aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sata_mv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sata_mv.c')
-rw-r--r--drivers/scsi/sata_mv.c41
1 files changed, 12 insertions, 29 deletions
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index 422e0b6f603a..46dbdee79f77 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -29,6 +29,7 @@
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/sched.h> 30#include <linux/sched.h>
31#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
32#include <linux/device.h>
32#include "scsi.h" 33#include "scsi.h"
33#include <scsi/scsi_host.h> 34#include <scsi/scsi_host.h>
34#include <linux/libata.h> 35#include <linux/libata.h>
@@ -258,7 +259,6 @@ struct mv_host_priv {
258static void mv_irq_clear(struct ata_port *ap); 259static void mv_irq_clear(struct ata_port *ap);
259static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in); 260static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in);
260static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); 261static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val);
261static u8 mv_check_err(struct ata_port *ap);
262static void mv_phy_reset(struct ata_port *ap); 262static void mv_phy_reset(struct ata_port *ap);
263static void mv_host_stop(struct ata_host_set *host_set); 263static void mv_host_stop(struct ata_host_set *host_set);
264static int mv_port_start(struct ata_port *ap); 264static int mv_port_start(struct ata_port *ap);
@@ -296,7 +296,6 @@ static const struct ata_port_operations mv_ops = {
296 .tf_load = ata_tf_load, 296 .tf_load = ata_tf_load,
297 .tf_read = ata_tf_read, 297 .tf_read = ata_tf_read,
298 .check_status = ata_check_status, 298 .check_status = ata_check_status,
299 .check_err = mv_check_err,
300 .exec_command = ata_exec_command, 299 .exec_command = ata_exec_command,
301 .dev_select = ata_std_dev_select, 300 .dev_select = ata_std_dev_select,
302 301
@@ -1067,6 +1066,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant,
1067 struct ata_queued_cmd *qc; 1066 struct ata_queued_cmd *qc;
1068 u32 hc_irq_cause; 1067 u32 hc_irq_cause;
1069 int shift, port, port0, hard_port, handled; 1068 int shift, port, port0, hard_port, handled;
1069 unsigned int err_mask;
1070 u8 ata_status = 0; 1070 u8 ata_status = 0;
1071 1071
1072 if (hc == 0) { 1072 if (hc == 0) {
@@ -1102,15 +1102,15 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant,
1102 handled++; 1102 handled++;
1103 } 1103 }
1104 1104
1105 err_mask = ac_err_mask(ata_status);
1106
1105 shift = port << 1; /* (port * 2) */ 1107 shift = port << 1; /* (port * 2) */
1106 if (port >= MV_PORTS_PER_HC) { 1108 if (port >= MV_PORTS_PER_HC) {
1107 shift++; /* skip bit 8 in the HC Main IRQ reg */ 1109 shift++; /* skip bit 8 in the HC Main IRQ reg */
1108 } 1110 }
1109 if ((PORT0_ERR << shift) & relevant) { 1111 if ((PORT0_ERR << shift) & relevant) {
1110 mv_err_intr(ap); 1112 mv_err_intr(ap);
1111 /* OR in ATA_ERR to ensure libata knows we took one */ 1113 err_mask |= AC_ERR_OTHER;
1112 ata_status = readb((void __iomem *)
1113 ap->ioaddr.status_addr) | ATA_ERR;
1114 handled++; 1114 handled++;
1115 } 1115 }
1116 1116
@@ -1120,7 +1120,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant,
1120 VPRINTK("port %u IRQ found for qc, " 1120 VPRINTK("port %u IRQ found for qc, "
1121 "ata_status 0x%x\n", port,ata_status); 1121 "ata_status 0x%x\n", port,ata_status);
1122 /* mark qc status appropriately */ 1122 /* mark qc status appropriately */
1123 ata_qc_complete(qc, ata_status); 1123 ata_qc_complete(qc, err_mask);
1124 } 1124 }
1125 } 1125 }
1126 } 1126 }
@@ -1185,22 +1185,6 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance,
1185} 1185}
1186 1186
1187/** 1187/**
1188 * mv_check_err - Return the error shadow register to caller.
1189 * @ap: ATA channel to manipulate
1190 *
1191 * Marvell requires DMA to be stopped before accessing shadow
1192 * registers. So we do that, then return the needed register.
1193 *
1194 * LOCKING:
1195 * Inherited from caller. FIXME: protect mv_stop_dma with lock?
1196 */
1197static u8 mv_check_err(struct ata_port *ap)
1198{
1199 mv_stop_dma(ap); /* can't read shadow regs if DMA on */
1200 return readb((void __iomem *) ap->ioaddr.error_addr);
1201}
1202
1203/**
1204 * mv_phy_reset - Perform eDMA reset followed by COMRESET 1188 * mv_phy_reset - Perform eDMA reset followed by COMRESET
1205 * @ap: ATA channel to manipulate 1189 * @ap: ATA channel to manipulate
1206 * 1190 *
@@ -1312,7 +1296,7 @@ static void mv_eng_timeout(struct ata_port *ap)
1312 */ 1296 */
1313 spin_lock_irqsave(&ap->host_set->lock, flags); 1297 spin_lock_irqsave(&ap->host_set->lock, flags);
1314 qc->scsidone = scsi_finish_command; 1298 qc->scsidone = scsi_finish_command;
1315 ata_qc_complete(qc, ATA_ERR); 1299 ata_qc_complete(qc, AC_ERR_OTHER);
1316 spin_unlock_irqrestore(&ap->host_set->lock, flags); 1300 spin_unlock_irqrestore(&ap->host_set->lock, flags);
1317 } 1301 }
1318} 1302}
@@ -1454,9 +1438,9 @@ static void mv_print_info(struct ata_probe_ent *probe_ent)
1454 else 1438 else
1455 scc_s = "unknown"; 1439 scc_s = "unknown";
1456 1440
1457 printk(KERN_INFO DRV_NAME 1441 dev_printk(KERN_INFO, &pdev->dev,
1458 "(%s) %u slots %u ports %s mode IRQ via %s\n", 1442 "%u slots %u ports %s mode IRQ via %s\n",
1459 pci_name(pdev), (unsigned)MV_MAX_Q_DEPTH, probe_ent->n_ports, 1443 (unsigned)MV_MAX_Q_DEPTH, probe_ent->n_ports,
1460 scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx"); 1444 scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx");
1461} 1445}
1462 1446
@@ -1477,9 +1461,8 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1477 void __iomem *mmio_base; 1461 void __iomem *mmio_base;
1478 int pci_dev_busy = 0, rc; 1462 int pci_dev_busy = 0, rc;
1479 1463
1480 if (!printed_version++) { 1464 if (!printed_version++)
1481 printk(KERN_INFO DRV_NAME " version " DRV_VERSION "\n"); 1465 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
1482 }
1483 1466
1484 rc = pci_enable_device(pdev); 1467 rc = pci_enable_device(pdev);
1485 if (rc) { 1468 if (rc) {