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

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

Pull libata updates from Tejun Heo:
"Mostly low level driver specific changes.

Two changes are somewhat noteworthy. First, Dan's patchset to support
per-port msix interrupt handling for ahci, which was tried last cycle
but had to be backed out due to a couple issues, is back and seems to
be working fine. Second, libata exception handling now uses
usleep_range() instead of msleep() for sleeps < 20ms which can make
things snappier in some corner cases"

* 'for-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata:
libata: skip debounce delay on link resume
ata: ahci_brcmstb: disable DIPM support
ata: ahci_brcmstb: enable support for ALPM
drivers: libata-core: Use usleep_range() instead of msleep() for short sleeps (<20 ms)
sata_sx4: correctly handling failed allocation
ata: ahci_brcmstb: add support for MIPS-based platforms
ahci: qoriq: Adjust the default register values on ls1021a
ahci: qoriq: Update the default Rx watermark value
ahci: qoriq: Adjust the default register values on ls1043a
ahci: compile out msi/msix infrastructure
ata: core: fix irq description on AHCI single irq systems
ata: ahci_brcmstb: remove unused definitions
ata: ahci_brcmstb: add a quirk for MIPS-based platforms
ata: ahci_brcmstb: disable NCQ for MIPS-based platforms
ata: sata_rcar: Remove obsolete platform_device_id entries
sata_rcar: Add compatible string for r8a7795
ahci: kill 'intr_status'
ahci: switch from 'threaded' to 'hardirq' interrupt handling
ahci: per-port msix support

