From: Tony Lindgren <tony@atomide.com>
To: Sicelo <absicsz@gmail.com>
Cc: linux-usb@vger.kernel.org, linux-omap@vger.kernel.org,
maemo-leste@lists.dyne.org, Felipe Balbi <balbi@kernel.org>,
phone-devel@vger.kernel.org, Bin Liu <b-liu@ti.com>,
Rob Herring <robh@kernel.org>,
"H. Nikolaus Schaller" <hns@goldelico.com>
Subject: Re: [maemo-leste] USB PHY Initialization Fails on Nokia N900 Since 5.19
Date: Fri, 18 Nov 2022 10:12:05 +0200 [thread overview]
Message-ID: <Y3c+VSLcH+c2sLGr@atomide.com> (raw)
In-Reply-To: <Y24JkS3tykIZRH+A@tp440p.steeds.sam>
* Sicelo <absicsz@gmail.com> [221111 08:26]:
> Just for further testing, I added the very ugly patch below. Applied on
> vanilla 6.1-rc3 (i.e. containing 239071064732), USB works normally on
> the N900.
>
> I copied the irq numbers from omap3xxx.dtsi. Does this give us any hints
> regarding the cause and resolution of this issue?
OK thanks that helps, I think it's because the platform IRQ resources are
no longer being automatically populated from devicetree because of the
issues with deferred probe.
Maybe give the following patch a try and see if it helps?
Then assuming this works as a fix I'll post further changes to make also
omap2430 glue layer to probe with ti-sysc interconnect target module
driver in call cases.
Regards,
Tony
8< -------------------
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -15,6 +15,7 @@
#include <linux/list.h>
#include <linux/io.h>
#include <linux/of.h>
+#include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/pm_runtime.h>
@@ -310,6 +311,7 @@ static int omap2430_probe(struct platform_device *pdev)
struct device_node *control_node;
struct platform_device *control_pdev;
int ret = -ENOMEM, val;
+ bool populate_irqs = false;
if (!np)
return -ENODEV;
@@ -328,6 +330,18 @@ static int omap2430_probe(struct platform_device *pdev)
musb->dev.dma_mask = &omap2430_dmamask;
musb->dev.coherent_dma_mask = omap2430_dmamask;
+ /*
+ * Legacy SoCs using omap_device get confused if node is moved
+ * because of interconnect properties mixed into the node.
+ */
+ if (of_get_property(np, "ti,hwmods", NULL)) {
+ dev_warn(&pdev->dev, "please update to probe with ti-sysc\n");
+ populate_irqs = true;
+ } else {
+ device_set_of_node_from_dev(&musb->dev, &pdev->dev);
+ }
+ of_node_put(np);
+
glue->dev = &pdev->dev;
glue->musb = musb;
glue->status = MUSB_UNKNOWN;
@@ -389,6 +403,46 @@ static int omap2430_probe(struct platform_device *pdev)
goto err2;
}
+ if (populate_irqs) {
+ struct resource musb_res[3];
+ struct resource *res;
+ int i = 0;
+
+ memset(musb_res, 0, sizeof(*musb_res) * ARRAY_SIZE(musb_res));
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ goto err2;
+
+ musb_res[i].start = res->start;
+ musb_res[i].end = res->end;
+ musb_res[i].flags = res->flags;
+ musb_res[i].name = res->name;
+ i++;
+
+ ret = of_irq_get_byname(np, "mc");
+ if (ret > 0) {
+ musb_res[i].start = ret;
+ musb_res[i].flags = IORESOURCE_IRQ;
+ musb_res[i].name = "mc";
+ i++;
+ }
+
+ ret = of_irq_get_byname(np, "dma");
+ if (ret > 0) {
+ musb_res[i].start = ret;
+ musb_res[i].flags = IORESOURCE_IRQ;
+ musb_res[i].name = "dma";
+ i++;
+ }
+
+ ret = platform_device_add_resources(musb, musb_res, i);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to add IRQ resources\n");
+ goto err2;
+ }
+ }
+
ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
dev_err(&pdev->dev, "failed to add platform_data\n");
--
2.38.1
next prev parent reply other threads:[~2022-11-18 8:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 9:08 USB PHY Initialization Fails on Nokia N900 Since 5.19 Sicelo
2022-10-11 5:39 ` [maemo-leste] " Tony Lindgren
2022-10-11 10:44 ` Sicelo
2022-11-11 8:36 ` Sicelo
2022-11-18 8:12 ` Tony Lindgren [this message]
2022-11-18 9:24 ` Sicelo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y3c+VSLcH+c2sLGr@atomide.com \
--to=tony@atomide.com \
--cc=absicsz@gmail.com \
--cc=b-liu@ti.com \
--cc=balbi@kernel.org \
--cc=hns@goldelico.com \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=maemo-leste@lists.dyne.org \
--cc=phone-devel@vger.kernel.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.