Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
[pandora-kernel.git] / drivers / scsi / isci / phy.c
index 79313a7..35f50c2 100644 (file)
@@ -104,6 +104,7 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy,
        u32 parity_count = 0;
        u32 llctl, link_rate;
        u32 clksm_value = 0;
+       u32 sp_timeouts = 0;
 
        iphy->link_layer_registers = reg;
 
@@ -211,6 +212,18 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy,
        llctl |= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE, link_rate);
        writel(llctl, &iphy->link_layer_registers->link_layer_control);
 
+       sp_timeouts = readl(&iphy->link_layer_registers->sas_phy_timeouts);
+
+       /* Clear the default 0x36 (54us) RATE_CHANGE timeout value. */
+       sp_timeouts &= ~SCU_SAS_PHYTOV_GEN_VAL(RATE_CHANGE, 0xFF);
+
+       /* Set RATE_CHANGE timeout value to 0x3B (59us).  This ensures SCU can
+        * lock with 3Gb drive when SCU max rate is set to 1.5Gb.
+        */
+       sp_timeouts |= SCU_SAS_PHYTOV_GEN_VAL(RATE_CHANGE, 0x3B);
+
+       writel(sp_timeouts, &iphy->link_layer_registers->sas_phy_timeouts);
+
        if (is_a2(ihost->pdev)) {
                /* Program the max ARB time for the PHY to 700us so we inter-operate with
                 * the PMC expander which shuts down PHYs if the expander PHY generates too
@@ -695,7 +708,7 @@ enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
                                 __func__,
                                 event_code);
 
-                       return SCI_FAILURE;;
+                       return SCI_FAILURE;
                }
                return SCI_SUCCESS;
        case SCI_PHY_SUB_AWAIT_SATA_SPEED_EN:
@@ -1300,6 +1313,17 @@ int isci_phy_control(struct asd_sas_phy *sas_phy,
                ret = isci_port_perform_hard_reset(ihost, iport, iphy);
 
                break;
+       case PHY_FUNC_GET_EVENTS: {
+               struct scu_link_layer_registers __iomem *r;
+               struct sas_phy *phy = sas_phy->phy;
+
+               r = iphy->link_layer_registers;
+               phy->running_disparity_error_count = readl(&r->running_disparity_error_count);
+               phy->loss_of_dword_sync_count = readl(&r->loss_of_sync_error_count);
+               phy->phy_reset_problem_count = readl(&r->phy_reset_problem_count);
+               phy->invalid_dword_count = readl(&r->invalid_dword_counter);
+               break;
+       }
 
        default:
                dev_dbg(&ihost->pdev->dev,