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

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

Pull libata updates from Tejun Heo:
"Nothing too interesting. Mostly ahci and ahci_platform changes, many
around power management"

* 'for-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: (22 commits)
ata: ahci_platform: enable to get and control reset
ata: libahci_platform: add reset control support
ata: add an extra argument to ahci_platform_get_resources()
ata: sata_rcar: Add r8a77965 support
ata: sata_rcar: exclude setting of PHY registers in Gen3
ata: sata_rcar: really mask all interrupts on Gen2 and later
Revert "ata: ahci_platform: allow disabling of hotplug to save power"
ata: libahci: Allow reconfigure of DEVSLP register
ata: libahci: Correct setting of DEVSLP register
ata: ahci: Enable DEVSLP by default on x86 with SLP_S0
ata: ahci: Support state with min power but Partial low power state
Revert "ata: ahci_platform: convert kcalloc to devm_kcalloc"
ata: sata_rcar: Add rudimentary Runtime PM support
ata: sata_rcar: Provide a short-hand for &pdev->dev
ata: Only output sg element mapped number in verbose debug
ata: Guard ata_scsi_dump_cdb() by ATA_VERBOSE_DEBUG
ata: ahci_platform: convert kcalloc to devm_kcalloc
ata: ahci_platform: convert kzallloc to kcalloc
ata: ahci_platform: correct parameter documentation for ahci_platform_shutdown
libata: remove ata_sff_data_xfer_noirq()
...

