mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: Peter Chen <hzpeterchen@gmail.com>
Cc: <peter.chen@freescale.com>, <stern@rowland.harvard.edu>,
	<balbi@kernel.org>, <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>,
	<yoshihiro.shimoda.uh@renesas.com>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-omap@vger.kernel.org>,
	<devicetree@vger.kernel.org>
Subject: Re: [PATCH v7 00/14] USB OTG/dual-role framework
Date: Wed, 11 May 2016 14:05:58 +0300	[thread overview]
Message-ID: <57331216.5060601@ti.com> (raw)
In-Reply-To: <20160511083619.GF16910@shlinux2.ap.freescale.net>

On 11/05/16 11:36, Peter Chen wrote:
> On Mon, May 02, 2016 at 03:18:43PM +0300, Roger Quadros wrote:
>> Hi,
>>
>> This series centralizes OTG/Dual-role functionality in the kernel.
>> As of now I've got Dual-role functionality working pretty reliably on
>> dra7-evm and am437x-gp-evm.
>>
>> DWC3 controller and platform related patches will be sent separately.
>>
>> Series is based on v4.6-rc1 and depends on first 2 patches of [1]
>> [1] - OTG fsm cleanup - https://lkml.org/lkml/2016/3/30/186
>>
>> Why?:
>> ----
>>
>> Currently there is no central location where OTG/dual-role functionality is
>> implemented in the Linux USB stack and every USB controller driver is
>> doing their own thing for OTG/dual-role. We can benefit from code-reuse
>> and simplicity by adding the OTG/dual-role core driver.
>>
>> Newer OTG cores support standard host interface (e.g. xHCI) so
>> host and gadget functionality are no longer closely knit like older
>> cores. There needs to be a way to co-ordinate the operation of the
>> host and gadget controllers in dual-role mode. i.e. to stop and start them
>> from a central location. This central location should be the
>> USB OTG/dual-role core.
>>
>> Host and gadget controllers might be sharing resources and can't
>> be always running. One has to be stopped for the other to run.
>> This couldn't be done till now but can be done from the OTG core.
>>
>> What?:
>> -----
>>
>> The OTG/dual-role core consists of a set of APIs that allow
>> registration of OTG controller device and OTG capable host and gadget
>> controllers.
>>
>> - The OTG controller driver can provide the OTG capabilities and the
>> Finite State Machine work function via 'struct usb_otg_config'
>> at the time of registration i.e. usb_otg_register();
>>
>> 	struct usb_otg *usb_otg_register(struct device *dev,
>>         	                         struct usb_otg_config *config);
>> 	int usb_otg_unregister(struct device *dev);
>> 	/**
>> 	 * struct usb_otg_config - otg controller configuration
>> 	 * @caps: otg capabilities of the controller
>> 	 * @ops: otg fsm operations
>> 	 * @otg_work: optional custom otg state machine work function
>> 	 */
>> 	struct usb_otg_config {
>> 	        struct usb_otg_caps *otg_caps;
>> 	        struct otg_fsm_ops *fsm_ops;
>> 	        void (*otg_work)(struct work_struct *work);
>> 	};
>>
>> The dual-role state machine is built-into the OTG core so nothing
>> special needs to be provided if only dual-role functionality is desired.
>> The low level OTG controller driver ops are povided via
>> 'struct otg_fsm_ops *fsm_ops' in the 'struct usb_otg_config'.
>>
>> After registration, the OTG core waits for host, gadget controller
>> and the gadget function driver to be registered. Once all resources are
>> available it instantiates the Finite State Machine (FSM).
>> The host/gadget controllers are started/stopped according to the FSM.
>>
>> - Host and gadget controllers that are a part of OTG/dual-role port must
>> use the OTG core provided APIs to add/remove the host/gadget.
>> i.e. hosts must use usb_otg_add_hcd() usb_otg_remove_hcd(),,
>> gadgets must use usb_otg_add_gadget_udc() usb_del_gadget_udc().
>> This ensures that the host and gadget controllers are not started till
>> the state machine is ready and the right bus conditions are met.
>> It also allows the host and gadget controllers to provide the OTG
>> controller device to link them together. For Device tree boots
>> the related OTG controller is automatically picked up via the
>> 'otg-controller' property in the Host/Gadget controller nodes.
>>
>> 	int usb_otg_add_hcd(struct usb_hcd *hcd,
>> 			    unsigned int irqnum, unsigned long irqflags,
>> 			    struct device *otg_dev);
>> 	void usb_otg_remove_hcd(struct usb_hcd *hcd);
>>
>> 	int usb_otg_add_gadget_udc(struct device *parent,
>> 				   struct usb_gadget *gadget,
>> 				   struct device *otg_dev);
>> 	usb_del_gadget_udc() must be used for removal.
>>
>>
>> - During the lifetime of the FSM, the OTG controller driver can provide
>> inputs event changes using usb_otg_sync_inputs(). The OTG core will
>> then schedule the FSM work function (or internal dual-role state machine)
>> to update the FSM state. The FSM then calls the OTG controller
>> operations (fsm_ops) as necessary.
>> 	void usb_otg_sync_inputs(struct usb_otg *otg);
>>
>> - The following 2 functions are provided as helpers for use by the
>> OTG controller driver to start/stop the host/gadget controllers.
>> 	int usb_otg_start_host(struct usb_otg *otg, int on);
>> 	int usb_otg_start_gadget(struct usb_otg *otg, int on);
>>
>> - The following function is provided for use by the USB host stack
>> to sync OTG related events to the OTG state machine.
>> e.g. change in host_bus->b_hnp_enable, gadget->b_hnp_enable
>> 	int usb_otg_kick_fsm(struct device *otg_device);
>>
>> Changelog:
>> ---------
>> v7:
>> - added dual-role support for host controllers requiring a companion
>> controller. e.g. EHCI + OHCI.
>> - added of_usb_get_otg() to get the OTG controller device
>> from the USB controller's device node.
>> - addressed review comments.
> 
> Would you please list more for review comments, eg which comment for
> which part? It is a big patch set, that will let review easy.

