libata-scsi: Fix translation of REPORT ZONES command
[linux/fpc-iii.git] / drivers / ide / rapide.c
blobd73c3d10087c72133d5db9bd5902ea1e94758008
1 /*
2 * Copyright (c) 1996-2002 Russell King.
3 */
5 #include <linux/module.h>
6 #include <linux/blkdev.h>
7 #include <linux/errno.h>
8 #include <linux/ide.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;
22 int i;
24 for (i = 0; i <= 7; i++) {
25 hw->io_ports_array[i] = port;
26 port += sz;
28 hw->io_ports.ctl_addr = (unsigned long)ctrl;
29 hw->irq = irq;
32 static int rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
34 void __iomem *base;
35 struct ide_host *host;
36 int ret;
37 struct ide_hw hw, *hws[] = { &hw };
39 ret = ecard_request_resources(ec);
40 if (ret)
41 goto out;
43 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
44 if (!base) {
45 ret = -ENOMEM;
46 goto release;
49 memset(&hw, 0, sizeof(hw));
50 rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq);
51 hw.dev = &ec->dev;
53 ret = ide_host_add(&rapide_port_info, hws, 1, &host);
54 if (ret)
55 goto release;
57 ecard_set_drvdata(ec, host);
58 goto out;
60 release:
61 ecard_release_resources(ec);
62 out:
63 return ret;
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 },
79 { 0xffff, 0xffff }
82 static struct ecard_driver rapide_driver = {
83 .probe = rapide_probe,
84 .remove = rapide_remove,
85 .id_table = rapide_ids,
86 .drv = {
87 .name = "rapide",
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);