diff options
-rw-r--r-- | drivers/ata/libata-core.c | 59 | ||||
-rw-r--r-- | include/linux/libata.h | 7 |
2 files changed, 66 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 | |||
1801 | int 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 | |||
1814 | int 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 | |||
1826 | int 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 | |||
1838 | int 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); | |||
6453 | EXPORT_SYMBOL_GPL(ata_irq_ack); | 6507 | EXPORT_SYMBOL_GPL(ata_irq_ack); |
6454 | EXPORT_SYMBOL_GPL(ata_dummy_irq_ack); | 6508 | EXPORT_SYMBOL_GPL(ata_dummy_irq_ack); |
6455 | EXPORT_SYMBOL_GPL(ata_dev_try_classify); | 6509 | EXPORT_SYMBOL_GPL(ata_dev_try_classify); |
6510 | |||
6511 | EXPORT_SYMBOL_GPL(ata_cable_40wire); | ||
6512 | EXPORT_SYMBOL_GPL(ata_cable_80wire); | ||
6513 | EXPORT_SYMBOL_GPL(ata_cable_unknown); | ||
6514 | EXPORT_SYMBOL_GPL(ata_cable_sata); | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index 84787cad860d..3451ef97a931 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -616,6 +616,8 @@ struct ata_port_operations { | |||
616 | 616 | ||
617 | void (*post_set_mode) (struct ata_port *ap); | 617 | void (*post_set_mode) (struct ata_port *ap); |
618 | 618 | ||
619 | int (*cable_detect) (struct ata_port *ap); | ||
620 | |||
619 | int (*check_atapi_dma) (struct ata_queued_cmd *qc); | 621 | int (*check_atapi_dma) (struct ata_queued_cmd *qc); |
620 | 622 | ||
621 | void (*bmdma_setup) (struct ata_queued_cmd *qc); | 623 | void (*bmdma_setup) (struct ata_queued_cmd *qc); |
@@ -834,6 +836,11 @@ extern u8 ata_dummy_irq_on(struct ata_port *ap); | |||
834 | extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq); | 836 | extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq); |
835 | extern u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq); | 837 | extern u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq); |
836 | 838 | ||
839 | extern int ata_cable_40wire(struct ata_port *ap); | ||
840 | extern int ata_cable_80wire(struct ata_port *ap); | ||
841 | extern int ata_cable_sata(struct ata_port *ap); | ||
842 | extern int ata_cable_unknown(struct ata_port *ap); | ||
843 | |||
837 | /* | 844 | /* |
838 | * Timing helpers | 845 | * Timing helpers |
839 | */ | 846 | */ |