Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1392163 > unrolled thread
| Started by | Roger Quadros <rogerq@ti.com> |
|---|---|
| First post | 2016-05-02 14:20 +0200 |
| Last post | 2016-05-11 13:10 +0200 |
| Articles | 20 on this page of 54 — 7 participants |
Back to article view | Back to linux.kernel
[PATCH v7 00/14] USB OTG/dual-role framework Roger Quadros <rogerq@ti.com> - 2016-05-02 14:20 +0200
[PATCH v7 02/14] usb: otg-fsm: Prevent build warning "VDBG" redefined Roger Quadros <rogerq@ti.com> - 2016-05-02 14:20 +0200
Re: [PATCH v7 02/14] usb: otg-fsm: Prevent build warning "VDBG" redefined Peter Chen <hzpeterchen@gmail.com> - 2016-05-11 10:30 +0200
[PATCH v7 07/14] usb: otg: get rid of CONFIG_USB_OTG_FSM in favour of CONFIG_USB_OTG Roger Quadros <rogerq@ti.com> - 2016-05-02 14:30 +0200
Re: [PATCH v7 07/14] usb: otg: get rid of CONFIG_USB_OTG_FSM in favour of CONFIG_USB_OTG Peter Chen <hzpeterchen@gmail.com> - 2016-05-11 10:40 +0200
[PATCH v7 09/14] usb: of: add an API to get OTG device from USB controller node Roger Quadros <rogerq@ti.com> - 2016-05-02 14:30 +0200
Re: [PATCH v7 09/14] usb: of: add an API to get OTG device from USB controller node Rob Herring <robh@kernel.org> - 2016-05-04 15:20 +0200
Re: [PATCH v7 09/14] usb: of: add an API to get OTG device from USB controller node Peter Chen <hzpeterchen@gmail.com> - 2016-05-11 10:50 +0200
Re: [PATCH v7 09/14] usb: of: add an API to get OTG device from USB controller node Roger Quadros <rogerq@ti.com> - 2016-05-11 13:10 +0200
[PATCH v7 11/14] usb: otg: use dev_dbg() instead of VDBG() Roger Quadros <rogerq@ti.com> - 2016-05-02 14:30 +0200
Re: [PATCH v7 11/14] usb: otg: use dev_dbg() instead of VDBG() Peter Chen <hzpeterchen@gmail.com> - 2016-05-06 11:20 +0200
Re: [PATCH v7 11/14] usb: otg: use dev_dbg() instead of VDBG() Roger Quadros <rogerq@ti.com> - 2016-05-09 11:50 +0200
Re: [PATCH v7 11/14] usb: otg: use dev_dbg() instead of VDBG() Peter Chen <hzpeterchen@gmail.com> - 2016-05-11 11:00 +0200
[PATCH v7 14/14] usb: host: xhci-plat: Add otg device to platform data Roger Quadros <rogerq@ti.com> - 2016-05-02 14:30 +0200
Re: [PATCH v7 14/14] usb: host: xhci-plat: Add otg device to platform data Peter Chen <hzpeterchen@gmail.com> - 2016-05-11 11:10 +0200
[PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface Roger Quadros <rogerq@ti.com> - 2016-05-02 14:30 +0200
Re: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface Peter Chen <hzpeterchen@gmail.com> - 2016-05-06 11:50 +0200
Re: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface Roger Quadros <rogerq@ti.com> - 2016-05-09 11:50 +0200
Re: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface Peter Chen <hzpeterchen@gmail.com> - 2016-05-10 05:30 +0200
Re: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface Roger Quadros <rogerq@ti.com> - 2016-05-10 09:40 +0200
Re: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface Felipe Balbi <balbi@kernel.org> - 2016-05-10 10:20 +0200
Re: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface Roger Quadros <rogerq@ti.com> - 2016-05-10 11:20 +0200
RE: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface Jun Li <jun.li@nxp.com> - 2016-05-10 10:20 +0200
Re: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface Roger Quadros <rogerq@ti.com> - 2016-05-10 11:30 +0200
Re: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface Peter Chen <hzpeterchen@gmail.com> - 2016-05-11 08:30 +0200
[PATCH v7 12/14] usb: hcd: Adapt to OTG core Roger Quadros <rogerq@ti.com> - 2016-05-02 14:30 +0200
Re: [PATCH v7 12/14] usb: hcd: Adapt to OTG core Peter Chen <hzpeterchen@gmail.com> - 2016-05-11 11:10 +0200
[PATCH v7 01/14] usb: hcd: Initialize hcd->flags to 0 Roger Quadros <rogerq@ti.com> - 2016-05-02 14:30 +0200
Re: [PATCH v7 01/14] usb: hcd: Initialize hcd->flags to 0 Peter Chen <hzpeterchen@gmail.com> - 2016-05-06 11:20 +0200
[PATCH v7 06/14] usb: gadget.h: Add OTG to gadget interface Roger Quadros <rogerq@ti.com> - 2016-05-02 14:30 +0200
[PATCH v7 08/14] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-05-02 14:30 +0200
Re: [PATCH v7 08/14] usb: otg: add OTG/dual-role core Peter Chen <hzpeterchen@gmail.com> - 2016-05-11 10:50 +0200
Re: [PATCH v7 08/14] usb: otg: add OTG/dual-role core Roger Quadros <rogerq@ti.com> - 2016-05-11 13:10 +0200
[PATCH v7 13/14] usb: gadget: udc: adapt to OTG core Roger Quadros <rogerq@ti.com> - 2016-05-02 14:30 +0200
[PATCH v7 05/14] usb: otg-fsm: move host controller operations into usb_otg->hcd_ops Roger Quadros <rogerq@ti.com> - 2016-05-02 14:30 +0200
Re: [PATCH v7 05/14] usb: otg-fsm: move host controller operations into usb_otg->hcd_ops Peter Chen <hzpeterchen@gmail.com> - 2016-05-11 08:20 +0200
Re: [PATCH v7 05/14] usb: otg-fsm: move host controller operations into usb_otg->hcd_ops Roger Quadros <rogerq@ti.com> - 2016-05-11 13:10 +0200
Re: [PATCH v7 05/14] usb: otg-fsm: move host controller operations into usb_otg->hcd_ops Roger Quadros <rogerq@ti.com> - 2016-05-11 14:40 +0200
Re: [PATCH v7 05/14] usb: otg-fsm: move host controller operations into usb_otg->hcd_ops Peter Chen <hzpeterchen@gmail.com> - 2016-05-12 10:30 +0200
Re: [PATCH v7 05/14] usb: otg-fsm: move host controller operations into usb_otg->hcd_ops Roger Quadros <rogerq@ti.com> - 2016-05-12 10:40 +0200
[PATCH v7 10/14] usb: otg: add hcd companion support Roger Quadros <rogerq@ti.com> - 2016-05-02 14:30 +0200
Re: [PATCH v7 10/14] usb: otg: add hcd companion support Rob Herring <robh@kernel.org> - 2016-05-04 15:20 +0200
Re: [PATCH v7 10/14] usb: otg: add hcd companion support Roger Quadros <rogerq@ti.com> - 2016-05-04 15:50 +0200
Re: [PATCH v7 10/14] usb: otg: add hcd companion support Rob Herring <robh@kernel.org> - 2016-05-11 16:00 +0200
Re: [PATCH v7 10/14] usb: otg: add hcd companion support Roger Quadros <rogerq@ti.com> - 2016-05-11 16:20 +0200
Re: [PATCH v7 10/14] usb: otg: add hcd companion support Alan Stern <stern@rowland.harvard.edu> - 2016-05-11 16:50 +0200
RE: [PATCH v7 10/14] usb: otg: add hcd companion support Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - 2016-05-12 06:10 +0200
Re: [PATCH v7 10/14] usb: otg: add hcd companion support Roger Quadros <rogerq@ti.com> - 2016-05-12 10:40 +0200
Re: [PATCH v7 10/14] usb: otg: add hcd companion support Roger Quadros <rogerq@ti.com> - 2016-05-12 11:40 +0200
RE: [PATCH v7 10/14] usb: otg: add hcd companion support Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - 2016-05-12 12:40 +0200
Re: [PATCH v7 10/14] usb: otg: add hcd companion support Roger Quadros <rogerq@ti.com> - 2016-05-12 14:20 +0200
Re: [PATCH v7 10/14] usb: otg: add hcd companion support Peter Chen <hzpeterchen@gmail.com> - 2016-05-11 11:00 +0200
Re: [PATCH v7 00/14] USB OTG/dual-role framework Peter Chen <hzpeterchen@gmail.com> - 2016-05-11 10:50 +0200
Re: [PATCH v7 00/14] USB OTG/dual-role framework Roger Quadros <rogerq@ti.com> - 2016-05-11 13:10 +0200
Page 1 of 3 [1] 2 3 Next page →
| From | Roger Quadros <rogerq@ti.com> |
|---|---|
| Date | 2016-05-02 14:20 +0200 |
| Subject | [PATCH v7 00/14] USB OTG/dual-role framework |
| Message-ID | <rukZs-3a6-21@gated-at.bofh.it> |
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.
v6:
- added otg specific APIs for host/gadget registration. behaviour of
original host/gadget API remains unchanged. Platform devices can now
pass the otg device explicitly while registering host/gadget.
- moved hcd specific operations from struct otg_fsm to struct hcd_ops.
- made struct usb_otg mandatory for all otg related APIs.
- allow otg controller to provide it's own otg_work function so that
it can implement it's own state machine.
- removed otg fsm and timers from usb-otg.c. Only dual-role state machine
is implemented.
- vbus is controlled in the dual-role state machine.
- PM runtime is used around drd_statemachine().
- added otg_dev to xhci platform data to allow platform code to specify
the otg controller tied to the xhci host controller.
v5: Internal version. Not sent to mailing list
v4:
- Added DT support for tying otg-controller to host and gadget
controllers. For DT we no longer have the constraint that
OTG controller needs to be parent of host and gadget. They can be
tied together using the "otg-controller" property.
- Relax the requirement for DT case that otg controller must register
before host/gadget. We maintain a wait list of host/gadget devices
waiting on the otg controller.
- Use a single struct usb_otg for otg data.
- Don't override host/gadget start/stop APIs. Let the controller
drivers do what they want as they know best. Helper API is provided
for controller start/stop that controller driver can use.
- Introduce struct usb_otg_config to pass the otg capabilities,
otg ops and otg timer timeouts during otg controller registration.
- rebased on Greg's usb.git/usb-next
v3:
- all otg related definations now in otg.h
- single kernel config USB_OTG to enable OTG core and FSM.
- resolved symbol dependency issues.
- use dev_vdbg instead of VDBG() in usb-otg-fsm.c
- rebased on v4.2-rc1
v2:
- Use add/remove_hcd() instead of start/stop_hcd() to enable/disable
the host controller
- added dual-role-device (DRD) state machine which is a much simpler
mode of operation when compared to OTG. Here we don't support fancy
OTG features like HNP, SRP, on the fly role-swap. The mode of operation
is determined based on ID pin (cable type) and the role doesn't change
till the cable type changes.
--
cheers,
-roger
Roger Quadros (13):
usb: hcd: Initialize hcd->flags to 0
usb: otg-fsm: Prevent build warning "VDBG" redefined
usb: hcd.h: Add OTG to HCD interface
usb: otg-fsm: use usb_otg wherever possible
usb: otg-fsm: move host controller operations into usb_otg->hcd_ops
usb: gadget.h: Add OTG to gadget interface
usb: otg: get rid of CONFIG_USB_OTG_FSM in favour of CONFIG_USB_OTG
usb: otg: add OTG/dual-role core
usb: of: add an API to get OTG device from USB controller node
usb: otg: use dev_dbg() instead of VDBG()
usb: hcd: Adapt to OTG core
usb: gadget: udc: adapt to OTG core
usb: host: xhci-plat: Add otg device to platform data
Yoshihiro Shimoda (1):
usb: otg: add hcd companion support
Documentation/devicetree/bindings/usb/generic.txt | 6 +
Documentation/usb/chipidea.txt | 2 +-
drivers/usb/chipidea/Makefile | 2 +-
drivers/usb/chipidea/ci.h | 3 +-
drivers/usb/chipidea/core.c | 14 +-
drivers/usb/chipidea/debug.c | 2 +-
drivers/usb/chipidea/otg_fsm.c | 176 ++--
drivers/usb/chipidea/otg_fsm.h | 2 +-
drivers/usb/chipidea/udc.c | 17 +-
drivers/usb/common/Makefile | 3 +-
drivers/usb/common/common.c | 27 +
drivers/usb/common/usb-otg-fsm.c | 203 ++--
drivers/usb/common/usb-otg.c | 1054 ++++++++++++++++++++
.../usb/{chipidea/otg_fsm.h => common/usb-otg.h} | 61 +-
drivers/usb/core/Kconfig | 10 +-
drivers/usb/core/hcd.c | 56 ++
drivers/usb/gadget/udc/udc-core.c | 161 ++-
drivers/usb/host/xhci-plat.c | 35 +-
drivers/usb/phy/Kconfig | 2 +-
drivers/usb/phy/phy-fsl-usb.c | 155 +--
drivers/usb/phy/phy-fsl-usb.h | 3 +-
include/linux/usb/gadget.h | 20 +
include/linux/usb/hcd.h | 29 +
include/linux/usb/of.h | 9 +
include/linux/usb/otg-fsm.h | 154 +--
include/linux/usb/otg.h | 264 ++++-
include/linux/usb/xhci_pdriver.h | 3 +
27 files changed, 1989 insertions(+), 484 deletions(-)
create mode 100644 drivers/usb/common/usb-otg.c
copy drivers/usb/{chipidea/otg_fsm.h => common/usb-otg.h} (63%)
--
2.7.4
[toc] | [next] | [standalone]
| From | Roger Quadros <rogerq@ti.com> |
|---|---|
| Date | 2016-05-02 14:20 +0200 |
| Subject | [PATCH v7 02/14] usb: otg-fsm: Prevent build warning "VDBG" redefined |
| Message-ID | <rukZs-3a6-25@gated-at.bofh.it> |
| In reply to | #1392163 |
If usb/otg-fsm.h and usb/composite.h are included together
then it results in the build warning [1].
Prevent that by defining VDBG locally.
Also get rid of MPC_LOC which doesn't seem to be used
by anyone.
[1] - warning fixed by this patch:
In file included from drivers/usb/dwc3/core.h:33,
from drivers/usb/dwc3/ep0.c:33:
include/linux/usb/otg-fsm.h:30:1: warning: "VDBG" redefined
In file included from drivers/usb/dwc3/ep0.c:31:
include/linux/usb/composite.h:615:1: warning: this is the location
of the previous definition
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/usb/common/usb-otg-fsm.c | 7 +++++++
drivers/usb/phy/phy-fsl-usb.c | 7 +++++++
include/linux/usb/otg-fsm.h | 15 ---------------
3 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c
index 9059b7d..015cf41 100644
--- a/drivers/usb/common/usb-otg-fsm.c
+++ b/drivers/usb/common/usb-otg-fsm.c
@@ -30,6 +30,13 @@
#include <linux/usb/otg.h>
#include <linux/usb/otg-fsm.h>
+#ifdef VERBOSE
+#define VDBG(fmt, args...) pr_debug("[%s] " fmt , \
+ __func__, ## args)
+#else
+#define VDBG(stuff...) do {} while (0)
+#endif
+
/* Change USB protocol when there is a protocol change */
static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
{
diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
index 94eb292..dd8a1ad 100644
--- a/drivers/usb/phy/phy-fsl-usb.c
+++ b/drivers/usb/phy/phy-fsl-usb.c
@@ -44,6 +44,13 @@
#include "phy-fsl-usb.h"
+#ifdef VERBOSE
+#define VDBG(fmt, args...) pr_debug("[%s] " fmt , \
+ __func__, ## args)
+#else
+#define VDBG(stuff...) do {} while (0)
+#endif
+
#define DRIVER_VERSION "Rev. 1.55"
#define DRIVER_AUTHOR "Jerry Huang/Li Yang"
#define DRIVER_DESC "Freescale USB OTG Transceiver Driver"
diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h
index 7a03505..a0a8f87 100644
--- a/include/linux/usb/otg-fsm.h
+++ b/include/linux/usb/otg-fsm.h
@@ -21,21 +21,6 @@
#include <linux/mutex.h>
#include <linux/errno.h>
-#undef VERBOSE
-
-#ifdef VERBOSE
-#define VDBG(fmt, args...) pr_debug("[%s] " fmt , \
- __func__, ## args)
-#else
-#define VDBG(stuff...) do {} while (0)
-#endif
-
-#ifdef VERBOSE
-#define MPC_LOC printk("Current Location [%s]:[%d]\n", __FILE__, __LINE__)
-#else
-#define MPC_LOC do {} while (0)
-#endif
-
#define PROTO_UNDEF (0)
#define PROTO_HOST (1)
#define PROTO_GADGET (2)
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Peter Chen <hzpeterchen@gmail.com> |
|---|---|
| Date | 2016-05-11 10:30 +0200 |
| Subject | Re: [PATCH v7 02/14] usb: otg-fsm: Prevent build warning "VDBG" redefined |
| Message-ID | <rxxGP-4ls-39@gated-at.bofh.it> |
| In reply to | #1392164 |
On Mon, May 02, 2016 at 03:18:45PM +0300, Roger Quadros wrote:
> If usb/otg-fsm.h and usb/composite.h are included together
> then it results in the build warning [1].
>
> Prevent that by defining VDBG locally.
>
> Also get rid of MPC_LOC which doesn't seem to be used
> by anyone.
>
> [1] - warning fixed by this patch:
>
> In file included from drivers/usb/dwc3/core.h:33,
> from drivers/usb/dwc3/ep0.c:33:
> include/linux/usb/otg-fsm.h:30:1: warning: "VDBG" redefined
> In file included from drivers/usb/dwc3/ep0.c:31:
> include/linux/usb/composite.h:615:1: warning: this is the location
> of the previous definition
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
> ---
> drivers/usb/common/usb-otg-fsm.c | 7 +++++++
> drivers/usb/phy/phy-fsl-usb.c | 7 +++++++
> include/linux/usb/otg-fsm.h | 15 ---------------
> 3 files changed, 14 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c
> index 9059b7d..015cf41 100644
> --- a/drivers/usb/common/usb-otg-fsm.c
> +++ b/drivers/usb/common/usb-otg-fsm.c
> @@ -30,6 +30,13 @@
> #include <linux/usb/otg.h>
> #include <linux/usb/otg-fsm.h>
>
> +#ifdef VERBOSE
> +#define VDBG(fmt, args...) pr_debug("[%s] " fmt , \
> + __func__, ## args)
> +#else
> +#define VDBG(stuff...) do {} while (0)
> +#endif
> +
> /* Change USB protocol when there is a protocol change */
> static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
> {
> diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
> index 94eb292..dd8a1ad 100644
> --- a/drivers/usb/phy/phy-fsl-usb.c
> +++ b/drivers/usb/phy/phy-fsl-usb.c
> @@ -44,6 +44,13 @@
>
> #include "phy-fsl-usb.h"
>
> +#ifdef VERBOSE
> +#define VDBG(fmt, args...) pr_debug("[%s] " fmt , \
> + __func__, ## args)
> +#else
> +#define VDBG(stuff...) do {} while (0)
> +#endif
> +
> #define DRIVER_VERSION "Rev. 1.55"
> #define DRIVER_AUTHOR "Jerry Huang/Li Yang"
> #define DRIVER_DESC "Freescale USB OTG Transceiver Driver"
> diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h
> index 7a03505..a0a8f87 100644
> --- a/include/linux/usb/otg-fsm.h
> +++ b/include/linux/usb/otg-fsm.h
> @@ -21,21 +21,6 @@
> #include <linux/mutex.h>
> #include <linux/errno.h>
>
> -#undef VERBOSE
> -
> -#ifdef VERBOSE
> -#define VDBG(fmt, args...) pr_debug("[%s] " fmt , \
> - __func__, ## args)
> -#else
> -#define VDBG(stuff...) do {} while (0)
> -#endif
> -
> -#ifdef VERBOSE
> -#define MPC_LOC printk("Current Location [%s]:[%d]\n", __FILE__, __LINE__)
> -#else
> -#define MPC_LOC do {} while (0)
> -#endif
> -
> #define PROTO_UNDEF (0)
> #define PROTO_HOST (1)
> #define PROTO_GADGET (2)
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Best Regards,
Peter Chen
[toc] | [prev] | [next] | [standalone]
| From | Roger Quadros <rogerq@ti.com> |
|---|---|
| Date | 2016-05-02 14:30 +0200 |
| Subject | [PATCH v7 07/14] usb: otg: get rid of CONFIG_USB_OTG_FSM in favour of CONFIG_USB_OTG |
| Message-ID | <rul98-3f2-9@gated-at.bofh.it> |
| In reply to | #1392163 |
Let's use CONFIG_USB_OTG as a single config option to enable
USB OTG and the OTG FSM. This makes things a lot less confusing.
Update all users of CONFIG_USB_OTG_FSM to CONFIG_USB_OTG.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
Documentation/usb/chipidea.txt | 2 +-
drivers/usb/chipidea/Makefile | 2 +-
drivers/usb/chipidea/ci.h | 2 +-
drivers/usb/chipidea/otg_fsm.h | 2 +-
drivers/usb/common/Makefile | 3 ++-
drivers/usb/core/Kconfig | 8 --------
drivers/usb/phy/Kconfig | 2 +-
7 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/Documentation/usb/chipidea.txt b/Documentation/usb/chipidea.txt
index 678741b..3b1f263 100644
--- a/Documentation/usb/chipidea.txt
+++ b/Documentation/usb/chipidea.txt
@@ -5,7 +5,7 @@ with 2 Freescale i.MX6Q sabre SD boards.
1.1 How to enable OTG FSM in menuconfig
---------------------------------------
-Select CONFIG_USB_OTG_FSM, rebuild kernel Image and modules.
+Select CONFIG_USB_OTG, rebuild kernel Image and modules.
If you want to check some internal variables for otg fsm,
mount debugfs, there are 2 files which can show otg fsm
variables and some controller registers value:
diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
index 518e445..45aa24d 100644
--- a/drivers/usb/chipidea/Makefile
+++ b/drivers/usb/chipidea/Makefile
@@ -3,7 +3,7 @@ obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc.o
ci_hdrc-y := core.o otg.o debug.o
ci_hdrc-$(CONFIG_USB_CHIPIDEA_UDC) += udc.o
ci_hdrc-$(CONFIG_USB_CHIPIDEA_HOST) += host.o
-ci_hdrc-$(CONFIG_USB_OTG_FSM) += otg_fsm.o
+ci_hdrc-$(CONFIG_USB_OTG) += otg_fsm.o
# Glue/Bridge layers go here
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index c523975..1a32b8c 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -406,7 +406,7 @@ static inline u32 hw_test_and_write(struct ci_hdrc *ci, enum ci_hw_regs reg,
*/
static inline bool ci_otg_is_fsm_mode(struct ci_hdrc *ci)
{
-#ifdef CONFIG_USB_OTG_FSM
+#ifdef CONFIG_USB_OTG
struct usb_otg_caps *otg_caps = &ci->platdata->ci_otg_caps;
return ci->is_otg && ci->roles[CI_ROLE_HOST] &&
diff --git a/drivers/usb/chipidea/otg_fsm.h b/drivers/usb/chipidea/otg_fsm.h
index 6366fe3..2d451bb 100644
--- a/drivers/usb/chipidea/otg_fsm.h
+++ b/drivers/usb/chipidea/otg_fsm.h
@@ -64,7 +64,7 @@
#define TB_AIDL_BDIS (20) /* 4ms ~ 150ms, section 5.2.1 */
-#if IS_ENABLED(CONFIG_USB_OTG_FSM)
+#if IS_ENABLED(CONFIG_USB_OTG)
int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci);
int ci_otg_fsm_work(struct ci_hdrc *ci);
diff --git a/drivers/usb/common/Makefile b/drivers/usb/common/Makefile
index 6bbb3ec..f8f2c88 100644
--- a/drivers/usb/common/Makefile
+++ b/drivers/usb/common/Makefile
@@ -6,5 +6,6 @@ obj-$(CONFIG_USB_COMMON) += usb-common.o
usb-common-y += common.o
usb-common-$(CONFIG_USB_LED_TRIG) += led.o
-obj-$(CONFIG_USB_OTG_FSM) += usb-otg-fsm.o
obj-$(CONFIG_USB_ULPI_BUS) += ulpi.o
+usbotg-y := usb-otg-fsm.o
+obj-$(CONFIG_USB_OTG) += usbotg.o
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index dd28010..ae228d0 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -75,14 +75,6 @@ config USB_OTG_BLACKLIST_HUB
and software costs by not supporting external hubs. So
are "Embedded Hosts" that don't offer OTG support.
-config USB_OTG_FSM
- tristate "USB 2.0 OTG FSM implementation"
- depends on USB && USB_OTG
- select USB_PHY
- help
- Implements OTG Finite State Machine as specified in On-The-Go
- and Embedded Host Supplement to the USB Revision 2.0 Specification.
-
config USB_ULPI_BUS
tristate "USB ULPI PHY interface support"
depends on USB_SUPPORT
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index c690474..06794e2 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -20,7 +20,7 @@ config AB8500_USB
config FSL_USB2_OTG
bool "Freescale USB OTG Transceiver Driver"
- depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG_FSM && PM
+ depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG && PM
select USB_PHY
help
Enable this to support Freescale USB OTG transceiver.
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Peter Chen <hzpeterchen@gmail.com> |
|---|---|
| Date | 2016-05-11 10:40 +0200 |
| Subject | Re: [PATCH v7 07/14] usb: otg: get rid of CONFIG_USB_OTG_FSM in favour of CONFIG_USB_OTG |
| Message-ID | <rxxQu-4q4-21@gated-at.bofh.it> |
| In reply to | #1392168 |
On Mon, May 02, 2016 at 03:18:50PM +0300, Roger Quadros wrote:
> Let's use CONFIG_USB_OTG as a single config option to enable
> USB OTG and the OTG FSM. This makes things a lot less confusing.
>
> Update all users of CONFIG_USB_OTG_FSM to CONFIG_USB_OTG.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
> ---
> Documentation/usb/chipidea.txt | 2 +-
I have updated this file, so you will meet a conflict if you
rebase with newest usb-next tree.
> drivers/usb/chipidea/Makefile | 2 +-
> drivers/usb/chipidea/ci.h | 2 +-
> drivers/usb/chipidea/otg_fsm.h | 2 +-
> drivers/usb/common/Makefile | 3 ++-
> drivers/usb/core/Kconfig | 8 --------
> drivers/usb/phy/Kconfig | 2 +-
> 7 files changed, 7 insertions(+), 14 deletions(-)
>
> diff --git a/Documentation/usb/chipidea.txt b/Documentation/usb/chipidea.txt
> index 678741b..3b1f263 100644
> --- a/Documentation/usb/chipidea.txt
> +++ b/Documentation/usb/chipidea.txt
> @@ -5,7 +5,7 @@ with 2 Freescale i.MX6Q sabre SD boards.
>
> 1.1 How to enable OTG FSM in menuconfig
> ---------------------------------------
> -Select CONFIG_USB_OTG_FSM, rebuild kernel Image and modules.
> +Select CONFIG_USB_OTG, rebuild kernel Image and modules.
> If you want to check some internal variables for otg fsm,
> mount debugfs, there are 2 files which can show otg fsm
> variables and some controller registers value:
> diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
> index 518e445..45aa24d 100644
> --- a/drivers/usb/chipidea/Makefile
> +++ b/drivers/usb/chipidea/Makefile
> @@ -3,7 +3,7 @@ obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc.o
> ci_hdrc-y := core.o otg.o debug.o
> ci_hdrc-$(CONFIG_USB_CHIPIDEA_UDC) += udc.o
> ci_hdrc-$(CONFIG_USB_CHIPIDEA_HOST) += host.o
> -ci_hdrc-$(CONFIG_USB_OTG_FSM) += otg_fsm.o
> +ci_hdrc-$(CONFIG_USB_OTG) += otg_fsm.o
>
> # Glue/Bridge layers go here
>
> diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
> index c523975..1a32b8c 100644
> --- a/drivers/usb/chipidea/ci.h
> +++ b/drivers/usb/chipidea/ci.h
> @@ -406,7 +406,7 @@ static inline u32 hw_test_and_write(struct ci_hdrc *ci, enum ci_hw_regs reg,
> */
> static inline bool ci_otg_is_fsm_mode(struct ci_hdrc *ci)
> {
> -#ifdef CONFIG_USB_OTG_FSM
> +#ifdef CONFIG_USB_OTG
> struct usb_otg_caps *otg_caps = &ci->platdata->ci_otg_caps;
>
> return ci->is_otg && ci->roles[CI_ROLE_HOST] &&
> diff --git a/drivers/usb/chipidea/otg_fsm.h b/drivers/usb/chipidea/otg_fsm.h
> index 6366fe3..2d451bb 100644
> --- a/drivers/usb/chipidea/otg_fsm.h
> +++ b/drivers/usb/chipidea/otg_fsm.h
> @@ -64,7 +64,7 @@
>
> #define TB_AIDL_BDIS (20) /* 4ms ~ 150ms, section 5.2.1 */
>
> -#if IS_ENABLED(CONFIG_USB_OTG_FSM)
> +#if IS_ENABLED(CONFIG_USB_OTG)
>
> int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci);
> int ci_otg_fsm_work(struct ci_hdrc *ci);
> diff --git a/drivers/usb/common/Makefile b/drivers/usb/common/Makefile
> index 6bbb3ec..f8f2c88 100644
> --- a/drivers/usb/common/Makefile
> +++ b/drivers/usb/common/Makefile
> @@ -6,5 +6,6 @@ obj-$(CONFIG_USB_COMMON) += usb-common.o
> usb-common-y += common.o
> usb-common-$(CONFIG_USB_LED_TRIG) += led.o
>
> -obj-$(CONFIG_USB_OTG_FSM) += usb-otg-fsm.o
> obj-$(CONFIG_USB_ULPI_BUS) += ulpi.o
> +usbotg-y := usb-otg-fsm.o
> +obj-$(CONFIG_USB_OTG) += usbotg.o
> diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
> index dd28010..ae228d0 100644
> --- a/drivers/usb/core/Kconfig
> +++ b/drivers/usb/core/Kconfig
> @@ -75,14 +75,6 @@ config USB_OTG_BLACKLIST_HUB
> and software costs by not supporting external hubs. So
> are "Embedded Hosts" that don't offer OTG support.
>
> -config USB_OTG_FSM
> - tristate "USB 2.0 OTG FSM implementation"
> - depends on USB && USB_OTG
> - select USB_PHY
> - help
> - Implements OTG Finite State Machine as specified in On-The-Go
> - and Embedded Host Supplement to the USB Revision 2.0 Specification.
> -
> config USB_ULPI_BUS
> tristate "USB ULPI PHY interface support"
> depends on USB_SUPPORT
> diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
> index c690474..06794e2 100644
> --- a/drivers/usb/phy/Kconfig
> +++ b/drivers/usb/phy/Kconfig
> @@ -20,7 +20,7 @@ config AB8500_USB
>
> config FSL_USB2_OTG
> bool "Freescale USB OTG Transceiver Driver"
> - depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG_FSM && PM
> + depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG && PM
> select USB_PHY
> help
> Enable this to support Freescale USB OTG transceiver.
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Best Regards,
Peter Chen
[toc] | [prev] | [next] | [standalone]
| From | Roger Quadros <rogerq@ti.com> |
|---|---|
| Date | 2016-05-02 14:30 +0200 |
| Subject | [PATCH v7 09/14] usb: of: add an API to get OTG device from USB controller node |
| Message-ID | <rul98-3f2-15@gated-at.bofh.it> |
| In reply to | #1392163 |
The OTG controller and the USB controller an be linked via the
'otg-controller' property in the USB controller's device node.
of_usb_get_otg() can be used to get the OTG controller device
from the USB controller's device node.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
Documentation/devicetree/bindings/usb/generic.txt | 3 +++
drivers/usb/common/common.c | 27 +++++++++++++++++++++++
include/linux/usb/of.h | 9 ++++++++
3 files changed, 39 insertions(+)
diff --git a/Documentation/devicetree/bindings/usb/generic.txt b/Documentation/devicetree/bindings/usb/generic.txt
index bba8257..f6866c1 100644
--- a/Documentation/devicetree/bindings/usb/generic.txt
+++ b/Documentation/devicetree/bindings/usb/generic.txt
@@ -24,6 +24,9 @@ Optional properties:
optional for OTG device.
- adp-disable: tells OTG controllers we want to disable OTG ADP, ADP is
optional for OTG device.
+ - otg-controller: phandle to otg controller. Host or gadget controllers can
+ contain this property to link it to a particular OTG
+ controller.
This is an attribute to a USB controller such as:
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index e3d0161..d7ec471 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -238,6 +238,33 @@ int of_usb_update_otg_caps(struct device_node *np,
}
EXPORT_SYMBOL_GPL(of_usb_update_otg_caps);
+#ifdef CONFIG_USB_OTG
+/**
+ * of_usb_get_otg - get the OTG controller linked to the USB controller
+ * @np: Pointer to the device_node of the USB controller
+ * @otg_caps: Pointer to the target usb_otg_caps to be set
+ *
+ * Returns the OTG controller device or NULL on error.
+ */
+struct device *of_usb_get_otg(struct device_node *np)
+{
+ struct device_node *otg_np;
+ struct platform_device *pdev;
+
+ otg_np = of_parse_phandle(np, "otg-controller", 0);
+ if (!otg_np)
+ return NULL;
+
+ pdev = of_find_device_by_node(otg_np);
+ of_node_put(otg_np);
+ if (!pdev)
+ return NULL;
+
+ return &pdev->dev;
+}
+EXPORT_SYMBOL_GPL(of_usb_get_otg);
+#endif
+
#endif
MODULE_LICENSE("GPL");
diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
index de3237f..499a4e8 100644
--- a/include/linux/usb/of.h
+++ b/include/linux/usb/of.h
@@ -40,6 +40,15 @@ static inline struct device_node *usb_of_get_child_node
}
#endif
+#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_OTG)
+struct device *of_usb_get_otg(struct device_node *np);
+#else
+static inline struct device *of_usb_get_otg(struct device_node *np)
+{
+ return NULL;
+}
+#endif
+
#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT)
enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np);
#else
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Date | 2016-05-04 15:20 +0200 |
| Subject | Re: [PATCH v7 09/14] usb: of: add an API to get OTG device from USB controller node |
| Message-ID | <rv4SC-4va-3@gated-at.bofh.it> |
| In reply to | #1392169 |
On Mon, May 02, 2016 at 03:18:52PM +0300, Roger Quadros wrote: > The OTG controller and the USB controller an be linked via the > 'otg-controller' property in the USB controller's device node. > > of_usb_get_otg() can be used to get the OTG controller device > from the USB controller's device node. > > Signed-off-by: Roger Quadros <rogerq@ti.com> > --- > Documentation/devicetree/bindings/usb/generic.txt | 3 +++ > drivers/usb/common/common.c | 27 +++++++++++++++++++++++ > include/linux/usb/of.h | 9 ++++++++ > 3 files changed, 39 insertions(+) Acked-by: Rob Herring <robh@kernel.org>
[toc] | [prev] | [next] | [standalone]
| From | Peter Chen <hzpeterchen@gmail.com> |
|---|---|
| Date | 2016-05-11 10:50 +0200 |
| Subject | Re: [PATCH v7 09/14] usb: of: add an API to get OTG device from USB controller node |
| Message-ID | <rxy0a-4vB-23@gated-at.bofh.it> |
| In reply to | #1392169 |
On Mon, May 02, 2016 at 03:18:52PM +0300, Roger Quadros wrote:
> The OTG controller and the USB controller an be linked via the
Typo?
Others are ok for me.
Acked-by: Peter Chen <peter.chen@nxp.com>
> 'otg-controller' property in the USB controller's device node.
>
> of_usb_get_otg() can be used to get the OTG controller device
> from the USB controller's device node.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> Documentation/devicetree/bindings/usb/generic.txt | 3 +++
> drivers/usb/common/common.c | 27 +++++++++++++++++++++++
> include/linux/usb/of.h | 9 ++++++++
> 3 files changed, 39 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/usb/generic.txt b/Documentation/devicetree/bindings/usb/generic.txt
> index bba8257..f6866c1 100644
> --- a/Documentation/devicetree/bindings/usb/generic.txt
> +++ b/Documentation/devicetree/bindings/usb/generic.txt
> @@ -24,6 +24,9 @@ Optional properties:
> optional for OTG device.
> - adp-disable: tells OTG controllers we want to disable OTG ADP, ADP is
> optional for OTG device.
> + - otg-controller: phandle to otg controller. Host or gadget controllers can
> + contain this property to link it to a particular OTG
> + controller.
>
> This is an attribute to a USB controller such as:
>
> diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> index e3d0161..d7ec471 100644
> --- a/drivers/usb/common/common.c
> +++ b/drivers/usb/common/common.c
> @@ -238,6 +238,33 @@ int of_usb_update_otg_caps(struct device_node *np,
> }
> EXPORT_SYMBOL_GPL(of_usb_update_otg_caps);
>
> +#ifdef CONFIG_USB_OTG
> +/**
> + * of_usb_get_otg - get the OTG controller linked to the USB controller
> + * @np: Pointer to the device_node of the USB controller
> + * @otg_caps: Pointer to the target usb_otg_caps to be set
> + *
> + * Returns the OTG controller device or NULL on error.
> + */
> +struct device *of_usb_get_otg(struct device_node *np)
> +{
> + struct device_node *otg_np;
> + struct platform_device *pdev;
> +
> + otg_np = of_parse_phandle(np, "otg-controller", 0);
> + if (!otg_np)
> + return NULL;
> +
> + pdev = of_find_device_by_node(otg_np);
> + of_node_put(otg_np);
> + if (!pdev)
> + return NULL;
> +
> + return &pdev->dev;
> +}
> +EXPORT_SYMBOL_GPL(of_usb_get_otg);
> +#endif
> +
> #endif
>
> MODULE_LICENSE("GPL");
> diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
> index de3237f..499a4e8 100644
> --- a/include/linux/usb/of.h
> +++ b/include/linux/usb/of.h
> @@ -40,6 +40,15 @@ static inline struct device_node *usb_of_get_child_node
> }
> #endif
>
> +#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_OTG)
> +struct device *of_usb_get_otg(struct device_node *np);
> +#else
> +static inline struct device *of_usb_get_otg(struct device_node *np)
> +{
> + return NULL;
> +}
> +#endif
> +
> #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT)
> enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np);
> #else
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Best Regards,
Peter Chen
[toc] | [prev] | [next] | [standalone]
| From | Roger Quadros <rogerq@ti.com> |
|---|---|
| Date | 2016-05-11 13:10 +0200 |
| Subject | Re: [PATCH v7 09/14] usb: of: add an API to get OTG device from USB controller node |
| Message-ID | <rxAbF-77O-47@gated-at.bofh.it> |
| In reply to | #1398796 |
On 11/05/16 11:40, Peter Chen wrote:
> On Mon, May 02, 2016 at 03:18:52PM +0300, Roger Quadros wrote:
>> The OTG controller and the USB controller an be linked via the
>
> Typo?
Will fix.
cheers,
-roger
>
> Others are ok for me.
>
> Acked-by: Peter Chen <peter.chen@nxp.com>
>
>> 'otg-controller' property in the USB controller's device node.
>>
>> of_usb_get_otg() can be used to get the OTG controller device
>> from the USB controller's device node.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>> Documentation/devicetree/bindings/usb/generic.txt | 3 +++
>> drivers/usb/common/common.c | 27 +++++++++++++++++++++++
>> include/linux/usb/of.h | 9 ++++++++
>> 3 files changed, 39 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/generic.txt b/Documentation/devicetree/bindings/usb/generic.txt
>> index bba8257..f6866c1 100644
>> --- a/Documentation/devicetree/bindings/usb/generic.txt
>> +++ b/Documentation/devicetree/bindings/usb/generic.txt
>> @@ -24,6 +24,9 @@ Optional properties:
>> optional for OTG device.
>> - adp-disable: tells OTG controllers we want to disable OTG ADP, ADP is
>> optional for OTG device.
>> + - otg-controller: phandle to otg controller. Host or gadget controllers can
>> + contain this property to link it to a particular OTG
>> + controller.
>>
>> This is an attribute to a USB controller such as:
>>
>> diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
>> index e3d0161..d7ec471 100644
>> --- a/drivers/usb/common/common.c
>> +++ b/drivers/usb/common/common.c
>> @@ -238,6 +238,33 @@ int of_usb_update_otg_caps(struct device_node *np,
>> }
>> EXPORT_SYMBOL_GPL(of_usb_update_otg_caps);
>>
>> +#ifdef CONFIG_USB_OTG
>> +/**
>> + * of_usb_get_otg - get the OTG controller linked to the USB controller
>> + * @np: Pointer to the device_node of the USB controller
>> + * @otg_caps: Pointer to the target usb_otg_caps to be set
>> + *
>> + * Returns the OTG controller device or NULL on error.
>> + */
>> +struct device *of_usb_get_otg(struct device_node *np)
>> +{
>> + struct device_node *otg_np;
>> + struct platform_device *pdev;
>> +
>> + otg_np = of_parse_phandle(np, "otg-controller", 0);
>> + if (!otg_np)
>> + return NULL;
>> +
>> + pdev = of_find_device_by_node(otg_np);
>> + of_node_put(otg_np);
>> + if (!pdev)
>> + return NULL;
>> +
>> + return &pdev->dev;
>> +}
>> +EXPORT_SYMBOL_GPL(of_usb_get_otg);
>> +#endif
>> +
>> #endif
>>
>> MODULE_LICENSE("GPL");
>> diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
>> index de3237f..499a4e8 100644
>> --- a/include/linux/usb/of.h
>> +++ b/include/linux/usb/of.h
>> @@ -40,6 +40,15 @@ static inline struct device_node *usb_of_get_child_node
>> }
>> #endif
>>
>> +#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_OTG)
>> +struct device *of_usb_get_otg(struct device_node *np);
>> +#else
>> +static inline struct device *of_usb_get_otg(struct device_node *np)
>> +{
>> + return NULL;
>> +}
>> +#endif
>> +
>> #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT)
>> enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np);
>> #else
>> --
>> 2.7.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
[toc] | [prev] | [next] | [standalone]
| From | Roger Quadros <rogerq@ti.com> |
|---|---|
| Date | 2016-05-02 14:30 +0200 |
| Subject | [PATCH v7 11/14] usb: otg: use dev_dbg() instead of VDBG() |
| Message-ID | <rul98-3f2-17@gated-at.bofh.it> |
| In reply to | #1392163 |
Now that we have a device reference in struct usb_otg
let's use dev_dbg() for debug messages.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/usb/common/usb-otg-fsm.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c
index 2986b66..e6e58c2 100644
--- a/drivers/usb/common/usb-otg-fsm.c
+++ b/drivers/usb/common/usb-otg-fsm.c
@@ -30,13 +30,6 @@
#include <linux/usb/otg.h>
#include <linux/usb/otg-fsm.h>
-#ifdef VERBOSE
-#define VDBG(fmt, args...) pr_debug("[%s] " fmt , \
- __func__, ## args)
-#else
-#define VDBG(stuff...) do {} while (0)
-#endif
-
/* Change USB protocol when there is a protocol change */
static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
{
@@ -44,8 +37,9 @@ static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
int ret = 0;
if (fsm->protocol != protocol) {
- VDBG("Changing role fsm->protocol= %d; new protocol= %d\n",
- fsm->protocol, protocol);
+ dev_vdbg(otg->dev,
+ "Changing role fsm->protocol= %d; new protocol= %d\n",
+ fsm->protocol, protocol);
/* stop old protocol */
if (fsm->protocol == PROTO_HOST)
ret = otg_start_host(otg, 0);
@@ -226,7 +220,7 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
if (otg->state == new_state)
return 0;
- VDBG("Set state: %s\n", usb_otg_state_string(new_state));
+ dev_vdbg(otg->dev, "Set state: %s\n", usb_otg_state_string(new_state));
otg_leave_state(fsm, otg->state);
switch (new_state) {
case OTG_STATE_B_IDLE:
@@ -358,7 +352,7 @@ int otg_statemachine(struct usb_otg *otg)
switch (state) {
case OTG_STATE_UNDEFINED:
- VDBG("fsm->id = %d\n", fsm->id);
+ dev_vdbg(otg->dev, "fsm->id = %d\n", fsm->id);
if (fsm->id)
otg_set_state(fsm, OTG_STATE_B_IDLE);
else
@@ -466,7 +460,8 @@ int otg_statemachine(struct usb_otg *otg)
}
mutex_unlock(&fsm->lock);
- VDBG("quit statemachine, changed = %d\n", fsm->state_changed);
+ dev_vdbg(otg->dev, "quit statemachine, changed = %d\n",
+ fsm->state_changed);
return fsm->state_changed;
}
EXPORT_SYMBOL_GPL(otg_statemachine);
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Peter Chen <hzpeterchen@gmail.com> |
|---|---|
| Date | 2016-05-06 11:20 +0200 |
| Subject | Re: [PATCH v7 11/14] usb: otg: use dev_dbg() instead of VDBG() |
| Message-ID | <rvK5r-2iM-5@gated-at.bofh.it> |
| In reply to | #1392170 |
On Mon, May 02, 2016 at 03:18:54PM +0300, Roger Quadros wrote:
> Now that we have a device reference in struct usb_otg
> let's use dev_dbg() for debug messages.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> drivers/usb/common/usb-otg-fsm.c | 19 +++++++------------
> 1 file changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c
> index 2986b66..e6e58c2 100644
> --- a/drivers/usb/common/usb-otg-fsm.c
> +++ b/drivers/usb/common/usb-otg-fsm.c
> @@ -30,13 +30,6 @@
> #include <linux/usb/otg.h>
> #include <linux/usb/otg-fsm.h>
>
> -#ifdef VERBOSE
> -#define VDBG(fmt, args...) pr_debug("[%s] " fmt , \
> - __func__, ## args)
> -#else
> -#define VDBG(stuff...) do {} while (0)
> -#endif
> -
> /* Change USB protocol when there is a protocol change */
> static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
> {
> @@ -44,8 +37,9 @@ static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
> int ret = 0;
>
> if (fsm->protocol != protocol) {
> - VDBG("Changing role fsm->protocol= %d; new protocol= %d\n",
> - fsm->protocol, protocol);
> + dev_vdbg(otg->dev,
> + "Changing role fsm->protocol= %d; new protocol= %d\n",
> + fsm->protocol, protocol);
> /* stop old protocol */
> if (fsm->protocol == PROTO_HOST)
> ret = otg_start_host(otg, 0);
> @@ -226,7 +220,7 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
>
> if (otg->state == new_state)
> return 0;
> - VDBG("Set state: %s\n", usb_otg_state_string(new_state));
> + dev_vdbg(otg->dev, "Set state: %s\n", usb_otg_state_string(new_state));
> otg_leave_state(fsm, otg->state);
> switch (new_state) {
> case OTG_STATE_B_IDLE:
> @@ -358,7 +352,7 @@ int otg_statemachine(struct usb_otg *otg)
>
> switch (state) {
> case OTG_STATE_UNDEFINED:
> - VDBG("fsm->id = %d\n", fsm->id);
> + dev_vdbg(otg->dev, "fsm->id = %d\n", fsm->id);
> if (fsm->id)
> otg_set_state(fsm, OTG_STATE_B_IDLE);
> else
> @@ -466,7 +460,8 @@ int otg_statemachine(struct usb_otg *otg)
> }
> mutex_unlock(&fsm->lock);
>
> - VDBG("quit statemachine, changed = %d\n", fsm->state_changed);
> + dev_vdbg(otg->dev, "quit statemachine, changed = %d\n",
> + fsm->state_changed);
> return fsm->state_changed;
> }
> EXPORT_SYMBOL_GPL(otg_statemachine);
> --
Could you squash patch 2 with this one?
--
Best Regards,
Peter Chen
[toc] | [prev] | [next] | [standalone]
| From | Roger Quadros <rogerq@ti.com> |
|---|---|
| Date | 2016-05-09 11:50 +0200 |
| Subject | Re: [PATCH v7 11/14] usb: otg: use dev_dbg() instead of VDBG() |
| Message-ID | <rwPZ8-2Mv-17@gated-at.bofh.it> |
| In reply to | #1395733 |
On 06/05/16 12:04, Peter Chen wrote:
> On Mon, May 02, 2016 at 03:18:54PM +0300, Roger Quadros wrote:
>> Now that we have a device reference in struct usb_otg
>> let's use dev_dbg() for debug messages.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>> drivers/usb/common/usb-otg-fsm.c | 19 +++++++------------
>> 1 file changed, 7 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c
>> index 2986b66..e6e58c2 100644
>> --- a/drivers/usb/common/usb-otg-fsm.c
>> +++ b/drivers/usb/common/usb-otg-fsm.c
>> @@ -30,13 +30,6 @@
>> #include <linux/usb/otg.h>
>> #include <linux/usb/otg-fsm.h>
>>
>> -#ifdef VERBOSE
>> -#define VDBG(fmt, args...) pr_debug("[%s] " fmt , \
>> - __func__, ## args)
>> -#else
>> -#define VDBG(stuff...) do {} while (0)
>> -#endif
>> -
>> /* Change USB protocol when there is a protocol change */
>> static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
>> {
>> @@ -44,8 +37,9 @@ static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
>> int ret = 0;
>>
>> if (fsm->protocol != protocol) {
>> - VDBG("Changing role fsm->protocol= %d; new protocol= %d\n",
>> - fsm->protocol, protocol);
>> + dev_vdbg(otg->dev,
>> + "Changing role fsm->protocol= %d; new protocol= %d\n",
>> + fsm->protocol, protocol);
>> /* stop old protocol */
>> if (fsm->protocol == PROTO_HOST)
>> ret = otg_start_host(otg, 0);
>> @@ -226,7 +220,7 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
>>
>> if (otg->state == new_state)
>> return 0;
>> - VDBG("Set state: %s\n", usb_otg_state_string(new_state));
>> + dev_vdbg(otg->dev, "Set state: %s\n", usb_otg_state_string(new_state));
>> otg_leave_state(fsm, otg->state);
>> switch (new_state) {
>> case OTG_STATE_B_IDLE:
>> @@ -358,7 +352,7 @@ int otg_statemachine(struct usb_otg *otg)
>>
>> switch (state) {
>> case OTG_STATE_UNDEFINED:
>> - VDBG("fsm->id = %d\n", fsm->id);
>> + dev_vdbg(otg->dev, "fsm->id = %d\n", fsm->id);
>> if (fsm->id)
>> otg_set_state(fsm, OTG_STATE_B_IDLE);
>> else
>> @@ -466,7 +460,8 @@ int otg_statemachine(struct usb_otg *otg)
>> }
>> mutex_unlock(&fsm->lock);
>>
>> - VDBG("quit statemachine, changed = %d\n", fsm->state_changed);
>> + dev_vdbg(otg->dev, "quit statemachine, changed = %d\n",
>> + fsm->state_changed);
>> return fsm->state_changed;
>> }
>> EXPORT_SYMBOL_GPL(otg_statemachine);
>> --
>
> Could you squash patch 2 with this one?
>
We can't because at patch 2, otg->dev is not defined and we need patch 2
before patch 8 to prevent the build warning. This patch can come only
after patch 8 where we add otg->dev.
cheers,
-roger
[toc] | [prev] | [next] | [standalone]
| From | Peter Chen <hzpeterchen@gmail.com> |
|---|---|
| Date | 2016-05-11 11:00 +0200 |
| Subject | Re: [PATCH v7 11/14] usb: otg: use dev_dbg() instead of VDBG() |
| Message-ID | <rxy9Q-4Ae-7@gated-at.bofh.it> |
| In reply to | #1396894 |
On Mon, May 09, 2016 at 12:48:28PM +0300, Roger Quadros wrote:
> On 06/05/16 12:04, Peter Chen wrote:
> > On Mon, May 02, 2016 at 03:18:54PM +0300, Roger Quadros wrote:
> >> Now that we have a device reference in struct usb_otg
> >> let's use dev_dbg() for debug messages.
> >>
> >> Signed-off-by: Roger Quadros <rogerq@ti.com>
> >> ---
> >> drivers/usb/common/usb-otg-fsm.c | 19 +++++++------------
> >> 1 file changed, 7 insertions(+), 12 deletions(-)
> >>
> >> diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c
> >> index 2986b66..e6e58c2 100644
> >> --- a/drivers/usb/common/usb-otg-fsm.c
> >> +++ b/drivers/usb/common/usb-otg-fsm.c
> >> @@ -30,13 +30,6 @@
> >> #include <linux/usb/otg.h>
> >> #include <linux/usb/otg-fsm.h>
> >>
> >> -#ifdef VERBOSE
> >> -#define VDBG(fmt, args...) pr_debug("[%s] " fmt , \
> >> - __func__, ## args)
> >> -#else
> >> -#define VDBG(stuff...) do {} while (0)
> >> -#endif
> >> -
> >> /* Change USB protocol when there is a protocol change */
> >> static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
> >> {
> >> @@ -44,8 +37,9 @@ static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
> >> int ret = 0;
> >>
> >> if (fsm->protocol != protocol) {
> >> - VDBG("Changing role fsm->protocol= %d; new protocol= %d\n",
> >> - fsm->protocol, protocol);
> >> + dev_vdbg(otg->dev,
> >> + "Changing role fsm->protocol= %d; new protocol= %d\n",
> >> + fsm->protocol, protocol);
> >> /* stop old protocol */
> >> if (fsm->protocol == PROTO_HOST)
> >> ret = otg_start_host(otg, 0);
> >> @@ -226,7 +220,7 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
> >>
> >> if (otg->state == new_state)
> >> return 0;
> >> - VDBG("Set state: %s\n", usb_otg_state_string(new_state));
> >> + dev_vdbg(otg->dev, "Set state: %s\n", usb_otg_state_string(new_state));
> >> otg_leave_state(fsm, otg->state);
> >> switch (new_state) {
> >> case OTG_STATE_B_IDLE:
> >> @@ -358,7 +352,7 @@ int otg_statemachine(struct usb_otg *otg)
> >>
> >> switch (state) {
> >> case OTG_STATE_UNDEFINED:
> >> - VDBG("fsm->id = %d\n", fsm->id);
> >> + dev_vdbg(otg->dev, "fsm->id = %d\n", fsm->id);
> >> if (fsm->id)
> >> otg_set_state(fsm, OTG_STATE_B_IDLE);
> >> else
> >> @@ -466,7 +460,8 @@ int otg_statemachine(struct usb_otg *otg)
> >> }
> >> mutex_unlock(&fsm->lock);
> >>
> >> - VDBG("quit statemachine, changed = %d\n", fsm->state_changed);
> >> + dev_vdbg(otg->dev, "quit statemachine, changed = %d\n",
> >> + fsm->state_changed);
> >> return fsm->state_changed;
> >> }
> >> EXPORT_SYMBOL_GPL(otg_statemachine);
> >> --
> >
> > Could you squash patch 2 with this one?
> >
>
> We can't because at patch 2, otg->dev is not defined and we need patch 2
> before patch 8 to prevent the build warning. This patch can come only
> after patch 8 where we add otg->dev.
>
Acked-by: Peter Chen <peter.chen@nxp.com>
--
Best Regards,
Peter Chen
[toc] | [prev] | [next] | [standalone]
| From | Roger Quadros <rogerq@ti.com> |
|---|---|
| Date | 2016-05-02 14:30 +0200 |
| Subject | [PATCH v7 14/14] usb: host: xhci-plat: Add otg device to platform data |
| Message-ID | <rul98-3f2-21@gated-at.bofh.it> |
| In reply to | #1392163 |
Host controllers that are part of an OTG/dual-role instance
need to somehow pass the OTG controller device information
to the HCD core.
We use platform data to pass the OTG controller device.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/usb/host/xhci-plat.c | 35 ++++++++++++++++++++++++++++-------
include/linux/usb/xhci_pdriver.h | 3 +++
2 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 5c15e9b..84ebe18 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -230,11 +230,20 @@ static int xhci_plat_probe(struct platform_device *pdev)
goto put_usb3_hcd;
}
- ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
+ if (pdata && pdata->otg_dev)
+ ret = usb_otg_add_hcd(hcd, irq, IRQF_SHARED, pdata->otg_dev);
+ else
+ ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
+
if (ret)
goto disable_usb_phy;
- ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
+ if (pdata && pdata->otg_dev)
+ ret = usb_otg_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED,
+ pdata->otg_dev);
+ else
+ ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
+
if (ret)
goto dealloc_usb2_hcd;
@@ -242,7 +251,10 @@ static int xhci_plat_probe(struct platform_device *pdev)
dealloc_usb2_hcd:
- usb_remove_hcd(hcd);
+ if (pdata && pdata->otg_dev)
+ usb_otg_remove_hcd(hcd);
+ else
+ usb_remove_hcd(hcd);
disable_usb_phy:
usb_phy_shutdown(hcd->usb_phy);
@@ -260,16 +272,25 @@ put_hcd:
return ret;
}
-static int xhci_plat_remove(struct platform_device *dev)
+static int xhci_plat_remove(struct platform_device *pdev)
{
- struct usb_hcd *hcd = platform_get_drvdata(dev);
+ struct usb_hcd *hcd = platform_get_drvdata(pdev);
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
struct clk *clk = xhci->clk;
+ struct usb_xhci_pdata *pdata = dev_get_platdata(&pdev->dev);
+
+ if (pdata && pdata->otg_dev)
+ usb_otg_remove_hcd(xhci->shared_hcd);
+ else
+ usb_remove_hcd(xhci->shared_hcd);
- usb_remove_hcd(xhci->shared_hcd);
usb_phy_shutdown(hcd->usb_phy);
- usb_remove_hcd(hcd);
+ if (pdata && pdata->otg_dev)
+ usb_otg_remove_hcd(hcd);
+ else
+ usb_remove_hcd(hcd);
+
usb_put_hcd(xhci->shared_hcd);
if (!IS_ERR(clk))
diff --git a/include/linux/usb/xhci_pdriver.h b/include/linux/usb/xhci_pdriver.h
index 376654b..5c68b83 100644
--- a/include/linux/usb/xhci_pdriver.h
+++ b/include/linux/usb/xhci_pdriver.h
@@ -18,10 +18,13 @@
*
* @usb3_lpm_capable: determines if this xhci platform supports USB3
* LPM capability
+ * @otg_dev: OTG controller device. Only requied if part of
+ * OTG/dual-role.
*
*/
struct usb_xhci_pdata {
unsigned usb3_lpm_capable:1;
+ struct device *otg_dev;
};
#endif /* __USB_CORE_XHCI_PDRIVER_H */
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Peter Chen <hzpeterchen@gmail.com> |
|---|---|
| Date | 2016-05-11 11:10 +0200 |
| Subject | Re: [PATCH v7 14/14] usb: host: xhci-plat: Add otg device to platform data |
| Message-ID | <rxyjw-58a-7@gated-at.bofh.it> |
| In reply to | #1392172 |
On Mon, May 02, 2016 at 03:18:57PM +0300, Roger Quadros wrote:
> Host controllers that are part of an OTG/dual-role instance
> need to somehow pass the OTG controller device information
> to the HCD core.
>
> We use platform data to pass the OTG controller device.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> drivers/usb/host/xhci-plat.c | 35 ++++++++++++++++++++++++++++-------
> include/linux/usb/xhci_pdriver.h | 3 +++
> 2 files changed, 31 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index 5c15e9b..84ebe18 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -230,11 +230,20 @@ static int xhci_plat_probe(struct platform_device *pdev)
> goto put_usb3_hcd;
> }
>
> - ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
> + if (pdata && pdata->otg_dev)
> + ret = usb_otg_add_hcd(hcd, irq, IRQF_SHARED, pdata->otg_dev);
> + else
> + ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
> +
> if (ret)
> goto disable_usb_phy;
>
> - ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
> + if (pdata && pdata->otg_dev)
> + ret = usb_otg_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED,
> + pdata->otg_dev);
> + else
> + ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
> +
> if (ret)
> goto dealloc_usb2_hcd;
>
> @@ -242,7 +251,10 @@ static int xhci_plat_probe(struct platform_device *pdev)
>
>
> dealloc_usb2_hcd:
> - usb_remove_hcd(hcd);
> + if (pdata && pdata->otg_dev)
> + usb_otg_remove_hcd(hcd);
> + else
> + usb_remove_hcd(hcd);
>
> disable_usb_phy:
> usb_phy_shutdown(hcd->usb_phy);
> @@ -260,16 +272,25 @@ put_hcd:
> return ret;
> }
>
> -static int xhci_plat_remove(struct platform_device *dev)
> +static int xhci_plat_remove(struct platform_device *pdev)
> {
> - struct usb_hcd *hcd = platform_get_drvdata(dev);
> + struct usb_hcd *hcd = platform_get_drvdata(pdev);
> struct xhci_hcd *xhci = hcd_to_xhci(hcd);
> struct clk *clk = xhci->clk;
> + struct usb_xhci_pdata *pdata = dev_get_platdata(&pdev->dev);
> +
> + if (pdata && pdata->otg_dev)
> + usb_otg_remove_hcd(xhci->shared_hcd);
> + else
> + usb_remove_hcd(xhci->shared_hcd);
>
> - usb_remove_hcd(xhci->shared_hcd);
> usb_phy_shutdown(hcd->usb_phy);
>
> - usb_remove_hcd(hcd);
> + if (pdata && pdata->otg_dev)
> + usb_otg_remove_hcd(hcd);
> + else
> + usb_remove_hcd(hcd);
> +
> usb_put_hcd(xhci->shared_hcd);
>
> if (!IS_ERR(clk))
> diff --git a/include/linux/usb/xhci_pdriver.h b/include/linux/usb/xhci_pdriver.h
> index 376654b..5c68b83 100644
> --- a/include/linux/usb/xhci_pdriver.h
> +++ b/include/linux/usb/xhci_pdriver.h
> @@ -18,10 +18,13 @@
> *
> * @usb3_lpm_capable: determines if this xhci platform supports USB3
> * LPM capability
> + * @otg_dev: OTG controller device. Only requied if part of
> + * OTG/dual-role.
> *
> */
> struct usb_xhci_pdata {
> unsigned usb3_lpm_capable:1;
> + struct device *otg_dev;
> };
>
> #endif /* __USB_CORE_XHCI_PDRIVER_H */
> --
> 2.7.4
>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
--
Best Regards,
Peter Chen
[toc] | [prev] | [next] | [standalone]
| From | Roger Quadros <rogerq@ti.com> |
|---|---|
| Date | 2016-05-02 14:30 +0200 |
| Subject | [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface |
| Message-ID | <rul98-3f2-25@gated-at.bofh.it> |
| In reply to | #1392163 |
The OTG core will use struct otg_hcd_ops to interface
with the HCD controller.
The main purpose of this interface is to avoid directly
calling HCD APIs from the OTG core as they
wouldn't be defined in the built-in symbol table if
CONFIG_USB is m.
Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
---
include/linux/usb/hcd.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index b98f831..861ccaa 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -399,6 +399,30 @@ struct hc_driver {
};
+/**
+ * struct otg_hcd_ops - Interface between OTG core and HCD
+ *
+ * Provided by the HCD core to allow the OTG core to interface with the HCD
+ *
+ * @add: function to add the HCD
+ * @remove: function to remove the HCD
+ * @usb_bus_start_enum: function to immediately start bus enumeration
+ * @usb_control_msg: function to build and send of a control urb
+ * @usb_hub_find_child: function to get pointer to the child device
+ */
+struct otg_hcd_ops {
+ int (*add)(struct usb_hcd *hcd,
+ unsigned int irqnum, unsigned long irqflags);
+ void (*remove)(struct usb_hcd *hcd);
+ int (*usb_bus_start_enum)(struct usb_bus *bus, unsigned int port_num);
+ int (*usb_control_msg)(struct usb_device *dev, unsigned int pipe,
+ __u8 request, __u8 requesttype, __u16 value,
+ __u16 index, void *data, __u16 size,
+ int timeout);
+ struct usb_device * (*usb_hub_find_child)(struct usb_device *hdev,
+ int port1);
+};
+
static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd)
{
return hcd->driver->flags & HCD_BH;
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Peter Chen <hzpeterchen@gmail.com> |
|---|---|
| Date | 2016-05-06 11:50 +0200 |
| Subject | Re: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface |
| Message-ID | <rvKyt-2xM-7@gated-at.bofh.it> |
| In reply to | #1392173 |
On Mon, May 02, 2016 at 03:18:46PM +0300, Roger Quadros wrote:
> The OTG core will use struct otg_hcd_ops to interface
> with the HCD controller.
>
> The main purpose of this interface is to avoid directly
> calling HCD APIs from the OTG core as they
> wouldn't be defined in the built-in symbol table if
> CONFIG_USB is m.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Acked-by: Peter Chen <peter.chen@nxp.com>
Roger, after thinking more, I still think current dependency between
OTG, HCD and gadget are too complicated. Since the OTG can't work
if it is built as module, I suggest letting OTG depends on HCD &&
USB_GADGET, and it is a boolean, in that case, we don't need to
export any HCD and gadget ops, things will be much simpler.
What's your opinion?
Peter
> ---
> include/linux/usb/hcd.h | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
> index b98f831..861ccaa 100644
> --- a/include/linux/usb/hcd.h
> +++ b/include/linux/usb/hcd.h
> @@ -399,6 +399,30 @@ struct hc_driver {
>
> };
>
> +/**
> + * struct otg_hcd_ops - Interface between OTG core and HCD
> + *
> + * Provided by the HCD core to allow the OTG core to interface with the HCD
> + *
> + * @add: function to add the HCD
> + * @remove: function to remove the HCD
> + * @usb_bus_start_enum: function to immediately start bus enumeration
> + * @usb_control_msg: function to build and send of a control urb
> + * @usb_hub_find_child: function to get pointer to the child device
> + */
> +struct otg_hcd_ops {
> + int (*add)(struct usb_hcd *hcd,
> + unsigned int irqnum, unsigned long irqflags);
> + void (*remove)(struct usb_hcd *hcd);
> + int (*usb_bus_start_enum)(struct usb_bus *bus, unsigned int port_num);
> + int (*usb_control_msg)(struct usb_device *dev, unsigned int pipe,
> + __u8 request, __u8 requesttype, __u16 value,
> + __u16 index, void *data, __u16 size,
> + int timeout);
> + struct usb_device * (*usb_hub_find_child)(struct usb_device *hdev,
> + int port1);
> +};
> +
> static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd)
> {
> return hcd->driver->flags & HCD_BH;
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Best Regards,
Peter Chen
[toc] | [prev] | [next] | [standalone]
| From | Roger Quadros <rogerq@ti.com> |
|---|---|
| Date | 2016-05-09 11:50 +0200 |
| Subject | Re: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface |
| Message-ID | <rwPZ8-2Mv-13@gated-at.bofh.it> |
| In reply to | #1395741 |
On 06/05/16 12:41, Peter Chen wrote:
> On Mon, May 02, 2016 at 03:18:46PM +0300, Roger Quadros wrote:
>> The OTG core will use struct otg_hcd_ops to interface
>> with the HCD controller.
>>
>> The main purpose of this interface is to avoid directly
>> calling HCD APIs from the OTG core as they
>> wouldn't be defined in the built-in symbol table if
>> CONFIG_USB is m.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> Acked-by: Peter Chen <peter.chen@nxp.com>
>
> Roger, after thinking more, I still think current dependency between
> OTG, HCD and gadget are too complicated. Since the OTG can't work
> if it is built as module, I suggest letting OTG depends on HCD &&
> USB_GADGET, and it is a boolean, in that case, we don't need to
> export any HCD and gadget ops, things will be much simpler.
> What's your opinion?
How will it work if HCD and USB_GADGET are modules and OTG is built-in?
cheers,
-roger
>
> Peter
>
>> ---
>> include/linux/usb/hcd.h | 24 ++++++++++++++++++++++++
>> 1 file changed, 24 insertions(+)
>>
>> diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
>> index b98f831..861ccaa 100644
>> --- a/include/linux/usb/hcd.h
>> +++ b/include/linux/usb/hcd.h
>> @@ -399,6 +399,30 @@ struct hc_driver {
>>
>> };
>>
>> +/**
>> + * struct otg_hcd_ops - Interface between OTG core and HCD
>> + *
>> + * Provided by the HCD core to allow the OTG core to interface with the HCD
>> + *
>> + * @add: function to add the HCD
>> + * @remove: function to remove the HCD
>> + * @usb_bus_start_enum: function to immediately start bus enumeration
>> + * @usb_control_msg: function to build and send of a control urb
>> + * @usb_hub_find_child: function to get pointer to the child device
>> + */
>> +struct otg_hcd_ops {
>> + int (*add)(struct usb_hcd *hcd,
>> + unsigned int irqnum, unsigned long irqflags);
>> + void (*remove)(struct usb_hcd *hcd);
>> + int (*usb_bus_start_enum)(struct usb_bus *bus, unsigned int port_num);
>> + int (*usb_control_msg)(struct usb_device *dev, unsigned int pipe,
>> + __u8 request, __u8 requesttype, __u16 value,
>> + __u16 index, void *data, __u16 size,
>> + int timeout);
>> + struct usb_device * (*usb_hub_find_child)(struct usb_device *hdev,
>> + int port1);
>> +};
>> +
>> static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd)
>> {
>> return hcd->driver->flags & HCD_BH;
>> --
>> 2.7.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
[toc] | [prev] | [next] | [standalone]
| From | Peter Chen <hzpeterchen@gmail.com> |
|---|---|
| Date | 2016-05-10 05:30 +0200 |
| Subject | Re: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface |
| Message-ID | <rx6wW-2kR-7@gated-at.bofh.it> |
| In reply to | #1396892 |
On Mon, May 09, 2016 at 12:45:38PM +0300, Roger Quadros wrote:
> On 06/05/16 12:41, Peter Chen wrote:
> > On Mon, May 02, 2016 at 03:18:46PM +0300, Roger Quadros wrote:
> >> The OTG core will use struct otg_hcd_ops to interface
> >> with the HCD controller.
> >>
> >> The main purpose of this interface is to avoid directly
> >> calling HCD APIs from the OTG core as they
> >> wouldn't be defined in the built-in symbol table if
> >> CONFIG_USB is m.
> >>
> >> Signed-off-by: Roger Quadros <rogerq@ti.com>
> >> Acked-by: Peter Chen <peter.chen@nxp.com>
> >
> > Roger, after thinking more, I still think current dependency between
> > OTG, HCD and gadget are too complicated. Since the OTG can't work
> > if it is built as module, I suggest letting OTG depends on HCD &&
> > USB_GADGET, and it is a boolean, in that case, we don't need to
> > export any HCD and gadget ops, things will be much simpler.
> > What's your opinion?
>
> How will it work if HCD and USB_GADGET are modules and OTG is built-in?
>
The OTG will not be compiled at this situation, since it is boolean.
In fact, like I mentioned at above, OTG or USB function can't work if
it is built as module.
Peter
> cheers,
> -roger
>
> >
> > Peter
> >
> >> ---
> >> include/linux/usb/hcd.h | 24 ++++++++++++++++++++++++
> >> 1 file changed, 24 insertions(+)
> >>
> >> diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
> >> index b98f831..861ccaa 100644
> >> --- a/include/linux/usb/hcd.h
> >> +++ b/include/linux/usb/hcd.h
> >> @@ -399,6 +399,30 @@ struct hc_driver {
> >>
> >> };
> >>
> >> +/**
> >> + * struct otg_hcd_ops - Interface between OTG core and HCD
> >> + *
> >> + * Provided by the HCD core to allow the OTG core to interface with the HCD
> >> + *
> >> + * @add: function to add the HCD
> >> + * @remove: function to remove the HCD
> >> + * @usb_bus_start_enum: function to immediately start bus enumeration
> >> + * @usb_control_msg: function to build and send of a control urb
> >> + * @usb_hub_find_child: function to get pointer to the child device
> >> + */
> >> +struct otg_hcd_ops {
> >> + int (*add)(struct usb_hcd *hcd,
> >> + unsigned int irqnum, unsigned long irqflags);
> >> + void (*remove)(struct usb_hcd *hcd);
> >> + int (*usb_bus_start_enum)(struct usb_bus *bus, unsigned int port_num);
> >> + int (*usb_control_msg)(struct usb_device *dev, unsigned int pipe,
> >> + __u8 request, __u8 requesttype, __u16 value,
> >> + __u16 index, void *data, __u16 size,
> >> + int timeout);
> >> + struct usb_device * (*usb_hub_find_child)(struct usb_device *hdev,
> >> + int port1);
> >> +};
> >> +
> >> static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd)
> >> {
> >> return hcd->driver->flags & HCD_BH;
> >> --
> >> 2.7.4
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
--
Best Regards,
Peter Chen
[toc] | [prev] | [next] | [standalone]
| From | Roger Quadros <rogerq@ti.com> |
|---|---|
| Date | 2016-05-10 09:40 +0200 |
| Subject | Re: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface |
| Message-ID | <rxaqS-6fU-37@gated-at.bofh.it> |
| In reply to | #1397674 |
On 10/05/16 06:14, Peter Chen wrote:
> On Mon, May 09, 2016 at 12:45:38PM +0300, Roger Quadros wrote:
>> On 06/05/16 12:41, Peter Chen wrote:
>>> On Mon, May 02, 2016 at 03:18:46PM +0300, Roger Quadros wrote:
>>>> The OTG core will use struct otg_hcd_ops to interface
>>>> with the HCD controller.
>>>>
>>>> The main purpose of this interface is to avoid directly
>>>> calling HCD APIs from the OTG core as they
>>>> wouldn't be defined in the built-in symbol table if
>>>> CONFIG_USB is m.
>>>>
>>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>>> Acked-by: Peter Chen <peter.chen@nxp.com>
>>>
>>> Roger, after thinking more, I still think current dependency between
>>> OTG, HCD and gadget are too complicated. Since the OTG can't work
>>> if it is built as module, I suggest letting OTG depends on HCD &&
>>> USB_GADGET, and it is a boolean, in that case, we don't need to
>>> export any HCD and gadget ops, things will be much simpler.
>>> What's your opinion?
>>
>> How will it work if HCD and USB_GADGET are modules and OTG is built-in?
>>
>
> The OTG will not be compiled at this situation, since it is boolean.
> In fact, like I mentioned at above, OTG or USB function can't work if
> it is built as module.
Isn't this a limitation?
As per the current implementation dual role works fine even with both
USB_GADGET and HCD as module.
In the real world it is unlikely that GADGET and HCD will be built-in.
cheers,
-roger
>
> Peter
>> cheers,
>> -roger
>>
>>>
>>> Peter
>>>
>>>> ---
>>>> include/linux/usb/hcd.h | 24 ++++++++++++++++++++++++
>>>> 1 file changed, 24 insertions(+)
>>>>
>>>> diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
>>>> index b98f831..861ccaa 100644
>>>> --- a/include/linux/usb/hcd.h
>>>> +++ b/include/linux/usb/hcd.h
>>>> @@ -399,6 +399,30 @@ struct hc_driver {
>>>>
>>>> };
>>>>
>>>> +/**
>>>> + * struct otg_hcd_ops - Interface between OTG core and HCD
>>>> + *
>>>> + * Provided by the HCD core to allow the OTG core to interface with the HCD
>>>> + *
>>>> + * @add: function to add the HCD
>>>> + * @remove: function to remove the HCD
>>>> + * @usb_bus_start_enum: function to immediately start bus enumeration
>>>> + * @usb_control_msg: function to build and send of a control urb
>>>> + * @usb_hub_find_child: function to get pointer to the child device
>>>> + */
>>>> +struct otg_hcd_ops {
>>>> + int (*add)(struct usb_hcd *hcd,
>>>> + unsigned int irqnum, unsigned long irqflags);
>>>> + void (*remove)(struct usb_hcd *hcd);
>>>> + int (*usb_bus_start_enum)(struct usb_bus *bus, unsigned int port_num);
>>>> + int (*usb_control_msg)(struct usb_device *dev, unsigned int pipe,
>>>> + __u8 request, __u8 requesttype, __u16 value,
>>>> + __u16 index, void *data, __u16 size,
>>>> + int timeout);
>>>> + struct usb_device * (*usb_hub_find_child)(struct usb_device *hdev,
>>>> + int port1);
>>>> +};
>>>> +
>>>> static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd)
>>>> {
>>>> return hcd->driver->flags & HCD_BH;
>>>> --
>>>> 2.7.4
>>>>
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>>
>
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | linux.kernel
csiph-web