33 #include <linux/kernel.h>
34 #include <linux/module.h>
35 #include <linux/pci.h>
40 #define DRV_NAME "cs5536"
79 return pci_read_config_dword(pdev,
PCI_IDE_CFG + reg * 4, val);
82 static int cs5536_write(
struct pci_dev *pdev,
int reg,
int val)
89 return pci_write_config_dword(pdev,
PCI_IDE_CFG + reg * 4, val);
98 cs5536_read(pdev,
DTC, &dtc);
100 dtc |= tim << dshift;
101 cs5536_write(pdev,
DTC, dtc);
118 cs5536_read(pdev,
CFG, &cfg);
134 static const u8 drv_timings[5] = {
135 0x98, 0x55, 0x32, 0x21, 0x20,
138 static const u8 addr_timings[5] = {
139 0x2, 0x1, 0x0, 0x0, 0x0,
142 static const u8 cmd_timings[5] = {
143 0x99, 0x92, 0x90, 0x22, 0x20,
149 unsigned long timings = (
unsigned long)ide_get_drivedata(drive);
158 timings |= drv_timings[
pio];
159 ide_set_drivedata(drive, (
void *)timings);
161 cs5536_program_dtc(drive, drv_timings[pio]);
163 cs5536_read(pdev,
CAST, &cast);
166 cast |= addr_timings[
pio] << cshift;
171 cs5536_write(pdev,
CAST, cast);
182 static const u8 udma_timings[6] = {
183 0xc2, 0xc1, 0xc0, 0xc4, 0xc5, 0xc6,
186 static const u8 mwdma_timings[3] = {
192 unsigned long timings = (
unsigned long)ide_get_drivedata(drive);
196 cs5536_read(pdev,
ETC, &etc);
205 ide_set_drivedata(drive, (
void *)timings);
208 cs5536_write(pdev,
ETC, etc);
213 unsigned long timings = (
unsigned long)ide_get_drivedata(drive);
217 cs5536_program_dtc(drive, timings >> 8);
225 unsigned long timings = (
unsigned long)ide_get_drivedata(drive);
235 .set_pio_mode = cs5536_set_pio_mode,
236 .set_dma_mode = cs5536_set_dma_mode,
237 .cable_detect = cs5536_cable_detect,
243 .dma_start = cs5536_dma_start,
244 .dma_end = cs5536_dma_end,
253 .port_ops = &cs5536_port_ops,
254 .dma_ops = &cs5536_dma_ops,
274 cs5536_read(dev,
CFG, &cfg);
289 static struct pci_driver cs5536_pci_driver = {
291 .id_table = cs5536_pci_tbl,
292 .probe = cs5536_init_one,
298 static int __init cs5536_init(
void)
300 return pci_register_driver(&cs5536_pci_driver);
303 static void __exit cs5536_exit(
void)
308 MODULE_AUTHOR(
"Martin K. Petersen, Bartlomiej Zolnierkiewicz");
314 MODULE_PARM_DESC(msr,
"Force using MSR to configure IDE function (Default: 0)");