Commit Graph

197 Commits

Author SHA1 Message Date
Anton Bondarenko 9bbf84e604 staging: octeon-usb: use correct function for hcd cleanup
Use usb_put_hdc to release hdc allocated by usb_create_hcd.
This is needed to handle sub-allocations and HCD sharing correctly.

Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15 07:43:55 +02:00
Rehas Sachdeva efb35d12b3 staging: octeon-usb: Remove unnecessary assignment
Remove 'x=a;' from a consecutive double assignment of the form 'x=a; x=b;'.
Issue detected by the semantic patch found here:
https://github.com/coccinelle/coccinellery/blob/master/write2/write2.cocci

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-22 11:54:48 +02:00
Randy Dunlap e7a69540e1 staging: octeon-usb: correct driver name in Kconfig help text
The module name in the Makefile and in the driver source file is
octeon-hcd, so correct the Kconfig text to be the same.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 19:09:47 +02:00
Aaro Koskinen 8ad6e09d55 staging: octeon-usb: update TODO
Update TODO.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen a00265de23 staging: octeon-usb: avoid an overlong line
Avoid an overlong line.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen d07374987f staging: octeon-usb: move next pipe selection into a separate function
Move next pipe selection into a separate function to avoid deep
nesting.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen dd588994fa staging: octeon-usb: move isoc transfer handling into separate function
Move isochronous transfer handling into a separate function to
avoid deep indentation.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen dfce62674c staging: octeon-usb: move interrupt transfer handling into separate function
Move bulk transfer handling into a separate function to avoid
deep indentation.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen 8ed3094c62 staging: octeon-usb: move bulk transfer handling into separate function
Move bulk transfer handling into a separate function to avoid
deep indentation.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen 81a71bad40 staging: octeon-usb: move control transfer handling into separate function
Move control transfer handling into a separate function to
avoid deep indentation.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen 8b07d2fe38 staging: octeon-usb: fold cvmx_usb_state into octeon_hcd
Fold cvmx_usb_state into octeon_hcd.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen b186eb64d4 staging: octeon-usb: rename STATUS_SUCCESS to STATUS_OK
Rename STATUS_SUCCESS to STATUS_OK.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen e6bff5a070 staging: octeon-usb: rename cvmx_usb_perform_complete to cvmx_usb_complete
Rename cvmx_usb_perform_complete to cvmx_usb_complete.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen add3ea324c staging: octeon-usb: rename cvmx_usb_complete to cvmx_usb_status
Rename cvmx_usb_complete to cvmx_usb_status.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen 284ea26aaa staging: octeon-usb: simplify if statement
Simplify if statement to avoid deep nesting.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen 25adcca6ec staging: octeon-usb: pass transfer type to find_ready_pipe
Since we always search the same list, we can just pass the transfer type.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen 38492ccbd1 staging: octeon-usb: eliminate redundant parameter from find_ready_pipe
current_frame always equals usb->frame_number.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen 68ea338017 staging: octeon-usb: align split lines to match open parenthesis
Align split lines to match open parenthesis.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen a2fcca426d staging: octeon-usb: use preferred style for NULL comparison
Use preferred coding style for NULL comparison.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen a89e28e3e2 staging: octeon-usb: make driver name to match the file name
Make driver name to match the file name.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:14:01 -08:00
Aaro Koskinen 3c98ef90f0 staging: octeon-usb: add spaces around operator
Add spaces around operator to improve readability.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:14:01 -08:00
Aaro Koskinen cce66005b4 staging: octeon-usb: switch to use kernel types
Switch to use kernel types:

	uint64_t -> u64
	uint32_t -> u32
	uint16_t -> u16
	uint8_t  -> u8
	int8_t   -> s8

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:14:01 -08:00
Aaro Koskinen 466657314b staging: octeon-usb: clean up includes
Clean up includes.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:14:01 -08:00
Aaro Koskinen ec7c4d7d52 staging: octeon-usb: delete space after cast
Delete space after cast.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:14:01 -08:00
Aaro Koskinen 6de14f12c3 staging: octeon-usb: add missing braces
Some if branches are missing braces as required by coding style.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:14:01 -08:00
Aaro Koskinen c9d19612e8 staging: octeon-usb: delete redundant blank lines
Delete redundant blank lines.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:14:01 -08:00
Aaro Koskinen bb778553d4 staging: octeon-usb: support official bindings
Support official DT bindings alongside with the deprecated ones.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 16:52:15 -08:00
Janani Ravichandran 1d5047c981 staging: octeon: Remove unneeded parentheses in assignment
Remove parentheses around the right hand side of assignments as they are
not needed. Semantic patch used:

@@
expression a, b, c;
@@

