[SCSI] mvsas: fix 94xx hotplug issue
authorXiangliang Yu <yuxiangl@marvell.com>
Tue, 24 May 2011 14:33:11 +0000 (22:33 +0800)
committerJames Bottomley <JBottomley@Parallels.com>
Tue, 26 Jul 2011 06:34:13 +0000 (10:34 +0400)
Fix 94xx A0/B0 revision hotplug issue.
Remove unused macro: DISABLE_HOTPLUG_DMA_FIX

Signed-off-by: Xiangliang Yu <yuxiangl@marvell.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/mvsas/mv_64xx.c
drivers/scsi/mvsas/mv_94xx.c
drivers/scsi/mvsas/mv_init.c
drivers/scsi/mvsas/mv_sas.c
drivers/scsi/mvsas/mv_sas.h

index c88b8a7ed39892ae59d6cee0ba59568a6bdfac8d..b02dd800af38c22f945f1679afadca3de850fffd 100644 (file)
@@ -744,11 +744,13 @@ int mvs_64xx_spi_waitdataready(struct mvs_info *mvi, u32 timeout)
        return -1;
 }
 
-#ifndef DISABLE_HOTPLUG_DMA_FIX
-void mvs_64xx_fix_dma(dma_addr_t buf_dma, int buf_len, int from, void *prd)
+void mvs_64xx_fix_dma(struct mvs_info *mvi, u32 phy_mask,
+                               int buf_len, int from, void *prd)
 {
        int i;
        struct mvs_prd *buf_prd = prd;
+       dma_addr_t buf_dma = mvi->bulk_buffer_dma;
+
        buf_prd += from;
        for (i = 0; i < MAX_SG_ENTRY - from; i++) {
                buf_prd->addr = cpu_to_le64(buf_dma);
@@ -756,7 +758,6 @@ void mvs_64xx_fix_dma(dma_addr_t buf_dma, int buf_len, int from, void *prd)
                ++buf_prd;
        }
 }
-#endif
 
 static void mvs_64xx_tune_interrupt(struct mvs_info *mvi, u32 time)
 {
@@ -830,9 +831,7 @@ const struct mvs_dispatch mvs_64xx_dispatch = {
        mvs_64xx_spi_buildcmd,
        mvs_64xx_spi_issuecmd,
        mvs_64xx_spi_waitdataready,
-#ifndef DISABLE_HOTPLUG_DMA_FIX
        mvs_64xx_fix_dma,
-#endif
        mvs_64xx_tune_interrupt,
        NULL,
 };
index e589f31cb2b47131ce662a81561be9383208d16b..ef3c9012df46a656adca496b9973043fef5c493e 100644 (file)
@@ -871,19 +871,27 @@ int mvs_94xx_spi_waitdataready(struct mvs_info *mvi, u32 timeout)
        return -1;
 }
 
-#ifndef DISABLE_HOTPLUG_DMA_FIX
-void mvs_94xx_fix_dma(dma_addr_t buf_dma, int buf_len, int from, void *prd)
+void mvs_94xx_fix_dma(struct mvs_info *mvi, u32 phy_mask,
+                               int buf_len, int from, void *prd)
 {
        int i;
        struct mvs_prd *buf_prd = prd;
+       dma_addr_t buf_dma;
        buf_prd += from;
+
+       if ((mvi->pdev->revision == VANIR_A0_REV) ||
+                       (mvi->pdev->revision == VANIR_B0_REV))
+               buf_dma = (phy_mask <= 0x08) ?
+                               mvi->bulk_buffer_dma : mvi->bulk_buffer_dma1;
+       else
+               return;
+
        for (i = 0; i < MAX_SG_ENTRY - from; i++) {
                buf_prd->addr = cpu_to_le64(buf_dma);
                buf_prd->im_len.len = cpu_to_le32(buf_len);
                ++buf_prd;
        }
 }
-#endif
 
 /*
  * FIXME JEJB: temporary nop clear_srs_irq to make 94xx still work
@@ -967,9 +975,7 @@ const struct mvs_dispatch mvs_94xx_dispatch = {
        mvs_94xx_spi_buildcmd,
        mvs_94xx_spi_issuecmd,
        mvs_94xx_spi_waitdataready,
-#ifndef DISABLE_HOTPLUG_DMA_FIX
        mvs_94xx_fix_dma,
-#endif
        mvs_94xx_tune_interrupt,
        mvs_94xx_non_spec_ncq_error,
 };
index 531093ddc418588a3ed6ede5bfe33d61e98681c1..b111ae2ec48901aaa3a3204c231e3cf9edb6c08f 100644 (file)
@@ -153,11 +153,13 @@ static void mvs_free(struct mvs_info *mvi)
                dma_free_coherent(mvi->dev,
                                  sizeof(*mvi->slot) * slot_nr,
                                  mvi->slot, mvi->slot_dma);
-#ifndef DISABLE_HOTPLUG_DMA_FIX
+
        if (mvi->bulk_buffer)
                dma_free_coherent(mvi->dev, TRASH_BUCKET_SIZE,
                                  mvi->bulk_buffer, mvi->bulk_buffer_dma);
-#endif
+       if (mvi->bulk_buffer1)
+               dma_free_coherent(mvi->dev, TRASH_BUCKET_SIZE,
+                                 mvi->bulk_buffer1, mvi->bulk_buffer_dma1);
 
        MVS_CHIP_DISP->chip_iounmap(mvi);
        if (mvi->shost)
@@ -278,13 +280,18 @@ static int __devinit mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost)
                goto err_out;
        memset(mvi->slot, 0, sizeof(*mvi->slot) * slot_nr);
 
-#ifndef DISABLE_HOTPLUG_DMA_FIX
        mvi->bulk_buffer = dma_alloc_coherent(mvi->dev,
                                       TRASH_BUCKET_SIZE,
                                       &mvi->bulk_buffer_dma, GFP_KERNEL);
        if (!mvi->bulk_buffer)
                goto err_out;
-#endif
+
+       mvi->bulk_buffer1 = dma_alloc_coherent(mvi->dev,
+                                      TRASH_BUCKET_SIZE,
+                                      &mvi->bulk_buffer_dma1, GFP_KERNEL);
+       if (!mvi->bulk_buffer1)
+               goto err_out;
+
        sprintf(pool_name, "%s%d", "mvs_dma_pool", mvi->id);
        mvi->dma_pool = pci_pool_create(pool_name, mvi->pdev, MVS_SLOT_BUF_SZ, 16, 0);
        if (!mvi->dma_pool) {
index aaa475a3eda6a8e23ad84c2ad95386199ae17b39..4585dc018ad122e3e469acc03569ee886d9e2589 100644 (file)
@@ -630,14 +630,11 @@ static int mvs_task_prep_ata(struct mvs_info *mvi,
                (mvi_dev->taskfileset << TXQ_SRS_SHIFT);
        mvi->tx[mvi->tx_prod] = cpu_to_le32(del_q);
 
-#ifndef DISABLE_HOTPLUG_DMA_FIX
        if (task->data_dir == DMA_FROM_DEVICE)
                flags = (MVS_CHIP_DISP->prd_count() << MCH_PRD_LEN_SHIFT);
        else
                flags = (tei->n_elem << MCH_PRD_LEN_SHIFT);
-#else
-       flags = (tei->n_elem << MCH_PRD_LEN_SHIFT);
-#endif
+
        if (task->ata_task.use_ncq)
                flags |= MCH_FPDMA;
        if (dev->sata_dev.command_set == ATAPI_COMMAND_SET) {
@@ -729,11 +726,11 @@ static int mvs_task_prep_ata(struct mvs_info *mvi,
 
        /* fill in PRD (scatter/gather) table, if any */
        MVS_CHIP_DISP->make_prd(task->scatter, tei->n_elem, buf_prd);
-#ifndef DISABLE_HOTPLUG_DMA_FIX
+
        if (task->data_dir == DMA_FROM_DEVICE)
-               MVS_CHIP_DISP->dma_fix(mvi->bulk_buffer_dma,
+               MVS_CHIP_DISP->dma_fix(mvi, sas_port->phy_mask,
                                TRASH_BUCKET_SIZE, tei->n_elem, buf_prd);
-#endif
+
        return 0;
 }
 
