]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
8 years agousb: gadget: s3c2410_udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:43 +0000 (16:00 +0200)]
usb: gadget: s3c2410_udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: s3c-hsudc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:42 +0000 (16:00 +0200)]
usb: gadget: s3c-hsudc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: r8a66597-udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:41 +0000 (16:00 +0200)]
usb: gadget: r8a66597-udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: pxa27x_udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:40 +0000 (16:00 +0200)]
usb: gadget: pxa27x_udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: pxa25x_udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:39 +0000 (16:00 +0200)]
usb: gadget: pxa25x_udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: pch_udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:38 +0000 (16:00 +0200)]
usb: gadget: pch_udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: omap_udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:37 +0000 (16:00 +0200)]
usb: gadget: omap_udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: net2280: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:36 +0000 (16:00 +0200)]
usb: gadget: net2280: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: net2272: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:35 +0000 (16:00 +0200)]
usb: gadget: net2272: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: mv_udc_core: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:34 +0000 (16:00 +0200)]
usb: gadget: mv_udc_core: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: mv_u3d_core: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:33 +0000 (16:00 +0200)]
usb: gadget: mv_u3d_core: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: m66592-udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:32 +0000 (16:00 +0200)]
usb: gadget: m66592-udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: lpc32xx_udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:31 +0000 (16:00 +0200)]
usb: gadget: lpc32xx_udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: gr_udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:30 +0000 (16:00 +0200)]
usb: gadget: gr_udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: goku_udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:29 +0000 (16:00 +0200)]
usb: gadget: goku_udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: fusb300_udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:28 +0000 (16:00 +0200)]
usb: gadget: fusb300_udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: fsl_udc_core: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:27 +0000 (16:00 +0200)]
usb: gadget: fsl_udc_core: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: fsl_qe_udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:26 +0000 (16:00 +0200)]
usb: gadget: fsl_qe_udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: fotg210-udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:25 +0000 (16:00 +0200)]
usb: gadget: fotg210-udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: dummy-hcd: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:24 +0000 (16:00 +0200)]
usb: gadget: dummy-hcd: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: bdc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:23 +0000 (16:00 +0200)]
usb: gadget: bdc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: bcm63xx_udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:22 +0000 (16:00 +0200)]
usb: gadget: bcm63xx_udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: at91_udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:21 +0000 (16:00 +0200)]
usb: gadget: at91_udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: amd5536udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:20 +0000 (16:00 +0200)]
usb: gadget: amd5536udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: dwc3: gadget: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:19 +0000 (16:00 +0200)]
usb: dwc3: gadget: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: dwc2: gadget: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:18 +0000 (16:00 +0200)]
usb: dwc2: gadget: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: chipidea: udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:17 +0000 (16:00 +0200)]
usb: chipidea: udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agostaging: emxx_udc: add ep capabilities support
Robert Baldyga [Fri, 31 Jul 2015 14:00:16 +0000 (16:00 +0200)]
staging: emxx_udc: add ep capabilities support

Convert endpoint configuration to new capabilities model.

Fixed typo in "epc-nulk" to "epc-bulk".

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: add endpoint capabilities helper macros
Robert Baldyga [Fri, 31 Jul 2015 14:00:15 +0000 (16:00 +0200)]
usb: gadget: add endpoint capabilities helper macros

Add macros useful while initializing array of endpoint capabilities
structures. These macros makes structure initialization more compact
to decrease number of code lines and increase readability of code.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: add endpoint capabilities flags
Robert Baldyga [Fri, 31 Jul 2015 14:00:14 +0000 (16:00 +0200)]
usb: gadget: add endpoint capabilities flags

Introduce struct usb_ep_caps which contains information about capabilities
of usb endpoints - supported transfer types and directions. This structure
should be filled by UDC driver for each of its endpoints, and will be
used in epautoconf in new ep matching mechanism which will replace ugly
guessing of endpoint capabilities basing on its name.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: encapsulate endpoint claiming mechanism
Robert Baldyga [Fri, 31 Jul 2015 14:00:13 +0000 (16:00 +0200)]
usb: gadget: encapsulate endpoint claiming mechanism

So far it was necessary for usb functions to set ep->driver_data in
endpoint obtained from autoconfig to non-null value, to indicate that
endpoint is claimed by function (in autoconfig it was checked if endpoint
has set this field to non-null value, and if it has, it was assumed that
it is claimed). It could cause bugs because if some function doesn't
set this field autoconfig could return the same endpoint more than one
time.

To help to avoid such bugs this patch adds claimed flag to struct usb_ep,
and  encapsulates endpoint claiming mechanism inside usb_ep_autoconfig_ss()
and usb_ep_autoconfig_reset(), so now usb functions don't need to perform
any additional actions to mark endpoint obtained from autoconfig as claimed.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: f_uac2: fix build warning
Felipe Balbi [Tue, 4 Aug 2015 16:02:45 +0000 (11:02 -0500)]
usb: gadget: f_uac2: fix build warning

