All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@freescale.com>
To: Roger Quadros <rogerq@ti.com>
Cc: <stern@rowland.harvard.edu>, <balbi@ti.com>,
	<gregkh@linuxfoundation.org>, <dan.j.williams@intel.com>,
	<jun.li@freescale.com>, <mathias.nyman@linux.intel.com>,
	<tony@atomide.com>, <Joao.Pinto@synopsys.com>,
	<abrestic@chromium.org>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-omap@vger.kernel.org>
Subject: Re: [PATCH v4 10/13] usb: hcd: Adapt to OTG core
Date: Wed, 9 Sep 2015 10:23:37 +0800	[thread overview]
Message-ID: <20150909022336.GG7802@shlinux2> (raw)
In-Reply-To: <1440422484-4737-11-git-send-email-rogerq@ti.com>

On Mon, Aug 24, 2015 at 04:21:21PM +0300, Roger Quadros wrote:
> The existing usb_add/remove_hcd() functionality
> remains unchanged for non-OTG devices. For OTG
> devices they only register the HCD with the OTG core.
> 
> Introduce usb_otg_add/remove_hcd() for use by OTG core.
> These functions actually add/remove the HCD.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/usb/core/hcd.c | 55 +++++++++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 50 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> index c0fd1f6..4851682 100644
> --- a/drivers/usb/core/hcd.c
> +++ b/drivers/usb/core/hcd.c
> @@ -46,6 +46,7 @@
>  #include <linux/usb.h>
>  #include <linux/usb/hcd.h>
>  #include <linux/usb/phy.h>
> +#include <linux/usb/otg.h>
>  
>  #include "usb.h"
>  
> @@ -2625,8 +2626,8 @@ static void usb_put_invalidate_rhdev(struct usb_hcd *hcd)
>   * buffers of consistent memory, register the bus, request the IRQ line,
>   * and call the driver's reset() and start() routines.
>   */
> -int usb_add_hcd(struct usb_hcd *hcd,
> -		unsigned int irqnum, unsigned long irqflags)
> +static int usb_otg_add_hcd(struct usb_hcd *hcd,
> +			   unsigned int irqnum, unsigned long irqflags)

You may change the kernel doc to this name too.

>  {
>  	int retval;
>  	struct usb_device *rhdev;
> @@ -2839,17 +2840,16 @@ err_phy:
>  	}
>  	return retval;
>  }
> -EXPORT_SYMBOL_GPL(usb_add_hcd);
>  
>  /**
> - * usb_remove_hcd - shutdown processing for generic HCDs
> + * usb_otg_remove_hcd - shutdown processing for generic HCDs
>   * @hcd: the usb_hcd structure to remove
>   * Context: !in_interrupt()
>   *
>   * Disconnects the root hub, then reverses the effects of usb_add_hcd(),
>   * invoking the HCD's stop() method.
>   */
> -void usb_remove_hcd(struct usb_hcd *hcd)
> +static void usb_otg_remove_hcd(struct usb_hcd *hcd)
>  {
>  	struct usb_device *rhdev = hcd->self.root_hub;
>  
> @@ -2923,6 +2923,51 @@ void usb_remove_hcd(struct usb_hcd *hcd)
>  
>  	usb_put_invalidate_rhdev(hcd);
>  }
> +
> +static struct otg_hcd_ops otg_hcd_intf = {
> +	.add = usb_otg_add_hcd,
> +	.remove = usb_otg_remove_hcd,
> +};
> +
> +/**
> + * usb_add_hcd - finish generic HCD structure initialization and register
> + * @hcd: the usb_hcd structure to initialize
> + * @irqnum: Interrupt line to allocate
> + * @irqflags: Interrupt type flags
> + *
> + * Finish the remaining parts of generic HCD initialization: allocate the
> + * buffers of consistent memory, register the bus, request the IRQ line,
> + * and call the driver's reset() and start() routines.
> + * If it is an OTG device then it only registers the HCD with OTG core.
> + *
> + */
> +int usb_add_hcd(struct usb_hcd *hcd,
> +		unsigned int irqnum, unsigned long irqflags)
> +{
> +	/* If OTG device, OTG core takes care of adding HCD */
> +	if (usb_otg_register_hcd(hcd, irqnum, irqflags, &otg_hcd_intf))
> +		return usb_otg_add_hcd(hcd, irqnum, irqflags);
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(usb_add_hcd);
> +
> +/**
> + * usb_remove_hcd - shutdown processing for generic HCDs
> + * @hcd: the usb_hcd structure to remove
> + * Context: !in_interrupt()
> + *
> + * Disconnects the root hub, then reverses the effects of usb_add_hcd(),
> + * invoking the HCD's stop() method.
> + * If it is an OTG device then it unregisters the HCD from OTG core
> + * as well.
> + */
> +void usb_remove_hcd(struct usb_hcd *hcd)
> +{
> +	/* If OTG device, OTG core takes care of stopping HCD */
> +	if (usb_otg_unregister_hcd(hcd))
> +		usb_otg_remove_hcd(hcd);
> +}
>  EXPORT_SYMBOL_GPL(usb_remove_hcd);
>  
>  void
> -- 
> 2.1.4
> 

-- 

Best Regards,
Peter Chen

WARNING: multiple messages have this Message-ID (diff)
From: Peter Chen <peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
To: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
Cc: stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org,
	balbi-l0cyMroinI0@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	jun.li-KZfg59tc24xl57MIdRCFDg@public.gmane.org,
	mathias.nyman-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org,
	Joao.Pinto-HKixBCOQz3hWk0Htik3J/w@public.gmane.org,
	abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v4 10/13] usb: hcd: Adapt to OTG core
