summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Lin <shawn.lin@rock-chips.com>2016-01-21 01:52:52 -0500
committerUlf Hansson <ulf.hansson@linaro.org>2016-02-29 05:03:10 -0500
commite8cc37b8fc3a94d17a2689cd77a7744d70477c14 (patch)
treedc5224ec6c0f10655f334d9d8a486f4936b2c774
parent13c3d4740216c4931fce1e764b9a76dd55c2da23 (diff)
mmc: dw_mmc: remove DW_MCI_QUIRK_BROKEN_CARD_DETECTION quirk
dw_mmc already use mmc_of_parse to get "broken-cd" property, but it considered "broken-cd" to be a quirk in its driver. We don't need this quirk here, and just take what we need from mmc->caps. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Tested-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/host/dw_mmc.c35
-rw-r--r--include/linux/mmc/dw_mmc.h4
2 files changed, 11 insertions, 28 deletions
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 6ad9ebf1faef..8cb8c1c8b3dd 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1447,12 +1447,11 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
1447{ 1447{
1448 int present; 1448 int present;
1449 struct dw_mci_slot *slot = mmc_priv(mmc); 1449 struct dw_mci_slot *slot = mmc_priv(mmc);
1450 struct dw_mci_board *brd = slot->host->pdata;
1451 struct dw_mci *host = slot->host; 1450 struct dw_mci *host = slot->host;
1452 int gpio_cd = mmc_gpio_get_cd(mmc); 1451 int gpio_cd = mmc_gpio_get_cd(mmc);
1453 1452
1454 /* Use platform get_cd function, else try onboard card detect */ 1453 /* Use platform get_cd function, else try onboard card detect */
1455 if ((brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION) || 1454 if ((mmc->caps & MMC_CAP_NEEDS_POLL) ||
1456 (mmc->caps & MMC_CAP_NONREMOVABLE)) 1455 (mmc->caps & MMC_CAP_NONREMOVABLE))
1457 present = 1; 1456 present = 1;
1458 else if (!IS_ERR_VALUE(gpio_cd)) 1457 else if (!IS_ERR_VALUE(gpio_cd))
@@ -2866,23 +2865,13 @@ static void dw_mci_dto_timer(unsigned long arg)
2866} 2865}
2867 2866
2868#ifdef CONFIG_OF 2867#ifdef CONFIG_OF
2869static struct dw_mci_of_quirks {
2870 char *quirk;
2871 int id;
2872} of_quirks[] = {
2873 {
2874 .quirk = "broken-cd",
2875 .id = DW_MCI_QUIRK_BROKEN_CARD_DETECTION,
2876 },
2877};
2878
2879static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host) 2868static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
2880{ 2869{
2881 struct dw_mci_board *pdata; 2870 struct dw_mci_board *pdata;
2882 struct device *dev = host->dev; 2871 struct device *dev = host->dev;
2883 struct device_node *np = dev->of_node; 2872 struct device_node *np = dev->of_node;
2884 const struct dw_mci_drv_data *drv_data = host->drv_data; 2873 const struct dw_mci_drv_data *drv_data = host->drv_data;
2885 int idx, ret; 2874 int ret;
2886 u32 clock_frequency; 2875 u32 clock_frequency;
2887 2876
2888 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); 2877 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
@@ -2897,11 +2886,6 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
2897 pdata->num_slots = 1; 2886 pdata->num_slots = 1;
2898 } 2887 }
2899 2888
2900 /* get quirks */
2901 for (idx = 0; idx < ARRAY_SIZE(of_quirks); idx++)
2902 if (of_get_property(np, of_quirks[idx].quirk, NULL))
2903 pdata->quirks |= of_quirks[idx].id;
2904
2905 if (of_property_read_u32(np, "fifo-depth", &pdata->fifo_depth)) 2889 if (of_property_read_u32(np, "fifo-depth", &pdata->fifo_depth))
2906 dev_info(dev, 2890 dev_info(dev,
2907 "fifo-depth property not found, using value of FIFOTH register as default\n"); 2891 "fifo-depth property not found, using value of FIFOTH register as default\n");
@@ -2934,18 +2918,19 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
2934 2918
2935static void dw_mci_enable_cd(struct dw_mci *host) 2919static void dw_mci_enable_cd(struct dw_mci *host)
2936{ 2920{
2937 struct dw_mci_board *brd = host->pdata;
2938 unsigned long irqflags; 2921 unsigned long irqflags;
2939 u32 temp; 2922 u32 temp;
2940 int i; 2923 int i;
2924 struct dw_mci_slot *slot;
2941 2925
2942 /* No need for CD if broken card detection */ 2926 /*
2943 if (brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION) 2927 * No need for CD if all slots have a non-error GPIO
2944 return; 2928 * as well as broken card detection is found.
2945 2929 */
2946 /* No need for CD if all slots have a non-error GPIO */
2947 for (i = 0; i < host->num_slots; i++) { 2930 for (i = 0; i < host->num_slots; i++) {
2948 struct dw_mci_slot *slot = host->slot[i]; 2931 slot = host->slot[i];
2932 if (slot->mmc->caps & MMC_CAP_NEEDS_POLL)
2933 return;
2949 2934
2950 if (IS_ERR_VALUE(mmc_gpio_get_cd(slot->mmc))) 2935 if (IS_ERR_VALUE(mmc_gpio_get_cd(slot->mmc)))
2951 break; 2936 break;
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index e1f90b80b77a..7b41c6db1bb6 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -235,10 +235,8 @@ struct dw_mci_dma_ops {
235}; 235};
236 236
237/* IP Quirks/flags. */ 237/* IP Quirks/flags. */
238/* Unreliable card detection */
239#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(0)
240/* Timer for broken data transfer over scheme */ 238/* Timer for broken data transfer over scheme */
241#define DW_MCI_QUIRK_BROKEN_DTO BIT(1) 239#define DW_MCI_QUIRK_BROKEN_DTO BIT(0)
242 240
243struct dma_pdata; 241struct dma_pdata;
244 242