Commit graph

194 commits

Author SHA1 Message Date
Aaro Koskinen 27bf55251c staging: octeon-usb: cvmx-usb: eliminate cvmx_likely/unlikely
Just use likely/unlikely.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-29 11:41:28 -07:00
Aaro Koskinen 6d658cb2ab staging: octeon-usb: cvmx-usb: utilize Linux error codes
Use generic Linux error codes to replace cvmx_usb_status_t.

The conversion table:

	Before				After
	cvmx_usb_status_t		int
	CVMX_USB_SUCCESS		0
	CVMX_USB_INVALID_PARAM		-EINVAL
	CVMX_USB_NO_MEMORY		-ENOMEM
	CVMX_USB_BUSY			-EBUSY
	CVMX_USB_TIMEOUT		-ETIMEDOUT
	CVMX_USB_INCORRECT_MODE		Deleted (was never used)

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-29 11:41:28 -07:00
Aaro Koskinen 684f94ccbd staging: octeon-usb: cvmx-usb: delete __cplusplus
Delete __cplusplus.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-29 11:41:28 -07:00
Aaro Koskinen 67f70fc624 staging: octeon-usb: cvmx-usb: delete redundant example code
Delete redundant example code found in comments. It's already there in
the driver proper.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-29 11:41:28 -07:00
Aaro Koskinen a7c679482d staging: octeon-usb: cvmx-usb: delete redundant debug flags
Delete redudant debug flags and dead code behind them.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-29 11:41:27 -07:00
Aaro Koskinen 1b50850d01 staging: octeon-usb: cvmx-usb: delete driver-specific tracing code
Delete call, parameter, and return value tracing.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-29 11:41:27 -07:00
Aaro Koskinen f6ba63fce2 staging: octeon-usb: use correct board type for EdgeRouter Lite
Use CVMX_BOARD_TYPE_UBNT_E100 for EdgeRouter Lite.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-29 11:41:27 -07:00
Aaro Koskinen 272705e937 staging: octeon-usb: depend on CAVIUM_OCTEON_SOC
The USB driver should depend on SOC instead of CPU.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-29 11:41:27 -07:00
Aaro Koskinen d935217df1 staging: octeon-usb: octeon-hcd: eliminate printk()s
Replace one printk() with dev_dbg(), and delete the other.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-18 11:17:04 -07:00
Aaro Koskinen 334715f31b staging: octeon-usb: octeon-hcd: delete commented-out code
Delete commented-out code.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-18 11:17:04 -07:00
Aaro Koskinen 87e7e57acd staging: octeon-usb: octeon-hcd: reformat long comments
Fix some comments to fit into 80 colums.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-18 11:17:03 -07:00
Aaro Koskinen 71e06db3b9 staging: octeon-usb: octeon-hcd: use dev_dbg
Replace DEBUG macros with dev_dbg. Some less useful are completely
deleted.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-18 11:17:03 -07:00
Aaro Koskinen f5ed3a3870 staging: octeon-usb: octeon-hcd: make internal variable static
Make an internal variable static.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-17 14:53:07 -07:00
Aaro Koskinen 2a81d2b01f staging: octeon-usb: octeon-hcd: fix some includes
Avoid including from "asm/".

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-17 14:51:36 -07:00
Aaro Koskinen c7609eac88 staging: octeon-usb: octeon-hcd: add missing braces
One else branch was missing braces.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-17 14:50:47 -07:00
Aaro Koskinen 771378bb05 staging: octeon-usb: octeon-hcd: use tabs for code indent
Replace spaces with tabs where possible.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-17 14:49:14 -07:00
Aaro Koskinen 47d8994bc1 staging: octeon-usb: cvmx-usbnx-defs.h: reformat a comment
Reformat a comment to fit it into 80 columns line lenght.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-08 22:04:32 -07:00
Aaro Koskinen b6bcaa488b staging: octeon-usb: cvmx-usbnx-defs.h: reformat license text to fit 80 cols
Reformat the original license text to fit in 80-column terminal. No
change in wording.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-08 22:04:31 -07:00
Aaro Koskinen bd4a270536 staging: octeon-usb: cvmx-usbnx-defs.h: delete CVS keyword marker
Delete CVS keyword marker and a comment that the file is autogenerated.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-08 22:04:31 -07:00
Aaro Koskinen 97d63efafb staging: octeon-usb: cvmx-usbnx-defs.h: clean up macros
Use helper macros to avoid copy-paste and too long lines.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-08 22:04:31 -07:00
Aaro Koskinen 322fb897fd staging: octeon-usb: cvmx-usbnx-defs.h: delete unused macros
Delete unused macros.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-08 22:04:31 -07:00
Aaro Koskinen d49e411251 staging: octeon-usb: cvmx-usbnx-defs.h: fix comment style
Adjust struct member comments to be closer to kernel-doc format.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-08 22:04:31 -07:00
Aaro Koskinen 39e873bb2a staging: octeon-usb: cvmx-usbnx-defs.h: fix struct indentation
Fix struct indentation.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-08 22:04:30 -07:00
Aaro Koskinen 7f4a470c8d staging: octeon-usb: cvmx-usbnx-defs.h: fix brace placement
Fix placement of braces in structs and unions.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-08 22:04:30 -07:00
Aaro Koskinen f2b9b33b82 staging: octeon-usb: cvmx-usbnx-defs.h: delete unused union members
Delete unused union members.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-08 22:04:30 -07:00
Aaro Koskinen 5fcf133a56 staging: octeon-usb: cvmx-usbnx-defs.h: delete unused data types
Delete unused data types.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-08 22:04:28 -07:00
Aaro Koskinen 877ea664f6 staging: octeon-usb: cvmx-usbcx-defs.h: reformat license text to fit 80 cols
Reformat the original license text to fit in 80-column terminal. No
change in wording.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-06 13:15:04 -07:00
Aaro Koskinen 56ac87dbae staging: octeon-usb: cvmx-usbcx-defs.h: delete CVS keyword marker
Delete CVS keyword marker and a comment that the file is autogenerated.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-06 13:15:04 -07:00
Aaro Koskinen 1337de71a9 staging: octeon-usb: cvmx-usbcx-defs.h: avoid long lines in comments
Format all comments (except license text) to fit to 80 column terminals.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-06 13:15:04 -07:00
Aaro Koskinen 3d3792e91f staging: octeon-usb: cvmx-usbcx-defs.h: clean up macros
Use helper macros to avoid copy-paste and too long lines.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-06 13:15:03 -07:00
Aaro Koskinen 8f55eb2ee3 staging: octeon-usb: cvmx-usbcx-defs.h: delete unused macros
Delete some unused macros.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-06 13:15:03 -07:00
Aaro Koskinen ebf5950a9a staging: octeon-usb: cvmx-usbcx-defs.h: fix comment style
Adjust struct member comments to be closer to kernel-doc format.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-06 13:15:03 -07:00
Aaro Koskinen 215f7493f5 staging: octeon-usb: cvmx-usbcx-defs.h: fix struct indentation
Fix struct indentation.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-06 13:13:58 -07:00
Aaro Koskinen ceba5567fd staging: octeon-usb: cvmx-usbcx-defs.h: fix brace placement
Fix placement of braces in structs and unions.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-06 13:13:57 -07:00
Aaro Koskinen 8aaefbef65 staging: octeon-usb: cvmx-usbcx-defs.h: delete unused union members
Delete unused union members.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-06 13:13:57 -07:00
Aaro Koskinen a972c4830d staging: octeon-usb: cvmx-usbcx-defs.h: delete unused data types
Delete unused data types.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-06 13:12:44 -07:00
Wei Yongjun 57f9c1d862 staging: octeon-usb: remove duplicated include from octeon-hcd.c
Remove duplicated include.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-05 15:35:59 -07:00
Devendra Naga 5e15430eaf staging: octeon-usb: call device_unregister when platform_device_register_simple fails
device_register is called before platform_device_register_simple gets called.
unregister and reset the octeon_usb_registered variable

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Daney <ddaney.cavm@gmail.com>
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-05 15:25:42 -07:00
Devendra Naga 55fa328aec staging: octeon-usb: check return value of platform_device_register_simple
the return value is a pointer having an error set. we have to check for
IS_ERR and return PTR_ERR when appropriate

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Daney <ddaney.cavm@gmail.com>
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-05 15:25:41 -07:00
Devendra Naga 3fa98f34b8 staging: octeon-usb: fix more checkpatch errors/warns
place the opening brace right after the if, else, else if, switch
statements.

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Daney <ddaney.cavm@gmail.com>
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-05 15:25:41 -07:00
Devendra Naga a2417928d6 staging: octeon-usb: more checkpatch fixes
place the opening brace right after the if,else, else if,switch
statements.

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Daney <ddaney.cavm@gmail.com>
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-05 15:25:41 -07:00
Devendra Naga 3e842f73c6 staging: octeon-usb: fix checkpatch error
this places the opening braces just after the if, else, elseif, switch
statements

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Daney <ddaney.cavm@gmail.com>
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-05 15:25:41 -07:00
Devendra Naga 1ead9c58df staging: octeon-usb: place opening braces of structs, enums on top
this fixes coding style problem, placing of the braces just right after the
struct name, not below the struct name.

