Commit graph

133 commits

Author SHA1 Message Date
Nitin Kuppelur
15ef0cc124 Staging: octeon-hcd: removed dummy label
This is a patch to the octeon-hcd.c file that fixes
removes dummy label i.e. label followed by return of
void function

Signed-off-by: Nitin Kuppelur <nitinkuppelur@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-11 14:49:13 -07:00
Nitin Kuppelur
9f87b44720 Staging: octeon-hcd: removed unwanted return from void
This is a patch to the octeon-hcd.c file that fixes
checkpatch.pl warning by removing return statement from
void functions.

Signed-off-by: Nitin Kuppelur <nitinkuppelur@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-08 14:06:52 -07:00
Aaro Koskinen
96ee2cc81f staging: octeon-usb: use USB_DIR_IN
Replace a magic value with #defined macro.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-02 10:48:32 -07:00
Aaro Koskinen
e301dfb208 staging: octeon-usb: use generic control packet header
Use generic control packet header structure definition.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-02 10:48:32 -07:00
Aaro Koskinen
e5873388e2 staging: octeon-usb: fix endianness bug
wHubCharacteristics gets wrong value on big-endian CPUs.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-08 16:39:22 -07:00
Aaro Koskinen
8dcf4ecea9 staging: octeon-usb: return transferred bytes only on success
Return transferred bytes only when transfer was successful.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-08 16:39:22 -07:00
Aaro Koskinen
d8c39d3f20 staging: octeon-usb: don't retry on data toggle error
On data toggle error, we don't know if and how many bytes were
successfully transferred by DMA. We should just fail the transaction
instead of trying a retry.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-08 16:39:22 -07:00
Aaro Koskinen
e5b90898d6 staging: octeon-usb: use usb_hcd_link_urb_to_ep()
The driver did not use link_urb_to_ep() / unlink_urb_from_ep(). This
caused odd behaviour in some error recovery situations, all requests
would start to fail after the first failure.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-08 16:39:22 -07:00
Aaro Koskinen
cdd15d8925 staging: octeon-usb: drop dequeue tasklet
Cancel requests synchronously instead of using the dequeue tasklet.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-08 16:39:22 -07:00
Joe Perches
f8628a47ba staging: Convert __FUNCTION__ to __func__
Use the normal mechanism for emitting a function name.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-25 11:05:07 -07:00
Paul Davies C
e725cef3e5 staging: octeon-usb: Fix lines with more than 80 chars in octeon-hcd.c
Some lines with more than 80 characters are converted in to multiple lines.

Signed-off-by: Paul Davies C <pauldaviesc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-24 02:03:50 +09:00
Paul Davies C
f510643522 staging: octeon-usb: Add blank line after all declarations in octeon-hcd.c
Add blank lines after each declarations in drivers/staging/octeon-usb/octeon-hcd.c.

Signed-off-by: Paul Davies C <pauldaviesc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-24 02:02:48 +09:00
Aaro Koskinen
20f6b82992 staging: octeon-usb: use generic prefetch
Use generic prefetch.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-24 02:01:09 +09:00
Aaro Koskinen
a4570140b3 staging: octeon-usb: delete redudant prefetches
cvmx_usb_pipe fits into a cache-line so additional prefetches are not
really helping anything.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-24 02:01:08 +09:00
Paul McQuade
8522851e3b Staging:Octeon-usb:octeon-hcd.c return value
return value instead of function.

Signed-off-by: Paul McQuade <paulmcquad@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-23 16:36:16 +09:00
Aaro Koskinen
120ee599b5 staging: octeon-usb: prevent memory corruption
octeon-hcd will crash the kernel when SLOB is used. This usually happens
after the 18-byte control transfer when a device descriptor is read.
The DMA engine is always transfering full 32-bit words and if the
transfer is shorter, some random garbage appears after the buffer.
The problem is not visible with SLUB since it rounds up the allocations
to word boundary, and the extra bytes will go undetected.

Fix by providing quirk functions for DMA map/unmap that allocate a bigger
temporary buffer when necessary. Tested by booting EdgeRouter Lite
to USB stick root file system with SLAB, SLOB and SLUB kernels.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=72121
Reported-by: Sergey Popov <pinkbyte@gentoo.org>
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-20 01:51:12 +00:00
Raluca Oncioiu
b49f11335d Staging: octeon-usb: Remove unnecessary brackets
Remove brackets from single line branches of if statements.
Break long lines.

Signed-off-by: Raluca Oncioiu <raluca.oncioiu91@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-07 16:10:54 -08:00
Raluca Oncioiu
1da69aa92b Staging: octeon-usb: Break up long lines
Break up long lines.

Signed-off-by: Raluca Oncioiu <raluca.oncioiu91@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-07 16:08:01 -08:00
David Daney
b91619c284 staging: octeon-usb: Probe via device tree populated platform device.
Extract clocking parameters from the device tree, and remove now dead
code and types.

