forked from Minki/linux
cmd64x: implement clear_irq() method (take 2)
Convert the driver's two dma_end() methods into clear_irq() methods -- the driver will now use the standard dma_end() method implementation, ide_dma_end(). Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
parent
53b987d5e7
commit
30e5ffc368
@ -7,7 +7,7 @@
|
|||||||
* Copyright (C) 1998 David S. Miller (davem@redhat.com)
|
* Copyright (C) 1998 David S. Miller (davem@redhat.com)
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org>
|
* Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org>
|
||||||
* Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com>
|
* Copyright (C) 2007,2009 MontaVista Software, Inc. <source@mvista.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
@ -226,11 +226,11 @@ static void cmd64x_set_dma_mode(ide_drive_t *drive, const u8 speed)
|
|||||||
(void) pci_write_config_byte(dev, pciU, regU);
|
(void) pci_write_config_byte(dev, pciU, regU);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd648_dma_end(ide_drive_t *drive)
|
static void cmd648_clear_irq(ide_drive_t *drive)
|
||||||
{
|
{
|
||||||
ide_hwif_t *hwif = drive->hwif;
|
ide_hwif_t *hwif = drive->hwif;
|
||||||
unsigned long base = hwif->dma_base - (hwif->channel * 8);
|
struct pci_dev *dev = to_pci_dev(hwif->dev);
|
||||||
int err = ide_dma_end(drive);
|
unsigned long base = pci_resource_start(dev, 4);
|
||||||
u8 irq_mask = hwif->channel ? MRDMODE_INTR_CH1 :
|
u8 irq_mask = hwif->channel ? MRDMODE_INTR_CH1 :
|
||||||
MRDMODE_INTR_CH0;
|
MRDMODE_INTR_CH0;
|
||||||
u8 mrdmode = inb(base + 1);
|
u8 mrdmode = inb(base + 1);
|
||||||
@ -238,11 +238,9 @@ static int cmd648_dma_end(ide_drive_t *drive)
|
|||||||
/* clear the interrupt bit */
|
/* clear the interrupt bit */
|
||||||
outb((mrdmode & ~(MRDMODE_INTR_CH0 | MRDMODE_INTR_CH1)) | irq_mask,
|
outb((mrdmode & ~(MRDMODE_INTR_CH0 | MRDMODE_INTR_CH1)) | irq_mask,
|
||||||
base + 1);
|
base + 1);
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd64x_dma_end(ide_drive_t *drive)
|
static void cmd64x_clear_irq(ide_drive_t *drive)
|
||||||
{
|
{
|
||||||
ide_hwif_t *hwif = drive->hwif;
|
ide_hwif_t *hwif = drive->hwif;
|
||||||
struct pci_dev *dev = to_pci_dev(hwif->dev);
|
struct pci_dev *dev = to_pci_dev(hwif->dev);
|
||||||
@ -250,13 +248,10 @@ static int cmd64x_dma_end(ide_drive_t *drive)
|
|||||||
u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 :
|
u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 :
|
||||||
CFR_INTR_CH0;
|
CFR_INTR_CH0;
|
||||||
u8 irq_stat = 0;
|
u8 irq_stat = 0;
|
||||||
int err = ide_dma_end(drive);
|
|
||||||
|
|
||||||
(void) pci_read_config_byte(dev, irq_reg, &irq_stat);
|
(void) pci_read_config_byte(dev, irq_reg, &irq_stat);
|
||||||
/* clear the interrupt bit */
|
/* clear the interrupt bit */
|
||||||
(void) pci_write_config_byte(dev, irq_reg, irq_stat | irq_mask);
|
(void) pci_write_config_byte(dev, irq_reg, irq_stat | irq_mask);
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd648_dma_test_irq(ide_drive_t *drive)
|
static int cmd648_dma_test_irq(ide_drive_t *drive)
|
||||||
@ -370,6 +365,14 @@ static u8 cmd64x_cable_detect(ide_hwif_t *hwif)
|
|||||||
static const struct ide_port_ops cmd64x_port_ops = {
|
static const struct ide_port_ops cmd64x_port_ops = {
|
||||||
.set_pio_mode = cmd64x_set_pio_mode,
|
.set_pio_mode = cmd64x_set_pio_mode,
|
||||||
.set_dma_mode = cmd64x_set_dma_mode,
|
.set_dma_mode = cmd64x_set_dma_mode,
|
||||||
|
.clear_irq = cmd64x_clear_irq,
|
||||||
|
.cable_detect = cmd64x_cable_detect,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct ide_port_ops cmd648_port_ops = {
|
||||||
|
.set_pio_mode = cmd64x_set_pio_mode,
|
||||||
|
.set_dma_mode = cmd64x_set_dma_mode,
|
||||||
|
.clear_irq = cmd648_clear_irq,
|
||||||
.cable_detect = cmd64x_cable_detect,
|
.cable_detect = cmd64x_cable_detect,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -377,7 +380,7 @@ static const struct ide_dma_ops cmd64x_dma_ops = {
|
|||||||
.dma_host_set = ide_dma_host_set,
|
.dma_host_set = ide_dma_host_set,
|
||||||
.dma_setup = ide_dma_setup,
|
.dma_setup = ide_dma_setup,
|
||||||
.dma_start = ide_dma_start,
|
.dma_start = ide_dma_start,
|
||||||
.dma_end = cmd64x_dma_end,
|
.dma_end = ide_dma_end,
|
||||||
.dma_test_irq = cmd64x_dma_test_irq,
|
.dma_test_irq = cmd64x_dma_test_irq,
|
||||||
.dma_lost_irq = ide_dma_lost_irq,
|
.dma_lost_irq = ide_dma_lost_irq,
|
||||||
.dma_timer_expiry = ide_dma_sff_timer_expiry,
|
.dma_timer_expiry = ide_dma_sff_timer_expiry,
|
||||||
@ -399,7 +402,7 @@ static const struct ide_dma_ops cmd648_dma_ops = {
|
|||||||
.dma_host_set = ide_dma_host_set,
|
.dma_host_set = ide_dma_host_set,
|
||||||
.dma_setup = ide_dma_setup,
|
.dma_setup = ide_dma_setup,
|
||||||
.dma_start = ide_dma_start,
|
.dma_start = ide_dma_start,
|
||||||
.dma_end = cmd648_dma_end,
|
.dma_end = ide_dma_end,
|
||||||
.dma_test_irq = cmd648_dma_test_irq,
|
.dma_test_irq = cmd648_dma_test_irq,
|
||||||
.dma_lost_irq = ide_dma_lost_irq,
|
.dma_lost_irq = ide_dma_lost_irq,
|
||||||
.dma_timer_expiry = ide_dma_sff_timer_expiry,
|
.dma_timer_expiry = ide_dma_sff_timer_expiry,
|
||||||
@ -423,7 +426,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
|
|||||||
.name = DRV_NAME,
|
.name = DRV_NAME,
|
||||||
.init_chipset = init_chipset_cmd64x,
|
.init_chipset = init_chipset_cmd64x,
|
||||||
.enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
|
.enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
|
||||||
.port_ops = &cmd64x_port_ops,
|
.port_ops = &cmd648_port_ops,
|
||||||
.dma_ops = &cmd648_dma_ops,
|
.dma_ops = &cmd648_dma_ops,
|
||||||
.host_flags = IDE_HFLAG_SERIALIZE |
|
.host_flags = IDE_HFLAG_SERIALIZE |
|
||||||
IDE_HFLAG_ABUSE_PREFETCH,
|
IDE_HFLAG_ABUSE_PREFETCH,
|
||||||
@ -435,7 +438,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
|
|||||||
.name = DRV_NAME,
|
.name = DRV_NAME,
|
||||||
.init_chipset = init_chipset_cmd64x,
|
.init_chipset = init_chipset_cmd64x,
|
||||||
.enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
|
.enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
|
||||||
.port_ops = &cmd64x_port_ops,
|
.port_ops = &cmd648_port_ops,
|
||||||
.dma_ops = &cmd648_dma_ops,
|
.dma_ops = &cmd648_dma_ops,
|
||||||
.host_flags = IDE_HFLAG_ABUSE_PREFETCH,
|
.host_flags = IDE_HFLAG_ABUSE_PREFETCH,
|
||||||
.pio_mask = ATA_PIO5,
|
.pio_mask = ATA_PIO5,
|
||||||
@ -446,7 +449,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
|
|||||||
.name = DRV_NAME,
|
.name = DRV_NAME,
|
||||||
.init_chipset = init_chipset_cmd64x,
|
.init_chipset = init_chipset_cmd64x,
|
||||||
.enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
|
.enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
|
||||||
.port_ops = &cmd64x_port_ops,
|
.port_ops = &cmd648_port_ops,
|
||||||
.dma_ops = &cmd648_dma_ops,
|
.dma_ops = &cmd648_dma_ops,
|
||||||
.host_flags = IDE_HFLAG_ABUSE_PREFETCH,
|
.host_flags = IDE_HFLAG_ABUSE_PREFETCH,
|
||||||
.pio_mask = ATA_PIO5,
|
.pio_mask = ATA_PIO5,
|
||||||
@ -484,6 +487,7 @@ static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_devic
|
|||||||
*/
|
*/
|
||||||
if (dev->revision < 3) {
|
if (dev->revision < 3) {
|
||||||
d.enablebits[0].reg = 0;
|
d.enablebits[0].reg = 0;
|
||||||
|
d.port_ops = &cmd64x_port_ops;
|
||||||
if (dev->revision == 1)
|
if (dev->revision == 1)
|
||||||
d.dma_ops = &cmd646_rev1_dma_ops;
|
d.dma_ops = &cmd646_rev1_dma_ops;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user