Commit Graph

168 Commits

Author SHA1 Message Date
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
Aaro Koskinen 31170da59e staging: octeon-usb: delete redundant field from octeon_temp_buffer
Since we are not moving/realigning the original pointer returned
by kmalloc, we don't need to store the value in a separate field.

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 3f9697b714 staging: octeon-usb: remove useless prefix from pipe flags
Remove useless prefix from pipe flags and adjust comments.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:10 +01:00
Aaro Koskinen 68d435dd54 staging: octeon-usb: remove useless prefix from internal routines
Original CVMX code used "__" to distinguis internal USB functions
from public ones. But in Linux all cvmx_usb routines are internal
to this driver, so such separation is useless.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:10 +01:00
Aaro Koskinen c4bdbdd916 staging: octeon-usb: eliminate 64-bit register access wrappers
Eliminate 64-bit register access wrappers. Since we don't implement
register-level debugging outputs, these are useless.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:10 +01:00
Aaro Koskinen 607078fcb1 staging: octeon-usb: remove internal function parameter sanity checks
Remove some function parameter sanity checks from internal functions
where we can rely them being called with sane parameters.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-24 13:47:10 +01:00
Fabian Frederick 877945759d Staging: octeon: constify of_device_id array
of_device_id is always used as const.
(See driver.of_match_table and open firmware functions)

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-20 14:11:29 +01:00
Gustavo A. R. Silva 1cf3273dfb Staging: octeon-usb: Fixed a typo
Fixed a typo in octeon-hcd.c file

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-17 15:00:23 -08:00
Linus Torvalds dab363f938 Staging patches for 3.19-rc1
Here's the big staging tree pull request for 3.19-rc1.
 
 We continued to delete more lines than were added, always a good thing,
 but not at a huge rate this release, only about 70k lines removed
 overall mostly from removing the horrid bcm driver.
 
 Lots of normal staging driver cleanups and fixes all over the place,
 well over a thousand of them, the shortlog shows all the horrid details.
 
 The "contentious" thing here is the movement of the Android binder code
 out of staging into the "real" part of the kernel.  This is code that
 has been stable for a few years now and is working as-is in the tens of
 millions of devices with no issues.  Yes, the code is horrid, and the
 userspace api leaves a lot to be desired, but it's not going to change
 due to legacy issues that we have no control over.  Because so many
 devices and companies rely on this, and the code is stable, might as
 well promote it out of staging.
 
 This was all discussed at the Linux Plumbers conference, and everyone
 participating agreed that this was the best way forward.
 
 There is work happening to replace the binder code with something new
 that is happening right now, but I don't expect to see the results of
 that work for another year at the earliest.  If that ever happens, and
 Android switches over to it, I'll gladly remove this version.
 
 As for maintainers, I'll be glad to maintain this code, I've been doing
 it for the past few years with no problems.  I'll send a MAINTAINERS
 entry for it before 3.19-final is out, still need to talk to the Google
 developers about if they are willing to help with it or not, last I
 checked they were, which was good.
 
 All of these patches have been in linux-next for a while with no
 reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlSPICkACgkQMUfUDdst+yksdwCfSLE9VUy1o2sAPDRe+J3bQced
 EWEAoL3RtnejKbo5tHS2IT69pLrwiIDS
 =YXyM
 -----END PGP SIGNATURE-----

Merge tag 'staging-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver updates from Greg KH:
 "Here's the big staging tree pull request for 3.19-rc1.

  We continued to delete more lines than were added, always a good
  thing, but not at a huge rate this release, only about 70k lines
  removed overall mostly from removing the horrid bcm driver.

  Lots of normal staging driver cleanups and fixes all over the place,
  well over a thousand of them, the shortlog shows all the horrid
  details.

  The "contentious" thing here is the movement of the Android binder
  code out of staging into the "real" part of the kernel.  This is code
  that has been stable for a few years now and is working as-is in the
  tens of millions of devices with no issues.  Yes, the code is horrid,
  and the userspace api leaves a lot to be desired, but it's not going
  to change due to legacy issues that we have no control over.  Because
  so many devices and companies rely on this, and the code is stable,
  might as well promote it out of staging.

  This was all discussed at the Linux Plumbers conference, and everyone
  participating agreed that this was the best way forward.

  There is work happening to replace the binder code with something new
  that is happening right now, but I don't expect to see the results of
  that work for another year at the earliest.  If that ever happens, and
  Android switches over to it, I'll gladly remove this version.

  As for maintainers, I'll be glad to maintain this code, I've been
  doing it for the past few years with no problems.  I'll send a
  MAINTAINERS entry for it before 3.19-final is out, still need to talk
  to the Google developers about if they are willing to help with it or
  not, last I checked they were, which was good.

  All of these patches have been in linux-next for a while with no
  reported issues"