+198 -83
+3 -1
Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt
··· 4 4 Each SATA controller should have its own node. 5 5 6 6 Required properties: 7 - - compatible : compatible list, may contain "brcm,bcm7445-ahci" and/or 7 + - compatible : should be one or more of 8 + "brcm,bcm7425-ahci" 9 + "brcm,bcm7445-ahci" 8 10 "brcm,sata3-ahci" 9 11 - reg : register mappings for AHCI and SATA_TOP_CTRL 10 12 - reg-names : "ahci" and "top-ctrl"
+1
Documentation/devicetree/bindings/ata/sata_rcar.txt
··· 8 8 - "renesas,sata-r8a7790" for R-Car H2 other than ES1 9 9 - "renesas,sata-r8a7791" for R-Car M2-W 10 10 - "renesas,sata-r8a7793" for R-Car M2-N 11 + - "renesas,sata-r8a7795" for R-Car H3 11 12 - reg : address and length of the SATA registers; 12 13 - interrupts : must consist of one interrupt specifier. 13 14 - clocks : must contain a reference to the functional clock.
+1 -1
drivers/ata/Kconfig
··· 100 100 101 101 config AHCI_BRCMSTB 102 102 tristate "Broadcom STB AHCI SATA support" 103 - depends on ARCH_BRCMSTB 103 + depends on ARCH_BRCMSTB || BMIPS_GENERIC 104 104 help 105 105 This option enables support for the AHCI SATA3 controller found on 106 106 STB SoC's.
+45 -22
drivers/ata/ahci.c
··· 1306 1306 #endif 1307 1307 1308 1308 /* 1309 - * ahci_init_msix() only implements single MSI-X support, not multiple 1310 - * MSI-X per-port interrupts. This is needed for host controllers that only 1311 - * have MSI-X support implemented, but no MSI or intx. 1309 + * ahci_init_msix() - optionally enable per-port MSI-X otherwise defer 1310 + * to single msi. 1312 1311 */ 1313 1312 static int ahci_init_msix(struct pci_dev *pdev, unsigned int n_ports, 1314 - struct ahci_host_priv *hpriv) 1313 + struct ahci_host_priv *hpriv, unsigned long flags) 1315 1314 { 1316 - int rc, nvec; 1317 - struct msix_entry entry = {}; 1315 + int nvec, i, rc; 1318 1316 1319 1317 /* Do not init MSI-X if MSI is disabled for the device */ 1320 1318 if (hpriv->flags & AHCI_HFLAG_NO_MSI) ··· 1322 1324 if (nvec < 0) 1323 1325 return nvec; 1324 1326 1325 - if (!nvec) { 1327 + /* 1328 + * Proper MSI-X implementations will have a vector per-port. 1329 + * Barring that, we prefer single-MSI over single-MSIX. If this 1330 + * check fails (not enough MSI-X vectors for all ports) we will 1331 + * be called again with the flag clear iff ahci_init_msi() 1332 + * fails. 1333 + */ 1334 + if (flags & AHCI_HFLAG_MULTI_MSIX) { 1335 + if (nvec < n_ports) 1336 + return -ENODEV; 1337 + nvec = n_ports; 1338 + } else if (nvec) { 1339 + nvec = 1; 1340 + } else { 1341 + /* 1342 + * Emit dev_err() since this was the non-legacy irq 1343 + * method of last resort. 1344 + */ 1326 1345 rc = -ENODEV; 1327 1346 goto fail; 1328 1347 } 1329 1348 1330 - /* 1331 - * There can be more than one vector (e.g. for error detection or 1332 - * hdd hotplug). Only the first vector (entry.entry = 0) is used. 1333 - */ 1334 - rc = pci_enable_msix_exact(pdev, &entry, 1); 1349 + for (i = 0; i < nvec; i++) 1350 + hpriv->msix[i].entry = i; 1351 + rc = pci_enable_msix_exact(pdev, hpriv->msix, nvec); 1335 1352 if (rc < 0) 1336 1353 goto fail; 1337 1354 1338 - hpriv->irq = entry.vector; 1355 + if (nvec > 1) 1356 + hpriv->flags |= AHCI_HFLAG_MULTI_MSIX; 1357 + hpriv->irq = hpriv->msix[0].vector; /* for single msi-x */ 1339 1358 1340 - return 1; 1359 + return nvec; 1341 1360 fail: 1342 1361 dev_err(&pdev->dev, 1343 1362 "failed to enable MSI-X with error %d, # of vectors: %d\n", ··· 1418 1403 { 1419 1404 int nvec; 1420 1405 1406 + /* 1407 + * Try to enable per-port MSI-X. If the host is not capable 1408 + * fall back to single MSI before finally attempting single 1409 + * MSI-X. 1410 + */ 1411 + nvec = ahci_init_msix(pdev, n_ports, hpriv, AHCI_HFLAG_MULTI_MSIX); 1412 + if (nvec >= 0) 1413 + return nvec; 1414 + 1421 1415 nvec = ahci_init_msi(pdev, n_ports, hpriv); 1422 1416 if (nvec >= 0) 1423 1417 return nvec; 1424 1418 1425 - /* 1426 - * Currently, MSI-X support only implements single IRQ mode and 1427 - * exists for controllers which can't do other types of IRQ. Only 1428 - * set it up if MSI fails. 1429 - */ 1430 - nvec = ahci_init_msix(pdev, n_ports, hpriv); 1419 + /* try single-msix */ 1420 + nvec = ahci_init_msix(pdev, n_ports, hpriv, 0); 1431 1421 if (nvec >= 0) 1432 1422 return nvec; 1433 1423 1434 - /* lagacy intx interrupts */ 1424 + /* legacy intx interrupts */ 1435 1425 pci_intx(pdev, 1); 1436 1426 hpriv->irq = pdev->irq; 1437 1427 ··· 1598 1578 if (!host) 1599 1579 return -ENOMEM; 1600 1580 host->private_data = hpriv; 1601 - 1581 + hpriv->msix = devm_kzalloc(&pdev->dev, 1582 + sizeof(struct msix_entry) * n_ports, GFP_KERNEL); 1583 + if (!hpriv->msix) 1584 + return -ENOMEM; 1602 1585 ahci_init_interrupts(pdev, n_ports, hpriv); 1603 1586 1604 1587 if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss)
+25 -2
drivers/ata/ahci.h
··· 35 35 #ifndef _AHCI_H 36 36 #define _AHCI_H 37 37 38 + #include <linux/pci.h> 38 39 #include <linux/clk.h> 39 40 #include <linux/libata.h> 40 41 #include <linux/phy/phy.h> ··· 238 237 AHCI_HFLAG_DELAY_ENGINE = (1 << 15), /* do not start engine on 239 238 port start (wait until 240 239 error-handling stage) */ 241 - AHCI_HFLAG_MULTI_MSI = (1 << 16), /* multiple PCI MSIs */ 242 240 AHCI_HFLAG_NO_DEVSLP = (1 << 17), /* no device sleep */ 243 241 AHCI_HFLAG_NO_FBS = (1 << 18), /* no FBS */ 244 242 AHCI_HFLAG_EDGE_IRQ = (1 << 19), /* HOST_IRQ_STAT behaves as 245 243 Edge Triggered */ 244 + #ifdef CONFIG_PCI_MSI 245 + AHCI_HFLAG_MULTI_MSI = (1 << 20), /* multiple PCI MSIs */ 246 + AHCI_HFLAG_MULTI_MSIX = (1 << 21), /* per-port MSI-X */ 247 + #else 248 + /* compile out MSI infrastructure */ 249 + AHCI_HFLAG_MULTI_MSI = 0, 250 + AHCI_HFLAG_MULTI_MSIX = 0, 251 + #endif 246 252 247 253 /* ap->flags bits */ 248 254 ··· 316 308 unsigned int ncq_saw_d2h:1; 317 309 unsigned int ncq_saw_dmas:1; 318 310 unsigned int ncq_saw_sdb:1; 319 - atomic_t intr_status; /* interrupts to handle */ 320 311 spinlock_t lock; /* protects parent ata_port */ 321 312 u32 intr_mask; /* interrupts to enable */ 322 313 bool fbs_supported; /* set iff FBS is supported */ ··· 350 343 * the PHY position in this array. 351 344 */ 352 345 struct phy **phys; 346 + struct msix_entry *msix; /* Optional MSI-X support */ 353 347 unsigned nports; /* Number of ports */ 354 348 void *plat_data; /* Other platform data */ 355 349 unsigned int irq; /* interrupt line */ ··· 361 353 */ 362 354 void (*start_engine)(struct ata_port *ap); 363 355 }; 356 + 357 + #ifdef CONFIG_PCI_MSI 358 + static inline int ahci_irq_vector(struct ahci_host_priv *hpriv, int port) 359 + { 360 + if (hpriv->flags & AHCI_HFLAG_MULTI_MSIX) 361 + return hpriv->msix[port].vector; 362 + else 363 + return hpriv->irq + port; 364 + } 365 + #else 366 + static inline int ahci_irq_vector(struct ahci_host_priv *hpriv, int port) 367 + { 368 + return hpriv->irq; 369 + } 370 + #endif 364 371 365 372 extern int ahci_ignore_sss; 366 373
+58 -3
drivers/ata/ahci_brcmstb.c
··· 52 52 #define SATA_TOP_CTRL_2_PHY_GLOBAL_RESET BIT(14) 53 53 #define SATA_TOP_CTRL_PHY_OFFS 0x8 54 54 #define SATA_TOP_MAX_PHYS 2 55 - #define SATA_TOP_CTRL_SATA_TP_OUT 0x1c 56 - #define SATA_TOP_CTRL_CLIENT_INIT_CTRL 0x20 55 + 56 + #define SATA_FIRST_PORT_CTRL 0x700 57 + #define SATA_NEXT_PORT_CTRL_OFFSET 0x80 58 + #define SATA_PORT_PCTRL6(reg_base) (reg_base + 0x18) 57 59 58 60 /* On big-endian MIPS, buses are reversed to big endian, so switch them back */ 59 61 #if defined(CONFIG_MIPS) && defined(__BIG_ENDIAN) ··· 71 69 (DATA_ENDIAN << DMADESC_ENDIAN_SHIFT) | \ 72 70 (MMIO_ENDIAN << MMIO_ENDIAN_SHIFT)) 73 71 72 + enum brcm_ahci_quirks { 73 + BRCM_AHCI_QUIRK_NO_NCQ = BIT(0), 74 + BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE = BIT(1), 75 + }; 76 + 74 77 struct brcm_ahci_priv { 75 78 struct device *dev; 76 79 void __iomem *top_ctrl; 77 80 u32 port_mask; 81 + u32 quirks; 78 82 }; 79 83 80 84 static const struct ata_port_info ahci_brcm_port_info = { 81 - .flags = AHCI_FLAG_COMMON, 85 + .flags = AHCI_FLAG_COMMON | ATA_FLAG_NO_DIPM, 86 + .link_flags = ATA_LFLAG_NO_DB_DELAY, 82 87 .pio_mask = ATA_PIO4, 83 88 .udma_mask = ATA_UDMA6, 84 89 .port_ops = &ahci_platform_ops, ··· 116 107 writel_relaxed(val, addr); 117 108 } 118 109 110 + static void brcm_sata_alpm_init(struct ahci_host_priv *hpriv) 111 + { 112 + struct brcm_ahci_priv *priv = hpriv->plat_data; 113 + u32 bus_ctrl, port_ctrl, host_caps; 114 + int i; 115 + 116 + /* Enable support for ALPM */ 117 + bus_ctrl = brcm_sata_readreg(priv->top_ctrl + 118 + SATA_TOP_CTRL_BUS_CTRL); 119 + brcm_sata_writereg(bus_ctrl | OVERRIDE_HWINIT, 120 + priv->top_ctrl + SATA_TOP_CTRL_BUS_CTRL); 121 + host_caps = readl(hpriv->mmio + HOST_CAP); 122 + writel(host_caps | HOST_CAP_ALPM, hpriv->mmio); 123 + brcm_sata_writereg(bus_ctrl, priv->top_ctrl + SATA_TOP_CTRL_BUS_CTRL); 124 + 125 + /* 126 + * Adjust timeout to allow PLL sufficient time to lock while waking 127 + * up from slumber mode. 128 + */ 129 + for (i = 0, port_ctrl = SATA_FIRST_PORT_CTRL; 130 + i < SATA_TOP_MAX_PHYS; 131 + i++, port_ctrl += SATA_NEXT_PORT_CTRL_OFFSET) { 132 + if (priv->port_mask & BIT(i)) 133 + writel(0xff1003fc, 134 + hpriv->mmio + SATA_PORT_PCTRL6(port_ctrl)); 135 + } 136 + } 137 + 119 138 static void brcm_sata_phy_enable(struct brcm_ahci_priv *priv, int port) 120 139 { 121 140 void __iomem *phyctrl = priv->top_ctrl + SATA_TOP_CTRL_PHY_CTRL + 122 141 (port * SATA_TOP_CTRL_PHY_OFFS); 123 142 void __iomem *p; 124 143 u32 reg; 144 + 145 + if (priv->quirks & BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE) 146 + return; 125 147 126 148 /* clear PHY_DEFAULT_POWER_STATE */ 127 149 p = phyctrl + SATA_TOP_CTRL_PHY_CTRL_1; ··· 182 142 (port * SATA_TOP_CTRL_PHY_OFFS); 183 143 void __iomem *p; 184 144 u32 reg; 145 + 146 + if (priv->quirks & BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE) 147 + return; 185 148 186 149 /* power-off the PHY digital logic */ 187 150 p = phyctrl + SATA_TOP_CTRL_PHY_CTRL_2; ··· 273 230 274 231 brcm_sata_init(priv); 275 232 brcm_sata_phys_enable(priv); 233 + brcm_sata_alpm_init(hpriv); 276 234 return ahci_platform_resume(dev); 277 235 } 278 236 #endif ··· 300 256 if (IS_ERR(priv->top_ctrl)) 301 257 return PTR_ERR(priv->top_ctrl); 302 258 259 + if (of_device_is_compatible(dev->of_node, "brcm,bcm7425-ahci")) { 260 + priv->quirks |= BRCM_AHCI_QUIRK_NO_NCQ; 261 + priv->quirks |= BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE; 262 + } 263 + 303 264 brcm_sata_init(priv); 304 265 305 266 priv->port_mask = brcm_ahci_get_portmask(pdev, priv); ··· 318 269 return PTR_ERR(hpriv); 319 270 hpriv->plat_data = priv; 320 271 272 + brcm_sata_alpm_init(hpriv); 273 + 321 274 ret = ahci_platform_enable_resources(hpriv); 322 275 if (ret) 323 276 return ret; 277 + 278 + if (priv->quirks & BRCM_AHCI_QUIRK_NO_NCQ) 279 + hpriv->flags |= AHCI_HFLAG_NO_NCQ; 324 280 325 281 ret = ahci_platform_init_host(pdev, hpriv, &ahci_brcm_port_info, 326 282 &ahci_platform_sht); ··· 354 300 } 355 301 356 302 static const struct of_device_id ahci_of_match[] = { 303 + {.compatible = "brcm,bcm7425-ahci"}, 357 304 {.compatible = "brcm,bcm7445-ahci"}, 358 305 {}, 359 306 };
+22 -9
drivers/ata/ahci_qoriq.c
··· 34 34 35 35 /* port register default value */ 36 36 #define AHCI_PORT_PHY_1_CFG 0xa003fffe 37 - #define AHCI_PORT_PHY_2_CFG 0x28183411 38 - #define AHCI_PORT_PHY_3_CFG 0x0e081004 39 - #define AHCI_PORT_PHY_4_CFG 0x00480811 40 - #define AHCI_PORT_PHY_5_CFG 0x192c96a4 41 - #define AHCI_PORT_TRANS_CFG 0x08000025 37 + #define AHCI_PORT_TRANS_CFG 0x08000029 38 + 39 + /* for ls1021a */ 40 + #define LS1021A_PORT_PHY2 0x28183414 41 + #define LS1021A_PORT_PHY3 0x0e080e06 42 + #define LS1021A_PORT_PHY4 0x064a080b 43 + #define LS1021A_PORT_PHY5 0x2aa86470 42 44 43 45 #define SATA_ECC_DISABLE 0x00020000 46 + 47 + /* for ls1043a */ 48 + #define LS1043A_PORT_PHY2 0x28184d1f 49 + #define LS1043A_PORT_PHY3 0x0e081509 44 50 45 51 enum ahci_qoriq_type { 46 52 AHCI_LS1021A, ··· 157 151 case AHCI_LS1021A: 158 152 writel(SATA_ECC_DISABLE, qpriv->ecc_addr); 159 153 writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); 160 - writel(AHCI_PORT_PHY_2_CFG, reg_base + PORT_PHY2); 161 - writel(AHCI_PORT_PHY_3_CFG, reg_base + PORT_PHY3); 162 - writel(AHCI_PORT_PHY_4_CFG, reg_base + PORT_PHY4); 163 - writel(AHCI_PORT_PHY_5_CFG, reg_base + PORT_PHY5); 154 + writel(LS1021A_PORT_PHY2, reg_base + PORT_PHY2); 155 + writel(LS1021A_PORT_PHY3, reg_base + PORT_PHY3); 156 + writel(LS1021A_PORT_PHY4, reg_base + PORT_PHY4); 157 + writel(LS1021A_PORT_PHY5, reg_base + PORT_PHY5); 164 158 writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); 165 159 break; 166 160 167 161 case AHCI_LS1043A: 162 + writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); 163 + writel(LS1043A_PORT_PHY2, reg_base + PORT_PHY2); 164 + writel(LS1043A_PORT_PHY3, reg_base + PORT_PHY3); 165 + writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); 166 + break; 167 + 168 168 case AHCI_LS2080A: 169 169 writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); 170 + writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); 170 171 break; 171 172 } 172 173
+16 -30
drivers/ata/libahci.c
··· 43 43 #include <scsi/scsi_host.h> 44 44 #include <scsi/scsi_cmnd.h> 45 45 #include <linux/libata.h> 46 + #include <linux/pci.h> 46 47 #include "ahci.h" 47 48 #include "libata.h" 48 49 ··· 1805 1804 ahci_handle_port_interrupt(ap, port_mmio, status); 1806 1805 } 1807 1806 1808 - static irqreturn_t ahci_port_thread_fn(int irq, void *dev_instance) 1809 - { 1810 - struct ata_port *ap = dev_instance; 1811 - struct ahci_port_priv *pp = ap->private_data; 1812 - void __iomem *port_mmio = ahci_port_base(ap); 1813 - u32 status; 1814 - 1815 - status = atomic_xchg(&pp->intr_status, 0); 1816 - if (!status) 1817 - return IRQ_NONE; 1818 - 1819 - spin_lock_bh(ap->lock); 1820 - ahci_handle_port_interrupt(ap, port_mmio, status); 1821 - spin_unlock_bh(ap->lock); 1822 - 1823 - return IRQ_HANDLED; 1824 - } 1825 - 1826 - static irqreturn_t ahci_multi_irqs_intr(int irq, void *dev_instance) 1807 + static irqreturn_t ahci_multi_irqs_intr_hard(int irq, void *dev_instance) 1827 1808 { 1828 1809 struct ata_port *ap = dev_instance; 1829 1810 void __iomem *port_mmio = ahci_port_base(ap); 1830 - struct ahci_port_priv *pp = ap->private_data; 1831 1811 u32 status; 1832 1812 1833 1813 VPRINTK("ENTER\n"); ··· 1816 1834 status = readl(port_mmio + PORT_IRQ_STAT); 1817 1835 writel(status, port_mmio + PORT_IRQ_STAT); 1818 1836 1819 - atomic_or(status, &pp->intr_status); 1837 + spin_lock(ap->lock); 1838 + ahci_handle_port_interrupt(ap, port_mmio, status); 1839 + spin_unlock(ap->lock); 1820 1840 1821 1841 VPRINTK("EXIT\n"); 1822 1842 1823 - return IRQ_WAKE_THREAD; 1843 + return IRQ_HANDLED; 1824 1844 } 1825 1845 1826 1846 static u32 ahci_handle_port_intr(struct ata_host *host, u32 irq_masked) ··· 2463 2479 } 2464 2480 EXPORT_SYMBOL_GPL(ahci_set_em_messages); 2465 2481 2466 - static int ahci_host_activate_multi_irqs(struct ata_host *host, int irq, 2482 + static int ahci_host_activate_multi_irqs(struct ata_host *host, 2467 2483 struct scsi_host_template *sht) 2468 2484 { 2485 + struct ahci_host_priv *hpriv = host->private_data; 2469 2486 int i, rc; 2470 2487 2471 2488 rc = ata_host_start(host); ··· 2478 2493 */ 2479 2494 for (i = 0; i < host->n_ports; i++) { 2480 2495 struct ahci_port_priv *pp = host->ports[i]->private_data; 2496 + int irq = ahci_irq_vector(hpriv, i); 2481 2497 2482 2498 /* Do not receive interrupts sent by dummy ports */ 2483 2499 if (!pp) { ··· 2486 2500 continue; 2487 2501 } 2488 2502 2489 - rc = devm_request_threaded_irq(host->dev, irq + i, 2490 - ahci_multi_irqs_intr, 2491 - ahci_port_thread_fn, 0, 2492 - pp->irq_desc, host->ports[i]); 2503 + rc = devm_request_irq(host->dev, irq, ahci_multi_irqs_intr_hard, 2504 + 0, pp->irq_desc, host->ports[i]); 2505 + 2493 2506 if (rc) 2494 2507 return rc; 2495 - ata_port_desc(host->ports[i], "irq %d", irq + i); 2508 + ata_port_desc(host->ports[i], "irq %d", irq); 2496 2509 } 2510 + 2497 2511 return ata_host_register(host, sht); 2498 2512 } 2499 2513 ··· 2514 2528 int irq = hpriv->irq; 2515 2529 int rc; 2516 2530 2517 - if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) 2518 - rc = ahci_host_activate_multi_irqs(host, irq, sht); 2531 + if (hpriv->flags & (AHCI_HFLAG_MULTI_MSI | AHCI_HFLAG_MULTI_MSIX)) 2532 + rc = ahci_host_activate_multi_irqs(host, sht); 2519 2533 else if (hpriv->flags & AHCI_HFLAG_EDGE_IRQ) 2520 2534 rc = ata_host_activate(host, irq, ahci_single_edge_irq_intr, 2521 2535 IRQF_SHARED, sht);
+17 -3
drivers/ata/libata-core.c
··· 50 50 #include <linux/blkdev.h> 51 51 #include <linux/delay.h> 52 52 #include <linux/timer.h> 53 + #include <linux/time.h> 53 54 #include <linux/interrupt.h> 54 55 #include <linux/completion.h> 55 56 #include <linux/suspend.h> ··· 3598 3597 * immediately after resuming. Delay 200ms before 3599 3598 * debouncing. 3600 3599 */ 3601 - ata_msleep(link->ap, 200); 3600 + if (!(link->flags & ATA_LFLAG_NO_DB_DELAY)) 3601 + ata_msleep(link->ap, 200); 3602 3602 3603 3603 /* is SControl restored correctly? */ 3604 3604 if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol))) ··· 6225 6223 struct scsi_host_template *sht) 6226 6224 { 6227 6225 int i, rc; 6226 + char *irq_desc; 6228 6227 6229 6228 rc = ata_host_start(host); 6230 6229 if (rc) ··· 6237 6234 return ata_host_register(host, sht); 6238 6235 } 6239 6236 6237 + irq_desc = devm_kasprintf(host->dev, GFP_KERNEL, "%s[%s]", 6238 + dev_driver_string(host->dev), 6239 + dev_name(host->dev)); 6240 + if (!irq_desc) 6241 + return -ENOMEM; 6242 + 6240 6243 rc = devm_request_irq(host->dev, irq, irq_handler, irq_flags, 6241 - dev_name(host->dev), host); 6244 + irq_desc, host); 6242 6245 if (rc) 6243 6246 return rc; 6244 6247 ··· 6706 6697 if (owns_eh) 6707 6698 ata_eh_release(ap); 6708 6699 6709 - msleep(msecs); 6700 + if (msecs < 20) { 6701 + unsigned long usecs = msecs * USEC_PER_MSEC; 6702 + usleep_range(usecs, usecs + 50); 6703 + } else { 6704 + msleep(msecs); 6705 + } 6710 6706 6711 6707 if (owns_eh) 6712 6708 ata_eh_acquire(ap);
+7 -12
drivers/ata/sata_rcar.c
··· 854 854 .compatible = "renesas,sata-r8a7793", 855 855 .data = (void *)RCAR_GEN2_SATA 856 856 }, 857 + { 858 + .compatible = "renesas,sata-r8a7795", 859 + .data = (void *)RCAR_GEN2_SATA 860 + }, 857 861 { }, 858 862 }; 859 863 MODULE_DEVICE_TABLE(of, sata_rcar_match); 860 - 861 - static const struct platform_device_id sata_rcar_id_table[] = { 862 - { "sata_rcar", RCAR_GEN1_SATA }, /* Deprecated by "sata-r8a7779" */ 863 - { "sata-r8a7779", RCAR_GEN1_SATA }, 864 - { }, 865 - }; 866 - MODULE_DEVICE_TABLE(platform, sata_rcar_id_table); 867 864 868 865 static int sata_rcar_probe(struct platform_device *pdev) 869 866 { ··· 881 884 return -ENOMEM; 882 885 883 886 of_id = of_match_device(sata_rcar_match, &pdev->dev); 884 - if (of_id) 885 - priv->type = (enum sata_rcar_type)of_id->data; 886 - else 887 - priv->type = platform_get_device_id(pdev)->driver_data; 887 + if (!of_id) 888 + return -ENODEV; 888 889 890 + priv->type = (enum sata_rcar_type)of_id->data; 889 891 priv->clk = devm_clk_get(&pdev->dev, NULL); 890 892 if (IS_ERR(priv->clk)) { 891 893 dev_err(&pdev->dev, "failed to get access to sata clock\n"); ··· 1014 1018 static struct platform_driver sata_rcar_driver = { 1015 1019 .probe = sata_rcar_probe, 1016 1020 .remove = sata_rcar_remove, 1017 - .id_table = sata_rcar_id_table, 1018 1021 .driver = { 1019 1022 .name = DRV_NAME, 1020 1023 .of_match_table = sata_rcar_match,
+2
drivers/ata/sata_sx4.c
··· 1396 1396 addr = 0; 1397 1397 length = size * 1024 * 1024; 1398 1398 buf = kzalloc(ECC_ERASE_BUF_SZ, GFP_KERNEL); 1399 + if (!buf) 1400 + return 1; 1399 1401 while (addr < length) { 1400 1402 pdc20621_put_to_dimm(host, buf, addr, 1401 1403 ECC_ERASE_BUF_SZ);
+1
include/linux/libata.h
··· 205 205 ATA_LFLAG_NO_LPM = (1 << 8), /* disable LPM on this link */ 206 206 ATA_LFLAG_RST_ONCE = (1 << 9), /* limit recovery to one reset */ 207 207 ATA_LFLAG_CHANGED = (1 << 10), /* LPM state changed on this link */ 208 + ATA_LFLAG_NO_DB_DELAY = (1 << 11), /* no debounce delay on link resume */ 208 209 209 210 /* struct ata_port flags */ 210 211 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */