Re: [PATCH] extcon: usb-gpio: Add VBUS detection support

2016-09-26 Thread Peter Chen
On Tue, Sep 20, 2016 at 05:53:55PM +0300, Roger Quadros wrote:
> Driver can now work with both ID and VBUS pins or either one of
> them.
> 
> There can be the following 3 cases
> 
> 1) Both ID and VBUS GPIOs are available:
> 
> ID = LOW -> USB_HOST active, USB inactive
> ID = HIGH -> USB_HOST inactive, USB state is same as VBUS.
> 
> 2) Only ID GPIO is available:
> 
> ID = LOW -> USB_HOST active, USB inactive
> ID = HIGH -> USB_HOST inactive, USB active
> 
> 3) Only VBUS GPIO is available:
> 
> VBUS = LOW -> USB_HOST inactive, USB inactive
> VBUS = HIGH -> USB_HOST inactive, USB active
> 
> Signed-off-by: Roger Quadros 
> ---
>  .../devicetree/bindings/extcon/extcon-usb-gpio.txt |   3 +
>  drivers/extcon/extcon-usb-gpio.c   | 169 
> -
>  2 files changed, 132 insertions(+), 40 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt 
> b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
> index af0b903..dfc14f7 100644
> --- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
> +++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
> @@ -5,7 +5,10 @@ connected to a GPIO pin.
>  
>  Required properties:
>  - compatible: Should be "linux,extcon-usb-gpio"
> +
> +Either one of id-gpio or vbus-gpio must be present. Both can be present as 
> well.
>  - id-gpio: gpio for USB ID pin. See gpio binding.
> +- vbus-gpio: gpio for USB VBUS pin.
>  
>  Example: Examples of extcon-usb-gpio node in dra7-evm.dts as listed below:
>   extcon_usb1 {
> diff --git a/drivers/extcon/extcon-usb-gpio.c 
> b/drivers/extcon/extcon-usb-gpio.c
> index a27d350..d589c5f 100644
> --- a/drivers/extcon/extcon-usb-gpio.c
> +++ b/drivers/extcon/extcon-usb-gpio.c
> @@ -24,7 +24,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -36,7 +35,9 @@ struct usb_extcon_info {
>   struct extcon_dev *edev;
>  
>   struct gpio_desc *id_gpiod;
> + struct gpio_desc *vbus_gpiod;
>   int id_irq;
> + int vbus_irq;
>  
>   unsigned long debounce_jiffies;
>   struct delayed_work wq_detcable;
> @@ -48,31 +49,47 @@ static const unsigned int usb_extcon_cable[] = {
>   EXTCON_NONE,
>  };
>  
> +/*
> + * "USB" = VBUS and "USB-HOST" = !ID, so we have:
> + * Both "USB" and "USB-HOST" can't be set as active at the
> + * same time so if "USB-HOST" is active (i.e. ID is 0)  we keep "USB" 
> inactive
> + * even if VBUS is on.
> + *
> + *  State  |ID   |   VBUS
> + * 
> + *  [1] USB|H|H
> + *  [2] none   |H|L
> + *  [3] USB-HOST   |L|H
> + *  [4] USB-HOST   |L|L
> + *
> + * In case we have only one of these signals:
> + * - VBUS only - we want to distinguish between [1] and [2], so ID is always 
> 1.
> + * - ID only - we want to distinguish between [1] and [4], so VBUS = ID.
> +*/
>  static void usb_extcon_detect_cable(struct work_struct *work)
>  {
> - int id;
> + int id, vbus;
>   struct usb_extcon_info *info = container_of(to_delayed_work(work),
>   struct usb_extcon_info,
>   wq_detcable);
>  
> - /* check ID and update cable state */
> - id = gpiod_get_value_cansleep(info->id_gpiod);
> - if (id) {
> - /*
> -  * ID = 1 means USB HOST cable detached.
> -  * As we don't have event for USB peripheral cable attached,
> -  * we simulate USB peripheral attach here.
> -  */
> + /* check ID and VBUS and update cable state */
> + id = info->id_gpiod ?
> + gpiod_get_value_cansleep(info->id_gpiod) : 1;
> + vbus = info->vbus_gpiod ?
> + gpiod_get_value_cansleep(info->vbus_gpiod) : id;
> +
> + /* at first we clean states which are no longer active */
> + if (id)
>   extcon_set_state_sync(info->edev, EXTCON_USB_HOST, false);
> - extcon_set_state_sync(info->edev, EXTCON_USB, true);
> - } else {
> - /*
> -  * ID = 0 means USB HOST cable attached.
> -  * As we don't have event for USB peripheral cable detached,
> -  * we simulate USB peripheral detach here.
> -  */
> + if (!vbus)
>   extcon_set_state_sync(info->edev, EXTCON_USB, false);
> +
> + if (!id) {
>   extcon_set_state_sync(info->edev, EXTCON_USB_HOST, true);
> + } else {
> + if (vbus)
> + extcon_set_state_sync(info->edev, EXTCON_USB, true);
>   }
>  }
>  
> @@ -101,12 +118,21 @@ static int usb_extcon_probe(struct platform_device 
> *pdev)
>   return -ENOMEM;
>  
>   info->dev = dev;
> - info->id_gpiod = devm_gpiod_get(>dev, "id", GPIOD_IN);
> - if (IS_ERR(info->id_gpiod)) {
> - 

Re: [RFC/PATCH] usb: misc: Add a driver for TC7USB40MU

2016-09-26 Thread Peter Chen
On Mon, Sep 26, 2016 at 11:44:50AM -0700, Stephen Boyd wrote:
> Quoting Peter Chen (2016-09-25 20:29:27)
> > On Thu, Sep 22, 2016 at 11:51:02AM -0700, Stephen Boyd wrote:
> > > Quoting Peter Chen (2016-09-16 18:16:05)
> > > > On Wed, Sep 14, 2016 at 01:55:02AM -0700, Stephen Boyd wrote:
> > > > > Quoting Stephen Boyd (2016-09-13 18:42:46)
> > > > > > On the db410c 96boards platform we have a TC7USB40MU[1] on the
> > > > > > board to mux the D+/D- lines from the SoC between a micro usb
> > > > > > "device" port and a USB hub for "host" roles. Upon a role switch,
> > > > > > we need to change this mux to forward the D+/D- lines to either
> > > > > > the port or the hub. Therefore, introduce a driver for this
> > > > > > device that intercepts extcon USB_HOST events and logically
> > > > > > asserts a gpio to mux the "host" D+/D- lines when a host cable is
> > > > > > attached. When the cable goes away, it will logically deassert
> > > > > > the gpio and mux the "device" lines.
> > > > > > 
> > > > > > [1] 
> > > > > > https://toshiba.semicon-storage.com/ap-en/product/logic/bus-switch/detail.TC7USB40MU.html
> > > > > > 
> > > > > > Cc: MyungJoo Ham 
> > > > > > Cc: Chanwoo Choi 
> > > > > > Cc: 
> > > > > > Signed-off-by: Stephen Boyd 
> > > > > > ---
> > > > > > 
> > > > > > Should I make the extcon part optional? I could see a case where 
> > > > > > there are two
> > > > > > "OTG" ports connected to the mux (or two hubs), and for some reason 
> > > > > > the
> > > > > > software may want to mux between them at runtime. If we mandate an 
> > > > > > extcon,
> > > > > > that won't be possible to support. Perhaps it would be better to 
> > > > > > have
> > > > > > the node, but connect it to the usb controller with a phandle 
> > > > > > (maybe of_graph
> > > > > > endpoints would be useful too) so that when the controller wants to 
> > > > > > mux over
> > > > > > a port it can do so.
> > > > > 
> > > > > Here's some dts mock-up on top of the db410c for the of_graph stuff. I
> > > > > haven't written any code around it, but the idea is to allow the 
> > > > > binding
> > > > > to specify how the mux is connected to upstream and downstream D+/D-
> > > > > lines. This way, we can do some dt parsing of the endpoints and their
> > > > > parent nodes to figure out if the mux needs to be set high or low to 
> > > > > use
> > > > > a device connector or a usb hub based on if the id cable is present.
> > > > > Maybe I'm over thinking things though and we could just have a DT
> > > > > property for that.
> > > > > 
> > > > >   soc {
> > > > >   usb@78d9000 {
> > > > >   extcon = <_id>, <_id>;
> > > > 
> > > > Why you have two same extcon phandler? From my mind, one should id,
> > > > another should is vbus. Besides, I find extcon-usb-gpio.c is lack of
> > > > vbus support, how you support vbus detection for
> > > > connection/disconnection with PC for your chipidea msm patch set?
> > > 
> > > This was already in the dts files for db410c. In the chipidea binding
> > > one is for EXTCON_USB (vbus) and one is for EXTCON_USB_HOST (id). My
> > > understanding is that extcon-usb-gpio.c sends events for both EXTCON_USB
> > > and EXTCON_USB_HOST when the gpio changes state. vbus detection is not
> > > that great on this board because we only have on gpio for this.
> > 
> > I think extcon-usb-gpio.c needs to extend for supporting vbus event,
> > otherwise, the micro-b cable's connect/disconnect will introduce
> > EXTCON_USB_HOST event, if you use two <_idx> for both id and
> > vbus event.
> > 
> 
> Sorry, I'm lost now. extcon-usb-gpio.c already supports EXTCON_USB as an
> event. Is the problem that we're using two of the same phandles in the
> binding?

No, ID and VBUS are different events.

http://www.spinics.net/lists/linux-usb/msg147004.html

-- 

Best Regards,
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


Re: [PATCH v6 0/2] Add USB configuration for imx53

2016-09-26 Thread Peter Chen
On Mon, Sep 26, 2016 at 01:14:18PM +0200, Fabien Lahoudere wrote:
> Changes in V2:
>   - Patches sent to early with bad contents
> Changes in V3:
>   - Change subject
>   - Split "configure imx for ULPI phy" for disable-oc code
> Changes in V4:
>   - Fix "Change switch order" commit message
>   - Indent switch/case (set case on the same column as switch)
>   - Remove useless test in "Change switch order"
> Changes in V5:
>   - Squash "Change switch order" and "configure imx for ULPI phy"
>   - Add device tree binding documentation
> Changes in v6:
>   - Remove dt binding because we can disable the feature by using an 
>   existing binding
> 
> Fabien Lahoudere (2):
>   usb: chipidea: imx: configure imx for ULPI phy
>   usb: chipidea: imx: Disable internal 60Mhz clock with ULPI PHY
> 
>  drivers/usb/chipidea/ci_hdrc_imx.c |  4 ++
>  drivers/usb/chipidea/ci_hdrc_imx.h |  1 +
>  drivers/usb/chipidea/usbmisc_imx.c | 86 
> +++---
>  3 files changed, 77 insertions(+), 14 deletions(-)
> 
> -- 
> 2.1.4
> 

I will queue them, thanks.

-- 

Best Regards,
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


Re: Strange behavior of CHN bit with dwc3

2016-09-26 Thread mgautam

On 2016-09-22 18:46, yfw wrote:

Hi list,
I tried to enable the high speed, high bandwidth transfer in device
mode for iso type on dwc3 based soc. The platform only supports usb
device 2.0.

I set the MaxPacketSize to 0x1400 so the host could allocate 3072
bytes for uframe. But when I chain three trbs together, the dwc3
behavior is quite weird:



Why are you using three TRBs for one service interval? Is the data
not contiguous?
Since, in your case all 3072 bytes belong to one service interval,
could just one TRB be used with PktCntM1 set to '2' ?
--
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


Re: USB hot-plug not working (ASUS TP301UA-C4028T)

2016-09-26 Thread Pierre de Villemereuil
Hi guys,

Any news on this front? Anything I can do to help find the issue?

Cheers,
Pierre.

Le mardi 20 septembre 2016, 11:05:13 NZDT Oliver Neukum a écrit :
> On Tue, 2016-09-20 at 20:58 +1200, Pierre de Villemereuil wrote:
> > Hi Oliver!
> > 
> > Here you are.
> > 
> > dmesg signals when plugging AC in:
> > http://paste.opensuse.org/57485b34
> > 
> > dmesg signals when unplugging AC:
> > http://paste.opensuse.org/5a8e9910
> > 
> > And just in case, dmesg signals when plugging a USB device when AC is
> > plugged in:
> > http://paste.opensuse.org/45faee84
> > 
> > Hope this helps!
> 
> This looks like your XHCI is suspended when you unplug AC but remote
> wakeup is not operational. The problem looks specific to XHCI not
> USB in general. Time to add the XHCI maintainer.
> 
> Mathias,
> 
> hotplug on battery fails. The XHCI seems to fail to wake up if something
> is plugged into the root hub.
> 
>   Regards
>   Oliver
--
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


[PATCH v2] Net Driver: Add Cypress GX3 VID=04b4 PID=3610.

2016-09-26 Thread Allan Chou
From: Chris Roth 

Add support for Cypress GX3 SuperSpeed to Gigabit Ethernet
Bridge Controller (Vendor=04b4 ProdID=3610).

Patch verified on x64 linux kernel 4.7.4 system with the
Kensington SD4600P USB-C Universal Dock with Power, which uses the
Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller.

A similar patch was signed-off and tested-by Allan Chou
 on 2015-12-01.

Allan verified his similar patch on x86 Linux kernel 4.1.6 system
with Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller.

Tested-by: Allan Chou 
Tested-by: Chris Roth 

Signed-off-by: Allan Chou 
Signed-off-by: Chris Roth 
---
 drivers/net/usb/ax88179_178a.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index e6338c1..8a6675d 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -1656,6 +1656,19 @@ static const struct driver_info ax88178a_info = {
.tx_fixup = ax88179_tx_fixup,
 };
 
+static const struct driver_info cypress_GX3_info = {
+   .description = "Cypress GX3 SuperSpeed to Gigabit Ethernet Controller",
+   .bind = ax88179_bind,
+   .unbind = ax88179_unbind,
+   .status = ax88179_status,
+   .link_reset = ax88179_link_reset,
+   .reset = ax88179_reset,
+   .stop = ax88179_stop,
+   .flags = FLAG_ETHER | FLAG_FRAMING_AX,
+   .rx_fixup = ax88179_rx_fixup,
+   .tx_fixup = ax88179_tx_fixup,
+};
+
 static const struct driver_info dlink_dub1312_info = {
.description = "D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter",
.bind = ax88179_bind,
@@ -1718,6 +1731,10 @@ static const struct usb_device_id products[] = {
USB_DEVICE(0x0b95, 0x178a),
.driver_info = (unsigned long)_info,
 }, {
+   /* Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller */
+   USB_DEVICE(0x04b4, 0x3610),
+   .driver_info = (unsigned long)_GX3_info,
+}, {
/* D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter */
USB_DEVICE(0x2001, 0x4a00),
.driver_info = (unsigned long)_dub1312_info,
-- 
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


Re: [PATCH v2] Net Driver: Add Cypress GX3 VID=04b4 PID=3610.

2016-09-26 Thread Chris Roth
I'm not sure what I'm doing wrong:

I'm trying to get the from statement to read original author (Allan
Chou) first, and then me (Chris Roth) second. I've used the following
two commands:

git format-patch -o /tmp/ --subject-prefix="PATCH v2" --from="Allan
Chou " HEAD^

and

git send-email --to linux-usb@vger.kernel.org --to
net...@vger.kernel.org --to linux-ker...@vger.kernel.org --from="Allan
Chou "
/tmp/0001-Net-Driver-Add-Cypress-GX3-VID-04b4-PID-3610.patch

I thought that adding the --from portions to the git format-patch and
git send-email commands would force the addition of Allan to the top
of the patch, but it hasn't. Can anyone tell me specifically how I
need to change these commands in order to get the desired result? Then
I'll submit a PATCH v3.

Regards,
Chris

On Mon, Sep 26, 2016 at 3:48 PM, Allan Chou  wrote:
> From: Chris Roth 
>
> Add support for Cypress GX3 SuperSpeed to Gigabit Ethernet
> Bridge Controller (Vendor=04b4 ProdID=3610).
>
> Patch verified on x64 linux kernel 4.7.4 system with the
> Kensington SD4600P USB-C Universal Dock with Power, which uses the
> Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller.
>
> A similar patch was signed-off and tested-by Allan Chou
>  on 2015-12-01.
>
> Allan verified his similar patch on x86 Linux kernel 4.1.6 system
> with Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller.
>
> Tested-by: Allan Chou 
> Tested-by: Chris Roth 
>
> Signed-off-by: Allan Chou 
> Signed-off-by: Chris Roth 
> ---
>  drivers/net/usb/ax88179_178a.c | 17 +
>  1 file changed, 17 insertions(+)
>
> diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
> index e6338c1..8a6675d 100644
> --- a/drivers/net/usb/ax88179_178a.c
> +++ b/drivers/net/usb/ax88179_178a.c
> @@ -1656,6 +1656,19 @@ static const struct driver_info ax88178a_info = {
> .tx_fixup = ax88179_tx_fixup,
>  };
>
> +static const struct driver_info cypress_GX3_info = {
> +   .description = "Cypress GX3 SuperSpeed to Gigabit Ethernet 
> Controller",
> +   .bind = ax88179_bind,
> +   .unbind = ax88179_unbind,
> +   .status = ax88179_status,
> +   .link_reset = ax88179_link_reset,
> +   .reset = ax88179_reset,
> +   .stop = ax88179_stop,
> +   .flags = FLAG_ETHER | FLAG_FRAMING_AX,
> +   .rx_fixup = ax88179_rx_fixup,
> +   .tx_fixup = ax88179_tx_fixup,
> +};
> +
>  static const struct driver_info dlink_dub1312_info = {
> .description = "D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter",
> .bind = ax88179_bind,
> @@ -1718,6 +1731,10 @@ static const struct usb_device_id products[] = {
> USB_DEVICE(0x0b95, 0x178a),
> .driver_info = (unsigned long)_info,
>  }, {
> +   /* Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller */
> +   USB_DEVICE(0x04b4, 0x3610),
> +   .driver_info = (unsigned long)_GX3_info,
> +}, {
> /* D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter */
> USB_DEVICE(0x2001, 0x4a00),
> .driver_info = (unsigned long)_dub1312_info,
> --
> 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


Re: [PATCH v8 2/3] usb: dwc2: assert phy reset when waking up in rk3288 platform

2016-09-26 Thread John Youn
On 9/24/2016 11:51 AM, Randy Li wrote:
> On the rk3288 USB host-only port (the one that's not the OTG-enabled
> port) the PHY can get into a bad state when a wakeup is asserted (not
> just a wakeup from full system suspend but also a wakeup from
> autosuspend).
> 
> We can get the PHY out of its bad state by asserting its "port reset",
> but unfortunately that seems to assert a reset onto the USB bus so it
> could confuse things if we don't actually deenumerate / reenumerate the
> device.
> 
> We can also get the PHY out of its bad state by fully resetting it using
> the reset from the CRU (clock reset unit) in chip, which does a more full
> reset.  The CRU-based reset appears to actually cause devices on the bus
> to be removed and reinserted, which fixes the problem (albeit in a hacky
> way).
> 
> It's unfortunate that we need to do a full re-enumeration of devices at
> wakeup time, but this is better than alternative of letting the bus get
> wedged.
> 
> Signed-off-by: Randy Li 
> ---
>  drivers/usb/dwc2/core_intr.c | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
> index d85c5c9..af27edc 100644
> --- a/drivers/usb/dwc2/core_intr.c
> +++ b/drivers/usb/dwc2/core_intr.c
> @@ -345,6 +345,7 @@ static void dwc2_handle_session_req_intr(struct 
> dwc2_hsotg *hsotg)
>  static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
>  {
>   int ret;
> + struct device_node *np = hsotg->dev->of_node;
>  
>   /* Clear interrupt */
>   dwc2_writel(GINTSTS_WKUPINT, hsotg->regs + GINTSTS);
> @@ -379,6 +380,16 @@ static void dwc2_handle_wakeup_detected_intr(struct 
> dwc2_hsotg *hsotg)
>   /* Restart the Phy Clock */
>   pcgcctl &= ~PCGCTL_STOPPCLK;
>   dwc2_writel(pcgcctl, hsotg->regs + PCGCTL);
> +
> + /*
> +  * It is a quirk in Rockchip RK3288, causing by
> +  * a hardware bug. This will propagate out and
> +  * eventually we'll re-enumerate the device.
> +  * Not great but the best we can do.
> +  */
> + if (of_device_is_compatible(np, "rockchip,rk3288-usb"))
> + phy_reset(hsotg->phy);
> +
>   mod_timer(>wkp_timer,
> jiffies + msecs_to_jiffies(71));
>   } else {
> 


Acked-by: John Youn 

Regards,
John

--
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


Re: [Umap2][7/11][160a:3184] NULL pointer dereference

2016-09-26 Thread Malcolm Priestley



On 26/09/16 19:23, Oliver Neukum wrote:

On Mon, 2016-09-26 at 18:57 +0100, Malcolm Priestley wrote:


On 26/09/16 09:48, Oliver Neukum wrote:

On Sat, 2016-09-24 at 01:21 +0100, Malcolm Priestley wrote:


On 22/09/16 20:50, Malcolm Priestley wrote:



On 22/09/16 15:25, Oliver Neukum wrote:

On Thu, 2016-09-22 at 14:46 +0300, Binyamin Sharet wrote:


-- Binyamin


I compiled the kernel without BPF and still got an issue (attached)
How can I verify the BPF is not enabled/part of the kernel?

-- Binyamin


Could you test the attached patch?

ieee80211_free_hw frees the priv.

usb_set_intfdata is set to hw_>priv, If vt6656_disconnect is called
there is a null check.

I was wrong ieee80211_free_hw does not null the ieee80211_hw->priv offset.

I have replicated this bug with the hardware.

This patch fixes the bug.


Which patch? It seems there's a potential for confusion here.


Your attached patch
[PATCH] vt6656: avoid double free


Thanks for clearing up the confusion. May I submit it with your
"Tested-by"?

Yes

Tested-by: Malcolm Priestley 

Regards

Malcolm
--
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


Re: [Umap2][7/11][160a:3184] NULL pointer dereference

2016-09-26 Thread Oliver Neukum
On Mon, 2016-09-26 at 18:57 +0100, Malcolm Priestley wrote:
> 
> On 26/09/16 09:48, Oliver Neukum wrote:
> > On Sat, 2016-09-24 at 01:21 +0100, Malcolm Priestley wrote:
> >>
> >> On 22/09/16 20:50, Malcolm Priestley wrote:
> >>>
> >>>
> >>> On 22/09/16 15:25, Oliver Neukum wrote:
>  On Thu, 2016-09-22 at 14:46 +0300, Binyamin Sharet wrote:
> 
> >> -- Binyamin
> >
> > I compiled the kernel without BPF and still got an issue (attached)
> > How can I verify the BPF is not enabled/part of the kernel?
> >
> > -- Binyamin
> 
>  Could you test the attached patch?
> >>> ieee80211_free_hw frees the priv.
> >>>
> >>> usb_set_intfdata is set to hw_>priv, If vt6656_disconnect is called
> >>> there is a null check.
> >> I was wrong ieee80211_free_hw does not null the ieee80211_hw->priv offset.
> >>
> >> I have replicated this bug with the hardware.
> >>
> >> This patch fixes the bug.
> >
> > Which patch? It seems there's a potential for confusion here.
> 
> Your attached patch
> [PATCH] vt6656: avoid double free

Thanks for clearing up the confusion. May I submit it with your
"Tested-by"?

Regards
Oliver


--
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


Re: g_webcam Isoch high bandwidth transfer

2016-09-26 Thread Laurent Pinchart
Hi Felipe,

On Friday 23 Sep 2016 11:27:26 Felipe Balbi wrote:
> yfw  writes:
> >> Here's one that actually compiles, sorry about that.
> > 
> > No worries, I was sleeping ;-)
> > 
> > I will test it out early next week. Thanks.
>  
>  meanwhile, how about some instructions on how to test this out myself?
>  How are you using g_webcam and what are you running on host side? Got a
>  nice list of commands there I can use? I think I can get to bottom of
>  this much quicker if I can reproduce it locally ;-)
> >>> 
> >>> On device side:
> >>> - first patch g_webcam as in my first email in this thread to enable
> >>>   640x480@30fps;
> >>> - # modprobe g_webcam streaming_maxpacket=3072
> >>> - then run uvc-gadget to feed the YUV frames;
> >>>   http://git.ideasonboard.org/uvc-gadget.git
> >> 
> >> as is, g_webcam never enumerates to the host. It's calls to
> >> usb_function_active() and usb_function_deactivate() are unbalanced. Do
> >> you have any other changes to g_webcam?
> > 
> > With uvc function gadget driver, user daemon uvc-gadget must be started
> > before connect to host. Not sure whether g_webcam has same requirement.
> 
> f_uvc.c should be handling that by means for usb_function_deactivate().
> 
> I'll try keeping cable disconnected until uvc-gadget is running.

Things might have changed since we've discussed the issue several years ago, 
but back then at least the musb UDC started unconditionally connected.

-- 
Regards,

Laurent Pinchart

--
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


Re: g_webcam Isoch high bandwidth transfer

2016-09-26 Thread Laurent Pinchart
Hi Felipe,

On Friday 23 Sep 2016 10:49:57 Felipe Balbi wrote:
> Bin Liu  writes:
> > +Fengwei Yin per his request.
> > 
> > On Thu, Sep 22, 2016 at 10:48:40PM +0300, Felipe Balbi wrote:
> >> Bin Liu  writes:
> >> 
> >> [...]
> >> 
>  Here's one that actually compiles, sorry about that.
> >>> 
> >>> No worries, I was sleeping ;-)
> >>> 
> >>> I will test it out early next week. Thanks.
> >> 
> >> meanwhile, how about some instructions on how to test this out myself?
> >> How are you using g_webcam and what are you running on host side? Got a
> >> nice list of commands there I can use? I think I can get to bottom of
> >> this much quicker if I can reproduce it locally ;-)
> > 
> > On device side:
> > - first patch g_webcam as in my first email in this thread to enable
> > 
> >   640x480@30fps;
> > 
> > - # modprobe g_webcam streaming_maxpacket=3072
> > - then run uvc-gadget to feed the YUV frames;
> > 
> > http://git.ideasonboard.org/uvc-gadget.git
> 
> as is, g_webcam never enumerates to the host. It's calls to
> usb_function_active() and usb_function_deactivate() are unbalanced. Do
> you have any other changes to g_webcam?
> 
> Also, uvc-gadget.git doesn't compile, had to modify it a bit:
> 
> -#include "../drivers/usb/gadget/uvc.h"
> +#include "../drivers/usb/gadget/function/uvc.h"
> 
> Also fixed a build warning:
> 
> @@ -732,6 +732,8 @@ int main(int argc, char *argv[])
> fd_set wfds = fds;
> 
> ret = select(dev->fd + 1, NULL, , , NULL);
> +   if (ret < 0)
> +   return ret;
> if (FD_ISSET(dev->fd, ))
> uvc_events_process(dev);
> if (FD_ISSET(dev->fd, ))
> 
> Laurent, have you tested g_webcam recently? What's the magic to get it
> working?

I'm afraid not, I haven't had time to work on UVC gadget for a few years now.

> Here's what I get out of dmesg:
> 
> [   58.568380] usb 1-9: new high-speed USB device number 5 using xhci_hcd
> [   58.738680] usb 1-9: New USB device found, idVendor=1d6b, idProduct=0102
> [   58.738683] usb 1-9: New USB device strings: Mfr=1, Product=2,
> SerialNumber=0 [   58.738685] usb 1-9: Product: Webcam gadget
> [   58.738687] usb 1-9: Manufacturer: Linux Foundation
> [   58.739133] g_webcam gadget: high-speed config #1: Video
> [   58.739138] g_webcam gadget: uvc_function_set_alt(0, 0)
> [   58.739139] g_webcam gadget: reset UVC Control
> [   58.739149] g_webcam gadget: uvc_function_set_alt(1, 0)
> [   58.804369] uvcvideo: Found UVC 1.00 device Webcam gadget (1d6b:0102)
> [   58.804479] g_webcam gadget: uvc_function_set_alt(1, 0)
> [   64.188459] uvcvideo: UVC non compliance - GET_DEF(PROBE) not supported.
> Enabling workaround. [   69.307458] uvcvideo: Failed to query (129) UVC
> probe control : -110 (exp. 26). [   69.307459] uvcvideo: Failed to
> initialize the device (-5).
> [   69.307505] usbcore: registered new interface driver uvcvideo
> [   69.307506] USB Video Class driver (1.1.1)
> [  146.646012] [ cut here ]
> [  146.646023] WARNING: CPU: 0 PID: 2616 at
> drivers/usb/gadget/composite.c:371 usb_function_activate+0x77/0x80
> [libcomposite] [  146.646024] Modules linked in: uvcvideo g_webcam
> usb_f_uvc videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_core
> videodev libcomposite kvm_intel kvm psmouse e1000e input_leds hid_generic
> usbhid atkbd irqbypass evdev [  146.646054] CPU: 0 PID: 2616 Comm:
> gst-launch-1.0 Not tainted
> 4.8.0-rc7-next-20160922-4-gc71031593917-dirty #20 [  146.646055]
> Hardware name: Intel Corporation Skylake Client platform/Skylake Y LPDDR3
> RVP3, BIOS SKLSE2R1.R00.B097.B02.1509020030 09/02/2015 [  146.646058] 
> c9000769bb70
> [  146.646059]  8132d415
> [  146.646060]  
> [  146.646061]  
> 
> [  146.646063]  c9000769bbb0
> [  146.646063]  8105ec1b
> [  146.646064]  01730769bb90
> [  146.646066]  ffea
> [  146.646070]  88016c03a150
> [  146.646072]  0282 88016d793000 c9000769befc
> [  146.646077] Call Trace:
> [  146.646086]  [] dump_stack+0x68/0x93
> [  146.646090]  [] __warn+0xcb/0xf0
> [  146.646095]  [] warn_slowpath_null+0x1d/0x20
> [  146.646099]  [] usb_function_activate+0x77/0x80
> [libcomposite] [  146.646105]  []
> uvc_function_connect+0x1e/0x40 [usb_f_uvc] [  146.646110] 
> [] uvc_v4l2_open+0x6e/0x80 [usb_f_uvc] [  146.646116] 
> [] v4l2_open+0xa0/0x100 [videodev] [  146.646121] 
> [] chrdev_open+0xa1/0x1d0
> [  146.646125]  [] ? cdev_put+0x30/0x30
> [  146.646129]  [] do_dentry_open.isra.17+0x150/0x2e0
> [  146.646133]  [] vfs_open+0x45/0x60
> [  146.646137]  [] path_openat+0x62d/0x1370
> [  146.646141]  [] ? putname+0x54/0x60
> [  146.646146]  [] do_filp_open+0x7e/0xe0
> [  146.646150]  [] ? preempt_count_sub+0x48/0x70
> [  146.646154]  [] ? _raw_spin_unlock+0x16/0x30
> [  146.646160]  [] ? __alloc_fd+0xc9/0x180
> [  146.646164]  [] 

Re: [PATCH 1/2] usb: add helper to extract bits 12:11 of wMaxPacketSize

2016-09-26 Thread Bin Liu
On Mon, Sep 26, 2016 at 01:15:57PM +0300, Felipe Balbi wrote:
> 
> Hi,
> 
> yfw  writes:
> > Hi Felipe,
> >
> > On 2016/9/26 16:12, Felipe Balbi wrote:
> >> According to USB Specification 2.0 table 9-4,
> >> wMaxPacketSize is a bitfield. Endpoint's maxpacket
> >> is laid out in bits 10:0. For high-speed,
> >> high-bandwidth isochronous endpoints, bits 12:11
> >> contain a multiplier to tell us how many
> >> transactions we want to try per uframe.
> >>
> >> This means that if we want an isochronous endpoint
> >> to issue 3 transfers of 1024 bytes per uframe,
> >> wMaxPacketSize should contain the value:
> >>
> >>1024 | (2 << 11)
> >>
> >> or 5120 (0x1400). In order to make Host and
> >> Peripheral controller drivers' life easier, we're
> >> adding a helper which returns bits 12:11. Note that
> >> no care is made WRT to checking endpoint type and
> >> gadget's speed. That's left for drivers to handle.
> >>
> >> Signed-off-by: Felipe Balbi 
> >> ---
> >>  include/uapi/linux/usb/ch9.h | 19 +++
> >>  1 file changed, 19 insertions(+)
> >>
> >> diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
> >> index a8acc24765fe..73bcb24d4077 100644
> >> --- a/include/uapi/linux/usb/ch9.h
> >> +++ b/include/uapi/linux/usb/ch9.h
> >> @@ -423,6 +423,11 @@ struct usb_endpoint_descriptor {
> >>  #define USB_ENDPOINT_XFER_INT 3
> >>  #define USB_ENDPOINT_MAX_ADJUSTABLE   0x80
> >>
> >> +#define USB_EP_ISOC_MAXP_MULT_SHIFT   11
> >> +#define USB_EP_ISOC_MAXP_MULT_MASK(3 << 
> >> USB_EP_ISOC_MAXP_MULT_SHIFT)
> >> +#define USB_EP_ISOC_MAXP_MULT(m) \
> >> +  (((m) & USB_EP_ISOC_MAXP_MULT_MASK) >> USB_EP_ISOC_MAXP_MULT_SHIFT)
> >> +
> >>  /* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep 
> >> type. */
> >>  #define USB_ENDPOINT_INTRTYPE 0x30
> >>  #define USB_ENDPOINT_INTR_PERIODIC(0 << 4)
> >> @@ -630,6 +635,20 @@ static inline int usb_endpoint_maxp(const struct 
> >> usb_endpoint_descriptor *epd)
> >>return __le16_to_cpu(epd->wMaxPacketSize);
> >>  }
> >>
> >> +/**
> >> + * usb_endpoint_isoc_maxp_mult - get endpoint's transactional 
> >> opportunities
> >> + * @epd: endpoint to be checked
> >> + *
> >> + * Return @epd's wMaxPacketSize[12:11] + 1
> >> + */
> >> +static inline int
> >> +usb_endpoint_isoc_maxp_mult(const struct usb_endpoint_descriptor *epd)
> >> +{
> >> +  int maxp = __le16_to_cpu(epd->wMaxPacketSize);
> >> +
> >> +  return USB_EP_ISOC_MAXP_MULT(maxp) + 1;
> >> +}
> >> +
> >>  static inline int usb_endpoint_interrupt_type(
> >>const struct usb_endpoint_descriptor *epd)
> >>  {
> >>
> > Does this mean the issue of isoc high bandwidth transfer was fixed by
> > this patchset per your test?
> 
> No, I couldn't get g_webcam to work yet.

In mainline, g_webcam is broken with DWC3. Also these two patches don't
fix the issue on v4.4.21.

Regards,
-Bin.
--
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


Re: g_webcam Isoch high bandwidth transfer

2016-09-26 Thread Bin Liu
On Fri, Sep 23, 2016 at 10:49:57AM +0300, Felipe Balbi wrote:
> 
> Hi,
> 
> Bin Liu  writes:
> > +Fengwei Yin per his request.
> >
> > On Thu, Sep 22, 2016 at 10:48:40PM +0300, Felipe Balbi wrote:
> >> 
> >> Hi,
> >> 
> >> Bin Liu  writes:
> >> 
> >> [...]
> >> 
> >> >> Here's one that actually compiles, sorry about that.
> >> >
> >> > No worries, I was sleeping ;-)
> >> >
> >> > I will test it out early next week. Thanks.
> >> 
> >> meanwhile, how about some instructions on how to test this out myself?
> >> How are you using g_webcam and what are you running on host side? Got a
> >> nice list of commands there I can use? I think I can get to bottom of
> >> this much quicker if I can reproduce it locally ;-)
> >
> > On device side:
> > - first patch g_webcam as in my first email in this thread to enable
> >   640x480@30fps;
> > - # modprobe g_webcam streaming_maxpacket=3072
> > - then run uvc-gadget to feed the YUV frames;
> > http://git.ideasonboard.org/uvc-gadget.git
> 
> as is, g_webcam never enumerates to the host. It's calls to

Right, on mainline kernel (I tested 4.8.0-rc7) g_webcam is broken with
DWC3, g_webcam does not enumerate on the host. But it works on v4.4.21.

[snip]

> 
> uvc-gadget keeps printing this error message:
> 
>  159 if ((ret = ioctl(dev->fd, VIDIOC_DQBUF, )) < 0) {
>  160 printf("Unable to dequeue buffer: %s (%d).\n", 
> strerror(errno),
>  161 errno);
>  162 return ret;
>  163 }

I removed this printf, since it floods the console if start uvc-gadget
before connect to the host.

BTY, you don't have to start uvc-gadget first then connect usb cable. I
keep the cable always connected.

Regards,
-Bin.
--
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


[PATCH 6/8] usb: dwc3: gadget: remove redundant trace prints

2016-09-26 Thread Felipe Balbi
Removing some trace prints which were made redundant
when we started decoding events and TRBs completely
within their respective trace points.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/dwc3/ep0.c| 17 +
 drivers/usb/dwc3/gadget.c | 43 +--
 2 files changed, 2 insertions(+), 58 deletions(-)

diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index fe79d771dee4..2d2f582068cb 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -99,11 +99,8 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, 
dma_addr_t buf_dma,
trace_dwc3_prepare_trb(dep, trb);
 
ret = dwc3_send_gadget_ep_cmd(dep, DWC3_DEPCMD_STARTTRANSFER, );
-   if (ret < 0) {
-   dwc3_trace(trace_dwc3_ep0, "%s STARTTRANSFER failed",
-   dep->name);
+   if (ret < 0)
return ret;
-   }
 
dep->flags |= DWC3_EP_BUSY;
dep->resource_index = dwc3_gadget_ep_get_transfer_index(dep);
@@ -242,11 +239,6 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct 
usb_request *request,
goto out;
}
 
-   dwc3_trace(trace_dwc3_ep0,
-   "queueing request %p to %s length %d state '%s'",
-   request, dep->name, request->length,
-   dwc3_ep0_state_string(dwc->ep0state));
-
ret = __dwc3_gadget_ep0_queue(dep, req);
 
 out:
@@ -940,17 +932,14 @@ static void dwc3_ep0_xfer_complete(struct dwc3 *dwc,
 
switch (dwc->ep0state) {
case EP0_SETUP_PHASE:
-   dwc3_trace(trace_dwc3_ep0, "Setup Phase");
dwc3_ep0_inspect_setup(dwc, event);
break;
 
case EP0_DATA_PHASE:
-   dwc3_trace(trace_dwc3_ep0, "Data Phase");
dwc3_ep0_complete_data(dwc, event);
break;
 
case EP0_STATUS_PHASE:
-   dwc3_trace(trace_dwc3_ep0, "Status Phase");
dwc3_ep0_complete_status(dwc, event);
break;
default:
@@ -1065,8 +1054,6 @@ static void dwc3_ep0_xfernotready(struct dwc3 *dwc,
 {
switch (event->status) {
case DEPEVT_STATUS_CONTROL_DATA:
-   dwc3_trace(trace_dwc3_ep0, "Control Data");
-
/*
 * We already have a DATA transfer in the controller's cache,
 * if we receive a XferNotReady(DATA) we will ignore it, unless
@@ -1092,8 +1079,6 @@ static void dwc3_ep0_xfernotready(struct dwc3 *dwc,
if (dwc->ep0_next_event != DWC3_EP0_NRDY_STATUS)
return;
 
-   dwc3_trace(trace_dwc3_ep0, "Control Status");
-
dwc->ep0state = EP0_STATUS_PHASE;
 
if (dwc->delayed_status) {
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 5f7e39407892..8eff2813e552 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -797,10 +797,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
struct usb_gadget   *gadget = >gadget;
enum usb_device_speed   speed = gadget->speed;
 
-   dwc3_trace(trace_dwc3_gadget, "%s: req %p dma %08llx length %d%s",
-   dep->name, req, (unsigned long long) dma,
-   length, chain ? " chain" : "");
-
trb = >trb_pool[dep->trb_enqueue];
 
if (!req->trb) {
@@ -2133,9 +2129,7 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
dep->resource_index = 0;
 
if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
-   dwc3_trace(trace_dwc3_gadget,
-   "%s is an Isochronous endpoint",
-   dep->name);
+   dev_err(dwc->dev, "XferComplete for Isochronous 
endpoint\n");
return;
}
 
@@ -2148,22 +2142,11 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
dwc3_gadget_start_isoc(dwc, dep, event);
} else {
-   int active;
int ret;
 
-   active = event->status & DEPEVT_STATUS_TRANSFER_ACTIVE;
-
-   dwc3_trace(trace_dwc3_gadget, "%s: reason %s",
-   dep->name, active ? "Transfer Active"
-   : "Transfer Not Active");
-
ret = __dwc3_gadget_kick_transfer(dep, 0);
if (!ret || ret == -EBUSY)
return;
-
-   dwc3_trace(trace_dwc3_gadget,
-   "%s: failed to kick transfers",
-   dep->name);
}
 
break;
@@ -2173,26 +2156,9 @@ static void 

[PATCH 8/8] usb: dwc3: trace: print out ep0state also from XferComplete

2016-09-26 Thread Felipe Balbi
With this extra piece of information, it will be
easier to find mismatches between driver and HW.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/dwc3/debug.h  | 11 ---
 drivers/usb/dwc3/ep0.c|  4 
 drivers/usb/dwc3/gadget.c |  2 +-
 drivers/usb/dwc3/trace.h  | 12 +++-
 4 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/dwc3/debug.h b/drivers/usb/dwc3/debug.h
index 61b6f0f207cf..b287fc6ab29e 100644
--- a/drivers/usb/dwc3/debug.h
+++ b/drivers/usb/dwc3/debug.h
@@ -200,10 +200,11 @@ dwc3_gadget_event_string(const struct dwc3_event_devt 
*event)
  * @event: then event code
  */
 static inline const char *
-dwc3_ep_event_string(const struct dwc3_event_depevt *event)
+dwc3_ep_event_string(const struct dwc3_event_depevt *event, u32 ep0state)
 {
u8 epnum = event->endpoint_number;
static char str[256];
+   size_t len;
int status;
int ret;
 
@@ -215,6 +216,10 @@ dwc3_ep_event_string(const struct dwc3_event_depevt *event)
switch (event->endpoint_event) {
case DWC3_DEPEVT_XFERCOMPLETE:
strcat(str, "Transfer Complete");
+   len = strlen(str);
+
+   if (epnum <= 1)
+   sprintf(str + len, " [%s]", 
dwc3_ep0_state_string(ep0state));
break;
case DWC3_DEPEVT_XFERINPROGRESS:
strcat(str, "Transfer In-Progress");
@@ -299,14 +304,14 @@ static inline const char 
*dwc3_gadget_event_type_string(u8 event)
}
 }
 
-static inline const char *dwc3_decode_event(u32 event)
+static inline const char *dwc3_decode_event(u32 event, u32 ep0state)
 {
const union dwc3_event evt = (union dwc3_event) event;
 
if (evt.type.is_devspec)
return dwc3_gadget_event_string();
else
-   return dwc3_ep_event_string();
+   return dwc3_ep_event_string(, ep0state);
 }
 
 static inline const char *dwc3_ep_cmd_status_string(int status)
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 1be54712147e..c562613ccd1a 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -1078,10 +1078,6 @@ static void dwc3_ep0_xfernotready(struct dwc3 *dwc,
 void dwc3_ep0_interrupt(struct dwc3 *dwc,
const struct dwc3_event_depevt *event)
 {
-   dwc3_trace(trace_dwc3_ep0, "%s: state '%s'",
-   dwc3_ep_event_string(event),
-   dwc3_ep0_state_string(dwc->ep0state));
-
switch (event->endpoint_event) {
case DWC3_DEPEVT_XFERCOMPLETE:
dwc3_ep0_xfer_complete(dwc, event);
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 8eff2813e552..ea769fcd82ac 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2719,7 +2719,7 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc,
 static void dwc3_process_event_entry(struct dwc3 *dwc,
const union dwc3_event *event)
 {
-   trace_dwc3_event(event->raw);
+   trace_dwc3_event(event->raw, dwc);
 
/* Endpoint IRQ, handle it and return early */
if (event->type.is_devspec == 0) {
diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h
index d24cefd191b5..a4ef5e7bf6b8 100644
--- a/drivers/usb/dwc3/trace.h
+++ b/drivers/usb/dwc3/trace.h
@@ -63,21 +63,23 @@ DEFINE_EVENT(dwc3_log_msg, dwc3_ep0,
 );
 
 DECLARE_EVENT_CLASS(dwc3_log_event,
-   TP_PROTO(u32 event),
-   TP_ARGS(event),
+   TP_PROTO(u32 event, struct dwc3 *dwc),
+   TP_ARGS(event, dwc),
TP_STRUCT__entry(
__field(u32, event)
+   __field(u32, ep0state)
),
TP_fast_assign(
__entry->event = event;
+   __entry->ep0state = dwc->ep0state;
),
TP_printk("event (%08x): %s", __entry->event,
-   dwc3_decode_event(__entry->event))
+   dwc3_decode_event(__entry->event, __entry->ep0state))
 );
 
 DEFINE_EVENT(dwc3_log_event, dwc3_event,
-   TP_PROTO(u32 event),
-   TP_ARGS(event)
+   TP_PROTO(u32 event, struct dwc3 *dwc),
+   TP_ARGS(event, dwc)
 );
 
 DECLARE_EVENT_CLASS(dwc3_log_ctrl,
-- 
2.10.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


[PATCH 4/8] usb: dwc3: gadget: conditionally disable Link State change events

2016-09-26 Thread Felipe Balbi
Link State Change events are only needed for
debugging and to apply certain workarounds on known
errata. Let's save a few cycles by disabling these
events completely on working revisions of the core.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/dwc3/gadget.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index dd8d957c2d85..5f7e39407892 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1531,11 +1531,13 @@ static void dwc3_gadget_enable_irq(struct dwc3 *dwc)
DWC3_DEVTEN_CMDCMPLTEN |
DWC3_DEVTEN_ERRTICERREN |
DWC3_DEVTEN_WKUPEVTEN |
-   DWC3_DEVTEN_ULSTCNGEN |
DWC3_DEVTEN_CONNECTDONEEN |
DWC3_DEVTEN_USBRSTEN |
DWC3_DEVTEN_DISCONNEVTEN);
 
+   if (dwc->revision < DWC3_REVISION_250A)
+   reg |= DWC3_DEVTEN_ULSTCNGEN;
+
dwc3_writel(dwc->regs, DWC3_DEVTEN, reg);
 }
 
-- 
2.10.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


[PATCH 7/8] usb: dwc3: debug: move dwc3_ep0_state_string() to debug.h

2016-09-26 Thread Felipe Balbi
We will be using dwc3_ep0_state_string() from within
our tracepoints, so we need to move that helper to
debug.h in order for it to be accessible.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/dwc3/debug.h | 16 
 drivers/usb/dwc3/ep0.c   | 16 
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/dwc3/debug.h b/drivers/usb/dwc3/debug.h
index fe8abee31551..61b6f0f207cf 100644
--- a/drivers/usb/dwc3/debug.h
+++ b/drivers/usb/dwc3/debug.h
@@ -124,6 +124,22 @@ dwc3_gadget_link_string(enum dwc3_link_state link_state)
}
 }
 
+static inline const char *dwc3_ep0_state_string(enum dwc3_ep0_state state)
+{
+   switch (state) {
+   case EP0_UNCONNECTED:
+   return "Unconnected";
+   case EP0_SETUP_PHASE:
+   return "Setup Phase";
+   case EP0_DATA_PHASE:
+   return "Data Phase";
+   case EP0_STATUS_PHASE:
+   return "Status Phase";
+   default:
+   return "UNKNOWN";
+   }
+}
+
 /**
  * dwc3_gadget_event_string - returns event name
  * @event: the event code
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 2d2f582068cb..1be54712147e 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -39,22 +39,6 @@ static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, 
struct dwc3_ep *dep);
 static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
struct dwc3_ep *dep, struct dwc3_request *req);
 
-static const char *dwc3_ep0_state_string(enum dwc3_ep0_state state)
-{
-   switch (state) {
-   case EP0_UNCONNECTED:
-   return "Unconnected";
-   case EP0_SETUP_PHASE:
-   return "Setup Phase";
-   case EP0_DATA_PHASE:
-   return "Data Phase";
-   case EP0_STATUS_PHASE:
-   return "Status Phase";
-   default:
-   return "UNKNOWN";
-   }
-}
-
 static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma,
u32 len, u32 type, bool chain)
 {
-- 
2.10.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


[PATCH 5/8] usb: dwc3: debug: decode control endpoint phase too

2016-09-26 Thread Felipe Balbi
DWC3 can tell us which phase of a setup transfer
we're getting into. Let's decode it from the event
to make it easier to debug.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/dwc3/core.h  |  1 +
 drivers/usb/dwc3/debug.h | 13 +
 2 files changed, 14 insertions(+)

diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 99fa8b8b06fe..18e4c09ae286 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -1041,6 +1041,7 @@ struct dwc3_event_depevt {
 /* Control-only Status */
 #define DEPEVT_STATUS_CONTROL_DATA 1
 #define DEPEVT_STATUS_CONTROL_STATUS   2
+#define DEPEVT_STATUS_CONTROL_PHASE(n) ((n) & 3)
 
 /* In response to Start Transfer */
 #define DEPEVT_TRANSFER_NO_RESOURCE1
diff --git a/drivers/usb/dwc3/debug.h b/drivers/usb/dwc3/debug.h
index 33ab2a203c1b..fe8abee31551 100644
--- a/drivers/usb/dwc3/debug.h
+++ b/drivers/usb/dwc3/debug.h
@@ -207,6 +207,19 @@ dwc3_ep_event_string(const struct dwc3_event_depevt *event)
strcat(str, "Transfer Not Ready");
status = event->status & DEPEVT_STATUS_TRANSFER_ACTIVE;
strcat(str, status ? " (Active)" : " (Not Active)");
+
+   /* Control Endpoints */
+   if (epnum <= 1) {
+   int phase = DEPEVT_STATUS_CONTROL_PHASE(event->status);
+
+   switch (phase) {
+   case DEPEVT_STATUS_CONTROL_DATA:
+   strcat(str, " [Data Phase]");
+   break;
+   case DEPEVT_STATUS_CONTROL_STATUS:
+   strcat(str, " [Status Phase]");
+   }
+   }
break;
case DWC3_DEPEVT_RXTXFIFOEVT:
strcat(str, "FIFO");
-- 
2.10.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


[PATCH 2/8] usb: dwc3: gadget: make use of No Response Update Transfer

2016-09-26 Thread Felipe Balbi
No Response Update Transfer is a special type of
Update Transfer command which can be used whenever
we're not relying on XferNotReady to prepare
transfers. With this, we don't need to wait for
CMDACT to be cleared and issue further commands to
the endpoint straight away.

Let's start using this version to skip the long-ish
wait.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/dwc3/gadget.c | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 144d6da43f1d..6ea0cd67500a 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -233,6 +233,7 @@ static int __dwc3_gadget_wakeup(struct dwc3 *dwc);
 int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd,
struct dwc3_gadget_ep_cmd_params *params)
 {
+   const struct usb_endpoint_descriptor *desc = dep->endpoint.desc;
struct dwc3 *dwc = dep->dwc;
u32 timeout = 500;
u32 reg;
@@ -276,7 +277,28 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned 
cmd,
dwc3_writel(dep->regs, DWC3_DEPCMDPAR1, params->param1);
dwc3_writel(dep->regs, DWC3_DEPCMDPAR2, params->param2);
 
-   dwc3_writel(dep->regs, DWC3_DEPCMD, cmd | DWC3_DEPCMD_CMDACT);
+   /*
+* Synopsys Databook 2.60a states in section 6.3.2.5.6 of that if we're
+* not relying on XferNotReady, we can make use of a special "No
+* Response Update Transfer" command where we should clear both CmdAct
+* and CmdIOC bits.
+*
+* With this, we don't need to wait for command completion and can
+* straight away issue further commands to the endpoint.
+*
+* NOTICE: We're making an assumption that control endpoints will never
+* make use of Update Transfer command. This is a safe assumption
+* because we can never have more than one request at a time with
+* Control Endpoints. If anybody changes that assumption, this chunk
+* needs to be updated accordingly.
+*/
+   if (DWC3_DEPCMD_CMD(cmd) == DWC3_DEPCMD_UPDATETRANSFER &&
+   !usb_endpoint_xfer_isoc(desc))
+   cmd &= ~(DWC3_DEPCMD_CMDIOC | DWC3_DEPCMD_CMDACT);
+   else
+   cmd |= DWC3_DEPCMD_CMDACT;
+
+   dwc3_writel(dep->regs, DWC3_DEPCMD, cmd);
do {
reg = dwc3_readl(dep->regs, DWC3_DEPCMD);
if (!(reg & DWC3_DEPCMD_CMDACT)) {
-- 
2.10.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


[PATCH v6 0/2] Add USB configuration for imx53

2016-09-26 Thread Fabien Lahoudere
Changes in V2:
- Patches sent to early with bad contents
Changes in V3:
- Change subject
- Split "configure imx for ULPI phy" for disable-oc code
Changes in V4:
- Fix "Change switch order" commit message
- Indent switch/case (set case on the same column as switch)
- Remove useless test in "Change switch order"
Changes in V5:
- Squash "Change switch order" and "configure imx for ULPI phy"
- Add device tree binding documentation
Changes in v6:
- Remove dt binding because we can disable the feature by using an 
existing binding

Fabien Lahoudere (2):
  usb: chipidea: imx: configure imx for ULPI phy
  usb: chipidea: imx: Disable internal 60Mhz clock with ULPI PHY

 drivers/usb/chipidea/ci_hdrc_imx.c |  4 ++
 drivers/usb/chipidea/ci_hdrc_imx.h |  1 +
 drivers/usb/chipidea/usbmisc_imx.c | 86 +++---
 3 files changed, 77 insertions(+), 14 deletions(-)

-- 
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


[PATCH v6 1/2] usb: chipidea: imx: configure imx for ULPI phy

2016-09-26 Thread Fabien Lahoudere
In order to use ULPI phy with usb host 2 and 3, we need to configure
controller register to enable ULPI features.

Each USB controller have different behaviour, so in order to avoid to have
several "swicth(data->index)" and lock/unlock, we prefer to get the index
switch and then test for features if they exist for this index.
This patch also remove useless test of reg and val. Those two values cannot
be NULL.

Signed-off-by: Fabien Lahoudere 
---
 drivers/usb/chipidea/ci_hdrc_imx.c |  4 ++
 drivers/usb/chipidea/ci_hdrc_imx.h |  1 +
 drivers/usb/chipidea/usbmisc_imx.c | 75 +++---
 3 files changed, 66 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c 
b/drivers/usb/chipidea/ci_hdrc_imx.c
index 0991794..5f4a815 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "ci.h"
@@ -146,6 +147,9 @@ static struct imx_usbmisc_data 
*usbmisc_get_init_data(struct device *dev)
if (of_find_property(np, "external-vbus-divider", NULL))
data->evdo = 1;
 
+   if (of_usb_get_phy_mode(np) == USBPHY_INTERFACE_MODE_ULPI)
+   data->ulpi = 1;
+
return data;
 }
 
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h 
b/drivers/usb/chipidea/ci_hdrc_imx.h
index 409aa5ca8..d666c9f 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.h
+++ b/drivers/usb/chipidea/ci_hdrc_imx.h
@@ -19,6 +19,7 @@ struct imx_usbmisc_data {
unsigned int disable_oc:1; /* over current detect disabled */
unsigned int oc_polarity:1; /* over current polarity if oc enabled */
unsigned int evdo:1; /* set external vbus divider option */
+   unsigned int ulpi:1; /* connected to an ULPI phy */
 };
 
 int imx_usbmisc_init(struct imx_usbmisc_data *);
diff --git a/drivers/usb/chipidea/usbmisc_imx.c 
b/drivers/usb/chipidea/usbmisc_imx.c
index 20d02a5..11f51bd 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -46,11 +46,20 @@
 
 #define MX53_USB_OTG_PHY_CTRL_0_OFFSET 0x08
 #define MX53_USB_OTG_PHY_CTRL_1_OFFSET 0x0c
+#define MX53_USB_CTRL_1_OFFSET 0x10
+#define MX53_USB_CTRL_1_H2_XCVR_CLK_SEL_MASK (0x11 << 2)
+#define MX53_USB_CTRL_1_H2_XCVR_CLK_SEL_ULPI BIT(2)
+#define MX53_USB_CTRL_1_H3_XCVR_CLK_SEL_MASK (0x11 << 6)
+#define MX53_USB_CTRL_1_H3_XCVR_CLK_SEL_ULPI BIT(6)
 #define MX53_USB_UH2_CTRL_OFFSET   0x14
 #define MX53_USB_UH3_CTRL_OFFSET   0x18
 #define MX53_BM_OVER_CUR_DIS_H1BIT(5)
 #define MX53_BM_OVER_CUR_DIS_OTG   BIT(8)
 #define MX53_BM_OVER_CUR_DIS_UHx   BIT(30)
+#define MX53_USB_CTRL_1_UH2_ULPI_ENBIT(26)
+#define MX53_USB_CTRL_1_UH3_ULPI_ENBIT(27)
+#define MX53_USB_UHx_CTRL_WAKE_UP_EN   BIT(7)
+#define MX53_USB_UHx_CTRL_ULPI_INT_EN  BIT(8)
 #define MX53_USB_PHYCTRL1_PLLDIV_MASK  0x3
 #define MX53_USB_PLL_DIV_24_MHZ0x01
 
@@ -199,31 +208,69 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data 
*data)
val |= MX53_USB_PLL_DIV_24_MHZ;
writel(val, usbmisc->base + MX53_USB_OTG_PHY_CTRL_1_OFFSET);
 
-   if (data->disable_oc) {
-   spin_lock_irqsave(>lock, flags);
-   switch (data->index) {
-   case 0:
+   spin_lock_irqsave(>lock, flags);
+
+   switch (data->index) {
+   case 0:
+   if (data->disable_oc) {
reg = usbmisc->base + MX53_USB_OTG_PHY_CTRL_0_OFFSET;
val = readl(reg) | MX53_BM_OVER_CUR_DIS_OTG;
-   break;
-   case 1:
+   writel(val, reg);
+   }
+   break;
+   case 1:
+   if (data->disable_oc) {
reg = usbmisc->base + MX53_USB_OTG_PHY_CTRL_0_OFFSET;
val = readl(reg) | MX53_BM_OVER_CUR_DIS_H1;
-   break;
-   case 2:
+   writel(val, reg);
+   }
+   break;
+   case 2:
+   if (data->ulpi) {
+   /* set USBH2 into ULPI-mode. */
+   reg = usbmisc->base + MX53_USB_CTRL_1_OFFSET;
+   val = readl(reg) | MX53_USB_CTRL_1_UH2_ULPI_EN;
+   /* select ULPI clock */
+   val &= ~MX53_USB_CTRL_1_H2_XCVR_CLK_SEL_MASK;
+   val |= MX53_USB_CTRL_1_H2_XCVR_CLK_SEL_ULPI;
+   writel(val, reg);
+   /* Set interrupt wake up enable */
+   reg = usbmisc->base + MX53_USB_UH2_CTRL_OFFSET;
+   val = readl(reg) | MX53_USB_UHx_CTRL_WAKE_UP_EN
+   | MX53_USB_UHx_CTRL_ULPI_INT_EN;
+   writel(val, reg);
+   }
+   if (data->disable_oc) {
reg = usbmisc->base + 

[PATCH v6 2/2] usb: chipidea: imx: Disable internal 60Mhz clock with ULPI PHY

2016-09-26 Thread Fabien Lahoudere
The internal 60Mhz clock for host2 and host3 are useless in ULPI
phy mode, so we disable it when configuring ULPI PHY node for
those host.

Signed-off-by: Fabien Lahoudere 
---
 drivers/usb/chipidea/usbmisc_imx.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/chipidea/usbmisc_imx.c 
b/drivers/usb/chipidea/usbmisc_imx.c
index 11f51bd..e77a4ed 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -53,6 +53,9 @@
 #define MX53_USB_CTRL_1_H3_XCVR_CLK_SEL_ULPI BIT(6)
 #define MX53_USB_UH2_CTRL_OFFSET   0x14
 #define MX53_USB_UH3_CTRL_OFFSET   0x18
+#define MX53_USB_CLKONOFF_CTRL_OFFSET  0x24
+#define MX53_USB_CLKONOFF_CTRL_H2_INT60CKOFF BIT(21)
+#define MX53_USB_CLKONOFF_CTRL_H3_INT60CKOFF BIT(22)
 #define MX53_BM_OVER_CUR_DIS_H1BIT(5)
 #define MX53_BM_OVER_CUR_DIS_OTG   BIT(8)
 #define MX53_BM_OVER_CUR_DIS_UHx   BIT(30)
@@ -239,6 +242,10 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data 
*data)
val = readl(reg) | MX53_USB_UHx_CTRL_WAKE_UP_EN
| MX53_USB_UHx_CTRL_ULPI_INT_EN;
writel(val, reg);
+   /* Disable internal 60Mhz clock */
+   reg = usbmisc->base + MX53_USB_CLKONOFF_CTRL_OFFSET;
+   val = readl(reg) | MX53_USB_CLKONOFF_CTRL_H2_INT60CKOFF;
+   writel(val, reg);
}
if (data->disable_oc) {
reg = usbmisc->base + MX53_USB_UH2_CTRL_OFFSET;
@@ -260,6 +267,10 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data 
*data)
val = readl(reg) | MX53_USB_UHx_CTRL_WAKE_UP_EN
| MX53_USB_UHx_CTRL_ULPI_INT_EN;
writel(val, reg);
+   /* Disable internal 60Mhz clock */
+   reg = usbmisc->base + MX53_USB_CLKONOFF_CTRL_OFFSET;
+   val = readl(reg) | MX53_USB_CLKONOFF_CTRL_H3_INT60CKOFF;
+   writel(val, reg);
}
if (data->disable_oc) {
reg = usbmisc->base + MX53_USB_UH3_CTRL_OFFSET;
-- 
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


Re: [PATCH] usb: gadget: udc: atmel: fix endpoint name

2016-09-26 Thread Richard Genoud
2016-09-26 9:18 GMT+02:00 Felipe Balbi :
>
> Hi,
>
> Greg Kroah-Hartman  writes:
>> On Fri, Sep 23, 2016 at 04:20:45PM +0200, Nicolas Ferre wrote:
>>> Le 16/09/2016 à 10:36, Nicolas Ferre a écrit :
>>> > Le 15/09/2016 à 17:07, Alexandre Belloni a écrit :
>>> >> Since commit c32b5bcfa3c4 ("ARM: dts: at91: Fix USB endpoint nodes"),
>>> >> atmel_usba_udc fails with:
>>> >>
>>> >> [ cut here ]
>>> >> WARNING: CPU: 0 PID: 0 at include/linux/usb/gadget.h:405
>>> >> ecm_do_notify+0x188/0x1a0
>>> >> Modules linked in:
>>> >> CPU: 0 PID: 0 Comm: swapper Not tainted 4.7.0+ #15
>>> >> Hardware name: Atmel SAMA5
>>> >> [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
>>> >> [] (show_stack) from [] (__warn+0xe4/0xfc)
>>> >> [] (__warn) from [] (warn_slowpath_null+0x20/0x28)
>>> >> [] (warn_slowpath_null) from [] 
>>> >> (ecm_do_notify+0x188/0x1a0)
>>> >> [] (ecm_do_notify) from [] (ecm_set_alt+0x74/0x1ac)
>>> >> [] (ecm_set_alt) from [] 
>>> >> (composite_setup+0xfc0/0x19f8)
>>> >> [] (composite_setup) from [] 
>>> >> (usba_udc_irq+0x8f4/0xd9c)
>>> >> [] (usba_udc_irq) from [] 
>>> >> (handle_irq_event_percpu+0x9c/0x158)
>>> >> [] (handle_irq_event_percpu) from [] 
>>> >> (handle_irq_event+0x28/0x3c)
>>> >> [] (handle_irq_event) from [] 
>>> >> (handle_fasteoi_irq+0xa0/0x168)
>>> >> [] (handle_fasteoi_irq) from [] 
>>> >> (generic_handle_irq+0x24/0x34)
>>> >> [] (generic_handle_irq) from [] 
>>> >> (__handle_domain_irq+0x54/0xa8)
>>> >> [] (__handle_domain_irq) from [] 
>>> >> (__irq_svc+0x54/0x70)
>>> >> [] (__irq_svc) from [] (arch_cpu_idle+0x38/0x3c)
>>> >> [] (arch_cpu_idle) from [] 
>>> >> (cpu_startup_entry+0x9c/0xdc)
>>> >> [] (cpu_startup_entry) from [] 
>>> >> (start_kernel+0x354/0x360)
>>> >> [] (start_kernel) from [<20008078>] (0x20008078)
>>> >> ---[ end trace e7cf9dcebf4815a6 ]---
>>> >>
>>> >> Fixes: c32b5bcfa3c4 ("ARM: dts: at91: Fix USB endpoint nodes")
>>> >> Reported-by: Richard Genoud 
>>> >> Signed-off-by: Alexandre Belloni 
>>> >
>>> > Acked-by: Nicolas Ferre 
>>> >
>>> > Felipe, Greg,
>>> > It is clearly a regression and material for 4.8-fixes. But I do know
>>> > that we are very late in the process :-(
>>> > Please do what you can to make it progress before 4.8-final but I'm
>>> > truly aware of the challenge.
>>>
>>> Any chance that we can have it (aka ping)?
>>
>> It's Felipe's area, not mine :)
>
> Sorry, I had missed this one. Greg, seems like this would be the only
> pending fix. Do you want it in a pull request or would you prefer to
> just pick it up as a patch? Works either way for me. In case you decide
> to pick it up as a patch:
>
> Acked-by: Felipe Balbi 
>
> If you prefer to pick it up as a pull request, I already have the patch
> in my 'fixes' branch, just need to tag it and send it to you.
>
> --
> balbi

All seems ok, thanks Alexandre.

Tested-by: Richard Genoud 
--
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


Re: [PATCH 1/2] usb: add helper to extract bits 12:11 of wMaxPacketSize

2016-09-26 Thread Felipe Balbi

Hi,

yfw  writes:
> Hi Felipe,
>
> On 2016/9/26 16:12, Felipe Balbi wrote:
>> According to USB Specification 2.0 table 9-4,
>> wMaxPacketSize is a bitfield. Endpoint's maxpacket
>> is laid out in bits 10:0. For high-speed,
>> high-bandwidth isochronous endpoints, bits 12:11
>> contain a multiplier to tell us how many
>> transactions we want to try per uframe.
>>
>> This means that if we want an isochronous endpoint
>> to issue 3 transfers of 1024 bytes per uframe,
>> wMaxPacketSize should contain the value:
>>
>>  1024 | (2 << 11)
>>
>> or 5120 (0x1400). In order to make Host and
>> Peripheral controller drivers' life easier, we're
>> adding a helper which returns bits 12:11. Note that
>> no care is made WRT to checking endpoint type and
>> gadget's speed. That's left for drivers to handle.
>>
>> Signed-off-by: Felipe Balbi 
>> ---
>>  include/uapi/linux/usb/ch9.h | 19 +++
>>  1 file changed, 19 insertions(+)
>>
>> diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
>> index a8acc24765fe..73bcb24d4077 100644
>> --- a/include/uapi/linux/usb/ch9.h
>> +++ b/include/uapi/linux/usb/ch9.h
>> @@ -423,6 +423,11 @@ struct usb_endpoint_descriptor {
>>  #define USB_ENDPOINT_XFER_INT   3
>>  #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
>>
>> +#define USB_EP_ISOC_MAXP_MULT_SHIFT 11
>> +#define USB_EP_ISOC_MAXP_MULT_MASK  (3 << USB_EP_ISOC_MAXP_MULT_SHIFT)
>> +#define USB_EP_ISOC_MAXP_MULT(m) \
>> +(((m) & USB_EP_ISOC_MAXP_MULT_MASK) >> USB_EP_ISOC_MAXP_MULT_SHIFT)
>> +
>>  /* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep 
>> type. */
>>  #define USB_ENDPOINT_INTRTYPE   0x30
>>  #define USB_ENDPOINT_INTR_PERIODIC  (0 << 4)
>> @@ -630,6 +635,20 @@ static inline int usb_endpoint_maxp(const struct 
>> usb_endpoint_descriptor *epd)
>>  return __le16_to_cpu(epd->wMaxPacketSize);
>>  }
>>
>> +/**
>> + * usb_endpoint_isoc_maxp_mult - get endpoint's transactional opportunities
>> + * @epd: endpoint to be checked
>> + *
>> + * Return @epd's wMaxPacketSize[12:11] + 1
>> + */
>> +static inline int
>> +usb_endpoint_isoc_maxp_mult(const struct usb_endpoint_descriptor *epd)
>> +{
>> +int maxp = __le16_to_cpu(epd->wMaxPacketSize);
>> +
>> +return USB_EP_ISOC_MAXP_MULT(maxp) + 1;
>> +}
>> +
>>  static inline int usb_endpoint_interrupt_type(
>>  const struct usb_endpoint_descriptor *epd)
>>  {
>>
> Does this mean the issue of isoc high bandwidth transfer was fixed by
> this patchset per your test?

No, I couldn't get g_webcam to work yet.

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH v5 2/2] usb: chipidea: imx: Add binding to disable USB 60Mhz clock

2016-09-26 Thread Fabien Lahoudere

Hi,

On 23/09/16 21:47, Rob Herring wrote:

On Wed, Sep 21, 2016 at 11:07:07AM +0200, Fabien Lahoudere wrote:

This binding allow to disable the internal 60Mhz clock for USB host2 or
host3.

Signed-off-by: Fabien Lahoudere 
---
 Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt |  1 +
 drivers/usb/chipidea/ci_hdrc_imx.c |  2 ++
 drivers/usb/chipidea/ci_hdrc_imx.h |  1 +
 drivers/usb/chipidea/usbmisc_imx.c | 13 +
 4 files changed, 17 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt 
b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
index 0e03344..f83da66 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
@@ -84,6 +84,7 @@ i.mx specific properties
 - over-current-active-high: over current signal polarity is high active,
   typically over current signal polarity is low active.
 - external-vbus-divider: enables off-chip resistor divider for Vbus
+- disable-int60ck: disable internal 60MHz clock for usb host2 or host3 on imx53


Doesn't this depend on something else like the type of phy connected? If
not, when can you do this or not?



We can disable it in OTG mode and with ULPI phy and Sascha Hauer think 
we can do it without dt binding for example based on PHY mode. So I will 
remove the binding and just disable clock if ULPI is selected.



Rob



Fabien
--
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


Re: [PATCH v5 2/2] usb: chipidea: imx: Add binding to disable USB 60Mhz clock

2016-09-26 Thread Fabien Lahoudere

Hi,

On 26/09/16 10:18, Sascha Hauer wrote:

On Wed, Sep 21, 2016 at 11:07:07AM +0200, Fabien Lahoudere wrote:

This binding allow to disable the internal 60Mhz clock for USB host2 or
host3.

Signed-off-by: Fabien Lahoudere 
---
 Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt |  1 +
 drivers/usb/chipidea/ci_hdrc_imx.c |  2 ++
 drivers/usb/chipidea/ci_hdrc_imx.h |  1 +
 drivers/usb/chipidea/usbmisc_imx.c | 13 +
 4 files changed, 17 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt 
b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
index 0e03344..f83da66 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
@@ -84,6 +84,7 @@ i.mx specific properties
 - over-current-active-high: over current signal polarity is high active,
   typically over current signal polarity is low active.
 - external-vbus-divider: enables off-chip resistor divider for Vbus
+- disable-int60ck: disable internal 60MHz clock for usb host2 or host3 on imx53


Why do we need a binding for this? I would assume the driver should know
whether this clock is in use or not. If it doesn't that's a problem we
should solve.



Yes you are right because we can disable this clock for OTG and with 
ULPI PHY. I think that it will be better to have a dt binding but if it 
is useless I can remove it and disable clock when ULPI mode is enabled.



Sascha



Fabien
--
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


Re: [Umap2][7/11][160a:3184] NULL pointer dereference

2016-09-26 Thread Oliver Neukum
On Sat, 2016-09-24 at 01:21 +0100, Malcolm Priestley wrote:
> 
> On 22/09/16 20:50, Malcolm Priestley wrote:
> >
> >
> > On 22/09/16 15:25, Oliver Neukum wrote:
> >> On Thu, 2016-09-22 at 14:46 +0300, Binyamin Sharet wrote:
> >>
>  -- Binyamin
> >>>
> >>> I compiled the kernel without BPF and still got an issue (attached)
> >>> How can I verify the BPF is not enabled/part of the kernel?
> >>>
> >>> -- Binyamin
> >>
> >> Could you test the attached patch?
> > ieee80211_free_hw frees the priv.
> >
> > usb_set_intfdata is set to hw_>priv, If vt6656_disconnect is called
> > there is a null check.
> I was wrong ieee80211_free_hw does not null the ieee80211_hw->priv offset.
> 
> I have replicated this bug with the hardware.
> 
> This patch fixes the bug.

Which patch? It seems there's a potential for confusion here.

Regards
Oliver


--
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


Re: [PATCH 1/2] usb: add helper to extract bits 12:11 of wMaxPacketSize

2016-09-26 Thread yfw

Hi Felipe,

On 2016/9/26 16:12, Felipe Balbi wrote:

According to USB Specification 2.0 table 9-4,
wMaxPacketSize is a bitfield. Endpoint's maxpacket
is laid out in bits 10:0. For high-speed,
high-bandwidth isochronous endpoints, bits 12:11
contain a multiplier to tell us how many
transactions we want to try per uframe.

This means that if we want an isochronous endpoint
to issue 3 transfers of 1024 bytes per uframe,
wMaxPacketSize should contain the value:

1024 | (2 << 11)

or 5120 (0x1400). In order to make Host and
Peripheral controller drivers' life easier, we're
adding a helper which returns bits 12:11. Note that
no care is made WRT to checking endpoint type and
gadget's speed. That's left for drivers to handle.

Signed-off-by: Felipe Balbi 
---
 include/uapi/linux/usb/ch9.h | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
index a8acc24765fe..73bcb24d4077 100644
--- a/include/uapi/linux/usb/ch9.h
+++ b/include/uapi/linux/usb/ch9.h
@@ -423,6 +423,11 @@ struct usb_endpoint_descriptor {
 #define USB_ENDPOINT_XFER_INT  3
 #define USB_ENDPOINT_MAX_ADJUSTABLE0x80

+#define USB_EP_ISOC_MAXP_MULT_SHIFT11
+#define USB_EP_ISOC_MAXP_MULT_MASK (3 << USB_EP_ISOC_MAXP_MULT_SHIFT)
+#define USB_EP_ISOC_MAXP_MULT(m) \
+   (((m) & USB_EP_ISOC_MAXP_MULT_MASK) >> USB_EP_ISOC_MAXP_MULT_SHIFT)
+
 /* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep type. */
 #define USB_ENDPOINT_INTRTYPE  0x30
 #define USB_ENDPOINT_INTR_PERIODIC (0 << 4)
@@ -630,6 +635,20 @@ static inline int usb_endpoint_maxp(const struct 
usb_endpoint_descriptor *epd)
return __le16_to_cpu(epd->wMaxPacketSize);
 }

+/**
+ * usb_endpoint_isoc_maxp_mult - get endpoint's transactional opportunities
+ * @epd: endpoint to be checked
+ *
+ * Return @epd's wMaxPacketSize[12:11] + 1
+ */
+static inline int
+usb_endpoint_isoc_maxp_mult(const struct usb_endpoint_descriptor *epd)
+{
+   int maxp = __le16_to_cpu(epd->wMaxPacketSize);
+
+   return USB_EP_ISOC_MAXP_MULT(maxp) + 1;
+}
+
 static inline int usb_endpoint_interrupt_type(
const struct usb_endpoint_descriptor *epd)
 {


Does this mean the issue of isoc high bandwidth transfer was fixed by
this patchset per your test?

Regards
Yin, Fengwei
--
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


Re: [PATCH v5 2/2] usb: chipidea: imx: Add binding to disable USB 60Mhz clock

2016-09-26 Thread Sascha Hauer
On Wed, Sep 21, 2016 at 11:07:07AM +0200, Fabien Lahoudere wrote:
> This binding allow to disable the internal 60Mhz clock for USB host2 or
> host3.
> 
> Signed-off-by: Fabien Lahoudere 
> ---
>  Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt |  1 +
>  drivers/usb/chipidea/ci_hdrc_imx.c |  2 ++
>  drivers/usb/chipidea/ci_hdrc_imx.h |  1 +
>  drivers/usb/chipidea/usbmisc_imx.c | 13 +
>  4 files changed, 17 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt 
> b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> index 0e03344..f83da66 100644
> --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> @@ -84,6 +84,7 @@ i.mx specific properties
>  - over-current-active-high: over current signal polarity is high active,
>typically over current signal polarity is low active.
>  - external-vbus-divider: enables off-chip resistor divider for Vbus
> +- disable-int60ck: disable internal 60MHz clock for usb host2 or host3 on 
> imx53

Why do we need a binding for this? I would assume the driver should know
whether this clock is in use or not. If it doesn't that's a problem we
should solve.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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


[PATCH 2/2] usb: dwc3: gadget: set PCM1 field of isochronous-first TRBs

2016-09-26 Thread Felipe Balbi
In case of High-Speed, High-Bandwidth endpoints, we
need to tell DWC3 that we have more than one packet
per interval. We do that by setting PCM1 field of
Isochronous-First TRB.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/dwc3/gadget.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 997e82dcc55e..5f7e39407892 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -793,6 +793,9 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
unsigned length, unsigned chain, unsigned node)
 {
struct dwc3_trb *trb;
+   struct dwc3 *dwc = dep->dwc;
+   struct usb_gadget   *gadget = >gadget;
+   enum usb_device_speed   speed = gadget->speed;
 
dwc3_trace(trace_dwc3_gadget, "%s: req %p dma %08llx length %d%s",
dep->name, req, (unsigned long long) dma,
@@ -819,10 +822,17 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
break;
 
case USB_ENDPOINT_XFER_ISOC:
-   if (!node)
+   if (!node) {
trb->ctrl = DWC3_TRBCTL_ISOCHRONOUS_FIRST;
-   else
+
+   if (speed == USB_SPEED_HIGH) {
+   struct usb_ep *ep = >endpoint;
+   u8 pkts = usb_endpoint_isoc_maxp_mult(ep->desc);
+   trb->size |= DWC3_TRB_SIZE_PCM1(pkts - 1);
+   }
+   } else {
trb->ctrl = DWC3_TRBCTL_ISOCHRONOUS;
+   }
 
/* always enable Interrupt on Missed ISOC */
trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI;
-- 
2.10.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


[PATCH 1/2] usb: add helper to extract bits 12:11 of wMaxPacketSize

2016-09-26 Thread Felipe Balbi
According to USB Specification 2.0 table 9-4,
wMaxPacketSize is a bitfield. Endpoint's maxpacket
is laid out in bits 10:0. For high-speed,
high-bandwidth isochronous endpoints, bits 12:11
contain a multiplier to tell us how many
transactions we want to try per uframe.

This means that if we want an isochronous endpoint
to issue 3 transfers of 1024 bytes per uframe,
wMaxPacketSize should contain the value:

1024 | (2 << 11)

or 5120 (0x1400). In order to make Host and
Peripheral controller drivers' life easier, we're
adding a helper which returns bits 12:11. Note that
no care is made WRT to checking endpoint type and
gadget's speed. That's left for drivers to handle.

Signed-off-by: Felipe Balbi 
---
 include/uapi/linux/usb/ch9.h | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
index a8acc24765fe..73bcb24d4077 100644
--- a/include/uapi/linux/usb/ch9.h
+++ b/include/uapi/linux/usb/ch9.h
@@ -423,6 +423,11 @@ struct usb_endpoint_descriptor {
 #define USB_ENDPOINT_XFER_INT  3
 #define USB_ENDPOINT_MAX_ADJUSTABLE0x80
 
+#define USB_EP_ISOC_MAXP_MULT_SHIFT11
+#define USB_EP_ISOC_MAXP_MULT_MASK (3 << USB_EP_ISOC_MAXP_MULT_SHIFT)
+#define USB_EP_ISOC_MAXP_MULT(m) \
+   (((m) & USB_EP_ISOC_MAXP_MULT_MASK) >> USB_EP_ISOC_MAXP_MULT_SHIFT)
+
 /* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep type. */
 #define USB_ENDPOINT_INTRTYPE  0x30
 #define USB_ENDPOINT_INTR_PERIODIC (0 << 4)
@@ -630,6 +635,20 @@ static inline int usb_endpoint_maxp(const struct 
usb_endpoint_descriptor *epd)
return __le16_to_cpu(epd->wMaxPacketSize);
 }
 
+/**
+ * usb_endpoint_isoc_maxp_mult - get endpoint's transactional opportunities
+ * @epd: endpoint to be checked
+ *
+ * Return @epd's wMaxPacketSize[12:11] + 1
+ */
+static inline int
+usb_endpoint_isoc_maxp_mult(const struct usb_endpoint_descriptor *epd)
+{
+   int maxp = __le16_to_cpu(epd->wMaxPacketSize);
+
+   return USB_EP_ISOC_MAXP_MULT(maxp) + 1;
+}
+
 static inline int usb_endpoint_interrupt_type(
const struct usb_endpoint_descriptor *epd)
 {
-- 
2.10.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


Re: [PATCH] usb: gadget: udc: atmel: fix endpoint name

2016-09-26 Thread Felipe Balbi

Hi,

Greg Kroah-Hartman  writes:
> On Fri, Sep 23, 2016 at 04:20:45PM +0200, Nicolas Ferre wrote:
>> Le 16/09/2016 à 10:36, Nicolas Ferre a écrit :
>> > Le 15/09/2016 à 17:07, Alexandre Belloni a écrit :
>> >> Since commit c32b5bcfa3c4 ("ARM: dts: at91: Fix USB endpoint nodes"),
>> >> atmel_usba_udc fails with:
>> >>
>> >> [ cut here ]
>> >> WARNING: CPU: 0 PID: 0 at include/linux/usb/gadget.h:405
>> >> ecm_do_notify+0x188/0x1a0
>> >> Modules linked in:
>> >> CPU: 0 PID: 0 Comm: swapper Not tainted 4.7.0+ #15
>> >> Hardware name: Atmel SAMA5
>> >> [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
>> >> [] (show_stack) from [] (__warn+0xe4/0xfc)
>> >> [] (__warn) from [] (warn_slowpath_null+0x20/0x28)
>> >> [] (warn_slowpath_null) from [] 
>> >> (ecm_do_notify+0x188/0x1a0)
>> >> [] (ecm_do_notify) from [] (ecm_set_alt+0x74/0x1ac)
>> >> [] (ecm_set_alt) from [] 
>> >> (composite_setup+0xfc0/0x19f8)
>> >> [] (composite_setup) from [] 
>> >> (usba_udc_irq+0x8f4/0xd9c)
>> >> [] (usba_udc_irq) from [] 
>> >> (handle_irq_event_percpu+0x9c/0x158)
>> >> [] (handle_irq_event_percpu) from [] 
>> >> (handle_irq_event+0x28/0x3c)
>> >> [] (handle_irq_event) from [] 
>> >> (handle_fasteoi_irq+0xa0/0x168)
>> >> [] (handle_fasteoi_irq) from [] 
>> >> (generic_handle_irq+0x24/0x34)
>> >> [] (generic_handle_irq) from [] 
>> >> (__handle_domain_irq+0x54/0xa8)
>> >> [] (__handle_domain_irq) from [] (__irq_svc+0x54/0x70)
>> >> [] (__irq_svc) from [] (arch_cpu_idle+0x38/0x3c)
>> >> [] (arch_cpu_idle) from [] 
>> >> (cpu_startup_entry+0x9c/0xdc)
>> >> [] (cpu_startup_entry) from [] 
>> >> (start_kernel+0x354/0x360)
>> >> [] (start_kernel) from [<20008078>] (0x20008078)
>> >> ---[ end trace e7cf9dcebf4815a6 ]---
>> >>
>> >> Fixes: c32b5bcfa3c4 ("ARM: dts: at91: Fix USB endpoint nodes")
>> >> Reported-by: Richard Genoud 
>> >> Signed-off-by: Alexandre Belloni 
>> > 
>> > Acked-by: Nicolas Ferre 
>> > 
>> > Felipe, Greg,
>> > It is clearly a regression and material for 4.8-fixes. But I do know
>> > that we are very late in the process :-(
>> > Please do what you can to make it progress before 4.8-final but I'm
>> > truly aware of the challenge.
>> 
>> Any chance that we can have it (aka ping)?
>
> It's Felipe's area, not mine :)

Sorry, I had missed this one. Greg, seems like this would be the only
pending fix. Do you want it in a pull request or would you prefer to
just pick it up as a patch? Works either way for me. In case you decide
to pick it up as a patch:

Acked-by: Felipe Balbi 

If you prefer to pick it up as a pull request, I already have the patch
in my 'fixes' branch, just need to tag it and send it to you.

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH v7 0/8] power: add power sequence library

2016-09-26 Thread Peter Chen
On Tue, Sep 20, 2016 at 11:36:39AM +0800, Peter Chen wrote:
> Hi all,
> 
> This is a follow-up for my last power sequence framework patch set [1].
> According to Rob Herring and Ulf Hansson's comments[2]. The kinds of
> power sequence instances will be added at postcore_initcall, the match
> criteria is compatible string first, if the compatible string is not
> matched between dts and library, it will try to use generic power sequence.
>
> The host driver just needs to call of_pwrseq_on/of_pwrseq_off
> if only one power sequence instance is needed, for more power sequences
> are used, using of_pwrseq_on_list/of_pwrseq_off_list instead (eg, USB hub 
> driver).
> 
> In future, if there are special power sequence requirements, the special
> power sequence library can be created.
> 
> This patch set is tested on i.mx6 sabresx evk using a dts change, I use
> two hot-plug devices to simulate this use case, the related binding
> change is updated at patch [1/6], The udoo board changes were tested
> using my last power sequence patch set.[3]
> 
> Except for hard-wired MMC and USB devices, I find the USB ULPI PHY also
> need to power on itself before it can be found by ULPI bus.
> 
> [1] http://www.spinics.net/lists/linux-usb/msg142755.html
> [2] http://www.spinics.net/lists/linux-usb/msg143106.html
> [3] http://www.spinics.net/lists/linux-usb/msg142815.html
> 
> Changes for v7:
> - Create kinds of power sequence instance at postcore_initcall, and match
>   the instance with node using compatible string, the beneit of this is
>   the host driver doesn't need to consider which pwrseq instance needs
>   to be used, and pwrseq core will match it, however, it eats some memories
>   if less power sequence instances are used. [Patch 2/8]
> - Add pwrseq_compatible_sample.c to test match pwrseq using device_id. [Patch 
> 2/8]
> - Fix the comments Vaibhav Hiremath adds for error path for clock and do not
>   use device_node for parameters at pwrseq_on. [Patch 2/8]
> - Simplify the caller to use power sequence, follows Alan's commnets [Patch 
> 4/8]
> - Tested three pwrseq instances together using both specific compatible 
> string and
>   generic libraries.
> 

Hi Vaibhav, would you please test if this series can support your case,
you can add one instance like pwrseq_compatible_sample? If you are busy
now, but think this series can satisfy your requirement, please ack it.
I will delete pwrseq_compatible_sample, and only submit the generic one
at next revision, you can add it later, thanks.

Peter

> Changes for v6:
> - Add Matthias Kaehlcke's Reviewed-by and Tested-by. (patch [2/6])
> - Change chipidea core of_node assignment for coming user. (patch [5/6])
> - Applies Joshua Clayton's three dts changes for two boards,
>   the USB device's reg has only #address-cells, but without #size-cells.
> 
> Changes for v5:
> - Delete pwrseq_register/pwrseq_unregister, which is useless currently
> - Fix the linker error when the pwrseq user is compiled as module
> 
> Changes for v4:
> - Create the patch on next-20160722 
> - Fix the of_node is not NULL after chipidea driver is unbinded [Patch 5/6]
> - Using more friendly wait method for reset gpio [Patch 2/6]
> - Support multiple input clocks [Patch 2/6]
> - Add Rob Herring's ack for DT changes
> - Add Joshua Clayton's Tested-by
> 
> Changes for v3:
> - Delete "power-sequence" property at binding-doc, and change related code
>   at both library and user code.
> - Change binding-doc example node name with Rob's comments
> - of_get_named_gpio_flags only gets the gpio, but without setting gpio flags,
>   add additional code request gpio with proper gpio flags
> - Add Philipp Zabel's Ack and MAINTAINER's entry
> 
> Changes for v2:
> - Delete "pwrseq" prefix and clock-names for properties at dt binding
> - Should use structure not but its pointer for kzalloc
> - Since chipidea core has no of_node, let core's of_node equals glue
>   layer's at core's probe
> 
> Joshua Clayton (2):
>   ARM: dts: imx6qdl: Enable usb node children with 
>   ARM: dts: imx6q-evi: Fix onboard hub reset line
> 
> Peter Chen (6):
>   binding-doc: power: pwrseq-generic: add binding doc for generic power
> sequence library
>   power: add power sequence library
>   binding-doc: usb: usb-device: add optional properties for power
> sequence
>   usb: core: add power sequence handling for USB devices
>   usb: chipidea: let chipidea core device of_node equal's glue layer
> device of_node
>   ARM: dts: imx6qdl-udoo.dtsi: fix onboard USB HUB property
> 
>  .../bindings/power/pwrseq/pwrseq-generic.txt   |  48 ++
>  .../devicetree/bindings/usb/usb-device.txt |  10 +-
>  MAINTAINERS|   9 +
>  arch/arm/boot/dts/imx6q-evi.dts|  25 +--
>  arch/arm/boot/dts/imx6qdl-udoo.dtsi|  26 ++-
>  arch/arm/boot/dts/imx6qdl.dtsi |   6 +
>  drivers/power/Kconfig  |   1 +
>