(
  a = (b == c)
|
  a =
- (
  b
- )
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-11 19:40:02 -08:00
Saatvik Arya edb0d9d4a3 drivers: staging: octeon-usb: octeon-hcd.c: fixed coding style related warnings
fixed coding style warnings related to comment blocks

Signed-off-by: Saatvik Arya <aryasaatvik@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:35:16 -08:00
Cristina Moraru 73eee567cb staging: octeon-usb: Replace kmalloc with kmalloc_array
Replace kmalloc with specialized function kmalloc_array
when the size is a multiplication of:
	number_of_elements * size_of_element

Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:28:52 -07:00
Luis de Bethencourt 1972308bf5 staging: octeon-usb: Fix module autoload for OF platform driver
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <luis@debethencourt.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12 18:24:37 -07:00
Carlos E. Garcia 69e98df782 Staging: fixed multiple spelling errors.
Fixed multiple spelling errors.

Signed-off-by: Carlos E. Garcia <carlos@cgarcia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-08 09:23:58 +02:00
Johan Hovold b97c3c1a0b staging: octeon-usb: fix unaligned isochronous transfers
Make sure to copy the whole transfer buffer when releasing the temporary
buffer used for unaligned isochronous transfers as the data is not
necessarily contiguous in that case.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-28 13:14:21 +02:00
Aaro Koskinen 203d776214 staging: octeon-usb: make CVMX_WAIT_FOR_FIELD32 to take condition expression
Make CVMX_WAIT_FOR_FIELD32 to take full condition expression.
This should make the usage simpler, and the macro more readable.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-03 13:57:28 +02:00
Aaro Koskinen 6068e81879 staging: octeon-usb: assume union type for FIELD32 macros
Assume union type for FIELD32 macros to simplify usage.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-03 13:57:28 +02:00
Aaro Koskinen 9a02e8d211 staging: octeon-usb: octeon_usb_probe: delete unused variable
"flags" is not used, delete it.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-03 13:57:28 +02:00
Aaro Koskinen a3d3390d1e staging: octeon-usb: make cvmx_fifo_setup void
Make cvmx_fifo_setup void, it does not return any value.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-03 13:57:28 +02:00
Aaro Koskinen edc16d8d48 stating: octeon-usb: cvmx_usb_initialize(): eliminate extra indentation
Eliminate extra indentation by putting all the code into the same block.
Also delete a bogus comment.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:13 +01:00
Aaro Koskinen 6ad9c95b3a staging: octeon-usb: try to recover from failed hardware reset
On some hardware the USB fails to initialize to sane state after
cold boot. We can detect this based on some unexpected interrupt bits,
and recover by re-initializing.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:13 +01:00
Aaro Koskinen f3b8edc0f3 staging: octeon-usb: fail and warn if DMA counters are wrong
Fail and WARN if DMA counters are wrong.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:13 +01:00
Aaro Koskinen eb04114f37 staging: octeon-usb: move cvmx_usb_shutdown()
Move cvmx_usb_shutdown() to allow its use from some other functions.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:13 +01:00
Aaro Koskinen b0c8c72ba3 staging: octeon-usb: rewrite port reset
Don't disable port before resetting. Also perform reset unconditionally
when requested.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:13 +01:00
Aaro Koskinen 164814bb6e staging: octeon-usb: move fifo setup to controller reset from port reset
Move FIFO setup to controller reset from port reset.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:12 +01:00
Aaro Koskinen 2263251fbb staging: octeon-usb: move fifo setup into a separate routine
Move FIFO setup into a separate routine.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:12 +01:00
Aaro Koskinen 0ed64a4c8f staging: octeon-usb: use USB stack to turn on power
Use USB stack to turn on the power bit. It will also do
the necessary delays.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:12 +01:00
Aaro Koskinen c8eedbd107 staging: octeon-usb: don't poll interrupts early
Don't poll interrupts before we have registered the HCD.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:12 +01:00
Aaro Koskinen b5e79e6ea6 staging: octeon-usb: refactor usbn block init
Move one-time state data structure initialization out of
cvmx_usb_initialize().

This enables to re-initialize USBN HW block without messing
up data structures.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:11 +01:00
Aaro Koskinen 532edc93e2 staging: octeon-usb: never retry after xacterr
Never retry after xacterr. The DMA engine cannot handle that properly
and may result in wrong transfer count and hang.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:11 +01:00
Aaro Koskinen d712648a22 staging: octeon-usb: program DMA engine based on transfer direction
Program DMA engine based on transfer direction. We are only transferring
to one direction at a time.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:11 +01:00
Aaro Koskinen af8e4c71f6 staging: octeon-usb: use __BITFIELD_FIELD
Use __BITFIELD_FIELD to define bitfields. OCTEON can at least in theory
run also in little-endian mode, so the bitfield definitions should not
assume big-endian byte order.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:11 +01:00