2 * Copyright (c) 1996-2002 Russell King.
5 #include <linux/module.h>
6 #include <linux/slab.h>
7 #include <linux/blkdev.h>
8 #include <linux/errno.h>
10 #include <linux/init.h>
12 #include <asm/ecard.h>
14 static struct const ide_port_info rapide_port_info = {
15 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
18 static void rapide_setup_ports(hw_regs_t *hw, void __iomem *base,
19 void __iomem *ctrl, unsigned int sz, int irq)
21 unsigned long port = (unsigned long)base;
24 for (i = 0; i <= 7; i++) {
25 hw->io_ports_array[i] = port;
28 hw->io_ports.ctl_addr = (unsigned long)ctrl;
33 rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
38 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
39 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
41 ret = ecard_request_resources(ec);
45 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
51 memset(&hw, 0, sizeof(hw));
52 rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq);
53 hw.chipset = ide_generic;
56 hwif = ide_find_port();
62 default_hwif_mmiops(hwif);
66 ide_device_add(idx, &rapide_port_info, hws);
68 ecard_set_drvdata(ec, hwif);
72 ecard_release_resources(ec);
77 static void __devexit rapide_remove(struct expansion_card *ec)
79 ide_hwif_t *hwif = ecard_get_drvdata(ec);
81 ecard_set_drvdata(ec, NULL);
85 ecard_release_resources(ec);
88 static struct ecard_id rapide_ids[] = {
89 { MANU_YELLOWSTONE, PROD_YELLOWSTONE_RAPIDE32 },
93 static struct ecard_driver rapide_driver = {
94 .probe = rapide_probe,
95 .remove = __devexit_p(rapide_remove),
96 .id_table = rapide_ids,
102 static int __init rapide_init(void)
104 return ecard_register_driver(&rapide_driver);
107 MODULE_LICENSE("GPL");
108 MODULE_DESCRIPTION("Yellowstone RAPIDE driver");
110 module_init(rapide_init);