commit 913e4a90b6f9 ("usb: gadget: f_uac2:
finalize wMaxPacketSize according to bandwidth")
added a possible build warning when calling
min(). In order to fix the warning, we just
make sure to call min_t() and tell that its
arguments should be u16.

Cc: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: musb: musb_dsps: Simplify return statement
Saurabh Karajgaonkar [Tue, 4 Aug 2015 14:02:28 +0000 (14:02 +0000)]
usb: musb: musb_dsps: Simplify return statement

Replace redundant variable use in return statement.

Signed-off-by: Saurabh Karajgaonkar <skarajga@visteon.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: phy: phy-keystone: Simplify return statement
Saurabh Karajgaonkar [Tue, 4 Aug 2015 14:02:03 +0000 (14:02 +0000)]
usb: phy: phy-keystone: Simplify return statement

Replace redundant variable use in return statement.

Signed-off-by: Saurabh Karajgaonkar <skarajga@visteon.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: phy: phy-mxs-usb: Simplify return statement
Saurabh Karajgaonkar [Tue, 4 Aug 2015 14:01:31 +0000 (14:01 +0000)]
usb: phy: phy-mxs-usb: Simplify return statement

Replace redundant variable use in return statement.

Signed-off-by: Saurabh Karajgaonkar <skarajga@visteon.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: chipidea: add ci->is_otg condition for otg judgement
Li Jun [Fri, 31 Jul 2015 02:41:00 +0000 (10:41 +0800)]
usb: chipidea: add ci->is_otg condition for otg judgement

Since some chipidea based controller is not otg capable, add ci->is_otg
condition when setting is_otg flag for gadget.

Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: f_printer: fix deadlock caused by nested spinlock
Fupan Li [Mon, 3 Aug 2015 11:19:43 +0000 (19:19 +0800)]
usb: gadget: f_printer: fix deadlock caused by nested spinlock

Function printer_func_disable() has called spinlock on printer_dev->lock,
and it'll call function chain of

    printer_reset_interface()
        |
+---dwc3_gadget_ep_disable()
        |
                +---__dwc3_gadget_ep_disable()
                        |
                        +---dwc3_remove_requests()
                                |
                                +---dwc3_gadget_giveback()
                                        |
                                        +---rx_complete()

in the protected block.

However, rx_complete() in f_printer.c calls spinlock on printer_dev->lock
again, which will cause system hang.

The following steps can reproduce this hang:

1. Build the test program from Documentation/usb/gadget_printer.txt as
   g_printer
2. Plug in the USB device to a host(such as Ubuntu).
3. on the USB device system run:
   #modprobe g_printer.ko
   #./g_printer -read_data

4. Unplug the USB device from the host

   The system will hang later.

In order to avoid this deadlock, moving the spinlock from
printer_func_disable() into printer_reset_interface() and excluding the block
of calling dwc3_gadget_ep_disable(), in which the critical resource will be
protected by its spinlock in rx_complete().

This commit will fix the system hang with the following calltrace:

INFO: rcu_preempt detected stalls on CPUs/tasks: { 3} (detected by 0, t=21006 jiffies, g=524, c=523, q=2)
sending NMI to all CPUs:
NMI backtrace for cpu 3
CPU: 3 PID: 718 Comm: irq/22-dwc3 Not tainted 3.10.38-ltsi-WR6.0.0.11_standard #2
Hardware name: Intel Corp. VALLEYVIEW B3 PLATFORM/NOTEBOOK, BIOS BYTICRB1.86C.0092.R32.1410021707 10/02/2014
task: f44f4c20 ti: f40f6000 task.ti: f40f6000
EIP: 0060:[<c1824955>] EFLAGS: 00000097 CPU: 3
EIP is at _raw_spin_lock_irqsave+0x35/0x40
EAX: 00000076 EBX: f80fad00 ECX: 00000076 EDX: 00000075
ESI: 00000096 EDI: ffffff94 EBP: f40f7e20 ESP: f40f7e18
 DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
CR0: 8005003b CR2: b77ac000 CR3: 01c30000 CR4: 001007f0
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: ffff0ff0 DR7: 00000400
Stack:
 f474a720 f80fad00 f40f7e3c f80f93cc c135d486 00000000 f474a720 f468fb00
 f4bea894 f40f7e54 f7e35f19 ffffff00 f468fb00 f468fb24 00000086 f40f7e64
 f7e36577 f468fb00 f4bea810 f40f7e74 f7e365a8 f468fb00 f4bea894 f40f7e9c
Call Trace:
 [<f80f93cc>] rx_complete+0x1c/0xb0 [g_printer]
 [<c135d486>] ? vsnprintf+0x166/0x390
 [<f7e35f19>] dwc3_gadget_giveback+0xc9/0xf0 [dwc3]
 [<f7e36577>] dwc3_remove_requests+0x57/0x70 [dwc3]
 [<f7e365a8>] __dwc3_gadget_ep_disable+0x18/0x60 [dwc3]
 [<f7e366e9>] dwc3_gadget_ep_disable+0x89/0xf0 [dwc3]
 [<f80f9031>] printer_reset_interface+0x31/0x50 [g_printer]
 [<f80f9270>] printer_func_disable+0x20/0x30 [g_printer]
 [<f80e6d8b>] composite_disconnect+0x4b/0x90 [libcomposite]
 [<f7e39a8b>] dwc3_disconnect_gadget+0x38/0x43 [dwc3]
 [<f7e39ad4>] dwc3_gadget_disconnect_interrupt+0x3e/0x5a [dwc3]
 [<f7e373b8>] dwc3_thread_interrupt+0x5c8/0x610 [dwc3]
 [<c10ac518>] irq_thread_fn+0x18/0x30
 [<c10ac800>] irq_thread+0x100/0x130
 [<c10ac500>] ? irq_finalize_oneshot.part.29+0xb0/0xb0
 [<c10ac650>] ? wake_threads_waitq+0x40/0x40
 [<c10ac700>] ? irq_thread_dtor+0xb0/0xb0
 [<c1057224>] kthread+0x94/0xa0
 [<c182b337>] ret_from_kernel_thread+0x1b/0x28
 [<c1057190>] ? kthread_create_on_node+0xc0/0xc0

Signed-off-by: Fupan Li <fupan.li@windriver.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: musb: Allow building in all the DMA code
Tony Lindgren [Mon, 3 Aug 2015 12:37:10 +0000 (05:37 -0700)]
usb: musb: Allow building in all the DMA code

With recent changes to MUSB code, we can now now get rid of
the Kconfig choise for the DMA code and allow building in any
of the desired DMA code. This makes life easier for distros.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: udc: fix spin_lock in pch_udc
Pengyu Ma [Mon, 3 Aug 2015 03:28:24 +0000 (11:28 +0800)]
usb: gadget: udc: fix spin_lock in pch_udc

When remove module g_serial on quark platform, the following Warning on:

Modules linked in: usb_f_acm u_serial g_serial(-) pch_udc libcomposite configfs udc_core
ad7298 industrialio_triggered_buffer kfifo_buf tpm_i2c_infineon indus
CPU: 0 PID: 369 Comm: modprobe Not tainted 3.14.29ltsi-WR7.0.0.0_standard #6
Hardware name: Intel Corp. QUARK/CrossHill, BIOS 0x010100F5 01/01/2014
 f641df0c f641df0c f641dec8 c15ac7fa f641defc c103084f c16c2356 f641df28
 00000171 c16b855c 000009dd c15b2d6f 000009dd c15b2d6f f6bd2000 faae5480
 00000000 f641df14 c10308a3 00000009 f641df0c c16c2356 f641df28 f641df2c
Call Trace:
 [<c15ac7fa>] dump_stack+0x16/0x18
 [<c103084f>] warn_slowpath_common+0x7f/0xa0
 [<c15b2d6f>] ? preempt_count_sub+0x6f/0xc0
 [<c15b2d6f>] ? preempt_count_sub+0x6f/0xc0
 [<c10308a3>] warn_slowpath_fmt+0x33/0x40
 [<c15b2d6f>] preempt_count_sub+0x6f/0xc0
 [<faadbc82>] pch_udc_pcd_pullup+0x32/0xa0 [pch_udc]
 [<fa9747d9>] usb_gadget_remove_driver+0x29/0x60 [udc_core]
 [<fa974869>] usb_gadget_unregister_driver+0x59/0x80 [udc_core]
 [<faa78310>] usb_composite_unregister+0x10/0x20 [libcomposite]
 [<faae50f1>] cleanup+0xd/0xf [g_serial]
 [<c1084c47>] SyS_delete_module+0xf7/0x150
 [<c111f8dd>] ? ____fput+0xd/0x10
 [<c104b2ae>] ? task_work_run+0x6e/0xa0
 [<c15afda5>] syscall_call+0x7/0x7

g_serial module on quark is depended on pch_udc module, ttyGSX cann't recieve
data and warning on when remove g_serial.

It was unlocked before the modification of the structure it was protecting,
fix it as "lock -> unlock" to resolve this.

Signed-off-by: Pengyu Ma <pengyu.ma@windriver.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agodoc: usb: gadget-testing: using the updated testusb.c
Peter Chen [Fri, 31 Jul 2015 08:36:30 +0000 (16:36 +0800)]
doc: usb: gadget-testing: using the updated testusb.c

testusb.c at http://www.linux-usb.org/usbtest/ is out of date,
using the one at the kernel source folder.

Cc: <stable@vger.kernel.org>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agoDoc: ABI: testing: configfs-usb-gadget-sourcesink
Peter Chen [Fri, 31 Jul 2015 08:36:29 +0000 (16:36 +0800)]
Doc: ABI: testing: configfs-usb-gadget-sourcesink

Fix the name of attribute

Cc: <stable@vger.kernel.org>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agoDoc: ABI: testing: configfs-usb-gadget-loopback
Peter Chen [Fri, 31 Jul 2015 08:36:28 +0000 (16:36 +0800)]
Doc: ABI: testing: configfs-usb-gadget-loopback

Fix the name of attribute

Cc: <stable@vger.kernel.org>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: mass_storage: Use static array for luns
Krzysztof Opasiak [Fri, 31 Jul 2015 11:46:07 +0000 (13:46 +0200)]
usb: gadget: mass_storage: Use static array for luns

This patch replace dynamicly allocated luns array with static one.
This simplifies the code of mass storage function and modules.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
8 years agousb: gadget: mass_storage: Fix freeing luns sysfs implementation
Krzysztof Opasiak [Fri, 31 Jul 2015 11:37:45 +0000 (13:37 +0200)]
usb: gadget: mass_storage: Fix freeing luns sysfs implementation

Use device_is_registered() instad of sysfs flag to determine if
we should free sysfs representation of particular LUN.

sysfs flag in fsg common determines if luns attributes should be
exposed using sysfs. This flag is used when creating and freeing
luns. Unfortunately there is no guarantee that this flag will not
be changed between creation and removal of particular LUN. Especially
because of lun.0 which is created during allocating instance of
function. This may lead to resource leak or NULL pointer dereference:

[   62.539925] Unable to handle kernel NULL pointer dereference at virtual address 00000044
[   62.548014] pgd = ec994000
[   62.550679] [00000044] *pgd=6d7be831, *pte=00000000, *ppte=00000000
[   62.556933] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
[   62.562310] Modules linked in: g_mass_storage(+)
[   62.566916] CPU: 2 PID: 613 Comm: insmod Not tainted 4.2.0-rc4-00077-ge29ee91-dirty #125
[   62.574984] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   62.581061] task: eca56e80 ti: eca76000 task.ti: eca76000
[   62.586450] PC is at kernfs_find_ns+0x8/0xe8
[   62.590698] LR is at kernfs_find_and_get_ns+0x30/0x48
[   62.595732] pc : [<c01277c0>]    lr : [<c0127b88>]    psr: 40010053
[   62.595732] sp : eca77c40  ip : eca77c38  fp : 000008c1
[   62.607187] r10: 00000001  r9 : c0082f38  r8 : ed41ce40
[   62.612395] r7 : c05c1484  r6 : 00000000  r5 : 00000000  r4 : c0814488
[   62.618904] r3 : 00000000  r2 : 00000000  r1 : c05c1484  r0 : 00000000
[   62.625417] Flags: nZcv  IRQs on  FIQs off  Mode SVC_32  ISA ARM  Segment user
[   62.632620] Control: 10c5387d  Table: 6c99404a  DAC: 00000015
[   62.638348] Process insmod (pid: 613, stack limit = 0xeca76210)
[   62.644251] Stack: (0xeca77c40 to 0xeca78000)
[   62.648594] 7c40: c0814488 00000000 00000000 c05c1484 ed41ce40 c0127b88 00000000 c0824888
[   62.656753] 7c60: ed41d038 ed41d030 ed41d000 c012af4c 00000000 c0824858 ed41d038 c02e3314
[   62.664912] 7c80: ed41d030 00000000 ed41ce04 c02d9e8c c070eda8 eca77cb4 000008c1 c058317c
[   62.673071] 7ca0: 000008c1 ed41d030 ed41ce00 ed41ce04 ed41d000 c02da044 ed41cf48 c0375870
[   62.681230] 7cc0: ed9d3c04 ed9d3c00 ed52df80 bf000940 fffffff0 c03758f4 c03758c0 00000000
[   62.689389] 7ce0: bf000564 c03614e0 ed9d3c04 bf000194 c0082f38 00000001 00000000 c0000100
[   62.697548] 7d00: c0814488 c0814488 c086b1dc c05893a8 00000000 ed7e8320 00000000 c0128b88
[   62.705707] 7d20: ed8a6b40 00000000 00000000 ed410500 ed8a6b40 c0594818 ed7e8320 00000000
[   62.713867] 7d40: 00000000 c0129f20 00000000 c082c444 ed8a6b40 c012a684 00001000 00000000
[   62.722026] 7d60: c0594818 c082c444 00000000 00000000 ed52df80 ed52df80 00000000 00000000
[   62.730185] 7d80: 00000000 00000000 00000001 00000002 ed8e9b70 ed52df80 bf0006d0 00000000
[   62.738345] 7da0: ed8e9b70 ed410500 ed618340 c036129c ed8c1c00 bf0006d0 c080b158 ed8c1c00
[   62.746504] 7dc0: bf0006d0 c080b158 ed8c1c08 ed410500 c0082f38 ed618340 000008c1 c03640ac
[   62.754663] 7de0: 00000000 bf0006d0 c082c8dc c080b158 c080b158 c03642d4 00000000 bf003000
[   62.762822] 7e00: 00000000 c0009784 00000000 00000001 00000000 c05849b0 00000002 ee7ab780
[   62.770981] 7e20: 00000002 ed4105c0 0000c53e 000000d0 c0808600 eca77e5c 00000004 00000000
[   62.779140] 7e40: bf000000 c0095680 c08075a0 ee001f00 ed4105c0 c00cadc0 ed52df80 bf000780
[   62.787300] 7e60: ed4105c0 bf000780 00000001 bf0007c8 c0082f38 ed618340 000008c1 c0083e24
[   62.795459] 7e80: 00000001 bf000780 00000001 eca77f58 00000001 bf000780 00000001 c00857f4
[   62.803618] 7ea0: bf00078c 00007fff 00000000 c00835b4 eca77f58 00000000 c0082fac eca77f58
[   62.811777] 7ec0: f05038c0 0003b008 bf000904 00000000 00000000 bf00078c 6e72656b 00006c65
[   62.819936] 7ee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   62.828095] 7f00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   62.836255] 7f20: 00000000 00000000 00000000 00000000 00000000 00000000 00000003 0003b008
[   62.844414] 7f40: 0000017b c000f5c8 eca76000 00000000 0003b008 c0085df8 f04ef000 0001b8a9
[   62.852573] 7f60: f0503258 f05030c2 f0509fe8 00000968 00000dc8 00000000 00000000 00000000
[   62.860732] 7f80: 00000029 0000002a 00000011 00000000 0000000a 00000000 33f6eb00 0003b008
[   62.868892] 7fa0: bef01cac c000f400 33f6eb00 0003b008 00000003 0003b008 00000000 00000003
[   62.877051] 7fc0: 33f6eb00 0003b008 bef01cac 0000017b 00000000 0003b008 0000000b 0003b008
[   62.885210] 7fe0: bef01ae0 bef01ad0 0001dc23 b6e8c162 800b0070 00000003 c0c0c0c0 c0c0c0c0
[   62.893380] [<c01277c0>] (kernfs_find_ns) from [<c0824888>] (pm_qos_latency_tolerance_attr_group+0x0/0x10)
[   62.903005] Code: e28dd00c e8bd80f0 e92d41f0 e2923000 (e1d0e4b4)
[   62.909115] ---[ end trace 02fb4373ef095c7b ]---

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: atmel_usba_udc: add missing ret value check
Robert Baldyga [Mon, 13 Jul 2015 09:03:54 +0000 (11:03 +0200)]
usb: gadget: atmel_usba_udc: add missing ret value check

