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
;
33 rapide_probe(struct expansion_card
*ec
, const struct ecard_id
*id
)
36 struct ide_host
*host
;
38 struct ide_hw hw
, *hws
[] = { &hw
};
40 ret
= ecard_request_resources(ec
);
44 base
= ecardm_iomap(ec
, ECARD_RES_MEMC
, 0, 0);
50 memset(&hw
, 0, sizeof(hw
));
51 rapide_setup_ports(&hw
, base
, base
+ 0x818, 1 << 6, ec
->irq
);
54 ret
= ide_host_add(&rapide_port_info
, hws
, 1, &host
);
58 ecard_set_drvdata(ec
, host
);
62 ecard_release_resources(ec
);
67 static void __devexit
rapide_remove(struct expansion_card
*ec
)
69 struct ide_host
*host
= ecard_get_drvdata(ec
);
71 ecard_set_drvdata(ec
, NULL
);
73 ide_host_remove(host
);
75 ecard_release_resources(ec
);
78 static struct ecard_id rapide_ids
[] = {
79 { MANU_YELLOWSTONE
, PROD_YELLOWSTONE_RAPIDE32
},
83 static struct ecard_driver rapide_driver
= {
84 .probe
= rapide_probe
,
85 .remove
= __devexit_p(rapide_remove
),
86 .id_table
= rapide_ids
,
92 static int __init
rapide_init(void)
94 return ecard_register_driver(&rapide_driver
);
97 static void __exit
rapide_exit(void)
99 ecard_remove_driver(&rapide_driver
);
102 MODULE_LICENSE("GPL");
103 MODULE_DESCRIPTION("Yellowstone RAPIDE driver");
105 module_init(rapide_init
);
106 module_exit(rapide_exit
);