android_kernel_samsung_msm8976/drivers/ata
xiangliang yu 420df0f5c5 ahci: disabled FBS prior to issuing software reset
commit 89dafa20f3daab5b3e0c13d0068a28e8e64e2102 upstream.

Tested with Marvell 88se9125, attached with one port mulitplier(5 ports)
and one disk, we will get following boot log messages if using current
code:

  ata8: SATA link up 6.0 Gbps (SStatus 133 SControl 330)
  ata8.15: Port Multiplier 1.2, 0x1b4b:0x9715 r160, 5 ports, feat 0x1/0x1f
  ahci 0000:03:00.0: FBS is enabled
  ata8.00: hard resetting link
  ata8.00: SATA link down (SStatus 0 SControl 330)
  ata8.01: hard resetting link
  ata8.01: SATA link down (SStatus 0 SControl 330)
  ata8.02: hard resetting link
  ata8.02: SATA link down (SStatus 0 SControl 330)
  ata8.03: hard resetting link
  ata8.03: SATA link up 6.0 Gbps (SStatus 133 SControl 133)
  ata8.04: hard resetting link
  ata8.04: failed to resume link (SControl 133)
  ata8.04: failed to read SCR 0 (Emask=0x40)
  ata8.04: failed to read SCR 0 (Emask=0x40)
  ata8.04: failed to read SCR 1 (Emask=0x40)
  ata8.04: failed to read SCR 0 (Emask=0x40)
  ata8.03: native sectors (2) is smaller than sectors (976773168)
  ata8.03: ATA-8: ST3500413AS, JC4B, max UDMA/133
  ata8.03: 976773168 sectors, multi 0: LBA48 NCQ (depth 31/32)
  ata8.03: configured for UDMA/133
  ata8.04: failed to IDENTIFY (I/O error, err_mask=0x100)
  ata8.15: hard resetting link
  ata8.15: SATA link up 6.0 Gbps (SStatus 133 SControl 330)
  ata8.15: Port Multiplier vendor mismatch '0x1b4b' != '0x133'
  ata8.15: PMP revalidation failed (errno=-19)
  ata8.15: hard resetting link
  ata8.15: SATA link up 6.0 Gbps (SStatus 133 SControl 330)
  ata8.15: Port Multiplier vendor mismatch '0x1b4b' != '0x133'
  ata8.15: PMP revalidation failed (errno=-19)
  ata8.15: limiting SATA link speed to 3.0 Gbps
  ata8.15: hard resetting link
  ata8.15: SATA link up 3.0 Gbps (SStatus 123 SControl 320)
  ata8.15: Port Multiplier vendor mismatch '0x1b4b' != '0x133'
  ata8.15: PMP revalidation failed (errno=-19)
  ata8.15: failed to recover PMP after 5 tries, giving up
  ata8.15: Port Multiplier detaching
  ata8.03: disabled
  ata8.00: disabled
  ata8: EH complete

The reason is that current detection code doesn't follow AHCI spec:

First,the port multiplier detection process look like this:

	ahci_hardreset(link, class, deadline)
	if (class == ATA_DEV_PMP) {
		sata_pmp_attach(dev)	/* will enable FBS */
		sata_pmp_init_links(ap, nr_ports);
		ata_for_each_link(link, ap, EDGE) {
			sata_std_hardreset(link, class, deadline);
			if (link_is_online)	/* do soft reset */
				ahci_softreset(link, class, deadline);
		}
	}
But, according to chapter 9.3.9 in AHCI spec: Prior to issuing software
reset, software shall clear PxCMD.ST to '0' and then clear PxFBS.EN to
'0'.

The patch test ok with kernel 3.11.1.

tj: Patch white space contaminated, applied manually with trivial
    updates.