Add missing return value check. In case of error print debug message
and return error code.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agostaging: emxx_udc: add missing usb_ep_set_maxpacket_limit()
Robert Baldyga [Mon, 13 Jul 2015 09:03:53 +0000 (11:03 +0200)]
staging: emxx_udc: add missing usb_ep_set_maxpacket_limit()

Since maxpacket_limit was introduced all UDC drivers should use
usb_ep_set_maxpacket_limit() function instead of setting maxpacket value
manually. ep.maxpacket_limit contains actual maximum maxpacket value
supported by hardware which is needed by epautoconf.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: isp1760: udc: add missing usb_ep_set_maxpacket_limit()
Robert Baldyga [Mon, 13 Jul 2015 09:03:52 +0000 (11:03 +0200)]
usb: isp1760: udc: add missing usb_ep_set_maxpacket_limit()

Since maxpacket_limit was introduced all UDC drivers should use
usb_ep_set_maxpacket_limit() function instead of setting maxpacket value
manually. ep.maxpacket_limit contains actual maximum maxpacket value
supported by hardware which is needed by epautoconf.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: midi: avoid redundant f_midi_set_alt() call
Robert Baldyga [Mon, 13 Jul 2015 09:03:51 +0000 (11:03 +0200)]
usb: gadget: midi: avoid redundant f_midi_set_alt() call

