mmc: sdhci_am654: Fix hard coded otap delay array size
authorFaiz Abbas <faiz_abbas@ti.com>
Wed, 23 Sep 2020 10:52:03 +0000 (16:22 +0530)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 28 Sep 2020 10:31:06 +0000 (12:31 +0200)
Change hard coded array size value to depend on struct timing_data
array size.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Link: https://lore.kernel.org/r/20200923105206.7988-4-faiz_abbas@ti.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci_am654.c

index a4c6d9d80e889718b9e1334ed0677d2027324780..9f3347bc3757e6cda121de521216e1dc695d91dc 100644 (file)
@@ -85,10 +85,30 @@ static struct regmap_config sdhci_am654_regmap_config = {
        .fast_io = true,
 };
 
+struct timing_data {
+       const char *binding;
+       u32 capability;
+};
+
+static const struct timing_data td[] = {
+       [MMC_TIMING_LEGACY] = {"ti,otap-del-sel-legacy", 0},
+       [MMC_TIMING_MMC_HS] = {"ti,otap-del-sel-mmc-hs", MMC_CAP_MMC_HIGHSPEED},
+       [MMC_TIMING_SD_HS]  = {"ti,otap-del-sel-sd-hs", MMC_CAP_SD_HIGHSPEED},
+       [MMC_TIMING_UHS_SDR12] = {"ti,otap-del-sel-sdr12", MMC_CAP_UHS_SDR12},
+       [MMC_TIMING_UHS_SDR25] = {"ti,otap-del-sel-sdr25", MMC_CAP_UHS_SDR25},
+       [MMC_TIMING_UHS_SDR50] = {"ti,otap-del-sel-sdr50", MMC_CAP_UHS_SDR50},
+       [MMC_TIMING_UHS_SDR104] = {"ti,otap-del-sel-sdr104",
+                                  MMC_CAP_UHS_SDR104},
+       [MMC_TIMING_UHS_DDR50] = {"ti,otap-del-sel-ddr50", MMC_CAP_UHS_DDR50},
+       [MMC_TIMING_MMC_DDR52] = {"ti,otap-del-sel-ddr52", MMC_CAP_DDR},
+       [MMC_TIMING_MMC_HS200] = {"ti,otap-del-sel-hs200", MMC_CAP2_HS200},
+       [MMC_TIMING_MMC_HS400] = {"ti,otap-del-sel-hs400", MMC_CAP2_HS400},
+};
+
 struct sdhci_am654_data {
        struct regmap *base;
        bool legacy_otapdly;
-       int otap_del_sel[11];
+       int otap_del_sel[ARRAY_SIZE(td)];
        int clkbuf_sel;
        int trm_icp;
        int drv_strength;
@@ -107,26 +127,6 @@ struct sdhci_am654_driver_data {
 #define DLL_CALIB      (1 << 4)
 };
 
-struct timing_data {
-       const char *binding;
-       u32 capability;
-};
-
-static const struct timing_data td[] = {
-       [MMC_TIMING_LEGACY] = {"ti,otap-del-sel-legacy", 0},
-       [MMC_TIMING_MMC_HS] = {"ti,otap-del-sel-mmc-hs", MMC_CAP_MMC_HIGHSPEED},
-       [MMC_TIMING_SD_HS]  = {"ti,otap-del-sel-sd-hs", MMC_CAP_SD_HIGHSPEED},
-       [MMC_TIMING_UHS_SDR12] = {"ti,otap-del-sel-sdr12", MMC_CAP_UHS_SDR12},
-       [MMC_TIMING_UHS_SDR25] = {"ti,otap-del-sel-sdr25", MMC_CAP_UHS_SDR25},
-       [MMC_TIMING_UHS_SDR50] = {"ti,otap-del-sel-sdr50", MMC_CAP_UHS_SDR50},
-       [MMC_TIMING_UHS_SDR104] = {"ti,otap-del-sel-sdr104",
-                                  MMC_CAP_UHS_SDR104},
-       [MMC_TIMING_UHS_DDR50] = {"ti,otap-del-sel-ddr50", MMC_CAP_UHS_DDR50},
-       [MMC_TIMING_MMC_DDR52] = {"ti,otap-del-sel-ddr52", MMC_CAP_DDR},
-       [MMC_TIMING_MMC_HS200] = {"ti,otap-del-sel-hs200", MMC_CAP2_HS200},
-       [MMC_TIMING_MMC_HS400] = {"ti,otap-del-sel-hs400", MMC_CAP2_HS400},
-};
-
 static void sdhci_am654_setup_dll(struct sdhci_host *host, unsigned int clock)
 {
        struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);