USB Overcurrent Debug
USB overcurrent indicates that the current limit of the USB port has been exceeded.
Many electronic devices have a rated current, once the current has been exceeded the device may be burned out. So these devices are equipped with current protection modules. When it exceeds the set current, the device powers off automatically to protect the device, which is called overcurrent protection.
For example, if the USB port of the development board is used to power the device and there is a high current surge, the development board will protect the USB port itself, causing the USB port to be unavailable.
On JH7110, the USB host has an OC signal to detect the USB signal. If the signal is not connected, JH7110 will judge that the USB port is in an overcurrent state, causing it to be unusable.
- Enable USB host mode by configuring the node of the USB controller in the DTS
file of the kernel, and remove overcurrent pinctrl. The following is an
example:The original node:
usb_pins: usb-pins { drive-vbus-pin { starfive,pins = <PAD_GPIO33>; starfive,pinmux = <PAD_GPIO33_FUNC_SEL 0>; starfive,pin-ioconfig = <IO(GPIO_IE(1))>; starfive,pin-gpio-dout = <GPO_HIGH>; starfive,pin-gpio-doen = <OEN_LOW>; }; overcurrent-pin { starfive,pins = <PAD_GPIO34>; starfive,pinmux = <PAD_GPIO34_FUNC_SEL 0>; starfive,pin-ioconfig = <IO(GPIO_IE(1))>; starfive,pin-gpio-din = <GPI_USB0_OVERCURRENT_N_IO>; starfive,pin-gpio-doen = <OEN_HIGH>; }; }; &usbdrd30 { pinctrl-names = "default"; dr_mode = "host"; /*host or peripheral*/ status = "disabled"; };
Modified node:usb_pins: usb-pins { drive-vbus-pin { starfive,pins = <PAD_GPIO33>; starfive,pinmux = <PAD_GPIO33_FUNC_SEL 0>; starfive,pin-ioconfig = <IO(GPIO_IE(1))>; starfive,pin-gpio-dout = <GPO_HIGH>; starfive,pin-gpio-doen = <OEN_LOW>; }; }; &usbdrd30 { pinctrl-names = "default"; dr_mode = "host"; /*host or peripheral*/ status = "okay"; };
- Set up USB overcurrent signal by configuring
sys iomux
register.value = readl(priv->base + JH7110_SYS_GPI); // priv->base:0x13040000; JH7110_SYS_GPI: 0x80 value &= ~(0x7f << 16); value |= BIT(16); writel(value, priv->base + JH7110_SYS_GPI);
Note: To avoid timing issues, please modify the above settings during the U-Boot phase.