@@ -1283,6 +1280,13 @@ static u32 mvs_is_sig_fis_received(u32 irq_status)
        return irq_status & PHYEV_SIG_FIS;
 }
 
+static void mvs_sig_remove_timer(struct mvs_phy *phy)
+{
+       if (phy->timer.function)
+               del_timer(&phy->timer);
+       phy->timer.function = NULL;
+}
+
 void mvs_update_phyinfo(struct mvs_info *mvi, int i, int get_st)
 {
        struct mvs_phy *phy = &mvi->phy[i];
@@ -1305,6 +1309,7 @@ void mvs_update_phyinfo(struct mvs_info *mvi, int i, int get_st)
                if (phy->phy_type & PORT_TYPE_SATA) {
                        phy->identify.target_port_protocols = SAS_PROTOCOL_STP;
                        if (mvs_is_sig_fis_received(phy->irq_status)) {
+                               mvs_sig_remove_timer(phy);
                                phy->phy_attached = 1;
                                phy->att_dev_sas_addr =
                                        i + mvi->id * mvi->chip->n_phy;
@@ -1322,7 +1327,6 @@ void mvs_update_phyinfo(struct mvs_info *mvi, int i, int get_st)
                                                tmp | PHYEV_SIG_FIS);
                                phy->phy_attached = 0;
                                phy->phy_type &= ~PORT_TYPE_SATA;
-                               MVS_CHIP_DISP->phy_reset(mvi, i, 0);
                                goto out_done;
                        }
                }       else if (phy->phy_type & PORT_TYPE_SAS
@@ -2193,13 +2197,6 @@ static void mvs_sig_time_out(unsigned long tphy)
        }
 }
 
-static void mvs_sig_remove_timer(struct mvs_phy *phy)
-{
-       if (phy->timer.function)
-               del_timer(&phy->timer);
-       phy->timer.function = NULL;
-}
-
 void mvs_int_port(struct mvs_info *mvi, int phy_no, u32 events)
 {
        u32 tmp;
@@ -2263,7 +2260,6 @@ void mvs_int_port(struct mvs_info *mvi, int phy_no, u32 events)
        }
        if (phy->irq_status & (PHYEV_SIG_FIS | PHYEV_ID_DONE)) {
                phy->phy_status = mvs_is_phy_ready(mvi, phy_no);
-               mvs_sig_remove_timer(phy);
                mv_dprintk("notify plug in on phy[%d]\n", phy_no);
                if (phy->phy_status) {
                        mdelay(10);
index 089ef1ef386568239e0815331c276bd71027576e..5cfa4cc18f2d2f9773df01d749d5dcc4403ba22b 100644 (file)
@@ -168,9 +168,8 @@ struct mvs_dispatch {
                                                );
        int (*spi_issuecmd)(struct mvs_info *mvi, u32 cmd);
        int (*spi_waitdataready)(struct mvs_info *mvi, u32 timeout);
-#ifndef DISABLE_HOTPLUG_DMA_FIX
-       void (*dma_fix)(dma_addr_t buf_dma, int buf_len, int from, void *prd);
-#endif
+       void (*dma_fix)(struct mvs_info *mvi, u32 phy_mask,
+                               int buf_len, int from, void *prd);
        void (*tune_interrupt)(struct mvs_info *mvi, u32 time);
        void (*non_spec_ncq_error)(struct mvs_info *mvi);
 
@@ -409,11 +408,11 @@ struct mvs_info {
        void *addon;
        struct hba_info_page hba_info_param;
        struct mvs_device       devices[MVS_MAX_DEVICES];
-#ifndef DISABLE_HOTPLUG_DMA_FIX
        void *bulk_buffer;
        dma_addr_t bulk_buffer_dma;
+       void *bulk_buffer1;
+       dma_addr_t bulk_buffer_dma1;
 #define TRASH_BUCKET_SIZE      0x20000
-#endif
        void *dma_pool;
        struct mvs_slot_info slot_info[0];
 };