Signed-off-by: Xiangliang Yu <yuxiangl@marvell.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-04 10:56:13 -08:00
..
acard-ahci.c libata: update "Maintained by:" tags 2013-05-14 11:13:04 -07:00
ahci.c ahci: Add Device IDs for Intel Wildcat Point-LP 2013-12-04 10:56:13 -08:00
ahci.h libata: update "Maintained by:" tags 2013-05-14 11:13:04 -07:00
ahci_platform.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
ata_generic.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
ata_piix.c ata: Fix DVD not dectected at some platform with Wellsburg PCH 2013-08-04 16:50:55 +08:00
Kconfig libata: make it clear that sata_inic162x is experimental 2013-08-04 16:50:55 +08:00
libahci.c ahci: disabled FBS prior to issuing software reset 2013-12-04 10:56:13 -08:00
libata-acpi.c libata-acpi: add back ACPI based hotplug functionality 2013-06-25 00:51:33 +02:00
libata-core.c drivers/libata: Set max sector to 65535 for Slimtype DVD A DS8A9SH drive 2013-12-04 10:55:51 -08:00
libata-eh.c libata: make ata_eh_qc_retry() bump scmd->allowed on bogus failures 2013-11-13 12:05:31 +09:00
libata-pmp.c libata: apply behavioral quirks to sil3826 PMP 2013-08-29 09:47:38 -07:00
libata-scsi.c libata: update "Maintained by:" tags 2013-05-14 11:13:04 -07:00
libata-sff.c libata: update "Maintained by:" tags 2013-05-14 11:13:04 -07:00
libata-transport.c libata: Fix display of sata speed 2013-12-04 10:55:51 -08:00
libata-transport.h
libata-zpodd.c libata-zpodd: must use ata_tf_init() 2013-07-25 14:07:27 -07:00
libata.h libata-acpi: add back ACPI based hotplug functionality 2013-06-25 00:51:33 +02:00
Makefile libata: add R-Car SATA driver 2013-02-20 17:10:53 -05:00
pata_acpi.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_ali.c
pata_amd.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_arasan_cf.c ata: arasan: remove the need for platform_data 2013-04-19 22:25:51 +02:00
pata_artop.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_at32.c pata_at32: use module_platform_driver_probe() 2013-04-03 19:52:10 -04:00
pata_at91.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_atiixp.c pata_atiixp: override cable detection on MSI E350DM-E33 2012-08-17 13:26:51 -04:00
pata_atp867x.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_bf54x.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_cmd64x.c ata: Convert dev_printk(KERN_<LEVEL> to dev_<level>( 2012-11-28 12:40:15 -05:00
pata_cmd640.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_cs5520.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_cs5530.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_cs5535.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_cs5536.c pata_cs5536: add quirk for broken udma 2012-11-28 12:38:41 -05:00
pata_cypress.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_efar.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_ep93xx.c drivers/ata: don't check resource with devm_ioremap_resource 2013-05-12 15:19:46 +02:00
pata_hpt3x2n.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_hpt3x3.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_hpt37x.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_hpt366.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_icside.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_imx.c pata_imx: add devicetree support 2013-04-11 19:38:00 -04:00
pata_isapnp.c
pata_it821x.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_it8213.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_ixp4xx_cf.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_jmicron.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_legacy.c pata_legacy: bogus clock in opti82c46x_set_piomode() 2013-04-03 19:53:10 -04:00
pata_macio.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_marvell.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_mpc52xx.c Merge remote-tracking branch 'agust/next' into next 2013-02-20 11:39:05 +11:00
pata_mpiix.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_netcell.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_ninja32.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_ns87410.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_ns87415.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_octeon_cf.c pata_octeon_cf: Use resource_size function 2013-04-03 19:53:30 -04:00
pata_of_platform.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_oldpiix.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_opti.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_optidma.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_palmld.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_pcmcia.c drivers/ata: use module_pcmcia_driver() in pcmcia drivers 2013-03-15 12:26:03 -07:00
pata_pdc202xx_old.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_pdc2027x.c pata_pdc2027x: Fix compiler warning 2013-04-12 15:24:12 +02:00
pata_piccolo.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_platform.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_pxa.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_radisys.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_rb532_cf.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_rdc.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_rz1000.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_samsung_cf.c pata_samsung_cf: use module_platform_driver_probe() 2013-03-04 17:12:52 -05:00
pata_sc1200.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_scc.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_sch.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_serverworks.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_sil680.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pata_sis.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_sl82c105.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_triflex.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pata_via.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
pdc_adma.c libata: update "Maintained by:" tags 2013-05-14 11:13:04 -07:00
sata_dwc_460ex.c sata_dwc_460ex: remove file exec bit (chmod 0755 -> 0644) 2012-12-14 09:43:39 -05:00
sata_fsl.c sata_fsl: save irqs while coalescing 2013-08-29 09:47:38 -07:00
sata_highbank.c sata_highbank: increase retry count but shorten duration for Calxeda controller 2013-07-25 14:07:28 -07:00
sata_inic162x.c libata: make it clear that sata_inic162x is experimental 2013-08-04 16:50:55 +08:00
sata_mv.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
sata_nv.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
sata_promise.c libata: update "Maintained by:" tags 2013-05-14 11:13:04 -07:00
sata_promise.h
sata_qstor.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
sata_rcar.c sata_rcar: fix interrupt handling 2013-06-02 00:54:45 -07:00
sata_sil.c libata: update "Maintained by:" tags 2013-05-14 11:13:04 -07:00
sata_sil24.c sata_sil24: remove unused variable from sata_sil24.c 2012-11-28 12:39:20 -05:00
sata_sis.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
sata_svw.c sata_svw: switch to ->show_info() 2013-04-09 14:13:28 -04:00
sata_sx4.c libata: update "Maintained by:" tags 2013-05-14 11:13:04 -07:00
sata_uli.c ata: use module_pci_driver 2012-07-25 15:12:11 -04:00
sata_via.c libata: update "Maintained by:" tags 2013-05-14 11:13:04 -07:00
sata_vsc.c Drivers: ata: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
sis.h