linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: "Gupta, Ajay Kumar" <ajay.gupta@ti.com>
Cc: "Balbi, Felipe" <balbi@ti.com>, Tony Lindgren <tony@atomide.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH 2/3 v5] arm: omap: am335x: enable phy controls
Date: Mon, 13 Feb 2012 12:11:18 +0200	[thread overview]
Message-ID: <20120213101117.GI6614@legolas.emea.dhcp.ti.com> (raw)
In-Reply-To: <47CEF8C4B26E8C44B22B028A650E0EA9317F7709@DBDE01.ent.ti.com>

[-- Attachment #1: Type: text/plain, Size: 3543 bytes --]

On Mon, Feb 13, 2012 at 09:40:26AM +0000, Gupta, Ajay Kumar wrote:
> Hi,
> > On Mon, Feb 13, 2012 at 04:26:19AM +0000, Gupta, Ajay Kumar wrote:
> > > Hi,
> > > > * Ajay Kumar Gupta <ajay.gupta@ti.com> [120207 19:55]:
> > > > > Switch on the phy for am335x.
> > > > >
> > > > > Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
> > > > > ---
> > > > >  arch/arm/mach-omap2/omap_phy_internal.c |   21 ++++++++++++++----
> > ---
> > > > >  1 files changed, 14 insertions(+), 7 deletions(-)
> > > > >
> > > > > diff --git a/arch/arm/mach-omap2/omap_phy_internal.c
> > > > > b/arch/arm/mach-
> > > > omap2/omap_phy_internal.c
> > > > > index 4c90477..7129408 100644
> > > > > --- a/arch/arm/mach-omap2/omap_phy_internal.c
> > > > > +++ b/arch/arm/mach-omap2/omap_phy_internal.c
> > > > > @@ -266,7 +266,11 @@ void ti81xx_musb_phy_power(u8 on)
> > > > >  	void __iomem *scm_base = NULL;
> > > > >  	u32 usbphycfg;
> > > > >
> > > > > -	scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
> > > > > +	if (cpu_is_ti81xx())
> > > > > +		scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
> > > > > +	else if (cpu_is_am33xx())
> > > > > +		scm_base = ioremap(AM33XX_SCM_BASE, SZ_2K);
> > > > > +
> > > > >  	if (!scm_base) {
> > > > >  		pr_err("system control module ioremap failed\n");
> > > > >  		return;
> > > > > @@ -278,16 +282,19 @@ void ti81xx_musb_phy_power(u8 on)
> > > > >  		if (cpu_is_ti816x()) {
> > > > >  			usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
> > > > >  			usbphycfg &= ~TI816X_USBPHY_REFCLK_OSC;
> > > > > -		} else if (cpu_is_ti814x()) {
> > > > > -			usbphycfg &= ~(USBPHY_CM_PWRDN |
> > USBPHY_OTG_PWRDN
> > > > > -				| USBPHY_DPINPUT | USBPHY_DMINPUT);
> > > > > -			usbphycfg |= (USBPHY_OTGVDET_EN |
> > USBPHY_OTGSESSEND_EN
> > > > > -				| USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL);
> > > > > +		} else if (cpu_is_ti814x() || cpu_is_am33xx()) {
> > > > > +			usbphycfg &= ~(USBPHY_CM_PWRDN |
> > USBPHY_OTG_PWRDN);
> > > > > +			usbphycfg |= USBPHY_OTGVDET_EN |
> > USBPHY_OTGSESSEND_EN;
> > > > > +			if (cpu_is_ti814x()) {
> > > > > +				usbphycfg &= ~(USBPHY_DPINPUT |
> > > > USBPHY_DMINPUT);
> > > > > +				usbphycfg |= USBPHY_DPOPBUFCTL
> > > > > +					| USBPHY_DMOPBUFCTL;
> > > > > +			}
> > > > >  		}
> > > > >  	} else {
> > > > >  		if (cpu_is_ti816x())
> > > > >  			usbphycfg &= ~TI816X_USBPHY0_NORMAL_MODE;
> > > > > -		else if (cpu_is_ti814x())
> > > > > +		else if (cpu_is_ti814x() || cpu_is_am33xx())
> > > > >  			usbphycfg |= USBPHY_CM_PWRDN |
> > USBPHY_OTG_PWRDN;
> > > > >
> > > >
> > > > Please remove all the cpu_is_xxxx calls from the *_phy_power
> > functions.
> > > > You should need those only in *_phy_init to set the right flags
> > > > once, not every time you enable or disable the phy.
> > >
> > > Tony,
> > >
> > > This is a common function used by ti814x, ti816x and am335x and they
> > > have mostly the same bit map but a few bits are different so we would
> > > need to have cpu_is_xxxx.
> > >
> > > We use this *_phy_power(1) for phy on/init and *_phy_power(0) for phy
> > > off and don't have separate *_phy_init(). Even in that case we would
> > > require
> > > cpu_is_xxxx() as phy power down bit is different for ti816x and same
> > > for ti814x and am335x.
> > >
> > > Please let me know how should we handle this.
> > 
> > use cpu_is_xxxx() to set a flag, and check on the flag.
> 
> Are you saying save the flags once in a local static flag and use
> the same later on?

that's correct.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2012-02-13 10:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-08  4:26 [PATCH 1/3 v5] usb: musb: Add support for ti81xx platform Ajay Kumar Gupta
2012-02-08  4:26 ` [PATCH 2/3 v5] arm: omap: am335x: enable phy controls Ajay Kumar Gupta
     [not found]   ` <1328675212-29693-2-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
2012-02-10 18:31     ` Tony Lindgren
     [not found]       ` <20120210183143.GS1426-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2012-02-13  4:26         ` Gupta, Ajay Kumar
2012-02-13  6:49           ` Felipe Balbi
2012-02-13  9:40             ` Gupta, Ajay Kumar
2012-02-13 10:11               ` Felipe Balbi [this message]
2012-02-08  4:26 ` [PATCH 3/3 v5] usb: musb: enable support for am335x Ajay Kumar Gupta
     [not found] ` <1328675212-29693-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
2012-02-08  6:16   ` [PATCH 1/3 v5] usb: musb: Add support for ti81xx platform Shubhrajyoti
2012-02-09  8:08     ` Felipe Balbi
2012-02-09 11:30       ` Gupta, Ajay Kumar
     [not found]         ` <47CEF8C4B26E8C44B22B028A650E0EA9317F03C8-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-02-13  7:05           ` Gupta, Ajay Kumar
  -- strict thread matches above, loose matches on Subject: below --
2012-02-08  7:41 Ajay Kumar Gupta
2012-02-08  7:41 ` [PATCH 2/3 v5] arm: omap: am335x: enable phy controls Ajay Kumar Gupta
2012-03-05 22:50   ` Tony Lindgren
2012-03-12 12:52     ` Gupta, Ajay Kumar

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=20120213101117.GI6614@legolas.emea.dhcp.ti.com \
    --to=balbi@ti.com \
    --cc=ajay.gupta@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tony@atomide.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 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).