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>
16 static void rapide_setup_ports(hw_regs_t *hw, void __iomem *base,
17 void __iomem *ctrl, unsigned int sz, int irq)
19 unsigned long port = (unsigned long)base;
22 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
23 hw->io_ports[i] = port;
26 hw->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
31 rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
36 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
39 ret = ecard_request_resources(ec);
43 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
49 hwif = ide_find_port((unsigned long)base);
51 memset(&hw, 0, sizeof(hw));
52 rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq);
53 hw.chipset = ide_generic;
56 ide_init_port_hw(hwif, &hw);
59 default_hwif_mmiops(hwif);
65 ecard_set_drvdata(ec, hwif);
70 ecard_release_resources(ec);
75 static void __devexit rapide_remove(struct expansion_card *ec)
77 ide_hwif_t *hwif = ecard_get_drvdata(ec);
79 ecard_set_drvdata(ec, NULL);
81 /* there must be a better way */
82 ide_unregister(hwif - ide_hwifs);
83 ecard_release_resources(ec);
86 static struct ecard_id rapide_ids[] = {
87 { MANU_YELLOWSTONE, PROD_YELLOWSTONE_RAPIDE32 },
91 static struct ecard_driver rapide_driver = {
92 .probe = rapide_probe,
93 .remove = __devexit_p(rapide_remove),
94 .id_table = rapide_ids,
100 static int __init rapide_init(void)
102 return ecard_register_driver(&rapide_driver);
105 MODULE_LICENSE("GPL");
106 MODULE_DESCRIPTION("Yellowstone RAPIDE driver");
108 module_init(rapide_init);