Signed-off-by: David Daney <david.daney@cavium.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-07 09:11:28 -08: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
Aaro Koskinen
5669601d92 staging: octeon-usb: use list.h for transactions
Use list.h helpers for transactions.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 15:46:00 -07:00
Aaro Koskinen
4a23ee1bd7 staging: octeon-usb: use list.h for pipes
Use list.h helpers for pipes.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 15:46:00 -07:00
Aaro Koskinen
f011fefa8a staging: octeon-usb: use list_for_each_entry_safe()
Use list_for_each_entry_safe() when deleting all list items.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 15:46:00 -07:00
Aaro Koskinen
244544a185 staging: octeon-usb: use list_del_init()
Replace list_del() + INIT_LIST_HEAD() with list_del_init().

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 15:45:59 -07:00
Aaro Koskinen
d2695a8a3d staging: octeon-usb: use dynamic allocation for pipes
Use dynamic memory allocation for pipes.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 15:45:59 -07:00
Aaro Koskinen
a2dfef06e6 staging: octeon-usb: use dynamic allocation for transactions
Use dynamic memory allocation for transactions.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 15:45:59 -07:00
Aaro Koskinen
f121910396 staging: octeon-usb: use a single .h file
Merge USBC and USBN register definitions into a single header
file. Although all HW definitions are purely internal to the driver,
it's better to keep them separate due to the large size of the file.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 15:45:59 -07:00
Aaro Koskinen
7d7bc26b1d staging: octeon-usb: CN3xxx: program p_xenbn and p_rclk through p_rtype
Do the clock setup through p_rtype on all OCTEONs. This enables to get
rid of duplicated register definitions.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 15:45:59 -07:00
Aaro Koskinen
34b70b9e05 staging: octeon-usb: delete cvmx_usbnx_clk_ctl_cn50xx
Add the missing bits to common clk ctl definition, and we can delete
duplicated definitions.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 15:45:59 -07:00
Aaro Koskinen
d8d8e148fd staging: octeon-usb: delete unused cvmx_usbnx_usbp_ctl_status definitions
cvmx_usbnx_usbp_ctl_status was multiplied for different OCTEONS and all
those definitions are unused. Delete them.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 15:45:58 -07:00
Aaro Koskinen
aa87afe207 staging: octeon-usb: refactor __cvmx_usb_pipe_needs_split
Split a long line and remove redundant parenthesis.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-06 22:02:22 -07:00
Aaro Koskinen
3e1674c093 staging: octeon-usb: eliminate submit_handle
Eliminate submit_handle, use a direct reference instead.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-06 22:02:21 -07:00
Aaro Koskinen
60f815078f staging: octeon-usb: eliminate pipe_handle
Eliminate pipe_handle, use a direct reference instead.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-06 22:02:21 -07:00
Aaro Koskinen
be44063df5 staging: octeon-usb: clean up hcpriv usage
Use ep->hcpriv for pipe handle and urb->hcpriv for submit handle,
instead of packing both into the same field.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-06 22:02:21 -07:00
Aaro Koskinen
e16b5e3f14 staging: octeon-usb: cvmx_usb_submit_control: get params from urb
Get the transfer parameters from urb.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-06 22:02:21 -07:00
Aaro Koskinen
9fdbb6964b staging: octeon-usb: cvmx_usb_submit_interrupt: get params from urb
Get the transfer parameters from urb.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-06 22:02:21 -07:00
Aaro Koskinen
2ae09e8721 staging: octeon-usb: cvmx_usb_submit_control: get params from urb
Get the transfer parameters from urb.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-06 22:02:21 -07:00
Aaro Koskinen
9ccca70718 staging: octeon-usb: cvmx_usb_submit_bulk: get params from urb
Get the transfer parameters from urb.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-06 22:02:21 -07:00
Aaro Koskinen
0cce1004c1 staging: octeon-usb: replace generic transfer callback data with urb
URB is always passed, so we can use strong typing here.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-06 22:02:21 -07:00
Aaro Koskinen
75ee512487 staging: octeon-usb: call transfer completion callback directly
The callback is always the same, we can just call it directly.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-06 22:02:21 -07:00
Aaro Koskinen
393e214686 staging: octeon-usb: call port change callback directly
Call port change callback directly.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-06 22:02:21 -07:00
Aaro Koskinen
29a202fa76 staging: octeon-usb: inline cvmx_usb_set_status
Inline a trivial function.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-06 22:02:21 -07:00
Aaro Koskinen
cb61c60098 staging: octeon-usb: eliminate cvmx_usb_internal_state
Eliminate cvmx_usb_internal_state, just use cvmx_usb_state everywhere.
This also enables to allocate only the needed amount of data for the
USB internal state, instead of always allocating 64 KB.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-06 22:02:21 -07:00
Aaro Koskinen
6570b4a991 staging: octeon-usb: merge cvmx-usb into octeon-hcd
cvmx-usb module provided Cavium "OS abstraction layer" for USB
functionality. To make this driver a proper Linux driver, we need to
refactor this layer out. By making all the code internal to the HCD
driver makes this task easier.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-06 22:02:21 -07:00
Aaro Koskinen
72b80113a6 staging: octeon-usb: cvmx-usb.h: make comments to fit into 80 columns
Make comments to fit into 80 columns.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-03 13:38:12 -07:00
Aaro Koskinen
ab09e5c148 staging: octeon-usb: cvmx-usb.c: make comments to fit into 80 columns
Make comments to fit into 80 columns.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-03 13:38:06 -07:00
Aaro Koskinen
d0adff6acd staging: octeon-usb: cvmx-usb: delete unused macros
Delete unused cvmx_read_csr / cvmx_write_csr macros.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-03 13:38:06 -07:00
Aaro Koskinen
5bffcff517 staging: octeon-usb: eliminate CVMX_PREFETCH_PREFX
Eliminate CVMX_PREFETCH_PREFX.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-03 13:38:06 -07:00
Aaro Koskinen
1e50e9ac31 staging: octeon-usb: eliminate CVMX_PREFETCH_PREF0
Eliminate CVMX_PREFETCH_PREF0.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-03 13:38:06 -07:00
Aaro Koskinen
10828735df staging: octeon-usb: delete CVMX_PREFETCH128
Delete unused macro.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-03 13:38:06 -07:00