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 * Something like this really should be in generic code, but isn't.
20 rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq)
22 unsigned long port = (unsigned long)base;
26 for (index = 0; index < MAX_HWIFS; ++index) {
27 hwif = ide_hwifs + index;
28 if (hwif->io_ports[IDE_DATA_OFFSET] == port)
32 for (index = 0; index < MAX_HWIFS; ++index) {
33 hwif = ide_hwifs + index;
34 if (hwif->io_ports[IDE_DATA_OFFSET] == 0)
41 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
42 hwif->hw.io_ports[i] = port;
43 hwif->io_ports[i] = port;
46 hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
47 hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
48 hwif->hw.irq = hwif->irq = irq;
50 default_hwif_mmiops(hwif);
56 rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
62 ret = ecard_request_resources(ec);
66 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
72 hwif = rapide_locate_hwif(base, base + 0x818, 1 << 6, ec->irq);
74 hwif->hwif_data = base;
75 hwif->gendev.parent = &ec->dev;
77 probe_hwif_init(hwif);
78 ide_proc_register_port(hwif);
79 ecard_set_drvdata(ec, hwif);
84 ecard_release_resources(ec);
89 static void __devexit rapide_remove(struct expansion_card *ec)
91 ide_hwif_t *hwif = ecard_get_drvdata(ec);
93 ecard_set_drvdata(ec, NULL);
95 /* there must be a better way */
96 ide_unregister(hwif - ide_hwifs);
97 ecard_release_resources(ec);
100 static struct ecard_id rapide_ids[] = {
101 { MANU_YELLOWSTONE, PROD_YELLOWSTONE_RAPIDE32 },
105 static struct ecard_driver rapide_driver = {
106 .probe = rapide_probe,
107 .remove = __devexit_p(rapide_remove),
108 .id_table = rapide_ids,
114 static int __init rapide_init(void)
116 return ecard_register_driver(&rapide_driver);
119 MODULE_LICENSE("GPL");
120 MODULE_DESCRIPTION("Yellowstone RAPIDE driver");
122 module_init(rapide_init);