diff options
Diffstat (limited to 'drivers/ide/cs5536.c')
-rw-r--r-- | drivers/ide/cs5536.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/ide/cs5536.c b/drivers/ide/cs5536.c index 9623b852c616..24214ab60ac0 100644 --- a/drivers/ide/cs5536.c +++ b/drivers/ide/cs5536.c | |||
@@ -125,11 +125,11 @@ static u8 cs5536_cable_detect(ide_hwif_t *hwif) | |||
125 | 125 | ||
126 | /** | 126 | /** |
127 | * cs5536_set_pio_mode - PIO timing setup | 127 | * cs5536_set_pio_mode - PIO timing setup |
128 | * @hwif: ATA port | ||
128 | * @drive: ATA device | 129 | * @drive: ATA device |
129 | * @pio: PIO mode number | ||
130 | */ | 130 | */ |
131 | 131 | ||
132 | static void cs5536_set_pio_mode(ide_drive_t *drive, const u8 pio) | 132 | static void cs5536_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
133 | { | 133 | { |
134 | static const u8 drv_timings[5] = { | 134 | static const u8 drv_timings[5] = { |
135 | 0x98, 0x55, 0x32, 0x21, 0x20, | 135 | 0x98, 0x55, 0x32, 0x21, 0x20, |
@@ -143,15 +143,16 @@ static void cs5536_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
143 | 0x99, 0x92, 0x90, 0x22, 0x20, | 143 | 0x99, 0x92, 0x90, 0x22, 0x20, |
144 | }; | 144 | }; |
145 | 145 | ||
146 | struct pci_dev *pdev = to_pci_dev(drive->hwif->dev); | 146 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
147 | ide_drive_t *pair = ide_get_pair_dev(drive); | 147 | ide_drive_t *pair = ide_get_pair_dev(drive); |
148 | int cshift = (drive->dn & 1) ? IDE_CAST_D1_SHIFT : IDE_CAST_D0_SHIFT; | 148 | int cshift = (drive->dn & 1) ? IDE_CAST_D1_SHIFT : IDE_CAST_D0_SHIFT; |
149 | unsigned long timings = (unsigned long)ide_get_drivedata(drive); | 149 | unsigned long timings = (unsigned long)ide_get_drivedata(drive); |
150 | u32 cast; | 150 | u32 cast; |
151 | const u8 pio = drive->pio_mode - XFER_PIO_0; | ||
151 | u8 cmd_pio = pio; | 152 | u8 cmd_pio = pio; |
152 | 153 | ||
153 | if (pair) | 154 | if (pair) |
154 | cmd_pio = min(pio, ide_get_best_pio_mode(pair, 255, 4)); | 155 | cmd_pio = min_t(u8, pio, pair->pio_mode - XFER_PIO_0); |
155 | 156 | ||
156 | timings &= (IDE_DRV_MASK << 8); | 157 | timings &= (IDE_DRV_MASK << 8); |
157 | timings |= drv_timings[pio]; | 158 | timings |= drv_timings[pio]; |
@@ -172,11 +173,11 @@ static void cs5536_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
172 | 173 | ||
173 | /** | 174 | /** |
174 | * cs5536_set_dma_mode - DMA timing setup | 175 | * cs5536_set_dma_mode - DMA timing setup |
176 | * @hwif: ATA port | ||
175 | * @drive: ATA device | 177 | * @drive: ATA device |
176 | * @mode: DMA mode | ||
177 | */ | 178 | */ |
178 | 179 | ||
179 | static void cs5536_set_dma_mode(ide_drive_t *drive, const u8 mode) | 180 | static void cs5536_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
180 | { | 181 | { |
181 | static const u8 udma_timings[6] = { | 182 | static const u8 udma_timings[6] = { |
182 | 0xc2, 0xc1, 0xc0, 0xc4, 0xc5, 0xc6, | 183 | 0xc2, 0xc1, 0xc0, 0xc4, 0xc5, 0xc6, |
@@ -186,10 +187,11 @@ static void cs5536_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
186 | 0x67, 0x21, 0x20, | 187 | 0x67, 0x21, 0x20, |
187 | }; | 188 | }; |
188 | 189 | ||
189 | struct pci_dev *pdev = to_pci_dev(drive->hwif->dev); | 190 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
190 | int dshift = (drive->dn & 1) ? IDE_D1_SHIFT : IDE_D0_SHIFT; | 191 | int dshift = (drive->dn & 1) ? IDE_D1_SHIFT : IDE_D0_SHIFT; |
191 | unsigned long timings = (unsigned long)ide_get_drivedata(drive); | 192 | unsigned long timings = (unsigned long)ide_get_drivedata(drive); |
192 | u32 etc; | 193 | u32 etc; |
194 | const u8 mode = drive->dma_mode; | ||
193 | 195 | ||
194 | cs5536_read(pdev, ETC, &etc); | 196 | cs5536_read(pdev, ETC, &etc); |
195 | 197 | ||