summaryrefslogtreecommitdiffstats
path: root/drivers/usb/renesas_usbhs/pipe.h
Commit message (Collapse)AuthorAgeFilesLines
* usb: renesas_usbhs: add support for USB-DMACYoshihiro Shimoda2015-03-131-0/+1
| | | | | | | | | | | | | | | | 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>
* usb: renesas_usbhs: fix the behavior of some usbhs_pkt_handleYoshihiro Shimoda2014-09-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* usb: renesas_usbhs: gadget: fix re-enabling pipe without re-connectingYoshihiro Shimoda2014-07-101-0/+1
| | | | | | | | | | | | | | | | | | | | 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>
* usb: renesas_usbhs: tidyup original usbhsx_for_each_xxx macroKuninori Morimoto2013-07-291-3/+3
| | | | | | | | | | | | | 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>
* Merge tag 'gadget-for-v3.8' of ↵Greg Kroah-Hartman2012-11-111-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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."
| * usb: renesas_usbhs: use transfer counter if IN direction bulk pipeKuninori Morimoto2012-11-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | usb: renesas_usbhs: fixup __usbhs_for_each_pipe 1st posKuninori Morimoto2012-10-161-1/+1
|/ | | | | | | | | | | __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>
* renesas_usbhs: cleanup quoted includesPaul Bolle2012-06-051-2/+2
| | | | | | | | 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>
* usb: renesas_usbhs: add usbhs_pipe_is_stall()Kuninori Morimoto2011-12-121-0/+1
| | | | | | | This is preparation for chapter 9 test Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: renesas_usbhs: modify pipe sequence settingsKuninori Morimoto2011-10-131-1/+4
| | | | | | | | renesas_usbhs can manually set DATA0/DATA1. This patch is prepare for mod_host support Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: renesas_usbhs: move done callback to struct usbhs_pktKuninori Morimoto2011-10-131-3/+0
| | | | | | | | | transfer done function was registered in struct struct usbhs_pipe_info. It was good for mod_gadget, but not good for mod_host. This function move it to struct usbhs_pkt. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: renesas_usbhs: add usbhs_pipe_name()Kuninori Morimoto2011-10-131-0/+1
| | | | | | | pipe name is usefull function for mod_xxx Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: renesas_usbhs: add device select support in ↵Kuninori Morimoto2011-10-131-1/+2
| | | | | | | | | usbhs_pipe_config_update() device select method will be used on mod_host Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: renesas_usbhs: add struct usbhs_priv to packet done functionKuninori Morimoto2011-10-131-2/+3
| | | | | | | | | There was no method to get struct usbhs_priv when packet transfer done function was called. This patch allow that callback function receive it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: renesas_usbhs: add usbhs_dcp_dir_for_host()Kuninori Morimoto2011-10-131-0/+1
| | | | | | | | | renesas_usbhs device needs special bit settings if it was mod_host and dcp pipe. This patch support it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: renesas_usbhs: move usbhs_usbreq_get/set_val() to common.cKuninori Morimoto2011-10-131-6/+0
| | | | | | | | | usbhs_usbreq_get/set_val() functions were in pipe.c file, but it is irrelevant to pipe. this patch move it to common.c Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: renesas_usbhs: move usbhsp_type() to usbhs_pipe_type()Kuninori Morimoto2011-10-131-0/+3
| | | | | | | | Pipe type check macro will be used in other files. This patch move local macro to global macro. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: renesas_usbhs: struct usbhs_pipe hold handlerKuninori Morimoto2011-10-131-0/+2
| | | | | | | | packet handler had moved to struct usbhs_pipe from struct usbhsg_uep. it is preparation of mod_host support Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: renesas_usbhs: each pipe hold maxpacket sizeKuninori Morimoto2011-10-131-0/+2
| | | | | | | | | | | | | Current renesas_usbhs pipe accessed DCPMAXP/PIPEMAXP register to get own maxpacket size every time. But maxpacket size isn't changed after pipe start, and register access is too slow. This patch adds new maxp variable to keep own maxpacket. And un-used function are removed. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: renesas_usbhs: remove desc from usbhs_pipe_mallocKuninori Morimoto2011-10-131-2/+2
| | | | | | | | | | | Current usbhs_pipe_malloc() used usb_endpoint_descriptor to get necessary information. It was very good for mod_gadget which allocate pipe in runtime, but is not good for mod_host which allocate pipe in initial timing. This patch remove usb_endpoint_descriptor from usbhs_pipe_malloc() Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: renesas_usbhs: fixup connection failKuninori Morimoto2011-06-141-0/+1
| | | | | | | | Sometimes the connection fail happen on renesas_usbhs. This patch fix it up. Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: renesas_usbhs: add DMAEngine supportKuninori Morimoto2011-06-071-1/+3
| | | | | | | | | | | | | | | | | | | | USB DMA was installed on "normal DMAC" when SH7724 or older SuperH, but the "USB-DMAC" was prepared on recent SuperH. These 2 DMAC have a little bit different behavior. This patch add DMAEngine code for "normal DMAC", but it is still using PIO fifo. The DMA fifo will be formally supported in the future. You can enable DMA fifo by local fixup usbhs_fifo_pio_push_handler -> usbhs_fifo_dma_push_handler usbhs_fifo_pio_pop_handler -> usbhs_fifo_dma_pop_handler on usbhsg_ep_enable. This DMAEngine was tested by g_file_storage on SH7724 Ecovec board Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: renesas_usbhs: add pipe/fifo linkKuninori Morimoto2011-06-071-0/+4
| | | | | | | | | | | | renesas_usbhs has CFIFO which is for PIO transfer, and D0FIFO/D1FIFO which are for DMA transfer. The pipe selects one of these fifo when it send/recv data. But fifo must not be selected to different pipe in same time. This patch add pipe/fifo link for each other, and fifo is not selected by another pipe until it is unselected. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: renesas_usbhs: modify data transfer interruptKuninori Morimoto2011-06-071-4/+2
| | | | | | | | | | | On current driver, overall data transfer method was implemented in fifo.c, but its interrupt which is member of packet queue control was still in mod_gadget.c. This patch move it into fifo.c. By this patch, the packet/fifo control is independent from mod_gadget. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: renesas_usbhs: modify packet queue control methodKuninori Morimoto2011-06-071-0/+1
| | | | | | | | | | | Current renesas_usbhs driver is controlling packet queue on mod_gadget.c. But it has relationship with pipe/fifo, not host/gadget. So, controlling USB packet queue in pipe.c/fifo.c is more convenient than in mod_gadget.c. This patch modify it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: renesas_usbhs: divide data transfer functionsKuninori Morimoto2011-06-071-1/+7
| | | | | | | | | | | | DMAEngine will be supported to this driver in the future. Then, both PIO and DMA data transfer method should be supported. But, the transfer function can returns the result immediately in PIO version, but it can't in DMA version. This patch divides data transfer functions into top/bottom half in preparation for DMAEngine support. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: renesas_usbhs: fifo became independent from pipe.Kuninori Morimoto2011-06-071-19/+10
| | | | | | | | | | | Current renesas_usbhs has PIO data transfer mode which controls CFIFO. And it was implemented in pipe.c. But, fifo control method needs more flexible implementation to support DMAEngine. This patch create fifo.c, and it became independent from pipe.c. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: renesas_usbhs: modify pipe direction flagsKuninori Morimoto2011-06-071-0/+2
| | | | | | | | | | | | | Current driver had pipe direction flag which came from usb_endpoint_dir_in(). It means "input direction" for HOST, and "out direction" for Gadget. But driver needs "input direction for pipe". This patch adds IS_DIR_HOST flags and care both "input direction for HOST" and "input direction for pipe" Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: renesas_usbhs: fixup cast warningKuninori Morimoto2011-04-291-2/+1
| | | | | | | | This patch fixup cast warning on 64 bit compiler Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reported-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: renesas_usbhs: Add Renesas USBHS common codeKuninori Morimoto2011-04-131-0/+105
Renesas SuperH has USBHS IP which can switch Host / Function. This driver is designed so that Host / Function may dynamically change. This patch add usb/renesas_usbhs and common code for SuperH USBHS. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
OpenPOWER on IntegriCloud