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

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

Pull libata updates from Tejun Heo:
"Nothing too interesting or alarming. Other than a new power saving
mode addition to ahci and crash fix on a tracepoint, all changes are
trivial or device-specific"

* 'for-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: (22 commits)
ahci: imx: Handle increased read failures for IMX53 temperature sensor in low frequency mode.
ata: sata_dwc_460ex: Propagate platform device ID to DMA driver
ata: fixes kernel crash while tracing ata_eh_link_autopsy event
ata: pata_pdc2027x: Fix space before '[' error.
libata: fix spelling mistake: 'ambigious' -> 'ambiguous'
ata: ceva: Add SMMU support for SATA IP
ata: ceva: Correct the suspend and resume logic for SATA
ata: ceva: Correct the AXI bus configuration for SATA ports
ata: ceva: Add CCI support for SATA if CCI is enabled
ata: ceva: Make RxWaterMark value as module parameter
ata: ceva: Disable Device Sleep capability
ata: ceva: Add gen 3 mode support in driver
ata: ceva: Move sata port phy oob settings to device-tree
devicetree: bindings: Add sata port phy config parameters in ahci-ceva
ata: mark expected switch fall-throughs
ata: sata_mv: remove a redundant assignment to pointer ehi
ahci: Add support for Cavium's fifth generation SATA controller
ata: sata_rcar: Use of_device_get_match_data() helper
libata: make ata_port_type const
libata: make static arrays const, reduces object code size
...

