1
0
Fork 0
Commit Graph

382 Commits (1475314530bb63b96be1623faa55c9709b7ca24f)

Author SHA1 Message Date
Yoshihiro Shimoda 15e4292a2d usb: renesas_usbhs: protect the CFIFOSEL setting in usbhsg_ep_enable()
This patch fixes an issue that the CFIFOSEL register value is possible
to be changed by usbhsg_ep_enable() wrongly. And then, a data transfer
using CFIFO may not work correctly.

For example:
 # modprobe g_multi file=usb-storage.bin
 # ifconfig usb0 192.168.1.1 up
 (During the USB host is sending file to the mass storage)
 # ifconfig usb0 down

In this case, since the u_ether.c may call usb_ep_enable() in
eth_stop(), if the renesas_usbhs driver is also using CFIFO for
mass storage, the mass storage may not work correctly.

So, this patch adds usbhs_lock() and usbhs_unlock() calling in
usbhsg_ep_enable() to protect CFIFOSEL register. This is because:
 - CFIFOSEL.CURPIPE = 0 is also needed for the pipe configuration
 - The CFIFOSEL (fifo->sel) is already protected by usbhs_lock()

Fixes: 97664a207b ("usb: renesas_usbhs: shrink spin lock area")
Cc: <stable@vger.kernel.org> # v3.1+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-06-29 11:14:44 +03:00
Yoshihiro Shimoda 4fdef69838 usb: renesas_usbhs: fix NULL pointer dereference in xfer_work()
This patch fixes an issue that the xfer_work() is possible to cause
NULL pointer dereference if the usb cable is disconnected while data
transfer is running.

In such case, a gadget driver may call usb_ep_disable()) before
xfer_work() is actually called. In this case, the usbhs_pkt_pop()
will call usbhsf_fifo_unselect(), and then usbhs_pipe_to_fifo()
in xfer_work() will return NULL.

Fixes: e73a989 ("usb: renesas_usbhs: add DMAEngine support")
Cc: <stable@vger.kernel.org> # v3.1+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-06-29 11:14:33 +03:00
Yoshihiro Shimoda 0d7995031a usb: renesas_usbhs: show error code when probe failed
To know why the driver probing failed, this patch shows error code.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-06-29 11:07:27 +03:00
Ben Dooks 7099258819 usb: renesas_usbhs: make usbhs_write32() static
The usbhs_write32 function is not used outside of the rcar3.c
file, so fix the following sparse warning by making it static:

drivers/usb/renesas_usbhs/rcar3.c:26:6: warning: symbol 'usbhs_write32' was not declared. Should it be static?

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-06-22 11:16:07 +03:00
Sudip Mukherjee 72f595f3b5 usb: renesas_usbhs: fix signed-unsigned return
The return type of usbhsp_setup_pipecfg() was u16 but it was returning
a negative value (-EINVAL). Lets have an additional argument which will
have pipecfg and just return the status (success or error) as the return
from the function.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-05-03 14:32:07 -07:00
Yoshihiro Shimoda b41d8a6a01 usb: renesas_usbhs: use usb_gadget_{un}map_request_by_dev() for IPMMU
The previous code could use the first USB-DMAC with IPMMU if iommus
property was set into this device node. However, in this case, it
could not control the second USB-DMAC with IPMMU because a parameter
of IPMMU (micro-TLB id) is different with each USB-DMAC.

So, this patch uses the usb_gadget_{un}map_request_by_dev() APIs for
IPMMU. (Then, iommus property should be set into USB-DMAC node(s).)

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-04-19 11:11:55 +03:00
Yoshihiro Shimoda c3cdcac786 usb: renesas_usbhs: change arguments of dma_map_ctrl()
Since usbhsg_dma_map_ctrl() needs DMA device structure in the near future,
this patch changes arguments of dma_map_ctrl() to give such data.
(This patch is only change the argument.)

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-04-19 11:11:54 +03:00
Yoshihiro Shimoda e789ece182 usb: renesas_usbhs: change function call orfer in usbhsf_dma_prepare_push()
Since usbhsf_dma_{un}map() will use the "fifo" data in the near future,
this patch changes function call orfer in usbhsf_dma_prepare_push().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-04-19 11:11:54 +03:00
Yoshihiro Shimoda 4fccb0767f usb: renesas_usbhs: fix to avoid using a disabled ep in usbhsg_queue_done()
This patch fixes an issue that usbhsg_queue_done() may cause kernel
panic when dma callback is running and usb_ep_disable() is called
by interrupt handler. (Especially, we can reproduce this issue using
g_audio with usb-dmac driver.)

For example of a flow:
 usbhsf_dma_complete (on tasklet)
  --> usbhsf_pkt_handler (on tasklet)
   --> usbhsg_queue_done (on tasklet)
    *** interrupt happened and usb_ep_disable() is called ***
    --> usbhsg_queue_pop (on tasklet)
     Then, oops happened.

Fixes: e73a989 ("usb: renesas_usbhs: add DMAEngine support")
Cc: <stable@vger.kernel.org> # v3.1+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-04-04 15:18:48 +03:00
Yoshihiro Shimoda 6490865c67 usb: renesas_usbhs: disable TX IRQ before starting TX DMAC transfer
This patch adds a code to surely disable TX IRQ of the pipe before
starting TX DMAC transfer. Otherwise, a lot of unnecessary TX IRQs
may happen in rare cases when DMAC is used.

