linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
To: Stephen Boyd <sboyd@codeaurora.org>, Peter Chen <peter.chen@nxp.com>
Cc: Peter Senna Tschudin <peter.senna@collabora.com>,
	Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"open list:USB PHY LAYER" <linux-usb@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] usb-phy-generic: Add support to SMSC USB3315
Date: Fri, 26 May 2017 11:00:30 +0200	[thread overview]
Message-ID: <1495789230.12055.104.camel@collabora.co.uk> (raw)
In-Reply-To: <1495708587.12055.97.camel@collabora.co.uk>

Hello

I modify ci_hrdc_imx_probe to bypass "data->phy = devm_usb_get_phy_by_phandle(&pdev->dev,
"fsl,usbphy", 0);". Everything works as expected and call ci_ulpi_init.

The problem is that in ci_ulpi_init, before calling "ci->ulpi = ulpi_register_interface(ci->dev,
&ci->ulpi_ops);" (to initialize our phy), "hw_phymode_configure(ci);" is called which is the
original function that make our system to hang.

Our phy is not initialised before calling ulpi_register_interface so I don't understand how the phy
can reply if it is not out of reset state.

The conclusion is that using ulpi_bus to manage our phy doesn't improve and we reach the same issue.

I will try to check if we don't do bad things in hw_phymode_configure.
If anyone have an idea it is welcome??

Fabien

