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


Groups > linux.kernel > #1381300 > unrolled thread

Re: [PATCH v6 08/12] usb: hcd: Adapt to OTG core

Started byPeter Chen <hzpeterchen@gmail.com>
First post2016-04-18 08:40 +0200
Last post2016-04-20 08:50 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v6 08/12] usb: hcd: Adapt to OTG core Peter Chen <hzpeterchen@gmail.com> - 2016-04-18 08:40 +0200
    Re: [PATCH v6 08/12] usb: hcd: Adapt to OTG core Peter Chen <hzpeterchen@gmail.com> - 2016-04-19 10:30 +0200
      Re: [PATCH v6 08/12] usb: hcd: Adapt to OTG core Roger Quadros <rogerq@ti.com> - 2016-04-20 08:50 +0200
    Re: [PATCH v6 08/12] usb: hcd: Adapt to OTG core Roger Quadros <rogerq@ti.com> - 2016-04-20 08:50 +0200

#1381300 — Re: [PATCH v6 08/12] usb: hcd: Adapt to OTG core

FromPeter Chen <hzpeterchen@gmail.com>
Date2016-04-18 08:40 +0200
SubjectRe: [PATCH v6 08/12] usb: hcd: Adapt to OTG core
Message-ID<rpb0L-WR-41@gated-at.bofh.it>
On Tue, Apr 05, 2016 at 05:05:13PM +0300, Roger Quadros wrote:
> Introduce usb_otg_add/remove_hcd() for use by host
> controllers that are part of OTG/dual-role port.
> 
> Non Device tree platforms can use the otg_dev argument
> to specify the OTG controller device. If otg_dev is NULL
> then the device tree node's otg-controller property is used to
> get the otg_dev device.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/usb/core/hcd.c  | 71 +++++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/usb/hcd.h |  4 +++
>  2 files changed, 75 insertions(+)
> 
> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> index 6b1930d..6a80193 100644
> --- a/drivers/usb/core/hcd.c
> +++ b/drivers/usb/core/hcd.c
> @@ -46,6 +46,10 @@
>  #include <linux/usb.h>
>  #include <linux/usb/hcd.h>
>  #include <linux/usb/phy.h>
> +#include <linux/usb/otg.h>
> +
> +#include <linux/of.h>
> +#include <linux/of_platform.h>
>  
>  #include "usb.h"
>  
> @@ -3013,6 +3017,73 @@ void usb_remove_hcd(struct usb_hcd *hcd)
>  }
>  EXPORT_SYMBOL_GPL(usb_remove_hcd);
>  
> +
> +static struct otg_hcd_ops otg_hcd_intf = {
> +	.add = usb_add_hcd,
> +	.remove = usb_remove_hcd,
> +	.usb_bus_start_enum = usb_bus_start_enum,
> +	.usb_control_msg = usb_control_msg,
> +	.usb_hub_find_child = usb_hub_find_child,
> +};
> +
> +/**
> + * usb_otg_add_hcd - Register the HCD with OTG core.
> + * @hcd: the usb_hcd structure to initialize
> + * @irqnum: Interrupt line to allocate
> + * @irqflags: Interrupt type flags
> + * @otg_dev: OTG controller device manging this HCD

%s/manging/managing

> + *
> + * Registers the HCD with OTG core. OTG core will call usb_add_hcd()
> + * or usb_remove_hcd() as necessary.
> + * If otg_dev is NULL then device tree node is checked for OTG
> + * controller device via the otg-controller property.
> + */
> +int usb_otg_add_hcd(struct usb_hcd *hcd,
> +		    unsigned int irqnum, unsigned long irqflags,
> +		    struct device *otg_dev)
> +{

Some users may not want to use default otg_hcd_ops, would you please
add one more parameter (eg, hcd_ops) for that? If hcd_ops is NULL, just
use the default one.

> +	struct device *dev = hcd->self.controller;
> +
> +	if (!otg_dev) {
> +		struct device_node *np;
> +		struct platform_device *pdev;
> +
> +		np = of_parse_phandle(dev->of_node, "otg-controller", 0);
> +		if (!np) {
> +			dev_err(dev,
> +				"otg_dev is NULL and no otg-controller property in DT\n");
> +			return -EINVAL;
> +		}
> +
> +		pdev = of_find_device_by_node(np);
> +		of_node_put(np);
> +		if (!pdev) {
> +			dev_err(dev,
> +				"couldn't get otg-controller device\n");
> +			return -ENODEV;
> +		}
> +
> +		hcd->otg_dev = &pdev->dev;
> +	} else {
> +		hcd->otg_dev = otg_dev;
> +	}
> +
> +	return usb_otg_register_hcd(hcd, irqnum, irqflags, &otg_hcd_intf);
> +}
> +EXPORT_SYMBOL_GPL(usb_otg_add_hcd);
> +

-- 

Best Regards,
Peter Chen

[toc] | [next] | [standalone]


#1382273

FromPeter Chen <hzpeterchen@gmail.com>
Date2016-04-19 10:30 +0200
Message-ID<rpzcK-3LU-13@gated-at.bofh.it>
In reply to#1381300
On Mon, Apr 18, 2016 at 02:29:37PM +0800, Peter Chen wrote:
> On Tue, Apr 05, 2016 at 05:05:13PM +0300, Roger Quadros wrote:
> > Introduce usb_otg_add/remove_hcd() for use by host
> > controllers that are part of OTG/dual-role port.
> > 
> > Non Device tree platforms can use the otg_dev argument
> > to specify the OTG controller device. If otg_dev is NULL
> > then the device tree node's otg-controller property is used to
> > get the otg_dev device.
> > 
> > Signed-off-by: Roger Quadros <rogerq@ti.com>
> > ---
> >  drivers/usb/core/hcd.c  | 71 +++++++++++++++++++++++++++++++++++++++++++++++++
> >  include/linux/usb/hcd.h |  4 +++
> >  2 files changed, 75 insertions(+)
> > 
> > diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> > index 6b1930d..6a80193 100644
> > --- a/drivers/usb/core/hcd.c
> > +++ b/drivers/usb/core/hcd.c
> > @@ -46,6 +46,10 @@
> >  #include <linux/usb.h>
> >  #include <linux/usb/hcd.h>
> >  #include <linux/usb/phy.h>
> > +#include <linux/usb/otg.h>
> > +
> > +#include <linux/of.h>
> > +#include <linux/of_platform.h>
> >  
> >  #include "usb.h"
> >  
> > @@ -3013,6 +3017,73 @@ void usb_remove_hcd(struct usb_hcd *hcd)
> >  }
> >  EXPORT_SYMBOL_GPL(usb_remove_hcd);
> >  
> > +
> > +static struct otg_hcd_ops otg_hcd_intf = {
> > +	.add = usb_add_hcd,
> > +	.remove = usb_remove_hcd,
> > +	.usb_bus_start_enum = usb_bus_start_enum,
> > +	.usb_control_msg = usb_control_msg,
> > +	.usb_hub_find_child = usb_hub_find_child,
> > +};
> > +
> > +/**
> > + * usb_otg_add_hcd - Register the HCD with OTG core.
> > + * @hcd: the usb_hcd structure to initialize
> > + * @irqnum: Interrupt line to allocate
> > + * @irqflags: Interrupt type flags
> > + * @otg_dev: OTG controller device manging this HCD
> 
> %s/manging/managing
> 
> > + *
> > + * Registers the HCD with OTG core. OTG core will call usb_add_hcd()
> > + * or usb_remove_hcd() as necessary.
> > + * If otg_dev is NULL then device tree node is checked for OTG
> > + * controller device via the otg-controller property.
> > + */
> > +int usb_otg_add_hcd(struct usb_hcd *hcd,
> > +		    unsigned int irqnum, unsigned long irqflags,
> > +		    struct device *otg_dev)
> > +{
> 
> Some users may not want to use default otg_hcd_ops, would you please
> add one more parameter (eg, hcd_ops) for that? If hcd_ops is NULL, just
> use the default one.
> 

I forgot there is .start_host at otg fsm API when reviewing, so it is
ok to have a unified hcd_ops, the user can do platform things at
fsm.start_host.

-- 

Best Regards,
Peter Chen

[toc] | [prev] | [next] | [standalone]


#1383084

FromRoger Quadros <rogerq@ti.com>
Date2016-04-20 08:50 +0200
Message-ID<rpU7w-3rG-19@gated-at.bofh.it>
In reply to#1382273
On 19/04/16 11:14, Peter Chen wrote:
> On Mon, Apr 18, 2016 at 02:29:37PM +0800, Peter Chen wrote:
>> On Tue, Apr 05, 2016 at 05:05:13PM +0300, Roger Quadros wrote:
>>> Introduce usb_otg_add/remove_hcd() for use by host
>>> controllers that are part of OTG/dual-role port.
>>>
>>> Non Device tree platforms can use the otg_dev argument
>>> to specify the OTG controller device. If otg_dev is NULL
>>> then the device tree node's otg-controller property is used to
>>> get the otg_dev device.
>>>
>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>> ---
>>>  drivers/usb/core/hcd.c  | 71 +++++++++++++++++++++++++++++++++++++++++++++++++
>>>  include/linux/usb/hcd.h |  4 +++
>>>  2 files changed, 75 insertions(+)
>>>
>>> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
>>> index 6b1930d..6a80193 100644
>>> --- a/drivers/usb/core/hcd.c
>>> +++ b/drivers/usb/core/hcd.c
>>> @@ -46,6 +46,10 @@
>>>  #include <linux/usb.h>
>>>  #include <linux/usb/hcd.h>
>>>  #include <linux/usb/phy.h>
>>> +#include <linux/usb/otg.h>
>>> +
>>> +#include <linux/of.h>
>>> +#include <linux/of_platform.h>
>>>  
>>>  #include "usb.h"
>>>  
>>> @@ -3013,6 +3017,73 @@ void usb_remove_hcd(struct usb_hcd *hcd)
>>>  }
>>>  EXPORT_SYMBOL_GPL(usb_remove_hcd);
>>>  
>>> +
>>> +static struct otg_hcd_ops otg_hcd_intf = {
>>> +	.add = usb_add_hcd,
>>> +	.remove = usb_remove_hcd,
>>> +	.usb_bus_start_enum = usb_bus_start_enum,
>>> +	.usb_control_msg = usb_control_msg,
>>> +	.usb_hub_find_child = usb_hub_find_child,
>>> +};
>>> +
>>> +/**
>>> + * usb_otg_add_hcd - Register the HCD with OTG core.
>>> + * @hcd: the usb_hcd structure to initialize
>>> + * @irqnum: Interrupt line to allocate
>>> + * @irqflags: Interrupt type flags
>>> + * @otg_dev: OTG controller device manging this HCD
>>
>> %s/manging/managing
>>
>>> + *
>>> + * Registers the HCD with OTG core. OTG core will call usb_add_hcd()
>>> + * or usb_remove_hcd() as necessary.
>>> + * If otg_dev is NULL then device tree node is checked for OTG
>>> + * controller device via the otg-controller property.
>>> + */
>>> +int usb_otg_add_hcd(struct usb_hcd *hcd,
>>> +		    unsigned int irqnum, unsigned long irqflags,
>>> +		    struct device *otg_dev)
>>> +{
>>
>> Some users may not want to use default otg_hcd_ops, would you please
>> add one more parameter (eg, hcd_ops) for that? If hcd_ops is NULL, just
>> use the default one.
>>
> 
> I forgot there is .start_host at otg fsm API when reviewing, so it is
> ok to have a unified hcd_ops, the user can do platform things at
> fsm.start_host.
> 
OK, great :).