Date: Wed, 9 Sep 2015 10:23:37 +0800	[thread overview]
Message-ID: <20150909022336.GG7802@shlinux2> (raw)
In-Reply-To: <1440422484-4737-11-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>

On Mon, Aug 24, 2015 at 04:21:21PM +0300, Roger Quadros wrote:
> The existing usb_add/remove_hcd() functionality
> remains unchanged for non-OTG devices. For OTG
> devices they only register the HCD with the OTG core.
> 
> Introduce usb_otg_add/remove_hcd() for use by OTG core.
> These functions actually add/remove the HCD.
> 
> Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
> ---
>  drivers/usb/core/hcd.c | 55 +++++++++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 50 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> index c0fd1f6..4851682 100644
> --- a/drivers/usb/core/hcd.c
> +++ b/drivers/usb/core/hcd.c
> @@ -46,6 +46,7 @@
>  #include <linux/usb.h>
>  #include <linux/usb/hcd.h>
>  #include <linux/usb/phy.h>
> +#include <linux/usb/otg.h>
>  
>  #include "usb.h"
>  
> @@ -2625,8 +2626,8 @@ static void usb_put_invalidate_rhdev(struct usb_hcd *hcd)
>   * buffers of consistent memory, register the bus, request the IRQ line,
>   * and call the driver's reset() and start() routines.
>   */
> -int usb_add_hcd(struct usb_hcd *hcd,
> -		unsigned int irqnum, unsigned long irqflags)
> +static int usb_otg_add_hcd(struct usb_hcd *hcd,
> +			   unsigned int irqnum, unsigned long irqflags)

You may change the kernel doc to this name too.

