diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-21 20:21:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-21 20:21:32 -0500 |
commit | 79f4d1d5c0d7d115b5a693a5bb369e69efb7e7a5 (patch) | |
tree | 0b571a25f3666ed36c25139c75705dde5682488a | |
parent | 97a229f90731894f46b85c20bcc1842f4a63cb78 (diff) | |
parent | 73b2951414f661e22dc4b88e4e6590c9406cf822 (diff) |
Merge branch 'for-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata
Pull libata updates from Tejun Heo:
- Bartlomiej added pata_falcon
- Christoph is trying to remove use of static 4k buf. It's still WIP
- config cleanup around HAS_DMA
- other fixes and driver-specific changes
* 'for-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: (29 commits)
ata: pata_of_platform: using of_property_read_u32() helper
pata_atiixp: Don't use unconnected secondary port on SB600/SB700
libata-sff: Don't scan disabled ports when checking for legacy mode.
pata_octeon_cf: remove unused local variables from octeon_cf_set_piomode()
ahci: qoriq: added ls2088a platforms support
ahci: qoriq: report error when ecc register address is missing in dts
ahci: qoriq: added a condition to enable dma coherence
Revert "libata: switch to dynamic allocation instead of ata_scsi_rbuf"
ahci: imx: fix building without hwmon or thermal
ata: add Atari Falcon PATA controller driver
ata: pass queued command to ->sff_data_xfer method
ata: allow subsystem to be used on m68k arch
libata: switch to dynamic allocation instead of ata_scsi_rbuf
libata: don't call ata_scsi_rbuf_fill for command without a response buffer
libata: call ->scsi_done from ata_scsi_simulate
libata: remove the done callback from ata_scsi_args
libata: move struct ata_scsi_args to libata-scsi.c
libata: avoid global response buffer in atapi_qc_complete
libata-eh: Use switch() instead of sparse array for protocol strings
ata: sata_mv: Convert to devm_ioremap_resource()
...
-rw-r--r-- | drivers/ata/Kconfig | 19 | ||||
-rw-r--r-- | drivers/ata/Makefile | 1 | ||||
-rw-r--r-- | drivers/ata/ahci_imx.c | 196 | ||||
-rw-r--r-- | drivers/ata/ahci_qoriq.c | 35 | ||||
-rw-r--r-- | drivers/ata/ahci_xgene.c | 6 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 61 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 44 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c | 97 | ||||
-rw-r--r-- | drivers/ata/libata-sff.c | 45 | ||||
-rw-r--r-- | drivers/ata/libata.h | 8 | ||||
-rw-r--r-- | drivers/ata/pata_at91.c | 6 | ||||
-rw-r--r-- | drivers/ata/pata_atiixp.c | 5 | ||||
-rw-r--r-- | drivers/ata/pata_bf54x.c | 7 | ||||
-rw-r--r-- | drivers/ata/pata_ep93xx.c | 4 | ||||
-rw-r--r-- | drivers/ata/pata_falcon.c | 184 | ||||
-rw-r--r-- | drivers/ata/pata_ixp4xx_cf.c | 4 | ||||
-rw-r--r-- | drivers/ata/pata_legacy.c | 15 | ||||
-rw-r--r-- | drivers/ata/pata_octeon_cf.c | 20 | ||||
-rw-r--r-- | drivers/ata/pata_of_platform.c | 9 | ||||
-rw-r--r-- | drivers/ata/pata_pcmcia.c | 6 | ||||
-rw-r--r-- | drivers/ata/pata_samsung_cf.c | 4 | ||||
-rw-r--r-- | drivers/ata/sata_mv.c | 15 | ||||
-rw-r--r-- | drivers/ata/sata_rcar.c | 4 | ||||
-rw-r--r-- | include/linux/libata.h | 8 |
24 files changed, 612 insertions, 191 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 2c8be74f401d..70b57d2229d6 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -14,7 +14,7 @@ menuconfig ATA | |||
14 | tristate "Serial ATA and Parallel ATA drivers (libata)" | 14 | tristate "Serial ATA and Parallel ATA drivers (libata)" |
15 | depends on HAS_IOMEM | 15 | depends on HAS_IOMEM |
16 | depends on BLOCK | 16 | depends on BLOCK |
17 | depends on !(M32R || M68K || S390) || BROKEN | 17 | depends on !(M32R || S390) || BROKEN |
18 | select SCSI | 18 | select SCSI |
19 | select GLOB | 19 | select GLOB |
20 | ---help--- | 20 | ---help--- |
@@ -80,6 +80,8 @@ config SATA_PMP | |||
80 | This option adds support for SATA Port Multipliers | 80 | This option adds support for SATA Port Multipliers |
81 | (the SATA version of an ethernet hub, or SAS expander). | 81 | (the SATA version of an ethernet hub, or SAS expander). |
82 | 82 | ||
83 | if HAS_DMA | ||
84 | |||
83 | comment "Controllers with non-SFF native interface" | 85 | comment "Controllers with non-SFF native interface" |
84 | 86 | ||
85 | config SATA_AHCI | 87 | config SATA_AHCI |
@@ -127,6 +129,7 @@ config AHCI_ST | |||
127 | config AHCI_IMX | 129 | config AHCI_IMX |
128 | tristate "Freescale i.MX AHCI SATA support" | 130 | tristate "Freescale i.MX AHCI SATA support" |
129 | depends on MFD_SYSCON && (ARCH_MXC || COMPILE_TEST) | 131 | depends on MFD_SYSCON && (ARCH_MXC || COMPILE_TEST) |
132 | depends on (HWMON && (THERMAL || !THERMAL_OF)) || !HWMON | ||
130 | help | 133 | help |
131 | This option enables support for the Freescale i.MX SoC's | 134 | This option enables support for the Freescale i.MX SoC's |
132 | onboard AHCI SATA. | 135 | onboard AHCI SATA. |
@@ -232,6 +235,8 @@ config SATA_SIL24 | |||
232 | 235 | ||
233 | If unsure, say N. | 236 | If unsure, say N. |
234 | 237 | ||
238 | endif # HAS_DMA | ||
239 | |||
235 | config ATA_SFF | 240 | config ATA_SFF |
236 | bool "ATA SFF support (for legacy IDE and PATA)" | 241 | bool "ATA SFF support (for legacy IDE and PATA)" |
237 | default y | 242 | default y |
@@ -289,6 +294,7 @@ config SATA_SX4 | |||
289 | 294 | ||
290 | config ATA_BMDMA | 295 | config ATA_BMDMA |
291 | bool "ATA BMDMA support" | 296 | bool "ATA BMDMA support" |
297 | depends on HAS_DMA | ||
292 | default y | 298 | default y |
293 | help | 299 | help |
294 | This option adds support for SFF ATA controllers with BMDMA | 300 | This option adds support for SFF ATA controllers with BMDMA |
@@ -344,6 +350,7 @@ config SATA_DWC_VDEBUG | |||
344 | 350 | ||
345 | config SATA_HIGHBANK | 351 | config SATA_HIGHBANK |
346 | tristate "Calxeda Highbank SATA support" | 352 | tristate "Calxeda Highbank SATA support" |
353 | depends on HAS_DMA | ||
347 | depends on ARCH_HIGHBANK || COMPILE_TEST | 354 | depends on ARCH_HIGHBANK || COMPILE_TEST |
348 | help | 355 | help |
349 | This option enables support for the Calxeda Highbank SoC's | 356 | This option enables support for the Calxeda Highbank SoC's |
@@ -353,6 +360,7 @@ config SATA_HIGHBANK | |||
353 | 360 | ||
354 | config SATA_MV | 361 | config SATA_MV |
355 | tristate "Marvell SATA support" | 362 | tristate "Marvell SATA support" |
363 | depends on HAS_DMA | ||
356 | depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \ | 364 | depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \ |
357 | ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST | 365 | ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST |
358 | select GENERIC_PHY | 366 | select GENERIC_PHY |
@@ -895,6 +903,15 @@ config PATA_CMD640_PCI | |||
895 | 903 | ||
896 | If unsure, say N. | 904 | If unsure, say N. |
897 | 905 | ||
906 | config PATA_FALCON | ||
907 | tristate "Atari Falcon PATA support" | ||
908 | depends on M68K && ATARI | ||
909 | help | ||
910 | This option enables support for the on-board IDE | ||
911 | interface on the Atari Falcon. | ||
912 | |||
913 | If unsure, say N. | ||
914 | |||
898 | config PATA_ISAPNP | 915 | config PATA_ISAPNP |
899 | tristate "ISA Plug and Play PATA support" | 916 | tristate "ISA Plug and Play PATA support" |
900 | depends on ISAPNP | 917 | depends on ISAPNP |
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index a46e6b784bda..89a0a1915d36 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile | |||
@@ -93,6 +93,7 @@ obj-$(CONFIG_PATA_WINBOND) += pata_sl82c105.o | |||
93 | obj-$(CONFIG_PATA_AT32) += pata_at32.o | 93 | obj-$(CONFIG_PATA_AT32) += pata_at32.o |
94 | obj-$(CONFIG_PATA_AT91) += pata_at91.o | 94 | obj-$(CONFIG_PATA_AT91) += pata_at91.o |
95 | obj-$(CONFIG_PATA_CMD640_PCI) += pata_cmd640.o | 95 | obj-$(CONFIG_PATA_CMD640_PCI) += pata_cmd640.o |
96 | obj-$(CONFIG_PATA_FALCON) += pata_falcon.o | ||
96 | obj-$(CONFIG_PATA_ISAPNP) += pata_isapnp.o | 97 | obj-$(CONFIG_PATA_ISAPNP) += pata_isapnp.o |
97 | obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o | 98 | obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o |
98 | obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o | 99 | obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o |
diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index 3f3a7db208ae..787567e840bd 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c | |||
@@ -26,6 +26,9 @@ | |||
26 | #include <linux/mfd/syscon.h> | 26 | #include <linux/mfd/syscon.h> |
27 | #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> | 27 | #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> |
28 | #include <linux/libata.h> | 28 | #include <linux/libata.h> |
29 | #include <linux/hwmon.h> | ||
30 | #include <linux/hwmon-sysfs.h> | ||
31 | #include <linux/thermal.h> | ||
29 | #include "ahci.h" | 32 | #include "ahci.h" |
30 | 33 | ||
31 | #define DRV_NAME "ahci-imx" | 34 | #define DRV_NAME "ahci-imx" |
@@ -214,6 +217,180 @@ static int imx_sata_phy_reset(struct ahci_host_priv *hpriv) | |||
214 | return timeout ? 0 : -ETIMEDOUT; | 217 | return timeout ? 0 : -ETIMEDOUT; |
215 | } | 218 | } |
216 | 219 | ||
220 | enum { | ||
221 | /* SATA PHY Register */ | ||
222 | SATA_PHY_CR_CLOCK_CRCMP_LT_LIMIT = 0x0001, | ||
223 | SATA_PHY_CR_CLOCK_DAC_CTL = 0x0008, | ||
224 | SATA_PHY_CR_CLOCK_RTUNE_CTL = 0x0009, | ||
225 | SATA_PHY_CR_CLOCK_ADC_OUT = 0x000A, | ||
226 | SATA_PHY_CR_CLOCK_MPLL_TST = 0x0017, | ||
227 | }; | ||
228 | |||
229 | static int read_adc_sum(void *dev, u16 rtune_ctl_reg, void __iomem * mmio) | ||
230 | { | ||
231 | u16 adc_out_reg, read_sum; | ||
232 | u32 index, read_attempt; | ||
233 | const u32 attempt_limit = 100; | ||
234 | |||
235 | imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_RTUNE_CTL, mmio); | ||
236 | imx_phy_reg_write(rtune_ctl_reg, mmio); | ||
237 | |||
238 | /* two dummy read */ | ||
239 | index = 0; | ||
240 | read_attempt = 0; | ||
241 | adc_out_reg = 0; | ||
242 | imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_ADC_OUT, mmio); | ||
243 | while (index < 2) { | ||
244 | imx_phy_reg_read(&adc_out_reg, mmio); | ||
245 | /* check if valid */ | ||
246 | if (adc_out_reg & 0x400) | ||
247 | index++; | ||
248 | |||
249 | read_attempt++; | ||
250 | if (read_attempt > attempt_limit) { | ||
251 | dev_err(dev, "Read REG more than %d times!\n", | ||
252 | attempt_limit); | ||
253 | break; | ||
254 | } | ||
255 | } | ||
256 | |||
257 | index = 0; | ||
258 | read_attempt = 0; | ||
259 | read_sum = 0; | ||
260 | while (index < 80) { | ||
261 | imx_phy_reg_read(&adc_out_reg, mmio); | ||
262 | if (adc_out_reg & 0x400) { | ||
263 | read_sum = read_sum + (adc_out_reg & 0x3FF); | ||
264 | index++; | ||
265 | } | ||
266 | read_attempt++; | ||
267 | if (read_attempt > attempt_limit) { | ||
268 | dev_err(dev, "Read REG more than %d times!\n", | ||
269 | attempt_limit); | ||
270 | break; | ||
271 | } | ||
272 | } | ||
273 | |||
274 | /* Use the U32 to make 1000 precision */ | ||
275 | return (read_sum * 1000) / 80; | ||
276 | } | ||
277 | |||
278 | /* SATA AHCI temperature monitor */ | ||
279 | static int sata_ahci_read_temperature(void *dev, int *temp) | ||
280 | { | ||
281 | u16 mpll_test_reg, rtune_ctl_reg, dac_ctl_reg, read_sum; | ||
282 | u32 str1, str2, str3, str4; | ||
283 | int m1, m2, a; | ||
284 | struct ahci_host_priv *hpriv = dev_get_drvdata(dev); | ||
285 | void __iomem *mmio = hpriv->mmio; | ||
286 | |||
287 | /* check rd-wr to reg */ | ||
288 | read_sum = 0; | ||
289 | imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_CRCMP_LT_LIMIT, mmio); | ||
290 | imx_phy_reg_write(read_sum, mmio); | ||
291 | imx_phy_reg_read(&read_sum, mmio); | ||
292 | if ((read_sum & 0xffff) != 0) | ||
293 | dev_err(dev, "Read/Write REG error, 0x%x!\n", read_sum); | ||
294 | |||
295 | imx_phy_reg_write(0x5A5A, mmio); | ||
296 | imx_phy_reg_read(&read_sum, mmio); | ||
297 | if ((read_sum & 0xffff) != 0x5A5A) | ||
298 | dev_err(dev, "Read/Write REG error, 0x%x!\n", read_sum); | ||
299 | |||
300 | imx_phy_reg_write(0x1234, mmio); | ||
301 | imx_phy_reg_read(&read_sum, mmio); | ||
302 | if ((read_sum & 0xffff) != 0x1234) | ||
303 | dev_err(dev, "Read/Write REG error, 0x%x!\n", read_sum); | ||
304 | |||
305 | /* start temperature test */ | ||
306 | imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_MPLL_TST, mmio); | ||
307 | imx_phy_reg_read(&mpll_test_reg, mmio); | ||
308 | imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_RTUNE_CTL, mmio); | ||
309 | imx_phy_reg_read(&rtune_ctl_reg, mmio); | ||
310 | imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_DAC_CTL, mmio); | ||
311 | imx_phy_reg_read(&dac_ctl_reg, mmio); | ||
312 | |||
313 | /* mpll_tst.meas_iv ([12:2]) */ | ||
314 | str1 = (mpll_test_reg >> 2) & 0x7FF; | ||
315 | /* rtune_ctl.mode ([1:0]) */ | ||
316 | str2 = (rtune_ctl_reg) & 0x3; | ||
317 | /* dac_ctl.dac_mode ([14:12]) */ | ||
318 | str3 = (dac_ctl_reg >> 12) & 0x7; | ||
319 | /* rtune_ctl.sel_atbp ([4]) */ | ||
320 | str4 = (rtune_ctl_reg >> 4); | ||
321 | |||
322 | /* Calculate the m1 */ | ||
323 | /* mpll_tst.meas_iv */ | ||
324 | mpll_test_reg = (mpll_test_reg & 0xE03) | (512) << 2; | ||
325 | /* rtune_ctl.mode */ | ||
326 | rtune_ctl_reg = (rtune_ctl_reg & 0xFFC) | (1); | ||
327 | /* dac_ctl.dac_mode */ | ||
328 | dac_ctl_reg = (dac_ctl_reg & 0x8FF) | (4) << 12; | ||
329 | /* rtune_ctl.sel_atbp */ | ||
330 | rtune_ctl_reg = (rtune_ctl_reg & 0xFEF) | (0) << 4; | ||
331 | imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_MPLL_TST, mmio); | ||
332 | imx_phy_reg_write(mpll_test_reg, mmio); | ||
333 | imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_DAC_CTL, mmio); | ||
334 | imx_phy_reg_write(dac_ctl_reg, mmio); | ||
335 | m1 = read_adc_sum(dev, rtune_ctl_reg, mmio); | ||
336 | |||
337 | /* Calculate the m2 */ | ||
338 | /* rtune_ctl.sel_atbp */ | ||
339 | rtune_ctl_reg = (rtune_ctl_reg & 0xFEF) | (1) << 4; | ||
340 | m2 = read_adc_sum(dev, rtune_ctl_reg, mmio); | ||
341 | |||
342 | /* restore the status */ | ||
343 | /* mpll_tst.meas_iv */ | ||
344 | mpll_test_reg = (mpll_test_reg & 0xE03) | (str1) << 2; | ||
345 | /* rtune_ctl.mode */ | ||
346 | rtune_ctl_reg = (rtune_ctl_reg & 0xFFC) | (str2); | ||
347 | /* dac_ctl.dac_mode */ | ||
348 | dac_ctl_reg = (dac_ctl_reg & 0x8FF) | (str3) << 12; | ||
349 | /* rtune_ctl.sel_atbp */ | ||
350 | rtune_ctl_reg = (rtune_ctl_reg & 0xFEF) | (str4) << 4; | ||
351 | |||
352 | imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_MPLL_TST, mmio); | ||
353 | imx_phy_reg_write(mpll_test_reg, mmio); | ||
354 | imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_DAC_CTL, mmio); | ||
355 | imx_phy_reg_write(dac_ctl_reg, mmio); | ||
356 | imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_RTUNE_CTL, mmio); | ||
357 | imx_phy_reg_write(rtune_ctl_reg, mmio); | ||
358 | |||
359 | /* Compute temperature */ | ||
360 | if (!(m2 / 1000)) | ||
361 | m2 = 1000; | ||
362 | a = (m2 - m1) / (m2/1000); | ||
363 | *temp = ((-559) * a * a) / 1000 + (1379) * a + (-458000); | ||
364 | |||
365 | return 0; | ||
366 | } | ||
367 | |||
368 | static ssize_t sata_ahci_show_temp(struct device *dev, | ||
369 | struct device_attribute *da, | ||
370 | char *buf) | ||
371 | { | ||
372 | unsigned int temp = 0; | ||
373 | int err; | ||
374 | |||
375 | err = sata_ahci_read_temperature(dev, &temp); | ||
376 | if (err < 0) | ||
377 | return err; | ||
378 | |||
379 | return sprintf(buf, "%u\n", temp); | ||
380 | } | ||
381 | |||
382 | static const struct thermal_zone_of_device_ops fsl_sata_ahci_of_thermal_ops = { | ||
383 | .get_temp = sata_ahci_read_temperature, | ||
384 | }; | ||
385 | |||
386 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, sata_ahci_show_temp, NULL, 0); | ||
387 | |||
388 | static struct attribute *fsl_sata_ahci_attrs[] = { | ||
389 | &sensor_dev_attr_temp1_input.dev_attr.attr, | ||
390 | NULL | ||
391 | }; | ||
392 | ATTRIBUTE_GROUPS(fsl_sata_ahci); | ||
393 | |||
217 | static int imx_sata_enable(struct ahci_host_priv *hpriv) | 394 | static int imx_sata_enable(struct ahci_host_priv *hpriv) |
218 | { | 395 | { |
219 | struct imx_ahci_priv *imxpriv = hpriv->plat_data; | 396 | struct imx_ahci_priv *imxpriv = hpriv->plat_data; |
@@ -597,6 +774,25 @@ static int imx_ahci_probe(struct platform_device *pdev) | |||
597 | if (ret) | 774 | if (ret) |
598 | return ret; | 775 | return ret; |
599 | 776 | ||
777 | if (imxpriv->type == AHCI_IMX53 && | ||
778 | IS_ENABLED(CONFIG_HWMON)) { | ||
779 | /* Add the temperature monitor */ | ||
780 | struct device *hwmon_dev; | ||
781 | |||
782 | hwmon_dev = | ||
783 | devm_hwmon_device_register_with_groups(dev, | ||
784 | "sata_ahci", | ||
785 | hpriv, | ||
786 | fsl_sata_ahci_groups); | ||
787 | if (IS_ERR(hwmon_dev)) { | ||
788 | ret = PTR_ERR(hwmon_dev); | ||
789 | goto disable_clk; | ||
790 | } | ||
791 | devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev, | ||
792 | &fsl_sata_ahci_of_thermal_ops); | ||
793 | dev_info(dev, "%s: sensor 'sata_ahci'\n", dev_name(hwmon_dev)); | ||
794 | } | ||
795 | |||
600 | ret = imx_sata_enable(hpriv); | 796 | ret = imx_sata_enable(hpriv); |
601 | if (ret) | 797 | if (ret) |
602 | goto disable_clk; | 798 | goto disable_clk; |
diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c index 9884c8c6e934..85d833289f28 100644 --- a/drivers/ata/ahci_qoriq.c +++ b/drivers/ata/ahci_qoriq.c | |||
@@ -46,19 +46,21 @@ | |||
46 | #define LS1021A_AXICC_ADDR 0xC0 | 46 | #define LS1021A_AXICC_ADDR 0xC0 |
47 | 47 | ||
48 | #define SATA_ECC_DISABLE 0x00020000 | 48 | #define SATA_ECC_DISABLE 0x00020000 |
49 | #define LS1046A_SATA_ECC_DIS 0x80000000 | 49 | #define ECC_DIS_ARMV8_CH2 0x80000000 |
50 | 50 | ||
51 | enum ahci_qoriq_type { | 51 | enum ahci_qoriq_type { |
52 | AHCI_LS1021A, | 52 | AHCI_LS1021A, |
53 | AHCI_LS1043A, | 53 | AHCI_LS1043A, |
54 | AHCI_LS2080A, | 54 | AHCI_LS2080A, |
55 | AHCI_LS1046A, | 55 | AHCI_LS1046A, |
56 | AHCI_LS2088A, | ||
56 | }; | 57 | }; |
57 | 58 | ||
58 | struct ahci_qoriq_priv { | 59 | struct ahci_qoriq_priv { |
59 | struct ccsr_ahci *reg_base; | 60 | struct ccsr_ahci *reg_base; |
60 | enum ahci_qoriq_type type; | 61 | enum ahci_qoriq_type type; |
61 | void __iomem *ecc_addr; | 62 | void __iomem *ecc_addr; |
63 | bool is_dmacoherent; | ||
62 | }; | 64 | }; |
63 | 65 | ||
64 | static const struct of_device_id ahci_qoriq_of_match[] = { | 66 | static const struct of_device_id ahci_qoriq_of_match[] = { |
@@ -66,6 +68,7 @@ static const struct of_device_id ahci_qoriq_of_match[] = { | |||
66 | { .compatible = "fsl,ls1043a-ahci", .data = (void *)AHCI_LS1043A}, | 68 | { .compatible = "fsl,ls1043a-ahci", .data = (void *)AHCI_LS1043A}, |
67 | { .compatible = "fsl,ls2080a-ahci", .data = (void *)AHCI_LS2080A}, | 69 | { .compatible = "fsl,ls2080a-ahci", .data = (void *)AHCI_LS2080A}, |
68 | { .compatible = "fsl,ls1046a-ahci", .data = (void *)AHCI_LS1046A}, | 70 | { .compatible = "fsl,ls1046a-ahci", .data = (void *)AHCI_LS1046A}, |
71 | { .compatible = "fsl,ls2088a-ahci", .data = (void *)AHCI_LS2088A}, | ||
69 | {}, | 72 | {}, |
70 | }; | 73 | }; |
71 | MODULE_DEVICE_TABLE(of, ahci_qoriq_of_match); | 74 | MODULE_DEVICE_TABLE(of, ahci_qoriq_of_match); |
@@ -157,6 +160,8 @@ static int ahci_qoriq_phy_init(struct ahci_host_priv *hpriv) | |||
157 | 160 | ||
158 | switch (qpriv->type) { | 161 | switch (qpriv->type) { |
159 | case AHCI_LS1021A: | 162 | case AHCI_LS1021A: |
163 | if (!qpriv->ecc_addr) | ||
164 | return -EINVAL; | ||
160 | writel(SATA_ECC_DISABLE, qpriv->ecc_addr); | 165 | writel(SATA_ECC_DISABLE, qpriv->ecc_addr); |
161 | writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); | 166 | writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); |
162 | writel(LS1021A_PORT_PHY2, reg_base + PORT_PHY2); | 167 | writel(LS1021A_PORT_PHY2, reg_base + PORT_PHY2); |
@@ -164,26 +169,43 @@ static int ahci_qoriq_phy_init(struct ahci_host_priv *hpriv) | |||
164 | writel(LS1021A_PORT_PHY4, reg_base + PORT_PHY4); | 169 | writel(LS1021A_PORT_PHY4, reg_base + PORT_PHY4); |
165 | writel(LS1021A_PORT_PHY5, reg_base + PORT_PHY5); | 170 | writel(LS1021A_PORT_PHY5, reg_base + PORT_PHY5); |
166 | writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); | 171 | writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); |
167 | writel(AHCI_PORT_AXICC_CFG, reg_base + LS1021A_AXICC_ADDR); | 172 | if (qpriv->is_dmacoherent) |
173 | writel(AHCI_PORT_AXICC_CFG, | ||
174 | reg_base + LS1021A_AXICC_ADDR); | ||
168 | break; | 175 | break; |
169 | 176 | ||
170 | case AHCI_LS1043A: | 177 | case AHCI_LS1043A: |
178 | if (!qpriv->ecc_addr) | ||
179 | return -EINVAL; | ||
180 | writel(ECC_DIS_ARMV8_CH2, qpriv->ecc_addr); | ||
171 | writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); | 181 | writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); |
172 | writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); | 182 | writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); |
173 | writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC); | 183 | if (qpriv->is_dmacoherent) |
184 | writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC); | ||
174 | break; | 185 | break; |
175 | 186 | ||
176 | case AHCI_LS2080A: | 187 | case AHCI_LS2080A: |
177 | writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); | 188 | writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); |
178 | writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); | 189 | writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); |
179 | writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC); | 190 | if (qpriv->is_dmacoherent) |
191 | writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC); | ||
180 | break; | 192 | break; |
181 | 193 | ||
182 | case AHCI_LS1046A: | 194 | case AHCI_LS1046A: |
183 | writel(LS1046A_SATA_ECC_DIS, qpriv->ecc_addr); | 195 | if (!qpriv->ecc_addr) |
196 | return -EINVAL; | ||
197 | writel(ECC_DIS_ARMV8_CH2, qpriv->ecc_addr); | ||
184 | writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); | 198 | writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); |
185 | writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); | 199 | writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); |
186 | writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC); | 200 | if (qpriv->is_dmacoherent) |
201 | writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC); | ||
202 | break; | ||
203 | |||
204 | case AHCI_LS2088A: | ||
205 | writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); | ||
206 | writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); | ||
207 | if (qpriv->is_dmacoherent) | ||
208 | writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC); | ||
187 | break; | 209 | break; |
188 | } | 210 | } |
189 | 211 | ||
@@ -221,6 +243,7 @@ static int ahci_qoriq_probe(struct platform_device *pdev) | |||
221 | if (IS_ERR(qoriq_priv->ecc_addr)) | 243 | if (IS_ERR(qoriq_priv->ecc_addr)) |
222 | return PTR_ERR(qoriq_priv->ecc_addr); | 244 | return PTR_ERR(qoriq_priv->ecc_addr); |
223 | } | 245 | } |
246 | qoriq_priv->is_dmacoherent = of_dma_is_coherent(np); | ||
224 | 247 | ||
225 | rc = ahci_platform_enable_resources(hpriv); | 248 | rc = ahci_platform_enable_resources(hpriv); |
226 | if (rc) | 249 | if (rc) |
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index 73b19b277138..c2b5941d9184 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c | |||
@@ -821,8 +821,10 @@ static int xgene_ahci_probe(struct platform_device *pdev) | |||
821 | dev_warn(&pdev->dev, "%s: Error reading device info. Assume version1\n", | 821 | dev_warn(&pdev->dev, "%s: Error reading device info. Assume version1\n", |
822 | __func__); | 822 | __func__); |
823 | version = XGENE_AHCI_V1; | 823 | version = XGENE_AHCI_V1; |
824 | } else if (info->valid & ACPI_VALID_CID) { | 824 | } else { |
825 | version = XGENE_AHCI_V2; | 825 | if (info->valid & ACPI_VALID_CID) |
826 | version = XGENE_AHCI_V2; | ||
827 | kfree(info); | ||
826 | } | 828 | } |
827 | } | 829 | } |
828 | } | 830 | } |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index c2d3785ec227..ca75823697dd 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4816,32 +4816,6 @@ static unsigned int ata_dev_init_params(struct ata_device *dev, | |||
4816 | } | 4816 | } |
4817 | 4817 | ||
4818 | /** | 4818 | /** |
4819 | * ata_sg_clean - Unmap DMA memory associated with command | ||
4820 | * @qc: Command containing DMA memory to be released | ||
4821 | * | ||
4822 | * Unmap all mapped DMA memory associated with this command. | ||
4823 | * | ||
4824 | * LOCKING: | ||
4825 | * spin_lock_irqsave(host lock) | ||
4826 | */ | ||
4827 | void ata_sg_clean(struct ata_queued_cmd *qc) | ||
4828 | { | ||
4829 | struct ata_port *ap = qc->ap; | ||
4830 | struct scatterlist *sg = qc->sg; | ||
4831 | int dir = qc->dma_dir; | ||
4832 | |||
4833 | WARN_ON_ONCE(sg == NULL); | ||
4834 | |||
4835 | VPRINTK("unmapping %u sg elements\n", qc->n_elem); | ||
4836 | |||
4837 | if (qc->n_elem) | ||
4838 | dma_unmap_sg(ap->dev, sg, qc->orig_n_elem, dir); | ||
4839 | |||
4840 | qc->flags &= ~ATA_QCFLAG_DMAMAP; | ||
4841 | qc->sg = NULL; | ||
4842 | } | ||
4843 | |||
4844 | /** | ||
4845 | * atapi_check_dma - Check whether ATAPI DMA can be supported | 4819 | * atapi_check_dma - Check whether ATAPI DMA can be supported |
4846 | * @qc: Metadata associated with taskfile to check | 4820 | * @qc: Metadata associated with taskfile to check |
4847 | * | 4821 | * |
@@ -4925,6 +4899,34 @@ void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, | |||
4925 | qc->cursg = qc->sg; | 4899 | qc->cursg = qc->sg; |
4926 | } | 4900 | } |
4927 | 4901 | ||
4902 | #ifdef CONFIG_HAS_DMA | ||
4903 | |||
4904 | /** | ||
4905 | * ata_sg_clean - Unmap DMA memory associated with command | ||
4906 | * @qc: Command containing DMA memory to be released | ||
4907 | * | ||
4908 | * Unmap all mapped DMA memory associated with this command. | ||
4909 | * | ||
4910 | * LOCKING: | ||
4911 | * spin_lock_irqsave(host lock) | ||
4912 | */ | ||
4913 | void ata_sg_clean(struct ata_queued_cmd *qc) | ||
4914 | { | ||
4915 | struct ata_port *ap = qc->ap; | ||
4916 | struct scatterlist *sg = qc->sg; | ||
4917 | int dir = qc->dma_dir; | ||
4918 | |||
4919 | WARN_ON_ONCE(sg == NULL); | ||
4920 | |||
4921 | VPRINTK("unmapping %u sg elements\n", qc->n_elem); | ||
4922 | |||
4923 | if (qc->n_elem) | ||
4924 | dma_unmap_sg(ap->dev, sg, qc->orig_n_elem, dir); | ||
4925 | |||
4926 | qc->flags &= ~ATA_QCFLAG_DMAMAP; | ||
4927 | qc->sg = NULL; | ||
4928 | } | ||
4929 | |||
4928 | /** | 4930 | /** |
4929 | * ata_sg_setup - DMA-map the scatter-gather table associated with a command. | 4931 | * ata_sg_setup - DMA-map the scatter-gather table associated with a command. |
4930 | * @qc: Command with scatter-gather table to be mapped. | 4932 | * @qc: Command with scatter-gather table to be mapped. |
@@ -4957,6 +4959,13 @@ static int ata_sg_setup(struct ata_queued_cmd *qc) | |||
4957 | return 0; | 4959 | return 0; |
4958 | } | 4960 | } |
4959 | 4961 | ||
4962 | #else /* !CONFIG_HAS_DMA */ | ||
4963 | |||
4964 | static inline void ata_sg_clean(struct ata_queued_cmd *qc) {} | ||
4965 | static inline int ata_sg_setup(struct ata_queued_cmd *qc) { return -1; } | ||
4966 | |||
4967 | #endif /* !CONFIG_HAS_DMA */ | ||
4968 | |||
4960 | /** | 4969 | /** |
4961 | * swap_buf_le16 - swap halves of 16-bit words in place | 4970 | * swap_buf_le16 - swap halves of 16-bit words in place |
4962 | * @buf: Buffer to swap | 4971 | * @buf: Buffer to swap |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 50ee10db160f..4e5bf36c5f46 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -2607,21 +2607,39 @@ static void ata_eh_link_report(struct ata_link *link) | |||
2607 | [DMA_TO_DEVICE] = "out", | 2607 | [DMA_TO_DEVICE] = "out", |
2608 | [DMA_FROM_DEVICE] = "in", | 2608 | [DMA_FROM_DEVICE] = "in", |
2609 | }; | 2609 | }; |
2610 | static const char *prot_str[] = { | 2610 | const char *prot_str = NULL; |
2611 | [ATA_PROT_UNKNOWN] = "unknown", | ||
2612 | [ATA_PROT_NODATA] = "nodata", | ||
2613 | [ATA_PROT_PIO] = "pio", | ||
2614 | [ATA_PROT_DMA] = "dma", | ||
2615 | [ATA_PROT_NCQ] = "ncq dma", | ||
2616 | [ATA_PROT_NCQ_NODATA] = "ncq nodata", | ||
2617 | [ATAPI_PROT_NODATA] = "nodata", | ||
2618 | [ATAPI_PROT_PIO] = "pio", | ||
2619 | [ATAPI_PROT_DMA] = "dma", | ||
2620 | }; | ||
2621 | 2611 | ||
2612 | switch (qc->tf.protocol) { | ||
2613 | case ATA_PROT_UNKNOWN: | ||
2614 | prot_str = "unknown"; | ||
2615 | break; | ||
2616 | case ATA_PROT_NODATA: | ||
2617 | prot_str = "nodata"; | ||
2618 | break; | ||
2619 | case ATA_PROT_PIO: | ||
2620 | prot_str = "pio"; | ||
2621 | break; | ||
2622 | case ATA_PROT_DMA: | ||
2623 | prot_str = "dma"; | ||
2624 | break; | ||
2625 | case ATA_PROT_NCQ: | ||
2626 | prot_str = "ncq dma"; | ||
2627 | break; | ||
2628 | case ATA_PROT_NCQ_NODATA: | ||
2629 | prot_str = "ncq nodata"; | ||
2630 | break; | ||
2631 | case ATAPI_PROT_NODATA: | ||
2632 | prot_str = "nodata"; | ||
2633 | break; | ||
2634 | case ATAPI_PROT_PIO: | ||
2635 | prot_str = "pio"; | ||
2636 | break; | ||
2637 | case ATAPI_PROT_DMA: | ||
2638 | prot_str = "dma"; | ||
2639 | break; | ||
2640 | } | ||
2622 | snprintf(data_buf, sizeof(data_buf), " %s %u %s", | 2641 | snprintf(data_buf, sizeof(data_buf), " %s %u %s", |
2623 | prot_str[qc->tf.protocol], qc->nbytes, | 2642 | prot_str, qc->nbytes, dma_str[qc->dma_dir]); |
2624 | dma_str[qc->dma_dir]); | ||
2625 | } | 2643 | } |
2626 | 2644 | ||
2627 | if (ata_is_atapi(qc->tf.protocol)) { | 2645 | if (ata_is_atapi(qc->tf.protocol)) { |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index c771d4c341ea..12d3a66600a3 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -484,13 +484,6 @@ struct device_attribute *ata_common_sdev_attrs[] = { | |||
484 | }; | 484 | }; |
485 | EXPORT_SYMBOL_GPL(ata_common_sdev_attrs); | 485 | EXPORT_SYMBOL_GPL(ata_common_sdev_attrs); |
486 | 486 | ||
487 | static void ata_scsi_invalid_field(struct ata_device *dev, | ||
488 | struct scsi_cmnd *cmd, u16 field) | ||
489 | { | ||
490 | ata_scsi_set_invalid_field(dev, cmd, field, 0xff); | ||
491 | cmd->scsi_done(cmd); | ||
492 | } | ||
493 | |||
494 | /** | 487 | /** |
495 | * ata_std_bios_param - generic bios head/sector/cylinder calculator used by sd. | 488 | * ata_std_bios_param - generic bios head/sector/cylinder calculator used by sd. |
496 | * @sdev: SCSI device for which BIOS geometry is to be determined | 489 | * @sdev: SCSI device for which BIOS geometry is to be determined |
@@ -2057,6 +2050,12 @@ defer: | |||
2057 | return SCSI_MLQUEUE_HOST_BUSY; | 2050 | return SCSI_MLQUEUE_HOST_BUSY; |
2058 | } | 2051 | } |
2059 | 2052 | ||
2053 | struct ata_scsi_args { | ||
2054 | struct ata_device *dev; | ||
2055 | u16 *id; | ||
2056 | struct scsi_cmnd *cmd; | ||
2057 | }; | ||
2058 | |||
2060 | /** | 2059 | /** |
2061 | * ata_scsi_rbuf_get - Map response buffer. | 2060 | * ata_scsi_rbuf_get - Map response buffer. |
2062 | * @cmd: SCSI command containing buffer to be mapped. | 2061 | * @cmd: SCSI command containing buffer to be mapped. |
@@ -2133,7 +2132,6 @@ static void ata_scsi_rbuf_fill(struct ata_scsi_args *args, | |||
2133 | 2132 | ||
2134 | if (rc == 0) | 2133 | if (rc == 0) |
2135 | cmd->result = SAM_STAT_GOOD; | 2134 | cmd->result = SAM_STAT_GOOD; |
2136 | args->done(cmd); | ||
2137 | } | 2135 | } |
2138 | 2136 | ||
2139 | /** | 2137 | /** |
@@ -2455,23 +2453,6 @@ static unsigned int ata_scsiop_inq_b6(struct ata_scsi_args *args, u8 *rbuf) | |||
2455 | } | 2453 | } |
2456 | 2454 | ||
2457 | /** | 2455 | /** |
2458 | * ata_scsiop_noop - Command handler that simply returns success. | ||
2459 | * @args: device IDENTIFY data / SCSI command of interest. | ||
2460 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. | ||
2461 | * | ||
2462 | * No operation. Simply returns success to caller, to indicate | ||
2463 | * that the caller should successfully complete this SCSI command. | ||
2464 | * | ||
2465 | * LOCKING: | ||
2466 | * spin_lock_irqsave(host lock) | ||
2467 | */ | ||
2468 | static unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf) | ||
2469 | { | ||
2470 | VPRINTK("ENTER\n"); | ||
2471 | return 0; | ||
2472 | } | ||
2473 | |||
2474 | /** | ||
2475 | * modecpy - Prepare response for MODE SENSE | 2456 | * modecpy - Prepare response for MODE SENSE |
2476 | * @dest: output buffer | 2457 | * @dest: output buffer |
2477 | * @src: data being copied | 2458 | * @src: data being copied |
@@ -2873,6 +2854,26 @@ static void atapi_request_sense(struct ata_queued_cmd *qc) | |||
2873 | DPRINTK("EXIT\n"); | 2854 | DPRINTK("EXIT\n"); |
2874 | } | 2855 | } |
2875 | 2856 | ||
2857 | /* | ||
2858 | * ATAPI devices typically report zero for their SCSI version, and sometimes | ||
2859 | * deviate from the spec WRT response data format. If SCSI version is | ||
2860 | * reported as zero like normal, then we make the following fixups: | ||
2861 | * 1) Fake MMC-5 version, to indicate to the Linux scsi midlayer this is a | ||
2862 | * modern device. | ||
2863 | * 2) Ensure response data format / ATAPI information are always correct. | ||
2864 | */ | ||
2865 | static void atapi_fixup_inquiry(struct scsi_cmnd *cmd) | ||
2866 | { | ||
2867 | u8 buf[4]; | ||
2868 | |||
2869 | sg_copy_to_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), buf, 4); | ||
2870 | if (buf[2] == 0) { | ||
2871 | buf[2] = 0x5; | ||
2872 | buf[3] = 0x32; | ||
2873 | } | ||
2874 | sg_copy_from_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), buf, 4); | ||
2875 | } | ||
2876 | |||
2876 | static void atapi_qc_complete(struct ata_queued_cmd *qc) | 2877 | static void atapi_qc_complete(struct ata_queued_cmd *qc) |
2877 | { | 2878 | { |
2878 | struct scsi_cmnd *cmd = qc->scsicmd; | 2879 | struct scsi_cmnd *cmd = qc->scsicmd; |
@@ -2927,30 +2928,8 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) | |||
2927 | */ | 2928 | */ |
2928 | ata_gen_passthru_sense(qc); | 2929 | ata_gen_passthru_sense(qc); |
2929 | } else { | 2930 | } else { |
2930 | u8 *scsicmd = cmd->cmnd; | 2931 | if (cmd->cmnd[0] == INQUIRY && (cmd->cmnd[1] & 0x03) == 0) |
2931 | 2932 | atapi_fixup_inquiry(cmd); | |
2932 | if ((scsicmd[0] == INQUIRY) && ((scsicmd[1] & 0x03) == 0)) { | ||
2933 | unsigned long flags; | ||
2934 | u8 *buf; | ||
2935 | |||
2936 | buf = ata_scsi_rbuf_get(cmd, true, &flags); | ||
2937 | |||
2938 | /* ATAPI devices typically report zero for their SCSI version, | ||
2939 | * and sometimes deviate from the spec WRT response data | ||
2940 | * format. If SCSI version is reported as zero like normal, | ||
2941 | * then we make the following fixups: 1) Fake MMC-5 version, | ||
2942 | * to indicate to the Linux scsi midlayer this is a modern | ||
2943 | * device. 2) Ensure response data format / ATAPI information | ||
2944 | * are always correct. | ||
2945 | */ | ||
2946 | if (buf[2] == 0) { | ||
2947 | buf[2] = 0x5; | ||
2948 | buf[3] = 0x32; | ||
2949 | } | ||
2950 | |||
2951 | ata_scsi_rbuf_put(cmd, true, &flags); | ||
2952 | } | ||
2953 | |||
2954 | cmd->result = SAM_STAT_GOOD; | 2933 | cmd->result = SAM_STAT_GOOD; |
2955 | } | 2934 | } |
2956 | 2935 | ||
@@ -4352,12 +4331,11 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) | |||
4352 | args.dev = dev; | 4331 | args.dev = dev; |
4353 | args.id = dev->id; | 4332 | args.id = dev->id; |
4354 | args.cmd = cmd; | 4333 | args.cmd = cmd; |
4355 | args.done = cmd->scsi_done; | ||
4356 | 4334 | ||
4357 | switch(scsicmd[0]) { | 4335 | switch(scsicmd[0]) { |
4358 | case INQUIRY: | 4336 | case INQUIRY: |
4359 | if (scsicmd[1] & 2) /* is CmdDt set? */ | 4337 | if (scsicmd[1] & 2) /* is CmdDt set? */ |
4360 | ata_scsi_invalid_field(dev, cmd, 1); | 4338 | ata_scsi_set_invalid_field(dev, cmd, 1, 0xff); |
4361 | else if ((scsicmd[1] & 1) == 0) /* is EVPD clear? */ | 4339 | else if ((scsicmd[1] & 1) == 0) /* is EVPD clear? */ |
4362 | ata_scsi_rbuf_fill(&args, ata_scsiop_inq_std); | 4340 | ata_scsi_rbuf_fill(&args, ata_scsiop_inq_std); |
4363 | else switch (scsicmd[2]) { | 4341 | else switch (scsicmd[2]) { |
@@ -4389,7 +4367,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) | |||
4389 | } | 4367 | } |
4390 | /* Fallthrough */ | 4368 | /* Fallthrough */ |
4391 | default: | 4369 | default: |
4392 | ata_scsi_invalid_field(dev, cmd, 2); | 4370 | ata_scsi_set_invalid_field(dev, cmd, 2, 0xff); |
4393 | break; | 4371 | break; |
4394 | } | 4372 | } |
4395 | break; | 4373 | break; |
@@ -4407,7 +4385,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) | |||
4407 | if ((scsicmd[1] & 0x1f) == SAI_READ_CAPACITY_16) | 4385 | if ((scsicmd[1] & 0x1f) == SAI_READ_CAPACITY_16) |
4408 | ata_scsi_rbuf_fill(&args, ata_scsiop_read_cap); | 4386 | ata_scsi_rbuf_fill(&args, ata_scsiop_read_cap); |
4409 | else | 4387 | else |
4410 | ata_scsi_invalid_field(dev, cmd, 1); | 4388 | ata_scsi_set_invalid_field(dev, cmd, 1, 0xff); |
4411 | break; | 4389 | break; |
4412 | 4390 | ||
4413 | case REPORT_LUNS: | 4391 | case REPORT_LUNS: |
@@ -4417,7 +4395,6 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) | |||
4417 | case REQUEST_SENSE: | 4395 | case REQUEST_SENSE: |
4418 | ata_scsi_set_sense(dev, cmd, 0, 0, 0); | 4396 | ata_scsi_set_sense(dev, cmd, 0, 0, 0); |
4419 | cmd->result = (DRIVER_SENSE << 24); | 4397 | cmd->result = (DRIVER_SENSE << 24); |
4420 | cmd->scsi_done(cmd); | ||
4421 | break; | 4398 | break; |
4422 | 4399 | ||
4423 | /* if we reach this, then writeback caching is disabled, | 4400 | /* if we reach this, then writeback caching is disabled, |
@@ -4431,31 +4408,29 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) | |||
4431 | case SEEK_6: | 4408 | case SEEK_6: |
4432 | case SEEK_10: | 4409 | case SEEK_10: |
4433 | case TEST_UNIT_READY: | 4410 | case TEST_UNIT_READY: |
4434 | ata_scsi_rbuf_fill(&args, ata_scsiop_noop); | ||
4435 | break; | 4411 | break; |
4436 | 4412 | ||
4437 | case SEND_DIAGNOSTIC: | 4413 | case SEND_DIAGNOSTIC: |
4438 | tmp8 = scsicmd[1] & ~(1 << 3); | 4414 | tmp8 = scsicmd[1] & ~(1 << 3); |
4439 | if ((tmp8 == 0x4) && (!scsicmd[3]) && (!scsicmd[4])) | 4415 | if (tmp8 != 0x4 || scsicmd[3] || scsicmd[4]) |
4440 | ata_scsi_rbuf_fill(&args, ata_scsiop_noop); | 4416 | ata_scsi_set_invalid_field(dev, cmd, 1, 0xff); |
4441 | else | ||
4442 | ata_scsi_invalid_field(dev, cmd, 1); | ||
4443 | break; | 4417 | break; |
4444 | 4418 | ||
4445 | case MAINTENANCE_IN: | 4419 | case MAINTENANCE_IN: |
4446 | if (scsicmd[1] == MI_REPORT_SUPPORTED_OPERATION_CODES) | 4420 | if (scsicmd[1] == MI_REPORT_SUPPORTED_OPERATION_CODES) |
4447 | ata_scsi_rbuf_fill(&args, ata_scsiop_maint_in); | 4421 | ata_scsi_rbuf_fill(&args, ata_scsiop_maint_in); |
4448 | else | 4422 | else |
4449 | ata_scsi_invalid_field(dev, cmd, 1); | 4423 | ata_scsi_set_invalid_field(dev, cmd, 1, 0xff); |
4450 | break; | 4424 | break; |
4451 | 4425 | ||
4452 | /* all other commands */ | 4426 | /* all other commands */ |
4453 | default: | 4427 | default: |
4454 | ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x20, 0x0); | 4428 | ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x20, 0x0); |
4455 | /* "Invalid command operation code" */ | 4429 | /* "Invalid command operation code" */ |
4456 | cmd->scsi_done(cmd); | ||
4457 | break; | 4430 | break; |
4458 | } | 4431 | } |
4432 | |||
4433 | cmd->scsi_done(cmd); | ||
4459 | } | 4434 | } |
4460 | 4435 | ||
4461 | int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht) | 4436 | int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht) |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 051b6158d1b7..2bd92dca3e62 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -542,7 +542,7 @@ static inline void ata_tf_to_host(struct ata_port *ap, | |||
542 | 542 | ||
543 | /** | 543 | /** |
544 | * ata_sff_data_xfer - Transfer data by PIO | 544 | * ata_sff_data_xfer - Transfer data by PIO |
545 | * @dev: device to target | 545 | * @qc: queued command |
546 | * @buf: data buffer | 546 | * @buf: data buffer |
547 | * @buflen: buffer length | 547 | * @buflen: buffer length |
548 | * @rw: read/write | 548 | * @rw: read/write |
@@ -555,10 +555,10 @@ static inline void ata_tf_to_host(struct ata_port *ap, | |||
555 | * RETURNS: | 555 | * RETURNS: |
556 | * Bytes consumed. | 556 | * Bytes consumed. |
557 | */ | 557 | */ |
558 | unsigned int ata_sff_data_xfer(struct ata_device *dev, unsigned char *buf, | 558 | unsigned int ata_sff_data_xfer(struct ata_queued_cmd *qc, unsigned char *buf, |
559 | unsigned int buflen, int rw) | 559 | unsigned int buflen, int rw) |
560 | { | 560 | { |
561 | struct ata_port *ap = dev->link->ap; | 561 | struct ata_port *ap = qc->dev->link->ap; |
562 | void __iomem *data_addr = ap->ioaddr.data_addr; | 562 | void __iomem *data_addr = ap->ioaddr.data_addr; |
563 | unsigned int words = buflen >> 1; | 563 | unsigned int words = buflen >> 1; |
564 | 564 | ||
@@ -595,7 +595,7 @@ EXPORT_SYMBOL_GPL(ata_sff_data_xfer); | |||
595 | 595 | ||
596 | /** | 596 | /** |
597 | * ata_sff_data_xfer32 - Transfer data by PIO | 597 | * ata_sff_data_xfer32 - Transfer data by PIO |
598 | * @dev: device to target | 598 | * @qc: queued command |
599 | * @buf: data buffer | 599 | * @buf: data buffer |
600 | * @buflen: buffer length | 600 | * @buflen: buffer length |
601 | * @rw: read/write | 601 | * @rw: read/write |
@@ -610,16 +610,17 @@ EXPORT_SYMBOL_GPL(ata_sff_data_xfer); | |||
610 | * Bytes consumed. | 610 | * Bytes consumed. |
611 | */ | 611 | */ |
612 | 612 | ||
613 | unsigned int ata_sff_data_xfer32(struct ata_device *dev, unsigned char *buf, | 613 | unsigned int ata_sff_data_xfer32(struct ata_queued_cmd *qc, unsigned char *buf, |
614 | unsigned int buflen, int rw) | 614 | unsigned int buflen, int rw) |
615 | { | 615 | { |
616 | struct ata_device *dev = qc->dev; | ||
616 | struct ata_port *ap = dev->link->ap; | 617 | struct ata_port *ap = dev->link->ap; |
617 | void __iomem *data_addr = ap->ioaddr.data_addr; | 618 | void __iomem *data_addr = ap->ioaddr.data_addr; |
618 | unsigned int words = buflen >> 2; | 619 | unsigned int words = buflen >> 2; |
619 | int slop = buflen & 3; | 620 | int slop = buflen & 3; |
620 | 621 | ||
621 | if (!(ap->pflags & ATA_PFLAG_PIO32)) | 622 | if (!(ap->pflags & ATA_PFLAG_PIO32)) |
622 | return ata_sff_data_xfer(dev, buf, buflen, rw); | 623 | return ata_sff_data_xfer(qc, buf, buflen, rw); |
623 | 624 | ||
624 | /* Transfer multiple of 4 bytes */ | 625 | /* Transfer multiple of 4 bytes */ |
625 | if (rw == READ) | 626 | if (rw == READ) |
@@ -658,7 +659,7 @@ EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); | |||
658 | 659 | ||
659 | /** | 660 | /** |
660 | * ata_sff_data_xfer_noirq - Transfer data by PIO | 661 | * ata_sff_data_xfer_noirq - Transfer data by PIO |
661 | * @dev: device to target | 662 | * @qc: queued command |
662 | * @buf: data buffer | 663 | * @buf: data buffer |
663 | * @buflen: buffer length | 664 | * @buflen: buffer length |
664 | * @rw: read/write | 665 | * @rw: read/write |
@@ -672,14 +673,14 @@ EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); | |||
672 | * RETURNS: | 673 | * RETURNS: |
673 | * Bytes consumed. | 674 | * Bytes consumed. |
674 | */ | 675 | */ |
675 | unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, unsigned char *buf, | 676 | unsigned int ata_sff_data_xfer_noirq(struct ata_queued_cmd *qc, unsigned char *buf, |
676 | unsigned int buflen, int rw) | 677 | unsigned int buflen, int rw) |
677 | { | 678 | { |
678 | unsigned long flags; | 679 | unsigned long flags; |
679 | unsigned int consumed; | 680 | unsigned int consumed; |
680 | 681 | ||
681 | local_irq_save(flags); | 682 | local_irq_save(flags); |
682 | consumed = ata_sff_data_xfer32(dev, buf, buflen, rw); | 683 | consumed = ata_sff_data_xfer32(qc, buf, buflen, rw); |
683 | local_irq_restore(flags); | 684 | local_irq_restore(flags); |
684 | 685 | ||
685 | return consumed; | 686 | return consumed; |
@@ -723,14 +724,14 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) | |||
723 | buf = kmap_atomic(page); | 724 | buf = kmap_atomic(page); |
724 | 725 | ||
725 | /* do the actual data transfer */ | 726 | /* do the actual data transfer */ |
726 | ap->ops->sff_data_xfer(qc->dev, buf + offset, qc->sect_size, | 727 | ap->ops->sff_data_xfer(qc, buf + offset, qc->sect_size, |
727 | do_write); | 728 | do_write); |
728 | 729 | ||
729 | kunmap_atomic(buf); | 730 | kunmap_atomic(buf); |
730 | local_irq_restore(flags); | 731 | local_irq_restore(flags); |
731 | } else { | 732 | } else { |
732 | buf = page_address(page); | 733 | buf = page_address(page); |
733 | ap->ops->sff_data_xfer(qc->dev, buf + offset, qc->sect_size, | 734 | ap->ops->sff_data_xfer(qc, buf + offset, qc->sect_size, |
734 | do_write); | 735 | do_write); |
735 | } | 736 | } |
736 | 737 | ||
@@ -791,7 +792,7 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
791 | DPRINTK("send cdb\n"); | 792 | DPRINTK("send cdb\n"); |
792 | WARN_ON_ONCE(qc->dev->cdb_len < 12); | 793 | WARN_ON_ONCE(qc->dev->cdb_len < 12); |
793 | 794 | ||
794 | ap->ops->sff_data_xfer(qc->dev, qc->cdb, qc->dev->cdb_len, 1); | 795 | ap->ops->sff_data_xfer(qc, qc->cdb, qc->dev->cdb_len, 1); |
795 | ata_sff_sync(ap); | 796 | ata_sff_sync(ap); |
796 | /* FIXME: If the CDB is for DMA do we need to do the transition delay | 797 | /* FIXME: If the CDB is for DMA do we need to do the transition delay |
797 | or is bmdma_start guaranteed to do it ? */ | 798 | or is bmdma_start guaranteed to do it ? */ |
@@ -868,14 +869,14 @@ next_sg: | |||
868 | buf = kmap_atomic(page); | 869 | buf = kmap_atomic(page); |
869 | 870 | ||
870 | /* do the actual data transfer */ | 871 | /* do the actual data transfer */ |
871 | consumed = ap->ops->sff_data_xfer(dev, buf + offset, | 872 | consumed = ap->ops->sff_data_xfer(qc, buf + offset, |
872 | count, rw); | 873 | count, rw); |
873 | 874 | ||
874 | kunmap_atomic(buf); | 875 | kunmap_atomic(buf); |
875 | local_irq_restore(flags); | 876 | local_irq_restore(flags); |
876 | } else { | 877 | } else { |
877 | buf = page_address(page); | 878 | buf = page_address(page); |
878 | consumed = ap->ops->sff_data_xfer(dev, buf + offset, | 879 | consumed = ap->ops->sff_data_xfer(qc, buf + offset, |
879 | count, rw); | 880 | count, rw); |
880 | } | 881 | } |
881 | 882 | ||
@@ -2427,11 +2428,21 @@ int ata_pci_sff_activate_host(struct ata_host *host, | |||
2427 | return rc; | 2428 | return rc; |
2428 | 2429 | ||
2429 | if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) { | 2430 | if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) { |
2430 | u8 tmp8, mask; | 2431 | u8 tmp8, mask = 0; |
2431 | 2432 | ||
2432 | /* TODO: What if one channel is in native mode ... */ | 2433 | /* |
2434 | * ATA spec says we should use legacy mode when one | ||
2435 | * port is in legacy mode, but disabled ports on some | ||
2436 | * PCI hosts appear as fixed legacy ports, e.g SB600/700 | ||
2437 | * on which the secondary port is not wired, so | ||
2438 | * ignore ports that are marked as 'dummy' during | ||
2439 | * this check | ||
2440 | */ | ||
2433 | pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8); | 2441 | pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8); |
2434 | mask = (1 << 2) | (1 << 0); | 2442 | if (!ata_port_is_dummy(host->ports[0])) |
2443 | mask |= (1 << 0); | ||
2444 | if (!ata_port_is_dummy(host->ports[1])) | ||
2445 | mask |= (1 << 2); | ||
2435 | if ((tmp8 & mask) != mask) | 2446 | if ((tmp8 & mask) != mask) |
2436 | legacy_mode = 1; | 2447 | legacy_mode = 1; |
2437 | } | 2448 | } |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 06d479d1f302..120fce0befd3 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -31,13 +31,6 @@ | |||
31 | #define DRV_NAME "libata" | 31 | #define DRV_NAME "libata" |
32 | #define DRV_VERSION "3.00" /* must be exactly four chars */ | 32 | #define DRV_VERSION "3.00" /* must be exactly four chars */ |
33 | 33 | ||
34 | struct ata_scsi_args { | ||
35 | struct ata_device *dev; | ||
36 | u16 *id; | ||
37 | struct scsi_cmnd *cmd; | ||
38 | void (*done)(struct scsi_cmnd *); | ||
39 | }; | ||
40 | |||
41 | /* libata-core.c */ | 34 | /* libata-core.c */ |
42 | enum { | 35 | enum { |
43 | /* flags for ata_dev_read_id() */ | 36 | /* flags for ata_dev_read_id() */ |
@@ -89,7 +82,6 @@ extern int sata_down_spd_limit(struct ata_link *link, u32 spd_limit); | |||
89 | extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); | 82 | extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); |
90 | extern unsigned int ata_dev_set_feature(struct ata_device *dev, | 83 | extern unsigned int ata_dev_set_feature(struct ata_device *dev, |
91 | u8 enable, u8 feature); | 84 | u8 enable, u8 feature); |
92 | extern void ata_sg_clean(struct ata_queued_cmd *qc); | ||
93 | extern void ata_qc_free(struct ata_queued_cmd *qc); | 85 | extern void ata_qc_free(struct ata_queued_cmd *qc); |
94 | extern void ata_qc_issue(struct ata_queued_cmd *qc); | 86 | extern void ata_qc_issue(struct ata_queued_cmd *qc); |
95 | extern void __ata_qc_complete(struct ata_queued_cmd *qc); | 87 | extern void __ata_qc_complete(struct ata_queued_cmd *qc); |
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c index 1611e0e8d767..fd5b34f0d007 100644 --- a/drivers/ata/pata_at91.c +++ b/drivers/ata/pata_at91.c | |||
@@ -286,10 +286,10 @@ static void pata_at91_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
286 | set_smc_timing(ap->dev, adev, info, &timing); | 286 | set_smc_timing(ap->dev, adev, info, &timing); |
287 | } | 287 | } |
288 | 288 | ||
289 | static unsigned int pata_at91_data_xfer_noirq(struct ata_device *dev, | 289 | static unsigned int pata_at91_data_xfer_noirq(struct ata_queued_cmd *qc, |
290 | unsigned char *buf, unsigned int buflen, int rw) | 290 | unsigned char *buf, unsigned int buflen, int rw) |
291 | { | 291 | { |
292 | struct at91_ide_info *info = dev->link->ap->host->private_data; | 292 | struct at91_ide_info *info = qc->dev->link->ap->host->private_data; |
293 | unsigned int consumed; | 293 | unsigned int consumed; |
294 | unsigned int mode; | 294 | unsigned int mode; |
295 | unsigned long flags; | 295 | unsigned long flags; |
@@ -301,7 +301,7 @@ static unsigned int pata_at91_data_xfer_noirq(struct ata_device *dev, | |||
301 | regmap_fields_write(fields.mode, info->cs, (mode & ~AT91_SMC_DBW) | | 301 | regmap_fields_write(fields.mode, info->cs, (mode & ~AT91_SMC_DBW) | |
302 | AT91_SMC_DBW_16); | 302 | AT91_SMC_DBW_16); |
303 | 303 | ||
304 | consumed = ata_sff_data_xfer(dev, buf, buflen, rw); | 304 | consumed = ata_sff_data_xfer(qc, buf, buflen, rw); |
305 | 305 | ||
306 | /* restore 8bit mode after data is written */ | 306 | /* restore 8bit mode after data is written */ |
307 | regmap_fields_write(fields.mode, info->cs, (mode & ~AT91_SMC_DBW) | | 307 | regmap_fields_write(fields.mode, info->cs, (mode & ~AT91_SMC_DBW) | |
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index 49d705c9f0f7..6c9aa95a9a05 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
@@ -278,6 +278,11 @@ static int atiixp_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
278 | }; | 278 | }; |
279 | const struct ata_port_info *ppi[] = { &info, &info }; | 279 | const struct ata_port_info *ppi[] = { &info, &info }; |
280 | 280 | ||
281 | /* SB600/700 don't have secondary port wired */ | ||
282 | if ((pdev->device == PCI_DEVICE_ID_ATI_IXP600_IDE) || | ||
283 | (pdev->device == PCI_DEVICE_ID_ATI_IXP700_IDE)) | ||
284 | ppi[1] = &ata_dummy_port_info; | ||
285 | |||
281 | return ata_pci_bmdma_init_one(pdev, ppi, &atiixp_sht, NULL, | 286 | return ata_pci_bmdma_init_one(pdev, ppi, &atiixp_sht, NULL, |
282 | ATA_HOST_PARALLEL_SCAN); | 287 | ATA_HOST_PARALLEL_SCAN); |
283 | } | 288 | } |
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c index ec748d31928d..9c5780a7e1b9 100644 --- a/drivers/ata/pata_bf54x.c +++ b/drivers/ata/pata_bf54x.c | |||
@@ -1143,7 +1143,7 @@ static unsigned char bfin_bmdma_status(struct ata_port *ap) | |||
1143 | 1143 | ||
1144 | /** | 1144 | /** |
1145 | * bfin_data_xfer - Transfer data by PIO | 1145 | * bfin_data_xfer - Transfer data by PIO |
1146 | * @adev: device for this I/O | 1146 | * @qc: queued command |
1147 | * @buf: data buffer | 1147 | * @buf: data buffer |
1148 | * @buflen: buffer length | 1148 | * @buflen: buffer length |
1149 | * @write_data: read/write | 1149 | * @write_data: read/write |
@@ -1151,10 +1151,11 @@ static unsigned char bfin_bmdma_status(struct ata_port *ap) | |||
1151 | * Note: Original code is ata_sff_data_xfer(). | 1151 | * Note: Original code is ata_sff_data_xfer(). |
1152 | */ | 1152 | */ |
1153 | 1153 | ||
1154 | static unsigned int bfin_data_xfer(struct ata_device *dev, unsigned char *buf, | 1154 | static unsigned int bfin_data_xfer(struct ata_queued_cmd *qc, |
1155 | unsigned char *buf, | ||
1155 | unsigned int buflen, int rw) | 1156 | unsigned int buflen, int rw) |
1156 | { | 1157 | { |
1157 | struct ata_port *ap = dev->link->ap; | 1158 | struct ata_port *ap = qc->dev->link->ap; |
1158 | void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; | 1159 | void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; |
1159 | unsigned int words = buflen >> 1; | 1160 | unsigned int words = buflen >> 1; |
1160 | unsigned short *buf16 = (u16 *)buf; | 1161 | unsigned short *buf16 = (u16 *)buf; |
diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c index bd6b089c67a3..bf1b910c5d69 100644 --- a/drivers/ata/pata_ep93xx.c +++ b/drivers/ata/pata_ep93xx.c | |||
@@ -474,11 +474,11 @@ static void ep93xx_pata_set_devctl(struct ata_port *ap, u8 ctl) | |||
474 | } | 474 | } |
475 | 475 | ||
476 | /* Note: original code is ata_sff_data_xfer */ | 476 | /* Note: original code is ata_sff_data_xfer */ |
477 | static unsigned int ep93xx_pata_data_xfer(struct ata_device *adev, | 477 | static unsigned int ep93xx_pata_data_xfer(struct ata_queued_cmd *qc, |
478 | unsigned char *buf, | 478 | unsigned char *buf, |
479 | unsigned int buflen, int rw) | 479 | unsigned int buflen, int rw) |
480 | { | 480 | { |
481 | struct ata_port *ap = adev->link->ap; | 481 | struct ata_port *ap = qc->dev->link->ap; |
482 | struct ep93xx_pata_data *drv_data = ap->host->private_data; | 482 | struct ep93xx_pata_data *drv_data = ap->host->private_data; |
483 | u16 *data = (u16 *)buf; | 483 | u16 *data = (u16 *)buf; |
484 | unsigned int words = buflen >> 1; | 484 | unsigned int words = buflen >> 1; |
diff --git a/drivers/ata/pata_falcon.c b/drivers/ata/pata_falcon.c new file mode 100644 index 000000000000..5b0c57d1c59f --- /dev/null +++ b/drivers/ata/pata_falcon.c | |||
@@ -0,0 +1,184 @@ | |||
1 | /* | ||
2 | * Atari Falcon PATA controller driver | ||
3 | * | ||
4 | * Copyright (c) 2016 Samsung Electronics Co., Ltd. | ||
5 | * http://www.samsung.com | ||
6 | * | ||
7 | * Based on falconide.c: | ||
8 | * | ||
9 | * Created 12 Jul 1997 by Geert Uytterhoeven | ||
10 | * | ||
11 | * This file is subject to the terms and conditions of the GNU General Public | ||
12 | * License. See the file "COPYING" in the main directory of this archive | ||
13 | * for more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/blkdev.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <scsi/scsi_host.h> | ||
22 | #include <scsi/scsi_cmnd.h> | ||
23 | #include <linux/ata.h> | ||
24 | #include <linux/libata.h> | ||
25 | #include <linux/mm.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/platform_device.h> | ||
28 | |||
29 | #include <asm/setup.h> | ||
30 | #include <asm/atarihw.h> | ||
31 | #include <asm/atariints.h> | ||
32 | #include <asm/atari_stdma.h> | ||
33 | #include <asm/ide.h> | ||
34 | |||
35 | #define DRV_NAME "pata_falcon" | ||
36 | #define DRV_VERSION "0.1.0" | ||
37 | |||
38 | #define ATA_HD_BASE 0xfff00000 | ||
39 | #define ATA_HD_CONTROL 0x39 | ||
40 | |||
41 | static struct scsi_host_template pata_falcon_sht = { | ||
42 | ATA_PIO_SHT(DRV_NAME), | ||
43 | }; | ||
44 | |||
45 | static unsigned int pata_falcon_data_xfer(struct ata_queued_cmd *qc, | ||
46 | unsigned char *buf, | ||
47 | unsigned int buflen, int rw) | ||
48 | { | ||
49 | struct ata_device *dev = qc->dev; | ||
50 | struct ata_port *ap = dev->link->ap; | ||
51 | void __iomem *data_addr = ap->ioaddr.data_addr; | ||
52 | unsigned int words = buflen >> 1; | ||
53 | struct scsi_cmnd *cmd = qc->scsicmd; | ||
54 | bool swap = 1; | ||
55 | |||
56 | if (dev->class == ATA_DEV_ATA && cmd && cmd->request && | ||
57 | !blk_rq_is_passthrough(cmd->request)) | ||
58 | swap = 0; | ||
59 | |||
60 | /* Transfer multiple of 2 bytes */ | ||
61 | if (rw == READ) { | ||
62 | if (swap) | ||
63 | raw_insw_swapw((u16 *)data_addr, (u16 *)buf, words); | ||
64 | else | ||
65 | raw_insw((u16 *)data_addr, (u16 *)buf, words); | ||
66 | } else { | ||
67 | if (swap) | ||
68 | raw_outsw_swapw((u16 *)data_addr, (u16 *)buf, words); | ||
69 | else | ||
70 | raw_outsw((u16 *)data_addr, (u16 *)buf, words); | ||
71 | } | ||
72 | |||
73 | /* Transfer trailing byte, if any. */ | ||
74 | if (unlikely(buflen & 0x01)) { | ||
75 | unsigned char pad[2] = { }; | ||
76 | |||
77 | /* Point buf to the tail of buffer */ | ||
78 | buf += buflen - 1; | ||
79 | |||
80 | if (rw == READ) { | ||
81 | if (swap) | ||
82 | raw_insw_swapw((u16 *)data_addr, (u16 *)pad, 1); | ||
83 | else | ||
84 | raw_insw((u16 *)data_addr, (u16 *)pad, 1); | ||
85 | *buf = pad[0]; | ||
86 | } else { | ||
87 | pad[0] = *buf; | ||
88 | if (swap) | ||
89 | raw_outsw_swapw((u16 *)data_addr, (u16 *)pad, 1); | ||
90 | else | ||
91 | raw_outsw((u16 *)data_addr, (u16 *)pad, 1); | ||
92 | } | ||
93 | words++; | ||
94 | } | ||
95 | |||
96 | return words << 1; | ||
97 | } | ||
98 | |||
99 | /* | ||
100 | * Provide our own set_mode() as we don't want to change anything that has | ||
101 | * already been configured.. | ||
102 | */ | ||
103 | static int pata_falcon_set_mode(struct ata_link *link, | ||
104 | struct ata_device **unused) | ||
105 | { | ||
106 | struct ata_device *dev; | ||
107 | |||
108 | ata_for_each_dev(dev, link, ENABLED) { | ||
109 | /* We don't really care */ | ||
110 | dev->pio_mode = dev->xfer_mode = XFER_PIO_0; | ||
111 | dev->xfer_shift = ATA_SHIFT_PIO; | ||
112 | dev->flags |= ATA_DFLAG_PIO; | ||
113 | ata_dev_info(dev, "configured for PIO\n"); | ||
114 | } | ||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | static struct ata_port_operations pata_falcon_ops = { | ||
119 | .inherits = &ata_sff_port_ops, | ||
120 | .sff_data_xfer = pata_falcon_data_xfer, | ||
121 | .cable_detect = ata_cable_unknown, | ||
122 | .set_mode = pata_falcon_set_mode, | ||
123 | }; | ||
124 | |||
125 | static int pata_falcon_init_one(void) | ||
126 | { | ||
127 | struct ata_host *host; | ||
128 | struct ata_port *ap; | ||
129 | struct platform_device *pdev; | ||
130 | void __iomem *base; | ||
131 | |||
132 | if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE)) | ||
133 | return -ENODEV; | ||
134 | |||
135 | pr_info(DRV_NAME ": Atari Falcon PATA controller\n"); | ||
136 | |||
137 | pdev = platform_device_register_simple(DRV_NAME, 0, NULL, 0); | ||
138 | if (IS_ERR(pdev)) | ||
139 | return PTR_ERR(pdev); | ||
140 | |||
141 | if (!devm_request_mem_region(&pdev->dev, ATA_HD_BASE, 0x40, DRV_NAME)) { | ||
142 | pr_err(DRV_NAME ": resources busy\n"); | ||
143 | return -EBUSY; | ||
144 | } | ||
145 | |||
146 | /* allocate host */ | ||
147 | host = ata_host_alloc(&pdev->dev, 1); | ||
148 | if (!host) | ||
149 | return -ENOMEM; | ||
150 | ap = host->ports[0]; | ||
151 | |||
152 | ap->ops = &pata_falcon_ops; | ||
153 | ap->pio_mask = ATA_PIO4; | ||
154 | ap->flags |= ATA_FLAG_SLAVE_POSS | ATA_FLAG_NO_IORDY; | ||
155 | ap->flags |= ATA_FLAG_PIO_POLLING; | ||
156 | |||
157 | base = (void __iomem *)ATA_HD_BASE; | ||
158 | ap->ioaddr.data_addr = base; | ||
159 | ap->ioaddr.error_addr = base + 1 + 1 * 4; | ||
160 | ap->ioaddr.feature_addr = base + 1 + 1 * 4; | ||
161 | ap->ioaddr.nsect_addr = base + 1 + 2 * 4; | ||
162 | ap->ioaddr.lbal_addr = base + 1 + 3 * 4; | ||
163 | ap->ioaddr.lbam_addr = base + 1 + 4 * 4; | ||
164 | ap->ioaddr.lbah_addr = base + 1 + 5 * 4; | ||
165 | ap->ioaddr.device_addr = base + 1 + 6 * 4; | ||
166 | ap->ioaddr.status_addr = base + 1 + 7 * 4; | ||
167 | ap->ioaddr.command_addr = base + 1 + 7 * 4; | ||
168 | |||
169 | ap->ioaddr.altstatus_addr = base + ATA_HD_CONTROL; | ||
170 | ap->ioaddr.ctl_addr = base + ATA_HD_CONTROL; | ||
171 | |||
172 | ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", (unsigned long)base, | ||
173 | (unsigned long)base + ATA_HD_CONTROL); | ||
174 | |||
175 | /* activate */ | ||
176 | return ata_host_activate(host, 0, NULL, 0, &pata_falcon_sht); | ||
177 | } | ||
178 | |||
179 | module_init(pata_falcon_init_one); | ||
180 | |||
181 | MODULE_AUTHOR("Bartlomiej Zolnierkiewicz"); | ||
182 | MODULE_DESCRIPTION("low-level driver for Atari Falcon PATA"); | ||
183 | MODULE_LICENSE("GPL"); | ||
184 | MODULE_VERSION(DRV_VERSION); | ||
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c index abda44183512..0b0d93065f5a 100644 --- a/drivers/ata/pata_ixp4xx_cf.c +++ b/drivers/ata/pata_ixp4xx_cf.c | |||
@@ -40,13 +40,13 @@ static int ixp4xx_set_mode(struct ata_link *link, struct ata_device **error) | |||
40 | return 0; | 40 | return 0; |
41 | } | 41 | } |
42 | 42 | ||
43 | static unsigned int ixp4xx_mmio_data_xfer(struct ata_device *dev, | 43 | static unsigned int ixp4xx_mmio_data_xfer(struct ata_queued_cmd *qc, |
44 | unsigned char *buf, unsigned int buflen, int rw) | 44 | unsigned char *buf, unsigned int buflen, int rw) |
45 | { | 45 | { |
46 | unsigned int i; | 46 | unsigned int i; |
47 | unsigned int words = buflen >> 1; | 47 | unsigned int words = buflen >> 1; |
48 | u16 *buf16 = (u16 *) buf; | 48 | u16 *buf16 = (u16 *) buf; |
49 | struct ata_port *ap = dev->link->ap; | 49 | struct ata_port *ap = qc->dev->link->ap; |
50 | void __iomem *mmio = ap->ioaddr.data_addr; | 50 | void __iomem *mmio = ap->ioaddr.data_addr; |
51 | struct ixp4xx_pata_data *data = dev_get_platdata(ap->host->dev); | 51 | struct ixp4xx_pata_data *data = dev_get_platdata(ap->host->dev); |
52 | 52 | ||
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c index bce2a8ca4678..53828b6c3044 100644 --- a/drivers/ata/pata_legacy.c +++ b/drivers/ata/pata_legacy.c | |||
@@ -303,11 +303,12 @@ static void pdc20230_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
303 | 303 | ||
304 | } | 304 | } |
305 | 305 | ||
306 | static unsigned int pdc_data_xfer_vlb(struct ata_device *dev, | 306 | static unsigned int pdc_data_xfer_vlb(struct ata_queued_cmd *qc, |
307 | unsigned char *buf, unsigned int buflen, int rw) | 307 | unsigned char *buf, unsigned int buflen, int rw) |
308 | { | 308 | { |
309 | int slop = buflen & 3; | 309 | struct ata_device *dev = qc->dev; |
310 | struct ata_port *ap = dev->link->ap; | 310 | struct ata_port *ap = dev->link->ap; |
311 | int slop = buflen & 3; | ||
311 | 312 | ||
312 | /* 32bit I/O capable *and* we need to write a whole number of dwords */ | 313 | /* 32bit I/O capable *and* we need to write a whole number of dwords */ |
313 | if (ata_id_has_dword_io(dev->id) && (slop == 0 || slop == 3) | 314 | if (ata_id_has_dword_io(dev->id) && (slop == 0 || slop == 3) |
@@ -340,7 +341,7 @@ static unsigned int pdc_data_xfer_vlb(struct ata_device *dev, | |||
340 | } | 341 | } |
341 | local_irq_restore(flags); | 342 | local_irq_restore(flags); |
342 | } else | 343 | } else |
343 | buflen = ata_sff_data_xfer_noirq(dev, buf, buflen, rw); | 344 | buflen = ata_sff_data_xfer_noirq(qc, buf, buflen, rw); |
344 | 345 | ||
345 | return buflen; | 346 | return buflen; |
346 | } | 347 | } |
@@ -702,9 +703,11 @@ static unsigned int qdi_qc_issue(struct ata_queued_cmd *qc) | |||
702 | return ata_sff_qc_issue(qc); | 703 | return ata_sff_qc_issue(qc); |
703 | } | 704 | } |
704 | 705 | ||
705 | static unsigned int vlb32_data_xfer(struct ata_device *adev, unsigned char *buf, | 706 | static unsigned int vlb32_data_xfer(struct ata_queued_cmd *qc, |
706 | unsigned int buflen, int rw) | 707 | unsigned char *buf, |
708 | unsigned int buflen, int rw) | ||
707 | { | 709 | { |
710 | struct ata_device *adev = qc->dev; | ||
708 | struct ata_port *ap = adev->link->ap; | 711 | struct ata_port *ap = adev->link->ap; |
709 | int slop = buflen & 3; | 712 | int slop = buflen & 3; |
710 | 713 | ||
@@ -727,7 +730,7 @@ static unsigned int vlb32_data_xfer(struct ata_device *adev, unsigned char *buf, | |||
727 | } | 730 | } |
728 | return (buflen + 3) & ~3; | 731 | return (buflen + 3) & ~3; |
729 | } else | 732 | } else |
730 | return ata_sff_data_xfer(adev, buf, buflen, rw); | 733 | return ata_sff_data_xfer(qc, buf, buflen, rw); |
731 | } | 734 | } |
732 | 735 | ||
733 | static int qdi_port(struct platform_device *dev, | 736 | static int qdi_port(struct platform_device *dev, |
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c index 475a00669427..f524a9099d01 100644 --- a/drivers/ata/pata_octeon_cf.c +++ b/drivers/ata/pata_octeon_cf.c | |||
@@ -138,9 +138,7 @@ static void octeon_cf_set_piomode(struct ata_port *ap, struct ata_device *dev) | |||
138 | int trh; | 138 | int trh; |
139 | int pause; | 139 | int pause; |
140 | /* These names are timing parameters from the ATA spec */ | 140 | /* These names are timing parameters from the ATA spec */ |
141 | int t1; | ||
142 | int t2; | 141 | int t2; |
143 | int t2i; | ||
144 | 142 | ||
145 | /* | 143 | /* |
146 | * A divisor value of four will overflow the timing fields at | 144 | * A divisor value of four will overflow the timing fields at |
@@ -154,15 +152,9 @@ static void octeon_cf_set_piomode(struct ata_port *ap, struct ata_device *dev) | |||
154 | 152 | ||
155 | BUG_ON(ata_timing_compute(dev, dev->pio_mode, &timing, T, T)); | 153 | BUG_ON(ata_timing_compute(dev, dev->pio_mode, &timing, T, T)); |
156 | 154 | ||
157 | t1 = timing.setup; | ||
158 | if (t1) | ||
159 | t1--; | ||
160 | t2 = timing.active; | 155 | t2 = timing.active; |
161 | if (t2) | 156 | if (t2) |
162 | t2--; | 157 | t2--; |
163 | t2i = timing.act8b; | ||
164 | if (t2i) | ||
165 | t2i--; | ||
166 | 158 | ||
167 | trh = ns_to_tim_reg(div, 20); | 159 | trh = ns_to_tim_reg(div, 20); |
168 | if (trh) | 160 | if (trh) |
@@ -293,17 +285,17 @@ static void octeon_cf_set_dmamode(struct ata_port *ap, struct ata_device *dev) | |||
293 | /** | 285 | /** |
294 | * Handle an 8 bit I/O request. | 286 | * Handle an 8 bit I/O request. |
295 | * | 287 | * |
296 | * @dev: Device to access | 288 | * @qc: Queued command |
297 | * @buffer: Data buffer | 289 | * @buffer: Data buffer |
298 | * @buflen: Length of the buffer. | 290 | * @buflen: Length of the buffer. |
299 | * @rw: True to write. | 291 | * @rw: True to write. |
300 | */ | 292 | */ |
301 | static unsigned int octeon_cf_data_xfer8(struct ata_device *dev, | 293 | static unsigned int octeon_cf_data_xfer8(struct ata_queued_cmd *qc, |
302 | unsigned char *buffer, | 294 | unsigned char *buffer, |
303 | unsigned int buflen, | 295 | unsigned int buflen, |
304 | int rw) | 296 | int rw) |
305 | { | 297 | { |
306 | struct ata_port *ap = dev->link->ap; | 298 | struct ata_port *ap = qc->dev->link->ap; |
307 | void __iomem *data_addr = ap->ioaddr.data_addr; | 299 | void __iomem *data_addr = ap->ioaddr.data_addr; |
308 | unsigned long words; | 300 | unsigned long words; |
309 | int count; | 301 | int count; |
@@ -332,17 +324,17 @@ static unsigned int octeon_cf_data_xfer8(struct ata_device *dev, | |||
332 | /** | 324 | /** |
333 | * Handle a 16 bit I/O request. | 325 | * Handle a 16 bit I/O request. |
334 | * | 326 | * |
335 | * @dev: Device to access | 327 | * @qc: Queued command |
336 | * @buffer: Data buffer | 328 | * @buffer: Data buffer |
337 | * @buflen: Length of the buffer. | 329 | * @buflen: Length of the buffer. |
338 | * @rw: True to write. | 330 | * @rw: True to write. |
339 | */ | 331 | */ |
340 | static unsigned int octeon_cf_data_xfer16(struct ata_device *dev, | 332 | static unsigned int octeon_cf_data_xfer16(struct ata_queued_cmd *qc, |
341 | unsigned char *buffer, | 333 | unsigned char *buffer, |
342 | unsigned int buflen, | 334 | unsigned int buflen, |
343 | int rw) | 335 | int rw) |
344 | { | 336 | { |
345 | struct ata_port *ap = dev->link->ap; | 337 | struct ata_port *ap = qc->dev->link->ap; |
346 | void __iomem *data_addr = ap->ioaddr.data_addr; | 338 | void __iomem *data_addr = ap->ioaddr.data_addr; |
347 | unsigned long words; | 339 | unsigned long words; |
348 | int count; | 340 | int count; |
diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c index b6b7af894d9d..201a32d0627f 100644 --- a/drivers/ata/pata_of_platform.c +++ b/drivers/ata/pata_of_platform.c | |||
@@ -32,7 +32,6 @@ static int pata_of_platform_probe(struct platform_device *ofdev) | |||
32 | unsigned int reg_shift = 0; | 32 | unsigned int reg_shift = 0; |
33 | int pio_mode = 0; | 33 | int pio_mode = 0; |
34 | int pio_mask; | 34 | int pio_mask; |
35 | const u32 *prop; | ||
36 | 35 | ||
37 | ret = of_address_to_resource(dn, 0, &io_res); | 36 | ret = of_address_to_resource(dn, 0, &io_res); |
38 | if (ret) { | 37 | if (ret) { |
@@ -50,13 +49,9 @@ static int pata_of_platform_probe(struct platform_device *ofdev) | |||
50 | 49 | ||
51 | irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0); | 50 | irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0); |
52 | 51 | ||
53 | prop = of_get_property(dn, "reg-shift", NULL); | 52 | of_property_read_u32(dn, "reg-shift", ®_shift); |
54 | if (prop) | ||
55 | reg_shift = be32_to_cpup(prop); | ||
56 | 53 | ||
57 | prop = of_get_property(dn, "pio-mode", NULL); | 54 | if (!of_property_read_u32(dn, "pio-mode", &pio_mode)) { |
58 | if (prop) { | ||
59 | pio_mode = be32_to_cpup(prop); | ||
60 | if (pio_mode > 6) { | 55 | if (pio_mode > 6) { |
61 | dev_err(&ofdev->dev, "invalid pio-mode\n"); | 56 | dev_err(&ofdev->dev, "invalid pio-mode\n"); |
62 | return -EINVAL; | 57 | return -EINVAL; |
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index bcc4b968c049..a541eacc5e95 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c | |||
@@ -90,7 +90,7 @@ static int pcmcia_set_mode_8bit(struct ata_link *link, | |||
90 | 90 | ||
91 | /** | 91 | /** |
92 | * ata_data_xfer_8bit - Transfer data by 8bit PIO | 92 | * ata_data_xfer_8bit - Transfer data by 8bit PIO |
93 | * @dev: device to target | 93 | * @qc: queued command |
94 | * @buf: data buffer | 94 | * @buf: data buffer |
95 | * @buflen: buffer length | 95 | * @buflen: buffer length |
96 | * @rw: read/write | 96 | * @rw: read/write |
@@ -101,10 +101,10 @@ static int pcmcia_set_mode_8bit(struct ata_link *link, | |||
101 | * Inherited from caller. | 101 | * Inherited from caller. |
102 | */ | 102 | */ |
103 | 103 | ||
104 | static unsigned int ata_data_xfer_8bit(struct ata_device *dev, | 104 | static unsigned int ata_data_xfer_8bit(struct ata_queued_cmd *qc, |
105 | unsigned char *buf, unsigned int buflen, int rw) | 105 | unsigned char *buf, unsigned int buflen, int rw) |
106 | { | 106 | { |
107 | struct ata_port *ap = dev->link->ap; | 107 | struct ata_port *ap = qc->dev->link->ap; |
108 | 108 | ||
109 | if (rw == READ) | 109 | if (rw == READ) |
110 | ioread8_rep(ap->ioaddr.data_addr, buf, buflen); | 110 | ioread8_rep(ap->ioaddr.data_addr, buf, buflen); |
diff --git a/drivers/ata/pata_samsung_cf.c b/drivers/ata/pata_samsung_cf.c index f6facd686f94..431c7de30ce6 100644 --- a/drivers/ata/pata_samsung_cf.c +++ b/drivers/ata/pata_samsung_cf.c | |||
@@ -263,10 +263,10 @@ static u8 pata_s3c_check_altstatus(struct ata_port *ap) | |||
263 | /* | 263 | /* |
264 | * pata_s3c_data_xfer - Transfer data by PIO | 264 | * pata_s3c_data_xfer - Transfer data by PIO |
265 | */ | 265 | */ |
266 | static unsigned int pata_s3c_data_xfer(struct ata_device *dev, | 266 | static unsigned int pata_s3c_data_xfer(struct ata_queued_cmd *qc, |
267 | unsigned char *buf, unsigned int buflen, int rw) | 267 | unsigned char *buf, unsigned int buflen, int rw) |
268 | { | 268 | { |
269 | struct ata_port *ap = dev->link->ap; | 269 | struct ata_port *ap = qc->dev->link->ap; |
270 | struct s3c_ide_info *info = ap->host->private_data; | 270 | struct s3c_ide_info *info = ap->host->private_data; |
271 | void __iomem *data_addr = ap->ioaddr.data_addr; | 271 | void __iomem *data_addr = ap->ioaddr.data_addr; |
272 | unsigned int words = buflen >> 1, i; | 272 | unsigned int words = buflen >> 1, i; |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 2f32782cea6d..00ce26d0c047 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -4067,6 +4067,7 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4067 | struct ata_host *host; | 4067 | struct ata_host *host; |
4068 | struct mv_host_priv *hpriv; | 4068 | struct mv_host_priv *hpriv; |
4069 | struct resource *res; | 4069 | struct resource *res; |
4070 | void __iomem *mmio; | ||
4070 | int n_ports = 0, irq = 0; | 4071 | int n_ports = 0, irq = 0; |
4071 | int rc; | 4072 | int rc; |
4072 | int port; | 4073 | int port; |
@@ -4085,8 +4086,9 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4085 | * Get the register base first | 4086 | * Get the register base first |
4086 | */ | 4087 | */ |
4087 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 4088 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
4088 | if (res == NULL) | 4089 | mmio = devm_ioremap_resource(&pdev->dev, res); |
4089 | return -EINVAL; | 4090 | if (IS_ERR(mmio)) |
4091 | return PTR_ERR(mmio); | ||
4090 | 4092 | ||
4091 | /* allocate host */ | 4093 | /* allocate host */ |
4092 | if (pdev->dev.of_node) { | 4094 | if (pdev->dev.of_node) { |
@@ -4130,12 +4132,7 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4130 | hpriv->board_idx = chip_soc; | 4132 | hpriv->board_idx = chip_soc; |
4131 | 4133 | ||
4132 | host->iomap = NULL; | 4134 | host->iomap = NULL; |
4133 | hpriv->base = devm_ioremap(&pdev->dev, res->start, | 4135 | hpriv->base = mmio - SATAHC0_REG_BASE; |
4134 | resource_size(res)); | ||
4135 | if (!hpriv->base) | ||
4136 | return -ENOMEM; | ||
4137 | |||
4138 | hpriv->base -= SATAHC0_REG_BASE; | ||
4139 | 4136 | ||
4140 | hpriv->clk = clk_get(&pdev->dev, NULL); | 4137 | hpriv->clk = clk_get(&pdev->dev, NULL); |
4141 | if (IS_ERR(hpriv->clk)) | 4138 | if (IS_ERR(hpriv->clk)) |
@@ -4529,7 +4526,7 @@ static void __exit mv_exit(void) | |||
4529 | 4526 | ||
4530 | MODULE_AUTHOR("Brett Russ"); | 4527 | MODULE_AUTHOR("Brett Russ"); |
4531 | MODULE_DESCRIPTION("SCSI low-level driver for Marvell SATA controllers"); | 4528 | MODULE_DESCRIPTION("SCSI low-level driver for Marvell SATA controllers"); |
4532 | MODULE_LICENSE("GPL"); | 4529 | MODULE_LICENSE("GPL v2"); |
4533 | MODULE_DEVICE_TABLE(pci, mv_pci_tbl); | 4530 | MODULE_DEVICE_TABLE(pci, mv_pci_tbl); |
4534 | MODULE_VERSION(DRV_VERSION); | 4531 | MODULE_VERSION(DRV_VERSION); |
4535 | MODULE_ALIAS("platform:" DRV_NAME); | 4532 | MODULE_ALIAS("platform:" DRV_NAME); |
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c index f72d601e300a..5d38245a7a73 100644 --- a/drivers/ata/sata_rcar.c +++ b/drivers/ata/sata_rcar.c | |||
@@ -447,11 +447,11 @@ static void sata_rcar_exec_command(struct ata_port *ap, | |||
447 | ata_sff_pause(ap); | 447 | ata_sff_pause(ap); |
448 | } | 448 | } |
449 | 449 | ||
450 | static unsigned int sata_rcar_data_xfer(struct ata_device *dev, | 450 | static unsigned int sata_rcar_data_xfer(struct ata_queued_cmd *qc, |
451 | unsigned char *buf, | 451 | unsigned char *buf, |
452 | unsigned int buflen, int rw) | 452 | unsigned int buflen, int rw) |
453 | { | 453 | { |
454 | struct ata_port *ap = dev->link->ap; | 454 | struct ata_port *ap = qc->dev->link->ap; |
455 | void __iomem *data_addr = ap->ioaddr.data_addr; | 455 | void __iomem *data_addr = ap->ioaddr.data_addr; |
456 | unsigned int words = buflen >> 1; | 456 | unsigned int words = buflen >> 1; |
457 | 457 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index 46e18c0619c6..c9a69fc8821e 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -968,7 +968,7 @@ struct ata_port_operations { | |||
968 | void (*sff_tf_read)(struct ata_port *ap, struct ata_taskfile *tf); | 968 | void (*sff_tf_read)(struct ata_port *ap, struct ata_taskfile *tf); |
969 | void (*sff_exec_command)(struct ata_port *ap, | 969 | void (*sff_exec_command)(struct ata_port *ap, |
970 | const struct ata_taskfile *tf); | 970 | const struct ata_taskfile *tf); |
971 | unsigned int (*sff_data_xfer)(struct ata_device *dev, | 971 | unsigned int (*sff_data_xfer)(struct ata_queued_cmd *qc, |
972 | unsigned char *buf, unsigned int buflen, int rw); | 972 | unsigned char *buf, unsigned int buflen, int rw); |
973 | void (*sff_irq_on)(struct ata_port *); | 973 | void (*sff_irq_on)(struct ata_port *); |
974 | bool (*sff_irq_check)(struct ata_port *); | 974 | bool (*sff_irq_check)(struct ata_port *); |
@@ -1825,11 +1825,11 @@ extern void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); | |||
1825 | extern void ata_sff_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | 1825 | extern void ata_sff_tf_read(struct ata_port *ap, struct ata_taskfile *tf); |
1826 | extern void ata_sff_exec_command(struct ata_port *ap, | 1826 | extern void ata_sff_exec_command(struct ata_port *ap, |
1827 | const struct ata_taskfile *tf); | 1827 | const struct ata_taskfile *tf); |
1828 | extern unsigned int ata_sff_data_xfer(struct ata_device *dev, | 1828 | extern unsigned int ata_sff_data_xfer(struct ata_queued_cmd *qc, |
1829 | unsigned char *buf, unsigned int buflen, int rw); | 1829 | unsigned char *buf, unsigned int buflen, int rw); |
1830 | extern unsigned int ata_sff_data_xfer32(struct ata_device *dev, | 1830 | extern unsigned int ata_sff_data_xfer32(struct ata_queued_cmd *qc, |
1831 | unsigned char *buf, unsigned int buflen, int rw); | 1831 | unsigned char *buf, unsigned int buflen, int rw); |
1832 | extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, | 1832 | extern unsigned int ata_sff_data_xfer_noirq(struct ata_queued_cmd *qc, |
1833 | unsigned char *buf, unsigned int buflen, int rw); | 1833 | unsigned char *buf, unsigned int buflen, int rw); |
1834 | extern void ata_sff_irq_on(struct ata_port *ap); | 1834 | extern void ata_sff_irq_on(struct ata_port *ap); |
1835 | extern void ata_sff_irq_clear(struct ata_port *ap); | 1835 | extern void ata_sff_irq_clear(struct ata_port *ap); |