25 #include <linux/module.h>
26 #include <linux/pci.h>
29 #define DRV_NAME "cs5535"
31 #define MSR_ATAC_BASE 0x51300000
32 #define ATAC_GLD_MSR_CAP (MSR_ATAC_BASE+0)
33 #define ATAC_GLD_MSR_CONFIG (MSR_ATAC_BASE+0x01)
34 #define ATAC_GLD_MSR_SMI (MSR_ATAC_BASE+0x02)
35 #define ATAC_GLD_MSR_ERROR (MSR_ATAC_BASE+0x03)
36 #define ATAC_GLD_MSR_PM (MSR_ATAC_BASE+0x04)
37 #define ATAC_GLD_MSR_DIAG (MSR_ATAC_BASE+0x05)
38 #define ATAC_IO_BAR (MSR_ATAC_BASE+0x08)
39 #define ATAC_RESET (MSR_ATAC_BASE+0x10)
40 #define ATAC_CH0D0_PIO (MSR_ATAC_BASE+0x20)
41 #define ATAC_CH0D0_DMA (MSR_ATAC_BASE+0x21)
42 #define ATAC_CH0D1_PIO (MSR_ATAC_BASE+0x22)
43 #define ATAC_CH0D1_DMA (MSR_ATAC_BASE+0x23)
44 #define ATAC_PCI_ABRTERR (MSR_ATAC_BASE+0x24)
45 #define ATAC_BM0_CMD_PRIM 0x00
46 #define ATAC_BM0_STS_PRIM 0x02
47 #define ATAC_BM0_PRD 0x04
48 #define CS5535_CABLE_DETECT 0x48
52 static unsigned int cs5535_pio_cmd_timings[5] =
53 { 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 };
54 static unsigned int cs5535_pio_dta_timings[5] =
55 { 0xF7F4, 0xF173, 0x8141, 0x5131, 0x1131 };
57 static unsigned int cs5535_mwdma_timings[3] =
58 { 0x7F0FFFF3, 0x7F035352, 0x7f024241 };
60 static unsigned int cs5535_udma_timings[5] =
61 { 0x7F7436A1, 0x7F733481, 0x7F723261, 0x7F713161, 0x7F703061 };
66 #define CS5535_BAD_PIO(timings) ( (timings&~0x80000000UL) == 0x00009172 )
67 #define CS5535_BAD_DMA(timings) ( (timings & 0x000FFFFF) == 0x00077771 )
76 static void cs5535_set_speed(
ide_drive_t *drive,
const u8 speed)
96 reg = (cs5535_pio_cmd_timings[
cmd] << 16) |
97 cs5535_pio_dta_timings[pioa];
103 if (((reg >> 16) & cs5535_pio_cmd_timings[cmd]) !=
104 cs5535_pio_cmd_timings[cmd]) {
106 reg |= cs5535_pio_cmd_timings[
cmd] << 16;
107 wrmsr(unit ? ATAC_CH0D0_PIO : ATAC_CH0D1_PIO, reg, 0);
113 reg | 0x80000000UL, 0);
140 cs5535_set_speed(drive, drive->
dma_mode);
153 cs5535_set_speed(drive, drive->
pio_mode);
168 .set_pio_mode = cs5535_set_pio_mode,
169 .set_dma_mode = cs5535_set_dma_mode,
170 .cable_detect = cs5535_cable_detect,
175 .port_ops = &cs5535_port_ops,
196 static struct pci_driver cs5535_pci_driver = {
197 .name =
"CS5535_IDE",
198 .id_table = cs5535_pci_tbl,
199 .probe = cs5535_init_one,
205 static int __init cs5535_ide_init(
void)
210 static void __exit cs5535_ide_exit(
void)