diff options
author | Feng Tang <feng.tang@intel.com> | 2008-01-07 01:29:02 -0500 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2008-02-08 03:02:47 -0500 |
commit | 541ceb5b8b4a90f7862ef24e4058fce520247827 (patch) | |
tree | 4c2c2d391ef570fc9705e014a37dbc35f4c51a1d /drivers/mmc | |
parent | 11b295c8b2934e1a9275961418e2c4f46ee674ac (diff) |
sdhci: add num index for multi controllers case
Some devices have several controllers; need add the index info to
device slot name host->slot_desc[]
Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/sdhci.c | 13 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci.h | 1 |
2 files changed, 13 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 785bbdcf4a58..4b673aa2dc3c 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -30,6 +30,10 @@ | |||
30 | 30 | ||
31 | static unsigned int debug_quirks = 0; | 31 | static unsigned int debug_quirks = 0; |
32 | 32 | ||
33 | /* For multi controllers in one platform case */ | ||
34 | static u16 chip_index = 0; | ||
35 | static spinlock_t index_lock; | ||
36 | |||
33 | /* | 37 | /* |
34 | * Different quirks to handle when the hardware deviates from a strict | 38 | * Different quirks to handle when the hardware deviates from a strict |
35 | * interpretation of the SDHCI specification. | 39 | * interpretation of the SDHCI specification. |
@@ -1320,7 +1324,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1320 | 1324 | ||
1321 | DBG("slot %d at 0x%08lx, irq %d\n", slot, host->addr, host->irq); | 1325 | DBG("slot %d at 0x%08lx, irq %d\n", slot, host->addr, host->irq); |
1322 | 1326 | ||
1323 | snprintf(host->slot_descr, 20, "sdhci:slot%d", slot); | 1327 | snprintf(host->slot_descr, 20, "sdhc%d:slot%d", chip->index, slot); |
1324 | 1328 | ||
1325 | ret = pci_request_region(pdev, host->bar, host->slot_descr); | 1329 | ret = pci_request_region(pdev, host->bar, host->slot_descr); |
1326 | if (ret) | 1330 | if (ret) |
@@ -1585,6 +1589,11 @@ static int __devinit sdhci_probe(struct pci_dev *pdev, | |||
1585 | chip->num_slots = slots; | 1589 | chip->num_slots = slots; |
1586 | pci_set_drvdata(pdev, chip); | 1590 | pci_set_drvdata(pdev, chip); |
1587 | 1591 | ||
1592 | /* Add for multi controller case */ | ||
1593 | spin_lock(&index_lock); | ||
1594 | chip->index = chip_index++; | ||
1595 | spin_unlock(&index_lock); | ||
1596 | |||
1588 | for (i = 0;i < slots;i++) { | 1597 | for (i = 0;i < slots;i++) { |
1589 | ret = sdhci_probe_slot(pdev, i); | 1598 | ret = sdhci_probe_slot(pdev, i); |
1590 | if (ret) { | 1599 | if (ret) { |
@@ -1645,6 +1654,8 @@ static int __init sdhci_drv_init(void) | |||
1645 | ": Secure Digital Host Controller Interface driver\n"); | 1654 | ": Secure Digital Host Controller Interface driver\n"); |
1646 | printk(KERN_INFO DRIVER_NAME ": Copyright(c) Pierre Ossman\n"); | 1655 | printk(KERN_INFO DRIVER_NAME ": Copyright(c) Pierre Ossman\n"); |
1647 | 1656 | ||
1657 | spin_lock_init(&index_lock); | ||
1658 | |||
1648 | return pci_register_driver(&sdhci_driver); | 1659 | return pci_register_driver(&sdhci_driver); |
1649 | } | 1660 | } |
1650 | 1661 | ||
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index e4d77b038bfa..d5a38f1b755a 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h | |||
@@ -208,6 +208,7 @@ struct sdhci_chip { | |||
208 | 208 | ||
209 | unsigned long quirks; | 209 | unsigned long quirks; |
210 | 210 | ||
211 | int index; /* Index for chip0, chip1 ...*/ | ||
211 | int num_slots; /* Slots on controller */ | 212 | int num_slots; /* Slots on controller */ |
212 | struct sdhci_host *hosts[0]; /* Pointers to hosts */ | 213 | struct sdhci_host *hosts[0]; /* Pointers to hosts */ |
213 | }; | 214 | }; |