15 #include <linux/module.h>
16 #include <linux/types.h>
17 #include <linux/kernel.h>
18 #include <linux/pci.h>
24 #define DRV_NAME "cs5530"
31 static unsigned int cs5530_pio_timings[2][5] = {
32 {0x00009172, 0x00012171, 0x00020080, 0x00032010, 0x00040010},
33 {0xd1329172, 0x71212171, 0x30200080, 0x20102010, 0x00100010}
39 #define CS5530_BAD_PIO(timings) (((timings)&~0x80000000)==0x0000e132)
40 #define CS5530_BASEREG(hwif) (((hwif)->dma_base & ~0xf) + ((hwif)->channel ? 0x30 : 0x20))
56 unsigned int format = (
inl(basereg + 4) >> 31) & 1;
59 outl(cs5530_pio_timings[format][pio], basereg + ((drive->
dn & 1)<<3));
105 unsigned long basereg;
117 reg =
inl(basereg + 4);
118 timings |= reg & 0x80000000;
119 if ((drive->
dn & 1) == 0) {
120 outl(timings, basereg + 4);
122 if (timings & 0x00100000)
126 outl(reg, basereg + 4);
127 outl(timings, basereg + 12);
138 static int init_chipset_cs5530(
struct pci_dev *
dev)
185 pci_write_config_word(cs5530_0, 0xd0, 0x5006);
193 pci_write_config_byte(master_0, 0x40, 0x1e);
205 pci_write_config_byte(master_0, 0x41, 0x14);
212 pci_write_config_byte(master_0, 0x42, 0x00);
213 pci_write_config_byte(master_0, 0x43, 0xc1);
231 unsigned long basereg;
235 d0_timings =
inl(basereg + 0);
237 outl(cs5530_pio_timings[(d0_timings >> 31) & 1][0], basereg + 0);
239 outl(cs5530_pio_timings[(d0_timings >> 31) & 1][0], basereg + 8);
243 .set_pio_mode = cs5530_set_pio_mode,
244 .set_dma_mode = cs5530_set_dma_mode,
245 .udma_filter = cs5530_udma_filter,
250 .init_chipset = init_chipset_cs5530,
251 .init_hwif = init_hwif_cs5530,
252 .port_ops = &cs5530_port_ops,
271 static struct pci_driver cs5530_pci_driver = {
272 .name =
"CS5530 IDE",
273 .id_table = cs5530_pci_tbl,
274 .probe = cs5530_init_one,
280 static int __init cs5530_ide_init(
void)
285 static void __exit cs5530_ide_exit(
void)