Re: [PATCH v11 08/14] usb: otg: add OTG/dual-role core

2016-06-20 Thread Peter Chen
On Mon, Jun 20, 2016 at 03:08:15PM +0300, Felipe Balbi wrote: > > Hi, > > Peter Chen writes: > >> Roger Quadros writes: > >> > It provides APIs for the following tasks > >> > > >> > - Registering an OTG/dual-role capable controller >

Re: [PATCH] dt-bindings: ci-hdrc-usb2: s/gadget-itc-setting/itc-setting in example

2016-06-20 Thread Peter Chen
t; - gadget-itc-setting = <0x4>; /* 4 micro-frames */ > + itc-setting = <0x4>; /* 4 micro-frames */ >/* Incremental burst of unspecified length */ > ahb-burst-config = <0x0>; > tx-burst-size-dword = <0x10>; /* 64 bytes */ > -- Applied, thanks. -- Best Regards, Peter Chen

Re: [PATCH v11 08/14] usb: otg: add OTG/dual-role core

2016-06-20 Thread Peter Chen
core. > > do you really know of any platform which has a separate OTG controller? > It may not be a real separate OTG controller. It can be a hardware part (external connector, external IC, SoC OTG register area, etc) to handle vbus ,id and other signals which are used for role swap. -- Best Regards, Peter Chen

Re: [PATCH] USB: core: fix missing include

2016-06-16 Thread Peter Chen
us definition of > >> 'usb_of_get_child_node' was here > >> static inline struct device_node *usb_of_get_child_node > >> ^ > >> > >> vim +/usb_of_get_child_node +32 drivers/usb/core/of.c >

[PATCH 1/1] usb: core: of.c: fix defined but not declare warning

2016-06-14 Thread Peter Chen
@vger.kernel.org Cc: Ben Dooks Cc: linux-ker...@lists.codethink.co.uk Signed-off-by: Peter Chen Reported-by: Ben Dooks --- drivers/usb/core/Makefile | 3 ++- drivers/usb/core/of.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/Makefile b/drivers/usb/core

Re: [PATCH] USB: core: fix missing include

2016-06-14 Thread Peter Chen
x27; was here > > static inline struct device_node *usb_of_get_child_node > > ^~~~~ > > > > vim +/usb_of_get_child_node +32 drivers/usb/core/of.c > > > > 69bec725 Peter Chen 2016-02-19 26 * @portnum: the port number

Re: [PATCH v10 00/14] USB OTG/dual-role framework

2016-06-13 Thread Peter Chen
- > 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| 22 + > include/linux/usb/hcd.h | 29 + > include/linux/usb/of.h| 9 + > include/linux/usb/otg-fsm.h | 154 +--- > include/linux/usb/otg.h | 290 ++- > include/linux/usb/xhci_pdriver.h | 3 + > 29 files changed, 1918 insertions(+), 462 deletions(-) > create mode 100644 drivers/usb/common/usb-otg.c > > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen

Re: [PATCH v11 08/14] usb: otg: add OTG/dual-role core

2016-06-13 Thread Peter Chen
n usb-otg.c. > The DRD state machine is only interested in 2 hardware inputs > 'id' and 'b_sess_vld'. > > Signed-off-by: Roger Quadros > --- > v11: > - remove usb_otg_kick_fsm(). > - typo fixes: structa/structure, upto/up to. > - remove "o

Re: [PATCH v11 13/14] usb: gadget: udc: adapt to OTG core