Function midi registers two interfaces with single set_alt() function
which means that f_midi_set_alt() is called twice when configuration
is set. That means that endpoint initialization and ep request allocation
is done two times. To avoid this problem we do such things only once,
for interface number 1 (MIDI Streaming interface).

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: ffs: call functionfs_unbind() if _ffs_func_bind() fails
Robert Baldyga [Mon, 13 Jul 2015 09:03:50 +0000 (11:03 +0200)]
usb: gadget: ffs: call functionfs_unbind() if _ffs_func_bind() fails

Function ffs_do_functionfs_bind() calls functionfs_bind() which allocates
usb request and increments refcounts. These things needs to be cleaned
up by if further steps of initialization fail by calling functionfs_unbind().

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: f_uac2: finalize wMaxPacketSize according to bandwidth
Peter Chen [Thu, 30 Jul 2015 05:13:03 +0000 (13:13 +0800)]
usb: gadget: f_uac2: finalize wMaxPacketSize according to bandwidth

According to USB Audio Device 2.0 Spec, Ch4.10.1.1:
wMaxPacketSize is defined as follows:
Maximum packet size this endpoint is capable of sending or receiving
when this configuration is selected.
This is determined by the audio bandwidth constraints of the endpoint.

In current code, the wMaxPacketSize is defined as the maximum packet size
for ISO endpoint, and it will let the host reserve much more space than
it really needs, so that we can't let more endpoints work together at
one frame.

