diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-02-16 20:40:25 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-02-16 20:40:25 -0500 |
commit | 0ecdca26e556eae9668ce6de9554757dddb942ef (patch) | |
tree | 21d62c01d0c0d5aeea2524252ed8dec6ca20b6d4 /drivers/ide/pci/trm290.c | |
parent | 7569e8dc2213ecc47024ea5edbadc8736487d926 (diff) |
ide: use PIO/MMIO operations directly where possible (v2)
This results in smaller/faster/simpler code and allows future optimizations.
Also remove no longer needed ide[_mm]_{inl,outl}() and ide_hwif_t.{INL,OUTL}.
v2:
* updated for scc_pata
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/trm290.c')
-rw-r--r-- | drivers/ide/pci/trm290.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index 5eb98893810c..cbb1b11119a5 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c | |||
@@ -157,16 +157,16 @@ static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma) | |||
157 | if (reg != hwif->select_data) { | 157 | if (reg != hwif->select_data) { |
158 | hwif->select_data = reg; | 158 | hwif->select_data = reg; |
159 | /* set PIO/DMA */ | 159 | /* set PIO/DMA */ |
160 | hwif->OUTB(0x51|(hwif->channel<<3), hwif->config_data+1); | 160 | outb(0x51 | (hwif->channel << 3), hwif->config_data + 1); |
161 | hwif->OUTW(reg & 0xff, hwif->config_data); | 161 | outw(reg & 0xff, hwif->config_data); |
162 | } | 162 | } |
163 | 163 | ||
164 | /* enable IRQ if not probing */ | 164 | /* enable IRQ if not probing */ |
165 | if (drive->present) { | 165 | if (drive->present) { |
166 | reg = hwif->INW(hwif->config_data + 3); | 166 | reg = inw(hwif->config_data + 3); |
167 | reg &= 0x13; | 167 | reg &= 0x13; |
168 | reg &= ~(1 << hwif->channel); | 168 | reg &= ~(1 << hwif->channel); |
169 | hwif->OUTW(reg, hwif->config_data+3); | 169 | outw(reg, hwif->config_data + 3); |
170 | } | 170 | } |
171 | 171 | ||
172 | local_irq_restore(flags); | 172 | local_irq_restore(flags); |
@@ -179,12 +179,10 @@ static void trm290_selectproc (ide_drive_t *drive) | |||
179 | 179 | ||
180 | static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command) | 180 | static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command) |
181 | { | 181 | { |
182 | ide_hwif_t *hwif = HWIF(drive); | ||
183 | |||
184 | BUG_ON(HWGROUP(drive)->handler != NULL); /* paranoia check */ | 182 | BUG_ON(HWGROUP(drive)->handler != NULL); /* paranoia check */ |
185 | ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); | 183 | ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); |
186 | /* issue cmd to drive */ | 184 | /* issue cmd to drive */ |
187 | hwif->OUTB(command, IDE_COMMAND_REG); | 185 | outb(command, IDE_COMMAND_REG); |
188 | } | 186 | } |
189 | 187 | ||
190 | static int trm290_ide_dma_setup(ide_drive_t *drive) | 188 | static int trm290_ide_dma_setup(ide_drive_t *drive) |
@@ -210,10 +208,10 @@ static int trm290_ide_dma_setup(ide_drive_t *drive) | |||
210 | } | 208 | } |
211 | /* select DMA xfer */ | 209 | /* select DMA xfer */ |
212 | trm290_prepare_drive(drive, 1); | 210 | trm290_prepare_drive(drive, 1); |
213 | hwif->OUTL(hwif->dmatable_dma|rw, hwif->dma_command); | 211 | outl(hwif->dmatable_dma | rw, hwif->dma_command); |
214 | drive->waiting_for_dma = 1; | 212 | drive->waiting_for_dma = 1; |
215 | /* start DMA */ | 213 | /* start DMA */ |
216 | hwif->OUTW((count * 2) - 1, hwif->dma_status); | 214 | outw((count * 2) - 1, hwif->dma_status); |
217 | return 0; | 215 | return 0; |
218 | } | 216 | } |
219 | 217 | ||
@@ -229,7 +227,7 @@ static int trm290_ide_dma_end (ide_drive_t *drive) | |||
229 | drive->waiting_for_dma = 0; | 227 | drive->waiting_for_dma = 0; |
230 | /* purge DMA mappings */ | 228 | /* purge DMA mappings */ |
231 | ide_destroy_dmatable(drive); | 229 | ide_destroy_dmatable(drive); |
232 | status = hwif->INW(hwif->dma_status); | 230 | status = inw(hwif->dma_status); |
233 | return (status != 0x00ff); | 231 | return (status != 0x00ff); |
234 | } | 232 | } |
235 | 233 | ||
@@ -238,7 +236,7 @@ static int trm290_ide_dma_test_irq (ide_drive_t *drive) | |||
238 | ide_hwif_t *hwif = HWIF(drive); | 236 | ide_hwif_t *hwif = HWIF(drive); |
239 | u16 status = 0; | 237 | u16 status = 0; |
240 | 238 | ||
241 | status = hwif->INW(hwif->dma_status); | 239 | status = inw(hwif->dma_status); |
242 | return (status == 0x00ff); | 240 | return (status == 0x00ff); |
243 | } | 241 | } |
244 | 242 | ||
@@ -267,15 +265,15 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif) | |||
267 | 265 | ||
268 | local_irq_save(flags); | 266 | local_irq_save(flags); |
269 | /* put config reg into first byte of hwif->select_data */ | 267 | /* put config reg into first byte of hwif->select_data */ |
270 | hwif->OUTB(0x51|(hwif->channel<<3), hwif->config_data+1); | 268 | outb(0x51 | (hwif->channel << 3), hwif->config_data + 1); |
271 | /* select PIO as default */ | 269 | /* select PIO as default */ |
272 | hwif->select_data = 0x21; | 270 | hwif->select_data = 0x21; |
273 | hwif->OUTB(hwif->select_data, hwif->config_data); | 271 | outb(hwif->select_data, hwif->config_data); |
274 | /* get IRQ info */ | 272 | /* get IRQ info */ |
275 | reg = hwif->INB(hwif->config_data+3); | 273 | reg = inb(hwif->config_data + 3); |
276 | /* mask IRQs for both ports */ | 274 | /* mask IRQs for both ports */ |
277 | reg = (reg & 0x10) | 0x03; | 275 | reg = (reg & 0x10) | 0x03; |
278 | hwif->OUTB(reg, hwif->config_data+3); | 276 | outb(reg, hwif->config_data + 3); |
279 | local_irq_restore(flags); | 277 | local_irq_restore(flags); |
280 | 278 | ||
281 | if ((reg & 0x10)) | 279 | if ((reg & 0x10)) |
@@ -308,16 +306,16 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif) | |||
308 | static u16 next_offset = 0; | 306 | static u16 next_offset = 0; |
309 | u8 old_mask; | 307 | u8 old_mask; |
310 | 308 | ||
311 | hwif->OUTB(0x54|(hwif->channel<<3), hwif->config_data+1); | 309 | outb(0x54 | (hwif->channel << 3), hwif->config_data + 1); |
312 | old = hwif->INW(hwif->config_data); | 310 | old = inw(hwif->config_data); |
313 | old &= ~1; | 311 | old &= ~1; |
314 | old_mask = hwif->INB(old+2); | 312 | old_mask = inb(old + 2); |
315 | if (old != compat && old_mask == 0xff) { | 313 | if (old != compat && old_mask == 0xff) { |
316 | /* leave lower 10 bits untouched */ | 314 | /* leave lower 10 bits untouched */ |
317 | compat += (next_offset += 0x400); | 315 | compat += (next_offset += 0x400); |
318 | hwif->io_ports[IDE_CONTROL_OFFSET] = compat + 2; | 316 | hwif->io_ports[IDE_CONTROL_OFFSET] = compat + 2; |
319 | hwif->OUTW(compat|1, hwif->config_data); | 317 | outw(compat | 1, hwif->config_data); |
320 | new = hwif->INW(hwif->config_data); | 318 | new = inw(hwif->config_data); |
321 | printk(KERN_INFO "%s: control basereg workaround: " | 319 | printk(KERN_INFO "%s: control basereg workaround: " |
322 | "old=0x%04x, new=0x%04x\n", | 320 | "old=0x%04x, new=0x%04x\n", |
323 | hwif->name, old, new & ~1); | 321 | hwif->name, old, new & ~1); |