From: Oliver Graute <oliver.graute@gmail.com>
To: Peter Chen <peter.chen@nxp.com>
Cc: Mathias Nyman <mathias.nyman@intel.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
Felipe Balbi <balbi@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
dl-linux-imx <linux-imx@nxp.com>,
Oliver Graute <Oliver.Graute@KoCoConnector.com>
Subject: Re: using cdns3-imx driver on imx8qm
Date: Tue, 7 Apr 2020 21:57:24 +0200 [thread overview]
Message-ID: <20200407195724.GA17007@portage> (raw)
In-Reply-To: <20200407163706.GA10515@portage>
On 07/04/20, Oliver Graute wrote:
> On 07/04/20, Peter Chen wrote:
> > On 20-04-06 18:25:17, Oliver Graute wrote:
> > > On 03/04/20, Oliver Graute wrote:
> > > > On 31/03/20, Peter Chen wrote:
> > > > >
> > > > > > > compatible = "fsl,imx8qxp-lpcg";
> > > > > > > reg = <0x5b280000 0x10000>;
> > > > > > > #clock-cells = <1>;
> > > > > > > bit-offset = <0 4 16 20 24 28>;
> > > > > > > clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
> > > > > > > <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
> > > > > > > <&conn_ipg_clk>,
> > > > > > > <&conn_ipg_clk>,
> > > > > > > <&conn_ipg_clk>,
> > > > > > > <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
> > > > > > > clock-output-names = "usb3_app_clk",
> > > > > > > "usb3_lpm_clk",
> > > > > > > "usb3_ipg_clk",
> > > > > > > "usb3_core_pclk",
> > > > > > > "usb3_phy_clk",
> > > > > > > "usb3_aclk";
> > > > > > > power-domains = <&pd IMX_SC_R_USB_2_PHY>;
> > > > > > > };
> > > > > > >
> > > > > > > usbotg3: usb3@5b110000 {
> > > > > > > compatible = "fsl,imx8qm-usb3";
> > > > > > > #address-cells = <1>;
> > > > > > > #size-cells = <1>;
> > > > > > > ranges;
> > > > > > > reg = <0x5B110000 0x10000>;
> > > > > > > clocks = <&usb3_lpcg 1>,
> > > > > > > <&usb3_lpcg 0>,
> > > > > > > <&usb3_lpcg 5>,
> > > > > > > <&usb3_lpcg 2>,
> > > > > > > <&usb3_lpcg 3>;
> > > > > > > clock-names = "usb3_lpm_clk", "usb3_bus_clk", "usb3_aclk",
> > > > > > > "usb3_ipg_clk", "usb3_core_pclk";
> > > > > > > assigned-clocks = <&clk IMX_SC_R_USB_2
> > > > > > IMX_SC_PM_CLK_PER>,
> > > > > > > <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
> > > > > > > <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
> > > > > > > assigned-clock-rates = <125000000>, <12000000>, <250000000>;
> > > > > > > power-domains = <&pd IMX_SC_R_USB_2>;
> > > > > > > status = "disabled";
> > > > > > >
> > > > > > > usbotg3_cdns3: cdns3 {
> > > > > > > compatible = "cdns,usb3";
> > > > > > > #address-cells = <1>;
> > > > > > > #size-cells = <1>;
> > > > > > > interrupt-parent = <&gic>;
> > > > > > > interrupts = <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
> > > > > > > <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
> > > > > > > <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>;
> > > > > > > interrupt-names = "host", "peripheral", "otg";
> > > > > > > reg = <0x5B130000 0x10000>, /* memory area for HOST
> > > > > > registers */
> > > > > > > <0x5B140000 0x10000>, /* memory area for
> > > > > > DEVICE registers */
> > > > > > > <0x5B120000 0x10000>; /* memory area for
> > > > > > OTG/DRD registers */
> > > > > > > reg-names = "xhci", "dev", "otg";
> > > > > > > phys = <&usb3_phy>;
> > > > > > > phy-names = "cdns3,usb3-phy";
> > > > > > > status = "disabled";
> > > > > > > };
> > > > > > > };
> > > > > >
> > > > > > Hello Peter,
> > > > > >
> > > > > > thx for the dts example. Now I get "wait clkvld timeout" in "cdns_imx_noncore_init()"
> > > > > > So USB3_SSPHY_STATUS register seems to be wrong.
> > > > > >
> > > > > > dmesg | grep imx
> > > > > > [ 1.065445] cdns3-imx 5b110000.usb3: Adding to iommu group 0
> > > > > > [ 1.257309] imx-scu scu: NXP i.MX SCU Initialized
> > > > > > [ 1.275489] imx-scu-clk: probe of gpt0_clk failed with error -5
> > > > > > [ 1.291143] imx-scu-clk: probe of pwm_clk failed with error -22
> > > > > > [ 1.302517] imx-scu-clk: probe of lcd_clk failed with error -22
> > > > > > [ 1.341405] imx8qm-pinctrl scu:pinctrl: initialized IMX pinctrl driver
> > > > > > [ 3.029484] cdns3-imx 5b110000.usb3: wait clkvld timeout
> > > > > > [ 3.034891] cdns3-imx: probe of 5b110000.usb3 failed with error -110
> > > > > > [ 3.237393] sdhci-esdhc-imx 5b030000.mmc: Got CD GPIO
> > > > > > [ 3.242468] sdhci-esdhc-imx 5b030000.mmc: Got WP GPIO
> > > > > > [ 3.316687] imx8qxp-lpcg-clk 5a4a0000.clock-controller: ignoring dependency for
> > > > > > device, assuming no driver
> > > > > >
> > > > >
> > > > > Make sure the five clocks in dts are correct, and print the USB3_SSPHY_STATUS if
> > > > > timeout still exists.
> > > >
> > > > ok thx, we got it fixed by replacing:
> > > >
> > > > clocks = <&usb3_lpcg 1>,
> > > > <&usb3_lpcg 0>,
> > > > <&usb3_lpcg 4>,
> > > > <&usb3_lpcg 2>,
> > > > <&usb3_lpcg 3>;
> > > >
> > > > with this:
> > > >
> > > > clocks = <&usb3_lpcg IMX_LPCG_CLK_1>,
> > > > <&usb3_lpcg IMX_LPCG_CLK_0>,
> > > > <&usb3_lpcg IMX_LPCG_CLK_7>,
> > > > <&usb3_lpcg IMX_LPCG_CLK_4>,
> > > > <&usb3_lpcg IMX_LPCG_CLK_5>;
> > > >
> > > > now the "wait clkvld timeout" is gone and the USB3_SSPHY_STATUS register
> > > > is very similar to another imx8qm device which runs linux-imx from NXP.
> > > >
> > > > Now I try to get into USB HOST mode:
> > > >
> > > > --- a/drivers/usb/cdns3/cdns3-imx.c
> > > > +++ b/drivers/usb/cdns3/cdns3-imx.c
> > > > @@ -113,11 +115,11 @@ static int cdns_imx_noncore_init(struct cdns_imx *data)
> > > > udelay(1);
> > > >
> > > > value = cdns_imx_readl(data, USB3_CORE_CTRL1);
> > > > - value = (value & ~MODE_STRAP_MASK) | OTG_MODE | OC_DISABLE;
> > > > + value = (value & ~MODE_STRAP_MASK) | HOST_MODE | OC_DISABLE;
> > > > cdns_imx_writel(data, USB3_CORE_CTRL1, value);
> > > >
> > > > Is this change necessary?
> >
> > No
> >
> > > >
> > > > Do I need special changes on xhci.c do get it work with cdns-imx in host mode?
> > > >
> >
> > No
> >
> > > > I'am stuck at:
> > > >
> > > > [ 16.697525] xhci-hcd xhci-hcd.0.auto: can't setup: -110
> > >
> > > A bit more debug information:
> > >
> > > [ 5.988571] cdns-usb3 5b130000.cdns3: DRD version v0 (00000100)
> > > [ 6.012664] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
> > > [ 6.018173] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
> > > [ 6.036369] xhci-hcd xhci-hcd.0.auto: // Halt the HC
> > > [ 6.041335] xhci-hcd xhci-hcd.0.auto: Resetting HCD
> > > [ 6.056364] xhci-hcd xhci-hcd.0.auto: // Reset the HC
> > > [ 16.062450] xhci-hcd xhci-hcd.0.auto: can't setup: -110
> > > [ 16.067686] xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered
> > > [ 16.073361] xhci-hcd: probe of xhci-hcd.0.auto failed with error -110
> > >
> >
> > set dr_mode = "otg" at dts, and after boot up, run below commands at
> > console:
> >
> > echo host > /sys/class/usb_role/5b130000.cdns3-role-switch/role
>
> I tried that but still get same result. Is there a reason to set
> dr_mode = "otg" and do the host mode later on?
>
> Are there any tweaks to get this usb controller working in host mode?
>
> Some further hints for debugging would be helpfull.
it is working now. The usb controller is in host mode now :-)
Your cadence salvo phy driver makes the difference here.
>https://patchwork.kernel.org/patch/11454581/
and the example from here:
https://patchwork.kernel.org/patch/11454579/
Best regards,
Oliver
prev parent reply other threads:[~2020-04-07 19:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-26 17:01 using cdns3-imx driver on imx8qm Oliver Graute
2020-03-27 9:05 ` Peter Chen
2020-03-27 9:50 ` Oliver Graute
2020-03-27 13:21 ` Peter Chen
2020-03-31 14:25 ` Oliver Graute
2020-03-31 14:39 ` Peter Chen
2020-04-01 10:34 ` Oliver Graute
2020-04-01 11:36 ` Felipe Balbi
2020-04-02 1:16 ` Peter Chen
2020-04-03 14:40 ` Oliver Graute
2020-04-06 16:25 ` Oliver Graute
2020-04-07 2:46 ` Peter Chen
2020-04-07 16:37 ` Oliver Graute
2020-04-07 19:57 ` Oliver Graute [this message]
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=20200407195724.GA17007@portage \
--to=oliver.graute@gmail.com \
--cc=Oliver.Graute@KoCoConnector.com \
--cc=balbi@kernel.org \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel@pengutronix.de \
--cc=linux-imx@nxp.com \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=peter.chen@nxp.com \
--cc=s.hauer@pengutronix.de \
/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 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).