aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/amd74xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/amd74xx.c')
-rw-r--r--drivers/ide/amd74xx.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/ide/amd74xx.c b/drivers/ide/amd74xx.c
index 628cd2e5fed8..3747b2561f09 100644
--- a/drivers/ide/amd74xx.c
+++ b/drivers/ide/amd74xx.c
@@ -3,7 +3,7 @@
3 * IDE driver for Linux. 3 * IDE driver for Linux.
4 * 4 *
5 * Copyright (c) 2000-2002 Vojtech Pavlik 5 * Copyright (c) 2000-2002 Vojtech Pavlik
6 * Copyright (c) 2007-2008 Bartlomiej Zolnierkiewicz 6 * Copyright (c) 2007-2010 Bartlomiej Zolnierkiewicz
7 * 7 *
8 * Based on the work of: 8 * Based on the work of:
9 * Andre Hedrick 9 * Andre Hedrick
@@ -70,7 +70,8 @@ static void amd_set_speed(struct pci_dev *dev, u8 dn, u8 udma_mask,
70 default: return; 70 default: return;
71 } 71 }
72 72
73 pci_write_config_byte(dev, AMD_UDMA_TIMING + offset + (3 - dn), t); 73 if (timing->udma)
74 pci_write_config_byte(dev, AMD_UDMA_TIMING + offset + 3 - dn, t);
74} 75}
75 76
76/* 77/*
@@ -78,14 +79,14 @@ static void amd_set_speed(struct pci_dev *dev, u8 dn, u8 udma_mask,
78 * to a desired transfer mode. It also can be called by upper layers. 79 * to a desired transfer mode. It also can be called by upper layers.
79 */ 80 */
80 81
81static void amd_set_drive(ide_drive_t *drive, const u8 speed) 82static void amd_set_drive(ide_hwif_t *hwif, ide_drive_t *drive)
82{ 83{
83 ide_hwif_t *hwif = drive->hwif;
84 struct pci_dev *dev = to_pci_dev(hwif->dev); 84 struct pci_dev *dev = to_pci_dev(hwif->dev);
85 ide_drive_t *peer = ide_get_pair_dev(drive); 85 ide_drive_t *peer = ide_get_pair_dev(drive);
86 struct ide_timing t, p; 86 struct ide_timing t, p;
87 int T, UT; 87 int T, UT;
88 u8 udma_mask = hwif->ultra_mask; 88 u8 udma_mask = hwif->ultra_mask;
89 const u8 speed = drive->dma_mode;
89 90
90 T = 1000000000 / amd_clock; 91 T = 1000000000 / amd_clock;
91 UT = (udma_mask == ATA_UDMA2) ? T : (T / 2); 92 UT = (udma_mask == ATA_UDMA2) ? T : (T / 2);
@@ -93,7 +94,7 @@ static void amd_set_drive(ide_drive_t *drive, const u8 speed)
93 ide_timing_compute(drive, speed, &t, T, UT); 94 ide_timing_compute(drive, speed, &t, T, UT);
94 95
95 if (peer) { 96 if (peer) {
96 ide_timing_compute(peer, peer->current_speed, &p, T, UT); 97 ide_timing_compute(peer, peer->pio_mode, &p, T, UT);
97 ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT); 98 ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT);
98 } 99 }
99 100
@@ -107,9 +108,10 @@ static void amd_set_drive(ide_drive_t *drive, const u8 speed)
107 * amd_set_pio_mode() is a callback from upper layers for PIO-only tuning. 108 * amd_set_pio_mode() is a callback from upper layers for PIO-only tuning.
108 */ 109 */
109 110
110static void amd_set_pio_mode(ide_drive_t *drive, const u8 pio) 111static void amd_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
111{ 112{
112 amd_set_drive(drive, XFER_PIO_0 + pio); 113 drive->dma_mode = drive->pio_mode;
114 amd_set_drive(hwif, drive);
113} 115}
114 116
115static void amd7409_cable_detect(struct pci_dev *dev) 117static void amd7409_cable_detect(struct pci_dev *dev)
@@ -340,6 +342,6 @@ static void __exit amd74xx_ide_exit(void)
340module_init(amd74xx_ide_init); 342module_init(amd74xx_ide_init);
341module_exit(amd74xx_ide_exit); 343module_exit(amd74xx_ide_exit);
342 344
343MODULE_AUTHOR("Vojtech Pavlik"); 345MODULE_AUTHOR("Vojtech Pavlik, Bartlomiej Zolnierkiewicz");
344MODULE_DESCRIPTION("AMD PCI IDE driver"); 346MODULE_DESCRIPTION("AMD PCI IDE driver");
345MODULE_LICENSE("GPL"); 347MODULE_LICENSE("GPL");