1. 05 3月, 2014 7 次提交
    • F
      usb: dwc3: workaround: clock gating issues · 32a4a135
      Felipe Balbi 提交于
      Revisions between 2.10a and 2.50a (included) have
      a known issue which may cause xHCI compliance tests
      to fail and/or quality issues with Isochronous
      transactions.
      
      Note that this issue only impacts certain configurations
      of those revisions, namely the ones which have clock
      gating enabled.
      
      The suggested workaround is to disable clock gating in
      known broken revisions, make sure HW LPM is disabled
      and set GCTL.SOFITPSYNC to 1.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      32a4a135
    • F
      usb: dwc3: core: define bit 10 of GCTL register · 183ca111
      Felipe Balbi 提交于
      This bit is necessary for implemeting workaround
      for known issue with some revisions of this core.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      183ca111
    • F
      usb: dwc3: gadget: always enable IOC on bulk/interrupt transfers · f3af3651
      Felipe Balbi 提交于
      by setting IOC always, we can recycle TRBs a
      lot sooner at the expense of some increased
      CPU load.
      
      The extra load seems to be quite minimal on
      OMAP5 devices (instead of 1 IRQ for one MSC
      transfer, we get
      CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS).
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      f3af3651
    • R
      usb: gadget: at91_udc: fix ep maxpacket initialisation · 0e06bcac
      Robert Baldyga 提交于
      This patch fixes problem with unnecessary usb_ep_set_maxpacket_limit() usage.
      It should not be used in at91udc_probe() function, where maxpacket values are
      set for field "maxpacket" of struct at91_ep, which is representation of
      endpoint in driver internals. Function usb_ep_set_maxpacket_limit() is called
      in udc_reinit() function, where struct usb_ep instances are initialised with
      values set previously in struct at91_ep instances. So it's very important to
      initialise it properly.
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      0e06bcac
    • G
      usb: musb: USB_MUSB_DUAL_ROLE/USB_MUSB_GADGET should depend on HAS_DMA · 3f83e538
      Geert Uytterhoeven 提交于
      If NO_DMA=y:
      
          drivers/built-in.o: In function `txstate':
          musb_gadget.c:(.text+0x35955a): undefined reference to `dma_unmap_single'
          musb_gadget.c:(.text+0x35957e): undefined reference to `dma_sync_single_for_cpu'
          drivers/built-in.o: In function `musb_g_giveback':
          (.text+0x359672): undefined reference to `dma_mapping_error'
          drivers/built-in.o: In function `musb_g_giveback':
          (.text+0x3596ba): undefined reference to `dma_unmap_single'
          drivers/built-in.o: In function `musb_g_giveback':
          (.text+0x3596e0): undefined reference to `dma_sync_single_for_cpu'
          drivers/built-in.o: In function `rxstate':
          musb_gadget.c:(.text+0x3599d0): undefined reference to `dma_unmap_single'
          musb_gadget.c:(.text+0x3599f6): undefined reference to `dma_sync_single_for_cpu'
          drivers/built-in.o: In function `musb_gadget_queue':
          musb_gadget.c:(.text+0x35a8c0): undefined reference to `dma_map_single'
          musb_gadget.c:(.text+0x35a8d0): undefined reference to `dma_mapping_error'
          musb_gadget.c:(.text+0x35a906): undefined reference to `dma_sync_single_for_cpu'
          musb_gadget.c:(.text+0x35a9a0): undefined reference to `dma_unmap_single'
          musb_gadget.c:(.text+0x35a9c8): undefined reference to `dma_sync_single_for_cpu'
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      3f83e538
    • S
      usb: phy: rcar-gen2-usb: always use 'dev' variable in probe() method · 7241a21a
      Sergei Shtylyov 提交于
      The probe() method has the 'dev' local variable declared and used but strangely
      not in all cases where it should be...
      Signed-off-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      7241a21a
    • F
      usb: musb: avoid NULL pointer dereference · eee3f15d
      Felipe Balbi 提交于
      instead of relying on the otg pointer, which
      can be NULL in certain cases, we can use the
      gadget and host pointers we already hold inside
      struct musb.
      
      Cc: <stable@vger.kernel.org>
      Tested-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      eee3f15d
  2. 20 2月, 2014 5 次提交
  3. 19 2月, 2014 19 次提交
    • R
      usb: gadget: f_fs: add aio support · 2e4c7553
      Robert Baldyga 提交于
      This patch adds asynchronous I/O support for FunctionFS endpoint files.
      It adds ffs_epfile_aio_write() and ffs_epfile_aio_read() functions responsible
      for preparing AIO operations.
      
      It also modifies ffs_epfile_io() function, adding aio handling code. Instead
      of extending list of parameters of this function, there is new struct
      ffs_io_data which contains all information needed to perform I/O operation.
      Pointer to this struct replaces "buf" and "len" parameters of ffs_epfile_io()
      function. Allocated buffer is freed immediately only after sync operation,
      because in async IO it's freed in complete funcion. For each async operation
      an USB request is allocated, because it allows to have more than one request
      queued on single endpoint.
      
      According to changes in ffs_epfile_io() function, functions ffs_epfile_write()
      and ffs_epfile_read() are updated to use new API.
      
      For asynchronous I/O operations there is new request complete function named
      ffs_epfile_async_io_complete(), which completes AIO operation, and frees
      used memory.
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      2e4c7553
    • R
      usb: gadget: f_fs: add poll for endpoint 0 · 23de91e9
      Robert Baldyga 提交于
      This patch adds poll function for file representing ep0.
      
      Ability of read from or write to ep0 file is related with actual state of ffs:
      - When desctiptors or strings are not written yet, POLLOUT flag is set.
      - If there is any event to read, POLLIN flag is set.
      - If setup request was read, POLLIN and POLLOUT flag is set, to allow
        send response (by performing I/O operation consistent with setup request
        direction) or set stall (by performing I/O operation opposite  setup
        request direction).
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      23de91e9
    • R
      usb: gadget: f_fs: fix setup request handling · 0a7b1f8a
      Robert Baldyga 提交于
      This patch fixes __ffs_ep0_queue_wait() function, which now returns number of
      bytes transferred in USB request or error code in case of failure. This is
      needed by ffs_ep0_read() function, when read data is copied to userspace.
      
      It also cleans up code by removing usused variable ep0req_status.
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      0a7b1f8a
    • M
      usb: gadget: functionfs: replace FFS_SETUP_STATUS with an inline function · a7ecf054
      Michal Nazarewicz 提交于
      The FFS_SETUP_STATUS macro could be trivialy replaced with an static
      inline function but more importantly its name was tad confusing.
      The name suggested it was a simple accessor macro but it actually
      did change the state of the ffs_data structure perfomring
      a FFS_SETUP_CANCELLED -> FFS_NO_SETUP transition.  The name of the
      function -- ffs_setup_state_clear_cancelled -- should better
      describe what the function actually does.
      Signed-off-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      a7ecf054
    • M
      usb: gadget: functionfs: fix typo in the enum variable · e46318a0
      Michal Nazarewicz 提交于
      Since “cancelled” is spelled with two “l”s, rename FFS_SETUP_CANCELED
      to FFS_SETUP_CANCELLED.
      Signed-off-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      e46318a0
    • A
      usb: gadget: FunctionFS: use consistent naming with regard to ffs_lock · da13a773
      Andrzej Pietrasiewicz 提交于
      Consistently prefix function name with underscore if the function has to
      be called with ffs_lock taken.
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      da13a773
    • A
      usb: gadget: FunctionFS: staticize functions used only in f_fs.c · 10b69ce0
      Andrzej Pietrasiewicz 提交于
      ffs_alloc_dev and ffs_free_dev are used only in f_fs.c,
      so make them static.
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      10b69ce0
    • A
      usb: gadget: code cleanup · ab13cb0c
      Andrzej Pietrasiewicz 提交于
      Remove trailing whitespace
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      ab13cb0c
    • A
      usb: gadget: FunctionFS: dereference ffs_dev conditionally · ea365922
      Andrzej Pietrasiewicz 提交于
      ffs_dev->ffs_release_dev_callback should be accessed only if ffs_dev
      is not NULL.
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      ea365922
    • M
      usb: musb: dsps, use devm_kzalloc · de9db572
      Markus Pargmann 提交于
      Replace kzalloc by devm_kzalloc and remove the kfree() calls.
      Signed-off-by: NMarkus Pargmann <mpa@pengutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      de9db572
    • W
      usb: dwc3: omap: don't check resource with devm_ioremap_resource · 30bbae9f
      Wolfram Sang 提交于
      devm_ioremap_resource does sanity checks on the given resource. No need to
      duplicate this in the driver.
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      30bbae9f
    • R
      usb: gadget: s3c-hsotg: stall ep0 in set_halt function · c9f721b2
      Robert Baldyga 提交于
      When s3c_hsotg_ep_sethalt() function is called for ep0 it should be stalled
      in the same way that it is in s3c_hsotg_process_control() function, because
      SET_HALT for ep0 is delayed response for setup request. Endpoint 0, if
      halted, it doesn't need CLEAR_HALT because it clears "stalled" state
      automatically when next setup request is received.
      
      For this reason this patch moves code setting ep0 to "stalled" state to new
      function named s3c_hsotg_stall_ep0() which is called in
      s3c_hsotg_process_control() function as an immediate response for setup
      request, and in s3c_hsotg_ep_sethalt() function as a delayed response for
      setup request.
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      c9f721b2
    • W
      usb: gadget: printer: fix memory leak · 7e98f600
      wenlin.kang 提交于
      When read data from g_printer, we see a Segmentation fault. eg:
      
      Unable to handle kernel paging request at virtual address bf048000 pgd
      = cf038000 [bf048000] *pgd=8e8cf811, *pte=00000000, *ppte=00000000
      Internal error: Oops: 7 [#1] PREEMPT ARM Modules linked in: bluetooth
      rfcomm g_printer
      CPU: 0    Not tainted  (3.4.43-WR5.0.1.9_standard #1)
      PC is at __copy_to_user_std+0x310/0x3a8 LR is at 0x4c808010
      pc : [<c036e990>]    lr : [<4c808010>]    psr: 20000013
      sp : cf883ea8  ip : 80801018  fp : cf883f24
      r10: bf04706c  r9 : 18a21205  r8 : 21953888
      r7 : 201588aa  r6 : 5109aa16  r5 : 0705aaa2  r4 : 5140aa8a
      r3 : 0000004c  r2 : 00000fdc  r1 : bf048000  r0 : bef5fc3c
      Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
      Control: 10c5387d  Table: 8f038019  DAC: 00000015 Process
      g_printer_test. (pid: 661, stack limit = 0xcf8822e8)
      Stack: (0xcf883ea8 to 0xcf884000)
      3ea0:                   bf047068 00001fff bef5ecb9 cf882000 00001fff bef5ecb9
      3ec0: 00001fff 00000000 cf2e8724 bf044d3c 80000013 80000013 00000001
      bf04706c
      3ee0: cf883f24 cf883ef0 c012e5ac c0324388 c007c8ac c0046298 00008180
      cf29b900
      3f00: 00002000 bef5ecb8 cf883f68 00000003 cf882000 cf29b900 cf883f54
      cf883f28
      3f20: c012ea08 bf044b0c c000eb88 00000000 cf883f7c 00000000 00000000
      00002000
      3f40: bef5ecb8 00000003 cf883fa4 cf883f58 c012eae8 c012e960 00000001
      bef60cb8
      3f60: 000000a8 c000eb88 00000000 00000000 cf883fa4 00000000 c014329c
      00000000
      3f80: 000000d4 41af63f0 00000003 c000eb88 cf882000 00000000 00000000
      cf883fa8
      3fa0: c000e920 c012eaa4 00000000 000000d4 00000003 bef5ecb8 00002000
      bef5ecb8
      3fc0: 00000000 000000d4 41af63f0 00000003 b6f534c0 00000000 419f9000
      00000000
      3fe0: 00000000 bef5ecac 000086d9 41a986bc 60000010 00000003 0109608a
      0088828a
      Code: f5d1f07c e8b100f0 e1a03c2e e2522020 (e8b15300) ---[ end trace
      97e2618e250e3377 ]--- Segmentation fault
      
      The root cause is the dev->rx_buffers list has been broken.
      When we call printer_read(), the following call tree is triggered:
      
      printer_read()
      	|
      	+---setup_rx_reqs(req)
      	|	|
      	|	+---usb_ep_queue(req)
      	|	|	|
      	|	|	+---...
      	|	|		|
      	|	|		+---rx_complete(req).
      	|	|
      	|	+---add the req to dev->rx_reqs_active
      	|
      	+---while(!list_empty(&dev->rx_buffers)))
      
      The route happens when we don't use DMA or fail to start DMA in USB
      driver. We can see: in the case, in rx_complete() it will add the req
      to dev->rx_buffers. meanwhile we see that we will also add the req to
      dev->rx_reqs_active after usb_ep_queue() return, so this adding will
      break the dev->rx_buffers out.
      
      After, when we call list_empty() to check dev->rx_buffers in while(),
      due to can't check correctly dev->rx_buffers, so the Segmentation fault
      occurs when copy_to_user() is called.
      Signed-off-by: Nwenlin.kang <wenlin.kang@windriver.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      7e98f600
    • W
      usb: gadget: printer: fix possible deadlock · 2c2b0425
      wenlin.kang 提交于
      The problem occurs in follow path.
      
      printer_read()
      	|
      	+---setup_rx_reqs()
      		|
      		+---usb_ep_queue()
      			|
      			+---...
      				|
      				+---rx_complete()
      
      Although it is clear from code, we can't get it normally.
      only when we enable some spin_lock debug config option, we can find it.
      eg:
      BUG: spinlock lockup on CPU#0, g_printer_test_/584
       lock: bf05e158, .magic: dead4ead, .owner: g_printer_test_/584, .owner_cpu: 0
      [<c0016e1c>] (unwind_backtrace+0x0/0x104) from [<c067aef8>] (dump_stack+0x20/0x24)
      [<c067aef8>] (dump_stack+0x20/0x24) from [<c0680bec>] (spin_dump+0x8c/0x94)
      [<c0680bec>] (spin_dump+0x8c/0x94) from [<c039071c>] (do_raw_spin_lock+0x128/0x154)
      [<c039071c>] (do_raw_spin_lock+0x128/0x154) from [<c0685618>] (_raw_spin_lock_irqsave+0x64/0x70)
      [<c0685618>] (_raw_spin_lock_irqsave+0x64/0x70) from [<bf05b4e8>] (rx_complete+0x54/0x10c [g_printer])
      [<bf05b4e8>] (rx_complete+0x54/0x10c [g_printer]) from [<c0480478>] (musb_g_giveback+0x78/0x88)
      [<c0480478>] (musb_g_giveback+0x78/0x88) from [<c048060c>] (rxstate+0xa0/0x10c)
      [<c048060c>] (rxstate+0xa0/0x10c) from [<c0480d50>] (musb_ep_restart+0x44/0x70)
      [<c0480d50>] (musb_ep_restart+0x44/0x70) from [<c0480fe4>] (musb_gadget_queue+0xe8/0xf8)
      [<c0480fe4>] (musb_gadget_queue+0xe8/0xf8) from [<bf05b2b0>] (setup_rx_reqs+0xa4/0x178 [g_printer])
      [<bf05b2b0>] (setup_rx_reqs+0xa4/0x178 [g_printer]) from [<bf05bb58>] (printer_read+0x9c/0x3f4 [g_printer])
      [<bf05bb58>] (printer_read+0x9c/0x3f4 [g_printer]) from [<c01387f0>] (vfs_read+0xb4/0x144)
      [<c01387f0>] (vfs_read+0xb4/0x144) from [<c01388d0>] (sys_read+0x50/0x124)
      [<c01388d0>] (sys_read+0x50/0x124) from [<c000e900>] (ret_fast_syscall+0x0/0x3c)
      
      The root cause is that we use the same lock two time in a path, so to avoid
      the deadlock, we need to unlock in setup_rx_reqs(), and only unlock.
      Signed-off-by: Nwenlin.kang <wenlin.kang@windriver.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      2c2b0425
    • S
      usb: gadget: s3c-hsudc: remove unused label · 236064c2
      Sachin Kamat 提交于
      Fixes the following compilation warning:
      drivers/usb/gadget/s3c-hsudc.c: In function ‘s3c_hsudc_probe’:
      drivers/usb/gadget/s3c-hsudc.c:1347:1: warning: label ‘err_add_device’
      defined but not used [-Wunused-label]
      Signed-off-by: NSachin Kamat <sachin.kamat@linaro.org>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      236064c2
    • S
      usb: gadget: s3c2410_udc: Fix build error · e362115a
      Sachin Kamat 提交于
      Pass value instead of address as expected by 'usb_ep_set_maxpacket_limit'.
      Fixes the following compilation error introduced by commit e117e742
      ("usb: gadget: add "maxpacket_limit" field to struct usb_ep"):
      
      drivers/usb/gadget/s3c2410_udc.c: In function ‘s3c2410_udc_reinit’:
      drivers/usb/gadget/s3c2410_udc.c:1632:3: error:
      cannot take address of bit-field ‘maxpacket’
         usb_ep_set_maxpacket_limit(&ep->ep, &ep->ep.maxpacket);
      Signed-off-by: NSachin Kamat <sachin.kamat@linaro.org>
      Reviewed-by: NRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      e362115a
    • J
      usb: gadget: fix error return code · abcdcc29
      Julia Lawall 提交于
      Set the return variable to an error code as done elsewhere in the function.
      
      A simplified version of the semantic match that finds this problem is as
      follows: (http://coccinelle.lip6.fr/)
      
      // <smpl>
      (
      if@p1 (\(ret < 0\|ret != 0\))
       { ... return ret; }
      |
      ret@p1 = 0
      )
      ... when != ret = e1
          when != &ret
      *if(...)
      {
        ... when != ret = e2
            when forall
       return ret;
      }
      
      // </smpl>
      Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      abcdcc29
    • J
      usb: gadget: s3c-hsotg: use %pad for dma_addr_t · 8b3bc14f
      Jingoo Han 提交于
      Use %pad for dma_addr_t to avoid the following build warnings
      in printks.
      
      drivers/usb/gadget/s3c-hsotg.c: In function 's3c_hsotg_start_req'
      drivers/usb/gadget/s3c-hsotg.c:722:3: warning: format '%x' expects argument of type 'unsigned int' but argument 6 has type
      'dma_addr_t' [-Wformat]
      drivers/usb/gadget/s3c-hsotg.c:792:3: warning: format '%x' expects argument of type 'unsigned int' but argument 5 has type
      'dma_addr_t' [-Wformat]
      Signed-off-by: NJingoo Han <jg1.han@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      8b3bc14f
    • M
      usb: gadget: s3c-hsotg: fix build on x86 and other architectures · 1a7ed5be
      Matt Porter 提交于
      The readsl and writesl I/O accessors are only defined on some
      architectures. The driver currently depends on CONFIG_ARM because
      the build breaks on x86, in particular. Switch to use of ioread32_rep
      and iowrite32_rep to fix build on all architectures and remove the
      CONFIG_ARM dependency.
      
      Also update printk formatting to handle a long long dma_addr_t to avoid
      warnings on !32-bit architectures.
      Signed-off-by: NMatt Porter <mporter@linaro.org>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      1a7ed5be
  4. 18 2月, 2014 3 次提交
  5. 16 2月, 2014 5 次提交
  6. 12 2月, 2014 1 次提交