We find this issue when we try to let 4 f_uac2 gadgets work together [1]
at FS connection.

[1]http://www.spinics.net/lists/linux-usb/msg123478.html

Acked-by: Daniel Mack <zonque@gmail.com>
Cc: andrzej.p@samsung.com
Cc: Daniel Mack <zonque@gmail.com>
Cc: tiwai@suse.de
Cc: <stable@vger.kernel.org> #v3.18+
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: f_mass_storage: stop thread in bind failure case
Sanjay Singh Rawat [Wed, 22 Jul 2015 10:59:46 +0000 (16:29 +0530)]
usb: gadget: f_mass_storage: stop thread in bind failure case

After the worker thread is launched, bind function is doing further
configuration. In case of failure stop the thread.

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sanjay Singh Rawat <snjsrwt@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: m66592-udc: forever loop in set_feature()
Dan Carpenter [Wed, 29 Jul 2015 21:30:58 +0000 (00:30 +0300)]
usb: gadget: m66592-udc: forever loop in set_feature()

There is an "&&" vs "||" typo here so this loops 3000 times or if we get
unlucky it could loop forever.

Fixes: ceaa0a6eeadf ('usb: gadget: m66592-udc: add support for TEST_MODE')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: fotg210-udc: remove duplicate conditions
Dan Carpenter [Wed, 29 Jul 2015 21:29:23 +0000 (00:29 +0300)]
usb: gadget: fotg210-udc: remove duplicate conditions

We handle the "if (!req->req.length)" condition at the start of the
function and return.  We can delete this dead code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: phy: msm: Add D+/D- lines route control
Ivan T. Ivanov [Tue, 28 Jul 2015 08:10:22 +0000 (11:10 +0300)]
usb: phy: msm: Add D+/D- lines route control

apq8016-sbc board is using Dual SPDT USB Switch (TC7USB40MU),
witch is controlled by GPIO to de/multiplex D+/D- USB lines to
USB2513B Hub and uB connector. Add support for this.

Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: apply generic altsetting support check mechanism
Robert Baldyga [Tue, 28 Jul 2015 05:20:03 +0000 (07:20 +0200)]
usb: gadget: apply generic altsetting support check mechanism

Replace calls of gadget_supports_altsettings() function (which check altset
support by comparing UDC controller name with hardcoded names) with
gadget_is_altset_supported() which checks generic quirk bitfield.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: f_ecm/f_ncm: check quirk instead of UDC name
Robert Baldyga [Tue, 28 Jul 2015 05:20:02 +0000 (07:20 +0200)]
usb: gadget: f_ecm/f_ncm: check quirk instead of UDC name

Use generic mechanism to check if UDC controller supports zlp.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: f_mass_storage: check quirk instead of UDC name
Robert Baldyga [Tue, 28 Jul 2015 05:20:01 +0000 (07:20 +0200)]
usb: gadget: f_mass_storage: check quirk instead of UDC name

Use generic mechanism to check if UDC controller supports stalling.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: add 'quirk_zlp_not_supp' to usb_gadget
Robert Baldyga [Tue, 28 Jul 2015 05:20:00 +0000 (07:20 +0200)]
usb: gadget: add 'quirk_zlp_not_supp' to usb_gadget

Due to some UDC controllers may not support zlp, usb gadget layer
needs to provide a generic way to inform gadget functions about non-standard
hardware limitations.

This patch adds 'quirk_zlp_not_supp' field to struct usb_gadget and helper
function gadget_is_zlp_supported(). It also sets 'quirk_zlp_not_supp'
to 1 in musb UDC driver, which has such limitation.

[ balbi@ti.com : make it build ]

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: add 'quirk_stall_not_supp' to usb_gadget
Robert Baldyga [Tue, 28 Jul 2015 05:19:59 +0000 (07:19 +0200)]
usb: gadget: add 'quirk_stall_not_supp' to usb_gadget

Due to some UDC controllers may not support stalling, usb gadget layer
needs to provide a generic way to inform gadget functions about non-standard
hardware limitations.

This patch adds 'quirk_stall_not_supp' field to struct usb_gadget and helper
function gadget_is_stall_supported(). It also sets 'quirk_stall_not_supp'
to 1 in at91_udc driver, which has such limitation.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: add 'quirk_altset_not_supp' to usb_gadget
Robert Baldyga [Tue, 28 Jul 2015 05:19:58 +0000 (07:19 +0200)]
usb: gadget: add 'quirk_altset_not_supp' to usb_gadget

