Commit 85cd7251 authored by Jeff Garzik's avatar Jeff Garzik

[libata #pata-drivers] Trim trailing whitespace.

parent 481ff126
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
* ata_generic.c - Generic PATA/SATA controller driver. * ata_generic.c - Generic PATA/SATA controller driver.
* Copyright 2005 Red Hat Inc <alan@redhat.com>, all rights reserved. * Copyright 2005 Red Hat Inc <alan@redhat.com>, all rights reserved.
* *
* Elements from ide/pci/generic.c * Elements from ide/pci/generic.c
* Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org>
* Portions (C) Copyright 2002 Red Hat Inc <alan@redhat.com> * Portions (C) Copyright 2002 Red Hat Inc <alan@redhat.com>
* *
* May be copied or modified under the terms of the GNU General Public License * May be copied or modified under the terms of the GNU General Public License
* *
* Driver for PCI IDE interfaces implementing the standard bus mastering * Driver for PCI IDE interfaces implementing the standard bus mastering
* interface functionality. This assumes the BIOS did the drive set up and * interface functionality. This assumes the BIOS did the drive set up and
* tuning for us. By default we do not grab all IDE class devices as they * tuning for us. By default we do not grab all IDE class devices as they
* may have other drivers or need fixups to avoid problems. Instead we keep * may have other drivers or need fixups to avoid problems. Instead we keep
* a default list of stuff without documentation/driver that appears to * a default list of stuff without documentation/driver that appears to
* work. * work.
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
* *
* Set up cable type and use generic probe init * Set up cable type and use generic probe init
*/ */
static int generic_pre_reset(struct ata_port *ap) static int generic_pre_reset(struct ata_port *ap)
{ {
ap->cbl = ATA_CBL_PATA80; ap->cbl = ATA_CBL_PATA80;
...@@ -55,7 +55,7 @@ static int generic_pre_reset(struct ata_port *ap) ...@@ -55,7 +55,7 @@ static int generic_pre_reset(struct ata_port *ap)
* None (inherited from caller). * None (inherited from caller).
*/ */
static void generic_error_handler(struct ata_port *ap) static void generic_error_handler(struct ata_port *ap)
{ {
ata_bmdma_drive_eh(ap, generic_pre_reset, ata_std_softreset, NULL, ata_std_postreset); ata_bmdma_drive_eh(ap, generic_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
...@@ -68,9 +68,9 @@ static void generic_error_handler(struct ata_port *ap) ...@@ -68,9 +68,9 @@ static void generic_error_handler(struct ata_port *ap)
* Use a non standard set_mode function. We don't want to be tuned. * Use a non standard set_mode function. We don't want to be tuned.
* The BIOS configured everything. Our job is not to fiddle. We * The BIOS configured everything. Our job is not to fiddle. We
* read the dma enabled bits from the PCI configuration of the device * read the dma enabled bits from the PCI configuration of the device
* and respect them. * and respect them.
*/ */
static void generic_set_mode(struct ata_port *ap) static void generic_set_mode(struct ata_port *ap)
{ {
int dma_enabled = 0; int dma_enabled = 0;
...@@ -79,14 +79,14 @@ static void generic_set_mode(struct ata_port *ap) ...@@ -79,14 +79,14 @@ static void generic_set_mode(struct ata_port *ap)
/* Bits 5 and 6 indicate if DMA is active on master/slave */ /* Bits 5 and 6 indicate if DMA is active on master/slave */
if (ap->ioaddr.bmdma_addr) if (ap->ioaddr.bmdma_addr)
dma_enabled = inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); dma_enabled = inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
for (i = 0; i < ATA_MAX_DEVICES; i++) { for (i = 0; i < ATA_MAX_DEVICES; i++) {
struct ata_device *dev = &ap->device[i]; struct ata_device *dev = &ap->device[i];
if (ata_dev_enabled(dev)) { if (ata_dev_enabled(dev)) {
/* We don't really care */ /* We don't really care */
dev->pio_mode = XFER_PIO_0; dev->pio_mode = XFER_PIO_0;
dev->dma_mode = XFER_MW_DMA_0; dev->dma_mode = XFER_MW_DMA_0;
/* We do need the right mode information for DMA or PIO /* We do need the right mode information for DMA or PIO
and this comes from the current configuration flags */ and this comes from the current configuration flags */
if (dma_enabled & (1 << (5 + i))) { if (dma_enabled & (1 << (5 + i))) {
dev->xfer_mode = XFER_MW_DMA_0; dev->xfer_mode = XFER_MW_DMA_0;
...@@ -121,7 +121,7 @@ static struct scsi_host_template generic_sht = { ...@@ -121,7 +121,7 @@ static struct scsi_host_template generic_sht = {
static struct ata_port_operations generic_port_ops = { static struct ata_port_operations generic_port_ops = {
.set_mode = generic_set_mode, .set_mode = generic_set_mode,
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
...@@ -133,7 +133,7 @@ static struct ata_port_operations generic_port_ops = { ...@@ -133,7 +133,7 @@ static struct ata_port_operations generic_port_ops = {
.bmdma_start = ata_bmdma_start, .bmdma_start = ata_bmdma_start,
.bmdma_stop = ata_bmdma_stop, .bmdma_stop = ata_bmdma_stop,
.bmdma_status = ata_bmdma_status, .bmdma_status = ata_bmdma_status,
.data_xfer = ata_pio_data_xfer, .data_xfer = ata_pio_data_xfer,
.freeze = ata_bmdma_freeze, .freeze = ata_bmdma_freeze,
...@@ -150,8 +150,8 @@ static struct ata_port_operations generic_port_ops = { ...@@ -150,8 +150,8 @@ static struct ata_port_operations generic_port_ops = {
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
static int all_generic_ide; /* Set to claim all devices */ static int all_generic_ide; /* Set to claim all devices */
/** /**
...@@ -160,10 +160,10 @@ static int all_generic_ide; /* Set to claim all devices */ ...@@ -160,10 +160,10 @@ static int all_generic_ide; /* Set to claim all devices */
* @id: match entry * @id: match entry
* *
* Called each time a matching IDE interface is found. We check if the * Called each time a matching IDE interface is found. We check if the
* interface is one we wish to claim and if so we perform any chip * interface is one we wish to claim and if so we perform any chip
* specific hacks then let the ATA layer do the heavy lifting. * specific hacks then let the ATA layer do the heavy lifting.
*/ */
static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
u16 command; u16 command;
...@@ -176,7 +176,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id ...@@ -176,7 +176,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id
.port_ops = &generic_port_ops .port_ops = &generic_port_ops
}; };
static struct ata_port_info *port_info[2] = { &info, &info }; static struct ata_port_info *port_info[2] = { &info, &info };
/* Don't use the generic entry unless instructed to do so */ /* Don't use the generic entry unless instructed to do so */
if (id->driver_data == 1 && all_generic_ide == 0) if (id->driver_data == 1 && all_generic_ide == 0)
return -ENODEV; return -ENODEV;
...@@ -197,7 +197,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id ...@@ -197,7 +197,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id
pci_read_config_word(dev, PCI_COMMAND, &command); pci_read_config_word(dev, PCI_COMMAND, &command);
if (!(command & PCI_COMMAND_IO)) if (!(command & PCI_COMMAND_IO))
return -ENODEV; return -ENODEV;
if (dev->vendor == PCI_VENDOR_ID_AL) if (dev->vendor == PCI_VENDOR_ID_AL)
ata_pci_clear_simplex(dev); ata_pci_clear_simplex(dev);
...@@ -207,7 +207,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id ...@@ -207,7 +207,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id
static struct pci_device_id ata_generic[] = { static struct pci_device_id ata_generic[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE), }, { PCI_DEVICE(PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE), },
{ PCI_DEVICE(PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_6565), }, { PCI_DEVICE(PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_6565), },
{ PCI_DEVICE(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8673F), }, { PCI_DEVICE(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8673F), },
{ PCI_DEVICE(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886A), }, { PCI_DEVICE(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886A), },
{ PCI_DEVICE(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF), }, { PCI_DEVICE(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF), },
{ PCI_DEVICE(PCI_VENDOR_ID_HINT, PCI_DEVICE_ID_HINT_VXPROII_IDE), }, { PCI_DEVICE(PCI_VENDOR_ID_HINT, PCI_DEVICE_ID_HINT_VXPROII_IDE), },
......
...@@ -127,7 +127,7 @@ enum { ...@@ -127,7 +127,7 @@ enum {
ich6_sata_ahci = 8, ich6_sata_ahci = 8,
ich6m_sata_ahci = 9, ich6m_sata_ahci = 9,
ich8_sata_ahci = 10, ich8_sata_ahci = 10,
/* constants for mapping table */ /* constants for mapping table */
P0 = 0, /* port 0 */ P0 = 0, /* port 0 */
P1 = 1, /* port 1 */ P1 = 1, /* port 1 */
...@@ -196,7 +196,7 @@ static const struct pci_device_id piix_pci_tbl[] = { ...@@ -196,7 +196,7 @@ static const struct pci_device_id piix_pci_tbl[] = {
{ 0x8086, 0x24DB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_133 }, { 0x8086, 0x24DB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_133 },
/* C-ICH (i810E2) */ /* C-ICH (i810E2) */
{ 0x8086, 0x245B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 }, { 0x8086, 0x245B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 },
/* ESB (855GME/875P + 6300ESB) UDMA 100 */ /* ESB (855GME/875P + 6300ESB) UDMA 100 */
{ 0x8086, 0x25A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 }, { 0x8086, 0x25A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 },
/* ICH6 (and 6) (i915) UDMA 100 */ /* ICH6 (and 6) (i915) UDMA 100 */
{ 0x8086, 0x266F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 }, { 0x8086, 0x266F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 },
...@@ -458,7 +458,7 @@ static struct ata_port_info piix_port_info[] = { ...@@ -458,7 +458,7 @@ static struct ata_port_info piix_port_info[] = {
.udma_mask = ATA_UDMA4, .udma_mask = ATA_UDMA4,
.port_ops = &ich_pata_ops, .port_ops = &ich_pata_ops,
}, },
/* ich_pata_100: 3 */ /* ich_pata_100: 3 */
{ {
.sht = &piix_sht, .sht = &piix_sht,
...@@ -759,7 +759,7 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev) ...@@ -759,7 +759,7 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev)
u8 slave_data; u8 slave_data;
u8 udma_enable; u8 udma_enable;
int control = 0; int control = 0;
/* /*
* See Intel Document 298600-004 for the timing programing rules * See Intel Document 298600-004 for the timing programing rules
* for ICH controllers. * for ICH controllers.
...@@ -777,7 +777,7 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev) ...@@ -777,7 +777,7 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev)
if (ata_pio_need_iordy(adev)) if (ata_pio_need_iordy(adev))
control |= 2; /* IE enable */ control |= 2; /* IE enable */
/* Intel specifies that the PPE functionality is for disk only */ /* Intel specifies that the PPE functionality is for disk only */
if (adev->class == ATA_DEV_ATA) if (adev->class == ATA_DEV_ATA)
control |= 4; /* PPE enable */ control |= 4; /* PPE enable */
...@@ -806,7 +806,7 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev) ...@@ -806,7 +806,7 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev)
/* Ensure the UDMA bit is off - it will be turned back on if /* Ensure the UDMA bit is off - it will be turned back on if
UDMA is selected */ UDMA is selected */
if (ap->udma_mask) { if (ap->udma_mask) {
pci_read_config_byte(dev, 0x48, &udma_enable); pci_read_config_byte(dev, 0x48, &udma_enable);
udma_enable &= ~(1 << (2 * ap->port_no + adev->devno)); udma_enable &= ~(1 << (2 * ap->port_no + adev->devno));
...@@ -835,7 +835,7 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i ...@@ -835,7 +835,7 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i
u8 speed = adev->dma_mode; u8 speed = adev->dma_mode;
int devid = adev->devno + 2 * ap->port_no; int devid = adev->devno + 2 * ap->port_no;
u8 udma_enable; u8 udma_enable;
static const /* ISP RTC */ static const /* ISP RTC */
u8 timings[][2] = { { 0, 0 }, u8 timings[][2] = { { 0, 0 },
{ 0, 0 }, { 0, 0 },
...@@ -851,13 +851,13 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i ...@@ -851,13 +851,13 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i
u16 udma_timing; u16 udma_timing;
u16 ideconf; u16 ideconf;
int u_clock, u_speed; int u_clock, u_speed;
/* /*
* UDMA is handled by a combination of clock switching and * UDMA is handled by a combination of clock switching and
* selection of dividers * selection of dividers
* *
* Handy rule: Odd modes are UDMATIMx 01, even are 02 * Handy rule: Odd modes are UDMATIMx 01, even are 02
* except UDMA0 which is 00 * except UDMA0 which is 00
*/ */
u_speed = min(2 - (udma & 1), udma); u_speed = min(2 - (udma & 1), udma);
if (udma == 5) if (udma == 5)
...@@ -866,16 +866,16 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i ...@@ -866,16 +866,16 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i
u_clock = 1; /* 66Mhz */ u_clock = 1; /* 66Mhz */
else else
u_clock = 0; /* 33Mhz */ u_clock = 0; /* 33Mhz */
udma_enable |= (1 << devid); udma_enable |= (1 << devid);
/* Load the CT/RP selection */ /* Load the CT/RP selection */
pci_read_config_word(dev, 0x4A, &udma_timing); pci_read_config_word(dev, 0x4A, &udma_timing);
udma_timing &= ~(3 << (4 * devid)); udma_timing &= ~(3 << (4 * devid));
udma_timing |= u_speed << (4 * devid); udma_timing |= u_speed << (4 * devid);
pci_write_config_word(dev, 0x4A, udma_timing); pci_write_config_word(dev, 0x4A, udma_timing);
if (isich) { if (isich) {
/* Select a 33/66/100Mhz clock */ /* Select a 33/66/100Mhz clock */
pci_read_config_word(dev, 0x54, &ideconf); pci_read_config_word(dev, 0x54, &ideconf);
ideconf &= ~(0x1001 << devid); ideconf &= ~(0x1001 << devid);
...@@ -897,12 +897,12 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i ...@@ -897,12 +897,12 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i
XFER_PIO_0, XFER_PIO_3, XFER_PIO_4 XFER_PIO_0, XFER_PIO_3, XFER_PIO_4
}; };
int pio = needed_pio[mwdma] - XFER_PIO_0; int pio = needed_pio[mwdma] - XFER_PIO_0;
control = 3; /* IORDY|TIME1 */ control = 3; /* IORDY|TIME1 */
/* If the drive MWDMA is faster than it can do PIO then /* If the drive MWDMA is faster than it can do PIO then
we must force PIO into PIO0 */ we must force PIO into PIO0 */
if (adev->pio_mode < needed_pio[mwdma]) if (adev->pio_mode < needed_pio[mwdma])
/* Enable DMA timing only */ /* Enable DMA timing only */
control |= 8; /* PIO cycles in PIO0 */ control |= 8; /* PIO cycles in PIO0 */
...@@ -916,7 +916,7 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i ...@@ -916,7 +916,7 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i
slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << (ap->port_no ? 4 : 0); slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << (ap->port_no ? 4 : 0);
pci_write_config_byte(dev, 0x44, slave_data); pci_write_config_byte(dev, 0x44, slave_data);
} else { /* Master */ } else { /* Master */
master_data &= 0xCCF4; /* Mask out IORDY|TIME1|DMAONLY master_data &= 0xCCF4; /* Mask out IORDY|TIME1|DMAONLY
and master timing bits */ and master timing bits */
master_data |= control; master_data |= control;
master_data |= master_data |=
......
...@@ -184,7 +184,7 @@ static void ali_fifo_control(struct ata_port *ap, struct ata_device *adev, int o ...@@ -184,7 +184,7 @@ static void ali_fifo_control(struct ata_port *ap, struct ata_device *adev, int o
/* ATA - FIFO on set nibble to 0x05, ATAPI - FIFO off, set nibble to /* ATA - FIFO on set nibble to 0x05, ATAPI - FIFO off, set nibble to
0x00. Not all the docs agree but the behaviour we now use is the 0x00. Not all the docs agree but the behaviour we now use is the
one stated in the BIOS Programming Guide */ one stated in the BIOS Programming Guide */
pci_read_config_byte(pdev, pio_fifo, &fifo); pci_read_config_byte(pdev, pio_fifo, &fifo);
fifo &= ~(0x0F << shift); fifo &= ~(0x0F << shift);
if (on) if (on)
...@@ -526,7 +526,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -526,7 +526,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.sht = &ali_sht, .sht = &ali_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48,
.pio_mask = 0x1f, .pio_mask = 0x1f,
.mwdma_mask = 0x07, .mwdma_mask = 0x07,
.udma_mask = 0x07, /* UDMA33 */ .udma_mask = 0x07, /* UDMA33 */
.port_ops = &ali_20_port_ops .port_ops = &ali_20_port_ops
}; };
......
...@@ -136,7 +136,7 @@ static int amd_pre_reset(struct ata_port *ap) ...@@ -136,7 +136,7 @@ static int amd_pre_reset(struct ata_port *ap)
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
u8 ata66; u8 ata66;
if (!pci_test_config_bits(pdev, &amd_enable_bits[ap->port_no])) { if (!pci_test_config_bits(pdev, &amd_enable_bits[ap->port_no])) {
ata_port_disable(ap); ata_port_disable(ap);
printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id); printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id);
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* TODO * TODO
* Testing work * Testing work
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
/* /*
* CMD64x specific registers definition. * CMD64x specific registers definition.
*/ */
enum { enum {
CFR = 0x50, CFR = 0x50,
CFR_INTR_CH0 = 0x02, CFR_INTR_CH0 = 0x02,
...@@ -90,9 +90,9 @@ static int cmd648_pre_reset(struct ata_port *ap) ...@@ -90,9 +90,9 @@ static int cmd648_pre_reset(struct ata_port *ap)
pci_read_config_byte(pdev, BMIDECSR, &r); pci_read_config_byte(pdev, BMIDECSR, &r);
if (r & (1 << ap->port_no)) if (r & (1 << ap->port_no))
ap->cbl = ATA_CBL_PATA80; ap->cbl = ATA_CBL_PATA80;
else else
ap->cbl = ATA_CBL_PATA40; ap->cbl = ATA_CBL_PATA40;
return ata_std_prereset(ap); return ata_std_prereset(ap);
} }
...@@ -113,18 +113,18 @@ static void cmd648_error_handler(struct ata_port *ap) ...@@ -113,18 +113,18 @@ static void cmd648_error_handler(struct ata_port *ap)
* *
* Called to do the PIO mode setup. * Called to do the PIO mode setup.
*/ */
static void cmd64x_set_piomode(struct ata_port *ap, struct ata_device *adev) static void cmd64x_set_piomode(struct ata_port *ap, struct ata_device *adev)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
struct ata_timing t; struct ata_timing t;
const unsigned long T = 1000000 / 33; const unsigned long T = 1000000 / 33;
const u8 setup_data[] = { 0x40, 0x40, 0x40, 0x80, 0x00 }; const u8 setup_data[] = { 0x40, 0x40, 0x40, 0x80, 0x00 };
u8 reg; u8 reg;
/* Port layout is not logical so use a table */ /* Port layout is not logical so use a table */
const u8 arttim_port[2][2] = { const u8 arttim_port[2][2] = {
{ ARTTIM0, ARTTIM1 }, { ARTTIM0, ARTTIM1 },
{ ARTTIM23, ARTTIM23 } { ARTTIM23, ARTTIM23 }
}; };
...@@ -132,11 +132,11 @@ static void cmd64x_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -132,11 +132,11 @@ static void cmd64x_set_piomode(struct ata_port *ap, struct ata_device *adev)
{ DRWTIM0, DRWTIM1 }, { DRWTIM0, DRWTIM1 },
{ DRWTIM2, DRWTIM3 } { DRWTIM2, DRWTIM3 }
}; };
int arttim = arttim_port[ap->port_no][adev->devno]; int arttim = arttim_port[ap->port_no][adev->devno];
int drwtim = drwtim_port[ap->port_no][adev->devno]; int drwtim = drwtim_port[ap->port_no][adev->devno];
if (ata_timing_compute(adev, adev->pio_mode, &t, T, 0) < 0) { if (ata_timing_compute(adev, adev->pio_mode, &t, T, 0) < 0) {
printk(KERN_ERR DRV_NAME ": mode computation failed.\n"); printk(KERN_ERR DRV_NAME ": mode computation failed.\n");
return; return;
...@@ -144,14 +144,14 @@ static void cmd64x_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -144,14 +144,14 @@ static void cmd64x_set_piomode(struct ata_port *ap, struct ata_device *adev)
if (ap->port_no) { if (ap->port_no) {
/* Slave has shared address setup */ /* Slave has shared address setup */
struct ata_device *pair = ata_dev_pair(adev); struct ata_device *pair = ata_dev_pair(adev);
if (pair) { if (pair) {
struct ata_timing tp; struct ata_timing tp;
ata_timing_compute(pair, pair->pio_mode, &tp, T, 0); ata_timing_compute(pair, pair->pio_mode, &tp, T, 0);
ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP);
} }
} }
printk(KERN_DEBUG DRV_NAME ": active %d recovery %d setup %d.\n", printk(KERN_DEBUG DRV_NAME ": active %d recovery %d setup %d.\n",
t.active, t.recover, t.setup); t.active, t.recover, t.setup);
if (t.recover > 16) { if (t.recover > 16) {
...@@ -160,30 +160,30 @@ static void cmd64x_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -160,30 +160,30 @@ static void cmd64x_set_piomode(struct ata_port *ap, struct ata_device *adev)
} }
if (t.active > 16) if (t.active > 16)
t.active = 16; t.active = 16;
/* Now convert the clocks into values we can actually stuff into /* Now convert the clocks into values we can actually stuff into
the chip */ the chip */
if (t.recover > 1) if (t.recover > 1)
t.recover--; t.recover--;
else else
t.recover = 15; t.recover = 15;
if (t.setup > 4) if (t.setup > 4)
t.setup = 0xC0; t.setup = 0xC0;
else else
t.setup = setup_data[t.setup]; t.setup = setup_data[t.setup];
t.active &= 0x0F; /* 0 = 16 */ t.active &= 0x0F; /* 0 = 16 */
/* Load setup timing */ /* Load setup timing */
pci_read_config_byte(pdev, arttim, &reg); pci_read_config_byte(pdev, arttim, &reg);
reg &= 0x3F; reg &= 0x3F;
reg |= t.setup; reg |= t.setup;
pci_write_config_byte(pdev, arttim, reg); pci_write_config_byte(pdev, arttim, reg);
/* Load active/recovery */ /* Load active/recovery */
pci_write_config_byte(pdev, drwtim, (t.active << 4) | t.recover); pci_write_config_byte(pdev, drwtim, (t.active << 4) | t.recover);
} }
/** /**
...@@ -193,29 +193,29 @@ static void cmd64x_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -193,29 +193,29 @@ static void cmd64x_set_piomode(struct ata_port *ap, struct ata_device *adev)
* *
* Called to do the DMA mode setup. * Called to do the DMA mode setup.
*/ */
static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev) static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
{ {
static const u8 udma_data[] = { static const u8 udma_data[] = {
0x31, 0x21, 0x11, 0x25, 0x15, 0x05 0x31, 0x21, 0x11, 0x25, 0x15, 0x05
}; };
static const u8 mwdma_data[] = { static const u8 mwdma_data[] = {
0x30, 0x20, 0x10 0x30, 0x20, 0x10
}; };
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
u8 regU, regD; u8 regU, regD;
int pciU = UDIDETCR0 + 8 * ap->port_no; int pciU = UDIDETCR0 + 8 * ap->port_no;
int pciD = BMIDESR0 + 8 * ap->port_no; int pciD = BMIDESR0 + 8 * ap->port_no;
int shift = 2 * adev->devno; int shift = 2 * adev->devno;
pci_read_config_byte(pdev, pciD, &regD); pci_read_config_byte(pdev, pciD, &regD);
pci_read_config_byte(pdev, pciU, &regU); pci_read_config_byte(pdev, pciU, &regU);
regD &= ~(0x20 << shift); regD &= ~(0x20 << shift);
regU &= ~(0x35 << shift); regU &= ~(0x35 << shift);
if (adev->dma_mode >= XFER_UDMA_0) if (adev->dma_mode >= XFER_UDMA_0)
regU |= udma_data[adev->dma_mode - XFER_UDMA_0] << shift; regU |= udma_data[adev->dma_mode - XFER_UDMA_0] << shift;
else else
...@@ -241,13 +241,13 @@ static void cmd648_bmdma_stop(struct ata_queued_cmd *qc) ...@@ -241,13 +241,13 @@ static void cmd648_bmdma_stop(struct ata_queued_cmd *qc)
u8 dma_intr; u8 dma_intr;
int dma_reg = ap->port_no ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0; int dma_reg = ap->port_no ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0;
int dma_mask = ap->port_no ? ARTTIM2 : CFR; int dma_mask = ap->port_no ? ARTTIM2 : CFR;
ata_bmdma_stop(qc); ata_bmdma_stop(qc);
pci_read_config_byte(pdev, dma_reg, &dma_intr); pci_read_config_byte(pdev, dma_reg, &dma_intr);
pci_write_config_byte(pdev, dma_reg, dma_intr | dma_mask); pci_write_config_byte(pdev, dma_reg, dma_intr | dma_mask);
} }
/** /**
* cmd646r1_dma_stop - DMA stop callback * cmd646r1_dma_stop - DMA stop callback
* @qc: Command in progress * @qc: Command in progress
...@@ -259,7 +259,7 @@ static void cmd646r1_bmdma_stop(struct ata_queued_cmd *qc) ...@@ -259,7 +259,7 @@ static void cmd646r1_bmdma_stop(struct ata_queued_cmd *qc)
{ {
ata_bmdma_stop(qc); ata_bmdma_stop(qc);
} }
static struct scsi_host_template cmd64x_sht = { static struct scsi_host_template cmd64x_sht = {
.module = THIS_MODULE, .module = THIS_MODULE,
.name = DRV_NAME, .name = DRV_NAME,
...@@ -306,11 +306,11 @@ static struct ata_port_operations cmd64x_port_ops = { ...@@ -306,11 +306,11 @@ static struct ata_port_operations cmd64x_port_ops = {
.irq_handler = ata_interrupt, .irq_handler = ata_interrupt,
.irq_clear = ata_bmdma_irq_clear, .irq_clear = ata_bmdma_irq_clear,
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
static struct ata_port_operations cmd646r1_port_ops = { static struct ata_port_operations cmd646r1_port_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
...@@ -340,11 +340,11 @@ static struct ata_port_operations cmd646r1_port_ops = { ...@@ -340,11 +340,11 @@ static struct ata_port_operations cmd646r1_port_ops = {
.irq_handler = ata_interrupt, .irq_handler = ata_interrupt,
.irq_clear = ata_bmdma_irq_clear, .irq_clear = ata_bmdma_irq_clear,
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
static struct ata_port_operations cmd648_port_ops = { static struct ata_port_operations cmd648_port_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
...@@ -374,16 +374,16 @@ static struct ata_port_operations cmd648_port_ops = { ...@@ -374,16 +374,16 @@ static struct ata_port_operations cmd648_port_ops = {
.irq_handler = ata_interrupt, .irq_handler = ata_interrupt,
.irq_clear = ata_bmdma_irq_clear, .irq_clear = ata_bmdma_irq_clear,
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{ {
u32 class_rev; u32 class_rev;
static struct ata_port_info cmd_info[6] = { static struct ata_port_info cmd_info[6] = {
{ /* CMD 643 - no UDMA */ { /* CMD 643 - no UDMA */
.sht = &cmd64x_sht, .sht = &cmd64x_sht,
...@@ -433,15 +433,15 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -433,15 +433,15 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
}; };
static struct ata_port_info *port_info[2], *info; static struct ata_port_info *port_info[2], *info;
u8 mrdmode; u8 mrdmode;
info = &cmd_info[id->driver_data]; info = &cmd_info[id->driver_data];
pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev); pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev);
class_rev &= 0xFF; class_rev &= 0xFF;
if (id->driver_data == 0) /* 643 */ if (id->driver_data == 0) /* 643 */
ata_pci_clear_simplex(pdev); ata_pci_clear_simplex(pdev);
if (pdev->device == PCI_DEVICE_ID_CMD_646) { if (pdev->device == PCI_DEVICE_ID_CMD_646) {
/* Does UDMA work ? */ /* Does UDMA work ? */
if (class_rev > 4) if (class_rev > 4)
...@@ -456,14 +456,14 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -456,14 +456,14 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
mrdmode &= ~ 0x30; /* IRQ set up */ mrdmode &= ~ 0x30; /* IRQ set up */
mrdmode |= 0x02; /* Memory read line enable */ mrdmode |= 0x02; /* Memory read line enable */
pci_write_config_byte(pdev, MRDMODE, mrdmode); pci_write_config_byte(pdev, MRDMODE, mrdmode);
/* Force PIO 0 here.. */ /* Force PIO 0 here.. */
/* PPC specific fixup copied from old driver */ /* PPC specific fixup copied from old driver */
#ifdef CONFIG_PPC #ifdef CONFIG_PPC
pci_write_config_byte(pdev, UDIDETCR0, 0xF0); pci_write_config_byte(pdev, UDIDETCR0, 0xF0);
#endif #endif
port_info[0] = port_info[1] = info; port_info[0] = port_info[1] = info;
return ata_pci_init_one(pdev, port_info, 2); return ata_pci_init_one(pdev, port_info, 2);
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* linux/drivers/ide/pci/cy82c693.c Version 0.40 Sep. 10, 2002 * linux/drivers/ide/pci/cy82c693.c Version 0.40 Sep. 10, 2002
* *
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
...@@ -59,7 +59,7 @@ static void cy82c693_error_handler(struct ata_port *ap) ...@@ -59,7 +59,7 @@ static void cy82c693_error_handler(struct ata_port *ap)
* *
* Called to do the PIO mode setup. * Called to do the PIO mode setup.
*/ */
static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev) static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
...@@ -67,7 +67,7 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -67,7 +67,7 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev)
const unsigned long T = 1000000 / 33; const unsigned long T = 1000000 / 33;
short time_16, time_8; short time_16, time_8;
u32 addr; u32 addr;
if (ata_timing_compute(adev, adev->pio_mode, &t, T, 1) < 0) { if (ata_timing_compute(adev, adev->pio_mode, &t, T, 1) < 0) {
printk(KERN_ERR DRV_NAME ": mome computation failed.\n"); printk(KERN_ERR DRV_NAME ": mome computation failed.\n");
return; return;
...@@ -75,20 +75,20 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -75,20 +75,20 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev)
time_16 = FIT(t.recover, 0, 15) | (FIT(t.active, 0, 15) << 4); time_16 = FIT(t.recover, 0, 15) | (FIT(t.active, 0, 15) << 4);
time_8 = FIT(t.act8b, 0, 15) | (FIT(t.rec8b, 0, 15) << 4); time_8 = FIT(t.act8b, 0, 15) | (FIT(t.rec8b, 0, 15) << 4);
if (adev->devno == 0) { if (adev->devno == 0) {
pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr);
addr &= ~0x0F; /* Mask bits */ addr &= ~0x0F; /* Mask bits */
addr |= FIT(t.setup, 0, 15); addr |= FIT(t.setup, 0, 15);
pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr);
pci_write_config_byte(pdev, CY82_IDE_MASTER_IOR, time_16); pci_write_config_byte(pdev, CY82_IDE_MASTER_IOR, time_16);
pci_write_config_byte(pdev, CY82_IDE_MASTER_IOW, time_16); pci_write_config_byte(pdev, CY82_IDE_MASTER_IOW, time_16);
pci_write_config_byte(pdev, CY82_IDE_MASTER_8BIT, time_8); pci_write_config_byte(pdev, CY82_IDE_MASTER_8BIT, time_8);
} else { } else {
pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr);
addr &= ~0xF0; /* Mask bits */ addr &= ~0xF0; /* Mask bits */
addr |= (FIT(t.setup, 0, 15) << 4); addr |= (FIT(t.setup, 0, 15) << 4);
...@@ -106,15 +106,15 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -106,15 +106,15 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev)
* *
* Called to do the DMA mode setup. * Called to do the DMA mode setup.
*/ */
static void cy82c693_set_dmamode(struct ata_port *ap, struct ata_device *adev) static void cy82c693_set_dmamode(struct ata_port *ap, struct ata_device *adev)
{ {
int reg = CY82_INDEX_CHANNEL0 + ap->port_no; int reg = CY82_INDEX_CHANNEL0 + ap->port_no;
/* Be afraid, be very afraid. Magic registers in low I/O space */ /* Be afraid, be very afraid. Magic registers in low I/O space */
outb(reg, 0x22); outb(reg, 0x22);
outb(adev->dma_mode - XFER_MW_DMA_0, 0x23); outb(adev->dma_mode - XFER_MW_DMA_0, 0x23);
/* 0x50 gives the best behaviour on the Alpha's using this chip */ /* 0x50 gives the best behaviour on the Alpha's using this chip */
outb(CY82_INDEX_TIMEOUT, 0x22); outb(CY82_INDEX_TIMEOUT, 0x22);
outb(0x50, 0x23); outb(0x50, 0x23);
...@@ -143,7 +143,7 @@ static struct ata_port_operations cy82c693_port_ops = { ...@@ -143,7 +143,7 @@ static struct ata_port_operations cy82c693_port_ops = {
.set_piomode = cy82c693_set_piomode, .set_piomode = cy82c693_set_piomode,
.set_dmamode = cy82c693_set_dmamode, .set_dmamode = cy82c693_set_dmamode,
.mode_filter = ata_pci_default_filter, .mode_filter = ata_pci_default_filter,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
.check_status = ata_check_status, .check_status = ata_check_status,
...@@ -167,11 +167,11 @@ static struct ata_port_operations cy82c693_port_ops = { ...@@ -167,11 +167,11 @@ static struct ata_port_operations cy82c693_port_ops = {
.irq_handler = ata_interrupt, .irq_handler = ata_interrupt,
.irq_clear = ata_bmdma_irq_clear, .irq_clear = ata_bmdma_irq_clear,
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *id) static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{ {
...@@ -183,13 +183,13 @@ static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *i ...@@ -183,13 +183,13 @@ static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *i
.port_ops = &cy82c693_port_ops .port_ops = &cy82c693_port_ops
}; };
static struct ata_port_info *port_info[1] = { &info }; static struct ata_port_info *port_info[1] = { &info };
/* Devfn 1 is the ATA primary. The secondary is magic and on devfn2. For the /* Devfn 1 is the ATA primary. The secondary is magic and on devfn2. For the
moment we don't handle the secondary. FIXME */ moment we don't handle the secondary. FIXME */
if (PCI_FUNC(pdev->devfn) != 1) if (PCI_FUNC(pdev->devfn) != 1)
return -ENODEV; return -ENODEV;
return ata_pci_init_one(pdev, port_info, 1); return ata_pci_init_one(pdev, port_info, 1);
} }
......
...@@ -168,7 +168,7 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, cons ...@@ -168,7 +168,7 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, cons
while(list[i] != NULL) { while(list[i] != NULL) {
if (!strncmp(list[i], s, len)) { if (!strncmp(list[i], s, len)) {
printk(KERN_WARNING DRV_NAME ": %s is not supported for %s.\n", printk(KERN_WARNING DRV_NAME ": %s is not supported for %s.\n",
modestr, list[i]); modestr, list[i]);
return 1; return 1;
} }
...@@ -184,7 +184,7 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, cons ...@@ -184,7 +184,7 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, cons
* *
* Block UDMA on devices that cause trouble with this controller. * Block UDMA on devices that cause trouble with this controller.
*/ */
static unsigned long hpt366_filter(const struct ata_port *ap, struct ata_device *adev, unsigned long mask) static unsigned long hpt366_filter(const struct ata_port *ap, struct ata_device *adev, unsigned long mask)
{ {
if (adev->class == ATA_DEV_ATA) { if (adev->class == ATA_DEV_ATA) {
...@@ -206,11 +206,11 @@ static unsigned long hpt366_filter(const struct ata_port *ap, struct ata_device ...@@ -206,11 +206,11 @@ static unsigned long hpt366_filter(const struct ata_port *ap, struct ata_device
* Return the 32bit register programming information for this channel * Return the 32bit register programming information for this channel
* that matches the speed provided. * that matches the speed provided.
*/ */
static u32 hpt36x_find_mode(struct ata_port *ap, int speed) static u32 hpt36x_find_mode(struct ata_port *ap, int speed)
{ {
struct hpt_clock *clocks = ap->host->private_data; struct hpt_clock *clocks = ap->host->private_data;
while(clocks->xfer_speed) { while(clocks->xfer_speed) {
if (clocks->xfer_speed == speed) if (clocks->xfer_speed == speed)
return clocks->timing; return clocks->timing;
...@@ -219,12 +219,12 @@ static u32 hpt36x_find_mode(struct ata_port *ap, int speed) ...@@ -219,12 +219,12 @@ static u32 hpt36x_find_mode(struct ata_port *ap, int speed)
BUG(); BUG();
return 0xffffffffU; /* silence compiler warning */ return 0xffffffffU; /* silence compiler warning */
} }
static int hpt36x_pre_reset(struct ata_port *ap) static int hpt36x_pre_reset(struct ata_port *ap)
{ {
u8 ata66; u8 ata66;
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
pci_read_config_byte(pdev, 0x5A, &ata66); pci_read_config_byte(pdev, 0x5A, &ata66);
if (ata66 & (1 << ap->port_no)) if (ata66 & (1 << ap->port_no))
ap->cbl = ATA_CBL_PATA40; ap->cbl = ATA_CBL_PATA40;
...@@ -239,7 +239,7 @@ static int hpt36x_pre_reset(struct ata_port *ap) ...@@ -239,7 +239,7 @@ static int hpt36x_pre_reset(struct ata_port *ap)
* *
* Perform the reset handling for the 366/368 * Perform the reset handling for the 366/368
*/ */
static void hpt36x_error_handler(struct ata_port *ap) static void hpt36x_error_handler(struct ata_port *ap)
{ {
ata_bmdma_drive_eh(ap, hpt36x_pre_reset, ata_std_softreset, NULL, ata_std_postreset); ata_bmdma_drive_eh(ap, hpt36x_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
...@@ -250,9 +250,9 @@ static void hpt36x_error_handler(struct ata_port *ap) ...@@ -250,9 +250,9 @@ static void hpt36x_error_handler(struct ata_port *ap)
* @ap: ATA interface * @ap: ATA interface
* @adev: device on the interface * @adev: device on the interface
* *
* Perform PIO mode setup. * Perform PIO mode setup.
*/ */
static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev) static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
...@@ -263,14 +263,14 @@ static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -263,14 +263,14 @@ static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev)
addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no);
addr2 = 0x51 + 4 * ap->port_no; addr2 = 0x51 + 4 * ap->port_no;
/* Fast interrupt prediction disable, hold off interrupt disable */ /* Fast interrupt prediction disable, hold off interrupt disable */
pci_read_config_byte(pdev, addr2, &fast); pci_read_config_byte(pdev, addr2, &fast);
if (fast & 0x80) { if (fast & 0x80) {
fast &= ~0x80; fast &= ~0x80;
pci_write_config_byte(pdev, addr2, fast); pci_write_config_byte(pdev, addr2, fast);
} }
pci_read_config_dword(pdev, addr1, &reg); pci_read_config_dword(pdev, addr1, &reg);
mode = hpt36x_find_mode(ap, adev->pio_mode); mode = hpt36x_find_mode(ap, adev->pio_mode);
mode &= ~0x8000000; /* No FIFO in PIO */ mode &= ~0x8000000; /* No FIFO in PIO */
...@@ -287,7 +287,7 @@ static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -287,7 +287,7 @@ static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev)
* Set up the channel for MWDMA or UDMA modes. Much the same as with * Set up the channel for MWDMA or UDMA modes. Much the same as with
* PIO, load the mode number and then set MWDMA or UDMA flag. * PIO, load the mode number and then set MWDMA or UDMA flag.
*/ */
static void hpt366_set_dmamode(struct ata_port *ap, struct ata_device *adev) static void hpt366_set_dmamode(struct ata_port *ap, struct ata_device *adev)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
...@@ -298,14 +298,14 @@ static void hpt366_set_dmamode(struct ata_port *ap, struct ata_device *adev) ...@@ -298,14 +298,14 @@ static void hpt366_set_dmamode(struct ata_port *ap, struct ata_device *adev)
addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no);
addr2 = 0x51 + 4 * ap->port_no; addr2 = 0x51 + 4 * ap->port_no;
/* Fast interrupt prediction disable, hold off interrupt disable */ /* Fast interrupt prediction disable, hold off interrupt disable */
pci_read_config_byte(pdev, addr2, &fast); pci_read_config_byte(pdev, addr2, &fast);
if (fast & 0x80) { if (fast & 0x80) {
fast &= ~0x80; fast &= ~0x80;
pci_write_config_byte(pdev, addr2, fast); pci_write_config_byte(pdev, addr2, fast);
} }
pci_read_config_dword(pdev, addr1, &reg); pci_read_config_dword(pdev, addr1, &reg);
mode = hpt36x_find_mode(ap, adev->dma_mode); mode = hpt36x_find_mode(ap, adev->dma_mode);
mode |= 0x8000000; /* FIFO in MWDMA or UDMA */ mode |= 0x8000000; /* FIFO in MWDMA or UDMA */
...@@ -335,13 +335,13 @@ static struct scsi_host_template hpt36x_sht = { ...@@ -335,13 +335,13 @@ static struct scsi_host_template hpt36x_sht = {
/* /*
* Configuration for HPT366/68 * Configuration for HPT366/68
*/ */
static struct ata_port_operations hpt366_port_ops = { static struct ata_port_operations hpt366_port_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.set_piomode = hpt366_set_piomode, .set_piomode = hpt366_set_piomode,
.set_dmamode = hpt366_set_dmamode, .set_dmamode = hpt366_set_dmamode,
.mode_filter = hpt366_filter, .mode_filter = hpt366_filter,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
.check_status = ata_check_status, .check_status = ata_check_status,
...@@ -369,7 +369,7 @@ static struct ata_port_operations hpt366_port_ops = { ...@@ -369,7 +369,7 @@ static struct ata_port_operations hpt366_port_ops = {
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
/** /**
* hpt36x_init_one - Initialise an HPT366/368 * hpt36x_init_one - Initialise an HPT366/368
...@@ -391,7 +391,7 @@ static struct ata_port_operations hpt366_port_ops = { ...@@ -391,7 +391,7 @@ static struct ata_port_operations hpt366_port_ops = {
* HPT37x/30x 4 (HPT366) 3+ Other driver * HPT37x/30x 4 (HPT366) 3+ Other driver
* *
*/ */
static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
static struct ata_port_info info_hpt366 = { static struct ata_port_info info_hpt366 = {
...@@ -410,7 +410,7 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -410,7 +410,7 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
class_rev &= 0xFF; class_rev &= 0xFF;
/* May be a later chip in disguise. Check */ /* May be a later chip in disguise. Check */
/* Newer chips are not in the HPT36x driver. Ignore them */ /* Newer chips are not in the HPT36x driver. Ignore them */
if (class_rev > 2) if (class_rev > 2)
...@@ -426,7 +426,7 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -426,7 +426,7 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
pci_write_config_byte(dev, 0x51, drive_fast & ~0x80); pci_write_config_byte(dev, 0x51, drive_fast & ~0x80);
pci_read_config_dword(dev, 0x40, &reg1); pci_read_config_dword(dev, 0x40, &reg1);
/* PCI clocking determines the ATA timing values to use */ /* PCI clocking determines the ATA timing values to use */
/* info_hpt366 is safe against re-entry so we can scribble on it */ /* info_hpt366 is safe against re-entry so we can scribble on it */
switch(reg1 & 0x700) { switch(reg1 & 0x700) {
......
This diff is collapsed.
...@@ -65,7 +65,7 @@ struct hpt_chip { ...@@ -65,7 +65,7 @@ struct hpt_chip {
* PIO. * PIO.
* 31 FIFO enable. * 31 FIFO enable.
*/ */
/* 66MHz DPLL clocks */ /* 66MHz DPLL clocks */
static struct hpt_clock hpt3x2n_clocks[] = { static struct hpt_clock hpt3x2n_clocks[] = {
...@@ -100,11 +100,11 @@ static struct hpt_clock hpt3x2n_clocks[] = { ...@@ -100,11 +100,11 @@ static struct hpt_clock hpt3x2n_clocks[] = {
* is hard coded but easy to change. This will be needed if we use * is hard coded but easy to change. This will be needed if we use
* different DPLLs * different DPLLs
*/ */
static u32 hpt3x2n_find_mode(struct ata_port *ap, int speed) static u32 hpt3x2n_find_mode(struct ata_port *ap, int speed)
{ {
struct hpt_clock *clocks = hpt3x2n_clocks; struct hpt_clock *clocks = hpt3x2n_clocks;
while(clocks->xfer_speed) { while(clocks->xfer_speed) {
if (clocks->xfer_speed == speed) if (clocks->xfer_speed == speed)
return clocks->timing; return clocks->timing;
...@@ -121,52 +121,52 @@ static u32 hpt3x2n_find_mode(struct ata_port *ap, int speed) ...@@ -121,52 +121,52 @@ static u32 hpt3x2n_find_mode(struct ata_port *ap, int speed)
* Perform the initial reset handling for the 3x2n series controllers. * Perform the initial reset handling for the 3x2n series controllers.
* Reset the hardware and state machine, obtain the cable type. * Reset the hardware and state machine, obtain the cable type.
*/ */
static int hpt3xn_pre_reset(struct ata_port *ap) static int hpt3xn_pre_reset(struct ata_port *ap)
{ {
u8 scr2, ata66; u8 scr2, ata66;
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
pci_read_config_byte(pdev, 0x5B, &scr2); pci_read_config_byte(pdev, 0x5B, &scr2);
pci_write_config_byte(pdev, 0x5B, scr2 & ~0x01); pci_write_config_byte(pdev, 0x5B, scr2 & ~0x01);
/* Cable register now active */ /* Cable register now active */
pci_read_config_byte(pdev, 0x5A, &ata66); pci_read_config_byte(pdev, 0x5A, &ata66);
/* Restore state */ /* Restore state */
pci_write_config_byte(pdev, 0x5B, scr2); pci_write_config_byte(pdev, 0x5B, scr2);
if (ata66 & (1 << ap->port_no)) if (ata66 & (1 << ap->port_no))
ap->cbl = ATA_CBL_PATA40; ap->cbl = ATA_CBL_PATA40;
else else
ap->cbl = ATA_CBL_PATA80; ap->cbl = ATA_CBL_PATA80;
/* Reset the state machine */ /* Reset the state machine */
pci_write_config_byte(pdev, 0x50, 0x37); pci_write_config_byte(pdev, 0x50, 0x37);
pci_write_config_byte(pdev, 0x54, 0x37); pci_write_config_byte(pdev, 0x54, 0x37);
udelay(100); udelay(100);
return ata_std_prereset(ap); return ata_std_prereset(ap);
} }
/** /**
* hpt3x2n_error_handler - probe the hpt3x2n bus * hpt3x2n_error_handler - probe the hpt3x2n bus
* @ap: ATA port to reset * @ap: ATA port to reset
* *
* Perform the probe reset handling for the 3x2N * Perform the probe reset handling for the 3x2N
*/ */
static void hpt3x2n_error_handler(struct ata_port *ap) static void hpt3x2n_error_handler(struct ata_port *ap)
{ {
ata_bmdma_drive_eh(ap, hpt3xn_pre_reset, ata_std_softreset, NULL, ata_std_postreset); ata_bmdma_drive_eh(ap, hpt3xn_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
} }
/** /**
* hpt3x2n_set_piomode - PIO setup * hpt3x2n_set_piomode - PIO setup
* @ap: ATA interface * @ap: ATA interface
* @adev: device on the interface * @adev: device on the interface
* *
* Perform PIO mode setup. * Perform PIO mode setup.
*/ */
static void hpt3x2n_set_piomode(struct ata_port *ap, struct ata_device *adev) static void hpt3x2n_set_piomode(struct ata_port *ap, struct ata_device *adev)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
...@@ -177,12 +177,12 @@ static void hpt3x2n_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -177,12 +177,12 @@ static void hpt3x2n_set_piomode(struct ata_port *ap, struct ata_device *adev)
addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no);
addr2 = 0x51 + 4 * ap->port_no; addr2 = 0x51 + 4 * ap->port_no;
/* Fast interrupt prediction disable, hold off interrupt disable */ /* Fast interrupt prediction disable, hold off interrupt disable */
pci_read_config_byte(pdev, addr2, &fast); pci_read_config_byte(pdev, addr2, &fast);
fast &= ~0x07; fast &= ~0x07;
pci_write_config_byte(pdev, addr2, fast); pci_write_config_byte(pdev, addr2, fast);
pci_read_config_dword(pdev, addr1, &reg); pci_read_config_dword(pdev, addr1, &reg);
mode = hpt3x2n_find_mode(ap, adev->pio_mode); mode = hpt3x2n_find_mode(ap, adev->pio_mode);
mode &= ~0x8000000; /* No FIFO in PIO */ mode &= ~0x8000000; /* No FIFO in PIO */
...@@ -199,7 +199,7 @@ static void hpt3x2n_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -199,7 +199,7 @@ static void hpt3x2n_set_piomode(struct ata_port *ap, struct ata_device *adev)
* Set up the channel for MWDMA or UDMA modes. Much the same as with * Set up the channel for MWDMA or UDMA modes. Much the same as with
* PIO, load the mode number and then set MWDMA or UDMA flag. * PIO, load the mode number and then set MWDMA or UDMA flag.
*/ */
static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev) static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
...@@ -210,12 +210,12 @@ static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev) ...@@ -210,12 +210,12 @@ static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev)
addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no);
addr2 = 0x51 + 4 * ap->port_no; addr2 = 0x51 + 4 * ap->port_no;
/* Fast interrupt prediction disable, hold off interrupt disable */ /* Fast interrupt prediction disable, hold off interrupt disable */
pci_read_config_byte(pdev, addr2, &fast); pci_read_config_byte(pdev, addr2, &fast);
fast &= ~0x07; fast &= ~0x07;
pci_write_config_byte(pdev, addr2, fast); pci_write_config_byte(pdev, addr2, fast);
pci_read_config_dword(pdev, addr1, &reg); pci_read_config_dword(pdev, addr1, &reg);
mode = hpt3x2n_find_mode(ap, adev->dma_mode); mode = hpt3x2n_find_mode(ap, adev->dma_mode);
mode |= 0x8000000; /* FIFO in MWDMA or UDMA */ mode |= 0x8000000; /* FIFO in MWDMA or UDMA */
...@@ -230,14 +230,14 @@ static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev) ...@@ -230,14 +230,14 @@ static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev)
* *
* Clean up after the HPT3x2n and later DMA engine * Clean up after the HPT3x2n and later DMA engine
*/ */
static void hpt3x2n_bmdma_stop(struct ata_queued_cmd *qc) static void hpt3x2n_bmdma_stop(struct ata_queued_cmd *qc)
{ {
struct ata_port *ap = qc->ap; struct ata_port *ap = qc->ap;
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
int mscreg = 0x50 + 2 * ap->port_no; int mscreg = 0x50 + 2 * ap->port_no;
u8 bwsr_stat, msc_stat; u8 bwsr_stat, msc_stat;
pci_read_config_byte(pdev, 0x6A, &bwsr_stat); pci_read_config_byte(pdev, 0x6A, &bwsr_stat);
pci_read_config_byte(pdev, mscreg, &msc_stat); pci_read_config_byte(pdev, mscreg, &msc_stat);
if (bwsr_stat & (1 << ap->port_no)) if (bwsr_stat & (1 << ap->port_no))
...@@ -257,29 +257,29 @@ static void hpt3x2n_bmdma_stop(struct ata_queued_cmd *qc) ...@@ -257,29 +257,29 @@ static void hpt3x2n_bmdma_stop(struct ata_queued_cmd *qc)
* - writing * - writing
* - second channel UDMA7 (SATA ports) or higher * - second channel UDMA7 (SATA ports) or higher
* - 66MHz PCI * - 66MHz PCI
* *
* or we will underclock the device and get reduced performance. * or we will underclock the device and get reduced performance.
*/ */
static void hpt3x2n_set_clock(struct ata_port *ap, int source) static void hpt3x2n_set_clock(struct ata_port *ap, int source)
{ {
unsigned long bmdma = ap->ioaddr.bmdma_addr; unsigned long bmdma = ap->ioaddr.bmdma_addr;
/* Tristate the bus */ /* Tristate the bus */
outb(0x80, bmdma+0x73); outb(0x80, bmdma+0x73);
outb(0x80, bmdma+0x77); outb(0x80, bmdma+0x77);
/* Switch clock and reset channels */ /* Switch clock and reset channels */
outb(source, bmdma+0x7B); outb(source, bmdma+0x7B);
outb(0xC0, bmdma+0x79); outb(0xC0, bmdma+0x79);
/* Reset state machines */ /* Reset state machines */
outb(0x37, bmdma+0x70); outb(0x37, bmdma+0x70);
outb(0x37, bmdma+0x74); outb(0x37, bmdma+0x74);
/* Complete reset */ /* Complete reset */
outb(0x00, bmdma+0x79); outb(0x00, bmdma+0x79);
/* Reconnect channels to bus */ /* Reconnect channels to bus */
outb(0x00, bmdma+0x73); outb(0x00, bmdma+0x73);
outb(0x00, bmdma+0x77); outb(0x00, bmdma+0x77);
...@@ -291,7 +291,7 @@ static int hpt3x2n_pair_idle(struct ata_port *ap) ...@@ -291,7 +291,7 @@ static int hpt3x2n_pair_idle(struct ata_port *ap)
{ {
struct ata_host *host = ap->host; struct ata_host *host = ap->host;
struct ata_port *pair = host->ports[ap->port_no ^ 1]; struct ata_port *pair = host->ports[ap->port_no ^ 1];
if (pair->hsm_task_state == HSM_ST_IDLE) if (pair->hsm_task_state == HSM_ST_IDLE)
return 1; return 1;
return 0; return 0;
...@@ -305,7 +305,7 @@ static int hpt3x2n_use_dpll(struct ata_port *ap, int reading) ...@@ -305,7 +305,7 @@ static int hpt3x2n_use_dpll(struct ata_port *ap, int reading)
return USE_DPLL; /* Needed for write */ return USE_DPLL; /* Needed for write */
if (flags & PCI66) if (flags & PCI66)
return USE_DPLL; /* Needed at 66Mhz */ return USE_DPLL; /* Needed at 66Mhz */
return 0; return 0;
} }
static unsigned int hpt3x2n_qc_issue_prot(struct ata_queued_cmd *qc) static unsigned int hpt3x2n_qc_issue_prot(struct ata_queued_cmd *qc)
...@@ -313,7 +313,7 @@ static unsigned int hpt3x2n_qc_issue_prot(struct ata_queued_cmd *qc) ...@@ -313,7 +313,7 @@ static unsigned int hpt3x2n_qc_issue_prot(struct ata_queued_cmd *qc)
struct ata_taskfile *tf = &qc->tf; struct ata_taskfile *tf = &qc->tf;
struct ata_port *ap = qc->ap; struct ata_port *ap = qc->ap;
int flags = (long)ap->host->private_data; int flags = (long)ap->host->private_data;
if (hpt3x2n_pair_idle(ap)) { if (hpt3x2n_pair_idle(ap)) {
int dpll = hpt3x2n_use_dpll(ap, (tf->flags & ATA_TFLAG_WRITE)); int dpll = hpt3x2n_use_dpll(ap, (tf->flags & ATA_TFLAG_WRITE));
if ((flags & USE_DPLL) != dpll) { if ((flags & USE_DPLL) != dpll) {
...@@ -347,13 +347,13 @@ static struct scsi_host_template hpt3x2n_sht = { ...@@ -347,13 +347,13 @@ static struct scsi_host_template hpt3x2n_sht = {
/* /*
* Configuration for HPT3x2n. * Configuration for HPT3x2n.
*/ */
static struct ata_port_operations hpt3x2n_port_ops = { static struct ata_port_operations hpt3x2n_port_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.set_piomode = hpt3x2n_set_piomode, .set_piomode = hpt3x2n_set_piomode,
.set_dmamode = hpt3x2n_set_dmamode, .set_dmamode = hpt3x2n_set_dmamode,
.mode_filter = ata_pci_default_filter, .mode_filter = ata_pci_default_filter,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
.check_status = ata_check_status, .check_status = ata_check_status,
...@@ -381,11 +381,11 @@ static struct ata_port_operations hpt3x2n_port_ops = { ...@@ -381,11 +381,11 @@ static struct ata_port_operations hpt3x2n_port_ops = {
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
/** /**
* hpt3xn_calibrate_dpll - Calibrate the DPLL loop * hpt3xn_calibrate_dpll - Calibrate the DPLL loop
* @dev: PCI device * @dev: PCI device
* *
* Perform a calibration cycle on the HPT3xN DPLL. Returns 1 if this * Perform a calibration cycle on the HPT3xN DPLL. Returns 1 if this
* succeeds * succeeds
...@@ -396,7 +396,7 @@ static int hpt3xn_calibrate_dpll(struct pci_dev *dev) ...@@ -396,7 +396,7 @@ static int hpt3xn_calibrate_dpll(struct pci_dev *dev)
u8 reg5b; u8 reg5b;
u32 reg5c; u32 reg5c;
int tries; int tries;
for(tries = 0; tries < 0x5000; tries++) { for(tries = 0; tries < 0x5000; tries++) {
udelay(50); udelay(50);
pci_read_config_byte(dev, 0x5b, &reg5b); pci_read_config_byte(dev, 0x5b, &reg5b);
...@@ -422,16 +422,16 @@ static int hpt3x2n_pci_clock(struct pci_dev *pdev) ...@@ -422,16 +422,16 @@ static int hpt3x2n_pci_clock(struct pci_dev *pdev)
{ {
unsigned long freq; unsigned long freq;
u32 fcnt; u32 fcnt;
pci_read_config_dword(pdev, 0x70/*CHECKME*/, &fcnt); pci_read_config_dword(pdev, 0x70/*CHECKME*/, &fcnt);
if ((fcnt >> 12) != 0xABCDE) { if ((fcnt >> 12) != 0xABCDE) {
printk(KERN_WARNING "hpt3xn: BIOS clock data not set.\n"); printk(KERN_WARNING "hpt3xn: BIOS clock data not set.\n");
return 33; /* Not BIOS set */ return 33; /* Not BIOS set */
} }
fcnt &= 0x1FF; fcnt &= 0x1FF;
freq = (fcnt * 77) / 192; freq = (fcnt * 77) / 192;
/* Clamp to bands */ /* Clamp to bands */
if (freq < 40) if (freq < 40)
return 33; return 33;
...@@ -471,7 +471,7 @@ static int hpt3x2n_pci_clock(struct pci_dev *pdev) ...@@ -471,7 +471,7 @@ static int hpt3x2n_pci_clock(struct pci_dev *pdev)
* *
* To pin down HPT371N * To pin down HPT371N
*/ */
static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
/* HPT372N and friends - UDMA133 */ /* HPT372N and friends - UDMA133 */
...@@ -488,14 +488,14 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -488,14 +488,14 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
u8 irqmask; u8 irqmask;
u32 class_rev; u32 class_rev;
unsigned int pci_mhz; unsigned int pci_mhz;
unsigned int f_low, f_high; unsigned int f_low, f_high;
int adjust; int adjust;
pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
class_rev &= 0xFF; class_rev &= 0xFF;
switch(dev->device) { switch(dev->device) {
case PCI_DEVICE_ID_TTI_HPT366: case PCI_DEVICE_ID_TTI_HPT366:
if (class_rev < 6) if (class_rev < 6)
...@@ -530,16 +530,16 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -530,16 +530,16 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
/* Tune the PLL. HPT recommend using 75 for SATA, 66 for UDMA133 or /* Tune the PLL. HPT recommend using 75 for SATA, 66 for UDMA133 or
50 for UDMA100. Right now we always use 66 */ 50 for UDMA100. Right now we always use 66 */
pci_mhz = hpt3x2n_pci_clock(dev); pci_mhz = hpt3x2n_pci_clock(dev);
f_low = (pci_mhz * 48) / 66; /* PCI Mhz for 66Mhz DPLL */ f_low = (pci_mhz * 48) / 66; /* PCI Mhz for 66Mhz DPLL */
f_high = f_low + 2; /* Tolerance */ f_high = f_low + 2; /* Tolerance */
pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100); pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100);
/* PLL clock */ /* PLL clock */
pci_write_config_byte(dev, 0x5B, 0x21); pci_write_config_byte(dev, 0x5B, 0x21);
/* Unlike the 37x we don't try jiggling the frequency */ /* Unlike the 37x we don't try jiggling the frequency */
for(adjust = 0; adjust < 8; adjust++) { for(adjust = 0; adjust < 8; adjust++) {
if (hpt3xn_calibrate_dpll(dev)) if (hpt3xn_calibrate_dpll(dev))
...@@ -554,7 +554,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -554,7 +554,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
port->private_data = NULL; port->private_data = NULL;
if (pci_mhz > 60) if (pci_mhz > 60)
port->private_data = (void *)PCI66; port->private_data = (void *)PCI66;
/* Now kick off ATA set up */ /* Now kick off ATA set up */
port_info[0] = port_info[1] = port; port_info[0] = port_info[1] = port;
return ata_pci_init_one(dev, port_info, 2); return ata_pci_init_one(dev, port_info, 2);
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* May be copied or modified under the terms of the GNU General Public * May be copied or modified under the terms of the GNU General Public
* License * License
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
......
...@@ -58,7 +58,7 @@ static int it8172_pre_reset(struct ata_port *ap) ...@@ -58,7 +58,7 @@ static int it8172_pre_reset(struct ata_port *ap)
}; };
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
if (ap->port_no && !pci_test_config_bits(pdev, &it8172_enable_bits[ap->port_no])) { if (ap->port_no && !pci_test_config_bits(pdev, &it8172_enable_bits[ap->port_no])) {
ata_port_disable(ap); ata_port_disable(ap);
printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id); printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* based upon * based upon
* *
* it821x.c * it821x.c
* *
* linux/drivers/ide/pci/it821x.c Version 0.09 December 2004 * linux/drivers/ide/pci/it821x.c Version 0.09 December 2004
* *
* Copyright (C) 2004 Red Hat <alan@redhat.com> * Copyright (C) 2004 Red Hat <alan@redhat.com>
...@@ -118,7 +118,7 @@ static int it8212_noraid; ...@@ -118,7 +118,7 @@ static int it8212_noraid;
* *
* Set the cable type * Set the cable type
*/ */
static int it821x_pre_reset(struct ata_port *ap) static int it821x_pre_reset(struct ata_port *ap)
{ {
ap->cbl = ATA_CBL_PATA80; ap->cbl = ATA_CBL_PATA80;
...@@ -131,7 +131,7 @@ static int it821x_pre_reset(struct ata_port *ap) ...@@ -131,7 +131,7 @@ static int it821x_pre_reset(struct ata_port *ap)
* *
* Set the cable type and trigger a probe * Set the cable type and trigger a probe
*/ */
static void it821x_error_handler(struct ata_port *ap) static void it821x_error_handler(struct ata_port *ap)
{ {
return ata_bmdma_drive_eh(ap, it821x_pre_reset, ata_std_softreset, NULL, ata_std_postreset); return ata_bmdma_drive_eh(ap, it821x_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
...@@ -286,7 +286,7 @@ static void it821x_passthru_set_piomode(struct ata_port *ap, struct ata_device * ...@@ -286,7 +286,7 @@ static void it821x_passthru_set_piomode(struct ata_port *ap, struct ata_device *
struct it821x_dev *itdev = ap->private_data; struct it821x_dev *itdev = ap->private_data;
int unit = adev->devno; int unit = adev->devno;
int mode_wanted = adev->pio_mode - XFER_PIO_0; int mode_wanted = adev->pio_mode - XFER_PIO_0;
/* We prefer 66Mhz clock for PIO 0-3, don't care for PIO4 */ /* We prefer 66Mhz clock for PIO 0-3, don't care for PIO4 */
itdev->want[unit][1] = pio_want[mode_wanted]; itdev->want[unit][1] = pio_want[mode_wanted];
itdev->want[unit][0] = 1; /* PIO is lowest priority */ itdev->want[unit][0] = 1; /* PIO is lowest priority */
...@@ -301,7 +301,7 @@ static void it821x_passthru_set_piomode(struct ata_port *ap, struct ata_device * ...@@ -301,7 +301,7 @@ static void it821x_passthru_set_piomode(struct ata_port *ap, struct ata_device *
* @adev: ATA device * @adev: ATA device
* *
* Set up the DMA modes. The actions taken depend heavily on the mode * Set up the DMA modes. The actions taken depend heavily on the mode
* to use. If UDMA is used as is hopefully the usual case then the * to use. If UDMA is used as is hopefully the usual case then the
* timing register is private and we need only consider the clock. If * timing register is private and we need only consider the clock. If
* we are using MWDMA then we have to manage the setting ourself as * we are using MWDMA then we have to manage the setting ourself as
* we switch devices and mode. * we switch devices and mode.
...@@ -322,7 +322,7 @@ static void it821x_passthru_set_dmamode(struct ata_port *ap, struct ata_device * ...@@ -322,7 +322,7 @@ static void it821x_passthru_set_dmamode(struct ata_port *ap, struct ata_device *
if (adev->dma_mode >= XFER_UDMA_0) { if (adev->dma_mode >= XFER_UDMA_0) {
int mode_wanted = adev->dma_mode - XFER_UDMA_0; int mode_wanted = adev->dma_mode - XFER_UDMA_0;
itdev->want[unit][1] = udma_want[mode_wanted]; itdev->want[unit][1] = udma_want[mode_wanted];
itdev->want[unit][0] = 3; /* UDMA is high priority */ itdev->want[unit][0] = 3; /* UDMA is high priority */
itdev->mwdma[unit] = MWDMA_OFF; itdev->mwdma[unit] = MWDMA_OFF;
...@@ -341,7 +341,7 @@ static void it821x_passthru_set_dmamode(struct ata_port *ap, struct ata_device * ...@@ -341,7 +341,7 @@ static void it821x_passthru_set_dmamode(struct ata_port *ap, struct ata_device *
it821x_program_udma(ap, adev, itdev->udma[unit]); it821x_program_udma(ap, adev, itdev->udma[unit]);
} else { } else {
int mode_wanted = adev->dma_mode - XFER_MW_DMA_0; int mode_wanted = adev->dma_mode - XFER_MW_DMA_0;
itdev->want[unit][1] = mwdma_want[mode_wanted]; itdev->want[unit][1] = mwdma_want[mode_wanted];
itdev->want[unit][0] = 2; /* MWDMA is low priority */ itdev->want[unit][0] = 2; /* MWDMA is low priority */
itdev->mwdma[unit] = dma[mode_wanted]; itdev->mwdma[unit] = dma[mode_wanted];
...@@ -363,7 +363,7 @@ static void it821x_passthru_set_dmamode(struct ata_port *ap, struct ata_device * ...@@ -363,7 +363,7 @@ static void it821x_passthru_set_dmamode(struct ata_port *ap, struct ata_device *
* @qc: Command in progress * @qc: Command in progress
* *
* Usually drivers set the DMA timing at the point the set_dmamode call * Usually drivers set the DMA timing at the point the set_dmamode call
* is made. IT821x however requires we load new timings on the * is made. IT821x however requires we load new timings on the
* transitions in some cases. * transitions in some cases.
*/ */
...@@ -410,7 +410,7 @@ static void it821x_passthru_bmdma_stop(struct ata_queued_cmd *qc) ...@@ -410,7 +410,7 @@ static void it821x_passthru_bmdma_stop(struct ata_queued_cmd *qc)
* *
* Device selection hook. If neccessary perform clock switching * Device selection hook. If neccessary perform clock switching
*/ */
static void it821x_passthru_dev_select(struct ata_port *ap, static void it821x_passthru_dev_select(struct ata_port *ap,
unsigned int device) unsigned int device)
{ {
...@@ -431,7 +431,7 @@ static void it821x_passthru_dev_select(struct ata_port *ap, ...@@ -431,7 +431,7 @@ static void it821x_passthru_dev_select(struct ata_port *ap,
* perform out own device selection timing loads before the * perform out own device selection timing loads before the
* usual happenings kick off * usual happenings kick off
*/ */
static unsigned int it821x_smart_qc_issue_prot(struct ata_queued_cmd *qc) static unsigned int it821x_smart_qc_issue_prot(struct ata_queued_cmd *qc)
{ {
switch(qc->tf.command) switch(qc->tf.command)
...@@ -466,7 +466,7 @@ static unsigned int it821x_smart_qc_issue_prot(struct ata_queued_cmd *qc) ...@@ -466,7 +466,7 @@ static unsigned int it821x_smart_qc_issue_prot(struct ata_queued_cmd *qc)
* perform out own device selection timing loads before the * perform out own device selection timing loads before the
* usual happenings kick off * usual happenings kick off
*/ */
static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc) static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc)
{ {
it821x_passthru_dev_select(qc->ap, qc->dev->devno); it821x_passthru_dev_select(qc->ap, qc->dev->devno);
...@@ -480,9 +480,9 @@ static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc) ...@@ -480,9 +480,9 @@ static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc)
* Use a non standard set_mode function. We don't want to be tuned. * Use a non standard set_mode function. We don't want to be tuned.
* The BIOS configured everything. Our job is not to fiddle. We * The BIOS configured everything. Our job is not to fiddle. We
* read the dma enabled bits from the PCI configuration of the device * read the dma enabled bits from the PCI configuration of the device
* and respect them. * and respect them.
*/ */
static void it821x_smart_set_mode(struct ata_port *ap) static void it821x_smart_set_mode(struct ata_port *ap)
{ {
int dma_enabled = 0; int dma_enabled = 0;
...@@ -492,14 +492,14 @@ static void it821x_smart_set_mode(struct ata_port *ap) ...@@ -492,14 +492,14 @@ static void it821x_smart_set_mode(struct ata_port *ap)
/* It is possible that BMDMA isn't allocated */ /* It is possible that BMDMA isn't allocated */
if (ap->ioaddr.bmdma_addr) if (ap->ioaddr.bmdma_addr)
dma_enabled = inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); dma_enabled = inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
for (i = 0; i < ATA_MAX_DEVICES; i++) { for (i = 0; i < ATA_MAX_DEVICES; i++) {
struct ata_device *dev = &ap->device[i]; struct ata_device *dev = &ap->device[i];
if (ata_dev_enabled(dev)) { if (ata_dev_enabled(dev)) {
/* We don't really care */ /* We don't really care */
dev->pio_mode = XFER_PIO_0; dev->pio_mode = XFER_PIO_0;
dev->dma_mode = XFER_MW_DMA_0; dev->dma_mode = XFER_MW_DMA_0;
/* We do need the right mode information for DMA or PIO /* We do need the right mode information for DMA or PIO
and this comes from the current configuration flags */ and this comes from the current configuration flags */
if (dma_enabled & (1 << (5 + i))) { if (dma_enabled & (1 << (5 + i))) {
dev->xfer_mode = XFER_MW_DMA_0; dev->xfer_mode = XFER_MW_DMA_0;
...@@ -526,7 +526,7 @@ static void it821x_smart_set_mode(struct ata_port *ap) ...@@ -526,7 +526,7 @@ static void it821x_smart_set_mode(struct ata_port *ap)
* FIXME: When FUA appears we need to block FUA too. And SMART and * FIXME: When FUA appears we need to block FUA too. And SMART and
* basically we need to filter commands for this chip. * basically we need to filter commands for this chip.
*/ */
static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev) static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev)
{ {
unsigned char model_num[40]; unsigned char model_num[40];
...@@ -535,7 +535,7 @@ static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev) ...@@ -535,7 +535,7 @@ static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev)
/* This block ought to be a library routine as it is in several /* This block ought to be a library routine as it is in several
drivers now */ drivers now */
ata_id_string(adev->id, model_num, ATA_ID_PROD_OFS, ata_id_string(adev->id, model_num, ATA_ID_PROD_OFS,
sizeof(model_num)); sizeof(model_num));
s = &model_num[0]; s = &model_num[0];
...@@ -549,7 +549,7 @@ static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev) ...@@ -549,7 +549,7 @@ static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev)
if (adev->max_sectors > 255) if (adev->max_sectors > 255)
adev->max_sectors = 255; adev->max_sectors = 255;
if (strstr(model_num, "Integrated Technology Express")) { if (strstr(model_num, "Integrated Technology Express")) {
/* RAID mode */ /* RAID mode */
printk(KERN_INFO "IT821x %sRAID%d volume", printk(KERN_INFO "IT821x %sRAID%d volume",
...@@ -569,12 +569,12 @@ static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev) ...@@ -569,12 +569,12 @@ static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev)
* Decide if this ATAPI command can be issued by DMA on this * Decide if this ATAPI command can be issued by DMA on this
* controller. Return 0 if it can be. * controller. Return 0 if it can be.
*/ */
static int it821x_check_atapi_dma(struct ata_queued_cmd *qc) static int it821x_check_atapi_dma(struct ata_queued_cmd *qc)
{ {
struct ata_port *ap = qc->ap; struct ata_port *ap = qc->ap;
struct it821x_dev *itdev = ap->private_data; struct it821x_dev *itdev = ap->private_data;
/* No ATAPI DMA in smart mode */ /* No ATAPI DMA in smart mode */
if (itdev->smart) if (itdev->smart)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -584,7 +584,7 @@ static int it821x_check_atapi_dma(struct ata_queued_cmd *qc) ...@@ -584,7 +584,7 @@ static int it821x_check_atapi_dma(struct ata_queued_cmd *qc)
/* Cool */ /* Cool */
return 0; return 0;
} }
/** /**
* it821x_port_start - port setup * it821x_port_start - port setup
...@@ -592,10 +592,10 @@ static int it821x_check_atapi_dma(struct ata_queued_cmd *qc) ...@@ -592,10 +592,10 @@ static int it821x_check_atapi_dma(struct ata_queued_cmd *qc)
* *
* The it821x needs to maintain private data structures and also to * The it821x needs to maintain private data structures and also to
* use the standard PCI interface which lacks support for this * use the standard PCI interface which lacks support for this
* functionality. We instead set up the private data on the port * functionality. We instead set up the private data on the port
* start hook, and tear it down on port stop * start hook, and tear it down on port stop
*/ */
static int it821x_port_start(struct ata_port *ap) static int it821x_port_start(struct ata_port *ap)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
...@@ -605,13 +605,13 @@ static int it821x_port_start(struct ata_port *ap) ...@@ -605,13 +605,13 @@ static int it821x_port_start(struct ata_port *ap)
int ret = ata_port_start(ap); int ret = ata_port_start(ap);
if (ret < 0) if (ret < 0)
return ret; return ret;
ap->private_data = kmalloc(sizeof(struct it821x_dev), GFP_KERNEL); ap->private_data = kmalloc(sizeof(struct it821x_dev), GFP_KERNEL);
if (ap->private_data == NULL) { if (ap->private_data == NULL) {
ata_port_stop(ap); ata_port_stop(ap);
return -ENOMEM; return -ENOMEM;
} }
itdev = ap->private_data; itdev = ap->private_data;
memset(itdev, 0, sizeof(struct it821x_dev)); memset(itdev, 0, sizeof(struct it821x_dev));
...@@ -650,7 +650,7 @@ static int it821x_port_start(struct ata_port *ap) ...@@ -650,7 +650,7 @@ static int it821x_port_start(struct ata_port *ap)
* *
* Release the private objects we added in it821x_port_start * Release the private objects we added in it821x_port_start
*/ */
static void it821x_port_stop(struct ata_port *ap) { static void it821x_port_stop(struct ata_port *ap) {
kfree(ap->private_data); kfree(ap->private_data);
ap->private_data = NULL; /* We want an OOPS if we reuse this ap->private_data = NULL; /* We want an OOPS if we reuse this
...@@ -684,7 +684,7 @@ static struct ata_port_operations it821x_smart_port_ops = { ...@@ -684,7 +684,7 @@ static struct ata_port_operations it821x_smart_port_ops = {
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
.mode_filter = ata_pci_default_filter, .mode_filter = ata_pci_default_filter,
.check_status = ata_check_status, .check_status = ata_check_status,
.check_atapi_dma= it821x_check_atapi_dma, .check_atapi_dma= it821x_check_atapi_dma,
.exec_command = ata_exec_command, .exec_command = ata_exec_command,
...@@ -712,14 +712,14 @@ static struct ata_port_operations it821x_smart_port_ops = { ...@@ -712,14 +712,14 @@ static struct ata_port_operations it821x_smart_port_ops = {
.port_start = it821x_port_start, .port_start = it821x_port_start,
.port_stop = it821x_port_stop, .port_stop = it821x_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
static struct ata_port_operations it821x_passthru_port_ops = { static struct ata_port_operations it821x_passthru_port_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.set_piomode = it821x_passthru_set_piomode, .set_piomode = it821x_passthru_set_piomode,
.set_dmamode = it821x_passthru_set_dmamode, .set_dmamode = it821x_passthru_set_dmamode,
.mode_filter = ata_pci_default_filter, .mode_filter = ata_pci_default_filter,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
.check_status = ata_check_status, .check_status = ata_check_status,
...@@ -748,7 +748,7 @@ static struct ata_port_operations it821x_passthru_port_ops = { ...@@ -748,7 +748,7 @@ static struct ata_port_operations it821x_passthru_port_ops = {
.port_start = it821x_port_start, .port_start = it821x_port_start,
.port_stop = it821x_port_stop, .port_stop = it821x_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
static void __devinit it821x_disable_raid(struct pci_dev *pdev) static void __devinit it821x_disable_raid(struct pci_dev *pdev)
{ {
...@@ -767,11 +767,11 @@ static void __devinit it821x_disable_raid(struct pci_dev *pdev) ...@@ -767,11 +767,11 @@ static void __devinit it821x_disable_raid(struct pci_dev *pdev)
pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x20); pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x20);
} }
static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{ {
u8 conf; u8 conf;
static struct ata_port_info info_smart = { static struct ata_port_info info_smart = {
.sht = &it821x_sht, .sht = &it821x_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
...@@ -788,7 +788,7 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -788,7 +788,7 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &it821x_passthru_port_ops .port_ops = &it821x_passthru_port_ops
}; };
static struct ata_port_info *port_info[2]; static struct ata_port_info *port_info[2];
static char *mode[2] = { "pass through", "smart" }; static char *mode[2] = { "pass through", "smart" };
/* Force the card into bypass mode if so requested */ /* Force the card into bypass mode if so requested */
...@@ -798,13 +798,13 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -798,13 +798,13 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
} }
pci_read_config_byte(pdev, 0x50, &conf); pci_read_config_byte(pdev, 0x50, &conf);
conf &= 1; conf &= 1;
printk(KERN_INFO DRV_NAME ": controller in %s mode.\n", mode[conf]); printk(KERN_INFO DRV_NAME ": controller in %s mode.\n", mode[conf]);
if (conf == 0) if (conf == 0)
port_info[0] = port_info[1] = &info_passthru; port_info[0] = port_info[1] = &info_passthru;
else else
port_info[0] = port_info[1] = &info_smart; port_info[0] = port_info[1] = &info_smart;
return ata_pci_init_one(pdev, port_info, 2); return ata_pci_init_one(pdev, port_info, 2);
} }
......
...@@ -211,11 +211,11 @@ static void pdc20230_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -211,11 +211,11 @@ static void pdc20230_set_piomode(struct ata_port *ap, struct ata_device *adev)
int pio = adev->pio_mode - XFER_PIO_0; int pio = adev->pio_mode - XFER_PIO_0;
u8 rt; u8 rt;
unsigned long flags; unsigned long flags;
/* Safe as UP only. Force I/Os to occur together */ /* Safe as UP only. Force I/Os to occur together */
local_irq_save(flags); local_irq_save(flags);
/* Unlock the control interface */ /* Unlock the control interface */
do do
{ {
...@@ -230,7 +230,7 @@ static void pdc20230_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -230,7 +230,7 @@ static void pdc20230_set_piomode(struct ata_port *ap, struct ata_device *adev)
while((inb(0x1F2) & 0x80) && --tries); while((inb(0x1F2) & 0x80) && --tries);
local_irq_restore(flags); local_irq_restore(flags);
outb(inb(0x1F4) & 0x07, 0x1F4); outb(inb(0x1F4) & 0x07, 0x1F4);
rt = inb(0x1F3); rt = inb(0x1F3);
...@@ -425,7 +425,7 @@ static struct ata_port_operations ht6560b_port_ops = { ...@@ -425,7 +425,7 @@ static struct ata_port_operations ht6560b_port_ops = {
/* /*
* Opti core chipset helpers * Opti core chipset helpers
*/ */
/** /**
* opti_syscfg - read OPTI chipset configuration * opti_syscfg - read OPTI chipset configuration
* @reg: Configuration register to read * @reg: Configuration register to read
...@@ -437,7 +437,7 @@ static u8 opti_syscfg(u8 reg) ...@@ -437,7 +437,7 @@ static u8 opti_syscfg(u8 reg)
{ {
unsigned long flags; unsigned long flags;
u8 r; u8 r;
/* Uniprocessor chipset and must force cycles adjancent */ /* Uniprocessor chipset and must force cycles adjancent */
local_irq_save(flags); local_irq_save(flags);
outb(reg, 0x22); outb(reg, 0x22);
...@@ -719,7 +719,7 @@ static __init int legacy_init_one(int port, unsigned long io, unsigned long ctrl ...@@ -719,7 +719,7 @@ static __init int legacy_init_one(int port, unsigned long io, unsigned long ctrl
} }
/* Probe for automatically detectable controllers */ /* Probe for automatically detectable controllers */
if (io == 0x1F0 && ops == &legacy_port_ops) { if (io == 0x1F0 && ops == &legacy_port_ops) {
unsigned long flags; unsigned long flags;
...@@ -868,7 +868,7 @@ static __init int legacy_init(void) ...@@ -868,7 +868,7 @@ static __init int legacy_init(void)
last_port = 2; last_port = 2;
} }
/* If an OPTI 82C46X is present find out where the channels are */ /* If an OPTI 82C46X is present find out where the channels are */
if (opti82c46x) { if (opti82c46x) {
static const char *optis[4] = { static const char *optis[4] = {
"3/463MV", "5MV", "3/463MV", "5MV",
...@@ -876,7 +876,7 @@ static __init int legacy_init(void) ...@@ -876,7 +876,7 @@ static __init int legacy_init(void)
}; };
u8 chans = 1; u8 chans = 1;
u8 ctrl = (opti_syscfg(0x30) & 0xC0) >> 6; u8 ctrl = (opti_syscfg(0x30) & 0xC0) >> 6;
opti82c46x = 3; /* Assume master and slave first */ opti82c46x = 3; /* Assume master and slave first */
printk(KERN_INFO DRV_NAME ": Opti 82C46%s chipset support.\n", optis[ctrl]); printk(KERN_INFO DRV_NAME ": Opti 82C46%s chipset support.\n", optis[ctrl]);
if (ctrl == 3) if (ctrl == 3)
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* *
* Cables are handled by the RAID controller. Report 80 pin. * Cables are handled by the RAID controller. Report 80 pin.
*/ */
static int netcell_pre_reset(struct ata_port *ap) static int netcell_pre_reset(struct ata_port *ap)
{ {
ap->cbl = ATA_CBL_PATA80; ap->cbl = ATA_CBL_PATA80;
...@@ -137,7 +137,7 @@ static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *e ...@@ -137,7 +137,7 @@ static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *e
/* Any chip specific setup/optimisation/messages here */ /* Any chip specific setup/optimisation/messages here */
ata_pci_clear_simplex(pdev); ata_pci_clear_simplex(pdev);
/* And let the library code do the work */ /* And let the library code do the work */
return ata_pci_init_one(pdev, port_info, 2); return ata_pci_init_one(pdev, port_info, 2);
} }
......
...@@ -51,11 +51,11 @@ static int pci_clock; /* 0 = 33 1 = 25 */ ...@@ -51,11 +51,11 @@ static int pci_clock; /* 0 = 33 1 = 25 */
* *
* Set up cable type and use generic probe init * Set up cable type and use generic probe init
*/ */
static int optidma_pre_reset(struct ata_port *ap) static int optidma_pre_reset(struct ata_port *ap)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
static const struct pci_bits optidma_enable_bits = { static const struct pci_bits optidma_enable_bits = {
0x40, 1, 0x08, 0x00 0x40, 1, 0x08, 0x00
}; };
...@@ -90,11 +90,11 @@ static void optidma_error_handler(struct ata_port *ap) ...@@ -90,11 +90,11 @@ static void optidma_error_handler(struct ata_port *ap)
* Unlock the control register block for this adapter. Registers must not * Unlock the control register block for this adapter. Registers must not
* be unlocked in a situation where libata might look at them. * be unlocked in a situation where libata might look at them.
*/ */
static void optidma_unlock(struct ata_port *ap) static void optidma_unlock(struct ata_port *ap)
{ {
unsigned long regio = ap->ioaddr.cmd_addr; unsigned long regio = ap->ioaddr.cmd_addr;
/* These 3 unlock the control register access */ /* These 3 unlock the control register access */
inw(regio + 1); inw(regio + 1);
inw(regio + 1); inw(regio + 1);
...@@ -107,11 +107,11 @@ static void optidma_unlock(struct ata_port *ap) ...@@ -107,11 +107,11 @@ static void optidma_unlock(struct ata_port *ap)
* *
* Re-lock the configuration register settings. * Re-lock the configuration register settings.
*/ */
static void optidma_lock(struct ata_port *ap) static void optidma_lock(struct ata_port *ap)
{ {
unsigned long regio = ap->ioaddr.cmd_addr; unsigned long regio = ap->ioaddr.cmd_addr;
/* Relock */ /* Relock */
outb(0x83, regio + 2); outb(0x83, regio + 2);
} }
...@@ -154,7 +154,7 @@ static void optidma_set_mode(struct ata_port *ap, struct ata_device *adev, u8 mo ...@@ -154,7 +154,7 @@ static void optidma_set_mode(struct ata_port *ap, struct ata_device *adev, u8 mo
/* Switch from IDE to control mode */ /* Switch from IDE to control mode */
optidma_unlock(ap); optidma_unlock(ap);
/* /*
* As with many controllers the address setup time is shared * As with many controllers the address setup time is shared
...@@ -166,7 +166,7 @@ static void optidma_set_mode(struct ata_port *ap, struct ata_device *adev, u8 mo ...@@ -166,7 +166,7 @@ static void optidma_set_mode(struct ata_port *ap, struct ata_device *adev, u8 mo
addr = 0; addr = 0;
else else
addr = addr_timing[pci_clock][pio]; addr = addr_timing[pci_clock][pio];
if (pair) { if (pair) {
u8 pair_addr; u8 pair_addr;
/* Hardware constraint */ /* Hardware constraint */
...@@ -177,7 +177,7 @@ static void optidma_set_mode(struct ata_port *ap, struct ata_device *adev, u8 mo ...@@ -177,7 +177,7 @@ static void optidma_set_mode(struct ata_port *ap, struct ata_device *adev, u8 mo
if (pair_addr > addr) if (pair_addr > addr)
addr = pair_addr; addr = pair_addr;
} }
/* Commence primary programming sequence */ /* Commence primary programming sequence */
/* First we load the device number into the timing select */ /* First we load the device number into the timing select */
outb(adev->devno, regio + MISC_REG); outb(adev->devno, regio + MISC_REG);
...@@ -194,10 +194,10 @@ static void optidma_set_mode(struct ata_port *ap, struct ata_device *adev, u8 mo ...@@ -194,10 +194,10 @@ static void optidma_set_mode(struct ata_port *ap, struct ata_device *adev, u8 mo
/* Programming sequence complete, timing 0 dev 0, timing 1 dev 1 */ /* Programming sequence complete, timing 0 dev 0, timing 1 dev 1 */
outb(0x85, regio + CNTRL_REG); outb(0x85, regio + CNTRL_REG);
/* Switch back to IDE mode */ /* Switch back to IDE mode */
optidma_lock(ap); optidma_lock(ap);
/* Note: at this point our programming is incomplete. We are /* Note: at this point our programming is incomplete. We are
not supposed to program PCI 0x43 "things we hacked onto the chip" not supposed to program PCI 0x43 "things we hacked onto the chip"
until we've done both sets of PIO/DMA timings */ until we've done both sets of PIO/DMA timings */
...@@ -223,7 +223,7 @@ static void optiplus_set_mode(struct ata_port *ap, struct ata_device *adev, u8 m ...@@ -223,7 +223,7 @@ static void optiplus_set_mode(struct ata_port *ap, struct ata_device *adev, u8 m
int dev2 = 2 * adev->devno; int dev2 = 2 * adev->devno;
int unit = 2 * ap->port_no + adev->devno; int unit = 2 * ap->port_no + adev->devno;
int udma = mode - XFER_UDMA_0; int udma = mode - XFER_UDMA_0;
pci_read_config_byte(pdev, 0x44, &udcfg); pci_read_config_byte(pdev, 0x44, &udcfg);
if (mode <= XFER_UDMA_0) { if (mode <= XFER_UDMA_0) {
udcfg &= ~(1 << unit); udcfg &= ~(1 << unit);
...@@ -252,7 +252,7 @@ static void optiplus_set_mode(struct ata_port *ap, struct ata_device *adev, u8 m ...@@ -252,7 +252,7 @@ static void optiplus_set_mode(struct ata_port *ap, struct ata_device *adev, u8 m
* DMA programming. The architecture of the Firestar makes it easier * DMA programming. The architecture of the Firestar makes it easier
* for us to have a common function so we provide wrappers * for us to have a common function so we provide wrappers
*/ */
static void optidma_set_pio_mode(struct ata_port *ap, struct ata_device *adev) static void optidma_set_pio_mode(struct ata_port *ap, struct ata_device *adev)
{ {
optidma_set_mode(ap, adev, adev->pio_mode); optidma_set_mode(ap, adev, adev->pio_mode);
...@@ -267,7 +267,7 @@ static void optidma_set_pio_mode(struct ata_port *ap, struct ata_device *adev) ...@@ -267,7 +267,7 @@ static void optidma_set_pio_mode(struct ata_port *ap, struct ata_device *adev)
* DMA programming. The architecture of the Firestar makes it easier * DMA programming. The architecture of the Firestar makes it easier
* for us to have a common function so we provide wrappers * for us to have a common function so we provide wrappers
*/ */
static void optidma_set_dma_mode(struct ata_port *ap, struct ata_device *adev) static void optidma_set_dma_mode(struct ata_port *ap, struct ata_device *adev)
{ {
optidma_set_mode(ap, adev, adev->dma_mode); optidma_set_mode(ap, adev, adev->dma_mode);
...@@ -282,7 +282,7 @@ static void optidma_set_dma_mode(struct ata_port *ap, struct ata_device *adev) ...@@ -282,7 +282,7 @@ static void optidma_set_dma_mode(struct ata_port *ap, struct ata_device *adev)
* DMA programming. The architecture of the Firestar makes it easier * DMA programming. The architecture of the Firestar makes it easier
* for us to have a common function so we provide wrappers * for us to have a common function so we provide wrappers
*/ */
static void optiplus_set_pio_mode(struct ata_port *ap, struct ata_device *adev) static void optiplus_set_pio_mode(struct ata_port *ap, struct ata_device *adev)
{ {
optiplus_set_mode(ap, adev, adev->pio_mode); optiplus_set_mode(ap, adev, adev->pio_mode);
...@@ -297,7 +297,7 @@ static void optiplus_set_pio_mode(struct ata_port *ap, struct ata_device *adev) ...@@ -297,7 +297,7 @@ static void optiplus_set_pio_mode(struct ata_port *ap, struct ata_device *adev)
* DMA programming. The architecture of the Firestar makes it easier * DMA programming. The architecture of the Firestar makes it easier
* for us to have a common function so we provide wrappers * for us to have a common function so we provide wrappers
*/ */
static void optiplus_set_dma_mode(struct ata_port *ap, struct ata_device *adev) static void optiplus_set_dma_mode(struct ata_port *ap, struct ata_device *adev)
{ {
optiplus_set_mode(ap, adev, adev->dma_mode); optiplus_set_mode(ap, adev, adev->dma_mode);
...@@ -310,7 +310,7 @@ static void optiplus_set_dma_mode(struct ata_port *ap, struct ata_device *adev) ...@@ -310,7 +310,7 @@ static void optiplus_set_dma_mode(struct ata_port *ap, struct ata_device *adev)
* Turn the ATA device setup into PCI configuration bits * Turn the ATA device setup into PCI configuration bits
* for register 0x43 and return the two bits needed. * for register 0x43 and return the two bits needed.
*/ */
static u8 optidma_make_bits43(struct ata_device *adev) static u8 optidma_make_bits43(struct ata_device *adev)
{ {
static const u8 bits43[5] = { static const u8 bits43[5] = {
...@@ -330,17 +330,17 @@ static u8 optidma_make_bits43(struct ata_device *adev) ...@@ -330,17 +330,17 @@ static u8 optidma_make_bits43(struct ata_device *adev)
* Finalise the configuration by writing the nibble of extra bits * Finalise the configuration by writing the nibble of extra bits
* of data into the chip. * of data into the chip.
*/ */
static void optidma_post_set_mode(struct ata_port *ap) static void optidma_post_set_mode(struct ata_port *ap)
{ {
u8 r; u8 r;
int nybble = 4 * ap->port_no; int nybble = 4 * ap->port_no;
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
pci_read_config_byte(pdev, 0x43, &r); pci_read_config_byte(pdev, 0x43, &r);
r &= (0x0F << nybble); r &= (0x0F << nybble);
r |= (optidma_make_bits43(&ap->device[0]) + r |= (optidma_make_bits43(&ap->device[0]) +
(optidma_make_bits43(&ap->device[0]) << 2)) << nybble; (optidma_make_bits43(&ap->device[0]) << 2)) << nybble;
pci_write_config_byte(pdev, 0x43, r); pci_write_config_byte(pdev, 0x43, r);
...@@ -438,19 +438,19 @@ static struct ata_port_operations optiplus_port_ops = { ...@@ -438,19 +438,19 @@ static struct ata_port_operations optiplus_port_ops = {
* optiplus_with_udma - Look for UDMA capable setup * optiplus_with_udma - Look for UDMA capable setup
* @pdev; ATA controller * @pdev; ATA controller
*/ */
static int optiplus_with_udma(struct pci_dev *pdev) static int optiplus_with_udma(struct pci_dev *pdev)
{ {
u8 r; u8 r;
int ret = 0; int ret = 0;
int ioport = 0x22; int ioport = 0x22;
struct pci_dev *dev1; struct pci_dev *dev1;
/* Find function 1 */ /* Find function 1 */
dev1 = pci_get_device(0x1045, 0xC701, NULL); dev1 = pci_get_device(0x1045, 0xC701, NULL);
if(dev1 == NULL) if(dev1 == NULL)
return 0; return 0;
/* Rev must be >= 0x10 */ /* Rev must be >= 0x10 */
pci_read_config_byte(dev1, 0x08, &r); pci_read_config_byte(dev1, 0x08, &r);
if (r < 0x10) if (r < 0x10)
...@@ -470,7 +470,7 @@ static int optiplus_with_udma(struct pci_dev *pdev) ...@@ -470,7 +470,7 @@ static int optiplus_with_udma(struct pci_dev *pdev)
pci_read_config_byte(dev1, 0x52, &r); pci_read_config_byte(dev1, 0x52, &r);
if (r & 0x80) /* IDEDIR disabled */ if (r & 0x80) /* IDEDIR disabled */
ret = 1; ret = 1;
done: done:
printk(KERN_WARNING "UDMA not supported in this configuration.\n"); printk(KERN_WARNING "UDMA not supported in this configuration.\n");
done_nomsg: /* Wrong chip revision */ done_nomsg: /* Wrong chip revision */
pci_dev_put(dev1); pci_dev_put(dev1);
...@@ -505,7 +505,7 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -505,7 +505,7 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id)
inw(0x1F1); inw(0x1F1);
inw(0x1F1); inw(0x1F1);
pci_clock = inb(0x1F5) & 1; /* 0 = 33Mhz, 1 = 25Mhz */ pci_clock = inb(0x1F5) & 1; /* 0 = 33Mhz, 1 = 25Mhz */
if (optiplus_with_udma(dev)) if (optiplus_with_udma(dev))
info = &info_82c700_udma; info = &info_82c700_udma;
......
/* /*
* pata_pcmcia.c - PCMCIA PATA controller driver. * pata_pcmcia.c - PCMCIA PATA controller driver.
* Copyright 2005-2006 Red Hat Inc <alan@redhat.com>, all rights reserved. * Copyright 2005-2006 Red Hat Inc <alan@redhat.com>, all rights reserved.
* PCMCIA ident update Copyright 2006 Marcin Juszkiewicz * PCMCIA ident update Copyright 2006 Marcin Juszkiewicz
* <openembedded@hrw.one.pl> * <openembedded@hrw.one.pl>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* TODO: * TODO:
* Channel interlock/reset on both required ? * Channel interlock/reset on both required ?
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* *
* Set up cable type and use generic probe init * Set up cable type and use generic probe init
*/ */
static int pdc2024x_pre_reset(struct ata_port *ap) static int pdc2024x_pre_reset(struct ata_port *ap)
{ {
ap->cbl = ATA_CBL_PATA40; ap->cbl = ATA_CBL_PATA40;
...@@ -47,7 +47,7 @@ static int pdc2026x_pre_reset(struct ata_port *ap) ...@@ -47,7 +47,7 @@ static int pdc2026x_pre_reset(struct ata_port *ap)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
u16 cis; u16 cis;
pci_read_config_word(pdev, 0x50, &cis); pci_read_config_word(pdev, 0x50, &cis);
if (cis & (1 << (10 + ap->port_no))) if (cis & (1 << (10 + ap->port_no)))
ap->cbl = ATA_CBL_PATA80; ap->cbl = ATA_CBL_PATA80;
...@@ -72,7 +72,7 @@ static void pdc2026x_error_handler(struct ata_port *ap) ...@@ -72,7 +72,7 @@ static void pdc2026x_error_handler(struct ata_port *ap)
* so a configure_dmamode call will undo any work we do here and vice * so a configure_dmamode call will undo any work we do here and vice
* versa * versa
*/ */
static void pdc_configure_piomode(struct ata_port *ap, struct ata_device *adev, int pio) static void pdc_configure_piomode(struct ata_port *ap, struct ata_device *adev, int pio)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
...@@ -88,7 +88,7 @@ static void pdc_configure_piomode(struct ata_port *ap, struct ata_device *adev, ...@@ -88,7 +88,7 @@ static void pdc_configure_piomode(struct ata_port *ap, struct ata_device *adev,
r_bp &= ~0x07; r_bp &= ~0x07;
r_ap |= (pio_timing[pio] >> 8); r_ap |= (pio_timing[pio] >> 8);
r_bp |= (pio_timing[pio] & 0xFF); r_bp |= (pio_timing[pio] & 0xFF);
if (ata_pio_need_iordy(adev)) if (ata_pio_need_iordy(adev))
r_ap |= 0x20; /* IORDY enable */ r_ap |= 0x20; /* IORDY enable */
if (adev->class == ATA_DEV_ATA) if (adev->class == ATA_DEV_ATA)
...@@ -105,7 +105,7 @@ static void pdc_configure_piomode(struct ata_port *ap, struct ata_device *adev, ...@@ -105,7 +105,7 @@ static void pdc_configure_piomode(struct ata_port *ap, struct ata_device *adev,
* Called to do the PIO mode setup. Our timing registers are shared * Called to do the PIO mode setup. Our timing registers are shared
* but we want to set the PIO timing by default. * but we want to set the PIO timing by default.
*/ */
static void pdc_set_piomode(struct ata_port *ap, struct ata_device *adev) static void pdc_set_piomode(struct ata_port *ap, struct ata_device *adev)
{ {
pdc_configure_piomode(ap, adev, adev->pio_mode - XFER_PIO_0); pdc_configure_piomode(ap, adev, adev->pio_mode - XFER_PIO_0);
...@@ -119,7 +119,7 @@ static void pdc_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -119,7 +119,7 @@ static void pdc_set_piomode(struct ata_port *ap, struct ata_device *adev)
* Load DMA cycle times into the chip ready for a DMA transfer * Load DMA cycle times into the chip ready for a DMA transfer
* to occur. * to occur.
*/ */
static void pdc_set_dmamode(struct ata_port *ap, struct ata_device *adev) static void pdc_set_dmamode(struct ata_port *ap, struct ata_device *adev)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
...@@ -130,21 +130,21 @@ static void pdc_set_dmamode(struct ata_port *ap, struct ata_device *adev) ...@@ -130,21 +130,21 @@ static void pdc_set_dmamode(struct ata_port *ap, struct ata_device *adev)
{ 0x20, 0x01 }, { 0x20, 0x01 },
{ 0x40, 0x02 }, /* 66 Mhz Clock */ { 0x40, 0x02 }, /* 66 Mhz Clock */
{ 0x20, 0x01 }, { 0x20, 0x01 },
{ 0x20, 0x01 } { 0x20, 0x01 }
}; };
u8 r_bp, r_cp; u8 r_bp, r_cp;
pci_read_config_byte(pdev, port + 1, &r_bp); pci_read_config_byte(pdev, port + 1, &r_bp);
pci_read_config_byte(pdev, port + 2, &r_cp); pci_read_config_byte(pdev, port + 2, &r_cp);
r_bp &= ~0xF0; r_bp &= ~0xF0;
r_cp &= ~0x0F; r_cp &= ~0x0F;
if (adev->dma_mode >= XFER_UDMA_0) { if (adev->dma_mode >= XFER_UDMA_0) {
int speed = adev->dma_mode - XFER_UDMA_0; int speed = adev->dma_mode - XFER_UDMA_0;
r_bp |= udma_timing[speed][0]; r_bp |= udma_timing[speed][0];
r_cp |= udma_timing[speed][1]; r_cp |= udma_timing[speed][1];
} else { } else {
int speed = adev->dma_mode - XFER_MW_DMA_0; int speed = adev->dma_mode - XFER_MW_DMA_0;
r_bp |= 0x60; r_bp |= 0x60;
...@@ -152,7 +152,7 @@ static void pdc_set_dmamode(struct ata_port *ap, struct ata_device *adev) ...@@ -152,7 +152,7 @@ static void pdc_set_dmamode(struct ata_port *ap, struct ata_device *adev)
} }
pci_write_config_byte(pdev, port + 1, r_bp); pci_write_config_byte(pdev, port + 1, r_bp);
pci_write_config_byte(pdev, port + 2, r_cp); pci_write_config_byte(pdev, port + 2, r_cp);
} }
/** /**
...@@ -162,7 +162,7 @@ static void pdc_set_dmamode(struct ata_port *ap, struct ata_device *adev) ...@@ -162,7 +162,7 @@ static void pdc_set_dmamode(struct ata_port *ap, struct ata_device *adev)
* In UDMA3 or higher we have to clock switch for the duration of the * In UDMA3 or higher we have to clock switch for the duration of the
* DMA transfer sequence. * DMA transfer sequence.
*/ */
static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc) static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
{ {
struct ata_port *ap = qc->ap; struct ata_port *ap = qc->ap;
...@@ -173,16 +173,16 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc) ...@@ -173,16 +173,16 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
unsigned long master = ap->host->ports[0]->ioaddr.bmdma_addr; unsigned long master = ap->host->ports[0]->ioaddr.bmdma_addr;
unsigned long clock = master + 0x11; unsigned long clock = master + 0x11;
unsigned long atapi_reg = master + 0x20 + (4 * ap->port_no); unsigned long atapi_reg = master + 0x20 + (4 * ap->port_no);
u32 len; u32 len;
/* Check we keep host level locking here */ /* Check we keep host level locking here */
if (adev->dma_mode >= XFER_UDMA_2) if (adev->dma_mode >= XFER_UDMA_2)
outb(inb(clock) | sel66, clock); outb(inb(clock) | sel66, clock);
else else
outb(inb(clock) & ~sel66, clock); outb(inb(clock) & ~sel66, clock);
/* The DMA clocks may have been trashed by a reset. FIXME: make conditional /* The DMA clocks may have been trashed by a reset. FIXME: make conditional
and move to qc_issue ? */ and move to qc_issue ? */
pdc_set_dmamode(ap, qc->dev); pdc_set_dmamode(ap, qc->dev);
...@@ -193,16 +193,16 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc) ...@@ -193,16 +193,16 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
len = qc->nsect * 512; len = qc->nsect * 512;
else else
len = qc->nbytes; len = qc->nbytes;
if (tf->flags & ATA_TFLAG_WRITE) if (tf->flags & ATA_TFLAG_WRITE)
len |= 0x06000000; len |= 0x06000000;
else else
len |= 0x05000000; len |= 0x05000000;
outl(len, atapi_reg); outl(len, atapi_reg);
} }
/* Activate DMA */ /* Activate DMA */
ata_bmdma_start(qc); ata_bmdma_start(qc);
} }
...@@ -213,19 +213,19 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc) ...@@ -213,19 +213,19 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
* After a DMA completes we need to put the clock back to 33MHz for * After a DMA completes we need to put the clock back to 33MHz for
* PIO timings. * PIO timings.
*/ */
static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc) static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc)
{ {
struct ata_port *ap = qc->ap; struct ata_port *ap = qc->ap;
struct ata_device *adev = qc->dev; struct ata_device *adev = qc->dev;
struct ata_taskfile *tf = &qc->tf; struct ata_taskfile *tf = &qc->tf;
int sel66 = ap->port_no ? 0x08: 0x02; int sel66 = ap->port_no ? 0x08: 0x02;
/* The clock bits are in the same register for both channels */ /* The clock bits are in the same register for both channels */
unsigned long master = ap->host->ports[0]->ioaddr.bmdma_addr; unsigned long master = ap->host->ports[0]->ioaddr.bmdma_addr;
unsigned long clock = master + 0x11; unsigned long clock = master + 0x11;
unsigned long atapi_reg = master + 0x20 + (4 * ap->port_no); unsigned long atapi_reg = master + 0x20 + (4 * ap->port_no);
/* Cases the state machine will not complete correctly */ /* Cases the state machine will not complete correctly */
if (tf->protocol == ATA_PROT_ATAPI_DMA || ( tf->flags & ATA_TFLAG_LBA48)) { if (tf->protocol == ATA_PROT_ATAPI_DMA || ( tf->flags & ATA_TFLAG_LBA48)) {
outl(0, atapi_reg); outl(0, atapi_reg);
...@@ -248,7 +248,7 @@ static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc) ...@@ -248,7 +248,7 @@ static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc)
* sizes to 8bit to avoid making the state engine on the 2026x cards * sizes to 8bit to avoid making the state engine on the 2026x cards
* barf. * barf.
*/ */
static void pdc2026x_dev_config(struct ata_port *ap, struct ata_device *adev) static void pdc2026x_dev_config(struct ata_port *ap, struct ata_device *adev)
{ {
adev->max_sectors = 256; adev->max_sectors = 256;
...@@ -299,11 +299,11 @@ static struct ata_port_operations pdc2024x_port_ops = { ...@@ -299,11 +299,11 @@ static struct ata_port_operations pdc2024x_port_ops = {
.irq_handler = ata_interrupt, .irq_handler = ata_interrupt,
.irq_clear = ata_bmdma_irq_clear, .irq_clear = ata_bmdma_irq_clear,
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
static struct ata_port_operations pdc2026x_port_ops = { static struct ata_port_operations pdc2026x_port_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
...@@ -333,11 +333,11 @@ static struct ata_port_operations pdc2026x_port_ops = { ...@@ -333,11 +333,11 @@ static struct ata_port_operations pdc2026x_port_ops = {
.irq_handler = ata_interrupt, .irq_handler = ata_interrupt,
.irq_clear = ata_bmdma_irq_clear, .irq_clear = ata_bmdma_irq_clear,
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
static int pdc_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int pdc_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
...@@ -349,7 +349,7 @@ static int pdc_init_one(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -349,7 +349,7 @@ static int pdc_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.mwdma_mask = 0x07, .mwdma_mask = 0x07,
.udma_mask = ATA_UDMA2, .udma_mask = ATA_UDMA2,
.port_ops = &pdc2024x_port_ops .port_ops = &pdc2024x_port_ops
}, },
{ {
.sht = &pdc_sht, .sht = &pdc_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
...@@ -366,12 +366,12 @@ static int pdc_init_one(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -366,12 +366,12 @@ static int pdc_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.udma_mask = ATA_UDMA5, .udma_mask = ATA_UDMA5,
.port_ops = &pdc2026x_port_ops .port_ops = &pdc2026x_port_ops
} }
}; };
static struct ata_port_info *port_info[2]; static struct ata_port_info *port_info[2];
port_info[0] = port_info[1] = &info[id->driver_data]; port_info[0] = port_info[1] = &info[id->driver_data];
if (dev->device == PCI_DEVICE_ID_PROMISE_20265) { if (dev->device == PCI_DEVICE_ID_PROMISE_20265) {
struct pci_dev *bridge = dev->bus->self; struct pci_dev *bridge = dev->bus->self;
/* Don't grab anything behind a Promise I2O RAID */ /* Don't grab anything behind a Promise I2O RAID */
......
...@@ -36,7 +36,7 @@ struct qdi_data { ...@@ -36,7 +36,7 @@ struct qdi_data {
u8 last; u8 last;
int fast; int fast;
struct platform_device *platform_dev; struct platform_device *platform_dev;
}; };
static struct ata_host *qdi_host[NR_HOST]; static struct ata_host *qdi_host[NR_HOST];
...@@ -58,7 +58,7 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -58,7 +58,7 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev)
/* Get the timing data in cycles */ /* Get the timing data in cycles */
ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000);
if (qdi->fast) { if (qdi->fast) {
active = 8 - FIT(t.active, 1, 8); active = 8 - FIT(t.active, 1, 8);
recovery = 18 - FIT(t.recover, 3, 18); recovery = 18 - FIT(t.recover, 3, 18);
...@@ -67,10 +67,10 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -67,10 +67,10 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev)
recovery = 15 - FIT(t.recover, 0, 15); recovery = 15 - FIT(t.recover, 0, 15);
} }
timing = (recovery << 4) | active | 0x08; timing = (recovery << 4) | active | 0x08;
qdi->clock[adev->devno] = timing; qdi->clock[adev->devno] = timing;
outb(timing, qdi->timing); outb(timing, qdi->timing);
} }
static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev) static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev)
...@@ -82,7 +82,7 @@ static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -82,7 +82,7 @@ static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev)
/* Get the timing data in cycles */ /* Get the timing data in cycles */
ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000);
if (qdi->fast) { if (qdi->fast) {
active = 8 - FIT(t.active, 1, 8); active = 8 - FIT(t.active, 1, 8);
recovery = 18 - FIT(t.recover, 3, 18); recovery = 18 - FIT(t.recover, 3, 18);
...@@ -91,11 +91,11 @@ static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -91,11 +91,11 @@ static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev)
recovery = 15 - FIT(t.recover, 0, 15); recovery = 15 - FIT(t.recover, 0, 15);
} }
timing = (recovery << 4) | active | 0x08; timing = (recovery << 4) | active | 0x08;
qdi->clock[adev->devno] = timing; qdi->clock[adev->devno] = timing;
outb(timing, qdi->timing); outb(timing, qdi->timing);
/* Clear the FIFO */ /* Clear the FIFO */
if (adev->class != ATA_DEV_ATA) if (adev->class != ATA_DEV_ATA)
outb(0x5F, (qdi->timing & 0xFFF0) + 3); outb(0x5F, (qdi->timing & 0xFFF0) + 3);
...@@ -128,13 +128,13 @@ static void qdi_data_xfer(struct ata_device *adev, unsigned char *buf, unsigned ...@@ -128,13 +128,13 @@ static void qdi_data_xfer(struct ata_device *adev, unsigned char *buf, unsigned
{ {
struct ata_port *ap = adev->ap; struct ata_port *ap = adev->ap;
int slop = buflen & 3; int slop = buflen & 3;
if (ata_id_has_dword_io(adev->id)) { if (ata_id_has_dword_io(adev->id)) {
if (write_data) if (write_data)
outsl(ap->ioaddr.data_addr, buf, buflen >> 2); outsl(ap->ioaddr.data_addr, buf, buflen >> 2);
else else
insl(ap->ioaddr.data_addr, buf, buflen >> 2); insl(ap->ioaddr.data_addr, buf, buflen >> 2);
if (unlikely(slop)) { if (unlikely(slop)) {
u32 pad; u32 pad;
if (write_data) { if (write_data) {
...@@ -181,7 +181,7 @@ static struct ata_port_operations qdi6500_port_ops = { ...@@ -181,7 +181,7 @@ static struct ata_port_operations qdi6500_port_ops = {
.thaw = ata_bmdma_thaw, .thaw = ata_bmdma_thaw,
.error_handler = ata_bmdma_error_handler, .error_handler = ata_bmdma_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd, .post_internal_cmd = ata_bmdma_post_internal_cmd,
.qc_prep = ata_qc_prep, .qc_prep = ata_qc_prep,
.qc_issue = qdi_qc_issue_prot, .qc_issue = qdi_qc_issue_prot,
.eng_timeout = ata_eng_timeout, .eng_timeout = ata_eng_timeout,
...@@ -189,11 +189,11 @@ static struct ata_port_operations qdi6500_port_ops = { ...@@ -189,11 +189,11 @@ static struct ata_port_operations qdi6500_port_ops = {
.irq_handler = ata_interrupt, .irq_handler = ata_interrupt,
.irq_clear = ata_bmdma_irq_clear, .irq_clear = ata_bmdma_irq_clear,
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
static struct ata_port_operations qdi6580_port_ops = { static struct ata_port_operations qdi6580_port_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
...@@ -209,7 +209,7 @@ static struct ata_port_operations qdi6580_port_ops = { ...@@ -209,7 +209,7 @@ static struct ata_port_operations qdi6580_port_ops = {
.thaw = ata_bmdma_thaw, .thaw = ata_bmdma_thaw,
.error_handler = ata_bmdma_error_handler, .error_handler = ata_bmdma_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd, .post_internal_cmd = ata_bmdma_post_internal_cmd,
.qc_prep = ata_qc_prep, .qc_prep = ata_qc_prep,
.qc_issue = qdi_qc_issue_prot, .qc_issue = qdi_qc_issue_prot,
.eng_timeout = ata_eng_timeout, .eng_timeout = ata_eng_timeout,
...@@ -217,11 +217,11 @@ static struct ata_port_operations qdi6580_port_ops = { ...@@ -217,11 +217,11 @@ static struct ata_port_operations qdi6580_port_ops = {
.irq_handler = ata_interrupt, .irq_handler = ata_interrupt,
.irq_clear = ata_bmdma_irq_clear, .irq_clear = ata_bmdma_irq_clear,
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
/** /**
* qdi_init_one - attach a qdi interface * qdi_init_one - attach a qdi interface
...@@ -233,7 +233,7 @@ static struct ata_port_operations qdi6580_port_ops = { ...@@ -233,7 +233,7 @@ static struct ata_port_operations qdi6580_port_ops = {
* Register an ISA bus IDE interface. Such interfaces are PIO and we * Register an ISA bus IDE interface. Such interfaces are PIO and we
* assume do not support IRQ sharing. * assume do not support IRQ sharing.
*/ */
static __init int qdi_init_one(unsigned long port, int type, unsigned long io, int irq, int fast) static __init int qdi_init_one(unsigned long port, int type, unsigned long io, int irq, int fast)
{ {
struct ata_probe_ent ae; struct ata_probe_ent ae;
...@@ -249,11 +249,11 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i ...@@ -249,11 +249,11 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
pdev = platform_device_register_simple(DRV_NAME, nr_qdi_host, NULL, 0); pdev = platform_device_register_simple(DRV_NAME, nr_qdi_host, NULL, 0);
if (pdev == NULL) if (pdev == NULL)
return -ENOMEM; return -ENOMEM;
memset(&ae, 0, sizeof(struct ata_probe_ent)); memset(&ae, 0, sizeof(struct ata_probe_ent));
INIT_LIST_HEAD(&ae.node); INIT_LIST_HEAD(&ae.node);
ae.dev = &pdev->dev; ae.dev = &pdev->dev;
if (type == 6580) { if (type == 6580) {
ae.port_ops = &qdi6580_port_ops; ae.port_ops = &qdi6580_port_ops;
ae.pio_mask = 0x1F; ae.pio_mask = 0x1F;
...@@ -261,7 +261,7 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i ...@@ -261,7 +261,7 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
ae.port_ops = &qdi6500_port_ops; ae.port_ops = &qdi6500_port_ops;
ae.pio_mask = 0x07; /* Actually PIO3 !IORDY is possible */ ae.pio_mask = 0x07; /* Actually PIO3 !IORDY is possible */
} }
ae.sht = &qdi_sht; ae.sht = &qdi_sht;
ae.n_ports = 1; ae.n_ports = 1;
ae.irq = irq; ae.irq = irq;
...@@ -287,9 +287,9 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i ...@@ -287,9 +287,9 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
platform_device_unregister(pdev); platform_device_unregister(pdev);
return -ENODEV; return -ENODEV;
} }
qdi_host[nr_qdi_host++] = dev_get_drvdata(&pdev->dev); qdi_host[nr_qdi_host++] = dev_get_drvdata(&pdev->dev);
return 0; return 0;
} }
/** /**
...@@ -297,29 +297,29 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i ...@@ -297,29 +297,29 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
* *
* Attach qdi IDE interfaces by scanning the ports it may occupy. * Attach qdi IDE interfaces by scanning the ports it may occupy.
*/ */
static __init int qdi_init(void) static __init int qdi_init(void)
{ {
unsigned long flags; unsigned long flags;
static const unsigned long qd_port[2] = { 0x30, 0xB0 }; static const unsigned long qd_port[2] = { 0x30, 0xB0 };
static const unsigned long ide_port[2] = { 0x170, 0x1F0 }; static const unsigned long ide_port[2] = { 0x170, 0x1F0 };
static const int ide_irq[2] = { 14, 15 }; static const int ide_irq[2] = { 14, 15 };
int ct = 0; int ct = 0;
int i; int i;
if (probe_qdi == 0) if (probe_qdi == 0)
return -ENODEV; return -ENODEV;
/* /*
* Check each possible QD65xx base address * Check each possible QD65xx base address
*/ */
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
unsigned long port = qd_port[i]; unsigned long port = qd_port[i];
u8 r, res; u8 r, res;
if (request_region(port, 2, "pata_qdi")) { if (request_region(port, 2, "pata_qdi")) {
/* Check for a card */ /* Check for a card */
local_irq_save(flags); local_irq_save(flags);
...@@ -328,14 +328,14 @@ static __init int qdi_init(void) ...@@ -328,14 +328,14 @@ static __init int qdi_init(void)
res = inb_p(port); res = inb_p(port);
outb_p(r, port); outb_p(r, port);
local_irq_restore(flags); local_irq_restore(flags);
/* Fail */ /* Fail */
if (res == 0x19) if (res == 0x19)
{ {
release_region(port, 2); release_region(port, 2);
continue; continue;
} }
/* Passes the presence test */ /* Passes the presence test */
r = inb_p(port + 1); /* Check port agrees with port set */ r = inb_p(port + 1); /* Check port agrees with port set */
if ((r & 2) >> 1 != i) { if ((r & 2) >> 1 != i) {
...@@ -343,7 +343,7 @@ static __init int qdi_init(void) ...@@ -343,7 +343,7 @@ static __init int qdi_init(void)
continue; continue;
} }
/* Check card type */ /* Check card type */
if ((r & 0xF0) == 0xC0) { if ((r & 0xF0) == 0xC0) {
/* QD6500: single channel */ /* QD6500: single channel */
if (r & 8) { if (r & 8) {
...@@ -388,7 +388,7 @@ static __exit void qdi_exit(void) ...@@ -388,7 +388,7 @@ static __exit void qdi_exit(void)
*/ */
release_region(qdi_data[i].timing, 2); release_region(qdi_data[i].timing, 2);
platform_device_unregister(qdi_data[i].platform_dev); platform_device_unregister(qdi_data[i].platform_dev);
} }
} }
MODULE_AUTHOR("Alan Cox"); MODULE_AUTHOR("Alan Cox");
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* *
* Set up cable type and use generic probe init * Set up cable type and use generic probe init
*/ */
static int radisys_pre_reset(struct ata_port *ap) static int radisys_pre_reset(struct ata_port *ap)
{ {
ap->cbl = ATA_CBL_PATA80; ap->cbl = ATA_CBL_PATA80;
...@@ -122,7 +122,7 @@ static void radisys_set_dmamode (struct ata_port *ap, struct ata_device *adev) ...@@ -122,7 +122,7 @@ static void radisys_set_dmamode (struct ata_port *ap, struct ata_device *adev)
struct pci_dev *dev = to_pci_dev(ap->host->dev); struct pci_dev *dev = to_pci_dev(ap->host->dev);
u16 idetm_data; u16 idetm_data;
u8 udma_enable; u8 udma_enable;
static const /* ISP RTC */ static const /* ISP RTC */
u8 timings[][2] = { { 0, 0 }, u8 timings[][2] = { { 0, 0 },
{ 0, 0 }, { 0, 0 },
...@@ -154,7 +154,7 @@ static void radisys_set_dmamode (struct ata_port *ap, struct ata_device *adev) ...@@ -154,7 +154,7 @@ static void radisys_set_dmamode (struct ata_port *ap, struct ata_device *adev)
/* Mask out the relevant control and timing bits we will load. Also /* Mask out the relevant control and timing bits we will load. Also
clear the other drive TIME register as a precaution */ clear the other drive TIME register as a precaution */
idetm_data &= 0xCCCC; idetm_data &= 0xCCCC;
idetm_data |= control << (4 * adev->devno); idetm_data |= control << (4 * adev->devno);
idetm_data |= (timings[pio][0] << 12) | (timings[pio][1] << 8); idetm_data |= (timings[pio][0] << 12) | (timings[pio][1] << 8);
...@@ -162,18 +162,18 @@ static void radisys_set_dmamode (struct ata_port *ap, struct ata_device *adev) ...@@ -162,18 +162,18 @@ static void radisys_set_dmamode (struct ata_port *ap, struct ata_device *adev)
udma_enable &= ~(1 << adev->devno); udma_enable &= ~(1 << adev->devno);
} else { } else {
u8 udma_mode; u8 udma_mode;
/* UDMA66 on: UDMA 33 and 66 are switchable via register 0x4A */ /* UDMA66 on: UDMA 33 and 66 are switchable via register 0x4A */
pci_read_config_byte(dev, 0x4A, &udma_mode); pci_read_config_byte(dev, 0x4A, &udma_mode);
if (adev->xfer_mode == XFER_UDMA_2) if (adev->xfer_mode == XFER_UDMA_2)
udma_mode &= ~ (1 << adev->devno); udma_mode &= ~ (1 << adev->devno);
else /* UDMA 4 */ else /* UDMA 4 */
udma_mode |= (1 << adev->devno); udma_mode |= (1 << adev->devno);
pci_write_config_byte(dev, 0x4A, udma_mode); pci_write_config_byte(dev, 0x4A, udma_mode);
udma_enable |= (1 << adev->devno); udma_enable |= (1 << adev->devno);
} }
pci_write_config_word(dev, 0x40, idetm_data); pci_write_config_word(dev, 0x40, idetm_data);
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -54,14 +54,14 @@ ...@@ -54,14 +54,14 @@
* Return the PCI bus clocking for the SC1200 chipset configuration * Return the PCI bus clocking for the SC1200 chipset configuration
* in use. We return 0 for 33MHz 1 for 48MHz and 2 for 66Mhz * in use. We return 0 for 33MHz 1 for 48MHz and 2 for 66Mhz
*/ */
static int sc1200_clock(void) static int sc1200_clock(void)
{ {
/* Magic registers that give us the chipset data */ /* Magic registers that give us the chipset data */
u8 chip_id = inb(0x903C); u8 chip_id = inb(0x903C);
u8 silicon_rev = inb(0x903D); u8 silicon_rev = inb(0x903D);
u16 pci_clock; u16 pci_clock;
if (chip_id == 0x04 && silicon_rev < SC1200_REV_B1) if (chip_id == 0x04 && silicon_rev < SC1200_REV_B1)
return 0; /* 33 MHz mode */ return 0; /* 33 MHz mode */
...@@ -83,7 +83,7 @@ static int sc1200_clock(void) ...@@ -83,7 +83,7 @@ static int sc1200_clock(void)
* *
* Set our PIO requirements. This is fairly simple on the SC1200 * Set our PIO requirements. This is fairly simple on the SC1200
*/ */
static void sc1200_set_piomode(struct ata_port *ap, struct ata_device *adev) static void sc1200_set_piomode(struct ata_port *ap, struct ata_device *adev)
{ {
static const u32 pio_timings[4][5] = { static const u32 pio_timings[4][5] = {
...@@ -97,11 +97,11 @@ static void sc1200_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -97,11 +97,11 @@ static void sc1200_set_piomode(struct ata_port *ap, struct ata_device *adev)
u32 format; u32 format;
unsigned int reg = 0x40 + 0x10 * ap->port_no; unsigned int reg = 0x40 + 0x10 * ap->port_no;
int mode = adev->pio_mode - XFER_PIO_0; int mode = adev->pio_mode - XFER_PIO_0;
pci_read_config_dword(pdev, reg + 4, &format); pci_read_config_dword(pdev, reg + 4, &format);
format >>= 31; format >>= 31;
format += sc1200_clock(); format += sc1200_clock();
pci_write_config_dword(pdev, reg + 8 * adev->devno, pci_write_config_dword(pdev, reg + 8 * adev->devno,
pio_timings[format][mode]); pio_timings[format][mode]);
} }
...@@ -113,7 +113,7 @@ static void sc1200_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -113,7 +113,7 @@ static void sc1200_set_piomode(struct ata_port *ap, struct ata_device *adev)
* We cannot mix MWDMA and UDMA without reloading timings each switch * We cannot mix MWDMA and UDMA without reloading timings each switch
* master to slave. * master to slave.
*/ */
static void sc1200_set_dmamode(struct ata_port *ap, struct ata_device *adev) static void sc1200_set_dmamode(struct ata_port *ap, struct ata_device *adev)
{ {
static const u32 udma_timing[3][3] = { static const u32 udma_timing[3][3] = {
...@@ -121,13 +121,13 @@ static void sc1200_set_dmamode(struct ata_port *ap, struct ata_device *adev) ...@@ -121,13 +121,13 @@ static void sc1200_set_dmamode(struct ata_port *ap, struct ata_device *adev)
{ 0x00932470, 0x00922260, 0x00922140 }, { 0x00932470, 0x00922260, 0x00922140 },
{ 0x009436A1, 0x00933481, 0x00923261 } { 0x009436A1, 0x00933481, 0x00923261 }
}; };
static const u32 mwdma_timing[3][3] = { static const u32 mwdma_timing[3][3] = {
{ 0x00077771, 0x00012121, 0x00002020 }, { 0x00077771, 0x00012121, 0x00002020 },
{ 0x000BBBB2, 0x00024241, 0x00013131 }, { 0x000BBBB2, 0x00024241, 0x00013131 },
{ 0x000FFFF3, 0x00035352, 0x00015151 } { 0x000FFFF3, 0x00035352, 0x00015151 }
}; };
int clock = sc1200_clock(); int clock = sc1200_clock();
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
unsigned int reg = 0x40 + 0x10 * ap->port_no; unsigned int reg = 0x40 + 0x10 * ap->port_no;
...@@ -138,10 +138,10 @@ static void sc1200_set_dmamode(struct ata_port *ap, struct ata_device *adev) ...@@ -138,10 +138,10 @@ static void sc1200_set_dmamode(struct ata_port *ap, struct ata_device *adev)
format = udma_timing[clock][mode - XFER_UDMA_0]; format = udma_timing[clock][mode - XFER_UDMA_0];
else else
format = mwdma_timing[clock][mode - XFER_MW_DMA_0]; format = mwdma_timing[clock][mode - XFER_MW_DMA_0];
if (adev->devno == 0) { if (adev->devno == 0) {
u32 timings; u32 timings;
pci_read_config_dword(pdev, reg + 4, &timings); pci_read_config_dword(pdev, reg + 4, &timings);
timings &= 0x80000000UL; timings &= 0x80000000UL;
timings |= format; timings |= format;
...@@ -201,7 +201,7 @@ static struct ata_port_operations sc1200_port_ops = { ...@@ -201,7 +201,7 @@ static struct ata_port_operations sc1200_port_ops = {
.set_piomode = sc1200_set_piomode, .set_piomode = sc1200_set_piomode,
.set_dmamode = sc1200_set_dmamode, .set_dmamode = sc1200_set_dmamode,
.mode_filter = ata_pci_default_filter, .mode_filter = ata_pci_default_filter,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
.check_status = ata_check_status, .check_status = ata_check_status,
...@@ -226,7 +226,7 @@ static struct ata_port_operations sc1200_port_ops = { ...@@ -226,7 +226,7 @@ static struct ata_port_operations sc1200_port_ops = {
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
/** /**
* sc1200_init_one - Initialise an SC1200 * sc1200_init_one - Initialise an SC1200
...@@ -236,7 +236,7 @@ static struct ata_port_operations sc1200_port_ops = { ...@@ -236,7 +236,7 @@ static struct ata_port_operations sc1200_port_ops = {
* Just throw the needed data at the libata helper and it does all * Just throw the needed data at the libata helper and it does all
* our work. * our work.
*/ */
static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
static struct ata_port_info info = { static struct ata_port_info info = {
...@@ -248,7 +248,7 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -248,7 +248,7 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.port_ops = &sc1200_port_ops .port_ops = &sc1200_port_ops
}; };
static struct ata_port_info *port_info[2] = { &info, &info }; static struct ata_port_info *port_info[2] = { &info, &info };
/* Can't enable port 2 yet, see top comments */ /* Can't enable port 2 yet, see top comments */
return ata_pci_init_one(dev, port_info, 1); return ata_pci_init_one(dev, port_info, 1);
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* based upon * based upon
* *
* serverworks.c * serverworks.c
* *
* Copyright (C) 1998-2000 Michel Aubry * Copyright (C) 1998-2000 Michel Aubry
* Copyright (C) 1998-2000 Andrzej Krzysztofowicz * Copyright (C) 1998-2000 Andrzej Krzysztofowicz
* Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
...@@ -62,12 +62,12 @@ static const char *csb_bad_ata100[] = { ...@@ -62,12 +62,12 @@ static const char *csb_bad_ata100[] = {
* @ap: ATA port to do cable detect * @ap: ATA port to do cable detect
* *
* Dell hide the 40/80 pin select for their interfaces in the top two * Dell hide the 40/80 pin select for their interfaces in the top two
* bits of the subsystem ID. * bits of the subsystem ID.
*/ */
static int dell_cable(struct ata_port *ap) { static int dell_cable(struct ata_port *ap) {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
if (pdev->subsystem_device & (1 << (ap->port_no + 14))) if (pdev->subsystem_device & (1 << (ap->port_no + 14)))
return ATA_CBL_PATA80; return ATA_CBL_PATA80;
return ATA_CBL_PATA40; return ATA_CBL_PATA40;
...@@ -81,10 +81,10 @@ static int dell_cable(struct ata_port *ap) { ...@@ -81,10 +81,10 @@ static int dell_cable(struct ata_port *ap) {
* subsystem ID the same as dell. We could use one function but we may * subsystem ID the same as dell. We could use one function but we may
* need to extend the Dell one in future * need to extend the Dell one in future
*/ */
static int sun_cable(struct ata_port *ap) { static int sun_cable(struct ata_port *ap) {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
if (pdev->subsystem_device & (1 << (ap->port_no + 14))) if (pdev->subsystem_device & (1 << (ap->port_no + 14)))
return ATA_CBL_PATA80; return ATA_CBL_PATA80;
return ATA_CBL_PATA40; return ATA_CBL_PATA40;
...@@ -123,7 +123,7 @@ struct sv_cable_table { ...@@ -123,7 +123,7 @@ struct sv_cable_table {
* Note that we don't copy the old serverworks code because the old * Note that we don't copy the old serverworks code because the old
* code contains obvious mistakes * code contains obvious mistakes
*/ */
static struct sv_cable_table cable_detect[] = { static struct sv_cable_table cable_detect[] = {
{ PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_VENDOR_ID_DELL, dell_cable }, { PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_VENDOR_ID_DELL, dell_cable },
{ PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_VENDOR_ID_DELL, dell_cable }, { PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_VENDOR_ID_DELL, dell_cable },
...@@ -140,16 +140,16 @@ static struct sv_cable_table cable_detect[] = { ...@@ -140,16 +140,16 @@ static struct sv_cable_table cable_detect[] = {
* serverworks_pre_reset - cable detection * serverworks_pre_reset - cable detection
* @ap: ATA port * @ap: ATA port
* *
* Perform cable detection according to the device and subvendor * Perform cable detection according to the device and subvendor
* identifications * identifications
*/ */
static int serverworks_pre_reset(struct ata_port *ap) { static int serverworks_pre_reset(struct ata_port *ap) {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
struct sv_cable_table *cb = cable_detect; struct sv_cable_table *cb = cable_detect;
while(cb->device) { while(cb->device) {
if (cb->device == pdev->device && if (cb->device == pdev->device &&
(cb->subvendor == pdev->subsystem_vendor || (cb->subvendor == pdev->subsystem_vendor ||
cb->subvendor == PCI_ANY_ID)) { cb->subvendor == PCI_ANY_ID)) {
ap->cbl = cb->cable_detect(ap); ap->cbl = cb->cable_detect(ap);
...@@ -174,7 +174,7 @@ static void serverworks_error_handler(struct ata_port *ap) ...@@ -174,7 +174,7 @@ static void serverworks_error_handler(struct ata_port *ap)
* Returns true if the device being checked is known to be a CSB * Returns true if the device being checked is known to be a CSB
* series device. * series device.
*/ */
static u8 serverworks_is_csb(struct pci_dev *pdev) static u8 serverworks_is_csb(struct pci_dev *pdev)
{ {
switch (pdev->device) { switch (pdev->device) {
...@@ -198,7 +198,7 @@ static u8 serverworks_is_csb(struct pci_dev *pdev) ...@@ -198,7 +198,7 @@ static u8 serverworks_is_csb(struct pci_dev *pdev)
* specific rules. OSB4 requires no UDMA for disks due to a FIFO * specific rules. OSB4 requires no UDMA for disks due to a FIFO
* bug we hit. * bug we hit.
*/ */
static unsigned long serverworks_osb4_filter(const struct ata_port *ap, struct ata_device *adev, unsigned long mask) static unsigned long serverworks_osb4_filter(const struct ata_port *ap, struct ata_device *adev, unsigned long mask)
{ {
if (adev->class == ATA_DEV_ATA) if (adev->class == ATA_DEV_ATA)
...@@ -221,14 +221,14 @@ static unsigned long serverworks_csb_filter(const struct ata_port *ap, struct at ...@@ -221,14 +221,14 @@ static unsigned long serverworks_csb_filter(const struct ata_port *ap, struct at
char model_num[40]; char model_num[40];
int len, i; int len, i;
/* Disk, UDMA */ /* Disk, UDMA */
if (adev->class != ATA_DEV_ATA) if (adev->class != ATA_DEV_ATA)
return ata_pci_default_filter(ap, adev, mask); return ata_pci_default_filter(ap, adev, mask);
/* Actually do need to check */ /* Actually do need to check */
ata_id_string(adev->id, model_num, ATA_ID_PROD_OFS, sizeof(model_num)); ata_id_string(adev->id, model_num, ATA_ID_PROD_OFS, sizeof(model_num));
/* Precuationary - why not do this in the libata core ?? */ /* Precuationary - why not do this in the libata core ?? */
len = strlen(model_num); len = strlen(model_num);
while ((len > 0) && (model_num[len - 1] == ' ')) { while ((len > 0) && (model_num[len - 1] == ' ')) {
len--; len--;
...@@ -261,7 +261,7 @@ static void serverworks_set_piomode(struct ata_port *ap, struct ata_device *adev ...@@ -261,7 +261,7 @@ static void serverworks_set_piomode(struct ata_port *ap, struct ata_device *adev
int pio = adev->pio_mode - XFER_PIO_0; int pio = adev->pio_mode - XFER_PIO_0;
pci_write_config_byte(pdev, 0x40 + offset, pio_mode[pio]); pci_write_config_byte(pdev, 0x40 + offset, pio_mode[pio]);
/* The OSB4 just requires the timing but the CSB series want the /* The OSB4 just requires the timing but the CSB series want the
mode number as well */ mode number as well */
if (serverworks_is_csb(pdev)) { if (serverworks_is_csb(pdev)) {
...@@ -303,7 +303,7 @@ static void serverworks_set_dmamode(struct ata_port *ap, struct ata_device *adev ...@@ -303,7 +303,7 @@ static void serverworks_set_dmamode(struct ata_port *ap, struct ata_device *adev
ultra_cfg |= (1 << devbits); ultra_cfg |= (1 << devbits);
} else { } else {
pci_write_config_byte(pdev, 0x44 + offset, pci_write_config_byte(pdev, 0x44 + offset,
dma_mode[adev->dma_mode - XFER_MW_DMA_0]); dma_mode[adev->dma_mode - XFER_MW_DMA_0]);
ultra_cfg &= ~(1 << devbits); ultra_cfg &= ~(1 << devbits);
} }
...@@ -333,7 +333,7 @@ static struct ata_port_operations serverworks_osb4_port_ops = { ...@@ -333,7 +333,7 @@ static struct ata_port_operations serverworks_osb4_port_ops = {
.set_piomode = serverworks_set_piomode, .set_piomode = serverworks_set_piomode,
.set_dmamode = serverworks_set_dmamode, .set_dmamode = serverworks_set_dmamode,
.mode_filter = serverworks_osb4_filter, .mode_filter = serverworks_osb4_filter,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
.check_status = ata_check_status, .check_status = ata_check_status,
...@@ -354,19 +354,19 @@ static struct ata_port_operations serverworks_osb4_port_ops = { ...@@ -354,19 +354,19 @@ static struct ata_port_operations serverworks_osb4_port_ops = {
.qc_issue = ata_qc_issue_prot, .qc_issue = ata_qc_issue_prot,
.eng_timeout = ata_eng_timeout, .eng_timeout = ata_eng_timeout,
.data_xfer = ata_pio_data_xfer, .data_xfer = ata_pio_data_xfer,
.irq_handler = ata_interrupt, .irq_handler = ata_interrupt,
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
static struct ata_port_operations serverworks_csb_port_ops = { static struct ata_port_operations serverworks_csb_port_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.set_piomode = serverworks_set_piomode, .set_piomode = serverworks_set_piomode,
.set_dmamode = serverworks_set_dmamode, .set_dmamode = serverworks_set_dmamode,
.mode_filter = serverworks_csb_filter, .mode_filter = serverworks_csb_filter,
.tf_load = ata_tf_load, .tf_load = ata_tf_load,
.tf_read = ata_tf_read, .tf_read = ata_tf_read,
.check_status = ata_check_status, .check_status = ata_check_status,
...@@ -387,12 +387,12 @@ static struct ata_port_operations serverworks_csb_port_ops = { ...@@ -387,12 +387,12 @@ static struct ata_port_operations serverworks_csb_port_ops = {
.qc_issue = ata_qc_issue_prot, .qc_issue = ata_qc_issue_prot,
.eng_timeout = ata_eng_timeout, .eng_timeout = ata_eng_timeout,
.data_xfer = ata_pio_data_xfer, .data_xfer = ata_pio_data_xfer,
.irq_handler = ata_interrupt, .irq_handler = ata_interrupt,
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
static int serverworks_fixup_osb4(struct pci_dev *pdev) static int serverworks_fixup_osb4(struct pci_dev *pdev)
{ {
...@@ -417,7 +417,7 @@ static int serverworks_fixup_csb(struct pci_dev *pdev) ...@@ -417,7 +417,7 @@ static int serverworks_fixup_csb(struct pci_dev *pdev)
{ {
u8 rev; u8 rev;
u8 btr; u8 btr;
pci_read_config_byte(pdev, PCI_REVISION_ID, &rev); pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
/* Third Channel Test */ /* Third Channel Test */
...@@ -463,7 +463,7 @@ static int serverworks_fixup_csb(struct pci_dev *pdev) ...@@ -463,7 +463,7 @@ static int serverworks_fixup_csb(struct pci_dev *pdev)
else else
btr |= (rev >= SVWKS_CSB5_REVISION_NEW) ? 0x3 : 0x2; btr |= (rev >= SVWKS_CSB5_REVISION_NEW) ? 0x3 : 0x2;
pci_write_config_byte(pdev, 0x5A, btr); pci_write_config_byte(pdev, 0x5A, btr);
return btr; return btr;
} }
...@@ -514,7 +514,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id ...@@ -514,7 +514,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id
}; };
static struct ata_port_info *port_info[2]; static struct ata_port_info *port_info[2];
struct ata_port_info *devinfo = &info[id->driver_data]; struct ata_port_info *devinfo = &info[id->driver_data];
/* Force master latency timer to 64 PCI clocks */ /* Force master latency timer to 64 PCI clocks */
pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40); pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40);
...@@ -528,12 +528,12 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id ...@@ -528,12 +528,12 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id
else if ((pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) || else if ((pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) ||
(pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) || (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
(pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) { (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) {
/* If the returned btr is the newer revision then /* If the returned btr is the newer revision then
select the right info block */ select the right info block */
if (serverworks_fixup_csb(pdev) == 3) if (serverworks_fixup_csb(pdev) == 3)
devinfo = &info[3]; devinfo = &info[3];
/* Is this the 3rd channel CSB6 IDE ? */ /* Is this the 3rd channel CSB6 IDE ? */
if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)
ports = 1; ports = 1;
...@@ -541,10 +541,10 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id ...@@ -541,10 +541,10 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id
/* setup HT1000E */ /* setup HT1000E */
else if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) else if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE)
serverworks_fixup_ht1000(pdev); serverworks_fixup_ht1000(pdev);
if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE)
ata_pci_clear_simplex(pdev); ata_pci_clear_simplex(pdev);
port_info[0] = port_info[1] = devinfo; port_info[0] = port_info[1] = devinfo;
return ata_pci_init_one(pdev, port_info, ports); return ata_pci_init_one(pdev, port_info, ports);
} }
......
...@@ -70,7 +70,7 @@ static int sis_133_pre_reset(struct ata_port *ap) ...@@ -70,7 +70,7 @@ static int sis_133_pre_reset(struct ata_port *ap)
{ 0x4aU, 1U, 0x02UL, 0x02UL }, /* port 0 */ { 0x4aU, 1U, 0x02UL, 0x02UL }, /* port 0 */
{ 0x4aU, 1U, 0x04UL, 0x04UL }, /* port 1 */ { 0x4aU, 1U, 0x04UL, 0x04UL }, /* port 1 */
}; };
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
u16 tmp; u16 tmp;
...@@ -164,7 +164,7 @@ static int sis_old_pre_reset(struct ata_port *ap) ...@@ -164,7 +164,7 @@ static int sis_old_pre_reset(struct ata_port *ap)
{ 0x4aU, 1U, 0x02UL, 0x02UL }, /* port 0 */ { 0x4aU, 1U, 0x02UL, 0x02UL }, /* port 0 */
{ 0x4aU, 1U, 0x04UL, 0x04UL }, /* port 1 */ { 0x4aU, 1U, 0x04UL, 0x04UL }, /* port 1 */
}; };
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
if (!pci_test_config_bits(pdev, &sis_enable_bits[ap->port_no])) { if (!pci_test_config_bits(pdev, &sis_enable_bits[ap->port_no])) {
...@@ -601,7 +601,7 @@ static const struct ata_port_operations sis_133_early_ops = { ...@@ -601,7 +601,7 @@ static const struct ata_port_operations sis_133_early_ops = {
.thaw = ata_bmdma_thaw, .thaw = ata_bmdma_thaw,
.error_handler = sis_66_error_handler, .error_handler = sis_66_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd, .post_internal_cmd = ata_bmdma_post_internal_cmd,
.bmdma_setup = ata_bmdma_setup, .bmdma_setup = ata_bmdma_setup,
.bmdma_start = ata_bmdma_start, .bmdma_start = ata_bmdma_start,
.bmdma_stop = ata_bmdma_stop, .bmdma_stop = ata_bmdma_stop,
...@@ -636,7 +636,7 @@ static const struct ata_port_operations sis_100_ops = { ...@@ -636,7 +636,7 @@ static const struct ata_port_operations sis_100_ops = {
.thaw = ata_bmdma_thaw, .thaw = ata_bmdma_thaw,
.error_handler = sis_66_error_handler, .error_handler = sis_66_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd, .post_internal_cmd = ata_bmdma_post_internal_cmd,
.bmdma_setup = ata_bmdma_setup, .bmdma_setup = ata_bmdma_setup,
.bmdma_start = ata_bmdma_start, .bmdma_start = ata_bmdma_start,
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* and in part on the documentation and errata sheet * and in part on the documentation and errata sheet
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
...@@ -40,7 +40,7 @@ enum { ...@@ -40,7 +40,7 @@ enum {
* *
* Set up cable type and use generic probe init * Set up cable type and use generic probe init
*/ */
static int sl82c105_pre_reset(struct ata_port *ap) static int sl82c105_pre_reset(struct ata_port *ap)
{ {
static const struct pci_bits sl82c105_enable_bits[] = { static const struct pci_bits sl82c105_enable_bits[] = {
...@@ -75,7 +75,7 @@ static void sl82c105_error_handler(struct ata_port *ap) ...@@ -75,7 +75,7 @@ static void sl82c105_error_handler(struct ata_port *ap)
* so a configure_dmamode call will undo any work we do here and vice * so a configure_dmamode call will undo any work we do here and vice
* versa * versa
*/ */
static void sl82c105_configure_piomode(struct ata_port *ap, struct ata_device *adev, int pio) static void sl82c105_configure_piomode(struct ata_port *ap, struct ata_device *adev, int pio)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
...@@ -84,7 +84,7 @@ static void sl82c105_configure_piomode(struct ata_port *ap, struct ata_device *a ...@@ -84,7 +84,7 @@ static void sl82c105_configure_piomode(struct ata_port *ap, struct ata_device *a
}; };
u16 dummy; u16 dummy;
int timing = 0x44 + (8 * ap->port_no) + (4 * adev->devno); int timing = 0x44 + (8 * ap->port_no) + (4 * adev->devno);
pci_write_config_word(pdev, timing, pio_timing[pio]); pci_write_config_word(pdev, timing, pio_timing[pio]);
/* Can we lose this oddity of the old driver */ /* Can we lose this oddity of the old driver */
pci_read_config_word(pdev, timing, &dummy); pci_read_config_word(pdev, timing, &dummy);
...@@ -98,7 +98,7 @@ static void sl82c105_configure_piomode(struct ata_port *ap, struct ata_device *a ...@@ -98,7 +98,7 @@ static void sl82c105_configure_piomode(struct ata_port *ap, struct ata_device *a
* Called to do the PIO mode setup. Our timing registers are shared * Called to do the PIO mode setup. Our timing registers are shared
* but we want to set the PIO timing by default. * but we want to set the PIO timing by default.
*/ */
static void sl82c105_set_piomode(struct ata_port *ap, struct ata_device *adev) static void sl82c105_set_piomode(struct ata_port *ap, struct ata_device *adev)
{ {
sl82c105_configure_piomode(ap, adev, adev->pio_mode - XFER_PIO_0); sl82c105_configure_piomode(ap, adev, adev->pio_mode - XFER_PIO_0);
...@@ -112,7 +112,7 @@ static void sl82c105_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -112,7 +112,7 @@ static void sl82c105_set_piomode(struct ata_port *ap, struct ata_device *adev)
* Load DMA cycle times into the chip ready for a DMA transfer * Load DMA cycle times into the chip ready for a DMA transfer
* to occur. * to occur.
*/ */
static void sl82c105_configure_dmamode(struct ata_port *ap, struct ata_device *adev) static void sl82c105_configure_dmamode(struct ata_port *ap, struct ata_device *adev)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
...@@ -122,7 +122,7 @@ static void sl82c105_configure_dmamode(struct ata_port *ap, struct ata_device *a ...@@ -122,7 +122,7 @@ static void sl82c105_configure_dmamode(struct ata_port *ap, struct ata_device *a
u16 dummy; u16 dummy;
int timing = 0x44 + (8 * ap->port_no) + (4 * adev->devno); int timing = 0x44 + (8 * ap->port_no) + (4 * adev->devno);
int dma = adev->dma_mode - XFER_MW_DMA_0; int dma = adev->dma_mode - XFER_MW_DMA_0;
pci_write_config_word(pdev, timing, dma_timing[dma]); pci_write_config_word(pdev, timing, dma_timing[dma]);
/* Can we lose this oddity of the old driver */ /* Can we lose this oddity of the old driver */
pci_read_config_word(pdev, timing, &dummy); pci_read_config_word(pdev, timing, &dummy);
...@@ -137,7 +137,7 @@ static void sl82c105_configure_dmamode(struct ata_port *ap, struct ata_device *a ...@@ -137,7 +137,7 @@ static void sl82c105_configure_dmamode(struct ata_port *ap, struct ata_device *a
* for the device in question. Set appropriate PIO timings not DMA * for the device in question. Set appropriate PIO timings not DMA
* timings at this point. * timings at this point.
*/ */
static void sl82c105_set_dmamode(struct ata_port *ap, struct ata_device *adev) static void sl82c105_set_dmamode(struct ata_port *ap, struct ata_device *adev)
{ {
switch(adev->dma_mode) { switch(adev->dma_mode) {
...@@ -152,7 +152,7 @@ static void sl82c105_set_dmamode(struct ata_port *ap, struct ata_device *adev) ...@@ -152,7 +152,7 @@ static void sl82c105_set_dmamode(struct ata_port *ap, struct ata_device *adev)
break; break;
default: default:
BUG(); BUG();
} }
} }
/** /**
...@@ -160,16 +160,16 @@ static void sl82c105_set_dmamode(struct ata_port *ap, struct ata_device *adev) ...@@ -160,16 +160,16 @@ static void sl82c105_set_dmamode(struct ata_port *ap, struct ata_device *adev)
* @ap: ATA interface * @ap: ATA interface
* *
* The sl82c105 has some serious problems with the DMA engine * The sl82c105 has some serious problems with the DMA engine
* when transfers don't run as expected or ATAPI is used. The * when transfers don't run as expected or ATAPI is used. The
* recommended fix is to reset the engine each use using a chip * recommended fix is to reset the engine each use using a chip
* test register. * test register.
*/ */
static void sl82c105_reset_engine(struct ata_port *ap) static void sl82c105_reset_engine(struct ata_port *ap)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
u16 val; u16 val;
pci_read_config_word(pdev, 0x7E, &val); pci_read_config_word(pdev, 0x7E, &val);
pci_write_config_word(pdev, 0x7E, val | 4); pci_write_config_word(pdev, 0x7E, val | 4);
pci_write_config_word(pdev, 0x7E, val & ~4); pci_write_config_word(pdev, 0x7E, val & ~4);
...@@ -180,21 +180,21 @@ static void sl82c105_reset_engine(struct ata_port *ap) ...@@ -180,21 +180,21 @@ static void sl82c105_reset_engine(struct ata_port *ap)
* @qc: ATA command * @qc: ATA command
* *
* Reset the DMA engine each use as recommended by the errata * Reset the DMA engine each use as recommended by the errata
* document. * document.
* *
* FIXME: if we switch clock at BMDMA start/end we might get better * FIXME: if we switch clock at BMDMA start/end we might get better
* PIO performance on DMA capable devices. * PIO performance on DMA capable devices.
*/ */
static void sl82c105_bmdma_start(struct ata_queued_cmd *qc) static void sl82c105_bmdma_start(struct ata_queued_cmd *qc)
{ {
struct ata_port *ap = qc->ap; struct ata_port *ap = qc->ap;
sl82c105_reset_engine(ap); sl82c105_reset_engine(ap);
/* Set the clocks for DMA */ /* Set the clocks for DMA */
sl82c105_configure_dmamode(ap, qc->dev); sl82c105_configure_dmamode(ap, qc->dev);
/* Activate DMA */ /* Activate DMA */
ata_bmdma_start(qc); ata_bmdma_start(qc);
} }
...@@ -212,14 +212,14 @@ static void sl82c105_bmdma_start(struct ata_queued_cmd *qc) ...@@ -212,14 +212,14 @@ static void sl82c105_bmdma_start(struct ata_queued_cmd *qc)
* We assume bmdma_stop is always called if bmdma_start as called. If * We assume bmdma_stop is always called if bmdma_start as called. If
* not then we may need to wrap qc_issue. * not then we may need to wrap qc_issue.
*/ */
static void sl82c105_bmdma_stop(struct ata_queued_cmd *qc) static void sl82c105_bmdma_stop(struct ata_queued_cmd *qc)
{ {
struct ata_port *ap = qc->ap; struct ata_port *ap = qc->ap;
ata_bmdma_stop(qc); ata_bmdma_stop(qc);
sl82c105_reset_engine(ap); sl82c105_reset_engine(ap);
/* This will redo the initial setup of the DMA device to matching /* This will redo the initial setup of the DMA device to matching
PIO timings */ PIO timings */
sl82c105_set_dmamode(ap, qc->dev); sl82c105_set_dmamode(ap, qc->dev);
...@@ -269,11 +269,11 @@ static struct ata_port_operations sl82c105_port_ops = { ...@@ -269,11 +269,11 @@ static struct ata_port_operations sl82c105_port_ops = {
.irq_handler = ata_interrupt, .irq_handler = ata_interrupt,
.irq_clear = ata_bmdma_irq_clear, .irq_clear = ata_bmdma_irq_clear,
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop .host_stop = ata_host_stop
}; };
/** /**
* sl82c105_bridge_revision - find bridge version * sl82c105_bridge_revision - find bridge version
...@@ -283,7 +283,7 @@ static struct ata_port_operations sl82c105_port_ops = { ...@@ -283,7 +283,7 @@ static struct ata_port_operations sl82c105_port_ops = {
* providing it is a Winbond 553 reports the revision. If it cannot * providing it is a Winbond 553 reports the revision. If it cannot
* find a revision or the right device it returns -1 * find a revision or the right device it returns -1
*/ */
static int sl82c105_bridge_revision(struct pci_dev *pdev) static int sl82c105_bridge_revision(struct pci_dev *pdev)
{ {
struct pci_dev *bridge; struct pci_dev *bridge;
...@@ -315,7 +315,7 @@ static int sl82c105_bridge_revision(struct pci_dev *pdev) ...@@ -315,7 +315,7 @@ static int sl82c105_bridge_revision(struct pci_dev *pdev)
return rev; return rev;
} }
static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
static struct ata_port_info info_dma = { static struct ata_port_info info_dma = {
...@@ -336,7 +336,7 @@ static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id ...@@ -336,7 +336,7 @@ static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id
int rev; int rev;
rev = sl82c105_bridge_revision(dev); rev = sl82c105_bridge_revision(dev);
if (rev == -1) if (rev == -1)
dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Unable to find bridge, disabling DMA.\n"); dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Unable to find bridge, disabling DMA.\n");
else if (rev <= 5) else if (rev <= 5)
...@@ -345,7 +345,7 @@ static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id ...@@ -345,7 +345,7 @@ static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id
port_info[0] = &info_dma; port_info[0] = &info_dma;
port_info[1] = &info_dma; port_info[1] = &info_dma;
} }
pci_read_config_dword(dev, 0x40, &val); pci_read_config_dword(dev, 0x40, &val);
val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16;
pci_write_config_dword(dev, 0x40, val); pci_write_config_dword(dev, 0x40, val);
......
...@@ -60,7 +60,7 @@ static int triflex_probe_init(struct ata_port *ap) ...@@ -60,7 +60,7 @@ static int triflex_probe_init(struct ata_port *ap)
}; };
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
if (!pci_test_config_bits(pdev, &triflex_enable_bits[ap->port_no])) { if (!pci_test_config_bits(pdev, &triflex_enable_bits[ap->port_no])) {
ata_port_disable(ap); ata_port_disable(ap);
printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id); printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id);
......
...@@ -154,7 +154,7 @@ static int via_pre_reset(struct ata_port *ap) ...@@ -154,7 +154,7 @@ static int via_pre_reset(struct ata_port *ap)
}; };
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
if (!pci_test_config_bits(pdev, &via_enable_bits[ap->port_no])) { if (!pci_test_config_bits(pdev, &via_enable_bits[ap->port_no])) {
ata_port_disable(ap); ata_port_disable(ap);
printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id); printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id);
......
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