2016-06-13 Thread Peter Chen
On Mon, Jun 13, 2016 at 10:55:12AM +0300, Roger Quadros wrote: > err1: > - if (ret != -EISNAM) > + if ((ret != -EISNAM)) Since you do not need above change. Expect above, I am ok with this patch. Acked-by: Peter Chen > dev_err(&udc->dev, "

Re: usb: common: otg-fsm: add license to usb-otg-fsm

2016-06-13 Thread Peter Chen
-- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Good catch, but would you please create the patch using "git format-patch", I can't apply it directly. -- Best Regards, Peter Chen

Re: [PATCH v10 13/14] usb: gadget: udc: adapt to OTG core

2016-06-13 Thread Peter Chen
On Mon, Jun 13, 2016 at 10:37:59AM +0300, Roger Quadros wrote: > On 13/06/16 10:20, Peter Chen wrote: > > On Mon, Jun 13, 2016 at 10:14:31AM +0300, Roger Quadros wrote: > >> On 12/06/16 14:36, Peter Chen wrote: > >>> On Fri, Jun 10, 2016 at 04:07:2

Re: [PATCH v10 13/14] usb: gadget: udc: adapt to OTG core

2016-06-13 Thread Peter Chen
On Mon, Jun 13, 2016 at 10:14:31AM +0300, Roger Quadros wrote: > On 12/06/16 14:36, Peter Chen wrote: > > On Fri, Jun 10, 2016 at 04:07:22PM +0300, Roger Quadros wrote: > >> > >> +/** > >> + * usb_otg_add_gadget_udc - adds a new gadget to the udc class driv

Re: [RFC v4 01/14] regulator: of: Add helper for getting all supplies

2016-06-12 Thread Peter Chen
On Sun, Jun 12, 2016 at 03:29:01PM +0800, Peter Chen wrote: > On Fri, Jun 10, 2016 at 12:30:56PM -0500, Rob Herring wrote: > > On Thu, Jun 09, 2016 at 01:42:02PM +0200, Krzysztof Kozlowski wrote: > > > On 06/09/2016 12:29 PM, Mark Brown wrote: > > > > On Thu, Ju

Re: [PATCH v10 13/14] usb: gadget: udc: adapt to OTG core

2016-06-12 Thread Peter Chen
> > kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); > return 0; > err1: > - if (ret != -EISNAM) > + if ((ret != -EISNAM) && (ret != -EPROBE_DEFER)) It seems it will not introduce -EPROBE_DEFER with your changes in udc_bind_to_driver -- Best Regards, Peter Chen

Re: [PATCH v10 08/14] usb: otg: add OTG/dual-role core

2016-06-12 Thread Peter Chen
ister the gadget controller to OTG core > + * @gadget: gadget controller instance > + * @ops: gadget interface ops > + * > + * This is used by the USB gadget stack to register the gadget controller > + * to the OTG core. Gadget controller must not be started by the > + * caller as it is left upto the OTG state machine to do so. > + * %s/upto/up to -- Best Regards, Peter Chen

Re: [PATCH v9 08/14] usb: otg: add OTG/dual-role core

2016-06-12 Thread Peter Chen
On Sun, Jun 12, 2016 at 02:26:17PM +0800, Peter Chen wrote: > On Thu, Jun 09, 2016 at 10:24:44AM +0300, Roger Quadros wrote: > > On 08/06/16 15:42, Peter Chen wrote: > > > On Wed, Jun 08, 2016 at 01:12:10PM +0300, Roger Quadros wrote: > > >> Hi, > > >>

Re: [PATCH v10 06/14] usb: gadget.h: Add OTG to gadget interface

2016-06-12 Thread Peter Chen
x27;t be defined in the built-in symbol table if > CONFIG_USB_GADGET is m. > > Signed-off-by: Roger Quadros Acked-by: Peter Chen > --- > include/linux/usb/gadget.h | 16 > 1 file changed, 16 insertions(+) > > diff --git a/include/linux/usb/gadget

Re: [PATCH v7 2/4] usb: dwc3: add dual-role support

2016-06-12 Thread Peter Chen
requested (mainly for testing purposes) > * @revision: revision register contents > - * @dr_mode: requested mode of operation > * @usb2_phy: pointer to USB2 PHY > * @usb3_phy: pointer to USB3 PHY > * @usb2_generic_phy: pointer to USB2 PHY > @@ -831,6 +840,9 @@ struct dwc3_scratchpad_array { > * @ulpi: pointer to ulpi interface > * @dcfg: saved contents of DCFG register > * @gctl: saved contents of GCTL register > + * @ocfg: saved contents of OCFG register > + * @octl: saved contents of OCTL register > + * @oevten: saved contents of OEVTEN register > * @isoch_delay: wValue from Set Isochronous Delay request; > * @u2sel: parameter from Set SEL request. > * @u2pel: parameter from Set SEL request. > @@ -929,9 +941,25 @@ struct dwc3 { > size_t regs_size; > > enum usb_dr_modedr_mode; > + struct usb_otg *otg; > + struct usb_otg_caps otg_caps; > + struct usb_otg_config otg_config; > + boolotg_prevent_sync; > + int otg_protocol; > + u32 current_mode; > + u32 oevt; > > u32 fladj; > u32 irq_gadget; > + int otg_irq; > + > + /* used for suspend/resume */ > + u32 dcfg; > + u32 gctl; > + u32 ocfg; > + u32 octl; > + u32 oevten; > + > u32 nr_scratch; > u32 u1u2; > u32 maximum_speed; > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > index 1ade5e8..e409b1e 100644 > --- a/drivers/usb/dwc3/gadget.c > +++ b/drivers/usb/dwc3/gadget.c > @@ -2974,7 +2974,11 @@ int dwc3_gadget_init(struct dwc3 *dwc) > if (ret) > goto err5; > > - ret = usb_add_gadget_udc(dwc->dev, &dwc->gadget); > + if (dwc->dr_mode == USB_DR_MODE_OTG) > + ret = usb_otg_add_gadget_udc(dwc->dev, &dwc->gadget, dwc->dev); > + else > + ret = usb_add_gadget_udc(dwc->dev, &dwc->gadget); > + > if (ret) { > dev_err(dwc->dev, "failed to register udc\n"); > goto err5; > diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c > index 2e960ed..32096ec 100644 > --- a/drivers/usb/dwc3/host.c > +++ b/drivers/usb/dwc3/host.c > @@ -91,6 +91,8 @@ int dwc3_host_init(struct dwc3 *dwc) > memset(&pdata, 0, sizeof(pdata)); > > pdata.usb3_lpm_capable = dwc->usb3_lpm_capable; > + if (dwc->dr_mode == USB_DR_MODE_OTG) > + pdata.otg_dev = dwc->dev; > > ret = platform_device_add_data(xhci, &pdata, sizeof(pdata)); > if (ret) { > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen

Re: [RFC v4 01/14] regulator: of: Add helper for getting all supplies

2016-06-12 Thread Peter Chen
e-delay, power-sequence-clocks, etc. What if you > need to express ordering relationship of supplies, clocks, gpios? We end > up with a scripting language in DT and we don't want to have that. > Can we do things like below: - DT describes hardware elements (clock, gpios, etc) for power sequence, and we need a node for power sequence. - Power sequence framework handles getting hardware elements. - Power sequence platform driver handles special sequence for devices, and we can create some generic drivers for generic devices. -- Best Regards, Peter Chen

Re: [PATCH v9 08/14] usb: otg: add OTG/dual-role core

2016-06-11 Thread Peter Chen
On Thu, Jun 09, 2016 at 10:24:44AM +0300, Roger Quadros wrote: > On 08/06/16 15:42, Peter Chen wrote: > > On Wed, Jun 08, 2016 at 01:12:10PM +0300, Roger Quadros wrote: > >> Hi, > >> > >> On 08/06/16 12:53, Peter Chen wrote: > >>> On Wed, Jun 0

Re: [PATCH v9 00/14] USB OTG/dual-role framework

2016-06-08 Thread Peter Chen
On Wed, Jun 8, 2016 at 5:03 PM, 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 TI platform related patches will be sent s

Re: [PATCH v9 08/14] usb: otg: add OTG/dual-role core

2016-06-08 Thread Peter Chen
On Wed, Jun 08, 2016 at 01:12:10PM +0300, Roger Quadros wrote: > Hi, > > On 08/06/16 12:53, Peter Chen wrote: > > On Wed, Jun 08, 2016 at 12:03:40PM +0300, Roger Quadros wrote: > >> +int usb_otg_unregister(struct device *dev) > >> +{ > >> + stru

Re: [PATCH v9 08/14] usb: otg: add OTG/dual-role core

2016-06-08 Thread Peter Chen
> +} > + > +static inline int usb_otg_gadget_ready(struct usb_gadget *gadget, bool ready) > +{ > + return -ENOTSUPP; > +} > +#endif /* CONFIG_USB_OTG */ > + > +/*- deprecated interface -*/ > /* Context: can sleep */ > static inline int > otg_start_hnp(struct usb_otg *otg) > @@ -113,6 +264,8 @@ otg_start_srp(struct usb_otg *otg) > return -ENOTSUPP; > } > > +/*---*/ > + > /* for OTG controller drivers (and maybe other stuff) */ > extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); > > @@ -237,4 +390,6 @@ static inline int otg_start_gadget(struct usb_otg *otg, > int on) > return otg->fsm.ops->start_gadget(otg, on); > } > > +int drd_statemachine(struct usb_otg *otg); > + > #endif /* __LINUX_USB_OTG_H */ > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen

Re: [PATCH v8 13/14] usb: gadget: udc: adapt to OTG core

2016-06-08 Thread Peter Chen
On Wed, Jun 08, 2016 at 10:32:19AM +0300, Roger Quadros wrote: > Hi, > > On 24/05/16 05:53, Peter Chen wrote: > > On Mon, May 23, 2016 at 01:36:51PM +0300, Roger Quadros wrote: > >> On 23/05/16 13:34, Jun Li wrote: > >>> Hi > >>> > >>

Re: [PATCH v10 2/7] usb: mux: add generic code for dual role port mux

2016-06-07 Thread Peter Chen
either by the HW or > within the kernel. > > If we're discussing userspace ABI here, there's something very wrong > with OTG/DRD layer design. Currently, there are some use cases which need to switch role on the fly (will be more for type-c in future), a sysfs for role switch is necessary. -- Best Regards, Peter Chen

Re: [PATCH v10 2/7] usb: mux: add generic code for dual role port mux

2016-06-06 Thread Peter Chen
On Mon, Jun 06, 2016 at 11:04:48AM +0800, Lu Baolu wrote: > Hi Peter, > > On 06/06/2016 09:25 AM, Peter Chen wrote: > > On Sun, Jun 05, 2016 at 02:55:56PM +0800, Lu Baolu wrote: > >> Hi Peter, > >> > >> On 06/04/2016 10:28 AM, Peter Chen wrote: > >

Re: [PATCH v10 2/7] usb: mux: add generic code for dual role port mux

2016-06-05 Thread Peter Chen
On Mon, Jun 06, 2016 at 10:45:34AM +0800, Lu Baolu wrote: > Hi Peter, > > On 06/06/2016 10:05 AM, Peter Chen wrote: > > On Sun, Jun 05, 2016 at 04:46:55PM +0800, Lu Baolu wrote: > >> Hi, > >> > >> On 06/05/2016 04:33 PM, Jun Li wrote: > >>>>

Re: [PATCH v3 06/12] power: pwrseq: simple: Add support for regulator and generic property

2016-06-05 Thread Peter Chen
127 > > How do you like that approach? > Rob, I am trying to implement the dts layout you suggested (see below), but I find it is very hard to it due to the device is still not created, without device, it is hard to manage the resources under this device ( Eg, de-initialization for probe deferral case). So, a common driver is suitable for this power sequence case. &usbotg1 { vbus-supply = <®_usb_otg1_vbus>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usb_otg1_id>; status = "okay"; #address-cells = <1>; #size-cells = <0>; hub: genesys@1 { compatible = "usb5e3,608"; reg = <1>; reset-gpios = <&gpio4 5 GPIO_ACTIVE_LOW>; /* hub reset pin */ reset-duration-us = <10>; clocks = <&clks IMX6SX_CLK_CKO>; }; }; -- Best Regards, Peter Chen

Re: [PATCH v10 2/7] usb: mux: add generic code for dual role port mux

2016-06-05 Thread Peter Chen
ed on his OTG core. > > Why do we need an OTG framework to support a device driver? Just like you said above, OTG framework can manage role switch, the role switch may need to start or stop host/gadget driver according to different hardware signals or user input. > Is it something like a bus or class driver? The DRD/OTG framework uses the same device structure with the caller, the caller can be a dual-role controller driver (like dwc3, chipidea, etc), or a separate switch driver which like your mux port driver. -- Best Regards, Peter Chen

Re: [PATCH v10 2/7] usb: mux: add generic code for dual role port mux

2016-06-05 Thread Peter Chen
On Sun, Jun 05, 2016 at 02:55:56PM +0800, Lu Baolu wrote: > Hi Peter, > > On 06/04/2016 10:28 AM, Peter Chen wrote: > > On Sat, Jun 04, 2016 at 12:06:06AM +0800, Lu Baolu wrote: > >>> from my point,it is a dual-role switch > >>> driver too, > >&g

Re: [PATCH v10 2/7] usb: mux: add generic code for dual role port mux

2016-06-03 Thread Peter Chen
On Sat, Jun 04, 2016 at 12:06:06AM +0800, Lu Baolu wrote: > Hi Peter, > > On 06/03/2016 03:41 PM, Peter Chen wrote: > > On Thu, Jun 02, 2016 at 09:37:24AM +0800, Lu Baolu wrote: > >> > Several Intel platforms implement USB dual role by having completely > >> &g

Re: [PATCH v10 2/7] usb: mux: add generic code for dual role port mux

2016-06-03 Thread Peter Chen
On Fri, Jun 03, 2016 at 11:16:32AM +0300, Heikki Krogerus wrote: > On Fri, Jun 03, 2016 at 03:41:13PM +0800, Peter Chen wrote: > > On Thu, Jun 02, 2016 at 09:37:24AM +0800, Lu Baolu wrote: > > > Several Intel platforms implement USB dual role by having completely > > >

Re: [PATCH v10 2/7] usb: mux: add generic code for dual role port mux

2016-06-03 Thread Peter Chen
ux_desc { > + const char *name; > + struct device *dev; > + const struct portmux_ops *ops; > +}; > + > +/** > + * enum portmux_role - role of the port > + */ > +enum portmux_role { > + PORTMUX_UNKNOWN, > + PORTMUX_HOST, > + PORTMUX_DEVICE, > +}; > + > +/** > + * struct portmux_dev - A mux device > + * > + * @desc: the descriptor of the mux > + * @dev: device of this mux > + * @mux_mutex: lock to serialize port switch operation > + * @mux_state: state of the mux > + */ > +struct portmux_dev { > + const struct portmux_desc *desc; > + struct device dev; > + > + /* lock for mux_state */ > + struct mutex mux_mutex; > + enum portmux_role mux_state; > +}; > + > +/* > + * Functions for mux driver > + */ > +struct portmux_dev *portmux_register(struct portmux_desc *desc); > +void portmux_unregister(struct portmux_dev *pdev); > +#ifdef CONFIG_PM_SLEEP > +void portmux_complete(struct portmux_dev *pdev); > +#endif > + > +/* > + * Functions for mux consumer > + */ > +#if defined(CONFIG_USB_PORTMUX) > +int portmux_switch(struct portmux_dev *pdev, enum portmux_role role); > +#else > +static inline int portmux_switch(struct portmux_dev *pdev, > + enum portmux_role role) > +{ > + return 0; > +} > +#endif > + > +#endif /* __LINUX_USB_PORTMUX_H */ > -- > 2.1.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen

Re: [PATCH v3 12/12] ARM: dts: exynos: Fix LAN and HUB after bootloader initialization on Odroid U3

2016-06-02 Thread Peter Chen
On Thu, Jun 02, 2016 at 09:26:57AM +0200, Krzysztof Kozlowski wrote: > On 06/01/2016 01:59 PM, Peter Chen wrote: > > On Wed, Jun 01, 2016 at 10:02:21AM +0200, Krzysztof Kozlowski wrote: > >> On Odroid U3 (Exynos4412-based) board if USB was initialized by > >> bootl

Re: [PATCH v3 09/12] EXAMPLE CODE: usb: port: Parse pwrseq phandle from Device Tree

2016-06-01 Thread Peter Chen
On Wed, Jun 01, 2016 at 11:16:34AM -0700, Stephen Boyd wrote: > Quoting Peter Chen (2016-06-01 05:05:20) > > On Wed, Jun 01, 2016 at 01:57:23AM -0700, Stephen Boyd wrote: > > > Quoting Krzysztof Kozlowski (2016-06-01 01:02:18) > > > > Parse usb-pwrseq property from

Re: [PATCH v3 09/12] EXAMPLE CODE: usb: port: Parse pwrseq phandle from Device Tree

2016-06-01 Thread Peter Chen
eset to it, but it seems this is more about > doing some sort of power on sequence after enumeration? > No, you may need to do reset before enumeration, the general purpose of reset is eliminate unstable hardware state, and let the controller find the device. Try to do it at bootloader to see if it works for you. -- Best Regards, Peter Chen

Re: [PATCH v3 12/12] ARM: dts: exynos: Fix LAN and HUB after bootloader initialization on Odroid U3

2016-06-01 Thread Peter Chen
mp;pinctrl_usb_otg1_id>; status = "okay"; #address-cells = <1>; #size-cells = <0>; hub: genesys@1 { compatible = "usb5e3,608"; reg = <1>; reset-gpios = <&gpio4 5 GPIO_ACTIVE_LOW>; /* hub reset pin */ reset-duration-us = <10>; clocks = <&clks IMX6SX_CLK_CKO>; }; }; }; -- Best Regards, Peter Chen

Re: [PATCH v8 13/14] usb: gadget: udc: adapt to OTG core

2016-06-01 Thread Peter Chen
tern int usb_otg_add_gadget_udc(struct device *parent, > + struct usb_gadget *gadget, > + struct device *otg_dev); > + > /*-*/ > > /* utility to simplify dealing with string descriptors */ > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen

Re: [RFC v2 00/13] usb/mmc/power: Fix USB/LAN when TFTP booting

2016-05-30 Thread Peter Chen
On Sat, May 28, 2016 at 11:36:13AM +0800, Peter Chen wrote: > On Tue, May 10, 2016 at 01:02:08PM +0200, Ulf Hansson wrote: > > + Arnd > > > > [...] > > > > >> >> Solution > > >> >> > > >> >> This is very s

Re: [PATCH v8 00/14] USB OTG/dual-role framework

2016-05-30 Thread Peter Chen
| 155 +-- > drivers/usb/phy/phy-fsl-usb.h |3 +- > include/linux/usb/gadget.h| 22 + > 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 + > 26 files changed, 2013 insertions(+), 438 deletions(-) > create mode 100644 drivers/usb/common/usb-otg.c > > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen

Re: [RFC v2 00/13] usb/mmc/power: Fix USB/LAN when TFTP booting

2016-05-27 Thread Peter Chen
le to managed them both from a common pwrseq > driver framework. > > Although, I do remember from an older conversations around some of > mine submission for the mmc pwrseq code, that some people (maybe > Arnd?) wasn't keen on adding a new framework for this. Perhaps that > has changed? > All, how we move on for this? 1. Using a generic driver to manage both mmc and USB (and further subsystem), USB and further subsystem do not use pwrseq node in dts. 2. USB creates the similar driver under drivers/usb for its own use. Which one do you prefer, thanks. -- Best Regards, Peter Chen

Re: [PATCH] usb: select NOP_USB_XCEIV by drivers that require it

2016-05-26 Thread Peter Chen
rivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig > index c690474..a0bdfd3 100644 > --- a/drivers/usb/phy/Kconfig > +++ b/drivers/usb/phy/Kconfig > @@ -57,6 +57,8 @@ config NOP_USB_XCEIV > built-in with usb ip or which are autonomous and doesn't require any > phy programming such as ISP1x04 etc. > > + Should be automatically selected by the relevant driver. > + > config AM335X_CONTROL_USB > tristate > > -- > 2.8.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen

Re: [RFC 4/5] ARM: tegra: Enable UDC on Dalmore

2016-05-26 Thread Peter Chen
phy@7d00 { > + status = "okay"; > + dr_mode = "otg"; > + }; > + It is a USB PHY node, you don't need to set dr_mode for it. -- Best Regards, Peter Chen

Re: [RFC 0/5] usb: chipidea: Add support for Tegra20 through Tegra124

2016-05-26 Thread Peter Chen
as an example: Using ID pin which is at Micro-B receptacle on the board to determine host (ID = 0) or device (ID = 1 )mode. - ID pin connects to CPU, and ID interrupt and value can be get through register OTGSC. - ID pin does not connect to CPU, and there is a dedicated GPIO for ID. -- Best Regards, Peter Chen

Re: [PATCH v8 08/14] usb: otg: add OTG/dual-role core

2016-05-24 Thread Peter Chen
d I am wonder if we can implement defer probe for gadget/udc/host driver if otg driver is not probed, in that case, some designs can be simpler like wait list in otg driver. > mutex_unlock(&udc_lock); > usb_otg_register_gadget(udc->gadget, &otg_gadget_intf); > mutex_lock(&udc_lock); > } else { > ret = usb_gadget_udc_start(udc); > if (ret) { > driver->unbind(udc->gadget); > goto err1; > } > usb_udc_connect_control(udc); > } > .. > } > > What do you say? > > regards, > -roger > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen

Re: [PATCH v8 13/14] usb: gadget: udc: adapt to OTG core

2016-05-23 Thread Peter Chen
On Mon, May 23, 2016 at 01:36:51PM +0300, Roger Quadros wrote: > On 23/05/16 13:34, Jun Li wrote: > > Hi > > > >> -Original Message- > >> From: Roger Quadros [mailto:rog...@ti.com] > >> Sent: Monday, May 23, 2016 6:12 PM > >> To: Peter C

Re: [PATCH v8 13/14] usb: gadget: udc: adapt to OTG core

2016-05-22 Thread Peter Chen
On Sat, May 21, 2016 at 10:29:40AM +0800, Peter Chen wrote: > On Thu, May 19, 2016 at 10:32:44AM +0300, Roger Quadros wrote: > > On 18/05/16 17:46, Jun Li wrote: > > > > > > > > >>>> > > >>>> I didn't want to have complex Kconfi

Re: [PATCH v8 13/14] usb: gadget: udc: adapt to OTG core

2016-05-20 Thread Peter Chen
On Fri, May 20, 2016 at 10:26:03AM +0300, Roger Quadros wrote: > Peter, > > On 20/05/16 04:39, Peter Chen wrote: > > On Wed, May 18, 2016 at 03:45:11PM +0300, Roger Quadros wrote: > >> On 18/05/16 06:18, Peter Chen wrote: > >>> On Mon, May 16, 2016 at 1

Re: [PATCH v8 13/14] usb: gadget: udc: adapt to OTG core

2016-05-20 Thread Peter Chen
x27;y' for proper build. > How about this: Moving usb_otg_register/unregister_hcd to host driver to remove dependency hcd->otg. And moving usb_otg_get_data to common.c. Delete the wait queue at usb-otg.c, and if calling usb_otg_get_data returns NULL, the host/device driver's probe return -EPROBE_DEFER. When the otg driver is probed successfully, the host/device will be re-probed again, and usb_otg_register_hcd will be called again. And let OTG depends on HCD && GADGET, and delete otg_hcd_ops and otg_gadget_ops. Below build dependency issues can be fixed. What do you think? > 1) hcd 'y', gadget 'y' > otg has to be 'y' for proper build. > > 2) hcd 'm', gadget 'm' > otg has to be 'm' for proper build. > > 3) hcd 'y', gadget 'm' > Build will fail always. > If otg is 'y', otg build will fail due to dependency on gadget. > If otg is 'm', hcd build will fail due to dependency on otg. > > 4) hcd 'm', gadget 'y' > Build will fail always. > If otg is 'y', otg build will fail due to dependency on hcd. > If otg is 'm', gadget build will fails due to dependency on otg. -- Best Regards, Peter Chen

