Over-Current detection reported later when OC removed

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Over-Current detection reported later when OC removed

549 Views
wzairi
Contributor I

Hi All, 

We are testing over-current detection on Linux-imx 4.19.35 kernel over imx6s . the OC kernel message "usb usb2-port1: over-current condition" is reported only we when remove the OC from USB pins (VCC/GND) but not when applied .

When apply an OC ,the kernel report a portchange but when reading the port status it doesn't match an USB_PORT_STAT_OVERCURRENT but only when removing OC from USB pins (on the next portchange event) later.

Here kernel messages :

When OC applied :
[ 504.688638] usb usb2: usb wakeup-resume
[ 504.692729] hub 2-0:1.0: hub_resume
[ 504.696352] hub 2-0:1.0: state 7 ports 1 chg 0002 evt 0000
[ 504.707508] usb usb2-port1: over-current change #1
[ 504.831475] hub 2-0:1.0: enabling power on all ports
[ 504.951552] usb usb2-port1: status 0100, change 0008, 12 Mb/s
[ 504.957354] hub 2-0:1.0: state 7 ports 1 chg 0000 evt 0000
[ 504.967493] hub 2-0:1.0: hub_suspend

When OC removed:
[ 507.557030] usb usb2: usb wakeup-resume
[ 507.560906] hub 2-0:1.0: hub_resume
[ 507.569719] hub 2-0:1.0: state 7 ports 1 chg 0002 evt 0000
[ 507.577432] usb usb2-port1: over-current change #2
[ 507.701476] hub 2-0:1.0: enabling power on all ports
[ 507.821540] usb usb2-port1: over-current condition
[ 507.826374] usb usb2-port1: status 0000, change 0008, 12 Mb/s
[ 507.832939] hub 2-0:1.0: state 7 ports 1 chg 0000 evt 0000
[ 507.838469] hub 2-0:1.0: hub_suspend


Here code from core/hub.c :


if (portchange & USB_PORT_STAT_C_OVERCURRENT) {
u16 status = 0, unused;
port_dev->over_current_count++;

dev_dbg(&port_dev->dev, "over-current change #%u\n",
port_dev->over_current_count);
usb_clear_port_feature(hdev, port1,
USB_PORT_FEAT_C_OVER_CURRENT);
msleep(100); /* Cool down */
hub_power_on(hub, true);
hub_port_status(hub, port1, &status, &unused);
if (status & USB_PORT_STAT_OVERCURRENT)
dev_err(&port_dev->dev, "over-current condition\n");
}

Here related device-tree node :

&usbotg {
vbus-supply = <&reg_usb_otg_vbus>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usbotg_t>;
dr_mode = "otg";
status = "okay";
};

pinctrl_usbotg_t: usbotggrp {
fsl,pins = <
MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0xb0
MX6QDL_PAD_KEY_COL4__USB_OTG_OC 0x1b0b0
>;
};


Have you please an idea about this issue ? Are we missing some polarity configs on dts ?

Thank you !

0 Kudos
1 Reply

486 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

You may refer to the following post for this:

https://community.nxp.com/t5/i-MX-Processors/iMX6-USB-OC-functionality/m-p/326129

 

Best regards,

Aldo.

0 Kudos