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->io_ports[i] = port;
30 hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
33 default_hwif_mmiops(hwif);
39 rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
44 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
46 ret = ecard_request_resources(ec);
50 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
56 hwif = rapide_locate_hwif(base, base + 0x818, 1 << 6, ec->irq);
58 hwif->hwif_data = base;
59 hwif->gendev.parent = &ec->dev;
66 ecard_set_drvdata(ec, hwif);
71 ecard_release_resources(ec);
76 static void __devexit rapide_remove(struct expansion_card *ec)
78 ide_hwif_t *hwif = ecard_get_drvdata(ec);
80 ecard_set_drvdata(ec, NULL);
82 /* there must be a better way */
83 ide_unregister(hwif - ide_hwifs);
84 ecard_release_resources(ec);
87 static struct ecard_id rapide_ids[] = {
88 { MANU_YELLOWSTONE, PROD_YELLOWSTONE_RAPIDE32 },
92 static struct ecard_driver rapide_driver = {
93 .probe = rapide_probe,
94 .remove = __devexit_p(rapide_remove),
95 .id_table = rapide_ids,
101 static int __init rapide_init(void)
103 return ecard_register_driver(&rapide_driver);
106 MODULE_LICENSE("GPL");
107 MODULE_DESCRIPTION("Yellowstone RAPIDE driver");
109 module_init(rapide_init);