Merge tag 'mmc-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 12 Jul 2019 01:11:21 +0000 (18:11 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 12 Jul 2019 01:11:21 +0000 (18:11 -0700)
Pull MMC updates from Ulf Hansson:
 "MMC core:
   - Let the dma map ops deal with bouncing and drop dma_max_pfn() from
     the dma-mapping interface for ARM
   - Convert the generic MMC DT doc to YAML schemas
   - Drop questionable support for powered-on re-init of SDIO cards at
     runtime resume and for SDIO HW reset
   - Prevent questionable re-init of powered-on removable SDIO cards at
     system resume
   - Cleanup and clarify some SDIO core code

  MMC host:
   - tmio: Make runtime PM enablement more flexible for variants
   - tmio/renesas_sdhi: Rename DT doc tmio_mmc.txt to renesas,sdhi.txt
     to clarify
   - sdhci-pci: Add support for Intel EHL
   - sdhci-pci-o2micro: Enable support for 8-bit bus
   - sdhci-msm: Prevent acquiring a mutex while holding a spin_lock
   - sdhci-of-esdhc: Improve clock management and tuning
   - sdhci_am654: Enable support for 4 and 8-bit bus on J721E
   - sdhci-sprd: Use pinctrl for a proper signal voltage switch
   - sdhci-sprd: Add support for HS400 enhanced strobe mode
   - sdhci-sprd: Enable PHY DLL and allow delay config to stabilize the
     clock
   - sdhci-sprd: Add support for optional gate clock
   - sunxi-mmc: Convert DT doc to YAML schemas
   - meson-gx: Add support for broken DRAM access for DMA

  MEMSTICK core:
   - Fixup error path of memstick_init()"

* tag 'mmc-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (52 commits)
  mmc: sdhci_am654: Add dependency on MMC_SDHCI_AM654
  mmc: alcor: remove a redundant greater or equal to zero comparison
  mmc: sdhci-msm: fix mutex while in spinlock
  mmc: sdhci_am654: Make some symbols static
  dma-mapping: remove dma_max_pfn
  mmc: core: let the dma map ops handle bouncing
  dt-binding: mmc: rename tmio_mmc.txt to renesas,sdhi.txt
  mmc: sdhci-sprd: Add pin control support for voltage switch
  dt-bindings: mmc: sprd: Add pinctrl support
  mmc: sdhci-sprd: Add start_signal_voltage_switch ops
  mmc: sdhci-pci: Add support for Intel EHL
  mmc: tmio: Use dma_max_mapping_size() instead of a workaround
  mmc: sdio: Drop unused in-parameter from mmc_sdio_init_card()
  mmc: sdio: Drop unused in-parameter to mmc_sdio_reinit_card()
  mmc: sdio: Don't re-initialize powered-on removable SDIO cards at resume
  mmc: sdio: Drop powered-on re-init at runtime resume and HW reset
  mmc: sdio: Move comment about re-initialization to mmc_sdio_reinit_card()
  mmc: sdio: Drop mmc_claim|release_host() in mmc_sdio_power_restore()
  mmc: sdio: Turn sdio_run_irqs() into static
  mmc: sdhci: Fix indenting on SDHCI_CTRL_8BITBUS
  ...

1  2 
drivers/memstick/core/memstick.c
drivers/mmc/core/debugfs.c
drivers/mmc/core/queue.c
drivers/mmc/host/android-goldfish.c
drivers/mmc/host/atmel-mci.c
drivers/mmc/host/meson-gx-mmc.c
drivers/mmc/host/s3cmci.c
drivers/mmc/host/s3cmci.h
include/linux/mmc/host.h

index 6cfb293396f2c4639c08bd11d5b0e744bef1d596,b1564cacd19e1b86dc26fabe945b4c892e5f4e40..693ee73eb2912c05abdbfbe4955757cc767c0731
@@@ -1,11 -1,15 +1,11 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   *  Sony MemoryStick support
   *
   *  Copyright (C) 2007 Alex Dubov <oakad@yahoo.com>
   *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
 - *
   * Special thanks to Carlos Corbacho for providing various MemoryStick cards
   * that made this driver possible.
 - *
   */
  
  #include <linux/memstick.h>
