aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_hpt3x2n.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-03-09 07:24:15 -0500
committerJeff Garzik <jeff@garzik.org>2007-04-28 14:15:56 -0400
commita0fcdc0259e98d1c16d96baea9ba8a8603e41791 (patch)
tree568c6a99b5e38486c84b5145ac2e3719b8c62720 /drivers/ata/pata_hpt3x2n.c
parent6a3d586d8e8a50e4cfd7f8c36d82a53c5614e05b (diff)
[libata] Update several PATA drivers for new ->cable_detect hook
All patches authored and signed-off-by Alan Cox, sent on Mar 7, 2007. I merely combined them all into a single patch. Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_hpt3x2n.c')
-rw-r--r--drivers/ata/pata_hpt3x2n.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
index 65f2e180e7fa..78323923143a 100644
--- a/drivers/ata/pata_hpt3x2n.c
+++ b/drivers/ata/pata_hpt3x2n.c
@@ -25,7 +25,7 @@
25#include <linux/libata.h> 25#include <linux/libata.h>
26 26
27#define DRV_NAME "pata_hpt3x2n" 27#define DRV_NAME "pata_hpt3x2n"
28#define DRV_VERSION "0.3.2" 28#define DRV_VERSION "0.3.3"
29 29
30enum { 30enum {
31 HPT_PCI_FAST = (1 << 31), 31 HPT_PCI_FAST = (1 << 31),
@@ -115,14 +115,13 @@ static u32 hpt3x2n_find_mode(struct ata_port *ap, int speed)
115} 115}
116 116
117/** 117/**
118 * hpt3x2n_pre_reset - reset the hpt3x2n bus 118 * hpt3x2n_cable_detect - Detect the cable type
119 * @ap: ATA port to reset 119 * @ap: ATA port to detect on
120 * 120 *
121 * Perform the initial reset handling for the 3x2n series controllers. 121 * Return the cable type attached to this port
122 * Reset the hardware and state machine, obtain the cable type.
123 */ 122 */
124 123
125static int hpt3xn_pre_reset(struct ata_port *ap) 124static int hpt3x2n_cable_detect(struct ata_port *ap)
126{ 125{
127 u8 scr2, ata66; 126 u8 scr2, ata66;
128 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 127 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
@@ -135,15 +134,26 @@ static int hpt3xn_pre_reset(struct ata_port *ap)
135 pci_write_config_byte(pdev, 0x5B, scr2); 134 pci_write_config_byte(pdev, 0x5B, scr2);
136 135
137 if (ata66 & (1 << ap->port_no)) 136 if (ata66 & (1 << ap->port_no))
138 ap->cbl = ATA_CBL_PATA40; 137 return ATA_CBL_PATA40;
139 else 138 else
140 ap->cbl = ATA_CBL_PATA80; 139 return ATA_CBL_PATA80;
140}
141
142/**
143 * hpt3x2n_pre_reset - reset the hpt3x2n bus
144 * @ap: ATA port to reset
145 *
146 * Perform the initial reset handling for the 3x2n series controllers.
147 * Reset the hardware and state machine,
148 */
141 149
150static int hpt3xn_pre_reset(struct ata_port *ap)
151{
152 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
142 /* Reset the state machine */ 153 /* Reset the state machine */
143 pci_write_config_byte(pdev, 0x50, 0x37); 154 pci_write_config_byte(pdev, 0x50, 0x37);
144 pci_write_config_byte(pdev, 0x54, 0x37); 155 pci_write_config_byte(pdev, 0x54, 0x37);
145 udelay(100); 156 udelay(100);
146
147 return ata_std_prereset(ap); 157 return ata_std_prereset(ap);
148} 158}
149 159
@@ -364,6 +374,7 @@ static struct ata_port_operations hpt3x2n_port_ops = {
364 .thaw = ata_bmdma_thaw, 374 .thaw = ata_bmdma_thaw,
365 .error_handler = hpt3x2n_error_handler, 375 .error_handler = hpt3x2n_error_handler,
366 .post_internal_cmd = ata_bmdma_post_internal_cmd, 376 .post_internal_cmd = ata_bmdma_post_internal_cmd,
377 .cable_detect = hpt3x2n_cable_detect,
367 378
368 .bmdma_setup = ata_bmdma_setup, 379 .bmdma_setup = ata_bmdma_setup,
369 .bmdma_start = ata_bmdma_start, 380 .bmdma_start = ata_bmdma_start,