Due to some UDC controllers may not support altsettings, usb gadget layer
needs to provide a generic way to inform gadget functions about non-standard
hardware limitations.

This patch adds 'quirk_altset_not_supp' field to struct usb_gadget and helper
function gadget_is_altset_supported(). It also sets 'quirk_altset_not_supp'
to 1 in pxa25x_udc and pxa27x_udc drivers, which have such limitation.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: dwc3: ep0: handle non maxpacket aligned transfers > 512
Kishon Vijay Abraham I [Mon, 27 Jul 2015 06:55:32 +0000 (12:25 +0530)]
usb: dwc3: ep0: handle non maxpacket aligned transfers > 512

Use chained TRB mechanism to handle non maxpacket aligned transfers
greater than bounce buffer size. With this the first TRB will be programmed
to receive 'ALIGN(ur->length - maxp, maxp)' data and the second TRB
will be programmed to receive the remaining data using bounce buffer.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: dwc3: ep0: Add chained TRB support
Kishon Vijay Abraham I [Mon, 27 Jul 2015 06:55:31 +0000 (12:25 +0530)]
usb: dwc3: ep0: Add chained TRB support

Add chained TRB support to ep0. Now TRB's can be chained just by
invoking _dwc3_ep0_start_trans_ with 'chain' parameter set to true.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: dwc3; ep0: Modify _dwc3_ep0_start_trans_ API to take 'chain' parameter
Kishon Vijay Abraham I [Mon, 27 Jul 2015 06:55:30 +0000 (12:25 +0530)]
usb: dwc3; ep0: Modify _dwc3_ep0_start_trans_ API to take 'chain' parameter

No functional change. Added a new parameter in _dwc3_ep0_start_trans_ to
indicate whether the TRB is a chained TRB or last TRB. This is in
preparation for adding chained TRB support for ep0.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: dwc3: ep0: preparation for handling non maxpacket aligned transfers > 512
Kishon Vijay Abraham I [Mon, 27 Jul 2015 06:55:29 +0000 (12:25 +0530)]
usb: dwc3: ep0: preparation for handling non maxpacket aligned transfers > 512

No functional change. This is in preparation for handling non maxpacket
aligned transfers greater than bounce buffer size. This is basically to
avoid code duplication when using chained TRB transfers to handle
non maxpacket aligned transfers greater than bounce buffer size.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: dwc3: ep0: use _roundup_ to calculate the transfer size
Kishon Vijay Abraham I [Mon, 27 Jul 2015 06:55:28 +0000 (12:25 +0530)]
usb: dwc3: ep0: use _roundup_ to calculate the transfer size

No functional change. Used _roundup_ macro to calculate the transfer
size aligned to maxpacket in  dwc3_ep0_complete_data. It also makes it
similar to how transfer size is calculated in __dwc3_ep0_do_control_data.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytes
Kishon Vijay Abraham I [Mon, 27 Jul 2015 06:55:27 +0000 (12:25 +0530)]
usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytes

DWC3 uses bounce buffer to handle non max packet aligned OUT transfers and
the size of bounce buffer is 512 bytes. However if the host initiates OUT
transfers of size more than 512 bytes (and non max packet aligned), the
driver throws a WARN dump but still programs the TRB to receive more than
512 bytes. This will cause bounce buffer to overflow and corrupt the
adjacent memory locations which can be fatal.

Fix it by programming the TRB to receive a maximum of DWC3_EP0_BOUNCE_SIZE
(512) bytes.

Cc: <stable@vger.kernel.org> # 3.4+
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: renesas_usbhs: Allow an OTG PHY driver to provide VBUS
Phil Edworthy [Mon, 13 Jul 2015 15:30:18 +0000 (16:30 +0100)]
usb: renesas_usbhs: Allow an OTG PHY driver to provide VBUS

These changes allow a PHY driver to trigger a VBUS interrupt and
to provide the value of VBUS.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: zero: allocate and init otg descriptor by otg capabilities
Li Jun [Thu, 9 Jul 2015 07:19:00 +0000 (15:19 +0800)]
usb: gadget: zero: allocate and init otg descriptor by otg capabilities

Allocate and initialize usb otg descriptor according to gadget otg
capabilities, add it for each usb configurations. If otg capability
is not defined, keep its original otg descriptor unchanged.

Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: serial: allocate and init otg descriptor by otg capabilities
Li Jun [Thu, 9 Jul 2015 07:18:59 +0000 (15:18 +0800)]
usb: gadget: serial: allocate and init otg descriptor by otg capabilities

Allocate and initialize usb otg descriptor according to gadget otg
capabilities, add it for each usb configurations. If otg capability
is not defined, keep its original otg descriptor unchanged.

Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: printer: allocate and init otg descriptor by otg capabilities
Li Jun [Thu, 9 Jul 2015 07:18:58 +0000 (15:18 +0800)]
usb: gadget: printer: allocate and init otg descriptor by otg capabilities

Allocate and initialize usb otg descriptor according to gadget otg
capabilities, add it for each usb configurations. If otg capability
is not defined, keep its original otg descriptor unchanged.

Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: ncm: allocate and init otg descriptor by otg capabilities
Li Jun [Thu, 9 Jul 2015 07:18:57 +0000 (15:18 +0800)]
usb: gadget: ncm: allocate and init otg descriptor by otg capabilities

Allocate and initialize usb otg descriptor according to gadget otg
capabilities, add it for each usb configurations. If otg capability
is not defined, keep its original otg descriptor unchanged.

Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: multi: allocate and init otg descriptor by otg capabilities
Li Jun [Thu, 9 Jul 2015 07:18:56 +0000 (15:18 +0800)]
usb: gadget: multi: allocate and init otg descriptor by otg capabilities

Allocate and initialize usb otg descriptor according to gadget otg
capabilities, add it for each usb configurations. If otg capability
is not defined, keep its original otg descriptor unchanged.

Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: mass_storage: allocate and init otg descriptor by otg capabilities
Li Jun [Thu, 9 Jul 2015 07:18:55 +0000 (15:18 +0800)]
usb: gadget: mass_storage: allocate and init otg descriptor by otg capabilities