Re: [PATCH v8 08/14] usb: otg: add OTG/dual-role core

2016-05-20 Thread Peter Chen
On Fri, May 20, 2016 at 12:19:07PM +0300, Roger Quadros wrote: > On 20/05/16 11:31, Roger Quadros wrote: > > On 18/05/16 15:59, Roger Quadros wrote: > >> Hi Peter, > >> > >> On 18/05/16 10:45, Peter Chen wrote: > >>> > >>> > >

Re: [PATCH v8 13/14] usb: gadget: udc: adapt to OTG core

2016-05-19 Thread Peter Chen
On Wed, May 18, 2016 at 03:45:11PM +0300, Roger Quadros wrote: > On 18/05/16 06:18, Peter Chen wrote: > > On Mon, May 16, 2016 at 12:51:53PM +0300, Roger Quadros wrote: > >> On 16/05/16 12:23, Peter Chen wrote: > >>> On Mon, May 16, 2016 at 11:26:57AM +0300,

Re: [PATCH v8 13/14] usb: gadget: udc: adapt to OTG core

2016-05-17 Thread Peter Chen
On Mon, May 16, 2016 at 12:51:53PM +0300, Roger Quadros wrote: > On 16/05/16 12:23, Peter Chen wrote: > > On Mon, May 16, 2016 at 11:26:57AM +0300, Roger Quadros wrote: > >> Hi, > >> > >> On 16/05/16 10:02, Peter Chen wrote: > >>> On Fri, May 1

