* [PATCH] usb:chipidea-imx: honor "phys" dtree property
@ 2022-01-14 10:52 Enrico Scholz
2022-01-17 9:14 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Enrico Scholz @ 2022-01-14 10:52 UTC (permalink / raw)
To: barebox; +Cc: Enrico Scholz
Recent kernel devicetrees changed the "fsl,usbphy" property name to
"phys" on some platforms (e.g. iMX8) but the old one was kept on other
platforms (e.g. iMX6).
Check them both in the usb driver by preferring "phys".
NOTE: this fixes a hard lockup when booting NXP linux kernels on iMX8.
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
---
drivers/usb/imx/chipidea-imx.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index f81477885884..bf8b6f1eb88a 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -218,6 +218,7 @@ static int imx_chipidea_probe(struct device_d *dev)
struct resource *iores;
struct imx_chipidea_data *imx_data;
struct imxusb_platformdata *pdata = dev->platform_data;
+ char const *phynode_name;
int ret;
void __iomem *base;
struct imx_chipidea *ci;
@@ -262,8 +263,19 @@ static int imx_chipidea_probe(struct device_d *dev)
if (!IS_ERR(ci->clk))
clk_enable(ci->clk);
- if (of_property_read_bool(dev->device_node, "fsl,usbphy")) {
- ci->phy = of_phy_get_by_phandle(dev, "fsl,usbphy", 0);
+ /* Device trees are using both "phys" and "fsl,usbphy". Prefer the
+ * more modern former one but fall back to the old one.
+ *
+ * Code should be removed when all devicetrees are using "phys" */
+ if (of_property_read_bool(dev->device_node, "phys"))
+ phynode_name = "phys";
+ else if (of_property_read_bool(dev->device_node, "fsl,usbphy"))
+ phynode_name = "fsl,usbphy";
+ else
+ phynode_name = NULL;
+
+ if (phynode_name) {
+ ci->phy = of_phy_get_by_phandle(dev, phynode_name, 0);
if (IS_ERR(ci->phy)) {
dev_err(dev, "Cannot get phy: %pe\n", ci->phy);
return PTR_ERR(ci->phy);
--
2.33.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] usb:chipidea-imx: honor "phys" dtree property
2022-01-14 10:52 [PATCH] usb:chipidea-imx: honor "phys" dtree property Enrico Scholz
@ 2022-01-17 9:14 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2022-01-17 9:14 UTC (permalink / raw)
To: Enrico Scholz; +Cc: barebox
On Fri, Jan 14, 2022 at 11:52:35AM +0100, Enrico Scholz wrote:
> Recent kernel devicetrees changed the "fsl,usbphy" property name to
> "phys" on some platforms (e.g. iMX8) but the old one was kept on other
> platforms (e.g. iMX6).
>
> Check them both in the usb driver by preferring "phys".
>
> NOTE: this fixes a hard lockup when booting NXP linux kernels on iMX8.
>
> Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
> ---
> drivers/usb/imx/chipidea-imx.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
Applied to master, thanks
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-17 9:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14 10:52 [PATCH] usb:chipidea-imx: honor "phys" dtree property Enrico Scholz
2022-01-17 9:14 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox