diff mbox

[v2,06/22] usb: chipidea: Add platform flag for wrapper phy management

Message ID 20160707222114.1673-7-stephen.boyd@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Stephen Boyd July 7, 2016, 10:20 p.m. UTC
The ULPI phy on qcom platforms needs to be initialized and
powered on after a USB reset and before we toggle the run/stop
bit. Otherwise, the phy locks up and doesn't work properly.
Therefore, add a flag to skip any phy power management in the
core layer, leaving it up to the glue driver to manage.

Cc: Peter Chen <peter.chen@nxp.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
---
 drivers/usb/chipidea/core.c  | 6 ++++++
 include/linux/usb/chipidea.h | 1 +
 2 files changed, 7 insertions(+)

Comments

Peter Chen July 8, 2016, 9:25 a.m. UTC | #1
On Thu, Jul 07, 2016 at 03:20:57PM -0700, Stephen Boyd wrote:
> The ULPI phy on qcom platforms needs to be initialized and
> powered on after a USB reset and before we toggle the run/stop
> bit. Otherwise, the phy locks up and doesn't work properly.
> Therefore, add a flag to skip any phy power management in the
> core layer, leaving it up to the glue driver to manage.
> 
> Cc: Peter Chen <peter.chen@nxp.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
> ---
>  drivers/usb/chipidea/core.c  | 6 ++++++
>  include/linux/usb/chipidea.h | 1 +
>  2 files changed, 7 insertions(+)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 01390e02ee53..532085a096d9 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -361,6 +361,9 @@ static int _ci_usb_phy_init(struct ci_hdrc *ci)
>   */
>  static void ci_usb_phy_exit(struct ci_hdrc *ci)
>  {
> +	if (ci->platdata->flags & CI_HDRC_OVERRIDE_PHY_CONTROL)
> +		return;
> +
>  	if (ci->phy) {
>  		phy_power_off(ci->phy);
>  		phy_exit(ci->phy);
> @@ -379,6 +382,9 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
>  {
>  	int ret;
>  
> +	if (ci->platdata->flags & CI_HDRC_OVERRIDE_PHY_CONTROL)
> +		return 0;
> +

How you handle the code for PHY getting at probe?
Stephen Boyd Aug. 5, 2016, 9:46 p.m. UTC | #2
Quoting Peter Chen (2016-07-08 02:25:35)
> On Thu, Jul 07, 2016 at 03:20:57PM -0700, Stephen Boyd wrote:
> > The ULPI phy on qcom platforms needs to be initialized and
> > powered on after a USB reset and before we toggle the run/stop
> > bit. Otherwise, the phy locks up and doesn't work properly.
> > Therefore, add a flag to skip any phy power management in the
> > core layer, leaving it up to the glue driver to manage.
> > 
> > Cc: Peter Chen <peter.chen@nxp.com>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
> > ---
> >  drivers/usb/chipidea/core.c  | 6 ++++++
> >  include/linux/usb/chipidea.h | 1 +
> >  2 files changed, 7 insertions(+)
> > 
> > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> > index 01390e02ee53..532085a096d9 100644
> > --- a/drivers/usb/chipidea/core.c
> > +++ b/drivers/usb/chipidea/core.c
> > @@ -361,6 +361,9 @@ static int _ci_usb_phy_init(struct ci_hdrc *ci)
> >   */
> >  static void ci_usb_phy_exit(struct ci_hdrc *ci)
> >  {
> > +     if (ci->platdata->flags & CI_HDRC_OVERRIDE_PHY_CONTROL)
> > +             return;
> > +
> >       if (ci->phy) {
> >               phy_power_off(ci->phy);
> >               phy_exit(ci->phy);
> > @@ -379,6 +382,9 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
> >  {
> >       int ret;
> >  
> > +     if (ci->platdata->flags & CI_HDRC_OVERRIDE_PHY_CONTROL)
> > +             return 0;
> > +
> 
> How you handle the code for PHY getting at probe?
> 

Which probe? Glue layer probe? In my case I'm not using the phy until
the RESET/STOPPED event so I just rely on the chipidea core to get the
phy and then control the phy manually in the glue layer.
Peter Chen Aug. 6, 2016, 7:59 a.m. UTC | #3
On Fri, Aug 05, 2016 at 02:46:00PM -0700, Stephen Boyd wrote:
> Quoting Peter Chen (2016-07-08 02:25:35)
> > On Thu, Jul 07, 2016 at 03:20:57PM -0700, Stephen Boyd wrote:
> > > The ULPI phy on qcom platforms needs to be initialized and
> > > powered on after a USB reset and before we toggle the run/stop
> > > bit. Otherwise, the phy locks up and doesn't work properly.
> > > Therefore, add a flag to skip any phy power management in the
> > > core layer, leaving it up to the glue driver to manage.
> > > 
> > > Cc: Peter Chen <peter.chen@nxp.com>
> > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
> > > ---
> > >  drivers/usb/chipidea/core.c  | 6 ++++++
> > >  include/linux/usb/chipidea.h | 1 +
> > >  2 files changed, 7 insertions(+)
> > > 
> > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> > > index 01390e02ee53..532085a096d9 100644
> > > --- a/drivers/usb/chipidea/core.c
> > > +++ b/drivers/usb/chipidea/core.c
> > > @@ -361,6 +361,9 @@ static int _ci_usb_phy_init(struct ci_hdrc *ci)
> > >   */
> > >  static void ci_usb_phy_exit(struct ci_hdrc *ci)
> > >  {
> > > +     if (ci->platdata->flags & CI_HDRC_OVERRIDE_PHY_CONTROL)
> > > +             return;
> > > +
> > >       if (ci->phy) {
> > >               phy_power_off(ci->phy);
> > >               phy_exit(ci->phy);
> > > @@ -379,6 +382,9 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
> > >  {
> > >       int ret;
> > >  
> > > +     if (ci->platdata->flags & CI_HDRC_OVERRIDE_PHY_CONTROL)
> > > +             return 0;
> > > +
> > 
> > How you handle the code for PHY getting at probe?
> > 
> 
> Which probe? Glue layer probe? In my case I'm not using the phy until
> the RESET/STOPPED event so I just rely on the chipidea core to get the
> phy and then control the phy manually in the glue layer.

I have no idea about it after reading your patch 10/22.
Stephen Boyd Aug. 8, 2016, 11:46 p.m. UTC | #4
Quoting Peter Chen (2016-08-06 00:59:25)
> On Fri, Aug 05, 2016 at 02:46:00PM -0700, Stephen Boyd wrote:
> > Quoting Peter Chen (2016-07-08 02:25:35)
> > > 
> > > How you handle the code for PHY getting at probe?
> > > 
> > 
> > Which probe? Glue layer probe? In my case I'm not using the phy until
> > the RESET/STOPPED event so I just rely on the chipidea core to get the
> > phy and then control the phy manually in the glue layer.
> 
> I have no idea about it after reading your patch 10/22.
> 

Sorry, you lost me now. What is the question?
Peter Chen Aug. 9, 2016, 12:36 a.m. UTC | #5
>> On Fri, Aug 05, 2016 at 02:46:00PM -0700, Stephen Boyd wrote:
>> > Quoting Peter Chen (2016-07-08 02:25:35)
>> > >
>> > > How you handle the code for PHY getting at probe?
>> > >
>> >
>> > Which probe? Glue layer probe? In my case I'm not using the phy
>> > until the RESET/STOPPED event so I just rely on the chipidea core to
>> > get the phy and then control the phy manually in the glue layer.
>>
>> I have no idea about it after reading your patch 10/22.
>>
>
>Sorry, you lost me now. What is the question?

At first, I don't know how you get the PHY for ULPI. But after reading your
later patch, I know it. So,  it is ok for this patch.

Acked-by: Peter Chen <peter.chen@nxp.com>

Peter
diff mbox

Patch

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 01390e02ee53..532085a096d9 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -361,6 +361,9 @@  static int _ci_usb_phy_init(struct ci_hdrc *ci)
  */
 static void ci_usb_phy_exit(struct ci_hdrc *ci)
 {
+	if (ci->platdata->flags & CI_HDRC_OVERRIDE_PHY_CONTROL)
+		return;
+
 	if (ci->phy) {
 		phy_power_off(ci->phy);
 		phy_exit(ci->phy);
@@ -379,6 +382,9 @@  static int ci_usb_phy_init(struct ci_hdrc *ci)
 {
 	int ret;
 
+	if (ci->platdata->flags & CI_HDRC_OVERRIDE_PHY_CONTROL)
+		return 0;
+
 	switch (ci->platdata->phy_mode) {
 	case USBPHY_INTERFACE_MODE_UTMI:
 	case USBPHY_INTERFACE_MODE_UTMIW:
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index f9be467d6695..d07b162073f7 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -57,6 +57,7 @@  struct ci_hdrc_platform_data {
 #define CI_HDRC_OVERRIDE_AHB_BURST	BIT(9)
 #define CI_HDRC_OVERRIDE_TX_BURST	BIT(10)
 #define CI_HDRC_OVERRIDE_RX_BURST	BIT(11)
+#define CI_HDRC_OVERRIDE_PHY_CONTROL	BIT(12) /* Glue layer manages phy */
 	enum usb_dr_mode	dr_mode;
 #define CI_HDRC_CONTROLLER_RESET_EVENT		0
 #define CI_HDRC_CONTROLLER_STOPPED_EVENT	1