Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1483130

Re: [PATCH v4 22/22] phy: Add support for Qualcomm's USB HS phy

Path csiph.com!goblin1!goblin2!goblin.stu.neva.ru!gothmog.csi.it!bofh.it!news.nic.it!robomod
From Peter Chen <hzpeterchen@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4 22/22] phy: Add support for Qualcomm's USB HS phy
Date Wed, 14 Sep 2016 11:40:01 +0200
Message-ID <shePD-7Az-13@gated-at.bofh.it> (permalink)
References <seSJz-5m0-3@gated-at.bofh.it> <seSJA-5m0-41@gated-at.bofh.it> <sgQ0W-6Y0-15@gated-at.bofh.it> <sh7XQ-2c8-9@gated-at.bofh.it> <sh7XQ-2c8-7@gated-at.bofh.it> <shePD-7Az-15@gated-at.bofh.it>
X-Original-To Stephen Boyd <stephen.boyd@linaro.org>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=XDwirLCiUnjujD2cJIuv16UUFB4/30u7jzwRBFba3aQ=; b=HfsuTJfr56a4SKRMnglIjAf1OnWnGKfIg6Vq9lJwAO6qDEWVwBde5Viw/qbh1tO8xg Y7gKq4Lv5fp4+ATRB1jGzU+qYGFv+SzYVb13/uqnh6UeCl8c5NFu1HDxKWYqGodOsRvh r5OMl8ohEOjhhuKWUEWSG04+uHa121WxFwc/1ARcjCzA/RCEGO7h97i1QYkf9g6ppis9 /0xu7o4d4JkTVhbJW2MBy0+pFBSkbZkyhKjBAeZ/9EAYSIDZ7wUPS3WCyiEjW0ctikRo pohvjjYmZiCwF54/97iH1MbQa2SuXn209P6Rhb8FXvMaeLzPWCRcB3dMzR9IU3xJEgsV IdcQ==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=XDwirLCiUnjujD2cJIuv16UUFB4/30u7jzwRBFba3aQ=; b=j6kR4MMabSH67VFxXPEY1qZ6M+VnDtBNFCjvk24cYF0E5QgrZUJt+sUrXwY5sBdPLe cJox6oAu7z+KEZzu7Krkgkvcx+mfDwU8EIarC0Z83RJVKmABVAVimtXwZz9KyM2kxl3n MFydelwG2RJU30KrOYcR+vXAuH9QmKhCU3SEOZQKKhfeaFfmK+1P95UOvy6RjrehFprU mvH7aBdXlYbCRogD4iiw0fu+kDoLIP/zjnfCsMgJajG3ZHheItoV9QBysVJ9pkhfvHHs B0oNgfbqPdeV+3Zi1vlDmdBis5jwnu8wWv831XqCl94wGyF2NMOd30Jpo8Q1G5MjL5iq Irbw==
X-Gm-Message-State AE9vXwPAJNe4y0YgwGRbXBptFsnpn6HBJdsEQE8qgiM+iUfYpuxskhKZBSlW53bF0J5VGA==
X-Received by 10.66.89.230 with SMTP id br6mr2723431pab.49.1473845595494; Wed, 14 Sep 2016 02:33:15 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.24 (2015-08-30)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 103
Organization linux.* mail to news gateway
X-Original-Cc linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Andy Gross <andy.gross@linaro.org>, Bjorn Andersson <bjorn.andersson@linaro.org>, Neil Armstrong <narmstrong@baylibre.com>, Arnd Bergmann <arnd@arndb.de>, Felipe Balbi <balbi@kernel.org>, Peter Chen <peter.chen@nxp.com>, Kishon Vijay Abraham I <kishon@ti.com>, devicetree@vger.kernel.org, Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
X-Original-Date Wed, 14 Sep 2016 17:33:07 +0800
X-Original-Message-ID <20160914093307.GC21674@b29397-desktop>
X-Original-References <20160907213519.27340-1-stephen.boyd@linaro.org> <20160907213519.27340-23-stephen.boyd@linaro.org> <20160913070358.GB30425@b29397-desktop> <147379930484.27460.3849356366746983941@sboyd-linaro> <20160914021133.GB30760@b29397-desktop> <147383455256.1541.16582625295760921275@sboyd-linaro>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1483130

Show key headers only | View raw


