Commit graph

276830 commits

Author SHA1 Message Date
Felipe Balbi
0949e99b05 usb: dwc3: fetch mode of operation from HW
There's no need to add driver_data for something
we can fetch from HW.

This also makes our id_table unnecessary - at least
for now -, so we also remove it on the same patch.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:48:11 +02:00
Felipe Balbi
9f622b2a40 usb: dwc3: calculate number of event buffers dynamically
This will allow us to only allocate memory when
we actually need.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:48:11 +02:00
Felipe Balbi
6c167fc9b0 usb: dwc3: allow forcing a maximum speed
this is mainly for testing. In order to be able
to test if we're enumerating correctly on all
speeds, let that be controlled by a module
parameter.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:48:10 +02:00
Felipe Balbi
b2c2271c82 usb: dwc3: gadget: don't disable endpoints on exit
when we remove the gadget driver, it will already
do that for us.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:48:09 +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
Kuninori Morimoto
9c6736523a usb: gadget: renesas_usbhs: usbhs_set_device_config() care upphub/hubport
current usbhs_set_device_config() didn't care upphub/hubport.
This patch adds its value.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:04 +02:00
Kuninori Morimoto
fca8ab7ee1 usb: gadget: renesas_usbhs: cleanup usbhs_endpoint_disable()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:03 +02:00
Kuninori Morimoto
3dd492686c usb: gadget: renesas_usbhs: modify function name of usbhs_set_device_xx()
it was device configuration setting function, not only speed.
This patch modify function name usbhs_set_device_speed() -> usbhs_set_device_config()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:02 +02:00
Kuninori Morimoto
fc9d5c79f6 usb: gadget: renesas_usbhs: usbhsh_ureq_alloc/free() care urb->hcpriv
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:02 +02:00
Kuninori Morimoto
ee8a0bf5a7 usb: gadget: renesas_usbhs: cleanup complicated ureq alloc/free
DCP data/status stage needs ureq to usbhs_pkt_push(),
but sometimes, there is no data stage.
In that case, allocated ureq was not freed,
Current ureq alloc/free pair were difficult to understand.
This patch removed unnecessary/un-understandable ureq alloc
from usbhsh_urb_enqueue(), and create simpler alloc/free pair.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:01 +02:00
Kuninori Morimoto
1ab6f257e1 usb: gadget: renesas_usbhs: drop dependency for mod_gadget
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:45:00 +02:00
Yuping Luo
144974e7f9 usb: gadget: mass_storage: support multi-luns with different logic block size
With Peiyu's patch "gadget: mass_storage: adapt logic block size to bound block
devices" (http://www.spinics.net/lists/linux-usb/msg50791.html), now mass storage
can adjust logic block size dynamically based on real devices.
Then there is one issue caused by it, if two luns have different logic block size,
mass storage can't work.
Let's check the current software flow:
1. get_next_command(): call received_cbw();
2. received_cbw(): update common->lun = cbw->Lun, but common->curlen is not updated;
3. do_scsi_command(): in READ_X and WRITE_X commands, common->data_size_from_cmnd is
updated by common->curlun->blkbits;
4. check_command(): update common->curlun according to common->lun
As you can see, the step 3 uses wrong common->curlun, then wrong common->curlun->blkbits.
If the two luns have same blkbits, there isn't issue. Otherwise, both will fail.
This patch moves the common->curlun update to step 1, then make sure step 3 gets right
blkbits and data_size_from_cmnd.

