Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: sdhci-esdhc-imx: get rid of the uses of cpu_is_mx()

The patch removes all the uses of cpu_is_mx(). Instead, it utilizes
platform_device_id to distinguish the esdhc differences among SoCs.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: Chris Ball <cjb@laptop.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Chris Ball <cjb@laptop.org>

Shawn Guo 57ed3314 842afc02

+78 -27
+2 -2
arch/arm/mach-imx/clock-imx25.c
··· 302 302 _REGISTER_CLOCK("imx2-wdt.0", NULL, wdt_clk) 303 303 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 304 304 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) 305 - _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 306 - _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) 305 + _REGISTER_CLOCK("sdhci-esdhc-imx25.0", NULL, esdhc1_clk) 306 + _REGISTER_CLOCK("sdhci-esdhc-imx25.1", NULL, esdhc2_clk) 307 307 _REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk) 308 308 _REGISTER_CLOCK(NULL, "audmux", audmux_clk) 309 309 _REGISTER_CLOCK("flexcan.0", NULL, can1_clk)
+3 -3
arch/arm/mach-imx/clock-imx35.c
··· 458 458 _REGISTER_CLOCK("imx-epit.0", NULL, epit1_clk) 459 459 _REGISTER_CLOCK("imx-epit.1", NULL, epit2_clk) 460 460 _REGISTER_CLOCK(NULL, "esai", esai_clk) 461 - _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 462 - _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) 463 - _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_clk) 461 + _REGISTER_CLOCK("sdhci-esdhc-imx35.0", NULL, esdhc1_clk) 462 + _REGISTER_CLOCK("sdhci-esdhc-imx35.1", NULL, esdhc2_clk) 463 + _REGISTER_CLOCK("sdhci-esdhc-imx35.2", NULL, esdhc3_clk) 464 464 /* i.mx35 has the i.mx27 type fec */ 465 465 _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk) 466 466 _REGISTER_CLOCK(NULL, "gpio", gpio1_clk)
+8 -8
arch/arm/mach-mx5/clock-mx51-mx53.c
··· 1456 1456 _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk) 1457 1457 /* i.mx51 has the i.mx35 type cspi */ 1458 1458 _REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk) 1459 - _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 1460 - _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) 1461 - _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_clk) 1462 - _REGISTER_CLOCK("sdhci-esdhc-imx.3", NULL, esdhc4_clk) 1459 + _REGISTER_CLOCK("sdhci-esdhc-imx51.0", NULL, esdhc1_clk) 1460 + _REGISTER_CLOCK("sdhci-esdhc-imx51.1", NULL, esdhc2_clk) 1461 + _REGISTER_CLOCK("sdhci-esdhc-imx51.2", NULL, esdhc3_clk) 1462 + _REGISTER_CLOCK("sdhci-esdhc-imx51.3", NULL, esdhc4_clk) 1463 1463 _REGISTER_CLOCK(NULL, "cpu_clk", cpu_clk) 1464 1464 _REGISTER_CLOCK(NULL, "iim_clk", iim_clk) 1465 1465 _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk) ··· 1485 1485 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk) 1486 1486 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk) 1487 1487 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c3_mx53_clk) 1488 - _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 1489 - _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_mx53_clk) 1490 - _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_mx53_clk) 1491 - _REGISTER_CLOCK("sdhci-esdhc-imx.3", NULL, esdhc4_mx53_clk) 1492 1488 /* i.mx53 has the i.mx51 type ecspi */ 1493 1489 _REGISTER_CLOCK("imx51-ecspi.0", NULL, ecspi1_clk) 1494 1490 _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk) 1495 1491 /* i.mx53 has the i.mx25 type cspi */ 1496 1492 _REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk) 1493 + _REGISTER_CLOCK("sdhci-esdhc-imx53.0", NULL, esdhc1_clk) 1494 + _REGISTER_CLOCK("sdhci-esdhc-imx53.1", NULL, esdhc2_mx53_clk) 1495 + _REGISTER_CLOCK("sdhci-esdhc-imx53.2", NULL, esdhc3_mx53_clk) 1496 + _REGISTER_CLOCK("sdhci-esdhc-imx53.3", NULL, esdhc4_mx53_clk) 1497 1497 _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk) 1498 1498 _REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk) 1499 1499 _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
+2 -2
arch/arm/mach-mx5/mx51_efika.c
··· 260 260 }; 261 261 262 262 static struct regulator_consumer_supply vsd_consumers[] = { 263 - REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.0"), 264 - REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.1"), 263 + REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx51.0"), 264 + REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx51.1"), 265 265 }; 266 266 267 267 static struct regulator_consumer_supply pwgt1_consumer[] = {
+9 -8
arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c
··· 10 10 #include <mach/devices-common.h> 11 11 #include <mach/esdhc.h> 12 12 13 - #define imx_sdhci_esdhc_imx_data_entry_single(soc, _id, hwid) \ 13 + #define imx_sdhci_esdhc_imx_data_entry_single(soc, _devid, _id, hwid) \ 14 14 { \ 15 + .devid = _devid, \ 15 16 .id = _id, \ 16 17 .iobase = soc ## _ESDHC ## hwid ## _BASE_ADDR, \ 17 18 .irq = soc ## _INT_ESDHC ## hwid, \ 18 19 } 19 20 20 - #define imx_sdhci_esdhc_imx_data_entry(soc, id, hwid) \ 21 - [id] = imx_sdhci_esdhc_imx_data_entry_single(soc, id, hwid) 21 + #define imx_sdhci_esdhc_imx_data_entry(soc, devid, id, hwid) \ 22 + [id] = imx_sdhci_esdhc_imx_data_entry_single(soc, devid, id, hwid) 22 23 23 24 #ifdef CONFIG_SOC_IMX25 24 25 const struct imx_sdhci_esdhc_imx_data 25 26 imx25_sdhci_esdhc_imx_data[] __initconst = { 26 27 #define imx25_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 27 - imx_sdhci_esdhc_imx_data_entry(MX25, _id, _hwid) 28 + imx_sdhci_esdhc_imx_data_entry(MX25, "sdhci-esdhc-imx25", _id, _hwid) 28 29 imx25_sdhci_esdhc_imx_data_entry(0, 1), 29 30 imx25_sdhci_esdhc_imx_data_entry(1, 2), 30 31 }; ··· 35 34 const struct imx_sdhci_esdhc_imx_data 36 35 imx35_sdhci_esdhc_imx_data[] __initconst = { 37 36 #define imx35_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 38 - imx_sdhci_esdhc_imx_data_entry(MX35, _id, _hwid) 37 + imx_sdhci_esdhc_imx_data_entry(MX35, "sdhci-esdhc-imx35", _id, _hwid) 39 38 imx35_sdhci_esdhc_imx_data_entry(0, 1), 40 39 imx35_sdhci_esdhc_imx_data_entry(1, 2), 41 40 imx35_sdhci_esdhc_imx_data_entry(2, 3), ··· 46 45 const struct imx_sdhci_esdhc_imx_data 47 46 imx51_sdhci_esdhc_imx_data[] __initconst = { 48 47 #define imx51_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 49 - imx_sdhci_esdhc_imx_data_entry(MX51, _id, _hwid) 48 + imx_sdhci_esdhc_imx_data_entry(MX51, "sdhci-esdhc-imx51", _id, _hwid) 50 49 imx51_sdhci_esdhc_imx_data_entry(0, 1), 51 50 imx51_sdhci_esdhc_imx_data_entry(1, 2), 52 51 imx51_sdhci_esdhc_imx_data_entry(2, 3), ··· 58 57 const struct imx_sdhci_esdhc_imx_data 59 58 imx53_sdhci_esdhc_imx_data[] __initconst = { 60 59 #define imx53_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 61 - imx_sdhci_esdhc_imx_data_entry(MX53, _id, _hwid) 60 + imx_sdhci_esdhc_imx_data_entry(MX53, "sdhci-esdhc-imx53", _id, _hwid) 62 61 imx53_sdhci_esdhc_imx_data_entry(0, 1), 63 62 imx53_sdhci_esdhc_imx_data_entry(1, 2), 64 63 imx53_sdhci_esdhc_imx_data_entry(2, 3), ··· 94 93 if (!pdata) 95 94 pdata = &default_esdhc_pdata; 96 95 97 - return imx_add_platform_device("sdhci-esdhc-imx", data->id, res, 96 + return imx_add_platform_device(data->devid, data->id, res, 98 97 ARRAY_SIZE(res), pdata, sizeof(*pdata)); 99 98 }
+1
arch/arm/plat-mxc/include/mach/devices-common.h
··· 277 277 278 278 #include <mach/esdhc.h> 279 279 struct imx_sdhci_esdhc_imx_data { 280 + const char *devid; 280 281 int id; 281 282 resource_size_t iobase; 282 283 resource_size_t irq;
+53 -4
drivers/mmc/host/sdhci-esdhc-imx.c
··· 20 20 #include <linux/mmc/host.h> 21 21 #include <linux/mmc/mmc.h> 22 22 #include <linux/mmc/sdio.h> 23 - #include <mach/hardware.h> 24 23 #include <mach/esdhc.h> 25 24 #include "sdhci-pltfm.h" 26 25 #include "sdhci-esdhc.h" ··· 41 42 */ 42 43 #define ESDHC_FLAG_MULTIBLK_NO_INT (1 << 1) 43 44 45 + enum imx_esdhc_type { 46 + IMX25_ESDHC, 47 + IMX35_ESDHC, 48 + IMX51_ESDHC, 49 + IMX53_ESDHC, 50 + }; 51 + 44 52 struct pltfm_imx_data { 45 53 int flags; 46 54 u32 scratchpad; 55 + enum imx_esdhc_type devtype; 47 56 struct esdhc_platform_data boarddata; 48 57 }; 58 + 59 + static struct platform_device_id imx_esdhc_devtype[] = { 60 + { 61 + .name = "sdhci-esdhc-imx25", 62 + .driver_data = IMX25_ESDHC, 63 + }, { 64 + .name = "sdhci-esdhc-imx35", 65 + .driver_data = IMX35_ESDHC, 66 + }, { 67 + .name = "sdhci-esdhc-imx51", 68 + .driver_data = IMX51_ESDHC, 69 + }, { 70 + .name = "sdhci-esdhc-imx53", 71 + .driver_data = IMX53_ESDHC, 72 + }, { 73 + /* sentinel */ 74 + } 75 + }; 76 + MODULE_DEVICE_TABLE(platform, imx_esdhc_devtype); 77 + 78 + static inline int is_imx25_esdhc(struct pltfm_imx_data *data) 79 + { 80 + return data->devtype == IMX25_ESDHC; 81 + } 82 + 83 + static inline int is_imx35_esdhc(struct pltfm_imx_data *data) 84 + { 85 + return data->devtype == IMX35_ESDHC; 86 + } 87 + 88 + static inline int is_imx51_esdhc(struct pltfm_imx_data *data) 89 + { 90 + return data->devtype == IMX51_ESDHC; 91 + } 92 + 93 + static inline int is_imx53_esdhc(struct pltfm_imx_data *data) 94 + { 95 + return data->devtype == IMX53_ESDHC; 96 + } 49 97 50 98 static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, int reg) 51 99 { ··· 308 262 imx_data = kzalloc(sizeof(struct pltfm_imx_data), GFP_KERNEL); 309 263 if (!imx_data) 310 264 return -ENOMEM; 265 + 266 + imx_data->devtype = pdev->id_entry->driver_data; 311 267 pltfm_host->priv = imx_data; 312 268 313 269 clk = clk_get(mmc_dev(host->mmc), NULL); ··· 321 273 clk_enable(clk); 322 274 pltfm_host->clk = clk; 323 275 324 - if (!cpu_is_mx25()) 276 + if (!is_imx25_esdhc(imx_data)) 325 277 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; 326 278 327 - if (cpu_is_mx25() || cpu_is_mx35()) 279 + if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) 328 280 /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ 329 281 host->quirks |= SDHCI_QUIRK_NO_MULTIBLOCK; 330 282 331 - if (!(cpu_is_mx25() || cpu_is_mx35() || cpu_is_mx51())) 283 + if (is_imx53_esdhc(imx_data)) 332 284 imx_data->flags |= ESDHC_FLAG_MULTIBLK_NO_INT; 333 285 334 286 if (!host->mmc->parent->platform_data) { ··· 443 395 .name = "sdhci-esdhc-imx", 444 396 .owner = THIS_MODULE, 445 397 }, 398 + .id_table = imx_esdhc_devtype, 446 399 .probe = sdhci_esdhc_imx_probe, 447 400 .remove = __devexit_p(sdhci_esdhc_imx_remove), 448 401 #ifdef CONFIG_PM