aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/pata_hpt3x2n.c29
-rw-r--r--drivers/ata/pata_it821x.c33
-rw-r--r--drivers/ata/pata_mpc52xx.c3
-rw-r--r--drivers/ata/pata_mpiix.c4
-rw-r--r--drivers/ata/pata_ns87410.c6
-rw-r--r--drivers/ata/pata_oldpiix.c6
-rw-r--r--drivers/ata/pata_opti.c5
-rw-r--r--drivers/ata/pata_pcmcia.c3
-rw-r--r--drivers/ata/pata_pdc202xx_old.c42
-rw-r--r--drivers/ata/pata_serverworks.c20
-rw-r--r--drivers/ata/pata_sil680.c11
-rw-r--r--drivers/ata/pata_triflex.c4
-rw-r--r--drivers/ata/sata_via.c35
13 files changed, 68 insertions, 133 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,
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index be8c9ef8d0d4..f1f8cec8c224 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -80,7 +80,7 @@
80 80
81 81
82#define DRV_NAME "pata_it821x" 82#define DRV_NAME "pata_it821x"
83#define DRV_VERSION "0.3.4" 83#define DRV_VERSION "0.3.6"
84 84
85struct it821x_dev 85struct it821x_dev
86{ 86{
@@ -113,31 +113,6 @@ struct it821x_dev
113static int it8212_noraid; 113static int it8212_noraid;
114 114
115/** 115/**
116 * it821x_pre_reset - probe
117 * @ap: ATA port
118 *
119 * Set the cable type
120 */
121
122static int it821x_pre_reset(struct ata_port *ap)
123{
124 ap->cbl = ATA_CBL_PATA80;
125 return ata_std_prereset(ap);
126}
127
128/**
129 * it821x_error_handler - probe/reset
130 * @ap: ATA port
131 *
132 * Set the cable type and trigger a probe
133 */
134
135static void it821x_error_handler(struct ata_port *ap)
136{
137 return ata_bmdma_drive_eh(ap, it821x_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
138}
139
140/**
141 * it821x_program - program the PIO/MWDMA registers 116 * it821x_program - program the PIO/MWDMA registers
142 * @ap: ATA port 117 * @ap: ATA port
143 * @adev: Device to program 118 * @adev: Device to program
@@ -666,8 +641,9 @@ static struct ata_port_operations it821x_smart_port_ops = {
666 641
667 .freeze = ata_bmdma_freeze, 642 .freeze = ata_bmdma_freeze,
668 .thaw = ata_bmdma_thaw, 643 .thaw = ata_bmdma_thaw,
669 .error_handler = it821x_error_handler, 644 .error_handler = ata_bmdma_error_handler,
670 .post_internal_cmd = ata_bmdma_post_internal_cmd, 645 .post_internal_cmd = ata_bmdma_post_internal_cmd,
646 .cable_detect = ata_cable_unknown,
671 647
672 .bmdma_setup = ata_bmdma_setup, 648 .bmdma_setup = ata_bmdma_setup,
673 .bmdma_start = ata_bmdma_start, 649 .bmdma_start = ata_bmdma_start,
@@ -702,8 +678,9 @@ static struct ata_port_operations it821x_passthru_port_ops = {
702 678
703 .freeze = ata_bmdma_freeze, 679 .freeze = ata_bmdma_freeze,
704 .thaw = ata_bmdma_thaw, 680 .thaw = ata_bmdma_thaw,
705 .error_handler = it821x_error_handler, 681 .error_handler = ata_bmdma_error_handler,
706 .post_internal_cmd = ata_bmdma_post_internal_cmd, 682 .post_internal_cmd = ata_bmdma_post_internal_cmd,
683 .cable_detect = ata_cable_unknown,
707 684
708 .bmdma_setup = ata_bmdma_setup, 685 .bmdma_setup = ata_bmdma_setup,
709 .bmdma_start = it821x_passthru_bmdma_start, 686 .bmdma_start = it821x_passthru_bmdma_start,
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index 882c36eaf293..77b57321ff52 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -24,7 +24,7 @@
24 24
25 25
26#define DRV_NAME "mpc52xx_ata" 26#define DRV_NAME "mpc52xx_ata"
27#define DRV_VERSION "0.1.0" 27#define DRV_VERSION "0.1.0ac2"
28 28
29 29
30/* Private structures used by the driver */ 30/* Private structures used by the driver */
@@ -297,6 +297,7 @@ static struct ata_port_operations mpc52xx_ata_port_ops = {
297 .freeze = ata_bmdma_freeze, 297 .freeze = ata_bmdma_freeze,
298 .thaw = ata_bmdma_thaw, 298 .thaw = ata_bmdma_thaw,
299 .error_handler = mpc52xx_ata_error_handler, 299 .error_handler = mpc52xx_ata_error_handler,
300 .cable_detect = ata_cable_40wire,
300 .qc_prep = ata_qc_prep, 301 .qc_prep = ata_qc_prep,
301 .qc_issue = ata_qc_issue_prot, 302 .qc_issue = ata_qc_issue_prot,
302 .data_xfer = ata_data_xfer, 303 .data_xfer = ata_data_xfer,
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c
index 4abe45ac19a2..1718eaca731f 100644
--- a/drivers/ata/pata_mpiix.c
+++ b/drivers/ata/pata_mpiix.c
@@ -35,7 +35,7 @@
35#include <linux/libata.h> 35#include <linux/libata.h>
36 36
37#define DRV_NAME "pata_mpiix" 37#define DRV_NAME "pata_mpiix"
38#define DRV_VERSION "0.7.5" 38#define DRV_VERSION "0.7.6"
39 39
40enum { 40enum {
41 IDETIM = 0x6C, /* IDE control register */ 41 IDETIM = 0x6C, /* IDE control register */
@@ -53,7 +53,6 @@ static int mpiix_pre_reset(struct ata_port *ap)
53 53
54 if (!pci_test_config_bits(pdev, &mpiix_enable_bits)) 54 if (!pci_test_config_bits(pdev, &mpiix_enable_bits))
55 return -ENOENT; 55 return -ENOENT;
56 ap->cbl = ATA_CBL_PATA40;
57 return ata_std_prereset(ap); 56 return ata_std_prereset(ap);
58} 57}
59 58
@@ -185,6 +184,7 @@ static struct ata_port_operations mpiix_port_ops = {
185 .thaw = ata_bmdma_thaw, 184 .thaw = ata_bmdma_thaw,
186 .error_handler = mpiix_error_handler, 185 .error_handler = mpiix_error_handler,
187 .post_internal_cmd = ata_bmdma_post_internal_cmd, 186 .post_internal_cmd = ata_bmdma_post_internal_cmd,
187 .cable_detect = ata_cable_40wire,
188 188
189 .qc_prep = ata_qc_prep, 189 .qc_prep = ata_qc_prep,
190 .qc_issue = mpiix_qc_issue_prot, 190 .qc_issue = mpiix_qc_issue_prot,
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c
index 9944a28daa9c..078aeda9cf8d 100644
--- a/drivers/ata/pata_ns87410.c
+++ b/drivers/ata/pata_ns87410.c
@@ -28,13 +28,13 @@
28#include <linux/libata.h> 28#include <linux/libata.h>
29 29
30#define DRV_NAME "pata_ns87410" 30#define DRV_NAME "pata_ns87410"
31#define DRV_VERSION "0.4.3" 31#define DRV_VERSION "0.4.6"
32 32
33/** 33/**
34 * ns87410_pre_reset - probe begin 34 * ns87410_pre_reset - probe begin
35 * @ap: ATA port 35 * @ap: ATA port
36 * 36 *
37 * Set up cable type and use generic probe init 37 * Check enabled ports
38 */ 38 */
39 39
40static int ns87410_pre_reset(struct ata_port *ap) 40static int ns87410_pre_reset(struct ata_port *ap)
@@ -47,7 +47,6 @@ static int ns87410_pre_reset(struct ata_port *ap)
47 47
48 if (!pci_test_config_bits(pdev, &ns87410_enable_bits[ap->port_no])) 48 if (!pci_test_config_bits(pdev, &ns87410_enable_bits[ap->port_no]))
49 return -ENOENT; 49 return -ENOENT;
50 ap->cbl = ATA_CBL_PATA40;
51 return ata_std_prereset(ap); 50 return ata_std_prereset(ap);
52} 51}
53 52
@@ -177,6 +176,7 @@ static struct ata_port_operations ns87410_port_ops = {
177 .thaw = ata_bmdma_thaw, 176 .thaw = ata_bmdma_thaw,
178 .error_handler = ns87410_error_handler, 177 .error_handler = ns87410_error_handler,
179 .post_internal_cmd = ata_bmdma_post_internal_cmd, 178 .post_internal_cmd = ata_bmdma_post_internal_cmd,
179 .cable_detect = ata_cable_40wire,
180 180
181 .qc_prep = ata_qc_prep, 181 .qc_prep = ata_qc_prep,
182 .qc_issue = ns87410_qc_issue_prot, 182 .qc_issue = ns87410_qc_issue_prot,
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c
index da68cd19efd6..dea4690340d1 100644
--- a/drivers/ata/pata_oldpiix.c
+++ b/drivers/ata/pata_oldpiix.c
@@ -25,7 +25,7 @@
25#include <linux/ata.h> 25#include <linux/ata.h>
26 26
27#define DRV_NAME "pata_oldpiix" 27#define DRV_NAME "pata_oldpiix"
28#define DRV_VERSION "0.5.4" 28#define DRV_VERSION "0.5.5"
29 29
30/** 30/**
31 * oldpiix_pre_reset - probe begin 31 * oldpiix_pre_reset - probe begin
@@ -44,7 +44,6 @@ static int oldpiix_pre_reset(struct ata_port *ap)
44 44
45 if (!pci_test_config_bits(pdev, &oldpiix_enable_bits[ap->port_no])) 45 if (!pci_test_config_bits(pdev, &oldpiix_enable_bits[ap->port_no]))
46 return -ENOENT; 46 return -ENOENT;
47 ap->cbl = ATA_CBL_PATA40;
48 return ata_std_prereset(ap); 47 return ata_std_prereset(ap);
49} 48}
50 49
@@ -65,7 +64,7 @@ static void oldpiix_pata_error_handler(struct ata_port *ap)
65/** 64/**
66 * oldpiix_set_piomode - Initialize host controller PATA PIO timings 65 * oldpiix_set_piomode - Initialize host controller PATA PIO timings
67 * @ap: Port whose timings we are configuring 66 * @ap: Port whose timings we are configuring
68 * @adev: um 67 * @adev: Device whose timings we are configuring
69 * 68 *
70 * Set PIO mode for device, in host controller PCI config space. 69 * Set PIO mode for device, in host controller PCI config space.
71 * 70 *
@@ -255,6 +254,7 @@ static const struct ata_port_operations oldpiix_pata_ops = {
255 .thaw = ata_bmdma_thaw, 254 .thaw = ata_bmdma_thaw,
256 .error_handler = oldpiix_pata_error_handler, 255 .error_handler = oldpiix_pata_error_handler,
257 .post_internal_cmd = ata_bmdma_post_internal_cmd, 256 .post_internal_cmd = ata_bmdma_post_internal_cmd,
257 .cable_detect = ata_cable_40wire,
258 258
259 .bmdma_setup = ata_bmdma_setup, 259 .bmdma_setup = ata_bmdma_setup,
260 .bmdma_start = ata_bmdma_start, 260 .bmdma_start = ata_bmdma_start,
diff --git a/drivers/ata/pata_opti.c b/drivers/ata/pata_opti.c
index 3fd3a35c2241..13b63e21838d 100644
--- a/drivers/ata/pata_opti.c
+++ b/drivers/ata/pata_opti.c
@@ -34,7 +34,7 @@
34#include <linux/libata.h> 34#include <linux/libata.h>
35 35
36#define DRV_NAME "pata_opti" 36#define DRV_NAME "pata_opti"
37#define DRV_VERSION "0.2.8" 37#define DRV_VERSION "0.2.9"
38 38
39enum { 39enum {
40 READ_REG = 0, /* index of Read cycle timing register */ 40 READ_REG = 0, /* index of Read cycle timing register */
@@ -61,8 +61,6 @@ static int opti_pre_reset(struct ata_port *ap)
61 61
62 if (!pci_test_config_bits(pdev, &opti_enable_bits[ap->port_no])) 62 if (!pci_test_config_bits(pdev, &opti_enable_bits[ap->port_no]))
63 return -ENOENT; 63 return -ENOENT;
64
65 ap->cbl = ATA_CBL_PATA40;
66 return ata_std_prereset(ap); 64 return ata_std_prereset(ap);
67} 65}
68 66
@@ -198,6 +196,7 @@ static struct ata_port_operations opti_port_ops = {
198 .thaw = ata_bmdma_thaw, 196 .thaw = ata_bmdma_thaw,
199 .error_handler = opti_error_handler, 197 .error_handler = opti_error_handler,
200 .post_internal_cmd = ata_bmdma_post_internal_cmd, 198 .post_internal_cmd = ata_bmdma_post_internal_cmd,
199 .cable_detect = ata_cable_40wire,
201 200
202 .bmdma_setup = ata_bmdma_setup, 201 .bmdma_setup = ata_bmdma_setup,
203 .bmdma_start = ata_bmdma_start, 202 .bmdma_start = ata_bmdma_start,
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index 103720f873c8..820332a7ec7b 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -42,7 +42,7 @@
42 42
43 43
44#define DRV_NAME "pata_pcmcia" 44#define DRV_NAME "pata_pcmcia"
45#define DRV_VERSION "0.3.0" 45#define DRV_VERSION "0.3.1"
46 46
47/* 47/*
48 * Private data structure to glue stuff together 48 * Private data structure to glue stuff together
@@ -84,6 +84,7 @@ static struct ata_port_operations pcmcia_port_ops = {
84 .thaw = ata_bmdma_thaw, 84 .thaw = ata_bmdma_thaw,
85 .error_handler = ata_bmdma_error_handler, 85 .error_handler = ata_bmdma_error_handler,
86 .post_internal_cmd = ata_bmdma_post_internal_cmd, 86 .post_internal_cmd = ata_bmdma_post_internal_cmd,
87 .cable_detect = ata_cable_40wire,
87 88
88 .qc_prep = ata_qc_prep, 89 .qc_prep = ata_qc_prep,
89 .qc_issue = ata_qc_issue_prot, 90 .qc_issue = ata_qc_issue_prot,
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index a764ce8252aa..ee636beb05e1 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -22,45 +22,17 @@
22#include <linux/libata.h> 22#include <linux/libata.h>
23 23
24#define DRV_NAME "pata_pdc202xx_old" 24#define DRV_NAME "pata_pdc202xx_old"
25#define DRV_VERSION "0.4.0" 25#define DRV_VERSION "0.4.2"
26 26
27/** 27static int pdc2026x_cable_detect(struct ata_port *ap)
28 * pdc2024x_pre_reset - probe begin
29 * @ap: ATA port
30 *
31 * Set up cable type and use generic probe init
32 */
33
34static int pdc2024x_pre_reset(struct ata_port *ap)
35{
36 ap->cbl = ATA_CBL_PATA40;
37 return ata_std_prereset(ap);
38}
39
40
41static void pdc2024x_error_handler(struct ata_port *ap)
42{
43 ata_bmdma_drive_eh(ap, pdc2024x_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
44}
45
46
47static int pdc2026x_pre_reset(struct ata_port *ap)
48{ 28{
49 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 29 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
50 u16 cis; 30 u16 cis;
51 31
52 pci_read_config_word(pdev, 0x50, &cis); 32 pci_read_config_word(pdev, 0x50, &cis);
53 if (cis & (1 << (10 + ap->port_no))) 33 if (cis & (1 << (10 + ap->port_no)))
54 ap->cbl = ATA_CBL_PATA80; 34 return ATA_CBL_PATA80;
55 else 35 return ATA_CBL_PATA40;
56 ap->cbl = ATA_CBL_PATA40;
57
58 return ata_std_prereset(ap);
59}
60
61static void pdc2026x_error_handler(struct ata_port *ap)
62{
63 ata_bmdma_drive_eh(ap, pdc2026x_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
64} 36}
65 37
66/** 38/**
@@ -291,8 +263,9 @@ static struct ata_port_operations pdc2024x_port_ops = {
291 263
292 .freeze = ata_bmdma_freeze, 264 .freeze = ata_bmdma_freeze,
293 .thaw = ata_bmdma_thaw, 265 .thaw = ata_bmdma_thaw,
294 .error_handler = pdc2024x_error_handler, 266 .error_handler = ata_bmdma_error_handler,
295 .post_internal_cmd = ata_bmdma_post_internal_cmd, 267 .post_internal_cmd = ata_bmdma_post_internal_cmd,
268 .cable_detect = ata_cable_40wire,
296 269
297 .bmdma_setup = ata_bmdma_setup, 270 .bmdma_setup = ata_bmdma_setup,
298 .bmdma_start = ata_bmdma_start, 271 .bmdma_start = ata_bmdma_start,
@@ -325,8 +298,9 @@ static struct ata_port_operations pdc2026x_port_ops = {
325 298
326 .freeze = ata_bmdma_freeze, 299 .freeze = ata_bmdma_freeze,
327 .thaw = ata_bmdma_thaw, 300 .thaw = ata_bmdma_thaw,
328 .error_handler = pdc2026x_error_handler, 301 .error_handler = ata_bmdma_error_handler,
329 .post_internal_cmd = ata_bmdma_post_internal_cmd, 302 .post_internal_cmd = ata_bmdma_post_internal_cmd,
303 .cable_detect = pdc2026x_cable_detect,
330 304
331 .bmdma_setup = ata_bmdma_setup, 305 .bmdma_setup = ata_bmdma_setup,
332 .bmdma_start = pdc2026x_bmdma_start, 306 .bmdma_start = pdc2026x_bmdma_start,
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
index 598eef810a74..283e9afade01 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * ata-serverworks.c - Serverworks PATA for new ATA layer 2 * pata_serverworks.c - Serverworks PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox <alan@redhat.com>
5 * 5 *
@@ -137,14 +137,14 @@ static struct sv_cable_table cable_detect[] = {
137}; 137};
138 138
139/** 139/**
140 * serverworks_pre_reset - cable detection 140 * serverworks_cable_detect - cable detection
141 * @ap: ATA port 141 * @ap: ATA port
142 * 142 *
143 * Perform cable detection according to the device and subvendor 143 * Perform cable detection according to the device and subvendor
144 * identifications 144 * identifications
145 */ 145 */
146 146
147static int serverworks_pre_reset(struct ata_port *ap) { 147static int serverworks_cable_detect(struct ata_port *ap) {
148 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 148 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
149 struct sv_cable_table *cb = cable_detect; 149 struct sv_cable_table *cb = cable_detect;
150 150
@@ -152,8 +152,7 @@ static int serverworks_pre_reset(struct ata_port *ap) {
152 if (cb->device == pdev->device && 152 if (cb->device == pdev->device &&
153 (cb->subvendor == pdev->subsystem_vendor || 153 (cb->subvendor == pdev->subsystem_vendor ||
154 cb->subvendor == PCI_ANY_ID)) { 154 cb->subvendor == PCI_ANY_ID)) {
155 ap->cbl = cb->cable_detect(ap); 155 return cb->cable_detect(ap);
156 return ata_std_prereset(ap);
157 } 156 }
158 cb++; 157 cb++;
159 } 158 }
@@ -162,11 +161,6 @@ static int serverworks_pre_reset(struct ata_port *ap) {
162 return -1; /* kill compiler warning */ 161 return -1; /* kill compiler warning */
163} 162}
164 163
165static void serverworks_error_handler(struct ata_port *ap)
166{
167 return ata_bmdma_drive_eh(ap, serverworks_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
168}
169
170/** 164/**
171 * serverworks_is_csb - Check for CSB or OSB 165 * serverworks_is_csb - Check for CSB or OSB
172 * @pdev: PCI device to check 166 * @pdev: PCI device to check
@@ -339,8 +333,9 @@ static struct ata_port_operations serverworks_osb4_port_ops = {
339 333
340 .freeze = ata_bmdma_freeze, 334 .freeze = ata_bmdma_freeze,
341 .thaw = ata_bmdma_thaw, 335 .thaw = ata_bmdma_thaw,
342 .error_handler = serverworks_error_handler, 336 .error_handler = ata_bmdma_error_handler,
343 .post_internal_cmd = ata_bmdma_post_internal_cmd, 337 .post_internal_cmd = ata_bmdma_post_internal_cmd,
338 .cable_detect = serverworks_cable_detect,
344 339
345 .bmdma_setup = ata_bmdma_setup, 340 .bmdma_setup = ata_bmdma_setup,
346 .bmdma_start = ata_bmdma_start, 341 .bmdma_start = ata_bmdma_start,
@@ -374,8 +369,9 @@ static struct ata_port_operations serverworks_csb_port_ops = {
374 369
375 .freeze = ata_bmdma_freeze, 370 .freeze = ata_bmdma_freeze,
376 .thaw = ata_bmdma_thaw, 371 .thaw = ata_bmdma_thaw,
377 .error_handler = serverworks_error_handler, 372 .error_handler = ata_bmdma_error_handler,
378 .post_internal_cmd = ata_bmdma_post_internal_cmd, 373 .post_internal_cmd = ata_bmdma_post_internal_cmd,
374 .cable_detect = serverworks_cable_detect,
379 375
380 .bmdma_setup = ata_bmdma_setup, 376 .bmdma_setup = ata_bmdma_setup,
381 .bmdma_start = ata_bmdma_start, 377 .bmdma_start = ata_bmdma_start,
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index dab2889a556f..6770820cfca9 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -33,7 +33,7 @@
33#include <linux/libata.h> 33#include <linux/libata.h>
34 34
35#define DRV_NAME "pata_sil680" 35#define DRV_NAME "pata_sil680"
36#define DRV_VERSION "0.4.5" 36#define DRV_VERSION "0.4.6"
37 37
38/** 38/**
39 * sil680_selreg - return register base 39 * sil680_selreg - return register base
@@ -91,12 +91,6 @@ static int sil680_cable_detect(struct ata_port *ap) {
91 return ATA_CBL_PATA40; 91 return ATA_CBL_PATA40;
92} 92}
93 93
94static int sil680_pre_reset(struct ata_port *ap)
95{
96 ap->cbl = sil680_cable_detect(ap);
97 return ata_std_prereset(ap);
98}
99
100/** 94/**
101 * sil680_bus_reset - reset the SIL680 bus 95 * sil680_bus_reset - reset the SIL680 bus
102 * @ap: ATA port to reset 96 * @ap: ATA port to reset
@@ -119,7 +113,7 @@ static int sil680_bus_reset(struct ata_port *ap,unsigned int *classes)
119 113
120static void sil680_error_handler(struct ata_port *ap) 114static void sil680_error_handler(struct ata_port *ap)
121{ 115{
122 ata_bmdma_drive_eh(ap, sil680_pre_reset, sil680_bus_reset, NULL, ata_std_postreset); 116 ata_bmdma_drive_eh(ap, ata_std_prereset, sil680_bus_reset, NULL, ata_std_postreset);
123} 117}
124 118
125/** 119/**
@@ -257,6 +251,7 @@ static struct ata_port_operations sil680_port_ops = {
257 .thaw = ata_bmdma_thaw, 251 .thaw = ata_bmdma_thaw,
258 .error_handler = sil680_error_handler, 252 .error_handler = sil680_error_handler,
259 .post_internal_cmd = ata_bmdma_post_internal_cmd, 253 .post_internal_cmd = ata_bmdma_post_internal_cmd,
254 .cable_detect = sil680_cable_detect,
260 255
261 .bmdma_setup = ata_bmdma_setup, 256 .bmdma_setup = ata_bmdma_setup,
262 .bmdma_start = ata_bmdma_start, 257 .bmdma_start = ata_bmdma_start,
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c
index 71418f2a0cdb..e618ffd6e944 100644
--- a/drivers/ata/pata_triflex.c
+++ b/drivers/ata/pata_triflex.c
@@ -43,7 +43,7 @@
43#include <linux/libata.h> 43#include <linux/libata.h>
44 44
45#define DRV_NAME "pata_triflex" 45#define DRV_NAME "pata_triflex"
46#define DRV_VERSION "0.2.7" 46#define DRV_VERSION "0.2.8"
47 47
48/** 48/**
49 * triflex_prereset - probe begin 49 * triflex_prereset - probe begin
@@ -63,7 +63,6 @@ static int triflex_prereset(struct ata_port *ap)
63 63
64 if (!pci_test_config_bits(pdev, &triflex_enable_bits[ap->port_no])) 64 if (!pci_test_config_bits(pdev, &triflex_enable_bits[ap->port_no]))
65 return -ENOENT; 65 return -ENOENT;
66 ap->cbl = ATA_CBL_PATA40;
67 return ata_std_prereset(ap); 66 return ata_std_prereset(ap);
68} 67}
69 68
@@ -214,6 +213,7 @@ static struct ata_port_operations triflex_port_ops = {
214 .thaw = ata_bmdma_thaw, 213 .thaw = ata_bmdma_thaw,
215 .error_handler = triflex_error_handler, 214 .error_handler = triflex_error_handler,
216 .post_internal_cmd = ata_bmdma_post_internal_cmd, 215 .post_internal_cmd = ata_bmdma_post_internal_cmd,
216 .cable_detect = ata_cable_40wire,
217 217
218 .bmdma_setup = ata_bmdma_setup, 218 .bmdma_setup = ata_bmdma_setup,
219 .bmdma_start = triflex_bmdma_start, 219 .bmdma_start = triflex_bmdma_start,
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 598e6a26a481..842ccf601224 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -78,8 +78,7 @@ static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg);
78static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); 78static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
79static void svia_noop_freeze(struct ata_port *ap); 79static void svia_noop_freeze(struct ata_port *ap);
80static void vt6420_error_handler(struct ata_port *ap); 80static void vt6420_error_handler(struct ata_port *ap);
81static void vt6421_sata_error_handler(struct ata_port *ap); 81static int vt6421_pata_cable_detect(struct ata_port *ap);
82static void vt6421_pata_error_handler(struct ata_port *ap);
83static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev); 82static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev);
84static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev); 83static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev);
85static int vt6421_port_start(struct ata_port *ap); 84static int vt6421_port_start(struct ata_port *ap);
@@ -172,8 +171,9 @@ static const struct ata_port_operations vt6421_pata_ops = {
172 171
173 .freeze = ata_bmdma_freeze, 172 .freeze = ata_bmdma_freeze,
174 .thaw = ata_bmdma_thaw, 173 .thaw = ata_bmdma_thaw,
175 .error_handler = vt6421_pata_error_handler, 174 .error_handler = ata_bmdma_error_handler,
176 .post_internal_cmd = ata_bmdma_post_internal_cmd, 175 .post_internal_cmd = ata_bmdma_post_internal_cmd,
176 .cable_detect = vt6421_pata_cable_detect,
177 177
178 .irq_handler = ata_interrupt, 178 .irq_handler = ata_interrupt,
179 .irq_clear = ata_bmdma_irq_clear, 179 .irq_clear = ata_bmdma_irq_clear,
@@ -203,8 +203,9 @@ static const struct ata_port_operations vt6421_sata_ops = {
203 203
204 .freeze = ata_bmdma_freeze, 204 .freeze = ata_bmdma_freeze,
205 .thaw = ata_bmdma_thaw, 205 .thaw = ata_bmdma_thaw,
206 .error_handler = vt6421_sata_error_handler, 206 .error_handler = ata_bmdma_error_handler,
207 .post_internal_cmd = ata_bmdma_post_internal_cmd, 207 .post_internal_cmd = ata_bmdma_post_internal_cmd,
208 .cable_detect = ata_cable_sata,
208 209
209 .irq_handler = ata_interrupt, 210 .irq_handler = ata_interrupt,
210 .irq_clear = ata_bmdma_irq_clear, 211 .irq_clear = ata_bmdma_irq_clear,
@@ -330,35 +331,15 @@ static void vt6420_error_handler(struct ata_port *ap)
330 NULL, ata_std_postreset); 331 NULL, ata_std_postreset);
331} 332}
332 333
333static int vt6421_pata_prereset(struct ata_port *ap) 334static int vt6421_pata_cable_detect(struct ata_port *ap)
334{ 335{
335 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 336 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
336 u8 tmp; 337 u8 tmp;
337 338
338 pci_read_config_byte(pdev, PATA_UDMA_TIMING, &tmp); 339 pci_read_config_byte(pdev, PATA_UDMA_TIMING, &tmp);
339 if (tmp & 0x10) 340 if (tmp & 0x10)
340 ap->cbl = ATA_CBL_PATA40; 341 return ATA_CBL_PATA40;
341 else 342 return ATA_CBL_PATA80;
342 ap->cbl = ATA_CBL_PATA80;
343 return 0;
344}
345
346static void vt6421_pata_error_handler(struct ata_port *ap)
347{
348 return ata_bmdma_drive_eh(ap, vt6421_pata_prereset, ata_std_softreset,
349 NULL, ata_std_postreset);
350}
351
352static int vt6421_sata_prereset(struct ata_port *ap)
353{
354 ap->cbl = ATA_CBL_SATA;
355 return 0;
356}
357
358static void vt6421_sata_error_handler(struct ata_port *ap)
359{
360 return ata_bmdma_drive_eh(ap, vt6421_sata_prereset, ata_std_softreset,
361 NULL, ata_std_postreset);
362} 343}
363 344
364static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev) 345static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev)