[libata] change master/slave IDENTIFY order

2.6.21-rc has horrible problems with libata and PATA cable types (and
thus speeds). This occurs because Tejun fixed a pile of other bugs and
we now do cable detect enforcement for drive side detection properly.

Unfortunately we don't do the process around cable detection right. Tejun
identified the problem and pointed to the right Annex in the spec, this patch
implements the needed changes.

The basic requirement is that we have to identify the slave before the
master.

The patch switches the identify order so that we can do the drive side
detection correctly.

[NOTE: patch and description extracted from a larger work written
and signed-off-by Alan Cox]

Signed-off-by: Jeff Garzik <jeff@garzik.org>

+14 -2
+14 -2
drivers/ata/libata-core.c
··· 1850 for (i = 0; i < ATA_MAX_DEVICES; i++) 1851 ap->device[i].pio_mode = XFER_PIO_0; 1852 1853 - /* read IDENTIFY page and configure devices */ 1854 - for (i = 0; i < ATA_MAX_DEVICES; i++) { 1855 dev = &ap->device[i]; 1856 1857 if (tries[i]) ··· 1867 dev->id); 1868 if (rc) 1869 goto fail; 1870 1871 ap->eh_context.i.flags |= ATA_EHI_PRINTINFO; 1872 rc = ata_dev_configure(dev);
··· 1850 for (i = 0; i < ATA_MAX_DEVICES; i++) 1851 ap->device[i].pio_mode = XFER_PIO_0; 1852 1853 + /* read IDENTIFY page and configure devices. We have to do the identify 1854 + specific sequence bass-ackwards so that PDIAG- is released by 1855 + the slave device */ 1856 + 1857 + for (i = ATA_MAX_DEVICES - 1; i >= 0; i--) { 1858 dev = &ap->device[i]; 1859 1860 if (tries[i]) ··· 1864 dev->id); 1865 if (rc) 1866 goto fail; 1867 + } 1868 + 1869 + /* After the identify sequence we can now set up the devices. We do 1870 + this in the normal order so that the user doesn't get confused */ 1871 + 1872 + for(i = 0; i < ATA_MAX_DEVICES; i++) { 1873 + dev = &ap->device[i]; 1874 + if (!ata_dev_enabled(dev)) 1875 + continue; 1876 1877 ap->eh_context.i.flags |= ATA_EHI_PRINTINFO; 1878 rc = ata_dev_configure(dev);