aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/trm290.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/trm290.c')
-rw-r--r--drivers/ide/pci/trm290.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
index de750f7a43e9..a8a3138682ef 100644
--- a/drivers/ide/pci/trm290.c
+++ b/drivers/ide/pci/trm290.c
@@ -214,7 +214,7 @@ static void trm290_dma_start(ide_drive_t *drive)
214{ 214{
215} 215}
216 216
217static int trm290_ide_dma_end (ide_drive_t *drive) 217static int trm290_dma_end(ide_drive_t *drive)
218{ 218{
219 u16 status; 219 u16 status;
220 220
@@ -225,7 +225,7 @@ static int trm290_ide_dma_end (ide_drive_t *drive)
225 return status != 0x00ff; 225 return status != 0x00ff;
226} 226}
227 227
228static int trm290_ide_dma_test_irq (ide_drive_t *drive) 228static int trm290_dma_test_irq(ide_drive_t *drive)
229{ 229{
230 u16 status; 230 u16 status;
231 231
@@ -254,22 +254,11 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
254 hwif->config_data = cfg_base; 254 hwif->config_data = cfg_base;
255 hwif->dma_base = (cfg_base + 4) ^ (hwif->channel ? 0x80 : 0); 255 hwif->dma_base = (cfg_base + 4) ^ (hwif->channel ? 0x80 : 0);
256 256
257 printk(KERN_INFO " %s: BM-DMA at 0x%04lx-0x%04lx", 257 printk(KERN_INFO " %s: BM-DMA at 0x%04lx-0x%04lx\n",
258 hwif->name, hwif->dma_base, hwif->dma_base + 3); 258 hwif->name, hwif->dma_base, hwif->dma_base + 3);
259 259
260 if (!request_region(hwif->dma_base, 4, hwif->name)) { 260 if (ide_allocate_dma_engine(hwif))
261 printk(KERN_CONT " -- Error, ports in use.\n");
262 return; 261 return;
263 }
264
265 hwif->dmatable_cpu = pci_alloc_consistent(dev, PRD_ENTRIES * PRD_BYTES,
266 &hwif->dmatable_dma);
267 if (!hwif->dmatable_cpu) {
268 printk(KERN_CONT " -- Error, unable to allocate DMA table.\n");
269 release_region(hwif->dma_base, 4);
270 return;
271 }
272 printk(KERN_CONT "\n");
273 262
274 local_irq_save(flags); 263 local_irq_save(flags);
275 /* put config reg into first byte of hwif->select_data */ 264 /* put config reg into first byte of hwif->select_data */
@@ -291,14 +280,6 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
291 /* sharing IRQ with mate */ 280 /* sharing IRQ with mate */
292 hwif->irq = hwif->mate->irq; 281 hwif->irq = hwif->mate->irq;
293 282
294 hwif->dma_host_set = &trm290_dma_host_set;
295 hwif->dma_setup = &trm290_dma_setup;
296 hwif->dma_exec_cmd = &trm290_dma_exec_cmd;
297 hwif->dma_start = &trm290_dma_start;
298 hwif->ide_dma_end = &trm290_ide_dma_end;
299 hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq;
300
301 hwif->selectproc = &trm290_selectproc;
302#if 1 283#if 1
303 { 284 {
304 /* 285 /*
@@ -317,7 +298,7 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
317 if (old != compat && old_mask == 0xff) { 298 if (old != compat && old_mask == 0xff) {
318 /* leave lower 10 bits untouched */ 299 /* leave lower 10 bits untouched */
319 compat += (next_offset += 0x400); 300 compat += (next_offset += 0x400);
320 hwif->io_ports[IDE_CONTROL_OFFSET] = compat + 2; 301 hwif->io_ports.ctl_addr = compat + 2;
321 outw(compat | 1, hwif->config_data); 302 outw(compat | 1, hwif->config_data);
322 new = inw(hwif->config_data); 303 new = inw(hwif->config_data);
323 printk(KERN_INFO "%s: control basereg workaround: " 304 printk(KERN_INFO "%s: control basereg workaround: "
@@ -328,16 +309,32 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
328#endif 309#endif
329} 310}
330 311
312static const struct ide_port_ops trm290_port_ops = {
313 .selectproc = trm290_selectproc,
314};
315
316static struct ide_dma_ops trm290_dma_ops = {
317 .dma_host_set = trm290_dma_host_set,
318 .dma_setup = trm290_dma_setup,
319 .dma_exec_cmd = trm290_dma_exec_cmd,
320 .dma_start = trm290_dma_start,
321 .dma_end = trm290_dma_end,
322 .dma_test_irq = trm290_dma_test_irq,
323 .dma_lost_irq = ide_dma_lost_irq,
324 .dma_timeout = ide_dma_timeout,
325};
326
331static const struct ide_port_info trm290_chipset __devinitdata = { 327static const struct ide_port_info trm290_chipset __devinitdata = {
332 .name = "TRM290", 328 .name = "TRM290",
333 .init_hwif = init_hwif_trm290, 329 .init_hwif = init_hwif_trm290,
334 .chipset = ide_trm290, 330 .chipset = ide_trm290,
331 .port_ops = &trm290_port_ops,
332 .dma_ops = &trm290_dma_ops,
335 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | 333 .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
336#if 0 /* play it safe for now */ 334#if 0 /* play it safe for now */
337 IDE_HFLAG_TRUST_BIOS_FOR_DMA | 335 IDE_HFLAG_TRUST_BIOS_FOR_DMA |
338#endif 336#endif
339 IDE_HFLAG_NO_AUTODMA | 337 IDE_HFLAG_NO_AUTODMA |
340 IDE_HFLAG_BOOTABLE |
341 IDE_HFLAG_NO_LBA48, 338 IDE_HFLAG_NO_LBA48,
342}; 339};
343 340