33 #include <linux/kernel.h>
34 #include <linux/module.h>
35 #include <linux/pci.h>
46 MODULE_PARM_DESC(msr,
"Force using MSR to configure IDE function (Default: 0)");
50 #define rdmsr(x, y, z) do { } while (0)
51 #define wrmsr(x, y, z) do { } while (0)
55 #define DRV_NAME "pata_cs5536"
56 #define DRV_VERSION "0.0.8"
92 return pci_read_config_dword(pdev,
PCI_IDE_CFG + reg * 4, val);
95 static int cs5536_write(
struct pci_dev *pdev,
int reg,
int val)
102 return pci_write_config_dword(pdev,
PCI_IDE_CFG + reg * 4, val);
105 static void cs5536_program_dtc(
struct ata_device *adev,
u8 tim)
111 cs5536_read(pdev,
DTC, &dtc);
113 dtc |= tim << dshift;
114 cs5536_write(pdev,
DTC, dtc);
126 static int cs5536_cable_detect(
struct ata_port *ap)
131 cs5536_read(pdev,
CFG, &cfg);
147 static const u8 drv_timings[5] = {
148 0x98, 0x55, 0x32, 0x21, 0x20,
151 static const u8 addr_timings[5] = {
152 0x2, 0x1, 0x0, 0x0, 0x0,
155 static const u8 cmd_timings[5] = {
156 0x99, 0x92, 0x90, 0x22, 0x20,
169 cs5536_program_dtc(adev, drv_timings[mode]);
171 cs5536_read(pdev,
CAST, &cast);
174 cast |= addr_timings[
mode] << cshift;
179 cs5536_write(pdev,
CAST, cast);
191 static const u8 udma_timings[6] = {
192 0xc2, 0xc1, 0xc0, 0xc4, 0xc5, 0xc6,
195 static const u8 mwdma_timings[3] = {
204 cs5536_read(pdev,
ETC, &etc);
211 cs5536_program_dtc(adev, mwdma_timings[mode -
XFER_MW_DMA_0]);
214 cs5536_write(pdev,
ETC, etc);
222 .inherits = &ata_bmdma32_port_ops,
223 .cable_detect = cs5536_cable_detect,
224 .set_piomode = cs5536_set_piomode,
225 .set_dmamode = cs5536_set_dmamode,
242 .port_ops = &cs5536_port_ops,
251 cs5536_read(dev,
CFG, &cfg);
258 return ata_pci_bmdma_init_one(dev, ppi, &cs5536_sht,
NULL, 0);
266 static struct pci_driver cs5536_pci_driver = {
269 .probe = cs5536_init_one,
270 .remove = ata_pci_remove_one,
272 .suspend = ata_pci_device_suspend,
273 .resume = ata_pci_device_resume,