2 * linux/drivers/ide/arm/rapide.c
4 * Copyright (c) 1996-2002 Russell King.
7 #include <linux/module.h>
8 #include <linux/slab.h>
9 #include <linux/blkdev.h>
10 #include <linux/errno.h>
11 #include <linux/ide.h>
12 #include <linux/init.h>
14 #include <asm/ecard.h>
17 rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq)
19 unsigned long port = (unsigned long)base;
20 ide_hwif_t *hwif = ide_find_port(port);
26 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
27 hwif->hw.io_ports[i] = port;
28 hwif->io_ports[i] = port;
31 hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
32 hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
33 hwif->hw.irq = hwif->irq = irq;
35 default_hwif_mmiops(hwif);
41 rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
46 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
48 ret = ecard_request_resources(ec);
52 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
58 hwif = rapide_locate_hwif(base, base + 0x818, 1 << 6, ec->irq);
60 hwif->hwif_data = base;
61 hwif->gendev.parent = &ec->dev;
68 ecard_set_drvdata(ec, hwif);
73 ecard_release_resources(ec);
78 static void __devexit rapide_remove(struct expansion_card *ec)
80 ide_hwif_t *hwif = ecard_get_drvdata(ec);
82 ecard_set_drvdata(ec, NULL);
84 /* there must be a better way */
85 ide_unregister(hwif - ide_hwifs);
86 ecard_release_resources(ec);
89 static struct ecard_id rapide_ids[] = {
90 { MANU_YELLOWSTONE, PROD_YELLOWSTONE_RAPIDE32 },
94 static struct ecard_driver rapide_driver = {
95 .probe = rapide_probe,
96 .remove = __devexit_p(rapide_remove),
97 .id_table = rapide_ids,
103 static int __init rapide_init(void)
105 return ecard_register_driver(&rapide_driver);
108 MODULE_LICENSE("GPL");
109 MODULE_DESCRIPTION("Yellowstone RAPIDE driver");
111 module_init(rapide_init);