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

Merge branch 'for-3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata

Pull libata update from Tejun Heo:
"AHCI is getting per-port irq handling and locks for better
scalability. The gain is not huge but measureable with multiple high
iops devices connected to the same host; however, the value of
threaded IRQ handling seems negligible for AHCI and it likely will
revert to non-threaded handling soon.

Another noteworthy change is George Spelvin's "libata: Un-break ATA
blacklist". During 3.17 devel cycle, the libata blacklist glob
matching got generalized and rewritten; unfortunately, the patch
forgot to swap arguments to match the new match function and ended up
breaking blacklist matching completely. It got noticed only a couple
days ago so it couldn't make for-3.17-fixes either. :(

Other than the above two, nothing too interesting - the usual cleanup
churns and device-specific changes"

* 'for-3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: (22 commits)
pata_serverworks: disable 64-KB DMA transfers on Broadcom OSB4 IDE Controller
libata: Un-break ATA blacklist
AHCI: Do not acquire ata_host::lock from single IRQ handler
AHCI: Optimize single IRQ interrupt processing
AHCI: Do not read HOST_IRQ_STAT reg in multi-MSI mode
AHCI: Make few function names more descriptive
AHCI: Move host activation code into ahci_host_activate()
AHCI: Move ahci_host_activate() function to libahci.c
AHCI: Pass SCSI host template as arg to ahci_host_activate()
ata: pata_imx: Use the SIMPLE_DEV_PM_OPS() macro
AHCI: Cleanup checking of multiple MSIs/SLM modes
libata-sff: Fix controllers with no ctl port
ahci_xgene: Fix the error print invalid resource for APM X-Gene SoC AHCI SATA Host Controller driver.
libata: change ata_<foo>_printk routines to return void
ata: qcom: Add device tree bindings information
ahci-platform: Bump max number of clocks to 5
ahci: ahci_p5wdh_workaround - constify DMI table
libahci_platform: Staticize ahci_platform_<en/dis>able_phys()
pata_platform: Remove useless irq_flags field
pata_of_platform: Remove "electra-ide" quirk
...

