hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/mmc/host/mxcmmc.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/drivers/mmc/host/mxcmmc.c - Freescale i.MX MMCI driver
34 *
....@@ -10,11 +11,6 @@
1011 * Copyright (C) 2006 Pavel Pisa, PiKRON <ppisa@pikron.com>
1112 *
1213 * derived from pxamci.c by Russell King
13
- *
14
- * This program is free software; you can redistribute it and/or modify
15
- * it under the terms of the GNU General Public License version 2 as
16
- * published by the Free Software Foundation.
17
- *
1814 */
1915
2016 #include <linux/module.h>
....@@ -31,14 +27,12 @@
3127 #include <linux/delay.h>
3228 #include <linux/clk.h>
3329 #include <linux/io.h>
34
-#include <linux/gpio.h>
3530 #include <linux/regulator/consumer.h>
3631 #include <linux/dmaengine.h>
3732 #include <linux/types.h>
3833 #include <linux/of.h>
3934 #include <linux/of_device.h>
4035 #include <linux/of_dma.h>
41
-#include <linux/of_gpio.h>
4236 #include <linux/mmc/slot-gpio.h>
4337
4438 #include <asm/dma.h>
....@@ -720,7 +714,6 @@
720714 static irqreturn_t mxcmci_irq(int irq, void *devid)
721715 {
722716 struct mxcmci_host *host = devid;
723
- unsigned long flags;
724717 bool sdio_irq;
725718 u32 stat;
726719
....@@ -732,9 +725,9 @@
732725
733726 dev_dbg(mmc_dev(host->mmc), "%s: 0x%08x\n", __func__, stat);
734727
735
- spin_lock_irqsave(&host->lock, flags);
728
+ spin_lock(&host->lock);
736729 sdio_irq = (stat & STATUS_SDIO_INT_ACTIVE) && host->use_sdio;
737
- spin_unlock_irqrestore(&host->lock, flags);
730
+ spin_unlock(&host->lock);
738731
739732 if (mxcmci_use_dma(host) && (stat & (STATUS_WRITE_OP_DONE)))
740733 mxcmci_writel(host, STATUS_WRITE_OP_DONE, MMC_REG_STATUS);
....@@ -1017,10 +1010,8 @@
10171010
10181011 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
10191012 irq = platform_get_irq(pdev, 0);
1020
- if (irq < 0) {
1021
- dev_err(&pdev->dev, "failed to get IRQ: %d\n", irq);
1013
+ if (irq < 0)
10221014 return irq;
1023
- }
10241015
10251016 mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
10261017 if (!mmc)
....@@ -1130,7 +1121,16 @@
11301121 mxcmci_writel(host, host->default_irq_mask, MMC_REG_INT_CNTR);
11311122
11321123 if (!host->pdata) {
1133
- host->dma = dma_request_slave_channel(&pdev->dev, "rx-tx");
1124
+ host->dma = dma_request_chan(&pdev->dev, "rx-tx");
1125
+ if (IS_ERR(host->dma)) {
1126
+ if (PTR_ERR(host->dma) == -EPROBE_DEFER) {
1127
+ ret = -EPROBE_DEFER;
1128
+ goto out_clk_put;
1129
+ }
1130
+
1131
+ /* Ignore errors to fall back to PIO mode */
1132
+ host->dma = NULL;
1133
+ }
11341134 } else {
11351135 res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
11361136 if (res) {
....@@ -1167,7 +1167,9 @@
11671167
11681168 timer_setup(&host->watchdog, mxcmci_watchdog, 0);
11691169
1170
- mmc_add_host(mmc);
1170
+ ret = mmc_add_host(mmc);
1171
+ if (ret)
1172
+ goto out_free_dma;
11711173
11721174 return 0;
11731175