17 #include <linux/types.h>
18 #include <linux/module.h>
19 #include <linux/kernel.h>
20 #include <linux/pci.h>
25 #define DRV_NAME "sl82c105"
30 #define CTRL_IDE_IRQB (1 << 30)
31 #define CTRL_IDE_IRQA (1 << 28)
32 #define CTRL_LEGIRQ (1 << 11)
33 #define CTRL_P1F16 (1 << 5)
34 #define CTRL_P1EN (1 << 4)
35 #define CTRL_P0F16 (1 << 1)
36 #define CTRL_P0EN (1 << 0)
45 unsigned int cmd_on, cmd_off;
48 cmd_on = (t->
active + 29) / 30;
60 return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy;
69 unsigned long timings = (
unsigned long)ide_get_drivedata(drive);
70 int reg = 0x44 + drive->
dn * 4;
74 drv_ctrl = get_pio_timings(drive, pio);
80 timings &= 0xffff0000;
82 ide_set_drivedata(drive, (
void *)timings);
84 pci_write_config_word(dev, reg, drv_ctrl);
85 pci_read_config_word (dev, reg, &drv_ctrl);
97 static u16 mwdma_timings[] = {0x0707, 0x0201, 0x0200};
98 unsigned long timings = (
unsigned long)ide_get_drivedata(drive);
108 timings &= 0x0000ffff;
109 timings |= (
unsigned long)drv_ctrl << 16;
110 ide_set_drivedata(drive, (
void *)timings);
113 static int sl82c105_test_irq(
ide_hwif_t *hwif)
118 pci_read_config_dword(dev, 0x40, &val);
120 return (val & mask) ? 1 : 0;
131 static inline void sl82c105_reset_host(
struct pci_dev *dev)
135 pci_read_config_word(dev, 0x7e, &val);
136 pci_write_config_word(dev, 0x7e, val | (1 << 2));
137 pci_write_config_word(dev, 0x7e, val & ~(1 << 2));
147 static void sl82c105_dma_lost_irq(
ide_drive_t *drive)
159 pci_read_config_dword(dev, 0x40, &val);
162 "but host lost it\n");
174 sl82c105_reset_host(dev);
189 int reg = 0x44 + drive->
dn * 4;
191 pci_write_config_word(dev, reg,
192 (
unsigned long)ide_get_drivedata(drive) >> 16);
194 sl82c105_reset_host(dev);
202 sl82c105_reset_host(dev);
208 int reg = 0x44 + drive->
dn * 4;
211 pci_write_config_word(dev, reg,
212 (
unsigned long)ide_get_drivedata(drive));
226 pci_read_config_dword(dev, 0x40, &val);
228 pci_write_config_dword(dev, 0x40, val);
235 static u8 sl82c105_bridge_revision(
struct pci_dev *dev)
272 static int init_chipset_sl82c105(
struct pci_dev *dev)
276 pci_read_config_dword(dev, 0x40, &val);
278 pci_write_config_dword(dev, 0x40, val);
284 .set_pio_mode = sl82c105_set_pio_mode,
285 .set_dma_mode = sl82c105_set_dma_mode,
286 .resetproc = sl82c105_resetproc,
287 .test_irq = sl82c105_test_irq,
290 static const struct ide_dma_ops sl82c105_dma_ops = {
293 .dma_start = sl82c105_dma_start,
294 .dma_end = sl82c105_dma_end,
296 .dma_lost_irq = sl82c105_dma_lost_irq,
298 .dma_clear = sl82c105_dma_clear,
304 .init_chipset = init_chipset_sl82c105,
305 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}},
306 .port_ops = &sl82c105_port_ops,
307 .dma_ops = &sl82c105_dma_ops,
319 u8 rev = sl82c105_bridge_revision(dev);
327 "revision %d, BM-DMA disabled\n", rev);
342 static struct pci_driver sl82c105_pci_driver = {
343 .name =
"W82C105_IDE",
344 .id_table = sl82c105_pci_tbl,
345 .probe = sl82c105_init_one,
351 static int __init sl82c105_ide_init(
void)
356 static void __exit sl82c105_ide_exit(
void)