aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_it8213.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2007-03-07 11:46:20 -0500
committerJeff Garzik <jeff@garzik.org>2007-04-28 14:15:56 -0400
commit5816fbbf22470b687964462e6c1f18165b291f22 (patch)
tree303396634636665e5e6d323a40ab128b29974f5e /drivers/ata/pata_it8213.c
parenta0fcdc0259e98d1c16d96baea9ba8a8603e41791 (diff)
pata_it8213: Cable detect
Another not-quite PIIX, another cable type conversion Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_it8213.c')
-rw-r--r--drivers/ata/pata_it8213.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c
index ea734701555e..011306ef8334 100644
--- a/drivers/ata/pata_it8213.c
+++ b/drivers/ata/pata_it8213.c
@@ -25,8 +25,8 @@
25 * it8213_pre_reset - check for 40/80 pin 25 * it8213_pre_reset - check for 40/80 pin
26 * @ap: Port 26 * @ap: Port
27 * 27 *
28 * Perform cable detection for the 8213 ATA interface. This is 28 * Filter out ports by the enable bits before doing the normal reset
29 * different to the PIIX arrangement 29 * and probe.
30 */ 30 */
31 31
32static int it8213_pre_reset(struct ata_port *ap) 32static int it8213_pre_reset(struct ata_port *ap)
@@ -34,23 +34,14 @@ static int it8213_pre_reset(struct ata_port *ap)
34 static const struct pci_bits it8213_enable_bits[] = { 34 static const struct pci_bits it8213_enable_bits[] = {
35 { 0x41U, 1U, 0x80UL, 0x80UL }, /* port 0 */ 35 { 0x41U, 1U, 0x80UL, 0x80UL }, /* port 0 */
36 }; 36 };
37
38 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 37 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
39 u8 tmp;
40
41 if (!pci_test_config_bits(pdev, &it8213_enable_bits[ap->port_no])) 38 if (!pci_test_config_bits(pdev, &it8213_enable_bits[ap->port_no]))
42 return -ENOENT; 39 return -ENOENT;
43
44 pci_read_config_byte(pdev, 0x42, &tmp);
45 if (tmp & 2) /* The initial docs are incorrect */
46 ap->cbl = ATA_CBL_PATA40;
47 else
48 ap->cbl = ATA_CBL_PATA80;
49 return ata_std_prereset(ap); 40 return ata_std_prereset(ap);
50} 41}
51 42
52/** 43/**
53 * it8213_probe_reset - Probe specified port on PATA host controller 44 * it8213_error_handler - Probe specified port on PATA host controller
54 * @ap: Port to probe 45 * @ap: Port to probe
55 * 46 *
56 * LOCKING: 47 * LOCKING:
@@ -63,9 +54,27 @@ static void it8213_error_handler(struct ata_port *ap)
63} 54}
64 55
65/** 56/**
57 * it8213_cable_detect - check for 40/80 pin
58 * @ap: Port
59 *
60 * Perform cable detection for the 8213 ATA interface. This is
61 * different to the PIIX arrangement
62 */
63
64static int it8213_cable_detect(struct ata_port *ap)
65{
66 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
67 u8 tmp;
68 pci_read_config_byte(pdev, 0x42, &tmp);
69 if (tmp & 2) /* The initial docs are incorrect */
70 return ATA_CBL_PATA40;
71 return ATA_CBL_PATA80;
72}
73
74/**
66 * it8213_set_piomode - Initialize host controller PATA PIO timings 75 * it8213_set_piomode - Initialize host controller PATA PIO timings
67 * @ap: Port whose timings we are configuring 76 * @ap: Port whose timings we are configuring
68 * @adev: um 77 * @adev: Device whose timings we are configuring
69 * 78 *
70 * Set PIO mode for device, in host controller PCI config space. 79 * Set PIO mode for device, in host controller PCI config space.
71 * 80 *
@@ -268,6 +277,7 @@ static const struct ata_port_operations it8213_ops = {
268 .thaw = ata_bmdma_thaw, 277 .thaw = ata_bmdma_thaw,
269 .error_handler = it8213_error_handler, 278 .error_handler = it8213_error_handler,
270 .post_internal_cmd = ata_bmdma_post_internal_cmd, 279 .post_internal_cmd = ata_bmdma_post_internal_cmd,
280 .cable_detect = it8213_cable_detect,
271 281
272 .bmdma_setup = ata_bmdma_setup, 282 .bmdma_setup = ata_bmdma_setup,
273 .bmdma_start = ata_bmdma_start, 283 .bmdma_start = ata_bmdma_start,