diff options
-rw-r--r-- | drivers/mmc/host/sh_mobile_sdhi.c | 32 | ||||
-rw-r--r-- | drivers/mmc/host/tmio_mmc_pio.c | 20 |
2 files changed, 44 insertions, 8 deletions
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index e0ca0abba0e5..06e1bc98c536 100644 --- a/drivers/mmc/host/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/mod_devicetable.h> | 24 | #include <linux/mod_devicetable.h> |
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/of_device.h> | ||
26 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
27 | #include <linux/mmc/host.h> | 28 | #include <linux/mmc/host.h> |
28 | #include <linux/mmc/sh_mobile_sdhi.h> | 29 | #include <linux/mmc/sh_mobile_sdhi.h> |
@@ -32,6 +33,16 @@ | |||
32 | 33 | ||
33 | #include "tmio_mmc.h" | 34 | #include "tmio_mmc.h" |
34 | 35 | ||
36 | struct sh_mobile_sdhi_of_data { | ||
37 | unsigned long tmio_flags; | ||
38 | }; | ||
39 | |||
40 | static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = { | ||
41 | { | ||
42 | .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, | ||
43 | }, | ||
44 | }; | ||
45 | |||
35 | struct sh_mobile_sdhi { | 46 | struct sh_mobile_sdhi { |
36 | struct clk *clk; | 47 | struct clk *clk; |
37 | struct tmio_mmc_data mmc_data; | 48 | struct tmio_mmc_data mmc_data; |
@@ -117,8 +128,18 @@ static const struct sh_mobile_sdhi_ops sdhi_ops = { | |||
117 | .cd_wakeup = sh_mobile_sdhi_cd_wakeup, | 128 | .cd_wakeup = sh_mobile_sdhi_cd_wakeup, |
118 | }; | 129 | }; |
119 | 130 | ||
131 | static const struct of_device_id sh_mobile_sdhi_of_match[] = { | ||
132 | { .compatible = "renesas,shmobile-sdhi" }, | ||
133 | { .compatible = "renesas,sh7372-sdhi" }, | ||
134 | { .compatible = "renesas,r8a7740-sdhi", .data = &sh_mobile_sdhi_of_cfg[0], }, | ||
135 | {}, | ||
136 | }; | ||
137 | MODULE_DEVICE_TABLE(of, sh_mobile_sdhi_of_match); | ||
138 | |||
120 | static int sh_mobile_sdhi_probe(struct platform_device *pdev) | 139 | static int sh_mobile_sdhi_probe(struct platform_device *pdev) |
121 | { | 140 | { |
141 | const struct of_device_id *of_id = | ||
142 | of_match_device(sh_mobile_sdhi_of_match, &pdev->dev); | ||
122 | struct sh_mobile_sdhi *priv; | 143 | struct sh_mobile_sdhi *priv; |
123 | struct tmio_mmc_data *mmc_data; | 144 | struct tmio_mmc_data *mmc_data; |
124 | struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; | 145 | struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; |
@@ -186,6 +207,11 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev) | |||
186 | */ | 207 | */ |
187 | mmc_data->flags |= TMIO_MMC_SDIO_IRQ; | 208 | mmc_data->flags |= TMIO_MMC_SDIO_IRQ; |
188 | 209 | ||
210 | if (of_id && of_id->data) { | ||
211 | const struct sh_mobile_sdhi_of_data *of_data = of_id->data; | ||
212 | mmc_data->flags |= of_data->tmio_flags; | ||
213 | } | ||
214 | |||
189 | ret = tmio_mmc_host_probe(&host, pdev, mmc_data); | 215 | ret = tmio_mmc_host_probe(&host, pdev, mmc_data); |
190 | if (ret < 0) | 216 | if (ret < 0) |
191 | goto eprobe; | 217 | goto eprobe; |
@@ -313,12 +339,6 @@ static const struct dev_pm_ops tmio_mmc_dev_pm_ops = { | |||
313 | .runtime_resume = tmio_mmc_host_runtime_resume, | 339 | .runtime_resume = tmio_mmc_host_runtime_resume, |
314 | }; | 340 | }; |
315 | 341 | ||
316 | static const struct of_device_id sh_mobile_sdhi_of_match[] = { | ||
317 | { .compatible = "renesas,shmobile-sdhi" }, | ||
318 | { } | ||
319 | }; | ||
320 | MODULE_DEVICE_TABLE(of, sh_mobile_sdhi_of_match); | ||
321 | |||
322 | static struct platform_driver sh_mobile_sdhi_driver = { | 342 | static struct platform_driver sh_mobile_sdhi_driver = { |
323 | .driver = { | 343 | .driver = { |
324 | .name = "sh_mobile_sdhi", | 344 | .name = "sh_mobile_sdhi", |
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index b25adb4160f5..e5b3fcf55c4c 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c | |||
@@ -918,6 +918,17 @@ static void tmio_mmc_init_ocr(struct tmio_mmc_host *host) | |||
918 | dev_warn(mmc_dev(mmc), "Platform OCR mask is ignored\n"); | 918 | dev_warn(mmc_dev(mmc), "Platform OCR mask is ignored\n"); |
919 | } | 919 | } |
920 | 920 | ||
921 | static void tmio_mmc_of_parse(struct platform_device *pdev, | ||
922 | struct tmio_mmc_data *pdata) | ||
923 | { | ||
924 | const struct device_node *np = pdev->dev.of_node; | ||
925 | if (!np) | ||
926 | return; | ||
927 | |||
928 | if (of_get_property(np, "toshiba,mmc-wrprotect-disable", NULL)) | ||
929 | pdata->flags |= TMIO_MMC_WRPROTECT_DISABLE; | ||
930 | } | ||
931 | |||
921 | int tmio_mmc_host_probe(struct tmio_mmc_host **host, | 932 | int tmio_mmc_host_probe(struct tmio_mmc_host **host, |
922 | struct platform_device *pdev, | 933 | struct platform_device *pdev, |
923 | struct tmio_mmc_data *pdata) | 934 | struct tmio_mmc_data *pdata) |
@@ -928,6 +939,8 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host, | |||
928 | int ret; | 939 | int ret; |
929 | u32 irq_mask = TMIO_MASK_CMD; | 940 | u32 irq_mask = TMIO_MASK_CMD; |
930 | 941 | ||
942 | tmio_mmc_of_parse(pdev, pdata); | ||
943 | |||
931 | if (!(pdata->flags & TMIO_MMC_HAS_IDLE_WAIT)) | 944 | if (!(pdata->flags & TMIO_MMC_HAS_IDLE_WAIT)) |
932 | pdata->write16_hook = NULL; | 945 | pdata->write16_hook = NULL; |
933 | 946 | ||
@@ -939,6 +952,8 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host, | |||
939 | if (!mmc) | 952 | if (!mmc) |
940 | return -ENOMEM; | 953 | return -ENOMEM; |
941 | 954 | ||
955 | mmc_of_parse(mmc); | ||
956 | |||
942 | pdata->dev = &pdev->dev; | 957 | pdata->dev = &pdev->dev; |
943 | _host = mmc_priv(mmc); | 958 | _host = mmc_priv(mmc); |
944 | _host->pdata = pdata; | 959 | _host->pdata = pdata; |
@@ -959,7 +974,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host, | |||
959 | } | 974 | } |
960 | 975 | ||
961 | mmc->ops = &tmio_mmc_ops; | 976 | mmc->ops = &tmio_mmc_ops; |
962 | mmc->caps = MMC_CAP_4_BIT_DATA | pdata->capabilities; | 977 | mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities; |
963 | mmc->caps2 = pdata->capabilities2; | 978 | mmc->caps2 = pdata->capabilities2; |
964 | mmc->max_segs = 32; | 979 | mmc->max_segs = 32; |
965 | mmc->max_blk_size = 512; | 980 | mmc->max_blk_size = 512; |
@@ -971,7 +986,8 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host, | |||
971 | 986 | ||
972 | _host->native_hotplug = !(pdata->flags & TMIO_MMC_USE_GPIO_CD || | 987 | _host->native_hotplug = !(pdata->flags & TMIO_MMC_USE_GPIO_CD || |
973 | mmc->caps & MMC_CAP_NEEDS_POLL || | 988 | mmc->caps & MMC_CAP_NEEDS_POLL || |
974 | mmc->caps & MMC_CAP_NONREMOVABLE); | 989 | mmc->caps & MMC_CAP_NONREMOVABLE || |
990 | mmc->slot.cd_irq >= 0); | ||
975 | 991 | ||
976 | _host->power = false; | 992 | _host->power = false; |
977 | pm_runtime_enable(&pdev->dev); | 993 | pm_runtime_enable(&pdev->dev); |