Yes. I will do so for v8.

cheers,
-roger

      reply	other threads:[~2016-05-11 11:06 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-02 12:18 Roger Quadros
2016-05-02 12:18 ` [PATCH v7 01/14] usb: hcd: Initialize hcd->flags to 0 Roger Quadros
2016-05-06  9:05   ` Peter Chen
2016-05-02 12:18 ` [PATCH v7 02/14] usb: otg-fsm: Prevent build warning "VDBG" redefined Roger Quadros
2016-05-11  8:17   ` Peter Chen
2016-05-02 12:18 ` [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface Roger Quadros
2016-05-06  9:41   ` Peter Chen
2016-05-09  9:45     ` Roger Quadros
2016-05-10  3:14       ` Peter Chen
2016-05-10  7:34         ` Roger Quadros
2016-05-10  8:03           ` Jun Li
2016-05-10  9:20             ` Roger Quadros
2016-05-11  6:19               ` Peter Chen
2016-05-10  8:12           ` Felipe Balbi
2016-05-10  9:12             ` Roger Quadros
2016-05-02 12:18 ` [PATCH v7 04/14] usb: otg-fsm: use usb_otg wherever possible Roger Quadros
2016-05-02 12:18 ` [PATCH v7 05/14] usb: otg-fsm: move host controller operations into usb_otg->hcd_ops Roger Quadros
2016-05-11  6:10   ` Peter Chen
2016-05-11 11:02     ` Roger Quadros
2016-05-11 12:32       ` Roger Quadros
2016-05-12  8:18         ` Peter Chen
2016-05-12  8:29           ` Roger Quadros
2016-05-02 12:18 ` [PATCH v7 06/14] usb: gadget.h: Add OTG to gadget interface Roger Quadros
2016-05-02 12:18 ` [PATCH v7 07/14] usb: otg: get rid of CONFIG_USB_OTG_FSM in favour of CONFIG_USB_OTG Roger Quadros
2016-05-11  8:21   ` Peter Chen
2016-05-02 12:18 ` [PATCH v7 08/14] usb: otg: add OTG/dual-role core Roger Quadros
2016-05-11  8:34   ` Peter Chen
2016-05-11 11:03     ` Roger Quadros
2016-05-02 12:18 ` [PATCH v7 09/14] usb: of: add an API to get OTG device from USB controller node Roger Quadros
2016-05-04 13:15   ` Rob Herring
2016-05-11  8:40   ` Peter Chen
2016-05-11 11:04     ` Roger Quadros
2016-05-02 12:18 ` [PATCH v7 10/14] usb: otg: add hcd companion support Roger Quadros
2016-05-04 13:17   ` Rob Herring
2016-05-04 13:47     ` Roger Quadros
2016-05-11 13:54       ` Rob Herring
2016-05-11 14:13         ` Roger Quadros
2016-05-11 14:47           ` Alan Stern
2016-05-12  4:00             ` Yoshihiro Shimoda
2016-05-12  8:34               ` Roger Quadros
2016-05-12  9:31                 ` Roger Quadros
2016-05-12 10:31                   ` Yoshihiro Shimoda
2016-05-12 12:13                     ` Roger Quadros
2016-05-16  2:13                       ` Peter Chen
2016-05-16  8:01                         ` Roger Quadros
2016-05-16  8:13                           ` Peter Chen
2016-05-16  8:35                             ` Roger Quadros
2016-05-12 18:16               ` Alan Stern
2016-05-11  8:43   ` Peter Chen
2016-05-02 12:18 ` [PATCH v7 11/14] usb: otg: use dev_dbg() instead of VDBG() Roger Quadros
2016-05-06  9:04   ` Peter Chen
2016-05-09  9:48     ` Roger Quadros
2016-05-11  8:43       ` Peter Chen
2016-05-02 12:18 ` [PATCH v7 12/14] usb: hcd: Adapt to OTG core Roger Quadros
2016-05-11  8:57   ` Peter Chen
2016-05-02 12:18 ` [PATCH v7 13/14] usb: gadget: udc: adapt " Roger Quadros
2016-05-02 12:18 ` [PATCH v7 14/14] usb: host: xhci-plat: Add otg device to platform data Roger Quadros
2016-05-11  9:00   ` Peter Chen
2016-05-11  8:36 ` [PATCH v7 00/14] USB OTG/dual-role framework Peter Chen
2016-05-11 11:05   ` Roger Quadros [this message]

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=57331216.5060601@ti.com \
    --to=rogerq@ti.com \
    --cc=Joao.Pinto@synopsys.com \
    --cc=abrestic@chromium.org \
    --cc=balbi@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hzpeterchen@gmail.com \
    --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=peter.chen@freescale.com \
    --cc=stern@rowland.harvard.edu \
    --cc=tony@atomide.com \
    --cc=yoshihiro.shimoda.uh@renesas.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome