| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Portions copyright (C) 2003 Russell King, PXA MMCI Driver |
|---|
| 3 | 4 | * Portions copyright (C) 2004-2005 Pierre Ossman, W83L51xD SD/MMC driver |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright 2008 Embedded Alley Solutions, Inc. |
|---|
| 6 | 7 | * 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. |
|---|
| 21 | 8 | */ |
|---|
| 22 | 9 | |
|---|
| 23 | 10 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 25 | 12 | #include <linux/ioport.h> |
|---|
| 26 | 13 | #include <linux/of.h> |
|---|
| 27 | 14 | #include <linux/of_device.h> |
|---|
| 28 | | -#include <linux/of_gpio.h> |
|---|
| 29 | 15 | #include <linux/platform_device.h> |
|---|
| 30 | 16 | #include <linux/delay.h> |
|---|
| 31 | 17 | #include <linux/interrupt.h> |
|---|
| 32 | 18 | #include <linux/dma-mapping.h> |
|---|
| 33 | 19 | #include <linux/dmaengine.h> |
|---|
| 20 | +#include <linux/dma/mxs-dma.h> |
|---|
| 34 | 21 | #include <linux/highmem.h> |
|---|
| 35 | 22 | #include <linux/clk.h> |
|---|
| 36 | 23 | #include <linux/err.h> |
|---|
| .. | .. |
|---|
| 39 | 26 | #include <linux/mmc/mmc.h> |
|---|
| 40 | 27 | #include <linux/mmc/sdio.h> |
|---|
| 41 | 28 | #include <linux/mmc/slot-gpio.h> |
|---|
| 42 | | -#include <linux/gpio.h> |
|---|
| 43 | 29 | #include <linux/regulator/consumer.h> |
|---|
| 44 | 30 | #include <linux/module.h> |
|---|
| 45 | 31 | #include <linux/stmp_device.h> |
|---|
| .. | .. |
|---|
| 281 | 267 | ssp->ssp_pio_words[2] = cmd1; |
|---|
| 282 | 268 | ssp->dma_dir = DMA_NONE; |
|---|
| 283 | 269 | 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); |
|---|
| 285 | 271 | if (!desc) |
|---|
| 286 | 272 | goto out; |
|---|
| 287 | 273 | |
|---|
| .. | .. |
|---|
| 326 | 312 | ssp->ssp_pio_words[2] = cmd1; |
|---|
| 327 | 313 | ssp->dma_dir = DMA_NONE; |
|---|
| 328 | 314 | 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); |
|---|
| 330 | 316 | if (!desc) |
|---|
| 331 | 317 | goto out; |
|---|
| 332 | 318 | |
|---|
| .. | .. |
|---|
| 456 | 442 | host->data = data; |
|---|
| 457 | 443 | ssp->dma_dir = dma_data_dir; |
|---|
| 458 | 444 | 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); |
|---|
| 460 | 446 | if (!desc) |
|---|
| 461 | 447 | goto out; |
|---|
| 462 | 448 | |
|---|
| .. | .. |
|---|
| 591 | 577 | struct device_node *np = pdev->dev.of_node; |
|---|
| 592 | 578 | struct mxs_mmc_host *host; |
|---|
| 593 | 579 | struct mmc_host *mmc; |
|---|
| 594 | | - struct resource *iores; |
|---|
| 595 | 580 | int ret = 0, irq_err; |
|---|
| 596 | 581 | struct regulator *reg_vmmc; |
|---|
| 597 | 582 | struct mxs_ssp *ssp; |
|---|
| .. | .. |
|---|
| 607 | 592 | host = mmc_priv(mmc); |
|---|
| 608 | 593 | ssp = &host->ssp; |
|---|
| 609 | 594 | 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); |
|---|
| 612 | 596 | if (IS_ERR(ssp->base)) { |
|---|
| 613 | 597 | ret = PTR_ERR(ssp->base); |
|---|
| 614 | 598 | goto out_mmc_free; |
|---|
| .. | .. |
|---|
| 649 | 633 | goto out_clk_disable; |
|---|
| 650 | 634 | } |
|---|
| 651 | 635 | |
|---|
| 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)) { |
|---|
| 654 | 638 | dev_err(mmc_dev(host->mmc), |
|---|
| 655 | 639 | "%s: failed to request dma\n", __func__); |
|---|
| 656 | | - ret = -ENODEV; |
|---|
| 640 | + ret = PTR_ERR(ssp->dmach); |
|---|
| 657 | 641 | goto out_clk_disable; |
|---|
| 658 | 642 | } |
|---|
| 659 | 643 | |
|---|
| .. | .. |
|---|
| 752 | 736 | .id_table = mxs_ssp_ids, |
|---|
| 753 | 737 | .driver = { |
|---|
| 754 | 738 | .name = DRIVER_NAME, |
|---|
| 739 | + .probe_type = PROBE_PREFER_ASYNCHRONOUS, |
|---|
| 755 | 740 | .pm = &mxs_mmc_pm_ops, |
|---|
| 756 | 741 | .of_match_table = mxs_mmc_dt_ids, |
|---|
| 757 | 742 | }, |
|---|