aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/via82cxxx.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-13 11:47:51 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-13 11:47:51 -0400
commit88b2b32babd46cd54d2de4d17eb869aea3383e11 (patch)
treed446864f7c3431f8c428eecacd11caf7b794f018 /drivers/ide/pci/via82cxxx.c
parent6e249395eace037ef139a1c8996b31e3797e412a (diff)
ide: move ide_config_drive_speed() calls to upper layers (take 2)
* Convert {ide_hwif_t,ide_pci_device_t}->host_flag to be u16. * Add IDE_HFLAG_POST_SET_MODE host flag to indicate the need to program the host for the transfer mode after programming the device. Set it in au1xxx-ide, amd74xx, cs5530, cs5535, pdc202xx_new, sc1200, pmac and via82cxxx host drivers. * Add IDE_HFLAG_NO_SET_MODE host flag to indicate the need to completely skip programming of host/device for the transfer mode ("smart" hosts). Set it in it821x host driver and check it in ide_tune_dma(). * Add ide_set_pio_mode()/ide_set_dma_mode() helpers and convert all direct ->set_pio_mode/->speedproc users to use these helpers. * Move ide_config_drive_speed() calls from ->set_pio_mode/->speedproc methods to callers. * Rename ->speedproc method to ->set_dma_mode, make it void and update all implementations accordingly. * Update ide_set_xfer_rate() comments. * Unexport ide_config_drive_speed(). v2: * Fix issues noticed by Sergei: - export ide_set_dma_mode() instead of moving ->set_pio_mode abuse wrt to setting DMA modes from sc1200_set_pio_mode() to do_special() - check IDE_HFLAG_NO_SET_MODE in ide_tune_dma() - check for (hwif->set_pio_mode) == NULL in ide_set_pio_mode() - check for (hwif->set_dma_mode) == NULL in ide_set_dma_mode() - return -1 from ide_set_{pio,dma}_mode() if ->set_{pio,dma}_mode == NULL - don't set ->set_{pio,dma}_mode on it821x in "smart" mode - fix build problem in pmac.c - minor fixes in au1xxx-ide.c/cs5530.c/siimage.c - improve patch description Changes in behavior caused by this patch: - HDIO_SET_PIO_MODE ioctl would now return -ENOSYS for attempts to change PIO mode if it821x controller is in "smart" mode - removal of two debugging printk-s (from cs5530.c and sc1200.c) - transfer modes 0x00-0x07 passed from user space may be programmed twice on the device (not really an issue since 0x00 is not supported correctly by any host driver ATM, 0x01 is not supported at all and 0x02-0x07 are invalid) Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/via82cxxx.c')
-rw-r--r--drivers/ide/pci/via82cxxx.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index ac094e51d2bf..479e49661032 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -153,21 +153,17 @@ static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing)
153 * @drive: Drive to set up 153 * @drive: Drive to set up
154 * @speed: desired speed 154 * @speed: desired speed
155 * 155 *
156 * via_set_drive() computes timing values configures the drive and 156 * via_set_drive() computes timing values configures the chipset to
157 * the chipset to a desired transfer mode. It also can be called 157 * a desired transfer mode. It also can be called by upper layers.
158 * by upper layers.
159 */ 158 */
160 159
161static int via_set_drive(ide_drive_t *drive, const u8 speed) 160static void via_set_drive(ide_drive_t *drive, const u8 speed)
162{ 161{
163 ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); 162 ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1);
164 struct via82cxxx_dev *vdev = pci_get_drvdata(drive->hwif->pci_dev); 163 struct via82cxxx_dev *vdev = pci_get_drvdata(drive->hwif->pci_dev);
165 struct ide_timing t, p; 164 struct ide_timing t, p;
166 unsigned int T, UT; 165 unsigned int T, UT;
167 166
168 if (ide_config_drive_speed(drive, speed))
169 return 1;
170
171 T = 1000000000 / via_clock; 167 T = 1000000000 / via_clock;
172 168
173 switch (vdev->via_config->udma_mask) { 169 switch (vdev->via_config->udma_mask) {
@@ -186,12 +182,10 @@ static int via_set_drive(ide_drive_t *drive, const u8 speed)
186 } 182 }
187 183
188 via_set_speed(HWIF(drive), drive->dn, &t); 184 via_set_speed(HWIF(drive), drive->dn, &t);
189
190 return 0;
191} 185}
192 186
193/** 187/**
194 * via_set_pio_mode - PIO setup 188 * via_set_pio_mode - set host controller for PIO mode
195 * @drive: drive 189 * @drive: drive
196 * @pio: PIO mode number 190 * @pio: PIO mode number
197 * 191 *
@@ -452,8 +446,7 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif)
452 hwif->autodma = 0; 446 hwif->autodma = 0;
453 447
454 hwif->set_pio_mode = &via_set_pio_mode; 448 hwif->set_pio_mode = &via_set_pio_mode;
455 hwif->speedproc = &via_set_drive; 449 hwif->set_dma_mode = &via_set_drive;
456
457 450
458#ifdef CONFIG_PPC_CHRP 451#ifdef CONFIG_PPC_CHRP
459 if(machine_is(chrp) && _chrp_type == _CHRP_Pegasos) { 452 if(machine_is(chrp) && _chrp_type == _CHRP_Pegasos) {
@@ -496,7 +489,8 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = {
496 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, 489 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
497 .bootable = ON_BOARD, 490 .bootable = ON_BOARD,
498 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST 491 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST
499 | IDE_HFLAG_PIO_NO_DOWNGRADE, 492 | IDE_HFLAG_PIO_NO_DOWNGRADE
493 | IDE_HFLAG_POST_SET_MODE,
500 .pio_mask = ATA_PIO5, 494 .pio_mask = ATA_PIO5,
501 },{ /* 1 */ 495 },{ /* 1 */
502 .name = "VP_IDE", 496 .name = "VP_IDE",
@@ -506,7 +500,8 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = {
506 .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, 500 .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
507 .bootable = ON_BOARD, 501 .bootable = ON_BOARD,
508 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST 502 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST
509 | IDE_HFLAG_PIO_NO_DOWNGRADE, 503 | IDE_HFLAG_PIO_NO_DOWNGRADE
504 | IDE_HFLAG_POST_SET_MODE,
510 .pio_mask = ATA_PIO5, 505 .pio_mask = ATA_PIO5,
511 } 506 }
512}; 507};