Allocate and initialize usb otg descriptor according to gadget otg
capabilities, add it for each usb configurations. If otg capability
is not defined, keep its original otg descriptor unchanged.

Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: hid: allocate and init otg descriptor by otg capabilities
Li Jun [Thu, 9 Jul 2015 07:18:54 +0000 (15:18 +0800)]
usb: gadget: hid: allocate and init otg descriptor by otg capabilities

Allocate and initialize usb otg descriptor according to gadget otg
capabilities, add it for each usb configurations. If otg capability
is not defined, keep its original otg descriptor unchanged.

Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: g_ffs: allocate and init otg descriptor by otg capabilities
Li Jun [Thu, 9 Jul 2015 07:18:53 +0000 (15:18 +0800)]
usb: gadget: g_ffs: allocate and init otg descriptor by otg capabilities

Allocate and initialize usb otg descriptor according to gadget otg
capabilities, add it for each usb configurations. If otg capability
is not defined, keep its original otg descriptor unchanged.

Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: cdc2: allocate and init otg descriptor by otg capabilities
Li Jun [Thu, 9 Jul 2015 07:18:52 +0000 (15:18 +0800)]
usb: gadget: cdc2: allocate and init otg descriptor by otg capabilities

Allocate and initialize usb otg descriptor according to gadget otg
capabilities, add it for each usb configurations. If otg capability
is not defined, keep its original otg descriptor unchanged.

Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: audio: allocate and init otg descriptor by otg capabilities
Li Jun [Thu, 9 Jul 2015 07:18:51 +0000 (15:18 +0800)]
usb: gadget: audio: allocate and init otg descriptor by otg capabilities

Allocate and initialize usb otg descriptor according to gadget otg
capabilities, add it for each usb configurations. If otg capability
is not defined, keep its original otg descriptor unchanged.

Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: acm_ms: allocate and init otg descriptor by otg capabilities
Li Jun [Thu, 9 Jul 2015 07:18:50 +0000 (15:18 +0800)]
usb: gadget: acm_ms: allocate and init otg descriptor by otg capabilities

Allocate and initialize usb otg descriptor according to gadget otg
capabilities, add it for each usb configurations. If otg capability
is not defined, keep its original otg descriptor unchanged.

Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: ether: allocate and init otg descriptor by otg capabilities
Li Jun [Thu, 9 Jul 2015 07:18:49 +0000 (15:18 +0800)]
usb: gadget: ether: allocate and init otg descriptor by otg capabilities

Allocate and initialize usb otg descriptor according to gadget otg
capabilities, add it for each usb configurations, free it while
ether unbind. If otg capability is not defined, keep its otg
descriptor unchanged.

Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: configfs: allocate and init otg descriptor by otg capabilities
Li Jun [Thu, 9 Jul 2015 07:18:48 +0000 (15:18 +0800)]
usb: gadget: configfs: allocate and init otg descriptor by otg capabilities

Allocate and initialize usb otg descriptor according to gadget otg
capabilities, add it for each usb configurations, free it while
composite unbind. If otg capability is not defined, keep its otg
descriptor unchanged.

Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: add usb otg descriptor allocate and init interface
Li Jun [Thu, 9 Jul 2015 07:18:47 +0000 (15:18 +0800)]
usb: gadget: add usb otg descriptor allocate and init interface

Allocate usb otg descriptor and initialize it according to gadget's otg
capabilities, if usb_otg_caps is not set, keep settings as current gadget
drivers. With this 2 new interfaces, gadget can use usb_otg_descriptor
for OTG 1.x, and usb_otg20_descriptor for OTG 2.0 or above, and otg
features can be decided by the combination of usb hardware property
and driver config.

Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: chipidea: update ci_otg_is_fsm_mode conditions
Li Jun [Thu, 9 Jul 2015 07:18:46 +0000 (15:18 +0800)]
usb: chipidea: update ci_otg_is_fsm_mode conditions

After introduce usb otg properties, update ci_otg_is_fsm_mode conditions
to be depending on both usb hardware properties and usb driver config,
also resolve a compile issue in debug.c after the API change.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: chipidea: set usb otg capabilities
Li Jun [Thu, 9 Jul 2015 07:18:45 +0000 (15:18 +0800)]
usb: chipidea: set usb otg capabilities

Init and update otg capabilities by DT, set gadget's otg capabilities
accordingly.

Acked-by: Peter Chen <peter.chen@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: common: add API to update usb otg capabilities by device tree
Li Jun [Thu, 9 Jul 2015 07:18:44 +0000 (15:18 +0800)]
usb: common: add API to update usb otg capabilities by device tree

Check property of usb hardware to update otg version and disable SRP, HNP
and ADP if its disable flag is present.

Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agodoc: dt-binding: usb: add otg related properties
Li Jun [Thu, 9 Jul 2015 07:18:43 +0000 (15:18 +0800)]
doc: dt-binding: usb: add otg related properties

Add otg version, srp, hnp and adp support for usb OTG port, then those OTG
features don't have to be decided by usb gadget drivers.

Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: composite: add USB_DT_OTG request handling
Macpaul Lin [Thu, 9 Jul 2015 07:18:42 +0000 (15:18 +0800)]
usb: gadget: composite: add USB_DT_OTG request handling

Copy usb_otg_descriptor from config's descriptor if host requests
USB_DT_OTG.

Signed-off-by: Macpaul Lin <macpaul@gmail.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: add usb_otg_caps to usb_gadget structure.
Macpaul Lin [Thu, 9 Jul 2015 07:18:41 +0000 (15:18 +0800)]
usb: add usb_otg_caps to usb_gadget structure.

Add usb_otg_caps pointer to usb_gadget structure to indicate its
otg capabilities.

