forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/mmc/host/mxs-mmc.c
....@@ -1,23 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Portions copyright (C) 2003 Russell King, PXA MMCI Driver
34 * Portions copyright (C) 2004-2005 Pierre Ossman, W83L51xD SD/MMC driver
45 *
56 * Copyright 2008 Embedded Alley Solutions, Inc.
67 * Copyright 2009-2011 Freescale Semiconductor, Inc.
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License along
19
- * with this program; if not, write to the Free Software Foundation, Inc.,
20
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
218 */
229
2310 #include <linux/kernel.h>
....@@ -25,12 +12,12 @@
2512 #include <linux/ioport.h>
2613 #include <linux/of.h>
2714 #include <linux/of_device.h>
28
-#include <linux/of_gpio.h>
2915 #include <linux/platform_device.h>
3016 #include <linux/delay.h>
3117 #include <linux/interrupt.h>
3218 #include <linux/dma-mapping.h>
3319 #include <linux/dmaengine.h>
20
+#include <linux/dma/mxs-dma.h>
3421 #include <linux/highmem.h>
3522 #include <linux/clk.h>
3623 #include <linux/err.h>
....@@ -39,7 +26,6 @@
3926 #include <linux/mmc/mmc.h>
4027 #include <linux/mmc/sdio.h>
4128 #include <linux/mmc/slot-gpio.h>
42
-#include <linux/gpio.h>
4329 #include <linux/regulator/consumer.h>
4430 #include <linux/module.h>
4531 #include <linux/stmp_device.h>
....@@ -281,7 +267,7 @@
281267 ssp->ssp_pio_words[2] = cmd1;
282268 ssp->dma_dir = DMA_NONE;
283269 ssp->slave_dirn = DMA_TRANS_NONE;
284
- desc = mxs_mmc_prep_dma(host, DMA_CTRL_ACK);
270
+ desc = mxs_mmc_prep_dma(host, MXS_DMA_CTRL_WAIT4END);
285271 if (!desc)
286272 goto out;
287273
....@@ -326,7 +312,7 @@
326312 ssp->ssp_pio_words[2] = cmd1;
327313 ssp->dma_dir = DMA_NONE;
328314 ssp->slave_dirn = DMA_TRANS_NONE;
329
- desc = mxs_mmc_prep_dma(host, DMA_CTRL_ACK);
315
+ desc = mxs_mmc_prep_dma(host, MXS_DMA_CTRL_WAIT4END);
330316 if (!desc)
331317 goto out;
332318
....@@ -456,7 +442,7 @@
456442 host->data = data;
457443 ssp->dma_dir = dma_data_dir;
458444 ssp->slave_dirn = slave_dirn;
459
- desc = mxs_mmc_prep_dma(host, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
445
+ desc = mxs_mmc_prep_dma(host, DMA_PREP_INTERRUPT | MXS_DMA_CTRL_WAIT4END);
460446 if (!desc)
461447 goto out;
462448
....@@ -591,7 +577,6 @@
591577 struct device_node *np = pdev->dev.of_node;
592578 struct mxs_mmc_host *host;
593579 struct mmc_host *mmc;
594
- struct resource *iores;
595580 int ret = 0, irq_err;
596581 struct regulator *reg_vmmc;
597582 struct mxs_ssp *ssp;
....@@ -607,8 +592,7 @@
607592 host = mmc_priv(mmc);
608593 ssp = &host->ssp;
609594 ssp->dev = &pdev->dev;
610
- iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
611
- ssp->base = devm_ioremap_resource(&pdev->dev, iores);
595
+ ssp->base = devm_platform_ioremap_resource(pdev, 0);
612596 if (IS_ERR(ssp->base)) {
613597 ret = PTR_ERR(ssp->base);
614598 goto out_mmc_free;
....@@ -649,11 +633,11 @@
649633 goto out_clk_disable;
650634 }
651635
652
- ssp->dmach = dma_request_slave_channel(&pdev->dev, "rx-tx");
653
- if (!ssp->dmach) {
636
+ ssp->dmach = dma_request_chan(&pdev->dev, "rx-tx");
637
+ if (IS_ERR(ssp->dmach)) {
654638 dev_err(mmc_dev(host->mmc),
655639 "%s: failed to request dma\n", __func__);
656
- ret = -ENODEV;
640
+ ret = PTR_ERR(ssp->dmach);
657641 goto out_clk_disable;
658642 }
659643
....@@ -752,6 +736,7 @@
752736 .id_table = mxs_ssp_ids,
753737 .driver = {
754738 .name = DRIVER_NAME,
739
+ .probe_type = PROBE_PREFER_ASYNCHRONOUS,
755740 .pm = &mxs_mmc_pm_ops,
756741 .of_match_table = mxs_mmc_dt_ids,
757742 },