Re: [PATCH v8 13/14] usb: gadget: udc: adapt to OTG core

2016-05-16 Thread Peter Chen
On Mon, May 16, 2016 at 11:26:57AM +0300, Roger Quadros wrote: > Hi, > > On 16/05/16 10:02, Peter Chen wrote: > > On Fri, May 13, 2016 at 01:03:27PM +0300, Roger Quadros wrote: > >> + > >> +static int usb_gadget_connect_control(struct usb_gadget *gadget, bool >

Re: [PATCH v7 10/14] usb: otg: add hcd companion support

2016-05-16 Thread Peter Chen
On Mon, May 16, 2016 at 11:01:27AM +0300, Roger Quadros wrote: > On 16/05/16 05:13, Peter Chen wrote: > > On Thu, May 12, 2016 at 03:13:48PM +0300, Roger Quadros wrote: > >> Hi, > >> > >> On 12/05/16 13:31, Yoshihiro Shimoda wrote: > >>> Hi, > &

Re: [PATCH v8 13/14] usb: gadget: udc: adapt to OTG core

2016-05-16 Thread Peter Chen
not supported in OTG mode\n"); > + return -EOPNOTSUPP; > + } > + The soft-connect can be supported at dual-role mode currently, we can use b_bus_req entry once it is implemented later. > if (sysfs_streq(buf, "connect")) { > usb_gadget_udc_start(udc); > - usb_gadget_connect(udc->gadget); > + usb_udc_connect_control(udc); This line seems to be not related with this patch. -- Best Regards, Peter Chen

Re: [PATCH v7 10/14] usb: otg: add hcd companion support

2016-05-15 Thread Peter Chen
s. > > > > R-Car Gen2 SoCs (r8a779[0134] / arm32) has USB 2.0 host controllers via PCI > > bus and > > one high speed function controller via AXI bus. > > One of channel can be used as host or function. > > > >> For DT case we could have a DT binding to tie the EHCI and companion and > >> use that > >> in the OTG framework. > > After looking at the code it seems we don't need this special binding as we > are already > linking the EHCI controller and companion controller to the single otg > controller instance > using the otg-controller property. > Then, how you know this EHCI + companion controller special case during otg adds hcd, it needs special handling, right? Peter > So all is good as of now. > > For non DT case, it is the responsibility of platform support code to ensure > that > it calls usb_otg_add_hcd() with the correct otg controller instance for both > EHCI and > companion controller and things should work fine there as well. > > -- > cheers, > -roger > > > > > R-Car Gen3 SoC (r8a7795 / arm64) will be this type. > > (Both USB 2.0 host/function controllers connect to AXI bus.) > > > >> Any objections? > > > > I don't have any objections because I'm just focus on R-Car Gen3 SoC for > > now. > > If someone needs for PCI case, I think it is possible to add such a code > > somehow later. > > > > Best regards, > > Yoshihiro Shimoda > > > >> cheers, > >> -roger > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen

Re: [PATCH v7 05/14] usb: otg-fsm: move host controller operations into usb_otg->hcd_ops

2016-05-12 Thread Peter Chen
On Wed, May 11, 2016 at 03:32:30PM +0300, Roger Quadros wrote: > Peter, > > On 11/05/16 14:02, Roger Quadros wrote: > > On 11/05/16 09:10, Peter Chen wrote: > >> On Mon, May 02, 2016 at 03:18:48PM +0300, Roger Quadros wrote: > >>> This is to prevent

Re: [PATCH v7 14/14] usb: host: xhci-plat: Add otg device to platform data

2016-05-11 Thread Peter Chen
sb/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 { > unsignedusb3_lpm_capable:1; > + struct device *otg_dev; > }; > > #endif /* __USB_CORE_XHCI_PDRIVER_H */ > -- > 2.7.4 > Reviewed-by: Peter Chen -- Best Regards, Peter Chen

Re: [PATCH v7 12/14] usb: hcd: Adapt to OTG core

2016-05-11 Thread Peter Chen
NULL > then the device tree node's otg-controller property is used to > get the otg_dev device. > > Signed-off-by: Roger Quadros Acked-by: Peter Chen > --- > drivers/usb/core/hcd.c | 55 > + > include/linux/usb/hcd.h

Re: [PATCH v7 11/14] usb: otg: use dev_dbg() instead of VDBG()

2016-05-11 Thread Peter Chen
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 m

Re: [PATCH v7 10/14] usb: otg: add hcd companion support

2016-05-11 Thread Peter Chen
iro Shimoda > Signed-off-by: Roger Quadros Acked-by: Peter Chen > --- > Documentation/devicetree/bindings/usb/generic.txt | 3 +++ > drivers/usb/common/usb-otg.c | 32 > --- > include/linux/usb/otg.h | 7

Re: [PATCH v7 09/14] usb: of: add an API to get OTG device from USB controller node

2016-05-11 Thread Peter Chen
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 > 'otg-controller' property in the USB controller's device node. > > of_usb_get_otg()

Re: [PATCH v7 00/14] USB OTG/dual-role framework

2016-05-11 Thread Peter Chen
+-- > 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 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen

Re: [PATCH v7 08/14] usb: otg: add OTG/dual-role core

2016-05-11 Thread Peter Chen
t; +#define TB_SESS_VLD (1000) Seems you agree to remove above definitions. > > /* Current usb protocol used: 0:undefine; 1:host; 2:client */ > diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h > index 85b8fb5..b094352 100644 > --- a/include/linux/usb/otg.h > +++ b/include/linux/usb/otg.h > @@ -10,10 +10,55 @@ > #define __LINUX_USB_OTG_H > > #include > -#include > -#include > +#include > +#include > +#include Above two headers are not needed -- Best Regards, Peter Chen

Re: [PATCH v7 07/14] usb: otg: get rid of CONFIG_USB_OTG_FSM in favour of CONFIG_USB_OTG

2016-05-11 Thread Peter Chen
: Roger Quadros Acked-by: Peter Chen > --- > 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/ch

Re: [PATCH v7 02/14] usb: otg-fsm: Prevent build warning "VDBG" redefined

2016-05-11 Thread Peter Chen
include/linux/usb/composite.h:615:1: warning: this is the location >of the previous definition > > Signed-off-by: Roger Quadros Acked-by: Peter Chen > --- > drivers/usb/common/usb-otg-fsm.c | 7 +++ > drivers/usb/phy/phy-fsl-usb.c| 7 +++ > include/linux

Re: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface

2016-05-10 Thread Peter Chen
On Tue, May 10, 2016 at 12:20:28PM +0300, Roger Quadros wrote: > On 10/05/16 11:03, Jun Li wrote: > > Hi > > > >> -Original Message- > >> From: Roger Quadros [mailto:rog...@ti.com] > >> Sent: Tuesday, May 10, 2016 3:35 PM > >> To

Re: [PATCH v7 05/14] usb: otg-fsm: move host controller operations into usb_otg->hcd_ops

2016-05-10 Thread Peter Chen
On Mon, May 02, 2016 at 03:18:48PM +0300, Roger Quadros wrote: > This is to prevent missing symbol build error if OTG is > enabled (built-in) and HCD core (CONFIG_USB) is module. > > Signed-off-by: Roger Quadros > Acked-by: Peter Chen > --- > drivers/usb/chip

Re: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface

2016-05-09 Thread Peter Chen
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. > &g

Re: [PATCH v7 03/14] usb: hcd.h: Add OTG to HCD interface

2016-05-06 Thread Peter Chen
in the built-in symbol table if > CONFIG_USB is m. > > Signed-off-by: Roger Quadros > Acked-by: Peter Chen 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

Re: [PATCH v7 01/14] usb: hcd: Initialize hcd->flags to 0

2016-05-06 Thread Peter Chen
5] [] usb_hcd_irq [usbcore] > [ 91.759260] Disabling IRQ #254 > > Signed-off-by: Roger Quadros > --- > drivers/usb/core/hcd.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c > index 2ca2cef..9484539 100644 > --- a/drivers/usb/core/hcd.c > +++ b/drivers/usb/core/hcd.c > @@ -3009,6 +3009,7 @@ void usb_remove_hcd(struct usb_hcd *hcd) > } > > usb_put_invalidate_rhdev(hcd); > + hcd->flags = 0; > } > EXPORT_SYMBOL_GPL(usb_remove_hcd); Reviewed-by: Peter Chen -- Best Regards, Peter Chen

