Commit b8cec3c2 authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by Jeff Garzik

pata_cmd64x: implement sff_irq_check() method

Implement sff_irq_check() method for both old and new chips.
Signed-off-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 419fd246
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include <linux/libata.h> #include <linux/libata.h>
#define DRV_NAME "pata_cmd64x" #define DRV_NAME "pata_cmd64x"
#define DRV_VERSION "0.2.17" #define DRV_VERSION "0.2.18"
/* /*
* CMD64x specific registers definition. * CMD64x specific registers definition.
...@@ -229,6 +229,26 @@ static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev) ...@@ -229,6 +229,26 @@ static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
pci_write_config_byte(pdev, pciD, regD); pci_write_config_byte(pdev, pciD, regD);
} }
/**
* cmd64x_sff_irq_check - check IDE interrupt
* @ap: ATA interface
*
* Check IDE interrupt in CFR/ARTTIM23 registers.
*/
static bool cmd64x_sff_irq_check(struct ata_port *ap)
{
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
int irq_mask = ap->port_no ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0;
int irq_reg = ap->port_no ? ARTTIM23 : CFR;
u8 irq_stat;
/* NOTE: reading the register should clear the interrupt */
pci_read_config_byte(pdev, irq_reg, &irq_stat);
return irq_stat & irq_mask;
}
/** /**
* cmd64x_sff_irq_clear - clear IDE interrupt * cmd64x_sff_irq_clear - clear IDE interrupt
* @ap: ATA interface * @ap: ATA interface
...@@ -248,6 +268,23 @@ static void cmd64x_sff_irq_clear(struct ata_port *ap) ...@@ -248,6 +268,23 @@ static void cmd64x_sff_irq_clear(struct ata_port *ap)
pci_read_config_byte(pdev, irq_reg, &irq_stat); pci_read_config_byte(pdev, irq_reg, &irq_stat);
} }
/**
* cmd648_sff_irq_check - check IDE interrupt
* @ap: ATA interface
*
* Check IDE interrupt in MRDMODE register.
*/
static bool cmd648_sff_irq_check(struct ata_port *ap)
{
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
unsigned long base = pci_resource_start(pdev, 4);
int irq_mask = ap->port_no ? MRDMODE_INTR_CH1 : MRDMODE_INTR_CH0;
u8 mrdmode = inb(base + 1);
return mrdmode & irq_mask;
}
/** /**
* cmd648_sff_irq_clear - clear IDE interrupt * cmd648_sff_irq_clear - clear IDE interrupt
* @ap: ATA interface * @ap: ATA interface
...@@ -294,12 +331,14 @@ static const struct ata_port_operations cmd64x_base_ops = { ...@@ -294,12 +331,14 @@ static const struct ata_port_operations cmd64x_base_ops = {
static struct ata_port_operations cmd64x_port_ops = { static struct ata_port_operations cmd64x_port_ops = {
.inherits = &cmd64x_base_ops, .inherits = &cmd64x_base_ops,
.sff_irq_check = cmd64x_sff_irq_check,
.sff_irq_clear = cmd64x_sff_irq_clear, .sff_irq_clear = cmd64x_sff_irq_clear,
.cable_detect = ata_cable_40wire, .cable_detect = ata_cable_40wire,
}; };
static struct ata_port_operations cmd646r1_port_ops = { static struct ata_port_operations cmd646r1_port_ops = {
.inherits = &cmd64x_base_ops, .inherits = &cmd64x_base_ops,
.sff_irq_check = cmd64x_sff_irq_check,
.sff_irq_clear = cmd64x_sff_irq_clear, .sff_irq_clear = cmd64x_sff_irq_clear,
.bmdma_stop = cmd646r1_bmdma_stop, .bmdma_stop = cmd646r1_bmdma_stop,
.cable_detect = ata_cable_40wire, .cable_detect = ata_cable_40wire,
...@@ -307,12 +346,14 @@ static struct ata_port_operations cmd646r1_port_ops = { ...@@ -307,12 +346,14 @@ static struct ata_port_operations cmd646r1_port_ops = {
static struct ata_port_operations cmd646r3_port_ops = { static struct ata_port_operations cmd646r3_port_ops = {
.inherits = &cmd64x_base_ops, .inherits = &cmd64x_base_ops,
.sff_irq_check = cmd648_sff_irq_check,
.sff_irq_clear = cmd648_sff_irq_clear, .sff_irq_clear = cmd648_sff_irq_clear,
.cable_detect = ata_cable_40wire, .cable_detect = ata_cable_40wire,
}; };
static struct ata_port_operations cmd648_port_ops = { static struct ata_port_operations cmd648_port_ops = {
.inherits = &cmd64x_base_ops, .inherits = &cmd64x_base_ops,
.sff_irq_check = cmd648_sff_irq_check,
.sff_irq_clear = cmd648_sff_irq_clear, .sff_irq_clear = cmd648_sff_irq_clear,
.cable_detect = cmd648_cable_detect, .cable_detect = cmd648_cable_detect,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment