aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-17 18:46:23 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-17 18:46:23 -0400
commit2dde7861afa23cd59db83515cb0b810b92b220aa (patch)
treee2cfda1c75d2157fde3801d29e2bcbebf1d5a129 /drivers/macintosh
parent26042d058ba21305aeb8ac92e4b1483dbec642ac (diff)
ide: rework PowerMac media-bay support (take 2)
Rework PowerMac media-bay support in such way that instead of un/registering the IDE interface we un/register IDE devices: * Add ide_port_scan() helper for probing+registerering devices on a port. * Rename ide_port_unregister_devices() to __ide_port_unregister_devices(). * Add ide_port_unregister_devices() helper for unregistering devices on a port. * Add 'ide_hwif_t *cd_port' to 'struct media_bay_info', pass 'hwif' instead of hwif->index to media_bay_set_ide_infos() and use it to setup 'cd_port'. * Use ide_port_unregister_devices() instead of ide_unregister() and ide_port_scan() instead of ide_register_hw() in media_bay_step(). * Unexport ide_register_hw() and make it static. v2: * Fix build by adding <linux/ide.h> include to <asm-powerpc/mediabay.h>. (Reported by Michael/Kamalesh/Andrew). Cc: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Cc: Michael Ellerman <michael@ellerman.id.au> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/mediabay.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index bd8a1d14b45d..82add26cc665 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -79,6 +79,7 @@ struct media_bay_info {
79 int sleeping; 79 int sleeping;
80 struct semaphore lock; 80 struct semaphore lock;
81#ifdef CONFIG_BLK_DEV_IDE_PMAC 81#ifdef CONFIG_BLK_DEV_IDE_PMAC
82 ide_hwif_t *cd_port;
82 void __iomem *cd_base; 83 void __iomem *cd_base;
83 int cd_irq; 84 int cd_irq;
84 int cd_retry; 85 int cd_retry;
@@ -448,7 +449,7 @@ int check_media_bay_by_base(unsigned long base, int what)
448} 449}
449 450
450int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base, 451int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base,
451 int irq, int index) 452 int irq, ide_hwif_t *hwif)
452{ 453{
453 int i; 454 int i;
454 455
@@ -456,10 +457,11 @@ int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base,
456 struct media_bay_info* bay = &media_bays[i]; 457 struct media_bay_info* bay = &media_bays[i];
457 458
458 if (bay->mdev && which_bay == bay->mdev->ofdev.node) { 459 if (bay->mdev && which_bay == bay->mdev->ofdev.node) {
459 int timeout = 5000; 460 int timeout = 5000, index = hwif->index;
460 461
461 down(&bay->lock); 462 down(&bay->lock);
462 463
464 bay->cd_port = hwif;
463 bay->cd_base = (void __iomem *) base; 465 bay->cd_base = (void __iomem *) base;
464 bay->cd_irq = irq; 466 bay->cd_irq = irq;
465 467
@@ -551,15 +553,10 @@ static void media_bay_step(int i)
551 bay->timer = 0; 553 bay->timer = 0;
552 bay->state = mb_up; 554 bay->state = mb_up;
553 if (bay->cd_index < 0) { 555 if (bay->cd_index < 0) {
554 hw_regs_t hw;
555
556 printk("mediabay %d, registering IDE...\n", i); 556 printk("mediabay %d, registering IDE...\n", i);
557 pmu_suspend(); 557 pmu_suspend();
558 ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL); 558 ide_port_scan(bay->cd_port);
559 hw.irq = bay->cd_irq; 559 bay->cd_index = bay->cd_port->index;
560 hw.chipset = ide_pmac;
561 bay->cd_index =
562 ide_register_hw(&hw, NULL, NULL);
563 pmu_resume(); 560 pmu_resume();
564 } 561 }
565 if (bay->cd_index == -1) { 562 if (bay->cd_index == -1) {
@@ -589,7 +586,7 @@ static void media_bay_step(int i)
589 if (bay->cd_index >= 0) { 586 if (bay->cd_index >= 0) {
590 printk(KERN_DEBUG "Unregistering mb %d ide, index:%d\n", i, 587 printk(KERN_DEBUG "Unregistering mb %d ide, index:%d\n", i,
591 bay->cd_index); 588 bay->cd_index);
592 ide_unregister(bay->cd_index, 1, 1); 589 ide_port_unregister_devices(bay->cd_port);
593 bay->cd_index = -1; 590 bay->cd_index = -1;
594 } 591 }
595 if (bay->cd_retry) { 592 if (bay->cd_retry) {