diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2019-01-30 14:55:50 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-02-06 08:46:39 +0100 |
commit | c98b43f5a081bdb849c4bca6565c3189e5f0466c (patch) | |
tree | 8d6b663715821cf799a68f1043a414c791530e68 /drivers | |
parent | 1ebee1e97ad43b4419e42d778d82059933405668 (diff) | |
download | barebox-c98b43f5a081bdb849c4bca6565c3189e5f0466c.tar.gz barebox-c98b43f5a081bdb849c4bca6565c3189e5f0466c.tar.xz |
mci: imx-esdhc: use dev_id
Avoid using cpu_is_* macros and use a dev_id instead. This will make it
easier to integrate the driver into another architecture.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mci/imx-esdhc.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c index a33d654f38..7ff431a66f 100644 --- a/drivers/mci/imx-esdhc.c +++ b/drivers/mci/imx-esdhc.c @@ -596,9 +596,6 @@ static int fsl_esdhc_detect(struct device_d *dev) return mci_detect_card(&host->mci); } -static struct esdhc_soc_data esdhc_imx25_data; -static struct esdhc_soc_data esdhc_imx53_data; - static int fsl_esdhc_probe(struct device_d *dev) { struct resource *iores; @@ -608,21 +605,16 @@ static int fsl_esdhc_probe(struct device_d *dev) int ret; unsigned long rate; struct esdhc_platform_data *pdata = dev->platform_data; + const struct esdhc_soc_data *socdata; + + ret = dev_get_drvdata(dev, (const void **)&socdata); + if (ret) + return ret; host = xzalloc(sizeof(*host)); + host->socdata = socdata; mci = &host->mci; - if (IS_ENABLED(CONFIG_OFDEVICE)) { - host->socdata = of_device_get_match_data(dev); - if (!host->socdata) - return -EINVAL; - } else { - if (cpu_is_mx50() || cpu_is_mx51() || cpu_is_mx53()) - host->socdata = &esdhc_imx53_data; - else - host->socdata = &esdhc_imx25_data; - } - dma_set_mask(dev, DMA_BIT_MASK(32)); host->clk = clk_get(dev, "per"); @@ -720,9 +712,22 @@ static __maybe_unused struct of_device_id fsl_esdhc_compatible[] = { { /* sentinel */ } }; +static struct platform_device_id imx_esdhc_ids[] = { + { + .name = "imx25-esdhc", + .driver_data = (unsigned long)&esdhc_imx25_data, + }, { + .name = "imx5-esdhc", + .driver_data = (unsigned long)&esdhc_imx53_data, + }, { + /* sentinel */ + } +}; + static struct driver_d fsl_esdhc_driver = { .name = "imx-esdhc", .probe = fsl_esdhc_probe, .of_compatible = DRV_OF_COMPAT(fsl_esdhc_compatible), + .id_table = imx_esdhc_ids, }; device_platform_driver(fsl_esdhc_driver); |