@@@ -625,13 -629,18 +625,18 @@@ static int __init memstick_init(void
                return -ENOMEM;
  
        rc = bus_register(&memstick_bus_type);
-       if (!rc)
-               rc = class_register(&memstick_host_class);
+       if (rc)
+               goto error_destroy_workqueue;
  
-       if (!rc)
-               return 0;
+       rc = class_register(&memstick_host_class);
+       if (rc)
+               goto error_bus_unregister;
+       return 0;
  
+ error_bus_unregister:
        bus_unregister(&memstick_bus_type);
+ error_destroy_workqueue:
        destroy_workqueue(workqueue);
  
        return rc;
index 2797771a5fa8b033cd6a8d0a28f3ea502cc2d2be,cc3be259bc427a3d77307f4f8a35f34695c8f01d..09e0c765946917e77517ac41cb0f114152abee70
@@@ -1,8 -1,11 +1,8 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   * Debugfs support for hosts and cards
   *
   * Copyright (C) 2008 Atmel Corporation
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
   */
  #include <linux/moduleparam.h>
  #include <linux/export.h>
@@@ -227,45 -230,21 +227,21 @@@ void mmc_add_host_debugfs(struct mmc_ho
        struct dentry *root;
  
        root = debugfs_create_dir(mmc_hostname(host), NULL);
-       if (IS_ERR(root))
-               /* Don't complain -- debugfs just isn't enabled */
-               return;
-       if (!root)
-               /* Complain -- debugfs is enabled, but it failed to
-                * create the directory. */
-               goto err_root;
        host->debugfs_root = root;
  
-       if (!debugfs_create_file("ios", S_IRUSR, root, host, &mmc_ios_fops))
-               goto err_node;
-       if (!debugfs_create_x32("caps", S_IRUSR, root, &host->caps))
-               goto err_node;
-       if (!debugfs_create_x32("caps2", S_IRUSR, root, &host->caps2))
-               goto err_node;
-       if (!debugfs_create_file("clock", S_IRUSR | S_IWUSR, root, host,
-                       &mmc_clock_fops))
-               goto err_node;
+       debugfs_create_file("ios", S_IRUSR, root, host, &mmc_ios_fops);
+       debugfs_create_x32("caps", S_IRUSR, root, &host->caps);
+       debugfs_create_x32("caps2", S_IRUSR, root, &host->caps2);
+       debugfs_create_file("clock", S_IRUSR | S_IWUSR, root, host,
+                           &mmc_clock_fops);
  
  #ifdef CONFIG_FAIL_MMC_REQUEST
        if (fail_request)
                setup_fault_attr(&fail_default_attr, fail_request);
        host->fail_mmc_request = fail_default_attr;
-       if (IS_ERR(fault_create_debugfs_attr("fail_mmc_request",
-                                            root,
-                                            &host->fail_mmc_request)))
-               goto err_node;
+       fault_create_debugfs_attr("fail_mmc_request", root,
+                                 &host->fail_mmc_request);
  #endif
-       return;
- err_node:
-       debugfs_remove_recursive(root);
-       host->debugfs_root = NULL;
- err_root:
-       dev_err(&host->class_dev, "failed to initialize debugfs\n");
  }
  
  void mmc_remove_host_debugfs(struct mmc_host *host)
@@@ -282,25 -261,9 +258,9 @@@ void mmc_add_card_debugfs(struct mmc_ca
                return;
  
        root = debugfs_create_dir(mmc_card_id(card), host->debugfs_root);
-       if (IS_ERR(root))
-               /* Don't complain -- debugfs just isn't enabled */
-               return;
-       if (!root)
-               /* Complain -- debugfs is enabled, but it failed to
-                * create the directory. */
-               goto err;
        card->debugfs_root = root;
  
-       if (!debugfs_create_x32("state", S_IRUSR, root, &card->state))
-               goto err;
-       return;
- err:
-       debugfs_remove_recursive(root);
-       card->debugfs_root = NULL;
-       dev_err(&card->dev, "failed to initialize debugfs\n");
+       debugfs_create_x32("state", S_IRUSR, root, &card->state);
  }
  
  void mmc_remove_card_debugfs(struct mmc_card *card)
diff --combined drivers/mmc/core/queue.c
index 3557d5c51141da7cec0d961947d54dbeec7390f4,4bf9cd881bd030e040539f1e1cf34f42f83e070c..e327f80ebe7048ea74ff70a67cfa0e350b15a0e0
@@@ -1,7 -1,11 +1,7 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   *  Copyright (C) 2003 Russell King, All Rights Reserved.
   *  Copyright 2006-2007 Pierre Ossman
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
 - *
   */
  #include <linux/slab.h>
  #include <linux/module.h>
@@@ -350,18 -354,15 +350,15 @@@ static const struct blk_mq_ops mmc_mq_o
  static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card)
  {
        struct mmc_host *host = card->host;
-       u64 limit = BLK_BOUNCE_HIGH;
        unsigned block_size = 512;
  
-       if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask)
-               limit = (u64)dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT;
        blk_queue_flag_set(QUEUE_FLAG_NONROT, mq->queue);
        blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, mq->queue);
        if (mmc_can_erase(card))
                mmc_queue_setup_discard(mq->queue, card);
  
