2 * Copyright (c) 1996-2002 Russell King.
5 #include <linux/module.h>
6 #include <linux/blkdev.h>
7 #include <linux/errno.h>
9 #include <linux/init.h>
11 #include <asm/ecard.h>
13 static const struct ide_port_info rapide_port_info = {
14 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
15 .chipset = ide_generic,
18 static void rapide_setup_ports(struct ide_hw *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;
32 static int rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
35 struct ide_host *host;
37 struct ide_hw hw, *hws[] = { &hw };
39 ret = ecard_request_resources(ec);
43 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
49 memset(&hw, 0, sizeof(hw));
50 rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq);
53 ret = ide_host_add(&rapide_port_info, hws, 1, &host);
57 ecard_set_drvdata(ec, host);
61 ecard_release_resources(ec);
66 static void rapide_remove(struct expansion_card *ec)
68 struct ide_host *host = ecard_get_drvdata(ec);
70 ecard_set_drvdata(ec, NULL);
72 ide_host_remove(host);
74 ecard_release_resources(ec);
77 static struct ecard_id rapide_ids[] = {
78 { MANU_YELLOWSTONE, PROD_YELLOWSTONE_RAPIDE32 },
82 static struct ecard_driver rapide_driver = {
83 .probe = rapide_probe,
84 .remove = rapide_remove,
85 .id_table = rapide_ids,
91 static int __init rapide_init(void)
93 return ecard_register_driver(&rapide_driver);
96 static void __exit rapide_exit(void)
98 ecard_remove_driver(&rapide_driver);
101 MODULE_LICENSE("GPL");
102 MODULE_DESCRIPTION("Yellowstone RAPIDE driver");
104 module_init(rapide_init);
105 module_exit(rapide_exit);