aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_mv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/sata_mv.c')
-rw-r--r--drivers/ata/sata_mv.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index a9fd9709c262..b52c0519ad0b 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -160,8 +160,7 @@ enum {
160 /* Host Flags */ 160 /* Host Flags */
161 MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ 161 MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */
162 162
163 MV_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 163 MV_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_PIO_POLLING,
164 ATA_FLAG_MMIO | ATA_FLAG_PIO_POLLING,
165 164
166 MV_GEN_I_FLAGS = MV_COMMON_FLAGS | ATA_FLAG_NO_ATAPI, 165 MV_GEN_I_FLAGS = MV_COMMON_FLAGS | ATA_FLAG_NO_ATAPI,
167 166
@@ -1353,7 +1352,7 @@ static int mv_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val)
1353 /* 1352 /*
1354 * Workaround for 88SX60x1 FEr SATA#26: 1353 * Workaround for 88SX60x1 FEr SATA#26:
1355 * 1354 *
1356 * COMRESETs have to take care not to accidently 1355 * COMRESETs have to take care not to accidentally
1357 * put the drive to sleep when writing SCR_CONTROL. 1356 * put the drive to sleep when writing SCR_CONTROL.
1358 * Setting bits 12..15 prevents this problem. 1357 * Setting bits 12..15 prevents this problem.
1359 * 1358 *
@@ -2045,7 +2044,7 @@ static void mv_qc_prep(struct ata_queued_cmd *qc)
2045 2044
2046 cw = &pp->crqb[in_index].ata_cmd[0]; 2045 cw = &pp->crqb[in_index].ata_cmd[0];
2047 2046
2048 /* Sadly, the CRQB cannot accomodate all registers--there are 2047 /* Sadly, the CRQB cannot accommodate all registers--there are
2049 * only 11 bytes...so we must pick and choose required 2048 * only 11 bytes...so we must pick and choose required
2050 * registers based on the command. So, we drop feature and 2049 * registers based on the command. So, we drop feature and
2051 * hob_feature for [RW] DMA commands, but they are needed for 2050 * hob_feature for [RW] DMA commands, but they are needed for
@@ -2743,18 +2742,11 @@ static void mv_err_intr(struct ata_port *ap)
2743 } 2742 }
2744} 2743}
2745 2744
2746static void mv_process_crpb_response(struct ata_port *ap, 2745static bool mv_process_crpb_response(struct ata_port *ap,
2747 struct mv_crpb *response, unsigned int tag, int ncq_enabled) 2746 struct mv_crpb *response, unsigned int tag, int ncq_enabled)
2748{ 2747{
2749 u8 ata_status; 2748 u8 ata_status;
2750 u16 edma_status = le16_to_cpu(response->flags); 2749 u16 edma_status = le16_to_cpu(response->flags);
2751 struct ata_queued_cmd *qc = ata_qc_from_tag(ap, tag);
2752
2753 if (unlikely(!qc)) {
2754 ata_port_printk(ap, KERN_ERR, "%s: no qc for tag=%d\n",
2755 __func__, tag);
2756 return;
2757 }
2758 2750
2759 /* 2751 /*
2760 * edma_status from a response queue entry: 2752 * edma_status from a response queue entry:
@@ -2768,13 +2760,14 @@ static void mv_process_crpb_response(struct ata_port *ap,
2768 * Error will be seen/handled by 2760 * Error will be seen/handled by
2769 * mv_err_intr(). So do nothing at all here. 2761 * mv_err_intr(). So do nothing at all here.
2770 */ 2762 */
2771 return; 2763 return false;
2772 } 2764 }
2773 } 2765 }
2774 ata_status = edma_status >> CRPB_FLAG_STATUS_SHIFT; 2766 ata_status = edma_status >> CRPB_FLAG_STATUS_SHIFT;
2775 if (!ac_err_mask(ata_status)) 2767 if (!ac_err_mask(ata_status))
2776 ata_qc_complete(qc); 2768 return true;
2777 /* else: leave it for mv_err_intr() */ 2769 /* else: leave it for mv_err_intr() */
2770 return false;
2778} 2771}
2779 2772
2780static void mv_process_crpb_entries(struct ata_port *ap, struct mv_port_priv *pp) 2773static void mv_process_crpb_entries(struct ata_port *ap, struct mv_port_priv *pp)
@@ -2783,6 +2776,7 @@ static void mv_process_crpb_entries(struct ata_port *ap, struct mv_port_priv *pp
2783 struct mv_host_priv *hpriv = ap->host->private_data; 2776 struct mv_host_priv *hpriv = ap->host->private_data;
2784 u32 in_index; 2777 u32 in_index;
2785 bool work_done = false; 2778 bool work_done = false;
2779 u32 done_mask = 0;
2786 int ncq_enabled = (pp->pp_flags & MV_PP_FLAG_NCQ_EN); 2780 int ncq_enabled = (pp->pp_flags & MV_PP_FLAG_NCQ_EN);
2787 2781
2788 /* Get the hardware queue position index */ 2782 /* Get the hardware queue position index */
@@ -2803,15 +2797,19 @@ static void mv_process_crpb_entries(struct ata_port *ap, struct mv_port_priv *pp
2803 /* Gen II/IIE: get command tag from CRPB entry */ 2797 /* Gen II/IIE: get command tag from CRPB entry */
2804 tag = le16_to_cpu(response->id) & 0x1f; 2798 tag = le16_to_cpu(response->id) & 0x1f;
2805 } 2799 }
2806 mv_process_crpb_response(ap, response, tag, ncq_enabled); 2800 if (mv_process_crpb_response(ap, response, tag, ncq_enabled))
2801 done_mask |= 1 << tag;
2807 work_done = true; 2802 work_done = true;
2808 } 2803 }
2809 2804
2810 /* Update the software queue position index in hardware */ 2805 if (work_done) {
2811 if (work_done) 2806 ata_qc_complete_multiple(ap, ap->qc_active ^ done_mask);
2807
2808 /* Update the software queue position index in hardware */
2812 writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) | 2809 writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) |
2813 (pp->resp_idx << EDMA_RSP_Q_PTR_SHIFT), 2810 (pp->resp_idx << EDMA_RSP_Q_PTR_SHIFT),
2814 port_mmio + EDMA_RSP_Q_OUT_PTR); 2811 port_mmio + EDMA_RSP_Q_OUT_PTR);
2812 }
2815} 2813}
2816 2814
2817static void mv_port_intr(struct ata_port *ap, u32 port_cause) 2815static void mv_port_intr(struct ata_port *ap, u32 port_cause)