>  {
>  	int retval;
>  	struct usb_device *rhdev;
> @@ -2839,17 +2840,16 @@ err_phy:
>  	}
>  	return retval;
>  }
> -EXPORT_SYMBOL_GPL(usb_add_hcd);
>  
>  /**
> - * usb_remove_hcd - shutdown processing for generic HCDs
> + * usb_otg_remove_hcd - shutdown processing for generic HCDs
>   * @hcd: the usb_hcd structure to remove
>   * Context: !in_interrupt()
>   *
>   * Disconnects the root hub, then reverses the effects of usb_add_hcd(),
>   * invoking the HCD's stop() method.
>   */
> -void usb_remove_hcd(struct usb_hcd *hcd)
> +static void usb_otg_remove_hcd(struct usb_hcd *hcd)
>  {
>  	struct usb_device *rhdev = hcd->self.root_hub;
>  
> @@ -2923,6 +2923,51 @@ void usb_remove_hcd(struct usb_hcd *hcd)
>  
>  	usb_put_invalidate_rhdev(hcd);
>  }
> +
> +static struct otg_hcd_ops otg_hcd_intf = {
> +	.add = usb_otg_add_hcd,
> +	.remove = usb_otg_remove_hcd,
> +};
> +
> +/**
> + * usb_add_hcd - finish generic HCD structure initialization and register
> + * @hcd: the usb_hcd structure to initialize
> + * @irqnum: Interrupt line to allocate
> + * @irqflags: Interrupt type flags
> + *
> + * Finish the remaining parts of generic HCD initialization: allocate the
> + * buffers of consistent memory, register the bus, request the IRQ line,
> + * and call the driver's reset() and start() routines.
> + * If it is an OTG device then it only registers the HCD with OTG core.
> + *
> + */
> +int usb_add_hcd(struct usb_hcd *hcd,
> +		unsigned int irqnum, unsigned long irqflags)
> +{
> +	/* If OTG device, OTG core takes care of adding HCD */
> +	if (usb_otg_register_hcd(hcd, irqnum, irqflags, &otg_hcd_intf))
> +		return usb_otg_add_hcd(hcd, irqnum, irqflags);
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(usb_add_hcd);
> +
> +/**
> + * usb_remove_hcd - shutdown processing for generic HCDs
> + * @hcd: the usb_hcd structure to remove
> + * Context: !in_interrupt()
> + *
> + * Disconnects the root hub, then reverses the effects of usb_add_hcd(),
> + * invoking the HCD's stop() method.
> + * If it is an OTG device then it unregisters the HCD from OTG core
> + * as well.
> + */
> +void usb_remove_hcd(struct usb_hcd *hcd)
> +{
> +	/* If OTG device, OTG core takes care of stopping HCD */
> +	if (usb_otg_unregister_hcd(hcd))
> +		usb_otg_remove_hcd(hcd);
> +}
>  EXPORT_SYMBOL_GPL(usb_remove_hcd);
>  
>  void
> -- 
> 2.1.4
> 

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-09-09  3:36 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-24 13:21 [PATCH v4 00/13] USB: OTG/DRD Core functionality Roger Quadros
2015-08-24 13:21 ` Roger Quadros
2015-08-24 13:21 ` [PATCH v4 01/13] usb: otg-fsm: Add documentation for struct otg_fsm Roger Quadros
2015-08-24 13:21   ` Roger Quadros
2015-08-24 13:21 ` [PATCH v4 02/13] usb: otg-fsm: support multiple instances Roger Quadros
2015-08-24 13:21   ` Roger Quadros
2015-09-06  5:52   ` Peter Chen
2015-09-06  5:52     ` Peter Chen
2015-08-24 13:21 ` [PATCH v4 03/13] usb: otg-fsm: Prevent build warning "VDBG" redefined Roger Quadros
2015-08-24 13:21   ` Roger Quadros
2015-08-24 13:21 ` [PATCH v4 04/13] otg-fsm: move usb_bus_start_enum into otg-fsm->ops Roger Quadros
2015-08-24 13:21   ` Roger Quadros
2015-09-07  1:24   ` Peter Chen
2015-09-07  1:24     ` Peter Chen
2015-09-07  9:57     ` Roger Quadros
2015-09-07  9:57       ` Roger Quadros
2015-09-08  6:54       ` Peter Chen
2015-09-08  6:54         ` Peter Chen
2015-09-08  8:24         ` Roger Quadros
2015-09-08  8:24           ` Roger Quadros
2015-08-24 13:21 ` [PATCH v4 05/13] usb: hcd.h: Add OTG to HCD interface Roger Quadros
2015-08-24 13:21   ` Roger Quadros
2015-08-24 13:21 ` [PATCH v4 06/13] usb: gadget.h: Add OTG to gadget interface Roger Quadros
2015-08-24 13:21   ` Roger Quadros
2015-08-24 13:21 ` [PATCH v4 07/13] usb: otg: add OTG core Roger Quadros
2015-08-24 13:21   ` Roger Quadros
2015-09-07  1:23   ` Peter Chen
2015-09-07  1:23     ` Peter Chen
2015-09-07 10:23     ` Roger Quadros
2015-09-07 10:23       ` Roger Quadros
2015-09-08  8:31       ` Peter Chen
2015-09-08  8:31         ` Peter Chen
2015-09-08 12:25         ` Roger Quadros
2015-09-08 12:25           ` Roger Quadros
2015-09-08 14:34           ` Alan Stern
2015-09-08 14:34             ` Alan Stern
2015-09-08 17:29             ` Roger Quadros
2015-09-08 17:29               ` Roger Quadros
2015-09-09  2:21           ` Peter Chen
2015-09-09  2:21             ` Peter Chen
2015-09-09  9:08             ` Roger Quadros
2015-09-09  9:08               ` Roger Quadros
2015-09-09  8:13               ` Peter Chen
2015-09-09  8:13                 ` Peter Chen
2015-09-09  9:33                 ` Roger Quadros
2015-09-09  9:33                   ` Roger Quadros
2015-09-09  8:45                   ` Peter Chen
2015-09-09  8:45                     ` Peter Chen
2015-09-09 10:21                     ` Roger Quadros
2015-09-09 10:21                       ` Roger Quadros
2015-09-10  5:35                       ` Peter Chen
2015-09-10  5:35                         ` Peter Chen
2015-09-10 14:17                         ` Roger Quadros
2015-09-10 14:17                           ` Roger Quadros
2015-09-11  1:50                           ` Peter Chen
2015-09-11  1:50                             ` Peter Chen
2015-09-07  7:40   ` Li Jun
2015-09-07  7:40     ` Li Jun
2015-09-07 10:53     ` Roger Quadros
2015-09-07 10:53       ` Roger Quadros
2015-09-09  6:20       ` Li Jun
2015-09-09  6:20         ` Li Jun
2015-09-09 10:01         ` Roger Quadros
2015-09-09 10:01           ` Roger Quadros
2015-09-10  9:28           ` Li Jun
2015-09-10  9:28             ` Li Jun
2015-09-10 14:14             ` Roger Quadros
2015-09-10 14:14               ` Roger Quadros
2015-08-24 13:21 ` [PATCH v4 08/13] usb: doc: dt-binding: Add otg-controller property Roger Quadros
2015-08-24 13:21   ` Roger Quadros
2015-08-24 13:21 ` [PATCH v4 09/13] usb: chipidea: move from CONFIG_USB_OTG_FSM to CONFIG_USB_OTG Roger Quadros
2015-08-24 13:21   ` Roger Quadros
2015-08-24 13:21 ` [PATCH v4 10/13] usb: hcd: Adapt to OTG core Roger Quadros
2015-08-24 13:21   ` Roger Quadros
2015-09-09  2:23   ` Peter Chen [this message]
2015-09-09  2:23     ` Peter Chen
2015-09-09  9:39     ` Roger Quadros
2015-09-09  9:39       ` Roger Quadros
2015-08-24 13:21 ` [PATCH v4 11/13] usb: core: hub: Notify OTG fsm when A device sets b_hnp_enable Roger Quadros
2015-08-24 13:21   ` Roger Quadros
2015-08-24 13:21 ` [PATCH v4 12/13] usb: gadget: udc: adapt to OTG core Roger Quadros
2015-08-24 13:21   ` Roger Quadros
2015-08-24 13:21 ` [PATCH v4 13/13] usb: otg: Add dual-role device (DRD) support Roger Quadros
2015-08-24 13:21   ` Roger Quadros
2015-09-07  7:53   ` Li Jun
2015-09-07  7:53     ` Li Jun
2015-09-07  9:51     ` Roger Quadros
2015-09-07  9:51       ` Roger Quadros
2015-08-26  6:19 ` [PATCH v4 00/13] USB: OTG/DRD Core functionality Peter Chen
2015-08-26  6:19   ` Peter Chen
2015-09-06  7:06 ` Peter Chen
2015-09-06  7:06   ` Peter Chen
2015-09-07 11:42   ` Roger Quadros
2015-09-07 11:42     ` Roger Quadros
2015-12-03  8:19 ` Peter Chen
2015-12-03  8:19   ` Peter Chen
2015-12-03  8:54   ` Roger Quadros
2015-12-03  8:54     ` Roger Quadros

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=20150909022336.GG7802@shlinux2 \
    --to=peter.chen@freescale.com \
    --cc=Joao.Pinto@synopsys.com \
    --cc=abrestic@chromium.org \
    --cc=balbi@ti.com \
    --cc=dan.j.williams@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jun.li@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=rogerq@ti.com \
    --cc=stern@rowland.harvard.edu \
    --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 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.