47 #include <linux/types.h>
48 #include <linux/module.h>
49 #include <linux/kernel.h>
50 #include <linux/pci.h>
56 #define DRV_NAME "piix"
58 static int no_piix_dma;
71 int is_slave = drive->
dn & 1;
72 int master_port = hwif->
channel ? 0x42 : 0x40;
73 int slave_port = 0x44;
95 pci_read_config_word(dev, master_port, &master_data);
104 master_data |= 0x4000;
105 master_data &= ~0x0070;
108 master_data |= control << 4;
110 pci_read_config_byte(dev, slave_port, &slave_data);
111 slave_data &= hwif->
channel ? 0x0f : 0xf0;
112 slave_data |= ((timings[
pio][0] << 2) | timings[pio][1]) <<
115 master_data &= ~0x3307;
120 master_data |= (timings[
pio][0] << 12) | (timings[pio][1] << 8);
122 pci_write_config_word(dev, master_port, master_data);
124 pci_write_config_byte(dev, slave_port, slave_data);
125 spin_unlock_irqrestore(&tune_lock, flags);
140 u8 maslave = hwif->
channel ? 0x42 : 0x40;
141 int a_speed = 3 << (drive->
dn * 4);
142 int u_flag = 1 << drive->
dn;
143 int v_flag = 0x01 << drive->
dn;
144 int w_flag = 0x10 << drive->
dn;
148 u8 reg48, reg54, reg55;
151 pci_read_config_word(dev, maslave, ®4042);
152 sitre = (reg4042 & 0x4000) ? 1 : 0;
153 pci_read_config_byte(dev, 0x48, ®48);
154 pci_read_config_word(dev, 0x4a, ®4a);
155 pci_read_config_byte(dev, 0x54, ®54);
156 pci_read_config_byte(dev, 0x55, ®55);
161 u_speed =
min_t(
u8, 2 - (udma & 1), udma) << (drive->
dn * 4);
163 if (!(reg48 & u_flag))
164 pci_write_config_byte(dev, 0x48, reg48 | u_flag);
166 pci_write_config_byte(dev, 0x55, (
u8) reg55|w_flag);
168 pci_write_config_byte(dev, 0x55, (
u8) reg55 & ~w_flag);
170 if ((reg4a & a_speed) != u_speed)
171 pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed);
173 if (!(reg54 & v_flag))
174 pci_write_config_byte(dev, 0x54, reg54 | v_flag);
176 pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
178 const u8 mwdma_to_pio[] = { 0, 3, 4 };
181 pci_write_config_byte(dev, 0x48, reg48 & ~u_flag);
183 pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
185 pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
187 pci_write_config_byte(dev, 0x55, (
u8) reg55 & ~w_flag);
195 piix_set_pio_mode(hwif, drive);
207 static int init_chipset_ich(
struct pci_dev *dev)
211 pci_read_config_dword(dev, 0x54, &extra);
212 pci_write_config_dword(dev, 0x54, extra | 0x400);
256 { 0x27DF, 0x1025, 0x0102 },
257 { 0x27DF, 0x0005, 0x0280 },
258 { 0x27DF, 0x1025, 0x0110 },
259 { 0x27DF, 0x1043, 0x1267 },
260 { 0x27DF, 0x103C, 0x30A1 },
261 { 0x27DF, 0x1071, 0xD221 },
262 { 0x24CA, 0x1025, 0x0061 },
263 { 0x24CA, 0x1025, 0x003d },
264 { 0x266F, 0x1025, 0x0066 },
265 { 0x2653, 0x1043, 0x82D8 },
266 { 0x27df, 0x104d, 0x900e },
274 const struct ich_laptop *lap = &ich_laptop[0];
287 pci_read_config_byte(pdev, 0x54, ®54h);
310 .set_pio_mode = piix_set_pio_mode,
311 .set_dma_mode = piix_set_dma_mode,
312 .cable_detect = piix_cable_detect,
316 .set_pio_mode = piix_set_pio_mode,
317 .set_dma_mode = piix_set_dma_mode,
318 .clear_irq = ich_clear_irq,
319 .cable_detect = piix_cable_detect,
322 #define DECLARE_PIIX_DEV(udma) \
325 .init_hwif = init_hwif_piix, \
326 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \
327 .port_ops = &piix_port_ops, \
328 .pio_mask = ATA_PIO4, \
329 .swdma_mask = ATA_SWDMA2_ONLY, \
330 .mwdma_mask = ATA_MWDMA12_ONLY, \
334 #define DECLARE_ICH_DEV(mwdma, udma) \
337 .init_chipset = init_chipset_ich, \
338 .init_hwif = init_hwif_piix, \
339 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \
340 .port_ops = &ich_port_ops, \
341 .pio_mask = ATA_PIO4, \
342 .swdma_mask = ATA_SWDMA2_ONLY, \
343 .mwdma_mask = mwdma, \
355 .enablebits = {{0x6d,0xc0,0x80}, {0x6d,0xc0,0xc0}},
397 static void __devinit piix_check_450nx(
void)
405 pci_read_config_word(pdev, 0x41, &cfg);
410 else if (cfg & (1<<14) && pdev->
revision < 5)
438 #ifdef CONFIG_BLK_DEV_IDE_SATA
453 .id_table = piix_pci_tbl,
454 .probe = piix_init_one,
460 static int __init piix_ide_init(
void)
466 static void __exit piix_ide_exit(
void)