diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2007-03-08 14:27:31 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 14:15:57 -0400 |
commit | 847086069cdb5eac14f70cd0aea8545d499c80b4 (patch) | |
tree | 2da939848e4ae88f0fc2f4a800f3b8aff5e7c4f5 /drivers | |
parent | d36a76482c19c186aa638446def39ec643993955 (diff) |
pata_atiixp: support ->cable_detect
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/pata_atiixp.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index 51d9923be02e..39c871a3ddac 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/libata.h> | 22 | #include <linux/libata.h> |
23 | 23 | ||
24 | #define DRV_NAME "pata_atiixp" | 24 | #define DRV_NAME "pata_atiixp" |
25 | #define DRV_VERSION "0.4.4" | 25 | #define DRV_VERSION "0.4.5" |
26 | 26 | ||
27 | enum { | 27 | enum { |
28 | ATIIXP_IDE_PIO_TIMING = 0x40, | 28 | ATIIXP_IDE_PIO_TIMING = 0x40, |
@@ -35,23 +35,15 @@ enum { | |||
35 | 35 | ||
36 | static int atiixp_pre_reset(struct ata_port *ap) | 36 | static int atiixp_pre_reset(struct ata_port *ap) |
37 | { | 37 | { |
38 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
39 | static const struct pci_bits atiixp_enable_bits[] = { | 38 | static const struct pci_bits atiixp_enable_bits[] = { |
40 | { 0x48, 1, 0x01, 0x00 }, | 39 | { 0x48, 1, 0x01, 0x00 }, |
41 | { 0x48, 1, 0x08, 0x00 } | 40 | { 0x48, 1, 0x08, 0x00 } |
42 | }; | 41 | }; |
43 | u8 udma; | 42 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
44 | 43 | ||
45 | if (!pci_test_config_bits(pdev, &atiixp_enable_bits[ap->port_no])) | 44 | if (!pci_test_config_bits(pdev, &atiixp_enable_bits[ap->port_no])) |
46 | return -ENOENT; | 45 | return -ENOENT; |
47 | 46 | ||
48 | /* Hack from drivers/ide/pci. Really we want to know how to do the | ||
49 | raw detection not play follow the bios mode guess */ | ||
50 | pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ap->port_no, &udma); | ||
51 | if ((udma & 0x07) >= 0x04 || (udma & 0x70) >= 0x40) | ||
52 | ap->cbl = ATA_CBL_PATA80; | ||
53 | else | ||
54 | ap->cbl = ATA_CBL_PATA40; | ||
55 | return ata_std_prereset(ap); | 47 | return ata_std_prereset(ap); |
56 | } | 48 | } |
57 | 49 | ||
@@ -60,6 +52,19 @@ static void atiixp_error_handler(struct ata_port *ap) | |||
60 | ata_bmdma_drive_eh(ap, atiixp_pre_reset, ata_std_softreset, NULL, ata_std_postreset); | 52 | ata_bmdma_drive_eh(ap, atiixp_pre_reset, ata_std_softreset, NULL, ata_std_postreset); |
61 | } | 53 | } |
62 | 54 | ||
55 | static int atiixp_cable_detect(struct ata_port *ap) | ||
56 | { | ||
57 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
58 | u8 udma; | ||
59 | |||
60 | /* Hack from drivers/ide/pci. Really we want to know how to do the | ||
61 | raw detection not play follow the bios mode guess */ | ||
62 | pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ap->port_no, &udma); | ||
63 | if ((udma & 0x07) >= 0x04 || (udma & 0x70) >= 0x40) | ||
64 | return ATA_CBL_PATA80; | ||
65 | return ATA_CBL_PATA40; | ||
66 | } | ||
67 | |||
63 | /** | 68 | /** |
64 | * atiixp_set_pio_timing - set initial PIO mode data | 69 | * atiixp_set_pio_timing - set initial PIO mode data |
65 | * @ap: ATA interface | 70 | * @ap: ATA interface |
@@ -245,6 +250,7 @@ static struct ata_port_operations atiixp_port_ops = { | |||
245 | .thaw = ata_bmdma_thaw, | 250 | .thaw = ata_bmdma_thaw, |
246 | .error_handler = atiixp_error_handler, | 251 | .error_handler = atiixp_error_handler, |
247 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 252 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
253 | .cable_detect = atiixp_cable_detect, | ||
248 | 254 | ||
249 | .bmdma_setup = ata_bmdma_setup, | 255 | .bmdma_setup = ata_bmdma_setup, |
250 | .bmdma_start = atiixp_bmdma_start, | 256 | .bmdma_start = atiixp_bmdma_start, |