Commit bd7fc2f2 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: (49 commits)
  libata-sff: separate out BMDMA qc_issue
  libata-sff: prd is BMDMA specific
  libata-sff: ata_sff_[dumb_]qc_prep are BMDMA specific
  libata-sff: separate out BMDMA EH
  libata-sff: port_task is SFF specific
  libata-sff: ap->[last_]ctl are SFF specific
  libata-sff: rename ap->ops->drain_fifo() to sff_drain_fifo()
  libata-sff: introduce ata_sff_init/exit() and ata_sff_port_init()
  libata-sff: clean up BMDMA initialization
  libata-sff: clean up inheritance in several drivers
  libata-sff: reorder SFF/BMDMA functions
  sata_inic162x: kill PORT_PRD_ADDR initialization
  libata: kill ATA_FLAG_DISABLED
  libata-sff: kill unused prototype and make ata_dev_select() static
  libata-sff: update bmdma host bus error handling
  sata_mv: remove unnecessary initialization
  sata_inic162x: inic162x is not dependent on CONFIG_ATA_SFF
  pata_sch: use ata_pci_sff_init_one()
  pata_sil680: Do our own exec_command posting
  libata: Remove excess delay in the tf_load path
  ...
parents f39d01be 360ff783
...@@ -81,16 +81,14 @@ void (*port_disable) (struct ata_port *); ...@@ -81,16 +81,14 @@ void (*port_disable) (struct ata_port *);
</programlisting> </programlisting>
<para> <para>
Called from ata_bus_probe() and ata_bus_reset() error paths, Called from ata_bus_probe() error path, as well as when
as well as when unregistering from the SCSI module (rmmod, hot unregistering from the SCSI module (rmmod, hot unplug).
unplug).
This function should do whatever needs to be done to take the This function should do whatever needs to be done to take the
port out of use. In most cases, ata_port_disable() can be used port out of use. In most cases, ata_port_disable() can be used
as this hook. as this hook.
</para> </para>
<para> <para>
Called from ata_bus_probe() on a failed probe. Called from ata_bus_probe() on a failed probe.
Called from ata_bus_reset() on a failed bus reset.
Called from ata_scsi_release(). Called from ata_scsi_release().
</para> </para>
...@@ -227,6 +225,18 @@ u8 (*sff_check_altstatus)(struct ata_port *ap); ...@@ -227,6 +225,18 @@ u8 (*sff_check_altstatus)(struct ata_port *ap);
</sect2> </sect2>
<sect2><title>Write specific ATA shadow register</title>
<programlisting>
void (*sff_set_devctl)(struct ata_port *ap, u8 ctl);
</programlisting>
<para>
Write the device control ATA shadow register to the hardware.
Most drivers don't need to define this.
</para>
</sect2>
<sect2><title>Select ATA device on bus</title> <sect2><title>Select ATA device on bus</title>
<programlisting> <programlisting>
void (*sff_dev_select)(struct ata_port *ap, unsigned int device); void (*sff_dev_select)(struct ata_port *ap, unsigned int device);
......
...@@ -65,6 +65,14 @@ config SATA_AHCI ...@@ -65,6 +65,14 @@ config SATA_AHCI
If unsure, say N. If unsure, say N.
config SATA_AHCI_PLATFORM
tristate "Platform AHCI SATA support"
help
This option enables support for Platform AHCI Serial ATA
controllers.
If unsure, say N.
config SATA_SIL24 config SATA_SIL24
tristate "Silicon Image 3124/3132 SATA support" tristate "Silicon Image 3124/3132 SATA support"
depends on PCI depends on PCI
...@@ -73,6 +81,12 @@ config SATA_SIL24 ...@@ -73,6 +81,12 @@ config SATA_SIL24
If unsure, say N. If unsure, say N.
config SATA_INIC162X
tristate "Initio 162x SATA support"
depends on PCI
help
This option enables support for Initio 162x Serial ATA.
config SATA_FSL config SATA_FSL
tristate "Freescale 3.0Gbps SATA support" tristate "Freescale 3.0Gbps SATA support"
depends on FSL_SOC depends on FSL_SOC
...@@ -213,12 +227,6 @@ config SATA_VITESSE ...@@ -213,12 +227,6 @@ config SATA_VITESSE
If unsure, say N. If unsure, say N.
config SATA_INIC162X
tristate "Initio 162x SATA support"
depends on PCI
help
This option enables support for Initio 162x Serial ATA.
config PATA_ACPI config PATA_ACPI
tristate "ACPI firmware driver for PATA" tristate "ACPI firmware driver for PATA"
depends on ATA_ACPI depends on ATA_ACPI
......
obj-$(CONFIG_ATA) += libata.o obj-$(CONFIG_ATA) += libata.o
obj-$(CONFIG_SATA_AHCI) += ahci.o obj-$(CONFIG_SATA_AHCI) += ahci.o libahci.o
obj-$(CONFIG_SATA_AHCI_PLATFORM) += ahci_platform.o libahci.o
obj-$(CONFIG_SATA_SVW) += sata_svw.o obj-$(CONFIG_SATA_SVW) += sata_svw.o
obj-$(CONFIG_ATA_PIIX) += ata_piix.o obj-$(CONFIG_ATA_PIIX) += ata_piix.o
obj-$(CONFIG_SATA_PROMISE) += sata_promise.o obj-$(CONFIG_SATA_PROMISE) += sata_promise.o
......
This diff is collapsed.
This diff is collapsed.
/*
* AHCI SATA platform driver
*
* Copyright 2004-2005 Red Hat, Inc.
* Jeff Garzik <jgarzik@pobox.com>
* Copyright 2010 MontaVista Software, LLC.
* Anton Vorontsov <avorontsov@ru.mvista.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*/
#include <linux/kernel.h>
#include <linux/gfp.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/libata.h>
#include <linux/ahci_platform.h>
#include "ahci.h"
static int __init ahci_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct ahci_platform_data *pdata = dev->platform_data;
struct ata_port_info pi = {
.flags = AHCI_FLAG_COMMON,
.pio_mask = ATA_PIO4,
.udma_mask = ATA_UDMA6,
.port_ops = &ahci_ops,
};
const struct ata_port_info *ppi[] = { &pi, NULL };
struct ahci_host_priv *hpriv;
struct ata_host *host;
struct resource *mem;
int irq;
int n_ports;
int i;
int rc;
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem) {
dev_err(dev, "no mmio space\n");
return -EINVAL;
}
irq = platform_get_irq(pdev, 0);
if (irq <= 0) {
dev_err(dev, "no irq\n");
return -EINVAL;
}
if (pdata && pdata->init) {
rc = pdata->init(dev);
if (rc)
return rc;
}
if (pdata && pdata->ata_port_info)
pi = *pdata->ata_port_info;
hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
if (!hpriv) {
rc = -ENOMEM;
goto err0;
}
hpriv->flags |= (unsigned long)pi.private_data;
hpriv->mmio = devm_ioremap(dev, mem->start, resource_size(mem));
if (!hpriv->mmio) {
dev_err(dev, "can't map %pR\n", mem);
rc = -ENOMEM;
goto err0;
}
ahci_save_initial_config(dev, hpriv,
pdata ? pdata->force_port_map : 0,
pdata ? pdata->mask_port_map : 0);
/* prepare host */
if (hpriv->cap & HOST_CAP_NCQ)
pi.flags |= ATA_FLAG_NCQ;
if (hpriv->cap & HOST_CAP_PMP)
pi.flags |= ATA_FLAG_PMP;
ahci_set_em_messages(hpriv, &pi);
/* CAP.NP sometimes indicate the index of the last enabled
* port, at other times, that of the last possible port, so
* determining the maximum port number requires looking at
* both CAP.NP and port_map.
*/
n_ports = max(ahci_nr_ports(hpriv->cap), fls(hpriv->port_map));
host = ata_host_alloc_pinfo(dev, ppi, n_ports);
if (!host) {
rc = -ENOMEM;
goto err0;
}
host->private_data = hpriv;
if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss)
host->flags |= ATA_HOST_PARALLEL_SCAN;
else
printk(KERN_INFO "ahci: SSS flag set, parallel bus scan disabled\n");
if (pi.flags & ATA_FLAG_EM)
ahci_reset_em(host);
for (i = 0; i < host->n_ports; i++) {
struct ata_port *ap = host->ports[i];
ata_port_desc(ap, "mmio %pR", mem);
ata_port_desc(ap, "port 0x%x", 0x100 + ap->port_no * 0x80);
/* set initial link pm policy */
ap->pm_policy = NOT_AVAILABLE;
/* set enclosure management message type */
if (ap->flags & ATA_FLAG_EM)
ap->em_message_type = hpriv->em_msg_type;
/* disabled/not-implemented port */
if (!(hpriv->port_map & (1 << i)))
ap->ops = &ata_dummy_port_ops;
}
rc = ahci_reset_controller(host);
if (rc)
goto err0;
ahci_init_controller(host);
ahci_print_info(host, "platform");
rc = ata_host_activate(host, irq, ahci_interrupt, IRQF_SHARED,
&ahci_sht);
if (rc)
goto err0;
return 0;
err0:
if (pdata && pdata->exit)
pdata->exit(dev);
return rc;
}
static int __devexit ahci_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct ahci_platform_data *pdata = dev->platform_data;
struct ata_host *host = dev_get_drvdata(dev);
ata_host_detach(host);
if (pdata && pdata->exit)
pdata->exit(dev);
return 0;
}
static struct platform_driver ahci_driver = {
.probe = ahci_probe,
.remove = __devexit_p(ahci_remove),
.driver = {
.name = "ahci",
.owner = THIS_MODULE,
},
};
static int __init ahci_init(void)
{
return platform_driver_probe(&ahci_driver, ahci_probe);
}
module_init(ahci_init);
static void __exit ahci_exit(void)
{
platform_driver_unregister(&ahci_driver);
}
module_exit(ahci_exit);
MODULE_DESCRIPTION("AHCI SATA platform driver");
MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:ahci");
This diff is collapsed.
This diff is collapsed.
...@@ -550,8 +550,8 @@ void ata_scsi_error(struct Scsi_Host *host) ...@@ -550,8 +550,8 @@ void ata_scsi_error(struct Scsi_Host *host)
DPRINTK("ENTER\n"); DPRINTK("ENTER\n");
/* synchronize with port task */ /* make sure sff pio task is not running */
ata_port_flush_task(ap); ata_sff_flush_pio_task(ap);
/* synchronize with host lock and sort out timeouts */ /* synchronize with host lock and sort out timeouts */
...@@ -3684,7 +3684,7 @@ void ata_std_error_handler(struct ata_port *ap) ...@@ -3684,7 +3684,7 @@ void ata_std_error_handler(struct ata_port *ap)
ata_reset_fn_t hardreset = ops->hardreset; ata_reset_fn_t hardreset = ops->hardreset;
/* ignore built-in hardreset if SCR access is not available */ /* ignore built-in hardreset if SCR access is not available */
if (ata_is_builtin_hardreset(hardreset) && !sata_scr_valid(&ap->link)) if (hardreset == sata_std_hardreset && !sata_scr_valid(&ap->link))
hardreset = NULL; hardreset = NULL;
ata_do_eh(ap, ops->prereset, ops->softreset, hardreset, ops->postreset); ata_do_eh(ap, ops->prereset, ops->softreset, hardreset, ops->postreset);
......
...@@ -231,10 +231,14 @@ static const char *sata_pmp_spec_rev_str(const u32 *gscr) ...@@ -231,10 +231,14 @@ static const char *sata_pmp_spec_rev_str(const u32 *gscr)
return "<unknown>"; return "<unknown>";
} }
#define PMP_GSCR_SII_POL 129
static int sata_pmp_configure(struct ata_device *dev, int print_info) static int sata_pmp_configure(struct ata_device *dev, int print_info)
{ {
struct ata_port *ap = dev->link->ap; struct ata_port *ap = dev->link->ap;
u32 *gscr = dev->gscr; u32 *gscr = dev->gscr;
u16 vendor = sata_pmp_gscr_vendor(gscr);
u16 devid = sata_pmp_gscr_devid(gscr);
unsigned int err_mask = 0; unsigned int err_mask = 0;
const char *reason; const char *reason;
int nr_ports, rc; int nr_ports, rc;
...@@ -260,12 +264,34 @@ static int sata_pmp_configure(struct ata_device *dev, int print_info) ...@@ -260,12 +264,34 @@ static int sata_pmp_configure(struct ata_device *dev, int print_info)
goto fail; goto fail;
} }
/* Disable sending Early R_OK.
* With "cached read" HDD testing and multiple ports busy on a SATA
* host controller, 3726 PMP will very rarely drop a deferred
* R_OK that was intended for the host. Symptom will be all
* 5 drives under test will timeout, get reset, and recover.
*/
if (vendor == 0x1095 && devid == 0x3726) {
u32 reg;
err_mask = sata_pmp_read(&ap->link, PMP_GSCR_SII_POL, &reg);
if (err_mask) {
rc = -EIO;
reason = "failed to read Sil3726 Private Register";
goto fail;
}
reg &= ~0x1;
err_mask = sata_pmp_write(&ap->link, PMP_GSCR_SII_POL, reg);
if (err_mask) {
rc = -EIO;
reason = "failed to write Sil3726 Private Register";
goto fail;
}
}
if (print_info) { if (print_info) {
ata_dev_printk(dev, KERN_INFO, "Port Multiplier %s, " ata_dev_printk(dev, KERN_INFO, "Port Multiplier %s, "
"0x%04x:0x%04x r%d, %d ports, feat 0x%x/0x%x\n", "0x%04x:0x%04x r%d, %d ports, feat 0x%x/0x%x\n",
sata_pmp_spec_rev_str(gscr), sata_pmp_spec_rev_str(gscr), vendor, devid,
sata_pmp_gscr_vendor(gscr),
sata_pmp_gscr_devid(gscr),
sata_pmp_gscr_rev(gscr), sata_pmp_gscr_rev(gscr),
nr_ports, gscr[SATA_PMP_GSCR_FEAT_EN], nr_ports, gscr[SATA_PMP_GSCR_FEAT_EN],
gscr[SATA_PMP_GSCR_FEAT]); gscr[SATA_PMP_GSCR_FEAT]);
......
...@@ -3345,9 +3345,6 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync) ...@@ -3345,9 +3345,6 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)
struct ata_link *link; struct ata_link *link;
struct ata_device *dev; struct ata_device *dev;
if (ap->flags & ATA_FLAG_DISABLED)
return;
repeat: repeat:
ata_for_each_link(link, ap, EDGE) { ata_for_each_link(link, ap, EDGE) {
ata_for_each_dev(dev, link, ENABLED) { ata_for_each_dev(dev, link, ENABLED) {
......
This diff is collapsed.
...@@ -38,17 +38,6 @@ struct ata_scsi_args { ...@@ -38,17 +38,6 @@ struct ata_scsi_args {
void (*done)(struct scsi_cmnd *); void (*done)(struct scsi_cmnd *);
}; };
static inline int ata_is_builtin_hardreset(ata_reset_fn_t reset)
{
if (reset == sata_std_hardreset)
return 1;
#ifdef CONFIG_ATA_SFF
if (reset == sata_sff_hardreset)
return 1;
#endif
return 0;
}
/* libata-core.c */ /* libata-core.c */
enum { enum {
/* flags for ata_dev_read_id() */ /* flags for ata_dev_read_id() */
...@@ -79,7 +68,6 @@ extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, ...@@ -79,7 +68,6 @@ extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
u64 block, u32 n_block, unsigned int tf_flags, u64 block, u32 n_block, unsigned int tf_flags,
unsigned int tag); unsigned int tag);
extern u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev); extern u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev);
extern void ata_port_flush_task(struct ata_port *ap);
extern unsigned ata_exec_internal(struct ata_device *dev, extern unsigned ata_exec_internal(struct ata_device *dev,
struct ata_taskfile *tf, const u8 *cdb, struct ata_taskfile *tf, const u8 *cdb,
int dma_dir, void *buf, unsigned int buflen, int dma_dir, void *buf, unsigned int buflen,
...@@ -202,10 +190,19 @@ static inline int sata_pmp_attach(struct ata_device *dev) ...@@ -202,10 +190,19 @@ static inline int sata_pmp_attach(struct ata_device *dev)
/* libata-sff.c */ /* libata-sff.c */
#ifdef CONFIG_ATA_SFF #ifdef CONFIG_ATA_SFF
extern void ata_dev_select(struct ata_port *ap, unsigned int device, extern void ata_sff_flush_pio_task(struct ata_port *ap);
unsigned int wait, unsigned int can_sleep); extern void ata_sff_port_init(struct ata_port *ap);
extern u8 ata_irq_on(struct ata_port *ap); extern int ata_sff_init(void);
extern void ata_pio_task(struct work_struct *work); extern void ata_sff_exit(void);
#else /* CONFIG_ATA_SFF */
static inline void ata_sff_flush_pio_task(struct ata_port *ap)
{ }
static inline void ata_sff_port_init(struct ata_port *ap)
{ }
static inline int ata_sff_init(void)
{ return 0; }
static inline void ata_sff_exit(void)
{ }
#endif /* CONFIG_ATA_SFF */ #endif /* CONFIG_ATA_SFF */
#endif /* __LIBATA_H__ */ #endif /* __LIBATA_H__ */
...@@ -101,7 +101,7 @@ static unsigned long pacpi_discover_modes(struct ata_port *ap, struct ata_device ...@@ -101,7 +101,7 @@ static unsigned long pacpi_discover_modes(struct ata_port *ap, struct ata_device
static unsigned long pacpi_mode_filter(struct ata_device *adev, unsigned long mask) static unsigned long pacpi_mode_filter(struct ata_device *adev, unsigned long mask)
{ {
struct pata_acpi *acpi = adev->link->ap->private_data; struct pata_acpi *acpi = adev->link->ap->private_data;
return ata_bmdma_mode_filter(adev, mask & acpi->mask[adev->devno]); return mask & acpi->mask[adev->devno];
} }
/** /**
...@@ -172,7 +172,7 @@ static unsigned int pacpi_qc_issue(struct ata_queued_cmd *qc) ...@@ -172,7 +172,7 @@ static unsigned int pacpi_qc_issue(struct ata_queued_cmd *qc)
struct pata_acpi *acpi = ap->private_data; struct pata_acpi *acpi = ap->private_data;
if (acpi->gtm.flags & 0x10) if (acpi->gtm.flags & 0x10)
return ata_sff_qc_issue(qc); return ata_bmdma_qc_issue(qc);
if (adev != acpi->last) { if (adev != acpi->last) {
pacpi_set_piomode(ap, adev); pacpi_set_piomode(ap, adev);
...@@ -180,7 +180,7 @@ static unsigned int pacpi_qc_issue(struct ata_queued_cmd *qc) ...@@ -180,7 +180,7 @@ static unsigned int pacpi_qc_issue(struct ata_queued_cmd *qc)
pacpi_set_dmamode(ap, adev); pacpi_set_dmamode(ap, adev);
acpi->last = adev; acpi->last = adev;
} }
return ata_sff_qc_issue(qc); return ata_bmdma_qc_issue(qc);
} }
/** /**
...@@ -205,7 +205,7 @@ static int pacpi_port_start(struct ata_port *ap) ...@@ -205,7 +205,7 @@ static int pacpi_port_start(struct ata_port *ap)
return -ENOMEM; return -ENOMEM;
acpi->mask[0] = pacpi_discover_modes(ap, &ap->link.device[0]); acpi->mask[0] = pacpi_discover_modes(ap, &ap->link.device[0]);
acpi->mask[1] = pacpi_discover_modes(ap, &ap->link.device[1]); acpi->mask[1] = pacpi_discover_modes(ap, &ap->link.device[1]);
ret = ata_sff_port_start(ap); ret = ata_bmdma_port_start(ap);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -124,7 +124,7 @@ static unsigned long ali_20_filter(struct ata_device *adev, unsigned long mask) ...@@ -124,7 +124,7 @@ static unsigned long ali_20_filter(struct ata_device *adev, unsigned long mask)
ata_id_c_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num)); ata_id_c_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num));
if (strstr(model_num, "WDC")) if (strstr(model_num, "WDC"))
return mask &= ~ATA_MASK_UDMA; return mask &= ~ATA_MASK_UDMA;
return ata_bmdma_mode_filter(adev, mask); return mask;
} }
/** /**
......
...@@ -202,7 +202,6 @@ static struct ata_port_operations pata_at91_port_ops = { ...@@ -202,7 +202,6 @@ static struct ata_port_operations pata_at91_port_ops = {
.sff_data_xfer = pata_at91_data_xfer_noirq, .sff_data_xfer = pata_at91_data_xfer_noirq,
.set_piomode = pata_at91_set_piomode, .set_piomode = pata_at91_set_piomode,
.cable_detect = ata_cable_40wire, .cable_detect = ata_cable_40wire,
.port_start = ATA_OP_NULL,
}; };
static int __devinit pata_at91_probe(struct platform_device *pdev) static int __devinit pata_at91_probe(struct platform_device *pdev)
......
...@@ -217,7 +217,7 @@ static struct scsi_host_template atiixp_sht = { ...@@ -217,7 +217,7 @@ static struct scsi_host_template atiixp_sht = {
static struct ata_port_operations atiixp_port_ops = { static struct ata_port_operations atiixp_port_ops = {
.inherits = &ata_bmdma_port_ops, .inherits = &ata_bmdma_port_ops,
.qc_prep = ata_sff_dumb_qc_prep, .qc_prep = ata_bmdma_dumb_qc_prep,
.bmdma_start = atiixp_bmdma_start, .bmdma_start = atiixp_bmdma_start,
.bmdma_stop = atiixp_bmdma_stop, .bmdma_stop = atiixp_bmdma_stop,
......
...@@ -820,6 +820,18 @@ static void bfin_dev_select(struct ata_port *ap, unsigned int device) ...@@ -820,6 +820,18 @@ static void bfin_dev_select(struct ata_port *ap, unsigned int device)
ata_sff_pause(ap); ata_sff_pause(ap);
} }
/**
* bfin_set_devctl - Write device control reg
* @ap: port where the device is
* @ctl: value to write
*/
static u8 bfin_set_devctl(struct ata_port *ap, u8 ctl)
{
void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
write_atapi_register(base, ATA_REG_CTRL, ctl);
}
/** /**
* bfin_bmdma_setup - Set up IDE DMA transaction * bfin_bmdma_setup - Set up IDE DMA transaction
* @qc: Info associated with this ATA transaction. * @qc: Info associated with this ATA transaction.
...@@ -1215,56 +1227,6 @@ static void bfin_irq_clear(struct ata_port *ap) ...@@ -1215,56 +1227,6 @@ static void bfin_irq_clear(struct ata_port *ap)
| MULTI_TERM_INT | UDMAIN_TERM_INT | UDMAOUT_TERM_INT); | MULTI_TERM_INT | UDMAIN_TERM_INT | UDMAOUT_TERM_INT);
} }
/**
* bfin_irq_on - Enable interrupts on a port.
* @ap: Port on which interrupts are enabled.
*
* Note: Original code is ata_sff_irq_on().
*/
static unsigned char bfin_irq_on(struct ata_port *ap)
{
void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
u8 tmp;
dev_dbg(ap->dev, "in atapi irq on\n");
ap->ctl &= ~ATA_NIEN;
ap->last_ctl = ap->ctl;
write_atapi_register(base, ATA_REG_CTRL, ap->ctl);
tmp = ata_wait_idle(ap);
bfin_irq_clear(ap);
return tmp;
}
/**
* bfin_freeze - Freeze DMA controller port
* @ap: port to freeze
*
* Note: Original code is ata_sff_freeze().
*/
static void bfin_freeze(struct ata_port *ap)
{
void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
dev_dbg(ap->dev, "in atapi dma freeze\n");
ap->ctl |= ATA_NIEN;
ap->last_ctl = ap->ctl;
write_atapi_register(base, ATA_REG_CTRL, ap->ctl);
/* Under certain circumstances, some controllers raise IRQ on
* ATA_NIEN manipulation. Also, many controllers fail to mask
* previously pending IRQ on ATA_NIEN assertion. Clear it.
*/
ap->ops->sff_check_status(ap);
bfin_irq_clear(ap);
}
/** /**
* bfin_thaw - Thaw DMA controller port * bfin_thaw - Thaw DMA controller port
* @ap: port to thaw * @ap: port to thaw
...@@ -1276,7 +1238,7 @@ void bfin_thaw(struct ata_port *ap) ...@@ -1276,7 +1238,7 @@ void bfin_thaw(struct ata_port *ap)
{ {
dev_dbg(ap->dev, "in atapi dma thaw\n"); dev_dbg(ap->dev, "in atapi dma thaw\n");
bfin_check_status(ap); bfin_check_status(ap);
bfin_irq_on(ap); ata_sff_irq_on(ap);
} }
/** /**
...@@ -1293,7 +1255,7 @@ static void bfin_postreset(struct ata_link *link, unsigned int *classes) ...@@ -1293,7 +1255,7 @@ static void bfin_postreset(struct ata_link *link, unsigned int *classes)
void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
/* re-enable interrupts */ /* re-enable interrupts */
bfin_irq_on(ap); ata_sff_irq_on(ap);
/* is double-select really necessary? */ /* is double-select really necessary? */
if (classes[0] != ATA_DEV_NONE) if (classes[0] != ATA_DEV_NONE)
...@@ -1438,18 +1400,12 @@ static irqreturn_t bfin_ata_interrupt(int irq, void *dev_instance) ...@@ -1438,18 +1400,12 @@ static irqreturn_t bfin_ata_interrupt(int irq, void *dev_instance)
spin_lock_irqsave(&host->lock, flags); spin_lock_irqsave(&host->lock, flags);
for (i = 0; i < host->n_ports; i++) { for (i = 0; i < host->n_ports; i++) {
struct ata_port *ap; struct ata_port *ap = host->ports[i];
struct ata_queued_cmd *qc;
ap = host->ports[i]; qc = ata_qc_from_tag(ap, ap->link.active_tag);
if (ap && if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)))
!(ap->flags & ATA_FLAG_DISABLED)) { handled |= bfin_ata_host_intr(ap, qc);
struct ata_queued_cmd *qc;
qc = ata_qc_from_tag(ap, ap->link.active_tag);
if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) &&
(qc->flags & ATA_QCFLAG_ACTIVE))
handled |= bfin_ata_host_intr(ap, qc);
}
} }
spin_unlock_irqrestore(&host->lock, flags); spin_unlock_irqrestore(&host->lock, flags);
...@@ -1465,7 +1421,7 @@ static struct scsi_host_template bfin_sht = { ...@@ -1465,7 +1421,7 @@ static struct scsi_host_template bfin_sht = {
}; };
static struct ata_port_operations bfin_pata_ops = { static struct ata_port_operations bfin_pata_ops = {
.inherits = &ata_sff_port_ops, .inherits = &ata_bmdma_port_ops,
.set_piomode = bfin_set_piomode, .set_piomode = bfin_set_piomode,
.set_dmamode = bfin_set_dmamode, .set_dmamode = bfin_set_dmamode,
...@@ -1476,6 +1432,7 @@ static struct ata_port_operations bfin_pata_ops = { ...@@ -1476,6 +1432,7 @@ static struct ata_port_operations bfin_pata_ops = {
.sff_check_status = bfin_check_status, .sff_check_status = bfin_check_status,
.sff_check_altstatus = bfin_check_altstatus, .sff_check_altstatus = bfin_check_altstatus,
.sff_dev_select = bfin_dev_select, .sff_dev_select = bfin_dev_select,
.sff_set_devctl = bfin_set_devctl,
.bmdma_setup = bfin_bmdma_setup, .bmdma_setup = bfin_bmdma_setup,
.bmdma_start = bfin_bmdma_start, .bmdma_start = bfin_bmdma_start,
...@@ -1485,13 +1442,11 @@ static struct ata_port_operations bfin_pata_ops = { ...@@ -1485,13 +1442,11 @@ static struct ata_port_operations bfin_pata_ops = {
.qc_prep = ata_noop_qc_prep, .qc_prep = ata_noop_qc_prep,
.freeze = bfin_freeze,
.thaw = bfin_thaw, .thaw = bfin_thaw,
.softreset = bfin_softreset, .softreset = bfin_softreset,
.postreset = bfin_postreset, .postreset = bfin_postreset,
.sff_irq_clear = bfin_irq_clear, .sff_irq_clear = bfin_irq_clear,
.sff_irq_on = bfin_irq_on,
.port_start = bfin_port_start, .port_start = bfin_port_start,
.port_stop = bfin_port_stop, .port_stop = bfin_port_stop,
......
...@@ -153,24 +153,20 @@ static int cmd640_port_start(struct ata_port *ap) ...@@ -153,24 +153,20 @@ static int cmd640_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);
struct cmd640_reg *timing; struct cmd640_reg *timing;
int ret = ata_sff_port_start(ap);
if (ret < 0)
return ret;
timing = devm_kzalloc(&pdev->dev, sizeof(struct cmd640_reg), GFP_KERNEL); timing = devm_kzalloc(&pdev->dev, sizeof(struct cmd640_reg), GFP_KERNEL);
if (timing == NULL) if (timing == NULL)
return -ENOMEM; return -ENOMEM;
timing->last = -1; /* Force a load */ timing->last = -1; /* Force a load */
ap->private_data = timing; ap->private_data = timing;
return ret; return 0;
} }
static struct scsi_host_template cmd640_sht = { static struct scsi_host_template cmd640_sht = {
ATA_BMDMA_SHT(DRV_NAME), ATA_PIO_SHT(DRV_NAME),
}; };
static struct ata_port_operations cmd640_port_ops = { static struct ata_port_operations cmd640_port_ops = {
.inherits = &ata_bmdma_port_ops, .inherits = &ata_sff_port_ops,
/* In theory xfer_noirq is not needed once we kill the prefetcher */ /* In theory xfer_noirq is not needed once we kill the prefetcher */
.sff_data_xfer = ata_sff_data_xfer_noirq, .sff_data_xfer = ata_sff_data_xfer_noirq,
.qc_issue = cmd640_qc_issue, .qc_issue = cmd640_qc_issue,
...@@ -181,13 +177,10 @@ static struct ata_port_operations cmd640_port_ops = { ...@@ -181,13 +177,10 @@ static struct ata_port_operations cmd640_port_ops = {
static void cmd640_hardware_init(struct pci_dev *pdev) static void cmd640_hardware_init(struct pci_dev *pdev)
{ {
u8 r;
u8 ctrl; u8 ctrl;
/* CMD640 detected, commiserations */ /* CMD640 detected, commiserations */
pci_write_config_byte(pdev, 0x5B, 0x00); pci_write_config_byte(pdev, 0x5B, 0x00);
/* Get version info */
pci_read_config_byte(pdev, CFR, &r);
/* PIO0 command cycles */ /* PIO0 command cycles */
pci_write_config_byte(pdev, CMDTIM, 0); pci_write_config_byte(pdev, CMDTIM, 0);
/* 512 byte bursts (sector) */ /* 512 byte bursts (sector) */
......
...@@ -110,7 +110,7 @@ static struct scsi_host_template cs5520_sht = { ...@@ -110,7 +110,7 @@ static struct scsi_host_template cs5520_sht = {
static struct ata_port_operations cs5520_port_ops = { static struct ata_port_operations cs5520_port_ops = {
.inherits = &ata_bmdma_port_ops, .inherits = &ata_bmdma_port_ops,
.qc_prep = ata_sff_dumb_qc_prep, .qc_prep = ata_bmdma_dumb_qc_prep,
.cable_detect = ata_cable_40wire, .cable_detect = ata_cable_40wire,
.set_piomode = cs5520_set_piomode, .set_piomode = cs5520_set_piomode,
}; };
......
...@@ -156,7 +156,7 @@ static unsigned int cs5530_qc_issue(struct ata_queued_cmd *qc) ...@@ -156,7 +156,7 @@ static unsigned int cs5530_qc_issue(struct ata_queued_cmd *qc)
cs5530_set_dmamode(ap, adev); cs5530_set_dmamode(ap, adev);
} }
return ata_sff_qc_issue(qc); return ata_bmdma_qc_issue(qc);
} }
static struct scsi_host_template cs5530_sht = { static struct scsi_host_template cs5530_sht = {
...@@ -167,7 +167,7 @@ static struct scsi_host_template cs5530_sht = { ...@@ -167,7 +167,7 @@ static struct scsi_host_template cs5530_sht = {
static struct ata_port_operations cs5530_port_ops = { static struct ata_port_operations cs5530_port_ops = {
.inherits = &ata_bmdma_port_ops, .inherits = &ata_bmdma_port_ops,
.qc_prep = ata_sff_dumb_qc_prep, .qc_prep = ata_bmdma_dumb_qc_prep,
.qc_issue = cs5530_qc_issue, .qc_issue = cs5530_qc_issue,
.cable_detect = ata_cable_40wire, .cable_detect = ata_cable_40wire,
......
...@@ -182,7 +182,7 @@ static unsigned long hpt366_filter(struct ata_device *adev, unsigned long mask) ...@@ -182,7 +182,7 @@ static unsigned long hpt366_filter(struct ata_device *adev, unsigned long mask)
} else if (adev->class == ATA_DEV_ATAPI) } else if (adev->class == ATA_DEV_ATAPI)
mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
return ata_bmdma_mode_filter(adev, mask); return mask;
} }
static int hpt36x_cable_detect(struct ata_port *ap) static int hpt36x_cable_detect(struct ata_port *ap)
......
...@@ -282,7 +282,7 @@ static unsigned long hpt370_filter(struct ata_device *adev, unsigned long mask) ...@@ -282,7 +282,7 @@ static unsigned long hpt370_filter(struct ata_device *adev, unsigned long mask)
if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5)) if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5))
mask &= ~(0xE0 << ATA_SHIFT_UDMA); mask &= ~(0xE0 << ATA_SHIFT_UDMA);
} }
return ata_bmdma_mode_filter(adev, mask); return mask;
} }
/** /**
...@@ -298,7 +298,7 @@ static unsigned long hpt370a_filter(struct ata_device *adev, unsigned long mask) ...@@ -298,7 +298,7 @@ static unsigned long hpt370a_filter(struct ata_device *adev, unsigned long mask)
if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5)) if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5))
mask &= ~(0xE0 << ATA_SHIFT_UDMA); mask &= ~(0xE0 << ATA_SHIFT_UDMA);
} }
return ata_bmdma_mode_filter(adev, mask); return mask;
} }
/** /**
......
...@@ -320,7 +320,7 @@ static unsigned int hpt3x2n_qc_issue(struct ata_queued_cmd *qc) ...@@ -320,7 +320,7 @@ static unsigned int hpt3x2n_qc_issue(struct ata_queued_cmd *qc)
hpt3x2n_set_clock(ap, dpll ? 0x21 : 0x23); hpt3x2n_set_clock(ap, dpll ? 0x21 : 0x23);
} }
return ata_sff_qc_issue(qc); return ata_bmdma_qc_issue(qc);
} }
static struct scsi_host_template hpt3x2n_sht = { static struct scsi_host_template hpt3x2n_sht = {
......
...@@ -321,7 +321,7 @@ static void pata_icside_postreset(struct ata_link *link, unsigned int *classes) ...@@ -321,7 +321,7 @@ static void pata_icside_postreset(struct ata_link *link, unsigned int *classes)
} }
static struct ata_port_operations pata_icside_port_ops = { static struct ata_port_operations pata_icside_port_ops = {
.inherits = &ata_sff_port_ops, .inherits = &ata_bmdma_port_ops,
/* no need to build any PRD tables for DMA */ /* no need to build any PRD tables for DMA */
.qc_prep = ata_noop_qc_prep, .qc_prep = ata_noop_qc_prep,
.sff_data_xfer = ata_sff_data_xfer_noirq, .sff_data_xfer = ata_sff_data_xfer_noirq,
...@@ -333,7 +333,8 @@ static struct ata_port_operations pata_icside_port_ops = { ...@@ -333,7 +333,8 @@ static struct ata_port_operations pata_icside_port_ops = {
.cable_detect = ata_cable_40wire, .cable_detect = ata_cable_40wire,
.set_dmamode = pata_icside_set_dmamode, .set_dmamode = pata_icside_set_dmamode,
.postreset = pata_icside_postreset, .postreset = pata_icside_postreset,
.post_internal_cmd = pata_icside_bmdma_stop,
.port_start = ATA_OP_NULL, /* don't need PRD table */
}; };
static void __devinit static void __devinit
......
...@@ -430,7 +430,7 @@ static unsigned int it821x_smart_qc_issue(struct ata_queued_cmd *qc) ...@@ -430,7 +430,7 @@ static unsigned int it821x_smart_qc_issue(struct ata_queued_cmd *qc)
case 0xFC: /* Internal 'report rebuild state' */ case 0xFC: /* Internal 'report rebuild state' */
/* Arguably should just no-op this one */ /* Arguably should just no-op this one */
case ATA_CMD_SET_FEATURES: case ATA_CMD_SET_FEATURES:
return ata_sff_qc_issue(qc); return ata_bmdma_qc_issue(qc);
} }
printk(KERN_DEBUG "it821x: can't process command 0x%02X\n", qc->tf.command); printk(KERN_DEBUG "it821x: can't process command 0x%02X\n", qc->tf.command);
return AC_ERR_DEV; return AC_ERR_DEV;
...@@ -448,7 +448,7 @@ static unsigned int it821x_smart_qc_issue(struct ata_queued_cmd *qc) ...@@ -448,7 +448,7 @@ static unsigned int it821x_smart_qc_issue(struct ata_queued_cmd *qc)
static unsigned int it821x_passthru_qc_issue(struct ata_queued_cmd *qc) static unsigned int it821x_passthru_qc_issue(struct ata_queued_cmd *qc)
{ {
it821x_passthru_dev_select(qc->ap, qc->dev->devno); it821x_passthru_dev_select(qc->ap, qc->dev->devno);
return ata_sff_qc_issue(qc); return ata_bmdma_qc_issue(qc);
} }
/** /**
...@@ -739,7 +739,7 @@ static int it821x_port_start(struct ata_port *ap) ...@@ -739,7 +739,7 @@ static int it821x_port_start(struct ata_port *ap)
struct it821x_dev *itdev; struct it821x_dev *itdev;
u8 conf; u8 conf;
int ret = ata_sff_port_start(ap); int ret = ata_bmdma_port_start(ap);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -720,6 +720,8 @@ static int pata_macio_port_start(struct ata_port *ap) ...@@ -720,6 +720,8 @@ static int pata_macio_port_start(struct ata_port *ap)
if (priv->dma_table_cpu == NULL) { if (priv->dma_table_cpu == NULL) {
dev_err(priv->dev, "Unable to allocate DMA command list\n"); dev_err(priv->dev, "Unable to allocate DMA command list\n");
ap->ioaddr.bmdma_addr = NULL; ap->ioaddr.bmdma_addr = NULL;
ap->mwdma_mask = 0;
ap->udma_mask = 0;
} }
return 0; return 0;
} }
...@@ -917,7 +919,7 @@ static struct scsi_host_template pata_macio_sht = { ...@@ -917,7 +919,7 @@ static struct scsi_host_template pata_macio_sht = {
}; };
static struct ata_port_operations pata_macio_ops = { static struct ata_port_operations pata_macio_ops = {
.inherits = &ata_sff_port_ops, .inherits = &ata_bmdma_port_ops,
.freeze = pata_macio_freeze, .freeze = pata_macio_freeze,
.set_piomode = pata_macio_set_timings, .set_piomode = pata_macio_set_timings,
...@@ -925,7 +927,6 @@ static struct ata_port_operations pata_macio_ops = { ...@@ -925,7 +927,6 @@ static struct ata_port_operations pata_macio_ops = {
.cable_detect = pata_macio_cable_detect, .cable_detect = pata_macio_cable_detect,
.sff_dev_select = pata_macio_dev_select, .sff_dev_select = pata_macio_dev_select,
.qc_prep = pata_macio_qc_prep, .qc_prep = pata_macio_qc_prep,
.mode_filter = ata_bmdma_mode_filter,
.bmdma_setup = pata_macio_bmdma_setup, .bmdma_setup = pata_macio_bmdma_setup,
.bmdma_start = pata_macio_bmdma_start, .bmdma_start = pata_macio_bmdma_start,
.bmdma_stop = pata_macio_bmdma_stop, .bmdma_stop = pata_macio_bmdma_stop,
......
...@@ -64,13 +64,13 @@ struct mpc52xx_ata_priv { ...@@ -64,13 +64,13 @@ struct mpc52xx_ata_priv {
/* ATAPI-4 PIO specs (in ns) */ /* ATAPI-4 PIO specs (in ns) */
static const int ataspec_t0[5] = {600, 383, 240, 180, 120}; static const u16 ataspec_t0[5] = {600, 383, 240, 180, 120};
static const int ataspec_t1[5] = { 70, 50, 30, 30, 25}; static const u16 ataspec_t1[5] = { 70, 50, 30, 30, 25};
static const int ataspec_t2_8[5] = {290, 290, 290, 80, 70}; static const u16 ataspec_t2_8[5] = {290, 290, 290, 80, 70};
static const int ataspec_t2_16[5] = {165, 125, 100, 80, 70}; static const u16 ataspec_t2_16[5] = {165, 125, 100, 80, 70};
static const int ataspec_t2i[5] = { 0, 0, 0, 70, 25}; static const u16 ataspec_t2i[5] = { 0, 0, 0, 70, 25};
static const int ataspec_t4[5] = { 30, 20, 15, 10, 10}; static const u16 ataspec_t4[5] = { 30, 20, 15, 10, 10};
static const int ataspec_ta[5] = { 35, 35, 35, 35, 35}; static const u16 ataspec_ta[5] = { 35, 35, 35, 35, 35};
#define CALC_CLKCYC(c,v) ((((v)+(c)-1)/(c))) #define CALC_CLKCYC(c,v) ((((v)+(c)-1)/(c)))
...@@ -78,13 +78,13 @@ static const int ataspec_ta[5] = { 35, 35, 35, 35, 35}; ...@@ -78,13 +78,13 @@ static const int ataspec_ta[5] = { 35, 35, 35, 35, 35};
/* ATAPI-4 MDMA specs (in clocks) */ /* ATAPI-4 MDMA specs (in clocks) */
struct mdmaspec { struct mdmaspec {
u32 t0M; u8 t0M;
u32 td; u8 td;
u32 th; u8 th;
u32 tj; u8 tj;
u32 tkw; u8 tkw;
u32 tm; u8 tm;
u32 tn; u8 tn;
}; };
static const struct mdmaspec mdmaspec66[3] = { static const struct mdmaspec mdmaspec66[3] = {
...@@ -101,23 +101,23 @@ static const struct mdmaspec mdmaspec132[3] = { ...@@ -101,23 +101,23 @@ static const struct mdmaspec mdmaspec132[3] = {
/* ATAPI-4 UDMA specs (in clocks) */ /* ATAPI-4 UDMA specs (in clocks) */
struct udmaspec { struct udmaspec {
u32 tcyc; u8 tcyc;
u32 t2cyc; u8 t2cyc;
u32 tds; u8 tds;
u32 tdh; u8 tdh;
u32 tdvs; u8 tdvs;
u32 tdvh; u8 tdvh;
u32 tfs; u8 tfs;
u32 tli; u8 tli;
u32 tmli; u8 tmli;
u32 taz; u8 taz;
u32 tzah; u8 tzah;
u32 tenv; u8 tenv;
u32 tsr; u8 tsr;
u32 trfs; u8 trfs;
u32 trp; u8 trp;
u32 tack; u8 tack;
u32 tss; u8 tss;
}; };
static const struct udmaspec udmaspec66[6] = { static const struct udmaspec udmaspec66[6] = {
...@@ -270,7 +270,7 @@ mpc52xx_ata_compute_pio_timings(struct mpc52xx_ata_priv *priv, int dev, int pio) ...@@ -270,7 +270,7 @@ mpc52xx_ata_compute_pio_timings(struct mpc52xx_ata_priv *priv, int dev, int pio)
{ {
struct mpc52xx_ata_timings *timing = &priv->timings[dev]; struct mpc52xx_ata_timings *timing = &priv->timings[dev];
unsigned int ipb_period = priv->ipb_period; unsigned int ipb_period = priv->ipb_period;
unsigned int t0, t1, t2_8, t2_16, t2i, t4, ta; u32 t0, t1, t2_8, t2_16, t2i, t4, ta;
if ((pio < 0) || (pio > 4)) if ((pio < 0) || (pio > 4))
return -EINVAL; return -EINVAL;
...@@ -299,8 +299,8 @@ mpc52xx_ata_compute_mdma_timings(struct mpc52xx_ata_priv *priv, int dev, ...@@ -299,8 +299,8 @@ mpc52xx_ata_compute_mdma_timings(struct mpc52xx_ata_priv *priv, int dev,
if (speed < 0 || speed > 2) if (speed < 0 || speed > 2)
return -EINVAL; return -EINVAL;
t->mdma1 = (s->t0M << 24) | (s->td << 16) | (s->tkw << 8) | (s->tm); t->mdma1 = ((u32)s->t0M << 24) | ((u32)s->td << 16) | ((u32)s->tkw << 8) | s->tm;
t->mdma2 = (s->th << 24) | (s->tj << 16) | (s->tn << 8); t->mdma2 = ((u32)s->th << 24) | ((u32)s->tj << 16) | ((u32)s->tn << 8);
t->using_udma = 0; t->using_udma = 0;
return 0; return 0;
...@@ -316,11 +316,11 @@ mpc52xx_ata_compute_udma_timings(struct mpc52xx_ata_priv *priv, int dev, ...@@ -316,11 +316,11 @@ mpc52xx_ata_compute_udma_timings(struct mpc52xx_ata_priv *priv, int dev,
if (speed < 0 || speed > 2) if (speed < 0 || speed > 2)
return -EINVAL; return -EINVAL;
t->udma1 = (s->t2cyc << 24) | (s->tcyc << 16) | (s->tds << 8) | s->tdh; t->udma1 = ((u32)s->t2cyc << 24) | ((u32)s->tcyc << 16) | ((u32)s->tds << 8) | s->tdh;
t->udma2 = (s->tdvs << 24) | (s->tdvh << 16) | (s->tfs << 8) | s->tli; t->udma2 = ((u32)s->tdvs << 24) | ((u32)s->tdvh << 16) | ((u32)s->tfs << 8) | s->tli;
t->udma3 = (s->tmli << 24) | (s->taz << 16) | (s->tenv << 8) | s->tsr; t->udma3 = ((u32)s->tmli << 24) | ((u32)s->taz << 16) | ((u32)s->tenv << 8) | s->tsr;
t->udma4 = (s->tss << 24) | (s->trfs << 16) | (s->trp << 8) | s->tack; t->udma4 = ((u32)s->tss << 24) | ((u32)s->trfs << 16) | ((u32)s->trp << 8) | s->tack;
t->udma5 = (s->tzah << 24); t->udma5 = (u32)s->tzah << 24;
t->using_udma = 1; t->using_udma = 1;
return 0; return 0;
......
...@@ -126,7 +126,7 @@ static void ns87415_bmdma_setup(struct ata_queued_cmd *qc) ...@@ -126,7 +126,7 @@ static void ns87415_bmdma_setup(struct ata_queued_cmd *qc)
/* load PRD table addr. */ /* load PRD table addr. */
mb(); /* make sure PRD table writes are visible to controller */ mb(); /* make sure PRD table writes are visible to controller */
iowrite32(ap->prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS); iowrite32(ap->bmdma_prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS);
/* specify data direction, triple-check start bit is clear */ /* specify data direction, triple-check start bit is clear */
dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
......
...@@ -489,9 +489,8 @@ static void octeon_cf_exec_command16(struct ata_port *ap, ...@@ -489,9 +489,8 @@ static void octeon_cf_exec_command16(struct ata_port *ap,
ata_wait_idle(ap); ata_wait_idle(ap);
} }
static u8 octeon_cf_irq_on(struct ata_port *ap) static void octeon_cf_irq_on(struct ata_port *ap)
{ {
return 0;
} }
static void octeon_cf_irq_clear(struct ata_port *ap) static void octeon_cf_irq_clear(struct ata_port *ap)
...@@ -655,9 +654,6 @@ static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance) ...@@ -655,9 +654,6 @@ static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance)
ap = host->ports[i]; ap = host->ports[i];
ocd = ap->dev->platform_data; ocd = ap->dev->platform_data;
if (ap->flags & ATA_FLAG_DISABLED)
continue;
ocd = ap->dev->platform_data; ocd = ap->dev->platform_data;
cf_port = ap->private_data; cf_port = ap->private_data;
dma_int.u64 = dma_int.u64 =
...@@ -667,8 +663,7 @@ static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance) ...@@ -667,8 +663,7 @@ static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance)
qc = ata_qc_from_tag(ap, ap->link.active_tag); qc = ata_qc_from_tag(ap, ap->link.active_tag);
if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) && if (qc && !(qc->tf.flags & ATA_TFLAG_POLLING)) {
(qc->flags & ATA_QCFLAG_ACTIVE)) {
if (dma_int.s.done && !dma_cfg.s.en) { if (dma_int.s.done && !dma_cfg.s.en) {
if (!sg_is_last(qc->cursg)) { if (!sg_is_last(qc->cursg)) {
qc->cursg = sg_next(qc->cursg); qc->cursg = sg_next(qc->cursg);
...@@ -738,8 +733,7 @@ static void octeon_cf_delayed_finish(struct work_struct *work) ...@@ -738,8 +733,7 @@ static void octeon_cf_delayed_finish(struct work_struct *work)
goto out; goto out;
} }
qc = ata_qc_from_tag(ap, ap->link.active_tag); qc = ata_qc_from_tag(ap, ap->link.active_tag);
if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) && if (qc && !(qc->tf.flags & ATA_TFLAG_POLLING))
(qc->flags & ATA_QCFLAG_ACTIVE))
octeon_cf_dma_finished(ap, qc); octeon_cf_dma_finished(ap, qc);
out: out:
spin_unlock_irqrestore(&host->lock, flags); spin_unlock_irqrestore(&host->lock, flags);
......
...@@ -200,7 +200,7 @@ static unsigned int oldpiix_qc_issue(struct ata_queued_cmd *qc) ...@@ -200,7 +200,7 @@ static unsigned int oldpiix_qc_issue(struct ata_queued_cmd *qc)
if (ata_dma_enabled(adev)) if (ata_dma_enabled(adev))
oldpiix_set_dmamode(ap, adev); oldpiix_set_dmamode(ap, adev);
} }
return ata_sff_qc_issue(qc); return ata_bmdma_qc_issue(qc);
} }
......
...@@ -165,7 +165,7 @@ static struct ata_port_operations pcmcia_8bit_port_ops = { ...@@ -165,7 +165,7 @@ static struct ata_port_operations pcmcia_8bit_port_ops = {
.sff_data_xfer = ata_data_xfer_8bit, .sff_data_xfer = ata_data_xfer_8bit,
.cable_detect = ata_cable_40wire, .cable_detect = ata_cable_40wire,
.set_mode = pcmcia_set_mode_8bit, .set_mode = pcmcia_set_mode_8bit,
.drain_fifo = pcmcia_8bit_drain_fifo, .sff_drain_fifo = pcmcia_8bit_drain_fifo,
}; };
......
...@@ -265,7 +265,7 @@ static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long ...@@ -265,7 +265,7 @@ static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long
struct ata_device *pair = ata_dev_pair(adev); struct ata_device *pair = ata_dev_pair(adev);
if (adev->class != ATA_DEV_ATA || adev->devno == 0 || pair == NULL) if (adev->class != ATA_DEV_ATA || adev->devno == 0 || pair == NULL)
return ata_bmdma_mode_filter(adev, mask); return mask;
/* Check for slave of a Maxtor at UDMA6 */ /* Check for slave of a Maxtor at UDMA6 */
ata_id_c_string(pair->id, model_num, ATA_ID_PROD, ata_id_c_string(pair->id, model_num, ATA_ID_PROD,
...@@ -274,7 +274,7 @@ static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long ...@@ -274,7 +274,7 @@ static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long
if (strstr(model_num, "Maxtor") == NULL && pair->dma_mode == XFER_UDMA_6) if (strstr(model_num, "Maxtor") == NULL && pair->dma_mode == XFER_UDMA_6)
mask &= ~ (1 << (6 + ATA_SHIFT_UDMA)); mask &= ~ (1 << (6 + ATA_SHIFT_UDMA));
return ata_bmdma_mode_filter(adev, mask); return mask;
} }
/** /**
......
...@@ -249,7 +249,7 @@ static int pdc2026x_port_start(struct ata_port *ap) ...@@ -249,7 +249,7 @@ static int pdc2026x_port_start(struct ata_port *ap)
u8 burst = ioread8(bmdma + 0x1f); u8 burst = ioread8(bmdma + 0x1f);
iowrite8(burst | 0x01, bmdma + 0x1f); iowrite8(burst | 0x01, bmdma + 0x1f);
} }
return ata_sff_port_start(ap); return ata_bmdma_port_start(ap);
} }
/** /**
......
...@@ -53,7 +53,6 @@ static struct ata_port_operations pata_platform_port_ops = { ...@@ -53,7 +53,6 @@ static struct ata_port_operations pata_platform_port_ops = {
.sff_data_xfer = ata_sff_data_xfer_noirq, .sff_data_xfer = ata_sff_data_xfer_noirq,
.cable_detect = ata_cable_unknown, .cable_detect = ata_cable_unknown,
.set_mode = pata_platform_set_mode, .set_mode = pata_platform_set_mode,
.port_start = ATA_OP_NULL,
}; };
static void pata_platform_setup_port(struct ata_ioports *ioaddr, static void pata_platform_setup_port(struct ata_ioports *ioaddr,
......
...@@ -179,7 +179,7 @@ static unsigned int radisys_qc_issue(struct ata_queued_cmd *qc) ...@@ -179,7 +179,7 @@ static unsigned int radisys_qc_issue(struct ata_queued_cmd *qc)
radisys_set_piomode(ap, adev); radisys_set_piomode(ap, adev);
} }
} }
return ata_sff_qc_issue(qc); return ata_bmdma_qc_issue(qc);
} }
......
...@@ -174,7 +174,7 @@ static unsigned int sc1200_qc_issue(struct ata_queued_cmd *qc) ...@@ -174,7 +174,7 @@ static unsigned int sc1200_qc_issue(struct ata_queued_cmd *qc)
sc1200_set_dmamode(ap, adev); sc1200_set_dmamode(ap, adev);
} }
return ata_sff_qc_issue(qc); return ata_bmdma_qc_issue(qc);
} }
/** /**
...@@ -209,7 +209,7 @@ static struct scsi_host_template sc1200_sht = { ...@@ -209,7 +209,7 @@ static struct scsi_host_template sc1200_sht = {
static struct ata_port_operations sc1200_port_ops = { static struct ata_port_operations sc1200_port_ops = {
.inherits = &ata_bmdma_port_ops, .inherits = &ata_bmdma_port_ops,
.qc_prep = ata_sff_dumb_qc_prep, .qc_prep = ata_bmdma_dumb_qc_prep,
.qc_issue = sc1200_qc_issue, .qc_issue = sc1200_qc_issue,
.qc_defer = sc1200_qc_defer, .qc_defer = sc1200_qc_defer,
.cable_detect = ata_cable_40wire, .cable_detect = ata_cable_40wire,
......
...@@ -265,7 +265,7 @@ unsigned long scc_mode_filter(struct ata_device *adev, unsigned long mask) ...@@ -265,7 +265,7 @@ unsigned long scc_mode_filter(struct ata_device *adev, unsigned long mask)
printk(KERN_INFO "%s: limit ATAPI UDMA to UDMA4\n", DRV_NAME); printk(KERN_INFO "%s: limit ATAPI UDMA to UDMA4\n", DRV_NAME);
mask &= ~(0xE0 << ATA_SHIFT_UDMA); mask &= ~(0xE0 << ATA_SHIFT_UDMA);
} }
return ata_bmdma_mode_filter(adev, mask); return mask;
} }
/** /**
...@@ -415,6 +415,17 @@ static void scc_dev_select (struct ata_port *ap, unsigned int device) ...@@ -415,6 +415,17 @@ static void scc_dev_select (struct ata_port *ap, unsigned int device)
ata_sff_pause(ap); ata_sff_pause(ap);
} }
/**
* scc_set_devctl - Write device control reg
* @ap: port where the device is
* @ctl: value to write
*/
static void scc_set_devctl(struct ata_port *ap, u8 ctl)
{
out_be32(ap->ioaddr.ctl_addr, ctl);
}
/** /**
* scc_bmdma_setup - Set up PCI IDE BMDMA transaction * scc_bmdma_setup - Set up PCI IDE BMDMA transaction
* @qc: Info associated with this ATA transaction. * @qc: Info associated with this ATA transaction.
...@@ -430,7 +441,7 @@ static void scc_bmdma_setup (struct ata_queued_cmd *qc) ...@@ -430,7 +441,7 @@ static void scc_bmdma_setup (struct ata_queued_cmd *qc)
void __iomem *mmio = ap->ioaddr.bmdma_addr; void __iomem *mmio = ap->ioaddr.bmdma_addr;
/* load PRD table addr */ /* load PRD table addr */
out_be32(mmio + SCC_DMA_TABLE_OFS, ap->prd_dma); out_be32(mmio + SCC_DMA_TABLE_OFS, ap->bmdma_prd_dma);
/* specify data direction, triple-check start bit is clear */ /* specify data direction, triple-check start bit is clear */
dmactl = in_be32(mmio + SCC_DMA_CMD); dmactl = in_be32(mmio + SCC_DMA_CMD);
...@@ -501,8 +512,8 @@ static unsigned int scc_devchk (struct ata_port *ap, ...@@ -501,8 +512,8 @@ static unsigned int scc_devchk (struct ata_port *ap,
* Note: Original code is ata_sff_wait_after_reset * Note: Original code is ata_sff_wait_after_reset
*/ */
int scc_wait_after_reset(struct ata_link *link, unsigned int devmask, static int scc_wait_after_reset(struct ata_link *link, unsigned int devmask,
unsigned long deadline) unsigned long deadline)
{ {
struct ata_port *ap = link->ap; struct ata_port *ap = link->ap;
struct ata_ioports *ioaddr = &ap->ioaddr; struct ata_ioports *ioaddr = &ap->ioaddr;
...@@ -816,54 +827,6 @@ static unsigned int scc_data_xfer (struct ata_device *dev, unsigned char *buf, ...@@ -816,54 +827,6 @@ static unsigned int scc_data_xfer (struct ata_device *dev, unsigned char *buf,
return words << 1; return words << 1;
} }
/**
* scc_irq_on - Enable interrupts on a port.
* @ap: Port on which interrupts are enabled.
*
* Note: Original code is ata_sff_irq_on().
*/
static u8 scc_irq_on (struct ata_port *ap)
{
struct ata_ioports *ioaddr = &ap->ioaddr;
u8 tmp;
ap->ctl &= ~ATA_NIEN;
ap->last_ctl = ap->ctl;
out_be32(ioaddr->ctl_addr, ap->ctl);
tmp = ata_wait_idle(ap);
ap->ops->sff_irq_clear(ap);
return tmp;
}
/**
* scc_freeze - Freeze BMDMA controller port
* @ap: port to freeze
*
* Note: Original code is ata_sff_freeze().
*/
static void scc_freeze (struct ata_port *ap)
{
struct ata_ioports *ioaddr = &ap->ioaddr;
ap->ctl |= ATA_NIEN;
ap->last_ctl = ap->ctl;
out_be32(ioaddr->ctl_addr, ap->ctl);
/* Under certain circumstances, some controllers raise IRQ on
* ATA_NIEN manipulation. Also, many controllers fail to mask
* previously pending IRQ on ATA_NIEN assertion. Clear it.
*/
ap->ops->sff_check_status(ap);
ap->ops->sff_irq_clear(ap);
}
/** /**
* scc_pata_prereset - prepare for reset * scc_pata_prereset - prepare for reset
* @ap: ATA port to be reset * @ap: ATA port to be reset
...@@ -903,8 +866,7 @@ static void scc_postreset(struct ata_link *link, unsigned int *classes) ...@@ -903,8 +866,7 @@ static void scc_postreset(struct ata_link *link, unsigned int *classes)
} }
/* set up device control */ /* set up device control */
if (ap->ioaddr.ctl_addr) out_be32(ap->ioaddr.ctl_addr, ap->ctl);
out_be32(ap->ioaddr.ctl_addr, ap->ctl);
DPRINTK("EXIT\n"); DPRINTK("EXIT\n");
} }
...@@ -930,7 +892,7 @@ static void scc_irq_clear (struct ata_port *ap) ...@@ -930,7 +892,7 @@ static void scc_irq_clear (struct ata_port *ap)
* scc_port_start - Set port up for dma. * scc_port_start - Set port up for dma.
* @ap: Port to initialize * @ap: Port to initialize
* *
* Allocate space for PRD table using ata_port_start(). * Allocate space for PRD table using ata_bmdma_port_start().
* Set PRD table address for PTERADD. (PRD Transfer End Read) * Set PRD table address for PTERADD. (PRD Transfer End Read)
*/ */
...@@ -939,11 +901,11 @@ static int scc_port_start (struct ata_port *ap) ...@@ -939,11 +901,11 @@ static int scc_port_start (struct ata_port *ap)
void __iomem *mmio = ap->ioaddr.bmdma_addr; void __iomem *mmio = ap->ioaddr.bmdma_addr;
int rc; int rc;
rc = ata_port_start(ap); rc = ata_bmdma_port_start(ap);
if (rc) if (rc)
return rc; return rc;
out_be32(mmio + SCC_DMA_PTERADD, ap->prd_dma); out_be32(mmio + SCC_DMA_PTERADD, ap->bmdma_prd_dma);
return 0; return 0;
} }
...@@ -978,6 +940,7 @@ static struct ata_port_operations scc_pata_ops = { ...@@ -978,6 +940,7 @@ static struct ata_port_operations scc_pata_ops = {
.sff_check_status = scc_check_status, .sff_check_status = scc_check_status,
.sff_check_altstatus = scc_check_altstatus, .sff_check_altstatus = scc_check_altstatus,
.sff_dev_select = scc_dev_select, .sff_dev_select = scc_dev_select,
.sff_set_devctl = scc_set_devctl,
.bmdma_setup = scc_bmdma_setup, .bmdma_setup = scc_bmdma_setup,
.bmdma_start = scc_bmdma_start, .bmdma_start = scc_bmdma_start,
...@@ -985,14 +948,11 @@ static struct ata_port_operations scc_pata_ops = { ...@@ -985,14 +948,11 @@ static struct ata_port_operations scc_pata_ops = {
.bmdma_status = scc_bmdma_status, .bmdma_status = scc_bmdma_status,
.sff_data_xfer = scc_data_xfer, .sff_data_xfer = scc_data_xfer,
.freeze = scc_freeze,
.prereset = scc_pata_prereset, .prereset = scc_pata_prereset,
.softreset = scc_softreset, .softreset = scc_softreset,
.postreset = scc_postreset, .postreset = scc_postreset,
.post_internal_cmd = scc_bmdma_stop,
.sff_irq_clear = scc_irq_clear, .sff_irq_clear = scc_irq_clear,
.sff_irq_on = scc_irq_on,
.port_start = scc_port_start, .port_start = scc_port_start,
.port_stop = scc_port_stop, .port_stop = scc_port_stop,
......
...@@ -174,22 +174,12 @@ static int __devinit sch_init_one(struct pci_dev *pdev, ...@@ -174,22 +174,12 @@ static int __devinit sch_init_one(struct pci_dev *pdev,
{ {
static int printed_version; static int printed_version;
const struct ata_port_info *ppi[] = { &sch_port_info, NULL }; const struct ata_port_info *ppi[] = { &sch_port_info, NULL };
struct ata_host *host;
int rc;
if (!printed_version++) if (!printed_version++)
dev_printk(KERN_DEBUG, &pdev->dev, dev_printk(KERN_DEBUG, &pdev->dev,
"version " DRV_VERSION "\n"); "version " DRV_VERSION "\n");
/* enable device and prepare host */ return ata_pci_sff_init_one(pdev, ppi, &sch_sht, NULL, 0);
rc = pcim_enable_device(pdev);
if (rc)
return rc;
rc = ata_pci_sff_prepare_host(pdev, ppi, &host);
if (rc)
return rc;
pci_set_master(pdev);
return ata_pci_sff_activate_host(host, ata_sff_interrupt, &sch_sht);
} }
static int __init sch_init(void) static int __init sch_init(void)
......
...@@ -198,7 +198,7 @@ static unsigned long serverworks_osb4_filter(struct ata_device *adev, unsigned l ...@@ -198,7 +198,7 @@ static unsigned long serverworks_osb4_filter(struct ata_device *adev, unsigned l
{ {
if (adev->class == ATA_DEV_ATA) if (adev->class == ATA_DEV_ATA)
mask &= ~ATA_MASK_UDMA; mask &= ~ATA_MASK_UDMA;
return ata_bmdma_mode_filter(adev, mask); return mask;
} }
...@@ -218,7 +218,7 @@ static unsigned long serverworks_csb_filter(struct ata_device *adev, unsigned lo ...@@ -218,7 +218,7 @@ static unsigned long serverworks_csb_filter(struct ata_device *adev, unsigned lo
/* Disk, UDMA */ /* Disk, UDMA */
if (adev->class != ATA_DEV_ATA) if (adev->class != ATA_DEV_ATA)
return ata_bmdma_mode_filter(adev, mask); return mask;
/* Actually do need to check */ /* Actually do need to check */
ata_id_c_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num)); ata_id_c_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num));
...@@ -227,7 +227,7 @@ static unsigned long serverworks_csb_filter(struct ata_device *adev, unsigned lo ...@@ -227,7 +227,7 @@ static unsigned long serverworks_csb_filter(struct ata_device *adev, unsigned lo
if (!strcmp(p, model_num)) if (!strcmp(p, model_num))
mask &= ~(0xE0 << ATA_SHIFT_UDMA); mask &= ~(0xE0 << ATA_SHIFT_UDMA);
} }
return ata_bmdma_mode_filter(adev, mask); return mask;
} }
/** /**
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -1160,13 +1160,8 @@ static irqreturn_t sil24_interrupt(int irq, void *dev_instance) ...@@ -1160,13 +1160,8 @@ static irqreturn_t sil24_interrupt(int irq, void *dev_instance)
for (i = 0; i < host->n_ports; i++) for (i = 0; i < host->n_ports; i++)
if (status & (1 << i)) { if (status & (1 << i)) {
struct ata_port *ap = host->ports[i]; sil24_host_intr(host->ports[i]);
if (ap && !(ap->flags & ATA_FLAG_DISABLED)) { handled++;
sil24_host_intr(ap);
handled++;
} else
printk(KERN_ERR DRV_NAME
": interrupt from disabled port %d\n", i);
} }
spin_unlock(&host->lock); spin_unlock(&host->lock);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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