cheers,
-roger

[toc] | [prev] | [next] | [standalone]


#1383080

FromRoger Quadros <rogerq@ti.com>
Date2016-04-20 08:50 +0200
Message-ID<rpU7w-3rG-11@gated-at.bofh.it>
In reply to#1381300
On 18/04/16 09:29, Peter Chen wrote:
> On Tue, Apr 05, 2016 at 05:05:13PM +0300, Roger Quadros wrote:
>> Introduce usb_otg_add/remove_hcd() for use by host
>> controllers that are part of OTG/dual-role port.
>>
>> Non Device tree platforms can use the otg_dev argument
>> to specify the OTG controller device. If otg_dev is NULL
>> then the device tree node's otg-controller property is used to
>> get the otg_dev device.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  drivers/usb/core/hcd.c  | 71 +++++++++++++++++++++++++++++++++++++++++++++++++
>>  include/linux/usb/hcd.h |  4 +++
>>  2 files changed, 75 insertions(+)
>>
>> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
>> index 6b1930d..6a80193 100644
>> --- a/drivers/usb/core/hcd.c
>> +++ b/drivers/usb/core/hcd.c
>> @@ -46,6 +46,10 @@
>>  #include <linux/usb.h>
>>  #include <linux/usb/hcd.h>
>>  #include <linux/usb/phy.h>
>> +#include <linux/usb/otg.h>
>> +
>> +#include <linux/of.h>
>> +#include <linux/of_platform.h>
>>  
>>  #include "usb.h"
>>  
>> @@ -3013,6 +3017,73 @@ void usb_remove_hcd(struct usb_hcd *hcd)
>>  }
>>  EXPORT_SYMBOL_GPL(usb_remove_hcd);
>>  
>> +
>> +static struct otg_hcd_ops otg_hcd_intf = {
>> +	.add = usb_add_hcd,
>> +	.remove = usb_remove_hcd,
>> +	.usb_bus_start_enum = usb_bus_start_enum,
>> +	.usb_control_msg = usb_control_msg,
>> +	.usb_hub_find_child = usb_hub_find_child,
>> +};
>> +
>> +/**
>> + * usb_otg_add_hcd - Register the HCD with OTG core.
>> + * @hcd: the usb_hcd structure to initialize
>> + * @irqnum: Interrupt line to allocate
>> + * @irqflags: Interrupt type flags
>> + * @otg_dev: OTG controller device manging this HCD
> 
> %s/manging/managing

OK.

> 
>> + *
>> + * Registers the HCD with OTG core. OTG core will call usb_add_hcd()
>> + * or usb_remove_hcd() as necessary.
>> + * If otg_dev is NULL then device tree node is checked for OTG
>> + * controller device via the otg-controller property.
>> + */
>> +int usb_otg_add_hcd(struct usb_hcd *hcd,
>> +		    unsigned int irqnum, unsigned long irqflags,
>> +		    struct device *otg_dev)
>> +{
> 
> Some users may not want to use default otg_hcd_ops, would you please
> add one more parameter (eg, hcd_ops) for that? If hcd_ops is NULL, just
> use the default one.
> 

Can we please wait to add anything new till we have such users?

>> +	struct device *dev = hcd->self.controller;
>> +
>> +	if (!otg_dev) {
>> +		struct device_node *np;
>> +		struct platform_device *pdev;
>> +
>> +		np = of_parse_phandle(dev->of_node, "otg-controller", 0);
>> +		if (!np) {
>> +			dev_err(dev,
>> +				"otg_dev is NULL and no otg-controller property in DT\n");
>> +			return -EINVAL;
>> +		}
>> +
>> +		pdev = of_find_device_by_node(np);
>> +		of_node_put(np);
>> +		if (!pdev) {
>> +			dev_err(dev,
>> +				"couldn't get otg-controller device\n");
>> +			return -ENODEV;
>> +		}
>> +
>> +		hcd->otg_dev = &pdev->dev;
>> +	} else {
>> +		hcd->otg_dev = otg_dev;
>> +	}
>> +
>> +	return usb_otg_register_hcd(hcd, irqnum, irqflags, &otg_hcd_intf);
>> +}
>> +EXPORT_SYMBOL_GPL(usb_otg_add_hcd);
>> +
> 

--
cheers,
-roger

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web