Re: [PATCH v7 11/14] usb: otg: use dev_dbg() instead of VDBG()

2016-05-06 Thread Peter Chen
gt;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

Re: [PATCH] usb: dwc3: usb/dwc3: fake dissconnect event when turn off pullup

2016-05-06 Thread Peter Chen
On Fri, May 06, 2016 at 10:01:20AM +0300, Felipe Balbi wrote: > > Hi, > > Peter Chen writes: > >> "Du, Changbin" writes: > >> > Hi, Balbi, > >> > > >> > The step to reproduce this issue is: > >> > 1) connect devi

Re: [RFC v2 00/13] usb/mmc/power: Fix USB/LAN when TFTP booting

2016-05-06 Thread Peter Chen
On Fri, May 06, 2016 at 08:12:24AM +0200, Krzysztof Kozlowski wrote: > On 05/06/2016 07:44 AM, Peter Chen wrote: > > On Thu, May 05, 2016 at 05:42:40PM -0500, Rob Herring wrote: > >> On Thu, May 05, 2016 at 02:34:13PM +0200, Krzysztof Kozlowski wrote: > >>> Hi, &

Re: [RFC v2 00/13] usb/mmc/power: Fix USB/LAN when TFTP booting

2016-05-05 Thread Peter Chen
andled by USB driver. > > 2. Extend the pwrseq-simple with regulator toggling, > > 3. Add support to USB hub and port core for pwrseq, > > We discussed this for USB already[1] and is why we defined how to add > USB child devices. The idea is not to add pwrseq to that. > > Rob > > [1] http://www.spinics.net/lists/linux-usb/msg134082.html [1] http://www.spinics.net/lists/linux-usb/msg137312.html -- Best Regards, Peter Chen

