summaryrefslogtreecommitdiff
path: root/drivers/ide/arm/rapide.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-26 20:13:05 +0100
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-26 20:13:05 +0100
commit57c802e84f9c759c3d1794a9dbe81bc10444df62 (patch)
treee8774704b3394b12efbb787022cc11b48a13dec0 /drivers/ide/arm/rapide.c
parent8f8e8483f667d79739007b25f0e59a540fb9fa51 (diff)
ide: add ide_init_port_hw() helper
* Add ide_init_port_hw() helper. * rapide.c: convert rapide_locate_hwif() to rapide_setup_ports() and use ide_init_port_hw(). * ide_platform.c: convert plat_ide_locate_hwif() to plat_ide_setup_ports() and use ide_init_port_hw(). * sgiioc4.c: use ide_init_port_hw(). * pmac.c: add 'hw_regs_t *hw' argument to pmac_ide_setup_device(), setup 'hw' in pmac_ide_{macio,pci}_attach() and use ide_init_port_hw() in pmac_ide_setup_device(). This patch is a preparation for the future changes in the IDE probing code. There should be no functionality changes caused by this patch. Cc: Russell King <rmk@arm.linux.org.uk> Cc: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: Jeremy Higdon <jeremy@sgi.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/arm/rapide.c')
-rw-r--r--drivers/ide/arm/rapide.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c
index c709d37ec095..0267467d1796 100644
--- a/drivers/ide/arm/rapide.c
+++ b/drivers/ide/arm/rapide.c
@@ -13,26 +13,18 @@
#include <asm/ecard.h>
-static ide_hwif_t *
-rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq)
+static void rapide_setup_ports(hw_regs_t *hw, void __iomem *base,
+ void __iomem *ctrl, unsigned int sz, int irq)
{
unsigned long port = (unsigned long)base;
- ide_hwif_t *hwif = ide_find_port(port);
int i;
- if (hwif == NULL)
- goto out;
-
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
- hwif->io_ports[i] = port;
+ hw->io_ports[i] = port;
port += sz;
}
- hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
- hwif->irq = irq;
- hwif->mmio = 1;
- default_hwif_mmiops(hwif);
-out:
- return hwif;
+ hw->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
+ hw->irq = irq;
}
static int __devinit
@@ -42,6 +34,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
void __iomem *base;
int ret;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
+ hw_regs_t hw;
ret = ecard_request_resources(ec);
if (ret)
@@ -53,12 +46,19 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
goto release;
}
- hwif = rapide_locate_hwif(base, base + 0x818, 1 << 6, ec->irq);
+ hwif = ide_find_port((unsigned long)base);
if (hwif) {
- hwif->chipset = ide_generic;
+ memset(&hw, 0, sizeof(hw));
+ rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq);
+ hw.chipset = ide_generic;
+ hw.dev = &ec->dev;
+
+ ide_init_port_hw(hwif, &hw);
+
+ hwif->mmio = 1;
+ default_hwif_mmiops(hwif);
+
hwif->hwif_data = base;
- hwif->gendev.parent = &ec->dev;
- hwif->noprobe = 0;
idx[0] = hwif->index;