9 #include <linux/kernel.h>
10 #include <linux/types.h>
11 #include <linux/module.h>
12 #include <linux/pci.h>
16 #define DRV_NAME "it8213"
29 int is_slave = drive->
dn & 1;
30 int master_port = 0x40;
31 int slave_port = 0x44;
47 pci_read_config_word(dev, master_port, &master_data);
56 master_data |= 0x4000;
57 master_data &= ~0x0070;
59 master_data = master_data | (control << 4);
60 pci_read_config_byte(dev, slave_port, &slave_data);
61 slave_data = slave_data & 0xf0;
62 slave_data = slave_data | (timings[
pio][0] << 2) | timings[pio][1];
64 master_data &= ~0x3307;
66 master_data = master_data |
control;
67 master_data = master_data | (timings[
pio][0] << 12) | (timings[pio][1] << 8);
69 pci_write_config_word(dev, master_port, master_data);
71 pci_write_config_byte(dev, slave_port, slave_data);
72 spin_unlock_irqrestore(&tune_lock, flags);
87 int a_speed = 3 << (drive->
dn * 4);
88 int u_flag = 1 << drive->
dn;
89 int v_flag = 0x01 << drive->
dn;
90 int w_flag = 0x10 << drive->
dn;
93 u8 reg48, reg54, reg55;
96 pci_read_config_word(dev, maslave, ®4042);
97 pci_read_config_byte(dev, 0x48, ®48);
98 pci_read_config_word(dev, 0x4a, ®4a);
99 pci_read_config_byte(dev, 0x54, ®54);
100 pci_read_config_byte(dev, 0x55, ®55);
105 u_speed =
min_t(
u8, 2 - (udma & 1), udma) << (drive->
dn * 4);
107 if (!(reg48 & u_flag))
108 pci_write_config_byte(dev, 0x48, reg48 | u_flag);
110 pci_write_config_byte(dev, 0x55, (
u8) reg55|w_flag);
112 pci_write_config_byte(dev, 0x55, (
u8) reg55 & ~w_flag);
114 if ((reg4a & a_speed) != u_speed)
115 pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed);
117 if (!(reg54 & v_flag))
118 pci_write_config_byte(dev, 0x54, reg54 | v_flag);
120 pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
122 const u8 mwdma_to_pio[] = { 0, 3, 4 };
125 pci_write_config_byte(dev, 0x48, reg48 & ~u_flag);
127 pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
129 pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
131 pci_write_config_byte(dev, 0x55, (
u8) reg55 & ~w_flag);
139 it8213_set_pio_mode(hwif, drive);
148 pci_read_config_byte(dev, 0x42, ®42h);
154 .set_pio_mode = it8213_set_pio_mode,
155 .set_dma_mode = it8213_set_dma_mode,
156 .cable_detect = it8213_cable_detect,
161 .enablebits = { {0x41, 0x80, 0x80} },
162 .port_ops = &it8213_port_ops,
192 static struct pci_driver it8213_pci_driver = {
193 .name =
"ITE8213_IDE",
194 .id_table = it8213_pci_tbl,
195 .probe = it8213_init_one,
201 static int __init it8213_ide_init(
void)
206 static void __exit it8213_ide_exit(
void)