-       blk_queue_bounce_limit(mq->queue, limit);
+       if (!mmc_dev(host)->dma_mask || !*mmc_dev(host)->dma_mask)
+               blk_queue_bounce_limit(mq->queue, BLK_BOUNCE_HIGH);
        blk_queue_max_hw_sectors(mq->queue,
                min(host->max_blk_count, host->max_req_size / 512));
        blk_queue_max_segments(mq->queue, host->max_segs);
index 11a208cfba04a2992343af7e7ed2b0fd845b0817,f6334c2a75bb0a8fef8b0c3f2b17770a34750cf0..914e17bab3bed56ad1baccb0554a0b56a130a63f
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   *  Copyright 2007, Google Inc.
   *  Copyright 2012, Intel Inc.
@@@ -8,6 -7,10 +8,6 @@@
   *  Written by Tuukka Tikkanen and Juha Yrjölä <juha.yrjola@nokia.com>
   *  Misc hacks here and there by Tony Lindgren <tony@atomide.com>
   *  Other hacks (DMA, SD, etc) by David Brownell
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
   */
  
  #include <linux/module.h>
@@@ -110,7 -113,6 +110,6 @@@ struct goldfish_mmc_host 
        struct mmc_request      *mrq;
        struct mmc_command      *cmd;
        struct mmc_data         *data;
-       struct mmc_host         *mmc;
        struct device           *dev;
        unsigned char           id; /* 16xx chips have 2 MMC blocks */
        void                    *virt_base;
@@@ -172,7 -174,7 +171,7 @@@ goldfish_mmc_start_command(struct goldf
                resptype = 3;
                break;
        default:
-               dev_err(mmc_dev(host->mmc),
+               dev_err(mmc_dev(mmc_from_priv(host)),
                        "Invalid response type: %04x\n", mmc_resp_type(cmd));
                break;
        }
@@@ -218,8 -220,8 +217,8 @@@ static void goldfish_mmc_xfer_done(stru
                                        data->sg->length);
                }
                host->data->bytes_xfered += data->sg->length;
-               dma_unmap_sg(mmc_dev(host->mmc), data->sg, host->sg_len,
-                            dma_data_dir);
+               dma_unmap_sg(mmc_dev(mmc_from_priv(host)), data->sg,
+                            host->sg_len, dma_data_dir);
        }
  
        host->data = NULL;
  
        if (!data->stop) {
                host->mrq = NULL;
-               mmc_request_done(host->mmc, data->mrq);
+               mmc_request_done(mmc_from_priv(host), data->mrq);
                return;
        }
  
@@@ -275,7 -277,7 +274,7 @@@ static void goldfish_mmc_cmd_done(struc
  
        if (host->data == NULL || cmd->error) {
                host->mrq = NULL;
-               mmc_request_done(host->mmc, cmd->mrq);
+               mmc_request_done(mmc_from_priv(host), cmd->mrq);
        }
  }
  
