.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * linux/drivers/mmc/host/mxcmmc.c - Freescale i.MX MMCI driver |
---|
3 | 4 | * |
---|
.. | .. |
---|
10 | 11 | * Copyright (C) 2006 Pavel Pisa, PiKRON <ppisa@pikron.com> |
---|
11 | 12 | * |
---|
12 | 13 | * 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 | | - * |
---|
18 | 14 | */ |
---|
19 | 15 | |
---|
20 | 16 | #include <linux/module.h> |
---|
.. | .. |
---|
31 | 27 | #include <linux/delay.h> |
---|
32 | 28 | #include <linux/clk.h> |
---|
33 | 29 | #include <linux/io.h> |
---|
34 | | -#include <linux/gpio.h> |
---|
35 | 30 | #include <linux/regulator/consumer.h> |
---|
36 | 31 | #include <linux/dmaengine.h> |
---|
37 | 32 | #include <linux/types.h> |
---|
38 | 33 | #include <linux/of.h> |
---|
39 | 34 | #include <linux/of_device.h> |
---|
40 | 35 | #include <linux/of_dma.h> |
---|
41 | | -#include <linux/of_gpio.h> |
---|
42 | 36 | #include <linux/mmc/slot-gpio.h> |
---|
43 | 37 | |
---|
44 | 38 | #include <asm/dma.h> |
---|
.. | .. |
---|
720 | 714 | static irqreturn_t mxcmci_irq(int irq, void *devid) |
---|
721 | 715 | { |
---|
722 | 716 | struct mxcmci_host *host = devid; |
---|
723 | | - unsigned long flags; |
---|
724 | 717 | bool sdio_irq; |
---|
725 | 718 | u32 stat; |
---|
726 | 719 | |
---|
.. | .. |
---|
732 | 725 | |
---|
733 | 726 | dev_dbg(mmc_dev(host->mmc), "%s: 0x%08x\n", __func__, stat); |
---|
734 | 727 | |
---|
735 | | - spin_lock_irqsave(&host->lock, flags); |
---|
| 728 | + spin_lock(&host->lock); |
---|
736 | 729 | sdio_irq = (stat & STATUS_SDIO_INT_ACTIVE) && host->use_sdio; |
---|
737 | | - spin_unlock_irqrestore(&host->lock, flags); |
---|
| 730 | + spin_unlock(&host->lock); |
---|
738 | 731 | |
---|
739 | 732 | if (mxcmci_use_dma(host) && (stat & (STATUS_WRITE_OP_DONE))) |
---|
740 | 733 | mxcmci_writel(host, STATUS_WRITE_OP_DONE, MMC_REG_STATUS); |
---|
.. | .. |
---|
1017 | 1010 | |
---|
1018 | 1011 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
---|
1019 | 1012 | 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) |
---|
1022 | 1014 | return irq; |
---|
1023 | | - } |
---|
1024 | 1015 | |
---|
1025 | 1016 | mmc = mmc_alloc_host(sizeof(*host), &pdev->dev); |
---|
1026 | 1017 | if (!mmc) |
---|
.. | .. |
---|
1130 | 1121 | mxcmci_writel(host, host->default_irq_mask, MMC_REG_INT_CNTR); |
---|
1131 | 1122 | |
---|
1132 | 1123 | 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 | + } |
---|
1134 | 1134 | } else { |
---|
1135 | 1135 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
---|
1136 | 1136 | if (res) { |
---|
.. | .. |
---|
1244 | 1244 | .id_table = mxcmci_devtype, |
---|
1245 | 1245 | .driver = { |
---|
1246 | 1246 | .name = DRIVER_NAME, |
---|
| 1247 | + .probe_type = PROBE_PREFER_ASYNCHRONOUS, |
---|
1247 | 1248 | .pm = &mxcmci_pm_ops, |
---|
1248 | 1249 | .of_match_table = mxcmci_of_match, |
---|
1249 | 1250 | } |
---|