* tag 'staging-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1382 commits)
  Staging: slicoss: Fix long line issues in slicoss.c
  staging: rtl8712: remove unnecessary else after return
  staging: comedi: change some printk calls to pr_err
  staging: rtl8723au: hal: Removed the extra semicolon
  lustre: Deletion of unnecessary checks before three function calls
  staging: lustre: fix sparse warnings: static function declaration
  staging: lustre: fixed sparse warnings related to static declarations
  staging: unisys: remove duplicate header
  staging: unisys: remove unneeded structure
  staging: ft1000 : replace __attribute ((__packed__) with __packed
  drivers: staging: rtl8192e: Include "asm/unaligned.h" instead of "access_ok.h" in "rtl819x_BAProc.c"
  Drivers:staging:rtl8192e: Fixed checkpatch warning
  Drivers:staging:clocking-wizard: Added a newline
  staging: clocking-wizard: check for a valid clk_name pointer
  staging: rtl8723au: Hal_InitPGData() avoid unnecessary typecasts
  staging: rtl8723au: _DisableAnalog(): Avoid zero-init variables unnecessarily
  staging: rtl8723au: Remove unnecessary wrapper _ResetDigitalProcedure1()
  staging: rtl8723au: _ResetDigitalProcedure1_92C() reduce code obfuscation
  staging: rtl8723au: Remove unnecessary wrapper _DisableRFAFEAndResetBB()
  staging: rtl8723au: _DisableRFAFEAndResetBB8192C(): Reduce code obfuscation
  ...
2014-12-15 18:06:13 -08:00
Aaro Koskinen ba0b8e420a staging: octeon-usb: eliminate cvmx_dprintf() usage
Eliminate cvmx_dprintf() usage and use dev_err() instead.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 13:45:12 -08:00
Aaro Koskinen 2e6ac45c4a staging: octeon-usb: move helper functions
Move helper functions to make them visible to all functions.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 13:45:12 -08:00
Wolfram Sang a4d9e08f81 staging: octeon-usb: drop owner assignment from platform_drivers
A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-20 16:21:41 +02:00
Aleh Suprunovich 9109fcff29 staging: octeon-usb: fix checkpatch.pl warnings
fixed several 'line over 80 characters' in places where it can be done
without changing/refactoring code

Signed-off-by: Aleh Suprunovich <br@ahlamon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:27 +08:00
Tapasweni Pathak dea7503ac4 staging: octeon-usb: use DIV_ROUND_UP
The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /
(d)) but is perhaps more readable.

Coccinelle script used :

// <smpl>
@haskernel@
@@
@depends on haskernel@
expression n,d;
@@
(
- (n + d - 1) / d
+ DIV_ROUND_UP(n,d)
|
- (n + (d - 1)) / d
+ DIV_ROUND_UP(n,d)
)
@depends on haskernel@
expression n,d;
@@
- DIV_ROUND_UP((n),d)
+ DIV_ROUND_UP(n,d)
@depends on haskernel@
expression n,d;
@@
- DIV_ROUND_UP(n,(d))
+ DIV_ROUND_UP(n,d)
// </smpl>

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:20 +08:00
Sarah Khan c9a114e70a staging: octeon-usb: Removed unnessecary else after return
WARNING: else is generally not useful after return or break
checkpatch.pl warning in octeon-hcd.c

Signed-off-by: Sarah Khan <sarahjmi07@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:13 +08:00
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