diff options
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/Kconfig | 7 | ||||
-rw-r--r-- | drivers/ata/ahci.c | 50 | ||||
-rw-r--r-- | drivers/ata/ahci.h | 2 | ||||
-rw-r--r-- | drivers/ata/ahci_imx.c | 179 | ||||
-rw-r--r-- | drivers/ata/libahci.c | 7 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 36 | ||||
-rw-r--r-- | drivers/ata/pata_arasan_cf.c | 7 | ||||
-rw-r--r-- | drivers/ata/pata_at91.c | 11 | ||||
-rw-r--r-- | drivers/ata/pata_samsung_cf.c | 10 |
9 files changed, 264 insertions, 45 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 20e03a7eb8b4..0033fafc470b 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -116,7 +116,7 @@ config AHCI_ST | |||
116 | 116 | ||
117 | config AHCI_IMX | 117 | config AHCI_IMX |
118 | tristate "Freescale i.MX AHCI SATA support" | 118 | tristate "Freescale i.MX AHCI SATA support" |
119 | depends on MFD_SYSCON | 119 | depends on MFD_SYSCON && (ARCH_MXC || COMPILE_TEST) |
120 | help | 120 | help |
121 | This option enables support for the Freescale i.MX SoC's | 121 | This option enables support for the Freescale i.MX SoC's |
122 | onboard AHCI SATA. | 122 | onboard AHCI SATA. |
@@ -134,8 +134,7 @@ config AHCI_SUNXI | |||
134 | 134 | ||
135 | config AHCI_XGENE | 135 | config AHCI_XGENE |
136 | tristate "APM X-Gene 6.0Gbps AHCI SATA host controller support" | 136 | tristate "APM X-Gene 6.0Gbps AHCI SATA host controller support" |
137 | depends on ARM64 || COMPILE_TEST | 137 | depends on PHY_XGENE |
138 | select PHY_XGENE | ||
139 | help | 138 | help |
140 | This option enables support for APM X-Gene SoC SATA host controller. | 139 | This option enables support for APM X-Gene SoC SATA host controller. |
141 | 140 | ||
@@ -816,7 +815,7 @@ config PATA_AT32 | |||
816 | 815 | ||
817 | config PATA_AT91 | 816 | config PATA_AT91 |
818 | tristate "PATA support for AT91SAM9260" | 817 | tristate "PATA support for AT91SAM9260" |
819 | depends on ARM && ARCH_AT91 | 818 | depends on ARM && SOC_AT91SAM9 |
820 | help | 819 | help |
821 | This option enables support for IDE devices on the Atmel AT91SAM9260 SoC. | 820 | This option enables support for IDE devices on the Atmel AT91SAM9260 SoC. |
822 | 821 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 5a0bf8ed649b..60707814a84b 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1115,6 +1115,17 @@ static bool ahci_broken_online(struct pci_dev *pdev) | |||
1115 | return pdev->bus->number == (val >> 8) && pdev->devfn == (val & 0xff); | 1115 | return pdev->bus->number == (val >> 8) && pdev->devfn == (val & 0xff); |
1116 | } | 1116 | } |
1117 | 1117 | ||
1118 | static bool ahci_broken_devslp(struct pci_dev *pdev) | ||
1119 | { | ||
1120 | /* device with broken DEVSLP but still showing SDS capability */ | ||
1121 | static const struct pci_device_id ids[] = { | ||
1122 | { PCI_VDEVICE(INTEL, 0x0f23)}, /* Valleyview SoC */ | ||
1123 | {} | ||
1124 | }; | ||
1125 | |||
1126 | return pci_match_id(ids, pdev); | ||
1127 | } | ||
1128 | |||
1118 | #ifdef CONFIG_ATA_ACPI | 1129 | #ifdef CONFIG_ATA_ACPI |
1119 | static void ahci_gtf_filter_workaround(struct ata_host *host) | 1130 | static void ahci_gtf_filter_workaround(struct ata_host *host) |
1120 | { | 1131 | { |
@@ -1164,9 +1175,9 @@ static inline void ahci_gtf_filter_workaround(struct ata_host *host) | |||
1164 | #endif | 1175 | #endif |
1165 | 1176 | ||
1166 | static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, | 1177 | static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, |
1167 | struct ahci_host_priv *hpriv) | 1178 | struct ahci_host_priv *hpriv) |
1168 | { | 1179 | { |
1169 | int nvec; | 1180 | int rc, nvec; |
1170 | 1181 | ||
1171 | if (hpriv->flags & AHCI_HFLAG_NO_MSI) | 1182 | if (hpriv->flags & AHCI_HFLAG_NO_MSI) |
1172 | goto intx; | 1183 | goto intx; |
@@ -1183,12 +1194,19 @@ static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, | |||
1183 | if (nvec < n_ports) | 1194 | if (nvec < n_ports) |
1184 | goto single_msi; | 1195 | goto single_msi; |
1185 | 1196 | ||
1186 | nvec = pci_enable_msi_range(pdev, nvec, nvec); | 1197 | rc = pci_enable_msi_exact(pdev, nvec); |
1187 | if (nvec == -ENOSPC) | 1198 | if (rc == -ENOSPC) |
1188 | goto single_msi; | 1199 | goto single_msi; |
1189 | else if (nvec < 0) | 1200 | else if (rc < 0) |
1190 | goto intx; | 1201 | goto intx; |
1191 | 1202 | ||
1203 | /* fallback to single MSI mode if the controller enforced MRSM mode */ | ||
1204 | if (readl(hpriv->mmio + HOST_CTL) & HOST_MRSM) { | ||
1205 | pci_disable_msi(pdev); | ||
1206 | printk(KERN_INFO "ahci: MRSM is on, fallback to single MSI\n"); | ||
1207 | goto single_msi; | ||
1208 | } | ||
1209 | |||
1192 | return nvec; | 1210 | return nvec; |
1193 | 1211 | ||
1194 | single_msi: | 1212 | single_msi: |
@@ -1232,18 +1250,18 @@ int ahci_host_activate(struct ata_host *host, int irq, unsigned int n_msis) | |||
1232 | return rc; | 1250 | return rc; |
1233 | 1251 | ||
1234 | for (i = 0; i < host->n_ports; i++) { | 1252 | for (i = 0; i < host->n_ports; i++) { |
1235 | const char* desc; | ||
1236 | struct ahci_port_priv *pp = host->ports[i]->private_data; | 1253 | struct ahci_port_priv *pp = host->ports[i]->private_data; |
1237 | 1254 | ||
1238 | /* pp is NULL for dummy ports */ | 1255 | /* Do not receive interrupts sent by dummy ports */ |
1239 | if (pp) | 1256 | if (!pp) { |
1240 | desc = pp->irq_desc; | 1257 | disable_irq(irq + i); |
1241 | else | 1258 | continue; |
1242 | desc = dev_driver_string(host->dev); | 1259 | } |
1243 | 1260 | ||
1244 | rc = devm_request_threaded_irq(host->dev, | 1261 | rc = devm_request_threaded_irq(host->dev, irq + i, |
1245 | irq + i, ahci_hw_interrupt, ahci_thread_fn, IRQF_SHARED, | 1262 | ahci_hw_interrupt, |
1246 | desc, host->ports[i]); | 1263 | ahci_thread_fn, IRQF_SHARED, |
1264 | pp->irq_desc, host->ports[i]); | ||
1247 | if (rc) | 1265 | if (rc) |
1248 | goto out_free_irqs; | 1266 | goto out_free_irqs; |
1249 | } | 1267 | } |
@@ -1357,6 +1375,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1357 | 1375 | ||
1358 | hpriv->mmio = pcim_iomap_table(pdev)[ahci_pci_bar]; | 1376 | hpriv->mmio = pcim_iomap_table(pdev)[ahci_pci_bar]; |
1359 | 1377 | ||
1378 | /* must set flag prior to save config in order to take effect */ | ||
1379 | if (ahci_broken_devslp(pdev)) | ||
1380 | hpriv->flags |= AHCI_HFLAG_NO_DEVSLP; | ||
1381 | |||
1360 | /* save initial config */ | 1382 | /* save initial config */ |
1361 | ahci_pci_save_initial_config(pdev, hpriv); | 1383 | ahci_pci_save_initial_config(pdev, hpriv); |
1362 | 1384 | ||
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 51af275b3388..af63c75c2001 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h | |||
@@ -94,6 +94,7 @@ enum { | |||
94 | /* HOST_CTL bits */ | 94 | /* HOST_CTL bits */ |
95 | HOST_RESET = (1 << 0), /* reset controller; self-clear */ | 95 | HOST_RESET = (1 << 0), /* reset controller; self-clear */ |
96 | HOST_IRQ_EN = (1 << 1), /* global IRQ enable */ | 96 | HOST_IRQ_EN = (1 << 1), /* global IRQ enable */ |
97 | HOST_MRSM = (1 << 2), /* MSI Revert to Single Message */ | ||
97 | HOST_AHCI_EN = (1 << 31), /* AHCI enabled */ | 98 | HOST_AHCI_EN = (1 << 31), /* AHCI enabled */ |
98 | 99 | ||
99 | /* HOST_CAP bits */ | 100 | /* HOST_CAP bits */ |
@@ -235,6 +236,7 @@ enum { | |||
235 | port start (wait until | 236 | port start (wait until |
236 | error-handling stage) */ | 237 | error-handling stage) */ |
237 | AHCI_HFLAG_MULTI_MSI = (1 << 16), /* multiple PCI MSIs */ | 238 | AHCI_HFLAG_MULTI_MSI = (1 << 16), /* multiple PCI MSIs */ |
239 | AHCI_HFLAG_NO_DEVSLP = (1 << 17), /* no device sleep */ | ||
238 | 240 | ||
239 | /* ap->flags bits */ | 241 | /* ap->flags bits */ |
240 | 242 | ||
diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index 497c7abe1c7d..8befeb69eeb1 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c | |||
@@ -29,9 +29,25 @@ | |||
29 | #include "ahci.h" | 29 | #include "ahci.h" |
30 | 30 | ||
31 | enum { | 31 | enum { |
32 | PORT_PHY_CTL = 0x178, /* Port0 PHY Control */ | 32 | /* Timer 1-ms Register */ |
33 | PORT_PHY_CTL_PDDQ_LOC = 0x100000, /* PORT_PHY_CTL bits */ | 33 | IMX_TIMER1MS = 0x00e0, |
34 | HOST_TIMER1MS = 0xe0, /* Timer 1-ms */ | 34 | /* Port0 PHY Control Register */ |
35 | IMX_P0PHYCR = 0x0178, | ||
36 | IMX_P0PHYCR_TEST_PDDQ = 1 << 20, | ||
37 | IMX_P0PHYCR_CR_READ = 1 << 19, | ||
38 | IMX_P0PHYCR_CR_WRITE = 1 << 18, | ||
39 | IMX_P0PHYCR_CR_CAP_DATA = 1 << 17, | ||
40 | IMX_P0PHYCR_CR_CAP_ADDR = 1 << 16, | ||
41 | /* Port0 PHY Status Register */ | ||
42 | IMX_P0PHYSR = 0x017c, | ||
43 | IMX_P0PHYSR_CR_ACK = 1 << 18, | ||
44 | IMX_P0PHYSR_CR_DATA_OUT = 0xffff << 0, | ||
45 | /* Lane0 Output Status Register */ | ||
46 | IMX_LANE0_OUT_STAT = 0x2003, | ||
47 | IMX_LANE0_OUT_STAT_RX_PLL_STATE = 1 << 1, | ||
48 | /* Clock Reset Register */ | ||
49 | IMX_CLOCK_RESET = 0x7f3f, | ||
50 | IMX_CLOCK_RESET_RESET = 1 << 0, | ||
35 | }; | 51 | }; |
36 | 52 | ||
37 | enum ahci_imx_type { | 53 | enum ahci_imx_type { |
@@ -54,9 +70,149 @@ MODULE_PARM_DESC(hotplug, "AHCI IMX hot-plug support (0=Don't support, 1=support | |||
54 | 70 | ||
55 | static void ahci_imx_host_stop(struct ata_host *host); | 71 | static void ahci_imx_host_stop(struct ata_host *host); |
56 | 72 | ||
73 | static int imx_phy_crbit_assert(void __iomem *mmio, u32 bit, bool assert) | ||
74 | { | ||
75 | int timeout = 10; | ||
76 | u32 crval; | ||
77 | u32 srval; | ||
78 | |||
79 | /* Assert or deassert the bit */ | ||
80 | crval = readl(mmio + IMX_P0PHYCR); | ||
81 | if (assert) | ||
82 | crval |= bit; | ||
83 | else | ||
84 | crval &= ~bit; | ||
85 | writel(crval, mmio + IMX_P0PHYCR); | ||
86 | |||
87 | /* Wait for the cr_ack signal */ | ||
88 | do { | ||
89 | srval = readl(mmio + IMX_P0PHYSR); | ||
90 | if ((assert ? srval : ~srval) & IMX_P0PHYSR_CR_ACK) | ||
91 | break; | ||
92 | usleep_range(100, 200); | ||
93 | } while (--timeout); | ||
94 | |||
95 | return timeout ? 0 : -ETIMEDOUT; | ||
96 | } | ||
97 | |||
98 | static int imx_phy_reg_addressing(u16 addr, void __iomem *mmio) | ||
99 | { | ||
100 | u32 crval = addr; | ||
101 | int ret; | ||
102 | |||
103 | /* Supply the address on cr_data_in */ | ||
104 | writel(crval, mmio + IMX_P0PHYCR); | ||
105 | |||
106 | /* Assert the cr_cap_addr signal */ | ||
107 | ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_CAP_ADDR, true); | ||
108 | if (ret) | ||
109 | return ret; | ||
110 | |||
111 | /* Deassert cr_cap_addr */ | ||
112 | ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_CAP_ADDR, false); | ||
113 | if (ret) | ||
114 | return ret; | ||
115 | |||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | static int imx_phy_reg_write(u16 val, void __iomem *mmio) | ||
120 | { | ||
121 | u32 crval = val; | ||
122 | int ret; | ||
123 | |||
124 | /* Supply the data on cr_data_in */ | ||
125 | writel(crval, mmio + IMX_P0PHYCR); | ||
126 | |||
127 | /* Assert the cr_cap_data signal */ | ||
128 | ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_CAP_DATA, true); | ||
129 | if (ret) | ||
130 | return ret; | ||
131 | |||
132 | /* Deassert cr_cap_data */ | ||
133 | ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_CAP_DATA, false); | ||
134 | if (ret) | ||
135 | return ret; | ||
136 | |||
137 | if (val & IMX_CLOCK_RESET_RESET) { | ||
138 | /* | ||
139 | * In case we're resetting the phy, it's unable to acknowledge, | ||
140 | * so we return immediately here. | ||
141 | */ | ||
142 | crval |= IMX_P0PHYCR_CR_WRITE; | ||
143 | writel(crval, mmio + IMX_P0PHYCR); | ||
144 | goto out; | ||
145 | } | ||
146 | |||
147 | /* Assert the cr_write signal */ | ||
148 | ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_WRITE, true); | ||
149 | if (ret) | ||
150 | return ret; | ||
151 | |||
152 | /* Deassert cr_write */ | ||
153 | ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_WRITE, false); | ||
154 | if (ret) | ||
155 | return ret; | ||
156 | |||
157 | out: | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | static int imx_phy_reg_read(u16 *val, void __iomem *mmio) | ||
162 | { | ||
163 | int ret; | ||
164 | |||
165 | /* Assert the cr_read signal */ | ||
166 | ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_READ, true); | ||
167 | if (ret) | ||
168 | return ret; | ||
169 | |||
170 | /* Capture the data from cr_data_out[] */ | ||
171 | *val = readl(mmio + IMX_P0PHYSR) & IMX_P0PHYSR_CR_DATA_OUT; | ||
172 | |||
173 | /* Deassert cr_read */ | ||
174 | ret = imx_phy_crbit_assert(mmio, IMX_P0PHYCR_CR_READ, false); | ||
175 | if (ret) | ||
176 | return ret; | ||
177 | |||
178 | return 0; | ||
179 | } | ||
180 | |||
181 | static int imx_sata_phy_reset(struct ahci_host_priv *hpriv) | ||
182 | { | ||
183 | void __iomem *mmio = hpriv->mmio; | ||
184 | int timeout = 10; | ||
185 | u16 val; | ||
186 | int ret; | ||
187 | |||
188 | /* Reset SATA PHY by setting RESET bit of PHY register CLOCK_RESET */ | ||
189 | ret = imx_phy_reg_addressing(IMX_CLOCK_RESET, mmio); | ||
190 | if (ret) | ||
191 | return ret; | ||
192 | ret = imx_phy_reg_write(IMX_CLOCK_RESET_RESET, mmio); | ||
193 | if (ret) | ||
194 | return ret; | ||
195 | |||
196 | /* Wait for PHY RX_PLL to be stable */ | ||
197 | do { | ||
198 | usleep_range(100, 200); | ||
199 | ret = imx_phy_reg_addressing(IMX_LANE0_OUT_STAT, mmio); | ||
200 | if (ret) | ||
201 | return ret; | ||
202 | ret = imx_phy_reg_read(&val, mmio); | ||
203 | if (ret) | ||
204 | return ret; | ||
205 | if (val & IMX_LANE0_OUT_STAT_RX_PLL_STATE) | ||
206 | break; | ||
207 | } while (--timeout); | ||
208 | |||
209 | return timeout ? 0 : -ETIMEDOUT; | ||
210 | } | ||
211 | |||
57 | static int imx_sata_enable(struct ahci_host_priv *hpriv) | 212 | static int imx_sata_enable(struct ahci_host_priv *hpriv) |
58 | { | 213 | { |
59 | struct imx_ahci_priv *imxpriv = hpriv->plat_data; | 214 | struct imx_ahci_priv *imxpriv = hpriv->plat_data; |
215 | struct device *dev = &imxpriv->ahci_pdev->dev; | ||
60 | int ret; | 216 | int ret; |
61 | 217 | ||
62 | if (imxpriv->no_device) | 218 | if (imxpriv->no_device) |
@@ -101,6 +257,14 @@ static int imx_sata_enable(struct ahci_host_priv *hpriv) | |||
101 | regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13, | 257 | regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13, |
102 | IMX6Q_GPR13_SATA_MPLL_CLK_EN, | 258 | IMX6Q_GPR13_SATA_MPLL_CLK_EN, |
103 | IMX6Q_GPR13_SATA_MPLL_CLK_EN); | 259 | IMX6Q_GPR13_SATA_MPLL_CLK_EN); |
260 | |||
261 | usleep_range(100, 200); | ||
262 | |||
263 | ret = imx_sata_phy_reset(hpriv); | ||
264 | if (ret) { | ||
265 | dev_err(dev, "failed to reset phy: %d\n", ret); | ||
266 | goto disable_regulator; | ||
267 | } | ||
104 | } | 268 | } |
105 | 269 | ||
106 | usleep_range(1000, 2000); | 270 | usleep_range(1000, 2000); |
@@ -156,8 +320,8 @@ static void ahci_imx_error_handler(struct ata_port *ap) | |||
156 | * without full reset once the pddq mode is enabled making it | 320 | * without full reset once the pddq mode is enabled making it |
157 | * impossible to use as part of libata LPM. | 321 | * impossible to use as part of libata LPM. |
158 | */ | 322 | */ |
159 | reg_val = readl(mmio + PORT_PHY_CTL); | 323 | reg_val = readl(mmio + IMX_P0PHYCR); |
160 | writel(reg_val | PORT_PHY_CTL_PDDQ_LOC, mmio + PORT_PHY_CTL); | 324 | writel(reg_val | IMX_P0PHYCR_TEST_PDDQ, mmio + IMX_P0PHYCR); |
161 | imx_sata_disable(hpriv); | 325 | imx_sata_disable(hpriv); |
162 | imxpriv->no_device = true; | 326 | imxpriv->no_device = true; |
163 | } | 327 | } |
@@ -217,6 +381,7 @@ static int imx_ahci_probe(struct platform_device *pdev) | |||
217 | if (!imxpriv) | 381 | if (!imxpriv) |
218 | return -ENOMEM; | 382 | return -ENOMEM; |
219 | 383 | ||
384 | imxpriv->ahci_pdev = pdev; | ||
220 | imxpriv->no_device = false; | 385 | imxpriv->no_device = false; |
221 | imxpriv->first_time = true; | 386 | imxpriv->first_time = true; |
222 | imxpriv->type = (enum ahci_imx_type)of_id->data; | 387 | imxpriv->type = (enum ahci_imx_type)of_id->data; |
@@ -248,7 +413,7 @@ static int imx_ahci_probe(struct platform_device *pdev) | |||
248 | 413 | ||
249 | /* | 414 | /* |
250 | * Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL, | 415 | * Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL, |
251 | * and IP vendor specific register HOST_TIMER1MS. | 416 | * and IP vendor specific register IMX_TIMER1MS. |
252 | * Configure CAP_SSS (support stagered spin up). | 417 | * Configure CAP_SSS (support stagered spin up). |
253 | * Implement the port0. | 418 | * Implement the port0. |
254 | * Get the ahb clock rate, and configure the TIMER1MS register. | 419 | * Get the ahb clock rate, and configure the TIMER1MS register. |
@@ -265,7 +430,7 @@ static int imx_ahci_probe(struct platform_device *pdev) | |||
265 | } | 430 | } |
266 | 431 | ||
267 | reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000; | 432 | reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000; |
268 | writel(reg_val, hpriv->mmio + HOST_TIMER1MS); | 433 | writel(reg_val, hpriv->mmio + IMX_TIMER1MS); |
269 | 434 | ||
270 | ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info, 0, 0); | 435 | ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info, 0, 0); |
271 | if (ret) | 436 | if (ret) |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 6bd4f660b4e1..b9861453fc81 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -452,6 +452,13 @@ void ahci_save_initial_config(struct device *dev, | |||
452 | cap &= ~HOST_CAP_SNTF; | 452 | cap &= ~HOST_CAP_SNTF; |
453 | } | 453 | } |
454 | 454 | ||
455 | if ((cap2 & HOST_CAP2_SDS) && (hpriv->flags & AHCI_HFLAG_NO_DEVSLP)) { | ||
456 | dev_info(dev, | ||
457 | "controller can't do DEVSLP, turning off\n"); | ||
458 | cap2 &= ~HOST_CAP2_SDS; | ||
459 | cap2 &= ~HOST_CAP2_SADM; | ||
460 | } | ||
461 | |||
455 | if (!(cap & HOST_CAP_FBS) && (hpriv->flags & AHCI_HFLAG_YES_FBS)) { | 462 | if (!(cap & HOST_CAP_FBS) && (hpriv->flags & AHCI_HFLAG_YES_FBS)) { |
456 | dev_info(dev, "controller can do FBS, turning on CAP_FBS\n"); | 463 | dev_info(dev, "controller can do FBS, turning on CAP_FBS\n"); |
457 | cap |= HOST_CAP_FBS; | 464 | cap |= HOST_CAP_FBS; |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index c19734d96d7e..ea83828bfea9 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4224,8 +4224,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4224 | { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, | 4224 | { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, |
4225 | 4225 | ||
4226 | /* devices that don't properly handle queued TRIM commands */ | 4226 | /* devices that don't properly handle queued TRIM commands */ |
4227 | { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4227 | { "Micron_M500*", "MU0[1-4]*", ATA_HORKAGE_NO_NCQ_TRIM, }, |
4228 | { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4228 | { "Crucial_CT???M500SSD*", "MU0[1-4]*", ATA_HORKAGE_NO_NCQ_TRIM, }, |
4229 | { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | ||
4230 | { "Crucial_CT???M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | ||
4229 | 4231 | ||
4230 | /* | 4232 | /* |
4231 | * Some WD SATA-I drives spin up and down erratically when the link | 4233 | * Some WD SATA-I drives spin up and down erratically when the link |
@@ -4792,21 +4794,26 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
4792 | static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) | 4794 | static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) |
4793 | { | 4795 | { |
4794 | struct ata_queued_cmd *qc = NULL; | 4796 | struct ata_queued_cmd *qc = NULL; |
4795 | unsigned int i; | 4797 | unsigned int i, tag; |
4796 | 4798 | ||
4797 | /* no command while frozen */ | 4799 | /* no command while frozen */ |
4798 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) | 4800 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) |
4799 | return NULL; | 4801 | return NULL; |
4800 | 4802 | ||
4801 | /* the last tag is reserved for internal command. */ | 4803 | for (i = 0; i < ATA_MAX_QUEUE; i++) { |
4802 | for (i = 0; i < ATA_MAX_QUEUE - 1; i++) | 4804 | tag = (i + ap->last_tag + 1) % ATA_MAX_QUEUE; |
4803 | if (!test_and_set_bit(i, &ap->qc_allocated)) { | 4805 | |
4804 | qc = __ata_qc_from_tag(ap, i); | 4806 | /* the last tag is reserved for internal command. */ |
4807 | if (tag == ATA_TAG_INTERNAL) | ||
4808 | continue; | ||
4809 | |||
4810 | if (!test_and_set_bit(tag, &ap->qc_allocated)) { | ||
4811 | qc = __ata_qc_from_tag(ap, tag); | ||
4812 | qc->tag = tag; | ||
4813 | ap->last_tag = tag; | ||
4805 | break; | 4814 | break; |
4806 | } | 4815 | } |
4807 | 4816 | } | |
4808 | if (qc) | ||
4809 | qc->tag = i; | ||
4810 | 4817 | ||
4811 | return qc; | 4818 | return qc; |
4812 | } | 4819 | } |
@@ -6307,6 +6314,8 @@ int ata_host_activate(struct ata_host *host, int irq, | |||
6307 | static void ata_port_detach(struct ata_port *ap) | 6314 | static void ata_port_detach(struct ata_port *ap) |
6308 | { | 6315 | { |
6309 | unsigned long flags; | 6316 | unsigned long flags; |
6317 | struct ata_link *link; | ||
6318 | struct ata_device *dev; | ||
6310 | 6319 | ||
6311 | if (!ap->ops->error_handler) | 6320 | if (!ap->ops->error_handler) |
6312 | goto skip_eh; | 6321 | goto skip_eh; |
@@ -6326,6 +6335,13 @@ static void ata_port_detach(struct ata_port *ap) | |||
6326 | cancel_delayed_work_sync(&ap->hotplug_task); | 6335 | cancel_delayed_work_sync(&ap->hotplug_task); |
6327 | 6336 | ||
6328 | skip_eh: | 6337 | skip_eh: |
6338 | /* clean up zpodd on port removal */ | ||
6339 | ata_for_each_link(link, ap, HOST_FIRST) { | ||
6340 | ata_for_each_dev(dev, link, ALL) { | ||
6341 | if (zpodd_dev_enabled(dev)) | ||
6342 | zpodd_exit(dev); | ||
6343 | } | ||
6344 | } | ||
6329 | if (ap->pmp_link) { | 6345 | if (ap->pmp_link) { |
6330 | int i; | 6346 | int i; |
6331 | for (i = 0; i < SATA_PMP_MAX_PORTS; i++) | 6347 | for (i = 0; i < SATA_PMP_MAX_PORTS; i++) |
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c index 6fac524c2f50..4edb1a81f63f 100644 --- a/drivers/ata/pata_arasan_cf.c +++ b/drivers/ata/pata_arasan_cf.c | |||
@@ -898,9 +898,12 @@ static int arasan_cf_probe(struct platform_device *pdev) | |||
898 | 898 | ||
899 | cf_card_detect(acdev, 0); | 899 | cf_card_detect(acdev, 0); |
900 | 900 | ||
901 | return ata_host_activate(host, acdev->irq, irq_handler, 0, | 901 | ret = ata_host_activate(host, acdev->irq, irq_handler, 0, |
902 | &arasan_cf_sht); | 902 | &arasan_cf_sht); |
903 | if (!ret) | ||
904 | return 0; | ||
903 | 905 | ||
906 | cf_exit(acdev); | ||
904 | free_clk: | 907 | free_clk: |
905 | clk_put(acdev->clk); | 908 | clk_put(acdev->clk); |
906 | return ret; | 909 | return ret; |
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c index e9c87274a781..8a66f23af4c4 100644 --- a/drivers/ata/pata_at91.c +++ b/drivers/ata/pata_at91.c | |||
@@ -407,12 +407,13 @@ static int pata_at91_probe(struct platform_device *pdev) | |||
407 | 407 | ||
408 | host->private_data = info; | 408 | host->private_data = info; |
409 | 409 | ||
410 | return ata_host_activate(host, gpio_is_valid(irq) ? gpio_to_irq(irq) : 0, | 410 | ret = ata_host_activate(host, gpio_is_valid(irq) ? gpio_to_irq(irq) : 0, |
411 | gpio_is_valid(irq) ? ata_sff_interrupt : NULL, | 411 | gpio_is_valid(irq) ? ata_sff_interrupt : NULL, |
412 | irq_flags, &pata_at91_sht); | 412 | irq_flags, &pata_at91_sht); |
413 | if (ret) | ||
414 | goto err_put; | ||
413 | 415 | ||
414 | if (!ret) | 416 | return 0; |
415 | return 0; | ||
416 | 417 | ||
417 | err_put: | 418 | err_put: |
418 | clk_put(info->mck); | 419 | clk_put(info->mck); |
diff --git a/drivers/ata/pata_samsung_cf.c b/drivers/ata/pata_samsung_cf.c index a79566d05666..0610e78c8a2a 100644 --- a/drivers/ata/pata_samsung_cf.c +++ b/drivers/ata/pata_samsung_cf.c | |||
@@ -594,9 +594,13 @@ static int __init pata_s3c_probe(struct platform_device *pdev) | |||
594 | 594 | ||
595 | platform_set_drvdata(pdev, host); | 595 | platform_set_drvdata(pdev, host); |
596 | 596 | ||
597 | return ata_host_activate(host, info->irq, | 597 | ret = ata_host_activate(host, info->irq, |
598 | info->irq ? pata_s3c_irq : NULL, | 598 | info->irq ? pata_s3c_irq : NULL, |
599 | 0, &pata_s3c_sht); | 599 | 0, &pata_s3c_sht); |
600 | if (ret) | ||
601 | goto stop_clk; | ||
602 | |||
603 | return 0; | ||
600 | 604 | ||
601 | stop_clk: | 605 | stop_clk: |
602 | clk_disable(info->clk); | 606 | clk_disable(info->clk); |