Browse Source

pinctrl: starfive: Set up usb overcurrent signal

For devkit HW design, there is not GPIO specific
for the usb controller overcurrent signal.
Config the sys iomux register to hardwire this
signal, so that the usb controller can work normally.

Signed-off-by: Mason Huo <mason.huo@starfivetech.com>
Mason Huo 1 year ago
parent
commit
9572aaa976
1 changed files with 14 additions and 1 deletions
  1. 14 1
      drivers/pinctrl/starfive/pinctrl-jh7110-sys.c

+ 14 - 1
drivers/pinctrl/starfive/pinctrl-jh7110-sys.c

@@ -376,10 +376,23 @@ const struct starfive_pinctrl_soc_info jh7110_sys_pinctrl_info = {
 
 static int jh7110_sys_pinctrl_probe(struct udevice *dev)
 {
+	u32 value;
+	int ret;
 	struct starfive_pinctrl_soc_info *info =
 		(struct starfive_pinctrl_soc_info *)dev_get_driver_data(dev);
+	struct starfive_pinctrl_priv *priv = dev_get_priv(dev);
+
+	ret = starfive_pinctrl_probe(dev, info);
+
+	/* Set up the usb controller overcurrent signal. */
+	if (!ret) {
+		value = readl(priv->base + JH7110_SYS_GPI);
+		value &= ~(0x7f << 16);
+		value |= BIT(16);
+		writel(value, priv->base + JH7110_SYS_GPI);
+	}
 
-	return starfive_pinctrl_probe(dev, info);
+	return ret;
 }
 
 static const struct udevice_id jh7110_sys_pinctrl_ids[] = {