diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-03-09 07:24:15 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 14:15:56 -0400 |
commit | a0fcdc0259e98d1c16d96baea9ba8a8603e41791 (patch) | |
tree | 568c6a99b5e38486c84b5145ac2e3719b8c62720 /drivers/ata/sata_via.c | |
parent | 6a3d586d8e8a50e4cfd7f8c36d82a53c5614e05b (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/sata_via.c')
-rw-r--r-- | drivers/ata/sata_via.c | 35 |
1 files changed, 8 insertions, 27 deletions
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); | |||
78 | static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | 78 | static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); |
79 | static void svia_noop_freeze(struct ata_port *ap); | 79 | static void svia_noop_freeze(struct ata_port *ap); |
80 | static void vt6420_error_handler(struct ata_port *ap); | 80 | static void vt6420_error_handler(struct ata_port *ap); |
81 | static void vt6421_sata_error_handler(struct ata_port *ap); | 81 | static int vt6421_pata_cable_detect(struct ata_port *ap); |
82 | static void vt6421_pata_error_handler(struct ata_port *ap); | ||
83 | static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev); | 82 | static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev); |
84 | static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev); | 83 | static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev); |
85 | static int vt6421_port_start(struct ata_port *ap); | 84 | static 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 | ||
333 | static int vt6421_pata_prereset(struct ata_port *ap) | 334 | static 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 | |||
346 | static 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 | |||
352 | static int vt6421_sata_prereset(struct ata_port *ap) | ||
353 | { | ||
354 | ap->cbl = ATA_CBL_SATA; | ||
355 | return 0; | ||
356 | } | ||
357 | |||
358 | static 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 | ||
364 | static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev) | 345 | static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev) |