Import 2.3.25pre1
[davej-history.git] / drivers / block / rapide.c
blob468f2e3b1bc777aa0f13907208d2045c0f492627
1 /*
2 * linux/arch/arm/drivers/block/ide-rapide.c
4 * Copyright (c) 1996-1998 Russell King.
6 * Changelog:
7 * 08-06-1996 RMK Created
8 * 13-04-1998 RMK Added manufacturer and product IDs
9 */
11 #include <linux/module.h>
12 #include <linux/malloc.h>
13 #include <linux/blkdev.h>
14 #include <linux/errno.h>
15 #include <linux/ide.h>
17 #include <asm/ecard.h>
19 static const card_ids rapide_cids[] = {
20 { MANU_YELLOWSTONE, PROD_YELLOWSTONE_RAPIDE32 },
21 { 0xffff, 0xffff }
24 static struct expansion_card *ec[MAX_ECARDS];
25 static int result[MAX_ECARDS];
27 static inline int rapide_register(struct expansion_card *ec)
29 unsigned long port = ecard_address (ec, ECARD_MEMC, 0);
30 hw_regs_t hw;
32 int i;
34 memset(&hw, 0, sizeof(hw));
36 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
37 hw.io_ports[i] = (ide_ioreg_t)port;
38 port += 1 << 4;
40 hw.io_ports[IDE_CONTROL_OFFSET] = port + 0x206;
41 hw.irq = ec->irq;
43 return ide_register_hw(&hw, NULL);
46 int rapide_init(void)
48 int i;
50 for (i = 0; i < MAX_ECARDS; i++)
51 ec[i] = NULL;
53 ecard_startfind();
55 for (i = 0; ; i++) {
56 if ((ec[i] = ecard_find(0, rapide_cids)) == NULL)
57 break;
59 ecard_claim(ec[i]);
60 result[i] = rapide_register(ec[i]);
62 for (i = 0; i < MAX_ECARDS; i++)
63 if (ec[i] && result[i] < 0) {
64 ecard_release(ec[i]);
65 ec[i] = NULL;
67 return 0;
70 #ifdef MODULE
72 int init_module (void)
74 return rapide_init();
77 void cleanup_module (void)
79 int i;
81 for (i = 0; i < MAX_ECARDS; i++)
82 if (ec[i]) {
83 unsigned long port;
84 port = ecard_address(ec[i], ECARD_MEMC, 0);
86 ide_unregister_port(port, ec[i]->irq, 16);
87 ecard_release(ec[i]);
88 ec[i] = NULL;
91 #endif