drivers: net: ipq6018: Fix uniphy soft reset
This patch updates the uniphy soft reset function
to do the reset based on uniphy index only for the
required ports.
Change-Id: I7078b7f1e53fd86f32ec213dffe1eeebd5c702ad
Signed-off-by: speriaka <speriaka@codeaurora.org>
diff --git a/drivers/net/ipq6018/ipq6018_uniphy.c b/drivers/net/ipq6018/ipq6018_uniphy.c
index 35687a6..47812a6 100644
--- a/drivers/net/ipq6018/ipq6018_uniphy.c
+++ b/drivers/net/ipq6018/ipq6018_uniphy.c
@@ -93,30 +93,23 @@
reg_value = readl(GCC_UNIPHY0_MISC + (uniphy_index * GCC_UNIPHY_REG_INC));
- reg_value |= GCC_UNIPHY_PSGMII_SOFT_RESET;
+ if (uniphy_index == 0)
+ reg_value |= GCC_UNIPHY_PSGMII_SOFT_RESET;
+ else
+ reg_value |= GCC_UNIPHY_SGMII_SOFT_RESET;
+
writel(reg_value, GCC_UNIPHY0_MISC + (uniphy_index * GCC_UNIPHY_REG_INC));
udelay(500);
- reg_value &= ~GCC_UNIPHY_PSGMII_SOFT_RESET;
+ if (uniphy_index == 0)
+ reg_value &= ~GCC_UNIPHY_PSGMII_SOFT_RESET;
+ else
+ reg_value &= ~GCC_UNIPHY_SGMII_SOFT_RESET;
+
writel(reg_value, GCC_UNIPHY0_MISC + (uniphy_index * GCC_UNIPHY_REG_INC));
}
-static void ppe_gcc_uniphy_sgmii_soft_reset(uint32_t uniphy_index)
-{
- uint32_t reg_value;
-
- reg_value = readl(GCC_UNIPHY0_MISC + (uniphy_index * GCC_UNIPHY_REG_INC));
-
- reg_value |= GCC_UNIPHY_SGMII_SOFT_RESET;
- writel(reg_value, GCC_UNIPHY0_MISC + (uniphy_index * GCC_UNIPHY_REG_INC));
- mdelay(100);
-
- reg_value &= ~GCC_UNIPHY_SGMII_SOFT_RESET;
- writel(reg_value, GCC_UNIPHY0_MISC + (uniphy_index * GCC_UNIPHY_REG_INC));
- mdelay(100);
-}
-
static void ppe_uniphy_psgmii_mode_set(uint32_t uniphy_index)
{
ppe_gcc_uniphy_xpcs_reset(uniphy_index, true);
@@ -183,7 +176,7 @@
break;
}
- ppe_gcc_uniphy_sgmii_soft_reset(uniphy_index);
+ ppe_gcc_uniphy_soft_reset(uniphy_index);
if (uniphy_index == 0) {
writel(0x1, GCC_UNIPHY0_PORT4_RX_CBCR);
diff --git a/drivers/net/ipq6018/ipq6018_uniphy.h b/drivers/net/ipq6018/ipq6018_uniphy.h
index 04151ef..4763fd2 100644
--- a/drivers/net/ipq6018/ipq6018_uniphy.h
+++ b/drivers/net/ipq6018/ipq6018_uniphy.h
@@ -32,7 +32,6 @@
#define UNIPHY_CALIBRATION_DONE 0x1
#define GCC_UNIPHY_PSGMII_SOFT_RESET 0x3ff2
-#define GCC_UNIPHY_USXGMII_SOFT_RESET 0x36
#define GCC_UNIPHY_SGMII_SOFT_RESET 0x32
#define PPE_UNIPHY_BASE 0X07A00000