aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/alim15x3.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-11 22:20:44 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-11 22:20:44 -0400
commit19f71153b9be219756c6b2757921433a69b7975c (patch)
treecc2c5c290a88d61df16848f733aed8708e82c119 /drivers/ide/pci/alim15x3.c
parente6005a85acb9609326512ecc784859831cfb24a3 (diff)
parent8f4dd2e42637fd61a6366d2cace69091926eaa15 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (24 commits) ide: use only ->set_pio_mode method for programming PIO modes (take 2) sis5513: don't change UDMA settings when programming PIO it8213/piix/slc90e66: don't change DMA settings when programming PIO alim15x3: PIO mode setup fixes siimage: fix ->set_pio_mode method to select PIO data transfer cs5520: don't enable VDMA in ->speedproc sc1200: remove redundant warning message from sc1200_tune_chipset() ide-pmac: PIO mode setup fixes (take 3) icside: fix ->speedproc to return on unsupported modes (take 5) sgiioc4: use ide_tune_dma() amd74xx/via82cxxx: use ide_tune_dma() ide: add ide_set{_max}_pio() (take 4) ide: Kconfig face-lift ide: move ide_rate_filter() calls to the upper layer (take 2) sis5513: add ->udma_filter method for chipset_family >= ATA_133 ide: mode limiting fixes for user requested speed changes ide: add missing ide_rate_filter() calls to ->speedproc()-s ide: call udma_filter() before resorting to the UltraDMA mask ide: make jmicron match vendor and device class pdc202xx_new: switch to using pci_get_slot() (take 2) ...
Diffstat (limited to 'drivers/ide/pci/alim15x3.c')
-rw-r--r--drivers/ide/pci/alim15x3.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 20ebe3b7049c..d04b966b4347 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/alim15x3.c Version 0.25 Jun 9 2007 2 * linux/drivers/ide/pci/alim15x3.c Version 0.26 Jul 14 2007
3 * 3 *
4 * Copyright (C) 1998-2000 Michel Aubry, Maintainer 4 * Copyright (C) 1998-2000 Michel Aubry, Maintainer
5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer 5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer
@@ -283,17 +283,14 @@ static int ali_get_info (char *buffer, char **addr, off_t offset, int count)
283#endif /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_IDE_PROC_FS) */ 283#endif /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_IDE_PROC_FS) */
284 284
285/** 285/**
286 * ali15x3_tune_pio - set up chipset for PIO mode 286 * ali_tune_pio - set host controller for PIO mode
287 * @drive: drive to tune 287 * @drive: drive
288 * @pio: desired mode 288 * @pio: PIO mode number
289 *
290 * Select the best PIO mode for the drive in question.
291 * Then program the controller for this mode.
292 * 289 *
293 * Returns the PIO mode programmed. 290 * Program the controller for the given PIO mode.
294 */ 291 */
295 292
296static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio) 293static void ali_tune_pio(ide_drive_t *drive, const u8 pio)
297{ 294{
298 ide_hwif_t *hwif = HWIF(drive); 295 ide_hwif_t *hwif = HWIF(drive);
299 struct pci_dev *dev = hwif->pci_dev; 296 struct pci_dev *dev = hwif->pci_dev;
@@ -306,7 +303,6 @@ static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio)
306 u8 cd_dma_fifo = 0; 303 u8 cd_dma_fifo = 0;
307 int unit = drive->select.b.unit & 1; 304 int unit = drive->select.b.unit & 1;
308 305
309 pio = ide_get_best_pio_mode(drive, pio, 5);
310 s_time = ide_pio_timings[pio].setup_time; 306 s_time = ide_pio_timings[pio].setup_time;
311 a_time = ide_pio_timings[pio].active_time; 307 a_time = ide_pio_timings[pio].active_time;
312 if ((s_clc = (s_time * bus_speed + 999) / 1000) >= 8) 308 if ((s_clc = (s_time * bus_speed + 999) / 1000) >= 8)
@@ -359,22 +355,20 @@ static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio)
359 * { 25, 70, 25 }, PIO Mode 4 with IORDY ns 355 * { 25, 70, 25 }, PIO Mode 4 with IORDY ns
360 * { 20, 50, 30 } PIO Mode 5 with IORDY (nonstandard) 356 * { 20, 50, 30 } PIO Mode 5 with IORDY (nonstandard)
361 */ 357 */
362
363 return pio;
364} 358}
365 359
366/** 360/**
367 * ali15x3_tune_drive - set up drive for PIO mode 361 * ali_set_pio_mode - set up drive for PIO mode
368 * @drive: drive to tune 362 * @drive: drive to tune
369 * @pio: desired mode 363 * @pio: desired mode
370 * 364 *
371 * Program the controller with the best PIO timing for the given drive. 365 * Program the controller with the desired PIO timing for the given drive.
372 * Then set up the drive itself. 366 * Then set up the drive itself.
373 */ 367 */
374 368
375static void ali15x3_tune_drive (ide_drive_t *drive, u8 pio) 369static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio)
376{ 370{
377 pio = ali15x3_tune_pio(drive, pio); 371 ali_tune_pio(drive, pio);
378 (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); 372 (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio);
379} 373}
380 374
@@ -409,22 +403,24 @@ static u8 ali_udma_filter(ide_drive_t *drive)
409/** 403/**
410 * ali15x3_tune_chipset - set up chipset/drive for new speed 404 * ali15x3_tune_chipset - set up chipset/drive for new speed
411 * @drive: drive to configure for 405 * @drive: drive to configure for
412 * @xferspeed: desired speed 406 * @speed: desired speed
413 * 407 *
414 * Configure the hardware for the desired IDE transfer mode. 408 * Configure the hardware for the desired IDE transfer mode.
415 * We also do the needed drive configuration through helpers 409 * We also do the needed drive configuration through helpers
416 */ 410 */
417 411
418static int ali15x3_tune_chipset (ide_drive_t *drive, u8 xferspeed) 412static int ali15x3_tune_chipset(ide_drive_t *drive, const u8 speed)
419{ 413{
420 ide_hwif_t *hwif = HWIF(drive); 414 ide_hwif_t *hwif = HWIF(drive);
421 struct pci_dev *dev = hwif->pci_dev; 415 struct pci_dev *dev = hwif->pci_dev;
422 u8 speed = ide_rate_filter(drive, xferspeed);
423 u8 speed1 = speed; 416 u8 speed1 = speed;
424 u8 unit = (drive->select.b.unit & 0x01); 417 u8 unit = (drive->select.b.unit & 0x01);
425 u8 tmpbyte = 0x00; 418 u8 tmpbyte = 0x00;
426 int m5229_udma = (hwif->channel) ? 0x57 : 0x56; 419 int m5229_udma = (hwif->channel) ? 0x57 : 0x56;
427 420
421 if (speed < XFER_PIO_0)
422 return 1;
423
428 if (speed == XFER_UDMA_6) 424 if (speed == XFER_UDMA_6)
429 speed1 = 0x47; 425 speed1 = 0x47;
430 426
@@ -437,8 +433,9 @@ static int ali15x3_tune_chipset (ide_drive_t *drive, u8 xferspeed)
437 tmpbyte &= ultra_enable; 433 tmpbyte &= ultra_enable;
438 pci_write_config_byte(dev, m5229_udma, tmpbyte); 434 pci_write_config_byte(dev, m5229_udma, tmpbyte);
439 435
440 if (speed < XFER_SW_DMA_0) 436 /*
441 (void) ali15x3_tune_pio(drive, speed - XFER_PIO_0); 437 * FIXME: Oh, my... DMA timings are never set.
438 */
442 } else { 439 } else {
443 pci_read_config_byte(dev, m5229_udma, &tmpbyte); 440 pci_read_config_byte(dev, m5229_udma, &tmpbyte);
444 tmpbyte &= (0x0f << ((1-unit) << 2)); 441 tmpbyte &= (0x0f << ((1-unit) << 2));
@@ -471,7 +468,7 @@ static int ali15x3_config_drive_for_dma(ide_drive_t *drive)
471 if (ide_tune_dma(drive)) 468 if (ide_tune_dma(drive))
472 return 0; 469 return 0;
473 470
474 ali15x3_tune_drive(drive, 255); 471 ide_set_max_pio(drive);
475 472
476 return -1; 473 return -1;
477} 474}
@@ -701,7 +698,7 @@ static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif)
701static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif) 698static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif)
702{ 699{
703 hwif->autodma = 0; 700 hwif->autodma = 0;
704 hwif->tuneproc = &ali15x3_tune_drive; 701 hwif->set_pio_mode = &ali_set_pio_mode;
705 hwif->speedproc = &ali15x3_tune_chipset; 702 hwif->speedproc = &ali15x3_tune_chipset;
706 hwif->udma_filter = &ali_udma_filter; 703 hwif->udma_filter = &ali_udma_filter;
707 704