2022-06-22 00:56:22

by Peter Geis

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

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 <[email protected]>
---
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:
--
2.25.1


2022-06-22 05:26:08

by Samuel Holland

[permalink] [raw]
Subject: Re: [PATCH] phy: rockchip-inno-usb2: Sync initial otg state

On 6/21/22 7:31 PM, Peter Geis wrote:
> 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 <[email protected]>

One comment below. Either way it fixes a bug, so:

Reviewed-by: Samuel Holland <[email protected]>

> ---
> 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")) {

Currently the IRQ handler does not care who created the extcon. We should at
least be consistent between here and there.

Regards,
Samuel

> + /* 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:
>

2022-06-22 09:31:13

by Peter Geis

[permalink] [raw]
Subject: Re: [PATCH] phy: rockchip-inno-usb2: Sync initial otg state

On Wed, Jun 22, 2022 at 1:16 AM Samuel Holland <[email protected]> wrote:
>
> On 6/21/22 7:31 PM, Peter Geis wrote:
> > 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 <[email protected]>
>
> One comment below. Either way it fixes a bug, so:
>
> Reviewed-by: Samuel Holland <[email protected]>

Thanks!

>
> > ---
> > 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")) {
>
> Currently the IRQ handler does not care who created the extcon. We should at
> least be consistent between here and there.

We care in this instance because if there is an external extcon it is
responsible for setting the initial state. Our ID pin may or may not
be used in this case and if it isn't we would overwrite the initial
state with an invalid one.

>
> Regards,
> Samuel
>
> > + /* 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:
> >
>

2022-07-05 07:44:08

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH] phy: rockchip-inno-usb2: Sync initial otg state

On 21-06-22, 20:31, Peter Geis wrote:
> 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.

Applied, thanks

--
~Vinod

2022-07-26 08:59:00

by Markus Reichl

[permalink] [raw]
Subject: Re: [PATCH] phy: rockchip-inno-usb2: Sync initial otg state

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 <[email protected]>
> ---
> 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

2022-08-02 12:59:36

by Markus Reichl

[permalink] [raw]
Subject: [BUG BISECT] phy: rockchip-inno-usb2: Sync initial otg state

Hi,

with linux-next-20220728 rk3399-roc-pc does not boot.
Bisecting pointed to this commit.
By reverting this commit the board boots again.

[ 2.398700] Unable to handle kernel NULL pointer dereference at virtual address
0000000000000008
[ 2.399517] Mem abort info:
[ 2.399772] ESR = 0x0000000096000004
[ 2.400114] EC = 0x25: DABT (current EL), IL = 32 bits
[ 2.400594] SET = 0, FnV = 0
[ 2.400873] EA = 0, S1PTW = 0
[ 2.401161] FSC = 0x04: level 0 translation fault
[ 2.401602] Data abort info:
[ 2.401864] ISV = 0, ISS = 0x00000004
[ 2.402212] CM = 0, WnR = 0
[ 2.402484] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000001376000
[ 2.403071] [0000000000000008] pgd=0000000000000000, p4d=0000000000000000
[ 2.403687] Internal error: Oops: 96000004 [#1] SMP
[ 2.404130] Modules linked in: ip_tables x_tables ipv6 xhci_plat_hcd xhci_hcd
dwc3 rockchipdrm drm_cma_helper analogix_dp dw_hdmi realtek drm_display_helper
dwc3_of_simple dw_mipi_dsi ehci_platform ohci_platform ohci_hcd ehci_hcd
drm_kms_helper dwmac_rk syscopyarea sysfillrect stmmac_platform sysimgblt
fb_sys_fops usbcore stmmac pcs_xpcs drm phylink drm_panel_orientation_quirks
[ 2.407155] CPU: 4 PID: 71 Comm: kworker/4:6 Not tainted
5.19.0-rc8-next-20220728 #437
[ 2.407868] Hardware name: Firefly ROC-RK3399-PC Mezzanine Board (DT)
[ 2.408448] Workqueue: events rockchip_usb2phy_otg_sm_work
[ 2.408958] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 2.411634] pc : rockchip_usb2phy_otg_sm_work+0x50/0x330
[ 2.414332] lr : process_one_work+0x1d8/0x380
[ 2.416948] sp : ffff800009373d60
[ 2.419406] x29: ffff800009373d60 x28: 0000000000000000 x27: 0000000000000000
[ 2.422199] x26: ffff0000f779fcb8 x25: ffff0000f77a3a05 x24: 000000000000000c
[ 2.424978] x23: 0000000000000000 x22: ffff0000010c8258 x21: ffff80000888ec10
[ 2.427768] x20: ffff0000010c82f0 x19: 000000000000000c x18: 0000000000000001
[ 2.430604] x17: 000000040044ffff x16: 00400034b5503510 x15: 0000000000000000
[ 2.433390] x14: ffff000000708000 x13: ffff8000eec96000 x12: 0000000034d4d91d
[ 2.436185] x11: 0000000000000000 x10: 0000000000000a10 x9 : ffff000001aa7a74
[ 2.438958] x8 : fefefefefefefeff x7 : 0000000000000018 x6 : ffff000001aa7a74
[ 2.441668] x5 : 000073746e657665 x4 : 000000000000002f x3 : ffff00000356c808
[ 2.444407] x2 : ffff800009373da4 x1 : 000000000000e2ac x0 : ffff80000888eb34
[ 2.447190] Call trace:
[ 2.449557] rockchip_usb2phy_otg_sm_work+0x50/0x330
[ 2.452169] process_one_work+0x1d8/0x380
[ 2.454684] worker_thread+0x170/0x4e0
[ 2.457056] kthread+0xd8/0xdc
[ 2.459354] ret_from_fork+0x10/0x20
[ 2.461728] Code: 91037015 295be001 f9403c77 b940e413 (f94006e0)
[ 2.464338] ---[ end trace 0000000000000000 ]---

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 <[email protected]>
> ---
> 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:

Gruß,
--
Markus Reichl

2022-08-04 10:16:45

by Peter Geis

[permalink] [raw]
Subject: Re: [BUG BISECT] phy: rockchip-inno-usb2: Sync initial otg state

On Tue, Aug 2, 2022 at 2:39 PM Markus Reichl <[email protected]> wrote:
>
> Hi,
>
> with linux-next-20220728 rk3399-roc-pc does not boot.
> Bisecting pointed to this commit.
> By reverting this commit the board boots again.

Thank you for reporting this, someone was kind enough to reproduce the
problem on the rockpro64 and confirmed this is an issue. As I won't
have access to my hardware until next month, we should probably revert
this until the root cause can be identified.

Very Respectfully,
Peter Geis

>
> [ 2.398700] Unable to handle kernel NULL pointer dereference at virtual address
> 0000000000000008
> [ 2.399517] Mem abort info:
> [ 2.399772] ESR = 0x0000000096000004
> [ 2.400114] EC = 0x25: DABT (current EL), IL = 32 bits
> [ 2.400594] SET = 0, FnV = 0
> [ 2.400873] EA = 0, S1PTW = 0
> [ 2.401161] FSC = 0x04: level 0 translation fault
> [ 2.401602] Data abort info:
> [ 2.401864] ISV = 0, ISS = 0x00000004
> [ 2.402212] CM = 0, WnR = 0
> [ 2.402484] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000001376000
> [ 2.403071] [0000000000000008] pgd=0000000000000000, p4d=0000000000000000
> [ 2.403687] Internal error: Oops: 96000004 [#1] SMP
> [ 2.404130] Modules linked in: ip_tables x_tables ipv6 xhci_plat_hcd xhci_hcd
> dwc3 rockchipdrm drm_cma_helper analogix_dp dw_hdmi realtek drm_display_helper
> dwc3_of_simple dw_mipi_dsi ehci_platform ohci_platform ohci_hcd ehci_hcd
> drm_kms_helper dwmac_rk syscopyarea sysfillrect stmmac_platform sysimgblt
> fb_sys_fops usbcore stmmac pcs_xpcs drm phylink drm_panel_orientation_quirks
> [ 2.407155] CPU: 4 PID: 71 Comm: kworker/4:6 Not tainted
> 5.19.0-rc8-next-20220728 #437
> [ 2.407868] Hardware name: Firefly ROC-RK3399-PC Mezzanine Board (DT)
> [ 2.408448] Workqueue: events rockchip_usb2phy_otg_sm_work
> [ 2.408958] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> [ 2.411634] pc : rockchip_usb2phy_otg_sm_work+0x50/0x330
> [ 2.414332] lr : process_one_work+0x1d8/0x380
> [ 2.416948] sp : ffff800009373d60
> [ 2.419406] x29: ffff800009373d60 x28: 0000000000000000 x27: 0000000000000000
> [ 2.422199] x26: ffff0000f779fcb8 x25: ffff0000f77a3a05 x24: 000000000000000c
> [ 2.424978] x23: 0000000000000000 x22: ffff0000010c8258 x21: ffff80000888ec10
> [ 2.427768] x20: ffff0000010c82f0 x19: 000000000000000c x18: 0000000000000001
> [ 2.430604] x17: 000000040044ffff x16: 00400034b5503510 x15: 0000000000000000
> [ 2.433390] x14: ffff000000708000 x13: ffff8000eec96000 x12: 0000000034d4d91d
> [ 2.436185] x11: 0000000000000000 x10: 0000000000000a10 x9 : ffff000001aa7a74
> [ 2.438958] x8 : fefefefefefefeff x7 : 0000000000000018 x6 : ffff000001aa7a74
> [ 2.441668] x5 : 000073746e657665 x4 : 000000000000002f x3 : ffff00000356c808
> [ 2.444407] x2 : ffff800009373da4 x1 : 000000000000e2ac x0 : ffff80000888eb34
> [ 2.447190] Call trace:
> [ 2.449557] rockchip_usb2phy_otg_sm_work+0x50/0x330
> [ 2.452169] process_one_work+0x1d8/0x380
> [ 2.454684] worker_thread+0x170/0x4e0
> [ 2.457056] kthread+0xd8/0xdc
> [ 2.459354] ret_from_fork+0x10/0x20
> [ 2.461728] Code: 91037015 295be001 f9403c77 b940e413 (f94006e0)
> [ 2.464338] ---[ end trace 0000000000000000 ]---
>
> 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 <[email protected]>
> > ---
> > 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:
>
> Gruß,
> --
> Markus Reichl

2022-08-16 10:55:43

by Michael Riesch

[permalink] [raw]
Subject: Re: [BUG BISECT] phy: rockchip-inno-usb2: Sync initial otg state

Hi all,

On 8/4/22 11:49, Peter Geis wrote:
> On Tue, Aug 2, 2022 at 2:39 PM Markus Reichl <[email protected]> wrote:
>>
>> Hi,
>>
>> with linux-next-20220728 rk3399-roc-pc does not boot.
>> Bisecting pointed to this commit.
>> By reverting this commit the board boots again.
>
> Thank you for reporting this, someone was kind enough to reproduce the
> problem on the rockpro64 and confirmed this is an issue. As I won't
> have access to my hardware until next month, we should probably revert
> this until the root cause can be identified.

Just experienced this issue on my ROCK3 Model A board (RK3568) and
reverting this commit solved it.

Having the revert in v6.0-rc2 would be great -- if there is anything I
can help to accelerate this please let me know.

Thanks and best regards,
Michael

>
> Very Respectfully,
> Peter Geis
>
>>
>> [ 2.398700] Unable to handle kernel NULL pointer dereference at virtual address
>> 0000000000000008
>> [ 2.399517] Mem abort info:
>> [ 2.399772] ESR = 0x0000000096000004
>> [ 2.400114] EC = 0x25: DABT (current EL), IL = 32 bits
>> [ 2.400594] SET = 0, FnV = 0
>> [ 2.400873] EA = 0, S1PTW = 0
>> [ 2.401161] FSC = 0x04: level 0 translation fault
>> [ 2.401602] Data abort info:
>> [ 2.401864] ISV = 0, ISS = 0x00000004
>> [ 2.402212] CM = 0, WnR = 0
>> [ 2.402484] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000001376000
>> [ 2.403071] [0000000000000008] pgd=0000000000000000, p4d=0000000000000000
>> [ 2.403687] Internal error: Oops: 96000004 [#1] SMP
>> [ 2.404130] Modules linked in: ip_tables x_tables ipv6 xhci_plat_hcd xhci_hcd
>> dwc3 rockchipdrm drm_cma_helper analogix_dp dw_hdmi realtek drm_display_helper
>> dwc3_of_simple dw_mipi_dsi ehci_platform ohci_platform ohci_hcd ehci_hcd
>> drm_kms_helper dwmac_rk syscopyarea sysfillrect stmmac_platform sysimgblt
>> fb_sys_fops usbcore stmmac pcs_xpcs drm phylink drm_panel_orientation_quirks
>> [ 2.407155] CPU: 4 PID: 71 Comm: kworker/4:6 Not tainted
>> 5.19.0-rc8-next-20220728 #437
>> [ 2.407868] Hardware name: Firefly ROC-RK3399-PC Mezzanine Board (DT)
>> [ 2.408448] Workqueue: events rockchip_usb2phy_otg_sm_work
>> [ 2.408958] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
>> [ 2.411634] pc : rockchip_usb2phy_otg_sm_work+0x50/0x330
>> [ 2.414332] lr : process_one_work+0x1d8/0x380
>> [ 2.416948] sp : ffff800009373d60
>> [ 2.419406] x29: ffff800009373d60 x28: 0000000000000000 x27: 0000000000000000
>> [ 2.422199] x26: ffff0000f779fcb8 x25: ffff0000f77a3a05 x24: 000000000000000c
>> [ 2.424978] x23: 0000000000000000 x22: ffff0000010c8258 x21: ffff80000888ec10
>> [ 2.427768] x20: ffff0000010c82f0 x19: 000000000000000c x18: 0000000000000001
>> [ 2.430604] x17: 000000040044ffff x16: 00400034b5503510 x15: 0000000000000000
>> [ 2.433390] x14: ffff000000708000 x13: ffff8000eec96000 x12: 0000000034d4d91d
>> [ 2.436185] x11: 0000000000000000 x10: 0000000000000a10 x9 : ffff000001aa7a74
>> [ 2.438958] x8 : fefefefefefefeff x7 : 0000000000000018 x6 : ffff000001aa7a74
>> [ 2.441668] x5 : 000073746e657665 x4 : 000000000000002f x3 : ffff00000356c808
>> [ 2.444407] x2 : ffff800009373da4 x1 : 000000000000e2ac x0 : ffff80000888eb34
>> [ 2.447190] Call trace:
>> [ 2.449557] rockchip_usb2phy_otg_sm_work+0x50/0x330
>> [ 2.452169] process_one_work+0x1d8/0x380
>> [ 2.454684] worker_thread+0x170/0x4e0
>> [ 2.457056] kthread+0xd8/0xdc
>> [ 2.459354] ret_from_fork+0x10/0x20
>> [ 2.461728] Code: 91037015 295be001 f9403c77 b940e413 (f94006e0)
>> [ 2.464338] ---[ end trace 0000000000000000 ]---
>>
>> 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 <[email protected]>
>>> ---
>>> 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:
>>
>> Gruß,
>> --
>> Markus Reichl
>
> _______________________________________________
> Linux-rockchip mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-rockchip

2022-08-16 15:53:22

by Peter Geis

[permalink] [raw]
Subject: Re: [BUG BISECT] phy: rockchip-inno-usb2: Sync initial otg state

On Tue, Aug 16, 2022 at 11:20 AM Michael Riesch
<[email protected]> wrote:
>
> Hi all,
>
> On 8/4/22 11:49, Peter Geis wrote:
> > On Tue, Aug 2, 2022 at 2:39 PM Markus Reichl <[email protected]> wrote:
> >>
> >> Hi,
> >>
> >> with linux-next-20220728 rk3399-roc-pc does not boot.
> >> Bisecting pointed to this commit.
> >> By reverting this commit the board boots again.
> >
> > Thank you for reporting this, someone was kind enough to reproduce the
> > problem on the rockpro64 and confirmed this is an issue. As I won't
> > have access to my hardware until next month, we should probably revert
> > this until the root cause can be identified.
>
> Just experienced this issue on my ROCK3 Model A board (RK3568) and
> reverting this commit solved it.
>
> Having the revert in v6.0-rc2 would be great -- if there is anything I
> can help to accelerate this please let me know.

If this is now happening on rk356x where I know it works, it now
cements my theory that it's a symptom and not the actual problem.
Possibly a race condition with the grf and regmap code where it isn't
quite ready when called. This code path is called exactly the same way
later on when the irq fires.

What config are you based on? I'm running a stripped down version of
the arm64_defconfig, but if you deviate from that it will be helpful
in reproducing the issue.

We should revert it until it's isolated, as well as the patch setting
the rk356x to otg since it will again be broken. If someone could
weigh in here as well (I currently don't have access to my hardware)
it would be helpful.

>
> Thanks and best regards,
> Michael
>
> >
> > Very Respectfully,
> > Peter Geis
> >
> >>
> >> [ 2.398700] Unable to handle kernel NULL pointer dereference at virtual address
> >> 0000000000000008
> >> [ 2.399517] Mem abort info:
> >> [ 2.399772] ESR = 0x0000000096000004
> >> [ 2.400114] EC = 0x25: DABT (current EL), IL = 32 bits
> >> [ 2.400594] SET = 0, FnV = 0
> >> [ 2.400873] EA = 0, S1PTW = 0
> >> [ 2.401161] FSC = 0x04: level 0 translation fault
> >> [ 2.401602] Data abort info:
> >> [ 2.401864] ISV = 0, ISS = 0x00000004
> >> [ 2.402212] CM = 0, WnR = 0
> >> [ 2.402484] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000001376000
> >> [ 2.403071] [0000000000000008] pgd=0000000000000000, p4d=0000000000000000
> >> [ 2.403687] Internal error: Oops: 96000004 [#1] SMP
> >> [ 2.404130] Modules linked in: ip_tables x_tables ipv6 xhci_plat_hcd xhci_hcd
> >> dwc3 rockchipdrm drm_cma_helper analogix_dp dw_hdmi realtek drm_display_helper
> >> dwc3_of_simple dw_mipi_dsi ehci_platform ohci_platform ohci_hcd ehci_hcd
> >> drm_kms_helper dwmac_rk syscopyarea sysfillrect stmmac_platform sysimgblt
> >> fb_sys_fops usbcore stmmac pcs_xpcs drm phylink drm_panel_orientation_quirks
> >> [ 2.407155] CPU: 4 PID: 71 Comm: kworker/4:6 Not tainted
> >> 5.19.0-rc8-next-20220728 #437
> >> [ 2.407868] Hardware name: Firefly ROC-RK3399-PC Mezzanine Board (DT)
> >> [ 2.408448] Workqueue: events rockchip_usb2phy_otg_sm_work
> >> [ 2.408958] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> >> [ 2.411634] pc : rockchip_usb2phy_otg_sm_work+0x50/0x330
> >> [ 2.414332] lr : process_one_work+0x1d8/0x380
> >> [ 2.416948] sp : ffff800009373d60
> >> [ 2.419406] x29: ffff800009373d60 x28: 0000000000000000 x27: 0000000000000000
> >> [ 2.422199] x26: ffff0000f779fcb8 x25: ffff0000f77a3a05 x24: 000000000000000c
> >> [ 2.424978] x23: 0000000000000000 x22: ffff0000010c8258 x21: ffff80000888ec10
> >> [ 2.427768] x20: ffff0000010c82f0 x19: 000000000000000c x18: 0000000000000001
> >> [ 2.430604] x17: 000000040044ffff x16: 00400034b5503510 x15: 0000000000000000
> >> [ 2.433390] x14: ffff000000708000 x13: ffff8000eec96000 x12: 0000000034d4d91d
> >> [ 2.436185] x11: 0000000000000000 x10: 0000000000000a10 x9 : ffff000001aa7a74
> >> [ 2.438958] x8 : fefefefefefefeff x7 : 0000000000000018 x6 : ffff000001aa7a74
> >> [ 2.441668] x5 : 000073746e657665 x4 : 000000000000002f x3 : ffff00000356c808
> >> [ 2.444407] x2 : ffff800009373da4 x1 : 000000000000e2ac x0 : ffff80000888eb34
> >> [ 2.447190] Call trace:
> >> [ 2.449557] rockchip_usb2phy_otg_sm_work+0x50/0x330
> >> [ 2.452169] process_one_work+0x1d8/0x380
> >> [ 2.454684] worker_thread+0x170/0x4e0
> >> [ 2.457056] kthread+0xd8/0xdc
> >> [ 2.459354] ret_from_fork+0x10/0x20
> >> [ 2.461728] Code: 91037015 295be001 f9403c77 b940e413 (f94006e0)
> >> [ 2.464338] ---[ end trace 0000000000000000 ]---
> >>
> >> 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 <[email protected]>
> >>> ---
> >>> 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:
> >>
> >> Gruß,
> >> --
> >> Markus Reichl
> >
> > _______________________________________________
> > Linux-rockchip mailing list
> > [email protected]
> > http://lists.infradead.org/mailman/listinfo/linux-rockchip

2022-08-17 08:56:55

by Michael Riesch

[permalink] [raw]
Subject: Re: [BUG BISECT] phy: rockchip-inno-usb2: Sync initial otg state

Hi Peter,

On 8/16/22 17:27, Peter Geis wrote:
> On Tue, Aug 16, 2022 at 11:20 AM Michael Riesch
> <[email protected]> wrote:
>>
>> Hi all,
>>
>> On 8/4/22 11:49, Peter Geis wrote:
>>> On Tue, Aug 2, 2022 at 2:39 PM Markus Reichl <[email protected]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> with linux-next-20220728 rk3399-roc-pc does not boot.
>>>> Bisecting pointed to this commit.
>>>> By reverting this commit the board boots again.
>>>
>>> Thank you for reporting this, someone was kind enough to reproduce the
>>> problem on the rockpro64 and confirmed this is an issue. As I won't
>>> have access to my hardware until next month, we should probably revert
>>> this until the root cause can be identified.
>>
>> Just experienced this issue on my ROCK3 Model A board (RK3568) and
>> reverting this commit solved it.
>>
>> Having the revert in v6.0-rc2 would be great -- if there is anything I
>> can help to accelerate this please let me know.
>
> If this is now happening on rk356x where I know it works, it now
> cements my theory that it's a symptom and not the actual problem.
> Possibly a race condition with the grf and regmap code where it isn't
> quite ready when called. This code path is called exactly the same way
> later on when the irq fires.
>
> What config are you based on? I'm running a stripped down version of
> the arm64_defconfig, but if you deviate from that it will be helpful
> in reproducing the issue.

I posted my Kconfig here: https://pastebin.com/P1As0W4k

FWIW the ROCK3 board has a switch to set the OTG port to device or host,
respectively. The NPE does not occur when the switch is set to host.

Best regards,
Michael

> We should revert it until it's isolated, as well as the patch setting
> the rk356x to otg since it will again be broken. If someone could
> weigh in here as well (I currently don't have access to my hardware)
> it would be helpful.
>
>>
>> Thanks and best regards,
>> Michael
>>
>>>
>>> Very Respectfully,
>>> Peter Geis
>>>
>>>>
>>>> [ 2.398700] Unable to handle kernel NULL pointer dereference at virtual address
>>>> 0000000000000008
>>>> [ 2.399517] Mem abort info:
>>>> [ 2.399772] ESR = 0x0000000096000004
>>>> [ 2.400114] EC = 0x25: DABT (current EL), IL = 32 bits
>>>> [ 2.400594] SET = 0, FnV = 0
>>>> [ 2.400873] EA = 0, S1PTW = 0
>>>> [ 2.401161] FSC = 0x04: level 0 translation fault
>>>> [ 2.401602] Data abort info:
>>>> [ 2.401864] ISV = 0, ISS = 0x00000004
>>>> [ 2.402212] CM = 0, WnR = 0
>>>> [ 2.402484] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000001376000
>>>> [ 2.403071] [0000000000000008] pgd=0000000000000000, p4d=0000000000000000
>>>> [ 2.403687] Internal error: Oops: 96000004 [#1] SMP
>>>> [ 2.404130] Modules linked in: ip_tables x_tables ipv6 xhci_plat_hcd xhci_hcd
>>>> dwc3 rockchipdrm drm_cma_helper analogix_dp dw_hdmi realtek drm_display_helper
>>>> dwc3_of_simple dw_mipi_dsi ehci_platform ohci_platform ohci_hcd ehci_hcd
>>>> drm_kms_helper dwmac_rk syscopyarea sysfillrect stmmac_platform sysimgblt
>>>> fb_sys_fops usbcore stmmac pcs_xpcs drm phylink drm_panel_orientation_quirks
>>>> [ 2.407155] CPU: 4 PID: 71 Comm: kworker/4:6 Not tainted
>>>> 5.19.0-rc8-next-20220728 #437
>>>> [ 2.407868] Hardware name: Firefly ROC-RK3399-PC Mezzanine Board (DT)
>>>> [ 2.408448] Workqueue: events rockchip_usb2phy_otg_sm_work
>>>> [ 2.408958] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
>>>> [ 2.411634] pc : rockchip_usb2phy_otg_sm_work+0x50/0x330
>>>> [ 2.414332] lr : process_one_work+0x1d8/0x380
>>>> [ 2.416948] sp : ffff800009373d60
>>>> [ 2.419406] x29: ffff800009373d60 x28: 0000000000000000 x27: 0000000000000000
>>>> [ 2.422199] x26: ffff0000f779fcb8 x25: ffff0000f77a3a05 x24: 000000000000000c
>>>> [ 2.424978] x23: 0000000000000000 x22: ffff0000010c8258 x21: ffff80000888ec10
>>>> [ 2.427768] x20: ffff0000010c82f0 x19: 000000000000000c x18: 0000000000000001
>>>> [ 2.430604] x17: 000000040044ffff x16: 00400034b5503510 x15: 0000000000000000
>>>> [ 2.433390] x14: ffff000000708000 x13: ffff8000eec96000 x12: 0000000034d4d91d
>>>> [ 2.436185] x11: 0000000000000000 x10: 0000000000000a10 x9 : ffff000001aa7a74
>>>> [ 2.438958] x8 : fefefefefefefeff x7 : 0000000000000018 x6 : ffff000001aa7a74
>>>> [ 2.441668] x5 : 000073746e657665 x4 : 000000000000002f x3 : ffff00000356c808
>>>> [ 2.444407] x2 : ffff800009373da4 x1 : 000000000000e2ac x0 : ffff80000888eb34
>>>> [ 2.447190] Call trace:
>>>> [ 2.449557] rockchip_usb2phy_otg_sm_work+0x50/0x330
>>>> [ 2.452169] process_one_work+0x1d8/0x380
>>>> [ 2.454684] worker_thread+0x170/0x4e0
>>>> [ 2.457056] kthread+0xd8/0xdc
>>>> [ 2.459354] ret_from_fork+0x10/0x20
>>>> [ 2.461728] Code: 91037015 295be001 f9403c77 b940e413 (f94006e0)
>>>> [ 2.464338] ---[ end trace 0000000000000000 ]---
>>>>
>>>> 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 <[email protected]>
>>>>> ---
>>>>> 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:
>>>>
>>>> Gruß,
>>>> --
>>>> Markus Reichl
>>>
>>> _______________________________________________
>>> Linux-rockchip mailing list
>>> [email protected]
>>> http://lists.infradead.org/mailman/listinfo/linux-rockchip

2022-08-20 11:01:10

by Peter Geis

[permalink] [raw]
Subject: Re: [BUG BISECT] phy: rockchip-inno-usb2: Sync initial otg state



On 8/17/2022 4:25 AM, Michael Riesch wrote:
> Hi Peter,
>
> On 8/16/22 17:27, Peter Geis wrote:
>> On Tue, Aug 16, 2022 at 11:20 AM Michael Riesch
>> <[email protected]> wrote:
>>>
>>> Hi all,
>>>
>>> On 8/4/22 11:49, Peter Geis wrote:
>>>> On Tue, Aug 2, 2022 at 2:39 PM Markus Reichl <[email protected]> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> with linux-next-20220728 rk3399-roc-pc does not boot.
>>>>> Bisecting pointed to this commit.
>>>>> By reverting this commit the board boots again.
>>>>
>>>> Thank you for reporting this, someone was kind enough to reproduce the
>>>> problem on the rockpro64 and confirmed this is an issue. As I won't
>>>> have access to my hardware until next month, we should probably revert
>>>> this until the root cause can be identified.
>>>
>>> Just experienced this issue on my ROCK3 Model A board (RK3568) and
>>> reverting this commit solved it.
>>>
>>> Having the revert in v6.0-rc2 would be great -- if there is anything I
>>> can help to accelerate this please let me know.
>>
>> If this is now happening on rk356x where I know it works, it now
>> cements my theory that it's a symptom and not the actual problem.
>> Possibly a race condition with the grf and regmap code where it isn't
>> quite ready when called. This code path is called exactly the same way
>> later on when the irq fires.
>>
>> What config are you based on? I'm running a stripped down version of
>> the arm64_defconfig, but if you deviate from that it will be helpful
>> in reproducing the issue.
>
> I posted my Kconfig here: https://pastebin.com/P1As0W4k
>
> FWIW the ROCK3 board has a switch to set the OTG port to device or host,
> respectively. The NPE does not occur when the switch is set to host.
>
> Best regards,
> Michael

Good Afternoon Michael,

Please try the following fix.

Very Respectfully,
Peter Geis

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index 0b1e9337ee8e..5fc7c374a6b4 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -1169,6 +1169,7 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
/* 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);
+ ret = 0;
}
}



>
>> We should revert it until it's isolated, as well as the patch setting
>> the rk356x to otg since it will again be broken. If someone could
>> weigh in here as well (I currently don't have access to my hardware)
>> it would be helpful.
>>
>>>
>>> Thanks and best regards,
>>> Michael
>>>
>>>>
>>>> Very Respectfully,
>>>> Peter Geis
>>>>
>>>>>
>>>>> [ 2.398700] Unable to handle kernel NULL pointer dereference at virtual address
>>>>> 0000000000000008
>>>>> [ 2.399517] Mem abort info:
>>>>> [ 2.399772] ESR = 0x0000000096000004
>>>>> [ 2.400114] EC = 0x25: DABT (current EL), IL = 32 bits
>>>>> [ 2.400594] SET = 0, FnV = 0
>>>>> [ 2.400873] EA = 0, S1PTW = 0
>>>>> [ 2.401161] FSC = 0x04: level 0 translation fault
>>>>> [ 2.401602] Data abort info:
>>>>> [ 2.401864] ISV = 0, ISS = 0x00000004
>>>>> [ 2.402212] CM = 0, WnR = 0
>>>>> [ 2.402484] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000001376000
>>>>> [ 2.403071] [0000000000000008] pgd=0000000000000000, p4d=0000000000000000
>>>>> [ 2.403687] Internal error: Oops: 96000004 [#1] SMP
>>>>> [ 2.404130] Modules linked in: ip_tables x_tables ipv6 xhci_plat_hcd xhci_hcd
>>>>> dwc3 rockchipdrm drm_cma_helper analogix_dp dw_hdmi realtek drm_display_helper
>>>>> dwc3_of_simple dw_mipi_dsi ehci_platform ohci_platform ohci_hcd ehci_hcd
>>>>> drm_kms_helper dwmac_rk syscopyarea sysfillrect stmmac_platform sysimgblt
>>>>> fb_sys_fops usbcore stmmac pcs_xpcs drm phylink drm_panel_orientation_quirks
>>>>> [ 2.407155] CPU: 4 PID: 71 Comm: kworker/4:6 Not tainted
>>>>> 5.19.0-rc8-next-20220728 #437
>>>>> [ 2.407868] Hardware name: Firefly ROC-RK3399-PC Mezzanine Board (DT)
>>>>> [ 2.408448] Workqueue: events rockchip_usb2phy_otg_sm_work
>>>>> [ 2.408958] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
>>>>> [ 2.411634] pc : rockchip_usb2phy_otg_sm_work+0x50/0x330
>>>>> [ 2.414332] lr : process_one_work+0x1d8/0x380
>>>>> [ 2.416948] sp : ffff800009373d60
>>>>> [ 2.419406] x29: ffff800009373d60 x28: 0000000000000000 x27: 0000000000000000
>>>>> [ 2.422199] x26: ffff0000f779fcb8 x25: ffff0000f77a3a05 x24: 000000000000000c
>>>>> [ 2.424978] x23: 0000000000000000 x22: ffff0000010c8258 x21: ffff80000888ec10
>>>>> [ 2.427768] x20: ffff0000010c82f0 x19: 000000000000000c x18: 0000000000000001
>>>>> [ 2.430604] x17: 000000040044ffff x16: 00400034b5503510 x15: 0000000000000000
>>>>> [ 2.433390] x14: ffff000000708000 x13: ffff8000eec96000 x12: 0000000034d4d91d
>>>>> [ 2.436185] x11: 0000000000000000 x10: 0000000000000a10 x9 : ffff000001aa7a74
>>>>> [ 2.438958] x8 : fefefefefefefeff x7 : 0000000000000018 x6 : ffff000001aa7a74
>>>>> [ 2.441668] x5 : 000073746e657665 x4 : 000000000000002f x3 : ffff00000356c808
>>>>> [ 2.444407] x2 : ffff800009373da4 x1 : 000000000000e2ac x0 : ffff80000888eb34
>>>>> [ 2.447190] Call trace:
>>>>> [ 2.449557] rockchip_usb2phy_otg_sm_work+0x50/0x330
>>>>> [ 2.452169] process_one_work+0x1d8/0x380
>>>>> [ 2.454684] worker_thread+0x170/0x4e0
>>>>> [ 2.457056] kthread+0xd8/0xdc
>>>>> [ 2.459354] ret_from_fork+0x10/0x20
>>>>> [ 2.461728] Code: 91037015 295be001 f9403c77 b940e413 (f94006e0)
>>>>> [ 2.464338] ---[ end trace 0000000000000000 ]---
>>>>>
>>>>> 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 <[email protected]>
>>>>>> ---
>>>>>> 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:
>>>>>
>>>>> Gruß,
>>>>> --
>>>>> Markus Reichl
>>>>
>>>> _______________________________________________
>>>> Linux-rockchip mailing list
>>>> [email protected]
>>>> http://lists.infradead.org/mailman/listinfo/linux-rockchip

2022-08-22 07:40:57

by Michael Riesch

[permalink] [raw]
Subject: Re: [BUG BISECT] phy: rockchip-inno-usb2: Sync initial otg state

Hi Peter,

On 8/20/22 12:23, Peter Geis wrote:
>
>
> On 8/17/2022 4:25 AM, Michael Riesch wrote:
>> Hi Peter,
>>
>> On 8/16/22 17:27, Peter Geis wrote:
>>> On Tue, Aug 16, 2022 at 11:20 AM Michael Riesch
>>> <[email protected]> wrote:
>>>>
>>>> Hi all,
>>>>
>>>> On 8/4/22 11:49, Peter Geis wrote:
>>>>> On Tue, Aug 2, 2022 at 2:39 PM Markus Reichl
>>>>> <[email protected]> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> with linux-next-20220728 rk3399-roc-pc does not boot.
>>>>>> Bisecting pointed to this commit.
>>>>>> By reverting this commit the board boots again.
>>>>>
>>>>> Thank you for reporting this, someone was kind enough to reproduce the
>>>>> problem on the rockpro64 and confirmed this is an issue. As I won't
>>>>> have access to my hardware until next month, we should probably revert
>>>>> this until the root cause can be identified.
>>>>
>>>> Just experienced this issue on my ROCK3 Model A board (RK3568) and
>>>> reverting this commit solved it.
>>>>
>>>> Having the revert in v6.0-rc2 would be great -- if there is anything I
>>>> can help to accelerate this please let me know.
>>>
>>> If this is now happening on rk356x where I know it works, it now
>>> cements my theory that it's a symptom and not the actual problem.
>>> Possibly a race condition with the grf and regmap code where it isn't
>>> quite ready when called. This code path is called exactly the same way
>>> later on when the irq fires.
>>>
>>> What config are you based on? I'm running a stripped down version of
>>> the arm64_defconfig, but if you deviate from that it will be helpful
>>> in reproducing the issue.
>>
>> I posted my Kconfig here: https://pastebin.com/P1As0W4k
>>
>> FWIW the ROCK3 board has a switch to set the OTG port to device or host,
>> respectively. The NPE does not occur when the switch is set to host.
>>
>> Best regards,
>> Michael
>
> Good Afternoon Michael,
>
> Please try the following fix.
>
> Very Respectfully,
> Peter Geis
>
> diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> index 0b1e9337ee8e..5fc7c374a6b4 100644
> --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> @@ -1169,6 +1169,7 @@ static int rockchip_usb2phy_otg_port_init(struct
> rockchip_usb2phy *rphy,
>              /* 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);
> +            ret = 0;
>          }
>      }

Thanks, this patch indeed solves the issue in my setup. With both role
switch settings the NPE does not occur anymore, the correct role is
selected, and both roles work (tested with zerogadget (device) and a USB
drive (host)). Can you spin a patch?

NB: On the ROCK3 the device tree needs a fix to get the host role going,
I'll need to take a closer look on this one and spin a patch.

What I still find strange (but is unrelated to the commit "phy:
rockchip-inno-usb2: Sync initial otg state") is that two and four xhci
controllers pop up in the device role and the host role, respectively.
For example, in the device role there is a pair of controllers

# lsusb | grep xhci
Bus 006 Device 001: ID 1d6b:0003 Linux 6.0.0-rc1+ xhci-hcd xHCI Host
Controller
Bus 005 Device 001: ID 1d6b:0002 Linux 6.0.0-rc1+ xhci-hcd xHCI Host
Controller
# hexdump /sys/bus/usb/devices/usb5/of_node/reg
0000000 0000 0000 00fd 0000 0000 0000 4000 0000
0000010
# hexdump /sys/bus/usb/devices/usb6/of_node/reg
0000000 0000 0000 00fd 0000 0000 0000 4000 0000
0000010

that are related to the same device (in this case usb_host1_xhci). I
would have expected a single controller. Anyone care to enlighten me a
bit why there is a pair of them?

Thanks and best regards,
Michael

>>> We should revert it until it's isolated, as well as the patch setting
>>> the rk356x to otg since it will again be broken. If someone could
>>> weigh in here as well (I currently don't have access to my hardware)
>>> it would be helpful.
>>>
>>>>
>>>> Thanks and best regards,
>>>> Michael
>>>>
>>>>>
>>>>> Very Respectfully,
>>>>> Peter Geis
>>>>>
>>>>>>
>>>>>> [    2.398700] Unable to handle kernel NULL pointer dereference at
>>>>>> virtual address
>>>>>> 0000000000000008
>>>>>> [    2.399517] Mem abort info:
>>>>>> [    2.399772]   ESR = 0x0000000096000004
>>>>>> [    2.400114]   EC = 0x25: DABT (current EL), IL = 32 bits
>>>>>> [    2.400594]   SET = 0, FnV = 0
>>>>>> [    2.400873]   EA = 0, S1PTW = 0
>>>>>> [    2.401161]   FSC = 0x04: level 0 translation fault
>>>>>> [    2.401602] Data abort info:
>>>>>> [    2.401864]   ISV = 0, ISS = 0x00000004
>>>>>> [    2.402212]   CM = 0, WnR = 0
>>>>>> [    2.402484] user pgtable: 4k pages, 48-bit VAs,
>>>>>> pgdp=0000000001376000
>>>>>> [    2.403071] [0000000000000008] pgd=0000000000000000,
>>>>>> p4d=0000000000000000
>>>>>> [    2.403687] Internal error: Oops: 96000004 [#1] SMP
>>>>>> [    2.404130] Modules linked in: ip_tables x_tables ipv6
>>>>>> xhci_plat_hcd xhci_hcd
>>>>>> dwc3 rockchipdrm drm_cma_helper analogix_dp dw_hdmi realtek
>>>>>> drm_display_helper
>>>>>> dwc3_of_simple dw_mipi_dsi ehci_platform ohci_platform ohci_hcd
>>>>>> ehci_hcd
>>>>>> drm_kms_helper dwmac_rk syscopyarea sysfillrect stmmac_platform
>>>>>> sysimgblt
>>>>>> fb_sys_fops usbcore stmmac pcs_xpcs drm phylink
>>>>>> drm_panel_orientation_quirks
>>>>>> [    2.407155] CPU: 4 PID: 71 Comm: kworker/4:6 Not tainted
>>>>>> 5.19.0-rc8-next-20220728 #437
>>>>>> [    2.407868] Hardware name: Firefly ROC-RK3399-PC Mezzanine
>>>>>> Board (DT)
>>>>>> [    2.408448] Workqueue: events rockchip_usb2phy_otg_sm_work
>>>>>> [    2.408958] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT
>>>>>> -SSBS BTYPE=--)
>>>>>> [    2.411634] pc : rockchip_usb2phy_otg_sm_work+0x50/0x330
>>>>>> [    2.414332] lr : process_one_work+0x1d8/0x380
>>>>>> [    2.416948] sp : ffff800009373d60
>>>>>> [    2.419406] x29: ffff800009373d60 x28: 0000000000000000 x27:
>>>>>> 0000000000000000
>>>>>> [    2.422199] x26: ffff0000f779fcb8 x25: ffff0000f77a3a05 x24:
>>>>>> 000000000000000c
>>>>>> [    2.424978] x23: 0000000000000000 x22: ffff0000010c8258 x21:
>>>>>> ffff80000888ec10
>>>>>> [    2.427768] x20: ffff0000010c82f0 x19: 000000000000000c x18:
>>>>>> 0000000000000001
>>>>>> [    2.430604] x17: 000000040044ffff x16: 00400034b5503510 x15:
>>>>>> 0000000000000000
>>>>>> [    2.433390] x14: ffff000000708000 x13: ffff8000eec96000 x12:
>>>>>> 0000000034d4d91d
>>>>>> [    2.436185] x11: 0000000000000000 x10: 0000000000000a10 x9 :
>>>>>> ffff000001aa7a74
>>>>>> [    2.438958] x8 : fefefefefefefeff x7 : 0000000000000018 x6 :
>>>>>> ffff000001aa7a74
>>>>>> [    2.441668] x5 : 000073746e657665 x4 : 000000000000002f x3 :
>>>>>> ffff00000356c808
>>>>>> [    2.444407] x2 : ffff800009373da4 x1 : 000000000000e2ac x0 :
>>>>>> ffff80000888eb34
>>>>>> [    2.447190] Call trace:
>>>>>> [    2.449557]  rockchip_usb2phy_otg_sm_work+0x50/0x330
>>>>>> [    2.452169]  process_one_work+0x1d8/0x380
>>>>>> [    2.454684]  worker_thread+0x170/0x4e0
>>>>>> [    2.457056]  kthread+0xd8/0xdc
>>>>>> [    2.459354]  ret_from_fork+0x10/0x20
>>>>>> [    2.461728] Code: 91037015 295be001 f9403c77 b940e413 (f94006e0)
>>>>>> [    2.464338] ---[ end trace 0000000000000000 ]---
>>>>>>
>>>>>> 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 <[email protected]>
>>>>>>> ---
>>>>>>>    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:
>>>>>>
>>>>>> Gruß,
>>>>>> --
>>>>>> Markus Reichl
>>>>>
>>>>> _______________________________________________
>>>>> Linux-rockchip mailing list
>>>>> [email protected]
>>>>> http://lists.infradead.org/mailman/listinfo/linux-rockchip

2022-08-22 10:00:43

by Markus Reichl

[permalink] [raw]
Subject: Re: [BUG BISECT] phy: rockchip-inno-usb2: Sync initial otg state

Hi Peter,
Am 20.08.22 um 12:23 schrieb Peter Geis:
>
>
> On 8/17/2022 4:25 AM, Michael Riesch wrote:
>> Hi Peter,
>>
>> On 8/16/22 17:27, Peter Geis wrote:
>>> On Tue, Aug 16, 2022 at 11:20 AM Michael Riesch
>>> <[email protected]> wrote:
>>>>
>>>> Hi all,
>>>>
>>>> On 8/4/22 11:49, Peter Geis wrote:
>>>>> On Tue, Aug 2, 2022 at 2:39 PM Markus Reichl <[email protected]> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> with linux-next-20220728 rk3399-roc-pc does not boot.
>>>>>> Bisecting pointed to this commit.
>>>>>> By reverting this commit the board boots again.
>>>>>
>>>>> Thank you for reporting this, someone was kind enough to reproduce the
>>>>> problem on the rockpro64 and confirmed this is an issue. As I won't
>>>>> have access to my hardware until next month, we should probably revert
>>>>> this until the root cause can be identified.
>>>>
>>>> Just experienced this issue on my ROCK3 Model A board (RK3568) and
>>>> reverting this commit solved it.
>>>>
>>>> Having the revert in v6.0-rc2 would be great -- if there is anything I
>>>> can help to accelerate this please let me know.
>>>
>>> If this is now happening on rk356x where I know it works, it now
>>> cements my theory that it's a symptom and not the actual problem.
>>> Possibly a race condition with the grf and regmap code where it isn't
>>> quite ready when called. This code path is called exactly the same way
>>> later on when the irq fires.
>>>
>>> What config are you based on? I'm running a stripped down version of
>>> the arm64_defconfig, but if you deviate from that it will be helpful
>>> in reproducing the issue.
>>
>> I posted my Kconfig here: https://pastebin.com/P1As0W4k
>>
>> FWIW the ROCK3 board has a switch to set the OTG port to device or host,
>> respectively. The NPE does not occur when the switch is set to host.
>>
>> Best regards,
>> Michael
>
> Good Afternoon Michael,
>
> Please try the following fix.
>
> Very Respectfully,
> Peter Geis
>
> diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> index 0b1e9337ee8e..5fc7c374a6b4 100644
> --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> @@ -1169,6 +1169,7 @@ static int rockchip_usb2phy_otg_port_init(struct
> rockchip_usb2phy *rphy,
>              /* 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);
> +            ret = 0;
>          }
>      }
>
>
>

This fixes the bug i reported on rk3399-roc-pc.
Feel free to add:
Reported-by: Markus Reichl <[email protected]>
Tested-by: Markus Reichl <[email protected]>

Gruß,
--
Markus

>>
>>> We should revert it until it's isolated, as well as the patch setting
>>> the rk356x to otg since it will again be broken. If someone could
>>> weigh in here as well (I currently don't have access to my hardware)
>>> it would be helpful.
>>>
>>>>
>>>> Thanks and best regards,
>>>> Michael
>>>>
>>>>>
>>>>> Very Respectfully,
>>>>> Peter Geis
>>>>>
>>>>>>
>>>>>> [    2.398700] Unable to handle kernel NULL pointer dereference at virtual
>>>>>> address
>>>>>> 0000000000000008
>>>>>> [    2.399517] Mem abort info:
>>>>>> [    2.399772]   ESR = 0x0000000096000004
>>>>>> [    2.400114]   EC = 0x25: DABT (current EL), IL = 32 bits
>>>>>> [    2.400594]   SET = 0, FnV = 0
>>>>>> [    2.400873]   EA = 0, S1PTW = 0
>>>>>> [    2.401161]   FSC = 0x04: level 0 translation fault
>>>>>> [    2.401602] Data abort info:
>>>>>> [    2.401864]   ISV = 0, ISS = 0x00000004
>>>>>> [    2.402212]   CM = 0, WnR = 0
>>>>>> [    2.402484] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000001376000
>>>>>> [    2.403071] [0000000000000008] pgd=0000000000000000, p4d=0000000000000000
>>>>>> [    2.403687] Internal error: Oops: 96000004 [#1] SMP
>>>>>> [    2.404130] Modules linked in: ip_tables x_tables ipv6 xhci_plat_hcd
>>>>>> xhci_hcd
>>>>>> dwc3 rockchipdrm drm_cma_helper analogix_dp dw_hdmi realtek drm_display_helper
>>>>>> dwc3_of_simple dw_mipi_dsi ehci_platform ohci_platform ohci_hcd ehci_hcd
>>>>>> drm_kms_helper dwmac_rk syscopyarea sysfillrect stmmac_platform sysimgblt
>>>>>> fb_sys_fops usbcore stmmac pcs_xpcs drm phylink drm_panel_orientation_quirks
>>>>>> [    2.407155] CPU: 4 PID: 71 Comm: kworker/4:6 Not tainted
>>>>>> 5.19.0-rc8-next-20220728 #437
>>>>>> [    2.407868] Hardware name: Firefly ROC-RK3399-PC Mezzanine Board (DT)
>>>>>> [    2.408448] Workqueue: events rockchip_usb2phy_otg_sm_work
>>>>>> [    2.408958] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
>>>>>> [    2.411634] pc : rockchip_usb2phy_otg_sm_work+0x50/0x330
>>>>>> [    2.414332] lr : process_one_work+0x1d8/0x380
>>>>>> [    2.416948] sp : ffff800009373d60
>>>>>> [    2.419406] x29: ffff800009373d60 x28: 0000000000000000 x27:
>>>>>> 0000000000000000
>>>>>> [    2.422199] x26: ffff0000f779fcb8 x25: ffff0000f77a3a05 x24:
>>>>>> 000000000000000c
>>>>>> [    2.424978] x23: 0000000000000000 x22: ffff0000010c8258 x21:
>>>>>> ffff80000888ec10
>>>>>> [    2.427768] x20: ffff0000010c82f0 x19: 000000000000000c x18:
>>>>>> 0000000000000001
>>>>>> [    2.430604] x17: 000000040044ffff x16: 00400034b5503510 x15:
>>>>>> 0000000000000000
>>>>>> [    2.433390] x14: ffff000000708000 x13: ffff8000eec96000 x12:
>>>>>> 0000000034d4d91d
>>>>>> [    2.436185] x11: 0000000000000000 x10: 0000000000000a10 x9 :
>>>>>> ffff000001aa7a74
>>>>>> [    2.438958] x8 : fefefefefefefeff x7 : 0000000000000018 x6 :
>>>>>> ffff000001aa7a74
>>>>>> [    2.441668] x5 : 000073746e657665 x4 : 000000000000002f x3 :
>>>>>> ffff00000356c808
>>>>>> [    2.444407] x2 : ffff800009373da4 x1 : 000000000000e2ac x0 :
>>>>>> ffff80000888eb34
>>>>>> [    2.447190] Call trace:
>>>>>> [    2.449557]  rockchip_usb2phy_otg_sm_work+0x50/0x330
>>>>>> [    2.452169]  process_one_work+0x1d8/0x380
>>>>>> [    2.454684]  worker_thread+0x170/0x4e0
>>>>>> [    2.457056]  kthread+0xd8/0xdc
>>>>>> [    2.459354]  ret_from_fork+0x10/0x20
>>>>>> [    2.461728] Code: 91037015 295be001 f9403c77 b940e413 (f94006e0)
>>>>>> [    2.464338] ---[ end trace 0000000000000000 ]---
>>>>>>
>>>>>> 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 <[email protected]>
>>>>>>> ---
>>>>>>>    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:
>>>>>>
>>>>>> Gruß,
>>>>>> --
>>>>>> Markus Reichl
>>>>>
>>>>> _______________________________________________
>>>>> Linux-rockchip mailing list
>>>>> [email protected]
>>>>> http://lists.infradead.org/mailman/listinfo/linux-rockchip
>
> _______________________________________________
> Linux-rockchip mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-rockchip