aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-19 18:32:30 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-19 18:32:30 -0400
commitcaea7602f309cbd55ba609800fd3c3e5d19ab684 (patch)
treefbf1fab750452317a1a38f9ec38b18ad6b1323c3 /drivers
parent272a370900e5d2ae84662338397bb7b2375ff5cf (diff)
ide: add IDE_HFLAG_{IO_32BIT,UNMASK_IRQS} host flags
Add IDE_HFLAG_{IO_32BIT,UNMASK_IRQS} host flag to tell ide_pci_setup_ports() to set drive->{io_32bit,unmask} for both drives on the interface. Convert amd74xx, sl82c105 and via82cxxx host drivers to use these new host flags. While at it: * Add IDE_HFLAGS_AMD define (amd74xx host driver). * Add IDE_HFLAGS_VIA define (via82cxxx host driver). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/pci/amd74xx.c25
-rw-r--r--drivers/ide/pci/sl82c105.c12
-rw-r--r--drivers/ide/pci/via82cxxx.c31
-rw-r--r--drivers/ide/setup-pci.c10
4 files changed, 38 insertions, 40 deletions
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index 7cafefbf6c1b..f6aa1d7f3fc3 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -242,19 +242,12 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch
242 242
243static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) 243static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
244{ 244{
245 int i;
246
247 if (hwif->irq == 0) /* 0 is bogus but will do for now */ 245 if (hwif->irq == 0) /* 0 is bogus but will do for now */
248 hwif->irq = pci_get_legacy_ide_irq(hwif->pci_dev, hwif->channel); 246 hwif->irq = pci_get_legacy_ide_irq(hwif->pci_dev, hwif->channel);
249 247
250 hwif->set_pio_mode = &amd_set_pio_mode; 248 hwif->set_pio_mode = &amd_set_pio_mode;
251 hwif->set_dma_mode = &amd_set_drive; 249 hwif->set_dma_mode = &amd_set_drive;
252 250
253 for (i = 0; i < 2; i++) {
254 hwif->drives[i].io_32bit = 1;
255 hwif->drives[i].unmask = 1;
256 }
257
258 if (!hwif->dma_base) 251 if (!hwif->dma_base)
259 return; 252 return;
260 253
@@ -270,16 +263,21 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
270 } 263 }
271} 264}
272 265
266#define IDE_HFLAGS_AMD \
267 (IDE_HFLAG_PIO_NO_BLACKLIST | \
268 IDE_HFLAG_PIO_NO_DOWNGRADE | \
269 IDE_HFLAG_POST_SET_MODE | \
270 IDE_HFLAG_IO_32BIT | \
271 IDE_HFLAG_UNMASK_IRQS | \
272 IDE_HFLAG_BOOTABLE)
273
273#define DECLARE_AMD_DEV(name_str) \ 274#define DECLARE_AMD_DEV(name_str) \
274 { \ 275 { \
275 .name = name_str, \ 276 .name = name_str, \
276 .init_chipset = init_chipset_amd74xx, \ 277 .init_chipset = init_chipset_amd74xx, \
277 .init_hwif = init_hwif_amd74xx, \ 278 .init_hwif = init_hwif_amd74xx, \
278 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ 279 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \
279 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | \ 280 .host_flags = IDE_HFLAGS_AMD, \
280 IDE_HFLAG_PIO_NO_DOWNGRADE | \
281 IDE_HFLAG_POST_SET_MODE | \
282 IDE_HFLAG_BOOTABLE, \
283 .pio_mask = ATA_PIO5, \ 281 .pio_mask = ATA_PIO5, \
284 .swdma_mask = ATA_SWDMA2, \ 282 .swdma_mask = ATA_SWDMA2, \
285 .mwdma_mask = ATA_MWDMA2, \ 283 .mwdma_mask = ATA_MWDMA2, \
@@ -291,10 +289,7 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
291 .init_chipset = init_chipset_amd74xx, \ 289 .init_chipset = init_chipset_amd74xx, \
292 .init_hwif = init_hwif_amd74xx, \ 290 .init_hwif = init_hwif_amd74xx, \
293 .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ 291 .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \
294 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | \ 292 .host_flags = IDE_HFLAGS_AMD, \
295 IDE_HFLAG_PIO_NO_DOWNGRADE | \
296 IDE_HFLAG_POST_SET_MODE | \
297 IDE_HFLAG_BOOTABLE, \
298 .pio_mask = ATA_PIO5, \ 293 .pio_mask = ATA_PIO5, \
299 .swdma_mask = ATA_SWDMA2, \ 294 .swdma_mask = ATA_SWDMA2, \
300 .mwdma_mask = ATA_MWDMA2, \ 295 .mwdma_mask = ATA_MWDMA2, \
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index 0dce459b1269..7b5f7b6d3e0d 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -361,13 +361,6 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
361 hwif->selectproc = &sl82c105_selectproc; 361 hwif->selectproc = &sl82c105_selectproc;
362 hwif->resetproc = &sl82c105_resetproc; 362 hwif->resetproc = &sl82c105_resetproc;
363 363
364 /*
365 * We support 32-bit I/O on this interface, and
366 * it doesn't have problems with interrupts.
367 */
368 hwif->drives[0].io_32bit = hwif->drives[1].io_32bit = 1;
369 hwif->drives[0].unmask = hwif->drives[1].unmask = 1;
370
371 if (!hwif->dma_base) 364 if (!hwif->dma_base)
372 return; 365 return;
373 366
@@ -399,7 +392,10 @@ static ide_pci_device_t sl82c105_chipset __devinitdata = {
399 .init_chipset = init_chipset_sl82c105, 392 .init_chipset = init_chipset_sl82c105,
400 .init_hwif = init_hwif_sl82c105, 393 .init_hwif = init_hwif_sl82c105,
401 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, 394 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}},
402 .host_flags = IDE_HFLAG_NO_AUTODMA | IDE_HFLAG_BOOTABLE, 395 .host_flags = IDE_HFLAG_IO_32BIT |
396 IDE_HFLAG_UNMASK_IRQS |
397 IDE_HFLAG_NO_AUTODMA |
398 IDE_HFLAG_BOOTABLE,
403 .pio_mask = ATA_PIO5, 399 .pio_mask = ATA_PIO5,
404}; 400};
405 401
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index 27e5b410123a..14979f4df362 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -422,17 +422,9 @@ static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif)
422 422
423static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) 423static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif)
424{ 424{
425 struct via82cxxx_dev *vdev = pci_get_drvdata(hwif->pci_dev);
426 int i;
427
428 hwif->set_pio_mode = &via_set_pio_mode; 425 hwif->set_pio_mode = &via_set_pio_mode;
429 hwif->set_dma_mode = &via_set_drive; 426 hwif->set_dma_mode = &via_set_drive;
430 427
431 for (i = 0; i < 2; i++) {
432 hwif->drives[i].io_32bit = 1;
433 hwif->drives[i].unmask = (vdev->via_config->flags & VIA_NO_UNMASK) ? 0 : 1;
434 }
435
436 if (!hwif->dma_base) 428 if (!hwif->dma_base)
437 return; 429 return;
438 430
@@ -440,17 +432,20 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif)
440 hwif->cbl = via82cxxx_cable_detect(hwif); 432 hwif->cbl = via82cxxx_cable_detect(hwif);
441} 433}
442 434
435#define IDE_HFLAGS_VIA \
436 (IDE_HFLAG_PIO_NO_BLACKLIST | \
437 IDE_HFLAG_PIO_NO_DOWNGRADE | \
438 IDE_HFLAG_POST_SET_MODE | \
439 IDE_HFLAG_IO_32BIT | \
440 IDE_HFLAG_BOOTABLE)
441
443static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { 442static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = {
444 { /* 0 */ 443 { /* 0 */
445 .name = "VP_IDE", 444 .name = "VP_IDE",
446 .init_chipset = init_chipset_via82cxxx, 445 .init_chipset = init_chipset_via82cxxx,
447 .init_hwif = init_hwif_via82cxxx, 446 .init_hwif = init_hwif_via82cxxx,
448 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, 447 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
449 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | 448 .host_flags = IDE_HFLAGS_VIA | IDE_HFLAG_NO_AUTODMA,
450 IDE_HFLAG_PIO_NO_DOWNGRADE |
451 IDE_HFLAG_POST_SET_MODE |
452 IDE_HFLAG_NO_AUTODMA |
453 IDE_HFLAG_BOOTABLE,
454 .pio_mask = ATA_PIO5, 449 .pio_mask = ATA_PIO5,
455 .swdma_mask = ATA_SWDMA2, 450 .swdma_mask = ATA_SWDMA2,
456 .mwdma_mask = ATA_MWDMA2, 451 .mwdma_mask = ATA_MWDMA2,
@@ -459,10 +454,7 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = {
459 .init_chipset = init_chipset_via82cxxx, 454 .init_chipset = init_chipset_via82cxxx,
460 .init_hwif = init_hwif_via82cxxx, 455 .init_hwif = init_hwif_via82cxxx,
461 .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, 456 .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
462 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | 457 .host_flags = IDE_HFLAGS_VIA,
463 IDE_HFLAG_PIO_NO_DOWNGRADE |
464 IDE_HFLAG_POST_SET_MODE |
465 IDE_HFLAG_BOOTABLE,
466 .pio_mask = ATA_PIO5, 458 .pio_mask = ATA_PIO5,
467 .swdma_mask = ATA_SWDMA2, 459 .swdma_mask = ATA_SWDMA2,
468 .mwdma_mask = ATA_MWDMA2, 460 .mwdma_mask = ATA_MWDMA2,
@@ -485,6 +477,11 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i
485 return -ENODEV; 477 return -ENODEV;
486 } 478 }
487 479
480 if (via_config->flags & VIA_NO_UNMASK)
481 d->host_flags &= ~IDE_HFLAG_UNMASK_IRQS;
482 else
483 d->host_flags |= IDE_HFLAG_UNMASK_IRQS;
484
488#ifdef CONFIG_PPC_CHRP 485#ifdef CONFIG_PPC_CHRP
489 if (machine_is(chrp) && _chrp_type == _CHRP_Pegasos) 486 if (machine_is(chrp) && _chrp_type == _CHRP_Pegasos)
490 d->host_flags |= IDE_HFLAG_FORCE_LEGACY_IRQS; 487 d->host_flags |= IDE_HFLAG_FORCE_LEGACY_IRQS;
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index a1d7efc9eaaf..d62b225f569f 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -573,6 +573,16 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
573 if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate) 573 if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate)
574 hwif->mate->serialized = hwif->serialized = 1; 574 hwif->mate->serialized = hwif->serialized = 1;
575 575
576 if (d->host_flags & IDE_HFLAG_IO_32BIT) {
577 hwif->drives[0].io_32bit = 1;
578 hwif->drives[1].io_32bit = 1;
579 }
580
581 if (d->host_flags & IDE_HFLAG_UNMASK_IRQS) {
582 hwif->drives[0].unmask = 1;
583 hwif->drives[1].unmask = 1;
584 }
585
576 if (hwif->dma_base) { 586 if (hwif->dma_base) {
577 hwif->swdma_mask = d->swdma_mask; 587 hwif->swdma_mask = d->swdma_mask;
578 hwif->mwdma_mask = d->mwdma_mask; 588 hwif->mwdma_mask = d->mwdma_mask;