Re: [PATCH] usb: dwc3: usb/dwc3: fake dissconnect event when turn off pullup

2016-05-05 Thread Peter Chen
connect explicitly. Another thing is the gadget driver should not call usb_gadget_disconnect directly, it should call usb_gadget_deactivate or usb_function_deactivate. Since currently, calling usb_gadget_disconnect may not do real pull down dp, Felipe, will you consider adding gadget_driver->disconnect into usb_gadget_disconnect after pull down dp? -- Best Regards, Peter Chen

Re: [PATCH v6 09/12] usb: gadget: udc: adapt to OTG core

2016-05-04 Thread Peter Chen
On Wed, May 04, 2016 at 11:40:56AM +0300, Roger Quadros wrote: > On 04/05/16 11:03, Jun Li wrote: > > Hi > > > >> -Original Message- > >> From: Roger Quadros [mailto:rog...@ti.com] > >> Sent: Wednesday, May 04, 2016 2:37 PM > >> To: Pete

Re: [PATCH v6 09/12] usb: gadget: udc: adapt to OTG core

2016-05-04 Thread Peter Chen
On Wed, May 04, 2016 at 09:37:29AM +0300, Roger Quadros wrote: > Peter, > > On 04/05/16 06:35, Peter Chen wrote: > > On Tue, May 03, 2016 at 06:44:46PM +0300, Roger Quadros wrote: > >> Hi, > >> > >>

Re: [PATCH v6 09/12] usb: gadget: udc: adapt to OTG core

2016-05-03 Thread Peter Chen
n't > > see the benefit if get rid of it. > > OK, no issues if we don't get rid of it. But I am still in favor of > doing a connect in usb_gadget_start(), because > > 1) If we split connect/disconnect() and usb_gadget_start/stop() then there is > additional overhead of keeping track whether connect was called or not during > usb_gadget_stop(). Plus we need to take care that users don't call > connect/disconnect > outside of start/stop. It is just complicating things. > > 2) for many controllers there is no difference between run/stop and > connect/disconnect. i.e. a single register bit controls both. > > 3) it fits well with the OTG specification. OTG specification says > that loc_conn *variable* must be true *after* the device has signalled a > connect. > So OTG state machine can safely set loc_conn variable to true after doing > otg_set_protocol(fsm, PROTO_GADGET); and set it to false otherwise. > > Note, OTG specification does not say to take any action based on loc_conn. > It is just a connect indicator variable. So we might have to fix this in the > OTG state machine. > > My suggestion is to keep it simple for now. Try the OTG implementation, > and later if we find issues then extend it as required. > Just talked with Jun, he is worried if loc_conn != pullup_dp at some situations. So, how about only calling start gadget at usb_start_gadget, and pullup_dp at drd_set_state (see below). static void drd_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) { struct usb_otg *otg = container_of(fsm, struct usb_otg, fsm); if (otg->state == new_state) return; fsm->state_changed = 1; dev_dbg(otg->dev, "otg: set state: %s\n", usb_otg_state_string(new_state)); switch (new_state) { case OTG_STATE_B_IDLE: + usb_udc_vbus_handler(gadget, false); drd_set_protocol(fsm, PROTO_UNDEF); otg_drv_vbus(otg, 0); break; case OTG_STATE_B_PERIPHERAL: drd_set_protocol(fsm, PROTO_GADGET); + usb_udc_vbus_handler(gadget, true); otg_drv_vbus(otg, 0); break; .. }; } When the OTG FSM is added to this framework, it can keep usb_fsm->ops->loc_conn, and using the current FSM. -- Best Regards, Peter Chen

Re: [PATCH v6 09/12] usb: gadget: udc: adapt to OTG core

