public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] usb: chipidea: add support for usb_phy in generic usb2
@ 2015-01-04  6:28 Baruch Siach
  2015-01-05  5:39 ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 4+ messages in thread
From: Baruch Siach @ 2015-01-04  6:28 UTC (permalink / raw)
  To: Felipe Balbi, Kishon Vijay Abraham I, Peter Chen
  Cc: linux-usb, linux-kernel, Antoine Tenart, Baruch Siach

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 drivers/usb/chipidea/ci_hdrc_usb2.c | 5 +++++
 1 file changed, 5 insertions(+)

I'm sending this as RFC as I'm not sure this is the right thing to do. There
seems to be a move away from USB specific PHY drivers towards the generic PHY
framework (drivers/phy). The trouble is that my PHY is similar to the mxs PHY
(phy-mxs-usb.c), and like mxs I need the notify_connect/notify_disconnect
callbacks. This functionality is not available is the generic PHY
framework. Having support for both 'usb-phy' and 'phy' properties (as dwc3
seems to do) is particularly bad, since the distinction between the two is a
Linux implementation detail that has nothing to do with hardware description.

So my questions are:

   1. Is there a plan to add notifications support to the generic PHY?

   2. If not, what are my options?

Thanks,
baruch

diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
index 45844c951788..cc3aeb781a57 100644
--- a/drivers/usb/chipidea/ci_hdrc_usb2.c
+++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
@@ -35,11 +35,16 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct ci_hdrc_usb2_priv *priv;
 	struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev);
+	struct usb_phy *usb_phy;
 	int ret;
 
 	if (!ci_pdata)
 		ci_pdata = &ci_default_pdata;
 
+	usb_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
+	if (!IS_ERR(usb_phy))
+		ci_pdata->usb_phy = usb_phy;
+
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
-- 
2.1.4


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

* Re: [PATCH RFC] usb: chipidea: add support for usb_phy in generic usb2
  2015-01-04  6:28 [PATCH RFC] usb: chipidea: add support for usb_phy in generic usb2 Baruch Siach
@ 2015-01-05  5:39 ` Kishon Vijay Abraham I
  2015-01-05  6:40   ` Baruch Siach
  2015-01-09  1:49   ` Peter Chen
  0 siblings, 2 replies; 4+ messages in thread
From: Kishon Vijay Abraham I @ 2015-01-05  5:39 UTC (permalink / raw)
  To: Baruch Siach, Felipe Balbi, Peter Chen
  Cc: linux-usb, linux-kernel, Antoine Tenart

Hi,

On Sunday 04 January 2015 11:58 AM, Baruch Siach wrote:
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
>  drivers/usb/chipidea/ci_hdrc_usb2.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> I'm sending this as RFC as I'm not sure this is the right thing to do. There
> seems to be a move away from USB specific PHY drivers towards the generic PHY
> framework (drivers/phy). The trouble is that my PHY is similar to the mxs PHY
> (phy-mxs-usb.c), and like mxs I need the notify_connect/notify_disconnect
> callbacks. This functionality is not available is the generic PHY
> framework. Having support for both 'usb-phy' and 'phy' properties (as dwc3
> seems to do) is particularly bad, since the distinction between the two is a
> Linux implementation detail that has nothing to do with hardware description.
> 
> So my questions are:
> 
>    1. Is there a plan to add notifications support to the generic PHY?
> 
>    2. If not, what are my options?

extcon framework has notification support. I feel your driver should use the
extcon framework along with phy framework.

Adding extcon support in the generic PHY framework is something I have not
thought through in detail.

Thanks
Kishon

> 
> Thanks,
> baruch
> 
> diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
> index 45844c951788..cc3aeb781a57 100644
> --- a/drivers/usb/chipidea/ci_hdrc_usb2.c
> +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
> @@ -35,11 +35,16 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct ci_hdrc_usb2_priv *priv;
>  	struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev);
> +	struct usb_phy *usb_phy;
>  	int ret;
>  
>  	if (!ci_pdata)
>  		ci_pdata = &ci_default_pdata;
>  
> +	usb_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
> +	if (!IS_ERR(usb_phy))
> +		ci_pdata->usb_phy = usb_phy;
> +
>  	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
>  	if (!priv)
>  		return -ENOMEM;
> 

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

* Re: [PATCH RFC] usb: chipidea: add support for usb_phy in generic usb2
  2015-01-05  5:39 ` Kishon Vijay Abraham I
@ 2015-01-05  6:40   ` Baruch Siach
  2015-01-09  1:49   ` Peter Chen
  1 sibling, 0 replies; 4+ messages in thread
From: Baruch Siach @ 2015-01-05  6:40 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Felipe Balbi, Peter Chen, linux-usb, linux-kernel, Antoine Tenart

Hi Kishon,

On Mon, Jan 05, 2015 at 11:09:35AM +0530, Kishon Vijay Abraham I wrote:
> On Sunday 04 January 2015 11:58 AM, Baruch Siach wrote:
> > Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> > ---
> >  drivers/usb/chipidea/ci_hdrc_usb2.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > I'm sending this as RFC as I'm not sure this is the right thing to do. There
> > seems to be a move away from USB specific PHY drivers towards the generic PHY
> > framework (drivers/phy). The trouble is that my PHY is similar to the mxs PHY
> > (phy-mxs-usb.c), and like mxs I need the notify_connect/notify_disconnect
> > callbacks. This functionality is not available is the generic PHY
> > framework. Having support for both 'usb-phy' and 'phy' properties (as dwc3
> > seems to do) is particularly bad, since the distinction between the two is a
> > Linux implementation detail that has nothing to do with hardware description.
> > 
> > So my questions are:
> > 
> >    1. Is there a plan to add notifications support to the generic PHY?
> > 
> >    2. If not, what are my options?
> 
> extcon framework has notification support. I feel your driver should use the
> extcon framework along with phy framework.

Currently USB PHY notifications are not going through the extcon framework. 
struct usb_phy includes its own notify_connect/notify_disconnect callbacks 
(see include/linux/usb/phy.h). Do you think USB should use extcon instead? USB 
PHY notifies carry the USB interface speed information, while extcon notifies 
seems to only carry boolean cable state.

> Adding extcon support in the generic PHY framework is something I have not
> thought through in detail.

Thanks,
baruch

> > diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c 
> > b/drivers/usb/chipidea/ci_hdrc_usb2.c
> > index 45844c951788..cc3aeb781a57 100644
> > --- a/drivers/usb/chipidea/ci_hdrc_usb2.c
> > +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
> > @@ -35,11 +35,16 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
> >  	struct device *dev = &pdev->dev;
> >  	struct ci_hdrc_usb2_priv *priv;
> >  	struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev);
> > +	struct usb_phy *usb_phy;
> >  	int ret;
> >  
> >  	if (!ci_pdata)
> >  		ci_pdata = &ci_default_pdata;
> >  
> > +	usb_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
> > +	if (!IS_ERR(usb_phy))
> > +		ci_pdata->usb_phy = usb_phy;
> > +
> >  	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> >  	if (!priv)
> >  		return -ENOMEM;
> > 

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

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

* Re: [PATCH RFC] usb: chipidea: add support for usb_phy in generic usb2
  2015-01-05  5:39 ` Kishon Vijay Abraham I
  2015-01-05  6:40   ` Baruch Siach
@ 2015-01-09  1:49   ` Peter Chen
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Chen @ 2015-01-09  1:49 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Felipe Balbi
  Cc: Baruch Siach, linux-usb, linux-kernel, Antoine Tenart

On Mon, Jan 05, 2015 at 11:09:35AM +0530, Kishon Vijay Abraham I wrote:
> Hi,
> 
> On Sunday 04 January 2015 11:58 AM, Baruch Siach wrote:
> > Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> > ---
> >  drivers/usb/chipidea/ci_hdrc_usb2.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > I'm sending this as RFC as I'm not sure this is the right thing to do. There
> > seems to be a move away from USB specific PHY drivers towards the generic PHY
> > framework (drivers/phy). The trouble is that my PHY is similar to the mxs PHY
> > (phy-mxs-usb.c), and like mxs I need the notify_connect/notify_disconnect
> > callbacks. This functionality is not available is the generic PHY
> > framework. Having support for both 'usb-phy' and 'phy' properties (as dwc3
> > seems to do) is particularly bad, since the distinction between the two is a
> > Linux implementation detail that has nothing to do with hardware description.
> > 
> > So my questions are:
> > 
> >    1. Is there a plan to add notifications support to the generic PHY?
> > 
> >    2. If not, what are my options?
> 
> extcon framework has notification support. I feel your driver should use the
> extcon framework along with phy framework.
> 
> Adding extcon support in the generic PHY framework is something I have not
> thought through in detail.
> 

Hi Kishon & Felipe

This is also my concern, we will not accept the new usb phy driver using
current usb_phy interface any more, how usb phy specific interfaces are
existed at generic phy, any plans?

> > 
> > Thanks,
> > baruch
> > 
> > diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
> > index 45844c951788..cc3aeb781a57 100644
> > --- a/drivers/usb/chipidea/ci_hdrc_usb2.c
> > +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
> > @@ -35,11 +35,16 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
> >  	struct device *dev = &pdev->dev;
> >  	struct ci_hdrc_usb2_priv *priv;
> >  	struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev);
> > +	struct usb_phy *usb_phy;
> >  	int ret;
> >  
> >  	if (!ci_pdata)
> >  		ci_pdata = &ci_default_pdata;
> >  
> > +	usb_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
> > +	if (!IS_ERR(usb_phy))
> > +		ci_pdata->usb_phy = usb_phy;
> > +
> >  	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> >  	if (!priv)
> >  		return -ENOMEM;
> > 

-- 

Best Regards,
Peter Chen

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

end of thread, other threads:[~2015-01-09  3:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-04  6:28 [PATCH RFC] usb: chipidea: add support for usb_phy in generic usb2 Baruch Siach
2015-01-05  5:39 ` Kishon Vijay Abraham I
2015-01-05  6:40   ` Baruch Siach
2015-01-09  1:49   ` Peter Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox