aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/siimage.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/siimage.c')
-rw-r--r--drivers/ide/siimage.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/ide/siimage.c b/drivers/ide/siimage.c
index d95df528562f..ddeda444a27a 100644
--- a/drivers/ide/siimage.c
+++ b/drivers/ide/siimage.c
@@ -229,19 +229,18 @@ static u8 sil_sata_udma_filter(ide_drive_t *drive)
229 229
230/** 230/**
231 * sil_set_pio_mode - set host controller for PIO mode 231 * sil_set_pio_mode - set host controller for PIO mode
232 * @hwif: port
232 * @drive: drive 233 * @drive: drive
233 * @pio: PIO mode number
234 * 234 *
235 * Load the timing settings for this device mode into the 235 * Load the timing settings for this device mode into the
236 * controller. 236 * controller.
237 */ 237 */
238 238
239static void sil_set_pio_mode(ide_drive_t *drive, u8 pio) 239static void sil_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
240{ 240{
241 static const u16 tf_speed[] = { 0x328a, 0x2283, 0x1281, 0x10c3, 0x10c1 }; 241 static const u16 tf_speed[] = { 0x328a, 0x2283, 0x1281, 0x10c3, 0x10c1 };
242 static const u16 data_speed[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 }; 242 static const u16 data_speed[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 };
243 243
244 ide_hwif_t *hwif = drive->hwif;
245 struct pci_dev *dev = to_pci_dev(hwif->dev); 244 struct pci_dev *dev = to_pci_dev(hwif->dev);
246 ide_drive_t *pair = ide_get_pair_dev(drive); 245 ide_drive_t *pair = ide_get_pair_dev(drive);
247 u32 speedt = 0; 246 u32 speedt = 0;
@@ -249,6 +248,7 @@ static void sil_set_pio_mode(ide_drive_t *drive, u8 pio)
249 unsigned long addr = siimage_seldev(drive, 0x04); 248 unsigned long addr = siimage_seldev(drive, 0x04);
250 unsigned long tfaddr = siimage_selreg(hwif, 0x02); 249 unsigned long tfaddr = siimage_selreg(hwif, 0x02);
251 unsigned long base = (unsigned long)hwif->hwif_data; 250 unsigned long base = (unsigned long)hwif->hwif_data;
251 const u8 pio = drive->pio_mode - XFER_PIO_0;
252 u8 tf_pio = pio; 252 u8 tf_pio = pio;
253 u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; 253 u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
254 u8 addr_mask = hwif->channel ? (mmio ? 0xF4 : 0x84) 254 u8 addr_mask = hwif->channel ? (mmio ? 0xF4 : 0x84)
@@ -258,7 +258,7 @@ static void sil_set_pio_mode(ide_drive_t *drive, u8 pio)
258 258
259 /* trim *taskfile* PIO to the slowest of the master/slave */ 259 /* trim *taskfile* PIO to the slowest of the master/slave */
260 if (pair) { 260 if (pair) {
261 u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4); 261 u8 pair_pio = pair->pio_mode - XFER_PIO_0;
262 262
263 if (pair_pio < tf_pio) 263 if (pair_pio < tf_pio)
264 tf_pio = pair_pio; 264 tf_pio = pair_pio;
@@ -289,19 +289,18 @@ static void sil_set_pio_mode(ide_drive_t *drive, u8 pio)
289 289
290/** 290/**
291 * sil_set_dma_mode - set host controller for DMA mode 291 * sil_set_dma_mode - set host controller for DMA mode
292 * @hwif: port
292 * @drive: drive 293 * @drive: drive
293 * @speed: DMA mode
294 * 294 *
295 * Tune the SiI chipset for the desired DMA mode. 295 * Tune the SiI chipset for the desired DMA mode.
296 */ 296 */
297 297
298static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed) 298static void sil_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive)
299{ 299{
300 static const u8 ultra6[] = { 0x0F, 0x0B, 0x07, 0x05, 0x03, 0x02, 0x01 }; 300 static const u8 ultra6[] = { 0x0F, 0x0B, 0x07, 0x05, 0x03, 0x02, 0x01 };
301 static const u8 ultra5[] = { 0x0C, 0x07, 0x05, 0x04, 0x02, 0x01 }; 301 static const u8 ultra5[] = { 0x0C, 0x07, 0x05, 0x04, 0x02, 0x01 };
302 static const u16 dma[] = { 0x2208, 0x10C2, 0x10C1 }; 302 static const u16 dma[] = { 0x2208, 0x10C2, 0x10C1 };
303 303
304 ide_hwif_t *hwif = drive->hwif;
305 struct pci_dev *dev = to_pci_dev(hwif->dev); 304 struct pci_dev *dev = to_pci_dev(hwif->dev);
306 unsigned long base = (unsigned long)hwif->hwif_data; 305 unsigned long base = (unsigned long)hwif->hwif_data;
307 u16 ultra = 0, multi = 0; 306 u16 ultra = 0, multi = 0;
@@ -311,6 +310,7 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed)
311 : (mmio ? 0xB4 : 0x80); 310 : (mmio ? 0xB4 : 0x80);
312 unsigned long ma = siimage_seldev(drive, 0x08); 311 unsigned long ma = siimage_seldev(drive, 0x08);
313 unsigned long ua = siimage_seldev(drive, 0x0C); 312 unsigned long ua = siimage_seldev(drive, 0x0C);
313 const u8 speed = drive->dma_mode;
314 314
315 scsc = sil_ioread8 (dev, base + (mmio ? 0x4A : 0x8A)); 315 scsc = sil_ioread8 (dev, base + (mmio ? 0x4A : 0x8A));
316 mode = sil_ioread8 (dev, base + addr_mask); 316 mode = sil_ioread8 (dev, base + addr_mask);