2016-05-03 Thread Peter Chen
; > > >> > >> loc_conn is just an internal state variable and it corresponds to our > >> gadget_start/stop() state. > > > > It's not an internal variable, there are OTG state machine > > parameters tables(table 7-x) in OTG spec which have clear lists > > which are "internal variable", which are "input", which are "output"... > > > > Those APIs are driven directly from OTG spec, easily understood so > > code reader can know what's those APIs for. For real OTG, I don't > > see the benefit if get rid of it. > > OK, no issues if we don't get rid of it. But I am still in favor of > doing a connect in usb_gadget_start(), because > > 1) If we split connect/disconnect() and usb_gadget_start/stop() then there is > additional overhead of keeping track whether connect was called or not during > usb_gadget_stop(). Plus we need to take care that users don't call > connect/disconnect > outside of start/stop. It is just complicating things. > > 2) for many controllers there is no difference between run/stop and > connect/disconnect. i.e. a single register bit controls both. > > 3) it fits well with the OTG specification. OTG specification says > that loc_conn *variable* must be true *after* the device has signalled a > connect. > So OTG state machine can safely set loc_conn variable to true after doing > otg_set_protocol(fsm, PROTO_GADGET); and set it to false otherwise. > > Note, OTG specification does not say to take any action based on loc_conn. > It is just a connect indicator variable. So we might have to fix this in the > OTG state machine. > > My suggestion is to keep it simple for now. Try the OTG implementation, > and later if we find issues then extend it as required. > I agree with you, roger. loc_conn action is only needed for peripheral, we can't do real !loc_conn at host mode. Besides, loc_conn is the output, we need to set/clear it after state has changed, and current gadget framework already takes well for connection and disconnection state, so it is better to delete loc_conn action at otg_fsm->ops, and only keeps it as indicator for OTG FSM reference. -- Best Regards, Peter Chen

Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core

2016-04-27 Thread Peter Chen
On Wed, Apr 27, 2016 at 01:59:44PM +0300, Roger Quadros wrote: > Hi, > > On 27/04/16 06:15, Peter Chen wrote: > > On Tue, Apr 26, 2016 at 04:21:07PM +0800, Peter Chen wrote: > >> On Tue, Apr 26, 2016 at 07:00:22AM +, Jun Li wrote: > >>> Hi > >>&g

Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core

2016-04-26 Thread Peter Chen
On Tue, Apr 26, 2016 at 04:21:07PM +0800, Peter Chen wrote: > On Tue, Apr 26, 2016 at 07:00:22AM +, Jun Li wrote: > > Hi > > > > > -Original Message- > > > From: Peter Chen [mailto:hzpeterc...@gmail.com] > > > Sent: Tuesday, April 26, 2016

Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core

2016-04-26 Thread Peter Chen
On Tue, Apr 26, 2016 at 07:00:22AM +, Jun Li wrote: > Hi > > > -Original Message- > > From: Peter Chen [mailto:hzpeterc...@gmail.com] > > Sent: Tuesday, April 26, 2016 2:28 PM > > To: Jun Li > > Cc: Roger Quadros ; st...@rowland.ha

Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core

2016-04-25 Thread Peter Chen
On Tue, Apr 26, 2016 at 05:11:36AM +, Jun Li wrote: > Hi > > > -Original Message- > > From: Peter Chen [mailto:hzpeterc...@gmail.com] > > Sent: Tuesday, April 26, 2016 11:47 AM > > To: Jun Li > > Cc: Roger Quadros ; st...@rowland.ha

Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core

2016-04-25 Thread Peter Chen
+ /* were we in wait list? */ > > + mutex_lock(&wait_list_mutex); > > + wait = usb_otg_get_wait(dev); > > + mutex_unlock(&wait_list_mutex); > > + if (wait) { > > + /* register pending host/gadget and flush from list */ > > + usb_otg_flush_wait(dev); > > + } > > + > > + return otg; > > + > > +err_wq: > > + kfree(otg); > > +unlock: > > + mutex_unlock(&otg_list_mutex); > > + return ERR_PTR(ret); > > +} > > +EXPORT_SYMBOL_GPL(usb_otg_register); > > + > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen

Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core

2016-04-21 Thread Peter Chen
On Wed, Apr 20, 2016 at 10:03:34AM +0300, Roger Quadros wrote: > On 20/04/16 08:08, Yoshihiro Shimoda wrote: > > Hi, > > > >> From: Peter Chen > >> Sent: Tuesday, April 19, 2016 6:18 PM > >> > >> On Fri, Apr 15, 2016 at 10:03:16AM +, Y

Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core

2016-04-21 Thread Peter Chen
On Fri, Apr 22, 2016 at 09:26:46AM +0800, Peter Chen wrote: > On Fri, Apr 15, 2016 at 10:03:16AM +, Yoshihiro Shimoda wrote: > > Hi, > > > > > From: Yoshihiro Shimoda > > > Sent: Friday, April 15, 2016 6:59 PM > > > > > > Hi, > > >

Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core