this reduces the errors reported by checkpatch script from

total: 1496 errors, 2133 warnings, 3344 lines checked

to

total: 1488 errors, 2132 warnings, 3336 lines checked

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Daney <ddaney.cavm@gmail.com>
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-05 15:25:41 -07:00
Aaro Koskinen b164935b38 staging: MIPS: add Octeon USB HCD support
Add support for Octeon USB HCD. Tested on EdgeRouter Lite with USB
mass storage.

The driver has been extracted from GPL sources of EdgeRouter Lite firmware
(based on Linux 2.6.32.13). Some minor fixes and cleanups have been done
to make it work with 3.10-rc3.

$ uname -a
Linux (none) 3.10.0-rc3-edge-00005-g86cb5bc #41 SMP PREEMPT Sat Jun 1 20:41:46 EEST 2013 mips64 GNU/Linux
$ modprobe octeon-usb
[   37.971683] octeon_usb: module is from the staging directory, the quality is unknown, you have been warned.
[   37.983649] OcteonUSB: Detected 1 ports
[   37.999360] OcteonUSB OcteonUSB.0: Octeon Host Controller
[   38.004847] OcteonUSB OcteonUSB.0: new USB bus registered, assigned bus number 1
[   38.012332] OcteonUSB OcteonUSB.0: irq 122, io mem 0x00000000
[   38.019970] hub 1-0:1.0: USB hub found
[   38.023851] hub 1-0:1.0: 1 port detected
[   38.028101] OcteonUSB: Registered HCD for port 0 on irq 122
[   38.391443] usb 1-1: new high-speed USB device number 2 using OcteonUSB
[   38.586922] usb-storage 1-1:1.0: USB Mass Storage device detected
[   38.597375] scsi0 : usb-storage 1-1:1.0
[   39.604111] scsi 0:0:0:0: Direct-Access              USB DISK 2.0     PMAP PQ: 0 ANSI: 4
[   39.619113] sd 0:0:0:0: [sda] 7579008 512-byte logical blocks: (3.88 GB/3.61 GiB)
[   39.630696] sd 0:0:0:0: [sda] Write Protect is off
[   39.635945] sd 0:0:0:0: [sda] No Caching mode page present
[   39.641464] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   39.651341] sd 0:0:0:0: [sda] No Caching mode page present
[   39.656917] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   39.664296]  sda: sda1 sda2
[   39.675574] sd 0:0:0:0: [sda] No Caching mode page present
[   39.681093] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   39.687223] sd 0:0:0:0: [sda] Attached SCSI removable disk

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Daney <ddaney.cavm@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-03 12:45:03 -07:00