+259 -298
+48
Documentation/devicetree/bindings/ata/qcom-sata.txt
··· 1 + * Qualcomm AHCI SATA Controller 2 + 3 + SATA nodes are defined to describe on-chip Serial ATA controllers. 4 + Each SATA controller should have its own node. 5 + 6 + Required properties: 7 + - compatible : compatible list, must contain "generic-ahci" 8 + - interrupts : <interrupt mapping for SATA IRQ> 9 + - reg : <registers mapping> 10 + - phys : Must contain exactly one entry as specified 11 + in phy-bindings.txt 12 + - phy-names : Must be "sata-phy" 13 + 14 + Required properties for "qcom,ipq806x-ahci" compatible: 15 + - clocks : Must contain an entry for each entry in clock-names. 16 + - clock-names : Shall be: 17 + "slave_iface" - Fabric port AHB clock for SATA 18 + "iface" - AHB clock 19 + "core" - core clock 20 + "rxoob" - RX out-of-band clock 21 + "pmalive" - Power Module Alive clock 22 + - assigned-clocks : Shall be: 23 + SATA_RXOOB_CLK 24 + SATA_PMALIVE_CLK 25 + - assigned-clock-rates : Shall be: 26 + 100Mhz (100000000) for SATA_RXOOB_CLK 27 + 100Mhz (100000000) for SATA_PMALIVE_CLK 28 + 29 + Example: 30 + sata@29000000 { 31 + compatible = "qcom,ipq806x-ahci", "generic-ahci"; 32 + reg = <0x29000000 0x180>; 33 + 34 + interrupts = <0 209 0x0>; 35 + 36 + clocks = <&gcc SFAB_SATA_S_H_CLK>, 37 + <&gcc SATA_H_CLK>, 38 + <&gcc SATA_A_CLK>, 39 + <&gcc SATA_RXOOB_CLK>, 40 + <&gcc SATA_PMALIVE_CLK>; 41 + clock-names = "slave_iface", "iface", "core", 42 + "rxoob", "pmalive"; 43 + assigned-clocks = <&gcc SATA_RXOOB_CLK>, <&gcc SATA_PMALIVE_CLK>; 44 + assigned-clock-rates = <100000000>, <100000000>; 45 + 46 + phys = <&sata_phy>; 47 + phy-names = "sata-phy"; 48 + };
+1 -2
arch/blackfin/mach-bf537/boards/cm_bf537e.c
··· 733 733 734 734 static struct pata_platform_info bfin_pata_platform_data = { 735 735 .ioport_shift = 2, 736 - .irq_type = IRQF_TRIGGER_HIGH, 737 736 }; 738 737 739 738 static struct resource bfin_pata_resources[] = { ··· 749 750 { 750 751 .start = PATA_INT, 751 752 .end = PATA_INT, 752 - .flags = IORESOURCE_IRQ, 753 + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 753 754 }, 754 755 }; 755 756
+1 -2
arch/blackfin/mach-bf537/boards/cm_bf537u.c
··· 587 587 588 588 static struct pata_platform_info bfin_pata_platform_data = { 589 589 .ioport_shift = 2, 590 - .irq_type = IRQF_TRIGGER_HIGH, 591 590 }; 592 591 593 592 static struct resource bfin_pata_resources[] = { ··· 603 604 { 604 605 .start = PATA_INT, 605 606 .end = PATA_INT, 606 - .flags = IORESOURCE_IRQ, 607 + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 607 608 }, 608 609 }; 609 610
+1 -2
arch/blackfin/mach-bf537/boards/stamp.c
··· 2462 2462 #define PATA_INT IRQ_PF5 2463 2463 static struct pata_platform_info bfin_pata_platform_data = { 2464 2464 .ioport_shift = 1, 2465 - .irq_flags = IRQF_TRIGGER_HIGH, 2466 2465 }; 2467 2466 2468 2467 static struct resource bfin_pata_resources[] = { ··· 2478 2479 { 2479 2480 .start = PATA_INT, 2480 2481 .end = PATA_INT, 2481 - .flags = IORESOURCE_IRQ, 2482 + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 2482 2483 }, 2483 2484 }; 2484 2485 #elif defined(CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE)
+1 -2
arch/blackfin/mach-bf537/boards/tcm_bf537.c
··· 589 589 590 590 static struct pata_platform_info bfin_pata_platform_data = { 591 591 .ioport_shift = 2, 592 - .irq_type = IRQF_TRIGGER_HIGH, 593 592 }; 594 593 595 594 static struct resource bfin_pata_resources[] = { ··· 605 606 { 606 607 .start = PATA_INT, 607 608 .end = PATA_INT, 608 - .flags = IORESOURCE_IRQ, 609 + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 609 610 }, 610 611 }; 611 612
+1 -2
arch/blackfin/mach-bf561/boards/cm_bf561.c
··· 354 354 355 355 static struct pata_platform_info bfin_pata_platform_data = { 356 356 .ioport_shift = 2, 357 - .irq_type = IRQF_TRIGGER_HIGH, 358 357 }; 359 358 360 359 static struct resource bfin_pata_resources[] = { ··· 370 371 { 371 372 .start = PATA_INT, 372 373 .end = PATA_INT, 373 - .flags = IORESOURCE_IRQ, 374 + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 374 375 }, 375 376 }; 376 377
+1 -2
drivers/ata/acard-ahci.c
··· 498 498 acard_ahci_pci_print_info(host); 499 499 500 500 pci_set_master(pdev); 501 - return ata_host_activate(host, pdev->irq, ahci_interrupt, IRQF_SHARED, 502 - &acard_ahci_sht); 501 + return ahci_host_activate(host, pdev->irq, &acard_ahci_sht); 503 502 } 504 503 505 504 module_pci_driver(acard_ahci_pci_driver);
+7 -75
drivers/ata/ahci.c
··· 790 790 */ 791 791 static void ahci_p5wdh_workaround(struct ata_host *host) 792 792 { 793 - static struct dmi_system_id sysids[] = { 793 + static const struct dmi_system_id sysids[] = { 794 794 { 795 795 .ident = "P5W DH Deluxe", 796 796 .matches = { ··· 1221 1221 goto single_msi; 1222 1222 } 1223 1223 1224 + if (nvec > 1) 1225 + hpriv->flags |= AHCI_HFLAG_MULTI_MSI; 1226 + 1224 1227 return nvec; 1225 1228 1226 1229 single_msi: ··· 1236 1233 return 0; 1237 1234 } 1238 1235 1239 - /** 1240 - * ahci_host_activate - start AHCI host, request IRQs and register it 1241 - * @host: target ATA host 1242 - * @irq: base IRQ number to request 1243 - * @n_msis: number of MSIs allocated for this host 1244 - * @irq_handler: irq_handler used when requesting IRQs 1245 - * @irq_flags: irq_flags used when requesting IRQs 1246 - * 1247 - * Similar to ata_host_activate, but requests IRQs according to AHCI-1.1 1248 - * when multiple MSIs were allocated. That is one MSI per port, starting 1249 - * from @irq. 1250 - * 1251 - * LOCKING: 1252 - * Inherited from calling layer (may sleep). 1253 - * 1254 - * RETURNS: 1255 - * 0 on success, -errno otherwise. 1256 - */ 1257 - int ahci_host_activate(struct ata_host *host, int irq, unsigned int n_msis) 1258 - { 1259 - int i, rc; 1260 - 1261 - /* Sharing Last Message among several ports is not supported */ 1262 - if (n_msis < host->n_ports) 1263 - return -EINVAL; 1264 - 1265 - rc = ata_host_start(host); 1266 - if (rc) 1267 - return rc; 1268 - 1269 - for (i = 0; i < host->n_ports; i++) { 1270 - struct ahci_port_priv *pp = host->ports[i]->private_data; 1271 - 1272 - /* Do not receive interrupts sent by dummy ports */ 1273 - if (!pp) { 1274 - disable_irq(irq + i); 1275 - continue; 1276 - } 1277 - 1278 - rc = devm_request_threaded_irq(host->dev, irq + i, 1279 - ahci_hw_interrupt, 1280 - ahci_thread_fn, IRQF_SHARED, 1281 - pp->irq_desc, host->ports[i]); 1282 - if (rc) 1283 - goto out_free_irqs; 1284 - } 1285 - 1286 - for (i = 0; i < host->n_ports; i++) 1287 - ata_port_desc(host->ports[i], "irq %d", irq + i); 1288 - 1289 - rc = ata_host_register(host, &ahci_sht); 1290 - if (rc) 1291 - goto out_free_all_irqs; 1292 - 1293 - return 0; 1294 - 1295 - out_free_all_irqs: 1296 - i = host->n_ports; 1297 - out_free_irqs: 1298 - for (i--; i >= 0; i--) 1299 - devm_free_irq(host->dev, irq + i, host->ports[i]); 1300 - 1301 - return rc; 1302 - } 1303 - 1304 1236 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 1305 1237 { 1306 1238 unsigned int board_id = ent->driver_data; ··· 1244 1306 struct device *dev = &pdev->dev; 1245 1307 struct ahci_host_priv *hpriv; 1246 1308 struct ata_host *host; 1247 - int n_ports, n_msis, i, rc; 1309 + int n_ports, i, rc; 1248 1310 int ahci_pci_bar = AHCI_PCI_BAR_STANDARD; 1249 1311 1250 1312 VPRINTK("ENTER\n"); ··· 1397 1459 */ 1398 1460 n_ports = max(ahci_nr_ports(hpriv->cap), fls(hpriv->port_map)); 1399 1461 1400 - n_msis = ahci_init_interrupts(pdev, n_ports, hpriv); 1401 - if (n_msis > 1) 1402 - hpriv->flags |= AHCI_HFLAG_MULTI_MSI; 1462 + ahci_init_interrupts(pdev, n_ports, hpriv); 1403 1463 1404 1464 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); 1405 1465 if (!host) ··· 1449 1513 1450 1514 pci_set_master(pdev); 1451 1515 1452 - if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) 1453 - return ahci_host_activate(host, pdev->irq, n_msis); 1454 - 1455 - return ata_host_activate(host, pdev->irq, ahci_interrupt, IRQF_SHARED, 1456 - &ahci_sht); 1516 + return ahci_host_activate(host, pdev->irq, &ahci_sht); 1457 1517 } 1458 1518 1459 1519 module_pci_driver(ahci_pci_driver);
+4 -6
drivers/ata/ahci.h
··· 53 53 54 54 enum { 55 55 AHCI_MAX_PORTS = 32, 56 - AHCI_MAX_CLKS = 4, 56 + AHCI_MAX_CLKS = 5, 57 57 AHCI_MAX_SG = 168, /* hardware max is 64K */ 58 58 AHCI_DMA_BOUNDARY = 0xffffffff, 59 59 AHCI_MAX_CMDS = 32, ··· 304 304 unsigned int ncq_saw_d2h:1; 305 305 unsigned int ncq_saw_dmas:1; 306 306 unsigned int ncq_saw_sdb:1; 307 - u32 intr_status; /* interrupts to handle */ 307 + atomic_t intr_status; /* interrupts to handle */ 308 308 spinlock_t lock; /* protects parent ata_port */ 309 309 u32 intr_mask; /* interrupts to enable */ 310 310 bool fbs_supported; /* set iff FBS is supported */ ··· 388 388 void ahci_set_em_messages(struct ahci_host_priv *hpriv, 389 389 struct ata_port_info *pi); 390 390 int ahci_reset_em(struct ata_host *host); 391 - irqreturn_t ahci_interrupt(int irq, void *dev_instance); 392 - irqreturn_t ahci_hw_interrupt(int irq, void *dev_instance); 393 - irqreturn_t ahci_thread_fn(int irq, void *dev_instance); 394 391 void ahci_print_info(struct ata_host *host, const char *scc_s); 395 - int ahci_host_activate(struct ata_host *host, int irq, unsigned int n_msis); 392 + int ahci_host_activate(struct ata_host *host, int irq, 393 + struct scsi_host_template *sht); 396 394 void ahci_error_handler(struct ata_port *ap); 397 395 398 396 static inline void __iomem *__ahci_port_base(struct ata_host *host,
+1 -17
drivers/ata/ahci_platform.c
··· 32 32 static int ahci_probe(struct platform_device *pdev) 33 33 { 34 34 struct device *dev = &pdev->dev; 35 - struct ahci_platform_data *pdata = dev_get_platdata(dev); 36 35 struct ahci_host_priv *hpriv; 37 36 int rc; 38 37 ··· 43 44 if (rc) 44 45 return rc; 45 46 46 - /* 47 - * Some platforms might need to prepare for mmio region access, 48 - * which could be done in the following init call. So, the mmio 49 - * region shouldn't be accessed before init (if provided) has 50 - * returned successfully. 51 - */ 52 - if (pdata && pdata->init) { 53 - rc = pdata->init(dev, hpriv->mmio); 54 - if (rc) 55 - goto disable_resources; 56 - } 57 - 58 47 if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) 59 48 hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ; 60 49 61 50 rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info); 62 51 if (rc) 63 - goto pdata_exit; 52 + goto disable_resources; 64 53 65 54 return 0; 66 - pdata_exit: 67 - if (pdata && pdata->exit) 68 - pdata->exit(dev); 69 55 disable_resources: 70 56 ahci_platform_disable_resources(hpriv); 71 57 return rc;
+8 -2
drivers/ata/ahci_xgene.c
··· 434 434 u32 val; 435 435 436 436 /* Check for optional MUX resource */ 437 - if (IS_ERR(ctx->csr_mux)) 437 + if (!ctx->csr_mux) 438 438 return 0; 439 439 440 440 val = readl(ctx->csr_mux + SATA_ENET_CONFIG_REG); ··· 484 484 485 485 /* Retrieve the optional IP mux resource */ 486 486 res = platform_get_resource(pdev, IORESOURCE_MEM, 4); 487 - ctx->csr_mux = devm_ioremap_resource(dev, res); 487 + if (res) { 488 + void __iomem *csr = devm_ioremap_resource(dev, res); 489 + if (IS_ERR(csr)) 490 + return PTR_ERR(csr); 491 + 492 + ctx->csr_mux = csr; 493 + } 488 494 489 495 dev_dbg(dev, "VAddr 0x%p Mmio VAddr 0x%p\n", ctx->csr_core, 490 496 hpriv->mmio);
+130 -65
drivers/ata/libahci.c
··· 1778 1778 } 1779 1779 } 1780 1780 1781 - static void ahci_port_intr(struct ata_port *ap) 1781 + static void ahci_update_intr_status(struct ata_port *ap) 1782 1782 { 1783 1783 void __iomem *port_mmio = ahci_port_base(ap); 1784 + struct ahci_port_priv *pp = ap->private_data; 1784 1785 u32 status; 1785 1786 1786 1787 status = readl(port_mmio + PORT_IRQ_STAT); 1787 1788 writel(status, port_mmio + PORT_IRQ_STAT); 1788 1789 1789 - ahci_handle_port_interrupt(ap, port_mmio, status); 1790 + atomic_or(status, &pp->intr_status); 1790 1791 } 1791 1792 1792 - irqreturn_t ahci_thread_fn(int irq, void *dev_instance) 1793 + static irqreturn_t ahci_port_thread_fn(int irq, void *dev_instance) 1793 1794 { 1794 1795 struct ata_port *ap = dev_instance; 1795 1796 struct ahci_port_priv *pp = ap->private_data; 1796 1797 void __iomem *port_mmio = ahci_port_base(ap); 1797 - unsigned long flags; 1798 1798 u32 status; 1799 1799 1800 - spin_lock_irqsave(&ap->host->lock, flags); 1801 - status = pp->intr_status; 1802 - if (status) 1803 - pp->intr_status = 0; 1804 - spin_unlock_irqrestore(&ap->host->lock, flags); 1800 + status = atomic_xchg(&pp->intr_status, 0); 1801 + if (!status) 1802 + return IRQ_NONE; 1805 1803 1806 1804 spin_lock_bh(ap->lock); 1807 1805 ahci_handle_port_interrupt(ap, port_mmio, status); ··· 1807 1809 1808 1810 return IRQ_HANDLED; 1809 1811 } 1810 - EXPORT_SYMBOL_GPL(ahci_thread_fn); 1811 1812 1812 - static void ahci_hw_port_interrupt(struct ata_port *ap) 1813 + irqreturn_t ahci_thread_fn(int irq, void *dev_instance) 1813 1814 { 1814 - void __iomem *port_mmio = ahci_port_base(ap); 1815 - struct ahci_port_priv *pp = ap->private_data; 1816 - u32 status; 1817 - 1818 - status = readl(port_mmio + PORT_IRQ_STAT); 1819 - writel(status, port_mmio + PORT_IRQ_STAT); 1820 - 1821 - pp->intr_status |= status; 1822 - } 1823 - 1824 - irqreturn_t ahci_hw_interrupt(int irq, void *dev_instance) 1825 - { 1826 - struct ata_port *ap_this = dev_instance; 1827 - struct ahci_port_priv *pp = ap_this->private_data; 1828 - struct ata_host *host = ap_this->host; 1815 + struct ata_host *host = dev_instance; 1829 1816 struct ahci_host_priv *hpriv = host->private_data; 1830 - void __iomem *mmio = hpriv->mmio; 1817 + u32 irq_masked = hpriv->port_map; 1831 1818 unsigned int i; 1832 - u32 irq_stat, irq_masked; 1833 - 1834 - VPRINTK("ENTER\n"); 1835 - 1836 - spin_lock(&host->lock); 1837 - 1838 - irq_stat = readl(mmio + HOST_IRQ_STAT); 1839 - 1840 - if (!irq_stat) { 1841 - u32 status = pp->intr_status; 1842 - 1843 - spin_unlock(&host->lock); 1844 - 1845 - VPRINTK("EXIT\n"); 1846 - 1847 - return status ? IRQ_WAKE_THREAD : IRQ_NONE; 1848 - } 1849 - 1850 - irq_masked = irq_stat & hpriv->port_map; 1851 1819 1852 1820 for (i = 0; i < host->n_ports; i++) { 1853 1821 struct ata_port *ap; ··· 1823 1859 1824 1860 ap = host->ports[i]; 1825 1861 if (ap) { 1826 - ahci_hw_port_interrupt(ap); 1862 + ahci_port_thread_fn(irq, ap); 1827 1863 VPRINTK("port %u\n", i); 1828 1864 } else { 1829 1865 VPRINTK("port %u (no irq)\n", i); ··· 1833 1869 } 1834 1870 } 1835 1871 1836 - writel(irq_stat, mmio + HOST_IRQ_STAT); 1872 + return IRQ_HANDLED; 1873 + } 1837 1874 1838 - spin_unlock(&host->lock); 1875 + static irqreturn_t ahci_multi_irqs_intr(int irq, void *dev_instance) 1876 + { 1877 + struct ata_port *ap = dev_instance; 1878 + void __iomem *port_mmio = ahci_port_base(ap); 1879 + struct ahci_port_priv *pp = ap->private_data; 1880 + u32 status; 1881 + 1882 + VPRINTK("ENTER\n"); 1883 + 1884 + status = readl(port_mmio + PORT_IRQ_STAT); 1885 + writel(status, port_mmio + PORT_IRQ_STAT); 1886 + 1887 + atomic_or(status, &pp->intr_status); 1839 1888 1840 1889 VPRINTK("EXIT\n"); 1841 1890 1842 1891 return IRQ_WAKE_THREAD; 1843 1892 } 1844 - EXPORT_SYMBOL_GPL(ahci_hw_interrupt); 1845 1893 1846 - irqreturn_t ahci_interrupt(int irq, void *dev_instance) 1894 + static irqreturn_t ahci_single_irq_intr(int irq, void *dev_instance) 1847 1895 { 1848 1896 struct ata_host *host = dev_instance; 1849 1897 struct ahci_host_priv *hpriv; ··· 1875 1899 1876 1900 irq_masked = irq_stat & hpriv->port_map; 1877 1901 1878 - spin_lock(&host->lock); 1879 - 1880 1902 for (i = 0; i < host->n_ports; i++) { 1881 1903 struct ata_port *ap; 1882 1904 ··· 1883 1909 1884 1910 ap = host->ports[i]; 1885 1911 if (ap) { 1886 - ahci_port_intr(ap); 1912 + ahci_update_intr_status(ap); 1887 1913 VPRINTK("port %u\n", i); 1888 1914 } else { 1889 1915 VPRINTK("port %u (no irq)\n", i); ··· 1906 1932 */ 1907 1933 writel(irq_stat, mmio + HOST_IRQ_STAT); 1908 1934 1909 - spin_unlock(&host->lock); 1910 - 1911 1935 VPRINTK("EXIT\n"); 1912 1936 1913 - return IRQ_RETVAL(handled); 1937 + return handled ? IRQ_WAKE_THREAD : IRQ_NONE; 1914 1938 } 1915 - EXPORT_SYMBOL_GPL(ahci_interrupt); 1916 1939 1917 1940 unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) 1918 1941 { ··· 2320 2349 */ 2321 2350 pp->intr_mask = DEF_PORT_IRQ; 2322 2351 2323 - /* 2324 - * Switch to per-port locking in case each port has its own MSI vector. 2325 - */ 2326 - if ((hpriv->flags & AHCI_HFLAG_MULTI_MSI)) { 2327 - spin_lock_init(&pp->lock); 2328 - ap->lock = &pp->lock; 2329 - } 2352 + spin_lock_init(&pp->lock); 2353 + ap->lock = &pp->lock; 2330 2354 2331 2355 ap->private_data = pp; 2332 2356 ··· 2437 2471 } 2438 2472 } 2439 2473 EXPORT_SYMBOL_GPL(ahci_set_em_messages); 2474 + 2475 + static int ahci_host_activate_multi_irqs(struct ata_host *host, int irq, 2476 + struct scsi_host_template *sht) 2477 + { 2478 + int i, rc; 2479 + 2480 + rc = ata_host_start(host); 2481 + if (rc) 2482 + return rc; 2483 + 2484 + for (i = 0; i < host->n_ports; i++) { 2485 + struct ahci_port_priv *pp = host->ports[i]->private_data; 2486 + 2487 + /* Do not receive interrupts sent by dummy ports */ 2488 + if (!pp) { 2489 + disable_irq(irq + i); 2490 + continue; 2491 + } 2492 + 2493 + rc = devm_request_threaded_irq(host->dev, irq + i, 2494 + ahci_multi_irqs_intr, 2495 + ahci_port_thread_fn, IRQF_SHARED, 2496 + pp->irq_desc, host->ports[i]); 2497 + if (rc) 2498 + goto out_free_irqs; 2499 + } 2500 + 2501 + for (i = 0; i < host->n_ports; i++) 2502 + ata_port_desc(host->ports[i], "irq %d", irq + i); 2503 + 2504 + rc = ata_host_register(host, sht); 2505 + if (rc) 2506 + goto out_free_all_irqs; 2507 + 2508 + return 0; 2509 + 2510 + out_free_all_irqs: 2511 + i = host->n_ports; 2512 + out_free_irqs: 2513 + for (i--; i >= 0; i--) 2514 + devm_free_irq(host->dev, irq + i, host->ports[i]); 2515 + 2516 + return rc; 2517 + } 2518 + 2519 + static int ahci_host_activate_single_irq(struct ata_host *host, int irq, 2520 + struct scsi_host_template *sht) 2521 + { 2522 + int i, rc; 2523 + 2524 + rc = ata_host_start(host); 2525 + if (rc) 2526 + return rc; 2527 + 2528 + rc = devm_request_threaded_irq(host->dev, irq, ahci_single_irq_intr, 2529 + ahci_thread_fn, IRQF_SHARED, 2530 + dev_driver_string(host->dev), host); 2531 + if (rc) 2532 + return rc; 2533 + 2534 + for (i = 0; i < host->n_ports; i++) 2535 + ata_port_desc(host->ports[i], "irq %d", irq); 2536 + 2537 + rc = ata_host_register(host, sht); 2538 + if (rc) 2539 + devm_free_irq(host->dev, irq, host); 2540 + 2541 + return rc; 2542 + } 2543 + 2544 + /** 2545 + * ahci_host_activate - start AHCI host, request IRQs and register it 2546 + * @host: target ATA host 2547 + * @irq: base IRQ number to request 2548 + * @sht: scsi_host_template to use when registering the host 2549 + * 2550 + * Similar to ata_host_activate, but requests IRQs according to AHCI-1.1 2551 + * when multiple MSIs were allocated. That is one MSI per port, starting 2552 + * from @irq. 2553 + * 2554 + * LOCKING: 2555 + * Inherited from calling layer (may sleep). 2556 + * 2557 + * RETURNS: 2558 + * 0 on success, -errno otherwise. 2559 + */ 2560 + int ahci_host_activate(struct ata_host *host, int irq, 2561 + struct scsi_host_template *sht) 2562 + { 2563 + struct ahci_host_priv *hpriv = host->private_data; 2564 + int rc; 2565 + 2566 + if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) 2567 + rc = ahci_host_activate_multi_irqs(host, irq, sht); 2568 + else 2569 + rc = ahci_host_activate_single_irq(host, irq, sht); 2570 + return rc; 2571 + } 2572 + EXPORT_SYMBOL_GPL(ahci_host_activate); 2440 2573 2441 2574 MODULE_AUTHOR("Jeff Garzik"); 2442 2575 MODULE_DESCRIPTION("Common AHCI SATA low-level routines");
+3 -29
drivers/ata/libahci_platform.c
··· 49 49 * RETURNS: 50 50 * 0 on success otherwise a negative error code 51 51 */ 52 - int ahci_platform_enable_phys(struct ahci_host_priv *hpriv) 52 + static int ahci_platform_enable_phys(struct ahci_host_priv *hpriv) 53 53 { 54 54 int rc, i; 55 55 ··· 77 77 } 78 78 return rc; 79 79 } 80 - EXPORT_SYMBOL_GPL(ahci_platform_enable_phys); 81 80 82 81 /** 83 82 * ahci_platform_disable_phys - Disable PHYs ··· 84 85 * 85 86 * This function disables all PHYs found in hpriv->phys. 86 87 */ 87 - void ahci_platform_disable_phys(struct ahci_host_priv *hpriv) 88 + static void ahci_platform_disable_phys(struct ahci_host_priv *hpriv) 88 89 { 89 90 int i; 90 91 ··· 96 97 phy_exit(hpriv->phys[i]); 97 98 } 98 99 } 99 - EXPORT_SYMBOL_GPL(ahci_platform_disable_phys); 100 100 101 101 /** 102 102 * ahci_platform_enable_clks - Enable platform clocks ··· 493 495 ahci_init_controller(host); 494 496 ahci_print_info(host, "platform"); 495 497 496 - return ata_host_activate(host, irq, ahci_interrupt, IRQF_SHARED, 497 - &ahci_platform_sht); 498 + return ahci_host_activate(host, irq, &ahci_platform_sht); 498 499 } 499 500 EXPORT_SYMBOL_GPL(ahci_platform_init_host); 500 501 501 502 static void ahci_host_stop(struct ata_host *host) 502 503 { 503 - struct device *dev = host->dev; 504 - struct ahci_platform_data *pdata = dev_get_platdata(dev); 505 504 struct ahci_host_priv *hpriv = host->private_data; 506 - 507 - if (pdata && pdata->exit) 508 - pdata->exit(dev); 509 505 510 506 ahci_platform_disable_resources(hpriv); 511 507 } ··· 584 592 */ 585 593 int ahci_platform_suspend(struct device *dev) 586 594 { 587 - struct ahci_platform_data *pdata = dev_get_platdata(dev); 588 595 struct ata_host *host = dev_get_drvdata(dev); 589 596 struct ahci_host_priv *hpriv = host->private_data; 590 597 int rc; ··· 592 601 if (rc) 593 602 return rc; 594 603 595 - if (pdata && pdata->suspend) { 596 - rc = pdata->suspend(dev); 597 - if (rc) 598 - goto resume_host; 599 - } 600 - 601 604 ahci_platform_disable_resources(hpriv); 602 605 603 606 return 0; 604 - 605 - resume_host: 606 - ahci_platform_resume_host(dev); 607 - return rc; 608 607 } 609 608 EXPORT_SYMBOL_GPL(ahci_platform_suspend); 610 609 ··· 610 629 */ 611 630 int ahci_platform_resume(struct device *dev) 612 631 { 613 - struct ahci_platform_data *pdata = dev_get_platdata(dev); 614 632 struct ata_host *host = dev_get_drvdata(dev); 615 633 struct ahci_host_priv *hpriv = host->private_data; 616 634 int rc; ··· 617 637 rc = ahci_platform_enable_resources(hpriv); 618 638 if (rc) 619 639 return rc; 620 - 621 - if (pdata && pdata->resume) { 622 - rc = pdata->resume(dev); 623 - if (rc) 624 - goto disable_resources; 625 - } 626 640 627 641 rc = ahci_platform_resume_host(dev); 628 642 if (rc)
+16 -25
drivers/ata/libata-core.c
··· 4261 4261 ata_id_c_string(dev->id, model_rev, ATA_ID_FW_REV, sizeof(model_rev)); 4262 4262 4263 4263 while (ad->model_num) { 4264 - if (glob_match(model_num, ad->model_num)) { 4264 + if (glob_match(ad->model_num, model_num)) { 4265 4265 if (ad->model_rev == NULL) 4266 4266 return ad->horkage; 4267 - if (glob_match(model_rev, ad->model_rev)) 4267 + if (glob_match(ad->model_rev, model_rev)) 4268 4268 return ad->horkage; 4269 4269 } 4270 4270 ad++; ··· 6227 6227 } 6228 6228 6229 6229 rc = devm_request_irq(host->dev, irq, irq_handler, irq_flags, 6230 - dev_driver_string(host->dev), host); 6230 + dev_name(host->dev), host); 6231 6231 if (rc) 6232 6232 return rc; 6233 6233 ··· 6772 6772 /* 6773 6773 * Utility print functions 6774 6774 */ 6775 - int ata_port_printk(const struct ata_port *ap, const char *level, 6776 - const char *fmt, ...) 6775 + void ata_port_printk(const struct ata_port *ap, const char *level, 6776 + const char *fmt, ...) 6777 6777 { 6778 6778 struct va_format vaf; 6779 6779 va_list args; 6780 - int r; 6781 6780 6782 6781 va_start(args, fmt); 6783 6782 6784 6783 vaf.fmt = fmt; 6785 6784 vaf.va = &args; 6786 6785 6787 - r = printk("%sata%u: %pV", level, ap->print_id, &vaf); 6786 + printk("%sata%u: %pV", level, ap->print_id, &vaf); 6788 6787 6789 6788 va_end(args); 6790 - 6791 - return r; 6792 6789 } 6793 6790 EXPORT_SYMBOL(ata_port_printk); 6794 6791 6795 - int ata_link_printk(const struct ata_link *link, const char *level, 6796 - const char *fmt, ...) 6792 + void ata_link_printk(const struct ata_link *link, const char *level, 6793 + const char *fmt, ...) 6797 6794 { 6798 6795 struct va_format vaf; 6799 6796 va_list args; 6800 - int r; 6801 6797 6802 6798 va_start(args, fmt); 6803 6799 ··· 6801 6805 vaf.va = &args; 6802 6806 6803 6807 if (sata_pmp_attached(link->ap) || link->ap->slave_link) 6804 - r = printk("%sata%u.%02u: %pV", 6805 - level, link->ap->print_id, link->pmp, &vaf); 6808 + printk("%sata%u.%02u: %pV", 6809 + level, link->ap->print_id, link->pmp, &vaf); 6806 6810 else 6807 - r = printk("%sata%u: %pV", 6808 - level, link->ap->print_id, &vaf); 6811 + printk("%sata%u: %pV", 6812 + level, link->ap->print_id, &vaf); 6809 6813 6810 6814 va_end(args); 6811 - 6812 - return r; 6813 6815 } 6814 6816 EXPORT_SYMBOL(ata_link_printk); 6815 6817 6816 - int ata_dev_printk(const struct ata_device *dev, const char *level, 6818 + void ata_dev_printk(const struct ata_device *dev, const char *level, 6817 6819 const char *fmt, ...) 6818 6820 { 6819 6821 struct va_format vaf; 6820 6822 va_list args; 6821 - int r; 6822 6823 6823 6824 va_start(args, fmt); 6824 6825 6825 6826 vaf.fmt = fmt; 6826 6827 vaf.va = &args; 6827 6828 6828 - r = printk("%sata%u.%02u: %pV", 6829 - level, dev->link->ap->print_id, dev->link->pmp + dev->devno, 6830 - &vaf); 6829 + printk("%sata%u.%02u: %pV", 6830 + level, dev->link->ap->print_id, dev->link->pmp + dev->devno, 6831 + &vaf); 6831 6832 6832 6833 va_end(args); 6833 - 6834 - return r; 6835 6834 } 6836 6835 EXPORT_SYMBOL(ata_dev_printk); 6837 6836
+9 -11
drivers/ata/libata-sff.c
··· 2008 2008 2009 2009 DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); 2010 2010 2011 - /* software reset. causes dev0 to be selected */ 2012 - iowrite8(ap->ctl, ioaddr->ctl_addr); 2013 - udelay(20); /* FIXME: flush */ 2014 - iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr); 2015 - udelay(20); /* FIXME: flush */ 2016 - iowrite8(ap->ctl, ioaddr->ctl_addr); 2017 - ap->last_ctl = ap->ctl; 2011 + if (ap->ioaddr.ctl_addr) { 2012 + /* software reset. causes dev0 to be selected */ 2013 + iowrite8(ap->ctl, ioaddr->ctl_addr); 2014 + udelay(20); /* FIXME: flush */ 2015 + iowrite8(ap->ctl | ATA_SRST, ioaddr->ctl_addr); 2016 + udelay(20); /* FIXME: flush */ 2017 + iowrite8(ap->ctl, ioaddr->ctl_addr); 2018 + ap->last_ctl = ap->ctl; 2019 + } 2018 2020 2019 2021 /* wait the port to become ready */ 2020 2022 return ata_sff_wait_after_reset(&ap->link, devmask, deadline); ··· 2216 2214 ap->ops->sff_drain_fifo(qc); 2217 2215 2218 2216 spin_unlock_irqrestore(ap->lock, flags); 2219 - 2220 - /* ignore ata_sff_softreset if ctl isn't accessible */ 2221 - if (softreset == ata_sff_softreset && !ap->ioaddr.ctl_addr) 2222 - softreset = NULL; 2223 2217 2224 2218 /* ignore built-in hardresets if SCR access is not available */ 2225 2219 if ((hardreset == sata_std_hardreset ||
+2 -7
drivers/ata/pata_imx.c
··· 221 221 222 222 return 0; 223 223 } 224 - 225 - static const struct dev_pm_ops pata_imx_pm_ops = { 226 - .suspend = pata_imx_suspend, 227 - .resume = pata_imx_resume, 228 - }; 229 224 #endif 225 + 226 + static SIMPLE_DEV_PM_OPS(pata_imx_pm_ops, pata_imx_suspend, pata_imx_resume); 230 227 231 228 static const struct of_device_id imx_pata_dt_ids[] = { 232 229 { ··· 241 244 .name = DRV_NAME, 242 245 .of_match_table = imx_pata_dt_ids, 243 246 .owner = THIS_MODULE, 244 - #ifdef CONFIG_PM_SLEEP 245 247 .pm = &pata_imx_pm_ops, 246 - #endif 247 248 }, 248 249 }; 249 250
+6 -18
drivers/ata/pata_of_platform.c
··· 35 35 return -EINVAL; 36 36 } 37 37 38 - if (of_device_is_compatible(dn, "electra-ide")) { 39 - /* Altstatus is really at offset 0x3f6 from the primary window 40 - * on electra-ide. Adjust ctl_res and io_res accordingly. 41 - */ 42 - ctl_res = io_res; 43 - ctl_res.start = ctl_res.start+0x3f6; 44 - io_res.end = ctl_res.start-1; 45 - } else { 46 - ret = of_address_to_resource(dn, 1, &ctl_res); 47 - if (ret) { 48 - dev_err(&ofdev->dev, "can't get CTL address from " 49 - "device tree\n"); 50 - return -EINVAL; 51 - } 38 + ret = of_address_to_resource(dn, 1, &ctl_res); 39 + if (ret) { 40 + dev_err(&ofdev->dev, "can't get CTL address from " 41 + "device tree\n"); 42 + return -EINVAL; 52 43 } 53 44 54 45 irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0); 55 - if (irq_res) 56 - irq_res->flags = 0; 57 46 58 47 prop = of_get_property(dn, "reg-shift", NULL); 59 48 if (prop) ··· 68 79 69 80 static struct of_device_id pata_of_platform_match[] = { 70 81 { .compatible = "ata-generic", }, 71 - { .compatible = "electra-ide", }, 72 - {}, 82 + { }, 73 83 }; 74 84 MODULE_DEVICE_TABLE(of, pata_of_platform_match); 75 85
+1 -3
drivers/ata/pata_platform.c
··· 118 118 */ 119 119 if (irq_res && irq_res->start > 0) { 120 120 irq = irq_res->start; 121 - irq_flags = irq_res->flags; 121 + irq_flags = irq_res->flags & IRQF_TRIGGER_MASK; 122 122 } 123 123 124 124 /* ··· 213 213 * And the IRQ 214 214 */ 215 215 irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 216 - if (irq_res) 217 - irq_res->flags = pp_info ? pp_info->irq_flags : 0; 218 216 219 217 return __pata_platform_probe(&pdev->dev, io_res, ctl_res, irq_res, 220 218 pp_info ? pp_info->ioport_shift : 0,
+11 -2
drivers/ata/pata_serverworks.c
··· 251 251 pci_write_config_byte(pdev, 0x54, ultra_cfg); 252 252 } 253 253 254 - static struct scsi_host_template serverworks_sht = { 254 + static struct scsi_host_template serverworks_osb4_sht = { 255 + ATA_BMDMA_SHT(DRV_NAME), 256 + .sg_tablesize = LIBATA_DUMB_MAX_PRD, 257 + }; 258 + 259 + static struct scsi_host_template serverworks_csb_sht = { 255 260 ATA_BMDMA_SHT(DRV_NAME), 256 261 }; 257 262 258 263 static struct ata_port_operations serverworks_osb4_port_ops = { 259 264 .inherits = &ata_bmdma_port_ops, 265 + .qc_prep = ata_bmdma_dumb_qc_prep, 260 266 .cable_detect = serverworks_cable_detect, 261 267 .mode_filter = serverworks_osb4_filter, 262 268 .set_piomode = serverworks_set_piomode, ··· 271 265 272 266 static struct ata_port_operations serverworks_csb_port_ops = { 273 267 .inherits = &serverworks_osb4_port_ops, 268 + .qc_prep = ata_bmdma_qc_prep, 274 269 .mode_filter = serverworks_csb_filter, 275 270 }; 276 271 ··· 411 404 } 412 405 }; 413 406 const struct ata_port_info *ppi[] = { &info[id->driver_data], NULL }; 407 + struct scsi_host_template *sht = &serverworks_csb_sht; 414 408 int rc; 415 409 416 410 rc = pcim_enable_device(pdev); ··· 425 417 /* Select non UDMA capable OSB4 if we can't do fixups */ 426 418 if (rc < 0) 427 419 ppi[0] = &info[1]; 420 + sht = &serverworks_osb4_sht; 428 421 } 429 422 /* setup CSB5/CSB6 : South Bridge and IDE option RAID */ 430 423 else if ((pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) || ··· 442 433 ppi[1] = &ata_dummy_port_info; 443 434 } 444 435 445 - return ata_pci_bmdma_init_one(pdev, ppi, &serverworks_sht, NULL, 0); 436 + return ata_pci_bmdma_init_one(pdev, ppi, sht, NULL, 0); 446 437 } 447 438 448 439 #ifdef CONFIG_PM_SLEEP
+1 -2
drivers/ata/sata_highbank.c
··· 568 568 ahci_init_controller(host); 569 569 ahci_print_info(host, "platform"); 570 570 571 - rc = ata_host_activate(host, irq, ahci_interrupt, 0, 572 - &ahci_highbank_platform_sht); 571 + rc = ahci_host_activate(host, irq, &ahci_highbank_platform_sht); 573 572 if (rc) 574 573 goto err0; 575 574
-13
include/linux/ahci_platform.h
··· 22 22 struct ahci_host_priv; 23 23 struct platform_device; 24 24 25 - /* 26 - * Note ahci_platform_data is deprecated, it is only kept around for use 27 - * by the old da850 and spear13xx ahci code. 28 - * New drivers should instead declare their own platform_driver struct, and 29 - * use ahci_platform* functions in their own probe, suspend and resume methods. 30 - */ 31 - struct ahci_platform_data { 32 - int (*init)(struct device *dev, void __iomem *addr); 33 - void (*exit)(struct device *dev); 34 - int (*suspend)(struct device *dev); 35 - int (*resume)(struct device *dev); 36 - }; 37 - 38 25 int ahci_platform_enable_clks(struct ahci_host_priv *hpriv); 39 26 void ahci_platform_disable_clks(struct ahci_host_priv *hpriv); 40 27 int ahci_platform_enable_resources(struct ahci_host_priv *hpriv);
-5
include/linux/ata_platform.h
··· 8 8 * spacing used by ata_std_ports(). 9 9 */ 10 10 unsigned int ioport_shift; 11 - /* 12 - * Indicate platform specific irq types and initial 13 - * IRQ flags when call request_irq() 14 - */ 15 - unsigned int irq_flags; 16 11 }; 17 12 18 13 extern int __pata_platform_probe(struct device *dev,
+6 -6
include/linux/libata.h
··· 1404 1404 * printk helpers 1405 1405 */ 1406 1406 __printf(3, 4) 1407 - int ata_port_printk(const struct ata_port *ap, const char *level, 1408 - const char *fmt, ...); 1407 + void ata_port_printk(const struct ata_port *ap, const char *level, 1408 + const char *fmt, ...); 1409 1409 __printf(3, 4) 1410 - int ata_link_printk(const struct ata_link *link, const char *level, 1411 - const char *fmt, ...); 1410 + void ata_link_printk(const struct ata_link *link, const char *level, 1411 + const char *fmt, ...); 1412 1412 __printf(3, 4) 1413 - int ata_dev_printk(const struct ata_device *dev, const char *level, 1414 - const char *fmt, ...); 1413 + void ata_dev_printk(const struct ata_device *dev, const char *level, 1414 + const char *fmt, ...); 1415 1415 1416 1416 #define ata_port_err(ap, fmt, ...) \ 1417 1417 ata_port_printk(ap, KERN_ERR, fmt, ##__VA_ARGS__)