diff options
author | John Rigby <john.rigby@linaro.org> | 2012-02-03 15:34:35 -0700 |
---|---|---|
committer | John Rigby <john.rigby@linaro.org> | 2012-04-23 07:48:47 -0600 |
commit | ed3b575946e33a2f5e8dbb8366671d0b1a623b4f (patch) | |
tree | 7850cd57fcde99989d12a24fe7f9e674ed8399fd /drivers | |
parent | d74b1a83ab2dfca7d2aa20a3143f2612f27e6bd5 (diff) |
MMC: arm_pl180_mmci: allow multiple devices
Signed-off-by: John Rigby <john.rigby@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/arm_pl180_mmci.c | 24 | ||||
-rw-r--r-- | drivers/mmc/arm_pl180_mmci.h | 2 |
2 files changed, 20 insertions, 6 deletions
diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c index 09d443ee3..877fd3011 100644 --- a/drivers/mmc/arm_pl180_mmci.c +++ b/drivers/mmc/arm_pl180_mmci.c @@ -360,12 +360,26 @@ err: * Set initial clock and power for mmc slot. * Initialize mmc struct and register with mmc framework. */ -static int arm_pl180_mmci_host_init(struct mmc *dev) +static int arm_pl180_mmci_host_init(int index, struct mmc *dev) { struct mmc_host *host = dev->priv; u32 sdi_u32; - host->base = (struct sdi_registers *)CONFIG_ARM_PL180_MMCI_BASE; + switch (index) { +#ifdef CONFIG_ARM_PL180_MMCI_BASE0 + case 0: + host->base = (struct sdi_registers *)CONFIG_ARM_PL180_MMCI_BASE0; + break; +#endif +#ifdef CONFIG_ARM_PL180_MMCI_BASE1 + case 1: + host->base = (struct sdi_registers *)CONFIG_ARM_PL180_MMCI_BASE1; + break; +#endif + default: + printf("Bad index in %s\n", __FUNCTION__); + return 1; + } /* Initially set power-on, full voltage & MMCI read */ sdi_u32 = INIT_PWR; @@ -394,7 +408,7 @@ static int arm_pl180_mmci_host_init(struct mmc *dev) return 0; } -int arm_pl180_mmci_init(void) +int arm_pl180_mmci_init(int index) { int error; struct mmc *dev; @@ -403,9 +417,9 @@ int arm_pl180_mmci_init(void) if (!dev) return -1; - error = arm_pl180_mmci_host_init(dev); + error = arm_pl180_mmci_host_init(index, dev); if (error) { - printf("mmci_host_init error - %d\n", error); + printf("mmci_host_init index %d error - %d\n", index, error); return -1; } diff --git a/drivers/mmc/arm_pl180_mmci.h b/drivers/mmc/arm_pl180_mmci.h index 42fbe3e38..43aef3481 100644 --- a/drivers/mmc/arm_pl180_mmci.h +++ b/drivers/mmc/arm_pl180_mmci.h @@ -26,7 +26,7 @@ #ifndef __ARM_PL180_MMCI_H__ #define __ARM_PL180_MMCI_H__ -int arm_pl180_mmci_init(void); +int arm_pl180_mmci_init(int); #define COMMAND_REG_DELAY 300 #define DATA_REG_DELAY 1000 |