diff options
-rw-r--r-- | drivers/mmc/host/dw_mmc-exynos.c | 1 | ||||
-rw-r--r-- | drivers/mmc/host/dw_mmc-k3.c | 1 | ||||
-rw-r--r-- | drivers/mmc/host/dw_mmc-rockchip.c | 1 | ||||
-rw-r--r-- | drivers/mmc/host/dw_mmc-zx.c | 1 | ||||
-rw-r--r-- | drivers/mmc/host/dw_mmc.c | 9 | ||||
-rw-r--r-- | drivers/mmc/host/dw_mmc.h | 2 |
6 files changed, 14 insertions, 1 deletions
diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c index 35026795be28..fa41d9422d57 100644 --- a/drivers/mmc/host/dw_mmc-exynos.c +++ b/drivers/mmc/host/dw_mmc-exynos.c | |||
@@ -487,6 +487,7 @@ static unsigned long exynos_dwmmc_caps[4] = { | |||
487 | 487 | ||
488 | static const struct dw_mci_drv_data exynos_drv_data = { | 488 | static const struct dw_mci_drv_data exynos_drv_data = { |
489 | .caps = exynos_dwmmc_caps, | 489 | .caps = exynos_dwmmc_caps, |
490 | .num_caps = ARRAY_SIZE(exynos_dwmmc_caps), | ||
490 | .init = dw_mci_exynos_priv_init, | 491 | .init = dw_mci_exynos_priv_init, |
491 | .set_ios = dw_mci_exynos_set_ios, | 492 | .set_ios = dw_mci_exynos_set_ios, |
492 | .parse_dt = dw_mci_exynos_parse_dt, | 493 | .parse_dt = dw_mci_exynos_parse_dt, |
diff --git a/drivers/mmc/host/dw_mmc-k3.c b/drivers/mmc/host/dw_mmc-k3.c index 75ae5803b0db..89cdb3d533bb 100644 --- a/drivers/mmc/host/dw_mmc-k3.c +++ b/drivers/mmc/host/dw_mmc-k3.c | |||
@@ -210,6 +210,7 @@ static int dw_mci_hi6220_execute_tuning(struct dw_mci_slot *slot, u32 opcode) | |||
210 | 210 | ||
211 | static const struct dw_mci_drv_data hi6220_data = { | 211 | static const struct dw_mci_drv_data hi6220_data = { |
212 | .caps = dw_mci_hi6220_caps, | 212 | .caps = dw_mci_hi6220_caps, |
213 | .num_caps = ARRAY_SIZE(dw_mci_hi6220_caps), | ||
213 | .switch_voltage = dw_mci_hi6220_switch_voltage, | 214 | .switch_voltage = dw_mci_hi6220_switch_voltage, |
214 | .set_ios = dw_mci_hi6220_set_ios, | 215 | .set_ios = dw_mci_hi6220_set_ios, |
215 | .parse_dt = dw_mci_hi6220_parse_dt, | 216 | .parse_dt = dw_mci_hi6220_parse_dt, |
diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c index a3f1c2b30145..339295212935 100644 --- a/drivers/mmc/host/dw_mmc-rockchip.c +++ b/drivers/mmc/host/dw_mmc-rockchip.c | |||
@@ -319,6 +319,7 @@ static const struct dw_mci_drv_data rk2928_drv_data = { | |||
319 | 319 | ||
320 | static const struct dw_mci_drv_data rk3288_drv_data = { | 320 | static const struct dw_mci_drv_data rk3288_drv_data = { |
321 | .caps = dw_mci_rk3288_dwmmc_caps, | 321 | .caps = dw_mci_rk3288_dwmmc_caps, |
322 | .num_caps = ARRAY_SIZE(dw_mci_rk3288_dwmmc_caps), | ||
322 | .set_ios = dw_mci_rk3288_set_ios, | 323 | .set_ios = dw_mci_rk3288_set_ios, |
323 | .execute_tuning = dw_mci_rk3288_execute_tuning, | 324 | .execute_tuning = dw_mci_rk3288_execute_tuning, |
324 | .parse_dt = dw_mci_rk3288_parse_dt, | 325 | .parse_dt = dw_mci_rk3288_parse_dt, |
diff --git a/drivers/mmc/host/dw_mmc-zx.c b/drivers/mmc/host/dw_mmc-zx.c index d38e94ae2b85..c06b5393312f 100644 --- a/drivers/mmc/host/dw_mmc-zx.c +++ b/drivers/mmc/host/dw_mmc-zx.c | |||
@@ -195,6 +195,7 @@ static unsigned long zx_dwmmc_caps[3] = { | |||
195 | 195 | ||
196 | static const struct dw_mci_drv_data zx_drv_data = { | 196 | static const struct dw_mci_drv_data zx_drv_data = { |
197 | .caps = zx_dwmmc_caps, | 197 | .caps = zx_dwmmc_caps, |
198 | .num_caps = ARRAY_SIZE(zx_dwmmc_caps), | ||
198 | .execute_tuning = dw_mci_zx_execute_tuning, | 199 | .execute_tuning = dw_mci_zx_execute_tuning, |
199 | .prepare_hs400_tuning = dw_mci_zx_prepare_hs400_tuning, | 200 | .prepare_hs400_tuning = dw_mci_zx_prepare_hs400_tuning, |
200 | .parse_dt = dw_mci_zx_parse_dt, | 201 | .parse_dt = dw_mci_zx_parse_dt, |
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 4033cf96c7d7..a850f8d7d4b5 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -2804,8 +2804,15 @@ static int dw_mci_init_slot_caps(struct dw_mci_slot *slot) | |||
2804 | } else { | 2804 | } else { |
2805 | ctrl_id = to_platform_device(host->dev)->id; | 2805 | ctrl_id = to_platform_device(host->dev)->id; |
2806 | } | 2806 | } |
2807 | if (drv_data && drv_data->caps) | 2807 | |
2808 | if (drv_data && drv_data->caps) { | ||
2809 | if (ctrl_id >= drv_data->num_caps) { | ||
2810 | dev_err(host->dev, "invalid controller id %d\n", | ||
2811 | ctrl_id); | ||
2812 | return -EINVAL; | ||
2813 | } | ||
2808 | mmc->caps |= drv_data->caps[ctrl_id]; | 2814 | mmc->caps |= drv_data->caps[ctrl_id]; |
2815 | } | ||
2809 | 2816 | ||
2810 | if (host->pdata->caps2) | 2817 | if (host->pdata->caps2) |
2811 | mmc->caps2 = host->pdata->caps2; | 2818 | mmc->caps2 = host->pdata->caps2; |
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index e3124f06a47e..1424bd490dd1 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h | |||
@@ -543,6 +543,7 @@ struct dw_mci_slot { | |||
543 | /** | 543 | /** |
544 | * dw_mci driver data - dw-mshc implementation specific driver data. | 544 | * dw_mci driver data - dw-mshc implementation specific driver data. |
545 | * @caps: mmc subsystem specified capabilities of the controller(s). | 545 | * @caps: mmc subsystem specified capabilities of the controller(s). |
546 | * @num_caps: number of capabilities specified by @caps. | ||
546 | * @init: early implementation specific initialization. | 547 | * @init: early implementation specific initialization. |
547 | * @set_ios: handle bus specific extensions. | 548 | * @set_ios: handle bus specific extensions. |
548 | * @parse_dt: parse implementation specific device tree properties. | 549 | * @parse_dt: parse implementation specific device tree properties. |
@@ -554,6 +555,7 @@ struct dw_mci_slot { | |||
554 | */ | 555 | */ |
555 | struct dw_mci_drv_data { | 556 | struct dw_mci_drv_data { |
556 | unsigned long *caps; | 557 | unsigned long *caps; |
558 | u32 num_caps; | ||
557 | int (*init)(struct dw_mci *host); | 559 | int (*init)(struct dw_mci *host); |
558 | void (*set_ios)(struct dw_mci *host, struct mmc_ios *ios); | 560 | void (*set_ios)(struct dw_mci *host, struct mmc_ios *ios); |
559 | int (*parse_dt)(struct dw_mci *host); | 561 | int (*parse_dt)(struct dw_mci *host); |