+166 -126
+1
Documentation/devicetree/bindings/ata/ahci-platform.txt
··· 29 29 Optional properties: 30 30 - dma-coherent : Present if dma operations are coherent 31 31 - clocks : a list of phandle + clock specifier pairs 32 + - resets : a list of phandle + reset specifier pairs 32 33 - target-supply : regulator for SATA target power 33 34 - phys : reference to the SATA PHY node 34 35 - phy-names : must be "sata-phy"
+1
Documentation/devicetree/bindings/ata/sata_rcar.txt
··· 8 8 - "renesas,sata-r8a7791" for R-Car M2-W 9 9 - "renesas,sata-r8a7793" for R-Car M2-N 10 10 - "renesas,sata-r8a7795" for R-Car H3 11 + - "renesas,sata-r8a77965" for R-Car M3-N 11 12 - "renesas,rcar-gen2-sata" for a generic R-Car Gen2 compatible device 12 13 - "renesas,rcar-gen3-sata" for a generic R-Car Gen3 compatible device 13 14 - "renesas,rcar-sata" is deprecated
+1 -2
Documentation/driver-api/libata.rst
··· 118 118 All bmdma-style drivers must implement this hook. This is the low-level 119 119 operation that actually copies the data bytes during a PIO data 120 120 transfer. Typically the driver will choose one of 121 - :c:func:`ata_sff_data_xfer_noirq`, :c:func:`ata_sff_data_xfer`, or 122 - :c:func:`ata_sff_data_xfer32`. 121 + :c:func:`ata_sff_data_xfer`, or :c:func:`ata_sff_data_xfer32`. 123 122 124 123 ATA command execute 125 124 ~~~~~~~~~~~~~~~~~~~
+33 -5
drivers/ata/ahci.c
··· 610 610 module_param(marvell_enable, int, 0644); 611 611 MODULE_PARM_DESC(marvell_enable, "Marvell SATA via AHCI (1 = enabled)"); 612 612 613 - static int mobile_lpm_policy = CONFIG_SATA_MOBILE_LPM_POLICY; 613 + static int mobile_lpm_policy = -1; 614 614 module_param(mobile_lpm_policy, int, 0644); 615 615 MODULE_PARM_DESC(mobile_lpm_policy, "Default LPM policy for mobile chipsets"); 616 616 ··· 1604 1604 return pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX); 1605 1605 } 1606 1606 1607 + static void ahci_update_initial_lpm_policy(struct ata_port *ap, 1608 + struct ahci_host_priv *hpriv) 1609 + { 1610 + int policy = CONFIG_SATA_MOBILE_LPM_POLICY; 1611 + 1612 + 1613 + /* Ignore processing for non mobile platforms */ 1614 + if (!(hpriv->flags & AHCI_HFLAG_IS_MOBILE)) 1615 + return; 1616 + 1617 + /* user modified policy via module param */ 1618 + if (mobile_lpm_policy != -1) { 1619 + policy = mobile_lpm_policy; 1620 + goto update_policy; 1621 + } 1622 + 1623 + #ifdef CONFIG_ACPI 1624 + if (policy > ATA_LPM_MED_POWER && 1625 + (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) { 1626 + if (hpriv->cap & HOST_CAP_PART) 1627 + policy = ATA_LPM_MIN_POWER_WITH_PARTIAL; 1628 + else if (hpriv->cap & HOST_CAP_SSC) 1629 + policy = ATA_LPM_MIN_POWER; 1630 + } 1631 + #endif 1632 + 1633 + update_policy: 1634 + if (policy >= ATA_LPM_UNKNOWN && policy <= ATA_LPM_MIN_POWER) 1635 + ap->target_lpm_policy = policy; 1636 + } 1637 + 1607 1638 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 1608 1639 { 1609 1640 unsigned int board_id = ent->driver_data; ··· 1838 1807 if (ap->flags & ATA_FLAG_EM) 1839 1808 ap->em_message_type = hpriv->em_msg_type; 1840 1809 1841 - if ((hpriv->flags & AHCI_HFLAG_IS_MOBILE) && 1842 - mobile_lpm_policy >= ATA_LPM_UNKNOWN && 1843 - mobile_lpm_policy <= ATA_LPM_MIN_POWER) 1844 - ap->target_lpm_policy = mobile_lpm_policy; 1810 + ahci_update_initial_lpm_policy(ap, hpriv); 1845 1811 1846 1812 /* disabled/not-implemented port */ 1847 1813 if (!(hpriv->port_map & (1 << i)))
+1
drivers/ata/ahci.h
··· 350 350 u32 em_msg_type; /* EM message type */ 351 351 bool got_runtime_pm; /* Did we do pm_runtime_get? */ 352 352 struct clk *clks[AHCI_MAX_CLKS]; /* Optional */ 353 + struct reset_control *rsts; /* Optional */ 353 354 struct regulator **target_pwrs; /* Optional */ 354 355 /* 355 356 * If platform uses PHYs. There is a 1:1 relation between the port number and
+1 -1
drivers/ata/ahci_brcm.c
··· 425 425 426 426 brcm_sata_phys_enable(priv); 427 427 428 - hpriv = ahci_platform_get_resources(pdev); 428 + hpriv = ahci_platform_get_resources(pdev, 0); 429 429 if (IS_ERR(hpriv)) 430 430 return PTR_ERR(hpriv); 431 431 hpriv->plat_data = priv;
+1 -1
drivers/ata/ahci_ceva.c
··· 213 213 214 214 cevapriv->ahci_pdev = pdev; 215 215 216 - hpriv = ahci_platform_get_resources(pdev); 216 + hpriv = ahci_platform_get_resources(pdev, 0); 217 217 if (IS_ERR(hpriv)) 218 218 return PTR_ERR(hpriv); 219 219
+1 -1
drivers/ata/ahci_da850.c
··· 171 171 u32 mpy; 172 172 int rc; 173 173 174 - hpriv = ahci_platform_get_resources(pdev); 174 + hpriv = ahci_platform_get_resources(pdev, 0); 175 175 if (IS_ERR(hpriv)) 176 176 return PTR_ERR(hpriv); 177 177
+1 -1
drivers/ata/ahci_dm816.c
··· 148 148 struct ahci_host_priv *hpriv; 149 149 int rc; 150 150 151 - hpriv = ahci_platform_get_resources(pdev); 151 + hpriv = ahci_platform_get_resources(pdev, 0); 152 152 if (IS_ERR(hpriv)) 153 153 return PTR_ERR(hpriv); 154 154
+1 -1
drivers/ata/ahci_imx.c
··· 1127 1127 return ret; 1128 1128 } 1129 1129 1130 - hpriv = ahci_platform_get_resources(pdev); 1130 + hpriv = ahci_platform_get_resources(pdev, 0); 1131 1131 if (IS_ERR(hpriv)) 1132 1132 return PTR_ERR(hpriv); 1133 1133
+1 -1
drivers/ata/ahci_mtk.c
··· 142 142 if (!plat) 143 143 return -ENOMEM; 144 144 145 - hpriv = ahci_platform_get_resources(pdev); 145 + hpriv = ahci_platform_get_resources(pdev, 0); 146 146 if (IS_ERR(hpriv)) 147 147 return PTR_ERR(hpriv); 148 148
+1 -1
drivers/ata/ahci_mvebu.c
··· 158 158 const struct mbus_dram_target_info *dram; 159 159 int rc; 160 160 161 - hpriv = ahci_platform_get_resources(pdev); 161 + hpriv = ahci_platform_get_resources(pdev, 0); 162 162 if (IS_ERR(hpriv)) 163 163 return PTR_ERR(hpriv); 164 164
+2 -1
drivers/ata/ahci_platform.c
··· 43 43 struct ahci_host_priv *hpriv; 44 44 int rc; 45 45 46 - hpriv = ahci_platform_get_resources(pdev); 46 + hpriv = ahci_platform_get_resources(pdev, 47 + AHCI_PLATFORM_GET_RESETS); 47 48 if (IS_ERR(hpriv)) 48 49 return PTR_ERR(hpriv); 49 50
+1 -1
drivers/ata/ahci_qoriq.c
··· 250 250 struct resource *res; 251 251 int rc; 252 252 253 - hpriv = ahci_platform_get_resources(pdev); 253 + hpriv = ahci_platform_get_resources(pdev, 0); 254 254 if (IS_ERR(hpriv)) 255 255 return PTR_ERR(hpriv); 256 256
+1 -1
drivers/ata/ahci_seattle.c
··· 164 164 int rc; 165 165 struct ahci_host_priv *hpriv; 166 166 167 - hpriv = ahci_platform_get_resources(pdev); 167 + hpriv = ahci_platform_get_resources(pdev, 0); 168 168 if (IS_ERR(hpriv)) 169 169 return PTR_ERR(hpriv); 170 170
+1 -1
drivers/ata/ahci_st.c
··· 156 156 if (!drv_data) 157 157 return -ENOMEM; 158 158 159 - hpriv = ahci_platform_get_resources(pdev); 159 + hpriv = ahci_platform_get_resources(pdev, 0); 160 160 if (IS_ERR(hpriv)) 161 161 return PTR_ERR(hpriv); 162 162 hpriv->plat_data = drv_data;
+1 -1
drivers/ata/ahci_sunxi.c
··· 181 181 struct ahci_host_priv *hpriv; 182 182 int rc; 183 183 184 - hpriv = ahci_platform_get_resources(pdev); 184 + hpriv = ahci_platform_get_resources(pdev, 0); 185 185 if (IS_ERR(hpriv)) 186 186 return PTR_ERR(hpriv); 187 187
+1 -1
drivers/ata/ahci_tegra.c
··· 494 494 int ret; 495 495 unsigned int i; 496 496 497 - hpriv = ahci_platform_get_resources(pdev); 497 + hpriv = ahci_platform_get_resources(pdev, 0); 498 498 if (IS_ERR(hpriv)) 499 499 return PTR_ERR(hpriv); 500 500
+1 -1
drivers/ata/ahci_xgene.c
··· 759 759 &xgene_ahci_v2_port_info }; 760 760 int rc; 761 761 762 - hpriv = ahci_platform_get_resources(pdev); 762 + hpriv = ahci_platform_get_resources(pdev, 0); 763 763 if (IS_ERR(hpriv)) 764 764 return PTR_ERR(hpriv); 765 765
+18 -9
drivers/ata/libahci.c
··· 801 801 cmd |= PORT_CMD_ALPE; 802 802 if (policy == ATA_LPM_MIN_POWER) 803 803 cmd |= PORT_CMD_ASP; 804 + else if (policy == ATA_LPM_MIN_POWER_WITH_PARTIAL) 805 + cmd &= ~PORT_CMD_ASP; 804 806 805 807 /* write out new cmd value */ 806 808 writel(cmd, port_mmio + PORT_CMD); ··· 813 811 if ((hpriv->cap2 & HOST_CAP2_SDS) && 814 812 (hpriv->cap2 & HOST_CAP2_SADM) && 815 813 (link->device->flags & ATA_DFLAG_DEVSLP)) { 816 - if (policy == ATA_LPM_MIN_POWER) 814 + if (policy == ATA_LPM_MIN_POWER || 815 + policy == ATA_LPM_MIN_POWER_WITH_PARTIAL) 817 816 ahci_set_aggressive_devslp(ap, true); 818 817 else 819 818 ahci_set_aggressive_devslp(ap, false); ··· 2110 2107 struct ahci_host_priv *hpriv = ap->host->private_data; 2111 2108 void __iomem *port_mmio = ahci_port_base(ap); 2112 2109 struct ata_device *dev = ap->link.device; 2113 - u32 devslp, dm, dito, mdat, deto; 2110 + u32 devslp, dm, dito, mdat, deto, dito_conf; 2114 2111 int rc; 2115 2112 unsigned int err_mask; 2116 2113 ··· 2134 2131 return; 2135 2132 } 2136 2133 2137 - /* device sleep was already enabled */ 2138 - if (devslp & PORT_DEVSLP_ADSE) 2134 + dm = (devslp & PORT_DEVSLP_DM_MASK) >> PORT_DEVSLP_DM_OFFSET; 2135 + dito = devslp_idle_timeout / (dm + 1); 2136 + if (dito > 0x3ff) 2137 + dito = 0x3ff; 2138 + 2139 + dito_conf = (devslp >> PORT_DEVSLP_DITO_OFFSET) & 0x3FF; 2140 + 2141 + /* device sleep was already enabled and same dito */ 2142 + if ((devslp & PORT_DEVSLP_ADSE) && (dito_conf == dito)) 2139 2143 return; 2140 2144 2141 2145 /* set DITO, MDAT, DETO and enable DevSlp, need to stop engine first */ 2142 2146 rc = hpriv->stop_engine(ap); 2143 2147 if (rc) 2144 2148 return; 2145 - 2146 - dm = (devslp & PORT_DEVSLP_DM_MASK) >> PORT_DEVSLP_DM_OFFSET; 2147 - dito = devslp_idle_timeout / (dm + 1); 2148 - if (dito > 0x3ff) 2149 - dito = 0x3ff; 2150 2149 2151 2150 /* Use the nominal value 10 ms if the read MDAT is zero, 2152 2151 * the nominal value of DETO is 20 ms. ··· 2167 2162 deto = 20; 2168 2163 } 2169 2164 2165 + /* Make dito, mdat, deto bits to 0s */ 2166 + devslp &= ~GENMASK_ULL(24, 2); 2170 2167 devslp |= ((dito << PORT_DEVSLP_DITO_OFFSET) | 2171 2168 (mdat << PORT_DEVSLP_MDAT_OFFSET) | 2172 2169 (deto << PORT_DEVSLP_DETO_OFFSET) | ··· 2446 2439 * re-enabling INTx. 2447 2440 */ 2448 2441 writel(1 << ap->port_no, host_mmio + HOST_IRQ_STAT); 2442 + 2443 + ahci_rpm_put_port(ap); 2449 2444 } 2450 2445 2451 2446 void ahci_print_info(struct ata_host *host, const char *scc_s)
+37 -12
drivers/ata/libahci_platform.c
··· 25 25 #include <linux/phy/phy.h> 26 26 #include <linux/pm_runtime.h> 27 27 #include <linux/of_platform.h> 28 + #include <linux/reset.h> 28 29 #include "ahci.h" 29 30 30 31 static void ahci_host_stop(struct ata_host *host); ··· 196 195 * following order: 197 196 * 1) Regulator 198 197 * 2) Clocks (through ahci_platform_enable_clks) 199 - * 3) Phys 198 + * 3) Resets 199 + * 4) Phys 200 200 * 201 201 * If resource enabling fails at any point the previous enabled resources 202 202 * are disabled in reverse order. ··· 217 215 if (rc) 218 216 goto disable_regulator; 219 217 220 - rc = ahci_platform_enable_phys(hpriv); 218 + rc = reset_control_deassert(hpriv->rsts); 221 219 if (rc) 222 220 goto disable_clks; 223 221 222 + rc = ahci_platform_enable_phys(hpriv); 223 + if (rc) 224 + goto disable_resets; 225 + 224 226 return 0; 227 + 228 + disable_resets: 229 + reset_control_assert(hpriv->rsts); 225 230 226 231 disable_clks: 227 232 ahci_platform_disable_clks(hpriv); ··· 247 238 * This function disables all ahci_platform managed resources in the 248 239 * following order: 249 240 * 1) Phys 250 - * 2) Clocks (through ahci_platform_disable_clks) 251 - * 3) Regulator 241 + * 2) Resets 242 + * 3) Clocks (through ahci_platform_disable_clks) 243 + * 4) Regulator 252 244 */ 253 245 void ahci_platform_disable_resources(struct ahci_host_priv *hpriv) 254 246 { 255 247 ahci_platform_disable_phys(hpriv); 248 + 249 + reset_control_assert(hpriv->rsts); 256 250 257 251 ahci_platform_disable_clks(hpriv); 258 252 ··· 344 332 /** 345 333 * ahci_platform_get_resources - Get platform resources 346 334 * @pdev: platform device to get resources for 335 + * @flags: bitmap representing the resource to get 347 336 * 348 337 * This function allocates an ahci_host_priv struct, and gets the following 349 338 * resources, storing a reference to them inside the returned struct: ··· 353 340 * 2) regulator for controlling the targets power (optional) 354 341 * 3) 0 - AHCI_MAX_CLKS clocks, as specified in the devs devicetree node, 355 342 * or for non devicetree enabled platforms a single clock 356 - * 4) phys (optional) 343 + * 4) resets, if flags has AHCI_PLATFORM_GET_RESETS (optional) 344 + * 5) phys (optional) 357 345 * 358 346 * RETURNS: 359 347 * The allocated ahci_host_priv on success, otherwise an ERR_PTR value 360 348 */ 361 - struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev) 349 + struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, 350 + unsigned int flags) 362 351 { 363 352 struct device *dev = &pdev->dev; 364 353 struct ahci_host_priv *hpriv; 365 354 struct clk *clk; 366 355 struct device_node *child; 367 - int i, sz, enabled_ports = 0, rc = -ENOMEM, child_nodes; 356 + int i, enabled_ports = 0, rc = -ENOMEM, child_nodes; 368 357 u32 mask_port_map = 0; 369 358 370 359 if (!devres_open_group(dev, NULL, GFP_KERNEL)) ··· 408 393 hpriv->clks[i] = clk; 409 394 } 410 395 396 + if (flags & AHCI_PLATFORM_GET_RESETS) { 397 + hpriv->rsts = devm_reset_control_array_get_optional_shared(dev); 398 + if (IS_ERR(hpriv->rsts)) { 399 + rc = PTR_ERR(hpriv->rsts); 400 + goto err_out; 401 + } 402 + } 403 + 411 404 hpriv->nports = child_nodes = of_get_child_count(dev->of_node); 412 405 413 406 /* ··· 426 403 if (!child_nodes) 427 404 hpriv->nports = 1; 428 405 429 - sz = hpriv->nports * sizeof(*hpriv->phys); 430 - hpriv->phys = devm_kzalloc(dev, sz, GFP_KERNEL); 406 + hpriv->phys = devm_kcalloc(dev, hpriv->nports, sizeof(*hpriv->phys), GFP_KERNEL); 431 407 if (!hpriv->phys) { 432 408 rc = -ENOMEM; 433 409 goto err_out; 434 410 } 435 - sz = hpriv->nports * sizeof(*hpriv->target_pwrs); 436 - hpriv->target_pwrs = kzalloc(sz, GFP_KERNEL); 411 + /* 412 + * We cannot use devm_ here, since ahci_platform_put_resources() uses 413 + * target_pwrs after devm_ have freed memory 414 + */ 415 + hpriv->target_pwrs = kcalloc(hpriv->nports, sizeof(*hpriv->target_pwrs), GFP_KERNEL); 437 416 if (!hpriv->target_pwrs) { 438 417 rc = -ENOMEM; 439 418 goto err_out; ··· 630 605 631 606 /** 632 607 * ahci_platform_shutdown - Disable interrupts and stop DMA for host ports 633 - * @dev: platform device pointer for the host 608 + * @pdev: platform device pointer for the host 634 609 * 635 610 * This function is called during system shutdown and performs the minimal 636 611 * deconfiguration required to ensure that an ahci_platform host cannot
+2 -1
drivers/ata/libata-core.c
··· 3970 3970 scontrol |= (0x6 << 8); 3971 3971 break; 3972 3972 case ATA_LPM_MED_POWER_WITH_DIPM: 3973 + case ATA_LPM_MIN_POWER_WITH_PARTIAL: 3973 3974 case ATA_LPM_MIN_POWER: 3974 3975 if (ata_link_nr_enabled(link) > 0) 3975 3976 /* no restrictions on LPM transitions */ ··· 5067 5066 if (n_elem < 1) 5068 5067 return -1; 5069 5068 5070 - DPRINTK("%d sg elements mapped\n", n_elem); 5069 + VPRINTK("%d sg elements mapped\n", n_elem); 5071 5070 qc->orig_n_elem = qc->n_elem; 5072 5071 qc->n_elem = n_elem; 5073 5072 qc->flags |= ATA_QCFLAG_DMAMAP;
+3 -2
drivers/ata/libata-scsi.c
··· 110 110 [ATA_LPM_MAX_POWER] = "max_performance", 111 111 [ATA_LPM_MED_POWER] = "medium_power", 112 112 [ATA_LPM_MED_POWER_WITH_DIPM] = "med_power_with_dipm", 113 + [ATA_LPM_MIN_POWER_WITH_PARTIAL] = "min_power_with_partial", 113 114 [ATA_LPM_MIN_POWER] = "min_power", 114 115 }; 115 116 ··· 4289 4288 static inline void ata_scsi_dump_cdb(struct ata_port *ap, 4290 4289 struct scsi_cmnd *cmd) 4291 4290 { 4292 - #ifdef ATA_DEBUG 4291 + #ifdef ATA_VERBOSE_DEBUG 4293 4292 struct scsi_device *scsidev = cmd->device; 4294 4293 4295 - DPRINTK("CDB (%u:%d,%d,%lld) %9ph\n", 4294 + VPRINTK("CDB (%u:%d,%d,%lld) %9ph\n", 4296 4295 ap->print_id, 4297 4296 scsidev->channel, scsidev->id, scsidev->lun, 4298 4297 cmd->cmnd);
-30
drivers/ata/libata-sff.c
··· 658 658 EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); 659 659 660 660 /** 661 - * ata_sff_data_xfer_noirq - Transfer data by PIO 662 - * @qc: queued command 663 - * @buf: data buffer 664 - * @buflen: buffer length 665 - * @rw: read/write 666 - * 667 - * Transfer data from/to the device data register by PIO. Do the 668 - * transfer with interrupts disabled. 669 - * 670 - * LOCKING: 671 - * Inherited from caller. 672 - * 673 - * RETURNS: 674 - * Bytes consumed. 675 - */ 676 - unsigned int ata_sff_data_xfer_noirq(struct ata_queued_cmd *qc, unsigned char *buf, 677 - unsigned int buflen, int rw) 678 - { 679 - unsigned long flags; 680 - unsigned int consumed; 681 - 682 - local_irq_save(flags); 683 - consumed = ata_sff_data_xfer32(qc, buf, buflen, rw); 684 - local_irq_restore(flags); 685 - 686 - return consumed; 687 - } 688 - EXPORT_SYMBOL_GPL(ata_sff_data_xfer_noirq); 689 - 690 - /** 691 661 * ata_pio_sector - Transfer a sector of data. 692 662 * @qc: Command on going 693 663 *
+1 -1
drivers/ata/pata_cmd640.c
··· 178 178 static struct ata_port_operations cmd640_port_ops = { 179 179 .inherits = &ata_sff_port_ops, 180 180 /* In theory xfer_noirq is not needed once we kill the prefetcher */ 181 - .sff_data_xfer = ata_sff_data_xfer_noirq, 181 + .sff_data_xfer = ata_sff_data_xfer32, 182 182 .sff_irq_check = cmd640_sff_irq_check, 183 183 .qc_issue = cmd640_qc_issue, 184 184 .cable_detect = ata_cable_40wire,
+1 -1
drivers/ata/pata_icside.c
··· 324 324 .inherits = &ata_bmdma_port_ops, 325 325 /* no need to build any PRD tables for DMA */ 326 326 .qc_prep = ata_noop_qc_prep, 327 - .sff_data_xfer = ata_sff_data_xfer_noirq, 327 + .sff_data_xfer = ata_sff_data_xfer32, 328 328 .bmdma_setup = pata_icside_bmdma_setup, 329 329 .bmdma_start = pata_icside_bmdma_start, 330 330 .bmdma_stop = pata_icside_bmdma_stop,
+1 -1
drivers/ata/pata_imx.c
··· 103 103 104 104 static struct ata_port_operations pata_imx_port_ops = { 105 105 .inherits = &ata_sff_port_ops, 106 - .sff_data_xfer = ata_sff_data_xfer_noirq, 106 + .sff_data_xfer = ata_sff_data_xfer32, 107 107 .cable_detect = ata_cable_unknown, 108 108 .set_piomode = pata_imx_set_piomode, 109 109 };
+3 -3
drivers/ata/pata_legacy.c
··· 246 246 247 247 static struct ata_port_operations simple_port_ops = { 248 248 .inherits = &legacy_base_port_ops, 249 - .sff_data_xfer = ata_sff_data_xfer_noirq, 249 + .sff_data_xfer = ata_sff_data_xfer32, 250 250 }; 251 251 252 252 static struct ata_port_operations legacy_port_ops = { 253 253 .inherits = &legacy_base_port_ops, 254 - .sff_data_xfer = ata_sff_data_xfer_noirq, 254 + .sff_data_xfer = ata_sff_data_xfer32, 255 255 .set_mode = legacy_set_mode, 256 256 }; 257 257 ··· 341 341 } 342 342 local_irq_restore(flags); 343 343 } else 344 - buflen = ata_sff_data_xfer_noirq(qc, buf, buflen, rw); 344 + buflen = ata_sff_data_xfer32(qc, buf, buflen, rw); 345 345 346 346 return buflen; 347 347 }
+1 -1
drivers/ata/pata_palmld.c
··· 44 44 45 45 static struct ata_port_operations palmld_port_ops = { 46 46 .inherits = &ata_sff_port_ops, 47 - .sff_data_xfer = ata_sff_data_xfer_noirq, 47 + .sff_data_xfer = ata_sff_data_xfer32, 48 48 .cable_detect = ata_cable_40wire, 49 49 }; 50 50
+1 -1
drivers/ata/pata_pcmcia.c
··· 151 151 152 152 static struct ata_port_operations pcmcia_port_ops = { 153 153 .inherits = &ata_sff_port_ops, 154 - .sff_data_xfer = ata_sff_data_xfer_noirq, 154 + .sff_data_xfer = ata_sff_data_xfer32, 155 155 .cable_detect = ata_cable_40wire, 156 156 .set_mode = pcmcia_set_mode, 157 157 };
+1 -1
drivers/ata/pata_platform.c
··· 49 49 50 50 static struct ata_port_operations pata_platform_port_ops = { 51 51 .inherits = &ata_sff_port_ops, 52 - .sff_data_xfer = ata_sff_data_xfer_noirq, 52 + .sff_data_xfer = ata_sff_data_xfer32, 53 53 .cable_detect = ata_cable_unknown, 54 54 .set_mode = pata_platform_set_mode, 55 55 };
+1 -1
drivers/ata/pata_via.c
··· 471 471 472 472 static struct ata_port_operations via_port_ops_noirq = { 473 473 .inherits = &via_port_ops, 474 - .sff_data_xfer = ata_sff_data_xfer_noirq, 474 + .sff_data_xfer = ata_sff_data_xfer32, 475 475 }; 476 476 477 477 /**
+39 -37
drivers/ata/sata_rcar.c
··· 17 17 #include <linux/libata.h> 18 18 #include <linux/of_device.h> 19 19 #include <linux/platform_device.h> 20 - #include <linux/clk.h> 20 + #include <linux/pm_runtime.h> 21 21 #include <linux/err.h> 22 22 23 23 #define DRV_NAME "sata_rcar" ··· 109 109 #define SATAINTMASK_ERRMSK BIT(2) 110 110 #define SATAINTMASK_ERRCRTMSK BIT(1) 111 111 #define SATAINTMASK_ATAMSK BIT(0) 112 + #define SATAINTMASK_ALL_GEN1 0x7ff 113 + #define SATAINTMASK_ALL_GEN2 0xfff 112 114 113 115 #define SATA_RCAR_INT_MASK (SATAINTMASK_SERRMSK | \ 114 116 SATAINTMASK_ATAMSK) ··· 154 152 155 153 struct sata_rcar_priv { 156 154 void __iomem *base; 157 - struct clk *clk; 155 + u32 sataint_mask; 158 156 enum sata_rcar_type type; 159 157 }; 160 158 ··· 228 226 struct sata_rcar_priv *priv = ap->host->private_data; 229 227 230 228 /* mask */ 231 - iowrite32(0x7ff, priv->base + SATAINTMASK_REG); 229 + iowrite32(priv->sataint_mask, priv->base + SATAINTMASK_REG); 232 230 233 231 ata_sff_freeze(ap); 234 232 } ··· 244 242 ata_sff_thaw(ap); 245 243 246 244 /* unmask */ 247 - iowrite32(0x7ff & ~SATA_RCAR_INT_MASK, base + SATAINTMASK_REG); 245 + iowrite32(priv->sataint_mask & ~SATA_RCAR_INT_MASK, base + SATAINTMASK_REG); 248 246 } 249 247 250 248 static void sata_rcar_ioread16_rep(void __iomem *reg, void *buffer, int count) ··· 738 736 if (!sataintstat) 739 737 goto done; 740 738 /* ack */ 741 - iowrite32(~sataintstat & 0x7ff, base + SATAINTSTAT_REG); 739 + iowrite32(~sataintstat & priv->sataint_mask, base + SATAINTSTAT_REG); 742 740 743 741 ap = host->ports[0]; 744 742 ··· 811 809 812 810 /* ack and mask */ 813 811 iowrite32(0, base + SATAINTSTAT_REG); 814 - iowrite32(0x7ff, base + SATAINTMASK_REG); 812 + iowrite32(priv->sataint_mask, base + SATAINTMASK_REG); 815 813 816 814 /* enable interrupts */ 817 815 iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG); ··· 821 819 { 822 820 struct sata_rcar_priv *priv = host->private_data; 823 821 822 + priv->sataint_mask = SATAINTMASK_ALL_GEN2; 823 + 824 824 /* reset and setup phy */ 825 825 switch (priv->type) { 826 826 case RCAR_GEN1_SATA: 827 + priv->sataint_mask = SATAINTMASK_ALL_GEN1; 827 828 sata_rcar_gen1_phy_init(priv); 828 829 break; 829 830 case RCAR_GEN2_SATA: 830 - case RCAR_GEN3_SATA: 831 831 case RCAR_R8A7790_ES1_SATA: 832 832 sata_rcar_gen2_phy_init(priv); 833 + break; 834 + case RCAR_GEN3_SATA: 833 835 break; 834 836 default: 835 837 dev_warn(host->dev, "SATA phy is not initialized\n"); ··· 887 881 888 882 static int sata_rcar_probe(struct platform_device *pdev) 889 883 { 884 + struct device *dev = &pdev->dev; 890 885 struct ata_host *host; 891 886 struct sata_rcar_priv *priv; 892 887 struct resource *mem; ··· 898 891 if (irq <= 0) 899 892 return -EINVAL; 900 893 901 - priv = devm_kzalloc(&pdev->dev, sizeof(struct sata_rcar_priv), 902 - GFP_KERNEL); 894 + priv = devm_kzalloc(dev, sizeof(struct sata_rcar_priv), GFP_KERNEL); 903 895 if (!priv) 904 896 return -ENOMEM; 905 897 906 - priv->type = (enum sata_rcar_type)of_device_get_match_data(&pdev->dev); 907 - priv->clk = devm_clk_get(&pdev->dev, NULL); 908 - if (IS_ERR(priv->clk)) { 909 - dev_err(&pdev->dev, "failed to get access to sata clock\n"); 910 - return PTR_ERR(priv->clk); 911 - } 898 + priv->type = (enum sata_rcar_type)of_device_get_match_data(dev); 912 899 913 - ret = clk_prepare_enable(priv->clk); 914 - if (ret) 915 - return ret; 900 + pm_runtime_enable(dev); 901 + ret = pm_runtime_get_sync(dev); 902 + if (ret < 0) 903 + goto err_pm_disable; 916 904 917 - host = ata_host_alloc(&pdev->dev, 1); 905 + host = ata_host_alloc(dev, 1); 918 906 if (!host) { 919 - dev_err(&pdev->dev, "ata_host_alloc failed\n"); 907 + dev_err(dev, "ata_host_alloc failed\n"); 920 908 ret = -ENOMEM; 921 - goto cleanup; 909 + goto err_pm_put; 922 910 } 923 911 924 912 host->private_data = priv; 925 913 926 914 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 927 - priv->base = devm_ioremap_resource(&pdev->dev, mem); 915 + priv->base = devm_ioremap_resource(dev, mem); 928 916 if (IS_ERR(priv->base)) { 929 917 ret = PTR_ERR(priv->base); 930 - goto cleanup; 918 + goto err_pm_put; 931 919 } 932 920 933 921 /* setup port */ ··· 936 934 if (!ret) 937 935 return 0; 938 936 939 - cleanup: 940 - clk_disable_unprepare(priv->clk); 941 - 937 + err_pm_put: 938 + pm_runtime_put(dev); 939 + err_pm_disable: 940 + pm_runtime_disable(dev); 942 941 return ret; 943 942 } 944 943 ··· 955 952 iowrite32(0, base + ATAPI_INT_ENABLE_REG); 956 953 /* ack and mask */ 957 954 iowrite32(0, base + SATAINTSTAT_REG); 958 - iowrite32(0x7ff, base + SATAINTMASK_REG); 955 + iowrite32(priv->sataint_mask, base + SATAINTMASK_REG); 959 956 960 - clk_disable_unprepare(priv->clk); 957 + pm_runtime_put(&pdev->dev); 958 + pm_runtime_disable(&pdev->dev); 961 959 962 960 return 0; 963 961 } ··· 976 972 /* disable interrupts */ 977 973 iowrite32(0, base + ATAPI_INT_ENABLE_REG); 978 974 /* mask */ 979 - iowrite32(0x7ff, base + SATAINTMASK_REG); 975 + iowrite32(priv->sataint_mask, base + SATAINTMASK_REG); 980 976 981 - clk_disable_unprepare(priv->clk); 977 + pm_runtime_put(dev); 982 978 } 983 979 984 980 return ret; ··· 991 987 void __iomem *base = priv->base; 992 988 int ret; 993 989 994 - ret = clk_prepare_enable(priv->clk); 995 - if (ret) 990 + ret = pm_runtime_get_sync(dev); 991 + if (ret < 0) 996 992 return ret; 997 993 998 994 if (priv->type == RCAR_GEN3_SATA) { 999 - sata_rcar_gen2_phy_init(priv); 1000 995 sata_rcar_init_module(priv); 1001 996 } else { 1002 997 /* ack and mask */ 1003 998 iowrite32(0, base + SATAINTSTAT_REG); 1004 - iowrite32(0x7ff, base + SATAINTMASK_REG); 999 + iowrite32(priv->sataint_mask, base + SATAINTMASK_REG); 1005 1000 1006 1001 /* enable interrupts */ 1007 1002 iowrite32(ATAPI_INT_ENABLE_SATAINT, ··· 1015 1012 static int sata_rcar_restore(struct device *dev) 1016 1013 { 1017 1014 struct ata_host *host = dev_get_drvdata(dev); 1018 - struct sata_rcar_priv *priv = host->private_data; 1019 1015 int ret; 1020 1016 1021 - ret = clk_prepare_enable(priv->clk); 1022 - if (ret) 1017 + ret = pm_runtime_get_sync(dev); 1018 + if (ret < 0) 1023 1019 return ret; 1024 1020 1025 1021 sata_rcar_setup_port(host);
+3 -1
include/linux/ahci_platform.h
··· 30 30 int ahci_platform_enable_resources(struct ahci_host_priv *hpriv); 31 31 void ahci_platform_disable_resources(struct ahci_host_priv *hpriv); 32 32 struct ahci_host_priv *ahci_platform_get_resources( 33 - struct platform_device *pdev); 33 + struct platform_device *pdev, unsigned int flags); 34 34 int ahci_platform_init_host(struct platform_device *pdev, 35 35 struct ahci_host_priv *hpriv, 36 36 const struct ata_port_info *pi_template, ··· 42 42 int ahci_platform_resume_host(struct device *dev); 43 43 int ahci_platform_suspend(struct device *dev); 44 44 int ahci_platform_resume(struct device *dev); 45 + 46 + #define AHCI_PLATFORM_GET_RESETS 0x01 45 47 46 48 #endif /* _AHCI_PLATFORM_H */
+2 -3
include/linux/libata.h
··· 523 523 ATA_LPM_MAX_POWER, 524 524 ATA_LPM_MED_POWER, 525 525 ATA_LPM_MED_POWER_WITH_DIPM, /* Med power + DIPM as win IRST does */ 526 - ATA_LPM_MIN_POWER, 526 + ATA_LPM_MIN_POWER_WITH_PARTIAL, /* Min Power + partial and slumber */ 527 + ATA_LPM_MIN_POWER, /* Min power + no partial (slumber only) */ 527 528 }; 528 529 529 530 enum ata_lpm_hints { ··· 1858 1857 extern unsigned int ata_sff_data_xfer(struct ata_queued_cmd *qc, 1859 1858 unsigned char *buf, unsigned int buflen, int rw); 1860 1859 extern unsigned int ata_sff_data_xfer32(struct ata_queued_cmd *qc, 1861 - unsigned char *buf, unsigned int buflen, int rw); 1862 - extern unsigned int ata_sff_data_xfer_noirq(struct ata_queued_cmd *qc, 1863 1860 unsigned char *buf, unsigned int buflen, int rw); 1864 1861 extern void ata_sff_irq_on(struct ata_port *ap); 1865 1862 extern void ata_sff_irq_clear(struct ata_port *ap);