summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2021-03-31 17:19:23 +0200
committerMax Krummenacher <max.krummenacher@toradex.com>2021-04-01 12:19:55 +0200
commitb00879d2cccef63594f4b2c5cadebcbd311e7e97 (patch)
treef6f8b72142a22aa80ab786dfc5b0929a732b9adf
parent99b7735d300f0fae25382a298c945e87464e2967 (diff)
colibri-imx8x: hardcode the on module usb hub to bypass mode
The on module USB hub connects upstream to SoC USB_OTG2 and provides two downstream ports, one to the on module Wi-Fi, one to the SODIMM connector. In bypass mode the upstream port is directly connected to the SODIMM connector pins. Related-to: ELB-3853 Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
-rw-r--r--board/toradex/colibri-imx8x/colibri-imx8x.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/board/toradex/colibri-imx8x/colibri-imx8x.c b/board/toradex/colibri-imx8x/colibri-imx8x.c
index 9098815424..5bc4fba5b9 100644
--- a/board/toradex/colibri-imx8x/colibri-imx8x.c
+++ b/board/toradex/colibri-imx8x/colibri-imx8x.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0+
/*
- * Copyright 2018-2019 Toradex
+ * Copyright 2018-2021 Toradex
*/
#include <common.h>
#include <cpu_func.h>
@@ -20,6 +20,7 @@
#include <asm/arch/iomux.h>
#include <asm/arch/sys_proto.h>
+#include <i2c.h>
#include <power-domain.h>
#include <usb.h>
@@ -125,8 +126,52 @@ int board_phy_config(struct phy_device *phydev)
}
#endif
+#define I2C_ONMODULE_BUS 0
+#define I2C_GPIO_EXPANDER 0x43
+#define FXL6408_REG_IODIR 0x3
+#define FXL6408_REG_OUTPUT 0x5
+#define FXL6408_REG_OPENDR 0x7
+/*
+ * On-module GPIO expander FXL6408 drives management signals for
+ * on-module USB Hub.
+ */
+static void init_gpio_expander(void)
+{
+#ifdef CONFIG_DM_I2C
+ struct udevice *dev;
+ int ret;
+ u8 temp;
+
+ ret = i2c_get_chip_for_busnum(I2C_ONMODULE_BUS, I2C_GPIO_EXPANDER,
+ 1, &dev);
+ if (ret) {
+ printf("%s: Cannot find dev %d on I2C bus %d\n", __func__,
+ I2C_GPIO_EXPANDER, I2C_ONMODULE_BUS);
+ return;
+ }
+
+ /*
+ * On-module USB3803 Hub has bypass mode. It connects
+ * directly its upstream PHY with its downstream PHY#3 port which then
+ * goes to the carrier board USBH port.
+ * Turn on the Bypass# and deassert the Reset# signals,
+ * i.e. BYPASS_N = 0, RESET_N = 1
+ * Refer to
+ * https://www.onsemi.com/pdf/datasheet/fxl6408-d.pdf, Page 9
+ */
+ temp = 0x30; /* set GPIO 4 and 5 as output */
+ dm_i2c_write(dev, 3, &temp, 1);
+ temp = 0xcf; /* take GPIO 4 and 5 out of tristate */
+ dm_i2c_write(dev, 7, &temp, 1);
+ temp = 0x10; /* set GPIO 4=1 and GPIO5=0 */
+ dm_i2c_write(dev, 5, &temp, 1);
+#endif
+}
+
int board_init(void)
{
+ init_gpio_expander();
+
gpio_request(USB_CDET_GPIO, "usb_cdet");
#ifdef CONFIG_SNVS_SEC_SC_AUTO