Commit Graph

276673 Commits (dee19be7d8ed428e701331f9428d14d2701589f5)

Author SHA1 Message Date
Heiko Stübner dee19be7d8 usb: gadget: s3c-hsudc: use release_mem_region instead of release_resource
As the memory region is requested through request_mem_region
use the correct paired method to release it in the error path
and don't go "beneath the API".

Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-21 13:24:41 +02:00
Heiko Stübner bab7d037c8 usb: gadget: s3c-hsudc: Add regulator handling
The udc has three supplies: vdda (3.3V), vddi (1.2V) and vddosc (1.8-3.3V).
Turn these on and off on start and stop calls.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-21 13:24:40 +02:00
Heiko Stübner d93e2600d8 usb: gadget: s3c-hsudc: use udc_start and udc_stop functions
udc_start and udc_stop reduce code duplication in comparison to
start and stop generalising calls done by all drivers
(i.e. bind and unbind) and moving these calls to common code.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-21 13:24:39 +02:00
Heiko Stübner 103495aaf0 usb: gadget: s3c-hsudc: move device registration to probe
Instead of adding and deleting the gadget device in the start and stop
invocations. Use device_register in the probe method to initialize
and add the gadget device.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-21 13:24:39 +02:00
Heiko Stübner e9bcb9e5fe usb: gadget: s3c-hsudc: add missing otg_put_transceiver in probe
The number of get and put calls should always be equal.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-21 13:24:38 +02:00
Heiko Stübner a197756271 usb: gadget: s3c-hsudc: add __devinit to probe function
Fixes possible section mismatch warnings.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-21 13:24:37 +02:00
Heiko Stübner 715a3e41e7 usb: gadget: s3c-hsudc: move platform_data struct to global header
Gadget drivers should be compilable on all architectures.
This patch removes one dependency on architecture-specific code.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-21 13:24:27 +02:00
Neil Zhang 3a082ec9b2 USB: EHCI: Add Marvell Host Controller driver
This patch adds support for EHCI compliant HSUSB Host controller found
on Marvell Socs.

It fits both OTG and SPH controller on marvell Socs, including
PXA9xx/MMP2/MMP3/MGx.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-20 12:58:13 +02:00
Neil Zhang 277164f03f USB: OTG: add Marvell usb OTG driver support
This driver is for ChipIdea USB OTG controller on Marvell Socs.
PXA9xx/MMP2/MMP3/MGx all have this USB OTG controller.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-20 12:58:07 +02:00
Neil Zhang 5e6c86b017 usb: gadget: mv_udc: drop ARCH dependency
This patch do the following things:
1. Change the Kconfig information.
2. Rename the driver name.
3. Don't do any type cast to io memory.
4. Add dummy stub for clk framework.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-20 12:55:06 +02:00
Neil Zhang c2bbd16b03 usb: gadget: mv_udc: fix bug in ep_dequeue
According to ChipIdea's SPEC, we cannot touch curr_dtd_ptr in dqh
directly, use prime endpoint instead.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-20 12:53:21 +02:00
Yu Xu a7250db363 usb: gadget: enlarge maxburst bit width.
For super speed bulk transfer, the max burst size
is 16, so that 4 bits of maxburst cannot store it.

Signed-off-by: Yu Xu <yuxu@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-19 12:19:50 +02:00
Neil Zhang 91d959d8e5 usb: gadget: mv_udc: rewrite queue_dtd according to spec
Rewrite function queue_dtd according to ChipIdea's reference manual.
Remove all unnecessary logic, it will enhance the performance.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-19 10:02:24 +02:00
Neil Zhang 86bb702813 usb: gadget: mv_udc: fix readl error
readl expected 'const volatile void *' as the argument.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-19 10:02:16 +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
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
Kuninori Morimoto e5679d07a6 usb: renesas_usbhs: add usbhs_pipe_attach() method
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.
This patch adds usbhsh_pipe_attach/detach() functions for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-13 13:06:25 +02:00
Kuninori Morimoto e4c57ded48 usb: renesas_usbhs: add usbhsh_endpoint_detach_all() for error case
This patch adds usbhsh_endpoint_detach_all() for error case.
usbhs_endpoitn_xxx() functions were moved to upper side in source code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-13 13:06:24 +02:00
Kuninori Morimoto c1e4877a41 usb: renesas_usbhs: modify device attach method
Current renesas_usbhs had been assigning udev to each urb.
It was executed even though it was device0.
For this reason, the device0 had to set the new device address
which has still not been assigned. (it will be assigned on next step).
Current renesas_usbhs used fixed address for it.
but it is not good for USB hub support.
This patch modifies this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-13 13:06:23 +02:00
Kuninori Morimoto 547965436d usb: renesas_usbhs: pop packet when urb dequeued
usbhsh_ureq_free() is not enough when urb dequeued.

Without this patch, the driver can not recognize re-connected
USB device after USB hub disconnected

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 12:26:35 +02:00
Kuninori Morimoto 37332ee0df usb: renesas_usbhs: add lost error value when enqueue
usbhsh_urb_enqueue() didn't have error value when
usbhsh_device_attach() failed

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 12:26:35 +02:00
Neil Zhang 2bcb751440 usb: gadget: mv_udc: replace some debug info
replace some debug info, make it easy to use.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:25 +02:00
Neil Zhang 5076ae5588 usb: gadget: mv_udc: refine suspend/resume function
This patch impletments system suspend/resume functions for Marvell
otg controller.
If OTG is enabled, OTG driver will do most of the work.
If not, we will check clock gating.
  If clock gating is enabled, the UDC will be start/stop automatically.
  If not, UDC will be start/stop in suspend/resume functions.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:24 +02:00
Neil Zhang 85ff7bfb6e usb: gadget: mv_udc: refine the clock relative code
Split the clock relative code from clock gating solution.
Then we can remove some duplicate code, make the code more clean.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:24 +02:00
Neil Zhang 309d6d2be4 usb: gadget: mv_udc: disable ISR when stopped
When device is stopped, there is no need to handle ISR.
Especially when otg switch to HOST mode.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:23 +02:00
Neil Zhang 487d54d172 usb: gadget: mv_udc: add otg relative code
Add otg relative code, make it possible to switch between host and
device.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:22 +02:00
Thomas Meyer 9823a52539 usb: gadget: Use kcalloc instead of kzalloc to allocate array
The advantage of kcalloc is, that will prevent integer overflows which could
result from the multiplication of number of elements and size and it is also
a bit nicer to read.

The semantic patch that makes this change is available
in https://lkml.org/lkml/2011/11/25/107

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Acked-by: Michal Nazarewicz <[4]mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:21 +02:00
Kuninori Morimoto b294b20336 usb: renesas_usbhs: remove the_controller_link
current renesas_usbhs is using new style udc_start/stop from
af1d7056a5
(usb: gadget: renesas: convert to new style).

with this patch we can finally remove the global "the_controller_link"

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:20 +02:00
Kuninori Morimoto dfbb7f4fba usb: renesas_usbhs: add test-mode support
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:20 +02:00
Kuninori Morimoto 91b158f4d1 usb: renesas_usbhs: call usbhsg_queue_pop() when pipe disable.
When poping packet from queue, it needs correct end procedure.
This patch call usbhsg_queue_pop() in usbhsg_pipe_disable().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:19 +02:00
Kuninori Morimoto 25fa70795b usb: renesas_usbhs: send packet in necessary timing.
Current renesas_usbhs driver always tries to send packet in end of recip handler.
But it breaks chapter 9 EndpointHalt test.
This patch fixup this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:18 +02:00
Kuninori Morimoto 17f7f76940 usb: renesas_usbhs: add basic USB_REQ_GET_STATUS support
This patch adds basic get-status support for chapter 9 test.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:16 +02:00
Kuninori Morimoto ced6e09e6e usb: renesas_usbhs: add basic USB_REQ_SET_FEATURE support
This patch adds basic set-feature support for chapter 9 test.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:16 +02:00
Kuninori Morimoto 9cf1b06e90 usb: renesas_usbhs: add usbhs_pipe_is_stall()
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>
2011-12-12 11:45:15 +02:00
Kuninori Morimoto 4b81593201 usb: renesas_usbhs: remove superfluous usbhs_lock from recip handler
recip handler will call various functions which are holding
usbhs_lock.

This patch removes superfluous usbhs_lock from recip handler
to escape double lock.

[ balbi@ti.com : brushed up commit log a bit ]

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:14 +02:00
Michal Nazarewicz 7177aed44f usb: gadget: rename usb_gadget_driver::speed to max_speed
This commit renames the “speed” field of the usb_gadget_driver
structure to “max_speed”.  This is so that to make it more
apparent that the field represents the maximum speed gadget
driver can support.

This also make the field look more like fields with the same
name in usb_gadget and usb_composite_driver structures.  All
of those represent the *maximal* speed given entity supports.

After this commit, there are the following fields in various
structures:
* usb_gadget::speed - the current connection speed,
* usb_gadget::max_speed - maximal speed UDC supports,
* usb_gadget_driver::max_speed - maximal speed gadget driver
  supports, and
* usb_composite_driver::max_speed - maximal speed composite
  gadget supports.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:12 +02:00
Michal Nazarewicz d327ab5b6d usb: gadget: replace usb_gadget::is_dualspeed with max_speed
This commit replaces usb_gadget's is_dualspeed field with
a max_speed field.

[ balbi@ti.com : Fixed DWC3 driver ]

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:11 +02:00
Kuninori Morimoto 7aac8d1537 usb: gadget: renesas_usbhs: parameter cleanup for usbhsh_device_xx()
current mod_host used usbhs_device_alloc/free(),
but allocated variable was attached to each xx->hcpriv.
The intuitively clear name was not xxx_alloc/free() but xxx_attach/detach().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:10 +02:00
Kuninori Morimoto 4825093e9d usb: gadget: renesas_usbhs: parameter cleanup for usbhsh_endpoint_xx()
current mod_host used usbhs_endpoint_alloc/free(),
but allocated variable was attached to each xx->hcpriv.
The intuitively clear name was not xxx_alloc/free() but xxx_attach/detach().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:09 +02:00
Kuninori Morimoto 3eddc9e4c8 usb: gadget: renesas_usbhs: parameter cleanup for usbhsh_xx_queue_push()
This patch remove unneeded parameter from usbhsh_xx_queue_push()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:09 +02:00
Kuninori Morimoto f352741d27 usb: gadget: renesas_usbhs: cleanup usbhsh_endpoint_xxx()
this patch cleanup
 - make sure static function
 - remove unneeded label
 - useless local variable were removed

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:08 +02:00
Kuninori Morimoto d399f90d19 usb: gadget: renesas_usbhs: adds spin lock area on mod_host
spin lock was needed in mod_host.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:07 +02:00
Kuninori Morimoto ab14230854 usb: gadget: renesas_usbhs: check device0 status when alloc
device0 was treated without checking in usbhsh_device_alloc().
but "udev->usbv" and "dev_set_drvdata()" will be overwritten
if device0  was multi-allocated.
This patch fixes this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:07 +02:00
Kuninori Morimoto c5b963f809 usb: gadget: renesas_usbhs: remove usbhsh_request list
mod_host had usbhsh_request active/free list.
it was almost meaningless, and vainly complicated.
This patch remove it.

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