All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] USB phy type C
@ 2015-02-12 18:41 David Cohen
  2015-02-12 18:45 ` Felipe Balbi
  0 siblings, 1 reply; 4+ messages in thread
From: David Cohen @ 2015-02-12 18:41 UTC (permalink / raw)
  To: balbi; +Cc: linux-usb, linux-kernel, yousaf.kaukab, nirmala.bailur

Hi Felipe, et al,

Is there any on going discussion regarding to USB phy for type C connectors?

We'd like to know the community's preferable direction for handling
(still unsupported) cases like USB3.1 PD, Accessories and Alternate
modes as a new layer or an extension of current USB phy layer.

Comments are welcome :)

Br, David

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] USB phy type C
  2015-02-12 18:41 [RFC] USB phy type C David Cohen
@ 2015-02-12 18:45 ` Felipe Balbi
  2015-02-12 19:27   ` David Cohen
  0 siblings, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2015-02-12 18:45 UTC (permalink / raw)
  To: David Cohen; +Cc: balbi, linux-usb, linux-kernel, yousaf.kaukab, nirmala.bailur

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

Hi,

On Thu, Feb 12, 2015 at 10:41:37AM -0800, David Cohen wrote:
> Hi Felipe, et al,
> 
> Is there any on going discussion regarding to USB phy for type C connectors?
> 
> We'd like to know the community's preferable direction for handling
> (still unsupported) cases like USB3.1 PD, Accessories and Alternate
> modes as a new layer or an extension of current USB phy layer.
> 
> Comments are welcome :)

Not the USB phy layer, but the generic phy layer. All you need to do is
add a new phy provider and add support for it from within dwc3.
Something like below:

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 9f0e209b8f6c..55a85b40e43e 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -653,6 +653,19 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
 		}
 	}
 
+	dwc->usb3_typec_phy = devm_phy_get(dev, "usb3-typec-phy");
+	if (IS_ERR(dwc->usb3_typec_phy)) {
+		ret = PTR_ERR(dwc->usb3_typec_phy);
+		if (ret == -ENOSYS || ret == -ENODEV) {
+			dwc->usb3_typec_phy = NULL;
+		} else if (ret == -EPROBE_DEFER) {
+			return ret;
+		} else {
+			dev_err(dev, "no usb3 typeC phy, continuing without\n");
+			dwc->usb3_typec_phy = NULL;
+		}
+	}
+
 	return 0;
 }
 

The only interesting part will be dealing with the other modes of
operation, I haven't wrapped my head around it yet.

-- 
balbi

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC] USB phy type C
  2015-02-12 18:45 ` Felipe Balbi
@ 2015-02-12 19:27   ` David Cohen
  2015-02-12 19:55     ` Felipe Balbi
  0 siblings, 1 reply; 4+ messages in thread
From: David Cohen @ 2015-02-12 19:27 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-usb, linux-kernel, yousaf.kaukab, nirmala.bailur

On Thu, Feb 12, 2015 at 12:45:53PM -0600, Felipe Balbi wrote:
> Hi,
> 
> On Thu, Feb 12, 2015 at 10:41:37AM -0800, David Cohen wrote:
> > Hi Felipe, et al,
> > 
> > Is there any on going discussion regarding to USB phy for type C connectors?
> > 
> > We'd like to know the community's preferable direction for handling
> > (still unsupported) cases like USB3.1 PD, Accessories and Alternate
> > modes as a new layer or an extension of current USB phy layer.
> > 
> > Comments are welcome :)
> 
> Not the USB phy layer, but the generic phy layer. All you need to do is
> add a new phy provider and add support for it from within dwc3.
> Something like below:
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 9f0e209b8f6c..55a85b40e43e 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -653,6 +653,19 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
>  		}
>  	}
>  
> +	dwc->usb3_typec_phy = devm_phy_get(dev, "usb3-typec-phy");
> +	if (IS_ERR(dwc->usb3_typec_phy)) {
> +		ret = PTR_ERR(dwc->usb3_typec_phy);
> +		if (ret == -ENOSYS || ret == -ENODEV) {
> +			dwc->usb3_typec_phy = NULL;
> +		} else if (ret == -EPROBE_DEFER) {
> +			return ret;
> +		} else {
> +			dev_err(dev, "no usb3 typeC phy, continuing without\n");
> +			dwc->usb3_typec_phy = NULL;
> +		}
> +	}
> +
>  	return 0;
>  }

Thanks. That's a nice direction.

>  
> 
> The only interesting part will be dealing with the other modes of
> operation, I haven't wrapped my head around it yet.

We'll probably get back to here with more questions/proposals about
that.

Br, David

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] USB phy type C
  2015-02-12 19:27   ` David Cohen
@ 2015-02-12 19:55     ` Felipe Balbi
  0 siblings, 0 replies; 4+ messages in thread
From: Felipe Balbi @ 2015-02-12 19:55 UTC (permalink / raw)
  To: David Cohen
  Cc: Felipe Balbi, linux-usb, linux-kernel, yousaf.kaukab,
	nirmala.bailur

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

On Thu, Feb 12, 2015 at 11:27:28AM -0800, David Cohen wrote:
> On Thu, Feb 12, 2015 at 12:45:53PM -0600, Felipe Balbi wrote:
> > Hi,
> > 
> > On Thu, Feb 12, 2015 at 10:41:37AM -0800, David Cohen wrote:
> > > Hi Felipe, et al,
> > > 
> > > Is there any on going discussion regarding to USB phy for type C connectors?
> > > 
> > > We'd like to know the community's preferable direction for handling
> > > (still unsupported) cases like USB3.1 PD, Accessories and Alternate
> > > modes as a new layer or an extension of current USB phy layer.
> > > 
> > > Comments are welcome :)
> > 
> > Not the USB phy layer, but the generic phy layer. All you need to do is
> > add a new phy provider and add support for it from within dwc3.
> > Something like below:
> > 
> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> > index 9f0e209b8f6c..55a85b40e43e 100644
> > --- a/drivers/usb/dwc3/core.c
> > +++ b/drivers/usb/dwc3/core.c
> > @@ -653,6 +653,19 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
> >  		}
> >  	}
> >  
> > +	dwc->usb3_typec_phy = devm_phy_get(dev, "usb3-typec-phy");
> > +	if (IS_ERR(dwc->usb3_typec_phy)) {
> > +		ret = PTR_ERR(dwc->usb3_typec_phy);
> > +		if (ret == -ENOSYS || ret == -ENODEV) {
> > +			dwc->usb3_typec_phy = NULL;
> > +		} else if (ret == -EPROBE_DEFER) {
> > +			return ret;
> > +		} else {
> > +			dev_err(dev, "no usb3 typeC phy, continuing without\n");
> > +			dwc->usb3_typec_phy = NULL;
> > +		}
> > +	}
> > +
> >  	return 0;
> >  }
> 
> Thanks. That's a nice direction.

btw, for typec, let's support only the new phy framework, that ought to
get people to move :-)

-- 
balbi

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-12 19:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-12 18:41 [RFC] USB phy type C David Cohen
2015-02-12 18:45 ` Felipe Balbi
2015-02-12 19:27   ` David Cohen
2015-02-12 19:55     ` Felipe Balbi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.