On Thu, 2017-05-25 at 12:36 +0200, Fabien Lahoudere wrote:
> On Tue, 2017-05-23 at 14:00 -0700, Stephen Boyd wrote:
> > On 05/23, Fabien Lahoudere wrote:
> > > Hi,
> > > 
> > > We investigate on the topic and now our device tree look like:
> > > 
> > > in imx53.dtsi:
> > > 
> > > usbh2: usb@53f80400 {
> > > 	compatible = "fsl,imx53-usb", "fsl,imx27-usb";
> > >         reg = <0x53f80400 0x0200>;
> > >         interrupts = <16>;
> > >         clocks = <&clks IMX5_CLK_USBOH3_GATE>;
> > >         fsl,usbmisc = <&usbmisc 2>;
> > >         dr_mode = "host";
> > >         status = "disabled";
> > > };
> > > 
> > > usbmisc: usbmisc@53f80800 {
> > > 	#index-cells = <1>;
> > > 	compatible = "fsl,imx53-usbmisc";
> > > 	reg = <0x53f80800 0x200>;
> > > 	clocks = <&clks IMX5_CLK_USBOH3_GATE>;
> > > };
> > > 
> > > and in our dts:
> > > 
> > > &usbh2 {
> > >         pinctrl-names = "default";
> > > 	pinctrl-0 = <&pinctrl_usbh2>;
> > > 	disable-int60ck;
> > >         dr_mode = "host";
> > >         //fsl,usbphy = <&usbphy2>;
> > >         vbus-supply = <&reg_usbh2_vbus>;
> > >         status = "okay";
> > > 	ulpi {
> > >                 phy {
> > >                         compatible = "smsc,usb3315-ulpi";
> > >                         reset-gpios = <&gpio4 4 GPIO_ACTIVE_LOW>;
> > > 			clock-names = "main_clk";
> > > 			/*
> > >                          * Hardware uses CKO2 at 24MHz at several places. Set the parent
> > > 			 *  clock of CKO2 to OSC.
> > >                          */
> > > 			clock-frequency = <24000000>;
> > > 			clocks = <&clks IMX5_CLK_CKO2>;
> > >                         assigned-clocks = <&clks IMX5_CLK_CKO2_SEL>, <&clks IMX5_CLK_OSC>;
> > > 			assigned-clock-parents = <&clks IMX5_CLK_OSC>;
> > >                         status = "okay";
> > >                 };
> > >         };
> > > };
> > > 
> > > And we create a basic driver to check what happened:
> > > 
> > > static int smsc_usb3315_phy_probe(struct ulpi *ulpi)
> > > {
> > >         printk(KERN_ERR "Fabien: %s:%d-%s\n", __FILE__, __LINE__, __func__);
> > > 
> > >         return 0;
> > > }
> > > 
> > > static const struct of_device_id smsc_usb3315_phy_match[] = {
> > >         { .compatible = "smsc,usb3315-phy", },
> > >         { }
> > > };
> > > MODULE_DEVICE_TABLE(of, smsc_usb3315_phy_match);
> > > 
> > > static struct ulpi_driver smsc_usb3315_phy_driver = {
> > >         .probe = smsc_usb3315_phy_probe,
> > >         .driver = {
> > >                 .name = "smsc_usb3315_phy",
> > >                 .of_match_table = smsc_usb3315_phy_match,
> > >         },
> > > };
> > > module_ulpi_driver(smsc_usb3315_phy_driver);
> > > 
> > > /*MODULE_ALIAS("platform:usb_phy_generic");*/
> > > MODULE_AUTHOR("GE Healthcare");
> > > MODULE_DESCRIPTION("SMSC USB 3315 ULPI Phy driver");
> > > MODULE_LICENSE("GPL v2");
> > > 
> > > I checked that the driver is registered by drivers/usb/common/ulpi.c:__ulpi_register_driver
> > > successfully.
> > 
> > Does the ulpi device have some vendor/product ids associated
> > with it? The design is made to only fallback to matching the
> > device to driver based on DT if the ulpi vendor id is 0.
> > Otherwise, if vendor is non-zero you'll need to have a
> > ulpi_device_id id table in your ulpi_driver structure.
> > 
> 
> Hi,
> 
> Thanks Stephen for your reply.
> Indeed we have a vendor/product so I modify my code but without effect.
> 
> After looking at the ulpi source code in the kernel, it seems that I need to call
> ulpi_register_interface. ci_hdrc_probe should be called to execute the ulpi init.
> 
> The problem is that we replace "fsl,usbphy = <&usbphy2>;" by an ulpi node but ci_hdrc_imx_probe
> fail
> because of "data->phy = devm_usb_get_phy_by_phandle(&pdev->dev, "fsl,usbphy", 0);"
> 
> So I will try to adapt ci_hdrc_imx_probe to continue phy initialisation if fsl,usbphy is missing.
> Is it the good way to proceed?
> 
> Thanks for any advice
> Fabien
> 

  reply	other threads:[~2017-05-26  9:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19  6:14 [RFC] usb-phy-generic: Add support to SMSC USB3315 Peter Senna Tschudin
2017-04-19 10:03 ` Sergei Shtylyov
2017-04-19 10:24   ` Peter Senna Tschudin
2017-04-19 17:23     ` Sergei Shtylyov
2017-04-20  8:50 ` Peter Chen
2017-05-23 18:16   ` Fabien Lahoudere
2017-05-23 21:00     ` Stephen Boyd
2017-05-25 10:36       ` Fabien Lahoudere
2017-05-26  9:00         ` Fabien Lahoudere [this message]
2017-06-02 22:00           ` Stephen Boyd
2017-06-05  8:57             ` Fabien Lahoudere
2017-06-05  9:43               ` Peter Chen
2017-06-05  9:52                 ` Fabien Lahoudere
2017-06-06  1:55                   ` Peter Chen
2017-06-06 17:36                     ` Fabien Lahoudere
2017-06-07  1:43                       ` Peter Chen
2017-06-07 15:00                         ` Fabien Lahoudere
2017-06-08 12:27                         ` Fabien Lahoudere
2017-06-09  8:26                           ` Peter Chen
2017-06-09 11:17                             ` Fabien Lahoudere
2017-06-12  1:20                               ` Peter Chen

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=1495789230.12055.104.camel@collabora.co.uk \
    --to=fabien.lahoudere@collabora.co.uk \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.chen@nxp.com \
    --cc=peter.senna@collabora.com \
    --cc=sboyd@codeaurora.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 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).