28 Jan, 2015

1 commit

  • commit f40afdddeb6c54ffd1e2920a5e93e363d6748db6 upstream.

    According to the datasheet, when transfer using DMA, the control
    setting for IN packet only need END_BUF_EN, END_BUF_IE, CH_EN,
    while for OUT packet, need more two bits END_TR_EN and END_TR_IE
    to be configured.

    Fixes: 914a3f3b3754 (USB: add atmel_usba_udc driver)
    Acked-by: Nicolas Ferre
    Signed-off-by: Bo Shen
    Signed-off-by: Felipe Balbi
    Signed-off-by: Greg Kroah-Hartman

    Bo Shen
     

16 Jan, 2015

1 commit

  • commit b2ba27a5c56ff7204d8a8684893d64d4afe2cee5 upstream.

    Commit 7628083227b6bc4a7e33d7c381d7a4e558424b6b (usb: gadget: at91_udc:
    prepare clk before calling enable) added clock preparation in interrupt
    context. This is not allowed as it might sleep. Also setting the clock
    rate is unsafe to call from there for the same reason. Move clock
    preparation and setting clock rate into process context (at91udc_probe).

    Signed-off-by: Ronald Wahl
    Acked-by: Alexandre Belloni
    Acked-by: Boris Brezillon
    Acked-by: Nicolas Ferre
    Cc: Felipe Balbi
    Signed-off-by: Felipe Balbi
    Signed-off-by: Greg Kroah-Hartman

    Ronald Wahl
     

23 Oct, 2014

