diff options
Diffstat (limited to 'drivers/mmc/host/sdhci.c')
-rw-r--r-- | drivers/mmc/host/sdhci.c | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 4b673aa2dc3c..71e020d6718d 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/mmc/host/sdhci.c - Secure Digital Host Controller Interface driver | 2 | * linux/drivers/mmc/host/sdhci.c - Secure Digital Host Controller Interface driver |
3 | * | 3 | * |
4 | * Copyright (C) 2005-2007 Pierre Ossman, All Rights Reserved. | 4 | * Copyright (C) 2005-2008 Pierre Ossman, All Rights Reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -30,10 +30,6 @@ | |||
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 | |||
37 | /* | 33 | /* |
38 | * Different quirks to handle when the hardware deviates from a strict | 34 | * Different quirks to handle when the hardware deviates from a strict |
39 | * interpretation of the SDHCI specification. | 35 | * interpretation of the SDHCI specification. |
@@ -1105,7 +1101,8 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) | |||
1105 | goto out; | 1101 | goto out; |
1106 | } | 1102 | } |
1107 | 1103 | ||
1108 | DBG("*** %s got interrupt: 0x%08x\n", host->slot_descr, intmask); | 1104 | DBG("*** %s got interrupt: 0x%08x\n", |
1105 | mmc_hostname(host->mmc), intmask); | ||
1109 | 1106 | ||
1110 | if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) { | 1107 | if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) { |
1111 | writel(intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE), | 1108 | writel(intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE), |
@@ -1235,7 +1232,7 @@ static int sdhci_resume (struct pci_dev *pdev) | |||
1235 | if (chip->hosts[i]->flags & SDHCI_USE_DMA) | 1232 | if (chip->hosts[i]->flags & SDHCI_USE_DMA) |
1236 | pci_set_master(pdev); | 1233 | pci_set_master(pdev); |
1237 | ret = request_irq(chip->hosts[i]->irq, sdhci_irq, | 1234 | ret = request_irq(chip->hosts[i]->irq, sdhci_irq, |
1238 | IRQF_SHARED, chip->hosts[i]->slot_descr, | 1235 | IRQF_SHARED, mmc_hostname(chip->hosts[i]->mmc), |
1239 | chip->hosts[i]); | 1236 | chip->hosts[i]); |
1240 | if (ret) | 1237 | if (ret) |
1241 | return ret; | 1238 | return ret; |
@@ -1324,9 +1321,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1324 | 1321 | ||
1325 | DBG("slot %d at 0x%08lx, irq %d\n", slot, host->addr, host->irq); | 1322 | DBG("slot %d at 0x%08lx, irq %d\n", slot, host->addr, host->irq); |
1326 | 1323 | ||
1327 | snprintf(host->slot_descr, 20, "sdhc%d:slot%d", chip->index, slot); | 1324 | ret = pci_request_region(pdev, host->bar, mmc_hostname(mmc)); |
1328 | |||
1329 | ret = pci_request_region(pdev, host->bar, host->slot_descr); | ||
1330 | if (ret) | 1325 | if (ret) |
1331 | goto free; | 1326 | goto free; |
1332 | 1327 | ||
@@ -1343,7 +1338,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1343 | version = (version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT; | 1338 | version = (version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT; |
1344 | if (version > 1) { | 1339 | if (version > 1) { |
1345 | printk(KERN_ERR "%s: Unknown controller version (%d). " | 1340 | printk(KERN_ERR "%s: Unknown controller version (%d). " |
1346 | "You may experience problems.\n", host->slot_descr, | 1341 | "You may experience problems.\n", mmc_hostname(mmc), |
1347 | version); | 1342 | version); |
1348 | } | 1343 | } |
1349 | 1344 | ||
@@ -1366,13 +1361,13 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1366 | (host->flags & SDHCI_USE_DMA)) { | 1361 | (host->flags & SDHCI_USE_DMA)) { |
1367 | printk(KERN_WARNING "%s: Will use DMA " | 1362 | printk(KERN_WARNING "%s: Will use DMA " |
1368 | "mode even though HW doesn't fully " | 1363 | "mode even though HW doesn't fully " |
1369 | "claim to support it.\n", host->slot_descr); | 1364 | "claim to support it.\n", mmc_hostname(mmc)); |
1370 | } | 1365 | } |
1371 | 1366 | ||
1372 | if (host->flags & SDHCI_USE_DMA) { | 1367 | if (host->flags & SDHCI_USE_DMA) { |
1373 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { | 1368 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { |
1374 | printk(KERN_WARNING "%s: No suitable DMA available. " | 1369 | printk(KERN_WARNING "%s: No suitable DMA available. " |
1375 | "Falling back to PIO.\n", host->slot_descr); | 1370 | "Falling back to PIO.\n", mmc_hostname(mmc)); |
1376 | host->flags &= ~SDHCI_USE_DMA; | 1371 | host->flags &= ~SDHCI_USE_DMA; |
1377 | } | 1372 | } |
1378 | } | 1373 | } |
@@ -1386,7 +1381,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1386 | (caps & SDHCI_CLOCK_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT; | 1381 | (caps & SDHCI_CLOCK_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT; |
1387 | if (host->max_clk == 0) { | 1382 | if (host->max_clk == 0) { |
1388 | printk(KERN_ERR "%s: Hardware doesn't specify base clock " | 1383 | printk(KERN_ERR "%s: Hardware doesn't specify base clock " |
1389 | "frequency.\n", host->slot_descr); | 1384 | "frequency.\n", mmc_hostname(mmc)); |
1390 | ret = -ENODEV; | 1385 | ret = -ENODEV; |
1391 | goto unmap; | 1386 | goto unmap; |
1392 | } | 1387 | } |
@@ -1396,7 +1391,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1396 | (caps & SDHCI_TIMEOUT_CLK_MASK) >> SDHCI_TIMEOUT_CLK_SHIFT; | 1391 | (caps & SDHCI_TIMEOUT_CLK_MASK) >> SDHCI_TIMEOUT_CLK_SHIFT; |
1397 | if (host->timeout_clk == 0) { | 1392 | if (host->timeout_clk == 0) { |
1398 | printk(KERN_ERR "%s: Hardware doesn't specify timeout clock " | 1393 | printk(KERN_ERR "%s: Hardware doesn't specify timeout clock " |
1399 | "frequency.\n", host->slot_descr); | 1394 | "frequency.\n", mmc_hostname(mmc)); |
1400 | ret = -ENODEV; | 1395 | ret = -ENODEV; |
1401 | goto unmap; | 1396 | goto unmap; |
1402 | } | 1397 | } |
@@ -1424,7 +1419,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1424 | 1419 | ||
1425 | if (mmc->ocr_avail == 0) { | 1420 | if (mmc->ocr_avail == 0) { |
1426 | printk(KERN_ERR "%s: Hardware doesn't report any " | 1421 | printk(KERN_ERR "%s: Hardware doesn't report any " |
1427 | "support voltages.\n", host->slot_descr); | 1422 | "support voltages.\n", mmc_hostname(mmc)); |
1428 | ret = -ENODEV; | 1423 | ret = -ENODEV; |
1429 | goto unmap; | 1424 | goto unmap; |
1430 | } | 1425 | } |
@@ -1458,8 +1453,8 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1458 | */ | 1453 | */ |
1459 | mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT; | 1454 | mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT; |
1460 | if (mmc->max_blk_size >= 3) { | 1455 | if (mmc->max_blk_size >= 3) { |
1461 | printk(KERN_WARNING "%s: Invalid maximum block size, assuming 512\n", | 1456 | printk(KERN_WARNING "%s: Invalid maximum block size, " |
1462 | host->slot_descr); | 1457 | "assuming 512 bytes\n", mmc_hostname(mmc)); |
1463 | mmc->max_blk_size = 512; | 1458 | mmc->max_blk_size = 512; |
1464 | } else | 1459 | } else |
1465 | mmc->max_blk_size = 512 << mmc->max_blk_size; | 1460 | mmc->max_blk_size = 512 << mmc->max_blk_size; |
@@ -1480,7 +1475,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1480 | setup_timer(&host->timer, sdhci_timeout_timer, (unsigned long)host); | 1475 | setup_timer(&host->timer, sdhci_timeout_timer, (unsigned long)host); |
1481 | 1476 | ||
1482 | ret = request_irq(host->irq, sdhci_irq, IRQF_SHARED, | 1477 | ret = request_irq(host->irq, sdhci_irq, IRQF_SHARED, |
1483 | host->slot_descr, host); | 1478 | mmc_hostname(mmc), host); |
1484 | if (ret) | 1479 | if (ret) |
1485 | goto untasklet; | 1480 | goto untasklet; |
1486 | 1481 | ||
@@ -1494,8 +1489,8 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1494 | 1489 | ||
1495 | mmc_add_host(mmc); | 1490 | mmc_add_host(mmc); |
1496 | 1491 | ||
1497 | printk(KERN_INFO "%s: SDHCI at 0x%08lx irq %d %s\n", mmc_hostname(mmc), | 1492 | printk(KERN_INFO "%s: SDHCI at 0x%08lx irq %d %s\n", |
1498 | host->addr, host->irq, | 1493 | mmc_hostname(mmc), host->addr, host->irq, |
1499 | (host->flags & SDHCI_USE_DMA)?"DMA":"PIO"); | 1494 | (host->flags & SDHCI_USE_DMA)?"DMA":"PIO"); |
1500 | 1495 | ||
1501 | return 0; | 1496 | return 0; |
@@ -1589,11 +1584,6 @@ static int __devinit sdhci_probe(struct pci_dev *pdev, | |||
1589 | chip->num_slots = slots; | 1584 | chip->num_slots = slots; |
1590 | pci_set_drvdata(pdev, chip); | 1585 | pci_set_drvdata(pdev, chip); |
1591 | 1586 | ||
1592 | /* Add for multi controller case */ | ||
1593 | spin_lock(&index_lock); | ||
1594 | chip->index = chip_index++; | ||
1595 | spin_unlock(&index_lock); | ||
1596 | |||
1597 | for (i = 0;i < slots;i++) { | 1587 | for (i = 0;i < slots;i++) { |
1598 | ret = sdhci_probe_slot(pdev, i); | 1588 | ret = sdhci_probe_slot(pdev, i); |
1599 | if (ret) { | 1589 | if (ret) { |
@@ -1654,8 +1644,6 @@ static int __init sdhci_drv_init(void) | |||
1654 | ": Secure Digital Host Controller Interface driver\n"); | 1644 | ": Secure Digital Host Controller Interface driver\n"); |
1655 | printk(KERN_INFO DRIVER_NAME ": Copyright(c) Pierre Ossman\n"); | 1645 | printk(KERN_INFO DRIVER_NAME ": Copyright(c) Pierre Ossman\n"); |
1656 | 1646 | ||
1657 | spin_lock_init(&index_lock); | ||
1658 | |||
1659 | return pci_register_driver(&sdhci_driver); | 1647 | return pci_register_driver(&sdhci_driver); |
1660 | } | 1648 | } |
1661 | 1649 | ||