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 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
;
20 for (i
= IDE_DATA_OFFSET
; i
<= IDE_STATUS_OFFSET
; i
++) {
21 hw
->io_ports
[i
] = port
;
24 hw
->io_ports
[IDE_CONTROL_OFFSET
] = (unsigned long)ctrl
;
29 rapide_probe(struct expansion_card
*ec
, const struct ecard_id
*id
)
34 u8 idx
[4] = { 0xff, 0xff, 0xff, 0xff };
37 ret
= ecard_request_resources(ec
);
41 base
= ecardm_iomap(ec
, ECARD_RES_MEMC
, 0, 0);
47 hwif
= ide_find_port((unsigned long)base
);
49 memset(&hw
, 0, sizeof(hw
));
50 rapide_setup_ports(&hw
, base
, base
+ 0x818, 1 << 6, ec
->irq
);
51 hw
.chipset
= ide_generic
;
54 ide_init_port_hw(hwif
, &hw
);
57 default_hwif_mmiops(hwif
);
61 ide_device_add(idx
, NULL
);
63 ecard_set_drvdata(ec
, hwif
);
68 ecard_release_resources(ec
);
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
},
89 static struct ecard_driver rapide_driver
= {
90 .probe
= rapide_probe
,
91 .remove
= __devexit_p(rapide_remove
),
92 .id_table
= rapide_ids
,
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
);