Frank Wang f5281345b1 phy: rockchip: inno-usb2: Fix the controller's failure to set host mode
In USB Type-A ports with non-permanent VBUS power, switching mode from
device to host via debugfs API would cause the controller to briefly
enter host then revert to device. This happens because PHY sends an
extcon message while EXTCON_USB_HOST remains false, so set
EXTCON_USB_HOST to true during the mode-setting process to fix it.

Serial logs show the following when debug is enabled in the PHY driver:

[  110.130678s][  T197]Workqueue: events rockchip_usb2phy_otg_sm_work
[  110.130682s][  T197]Call trace:
[  110.130688s][  T197] dump_backtrace+0x0/0x1dc
[  110.130693s][  T197] show_stack+0x18/0x24
[  110.130698s][  T197] dump_stack_lvl+0xe4/0x12c
[  110.130701s][  T197] dump_stack+0x18/0x3c
[  110.130705s][  T197] rockchip_usb2phy_otg_sm_work+0x40/0x5ec
[  110.130709s][  T197] process_one_work+0x22c/0x510
[  110.130712s][  T197] worker_thread+0x280/0x4ec
[  110.130716s][  T197] kthread+0x138/0x200
[  110.130720s][  T197] ret_from_fork+0x10/0x18
[  110.130727s][  T197]phy phy-fd5d0000.syscon:usb2-phy@0.0: b_peripheral otg sm work
[  110.130731s][  T197]phy phy-fd5d0000.syscon:usb2-phy@0.0: usb otg host connect
[  110.130736s][  T197]phy phy-fd5d0000.syscon:usb2-phy@0.0: extcon set cable(7) as 0
[  110.130817s][  T197]phy phy-fd5d0000.syscon:usb2-phy@0.0: extcon set cable(1) as 0
[  110.130834s][  T197]CPU: 6 PID: 197 Comm: kworker/6:3 VIP: 00 Tainted: G        W         5.10.226 #1
[  110.130837s][  T197]Hardware name: CDC710_SOCA_VA_BOM9_M_001_FACTORY (DT)
[  110.130841s][  T197]Workqueue: events rockchip_usb2phy_otg_sm_work
[  110.130845s][  T197]Call trace:
[  110.130848s][  T197] dump_backtrace+0x0/0x1dc
[  110.130853s][  T197] show_stack+0x18/0x24
[  110.130856s][  T197] dump_stack_lvl+0xe4/0x12c
[  110.130859s][  T197] dump_stack+0x18/0x3c
[  110.130864s][  T197] dwc3_set_mode+0x20/0x7c
[  110.130869s][  T197] dwc3_drd_notifier+0x68/0x7c
[  110.130873s][  T197] raw_notifier_call_chain+0x40/0x6c
[  110.130878s][  T197] extcon_sync+0x124/0x2e0
[  110.130882s][  T197] rockchip_usb2phy_otg_sm_work+0x480/0x5ec
[  110.130886s][  T197] process_one_work+0x22c/0x510
[  110.130889s][  T197] worker_thread+0x280/0x4ec
[  110.130893s][  T197] kthread+0x138/0x200
[  110.130896s][  T197] ret_from_fork+0x10/0x18
[  110.130920s][  T197]CPU: 6 PID: 197 Comm: kworker/6:3 VIP: 00 Tainted: G        W         5.10.226 #1
[  110.130923s][  T197]Hardware name: CDC710_SOCA_VA_BOM9_M_001_FACTORY (DT)
[  110.130926s][  T197]Workqueue: events_freezable __dwc3_set_mode
[  110.130930s][  T197]Call trace:
[  110.130934s][  T197] dump_backtrace+0x0/0x1dc
[  110.130938s][  T197] show_stack+0x18/0x24
[  110.130941s][  T197] dump_stack_lvl+0xe4/0x12c
[  110.130944s][  T197] dump_stack+0x18/0x3c
[  110.130947s][  T197] __dwc3_set_mode+0x2c/0xb54
[  110.130951s][  T197] process_one_work+0x22c/0x510
[  110.130954s][  T197] worker_thread+0x280/0x4ec
[  110.130958s][  T197] kthread+0x138/0x200
[  110.130962s][  T197] ret_from_fork+0x10/0x18
[  110.130971s][  T197]dwc->desired_role_sw_mode = 0
[  110.130974s][  T197]dwc->current_role_sw_mode = 1
[  110.131024s][  T197]xhci-hcd xhci-hcd.10.auto: remove, state 4
[  110.131028s][  T197]xhci-hcd xhci-hcd.10.auto: roothub graceful disconnect
[  110.131035s][  T197]usb usb4: USB disconnect, device number 1

Change-Id: I7b0a2f8161eb52fd145f145f398586526ab1006b
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2025-09-12 18:07:40 +08:00
2025-07-07 19:57:35 +08:00
2025-07-07 19:57:35 +08:00
2025-07-07 19:57:35 +08:00
2025-07-07 19:57:35 +08:00
2025-07-07 19:57:35 +08:00
2025-07-07 19:57:35 +08:00
2025-07-07 19:57:35 +08:00
2025-01-10 17:48:57 +08:00
2025-06-04 14:40:26 +02:00

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.
Description
No description provided
Readme 7.9 GiB
Languages
C 97.7%
Assembly 1.6%
Makefile 0.3%
Perl 0.1%