On Tue, Sep 13, 2016 at 11:29:12PM -0700, Stephen Boyd wrote:
> Quoting Peter Chen (2016-09-13 19:11:33)
> > On Tue, Sep 13, 2016 at 01:41:44PM -0700, Stephen Boyd wrote:
> > > Quoting Peter Chen (2016-09-13 00:03:58)
> > > > On Wed, Sep 07, 2016 at 02:35:19PM -0700, Stephen Boyd wrote:
> > > > > The high-speed phy on qcom SoCs is controlled via the ULPI
> > > > > viewport.
> > > > > 
> > > > 
> > > > Hi Stephen, I am a little puzzled how this driver co-work with chipidea
> > > > driver. According to nxp IC guys, the ULPI PHY's clock needs to be enabled
> > > > before access portsc.pts (calling hw_phymode_configure), otherwise,
> > > > the system will hang. But I find you call hw_phymode_configure before
> > > > phy->power_on, doesn't your design have this requirement?
> > > 
> > > Which clk needs to be enabled? The xcvr_clk? I believe that clk
> > > corresponds to the "core" clk that we enable in the msm glue driver
> > > layer. When that clk is enabled, the ULPI phy is able to respond to
> > > register read/writes via the ULPI viewport.
> > > 
> > 
> > The input clock for ULPI PHY, maybe it is ref_clk at this PHY driver, 
> > so in your platform, even PHY clock is gated, you can still access
> > portsc.pts to configure PHY mode at controller register?
> 
> There are a couple input clocks for this phy. I'm not sure which one the
> nxp IC guys think needs to be enabled. Typically, the ref_clk is always
> on so it's hard for me to test a scenario where it isn't enabled. But
> I'm not sure that the ref_clk is what we're talking about anyway. Would
> you know the frequency perhaps?

I think this ref_clk is ULPI PHY vendor specific, at USB3317, it is
26Mhz.

> The ref_clk is usually 19.2MHz on these
> SoCs. That would match up with the "crystal input" pin in the ULPI
> spec[1].
> 
> Do you know if this is documented anywhere in the chipidea manual?
> I'll have to look again and see if there's something in there, but I
> didn't see anything like this.
> 
> I would guess that we're talking about the xcvr clock though, because
> from what I see in the manual, this is used to clock the interface
> between the ULPI phy and the controller. In the ULPI spec, this matches
> up with the "clock" signal for the ULPI phy and that usually runs at
> something >= 60MHz. 

I think you are right, since controller only concerns the output clock.
So, if you have not enabled xcvr, you may meet hang when set portsc.pts too?

At some designs, ULPI input clock (ref_clk) may from Soc internal,
without enabling it, the controller will not get PHY clock (60Mhz).
When visiting portsc.pts, may meet hang.

> 
> > 
> > > >        
> > > > Besides, you read ulpi id before phy->power_on, how can read work before
> > > > phy power on?
> > > > 
> > > 
> > > I've found that even having the link clk enabled before phy->power_on
> > > doesn't mean it's possible to read the id registers though. That's
> > > because there can be other power supplies, like regulators, which need
> > > to be on for the phy to operate properly.
> > > 
> > 
> > Then I am puzzled the current initialization for your case, in my mind,
> > it should like below:
> > 
> > qcom_usb_hs_phy_probe->qcom_usb_hs_phy_power_on->ci_ulpi_init
> > 
> > Like other PHYs, it should get PHY first, then power on it, after that,
> > you can access its register.
> > 
> 
> Hmm.. maybe the confusion is in which registers we should be able to
> access? Are we talking about the ULPI viewport MMIO register space or
> the ULPI registers that we access through the viewport? I have a
> hw_phymode_configure() inside of of ci_ulpi_init() so that the
> identification registers through the ULPI viewport read properly
> (assuming there aren't other power requirements like regulators). If we
> don't set the portsc.pts before using the viewport, the viewport doesn't
> work and reads timeout. So we really don't touch the ULPI registers
> except for the scratch space and the id registers until after the phy is
> properly powered on with clks and regulators, because the only place we
> touch them after doing the id checking is in this phy driver in
> qcom_usb_hs_phy_power_on(). We've "solved" the chicken-egg problem where
> we don't know which device driver to probe because the phy needs to be
> powered on to read the id registers to know which device driver to use
> by using DT to match up device drivers instead.
> 
> [1] https://www.sparkfun.com/datasheets/Components/SMD/ULPI_v1_1.pdf

Ok, ulpi phy works like USB device on USB bus which create device at
runtime. So, like some hard-wired USB devices, it may needs power
sequence too, otherwise, how it knows which driver can loads.

-- 

Best Regards,
Peter Chen

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v4 22/22] phy: Add support for Qualcomm's USB HS phy Peter Chen <hzpeterchen@gmail.com> - 2016-09-13 09:10 +0200
  Re: [PATCH v4 22/22] phy: Add support for Qualcomm's USB HS phy Peter Chen <hzpeterchen@gmail.com> - 2016-09-14 04:20 +0200
    Re: [PATCH v4 22/22] phy: Add support for Qualcomm's USB HS phy Peter Chen <hzpeterchen@gmail.com> - 2016-09-14 11:40 +0200
      Re: [PATCH v4 22/22] phy: Add support for Qualcomm's USB HS phy Peter Chen <hzpeterchen@gmail.com> - 2016-09-15 07:30 +0200

csiph-web