iwlwifi: introduce host commands callbacks
[linux/fpc-iii.git] / drivers / ide / arm / rapide.c
blobefba00d2fc37bf4de6c20b35a46b5ee02b7c4663
1 /*
2 * Copyright (c) 1996-2002 Russell King.
3 */
5 #include <linux/module.h>
6 #include <linux/slab.h>
7 #include <linux/blkdev.h>
8 #include <linux/errno.h>
9 #include <linux/ide.h>
10 #include <linux/init.h>
12 #include <asm/ecard.h>
14 static void rapide_setup_ports(hw_regs_t *hw, void __iomem *base,
15 void __iomem *ctrl, unsigned int sz, int irq)
17 unsigned long port = (unsigned long)base;
18 int i;
20 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
21 hw->io_ports[i] = port;
22 port += sz;
24 hw->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
25 hw->irq = irq;
28 static int __devinit
29 rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
31 ide_hwif_t *hwif;
32 void __iomem *base;
33 int ret;
34 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
35 hw_regs_t hw;
37 ret = ecard_request_resources(ec);
38 if (ret)
39 goto out;
41 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
42 if (!base) {
43 ret = -ENOMEM;
44 goto release;
47 hwif = ide_find_port((unsigned long)base);
48 if (hwif) {
49 memset(&hw, 0, sizeof(hw));
50 rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq);
51 hw.chipset = ide_generic;
52 hw.dev = &ec->dev;
54 ide_init_port_hw(hwif, &hw);
56 hwif->mmio = 1;
57 default_hwif_mmiops(hwif);
59 idx[0] = hwif->index;
61 ide_device_add(idx, NULL);
63 ecard_set_drvdata(ec, hwif);
64 goto out;
67 release:
68 ecard_release_resources(ec);
69 out:
70 return ret;
73 static void __devexit rapide_remove(struct expansion_card *ec)
75 ide_hwif_t *hwif = ecard_get_drvdata(ec);
77 ecard_set_drvdata(ec, NULL);
79 ide_unregister(hwif->index, 0, 0);
81 ecard_release_resources(ec);
84 static struct ecard_id rapide_ids[] = {
85 { MANU_YELLOWSTONE, PROD_YELLOWSTONE_RAPIDE32 },
86 { 0xffff, 0xffff }
89 static struct ecard_driver rapide_driver = {
90 .probe = rapide_probe,
91 .remove = __devexit_p(rapide_remove),
92 .id_table = rapide_ids,
93 .drv = {
94 .name = "rapide",
98 static int __init rapide_init(void)
100 return ecard_register_driver(&rapide_driver);
103 MODULE_LICENSE("GPL");
104 MODULE_DESCRIPTION("Yellowstone RAPIDE driver");
106 module_init(rapide_init);