[PATCH] phy: rockchip-inno-usb2: Sync initial otg state

Markus Reichl m.reichl at fivetechno.de
Tue Jul 26 01:54:49 PDT 2022


Hi Peter,
Am 22.06.22 um 02:31 schrieb Peter Geis:
> The initial otg state for the phy defaults to device mode. The actual
> state isn't detected until an ID IRQ fires. Fix this by syncing the ID
> state during initialization.
> 
> Fixes: 51a9b2c03dd3 ("phy: rockchip-inno-usb2: Handle ID IRQ")
> Signed-off-by: Peter Geis <pgwipeout at gmail.com>
> ---
>   drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> index 6711659f727c..6e44069617df 100644
> --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> @@ -1162,6 +1162,12 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
>   					EXTCON_USB_HOST, &rport->event_nb);
>   		if (ret)
>   			dev_err(rphy->dev, "register USB HOST notifier failed\n");
> +
> +		if (!of_property_read_bool(rphy->dev->of_node, "extcon")) {
> +			/* do initial sync of usb state */
> +			ret = property_enabled(rphy->grf, &rport->port_cfg->utmi_id);
> +			extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !ret);
> +		}
>   	}
>   
>   out:

with recent linux-next kernels, here with next-20220725 my rk3399-roc-pc does not 
boot. Bisecting pointed to this commit.
By reverting this commit the board boots again.

  2.431005] Unable to handle kernel NULL pointer dereference at virtual address 
0000000000000000
[    2.432152] Mem abort info:
[    2.432519]   ESR = 0x0000000086000004
[    2.433001]   EC = 0x21: IABT (current EL), IL = 32 bits
[    2.433674]   SET = 0, FnV = 0
[    2.434075]   EA = 0, S1PTW = 0
[    2.434484]   FSC = 0x04: level 0 translation fault
[    2.435102] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000001765000
[    2.435911] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000
[    2.436775] Internal error: Oops: 86000004 [#1] SMP
[    2.437397] Modules linked in: ip_tables x_tables ipv6 xhci_plat_hcd xhci_hcd 
rockchipdrm drm_cma_helper dwc3 analogix_dp dw_hdmi realtek dwc3_of_simple 
drm_display_helper dw_mipi_dsi drm_kms_helper syscopyarea ohci_platform ohci_hcd 
ehci_platform sysfillrect sysimgblt ehci_hcd dwmac_rk fb_sys_fops stmmac_platform 
stmmac pcs_xpcs phylink drm usbcore drm_panel_orientation_quirks
[    2.441651] CPU: 3 PID: 0 Comm: swapper/3 Not tainted 5.19.0-rc8-next-20220725 #417
[    2.442609] Hardware name: Firefly ROC-RK3399-PC Mezzanine Board (DT)
[    2.443415] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    2.444289] pc : 0x0
[    2.444594] lr : call_timer_fn.constprop.0+0x24/0x80
[    2.445247] sp : ffff800008f43a50
[    2.445678] x29: ffff800008f43a50 x28: 0000000000000005 x27: 0000000000000020
[    2.453334] x26: ffff000000646580 x25: ffff800008f43b00 x24: 0000000000000000
[    2.461028] x23: 0000000000000001 x22: 00000000000000e0 x21: 0000000000000100
[    2.466727] x20: ffff000000646580 x19: 0000000000000000 x18: ffff00000679e80c
[    2.471614] x17: ffff8000eec73000 x16: ffff800008d84000 x15: 0000000000004000
[    2.476524] x14: ffff000000646580 x13: ffff8000eec73000 x12: ffff0000f7786ef0
[    2.481408] x11: 0000000000000001 x10: 0000000000000000 x9 : 000000000000006d
[    2.486309] x8 : ffff0000f7786ea8 x7 : ffffffffffffffff x6 : 0000000000000000
[    2.491197] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff800008f43b00
[    2.496077] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0000018e0b10
[    2.500871] Call trace:
[    2.505098]  0x0
[    2.509249]  expire_timers+0xcc/0x100
[    2.513533]  run_timer_softirq+0x11c/0x300
[    2.517842]  _stext+0x124/0x2a4
[    2.522050]  __irq_exit_rcu+0xcc/0xfc
[    2.526289]  irq_exit_rcu+0x10/0x1c
[    2.530448]  el1_interrupt+0x38/0x54
[    2.534601]  el1h_64_irq_handler+0x18/0x24
[    2.538791]  el1h_64_irq+0x64/0x68
[    2.542892]  cpuidle_enter_state+0x130/0x2f0
[    2.547064]  cpuidle_enter+0x38/0x50
[    2.551167]  do_idle+0x228/0x2ac
[    2.555267]  cpu_startup_entry+0x24/0x30
[    2.559396]  secondary_start_kernel+0x124/0x140
[    2.563526]  __secondary_switched+0xb0/0xb4
[    2.567599] Code: bad PC value
[    2.571567] ---[ end trace 0000000000000000 ]---
[    2.575625] Kernel panic - not syncing: Oops: Fatal exception in interrupt
[    2.579901] SMP: stopping secondary CPUs
[    2.584020] Kernel Offset: disabled
[    2.587955] CPU features: 0x2000,0820b021,00001082
[    2.592000] Memory Limit: none
[    2.595844] ---[ end Kernel panic - not syncing: Oops: Fatal exception in 
interrupt ]---


Gruß,
-- 
Markus Reichl



More information about the Linux-rockchip mailing list