Signed-off-by: Macpaul Lin <macpaul@gmail.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: otg: add usb_otg_caps structure for otg capabilities
Li Jun [Thu, 9 Jul 2015 07:18:40 +0000 (15:18 +0800)]
usb: otg: add usb_otg_caps structure for otg capabilities

This patch adds a structure usb_otg_caps to cover all otg related
capabilities of the device, including otg revision, and if hnp/srp/adp
is supported.

Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: add USB_OTG_ADP definition
Macpaul Lin [Thu, 9 Jul 2015 07:18:39 +0000 (15:18 +0800)]
usb: add USB_OTG_ADP definition

Add USB_OTG_ADP definition for usb_otg_descriptor.bmAttributes.

Signed-off-by: Macpaul Lin <macpaul@gmail.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: add usb_otg20_descriptor for OTG 2.0 and above
Macpaul Lin [Thu, 9 Jul 2015 07:18:38 +0000 (15:18 +0800)]
usb: add usb_otg20_descriptor for OTG 2.0 and above

OTG 2.0 introduces bcdOTG in otg descriptor to identify the OTG and EH
supplement release number with which the OTG device is compliant, this
patch adds structure usb_otg20_descriptor for OTG 2.0 and above.

Signed-off-by: Macpaul Lin <macpaul@gmail.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: musb: sunxi: Add support for musb controller in A33 SoC
Hans de Goede [Wed, 8 Jul 2015 14:41:40 +0000 (16:41 +0200)]
usb: musb: sunxi: Add support for musb controller in A33 SoC

The A33 SoC uses the same musb controller as found on the A31 and later,
but allwinner has removed the configdata register, this commit adds special
handling for this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: musb: sunxi: Add support for musb controller in A31 SoC
Hans de Goede [Wed, 8 Jul 2015 14:41:39 +0000 (16:41 +0200)]
usb: musb: sunxi: Add support for musb controller in A31 SoC

The A31 SoC uses the same musb controller as found in earlier SoCs, but it
is hooked up slightly different. Its SRAM is private and no longer controlled
through the SRAM controller, and its reset is controlled via a separate
reset controller. This commit adds support for this setup.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: musb: sunxi: Add support for the Allwinner sunxi musb controller
Hans de Goede [Wed, 8 Jul 2015 14:41:38 +0000 (16:41 +0200)]
usb: musb: sunxi: Add support for the Allwinner sunxi musb controller

This is based on initial code to get the Allwinner sunxi musb controller
supported by Chen-Yu Tsai and Roman Byshko.

This adds support for the Allwinner sunxi musb controller in both host only
and otg mode. Peripheral only mode is not supported, as no boards use that.

This has been tested on a cubietruck (A20 SoC) and an UTOO P66 tablet
(A13 SoC) with a variety of devices in host mode and with the g_serial gadget
driver in peripheral mode, plugging otg / host cables in/out a lot of times
in all possible imaginable plug orders.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: f_obex: use bind_deactivated flag
Robert Baldyga [Mon, 4 May 2015 12:55:15 +0000 (14:55 +0200)]
usb: gadget: f_obex: use bind_deactivated flag

Use bind_deactivated flag instead of calling usb_function_deactivate()
in function bind(). Field 'can_activate' in struct f_obex is no longer
needed as setting 'bind_deactivated' flag makes us sure, that the function
will be binded only if deactivation can be performed successfully.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: f_uvc: use bind_deactivated flag
Robert Baldyga [Mon, 4 May 2015 12:55:14 +0000 (14:55 +0200)]
usb: gadget: f_uvc: use bind_deactivated flag

Use bind_deactivated flag instead of calling usb_function_deactivate()
in function bind().

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: composite: add bind_deactivated flag to usb_function
Robert Baldyga [Mon, 4 May 2015 12:55:13 +0000 (14:55 +0200)]
usb: composite: add bind_deactivated flag to usb_function

This patch introduces 'bind_deactivated' flag in struct usb_function.
Functions which don't want to be activated automatically after bind should
set this flag, and when they start to be ready to work they should call
usb_function_activate().

When USB function sets 'bind_deactivated' flag, initial deactivation
counter is incremented automatically, so there is no need to call
usb_function_deactivate() in function bind.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: composite: fix usb_function_activate/deactivate functions
Robert Baldyga [Mon, 4 May 2015 12:55:12 +0000 (14:55 +0200)]
usb: composite: fix usb_function_activate/deactivate functions

Using usb_gadget_disconnect to make gadget temporarily invisible to host
doesn't provide desired result, because gadget is connected immediately
after binding regardless to previous usb_gadget_disconnect() calls.

For this reason we use usb_gadget_deactivate() instead of
usb_gadget_disconnect() to make it working as expected.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: add usb_gadget_activate/deactivate functions
Robert Baldyga [Mon, 4 May 2015 12:55:11 +0000 (14:55 +0200)]
usb: gadget: add usb_gadget_activate/deactivate functions

These functions allows to deactivate gadget to make it not visible to
host and make it active again when gadget driver is finally ready.

They are needed to fix usb_function_activate() and usb_function_deactivate()
functions which currently are not working as usb_gadget_connect() is
called immediately after function bind regardless to previous calls of
usb_gadget_disconnect() function.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: phy: qcom: New APQ8016/MSM8916 USB transceiver driver
Ivan T. Ivanov [Wed, 8 Jul 2015 14:57:40 +0000 (17:57 +0300)]
usb: phy: qcom: New APQ8016/MSM8916 USB transceiver driver

Driver handles PHY initialization, clock management, power
management and workarounds required after resetting the hardware.

Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
8 years agousb: gadget: storage-common: Set FSG_MAX_LUNS to 16
Krzysztof Opasiak [Mon, 20 Jul 2015 18:15:19 +0000 (20:15 +0200)]
usb: gadget: storage-common: Set FSG_MAX_LUNS to 16

Mass storage spec allows up to 16 LUNs, so let's not
add some more restrictive limits.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>