+244 -74
+39
Documentation/devicetree/bindings/ata/ahci-ceva.txt
··· 5 5 - compatible: Compatibility string. Must be 'ceva,ahci-1v84'. 6 6 - clocks: Input clock specifier. Refer to common clock bindings. 7 7 - interrupts: Interrupt specifier. Refer to interrupt binding. 8 + - ceva,p0-cominit-params: OOB timing value for COMINIT parameter for port 0. 9 + - ceva,p1-cominit-params: OOB timing value for COMINIT parameter for port 1. 10 + The fields for the above parameter must be as shown below: 11 + ceva,pN-cominit-params = /bits/ 8 <CIBGMN CIBGMX CIBGN CINMP>; 12 + CINMP : COMINIT Negate Minimum Period. 13 + CIBGN : COMINIT Burst Gap Nominal. 14 + CIBGMX: COMINIT Burst Gap Maximum. 15 + CIBGMN: COMINIT Burst Gap Minimum. 16 + - ceva,p0-comwake-params: OOB timing value for COMWAKE parameter for port 0. 17 + - ceva,p1-comwake-params: OOB timing value for COMWAKE parameter for port 1. 18 + The fields for the above parameter must be as shown below: 19 + ceva,pN-comwake-params = /bits/ 8 <CWBGMN CWBGMX CWBGN CWNMP>; 20 + CWBGMN: COMWAKE Burst Gap Minimum. 21 + CWBGMX: COMWAKE Burst Gap Maximum. 22 + CWBGN: COMWAKE Burst Gap Nominal. 23 + CWNMP: COMWAKE Negate Minimum Period. 24 + - ceva,p0-burst-params: Burst timing value for COM parameter for port 0. 25 + - ceva,p1-burst-params: Burst timing value for COM parameter for port 1. 26 + The fields for the above parameter must be as shown below: 27 + ceva,pN-burst-params = /bits/ 8 <BMX BNM SFD PTST>; 28 + BMX: COM Burst Maximum. 29 + BNM: COM Burst Nominal. 30 + SFD: Signal Failure Detection value. 31 + PTST: Partial to Slumber timer value. 32 + - ceva,p0-retry-params: Retry interval timing value for port 0. 33 + - ceva,p1-retry-params: Retry interval timing value for port 1. 34 + The fields for the above parameter must be as shown below: 35 + ceva,pN-retry-params = /bits/ 16 <RIT RCT>; 36 + RIT: Retry Interval Timer. 37 + RCT: Rate Change Timer. 8 38 9 39 Optional properties: 10 40 - ceva,broken-gen2: limit to gen1 speed instead of gen2. ··· 46 16 interrupt-parent = <&gic>; 47 17 interrupts = <0 133 4>; 48 18 clocks = <&clkc SATA_CLK_ID>; 19 + ceva,p0-cominit-params = /bits/ 8 <0x0F 0x25 0x18 0x29>; 20 + ceva,p0-comwake-params = /bits/ 8 <0x04 0x0B 0x08 0x0F>; 21 + ceva,p0-burst-params = /bits/ 8 <0x0A 0x08 0x4A 0x06>; 22 + ceva,p0-retry-params = /bits/ 16 <0x0216 0x7F06>; 23 + 24 + ceva,p1-cominit-params = /bits/ 8 <0x0F 0x25 0x18 0x29>; 25 + ceva,p1-comwake-params = /bits/ 8 <0x04 0x0B 0x08 0x0F>; 26 + ceva,p1-burst-params = /bits/ 8 <0x0A 0x08 0x4A 0x06>; 27 + ceva,p1-retry-params = /bits/ 16 <0x0216 0x7F06>; 49 28 ceva,broken-gen2; 50 29 };
+7 -2
drivers/ata/ahci.c
··· 57 57 AHCI_PCI_BAR_STA2X11 = 0, 58 58 AHCI_PCI_BAR_CAVIUM = 0, 59 59 AHCI_PCI_BAR_ENMOTUS = 2, 60 + AHCI_PCI_BAR_CAVIUM_GEN5 = 4, 60 61 AHCI_PCI_BAR_STANDARD = 5, 61 62 }; 62 63 ··· 1571 1570 ahci_pci_bar = AHCI_PCI_BAR_STA2X11; 1572 1571 else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000) 1573 1572 ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS; 1574 - else if (pdev->vendor == 0x177d && pdev->device == 0xa01c) 1575 - ahci_pci_bar = AHCI_PCI_BAR_CAVIUM; 1573 + else if (pdev->vendor == PCI_VENDOR_ID_CAVIUM) { 1574 + if (pdev->device == 0xa01c) 1575 + ahci_pci_bar = AHCI_PCI_BAR_CAVIUM; 1576 + if (pdev->device == 0xa084) 1577 + ahci_pci_bar = AHCI_PCI_BAR_CAVIUM_GEN5; 1578 + } 1576 1579 1577 1580 /* acquire resources */ 1578 1581 rc = pcim_enable_device(pdev);
+159 -38
drivers/ata/ahci_ceva.c
··· 32 32 #define AHCI_VEND_PP3C 0xB0 33 33 #define AHCI_VEND_PP4C 0xB4 34 34 #define AHCI_VEND_PP5C 0xB8 35 + #define AHCI_VEND_AXICC 0xBC 35 36 #define AHCI_VEND_PAXIC 0xC0 36 37 #define AHCI_VEND_PTC 0xC8 37 38 38 39 /* Vendor Specific Register bit definitions */ 39 40 #define PAXIC_ADBW_BW64 0x1 40 - #define PAXIC_MAWIDD (1 << 8) 41 - #define PAXIC_MARIDD (1 << 16) 41 + #define PAXIC_MAWID(i) (((i) * 2) << 4) 42 + #define PAXIC_MARID(i) (((i) * 2) << 12) 43 + #define PAXIC_MARIDD(i) ((((i) * 2) + 1) << 16) 44 + #define PAXIC_MAWIDD(i) ((((i) * 2) + 1) << 8) 42 45 #define PAXIC_OTL (0x4 << 20) 46 + 47 + /* Register bit definitions for cache control */ 48 + #define AXICC_ARCA_VAL (0xF << 0) 49 + #define AXICC_ARCF_VAL (0xF << 4) 50 + #define AXICC_ARCH_VAL (0xF << 8) 51 + #define AXICC_ARCP_VAL (0xF << 12) 52 + #define AXICC_AWCFD_VAL (0xF << 16) 53 + #define AXICC_AWCD_VAL (0xF << 20) 54 + #define AXICC_AWCF_VAL (0xF << 24) 43 55 44 56 #define PCFG_TPSS_VAL (0x32 << 16) 45 57 #define PCFG_TPRS_VAL (0x2 << 12) ··· 61 49 #define PPCFG_PSSO_EN (1 << 28) 62 50 #define PPCFG_PSS_EN (1 << 29) 63 51 #define PPCFG_ESDF_EN (1 << 31) 64 - 65 - #define PP2C_CIBGMN 0x0F 66 - #define PP2C_CIBGMX (0x25 << 8) 67 - #define PP2C_CIBGN (0x18 << 16) 68 - #define PP2C_CINMP (0x29 << 24) 69 - 70 - #define PP3C_CWBGMN 0x04 71 - #define PP3C_CWBGMX (0x0B << 8) 72 - #define PP3C_CWBGN (0x08 << 16) 73 - #define PP3C_CWNMP (0x0F << 24) 74 - 75 - #define PP4C_BMX 0x0a 76 - #define PP4C_BNM (0x08 << 8) 77 - #define PP4C_SFD (0x4a << 16) 78 - #define PP4C_PTST (0x06 << 24) 79 52 80 53 #define PP5C_RIT 0x60216 81 54 #define PP5C_RCT (0x7f0 << 20) ··· 72 75 #define PORT1_BASE 0x180 73 76 74 77 /* Port Control Register Bit Definitions */ 78 + #define PORT_SCTL_SPD_GEN3 (0x3 << 4) 75 79 #define PORT_SCTL_SPD_GEN2 (0x2 << 4) 76 80 #define PORT_SCTL_SPD_GEN1 (0x1 << 4) 77 81 #define PORT_SCTL_IPM (0x3 << 8) ··· 83 85 #define DRV_NAME "ahci-ceva" 84 86 #define CEVA_FLAG_BROKEN_GEN2 1 85 87 88 + static unsigned int rx_watermark = PTC_RX_WM_VAL; 89 + module_param(rx_watermark, uint, 0644); 90 + MODULE_PARM_DESC(rx_watermark, "RxWaterMark value (0 - 0x80)"); 91 + 86 92 struct ceva_ahci_priv { 87 93 struct platform_device *ahci_pdev; 94 + /* Port Phy2Cfg Register */ 95 + u32 pp2c[NR_PORTS]; 96 + u32 pp3c[NR_PORTS]; 97 + u32 pp4c[NR_PORTS]; 98 + u32 pp5c[NR_PORTS]; 99 + /* Axi Cache Control Register */ 100 + u32 axicc; 101 + bool is_cci_enabled; 88 102 int flags; 89 103 }; 90 104 105 + static unsigned int ceva_ahci_read_id(struct ata_device *dev, 106 + struct ata_taskfile *tf, u16 *id) 107 + { 108 + u32 err_mask; 109 + 110 + err_mask = ata_do_dev_read_id(dev, tf, id); 111 + if (err_mask) 112 + return err_mask; 113 + /* 114 + * Since CEVA controller does not support device sleep feature, we 115 + * need to clear DEVSLP (bit 8) in word78 of the IDENTIFY DEVICE data. 116 + */ 117 + id[ATA_ID_FEATURE_SUPP] &= cpu_to_le16(~(1 << 8)); 118 + 119 + return 0; 120 + } 121 + 91 122 static struct ata_port_operations ahci_ceva_ops = { 92 123 .inherits = &ahci_platform_ops, 124 + .read_id = ceva_ahci_read_id, 93 125 }; 94 126 95 127 static const struct ata_port_info ahci_ceva_port_info = { ··· 136 108 u32 tmp; 137 109 int i; 138 110 139 - /* 140 - * AXI Data bus width to 64 141 - * Set Mem Addr Read, Write ID for data transfers 142 - * Transfer limit to 72 DWord 143 - */ 144 - tmp = PAXIC_ADBW_BW64 | PAXIC_MAWIDD | PAXIC_MARIDD | PAXIC_OTL; 145 - writel(tmp, mmio + AHCI_VEND_PAXIC); 146 - 147 111 /* Set AHCI Enable */ 148 112 tmp = readl(mmio + HOST_CTL); 149 113 tmp |= HOST_AHCI_EN; ··· 146 126 tmp = PCFG_TPSS_VAL | PCFG_TPRS_VAL | (PCFG_PAD_VAL + i); 147 127 writel(tmp, mmio + AHCI_VEND_PCFG); 148 128 129 + /* 130 + * AXI Data bus width to 64 131 + * Set Mem Addr Read, Write ID for data transfers 132 + * Set Mem Addr Read ID, Write ID for non-data transfers 133 + * Transfer limit to 72 DWord 134 + */ 135 + tmp = PAXIC_ADBW_BW64 | PAXIC_MAWIDD(i) | PAXIC_MARIDD(i) | 136 + PAXIC_MAWID(i) | PAXIC_MARID(i) | PAXIC_OTL; 137 + writel(tmp, mmio + AHCI_VEND_PAXIC); 138 + 139 + /* Set AXI cache control register if CCi is enabled */ 140 + if (cevapriv->is_cci_enabled) { 141 + tmp = readl(mmio + AHCI_VEND_AXICC); 142 + tmp |= AXICC_ARCA_VAL | AXICC_ARCF_VAL | 143 + AXICC_ARCH_VAL | AXICC_ARCP_VAL | 144 + AXICC_AWCFD_VAL | AXICC_AWCD_VAL | 145 + AXICC_AWCF_VAL; 146 + writel(tmp, mmio + AHCI_VEND_AXICC); 147 + } 148 + 149 149 /* Port Phy Cfg register enables */ 150 150 tmp = PPCFG_TTA | PPCFG_PSS_EN | PPCFG_ESDF_EN; 151 151 writel(tmp, mmio + AHCI_VEND_PPCFG); 152 152 153 153 /* Phy Control OOB timing parameters COMINIT */ 154 - tmp = PP2C_CIBGMN | PP2C_CIBGMX | PP2C_CIBGN | PP2C_CINMP; 155 - writel(tmp, mmio + AHCI_VEND_PP2C); 154 + writel(cevapriv->pp2c[i], mmio + AHCI_VEND_PP2C); 156 155 157 156 /* Phy Control OOB timing parameters COMWAKE */ 158 - tmp = PP3C_CWBGMN | PP3C_CWBGMX | PP3C_CWBGN | PP3C_CWNMP; 159 - writel(tmp, mmio + AHCI_VEND_PP3C); 157 + writel(cevapriv->pp3c[i], mmio + AHCI_VEND_PP3C); 160 158 161 159 /* Phy Control Burst timing setting */ 162 - tmp = PP4C_BMX | PP4C_BNM | PP4C_SFD | PP4C_PTST; 163 - writel(tmp, mmio + AHCI_VEND_PP4C); 160 + writel(cevapriv->pp4c[i], mmio + AHCI_VEND_PP4C); 164 161 165 162 /* Rate Change Timer and Retry Interval Timer setting */ 166 - tmp = PP5C_RIT | PP5C_RCT; 167 - writel(tmp, mmio + AHCI_VEND_PP5C); 163 + writel(cevapriv->pp5c[i], mmio + AHCI_VEND_PP5C); 168 164 169 165 /* Rx Watermark setting */ 170 - tmp = PTC_RX_WM_VAL | PTC_RSVD; 166 + tmp = rx_watermark | PTC_RSVD; 171 167 writel(tmp, mmio + AHCI_VEND_PTC); 172 168 173 - /* Default to Gen 2 Speed and Gen 1 if Gen2 is broken */ 174 - tmp = PORT_SCTL_SPD_GEN2 | PORT_SCTL_IPM; 169 + /* Default to Gen 3 Speed and Gen 1 if Gen2 is broken */ 170 + tmp = PORT_SCTL_SPD_GEN3 | PORT_SCTL_IPM; 175 171 if (cevapriv->flags & CEVA_FLAG_BROKEN_GEN2) 176 172 tmp = PORT_SCTL_SPD_GEN1 | PORT_SCTL_IPM; 177 173 writel(tmp, mmio + PORT_SCR_CTL + PORT_BASE + PORT_OFFSET * i); ··· 204 168 struct device *dev = &pdev->dev; 205 169 struct ahci_host_priv *hpriv; 206 170 struct ceva_ahci_priv *cevapriv; 171 + enum dev_dma_attr attr; 207 172 int rc; 208 173 209 174 cevapriv = devm_kzalloc(dev, sizeof(*cevapriv), GFP_KERNEL); ··· 223 186 224 187 if (of_property_read_bool(np, "ceva,broken-gen2")) 225 188 cevapriv->flags = CEVA_FLAG_BROKEN_GEN2; 189 + 190 + /* Read OOB timing value for COMINIT from device-tree */ 191 + if (of_property_read_u8_array(np, "ceva,p0-cominit-params", 192 + (u8 *)&cevapriv->pp2c[0], 4) < 0) { 193 + dev_warn(dev, "ceva,p0-cominit-params property not defined\n"); 194 + return -EINVAL; 195 + } 196 + 197 + if (of_property_read_u8_array(np, "ceva,p1-cominit-params", 198 + (u8 *)&cevapriv->pp2c[1], 4) < 0) { 199 + dev_warn(dev, "ceva,p1-cominit-params property not defined\n"); 200 + return -EINVAL; 201 + } 202 + 203 + /* Read OOB timing value for COMWAKE from device-tree*/ 204 + if (of_property_read_u8_array(np, "ceva,p0-comwake-params", 205 + (u8 *)&cevapriv->pp3c[0], 4) < 0) { 206 + dev_warn(dev, "ceva,p0-comwake-params property not defined\n"); 207 + return -EINVAL; 208 + } 209 + 210 + if (of_property_read_u8_array(np, "ceva,p1-comwake-params", 211 + (u8 *)&cevapriv->pp3c[1], 4) < 0) { 212 + dev_warn(dev, "ceva,p1-comwake-params property not defined\n"); 213 + return -EINVAL; 214 + } 215 + 216 + /* Read phy BURST timing value from device-tree */ 217 + if (of_property_read_u8_array(np, "ceva,p0-burst-params", 218 + (u8 *)&cevapriv->pp4c[0], 4) < 0) { 219 + dev_warn(dev, "ceva,p0-burst-params property not defined\n"); 220 + return -EINVAL; 221 + } 222 + 223 + if (of_property_read_u8_array(np, "ceva,p1-burst-params", 224 + (u8 *)&cevapriv->pp4c[1], 4) < 0) { 225 + dev_warn(dev, "ceva,p1-burst-params property not defined\n"); 226 + return -EINVAL; 227 + } 228 + 229 + /* Read phy RETRY interval timing value from device-tree */ 230 + if (of_property_read_u16_array(np, "ceva,p0-retry-params", 231 + (u16 *)&cevapriv->pp5c[0], 2) < 0) { 232 + dev_warn(dev, "ceva,p0-retry-params property not defined\n"); 233 + return -EINVAL; 234 + } 235 + 236 + if (of_property_read_u16_array(np, "ceva,p1-retry-params", 237 + (u16 *)&cevapriv->pp5c[1], 2) < 0) { 238 + dev_warn(dev, "ceva,p1-retry-params property not defined\n"); 239 + return -EINVAL; 240 + } 241 + 242 + /* 243 + * Check if CCI is enabled for SATA. The DEV_DMA_COHERENT is returned 244 + * if CCI is enabled, so check for DEV_DMA_COHERENT. 245 + */ 246 + attr = device_get_dma_attr(dev); 247 + cevapriv->is_cci_enabled = (attr == DEV_DMA_COHERENT); 226 248 227 249 hpriv->plat_data = cevapriv; 228 250 ··· 302 206 303 207 static int __maybe_unused ceva_ahci_suspend(struct device *dev) 304 208 { 305 - return ahci_platform_suspend_host(dev); 209 + return ahci_platform_suspend(dev); 306 210 } 307 211 308 212 static int __maybe_unused ceva_ahci_resume(struct device *dev) 309 213 { 310 - return ahci_platform_resume_host(dev); 214 + struct ata_host *host = dev_get_drvdata(dev); 215 + struct ahci_host_priv *hpriv = host->private_data; 216 + int rc; 217 + 218 + rc = ahci_platform_enable_resources(hpriv); 219 + if (rc) 220 + return rc; 221 + 222 + /* Configure CEVA specific config before resuming HBA */ 223 + ahci_ceva_setup(hpriv); 224 + 225 + rc = ahci_platform_resume_host(dev); 226 + if (rc) 227 + goto disable_resources; 228 + 229 + /* We resumed so update PM runtime state */ 230 + pm_runtime_disable(dev); 231 + pm_runtime_set_active(dev); 232 + pm_runtime_enable(dev); 233 + 234 + return 0; 235 + 236 + disable_resources: 237 + ahci_platform_disable_resources(hpriv); 238 + 239 + return rc; 311 240 } 312 241 313 242 static SIMPLE_DEV_PM_OPS(ahci_ceva_pm_ops, ceva_ahci_suspend, ceva_ahci_resume);
+1 -1
drivers/ata/ahci_imx.c
··· 230 230 { 231 231 u16 adc_out_reg, read_sum; 232 232 u32 index, read_attempt; 233 - const u32 attempt_limit = 100; 233 + const u32 attempt_limit = 200; 234 234 235 235 imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_RTUNE_CTL, mmio); 236 236 imx_phy_reg_write(rtune_ctl_reg, mmio);
+1
drivers/ata/libahci_platform.c
··· 295 295 node->name); 296 296 break; 297 297 } 298 + /* fall through */ 298 299 case -ENODEV: 299 300 /* continue normally */ 300 301 hpriv->phys[port] = NULL;
+6 -2
drivers/ata/libata-core.c
··· 1879 1879 switch (class) { 1880 1880 case ATA_DEV_SEMB: 1881 1881 class = ATA_DEV_ATA; /* some hard drives report SEMB sig */ 1882 + /* fall through */ 1882 1883 case ATA_DEV_ATA: 1883 1884 case ATA_DEV_ZAC: 1884 1885 tf.command = ATA_CMD_ID_ATA; ··· 2976 2975 case -ENODEV: 2977 2976 /* give it just one more chance */ 2978 2977 tries[dev->devno] = min(tries[dev->devno], 1); 2978 + /* fall through */ 2979 2979 case -EIO: 2980 2980 if (tries[dev->devno] == 1) { 2981 2981 /* This is the last chance, better to slow ··· 3464 3462 3465 3463 case ATA_DNXFER_FORCE_PIO0: 3466 3464 pio_mask &= 1; 3465 + /* fall through */ 3467 3466 case ATA_DNXFER_FORCE_PIO: 3468 3467 mwdma_mask = 0; 3469 3468 udma_mask = 0; ··· 3967 3964 scontrol &= ~(0x1 << 8); 3968 3965 scontrol |= (0x6 << 8); 3969 3966 break; 3967 + case ATA_LPM_MED_POWER_WITH_DIPM: 3970 3968 case ATA_LPM_MIN_POWER: 3971 3969 if (ata_link_nr_enabled(link) > 0) 3972 3970 /* no restrictions on LPM transitions */ ··· 5827 5823 } 5828 5824 #endif 5829 5825 5830 - struct device_type ata_port_type = { 5826 + const struct device_type ata_port_type = { 5831 5827 .name = "ata_port", 5832 5828 #ifdef CONFIG_PM 5833 5829 .pm = &ata_port_pm_ops, ··· 6907 6903 return -EINVAL; 6908 6904 } 6909 6905 if (nr_matches > 1) { 6910 - *reason = "ambigious value"; 6906 + *reason = "ambiguous value"; 6911 6907 return -EINVAL; 6912 6908 } 6913 6909
+8 -6
drivers/ata/libata-eh.c
··· 2264 2264 if (dev->flags & ATA_DFLAG_DUBIOUS_XFER) 2265 2265 eflags |= ATA_EFLAG_DUBIOUS_XFER; 2266 2266 ehc->i.action |= ata_eh_speed_down(dev, eflags, all_err_mask); 2267 + trace_ata_eh_link_autopsy(dev, ehc->i.action, all_err_mask); 2267 2268 } 2268 - trace_ata_eh_link_autopsy(dev, ehc->i.action, all_err_mask); 2269 2269 DPRINTK("EXIT\n"); 2270 2270 } 2271 2271 ··· 3454 3454 * @r_failed_dev: out parameter for failed device 3455 3455 * 3456 3456 * Enable SATA Interface power management. This will enable 3457 - * Device Interface Power Management (DIPM) for min_power 3458 - * policy, and then call driver specific callbacks for 3459 - * enabling Host Initiated Power management. 3457 + * Device Interface Power Management (DIPM) for min_power and 3458 + * medium_power_with_dipm policies, and then call driver specific 3459 + * callbacks for enabling Host Initiated Power management. 3460 3460 * 3461 3461 * LOCKING: 3462 3462 * EH context. ··· 3502 3502 hints &= ~ATA_LPM_HIPM; 3503 3503 3504 3504 /* disable DIPM before changing link config */ 3505 - if (policy != ATA_LPM_MIN_POWER && dipm) { 3505 + if (policy < ATA_LPM_MED_POWER_WITH_DIPM && dipm) { 3506 3506 err_mask = ata_dev_set_feature(dev, 3507 3507 SETFEATURES_SATA_DISABLE, SATA_DIPM); 3508 3508 if (err_mask && err_mask != AC_ERR_DEV) { ··· 3545 3545 3546 3546 /* host config updated, enable DIPM if transitioning to MIN_POWER */ 3547 3547 ata_for_each_dev(dev, link, ENABLED) { 3548 - if (policy == ATA_LPM_MIN_POWER && !no_dipm && 3548 + if (policy >= ATA_LPM_MED_POWER_WITH_DIPM && !no_dipm && 3549 3549 ata_id_has_dipm(dev->id)) { 3550 3550 err_mask = ata_dev_set_feature(dev, 3551 3551 SETFEATURES_SATA_ENABLE, SATA_DIPM); ··· 3711 3711 case -ENODEV: 3712 3712 /* device missing or wrong IDENTIFY data, schedule probing */ 3713 3713 ehc->i.probe_mask |= (1 << dev->devno); 3714 + /* fall through */ 3714 3715 case -EINVAL: 3715 3716 /* give it just one more chance */ 3716 3717 ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); 3718 + /* fall through */ 3717 3719 case -EIO: 3718 3720 if (ehc->tries[dev->devno] == 1) { 3719 3721 /* This is the last chance, better to slow
+10 -9
drivers/ata/libata-scsi.c
··· 106 106 }; 107 107 108 108 static const char *ata_lpm_policy_names[] = { 109 - [ATA_LPM_UNKNOWN] = "max_performance", 110 - [ATA_LPM_MAX_POWER] = "max_performance", 111 - [ATA_LPM_MED_POWER] = "medium_power", 112 - [ATA_LPM_MIN_POWER] = "min_power", 109 + [ATA_LPM_UNKNOWN] = "max_performance", 110 + [ATA_LPM_MAX_POWER] = "max_performance", 111 + [ATA_LPM_MED_POWER] = "medium_power", 112 + [ATA_LPM_MED_POWER_WITH_DIPM] = "med_power_with_dipm", 113 + [ATA_LPM_MIN_POWER] = "min_power", 113 114 }; 114 115 115 116 static ssize_t ata_scsi_lpm_store(struct device *device, ··· 2146 2145 */ 2147 2146 static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) 2148 2147 { 2149 - const u8 versions[] = { 2148 + static const u8 versions[] = { 2150 2149 0x00, 2151 2150 0x60, /* SAM-3 (no version claimed) */ 2152 2151 ··· 2156 2155 0x03, 2157 2156 0x00 /* SPC-3 (no version claimed) */ 2158 2157 }; 2159 - const u8 versions_zbc[] = { 2158 + static const u8 versions_zbc[] = { 2160 2159 0x00, 2161 2160 0xA0, /* SAM-5 (no version claimed) */ 2162 2161 ··· 2228 2227 static unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf) 2229 2228 { 2230 2229 int num_pages; 2231 - const u8 pages[] = { 2230 + static const u8 pages[] = { 2232 2231 0x00, /* page 0x00, this page */ 2233 2232 0x80, /* page 0x80, unit serial no page */ 2234 2233 0x83, /* page 0x83, device ident page */ ··· 2259 2258 */ 2260 2259 static unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf) 2261 2260 { 2262 - const u8 hdr[] = { 2261 + static const u8 hdr[] = { 2263 2262 0, 2264 2263 0x80, /* this page code */ 2265 2264 0, ··· 2581 2580 { 2582 2581 struct ata_device *dev = args->dev; 2583 2582 u8 *scsicmd = args->cmd->cmnd, *p = rbuf; 2584 - const u8 sat_blk_desc[] = { 2583 + static const u8 sat_blk_desc[] = { 2585 2584 0, 0, 0, 0, /* number of blocks: sat unspecified */ 2586 2585 0, 2587 2586 0, 0x2, 0x0 /* block length: 512 bytes */
+1 -1
drivers/ata/libata.h
··· 51 51 extern int libata_fua; 52 52 extern int libata_noacpi; 53 53 extern int libata_allow_tpm; 54 - extern struct device_type ata_port_type; 54 + extern const struct device_type ata_port_type; 55 55 extern struct ata_link *ata_dev_phys_link(struct ata_device *dev); 56 56 extern void ata_force_cbl(struct ata_port *ap); 57 57 extern u64 ata_tf_to_lba(const struct ata_taskfile *tf);
+1 -1
drivers/ata/pata_artop.c
··· 242 242 243 243 static void artop6260_set_dmamode (struct ata_port *ap, struct ata_device *adev) 244 244 { 245 - unsigned int pio = adev->pio_mode - XFER_PIO_0; 245 + unsigned int pio; 246 246 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 247 247 u8 ultra; 248 248
+2
drivers/ata/pata_atp867x.c
··· 171 171 default: 172 172 printk(KERN_WARNING "ATP867X: active %dclk is invalid. " 173 173 "Using 12clk.\n", clk); 174 + /* fall through */ 174 175 case 9 ... 12: 175 176 clocks = 7; /* 12 clk */ 176 177 break; ··· 204 203 default: 205 204 printk(KERN_WARNING "ATP867X: recover %dclk is invalid. " 206 205 "Using default 12clk.\n", clk); 206 + /* fall through */ 207 207 case 12: /* default 12 clk */ 208 208 clocks = 0; 209 209 break;
+3 -3
drivers/ata/pata_pdc2027x.c
··· 84 84 */ 85 85 static struct pdc2027x_pio_timing { 86 86 u8 value0, value1, value2; 87 - } pdc2027x_pio_timing_tbl [] = { 87 + } pdc2027x_pio_timing_tbl[] = { 88 88 { 0xfb, 0x2b, 0xac }, /* PIO mode 0 */ 89 89 { 0x46, 0x29, 0xa4 }, /* PIO mode 1 */ 90 90 { 0x23, 0x26, 0x64 }, /* PIO mode 2 */ ··· 94 94 95 95 static struct pdc2027x_mdma_timing { 96 96 u8 value0, value1; 97 - } pdc2027x_mdma_timing_tbl [] = { 97 + } pdc2027x_mdma_timing_tbl[] = { 98 98 { 0xdf, 0x5f }, /* MDMA mode 0 */ 99 99 { 0x6b, 0x27 }, /* MDMA mode 1 */ 100 100 { 0x69, 0x25 }, /* MDMA mode 2 */ ··· 102 102 103 103 static struct pdc2027x_udma_timing { 104 104 u8 value0, value1, value2; 105 - } pdc2027x_udma_timing_tbl [] = { 105 + } pdc2027x_udma_timing_tbl[] = { 106 106 { 0x4a, 0x0f, 0xd5 }, /* UDMA mode 0 */ 107 107 { 0x3a, 0x0a, 0xd0 }, /* UDMA mode 1 */ 108 108 { 0x2a, 0x07, 0xcd }, /* UDMA mode 2 */
+1
drivers/ata/sata_dwc_460ex.c
··· 248 248 return -ENOMEM; 249 249 250 250 hsdev->dma->dev = &pdev->dev; 251 + hsdev->dma->id = pdev->id; 251 252 252 253 /* Get SATA DMA interrupt number */ 253 254 hsdev->dma->irq = irq_of_parse_and_map(np, 1);
+3 -5
drivers/ata/sata_mv.c
··· 2387 2387 ": attempting PIO w/multiple DRQ: " 2388 2388 "this may fail due to h/w errata\n"); 2389 2389 } 2390 - /* drop through */ 2390 + /* fall through */ 2391 2391 case ATA_PROT_NODATA: 2392 2392 case ATAPI_PROT_PIO: 2393 2393 case ATAPI_PROT_NODATA: ··· 2478 2478 2479 2479 static void mv_pmp_eh_prep(struct ata_port *ap, unsigned int pmp_map) 2480 2480 { 2481 - struct ata_eh_info *ehi; 2482 2481 unsigned int pmp; 2483 2482 2484 2483 /* 2485 2484 * Initialize EH info for PMPs which saw device errors 2486 2485 */ 2487 - ehi = &ap->link.eh_info; 2488 2486 for (pmp = 0; pmp_map != 0; pmp++) { 2489 2487 unsigned int this_pmp = (1 << pmp); 2490 2488 if (pmp_map & this_pmp) { 2491 2489 struct ata_link *link = &ap->pmp_link[pmp]; 2490 + struct ata_eh_info *ehi = &link->eh_info; 2492 2491 2493 2492 pmp_map &= ~this_pmp; 2494 - ehi = &link->eh_info; 2495 2493 ata_ehi_clear_desc(ehi); 2496 2494 ata_ehi_push_desc(ehi, "dev err"); 2497 2495 ehi->err_mask |= AC_ERR_DEV; ··· 3875 3877 " and avoid the final two gigabytes on" 3876 3878 " all RocketRAID BIOS initialized drives.\n"); 3877 3879 } 3878 - /* drop through */ 3880 + /* fall through */ 3879 3881 case chip_6042: 3880 3882 hpriv->ops = &mv6xxx_ops; 3881 3883 hp_flags |= MV_HP_GEN_IIE;
+1 -6
drivers/ata/sata_rcar.c
··· 872 872 873 873 static int sata_rcar_probe(struct platform_device *pdev) 874 874 { 875 - const struct of_device_id *of_id; 876 875 struct ata_host *host; 877 876 struct sata_rcar_priv *priv; 878 877 struct resource *mem; ··· 887 888 if (!priv) 888 889 return -ENOMEM; 889 890 890 - of_id = of_match_device(sata_rcar_match, &pdev->dev); 891 - if (!of_id) 892 - return -ENODEV; 893 - 894 - priv->type = (enum sata_rcar_type)of_id->data; 891 + priv->type = (enum sata_rcar_type)of_device_get_match_data(&pdev->dev); 895 892 priv->clk = devm_clk_get(&pdev->dev, NULL); 896 893 if (IS_ERR(priv->clk)) { 897 894 dev_err(&pdev->dev, "failed to get access to sata clock\n");
+1
include/linux/libata.h
··· 522 522 ATA_LPM_UNKNOWN, 523 523 ATA_LPM_MAX_POWER, 524 524 ATA_LPM_MED_POWER, 525 + ATA_LPM_MED_POWER_WITH_DIPM, /* Med power + DIPM as win IRST does */ 525 526 ATA_LPM_MIN_POWER, 526 527 }; 527 528