@@@ -310,7 -312,7 +309,7 @@@ static irqreturn_t goldfish_mmc_irq(in
                struct mmc_request *mrq = host->mrq;
                mrq->cmd->error = -ETIMEDOUT;
                host->mrq = NULL;
-               mmc_request_done(host->mmc, mrq);
+               mmc_request_done(mmc_from_priv(host), mrq);
        }
  
        if (end_command)
                u32 state = GOLDFISH_MMC_READ(host, MMC_STATE);
                pr_info("%s: Card detect now %d\n", __func__,
                        (state & MMC_STATE_INSERTED));
-               mmc_detect_change(host->mmc, 0);
+               mmc_detect_change(mmc_from_priv(host), 0);
        }
  
        if (!end_command && !end_transfer && !state_changed && !cmd_timeout) {
                status = GOLDFISH_MMC_READ(host, MMC_INT_STATUS);
-               dev_info(mmc_dev(host->mmc),"spurious irq 0x%04x\n", status);
+               dev_info(mmc_dev(mmc_from_priv(host)), "spurious irq 0x%04x\n",
+                        status);
                if (status != 0) {
                        GOLDFISH_MMC_WRITE(host, MMC_INT_STATUS, status);
                        GOLDFISH_MMC_WRITE(host, MMC_INT_ENABLE, 0);
@@@ -380,7 -383,7 +380,7 @@@ static void goldfish_mmc_prepare_data(s
  
        dma_data_dir = mmc_get_dma_dir(data);
  
-       host->sg_len = dma_map_sg(mmc_dev(host->mmc), data->sg,
+       host->sg_len = dma_map_sg(mmc_dev(mmc_from_priv(host)), data->sg,
                                  sg_len, dma_data_dir);
        host->dma_done = 0;
        host->dma_in_use = 1;
@@@ -458,7 -461,6 +458,6 @@@ static int goldfish_mmc_probe(struct pl
        }
  
        host = mmc_priv(mmc);
-       host->mmc = mmc;
  
        pr_err("mmc: Mapping %lX to %lX\n", (long)res->start, (long)res->end);
        host->reg_base = ioremap(res->start, resource_size(res));
  
        ret = device_create_file(&pdev->dev, &dev_attr_cover_switch);
        if (ret)
-               dev_warn(mmc_dev(host->mmc),
-                        "Unable to create sysfs attributes\n");
+               dev_warn(mmc_dev(mmc), "Unable to create sysfs attributes\n");
  
        GOLDFISH_MMC_WRITE(host, MMC_SET_BUFFER, host->phys_base);
        GOLDFISH_MMC_WRITE(host, MMC_INT_ENABLE,
@@@ -522,7 -523,7 +520,7 @@@ err_request_irq_failed
  dma_alloc_failed:
        iounmap(host->reg_base);
  ioremap_failed:
-       mmc_free_host(host->mmc);
+       mmc_free_host(mmc);
  err_alloc_host_failed:
        return ret;
  }
  static int goldfish_mmc_remove(struct platform_device *pdev)
  {
        struct goldfish_mmc_host *host = platform_get_drvdata(pdev);
+       struct mmc_host *mmc = mmc_from_priv(host);
  
        BUG_ON(host == NULL);
  
-       mmc_remove_host(host->mmc);
+       mmc_remove_host(mmc);
        free_irq(host->irq, host);
        dma_free_coherent(&pdev->dev, BUFFER_SIZE, host->virt_base, host->phys_base);
        iounmap(host->reg_base);
-       mmc_free_host(host->mmc);
+       mmc_free_host(mmc);
        return 0;
  }
  
index 392a1f87c638311bfe3ddb5047507061d5ce749a,e1f10c3fa1441d2f1e9d291fb374c8e167f2dc98..9ee0bc0ce6d0cac1f9d77c89ed7cc4d7ac4ae0c2
@@@ -1,8 -1,11 +1,8 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   * Atmel MultiMedia Card Interface driver
   *
   * Copyright (C) 2004-2008 Atmel Corporation
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
   */
  #include <linux/blkdev.h>
  #include <linux/clk.h>
@@@ -576,42 -579,18 +576,18 @@@ static void atmci_init_debugfs(struct a
        struct mmc_host         *mmc = slot->mmc;
        struct atmel_mci        *host = slot->host;
        struct dentry           *root;
-       struct dentry           *node;
  
        root = mmc->debugfs_root;
        if (!root)
                return;
  
-       node = debugfs_create_file("regs", S_IRUSR, root, host,
-                                  &atmci_regs_fops);
-       if (IS_ERR(node))
-               return;
-       if (!node)
-               goto err;
-       node = debugfs_create_file("req", S_IRUSR, root, slot,
-                                  &atmci_req_fops);
-       if (!node)
-               goto err;
-       node = debugfs_create_u32("state", S_IRUSR, root, (u32 *)&host->state);
-       if (!node)
-               goto err;
-       node = debugfs_create_x32("pending_events", S_IRUSR, root,
-                                    (u32 *)&host->pending_events);
-       if (!node)
-               goto err;
-       node = debugfs_create_x32("completed_events", S_IRUSR, root,
-                                    (u32 *)&host->completed_events);
-       if (!node)
-               goto err;
-       return;
- err:
-       dev_err(&mmc->class_dev, "failed to initialize debugfs for slot\n");
+       debugfs_create_file("regs", S_IRUSR, root, host, &atmci_regs_fops);
+       debugfs_create_file("req", S_IRUSR, root, slot, &atmci_req_fops);
+       debugfs_create_u32("state", S_IRUSR, root, (u32 *)&host->state);
+       debugfs_create_x32("pending_events", S_IRUSR, root,
+                          (u32 *)&host->pending_events);
+       debugfs_create_x32("completed_events", S_IRUSR, root,
+                          (u32 *)&host->completed_events);
  }
  
  #if defined(CONFIG_OF)
index fb842255de4941081591194192205c7c55518e5b,26f33431120e5c7e4f40dff273d4b1190d3000ea..037311db3551f2ec98318eaf1da1b4196b09da3a
@@@ -1,4 -1,4 +1,4 @@@
 -// SPDX-License-Identifier: GPL-2.0
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   * Amlogic SD/eMMC driver for the GX/S905 family SoCs
   *
  #define SD_EMMC_TXD 0x94
  #define SD_EMMC_LAST_REG SD_EMMC_TXD
  
+ #define SD_EMMC_SRAM_DATA_BUF_LEN 1536
+ #define SD_EMMC_SRAM_DATA_BUF_OFF 0x200
  #define SD_EMMC_CFG_BLK_SIZE 512 /* internal buffer max: 512 bytes */
  #define SD_EMMC_CFG_RESP_TIMEOUT 256 /* in clock cycles */
  #define SD_EMMC_CMD_TIMEOUT 1024 /* in ms */
@@@ -155,6 -158,8 +158,8 @@@ struct meson_host 
        unsigned long req_rate;
        bool ddr;
  
+       bool dram_access_quirk;
        struct pinctrl *pinctrl;
        struct pinctrl_state *pins_default;
        struct pinctrl_state *pins_clk_gate;
@@@ -219,11 -224,20 +224,20 @@@ static struct mmc_command *meson_mmc_ge
  static void meson_mmc_get_transfer_mode(struct mmc_host *mmc,
                                        struct mmc_request *mrq)
  {
+       struct meson_host *host = mmc_priv(mmc);
        struct mmc_data *data = mrq->data;
        struct scatterlist *sg;
        int i;
        bool use_desc_chain_mode = true;
  
+       /*
+        * When Controller DMA cannot directly access DDR memory, disable
+        * support for Chain Mode to directly use the internal SRAM using
+        * the bounce buffer mode.
+        */
+       if (host->dram_access_quirk)
+               return;
        /*
         * Broken SDIO with AP6255-based WiFi on Khadas VIM Pro has been
         * reported. For some strange reason this occurs in descriptor
@@@ -1036,6 -1050,10 +1050,10 @@@ static int meson_mmc_probe(struct platf
        host->dev = &pdev->dev;
        dev_set_drvdata(&pdev->dev, host);
  
+       /* The G12A SDIO Controller needs an SRAM bounce buffer */
+       host->dram_access_quirk = device_property_read_bool(&pdev->dev,
+                                       "amlogic,dram-access-quirk");
        /* Get regulators and the supported OCR mask */
        host->vqmmc_enabled = false;
        ret = mmc_regulator_get_supply(mmc);
                goto err_init_clk;
  
        mmc->caps |= MMC_CAP_CMD23;
-       mmc->max_blk_count = CMD_CFG_LENGTH_MASK;
+       if (host->dram_access_quirk) {
+               /* Limit to the available sram memory */
+               mmc->max_segs = SD_EMMC_SRAM_DATA_BUF_LEN / mmc->max_blk_size;
+               mmc->max_blk_count = mmc->max_segs;
+       } else {
+               mmc->max_blk_count = CMD_CFG_LENGTH_MASK;
+               mmc->max_segs = SD_EMMC_DESC_BUF_LEN /
+                               sizeof(struct sd_emmc_desc);
+       }
        mmc->max_req_size = mmc->max_blk_count * mmc->max_blk_size;
-       mmc->max_segs = SD_EMMC_DESC_BUF_LEN / sizeof(struct sd_emmc_desc);
        mmc->max_seg_size = mmc->max_req_size;
  
        /*
         */
        mmc->caps2 &= ~MMC_CAP2_HS400;
  
-       /* data bounce buffer */
-       host->bounce_buf_size = mmc->max_req_size;
-       host->bounce_buf =
-               dma_alloc_coherent(host->dev, host->bounce_buf_size,
-                                  &host->bounce_dma_addr, GFP_KERNEL);
-       if (host->bounce_buf == NULL) {
-               dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n");
-               ret = -ENOMEM;
-               goto err_free_irq;
+       if (host->dram_access_quirk) {
+               /*
+                * The MMC Controller embeds 1,5KiB of internal SRAM
+                * that can be used to be used as bounce buffer.
+                * In the case of the G12A SDIO controller, use these
+                * instead of the DDR memory
+                */
+               host->bounce_buf_size = SD_EMMC_SRAM_DATA_BUF_LEN;
+               host->bounce_buf = host->regs + SD_EMMC_SRAM_DATA_BUF_OFF;
+               host->bounce_dma_addr = res->start + SD_EMMC_SRAM_DATA_BUF_OFF;
+       } else {
+               /* data bounce buffer */
+               host->bounce_buf_size = mmc->max_req_size;
+               host->bounce_buf =
+                       dma_alloc_coherent(host->dev, host->bounce_buf_size,
+                                          &host->bounce_dma_addr, GFP_KERNEL);
+               if (host->bounce_buf == NULL) {
+                       dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n");
+                       ret = -ENOMEM;
+                       goto err_free_irq;
+               }
        }
  
        host->descs = dma_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
        return 0;
  
  err_bounce_buf:
-       dma_free_coherent(host->dev, host->bounce_buf_size,
-                         host->bounce_buf, host->bounce_dma_addr);
+       if (!host->dram_access_quirk)
+               dma_free_coherent(host->dev, host->bounce_buf_size,
+                                 host->bounce_buf, host->bounce_dma_addr);
  err_free_irq:
        free_irq(host->irq, host);
  err_init_clk:
@@@ -1195,8 -1233,10 +1233,10 @@@ static int meson_mmc_remove(struct plat
  
        dma_free_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
                          host->descs, host->descs_dma_addr);
-       dma_free_coherent(host->dev, host->bounce_buf_size,
-                         host->bounce_buf, host->bounce_dma_addr);
+       if (!host->dram_access_quirk)
+               dma_free_coherent(host->dev, host->bounce_buf_size,
+                                 host->bounce_buf, host->bounce_dma_addr);
  
        clk_disable_unprepare(host->mmc_clk);
        clk_disable_unprepare(host->core_clk);
index b1d3f828873248371b99e29b112be627b7f9f8ea,6a91db7ca5f14ee822d5ceb5141831b68a8627ac..ccc5f095775f36fb75683e867f026a3dc2053809
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   *  linux/drivers/mmc/s3cmci.h - Samsung S3C MCI driver
   *
@@@ -6,6 -5,10 +6,6 @@@
   *
   * Current driver maintained by Ben Dooks and Simtec Electronics
   *  Copyright (C) 2008 Simtec Electronics <ben-linux@fluff.org>
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
   */
  
  #include <linux/module.h>
@@@ -1449,33 -1452,18 +1449,18 @@@ DEFINE_SHOW_ATTRIBUTE(s3cmci_regs)
  static void s3cmci_debugfs_attach(struct s3cmci_host *host)
  {
        struct device *dev = &host->pdev->dev;
+       struct dentry *root;
  
-       host->debug_root = debugfs_create_dir(dev_name(dev), NULL);
-       if (IS_ERR(host->debug_root)) {
-               dev_err(dev, "failed to create debugfs root\n");
-               return;
-       }
-       host->debug_state = debugfs_create_file("state", 0444,
-                                               host->debug_root, host,
-                                               &s3cmci_state_fops);
-       if (IS_ERR(host->debug_state))
-               dev_err(dev, "failed to create debug state file\n");
-       host->debug_regs = debugfs_create_file("regs", 0444,
-                                              host->debug_root, host,
-                                              &s3cmci_regs_fops);
+       root = debugfs_create_dir(dev_name(dev), NULL);
+       host->debug_root = root;
  
-       if (IS_ERR(host->debug_regs))
-               dev_err(dev, "failed to create debug regs file\n");
+       debugfs_create_file("state", 0444, root, host, &s3cmci_state_fops);
+       debugfs_create_file("regs", 0444, root, host, &s3cmci_regs_fops);
  }
  
  static void s3cmci_debugfs_remove(struct s3cmci_host *host)
  {
-       debugfs_remove(host->debug_regs);
-       debugfs_remove(host->debug_state);
-       debugfs_remove(host->debug_root);
+       debugfs_remove_recursive(host->debug_root);
  }
  
  #else
index 7ca1d9d639c4b60f7f7956432fb2d816ad8d50b2,62cae53b42714350498364dc1ffb3d223f79fd9c..8b65d7ad9f97de1440698a1d5ccf319f48386e9b
@@@ -1,8 -1,11 +1,8 @@@
 +/* SPDX-License-Identifier: GPL-2.0-only */
  /*
   *  linux/drivers/mmc/s3cmci.h - Samsung S3C MCI driver
   *
   *  Copyright (C) 2004-2006 Thomas Kleffel, All Rights Reserved.
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
   */
  
  enum s3cmci_waitfor {
@@@ -67,8 -70,6 +67,6 @@@ struct s3cmci_host 
  
  #ifdef CONFIG_DEBUG_FS
        struct dentry           *debug_root;
-       struct dentry           *debug_state;
-       struct dentry           *debug_regs;
  #endif
  
  #ifdef CONFIG_ARM_S3C24XX_CPUFREQ
diff --combined include/linux/mmc/host.h
index 7ac3755444d3d5d6f27e246671258324429593c9,a9b12322c775a1419a83752fbd805c5c951f04da..4a351cb7f20fc884df8720f66f0be9691d9eb6d3
@@@ -1,7 -1,10 +1,7 @@@
 +/* SPDX-License-Identifier: GPL-2.0-only */
  /*
   *  linux/include/linux/mmc/host.h
   *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
 - *
   *  Host driver specific definitions.
   */
  #ifndef LINUX_MMC_HOST_H
@@@ -501,7 -504,6 +501,6 @@@ static inline void mmc_signal_sdio_irq(
                wake_up_process(host->sdio_irq_thread);
  }
  
- void sdio_run_irqs(struct mmc_host *host);
  void sdio_signal_irq(struct mmc_host *host);
  
  #ifdef CONFIG_REGULATOR