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

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>

authored by

Feng Tang and committed by
Pierre Ossman
541ceb5b 11b295c8

+13 -1
+12 -1
drivers/mmc/host/sdhci.c
··· 30 30 31 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 38 * Different quirks to handle when the hardware deviates from a strict 35 39 * interpretation of the SDHCI specification. ··· 1324 1320 1325 1321 DBG("slot %d at 0x%08lx, irq %d\n", slot, host->addr, host->irq); 1326 1322 1327 - snprintf(host->slot_descr, 20, "sdhci:slot%d", slot); 1323 + snprintf(host->slot_descr, 20, "sdhc%d:slot%d", chip->index, slot); 1328 1324 1329 1325 ret = pci_request_region(pdev, host->bar, host->slot_descr); 1330 1326 if (ret) ··· 1589 1585 chip->num_slots = slots; 1590 1586 pci_set_drvdata(pdev, chip); 1591 1587 1588 + /* Add for multi controller case */ 1589 + spin_lock(&index_lock); 1590 + chip->index = chip_index++; 1591 + spin_unlock(&index_lock); 1592 + 1592 1593 for (i = 0;i < slots;i++) { 1593 1594 ret = sdhci_probe_slot(pdev, i); 1594 1595 if (ret) { ··· 1653 1644 printk(KERN_INFO DRIVER_NAME 1654 1645 ": Secure Digital Host Controller Interface driver\n"); 1655 1646 printk(KERN_INFO DRIVER_NAME ": Copyright(c) Pierre Ossman\n"); 1647 + 1648 + spin_lock_init(&index_lock); 1656 1649 1657 1650 return pci_register_driver(&sdhci_driver); 1658 1651 }
+1
drivers/mmc/host/sdhci.h
··· 208 208 209 209 unsigned long quirks; 210 210 211 + int index; /* Index for chip0, chip1 ...*/ 211 212 int num_slots; /* Slots on controller */ 212 213 struct sdhci_host *hosts[0]; /* Pointers to hosts */ 213 214 };