2 commits

  • Currently, there's no guarantee that udc->driver
    will be valid when using soft_connect sysfs
    interface. In fact, we can very easily trigger
    a NULL pointer dereference by trying to disconnect
    when a gadget driver isn't loaded.

    Fix this bug:

    ~# echo disconnect > soft_connect
    [ 33.685743] Unable to handle kernel NULL pointer dereference at virtual address 00000014
    [ 33.694221] pgd = ed0cc000
    [ 33.697174] [00000014] *pgd=ae351831, *pte=00000000, *ppte=00000000
    [ 33.703766] Internal error: Oops: 17 [#1] SMP ARM
    [ 33.708697] Modules linked in: xhci_plat_hcd xhci_hcd snd_soc_davinci_mcasp snd_soc_tlv320aic3x snd_soc_edma snd_soc_omap snd_soc_evm snd_soc_core dwc3 snd_compress snd_pcm_dmaengine snd_pcm snd_timer snd lis3lv02d_i2c matrix_keypad lis3lv02d dwc3_omap input_polldev soundcore
    [ 33.734372] CPU: 0 PID: 1457 Comm: bash Not tainted 3.17.0-09740-ga93416e-dirty #345
    [ 33.742457] task: ee71ce00 ti: ee68a000 task.ti: ee68a000
    [ 33.748116] PC is at usb_udc_softconn_store+0xa4/0xec
    [ 33.753416] LR is at mark_held_locks+0x78/0x90
    [ 33.758057] pc : [] lr : [] psr: 20000013
    [ 33.758057] sp : ee68bec8 ip : c0c00008 fp : ee68bee4
    [ 33.770050] r10: ee6b394c r9 : ee68bf80 r8 : ee6062c0
    [ 33.775508] r7 : 00000000 r6 : ee6062c0 r5 : 0000000b r4 : ee739408
    [ 33.782346] r3 : 00000000 r2 : 00000000 r1 : ee71d390 r0 : ee664170
    [ 33.789168] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
    [ 33.796636] Control: 10c5387d Table: ad0cc059 DAC: 00000015
    [ 33.802638] Process bash (pid: 1457, stack limit = 0xee68a248)
    [ 33.808740] Stack: (0xee68bec8 to 0xee68c000)
    [ 33.813299] bec0: 0000000b c0411284 ee6062c0 00000000 ee68bef4 ee68bee8
    [ 33.821862] bee0: c04112ac c04df090 ee68bf14 ee68bef8 c01c2868 c0411290 0000000b ee6b3940
    [ 33.830419] bf00: 00000000 00000000 ee68bf4c ee68bf18 c01c1a24 c01c2818 00000000 00000000
    [ 33.838990] bf20: ee61b940 ee2f47c0 0000000b 000ce408 ee68bf80 c000f304 ee68a000 00000000
    [ 33.847544] bf40: ee68bf7c ee68bf50 c0152dd8 c01c1960 ee68bf7c c0170af8 ee68bf7c ee2f47c0
    [ 33.856099] bf60: ee2f47c0 000ce408 0000000b c000f304 ee68bfa4 ee68bf80 c0153330 c0152d34
    [ 33.864653] bf80: 00000000 00000000 0000000b 000ce408 b6e7fb50 00000004 00000000 ee68bfa8
    [ 33.873204] bfa0: c000f080 c01532e8 0000000b 000ce408 00000001 000ce408 0000000b 00000000
    [ 33.881763] bfc0: 0000000b 000ce408 b6e7fb50 00000004 0000000b 00000000 000c5758 00000000
    [ 33.890319] bfe0: 00000000 bec2c924 b6de422d b6e1d226 40000030 00000001 75716d2f 00657565
    [ 33.898890] [] (usb_udc_softconn_store) from [] (dev_attr_store+0x28/0x34)
    [ 33.907920] [] (dev_attr_store) from [] (sysfs_kf_write+0x5c/0x60)
    [ 33.916200] [] (sysfs_kf_write) from [] (kernfs_fop_write+0xd0/0x194)
    [ 33.924773] [] (kernfs_fop_write) from [] (vfs_write+0xb0/0x1bc)
    [ 33.932874] [] (vfs_write) from [] (SyS_write+0x54/0xb0)
    [ 33.940247] [] (SyS_write) from [] (ret_fast_syscall+0x0/0x48)
    [ 33.948160] Code: e1a01007 e12fff33 e5140004 e5143008 (e5933014)
    [ 33.954625] ---[ end trace f849bead94eab7ea ]---

    Fixes: 2ccea03 (usb: gadget: introduce UDC Class)
    Cc: # v3.1+
    Signed-off-by: Felipe Balbi

    Felipe Balbi
     
  • If NO_DMA=y:

    drivers/built-in.o: In function `xudc_done':
    udc-xilinx.c:(.text+0x54f4d2): undefined reference to `usb_gadget_unmap_request'
    drivers/built-in.o: In function `xudc_dma_send':
    udc-xilinx.c:(.text+0x54f9f8): undefined reference to `dma_sync_single_for_cpu'
    drivers/built-in.o: In function `xudc_read_fifo':
    udc-xilinx.c:(.text+0x54ff4a): undefined reference to `dma_sync_single_for_cpu'
    drivers/built-in.o: In function `xudc_ep_queue':
    udc-xilinx.c:(.text+0x550e7c): undefined reference to `usb_gadget_map_request'

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Felipe Balbi

    Geert Uytterhoeven
     

25 Sep, 2014

3 commits

  • With this patch, USB activity can be signaled by blinking a LED. There
    are two triggers, one for activity on USB host and one for USB gadget.

    Both triggers should work with all host/device controllers. Tested only
    with musb.

    Performace: I measured performance overheads on ARM Cortex-A8 (TI
    AM335x) running on 600 MHz.

    Duration of usb_led_activity():
    - with no LED attached to the trigger: 2 ± 1 µs
    - with one GPIO LED attached to the trigger: 2 ± 1 µs or 8 ± 2 µs (two peaks in histogram)

    Duration of functions calling usb_led_activity() (with this patch
    applied and no LED attached to the trigger):
    - __usb_hcd_giveback_urb(): 10 - 25 µs
    - usb_gadget_giveback_request(): 2 - 6 µs

    Signed-off-by: Michal Sojka
    Acked-by: Felipe Balbi
    Tested-by: Felipe Balbi
    Signed-off-by: Greg Kroah-Hartman

    Michal Sojka
     
  • Use the recently introduced usb_gadget_giveback_request() in favor of
    direct invocation of the completion routine.

    All places in drivers/usb/ matching "[-.]complete(" were replaced with a
    call to usb_gadget_giveback_request(). This was compile-tested with all
    ARM drivers enabled and runtime-tested for musb.

    Signed-off-by: Michal Sojka
    Acked-by: Felipe Balbi
    Tested-by: Felipe Balbi
    Signed-off-by: Greg Kroah-Hartman

    Michal Sojka
     
  • All USB peripheral controller drivers call completion routines directly.
    This patch adds usb_gadget_giveback_request() which will be used instead
    of direct invocation in the next patch. The goal here is to have a place
    where common functionality can be added.

    Signed-off-by: Michal Sojka
    Acked-by: Felipe Balbi
    Tested-by: Felipe Balbi
    Signed-off-by: Greg Kroah-Hartman

    Michal Sojka
     

16 Sep, 2014

3 commits


12 Sep, 2014

2 commits


09 Sep, 2014

1 commit

  • Merge Linux 3.17-rc4 here so we have all the latest
    fixes on next too. This also cleans up a few conflicts
    when applying patches.

    Signed-off-by: Felipe Balbi

    Conflicts:
    drivers/usb/gadget/Makefile
    drivers/usb/gadget/function/Makefile
    drivers/usb/gadget/legacy/Makefile
    drivers/usb/phy/phy-samsung-usb.h

    Felipe Balbi
     

03 Sep, 2014

2 commits


02 Sep, 2014

1 commit


30 Aug, 2014

1 commit

  • This patch introduces the use of the functions usb_endpoint_type and
    usb_endpoint_num.

    The Coccinelle semantic patch that makes these changes is as follows:

    @@ struct usb_endpoint_descriptor *epd; @@

    - (epd->bEndpointAddress & \(USB_ENDPOINT_NUMBER_MASK\|0x0f\))
    + usb_endpoint_num(epd)

    @@ struct usb_endpoint_descriptor *epd; @@

    - (epd->bmAttributes & \(USB_ENDPOINT_XFERTYPE_MASK\|3\))
    + usb_endpoint_type(epd)

    Signed-off-by: Himangi Saraogi
    Acked-by: Julia Lawall
    Signed-off-by: Felipe Balbi

    Himangi Saraogi
     

21 Aug, 2014

1 commit


20 Aug, 2014

1 commit


19 Aug, 2014

3 commits

  • In case of error, the function devm_ioremap_resource() returns ERR_PTR()
    and never returns NULL. The NULL test in the return value check should
    be replaced with IS_ERR().

    Acked-by: Laurent Pinchart
    Signed-off-by: Wei Yongjun
    Signed-off-by: Felipe Balbi

    Wei Yongjun
     
  • As, the interrupt for DMA is counted from 1, so need to checked
    the USBA_NR_DMAS, in old way, it only check (USBA_NR_DMAS - 1),
    so fix it.

    Reported-by: Max Liao
    Signed-off-by: Bo Shen
    Signed-off-by: Felipe Balbi

    Bo Shen
     
  • Convert a zero return value on error to a negative one, as returned
    elsewhere in the function.

    A simplified version of the semantic match that finds this problem is as
    follows: (http://coccinelle.lip6.fr/)

    //
    @@
    identifier ret; expression e1,e2;
    @@
    (
    if (\(ret < 0\|ret != 0\))
    { ... return ret; }
    |
    ret = 0
    )
    ... when != ret = e1
    when != &ret
    *if(...)
    {
    ... when != ret = e2
    when forall
    return ret;
    }
    //

    Reviewed-by: Jeff Moyer
    Signed-off-by: Julia Lawall
    Signed-off-by: Felipe Balbi

    Julia Lawall
     

22 Jul, 2014

1 commit


17 Jul, 2014

4 commits