Cc: Peiyu Li <peiyu.li@csr.com>
Signed-off-by: YuPing Luo <yuping.luo@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:44:59 +02:00
Kuninori Morimoto
b4fcea2a71 usb: gadget: renesas_usbhs: unified callback function
renesas_usbhs needs callback for notify hotplug.
but it were 2 methods which are almost same.
This patch unified these into one.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:44:59 +02:00
Kuninori Morimoto
f1ee56a000 usb: gadget: renesas_usbhs: add platform power control function
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:44:58 +02:00
Kuninori Morimoto
a49a88f108 usb: gadget: renesas_usbhs: tidyup the unit of detection_delay
detection_delay was assumed as msec

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:44:57 +02:00
Kuninori Morimoto
25234b46be usb: gadget: renesas_usbhs: tidyup mod_host request variable name
renesas_usbhs driver use "req" for struct usb_ctrlrequest,
and "ureq" for struct usbhsh_request

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:44:56 +02:00
Kuninori Morimoto
76190152fb usb: gadget: renesas_usbhs: tidyup usbhs_sys_clock_ctrl() was local function
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:44:56 +02:00
Kuninori Morimoto
3244a7b43f usb: gadget: renesas_usbhs: remove usbhs_sys_usb_ctrl()
usbhs_sys_usb_ctrl() can collect into usbhs_sys_host/function_ctrl().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:44:47 +02:00
Kuninori Morimoto
2288e10993 usb: gadget: renesas_usbhs: remove usbhs_sys_hispeed_ctrl()
usbhs_sys_hispeed_ctrl() can collect into usbhs_sys_host/function_ctrl().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:44:46 +02:00
Marc Kleine-Budde
dd39c358df USB: ci13xxx_udc: handle controllers with less than 16 EPs
The ci13xxx_udc driver checks the number of endpoints in the udc
controller, however some routines expect that the hardware has 16
bidirectional endpoints.

This patch improves the driver to work on controllers with less than
16 endpoints like the udc controller found on freescale's
mx23 and mx28.

Tested-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:44:45 +02:00
Marc Kleine-Budde
7bb4fdc602 USB: ci13xxx_udc: make suspend and resume in gadget driver optional
Some gadget drivers don't implement suspend and/or resume functions.
Instead of changing the gadget drivers, make suspend and resume in
ci13xxx_udc (following other udc drivers) optional.

Tested-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-12-12 11:44:45 +02:00
Havard Skinnemoen
99823f457d usb: cdc-acm: Kill ACM_READY() macro completely
The ACM_READY() macro doesn't seem to do anything useful, and it may
prevent tty_wait_until_sent() from working properly when called from
close.

Previously, acm_tty_chars_in_buffer() returned 0 whenever
acm->port.count was 0. This means close() could return before all the
data has actually been written.

Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 19:33:48 -08:00
Aman Deep
7bf01185c5 USB: Adding #define in hub_configure() and hcd.c file
This patch is in succession of previous patch
commit c842114792
        xHCI: Adding #define values used for hub descriptor

Hub descriptors characteristics #defines values are added in
hub_configure() in place of magic numbers as asked by Alan Stern.
And the indentation for switch and case is changed to be same.

Some #defines values are added in ch11.h for defining hub class
protocols and used in hub.c and hcd.c in which magic values were
used for hub class protocols.

Signed-off-by: Aman Deep <amandeep3986@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 16:20:38 -08:00
Tanmay Upadhyay
35657c4d72 USB: pxa168: Fix compilation error
After commit c430131a02 (Support
controllers with big endian capability regs), HC_LENGTH takes
two arguments. This patch fixes following compilation error:

In file included from drivers/usb/host/ehci-hcd.c:1323:
drivers/usb/host/ehci-pxa168.c:302:54: error: macro "HC_LENGTH" requires 2 arguments, but only 1 given
In file included from drivers/usb/host/ehci-hcd.c:1323:
drivers/usb/host/ehci-pxa168.c: In function 'ehci_pxa168_drv_probe':
drivers/usb/host/ehci-pxa168.c:302: error: 'HC_LENGTH' undeclared (first use in this function)
drivers/usb/host/ehci-pxa168.c:302: error: (Each undeclared identifier is reported only once
drivers/usb/host/ehci-pxa168.c:302: error: for each function it appears in.)

Signed-off-by: Tanmay Upadhyay <tanmay.upadhyay@einfochips.com>
Cc: stable <stable@vger.kernel.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 16:18:20 -08:00
Thomas Meyer
a451eaf9c5 uwb: 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 16:18:20 -08:00
Thomas Meyer
d5ca9db8f1 USB: wusb: 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 16:18:20 -08:00
Thomas Meyer
87763842b7 usb: gadget: renesas_usbhs: 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 16:18:19 -08:00
Greg Kroah-Hartman
59bf5cf94f USB: isight: fix kernel bug when loading firmware
We were sending data on the stack when uploading firmware, which causes
some machines fits, and is not allowed.  Fix this by using the buffer we
already had around for this very purpose.

Reported-by: Wouter M. Koolen <wmkoolen@cwi.nl>
Tested-by: Wouter M. Koolen <wmkoolen@cwi.nl>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-09 16:18:19 -08:00