2016-04-21 Thread Peter Chen
_FLAG_HCD_NEEDS_COMPANION (1 << 2) > /* use otg->fsm.lock for serializing access */ > > /*- deprecated interface -*/ > @@ -125,11 +127,14 @@ struct usb_otg_caps { > * @caps: otg capabilities of the controller > * @ops: otg fsm operations > * @otg_work: optional custom otg state machine work function > + * @hcd_needs_companion: Indicates if host controller needs a companion > + *controller > */ > struct usb_otg_config { > struct usb_otg_caps *otg_caps; > struct otg_fsm_ops *fsm_ops; > void (*otg_work)(struct work_struct *work); > + bool hcd_needs_companion; > }; > > extern const char *usb_otg_state_string(enum usb_otg_state state); > -- Hi Yoshihiro, the shared_hcd is used for USB3 only [1], this patch may not be suitable for supporting companion controller at OTG framework. For companion or other USB2 controllers, both primary hcd and shard hcd are NULL for HCD core. [1] http://www.spinics.net/lists/linux-usb/msg139630.html -- Best Regards, Peter Chen

Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core

2016-04-21 Thread Peter Chen
ate > + * > + * @default_a: Indicates we are an A device. i.e. Host. > + *

Re: [PATCH v6 01/12] usb: hcd: Initialize hcd->flags to 0

2016-04-20 Thread Peter Chen
On Wed, Apr 20, 2016 at 11:15:30AM +0300, Roger Quadros wrote: > On 19/04/16 04:56, Peter Chen wrote: > > On Mon, Apr 18, 2016 at 10:11:29AM -0400, Alan Stern wrote: > >> On Mon, 18 Apr 2016, Peter Chen wrote: > >> > >>> On Wed, Apr 06, 2016 at 09:32:22AM +

Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core

2016-04-20 Thread Peter Chen
On Wed, Apr 20, 2016 at 10:02:33AM +0300, Roger Quadros wrote: > On 19/04/16 11:06, Peter Chen wrote: > > On Tue, Apr 05, 2016 at 05:05:12PM +0300, Roger Quadros wrote: > >> +/** > >> + * usb_otg_start_host - start/stop the host controller > >> + *

Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core

2016-04-20 Thread Peter Chen
On Wed, Apr 20, 2016 at 09:54:49AM +0300, Roger Quadros wrote: > On 18/04/16 05:09, Peter Chen wrote: > > On Fri, Apr 15, 2016 at 02:00:46PM +0300, Roger Quadros wrote: > >> On 15/04/16 12:25, Peter Chen wrote: > >>> On Tue, Apr 05, 2016 at 05:05:1

Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core

2016-04-19 Thread Peter Chen
flags; > #define OTG_FLAG_GADGET_RUNNING (1 << 0) > #define OTG_FLAG_HOST_RUNNING (1 << 1) > +#define OTG_FLAG_HCD_NEEDS_COMPANION (1 << 2) > /* use otg->fsm.lock for serializing access */ > > /*- deprecated interface -*/ > @@ -125,11 +127,14 @@ struct usb_otg_caps { > * @caps: otg capabilities of the controller > * @ops: otg fsm operations > * @otg_work: optional custom otg state machine work function > + * @hcd_needs_companion: Indicates if host controller needs a companion > + *controller > */ > struct usb_otg_config { > struct usb_otg_caps *otg_caps; > struct otg_fsm_ops *fsm_ops; > void (*otg_work)(struct work_struct *work); > + bool hcd_needs_companion; > }; > > extern const char *usb_otg_state_string(enum usb_otg_state state); > -- > 1.9.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen

Re: [PATCH v7 3/3] usb: otg-fsm: Prevent build warning "VDBG" redefined

2016-04-19 Thread Peter Chen
On Wed, Apr 06, 2016 at 10:13:52AM +0300, Roger Quadros wrote: > On 06/04/16 09:46, Peter Chen wrote: > > On Tue, Apr 05, 2016 at 04:48:19PM +0300, Roger Quadros wrote: > >> Peter, > >> > >> On 05/04/16 15:52, Roger Quadros wrote: > >>> Peter,

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

2016-04-19 Thread Peter Chen
On Mon, Apr 18, 2016 at 02:29:37PM +0800, Peter Chen wrote: > On Tue, Apr 05, 2016 at 05:05:13PM +0300, Roger Quadros wrote: > > Introduce usb_otg_add/remove_hcd() for use by host > > controllers that are part of OTG/dual-role port. > > > > Non Device tree platforms c

Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core

2016-04-19 Thread Peter Chen
ly for DRD, these FSM stuffs aren't needed. Besides, there is already an otg-fsm.h at include/linux/usb/, and there are both otg and otg-fsm source and headers, we may let these timing thing belong to otg-fsm. > +#endif /* __DRIVERS_USB_COMMON_USB_OTG_H */ > diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig > index ae228d0..b468a9f 100644 > --- a/drivers/usb/core/Kconfig > +++ b/drivers/usb/core/Kconfig > @@ -42,7 +42,7 @@ config USB_DYNAMIC_MINORS > If you are unsure about this, say N here. > > config USB_OTG > - bool "OTG support" > + bool "OTG/Dual-role support" > depends on PM > default n > help > diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h > index 8c0ae64..1878ae1 100644 > --- a/include/linux/usb/gadget.h > +++ b/include/linux/usb/gadget.h > @@ -583,6 +583,7 @@ struct usb_gadget_ops { > * @out_epnum: last used out ep number > * @in_epnum: last used in ep number > * @otg_caps: OTG capabilities of this gadget. > + * @otg_dev: OTG controller device, if needs to be used with OTG core. > * @sg_supported: true if we can handle scatter-gather > * @is_otg: True if the USB device port uses a Mini-AB jack, so that the > * gadget driver must provide a USB OTG descriptor. > @@ -639,6 +640,7 @@ struct usb_gadget { > unsignedout_epnum; > unsignedin_epnum; > struct usb_otg_caps *otg_caps; > + struct device *otg_dev; > > unsignedsg_supported:1; > unsignedis_otg:1; > diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h > index 861ccaa..2017cd4 100644 > --- a/include/linux/usb/hcd.h > +++ b/include/linux/usb/hcd.h > @@ -184,6 +184,7 @@ struct usb_hcd { > struct mutex*bandwidth_mutex; > struct usb_hcd *shared_hcd; > struct usb_hcd *primary_hcd; > + struct device *otg_dev; /* OTG controller device */ > > > #define HCD_BUFFER_POOLS 4 > diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h > index 36f0cf9..ba6755c 100644 > --- a/include/linux/usb/otg-fsm.h > +++ b/include/linux/usb/otg-fsm.h > @@ -61,6 +61,11 @@ enum otg_fsm_timer { > /** > * struct otg_fsm - OTG state machine according to the OTG spec > * > + * DRD mode hardware Inputs > + * > + * @id: TRUE for B-device, FALSE for A-device. > + * @b_sess_vld: VBUS voltage in regulation. > + * > * OTG hardware Inputs > * > * Common inputs for A and B device > @@ -133,6 +138,7 @@ enum otg_fsm_timer { > * a_clr_err:Asserted (by application ?) to clear a_vbus_err due to > an > * overcurrent condition and causes the A-device to transition > * to a_wait_vfall > + * running: state machine running/stopped indicator > */ > struct otg_fsm { > /* Input */ > @@ -188,6 +194,7 @@ struct otg_fsm { > int b_ase0_brst_tmout; > int a_bidl_adis_tmout; > > + bool running; > struct otg_fsm_ops *ops; > > /* Current usb protocol used: 0:undefine; 1:host; 2:client */ > diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h > index 85b8fb5..b094352 100644 > --- a/include/linux/usb/otg.h > +++ b/include/linux/usb/otg.h > @@ -10,10 +10,55 @@ > #define __LINUX_USB_OTG_H > > #include > -#include > -#include > +#include > +#include > +#include Does above two headers are really needed? > +#include > #include > +#include > +#include > +#include Does above header is really needed? > > +/** > + * struct otg_hcd - host controller state and interface > + * > + * @hcd: host controller > + * @irqnum: irq number > + * @irqflags: irq flags > + * @ops: otg to host controller interface > + * @ops: otg to host controller interface Duplicated line -- Best Regards, Peter Chen

Re: [PATCH v6 01/12] usb: hcd: Initialize hcd->flags to 0

2016-04-18 Thread Peter Chen
On Mon, Apr 18, 2016 at 10:11:29AM -0400, Alan Stern wrote: > On Mon, 18 Apr 2016, Peter Chen wrote: > > > On Wed, Apr 06, 2016 at 09:32:22AM +0300, Roger Quadros wrote: > > > On 06/04/16 09:09, Felipe Balbi wrote: > > > > > > > > Hi, > > > &

Re: [PATCH v6 06/12] usb: otg: get rid of CONFIG_USB_OTG_FSM in favour of CONFIG_USB_OTG

2016-04-18 Thread Peter Chen
2 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.5.0 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen

Re: [PATCH v6 04/12] usb: otg-fsm: move host controller operations into usb_otg->hcd_ops

2016-04-18 Thread Peter Chen
On Tue, Apr 05, 2016 at 05:05:09PM +0300, Roger Quadros wrote: > This is to prevent missing symbol build error if OTG is > enabled (built-in) and HCD core (CONFIG_USB) is module. > > Signed-off-by: Roger Quadros Acked-by: Peter Chen > --- > drivers/usb/chipide

Re: [PATCH v6 03/12] usb: otg-fsm: use usb_otg wherever possible

2016-04-18 Thread Peter Chen
On Tue, Apr 05, 2016 at 05:05:08PM +0300, Roger Quadros wrote: > Move otg_fsm into usb_otg and use usb_otg wherever possible > in the usb_otg APIs. > > Signed-off-by: Roger Quadros Acked-by: Peter Chen > --- > drivers/usb/chipidea/ci.h| 1 - > drivers/usb/chipi

<    3   4   5   6   7   8   9   10   11   12   >