usb3: a38x: add USB3 configuration register update for USB3 Device
When USB3 device is enabled (SatR field 'usb3port0' or 'usb3port1' is 1)
update configuration register (0x18420):
- BIT0 (USB3 Device UTMI En) -> 1 : USB3 Device enabled
- BIT1 (USB3 Device UTMI Mux) -> 0 : UTMI2: USB3 Device is on UTMI2
Change-Id: I82f3d37596528749cd33ccceb84b9679b773dc2d
Signed-off-by: Bassel Saba <basselsa@marvell.com>
Reviewed-on: http://vgitil04.il.marvell.com:8080/20281
Tested-by: Star_Automation <star@marvell.com>
Reviewed-by: Omri Itach <omrii@marvell.com>
diff --git a/tools/marvell/bin_hdr/platform/sysEnv/a38x/mvSysEnvLib.h b/tools/marvell/bin_hdr/platform/sysEnv/a38x/mvSysEnvLib.h
index 0092350..218fb0a 100755
--- a/tools/marvell/bin_hdr/platform/sysEnv/a38x/mvSysEnvLib.h
+++ b/tools/marvell/bin_hdr/platform/sysEnv/a38x/mvSysEnvLib.h
@@ -91,6 +91,8 @@
#define QSGMII_CONTROL_REG1 0x18494
+#define USB3_CONFIG_REG 0x18420
+
#define DBG_PORT_CONFIG_REG 0x186c0
#define DBG_PORT_CONFIG2_REG 0x186c4
diff --git a/tools/marvell/bin_hdr/src_phy/a38x/mvHighSpeedEnvSpec.c b/tools/marvell/bin_hdr/src_phy/a38x/mvHighSpeedEnvSpec.c
index d70937c..bc8e7e4 100755
--- a/tools/marvell/bin_hdr/src_phy/a38x/mvHighSpeedEnvSpec.c
+++ b/tools/marvell/bin_hdr/src_phy/a38x/mvHighSpeedEnvSpec.c
@@ -1296,6 +1296,32 @@
return mvHwsCtrlHighSpeedSerdesPhyConfig(); // stub
}
+/**************************************************************************
+* updateUsb3DeviceConfig
+* DESCRIPTION: Update USB3 configuration register if USB3 device is enabled
+* INPUT:
+* topologyConfigPtr - pointer to the Serdes mapping
+*
+***************************************************************************/
+void updateUsb3DeviceConfig(SERDES_MAP *serdesMapArray)
+{
+ MV_U32 laneNum;
+ for (laneNum = 0; laneNum < mvHwsSerdesGetMaxLane(); laneNum++) {
+ if (serdesMapArray[laneNum].serdesType == USB3_DEVICE) {
+ /* write 0x1 to USB3_CONFIG_REG[0:1]
+ * BIT0 (USB3 Device UTMI En) 0 : USB3 Device disabled.
+ * (USB2 on UTMI0, and USB3 Host1 on UTMI2)
+ * -> 1 : USB3 Device enabled
+ *
+ * BIT1 (USB3 Device UTMI Mux) -> 0 : UTMI2: USB3 Device is on UTMI2
+ * 1 : UTMI0: USB3 Device is on UTMI0 */
+ MV_REG_BIT_RESET(USB3_CONFIG_REG, BIT1);
+ MV_REG_BIT_SET(USB3_CONFIG_REG, BIT0);
+ return;
+ }
+ }
+}
+
/***************************************************************************/
static MV_STATUS mvSerdesPexUsb3PipeDelayWA(MV_U32 serdesNum, MV_U8 serdesType)
{
diff --git a/tools/marvell/bin_hdr/src_phy/a38x/mvHighSpeedEnvSpec.h b/tools/marvell/bin_hdr/src_phy/a38x/mvHighSpeedEnvSpec.h
index 5ee22b0..1423807 100755
--- a/tools/marvell/bin_hdr/src_phy/a38x/mvHighSpeedEnvSpec.h
+++ b/tools/marvell/bin_hdr/src_phy/a38x/mvHighSpeedEnvSpec.h
@@ -604,4 +604,13 @@
* RETURNS: True if lane is active
***************************************************************************/
MV_BOOL mvHwsIsSerdesActive(MV_U8 laneNum);
+
+/**************************************************************************
+* updateUsb3DeviceConfig
+* DESCRIPTION: Update USB3 configuration register if USB3 device is enabled
+* INPUT:
+* topologyConfigPtr - pointer to the Serdes mapping
+*
+***************************************************************************/
+void updateUsb3DeviceConfig(SERDES_MAP *serdesMapArray);
#endif /* _MV_HIGHSPEED_ENV_SPEC_H */
diff --git a/tools/marvell/bin_hdr/src_phy/a38x/mvHighSpeedTopologySpec-38x.c b/tools/marvell/bin_hdr/src_phy/a38x/mvHighSpeedTopologySpec-38x.c
index fbf036b..5437807 100755
--- a/tools/marvell/bin_hdr/src_phy/a38x/mvHighSpeedTopologySpec-38x.c
+++ b/tools/marvell/bin_hdr/src_phy/a38x/mvHighSpeedTopologySpec-38x.c
@@ -113,6 +113,7 @@
serdesMapArray[laneNum].swapTx = CustomerBoardTopologyConfig[boardIdIndex][laneNum].swapTx;
}
+ updateUsb3DeviceConfig(serdesMapArray);
return MV_OK;
}
@@ -920,6 +921,8 @@
/* update 'sgmiispeed' settings */
updateTopologySgmiiSpeed(serdesMapArray);
+ /* update USB3 config register */
+ updateUsb3DeviceConfig(serdesMapArray);
return MV_OK;
}
@@ -932,7 +935,6 @@
SERDES_MAP* topologyConfigPtr;
MV_U8 twsiData;
MV_U8 usb3Host0OrDevice = 0, usb3Host1OrDevice = 0;
-
mvPrintf("\nInitialize DB-88F6820-BP board topology\n");
/* Getting the relevant topology mode (index) */
@@ -983,6 +985,8 @@
/* update 'sgmiispeed' settings */
updateTopologySgmiiSpeed(serdesMapArray);
+ /* update USB3 config register */
+ updateUsb3DeviceConfig(serdesMapArray);
return MV_OK;
}