Commit c135b659 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:
  Fix bug - Implement bfin ata interrupt handler to avoid "irq 68 nobody cared" (v2)
  sata_mv: Improve naming of main_irq cause/mask identifiers
  libata-scsi: improve rbuf handling for simulated commands
  libata-scsi: clean up inquiry / mode sense related functions
  [MIPS] ATA: Rename routerboard 500 to 532
parents 5f78e4d3 65c0d4e5
...@@ -566,11 +566,11 @@ config PATA_RADISYS ...@@ -566,11 +566,11 @@ config PATA_RADISYS
If unsure, say N. If unsure, say N.
config PATA_RB500 config PATA_RB532
tristate "RouterBoard 500 PATA CompactFlash support" tristate "RouterBoard 532 PATA CompactFlash support"
depends on MIKROTIK_RB500 depends on MIKROTIK_RB532
help help
This option enables support for the RouterBoard 500 This option enables support for the RouterBoard 532
PATA CompactFlash controller. PATA CompactFlash controller.
If unsure, say N. If unsure, say N.
......
...@@ -55,7 +55,7 @@ obj-$(CONFIG_PATA_PDC2027X) += pata_pdc2027x.o ...@@ -55,7 +55,7 @@ obj-$(CONFIG_PATA_PDC2027X) += pata_pdc2027x.o
obj-$(CONFIG_PATA_PDC_OLD) += pata_pdc202xx_old.o obj-$(CONFIG_PATA_PDC_OLD) += pata_pdc202xx_old.o
obj-$(CONFIG_PATA_QDI) += pata_qdi.o obj-$(CONFIG_PATA_QDI) += pata_qdi.o
obj-$(CONFIG_PATA_RADISYS) += pata_radisys.o obj-$(CONFIG_PATA_RADISYS) += pata_radisys.o
obj-$(CONFIG_PATA_RB500) += pata_rb500_cf.o obj-$(CONFIG_PATA_RB532) += pata_rb532_cf.o
obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o
obj-$(CONFIG_PATA_SC1200) += pata_sc1200.o obj-$(CONFIG_PATA_SC1200) += pata_sc1200.o
obj-$(CONFIG_PATA_SERVERWORKS) += pata_serverworks.o obj-$(CONFIG_PATA_SERVERWORKS) += pata_serverworks.o
......
This diff is collapsed.
...@@ -146,34 +146,6 @@ extern void ata_scsi_scan_host(struct ata_port *ap, int sync); ...@@ -146,34 +146,6 @@ extern void ata_scsi_scan_host(struct ata_port *ap, int sync);
extern int ata_scsi_offline_dev(struct ata_device *dev); extern int ata_scsi_offline_dev(struct ata_device *dev);
extern void ata_scsi_media_change_notify(struct ata_device *dev); extern void ata_scsi_media_change_notify(struct ata_device *dev);
extern void ata_scsi_hotplug(struct work_struct *work); extern void ata_scsi_hotplug(struct work_struct *work);
extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf,
unsigned int buflen);
extern unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf,
unsigned int buflen);
extern unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf,
unsigned int buflen);
extern unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
unsigned int buflen);
extern unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf,
unsigned int buflen);
extern unsigned int ata_scsiop_sync_cache(struct ata_scsi_args *args, u8 *rbuf,
unsigned int buflen);
extern unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf,
unsigned int buflen);
extern unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf,
unsigned int buflen);
extern unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf,
unsigned int buflen);
extern void ata_scsi_badcmd(struct scsi_cmnd *cmd,
void (*done)(struct scsi_cmnd *),
u8 asc, u8 ascq);
extern void ata_scsi_set_sense(struct scsi_cmnd *cmd,
u8 sk, u8 asc, u8 ascq);
extern void ata_scsi_rbuf_fill(struct ata_scsi_args *args,
unsigned int (*actor) (struct ata_scsi_args *args,
u8 *rbuf, unsigned int buflen));
extern void ata_schedule_scsi_eh(struct Scsi_Host *shost); extern void ata_schedule_scsi_eh(struct Scsi_Host *shost);
extern void ata_scsi_dev_rescan(struct work_struct *work); extern void ata_scsi_dev_rescan(struct work_struct *work);
extern int ata_bus_probe(struct ata_port *ap); extern int ata_bus_probe(struct ata_port *ap);
......
...@@ -1272,8 +1272,8 @@ static void bfin_freeze(struct ata_port *ap) ...@@ -1272,8 +1272,8 @@ static void bfin_freeze(struct ata_port *ap)
void bfin_thaw(struct ata_port *ap) void bfin_thaw(struct ata_port *ap)
{ {
dev_dbg(ap->dev, "in atapi dma thaw\n");
bfin_check_status(ap); bfin_check_status(ap);
bfin_irq_clear(ap);
bfin_irq_on(ap); bfin_irq_on(ap);
} }
...@@ -1339,13 +1339,130 @@ static int bfin_port_start(struct ata_port *ap) ...@@ -1339,13 +1339,130 @@ static int bfin_port_start(struct ata_port *ap)
return 0; return 0;
} }
static unsigned int bfin_ata_host_intr(struct ata_port *ap,
struct ata_queued_cmd *qc)
{
struct ata_eh_info *ehi = &ap->link.eh_info;
u8 status, host_stat = 0;
VPRINTK("ata%u: protocol %d task_state %d\n",
ap->print_id, qc->tf.protocol, ap->hsm_task_state);
/* Check whether we are expecting interrupt in this state */
switch (ap->hsm_task_state) {
case HSM_ST_FIRST:
/* Some pre-ATAPI-4 devices assert INTRQ
* at this state when ready to receive CDB.
*/
/* Check the ATA_DFLAG_CDB_INTR flag is enough here.
* The flag was turned on only for atapi devices.
* No need to check is_atapi_taskfile(&qc->tf) again.
*/
if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR))
goto idle_irq;
break;
case HSM_ST_LAST:
if (qc->tf.protocol == ATA_PROT_DMA ||
qc->tf.protocol == ATAPI_PROT_DMA) {
/* check status of DMA engine */
host_stat = ap->ops->bmdma_status(ap);
VPRINTK("ata%u: host_stat 0x%X\n",
ap->print_id, host_stat);
/* if it's not our irq... */
if (!(host_stat & ATA_DMA_INTR))
goto idle_irq;
/* before we do anything else, clear DMA-Start bit */
ap->ops->bmdma_stop(qc);
if (unlikely(host_stat & ATA_DMA_ERR)) {
/* error when transfering data to/from memory */
qc->err_mask |= AC_ERR_HOST_BUS;
ap->hsm_task_state = HSM_ST_ERR;
}
}
break;
case HSM_ST:
break;
default:
goto idle_irq;
}
/* check altstatus */
status = ap->ops->sff_check_altstatus(ap);
if (status & ATA_BUSY)
goto busy_ata;
/* check main status, clearing INTRQ */
status = ap->ops->sff_check_status(ap);
if (unlikely(status & ATA_BUSY))
goto busy_ata;
/* ack bmdma irq events */
ap->ops->sff_irq_clear(ap);
ata_sff_hsm_move(ap, qc, status, 0);
if (unlikely(qc->err_mask) && (qc->tf.protocol == ATA_PROT_DMA ||
qc->tf.protocol == ATAPI_PROT_DMA))
ata_ehi_push_desc(ehi, "BMDMA stat 0x%x", host_stat);
busy_ata:
return 1; /* irq handled */
idle_irq:
ap->stats.idle_irq++;
#ifdef ATA_IRQ_TRAP
if ((ap->stats.idle_irq % 1000) == 0) {
ap->ops->irq_ack(ap, 0); /* debug trap */
ata_port_printk(ap, KERN_WARNING, "irq trap\n");
return 1;
}
#endif
return 0; /* irq not handled */
}
static irqreturn_t bfin_ata_interrupt(int irq, void *dev_instance)
{
struct ata_host *host = dev_instance;
unsigned int i;
unsigned int handled = 0;
unsigned long flags;
/* TODO: make _irqsave conditional on x86 PCI IDE legacy mode */
spin_lock_irqsave(&host->lock, flags);
for (i = 0; i < host->n_ports; i++) {
struct ata_port *ap;
ap = host->ports[i];
if (ap &&
!(ap->flags & ATA_FLAG_DISABLED)) {
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);
return IRQ_RETVAL(handled);
}
static struct scsi_host_template bfin_sht = { static struct scsi_host_template bfin_sht = {
ATA_BASE_SHT(DRV_NAME), ATA_BASE_SHT(DRV_NAME),
.sg_tablesize = SG_NONE, .sg_tablesize = SG_NONE,
.dma_boundary = ATA_DMA_BOUNDARY, .dma_boundary = ATA_DMA_BOUNDARY,
}; };
static const struct ata_port_operations bfin_pata_ops = { static struct ata_port_operations bfin_pata_ops = {
.inherits = &ata_sff_port_ops, .inherits = &ata_sff_port_ops,
.set_piomode = bfin_set_piomode, .set_piomode = bfin_set_piomode,
...@@ -1370,7 +1487,6 @@ static const struct ata_port_operations bfin_pata_ops = { ...@@ -1370,7 +1487,6 @@ static const struct ata_port_operations bfin_pata_ops = {
.thaw = bfin_thaw, .thaw = bfin_thaw,
.softreset = bfin_softreset, .softreset = bfin_softreset,
.postreset = bfin_postreset, .postreset = bfin_postreset,
.post_internal_cmd = bfin_bmdma_stop,
.sff_irq_clear = bfin_irq_clear, .sff_irq_clear = bfin_irq_clear,
.sff_irq_on = bfin_irq_on, .sff_irq_on = bfin_irq_on,
...@@ -1507,7 +1623,7 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev) ...@@ -1507,7 +1623,7 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev)
} }
if (ata_host_activate(host, platform_get_irq(pdev, 0), if (ata_host_activate(host, platform_get_irq(pdev, 0),
ata_sff_interrupt, IRQF_SHARED, &bfin_sht) != 0) { bfin_ata_interrupt, IRQF_SHARED, &bfin_sht) != 0) {
peripheral_free_list(atapi_io_port); peripheral_free_list(atapi_io_port);
dev_err(&pdev->dev, "Fail to attach ATAPI device\n"); dev_err(&pdev->dev, "Fail to attach ATAPI device\n");
return -ENODEV; return -ENODEV;
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <asm/gpio.h> #include <asm/gpio.h>
#define DRV_NAME "pata-rb500-cf" #define DRV_NAME "pata-rb532-cf"
#define DRV_VERSION "0.1.0" #define DRV_VERSION "0.1.0"
#define DRV_DESC "PATA driver for RouterBOARD 532 Compact Flash" #define DRV_DESC "PATA driver for RouterBOARD 532 Compact Flash"
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#define RB500_CF_REG_CTRL 0x080E #define RB500_CF_REG_CTRL 0x080E
#define RB500_CF_REG_DATA 0x0C00 #define RB500_CF_REG_DATA 0x0C00
struct rb500_cf_info { struct rb532_cf_info {
void __iomem *iobase; void __iomem *iobase;
unsigned int gpio_line; unsigned int gpio_line;
int frozen; int frozen;
...@@ -52,10 +52,10 @@ struct rb500_cf_info { ...@@ -52,10 +52,10 @@ struct rb500_cf_info {
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
static inline void rb500_pata_finish_io(struct ata_port *ap) static inline void rb532_pata_finish_io(struct ata_port *ap)
{ {
struct ata_host *ah = ap->host; struct ata_host *ah = ap->host;
struct rb500_cf_info *info = ah->private_data; struct rb532_cf_info *info = ah->private_data;
ata_sff_altstatus(ap); ata_sff_altstatus(ap);
ndelay(RB500_CF_IO_DELAY); ndelay(RB500_CF_IO_DELAY);
...@@ -63,14 +63,14 @@ static inline void rb500_pata_finish_io(struct ata_port *ap) ...@@ -63,14 +63,14 @@ static inline void rb500_pata_finish_io(struct ata_port *ap)
set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH);
} }
static void rb500_pata_exec_command(struct ata_port *ap, static void rb532_pata_exec_command(struct ata_port *ap,
const struct ata_taskfile *tf) const struct ata_taskfile *tf)
{ {
writeb(tf->command, ap->ioaddr.command_addr); writeb(tf->command, ap->ioaddr.command_addr);
rb500_pata_finish_io(ap); rb532_pata_finish_io(ap);
} }
static void rb500_pata_data_xfer(struct ata_device *adev, unsigned char *buf, static void rb532_pata_data_xfer(struct ata_device *adev, unsigned char *buf,
unsigned int buflen, int write_data) unsigned int buflen, int write_data)
{ {
struct ata_port *ap = adev->link->ap; struct ata_port *ap = adev->link->ap;
...@@ -84,27 +84,27 @@ static void rb500_pata_data_xfer(struct ata_device *adev, unsigned char *buf, ...@@ -84,27 +84,27 @@ static void rb500_pata_data_xfer(struct ata_device *adev, unsigned char *buf,
*buf = readb(ioaddr); *buf = readb(ioaddr);
} }
rb500_pata_finish_io(adev->link->ap); rb532_pata_finish_io(adev->link->ap);
} }
static void rb500_pata_freeze(struct ata_port *ap) static void rb532_pata_freeze(struct ata_port *ap)
{ {
struct rb500_cf_info *info = ap->host->private_data; struct rb532_cf_info *info = ap->host->private_data;
info->frozen = 1; info->frozen = 1;
} }
static void rb500_pata_thaw(struct ata_port *ap) static void rb532_pata_thaw(struct ata_port *ap)
{ {
struct rb500_cf_info *info = ap->host->private_data; struct rb532_cf_info *info = ap->host->private_data;
info->frozen = 0; info->frozen = 0;
} }
static irqreturn_t rb500_pata_irq_handler(int irq, void *dev_instance) static irqreturn_t rb532_pata_irq_handler(int irq, void *dev_instance)
{ {
struct ata_host *ah = dev_instance; struct ata_host *ah = dev_instance;
struct rb500_cf_info *info = ah->private_data; struct rb532_cf_info *info = ah->private_data;
if (gpio_get_value(info->gpio_line)) { if (gpio_get_value(info->gpio_line)) {
set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW); set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW);
...@@ -117,30 +117,30 @@ static irqreturn_t rb500_pata_irq_handler(int irq, void *dev_instance) ...@@ -117,30 +117,30 @@ static irqreturn_t rb500_pata_irq_handler(int irq, void *dev_instance)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static struct ata_port_operations rb500_pata_port_ops = { static struct ata_port_operations rb532_pata_port_ops = {
.inherits = &ata_sff_port_ops, .inherits = &ata_sff_port_ops,
.sff_exec_command = rb500_pata_exec_command, .sff_exec_command = rb532_pata_exec_command,
.sff_data_xfer = rb500_pata_data_xfer, .sff_data_xfer = rb532_pata_data_xfer,
.freeze = rb500_pata_freeze, .freeze = rb532_pata_freeze,
.thaw = rb500_pata_thaw, .thaw = rb532_pata_thaw,
}; };
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
static struct scsi_host_template rb500_pata_sht = { static struct scsi_host_template rb532_pata_sht = {
ATA_PIO_SHT(DRV_NAME), ATA_PIO_SHT(DRV_NAME),
}; };
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
static void rb500_pata_setup_ports(struct ata_host *ah) static void rb532_pata_setup_ports(struct ata_host *ah)
{ {
struct rb500_cf_info *info = ah->private_data; struct rb532_cf_info *info = ah->private_data;
struct ata_port *ap; struct ata_port *ap;
ap = ah->ports[0]; ap = ah->ports[0];
ap->ops = &rb500_pata_port_ops; ap->ops = &rb532_pata_port_ops;
ap->pio_mask = 0x1f; /* PIO4 */ ap->pio_mask = 0x1f; /* PIO4 */
ap->flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO; ap->flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO;
...@@ -153,13 +153,13 @@ static void rb500_pata_setup_ports(struct ata_host *ah) ...@@ -153,13 +153,13 @@ static void rb500_pata_setup_ports(struct ata_host *ah)
ap->ioaddr.data_addr = info->iobase + RB500_CF_REG_DATA; ap->ioaddr.data_addr = info->iobase + RB500_CF_REG_DATA;
} }
static __devinit int rb500_pata_driver_probe(struct platform_device *pdev) static __devinit int rb532_pata_driver_probe(struct platform_device *pdev)
{ {
unsigned int irq; unsigned int irq;
int gpio; int gpio;
struct resource *res; struct resource *res;
struct ata_host *ah; struct ata_host *ah;
struct rb500_cf_info *info; struct rb532_cf_info *info;
int ret; int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
...@@ -213,10 +213,10 @@ static __devinit int rb500_pata_driver_probe(struct platform_device *pdev) ...@@ -213,10 +213,10 @@ static __devinit int rb500_pata_driver_probe(struct platform_device *pdev)
goto err_free_gpio; goto err_free_gpio;
} }
rb500_pata_setup_ports(ah); rb532_pata_setup_ports(ah);
ret = ata_host_activate(ah, irq, rb500_pata_irq_handler, ret = ata_host_activate(ah, irq, rb532_pata_irq_handler,
IRQF_TRIGGER_LOW, &rb500_pata_sht); IRQF_TRIGGER_LOW, &rb532_pata_sht);
if (ret) if (ret)
goto err_free_gpio; goto err_free_gpio;
...@@ -228,10 +228,10 @@ static __devinit int rb500_pata_driver_probe(struct platform_device *pdev) ...@@ -228,10 +228,10 @@ static __devinit int rb500_pata_driver_probe(struct platform_device *pdev)
return ret; return ret;
} }
static __devexit int rb500_pata_driver_remove(struct platform_device *pdev) static __devexit int rb532_pata_driver_remove(struct platform_device *pdev)
{ {
struct ata_host *ah = platform_get_drvdata(pdev); struct ata_host *ah = platform_get_drvdata(pdev);
struct rb500_cf_info *info = ah->private_data; struct rb532_cf_info *info = ah->private_data;
ata_host_detach(ah); ata_host_detach(ah);
gpio_free(info->gpio_line); gpio_free(info->gpio_line);
...@@ -242,9 +242,9 @@ static __devexit int rb500_pata_driver_remove(struct platform_device *pdev) ...@@ -242,9 +242,9 @@ static __devexit int rb500_pata_driver_remove(struct platform_device *pdev)
/* work with hotplug and coldplug */ /* work with hotplug and coldplug */
MODULE_ALIAS("platform:" DRV_NAME); MODULE_ALIAS("platform:" DRV_NAME);
static struct platform_driver rb500_pata_platform_driver = { static struct platform_driver rb532_pata_platform_driver = {
.probe = rb500_pata_driver_probe, .probe = rb532_pata_driver_probe,
.remove = __devexit_p(rb500_pata_driver_remove), .remove = __devexit_p(rb532_pata_driver_remove),
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -255,16 +255,16 @@ static struct platform_driver rb500_pata_platform_driver = { ...@@ -255,16 +255,16 @@ static struct platform_driver rb500_pata_platform_driver = {
#define DRV_INFO DRV_DESC " version " DRV_VERSION #define DRV_INFO DRV_DESC " version " DRV_VERSION
static int __init rb500_pata_module_init(void) static int __init rb532_pata_module_init(void)
{ {
printk(KERN_INFO DRV_INFO "\n"); printk(KERN_INFO DRV_INFO "\n");
return platform_driver_register(&rb500_pata_platform_driver); return platform_driver_register(&rb532_pata_platform_driver);
} }
static void __exit rb500_pata_module_exit(void) static void __exit rb532_pata_module_exit(void)
{ {
platform_driver_unregister(&rb500_pata_platform_driver); platform_driver_unregister(&rb532_pata_platform_driver);
} }
MODULE_AUTHOR("Gabor Juhos <juhosg at openwrt.org>"); MODULE_AUTHOR("Gabor Juhos <juhosg at openwrt.org>");
...@@ -273,5 +273,5 @@ MODULE_DESCRIPTION(DRV_DESC); ...@@ -273,5 +273,5 @@ MODULE_DESCRIPTION(DRV_DESC);
MODULE_VERSION(DRV_VERSION); MODULE_VERSION(DRV_VERSION);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(rb500_pata_module_init); module_init(rb532_pata_module_init);
module_exit(rb500_pata_module_exit); module_exit(rb532_pata_module_exit);
...@@ -172,10 +172,11 @@ enum { ...@@ -172,10 +172,11 @@ enum {
PCIE_IRQ_MASK_OFS = 0x1910, PCIE_IRQ_MASK_OFS = 0x1910,
PCIE_UNMASK_ALL_IRQS = 0x40a, /* assorted bits */ PCIE_UNMASK_ALL_IRQS = 0x40a, /* assorted bits */
HC_MAIN_IRQ_CAUSE_OFS = 0x1d60, /* Host Controller Main Interrupt Cause/Mask registers (1 per-chip) */
HC_MAIN_IRQ_MASK_OFS = 0x1d64, PCI_HC_MAIN_IRQ_CAUSE_OFS = 0x1d60,
HC_SOC_MAIN_IRQ_CAUSE_OFS = 0x20020, PCI_HC_MAIN_IRQ_MASK_OFS = 0x1d64,
HC_SOC_MAIN_IRQ_MASK_OFS = 0x20024, SOC_HC_MAIN_IRQ_CAUSE_OFS = 0x20020,
SOC_HC_MAIN_IRQ_MASK_OFS = 0x20024,
ERR_IRQ = (1 << 0), /* shift by port # */ ERR_IRQ = (1 << 0), /* shift by port # */
DONE_IRQ = (1 << 1), /* shift by port # */ DONE_IRQ = (1 << 1), /* shift by port # */
HC0_IRQ_PEND = 0x1ff, /* bits 0-8 = HC0's ports */ HC0_IRQ_PEND = 0x1ff, /* bits 0-8 = HC0's ports */
...@@ -445,8 +446,8 @@ struct mv_host_priv { ...@@ -445,8 +446,8 @@ struct mv_host_priv {
const struct mv_hw_ops *ops; const struct mv_hw_ops *ops;
int n_ports; int n_ports;
void __iomem *base; void __iomem *base;
void __iomem *main_cause_reg_addr; void __iomem *main_irq_cause_addr;
void __iomem *main_mask_reg_addr; void __iomem *main_irq_mask_addr;
u32 irq_cause_ofs; u32 irq_cause_ofs;
u32 irq_mask_ofs; u32 irq_mask_ofs;
u32 unmask_all_irqs; u32 unmask_all_irqs;
...@@ -727,8 +728,8 @@ static inline unsigned int mv_hardport_from_port(unsigned int port) ...@@ -727,8 +728,8 @@ static inline unsigned int mv_hardport_from_port(unsigned int port)
* Simple code, with two return values, so macro rather than inline. * Simple code, with two return values, so macro rather than inline.
* *
* port is the sole input, in range 0..7. * port is the sole input, in range 0..7.
* shift is one output, for use with the main_cause and main_mask registers. * shift is one output, for use with main_irq_cause / main_irq_mask registers.
* hardport is the other output, in range 0..3 * hardport is the other output, in range 0..3.
* *
* Note that port and hardport may be the same variable in some cases. * Note that port and hardport may be the same variable in some cases.
*/ */
...@@ -1679,12 +1680,12 @@ static void mv_process_crpb_entries(struct ata_port *ap, struct mv_port_priv *pp ...@@ -1679,12 +1680,12 @@ static void mv_process_crpb_entries(struct ata_port *ap, struct mv_port_priv *pp
/** /**
* mv_host_intr - Handle all interrupts on the given host controller * mv_host_intr - Handle all interrupts on the given host controller
* @host: host specific structure * @host: host specific structure
* @main_cause: Main interrupt cause register for the chip. * @main_irq_cause: Main interrupt cause register for the chip.
* *
* LOCKING: * LOCKING:
* Inherited from caller. * Inherited from caller.
*/ */
static int mv_host_intr(struct ata_host *host, u32 main_cause) static int mv_host_intr(struct ata_host *host, u32 main_irq_cause)
{ {
struct mv_host_priv *hpriv = host->private_data; struct mv_host_priv *hpriv = host->private_data;
void __iomem *mmio = hpriv->base, *hc_mmio = NULL; void __iomem *mmio = hpriv->base, *hc_mmio = NULL;
...@@ -1705,7 +1706,7 @@ static int mv_host_intr(struct ata_host *host, u32 main_cause) ...@@ -1705,7 +1706,7 @@ static int mv_host_intr(struct ata_host *host, u32 main_cause)
* Do nothing if port is not interrupting or is disabled: * Do nothing if port is not interrupting or is disabled:
*/ */
MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport);
port_cause = (main_cause >> shift) & (DONE_IRQ | ERR_IRQ); port_cause = (main_irq_cause >> shift) & (DONE_IRQ | ERR_IRQ);
if (!port_cause || !ap || (ap->flags & ATA_FLAG_DISABLED)) if (!port_cause || !ap || (ap->flags & ATA_FLAG_DISABLED))
continue; continue;
/* /*
...@@ -1811,20 +1812,20 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance) ...@@ -1811,20 +1812,20 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance)
struct ata_host *host = dev_instance; struct ata_host *host = dev_instance;
struct mv_host_priv *hpriv = host->private_data; struct mv_host_priv *hpriv = host->private_data;
unsigned int handled = 0; unsigned int handled = 0;
u32 main_cause, main_mask; u32 main_irq_cause, main_irq_mask;
spin_lock(&host->lock); spin_lock(&host->lock);
main_cause = readl(hpriv->main_cause_reg_addr); main_irq_cause = readl(hpriv->main_irq_cause_addr);
main_mask = readl(hpriv->main_mask_reg_addr); main_irq_mask = readl(hpriv->main_irq_mask_addr);
/* /*
* Deal with cases where we either have nothing pending, or have read * Deal with cases where we either have nothing pending, or have read
* a bogus register value which can indicate HW removal or PCI fault. * a bogus register value which can indicate HW removal or PCI fault.
*/ */
if ((main_cause & main_mask) && (main_cause != 0xffffffffU)) { if ((main_irq_cause & main_irq_mask) && (main_irq_cause != 0xffffffffU)) {
if (unlikely((main_cause & PCI_ERR) && HAS_PCI(host))) if (unlikely((main_irq_cause & PCI_ERR) && HAS_PCI(host)))
handled = mv_pci_error(host, hpriv->base); handled = mv_pci_error(host, hpriv->base);
else else
handled = mv_host_intr(host, main_cause); handled = mv_host_intr(host, main_irq_cause);
} }
spin_unlock(&host->lock); spin_unlock(&host->lock);
return IRQ_RETVAL(handled); return IRQ_RETVAL(handled);
...@@ -2027,7 +2028,7 @@ static void mv_reset_pci_bus(struct ata_host *host, void __iomem *mmio) ...@@ -2027,7 +2028,7 @@ static void mv_reset_pci_bus(struct ata_host *host, void __iomem *mmio)
ZERO(MV_PCI_DISC_TIMER); ZERO(MV_PCI_DISC_TIMER);
ZERO(MV_PCI_MSI_TRIGGER); ZERO(MV_PCI_MSI_TRIGGER);
writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT); writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT);
ZERO(HC_MAIN_IRQ_MASK_OFS); ZERO(PCI_HC_MAIN_IRQ_MASK_OFS);
ZERO(MV_PCI_SERR_MASK); ZERO(MV_PCI_SERR_MASK);
ZERO(hpriv->irq_cause_ofs); ZERO(hpriv->irq_cause_ofs);
ZERO(hpriv->irq_mask_ofs); ZERO(hpriv->irq_mask_ofs);
...@@ -2404,7 +2405,7 @@ static void mv_eh_freeze(struct ata_port *ap) ...@@ -2404,7 +2405,7 @@ static void mv_eh_freeze(struct ata_port *ap)
{ {
struct mv_host_priv *hpriv = ap->host->private_data; struct mv_host_priv *hpriv = ap->host->private_data;
unsigned int shift, hardport, port = ap->port_no; unsigned int shift, hardport, port = ap->port_no;
u32 main_mask; u32 main_irq_mask;
/* FIXME: handle coalescing completion events properly */ /* FIXME: handle coalescing completion events properly */
...@@ -2412,9 +2413,9 @@ static void mv_eh_freeze(struct ata_port *ap) ...@@ -2412,9 +2413,9 @@ static void mv_eh_freeze(struct ata_port *ap)
MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport);
/* disable assertion of portN err, done events */ /* disable assertion of portN err, done events */
main_mask = readl(hpriv->main_mask_reg_addr); main_irq_mask = readl(hpriv->main_irq_mask_addr);
main_mask &= ~((DONE_IRQ | ERR_IRQ) << shift); main_irq_mask &= ~((DONE_IRQ | ERR_IRQ) << shift);
writelfl(main_mask, hpriv->main_mask_reg_addr); writelfl(main_irq_mask, hpriv->main_irq_mask_addr);
} }
static void mv_eh_thaw(struct ata_port *ap) static void mv_eh_thaw(struct ata_port *ap)
...@@ -2423,7 +2424,7 @@ static void mv_eh_thaw(struct ata_port *ap) ...@@ -2423,7 +2424,7 @@ static void mv_eh_thaw(struct ata_port *ap)
unsigned int shift, hardport, port = ap->port_no; unsigned int shift, hardport, port = ap->port_no;
void __iomem *hc_mmio = mv_hc_base_from_port(hpriv->base, port); void __iomem *hc_mmio = mv_hc_base_from_port(hpriv->base, port);
void __iomem *port_mmio = mv_ap_base(ap); void __iomem *port_mmio = mv_ap_base(ap);
u32 main_mask, hc_irq_cause; u32 main_irq_mask, hc_irq_cause;
/* FIXME: handle coalescing completion events properly */ /* FIXME: handle coalescing completion events properly */
...@@ -2438,9 +2439,9 @@ static void mv_eh_thaw(struct ata_port *ap) ...@@ -2438,9 +2439,9 @@ static void mv_eh_thaw(struct ata_port *ap)
writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS);
/* enable assertion of portN err, done events */ /* enable assertion of portN err, done events */
main_mask = readl(hpriv->main_mask_reg_addr); main_irq_mask = readl(hpriv->main_irq_mask_addr);
main_mask |= ((DONE_IRQ | ERR_IRQ) << shift); main_irq_mask |= ((DONE_IRQ | ERR_IRQ) << shift);
writelfl(main_mask, hpriv->main_mask_reg_addr); writelfl(main_irq_mask, hpriv->main_irq_mask_addr);
} }
/** /**
...@@ -2654,15 +2655,15 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) ...@@ -2654,15 +2655,15 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
goto done; goto done;
if (HAS_PCI(host)) { if (HAS_PCI(host)) {
hpriv->main_cause_reg_addr = mmio + HC_MAIN_IRQ_CAUSE_OFS; hpriv->main_irq_cause_addr = mmio + PCI_HC_MAIN_IRQ_CAUSE_OFS;
hpriv->main_mask_reg_addr = mmio + HC_MAIN_IRQ_MASK_OFS; hpriv->main_irq_mask_addr = mmio + PCI_HC_MAIN_IRQ_MASK_OFS;
} else { } else {
hpriv->main_cause_reg_addr = mmio + HC_SOC_MAIN_IRQ_CAUSE_OFS; hpriv->main_irq_cause_addr = mmio + SOC_HC_MAIN_IRQ_CAUSE_OFS;
hpriv->main_mask_reg_addr = mmio + HC_SOC_MAIN_IRQ_MASK_OFS; hpriv->main_irq_mask_addr = mmio + SOC_HC_MAIN_IRQ_MASK_OFS;
} }
/* global interrupt mask: 0 == mask everything */ /* global interrupt mask: 0 == mask everything */
writel(0, hpriv->main_mask_reg_addr); writel(0, hpriv->main_irq_mask_addr);
n_hc = mv_get_hc_count(host->ports[0]->flags); n_hc = mv_get_hc_count(host->ports[0]->flags);
...@@ -2712,23 +2713,23 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) ...@@ -2712,23 +2713,23 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs);
if (IS_GEN_I(hpriv)) if (IS_GEN_I(hpriv))
writelfl(~HC_MAIN_MASKED_IRQS_5, writelfl(~HC_MAIN_MASKED_IRQS_5,
hpriv->main_mask_reg_addr); hpriv->main_irq_mask_addr);
else else
writelfl(~HC_MAIN_MASKED_IRQS, writelfl(~HC_MAIN_MASKED_IRQS,
hpriv->main_mask_reg_addr); hpriv->main_irq_mask_addr);
VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x " VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x "
"PCI int cause/mask=0x%08x/0x%08x\n", "PCI int cause/mask=0x%08x/0x%08x\n",
readl(hpriv->main_cause_reg_addr), readl(hpriv->main_irq_cause_addr),
readl(hpriv->main_mask_reg_addr), readl(hpriv->main_irq_mask_addr),
readl(mmio + hpriv->irq_cause_ofs), readl(mmio + hpriv->irq_cause_ofs),
readl(mmio + hpriv->irq_mask_ofs)); readl(mmio + hpriv->irq_mask_ofs));
} else { } else {
writelfl(~HC_MAIN_MASKED_IRQS_SOC, writelfl(~HC_MAIN_MASKED_IRQS_SOC,
hpriv->main_mask_reg_addr); hpriv->main_irq_mask_addr);
VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x\n", VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x\n",
readl(hpriv->main_cause_reg_addr), readl(hpriv->main_irq_cause_addr),
readl(hpriv->main_mask_reg_addr)); readl(hpriv->main_irq_mask_addr));
} }
done: done:
return rc; return rc;
......
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