RE: [PATCH] usb: dwc3: gadget: Avoid race between dwc3 interrupt handler and irq thread handler

2016-12-28 Thread John Youn
> -Original Message- > From: linux-usb-ow...@vger.kernel.org [mailto:linux-usb- > ow...@vger.kernel.org] On Behalf Of Felipe Balbi > Sent: Wednesday, December 28, 2016 8:19 AM > To: Janusz Dziedzic > Cc: Lu Baolu ; Baolin Wang >

RE: [PATCH 0/9] usb: dwc2: Fix checkpatch issues

2016-12-28 Thread John Youn
> -Original Message- > From: Felipe Balbi [mailto:ba...@kernel.org] > Sent: Tuesday, December 27, 2016 3:37 AM > To: John Youn ; John Youn > ; linux-usb@vger.kernel.org > Subject: Re: [PATCH 0/9] usb: dwc2: Fix checkpatch issues > > > Hi

RE: [PATCH v2] usb: dwc3: pci: Add "linux,sysdev_is_parent" property

2016-12-28 Thread John Youn
> -Original Message- > From: Felipe Balbi [mailto:ba...@kernel.org] > Sent: Tuesday, December 27, 2016 3:33 AM > To: John Youn ; linux-usb@vger.kernel.org > Cc: John Youn ; Sriram Dash > ; Baolin Wang

[PATCH v6 07/25] usb: chipidea: Notify events when switching host mode

2016-12-28 Thread Stephen Boyd
The chipidea/udc.c file sends a CI_HDRC_CONTROLLER_RESET_EVENT to the wrapper drivers when it calls hw_device_reset(), but that function is not called from chipidea/host.c. And the udc.c file sends the CI_HDRC_CONTROLLER_STOPPED_EVENT but the host.c file doesn't do anything. The intent of the

[PATCH v6 08/25] usb: chipidea: Remove locking in ci_udc_start()

2016-12-28 Thread Stephen Boyd
We don't call hw_device_reset() with the ci->lock held, so it doesn't seem like this lock here is protecting anything. Let's just remove it. This allows us to call sleeping functions like phy_init() from within the CI_HDRC_CONTROLLER_RESET_EVENT hook. Acked-by: Peter Chen Cc:

[PATCH v6 03/25] usb: ulpi: Support device discovery via DT

2016-12-28 Thread Stephen Boyd
The qcom HSIC ULPI phy doesn't have any bits set in the vendor or product ID registers. This makes it impossible to make a ULPI driver match against the ID registers. Add support to discover the ULPI phys via DT help alleviate this problem. In the DT case, we'll look for a ULPI bus node underneath

[PATCH v6 05/25] usb: chipidea: Handle extcon events properly

2016-12-28 Thread Stephen Boyd
We're currently emulating the vbus and id interrupts in the OTGSC read API, but we also need to make sure that if we're handling the events with extcon that we don't enable the interrupts for those events in the hardware. Therefore, properly emulate this register if we're using extcon, but don't

[PATCH v6 04/25] usb: chipidea: Only read/write OTGSC from one place

2016-12-28 Thread Stephen Boyd
With the id and vbus detection done via extcon we need to make sure we poll the status of OTGSC properly by considering what the extcon is saying, and not just what the register is saying. Let's move this hw_wait_reg() function to the only place it's used and simplify it for polling the OTGSC

[PATCH v6 06/25] usb: chipidea: Add platform flag for wrapper phy management

2016-12-28 Thread Stephen Boyd
The ULPI phy on qcom platforms needs to be initialized and powered on after a USB reset and before we toggle the run/stop bit. Otherwise, the phy locks up and doesn't work properly. Therefore, add a flag to skip any phy power management in the core layer, leaving it up to the glue driver to

[PATCH v6 02/25] of: device: Export of_device_{get_modalias,uvent_modalias} to modules

2016-12-28 Thread Stephen Boyd
The ULPI bus can be built as a module, and it will soon be calling these functions when it supports probing devices from DT. Export them so they can be used by the ULPI module. Acked-by: Rob Herring Cc: Signed-off-by: Stephen Boyd

[PATCH v6 00/25] Support qcom's HSIC USB and rewrite USB2 HS support

2016-12-28 Thread Stephen Boyd
The state of USB ChipIdea support on Qualcomm's platforms is not great. The DT description of these devices requires up to three different nodes for what amounts to be the same hardware block, when there should really only be one. Furthermore, the "phy" driver that is in mainline (phy-msm-usb.c)

[PATCH v6 11/25] usb: chipidea: vbus event may exist before starting gadget

