All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Harvey <tharvey@gateworks.com>
To: Adam Ford <aford173@gmail.com>, Marek Vasut <marex@denx.de>,
	 Fabio Estevam <festevam@gmail.com>
Cc: Ye Li <ye.li@nxp.com>, Peng Fan <peng.fan@nxp.com>,
	Li Jun <jun.li@nxp.com>,
	sbabic@denx.de, u-boot@lists.denx.de,
	Fabio Estevam <festevam@denx.de>
Subject: Re: [PATCH 1/3] arm: dts: imx8mm: Sync with Linux 6.3
Date: Fri, 28 Apr 2023 10:59:15 -0700	[thread overview]
Message-ID: <CAJ+vNU0JPBu2Q5Cdc5O+Oh+eCmqQ_qtoAZaz4DHVcqsBeg41Tg@mail.gmail.com> (raw)
In-Reply-To: <CAHCN7xL0BFfZuY1pREWjbmqXkPUaC1UZBEZcMKaR7hQTU+rDqQ@mail.gmail.com>

On Fri, Apr 28, 2023 at 9:44 AM Adam Ford <aford173@gmail.com> wrote:
>
> On Fri, Apr 28, 2023 at 11:26 AM Fabio Estevam <festevam@gmail.com> wrote:
> >
> > Hi Tim,
> >
> > On Fri, Apr 28, 2023 at 12:48 PM Tim Harvey <tharvey@gateworks.com> wrote:
> >
> > > Yes I think that is similar enough to test. In my experience simply
> > > enabling otg2 via dt on imx8mm-evk shows the issue I see here but
> > > Fabio says he sees a hang on 'usb start' even before this dt sync and
> > > I don't know why my results on an imx8mm-evk differ.
> >
> > I started from scratch today and now our results match.
> >
> > Applied the following change against U-Boot master:
> >
> > diff --git a/arch/arm/dts/imx8mm-evk.dtsi b/arch/arm/dts/imx8mm-evk.dtsi
> > index 7d6317d95b13..898639e33d5e 100644
> > --- a/arch/arm/dts/imx8mm-evk.dtsi
> > +++ b/arch/arm/dts/imx8mm-evk.dtsi
> > @@ -417,6 +417,10 @@
> >   };
> >  };
> >
> > +&usbotg2 {
> > +      status = "okay";
> > +};
> > +
> >  &usdhc2 {
> >   assigned-clocks = <&clk IMX8MM_CLK_USDHC2>;
> >   assigned-clock-rates = <200000000>;
> > diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig
> > index ab9ad41b4548..70c7a21f2d9f 100644
> > --- a/configs/imx8mm_evk_defconfig
> > +++ b/configs/imx8mm_evk_defconfig
> > @@ -119,3 +119,4 @@ CONFIG_CI_UDC=y
> >  CONFIG_SDP_LOADADDR=0x40400000
> >  CONFIG_USB_GADGET_DOWNLOAD=y
> >  CONFIG_IMX_WATCHDOG=y
> > +CONFIG_CMD_USB=y
> > --
> > 2.34.1
> >
> > Running "usb start" does not hang.
> >
> > Running "ums 0 mmc 1", CTRL+C and then "ums 0 mmc 1" does not work (SD
> > card is not mounted on PC on the second time).
> >
> > After applying the imx8mm.dtsi sync with kernel 6.3:
> >
> > Running "ums 0 mmc 1", CTRL+C and then "ums 0 mmc 1" works fine.
> >
> > "usb start" hangs.
> >
> > So, yes, I agree we cannot do the imx8mm.dtsi sync with 6.3 right now
> > as we need to fix the USB hang first.
> >
> > If anyone has any ideas as to why syncing the commit below:
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/arm64/boot/dts/freescale/imx8mm.dtsi?h=v6.3&id=4585c79ff477f9517b7f384a4fce351417e8fa36
> >
> > causes issues in U-Boot, please let us know.
>
> I am not in a place to test this as I am traveling, but I thought I'd
> throw out an idea.  The power-domain looks like it moved to the
> usbphynop2  driver which has the compatible name of "usb-nop-xceiv"
> Is there a a driver for this?  Does it get enabled?
> If not, maybe we could  update the imx8mm-u-u-boot.dtsi to restore the
> power-domains to a driver that is present.
>

Adam,

Ya, I think you were on the right track here.

There is a driver (driver/phy/nop-phy.c) which does get enabled but
with the dt sync the phy's power domain gets enabled after EHCI
registers are accessed.

I believe the fix we need is the following which moves phy setup
before the register access (where it should have been along with the
case for !defined(CONFIG_PHY):
diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index 91633f013a55..fae20838c60a 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -703,6 +703,10 @@ static int ehci_usb_probe(struct udevice *dev)
        usb_internal_phy_clock_gate(priv->phy_addr, 1);
        usb_phy_enable(ehci, priv->phy_addr);
 #endif
+#else
+       ret = generic_setup_phy(dev, &priv->phy, 0);
+       if (ret)
+               goto err_regulator;
 #endif

 #if CONFIG_IS_ENABLED(DM_REGULATOR)
@@ -725,12 +729,6 @@ static int ehci_usb_probe(struct udevice *dev)

        mdelay(10);

-#if defined(CONFIG_PHY)
-       ret = generic_setup_phy(dev, &priv->phy, 0);
-       if (ret)
-               goto err_regulator;
-#endif
-
        hccr = (struct ehci_hccr *)((uintptr_t)&ehci->caplength);
        hcor = (struct ehci_hcor *)((uintptr_t)hccr +
                        HC_LENGTH(ehci_readl(&(hccr)->cr_capbase)));


If everyone agrees here I'll submit a formal patch which should get
applied through Marek via the usb tree before the dt sync.

Best Regards,

Tim

  reply	other threads:[~2023-04-28 17:59 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-27 18:08 [PATCH 1/3] arm: dts: imx8mm: Sync with Linux 6.3 Fabio Estevam
2023-04-27 18:08 ` [PATCH 2/3] arm: dts: imx8mn: " Fabio Estevam
2023-04-27 19:21   ` Adam Ford
2023-05-03 16:12   ` Tim Harvey
2023-07-14  0:42     ` Tim Harvey
2023-04-27 18:08 ` [PATCH 3/3] arm: dts: imx8mp: " Fabio Estevam
2023-04-27 19:22   ` Adam Ford
2023-05-03 16:11   ` Tim Harvey
2023-05-19 22:19     ` Tim Harvey
2023-05-19 22:26       ` Adam Ford
2023-05-19 22:31         ` Tim Harvey
2023-05-19 22:33           ` Tim Harvey
2023-05-19 22:35             ` Adam Ford
2023-05-19 23:00               ` Tim Harvey
2023-05-22 20:48                 ` Fabio Estevam
2023-05-22 20:52                   ` Adam Ford
2023-05-25  2:02                 ` Fabio Estevam
2023-05-29 17:45                   ` Adam Ford
2023-05-30 17:23                     ` Tim Harvey
2023-05-30 17:28                       ` Adam Ford
2023-05-30 18:40                         ` Tim Harvey
2023-05-30 22:34                           ` Adam Ford
2023-05-30 23:13                             ` Fabio Estevam
2023-05-22  6:49         ` Rasmus Villemoes
2023-04-27 18:56 ` [PATCH 1/3] arm: dts: imx8mm: " Tim Harvey
2023-04-27 19:11   ` Fabio Estevam
2023-04-27 19:14     ` Tim Harvey
2023-04-27 19:19       ` Tim Harvey
2023-04-27 19:26         ` Fabio Estevam
2023-04-27 19:44           ` Tim Harvey
2023-04-27 19:49             ` Fabio Estevam
2023-04-27 22:25               ` Tim Harvey
2023-04-28 11:57                 ` Adam Ford
2023-04-28 15:27                   ` Tim Harvey
2023-04-28 15:32                     ` Adam Ford
2023-04-28 15:48                       ` Tim Harvey
2023-04-28 16:26                         ` Fabio Estevam
2023-04-28 16:44                           ` Adam Ford
2023-04-28 17:59                             ` Tim Harvey [this message]
2023-04-28 18:19                               ` Fabio Estevam
2023-05-03 16:11                                 ` Tim Harvey
2023-07-14  0:42                                   ` Tim Harvey
2023-07-14  5:17                                     ` Stefano Babic
2023-10-17 19:21                                       ` Tim Harvey
2023-10-17 20:28                                         ` Stefano Babic
2023-10-18  8:04                                           ` Stefano Babic
2023-04-27 19:23 ` Adam Ford

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=CAJ+vNU0JPBu2Q5Cdc5O+Oh+eCmqQ_qtoAZaz4DHVcqsBeg41Tg@mail.gmail.com \
    --to=tharvey@gateworks.com \
    --cc=aford173@gmail.com \
    --cc=festevam@denx.de \
    --cc=festevam@gmail.com \
    --cc=jun.li@nxp.com \
    --cc=marex@denx.de \
    --cc=peng.fan@nxp.com \
    --cc=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    --cc=ye.li@nxp.com \
    /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.