odroid-linux/drivers/ata
Vincent Pelletier cd6b18b060 libata: make ata_exec_internal_sg honor DMADIR
commit e771451c0a upstream.

libata honors DMADIR for regular commands, but not for internal commands
used (among other) during device initialisation.

This makes SATA-host-to-PATA-device bridges based on Silicon Image SiL3611
(such as "Abit Serillel 2") end up disabled when used with an ATAPI device
after a few tries.

Log output of the bridge being hot-plugged with an ATAPI drive:

  [ 9631.212901] ata1: exception Emask 0x10 SAct 0x0 SErr 0x40c0000 action 0xe frozen
  [ 9631.212913] ata1: irq_stat 0x00000040, connection status changed
  [ 9631.212923] ata1: SError: { CommWake 10B8B DevExch }
  [ 9631.212939] ata1: hard resetting link
  [ 9632.104962] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
  [ 9632.106393] ata1.00: ATAPI: PIONEER DVD-RW  DVR-115, 1.06, max UDMA/33
  [ 9632.106407] ata1.00: applying bridge limits
  [ 9632.108151] ata1.00: configured for UDMA/33
  [ 9637.105303] ata1.00: qc timeout (cmd 0xa0)
  [ 9637.105324] ata1.00: failed to clear UNIT ATTENTION (err_mask=0x5)
  [ 9637.105335] ata1: hard resetting link
  [ 9638.044599] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
  [ 9638.047878] ata1.00: configured for UDMA/33
  [ 9643.044933] ata1.00: qc timeout (cmd 0xa0)
  [ 9643.044953] ata1.00: failed to clear UNIT ATTENTION (err_mask=0x5)
  [ 9643.044963] ata1: limiting SATA link speed to 1.5 Gbps
  [ 9643.044971] ata1.00: limiting speed to UDMA/33:PIO3
  [ 9643.044979] ata1: hard resetting link
  [ 9643.984225] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
  [ 9643.987471] ata1.00: configured for UDMA/33
  [ 9648.984591] ata1.00: qc timeout (cmd 0xa0)
  [ 9648.984612] ata1.00: failed to clear UNIT ATTENTION (err_mask=0x5)
  [ 9648.984619] ata1.00: disabled
  [ 9649.000593] ata1: hard resetting link
  [ 9649.939902] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
  [ 9649.955864] ata1: EH complete

With this patch, the drive enumerates correctly when libata is loaded with
atapi_dmadir=1:

  [ 9891.810863] ata1: exception Emask 0x10 SAct 0x0 SErr 0x40c0000 action 0xe frozen
  [ 9891.810874] ata1: irq_stat 0x00000040, connection status changed
  [ 9891.810884] ata1: SError: { CommWake 10B8B DevExch }
  [ 9891.810900] ata1: hard resetting link
  [ 9892.762105] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
  [ 9892.763544] ata1.00: ATAPI: PIONEER DVD-RW  DVR-115, 1.06, max UDMA/33, DMADIR
  [ 9892.763558] ata1.00: applying bridge limits
  [ 9892.765393] ata1.00: configured for UDMA/33
  [ 9892.786063] ata1: EH complete
  [ 9892.792062] scsi 0:0:0:0: CD-ROM            PIONEER  DVD-RW  DVR-115  1.06 PQ: 0 ANSI: 5
  [ 9892.798455] sr2: scsi3-mmc drive: 12x/12x writer dvd-ram cd/rw xa/form2 cdda tray
  [ 9892.798837] sr 0:0:0:0: Attached scsi CD-ROM sr2
  [ 9892.799109] sr 0:0:0:0: Attached scsi generic sg6 type 5

Based on a patch by Csaba Halász <csaba.halasz@gmail.com> on linux-ide:
http://marc.info/?l=linux-ide&m=136121147832295&w=2

tj: minor formatting changes.

Signed-off-by: Vincent Pelletier <plr.vincent@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-07 12:46:48 -07:00
..
acard-ahci.c drivers/ata/acard-ahci.c: fix enum warning 2011-05-19 20:45:15 -04:00
ahci.c ahci: Add identifiers for ASM106x devices 2013-01-27 20:46:29 -08:00
ahci.h ahci: EM supported message type sysfs attribute 2011-04-24 11:31:31 -04:00
ahci_platform.c libata: reimplement link power management 2010-10-21 20:21:04 -04:00
ata_generic.c [libata] trivial: trim trailing whitespace for drivers/ata/*.[ch] 2011-03-02 02:36:45 -05:00
ata_piix.c ata_piix: make DVD Drive recognisable on systems with Intel Sandybridge chipsets(v2) 2011-11-11 09:35:50 -08:00
Kconfig pata_arasan_cf: Adding support for arasan compact flash host controller 2011-03-14 02:52:46 -04:00
libahci.c ahci: change 'masking port_map' printk to KERN_WARNING level 2011-06-29 10:10:07 -07:00
libata-acpi.c libata: remove ATA_FLAG_MMIO 2011-03-02 02:36:46 -05:00
libata-core.c libata: make ata_exec_internal_sg honor DMADIR 2013-06-07 12:46:48 -07:00
libata-eh.c libata: set dma_mode to 0xff in reset 2013-01-17 08:43:54 -08:00
libata-pmp.c libata-pmp: add support for Thermaltake BlackX Duet esata drive dock 2011-05-19 20:48:59 -04:00
libata-scsi.c libata: fix Null pointer dereference on disk error 2013-01-17 08:43:54 -08:00
libata-sff.c libata-sff: prevent irq descriptions for dummy ports 2011-05-14 14:59:54 -04:00
libata-transport.c drivers/ata/libata-transport.c: include linux/slab.h 2010-10-21 20:21:04 -04:00
libata-transport.h [libata] Add ATA transport class 2010-10-21 20:21:03 -04:00
libata.h libata: plumb sas port scan into standard libata paths 2011-03-02 02:36:45 -05:00
Makefile pata_arasan_cf: Adding support for arasan compact flash host controller 2011-03-14 02:52:46 -04:00
pata_acpi.c libata: remove ATA_FLAG_{SRST|SATA_RESET} 2011-03-02 02:36:46 -05:00
pata_ali.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_amd.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_arasan_cf.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_artop.c pata_artop: Fix device ID parity check 2010-09-09 14:19:18 -04:00
pata_at32.c libata: remove ATA_FLAG_MMIO 2011-03-02 02:36:46 -05:00
pata_at91.c pata_at91: SMC settings calculation bugfixes, support for t6z and IORDY 2011-05-14 15:00:13 -04:00
pata_atiixp.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_atp867x.c libata-sff: separate out BMDMA irq handler 2010-05-25 19:40:24 -04:00
pata_bf54x.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_cmd64x.c pata_cm64x: fix boot crash on parisc 2011-05-14 14:59:15 -04:00
pata_cmd640.c pata_cmd640: implement sff_irq_check() method 2010-10-21 20:21:05 -04:00
pata_cs5520.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_cs5530.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_cs5535.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_cs5536.c pata_cs5536: avoid implicit MSR API inclusion on x86-64 2010-12-26 19:42:15 -05:00
pata_cypress.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_efar.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_hpt3x2n.c ata: pata: Convert pr_*(DRV_NAME ...) to pr_fmt/pr_<level> 2011-03-14 02:56:31 -04:00
pata_hpt3x3.c [libata] trivial: trim trailing whitespace for drivers/ata/*.[ch] 2011-03-02 02:36:45 -05:00
pata_hpt37x.c ata: pata: Convert pr_*(DRV_NAME ...) to pr_fmt/pr_<level> 2011-03-14 02:56:31 -04:00
pata_hpt366.c ata: pata: Convert pr_*(DRV_NAME ...) to pr_fmt/pr_<level> 2011-03-14 02:56:31 -04:00
pata_icside.c libata-sff: separate out BMDMA irq handler 2010-05-25 19:40:24 -04:00
pata_isapnp.c [libata] Improve timeout handling 2009-03-24 22:52:39 -04:00
pata_it821x.c [libata] trivial: trim trailing whitespace for drivers/ata/*.[ch] 2011-03-02 02:36:45 -05:00
pata_it8213.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_ixp4xx_cf.c drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
pata_jmicron.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_legacy.c pata_legacy: correctly mask recovery field for HT6560B 2012-04-02 09:27:13 -07:00
pata_macio.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
pata_marvell.c pata_marvell: Add support for 88SE91A0, 88SE91A4 2011-06-24 02:07:35 -04:00
pata_mpc52xx.c dt: Eliminate of_platform_{,un}register_driver 2011-02-28 13:22:46 -07:00
pata_mpiix.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_netcell.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_ninja32.c [libata] trivial: trim trailing whitespace for drivers/ata/*.[ch] 2011-03-02 02:36:45 -05:00
pata_ns87410.c libata: Pass host flags into the pci helper 2010-03-01 14:58:46 -05:00
pata_ns87415.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_octeon_cf.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
pata_of_platform.c dt: Eliminate of_platform_{,un}register_driver 2011-02-28 13:22:46 -07:00
pata_oldpiix.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_opti.c libata: Pass host flags into the pci helper 2010-03-01 14:58:46 -05:00
pata_optidma.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_palmld.c Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa-linux-2.6 into devel-stable 2011-03-26 10:03:03 +00:00
pata_pcmcia.c pcmcia: Convert pcmcia_device_id declarations to const 2011-05-06 07:46:22 +02:00
pata_pdc202xx_old.c pata_pdc202xx_old: implement sff_irq_check() method 2010-10-21 20:21:06 -04:00
pata_pdc2027x.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
pata_piccolo.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_platform.c libata-sff: clean up BMDMA initialization 2010-05-19 13:32:19 -04:00
pata_pxa.c libata: remove ATA_FLAG_MMIO 2011-03-02 02:36:46 -05:00
pata_qdi.c [libata] convert drivers to use ata.h mode mask defines 2009-03-24 22:13:27 -04:00
pata_radisys.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_rb532_cf.c drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
pata_rdc.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_rz1000.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_samsung_cf.c libata: remove ATA_FLAG_MMIO 2011-03-02 02:36:46 -05:00
pata_sc1200.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_scc.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
pata_sch.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_serverworks.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_sil680.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_sis.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_sl82c105.c pata_sl82c105: implement sff_irq_check() method 2010-10-21 20:21:06 -04:00
pata_triflex.c ATA: Don't powerdown Compaq Triflex IDE device on suspend 2011-05-19 20:46:40 -04:00
pata_via.c pata_via: disable ATAPI DMA on AVERATEC 3200 2011-10-03 11:39:57 -07:00
pdc_adma.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_dwc_460ex.c drivers/ata/sata_dwc_460ex: Fix typo 'corrresponding' 2011-06-23 16:40:28 -04:00
sata_fsl.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sata_inic162x.c libata: add @ap to ata_wait_register() and introduce ata_msleep() 2010-10-21 20:21:05 -04:00
sata_mv.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sata_nv.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sata_promise.c sata_promise: fix hardreset lockdep error 2013-01-17 08:43:54 -08:00
sata_promise.h libata annotations and fixes 2008-01-23 05:24:15 -05:00
sata_qstor.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_sil.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_sil24.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_sis.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_svw.c sata_svw: check DMA start bit before reset 2012-12-03 12:59:15 -08:00
sata_sx4.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_uli.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_via.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sata_vsc.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sis.h libata: PATA-mode fixes for sis_sata 2007-07-02 10:17:42 -04:00