aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/cs5535.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/cs5535.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/cs5535.c')
-rw-r--r--drivers/ide/pci/cs5535.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index 5d1be657adca..da606ba6d28c 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -131,26 +131,21 @@ static void cs5535_set_speed(ide_drive_t *drive, const u8 speed)
131 } 131 }
132} 132}
133 133
134/**** 134/**
135 * cs5535_set_drive - Configure the drive to the new speed 135 * cs5535_set_dma_mode - set host controller for DMA mode
136 * @drive: Drive to set up 136 * @drive: drive
137 * @speed: desired speed 137 * @speed: DMA mode
138 * 138 *
139 * cs5535_set_drive() configures the drive and the chipset to a 139 * Programs the chipset for DMA mode.
140 * new speed. It also can be called by upper layers.
141 */ 140 */
142static int cs5535_set_drive(ide_drive_t *drive, u8 speed)
143{
144 if (ide_config_drive_speed(drive, speed))
145 return 1;
146 141
142static void cs5535_set_dma_mode(ide_drive_t *drive, const u8 speed)
143{
147 cs5535_set_speed(drive, speed); 144 cs5535_set_speed(drive, speed);
148
149 return 0;
150} 145}
151 146
152/** 147/**
153 * cs5535_set_pio_mode - PIO setup 148 * cs5535_set_pio_mode - set host controller for PIO mode
154 * @drive: drive 149 * @drive: drive
155 * @pio: PIO mode number 150 * @pio: PIO mode number
156 * 151 *
@@ -159,9 +154,6 @@ static int cs5535_set_drive(ide_drive_t *drive, u8 speed)
159 154
160static void cs5535_set_pio_mode(ide_drive_t *drive, const u8 pio) 155static void cs5535_set_pio_mode(ide_drive_t *drive, const u8 pio)
161{ 156{
162 if (ide_config_drive_speed(drive, XFER_PIO_0 + pio))
163 return;
164
165 cs5535_set_speed(drive, XFER_PIO_0 + pio); 157 cs5535_set_speed(drive, XFER_PIO_0 + pio);
166} 158}
167 159
@@ -203,7 +195,7 @@ static void __devinit init_hwif_cs5535(ide_hwif_t *hwif)
203 hwif->autodma = 0; 195 hwif->autodma = 0;
204 196
205 hwif->set_pio_mode = &cs5535_set_pio_mode; 197 hwif->set_pio_mode = &cs5535_set_pio_mode;
206 hwif->speedproc = &cs5535_set_drive; 198 hwif->set_dma_mode = &cs5535_set_dma_mode;
207 hwif->ide_dma_check = &cs5535_dma_check; 199 hwif->ide_dma_check = &cs5535_dma_check;
208 200
209 hwif->atapi_dma = 1; 201 hwif->atapi_dma = 1;
@@ -227,7 +219,7 @@ static ide_pci_device_t cs5535_chipset __devinitdata = {
227 .init_hwif = init_hwif_cs5535, 219 .init_hwif = init_hwif_cs5535,
228 .autodma = AUTODMA, 220 .autodma = AUTODMA,
229 .bootable = ON_BOARD, 221 .bootable = ON_BOARD,
230 .host_flags = IDE_HFLAG_SINGLE, 222 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE,
231 .pio_mask = ATA_PIO4, 223 .pio_mask = ATA_PIO4,
232}; 224};
233 225