16 #include <linux/kernel.h>
17 #include <linux/module.h>
18 #include <linux/pci.h>
25 #define DRV_NAME "pata_hpt3x3"
26 #define DRV_VERSION "0.6.1"
44 pci_read_config_dword(pdev, 0x44, &r1);
45 pci_read_config_dword(pdev, 0x48, &r2);
47 r1 &= ~(7 << (3 *
dn));
51 pci_write_config_dword(pdev, 0x44, r1);
52 pci_write_config_dword(pdev, 0x48, r2);
55 #if defined(CONFIG_PATA_HPT3X3_DMA)
73 int mode_num = adev->
dma_mode & 0x0F;
75 pci_read_config_dword(pdev, 0x44, &r1);
76 pci_read_config_dword(pdev, 0x48, &r2);
78 r1 &= ~(7 << (3 *
dn));
79 r1 |= (mode_num << (3 *
dn));
87 pci_write_config_dword(pdev, 0x44, r1);
88 pci_write_config_dword(pdev, 0x48, r2);
99 static void hpt3x3_freeze(
struct ata_port *ap)
101 void __iomem *mmio = ap->ioaddr.bmdma_addr;
123 return ata_bmdma_setup(qc);
145 .inherits = &ata_bmdma_port_ops,
147 .set_piomode = hpt3x3_set_piomode,
148 #if defined(CONFIG_PATA_HPT3X3_DMA)
149 .set_dmamode = hpt3x3_set_dmamode,
150 .bmdma_setup = hpt3x3_bmdma_setup,
151 .check_atapi_dma= hpt3x3_atapi_dma,
152 .freeze = hpt3x3_freeze,
164 static void hpt3x3_init_chipset(
struct pci_dev *
dev)
168 pci_write_config_word(dev, 0x80, 0x00);
191 #if defined(CONFIG_PATA_HPT3X3_DMA)
196 .port_ops = &hpt3x3_port_ops
199 static const u8 offset_cmd[2] = { 0x20, 0x28 };
200 static const u8 offset_ctl[2] = { 0x36, 0x3E };
206 hpt3x3_init_chipset(pdev);
232 base = host->
iomap[4];
234 for (i = 0; i < host->
n_ports; i++) {
236 struct ata_ioports *ioaddr = &ap->ioaddr;
238 ioaddr->cmd_addr = base + offset_cmd[
i];
239 ioaddr->altstatus_addr =
240 ioaddr->ctl_addr = base + offset_ctl[
i];
241 ioaddr->scr_addr =
NULL;
243 ioaddr->bmdma_addr = base + 8 *
i;
245 ata_port_pbar_desc(ap, 4, -1,
"ioport");
246 ata_port_pbar_desc(ap, 4, offset_cmd[i],
"cmd");
254 static int hpt3x3_reinit_one(
struct pci_dev *dev)
259 rc = ata_pci_device_do_resume(dev);
263 hpt3x3_init_chipset(dev);
265 ata_host_resume(host);
276 static struct pci_driver hpt3x3_pci_driver = {
279 .probe = hpt3x3_init_one,
280 .remove = ata_pci_remove_one,
282 .suspend = ata_pci_device_suspend,
283 .resume = hpt3x3_reinit_one,