aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2007-03-06 05:37:56 -0500
committerJeff Garzik <jeff@garzik.org>2007-04-28 14:15:55 -0400
commitbe0d18dff5fae83845801929f297977c10ab99ad (patch)
tree6551bf28f7123e19cee86717db689e6d8d530973 /drivers
parent5aea408df5ae459cb29b91d45fa0f8bc1bee924e (diff)
libata: cable detection fixes
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 rest of the needed changes. We add a ->cable_detect() method called after the identify sequence which allows a host to do host side detection at this point should it wish, or to modify the results of the drive side identify. This separate ->cable_detect method also cleans up a lot of code because many drivers have their own error_handler methods which really just set the cable type. If there is no ->cable_detect method the cable type is left alone so a driver setting it earlier (eg because it has the SATA flags set or because it uses the old error_handler approach) will still do the right thing (or at least the same thing) as before. This patch simply adds the cable_detect method and helpers it doesn't use them but other follow up patches will (ie Adrian please don't submit patches to unexport them ;)) Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/libata-core.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 93e7b99d7819..1e1140c9618b 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1791,6 +1791,56 @@ err_out_nosup:
1791} 1791}
1792 1792
1793/** 1793/**
1794 * ata_cable_40wire - return 40pin cable type
1795 * @ap: port
1796 *
1797 * Helper method for drivers which want to hardwire 40 pin cable
1798 * detection.
1799 */
1800
1801int ata_cable_40wire(struct ata_port *ap)
1802{
1803 return ATA_CBL_PATA40;
1804}
1805
1806/**
1807 * ata_cable_80wire - return 40pin cable type
1808 * @ap: port
1809 *
1810 * Helper method for drivers which want to hardwire 80 pin cable
1811 * detection.
1812 */
1813
1814int ata_cable_80wire(struct ata_port *ap)
1815{
1816 return ATA_CBL_PATA80;
1817}
1818
1819/**
1820 * ata_cable_unknown - return unknown PATA cable.
1821 * @ap: port
1822 *
1823 * Helper method for drivers which have no PATA cable detection.
1824 */
1825
1826int ata_cable_unknown(struct ata_port *ap)
1827{
1828 return ATA_CBL_PATA_UNK;
1829}
1830
1831/**
1832 * ata_cable_sata - return SATA cable type
1833 * @ap: port
1834 *
1835 * Helper method for drivers which have SATA cables
1836 */
1837
1838int ata_cable_sata(struct ata_port *ap)
1839{
1840 return ATA_CBL_SATA;
1841}
1842
1843/**
1794 * ata_bus_probe - Reset and probe ATA bus 1844 * ata_bus_probe - Reset and probe ATA bus
1795 * @ap: Bus to probe 1845 * @ap: Bus to probe
1796 * 1846 *
@@ -1860,6 +1910,10 @@ int ata_bus_probe(struct ata_port *ap)
1860 goto fail; 1910 goto fail;
1861 } 1911 }
1862 1912
1913 /* Now ask for the cable type as PDIAG- should have been released */
1914 if (ap->ops->cable_detect)
1915 ap->cbl = ap->ops->cable_detect(ap);
1916
1863 /* After the identify sequence we can now set up the devices. We do 1917 /* After the identify sequence we can now set up the devices. We do
1864 this in the normal order so that the user doesn't get confused */ 1918 this in the normal order so that the user doesn't get confused */
1865 1919
@@ -6453,3 +6507,8 @@ EXPORT_SYMBOL_GPL(ata_dummy_irq_on);
6453EXPORT_SYMBOL_GPL(ata_irq_ack); 6507EXPORT_SYMBOL_GPL(ata_irq_ack);
6454EXPORT_SYMBOL_GPL(ata_dummy_irq_ack); 6508EXPORT_SYMBOL_GPL(ata_dummy_irq_ack);
6455EXPORT_SYMBOL_GPL(ata_dev_try_classify); 6509EXPORT_SYMBOL_GPL(ata_dev_try_classify);
6510
6511EXPORT_SYMBOL_GPL(ata_cable_40wire);
6512EXPORT_SYMBOL_GPL(ata_cable_80wire);
6513EXPORT_SYMBOL_GPL(ata_cable_unknown);
6514EXPORT_SYMBOL_GPL(ata_cable_sata);