diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2007-03-08 14:33:29 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 14:15:57 -0400 |
commit | 6bfed3fb035b4eff59160c2da5e3fbb69d6b0531 (patch) | |
tree | 3c040f5f8bb351994f2cfb54e6e278fea8f593dc /drivers/ata/pata_efar.c | |
parent | 847086069cdb5eac14f70cd0aea8545d499c80b4 (diff) |
pata_efar: support ->cable_detect
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_efar.c')
-rw-r--r-- | drivers/ata/pata_efar.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c index dac7a6554f6c..a3216850bba1 100644 --- a/drivers/ata/pata_efar.c +++ b/drivers/ata/pata_efar.c | |||
@@ -22,10 +22,10 @@ | |||
22 | #include <linux/ata.h> | 22 | #include <linux/ata.h> |
23 | 23 | ||
24 | #define DRV_NAME "pata_efar" | 24 | #define DRV_NAME "pata_efar" |
25 | #define DRV_VERSION "0.4.3" | 25 | #define DRV_VERSION "0.4.4" |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * efar_pre_reset - check for 40/80 pin | 28 | * efar_pre_reset - Enable bits |
29 | * @ap: Port | 29 | * @ap: Port |
30 | * | 30 | * |
31 | * Perform cable detection for the EFAR ATA interface. This is | 31 | * Perform cable detection for the EFAR ATA interface. This is |
@@ -38,18 +38,11 @@ static int efar_pre_reset(struct ata_port *ap) | |||
38 | { 0x41U, 1U, 0x80UL, 0x80UL }, /* port 0 */ | 38 | { 0x41U, 1U, 0x80UL, 0x80UL }, /* port 0 */ |
39 | { 0x43U, 1U, 0x80UL, 0x80UL }, /* port 1 */ | 39 | { 0x43U, 1U, 0x80UL, 0x80UL }, /* port 1 */ |
40 | }; | 40 | }; |
41 | |||
42 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 41 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
43 | u8 tmp; | ||
44 | 42 | ||
45 | if (!pci_test_config_bits(pdev, &efar_enable_bits[ap->port_no])) | 43 | if (!pci_test_config_bits(pdev, &efar_enable_bits[ap->port_no])) |
46 | return -ENOENT; | 44 | return -ENOENT; |
47 | 45 | ||
48 | pci_read_config_byte(pdev, 0x47, &tmp); | ||
49 | if (tmp & (2 >> ap->port_no)) | ||
50 | ap->cbl = ATA_CBL_PATA40; | ||
51 | else | ||
52 | ap->cbl = ATA_CBL_PATA80; | ||
53 | return ata_std_prereset(ap); | 46 | return ata_std_prereset(ap); |
54 | } | 47 | } |
55 | 48 | ||
@@ -67,6 +60,25 @@ static void efar_error_handler(struct ata_port *ap) | |||
67 | } | 60 | } |
68 | 61 | ||
69 | /** | 62 | /** |
63 | * efar_cable_detect - check for 40/80 pin | ||
64 | * @ap: Port | ||
65 | * | ||
66 | * Perform cable detection for the EFAR ATA interface. This is | ||
67 | * different to the PIIX arrangement | ||
68 | */ | ||
69 | |||
70 | static int efar_cable_detect(struct ata_port *ap) | ||
71 | { | ||
72 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
73 | u8 tmp; | ||
74 | |||
75 | pci_read_config_byte(pdev, 0x47, &tmp); | ||
76 | if (tmp & (2 >> ap->port_no)) | ||
77 | return ATA_CBL_PATA40; | ||
78 | return ATA_CBL_PATA80; | ||
79 | } | ||
80 | |||
81 | /** | ||
70 | * efar_set_piomode - Initialize host controller PATA PIO timings | 82 | * efar_set_piomode - Initialize host controller PATA PIO timings |
71 | * @ap: Port whose timings we are configuring | 83 | * @ap: Port whose timings we are configuring |
72 | * @adev: um | 84 | * @adev: um |
@@ -256,6 +268,7 @@ static const struct ata_port_operations efar_ops = { | |||
256 | .thaw = ata_bmdma_thaw, | 268 | .thaw = ata_bmdma_thaw, |
257 | .error_handler = efar_error_handler, | 269 | .error_handler = efar_error_handler, |
258 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 270 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
271 | .cable_detect = efar_cable_detect, | ||
259 | 272 | ||
260 | .bmdma_setup = ata_bmdma_setup, | 273 | .bmdma_setup = ata_bmdma_setup, |
261 | .bmdma_start = ata_bmdma_start, | 274 | .bmdma_start = ata_bmdma_start, |