* [PATCH for-5.8 0/2] dwc3: meson-g12a: two fixes for v5.8
@ 2020-05-26 20:29 Martin Blumenstingl
2020-05-26 20:29 ` [PATCH for-5.8 1/2] usb: dwc3: meson-g12a: fix error path when fetching the reset line fails Martin Blumenstingl
2020-05-26 20:29 ` [PATCH for-5.8 2/2] usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs Martin Blumenstingl
0 siblings, 2 replies; 7+ messages in thread
From: Martin Blumenstingl @ 2020-05-26 20:29 UTC (permalink / raw)
To: balbi, gregkh, linux-usb, linux-amlogic, narmstrong
Cc: Martin Blumenstingl, hanjie.lin, linux-kernel, linux-arm-kernel,
yue.wang
I discovered the problem addressed by the first patch while I was
investigating a Kernel CI regression: [0]
It is unrelated to that regression but should still be fixed.
The second patch adresses the actual regression. Testing was focussed
on GXL and GXM for the previous patches. Unfortunately one of them
regresses USB on G12A, G12B, SM1 and A1 SoCs.
Please queue these for v5.8 so we don't end up with broken USB on
some boards.
[0] https://lore.kernel.org/linux-usb/ffe2c64c-62ed-9b59-3754-7ede0f0203be@collabora.com/T/#u
Martin Blumenstingl (2):
usb: dwc3: meson-g12a: fix error path when fetching the reset line
fails
usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs
drivers/usb/dwc3/dwc3-meson-g12a.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--
2.26.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH for-5.8 1/2] usb: dwc3: meson-g12a: fix error path when fetching the reset line fails
2020-05-26 20:29 [PATCH for-5.8 0/2] dwc3: meson-g12a: two fixes for v5.8 Martin Blumenstingl
@ 2020-05-26 20:29 ` Martin Blumenstingl
2020-05-27 7:53 ` Neil Armstrong
2020-05-26 20:29 ` [PATCH for-5.8 2/2] usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs Martin Blumenstingl
1 sibling, 1 reply; 7+ messages in thread
From: Martin Blumenstingl @ 2020-05-26 20:29 UTC (permalink / raw)
To: balbi, gregkh, linux-usb, linux-amlogic, narmstrong
Cc: Martin Blumenstingl, hanjie.lin, linux-kernel, linux-arm-kernel,
yue.wang
Disable and unprepare the clocks when devm_reset_control_get_shared()
fails. This fixes the error path as this must disable the clocks which
were previously enabled.
Fixes: 1e355f21d3fb96 ("usb: dwc3: Add Amlogic A1 DWC3 glue")
Cc: Yue Wang <yue.wang@amlogic.com>
Cc: Hanjie Lin <hanjie.lin@amlogic.com>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
drivers/usb/dwc3/dwc3-meson-g12a.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index bd744e82cad4..ce5388338389 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -738,7 +738,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
if (IS_ERR(priv->reset)) {
ret = PTR_ERR(priv->reset);
dev_err(dev, "failed to get device reset, err=%d\n", ret);
- return ret;
+ goto err_disable_clks;
}
ret = reset_control_reset(priv->reset);
--
2.26.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH for-5.8 2/2] usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs
2020-05-26 20:29 [PATCH for-5.8 0/2] dwc3: meson-g12a: two fixes for v5.8 Martin Blumenstingl
2020-05-26 20:29 ` [PATCH for-5.8 1/2] usb: dwc3: meson-g12a: fix error path when fetching the reset line fails Martin Blumenstingl
@ 2020-05-26 20:29 ` Martin Blumenstingl
2020-05-27 8:17 ` Neil Armstrong
1 sibling, 1 reply; 7+ messages in thread
From: Martin Blumenstingl @ 2020-05-26 20:29 UTC (permalink / raw)
To: balbi, gregkh, linux-usb, linux-amlogic, narmstrong
Cc: hanjie.lin, kernelci.org bot, Martin Blumenstingl, linux-kernel,
yue.wang, linux-arm-kernel
dwc3_meson_g12a_usb2_init_phy() crashes with NULL pointer on an SM1
board (which uses the same USB setup as G12A) dereference as reported
by the Kernel CI bot. This is because of the following call flow:
dwc3_meson_g12a_probe
priv->drvdata->setup_regmaps
dwc3_meson_g12a_setup_regmaps
priv->usb2_ports is still 0 so priv->u2p_regmap[i] will be NULL
dwc3_meson_g12a_get_phys
initializes priv->usb2_ports
priv->drvdata->usb_init
dwc3_meson_g12a_usb_init
dwc3_meson_g12a_usb_init_glue
dwc3_meson_g12a_usb2_init
priv->drvdata->usb2_init_phy
dwc3_meson_g12a_usb2_init_phy
dereferences priv->u2p_regmap[i]
Call priv->drvdata->setup_regmaps only after dwc3_meson_g12a_get_phys so
priv->usb2_ports is initialized and the regmaps will be set up
correctly. This fixes the NULL dereference later on.
Fixes: 013af227f58a97 ("usb: dwc3: meson-g12a: handle the phy and glue registers separately")
Reported-by: "kernelci.org bot" <bot@kernelci.org>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
drivers/usb/dwc3/dwc3-meson-g12a.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index ce5388338389..1f7f4d88ed9d 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -708,11 +708,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
return PTR_ERR(base);
priv->drvdata = of_device_get_match_data(&pdev->dev);
-
priv->dev = dev;
- ret = priv->drvdata->setup_regmaps(priv, base);
- if (ret)
- return ret;
priv->vbus = devm_regulator_get_optional(dev, "vbus");
if (IS_ERR(priv->vbus)) {
@@ -749,6 +745,10 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
if (ret)
goto err_disable_clks;
+ ret = priv->drvdata->setup_regmaps(priv, base);
+ if (ret)
+ return ret;
+
if (priv->vbus) {
ret = regulator_enable(priv->vbus);
if (ret)
--
2.26.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH for-5.8 1/2] usb: dwc3: meson-g12a: fix error path when fetching the reset line fails
2020-05-26 20:29 ` [PATCH for-5.8 1/2] usb: dwc3: meson-g12a: fix error path when fetching the reset line fails Martin Blumenstingl
@ 2020-05-27 7:53 ` Neil Armstrong
0 siblings, 0 replies; 7+ messages in thread
From: Neil Armstrong @ 2020-05-27 7:53 UTC (permalink / raw)
To: Martin Blumenstingl, balbi, gregkh, linux-usb, linux-amlogic
Cc: hanjie.lin, linux-kernel, linux-arm-kernel, yue.wang
On 26/05/2020 22:29, Martin Blumenstingl wrote:
> Disable and unprepare the clocks when devm_reset_control_get_shared()
> fails. This fixes the error path as this must disable the clocks which
> were previously enabled.
>
> Fixes: 1e355f21d3fb96 ("usb: dwc3: Add Amlogic A1 DWC3 glue")
> Cc: Yue Wang <yue.wang@amlogic.com>
> Cc: Hanjie Lin <hanjie.lin@amlogic.com>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
> drivers/usb/dwc3/dwc3-meson-g12a.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
> index bd744e82cad4..ce5388338389 100644
> --- a/drivers/usb/dwc3/dwc3-meson-g12a.c
> +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
> @@ -738,7 +738,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
> if (IS_ERR(priv->reset)) {
> ret = PTR_ERR(priv->reset);
> dev_err(dev, "failed to get device reset, err=%d\n", ret);
> - return ret;
> + goto err_disable_clks;
> }
>
> ret = reset_control_reset(priv->reset);
>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH for-5.8 2/2] usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs
2020-05-26 20:29 ` [PATCH for-5.8 2/2] usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs Martin Blumenstingl
@ 2020-05-27 8:17 ` Neil Armstrong
2020-05-27 8:53 ` Greg KH
0 siblings, 1 reply; 7+ messages in thread
From: Neil Armstrong @ 2020-05-27 8:17 UTC (permalink / raw)
To: balbi, gregkh
Cc: hanjie.lin, kernelci.org bot, Martin Blumenstingl, linux-usb,
linux-kernel, yue.wang, linux-amlogic, linux-arm-kernel
Hi Martin,
On 26/05/2020 22:29, Martin Blumenstingl wrote:
> dwc3_meson_g12a_usb2_init_phy() crashes with NULL pointer on an SM1
> board (which uses the same USB setup as G12A) dereference as reported
> by the Kernel CI bot. This is because of the following call flow:
> dwc3_meson_g12a_probe
> priv->drvdata->setup_regmaps
> dwc3_meson_g12a_setup_regmaps
> priv->usb2_ports is still 0 so priv->u2p_regmap[i] will be NULL
> dwc3_meson_g12a_get_phys
> initializes priv->usb2_ports
> priv->drvdata->usb_init
> dwc3_meson_g12a_usb_init
> dwc3_meson_g12a_usb_init_glue
> dwc3_meson_g12a_usb2_init
> priv->drvdata->usb2_init_phy
> dwc3_meson_g12a_usb2_init_phy
> dereferences priv->u2p_regmap[i]
>
> Call priv->drvdata->setup_regmaps only after dwc3_meson_g12a_get_phys so
> priv->usb2_ports is initialized and the regmaps will be set up
> correctly. This fixes the NULL dereference later on.
>
> Fixes: 013af227f58a97 ("usb: dwc3: meson-g12a: handle the phy and glue registers separately")
> Reported-by: "kernelci.org bot" <bot@kernelci.org>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
> drivers/usb/dwc3/dwc3-meson-g12a.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
> index ce5388338389..1f7f4d88ed9d 100644
> --- a/drivers/usb/dwc3/dwc3-meson-g12a.c
> +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
[...]
Fixes regression reported at [1] on SEI510 board based on Amlogic G12A.
Felipe, Greg, can this be queued on uxb-next for 5.8 ?
Acked-by: Neil Armstrong <narmstron@baylibre.com>
Thanks,
Neil
[1] http://lore.kernel.org/r/ffe2c64c-62ed-9b59-3754-7ede0f0203be@collabora.com
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH for-5.8 2/2] usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs
2020-05-27 8:17 ` Neil Armstrong
@ 2020-05-27 8:53 ` Greg KH
2020-05-27 12:56 ` Felipe Balbi
0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2020-05-27 8:53 UTC (permalink / raw)
To: Neil Armstrong
Cc: balbi, hanjie.lin, kernelci.org bot, Martin Blumenstingl,
linux-usb, linux-kernel, yue.wang, linux-amlogic,
linux-arm-kernel
On Wed, May 27, 2020 at 10:17:31AM +0200, Neil Armstrong wrote:
> Hi Martin,
>
> On 26/05/2020 22:29, Martin Blumenstingl wrote:
> > dwc3_meson_g12a_usb2_init_phy() crashes with NULL pointer on an SM1
> > board (which uses the same USB setup as G12A) dereference as reported
> > by the Kernel CI bot. This is because of the following call flow:
> > dwc3_meson_g12a_probe
> > priv->drvdata->setup_regmaps
> > dwc3_meson_g12a_setup_regmaps
> > priv->usb2_ports is still 0 so priv->u2p_regmap[i] will be NULL
> > dwc3_meson_g12a_get_phys
> > initializes priv->usb2_ports
> > priv->drvdata->usb_init
> > dwc3_meson_g12a_usb_init
> > dwc3_meson_g12a_usb_init_glue
> > dwc3_meson_g12a_usb2_init
> > priv->drvdata->usb2_init_phy
> > dwc3_meson_g12a_usb2_init_phy
> > dereferences priv->u2p_regmap[i]
> >
> > Call priv->drvdata->setup_regmaps only after dwc3_meson_g12a_get_phys so
> > priv->usb2_ports is initialized and the regmaps will be set up
> > correctly. This fixes the NULL dereference later on.
> >
> > Fixes: 013af227f58a97 ("usb: dwc3: meson-g12a: handle the phy and glue registers separately")
> > Reported-by: "kernelci.org bot" <bot@kernelci.org>
> > Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> > ---
> > drivers/usb/dwc3/dwc3-meson-g12a.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
> > index ce5388338389..1f7f4d88ed9d 100644
> > --- a/drivers/usb/dwc3/dwc3-meson-g12a.c
> > +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
>
> [...]
>
> Fixes regression reported at [1] on SEI510 board based on Amlogic G12A.
>
> Felipe, Greg, can this be queued on uxb-next for 5.8 ?
>
> Acked-by: Neil Armstrong <narmstron@baylibre.com>
I can take this and patch 1/2 here if Felipe acks them.
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH for-5.8 2/2] usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs
2020-05-27 8:53 ` Greg KH
@ 2020-05-27 12:56 ` Felipe Balbi
0 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2020-05-27 12:56 UTC (permalink / raw)
To: Greg KH, Neil Armstrong
Cc: hanjie.lin, kernelci.org bot, Martin Blumenstingl, linux-usb,
linux-kernel, yue.wang, linux-amlogic, linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 2166 bytes --]
Greg KH <gregkh@linuxfoundation.org> writes:
> On Wed, May 27, 2020 at 10:17:31AM +0200, Neil Armstrong wrote:
>> Hi Martin,
>>
>> On 26/05/2020 22:29, Martin Blumenstingl wrote:
>> > dwc3_meson_g12a_usb2_init_phy() crashes with NULL pointer on an SM1
>> > board (which uses the same USB setup as G12A) dereference as reported
>> > by the Kernel CI bot. This is because of the following call flow:
>> > dwc3_meson_g12a_probe
>> > priv->drvdata->setup_regmaps
>> > dwc3_meson_g12a_setup_regmaps
>> > priv->usb2_ports is still 0 so priv->u2p_regmap[i] will be NULL
>> > dwc3_meson_g12a_get_phys
>> > initializes priv->usb2_ports
>> > priv->drvdata->usb_init
>> > dwc3_meson_g12a_usb_init
>> > dwc3_meson_g12a_usb_init_glue
>> > dwc3_meson_g12a_usb2_init
>> > priv->drvdata->usb2_init_phy
>> > dwc3_meson_g12a_usb2_init_phy
>> > dereferences priv->u2p_regmap[i]
>> >
>> > Call priv->drvdata->setup_regmaps only after dwc3_meson_g12a_get_phys so
>> > priv->usb2_ports is initialized and the regmaps will be set up
>> > correctly. This fixes the NULL dereference later on.
>> >
>> > Fixes: 013af227f58a97 ("usb: dwc3: meson-g12a: handle the phy and glue registers separately")
>> > Reported-by: "kernelci.org bot" <bot@kernelci.org>
>> > Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
>> > ---
>> > drivers/usb/dwc3/dwc3-meson-g12a.c | 8 ++++----
>> > 1 file changed, 4 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
>> > index ce5388338389..1f7f4d88ed9d 100644
>> > --- a/drivers/usb/dwc3/dwc3-meson-g12a.c
>> > +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
>>
>> [...]
>>
>> Fixes regression reported at [1] on SEI510 board based on Amlogic G12A.
>>
>> Felipe, Greg, can this be queued on uxb-next for 5.8 ?
>>
>> Acked-by: Neil Armstrong <narmstron@baylibre.com>
>
> I can take this and patch 1/2 here if Felipe acks them.
Sure thing, Greg. Thanks.
Acked-by: Felipe Balbi <balbi@kernel.org>
--
balbi
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-05-27 12:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26 20:29 [PATCH for-5.8 0/2] dwc3: meson-g12a: two fixes for v5.8 Martin Blumenstingl
2020-05-26 20:29 ` [PATCH for-5.8 1/2] usb: dwc3: meson-g12a: fix error path when fetching the reset line fails Martin Blumenstingl
2020-05-27 7:53 ` Neil Armstrong
2020-05-26 20:29 ` [PATCH for-5.8 2/2] usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs Martin Blumenstingl
2020-05-27 8:17 ` Neil Armstrong
2020-05-27 8:53 ` Greg KH
2020-05-27 12:56 ` Felipe Balbi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).