Fixes: e73a989 ("usb: renesas_usbhs: add DMAEngine support")
Cc: <stable@vger.kernel.org> # v3.1+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-03-30 16:02:53 +03:00
Yoshihiro Shimoda 894f2fc44f usb: renesas_usbhs: avoid NULL pointer derefernce in usbhsf_pkt_handler()
When unexpected situation happened (e.g. tx/rx irq happened while
DMAC is used), the usbhsf_pkt_handler() was possible to cause NULL
pointer dereference like the followings:

Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 80000007 [#1] SMP ARM
Modules linked in: usb_f_acm u_serial g_serial libcomposite
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.5.0-rc6-00842-gac57066-dirty #63
Hardware name: Generic R8A7790 (Flattened Device Tree)
task: c0729c00 ti: c0724000 task.ti: c0724000
PC is at 0x0
LR is at usbhsf_pkt_handler+0xac/0x118
pc : [<00000000>]    lr : [<c03257e0>]    psr: 60000193
sp : c0725db8  ip : 00000000  fp : c0725df4
r10: 00000001  r9 : 00000193  r8 : ef3ccab4
r7 : ef3cca10  r6 : eea4586c  r5 : 00000000  r4 : ef19ceb4
r3 : 00000000  r2 : 0000009c  r1 : c0725dc4  r0 : ef19ceb4

This patch adds a condition to avoid the dereference.

Fixes: e73a989 ("usb: renesas_usbhs: add DMAEngine support")
Cc: <stable@vger.kernel.org> # v3.1+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-03-30 16:02:37 +03:00
Yoshihiro Shimoda 11ebf3ad3b usb: renesas_usbhs: gadget: fix giveback status code in usbhsg_pipe_disable()
A udc driver should set the giveback status to -ESHUTDOWN in
usb_ep_disable(). Otherwise, a gadget driver (e.g. g_serial) might
request next data wrongly and it is possible to cause kernel panic.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
2016-03-04 15:14:48 +02:00
Yoshihiro Shimoda 21a596c17b usb: renesas_usbhs: Don't check CSSTS bit if peripheral mode
Since Some SoCs (e.g. R-Car Gen2) don't have the CSSTS bit in the
pipectrl registers ({DCP,PIPEn}CTR) because such SoCs have peripheral
mode only. So, this driver should not check the CSSTS bit if peripheral
mode is running.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
2016-03-04 15:14:28 +02:00
Yoshihiro Shimoda de18757e27 usb: renesas_usbhs: add R-Car Gen3 power control
Since the usb2 phy driver for gen3 (phy-rcar-gen3-usb2) cannot access
LPSTS and UGCTRL2 registers in the HSUSB module, this driver have to
initialize the registers. So, this patch adds such handling code into
rcar3.c.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
2016-03-04 15:14:28 +02:00
Simon Horman a1cd225650 usb: renesas_usbhs: Use ARCH_RENESAS
Make use of ARCH_RENESAS in place of ARCH_SHMOBILE.

This is part of an ongoing process to migrate from ARCH_SHMOBILE to
ARCH_RENESAS the motivation for which being that RENESAS seems to be a more
appropriate name than SHMOBILE for the majority of Renesas ARM based SoCs.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 20:21:53 -08:00
Julia Lawall fcb42e232a usb: renesas_usbhs: constify usbhs_pkt_handle structures
The usbhs_pkt_handle structures are never modified, so declare them as
const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 19:45:09 -08:00
Simon Horman 2f1a993a0d usb: renesas_usbhs: add fallback compatibility strings
Add fallback compatibility strings for R-Car Gen2 and Gen3.
This is in keeping with the fallback scheme being adopted wherever
appropriate for drivers for Renesas SoCs.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-12-16 10:53:51 -06:00
Yoshihiro Shimoda 64c5f48b10 usb: renesas_usbhs: Modify ep.caps.type_xxx and usb_ep_maxpacket_limit()
This patch modifies the ep.caps.type_{iso,bulk,int} setting and
the second argument of usb_ep_maxpacket_limit() using
the dparam.pipe_configs.

In the previous code, all the type_{iso,bulk,int} were set to true.
However, to avoid waste time for finding suitable pipe in usb_ep_enable(),
this driver should set correct type.
Also the second argument of usb_ep_maxpacket_limit() was set to 512
even if the pipe is isochronous or interrupt. So, this driver could
not bind a gadget driver like the g_audio driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-12-15 09:12:41 -06:00
Yoshihiro Shimoda 51f141a97a usb: renesas_usbhs: Modify pipe configuration
The current code has info->bufnmb_last to calculate the BUFNMB bits of
PIPEBUF register. However, since the bufnmb_last is initialized in
the usbhs_pipe_init() only, this driver is possible to set unexpected
value to the register if usb_ep_{enable,disable}() are called many times.

So, this patch modifies the pipe configuration via struct
renesas_usbhs_driver_param to simplify the code. Also this patch changes:
 - a double buffer configuration
 - isochronous buffer size from 512 to 1024

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-12-15 09:12:41 -06:00
Yoshihiro Shimoda c9eb29503e usb: renesas_usbhs: gadget: Fix NULL pointer dereference in usbhsg_ep_dequeue()
This patch fixes an issue that NULL pointer dereference happens when
a gadget driver calls usb_ep_dequeue() for ep0 after disconnected
a usb cable. This is because that usbhsg_try_stop() will call
usbhsg_ep_disable(&dcp->ep) when a usb cable is disconnected and
the pipe of dcp (ep0) is set to NULL.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-11-19 14:48:48 -06:00
Linus Torvalds bc9d8c20ff This is the big bulk of pin control changes for the
v4.4 kernel development cycle:
 
 Infrastructure:
 - Doug Anderson wrote a patch adding an "init" state
   different from the "default" state for pin control
   state handling in the core framework. This is applied
   before the driver's probe() call if defined and takes
   precedence over "default". If both are defined, "init"
   will be applied *before* probe() and "default" will be
   applied *after* probe().
 
 Significant subdriver improvements:
 - SH PFC is switched to getting GPIO ranges from the
   device tree ranges property on DT platforms.
 - Got rid of CONFIG_ARCH_SHMOBILE_LEGACY, we are all
   modernized.
 - Got rid of SH PFC hardcoded IRQ numbers.
 - Allwinner sunxi external interrupt through the "r"
   controller.
 - Moved the Cygnus driver to use DT-provided GPIO
   ranges.
 
 New drivers:
 - Atmel PIO4 pin controller for the SAMA4D2 family
 
 New subdrivers:
 - Rockchip RK3036 subdriver
 - Renesas SH PFC R8A7795 subdriver
 - Allwinner sunxi A83T PIO subdriver
 - Freescale i.MX7d iomux lpsr subdriver
 - Marvell Berlin BG4CT subdriver
 - SiRF Atlas 7 step B SoC subdriver
 - Intel Broxton SoC subdriver
 
 Apart from this, the usual slew if syntactic and semantic
 fixes.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWNzaFAAoJEEEQszewGV1zth0QAIWBhrEFeZNw3yewSwtawBin
 Q+5hxxld7YWeYykK/phRw+nru+tRmRKd72uZbiA/OHDFmXdlF7ecQC+D2ByAT/a3
 /d61BPtuT0tzmiZTmYSdbivBZzXjs9UrbEsGe2MXgf2WJuzZU/2EiQwCxklDfiX6
 BWa0lcL9+ikVRh53xGoEps/5KVOkXSlPDq/twXp6Trd6B1k+opPqKHf7UNxb0BvK
 0QoNPDYBTb93Z9iIItQdAGNCD/JMllywpUcqK+tPdQoRdrqlAcdRlUdXI7rdtvGw
 O3O2/MTBrGI7pxCNxBPGi9+niM6qtLrwKeQx8iIe0ieTIrUCCdg3vftUXctxXHkC
 +GxKLQGO/aMqW/4O8J+voAOD5HiGc+heoJsQEWoysoooWos/IxVJiiCKy5RNTk7g
 ECbzQvu7kbwTnwNXbxAc5ocdwhQ6HpJe2X2S52zTpDscfK8HcOow0hmf9m2EI4hV
 ikf47WJQIN9zunJloiJ3oZveK0Eytx1hH/47gcFRwr0KV/DK0KngvxnPWlB2nzlc
 pggkVnkHXczCyqBfDhZomILnTK2aDt6RKUZhz4w1s8ezK2EDn8Vvt3Qm7wOIeWvR
 xiY7XVoO+AYOywuFsbNxkt28Y8h5yQxu/AV6/rYSn+NYCZcLxKbcrVEiY2N6ecCA
 x74epIdnjA8F7S3Xp14q
 =0t3B
 -----END PGP SIGNATURE-----

Merge tag 'pinctrl-v4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull pin control updates from Linus Walleij:
 "This is the big bulk of pin control changes for the v4.4 kernel
  development cycle.  Development pace is high in pin control again this
  merge window.  28 contributors, 83 patches.

  It hits a few sites outside the pin control subsystem:

   - Device tree bindings in Documentation (as usual)
   - MAINTAINERS
   - drivers/base/* for the "init" state handling by Doug Anderson.
     This has been ACKed by Greg.
   - drivers/usb/renesas_usbhs/rcar2.c, for a dependent Renesas change
     in the USB subsystem.  This has been ACKed by both Greg and Felipe.
   - arch/arm/boot/dts/sama5d2.dtsi - this should ideally have gone
     through the ARM SoC tree but ended up here.

  This time I am using Geert Uytterhoeven as submaintainer for SH PFC
  since the are three-four people working in parallel with new Renesas
  ASICs.

  Summary of changes:

  Infrastructure:

   - Doug Anderson wrote a patch adding an "init" state different from
     the "default" state for pin control state handling in the core
     framework.  This is applied before the driver's probe() call if
     defined and takes precedence over "default".  If both are defined,
     "init" will be applied *before* probe() and "default" will be
     applied *after* probe().

  Significant subdriver improvements:

   - SH PFC is switched to getting GPIO ranges from the device tree
     ranges property on DT platforms.
   - Got rid of CONFIG_ARCH_SHMOBILE_LEGACY, we are all modernized.
   - Got rid of SH PFC hardcoded IRQ numbers.
   - Allwinner sunxi external interrupt through the "r" controller.
   - Moved the Cygnus driver to use DT-provided GPIO ranges.

  New drivers:

   - Atmel PIO4 pin controller for the SAMA4D2 family

  New subdrivers:

   - Rockchip RK3036 subdriver
   - Renesas SH PFC R8A7795 subdriver
   - Allwinner sunxi A83T PIO subdriver
   - Freescale i.MX7d iomux lpsr subdriver
   - Marvell Berlin BG4CT subdriver
   - SiRF Atlas 7 step B SoC subdriver
   - Intel Broxton SoC subdriver

  Apart from this, the usual slew if syntactic and semantic fixes"

* tag 'pinctrl-v4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (81 commits)
  pinctrl: pinconf: remove needless loop
  pinctrl: uniphier: guard uniphier directory with CONFIG_PINCTRL_UNIPHIER
  pinctrl: zynq: fix UTF-8 errors
  pinctrl: zynq: Initialize early
  pinctrl: at91: add missing of_node_put
  pinctrl: tegra-xusb: Correct lane mux options
  pinctrl: intel: Add Intel Broxton pin controller support
  pinctrl: intel: Allow requesting pins which are in ACPI mode as GPIOs
  pinctrl: intel: Add support for multiple GPIO chips sharing the interrupt
  drivers/pinctrl: Add the concept of an "init" state
  pinctrl: uniphier: set input-enable before pin-muxing
  pinctrl: cygnus: Add new compatible string for gpio controller driver
  pinctrl: cygnus: Remove GPIO to Pinctrl pin mapping from driver
  pinctrl: cygnus: Optional DT property to support pin mappings
  pinctrl: sunxi: Add irq pinmuxing to sun6i "r" pincontroller
  pinctrl: sunxi: Fix irq_of_xlate for the r_pio pinctrl block
  pinctrl: sh-pfc: Remove obsolete r8a7778 platform_device_id entry
  pinctrl: sh-pfc: Remove obsolete r8a7779 platform_device_id entry
  pinctrl: sh-pfc: Stop including <linux/platform_data/gpio-rcar.h>
  usb: renesas_usbhs: Remove unneeded #include <linux/platform_data/gpio-rcar.h>
  ...
2015-11-02 12:30:39 -08:00
Geert Uytterhoeven f15f30449a usb: renesas_usbhs: Remove unneeded #include <linux/platform_data/gpio-rcar.h>
This header file will be removed soon.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Felipe Balbi <balbi@ti.com>
2015-10-20 16:03:36 +02:00
Yoshihiro Shimoda f5f6afa85a usb: renesas_usbhs: Add support for R-Car H3
This patch adds a compatible string to support for R-Car H3.

Since the HS-USB controller of R-Car H3 is almost the same specification
with R-Car Gen2 (these have 16 pipes and usb-dmac), this patch
sets the "type" of renesas_usbhs_driver_param to USBHS_TYPE_RCAR_GEN2.

Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-30 11:21:11 -05:00
Yoshihiro Shimoda 9ae7ce00cc usb: renesas_usbhs: fix build warning if 64-bit architecture
This patch fixes the following warning if 64-bit architecture environment:

./drivers/usb/renesas_usbhs/common.c:496:25: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  dparam->type = of_id ? (u32)of_id->data : 0;

Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-30 11:21:03 -05:00
Robert Baldyga 916f7ac5db usb: renesas: gadget: add ep capabilities support
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04 12:27:08 -05:00
Phil Edworthy b5a2875605 usb: renesas_usbhs: Allow an OTG PHY driver to provide VBUS
These changes allow a PHY driver to trigger a VBUS interrupt and
to provide the value of VBUS.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-07-29 09:59:22 -05:00
Chanwoo Choi 50297b79b8 usb: renesas_usbhs: Replace deprecated API of extcon
This patch removes the deprecated API of extcon and then use the new extcon API
with the unique id to indicate the each external connector (USB-HOST).
- extcon_get_cable_state(*edev, char *) -> extcon_get_cable_state_(*edev, id)

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Peter Chen <peter.chen@freescale.com>
Cc: Varka Bhadram <varkab@cdac.in>
Cc: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-07-29 09:59:18 -05:00
Greg Kroah-Hartman e152813ff5 usb: patches for v4.2 merge window
- dwc2 adds hibernation support
 - preparation for sunxi glue to musb driver
 - new ULPI bus
 - new ULPI PHY driver for TUSB1210
 - musb patches to support multiple DMA engines on same binary
 - support for R-Car E2 on renesas_usbhs
 
 Signed-off-by: Felipe Balbi <balbi@ti.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVaIsMAAoJEIaOsuA1yqREQXQP/2tYG5H2f71mpYAuOKu1KcYi
 DnFH5bKgVQZwl+Dafa41B7P40qub7goCULQSmAgErKboHQvzf7GhzbH22jG3cUg+
 icowa+pEstXxzcwQGOMVIOZ3jAIQCZFFOizolfAaCHrnYNGwaCKq+5809EdMyXHc
 IdYnkYFYdOVGjTPypzoHf8fjpMoCfMx+TLh2ZV4ICj4o5cVXkr9oXNAA8/B/dn+T
 MLK02IPmMOVNJs2gYFQSsGYy03YVR+y62jrYXa+bIa1lzYr4v2yx5SymYTcCWMsH
 c6szhMxCOoL3CGzONCT52b+ogfpCzefl0HV6yvpAQmRcgbAiRuVt3caq1TBpvMq0
 NJVChEfFtOaUR+UGNkBUzh7/CjcVlH8516NQlCIdPemB8HzqBfRMv9MjHsGt1rXC
 SHQMQSTOBw2fbdG5zvi06BOO2hCStqXLNCHARJ2Z5YjP7mLrwteO+wYg2FG9zhTp
 ShGZlHPqP/U+50WuzorHEpr/pRTJh3LhDlYJ6CBwyd4+vg17PrYYbkf82d9WDEDL
 BFH9qe7jfOwZiWHJvNFeHLriKzj/k3i9/DoRaqtm7QwJgafzBz7l+319jvruupnG
 8oxhr+gt74uDPIzxWWv+eFOtO+Uu/q8C3dSp0H/0sY4soBELIgf+QtOkwn596rFp
 mBLSkru+oEN62IQbTKDK
 =Jqzf
 -----END PGP SIGNATURE-----

Merge tag 'usb-for-v4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:

usb: patches for v4.2 merge window

- dwc2 adds hibernation support
- preparation for sunxi glue to musb driver
- new ULPI bus
- new ULPI PHY driver for TUSB1210
- musb patches to support multiple DMA engines on same binary
- support for R-Car E2 on renesas_usbhs

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-06-02 10:47:03 +09:00
Yoshihiro Shimoda c5d496ad98 usb: renesas_usbhs: Don't disable the pipe if Control write status stage
This patch fixes an issue that sometimes this controller is not able
to complete the Control write status stage.

This driver should enable DCPCTR.CCPL and PID_BUF to complete the status
stage. However, if this driver detects the ctrl_stage interruption first
before the control write data is received, this driver will clear the
PID_BUF wrongly in the usbhsf_pio_try_pop(). To avoid this issue, this
patch doesn't clear the PID_BUF in the usbhsf_pio_try_pop().
(Since also the privious code doesn't disable the PID_BUF after a control
 transfer was finished, this patch doesn't have any side efforts.)

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-31 16:14:07 +09:00
Kazuya Mizuguchi 5e582ff309 usb: renesas_usbhs: Fix fifo unclear in usbhsf_prepare_pop
This patch fixes an issue for control write. When usbhsf_prepare_pop()
is called after this driver called a gadget setup function, this controller
doesn't receive the control write data. So, this patch adds a code to clear
the fifo for control write in usbhsf_prepare_pop().

Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-31 16:14:07 +09:00
Yoshihiro Shimoda af6e613bb1 usb: renesas_usbhs: Add support for R-Car E2
This patch adds a compatible string to support for R-Car E2.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>" in patch 2
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-26 10:39:43 -05:00
Yoshihiro Shimoda e0213bc546 usb: renesas_usbhs: Change USBHS_TYPE_R8A779x to USBHS_TYPE_RCAR_GEN2
Since the HSUSB controllers of R-Car Gen2 are the same specification
(they have 16 pipes and usb-dmac), this patch changes USBHS_TYPE_R8A7790
and USBHS_TYPE_R8A7791 to USBHS_TYPE_RCAR_GEN2.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-26 10:39:39 -05:00
Arnd Bergmann 672bfdaa31 usb: renesas_usbhs: avoid uninitialized variable use
After the renesas_usbhs driver is enabled in ARM multi_v7_defconfig,
we now get a new warning:

renesas_usbhs/mod.c: In function 'usbhs_interrupt':
renesas_usbhs/mod.c:246:7: warning: 'intenb1' may be used uninitialized in this function [-Wmaybe-uninitialized]

gcc correctly points to a problem here, for the case that the
device is in host mode, we use the intenb1 variable without
having assigned it first. The state->intsts1 has a similar
problem, but gcc cannot know that.

This avoids the problem by initializing both sides of the
comparison to zero when we don't read them from the respective
registers.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 88a25e02f3 ("usb: renesas_usbhs: Add access control for INTSTS1 and INTENB1 register")
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-22 08:52:16 -05:00
Nobuhiro Iwamatsu 88a25e02f3 usb: renesas_usbhs: Add access control for INTSTS1 and INTENB1 register
INTSTS1 and INTENB1 register of renesas_usbhs can access only Host mode.
This adds process of accessing INTSTS1 and INTENB1 only when renesas_usbhs
is Host mode.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-14 09:56:09 -05:00
Yoshihiro Shimoda 5a294e5469 usb: renesas_usbhs: Revise the binding document about the dma-names
Since the DT should describe the hardware (not the driver limitation),
This patch revises the binding document about the dma-names to change
simple numbering as "ch%d" instead of "tx<n>" and "rx<n>".

Also this patch fixes the actual code of renesas_usbhs driver to handle
the new dma-names.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-04-28 11:33:49 -05:00
Kuninori Morimoto 2d9c7f3ca5 usb: renesas_usbhs: tidyup usbhs_for_each_dfifo macro
Current usbhs_for_each_dfifo macro will read out-of-array's
memory after last loop operation.
It was not good C language operation, and the binary which was
compiled by (at least) gcc 4.8.1 is broken.

This patch is based on
925403f425
(usb: renesas_usbhs: tidyup original usbhsx_for_each_xxx macro)

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-04-27 15:48:33 -05:00
Sergei Shtylyov b11373debe renesas_usbhs: mod_host: use USB_DT_HUB
Fix  using the  bare number to set the 'bDescriptorType' field of the Hub
Descriptor while the value  is #define'd in <linux/usb/ch11.h>.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-03 19:03:16 +02:00
Yoshihiro Shimoda 00f30d29b4 usb: renesas_usbhs: fix spinlock suspected in a gadget complete function
According to the gadget.h, a "complete" function will always be called
with interrupts disabled. However, sometimes usbhsg_queue_pop() function
is called with interrupts enabled. So, this function should be held by
usbhs_lock() to disable interruption. Also, this driver has to call
spin_unlock() to avoid spinlock recursion by this driver before calling
usb_gadget_giveback_request().
Otherwise, there is possible to cause a spinlock suspected in a gadget
complete function.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-19 11:28:15 -05:00
Yoshihiro Shimoda ab330cf388 usb: renesas_usbhs: add support for USB-DMAC
Some Renesas SoCs have the USB-DMAC. It is able to terminate transfers
when a short packet is received, even if less bytes than the transfer
counter size have been received. Also, it is able to send a short
packet even if the packet size is not multiples of 8bytes.

Since the previous code has used the interruption of USBHS controller
when receiving packets even if this driver has used a dmac, a lot of
interruptions has happened. This patch will reduce such interruptions.

This patch allows to use the USB-DMAC on R-Car H2 and M2.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-13 10:41:19 -05:00
Yoshihiro Shimoda 9b53d9af7a usb: renesas_usbhs: fix the sequence in xfer_work()
This patch fixes the setup sequence in xfer_work(). Otherwise,
sometimes a usb transaction will get stuck.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-13 10:41:12 -05:00
Yoshihiro Shimoda 7a96b78464 usb: renesas_usbhs: add the channel number in dma-names
To connect the channel of USB-DMAC to USBHS DnFIFO number, this patch
adds this channel/FIFO number in dma-names. Otherwise, this driver
needs to add analysis code for device tree.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-13 10:41:08 -05:00
Arnd Bergmann eed97ef39a usb: renesas: fix extcon dependency
The renesas usbhs driver calls extcon_get_edev_by_phandle(), which
is defined in drivers/extcon/extcon-class.c, and that can be a
loadable module. If the extcon-class support is disabled, usbhs
will work correctly for all devices that do not need extcon.

However, if extcon-class is a loadable module, and usbhs is
built-in, the kernel fails to link. In order to solve that,
we need a Kconfig dependency that allows extcon to be disabled
but does not allow usbhs built-in if extcon is a module.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-02-23 09:14:33 -06:00
Yoshihiro Shimoda ffb9da6575 usb: renesas_usbhs: fix NULL pointer dereference in dma_release_channel()
This patch fixes an issue that the following commit causes NULL
pointer dereference in dma_release_channel().
 "usb: renesas_usbhs: add support for requesting DT DMA"
 (commit id abd2dbf6bb)

The usbhsf_dma_init_dt() should set fifo->{t,r}x_chan to NULL if
dma_request_slave_channel_reason() returns IS_ERR value.
Otherwise, usbhsf_dma_quit() will call dma_release_channel(), and then
NULL pointer dereference happens.

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
Reported-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-30 10:35:37 -06:00
Peter Chen a17fd41206 usb: renesas_usbhs: gadget: set value for common is_selfpowered
Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-29 10:32:51 -06:00
Yoshihiro Shimoda abd2dbf6bb usb: renesas_usbhs: add support for requesting DT DMA
This patch adds dma_request_slave_channel_reason() calling to request
dma slave channels for multiplatform environment.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:34:58 -06:00
Yoshihiro Shimoda 6e3f53ab5b usb: renesas_usbhs: add usbhsf_dma_init_pdev() function
To add support for requesting DT DMA in the future, this patch adds
usbhsf_dma_init_pdev() function.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:34:57 -06:00
Sergei Shtylyov 16eb1a67f3 usb: renesas_usbhs: mod_host: use HUB_CHAR_*
Fix  using the  bare number  to set the 'wHubCharacteristics' field of the Hub
Descriptor while the values are #define'd in <linux/usb/ch11.h>.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-27 09:34:57 -06:00
Sergei Shtylyov d7b3968dbc usb: renesas_usbhs: add OTG ID signal sensing
On the Renesas R8A7791 SoC based boards there's MAX3355 USB OTG chip and mini-AB
USB connector corresponding to USB port 0 driven either by EHCI/OHCI or  Renesas
USBHS gadget controller. And we'd like the host/gadget  drivers to work based on
the cable type connected. An 'extcon' driver for MAX3355 has been written, so we
only need to bind  to it via device tree which I'm doing in this patch.

(Perhaps, it would also make sense to use OTG HNP when the USBHS host mode is
active and a B-cable is connected but I don't have access to host-capable USBHS,
so  wouldn't be able to test it.)

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 15:36:28 -06:00
Sergei Shtylyov 48ac1e5766 usb: renesas_usbhs: fix platform init error message
There is a typo ("prove" instead of "probe") in the error message printed when
the platform initialization fails. Replace that word with more fitting "init".

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:27 -06:00
Sergei Shtylyov 368504c00a usb: renesas_usbhs: kill dead code in usbhs_probe()
usbhsc_drvcllbck_notify_hotplug() always returns 0, so it's rather pointless to
store and check its result for being < 0.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:26 -06:00
Yoshihiro Shimoda d3cf6a4b01 usb: renesas_usbhs: expand USB-DMAC channels for R-Car Gen2
This patch expands USB-DMAC channels for R-Car Gen2 SoCs. The SoCs
have 4 channels. If d{2,3}_{t,x}x_id are not set, this driver never
uses the expanded USB-DMAC channels.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-12 09:11:31 -06:00
Yoshihiro Shimoda 53e734b1ec usb: renesas_usbhs: add a new macro for extending DnFIFOs
To extend DnFIFOs in the future, this patch adds a new macro because
some SoCs don't the "port" address for DnFIFOs.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-12 09:11:27 -06:00
Yoshihiro Shimoda 3a2634a5b4 usb: renesas_usbhs: standardize d{0,1}fifo control
To expand DnFIFOs in the future, this patch standardizes the d{0,1}fifo
control using new macros.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-12 09:10:39 -06:00
Yoshihiro Shimoda c907e42353 usb: renesas_usbhs: change d{0,1}fifo to dfifo array
To extend DnFIFOs in the future, this patch changes d{0,1}fifo of
usbhs_fifo_info to dfifo array.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-12 09:09:39 -06:00
Yoshihiro Shimoda cdeb794313 usb: renesas_usbhs: fix usbhs_pipe_clear() for DCP PIPE
Since the DCPCTR doesn't have the ACLRM bit, the usbus_pipe_clear()
should not call the usbhsp_pipectrl_set() with ACLRM.
So, this patch fixes this issue to add the usbhs_fifo_clear_dcp()
in fifo.c because the controller needs the CFIFO to clear the
the DCP PIPE.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-05 13:22:16 -06:00
Yoshihiro Shimoda 4ef35b10bf usb: renesas_usbhs: fix the timing of dcp_control_transfer_done
According to the datasheet, this driver should clear the INTSTS0.CTRT
bit before this controller detects the next stage transition. Otherwise,
the driver may not be able to clear the bit after the controller went to
the next stage transition. After that, the driver will not be able to
clear the INTSTS0.VALID, and a usb control transfer will not finish
finally.

If we use the testusb tool, it is easy to reproduce this issue:

 # testusb -a -t 10

Since the previous code handled a data stage and a status stage in
the usbhsf_pio_try_push(), it may not clear the INTSTS0.CTRT at the
right timing.
So, this patch change the timing of usbhs_dcp_control_transfer_done()
to the usbhsg_irq_ctrl_stage().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-05 13:22:12 -06:00
Takeshi Kihara 04a5def3df usb: renesas_usbhs: gadget: fix the behavior of pullup
This patch fixes an issue that this driver always enable the D+ pullup
after it detected the VBUS connection even though this usb controller
can control the D+ pullup timing by software. So, this driver should
enable the D+ pullup after a gadget driver called usb_gadget_connect().

Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-05 13:22:09 -06:00
Kazuya Mizuguchi 11432050f0 usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()
This patch fixes an issue that the NULL pointer dereference happens
when we uses g_audio driver. Since the g_audio driver will call
usb_ep_disable() in afunc_set_alt() before it calls usb_ep_enable(),
the uep->pipe of renesas usbhs driver will be NULL. So, this patch
adds a condition to avoid the oops.

Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Fixes: 2f98382dc (usb: renesas_usbhs: Add Renesas USBHS Gadget)
Cc: <stable@vger.kernel.org> # v3.0+
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-05 13:22:05 -06:00
Varka Bhadram 687f16b859 usb: renesas_usbhs: common: remove duplicate check on resource
Sanity check on resource happening with devm_ioremap_resource().

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:20 -06:00
Felipe Balbi 22835b807e usb: gadget: remove unnecessary 'driver' argument
now that no UDC driver relies on the extra
'driver' argument to ->udc_stop(), we can
safely remove it.

This commit is based on previous work by
Robert Baldyga <r.baldyga@samsung.com> which
can be found at [1]; however that patch turned
out to have a high probability of regressing
many UDC drivers because of a blind search & replace
s/driver/$udc->driver/ which caused the 'driver'
argument to stop_activity() to be a valid non-NULL
pointer when it should be NULL, thus causing UDCs
to mistakenly call gadget driver's ->disconnect()
callback.

[1] http://markmail.org/message/x5zneg4xea4zntab

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:16 -06:00
Peter Chen b1cb07cdee usb: renesas_usbhs: delete unnecessary 'out of memory' messages
The memory subsystem has already had similar message for it.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:07 -06:00
Yoshihiro Shimoda 420974a0ed usb: renesas_usbhs: add support for generic PHY
This patch adds support for the generic PHY. The generic PHY will be
used in multiplatform environment.

Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:00:56 -06:00
Yoshihiro Shimoda 5f6aea3453 usb: renesas_usbhs: clean up rcar2.c to support a generic PHY
To support both usb PHY and generic PHY, this patch cleans up rcar2.c.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:00:56 -06:00
Yoshihiro Shimoda c042b85a2c usb: renesas_usbhs: rename phy to usb_phy in usbhs_priv
To support a generic phy driver in this driver later, this patch
renames "struct usb_phy *phy" to "struct usb_phy *usb_phy".

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:00:56 -06:00
Michal Sojka 304f7e5e1d usb: gadget: Refactor request completion
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 <sojka@merica.cz>
Acked-by: Felipe Balbi <balbi@ti.com>
Tested-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-25 16:58:50 +02:00
Bartlomiej Zolnierkiewicz 2b6127ddef usb: renesas_usbhs: fix driver dependencies
Renesas USBHS controller support should be available only on
Renesas ARM SoCs and SuperH architecture.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Magnus Damm <magnus.damm@gmail.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 21:57:22 -07:00
Felipe Balbi 4cd41ffd27 Linux 3.17-rc5
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJUFjfVAAoJEHm+PkMAQRiGANkIAIU3PNrAz9dIItq8a/rEAhnx
 l2shHoOyEmyNR2apholM3BPUNX50cbsc/HGdi7lZKLkA/ifAj6B9nFD2NzVsIChD
 1QWVcvdkKlVuxXCDd26qbijlfmbTOAWrLw9ntvM+J6ZtECM6zCAZF4MAV/FwogPq
 ETGKD76AxJtVIhBMS99troAiC1YxmQ7DKgEr8CraTOR1qwXEonnPCmN/IZA6x2/G
 EXiihOuQB5me1X7k4PI0V8CDscQOn+3B2CQHIrjRB+KiTF+iKIuI8n6ORC6bpFh+
 U8UZP9wLlIG1BrUHG83pIndglIHotqPcjmtfl1WGrRr2hn7abzVSfV+g5Syo3Vg=
 =Ep+s
 -----END PGP SIGNATURE-----

Merge tag 'v3.17-rc5' into next

Linux 3.17-rc5

Signed-off-by: Felipe Balbi <balbi@ti.com>

Conflicts:
	Documentation/devicetree/bindings/usb/mxs-phy.txt
	drivers/usb/phy/phy-mxs-usb.c
2014-09-16 09:53:59 -05:00
Yoshihiro Shimoda b854100eda usb: renesas_usbhs: Add device tree support for R-Car H2 and M2
This driver supports other SoCs, but they need boards/Soc depend code.
So, this patch adds device tree support for R-Car H2 and M2 initially.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-05 10:59:27 -05:00
Yoshihiro Shimoda 2743e7f90d usb: renesas_usbhs: fix the usb_pkt_pop()
This patch fixes the usb_pkt_pop(). If a gadget driver calls
usb_ep_dequeue(), this driver will call the usb_pkt_pop().
So, the usb_pkt_pop() should cancel the transaction.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-03 09:15:58 -05:00
Yoshihiro Shimoda c0ed8b23b2 usb: renesas_usbhs: fix the condition of is_done in usbhsf_dma_push_done
This patch fixes the condition of is_done in usbhsf_dma_push_done().
This function will be called after a transmission finished by DMAC.
So, the function should check if the transmission packet is short packet
or not. Also the function should call try_run to send the zero packet
by the pio handler if the "*is_done" is not set. Otherwize, the
transaction will not finish if a gadget driver sets the "zero" flag
in a transmission.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-03 09:15:58 -05:00
Yoshihiro Shimoda c4d8199ba1 usb: renesas_usbhs: protect mod->irq_{bemp,brdy}sts by spin lock
This patch protects the mod->irq_bempsts and mod->irq_brdysts by
spin lock in the usbhs_status_get_each_irq() because other functions
will write them during spin lock. Otherwise, the driver will clears
the BRDYSTS and/or BEMPSTS wrongly, and then, the transaction will not
finish.
Also since the driver should use the INTSTS0 and BRDYSTS and BEMPSTS
as the same timing, the patch protects them.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-03 09:15:57 -05:00
Yoshihiro Shimoda 8355b2b308 usb: renesas_usbhs: fix the behavior of some usbhs_pkt_handle
Some gadget drivers will call usb_ep_queue() more than once before
the first queue doesn't finish. However, this driver didn't handle
it correctly. So, this patch fixes the behavior of some
usbhs_pkt_handle using the "running" flag. Otherwise, the oops below
happens if we use g_ncm driver and when the "iperf -u -c host -b 200M"
is running.

Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 80000007 [#1] SMP ARM
Modules linked in: usb_f_ncm g_ncm libcomposite u_ether
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W      3.17.0-rc1-00008-g8b2be8a-dirty #20
task: c051c7e0 ti: c0512000 task.ti: c0512000
PC is at 0x0
LR is at usbhsf_pkt_handler+0xa8/0x114
pc : [<00000000>]    lr : [<c0278fb4>]    psr: 60000193
sp : c0513ce8  ip : c0513c58  fp : c0513d24
r10: 00000001  r9 : 00000193  r8 : eebec4a0
r7 : eebec410  r6 : eebe0c6c  r5 : 00000000  r4 : ee4a2774
r3 : 00000000  r2 : ee251e00  r1 : c0513cf4  r0 : ee4a2774

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-03 09:15:57 -05:00
Greg Kroah-Hartman 61fe2d75f1 usb: patches for v3.17 merge window
Surprisingly enough, while a big set of patches, the majority is
 composed of cleanups (using devm_*, fixing sparse errors, moving
 code around, adding const, etc).
 
 The highlights are addition of new support for PLX USB338x devices,
 and support for USB 2.0-only configurations of the DWC3 IP core.
 
 Signed-of-by: Felipe Balbi <balbi@ti.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJTzTI9AAoJEIaOsuA1yqREIqcQAJbwMaDb5sp8dWst+nL1Vo8N
 08bhOOM+o2KLiIBSNQh1hYtujpa06RSQMiNYZ7F/+R4Q3OAoq+uC0dD69TLEQ3Sd
 1xi0UgUTAvtXo13TToRjIi0mYywrrkZ91Maqff5jZKdslOY4ZfAScpUQHyD3i1UO
 JNUqpayYAnp8JJIGQ8CG1wAeJh/J8JH3O607vaknKVjds+WMkeC5ubnuV4sgVw71
 8JTwxk22EkMTr2MKhHjZwcv016NMEvziinWVoTXcWN2Uwk42Dn1nhfaYWSvg7kZE
 8/3t6zzdFMdoeeTEn2xXIQGTjbHW0sBS5+S+6PAon2YbjS3x40cbyLJnZ+KoVXog
 iHDKAl5w53gd/7qMiv57dW+HRP0M7/m2iy/owIrY8H8DkM3uwFevaeq/G2raJKmA
 frB1k95bSyypN7wVkALYv4nurP5+d7ERy9hPj/49M5giJXPpEIbgKN2qGdafaEx7
 xzAI+GqYrFtmmg25+f6AQRicVczQNMCdDT8HPZ04099Z2JVY/4uOoqTl29CePMgo
 OXeQ45ECMoJuRSwpF56e8h+qmsXp6WD31IhlcHseTvUvFu0Ex4SgUJhFP2UaF9WP
 aOqz0w36yX/ME3VhQk9YImNqGoqEk6fYHIHhxfdDugt0n68+M56EiiwtKvd5v5BI
 hCJAMBrv+WCGnJvWunVW
 =aJY4
 -----END PGP SIGNATURE-----

Merge tag 'usb-for-v3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:

usb: patches for v3.17 merge window

Surprisingly enough, while a big set of patches, the majority is
composed of cleanups (using devm_*, fixing sparse errors, moving
code around, adding const, etc).

The highlights are addition of new support for PLX USB338x devices,
and support for USB 2.0-only configurations of the DWC3 IP core.

Signed-of-by: Felipe Balbi <balbi@ti.com>
2014-07-21 11:33:41 -07:00
Ulrich Hecht 8ecef00fe1 usb: renesas_usbhs: add R-Car Gen. 2 init and power control
In preparation for DT conversion to reduce reliance on platform device
callbacks.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-16 10:06:32 -05:00
Yoshihiro Shimoda dfb87b8bfe usb: renesas_usbhs: gadget: fix re-enabling pipe without re-connecting
This patch fixes an issue that the renesas_usbhs driver in gadget mode
cannot work correctly even if I disabled DMAC of the driver when I used
the g_zero driver and the testusb tool.

When a usb cable is re-connected, the renesas_usbhs driver calls the
usbhsp_flags_init() (via usbhs_hotplug() --> usbhs_mod_call(start) -->
usbhsg_try_start() --> usbhs_pipe_init()). However, the driver doesn't
call the usbhsp_flags_init() when usbhsg_ep_disable() is called.
So, if a gadget driver calls usb_ep_enable() and usb_ep_disable() again
and again, the renesas_usbhs driver will output the following log:

  renesas_usbhs renesas_usbhs: can't get pipe (BULK)
  renesas_usbhs renesas_usbhs: wrong recip request

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10 08:36:49 -05:00
Yoshihiro Shimoda 6a0541599f usb: renesas_usbhs: fix usbhs_pipe_malloc() to re-enable a pipe.
This patch fixes an issue that the driver cannot push a new data when
a pipe is re-enabled after the pipe is queued.

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10 08:36:49 -05:00
Kuninori Morimoto 3fe1550529 usb: renesas: gadget: fixup: complete STATUS stage after receiving
Current usbhs gadget driver didn't complete STATUS stage after receiving.
It wasn't problem for us before, because some USB class doesn't use
DATA OUT stage in control transfer.
But, it is required on some device.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-19 10:06:46 -05:00
Greg Kroah-Hartman 73ad0adcb6 usb: changes for v3.14 merge window
This pull request is quite extensive, containing
 105 non-merge commits. Because of that, we describe
 the changes in sections below:
 
 New drivers:
 	- Keystone PHY driver and DWC3 Glue Layer
 	- Aeroflex Gaisler GRUSBDC
 	- Tahvo PHY driver for N770
 	- JZ4740 MUSB gluer Layer
 	- Broadcom PHY Driver
 
 Important new features:
 	- MUSB DSPS learned about suspend/resume
 	- New quirk_ep_out_aligned_size flag added to struct usb_gadget
 	- DWC3 initializes the new quirk flag so gadget drivers can use it.
 	- AM335x PHY Driver learns about remote wakeup
 	- Renesas USBHS now requests DMA Engine only once
 	- s3c-hsotg is now re-used on Broadcom devices
 	- USB PHY layer now makes sure to initialize the notifier for all
 		drivers
 	- omap-control learned about TI's new AM437x devices
 	- few other usb gadget/function drivers learned about the new
 		configfs-based binding.
 
 Misc Fixes and Clean Ups:
 	- Several sparse fixes all over the place
 	- Removal of redundant of_match_ptr()
 	- r-car gen2 phy now uses usb_add_phy_dev()
 	- removal of DEFINE_PCI_DEVICE_TABLE() from a few drivers
 	- conversion to clk_prepare/clk_unprepare on r8a66597-udc
 	- some randconfig errors and build warnings were fixed
 	- removal of unnecessary lock on dwc3-omap.c
 
 Signed-of-by: Felipe Balbi <balbi@ti.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.15 (GNU/Linux)
 
 iQIcBAABAgAGBQJSvK5dAAoJEIaOsuA1yqREKrEP/jdrhxgkavR39dgpWj3ujsjf
 jnH9GH9jhLgphpL8jHVxnbu7YHCy2qlHeZMiVksSYwZuAZY3fp00xTpzOCKVyRmr
 LTRvyqTKh90SOqRcx/3MX4DdUf+paG75z7QMQM362fjdogh41sJK76rk+loPjOWf
 mBOmSphQrfDrqBunigdtSVsq3c/kiwWSbU3kzF/wttu//DuMsahxu1D9+UN0yxMl
 NpI84E06ii1qyOt4H5UyN/jWwIcrleC3YFCe5EF+8lRluOjNJCfUD7qOgAOoEVJ/
 OAhgBj+Q47KY39Tz/vfgCuIvKLsnLcnX8SS3mvQQgpa0Rw0EEHyakrD4p07Qfnuk
 H4WfYH0NB/BxKmH6IqQHg/pLWlqAvrqWuHpgO8Y2Mlfr5ILFhzcAM2mTvLVfn6+D
 VJslKXWhVpHWiFsstDdwzqwI9sxoHo1E2QTikkh4jPiD8duaQraneXPkoQn7FW4A
 wMYsPDL1T4wkYfE7vpY2iX76KjRa48FjuQbrxb6hZoKUEWhAqKcaEZWcz8d42DH5
 LmfrpzJPCONos4yfEoxIZJ/Jve2eR82Tx+Pd+OV3/edVCi5VR/RJsxtLdXF6dNkm
 VmZsVT1s9D4QllsTp8/pJyUMRFoxDyhIdlC/22dlULIYq9FYqkc+5lTwpvt621t9
 n/iKABz1jGfM6hhi8Kkj
 =N4//
 -----END PGP SIGNATURE-----

Merge tag 'usb-for-v3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:

usb: changes for v3.14 merge window

This pull request is quite extensive, containing
105 non-merge commits. Because of that, we describe
the changes in sections below:

New drivers:
	- Keystone PHY driver and DWC3 Glue Layer
	- Aeroflex Gaisler GRUSBDC
	- Tahvo PHY driver for N770
	- JZ4740 MUSB gluer Layer
	- Broadcom PHY Driver

Important new features:
	- MUSB DSPS learned about suspend/resume
	- New quirk_ep_out_aligned_size flag added to struct usb_gadget
	- DWC3 initializes the new quirk flag so gadget drivers can use it.
	- AM335x PHY Driver learns about remote wakeup
	- Renesas USBHS now requests DMA Engine only once
	- s3c-hsotg is now re-used on Broadcom devices
	- USB PHY layer now makes sure to initialize the notifier for all
		drivers
	- omap-control learned about TI's new AM437x devices
	- few other usb gadget/function drivers learned about the new
		configfs-based binding.

Misc Fixes and Clean Ups:
	- Several sparse fixes all over the place
	- Removal of redundant of_match_ptr()
	- r-car gen2 phy now uses usb_add_phy_dev()
	- removal of DEFINE_PCI_DEVICE_TABLE() from a few drivers
	- conversion to clk_prepare/clk_unprepare on r8a66597-udc
	- some randconfig errors and build warnings were fixed
	- removal of unnecessary lock on dwc3-omap.c

Signed-of-by: Felipe Balbi <balbi@ti.com>
2014-01-03 12:15:10 -08:00
Robert Baldyga e117e742d3 usb: gadget: add "maxpacket_limit" field to struct usb_ep
This patch adds "maxpacket_limit" to struct usb_ep. This field contains
maximum value of maxpacket supported by driver, and is set in driver probe.
This value should be used by autoconfig() function, because value of field
"maxpacket" is set to value from endpoint descriptor when endpoint becomes
enabled. So when autoconfig() function will be called again for this endpoint,
"maxpacket" value will contain wMaxPacketSize from descriptior instead of
maximum packet size for this endpoint.

For this reason this patch adds new field "maxpacket_limit" which contains
value of maximum packet size (which defines maximum endpoint capabilities).
This value is used in ep_matches() function used by autoconfig().

Value of "maxpacket_limit" should be set in UDC driver probe function, using
usb_ep_set_maxpacket_limit() function, defined in gadget.h. This function
set choosen value to both "maxpacket_limit" and "maxpacket" fields.

This patch modifies UDC drivers by adding support for maxpacket_limit.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-17 13:17:41 -06:00
Kuninori Morimoto 1b2e21b082 usb: renesas_usbhs: fifo: request DMAEngine once
DMAEngine uses IRQ if dma_request_channel() was called,
and it is using devm_request_irq() today,
OTOH, dma_request_channel() will be called when each
USB connection happened on this driver.
This means same IRQ will be requested many times
whenever each USB connected,
and this IRQ isn't freed when USB disconnected.
Request DMAEngine once.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-12-12 13:43:34 -06:00
Peter Chen 3c9740a117 usb: hcd: move controller wakeup setting initialization to individual driver
Individual controller driver has different requirement for wakeup
setting, so move it from core to itself. In order to align with
current etting the default wakeup setting is enabled (except for
chipidea host).

Pass compile test with below commands:
	make O=outout/all allmodconfig
	make -j$CPU_NUM O=outout/all drivers/usb

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-08 18:06:46 -08:00
Martin Schwidefsky 0244ad004a Remove GENERIC_HARDIRQ config option
After the last architecture switched to generic hard irqs the config
options HAVE_GENERIC_HARDIRQS & GENERIC_HARDIRQS and the related code
for !CONFIG_GENERIC_HARDIRQS can be removed.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2013-09-13 15:09:52 +02:00
Libo Chen c9a0552e8d usb: renesas_usbhs: use platform_{get,set}_drvdata()
Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev,
so we can directly pass a struct platform_device.

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-27 21:35:23 -07:00
Jingoo Han f074245960 usb: renesas: use dev_get_platdata()
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-07-30 11:21:58 +03:00
Kuninori Morimoto 925403f425 usb: renesas_usbhs: tidyup original usbhsx_for_each_xxx macro
Current usbhsx_for_each_xxx macro will read out-of-array's
memory after last loop operation.
It was not good C language operation, and the binary which was
compiled by (at least) gcc 4.8.1 is broken
This patch tidyup these issues

Reported-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
Reviewed-by: Takashi Yoshii <takashi.yoshii.zj@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-07-29 13:58:12 +03:00
Kuninori Morimoto 8047806e64 usb: renesas_usbhs: gadget: remove extra check on udc_stop
usb_gadget_ops :: udc_stop might be called with driver = NULL since
511f3c5326
(usb: gadget: udc-core: fix a regression during gadget driver unbinding)

Because of that, 2nd times insmod goes fail.
This patch fixes it up.

Reported-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-07-15 13:01:24 +03:00
Florian Fainelli 25e11ec4fe USB: regroup all depends on USB within an if USB block
This patch removes the depends on USB from all config symbols in
drivers/usb/host/Kconfig and replace that with an if USB / endif block
as suggested by Alan Stern. Some source ... Kconfig lines have been
shuffled around to permit a better regroupment of the Kconfig files
depending on "config USB" item. No functionnal change is introduced.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-09 16:49:07 -07:00
Kuninori Morimoto 225da3e3cb usb: renesas_usbhs: fixup sparse errors for common.c
This patch fixup below sparse errors

CHECK   ${RENESAS_USB}/common.c
${RENESAS_USB}/common.c:313:17: error: incompatible types in conditional expression (different base types)
${RENESAS_USB}/common.c:322:17: error: incompatible types in conditional expression (different base types)
${RENESAS_USB}/common.c:384:17: error: incompatible types in conditional expression (different base types)
${RENESAS_USB}/common.c:524:9: error: incompatible types in conditional expression (different base types)
${RENESAS_USB}/common.c:545:9: error: incompatible types in conditional expression (different base types)
${RENESAS_USB}/common.c:574:9: error: incompatible types in conditional expression (different base types)
${RENESAS_USB}/common.c:606:9: error: incompatible types in conditional expression (different base types)
${RENESAS_USB}/mod_gadget.c:233:28: warning: symbol 'req_clear_feature' was not declared. Should it be static?
${RENESAS_USB}/mod_gadget.c:274:28: warning: symbol 'req_set_feature' was not declared. Should it be static?
${RENESAS_USB}/mod_gadget.c:375:28: warning: symbol 'req_get_status' was not declared. Should it be static?

[ balbi@ti.com : added three sparse fixes to mod_gadget.c ]

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-02 11:42:48 +03:00
Felipe Balbi 40b8156f94 usb: renesas: remove unused DMA_ADDR_INVALID
DMA_ADDR_INVALID isn't used anymore, it's safe
to remove it.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:13 +02:00
Felipe Balbi 3920193d8e usb: renesas: gadget: don't assign gadget.dev.release directly
udc-core provides a better way to handle release
methods, let's use it.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:17:55 +02:00
Felipe Balbi 8707d5abbd usb: renesas: gadget: don't touch gadget.dev.driver
udc-core now handles that for us, which means
we can remove it from our driver.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:17:44 +02:00
Felipe Balbi 7bce401cc6 usb: gadget: drop now unnecessary flag
We don't need the ->register_my_device flag
anymore because all UDC drivers have been
properly converted.

Let's remove every history of it.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:16:55 +02:00
Felipe Balbi 0972ef71b4 usb: renesas_usbhs: gadget: let udc-core manage gadget->dev
By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:16:53 +02:00
Linus Torvalds 74e1a2a393 USB patches for 3.9-rc1
Here's the big USB merge for 3.9-rc1
 
 Nothing major, lots of gadget fixes, and of course, xhci stuff.
 
 All of this has been in linux-next for a while, with the exception of
 the last 3 patches, which were reverts of patches in the tree that
 caused problems, they went in yesterday.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iEYEABECAAYFAlEmZ/kACgkQMUfUDdst+ylEhwCgyM0JEOgLuW7M8D+oNcitZn51
 g7oAniD0IkLG8RCB8plLj+82AvthalCo
 =bHSs
 -----END PGP SIGNATURE-----

Merge tag 'usb-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB patches from Greg Kroah-Hartman:
 "Here's the big USB merge for 3.9-rc1

  Nothing major, lots of gadget fixes, and of course, xhci stuff.

  All of this has been in linux-next for a while, with the exception of
  the last 3 patches, which were reverts of patches in the tree that
  caused problems, they went in yesterday."

* tag 'usb-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (190 commits)
  Revert "USB: EHCI: make ehci-vt8500 a separate driver"
  Revert "USB: EHCI: make ehci-orion a separate driver"
  Revert "USB: update host controller Kconfig entries"
  USB: update host controller Kconfig entries
  USB: EHCI: make ehci-orion a separate driver
  USB: EHCI: make ehci-vt8500 a separate driver
  USB: usb-storage: unusual_devs update for Super TOP SATA bridge
  USB: ehci-omap: Fix autoloading of module
  USB: ehci-omap: Don't free gpios that we didn't request
  USB: option: add Huawei "ACM" devices using protocol = vendor
  USB: serial: fix null-pointer dereferences on disconnect
  USB: option: add Yota / Megafon M100-1 4g modem
  drivers/usb: add missing GENERIC_HARDIRQS dependencies
  USB: storage: properly handle the endian issues of idProduct
  testusb: remove all mentions of 'usbfs'
  usb: gadget: imx_udc: make it depend on BROKEN
  usb: omap_control_usb: fix compile warning
  ARM: OMAP: USB: Add phy binding information
  ARM: OMAP2: MUSB: Specify omap4 has mailbox
  ARM: OMAP: devices: create device for usb part of control module
  ...
2013-02-21 12:20:00 -08:00
Heiko Carstens 5273afe359 drivers/usb: add missing GENERIC_HARDIRQS dependencies
Add a couple of missing GENERIC_HARDIRQS dependencies to fix link
errors like below on s390:

ERROR: "devm_request_threaded_irq" [drivers/usb/gadget/mv_udc.ko] undefined!

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-08 12:16:12 -08:00
Greg Kroah-Hartman cba6c85027 usb: gadget: patches for v3.9 merge window
finally getting rid of the old ->start()/->stop() methods
 in favor of the better and improved ->udc_start()/->udc_stop().
 
 There were surprisingly quite a few users left, but all of them
 have been converted.
 
 f_mass_storage removed some dead code, which is always great ;-)
 
 There's also a big cleanup to the gadget framework from Sebastian
 which gets us a lot closer to having only function drivers in
 kernel and move over to configfs-based binding.
 
 Other than these, there's the usual set of cleanups: s3c UDCs are
 moving over to devm_regulator_bulk_get() API, at91_udc removed
 an unnecessary check for work_pending() before scheduling and
 there's the removal of an unused variable from uac2_pcm_trigger().
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRAqbFAAoJEIaOsuA1yqREkXsQAInuD5h4OE4gMQSFWJbYY+it
 BWN3JAIxm5NTKD9cez7d0vQ45v+9qDygBpHP4lsGGjhI0tkOr+nQ/g/sfSi3xbHM
 HQ6/z7Y68pNz9k57ans9NfIt0AuIsHE79tlOx3g+QVvryLHmQSAUzk9ru0VUHw4D
 rSI3Czk3yCA4UnRITxJYpsnmEAZw/M7DwyMANqdNFzZaruMB77phsCWGIM2O0h1T
 lw3sgcBoFcvYodWCzi90NWMA8FccQLMxBg6G+7ViaqGvAPqSuYwNTHJxxUwPHdbI
 o28gQY7gkxZY9MwbnFZ+7jSbpcmzRpYtpgBflubf4iAkv+197lG6I5XyVgfdEZSF
 AF3qi7asrXX/jjFoXASpmphBdCazz6G9bTmtdT3RpV3MKC6fnS1tXImBgreveIWh
 sjhPQCleCCZI2+KLpVOujk3kUVHc9aJ5zbqcNLu03Ux1qqqK0VlZ9bahtip6HQ8H
 GYhEdOmgIAe83CcJeWBdWAoz2c7fzEEvCj+TxxbyB7nE8TRsOYooKrBcfEM1plVy
 qWcXULlhTdD4aWpQLanL8XSamKFvyDk+lEn4803of0eaVpE9gUxKi0fwD+j6UOMV
 iBa7mEx5zIym7gJI4+SlvXIn8fPHfcHGX4BPLASd+G4ndkLIPc2wAb/KqVyIUCXt
 I5K8UNYb0DiuQtxKXg8R
 =PCP4
 -----END PGP SIGNATURE-----

Merge tag 'gadget-for-v3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:
	usb: gadget: patches for v3.9 merge window

	finally getting rid of the old ->start()/->stop() methods
	in favor of the better and improved ->udc_start()/->udc_stop().

	There were surprisingly quite a few users left, but all of them
	have been converted.

	f_mass_storage removed some dead code, which is always great ;-)

	There's also a big cleanup to the gadget framework from Sebastian
	which gets us a lot closer to having only function drivers in
	kernel and move over to configfs-based binding.

	Other than these, there's the usual set of cleanups: s3c UDCs are
	moving over to devm_regulator_bulk_get() API, at91_udc removed
	an unnecessary check for work_pending() before scheduling and
	there's the removal of an unused variable from uac2_pcm_trigger().
2013-01-25 09:08:05 -08:00
Felipe Balbi eeef458766 usb: gadget: constify all struct usb_gadget_ops
Add the missing 'const' keyword to all struct
usb_gadget_ops in the gadget framework.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-01-24 21:11:35 +02:00
Thierry Reding 148e11349b usb: Convert to devm_ioremap_resource()
Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-22 11:41:58 -08:00
Kuninori Morimoto e0b64ce6fe usb: renesas_usbhs: mod_host: fixup usbhsh_ureq_free() timing
usbhsh_ureq_free() free ureq which includes ubshs_pkt.
But current driver used usbhs_pkt after freed ureq.
This patch fixup this bug.
Special thanks to Chen

Reported-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-12-13 11:58:44 +02:00
Kuninori Morimoto d9fa298f21 usb: renesas_usbhs: gadget: usbhsg_ep_disable() care pipe settings
Current usbhsg_ep_disable() didn't care
uep->pipe and pipe->mod_private variable which is used on usbhsg_ep_enable().
It breaks renesas_usbhs gadget when resume.
This patch fixes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-12-13 11:58:43 +02:00
Kuninori Morimoto 584829459b usb: renesas_usbhs: gadget: remove usbhsg_uep_init()
Current driver always initialized uep->pipe to NULL on usbhsg_try_start().
But it breaks relationship with
usb_ep_ops :: enable/disable functions when suspend/resume.
This patch solved this issue by initializing uep->pipe on probe()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-12-13 11:58:39 +02:00
Bill Pemberton fb4e98ab63 usb: remove use of __devexit
CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Peter Korsgaard <jacmet@sunsite.dk>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Cc: Li Yang <leoli@freescale.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 13:27:17 -08:00
Bill Pemberton 7690417db5 usb: remove use of __devexit_p
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Peter Korsgaard <jacmet@sunsite.dk>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Cc: Li Yang <leoli@freescale.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 13:27:16 -08:00
Greg Kroah-Hartman 7fd94beeca usb: gadget: patches for v3.8
renesas_usbhs implements ->pullup() method, switches over
 to devm_request_irq(), adds support for DMA Engine and
 got a few miscelaneous cleanups.
 
 The NCM gadget got an endianness fix and the Ethernet
 gadget a frame size fix.
 
 We're finally removing the g_file_storage gadget and
 sticking to g_mass_storage and the new tcm_usb_gadget
 gadgets since that was a huge duplicaton of effort anyway.
 
 While removing g_file_storage, we also had to fix a bunch
 of defconfigs which were still pointing to the old gadget.
 
 There's a big series getting us closer to being able to
 introduce our configfs interface. The series converts
 functions into loadable modules which will, eventually,
 be registered to the configfs interface.
 
 Other than that there's the usual typo fixes and miscelaneous
 cleanups all over the place.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJQnXPMAAoJEIaOsuA1yqREkygQALIuhY6veRPZoZJltuADeAOV
 h7lBkuseJxvlJsbMLnjqP5tw4W/haE1deGR+ee1ZItkPrERCX1++jkQ6hmm7e00R
 mvr8rI+n3eBHSKUO89tUfCaz5UBsTl0cowPWdTwxRrV4VRJ1wVBw/oII9sfyss03
 jDo+11DSjTGTB+Bz72p2NTkRiv9my2Kz+ihhqFR5VSl5FyoutG53RNKRmciJKGB+
 i+RptOI+prdW1uOURHbie5FAI0xOBrE1Up2XdNiZ9blT6zcsK754Lc8erFJEZXX5
 7s8Ys/HJZLQCF/fRt4WAw8e1lSPELD2xuDMqV+WKu93aXOiAWL1SbzqK3Y+PaUDg
 Red07jOxgPqgq0F1mAp3+0Rs1RnshSvKREtQhZqsttg7suXhDB0q7h61CX8uQbRA
 hBZh8eFexRjqOZxveeV+h4ATz00c2nlEa8cJscr5zLf4R/LSxJWT7LV5227BDkBV
 9NUMA3dunDYZLqnxBv5lS2gQzmYO6G11wzdpgjnABL2WlM8Pv1lUDhY+erwvTRzd
 BM+9qMd7K40BuI1JyUsbBdmuEpJAD/yWE77pT2aBrr4767x0CYjBPZqQAxXFcWi8
 5NG1BzqWmH9HhwxKyWueWgNgY253cRcAzFlUN80NRA2UuNkMAeOAeJjvK48isAqJ
 T1MUkQgIFNvSecpRPrEl
 =umtl
 -----END PGP SIGNATURE-----

Merge tag 'gadget-for-v3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

USB gadget patches from Felipe:
"usb: gadget: patches for v3.8

renesas_usbhs implements ->pullup() method, switches over
to devm_request_irq(), adds support for DMA Engine and
got a few miscelaneous cleanups.

The NCM gadget got an endianness fix and the Ethernet
gadget a frame size fix.

We're finally removing the g_file_storage gadget and
sticking to g_mass_storage and the new tcm_usb_gadget
gadgets since that was a huge duplicaton of effort anyway.

While removing g_file_storage, we also had to fix a bunch
of defconfigs which were still pointing to the old gadget.

There's a big series getting us closer to being able to
introduce our configfs interface. The series converts
functions into loadable modules which will, eventually,
be registered to the configfs interface.

Other than that there's the usual typo fixes and miscelaneous
cleanups all over the place."
2012-11-11 17:31:53 -08:00
Kuninori Morimoto 1c90ee0b3e usb: renesas_usbhs: use transfer counter if IN direction bulk pipe
received data will break if it was bulk pipe and large data size,
because pipe kept BUF PID even though it doesn't have enough buffer.
To avoid this issue, renesas_usbhs can use transfer counter.
Pipe PID will be NAK if it didn't have enough buffer by this patch.

renesas_usbhs has strange address mapping.
Thus, it is difficult to calculate transfer counter setting address.
This patch use fixed table for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-11-08 15:46:06 +02:00
Kuninori Morimoto 7b332e5fef usb: renesas_usbhs: host: add endpoint user counter
renesas_usbhs attaches pipe to endpoint when urb was queued, and it will be
detached when transfer was done.  Multi device controlling was enabled by this
behavior.

Now renesas_usbhs driver tried to wait until detaching if urb was queued to
endpoint which already has been attached to pipe, and it created strange driver
behavior.

But it can re-use this attached pipe if multi urb was queued.  This patch
implements it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-11-06 15:04:28 +02:00
Kuninori Morimoto 24e4c1c30d usb: renesas_usbhs: remove debug information from usbhsh_hub_status_data()
Because usbhsh_hub_status_data() will be called many times,
there are too many obstructive/useless debug informations if driver has #define DEBUG.
Thus, other important dev_dbg() information will hide.
This patch removed obstructive/useless dev_dbg().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-11-06 15:04:28 +02:00
Masanari Iida 984e833c2b usb: fix typo in drivers/usb
Correct spelling typo in debug messages within drivers/usb.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-11-06 15:04:14 +02:00
Kuninori Morimoto 87c2905fd8 usb: renesas_usbhs: add DMAEngine support on mod_host
This patch enabled dma mapping, and used dma transfer handler
on mod_host

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-10-31 14:50:29 +02:00
Kuninori Morimoto 3192fcb234 usb: renesas_usbhs: fixup unreadable macro
mod.h has irq_bempsts/irq_brdysts to keep each irq status,
but it was difficult to find where they were used
on renesas_usbhs driver by using "grep irq_xxxx" command,
since it used irq_##status macro.
This patch fixup them

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-10-31 14:50:25 +02:00
Kuninori Morimoto 797b4e145c usb: renesas_usbhs: use devm_request_irq()
This patch uses devm_request_irq() instead of request_irq(),
and removed free_irq() from driver

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-10-31 14:50:16 +02:00
Kuninori Morimoto 1cb60156de usb: renesas_usbhs: fixup dma transfer stall
renesas_usbhs driver can switch DMA/PIO transfer by using handler,
and each handler have push/pop direction.
But unfortunately, current dma push handler didn't a path
which calls usbhs_pipe_enable(). Thus, dma transfer never happened.
this patch fixes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-10-23 09:44:37 +03:00
Kuninori Morimoto 4f053a24ec usb: renesas_usbhs: fixup: avoid NULL access on error case pipe detach
If renesas_usbhs or DMAEngine interrupt didn't happen by a certain cause,
urb->ep will be NULL by usb time out.
Then, host mode will access to it and crash kernel.
This patch fixes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-10-23 09:44:08 +03:00
kuninori.morimoto.gx@renesas.com 4cd2f59987 usb: renesas_usbhs: gadget: add usb_gadget_ops :: pullup support
This patch adds usbhs_sys_function_pullup() to control
D+ line for USB function, and enabled pullup support on mod_gadget.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-10-16 13:09:50 +03:00
Kuninori Morimoto d5c6a1e024 usb: renesas_usbhs: fixup interrupt status clear method
When interrupt happened, renesas_usbhs driver gets irq status
by usbhs_status_get_each_irq(), and cleared all status by using 0.
But, this method is incorrect,
since extra interrupt might occur between them.
This patch cleared corresponding bits only

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-10-16 12:47:40 +03:00
Kuninori Morimoto c2fa3edc58 usb: renesas_usbhs: fixup __usbhs_for_each_pipe 1st pos
__usbhs_for_each_pipe() is the macro which moves around each pipe,
but it has a bug which didn't care about 1st pipe's position.
Because of this bug, it moves around
pipe0, pipe2, pipe3 ... even though it requested pipe1, pipe2, pipe3...
This patch modifies it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-10-16 12:47:35 +03:00
Kuninori Morimoto 58efc77c86 usb: renesas_usbhs: convert to devm_xxx()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-11 13:57:18 -07:00
Kuninori Morimoto a651684c10 usb: renesas_usbhs: fixup DMA transport data alignment
renesas_usbhs dma can transport 8byte alignment data, not 4byte.
This patch fixup it.

Reported-by: Sugnan Prabhu S <sugnan.prabhu@renesasmobile.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-05 16:52:08 -07:00
Shimoda, Yoshihiro 697d5c004e usb: renesas_usbhs: modify the irq handler for sharing irq
When IORESOURCE_IRQ_SHAREABLE is set, the irq handler may be called
even if the interupt of the USB module doesn't happen. So, it may
clear the interrupt flags by mistake. This patch fixes it.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-05 16:52:08 -07:00
Kuninori Morimoto 5b50d3b526 usb: renesas_usbhs: fixup resume method for autonomy mode
If renesas_usbhs is probed as autonomy mode,
phy reset should be called after power resumed,
and manual cold-plug should be called with slight delay.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-10 11:53:24 -07:00
Kuninori Morimoto e7ae64c754 usb: renesas_usbhs: mod_host: add missing .bus_suspend/resume
suspend/resume will failed on renesas_usbhs without this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-10 11:53:23 -07:00
Linus Torvalds 9fc377799b USB patches for 3.6-rc1
Here's the big USB patch set for the 3.6-rc1 merge window.
 
 Lots of little changes in here, primarily for gadget controllers and drivers.
 There's some scsi changes that I think also went in through the scsi tree, but
 they merge just fine.  All of these patches have been in the linux-next tree
 for a while now.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.18 (GNU/Linux)
 
 iEYEABECAAYFAlAQhpcACgkQMUfUDdst+yms4wCgpMbfFYTZ8lHpDnXHYFv6qw8j
 FIsAmwT4mbT7m8C0k+ELV/5T2e0eYJEQ
 =QetG
 -----END PGP SIGNATURE-----

Merge tag 'usb-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB patches from Greg Kroah-Hartman:
 "Here's the big USB patch set for the 3.6-rc1 merge window.

  Lots of little changes in here, primarily for gadget controllers and
  drivers.  There's some scsi changes that I think also went in through
  the scsi tree, but they merge just fine.  All of these patches have
  been in the linux-next tree for a while now.

  Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

Fix up trivial conflicts in include/scsi/scsi_device.h (same libata
conflict that Jeff had already encountered)

* tag 'usb-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (207 commits)
  usb: Add USB_QUIRK_RESET_RESUME for all Logitech UVC webcams
  usb: Add quirk detection based on interface information
  usb: s3c-hsotg: Add header file protection macros in s3c-hsotg.h
  USB: ehci-s5p: Add vbus setup function to the s5p ehci glue layer
  USB: add USB_VENDOR_AND_INTERFACE_INFO() macro
  USB: notify phy when root hub port connect change
  USB: remove 8 bytes of padding from usb_host_interface on 64 bit builds
  USB: option: add ZTE MF821D
  USB: sierra: QMI mode MC7710 moved to qcserial
  USB: qcserial: adding Sierra Wireless devices
  USB: qcserial: support generic Qualcomm serial ports
  USB: qcserial: make probe more flexible
  USB: qcserial: centralize probe exit path
  USB: qcserial: consolidate usb_set_interface calls
  USB: ehci-s5p: Add support for device tree
  USB: ohci-exynos: Add support for device tree
  USB: ehci-omap: fix compile failure(v1)
  usb: host: tegra: pass correct pointer in ehci_setup()
  USB: ehci-fsl: Update ifdef check to work on 64-bit ppc
  USB: serial: keyspan: Removed unrequired parentheses.
  ...
2012-07-26 10:23:47 -07:00
Linus Torvalds c511dc1fb6 Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma
Pull slave-dmaengine update from Vinod Koul:
 "This time we have a new dmaengine driver from the tegra folks.  Also
  we have Guennadi's cleanup of sh drivers which incudes a library for
  sh drivers.  And the usual odd fixes in bunch of drivers and some nice
  cleanup of dw_dmac from Andy."

Fix up conflicts in drivers/mmc/host/sh_mmcif.c

* 'next' of git://git.infradead.org/users/vkoul/slave-dma: (46 commits)
  dmaengine: Cleanup logging messages
  mmc: sh_mmcif: switch to the new DMA channel allocation and configuration
  dma: sh: provide a migration path for slave drivers to stop using .private
  dma: sh: use an integer slave ID to improve API compatibility
  dmaengine: shdma: prepare to stop using struct dma_chan::private
  sh: remove unused DMA device pointer from SIU platform data
  ASoC: siu: don't use DMA device for channel filtering
  dmaengine: shdma: (cosmetic) simplify a static function
  dmaengine: at_hdmac: add a few const qualifiers
  dw_dmac: use 'u32' for LLI structure members, not dma_addr_t
  dw_dmac: mark dwc_dump_lli inline
  dma: mxs-dma: Export missing symbols from mxs-dma.c
  dma: shdma: convert to the shdma base library
  ASoC: fsi: prepare for conversion to the shdma base library
  usb: renesas_usbhs: prepare for conversion to the shdma base library
  ASoC: siu: prepare for conversion to the shdma base library
  serial: sh-sci: prepare for conversion to the shdma base library
  mmc: sh_mobile_sdhi: prepare for conversion to the shdma base library
  mmc: sh_mmcif: remove unneeded struct sh_mmcif_dma, prepare to shdma conversion
  dma: shdma: prepare for conversion to the shdma base library
  ...
2012-07-24 17:12:54 -07:00
Guennadi Liakhovetski f19b7e0db7 usb: renesas_usbhs: prepare for conversion to the shdma base library
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-07-13 09:13:08 +05:30
Kuninori Morimoto 2f0de9d844 usb: renesas_usbhs: use dmaengine helper functions
This patch used dmaengine helper functions instead of using hand setting.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-09 09:48:26 -07:00
Paul Bolle cc502bb741 renesas_usbhs: cleanup quoted includes
A few quoted includes start with a superfluous "./". Clean up those
quoted includes.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-06-05 10:15:25 +02:00
Shimoda, Yoshihiro cac402dd08 usb: renesas_usbhs: gadget: add support for set_selfpowered
The previous code always set to USB_DEVICE_SELF_POWERED in GET_STATUS.
So, this patch adds set_selfpowered().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-05-04 15:53:05 +03:00
Linus Torvalds ef08e78268 Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma
Pull slave-dmaengine update from Vinod Koul:
 "This includes the cookie cleanup by Russell, the addition of context
  parameter for dmaengine APIs, more arm dmaengine driver cleanup by
  moving code to dmaengine, this time for imx by Javier and pl330 by
  Boojin along with the usual driver fixes."

Fix up some fairly trivial conflicts with various other cleanups.

* 'next' of git://git.infradead.org/users/vkoul/slave-dma: (67 commits)
  dmaengine: imx: fix the build failure on x86_64
  dmaengine: i.MX: Fix merge of cookie branch.
  dmaengine: i.MX: Add support for interleaved transfers.
  dmaengine: imx-dma: use 'dev_dbg' and 'dev_warn' for messages.
  dmaengine: imx-dma: remove 'imx_dmav1_baseaddr' and 'dma_clk'.
  dmaengine: imx-dma: remove unused arg of imxdma_sg_next.
  dmaengine: imx-dma: remove internal structure.
  dmaengine: imx-dma: remove 'resbytes' field of 'internal' structure.
  dmaengine: imx-dma: remove 'in_use' field of 'internal' structure.
  dmaengine: imx-dma: remove sg member from internal structure.
  dmaengine: imx-dma: remove 'imxdma_setup_sg_hw' function.
  dmaengine: imx-dma: remove 'imxdma_config_channel_hw' function.
  dmaengine: imx-dma: remove 'imxdma_setup_mem2mem_hw' function.
  dmaengine: imx-dma: remove dma_mode member of internal structure.
  dmaengine: imx-dma: remove data member from internal structure.
  dmaengine: imx-dma: merge old dma-v1.c with imx-dma.c
  dmaengine: at_hdmac: add slave config operation
  dmaengine: add context parameter to prep_slave_sg and prep_dma_cyclic
  dmaengine/dma_slave: introduce inline wrappers
  dma: imx-sdma: Treat firmware messages as warnings instead of erros
  ...
2012-03-29 15:34:57 -07:00
Alexandre Bounine 16052827d9 dmaengine/dma_slave: introduce inline wrappers
Add inline wrappers for device_prep_slave_sg() and device_prep_dma_cyclic()
interfaces to hide new parameter from current users of affected interfaces.
Convert current users to use new wrappers instead of direct calls.
Suggested by Russell King [https://lkml.org/lkml/2012/2/3/269].

Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-03-21 19:20:22 +05:30
Greg Kroah-Hartman f9b0f51709 This merge is rather big. Here's what it contains:
For am5536udc we have just simple coding style fixes. Nothing that has any
 potential to cause any issues going forward.
 
 With mv_udc, there's only one single change removing an unneeded NULL check.
 
 at91_udc also only saw a single change this merge window, and that's only
 removing a duplicated header.
 
 The Renesas controller has a few more involved changes. Support for SUDMAC was
 added, there's now a special handling of IRQ resources for when the IRQ line is
 shared between Renesas controller and SUDMAC, we also had a bug fix where
 Renesas controller would sleep in atomic context while doing DMA transfers from
 a tasklet. There were also a set of minor cleanups.
 
 The FSL UDC also had a scheduling in atomic context bug fix, but that's all.
 
 Thanks to Sebastian, the dummy_hcd now works better than ever with support for
 scatterlists and streams. Sebastian also added SuperSpeed descriptors to the
 serial gadgets.
 
 The highlight on this merge is the addition of a generic API for mapping and
 unmapping usb_requests. This will avoid code duplication on all UDC controllers
 and also kills all the defines for DMA_ADDR_INVALID which UDC controllers
 sprinkled around. A few of the UDC controllers were already converted to use
 this new API.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJPTeaWAAoJEIaOsuA1yqREdT8QAK8ob6RqnZs9en7NdaBTq18G
 qPtdheAZ9TkWxv+JE69Nqq1DuLO93+ZqLt88kaIVp/jTg+MxZ4qeANe9Nga0Qr+U
 Qc4d9HOkKsLGC+E45TApAMCQkPZ3DxbObJRUeJI7DBefPJ+MzQYAeeQtzjEeKKf8
 hGY5kh5FdXds/TlTePwWuyVoe09grgoy7cvptIVJRZiWx8+n9PZeMiKe+vAmQDEc
 +V0FfOMZLcSY9Oi14faYDrOFIV5cjBxnwnBpinOYx5TArxep35HSynt/mJtW2a7/
 lcdpbS4Hn35LJQWcYl0onx0GNgvI/YDYg9V6vrSjoBVU7vZ/7slZ896yjiovmAsc
 KQXxKoqss80sd+rYUe/si/Ues+koN9HztucG//+9cuS2ZCnDydHMJHonMBXUZguv
 o2gzQwjRCUOcGLj+vnSAFiBAGZwAZV99rA2VgIz3dSyegDN+SverXJscOuvzzW/V
 6yERLjbmxwtIQczlUMPQgGE9gSMYKRzyDV4JlO1xtfsBwcVc0c4YE+ZnWOeEAbOa
 evrI/3RGjP12rY+eyntlN2ZpHq2ZJnS7guDjooi0mGK16LWeQh8h0zD24XoUiwnr
 nhkv+eqWJQXV2iQcyezO1TLnxhZ7LZdtfkYg5MH/VqGIuh6SNQdhew4bijUuKKsq
 +aLPREySYHdIloQjPBe/
 =RR+f
 -----END PGP SIGNATURE-----

Merge tag 'gadget-for-v3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

USB: Gadget: changes for 3.4

This merge is rather big. Here's what it contains:

For am5536udc we have just simple coding style fixes. Nothing that has any
potential to cause any issues going forward.

With mv_udc, there's only one single change removing an unneeded NULL check.

at91_udc also only saw a single change this merge window, and that's only
removing a duplicated header.

The Renesas controller has a few more involved changes. Support for SUDMAC was
added, there's now a special handling of IRQ resources for when the IRQ line is
shared between Renesas controller and SUDMAC, we also had a bug fix where
Renesas controller would sleep in atomic context while doing DMA transfers from
a tasklet. There were also a set of minor cleanups.

The FSL UDC also had a scheduling in atomic context bug fix, but that's all.

Thanks to Sebastian, the dummy_hcd now works better than ever with support for
scatterlists and streams. Sebastian also added SuperSpeed descriptors to the
serial gadgets.

The highlight on this merge is the addition of a generic API for mapping and
unmapping usb_requests. This will avoid code duplication on all UDC controllers
and also kills all the defines for DMA_ADDR_INVALID which UDC controllers
sprinkled around. A few of the UDC controllers were already converted to use
this new API.

Conflicts:
	drivers/usb/dwc3/gadget.c
2012-03-01 09:20:28 -08:00
Felipe Balbi ade78f9feb usb: renesas: gadget: use generic map/unmap routines
those routines have everything we need to map/unmap
USB requests and it's better to use them.

Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-28 14:49:06 +02:00
Kuninori Morimoto 3b2a2e4717 usb: renesas_usbhs: bugfix: add .release function to gpriv->gadget.dev
This patch fixup below warning on device_unregister()

renesas_usbhs renesas_usbhs.1: host probed
renesas_usbhs renesas_usbhs.1: gadget probed
renesas_usbhs renesas_usbhs.1: irq request err
------------[ cut here ]------------
WARNING: at ${LINUX}/drivers/base/core.c:1)
Device 'gadget' does not have a release() function, it is broken and must be fi.
Modules linked in:
[<c000e25c>] (unwind_backtrace+0x0/0xe4) from [<c0016960>] (warn_slowpath_commo)
[<c0016960>] (warn_slowpath_common+0x4c/0x64) from [<c00169f8>] (warn_slowpath_)
[<c00169f8>] (warn_slowpath_fmt+0x2c/0x3c) from [<c0185b80>] (device_release+0x)
[<c0185b80>] (device_release+0x70/0x84) from [<c013e300>] (kobject_cleanup+0x58)
[<c013e300>] (kobject_cleanup+0x58/0x6c) from [<c01cba14>] (usbhs_mod_gadget_re)
[<c01cba14>] (usbhs_mod_gadget_remove+0x3c/0x6c) from [<c01c8384>] (usbhs_mod_p)
[<c01c8384>] (usbhs_mod_probe+0x68/0x80) from [<c01c7f84>] (usbhs_probe+0x1cc/0)
...

Cc: stable@vger.kernel.org
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-24 12:22:39 +02:00
Guennadi Liakhovetski 6e4b74e469 usb: renesas: fix scheduling in atomic context bug
The current renesas_usbhs driver triggers

BUG: scheduling while atomic: ksoftirqd/0/3/0x00000102

with enabled CONFIG_DEBUG_ATOMIC_SLEEP, by submitting DMA transfers from
an atomic (tasklet) context, which is not supported by the shdma dmaengine
driver. Fix it by switching to a work.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-14 13:44:53 +02:00
Guennadi Liakhovetski d526128694 usb: renesas_usbhs: (cosmetic) simplify list operations
list.h already provide helpers to find the first entry and to move list
nodes to the tail of another list. This patch simply uses those helpers,
no functional changes.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-14 13:44:27 +02:00
Jesper Juhl 7983bc74fc usb: renesas: silence uninitialized variable report in usbhsg_recip_run_handle()
In drivers/usb/renesas_usbhs/mod_gadget.c::usbhsg_recip_run_handle()
the Coverity Prevent checker currently flags a warning about possibly
uninitialized use of 'ret' i usbhsg_recip_run_handle(). It does this
since it assumes we take one of the non-default branches in the switch
and then subsequently take the false branch in the 'if (func)' case
below. This exact scenario will never happen, but Coverity can't see
that for some reason. This patch initializes 'ret' to '0' when it is
declared which should shut up this report and won't really hurt - so
why not? At least then it's clear that 'ret' is always initialized..

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-01-24 15:43:06 +02:00
Shimoda, Yoshihiro 5ea4399457 usb: renesas_usbhs: add support for SUDMAC
The SUDMAC uses 8-bit width only. So, when the driver uses SUDMAC,
we have to clear the MBW_32.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-01-24 11:33:04 +02:00
Shimoda, Yoshihiro 53069af3fa usb: renesas_usbhs: add IRQ resource decoding for IRQF_SHARED
In case of the SH7757, the irq number of USB module and SUDMAC
are the same. So, we have to set the IRQF_SHARED in such a case.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-01-24 11:32:56 +02:00
Linus Torvalds 57f2685c16 Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma
* 'next' of git://git.infradead.org/users/vkoul/slave-dma: (53 commits)
  ARM: mach-shmobile: specify CHCLR registers on SH7372
  dma: shdma: fix runtime PM: clear channel buffers on reset
  dma/imx-sdma: save irq flags when use spin_lock in sdma_tx_submit
  dmaengine/ste_dma40: clear LNK on channel startup
  dmaengine: intel_mid_dma: remove legacy pm interface
  ASoC: mxs: correct 'direction' of device_prep_dma_cyclic
  dmaengine: intel_mid_dma: error path fix
  dmaengine: intel_mid_dma: locking and freeing fixes
  mtd: gpmi-nand: move to dma_transfer_direction
  mtd: fix compile error for gpmi-nand
  mmc: mxs-mmc: fix the dma_transfer_direction migration
  dmaengine: add DMA_TRANS_NONE to dma_transfer_direction
  dma: mxs-dma: Don't use CLKGATE bits in CTRL0 to disable DMA channels
  dma: mxs-dma: make mxs_dma_prep_slave_sg() multi user safe
  dma: mxs-dma: Always leave mxs_dma_init() with the clock disabled.
  dma: mxs-dma: fix a typo in comment
  DMA: PL330: Remove pm_runtime_xxx calls from pl330 probe/remove
  video i.MX IPU: Fix display connections
  i.MX IPU DMA: Fix wrong burstsize settings
  dmaengine/ste_dma40: allow fixed physical channel
  ...

Fix up conflicts in drivers/dma/{Kconfig,mxs-dma.c,pl330.c}

The conflicts looked pretty trivial, but I'll ask people to verify them.
2012-01-17 18:40:24 -08:00
Linus Torvalds 55b81e6f27 Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
* 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (232 commits)
  USB: Add USB-ID for Multiplex RC serial adapter to cp210x.c
  xhci: Clean up 32-bit build warnings.
  USB: update documentation for usbmon
  usb: usb-storage doesn't support dynamic id currently, the patch disables the feature to fix an oops
  drivers/usb/class/cdc-acm.c: clear dangling pointer
  drivers/usb/dwc3/dwc3-pci.c: introduce missing kfree
  drivers/usb/host/isp1760-if.c: introduce missing kfree
  usb: option: add ZD Incorporated HSPA modem
  usb: ch9: fix up MaxStreams helper
  USB: usb-skeleton.c: cleanup open_count
  USB: usb-skeleton.c: fix open/disconnect race
  xhci: Properly handle COMP_2ND_BW_ERR
  USB: remove dead code from suspend/resume path
  USB: add quirk for another camera
  drivers: usb: wusbcore: Fix dependency for USB_WUSB
  xhci: Better debugging for critical host errors.
  xhci: Be less verbose during URB cancellation.
  xhci: Remove debugging about ring structure allocation.
  xhci: Remove debugging about toggling cycle bits.
  xhci: Remove debugging for individual transfers.
  ...
2012-01-09 12:09:47 -08:00
Greg Kroah-Hartman ee0db58ade Merge branch 'for-gadget/next' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
* 'for-gadget/next' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: (24 commits)
  usb: dwc3: gadget: add support for SG lists
  usb: dwc3: gadget: don't force 'LST' always
  usb: dwc3: gadget: don't return anything on prepare trbs
  usb: dwc3: gadget: re-factor dwc3_prepare_trbs()
  usb: gadget: introduce support for sg lists
  usb: renesas: pipe: convert a long if into a XOR operation
  usb: gadget: remove useless depends on Kconfig
  usb: gadget: s3c-hsudc: remove the_controller global
  usb: gadget: s3c-hsudc: use release_mem_region instead of release_resource
  usb: gadget: s3c-hsudc: Add regulator handling
  usb: gadget: s3c-hsudc: use udc_start and udc_stop functions
  usb: gadget: s3c-hsudc: move device registration to probe
  usb: gadget: s3c-hsudc: add missing otg_put_transceiver in probe
  usb: gadget: s3c-hsudc: add __devinit to probe function
  usb: gadget: s3c-hsudc: move platform_data struct to global header
  USB: EHCI: Add Marvell Host Controller driver
  USB: OTG: add Marvell usb OTG driver support
  usb: gadget: mv_udc: drop ARCH dependency
  usb: gadget: mv_udc: fix bug in ep_dequeue
  usb: gadget: enlarge maxburst bit width.
  ...
2011-12-22 14:05:19 -08:00
Felipe Balbi 14ff96e04c usb: renesas: pipe: convert a long if into a XOR operation
This is just a minor optimization for the long
if we have on the driver.

When we want to check that one input is true
and the other must be false, the bitwise XOR
operator will achieve that for us.

Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-21 13:24:43 +02:00
Dan Carpenter 8418153a4c usb: renesas_usbhs: silence a gcc warning
Gcc complains about this printk:
drivers/usb/renesas_usbhs/mod_gadget.c:188:3: warning: format ‘%x’
	expects argument of type ‘unsigned int’, but argument 3 has type
	‘dma_addr_t’ [-Wformat]

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-15 13:45:58 +02:00
Kuninori Morimoto d9b78f33d9 usb: renesas_usbhs: tidyup for smatch warnings
This patch tidyup below smatch complaint

drivers/usb/renesas_usbhs/mod_host.c +642 usbhsh_queue_done()
	 warn: variable dereferenced before check 'urb' (see line 636)

Special thanks to Dan

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-15 12:59:17 +02:00
Greg Kroah-Hartman 121a8cdd79 Merge branch 'for-next/gadget' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
* 'for-next/gadget' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: (50 commits)
  usb: renesas_usbhs: show error reason on usbhsh_urb_enqueu()
  usb: renesas_usbhs: add force packet remove method
  usb: renesas_usbhs: care usb_hcd_giveback_urb() status
  usb: renesas_usbhs: add usbhsh_is_running()
  usb: renesas_usbhs: disable attch irq after device attached
  usb: renesas_usbhs: care pipe sequence
  usb: renesas_usbhs: add usbhs_pipe_attach() method
  usb: renesas_usbhs: add usbhsh_endpoint_detach_all() for error case
  usb: renesas_usbhs: modify device attach method
  usb: renesas_usbhs: pop packet when urb dequeued
  usb: renesas_usbhs: add lost error value when enqueue
  usb: gadget: mv_udc: replace some debug info
  usb: gadget: mv_udc: refine suspend/resume function
  usb: gadget: mv_udc: refine the clock relative code
  usb: gadget: mv_udc: disable ISR when stopped
  usb: gadget: mv_udc: add otg relative code
  usb: gadget: Use kcalloc instead of kzalloc to allocate array
  usb: renesas_usbhs: remove the_controller_link
  usb: renesas_usbhs: add test-mode support
  usb: renesas_usbhs: call usbhsg_queue_pop() when pipe disable.
  ...
2011-12-13 09:37:40 -08:00
Kuninori Morimoto 15a3838b10 usb: renesas_usbhs: show error reason on usbhsh_urb_enqueu()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-13 13:06:30 +02:00
Kuninori Morimoto 2d833faad2 usb: renesas_usbhs: add force packet remove method
Packet should be force removed when reset/detach

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-13 13:06:30 +02:00
Kuninori Morimoto 6d0376f844 usb: renesas_usbhs: care usb_hcd_giveback_urb() status
Without this patch, USB host hub shows error when cable was detached

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-13 13:06:29 +02:00
Kuninori Morimoto b1930da088 usb: renesas_usbhs: add usbhsh_is_running()
It is possible to judge whether renesas_usbhs driver is running,
by checking attch irq mask.
This patch adds usbhsh_is_running() to check it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-13 13:06:28 +02:00
Kuninori Morimoto 31e00fd116 usb: renesas_usbhs: disable attch irq after device attached
attch interrupt might happen infinitely on some USB hub (self power?).
This patch disable attch irq after device attached,
and enable it again when detach irq happen.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-13 13:06:27 +02:00
Kuninori Morimoto 3edeee3893 usb: renesas_usbhs: care pipe sequence
driver has to re-use the limited pipe for each device/endpoint
when it is USB host hub mode, since number of pipe has limitation.

Then, each pipe should care own pipe sequence for next packet.
This patch adds sequence control.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-13 13:06:26 +02:00