ARM omap / mci: Fix register offsets
Only the OMAP4 has a register offset of 0x100 in the register space. Fix this by using the device id mechanism. This became broken when the device register convenience functions were introduced. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
d43bcb9987
commit
04cb446c9a
|
@ -26,7 +26,8 @@ static inline struct device_d *am33xx_add_uart2(void)
|
|||
|
||||
static inline struct device_d *am33xx_add_mmc0(struct omap_hsmmc_platform_data *pdata)
|
||||
{
|
||||
return omap_add_mmc(0, AM33XX_MMCHS0_BASE, pdata);
|
||||
return add_generic_device("omap3-hsmmc", 0, NULL,
|
||||
AM33XX_MMCHS0_BASE, SZ_4K, IORESOURCE_MEM, pdata);
|
||||
}
|
||||
|
||||
#endif /* __MACH_OMAP3_DEVICES_H */
|
||||
|
|
|
@ -9,9 +9,6 @@ void omap_add_sram0(resource_size_t base, resource_size_t size);
|
|||
|
||||
struct device_d *omap_add_uart(int id, unsigned long base);
|
||||
|
||||
struct device_d *omap_add_mmc(int id, unsigned long base,
|
||||
struct omap_hsmmc_platform_data *pdata);
|
||||
|
||||
struct device_d *omap_add_i2c(int id, unsigned long base, void *pdata);
|
||||
|
||||
#endif /* __MACH_OMAP_DEVICES_H */
|
||||
|
|
|
@ -59,17 +59,20 @@ static inline struct device_d *omap3_add_uart3(void)
|
|||
|
||||
static inline struct device_d *omap3_add_mmc1(struct omap_hsmmc_platform_data *pdata)
|
||||
{
|
||||
return omap_add_mmc(0, OMAP3_MMC1_BASE, pdata);
|
||||
return add_generic_device("omap3-hsmmc", 0, NULL,
|
||||
OMAP3_MMC1_BASE, SZ_4K, IORESOURCE_MEM, pdata);
|
||||
}
|
||||
|
||||
static inline struct device_d *omap3_add_mmc2(struct omap_hsmmc_platform_data *pdata)
|
||||
{
|
||||
return omap_add_mmc(1, OMAP3_MMC2_BASE, pdata);
|
||||
return add_generic_device("omap3-hsmmc", 1, NULL,
|
||||
OMAP3_MMC2_BASE, SZ_4K, IORESOURCE_MEM, pdata);
|
||||
}
|
||||
|
||||
static inline struct device_d *omap3_add_mmc3(struct omap_hsmmc_platform_data *pdata)
|
||||
{
|
||||
return omap_add_mmc(2, OMAP3_MMC3_BASE, pdata);
|
||||
return add_generic_device("omap3-hsmmc", 2, NULL,
|
||||
OMAP3_MMC3_BASE, SZ_4K, IORESOURCE_MEM, pdata);
|
||||
}
|
||||
|
||||
static inline struct device_d *omap3_add_i2c1(void *pdata)
|
||||
|
|
|
@ -30,27 +30,32 @@ static inline struct device_d *omap44xx_add_uart3(void)
|
|||
|
||||
static inline struct device_d *omap44xx_add_mmc1(struct omap_hsmmc_platform_data *pdata)
|
||||
{
|
||||
return omap_add_mmc(0, OMAP44XX_MMC1_BASE, pdata);
|
||||
return add_generic_device("omap4-hsmmc", 0, NULL,
|
||||
OMAP44XX_MMC1_BASE, SZ_4K, IORESOURCE_MEM, pdata);
|
||||
}
|
||||
|
||||
static inline struct device_d *omap44xx_add_mmc2(struct omap_hsmmc_platform_data *pdata)
|
||||
{
|
||||
return omap_add_mmc(1, OMAP44XX_MMC2_BASE, pdata);
|
||||
return add_generic_device("omap4-hsmmc", 1, NULL,
|
||||
OMAP44XX_MMC2_BASE, SZ_4K, IORESOURCE_MEM, pdata);
|
||||
}
|
||||
|
||||
static inline struct device_d *omap44xx_add_mmc3(struct omap_hsmmc_platform_data *pdata)
|
||||
{
|
||||
return omap_add_mmc(2, OMAP44XX_MMC3_BASE, pdata);
|
||||
return add_generic_device("omap4-hsmmc", 2, NULL,
|
||||
OMAP44XX_MMC3_BASE, SZ_4K, IORESOURCE_MEM, pdata);
|
||||
}
|
||||
|
||||
static inline struct device_d *omap44xx_add_mmc4(struct omap_hsmmc_platform_data *pdata)
|
||||
{
|
||||
return omap_add_mmc(3, OMAP44XX_MMC4_BASE, pdata);
|
||||
return add_generic_device("omap4-hsmmc", 3, NULL,
|
||||
OMAP44XX_MMC4_BASE, SZ_4K, IORESOURCE_MEM, pdata);
|
||||
}
|
||||
|
||||
static inline struct device_d *omap44xx_add_mmc5(struct omap_hsmmc_platform_data *pdata)
|
||||
{
|
||||
return omap_add_mmc(4, OMAP44XX_MMC5_BASE, pdata);
|
||||
return add_generic_device("omap4-hsmmc", 4, NULL,
|
||||
OMAP44XX_MMC5_BASE, SZ_4K, IORESOURCE_MEM, pdata);
|
||||
}
|
||||
|
||||
static inline struct device_d *omap44xx_add_i2c1(void *pdata)
|
||||
|
|
|
@ -25,13 +25,6 @@ struct device_d *omap_add_uart(int id, unsigned long base)
|
|||
IORESOURCE_MEM_8BIT, &serial_plat);
|
||||
}
|
||||
|
||||
struct device_d *omap_add_mmc(int id, unsigned long base,
|
||||
struct omap_hsmmc_platform_data *pdata)
|
||||
{
|
||||
return add_generic_device("omap-hsmmc", id, NULL,
|
||||
base, SZ_4K, IORESOURCE_MEM, pdata);
|
||||
}
|
||||
|
||||
struct device_d *omap_add_i2c(int id, unsigned long base, void *pdata)
|
||||
{
|
||||
return add_generic_device("i2c-omap", id, NULL, base, SZ_4K,
|
||||
|
|
|
@ -59,6 +59,18 @@ struct hsmmc {
|
|||
unsigned int capa; /* 0x140 */
|
||||
};
|
||||
|
||||
struct omap_mmc_driver_data {
|
||||
unsigned long reg_ofs;
|
||||
};
|
||||
|
||||
static struct omap_mmc_driver_data omap3_data = {
|
||||
.reg_ofs = 0,
|
||||
};
|
||||
|
||||
static struct omap_mmc_driver_data omap4_data = {
|
||||
.reg_ofs = 0x100,
|
||||
};
|
||||
|
||||
/*
|
||||
* OMAP HS MMC Bit definitions
|
||||
*/
|
||||
|
@ -566,6 +578,13 @@ static int omap_mmc_probe(struct device_d *dev)
|
|||
{
|
||||
struct omap_hsmmc *hsmmc;
|
||||
struct omap_hsmmc_platform_data *pdata;
|
||||
struct omap_mmc_driver_data *drvdata;
|
||||
unsigned long reg_ofs = 0;
|
||||
int ret;
|
||||
|
||||
ret = dev_get_drvdata(dev, (unsigned long *)&drvdata);
|
||||
if (!ret)
|
||||
reg_ofs = drvdata->reg_ofs;
|
||||
|
||||
hsmmc = xzalloc(sizeof(*hsmmc));
|
||||
|
||||
|
@ -577,7 +596,7 @@ static int omap_mmc_probe(struct device_d *dev)
|
|||
hsmmc->mci.hw_dev = dev;
|
||||
|
||||
hsmmc->iobase = dev_request_mem_region(dev, 0);
|
||||
hsmmc->base = hsmmc->iobase + 0x100;
|
||||
hsmmc->base = hsmmc->iobase + reg_ofs;
|
||||
|
||||
hsmmc->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
|
||||
|
||||
|
@ -594,9 +613,22 @@ static int omap_mmc_probe(struct device_d *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_device_id omap_mmc_ids[] = {
|
||||
{
|
||||
.name = "omap3-hsmmc",
|
||||
.driver_data = (unsigned long)&omap3_data,
|
||||
}, {
|
||||
.name = "omap4-hsmmc",
|
||||
.driver_data = (unsigned long)&omap4_data,
|
||||
}, {
|
||||
/* sentinel */
|
||||
},
|
||||
};
|
||||
|
||||
static struct driver_d omap_mmc_driver = {
|
||||
.name = "omap-hsmmc",
|
||||
.probe = omap_mmc_probe,
|
||||
.id_table = omap_mmc_ids,
|
||||
};
|
||||
|
||||
static int omap_mmc_init_driver(void)
|
||||
|
|
Loading…
Reference in New Issue