2016-12-28 Thread Stephen Boyd
From: Peter Chen At some situations, the vbus may already be there before starting gadget. So we need to check vbus event after switch to gadget in order to handle missing vbus event. The typical use cases are plugging vbus cable before driver load or the vbus has already

[PATCH v6 16/25] usb: chipidea: msm: Mux over secondary phy at the right time

2016-12-28 Thread Stephen Boyd
We need to pick the correct phy at runtime based on how the SoC has been wired onto the board. If the secondary phy is used, take it out of reset and mux over to it by writing into the TCSR register. Make sure to do this on reset too, because this register is reset to the default value (primary

[PATCH v6 22/25] usb: chipidea: Drop lock across event_notify during gadget stop

2016-12-28 Thread Stephen Boyd
The CI_HDRC_CONTROLLER_STOPPED_EVENT may want to call sleeping APIs similar to how _gadget_stop_activity() may. Let's drop the lock across the event so that glue drivers can make sleeping calls. Cc: Peter Chen Cc: Greg Kroah-Hartman Signed-off-by:

[PATCH v6 20/25] usb: chipidea: msm: Handle phy power states

2016-12-28 Thread Stephen Boyd
The ULPI phy on qcom platforms needs to be initialized and powered on after a USB reset and before we toggle the run/stop bit. Otherwise, the phy locks up and doesn't work properly. Hook the phy initialization into the RESET event and the phy power off into the STOPPED event. Acked-by: Peter Chen

[PATCH v6 18/25] usb: chipidea: msm: Make platform data driver local instead of global

2016-12-28 Thread Stephen Boyd
If two devices are probed with this same driver, they'll share the same platform data structure, while the chipidea core layer writes and modifies it. This can lead to interesting results especially if one device is an OTG type chipidea controller and another is a host. Let's create a copy of this

[PATCH v6 09/25] usb: chipidea: Add support for ULPI PHY bus

2016-12-28 Thread Stephen Boyd
Some phys for the chipidea controller are controlled via the ULPI viewport. Add support for the ULPI bus so that these sorts of phys can be probed and read/written automatically without having to duplicate the viewport logic in each phy driver. Acked-by: Peter Chen Cc: Greg

[PATCH v6 10/25] usb: chipidea: Consolidate extcon notifiers

2016-12-28 Thread Stephen Boyd
The two extcon notifiers are almost the same except for the variable name for the cable structure and the id notifier inverts the cable->state logic. Make it the same and replace two functions with one to save some lines. This also makes it so that the id cable state is true when the id pin is

[PATCH v6 12/25] usb: chipidea: msm: Mark device as runtime pm active

2016-12-28 Thread Stephen Boyd
We're not properly marking the glue layer/wrapper device as runtime active, so runtime PM believes that the hardware state is inactive when we call pm_runtime_enable() in this driver. This causes a problem when the glue layer has a power domain associated with it, because runtime PM will go and

[PATCH v6 17/25] usb: chipidea: msm: Restore wrapper settings after reset

2016-12-28 Thread Stephen Boyd
When the RESET bit is set in the USBCMD register it resets quite a few of the wrapper's registers to their reset state. This includes the GENCONFIG and GENCONFIG2 registers. Currently this is done by the usb phy and ehci-msm drivers writing into the controller wrapper's MMIO address space. Let's

[PATCH v6 14/25] usb: chipidea: msm: Use hw_write_id_reg() instead of writel

2016-12-28 Thread Stephen Boyd
The MSM_USB_BASE macro trick is not very clear, and we're using it for only one register write so let's just move to using hw_write_id_reg() and passing the ci pointer instead. That clearly shows what offset we're using and avoids needing to include the msm_hsusb_hw.h file when we're going to

[PATCH v6 15/25] usb: chipidea: msm: Add proper clk and reset support

2016-12-28 Thread Stephen Boyd
The msm chipidea controller uses two main clks, an AHB clk to read/write the MMIO registers and a core clk called the system clk that drives the controller itself. Add support for these clks as they're required in all designs. Also add support for an optional third clk that we need to turn on to

[PATCH v6 13/25] usb: chipidea: msm: Rely on core to override AHBBURST

2016-12-28 Thread Stephen Boyd
The core framework already handles setting this parameter with a platform quirk. Add the appropriate flag so that we always set AHBBURST to 0. Technically DT should be doing this, but we always do it for msm chipidea devices so setting the flag in the driver works just as well. If the burst needs

[PATCH v6 23/25] usb: chipidea: Pullup D+ in device mode via phy APIs

2016-12-28 Thread Stephen Boyd
If the phy supports it, call phy_set_mode() to pull up D+ when required by setting the mode to PHY_MODE_USB_DEVICE. If we want to remove the pullup, set the mode to PHY_MODE_USB_HOST. Cc: Peter Chen Cc: Greg Kroah-Hartman Signed-off-by: Stephen

[PATCH v6 24/25] phy: Add support for Qualcomm's USB HSIC phy

2016-12-28 Thread Stephen Boyd
The HSIC USB controller on qcom SoCs has an integrated all digital phy controlled via the ULPI viewport. Cc: Kishon Vijay Abraham I Acked-by: Rob Herring Cc: Signed-off-by: Stephen Boyd ---

[PATCH v6 21/25] usb: chipidea: msm: Be silent on probe defer errors

2016-12-28 Thread Stephen Boyd
If something fails in ci_hdrc_add_device() due to probe defer, we shouldn't print an error message. Be silent in this case as we'll try probe again later. Acked-by: Peter Chen Cc: Greg Kroah-Hartman Signed-off-by: Stephen Boyd

[PATCH v6 25/25] phy: Add support for Qualcomm's USB HS phy

2016-12-28 Thread Stephen Boyd
The high-speed phy on qcom SoCs is controlled via the ULPI viewport. Cc: Kishon Vijay Abraham I Cc: Acked-by: Rob Herring Signed-off-by: Stephen Boyd --- .../devicetree/bindings/phy/qcom,usb-hs-phy.txt|

[PATCH v6 19/25] usb: chipidea: msm: Add reset controller for PHY POR bit

2016-12-28 Thread Stephen Boyd
The MSM chipidea wrapper has two bits that are used to reset the first or second phy. Add support for these bits via the reset controller framework, so that phy drivers can reset their hardware at the right time during initialization. Acked-by: Peter Chen Cc: Greg

[PATCH v6 01/25] of: device: Support loading a module with OF based modalias

2016-12-28 Thread Stephen Boyd
In the case of ULPI devices, we want to be able to load the driver before registering the device so that we don't get stuck in a loop waiting for the phy module to appear and failing usb controller probe. Currently we request the ulpi module via the ulpi ids, but in the DT case we might need to

[PATCH] usb: renesas_usbhs: mod_host: fix typo: "connecte" -> "connected"

2016-12-28 Thread Colin King
From: Colin Ian King trivial fix to typo in dev_dbg message Signed-off-by: Colin Ian King --- drivers/usb/renesas_usbhs/mod_host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/renesas_usbhs/mod_host.c

rndis_host drops connection

2016-12-28 Thread Marcus Hardt
Hi There, Not sure if this might need to go to networking instead. The issue is related to getting USB tethering for my phone. It works with a galaxy-s4, but not with oneplus-3t. I think it's a kernel related bug. All log excerpts are from my linux-laptop to which i plug the phone via USB.

Re: [PATCH] usb: dwc3: gadget: Avoid race between dwc3 interrupt handler and irq thread handler

2016-12-28 Thread Felipe Balbi
Hi, Janusz Dziedzic writes: On some platfroms(like x86 platform), when one core is running the USB gadget irq thread handler by dwc3_thread_interrupt(), meanwhile another core also can respond other interrupts from dwc3 controller and modify

Re: [PATCH] usb: dwc3: gadget: Avoid race between dwc3 interrupt handler and irq thread handler

2016-12-28 Thread Janusz Dziedzic
2016-12-27 12:05 GMT+01:00 Felipe Balbi : > Hi, > > Lu Baolu writes: >> On 12/26/2016 04:01 PM, Baolin Wang wrote: >>> On some platfroms(like x86 platform), when one core is running the USB >>> gadget >>> irq thread handler by dwc3_thread_interrupt(),

Re: [PATCH] usb: dwc3: gadget: Avoid race between dwc3 interrupt handler and irq thread handler

2016-12-28 Thread Janusz Dziedzic
2016-12-27 13:16 GMT+01:00 Baolin Wang : > Hi, > > On 27 December 2016 at 19:11, Felipe Balbi wrote: >> >> Hi, >> >> Baolin Wang writes: >>> Hi, >>> >>> On 27 December 2016 at 18:52, Janusz Dziedzic

Re: net/gadget: slab-out-of-bounds write in dev_config

2016-12-28 Thread Felipe Balbi
Hi, Alan Stern writes: >> > Index: usb-4.x/drivers/usb/gadget/legacy/inode.c >> > === >> > --- usb-4.x.orig/drivers/usb/gadget/legacy/inode.c >> > +++ usb-4.x/drivers/usb/gadget/legacy/inode.c >> > @@