37 #include <linux/kernel.h>
38 #include <linux/module.h>
39 #include <linux/pci.h>
45 #include <linux/device.h>
49 #define DRV_NAME "sata_vsc"
50 #define DRV_VERSION "2.3"
98 VSC_SATA_INT_PHY_CHANGE),
102 unsigned int sc_reg,
u32 *
val)
106 *val =
readl(link->
ap->ioaddr.scr_addr + (sc_reg * 4));
112 unsigned int sc_reg,
u32 val)
116 writel(val, link->
ap->ioaddr.scr_addr + (sc_reg * 4));
121 static void vsc_freeze(
struct ata_port *ap)
132 static void vsc_thaw(
struct ata_port *ap)
143 static void vsc_intr_mask_update(
struct ata_port *ap,
u8 ctl)
150 mask =
readb(mask_addr);
161 struct ata_ioports *ioaddr = &ap->ioaddr;
171 ap->last_ctl = tf->
ctl;
176 ioaddr->feature_addr);
185 }
else if (is_addr) {
202 struct ata_ioports *ioaddr = &ap->ioaddr;
207 feature =
readw(ioaddr->error_addr);
208 nsect =
readw(ioaddr->nsect_addr);
209 lbal =
readw(ioaddr->lbal_addr);
210 lbam =
readw(ioaddr->lbam_addr);
211 lbah =
readw(ioaddr->lbah_addr);
236 static void vsc_port_intr(
u8 port_status,
struct ata_port *ap)
242 vsc_error_intr(port_status, ap);
246 qc = ata_qc_from_tag(ap, ap->
link.active_tag);
248 handled = ata_bmdma_port_intr(ap, qc);
256 ap->
ops->sff_check_status(ap);
265 static irqreturn_t vsc_sata_interrupt(
int irq,
void *dev_instance)
269 unsigned int handled = 0;
274 if (
unlikely(status == 0xffffffff || status == 0)) {
277 ": IRQ status == 0xffffffff, PCI fault or device removal?\n");
281 spin_lock(&host->
lock);
283 for (i = 0; i < host->
n_ports; i++) {
284 u8 port_status = (status >> (8 *
i)) & 0xff;
286 vsc_port_intr(port_status, host->
ports[i]);
291 spin_unlock(&host->
lock);
303 .inherits = &ata_bmdma_port_ops,
307 .sff_tf_load = vsc_sata_tf_load,
308 .sff_tf_read = vsc_sata_tf_read,
309 .freeze = vsc_freeze,
311 .scr_read = vsc_sata_scr_read,
312 .scr_write = vsc_sata_scr_write,
315 static void __devinit vsc_sata_setup_port(
struct ata_ioports *
port,
346 .port_ops = &vsc_sata_ops,
379 for (i = 0; i < host->
n_ports; i++) {
383 vsc_sata_setup_port(&ap->ioaddr, mmio_base + offset);
395 rc = pci_set_consistent_dma_mask(pdev,
DMA_BIT_MASK(32));
407 if (pci_enable_msi(pdev) == 0)
416 pci_write_config_dword(pdev, 0x98, 0);
432 static struct pci_driver vsc_sata_pci_driver = {
434 .id_table = vsc_sata_pci_tbl,
435 .probe = vsc_sata_init_one,
436 .remove = ata_pci_remove_one,