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