USB hub port status change with linux-imx 6.1.x and imx7d

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

USB hub port status change with linux-imx 6.1.x and imx7d

250 次查看
afperry
Contributor I

We are running a kernel based on the linux-imx repo on imx7d. When we plug in a USB hub (including one that is just a Type C to Type A adapter), the hub is recognized and any device attached to the port is not. Investigating the problem, I have found that the port status is always 0 and there is no port status change when connecting/disconnecting a device.

Connecting devices directly to the port works fine, but not when through a hub and we have USB storage devices that we use for admin tasks on the units that the imx7d is in that connect through an adapter that is a hub.

This is a problem with the 6.1.x kernel but not the 4.9.x kernel.

Is there some kernel config or usb setting that I missed?

标签 (1)
0 项奖励
回复
5 回复数

33 次查看
afperry
Contributor I

It turned out that the problem is that there wasn't a clean way to tell the charger to send power out to USB when a bus-powered device was connected.

The chipidea hdrc code creates an EHCI controller host port instance but there isn't an appropriate hook in that code that can be used to do system-specific things once that instance has been created (like tell the charger to do OTG boost instead of battery charging).

In our old code, the charger driver registered to receive usb bus add and remove events and, if it was a specifically named bus, it would change the charger type as appropriate. This has to be done before the bus-powered device is connected or adding the device isn't detected at all.

There is an existing "notify event" callback, but I added a usb host setup callback that is implemented in the imx hdrc driver to call usb misc to call the charger driver to set the charge type.

0 项奖励
回复

94 次查看
afperry
Contributor I

So, it turns out that I was misinterpreting the logs. I was connecting USB Type A devices to a Type C connector through a hub. I thought that the log messages for a hub being attached were for that hub. But it was actually the root hub for the host controller. The actual problem that I am having is that none of the bus-powered devices are getting power. So, I am trying to figure out what I need to do to enable that.

0 项奖励
回复

187 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi

You can check the defconfig differences between 4.9 and 6.1

Best Regards
Zhiming

0 项奖励
回复

196 次查看
afperry
Contributor I

"Type flash drive" should be "Type A flash drive". Thanks, autocorrect!

0 项奖励
回复

210 次查看
afperry
Contributor I

I did more investigation and found that a new hub is being added even when I wouldn't expect it.

The normal issue is that I plug in the Type A to Type C adapter and a new hub instance is created. The last report from the hub driver is that its state is connected and the event and change bits are all 0. Then I plug in a Type flash drive into the adapter and there is no additional debug output, despite enabling debugging on most of the relevant USB driver source files.

Yesterday I got a Type C flash drive so that the adapter was not needed. When that is plugged in, a new hub instance is created, the same debugging output as above is displayed, and I see no debugging related to the flash drive.

0 项奖励
回复