firefly-linux-kernel-4.4.55.git
9 years agostaging: emxx_udc: fix the build error
Peter Chen [Tue, 3 Feb 2015 02:37:06 +0000 (10:37 +0800)]
staging: emxx_udc: fix the build error

Fix below build error:

reproduce:
  wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
  chmod +x ~/bin/make.cross
  git checkout 9239d88fc5e58a2a72bc949362f999aac9bffb29
  # save the attached .config to linux build tree
  make.cross ARCH=arm

All error/warnings:

   In file included from include/linux/seqlock.h:35:0,
                    from include/linux/time.h:5,
                    from include/linux/stat.h:18,
                    from include/linux/module.h:10,
                    from drivers/staging/emxx_udc/emxx_udc.c:22:
   drivers/staging/emxx_udc/emxx_udc.c: In function 'nbu2ss_gad_set_selfpowered':
>> drivers/staging/emxx_udc/emxx_udc.c:3129:21: error: 'udc' undeclared (first use in this function)
     spin_lock_irqsave(&udc->lock, flags);
                        ^
   include/linux/spinlock.h:215:34: note: in definition of macro 'raw_spin_lock_irqsave'
      flags = _raw_spin_lock_irqsave(lock); \
                                     ^
>> drivers/staging/emxx_udc/emxx_udc.c:3129:2: note: in expansion of macro 'spin_lock_irqsave'
     spin_lock_irqsave(&udc->lock, flags);
     ^
   drivers/staging/emxx_udc/emxx_udc.c:3129:21: note: each undeclared identifier is reported only once for each function it appears in
     spin_lock_irqsave(&udc->lock, flags);
                        ^
   include/linux/spinlock.h:215:34: note: in definition of macro 'raw_spin_lock_irqsave'
      flags = _raw_spin_lock_irqsave(lock); \
                                     ^
>> drivers/staging/emxx_udc/emxx_udc.c:3129:2: note: in expansion of macro 'spin_lock_irqsave'
     spin_lock_irqsave(&udc->lock, flags);
     ^

vim +/udc +3129 drivers/staging/emxx_udc/emxx_udc.c

33aa8d45 Magnus Damm 2014-06-06  3123
33aa8d45 Magnus Damm 2014-06-06  3124   if (pgadget == NULL) {
33aa8d45 Magnus Damm 2014-06-06  3125   ERR("%s, bad param\n", __func__);
33aa8d45 Magnus Damm 2014-06-06  3126   return -EINVAL;
33aa8d45 Magnus Damm 2014-06-06  3127   }
33aa8d45 Magnus Damm 2014-06-06  3128
33aa8d45 Magnus Damm 2014-06-06 @3129   spin_lock_irqsave(&udc->lock, flags);
9239d88f Peter Chen  2015-01-28  3130   pgadget->is_selfpowered = (is_selfpowered != 0);
33aa8d45 Magnus Damm 2014-06-06  3131   spin_unlock_irqrestore(&udc->lock, flags);
33aa8d45 Magnus Damm 2014-06-06  3132

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: Kconfig: use bool instead of boolean
Christoph Jaeger [Mon, 2 Feb 2015 15:00:03 +0000 (10:00 -0500)]
usb: gadget: Kconfig: use bool instead of boolean

Keyword 'boolean' for type definition attributes is considered
deprecated and, therefore, should not be used anymore.

See http://lkml.kernel.org/r/cover.1418003065.git.cj@linux.com
See http://lkml.kernel.org/r/1419108071-11607-1-git-send-email-cj@linux.com

Signed-off-by: Christoph Jaeger <cj@linux.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: blackfin: remove incorrect __exit_p()
Dmitry Torokhov [Sun, 1 Feb 2015 05:13:59 +0000 (21:13 -0800)]
usb: musb: blackfin: remove incorrect __exit_p()

bfin_remove() is not (nor should it be) marked as __exit, so we should
not be using __exit_p() wrapper with it, otherwise unbinding through
sysfs does not work properly.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: phy: phy-generic: Fix USB PHY gpio reset
Fabio Estevam [Wed, 28 Jan 2015 15:19:17 +0000 (13:19 -0200)]
usb: phy: phy-generic: Fix USB PHY gpio reset

Since commit e9f2cefb0cdc2ae ("usb: phy: generic: migrate to gpio_desc") a
kernel hang is observed on imx51-babbage board:

[    1.392824] ci_hdrc ci_hdrc.1: doesn't support gadget
[    1.397975] ci_hdrc ci_hdrc.1: EHCI Host Controller
[    1.403205] ci_hdrc ci_hdrc.1: new USB bus registered, assigned bus number 1
[    1.422335] ci_hdrc ci_hdrc.1: USB 2.0 started, EHCI 1.00
[    1.432962] hub 1-0:1.0: USB hub found
[    1.437119] hub 1-0:1.0: 1 port detected

This hang happens because the reset GPIO stays at logic level 0.

The USB PHY reset gpio is defined in the dts file as:

reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;

, which means it is active low, so what the gpio reset pin needs to do in this
case is the following:

- Go to logic level 0 to reset the USB PHY
- Stay at 0 for a bit
- Go back to logic level 1

When switching to gpiod API we need to following according to
Documentation/gpio/consumer.txt:

"The first thing a driver must do with a GPIO is setting its direction. If no
direction-setting flags have been given to gpiod_get*(), this is done by
invoking one of the gpiod_direction_*() functions:

int gpiod_direction_input(struct gpio_desc *desc)
int gpiod_direction_output(struct gpio_desc *desc, int value)"

Since no direction-setting flags have been given to devm_gpiod_get_optional()
in our case, we need to use gpiod_direction_output to comply with the gpiod API.

With this change the USB PHY reset performs a proper reset, the kernel boots
fine and USB host is functional.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: fix USB core dependencies
Arnd Bergmann [Wed, 28 Jan 2015 21:49:00 +0000 (22:49 +0100)]
usb: dwc2: fix USB core dependencies

It is currently possible to configure the dwc2 driver as built-in
when host mode or dual-role is enabled, but the USB core is
a loadable module. This leads to a link failure:

drivers/built-in.o: In function `_dwc2_hcd_start':
:(.text+0x84538): undefined reference to `usb_hcd_resume_root_hub'
drivers/built-in.o: In function `_dwc2_hcd_urb_dequeue':
:(.text+0x84aa0): undefined reference to `usb_hcd_check_unlink_urb'
:(.text+0x84e4c): undefined reference to `usb_hcd_unlink_urb_from_ep'
:(.text+0x84e74): undefined reference to `usb_hcd_giveback_urb'
drivers/built-in.o: In function `dwc2_assign_and_init_hc':
:(.text+0x86b98): undefined reference to `usb_hcd_unmap_urb_for_dma'
drivers/built-in.o: In function `_dwc2_hcd_urb_enqueue':
:(.text+0x8717c): undefined reference to `usb_hcd_link_urb_to_ep'
:(.text+0x872f4): undefined reference to `usb_hcd_unlink_urb_from_ep'
drivers/built-in.o: In function `dwc2_host_complete':
:(.text+0x875d4): undefined reference to `usb_hcd_unlink_urb_from_ep'
:(.text+0x87600): undefined reference to `usb_hcd_giveback_urb'
drivers/built-in.o: In function `dwc2_hcd_init':
:(.text+0x87ba8): undefined reference to `usb_disabled'
:(.text+0x87d38): undefined reference to `usb_create_hcd'
:(.text+0x88094): undefined reference to `usb_add_hcd'
:(.text+0x880dc): undefined reference to `usb_put_hcd'
drivers/built-in.o: In function `dwc2_hcd_remove':
:(.text+0x8821c): undefined reference to `usb_remove_hcd'
:(.text+0x8823c): undefined reference to `usb_put_hcd'
drivers/built-in.o: In function `dwc2_hc_handle_tt_clear.isra.10':
:(.text+0x88e2c): undefined reference to `usb_hub_clear_tt_buffer'
drivers/built-in.o: In function `dwc2_hcd_qtd_add':
:(.text+0x8b554): undefined reference to `usb_calc_bus_time'

To fix the problem, this patch changes the dependencies so that
dwc2 host mode can only be enabled if either the USB core is
built-in or both USB and dwc2 are modules.

Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: renesas_usbhs: fix NULL pointer dereference in dma_release_channel()
Yoshihiro Shimoda [Fri, 30 Jan 2015 06:58:23 +0000 (15:58 +0900)]
usb: renesas_usbhs: fix NULL pointer dereference in dma_release_channel()

This patch fixes an issue that the following commit causes NULL
pointer dereference in dma_release_channel().
 "usb: renesas_usbhs: add support for requesting DT DMA"
 (commit id abd2dbf6bb1b5f3a03a8c76b1a8879da1dd30caa)

The usbhsf_dma_init_dt() should set fifo->{t,r}x_chan to NULL if
dma_request_slave_channel_reason() returns IS_ERR value.
Otherwise, usbhsf_dma_quit() will call dma_release_channel(), and then
NULL pointer dereference happens.

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
Reported-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: phy: generic: fix the vbus interrupt request
Robert Jarzmik [Fri, 30 Jan 2015 16:22:46 +0000 (17:22 +0100)]
usb: phy: generic: fix the vbus interrupt request

Declare the interrupt as "one shot" so that it is masked until the end
of the threaded handler. This prevents the irq core from spitting out an
error :
  "Threaded irq requested with handler=NULL and !ONESHOT for irq 63"

This was introduced by commit "usb: phy: generic: add vbus support".

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: phy: generic: fix the gpios to be optional
Robert Jarzmik [Fri, 30 Jan 2015 16:22:45 +0000 (17:22 +0100)]
usb: phy: generic: fix the gpios to be optional

All the gpios, ie. reset-gpios and vbus-detect-gpio, should be optional
and not prevent the driver from working. Fix the regression in the
behavior introduced by commit "usb: phy: generic: migrate to gpio_desc".

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: gadget: initialize controller in pullup callback
Gregory Herrero [Fri, 30 Jan 2015 08:09:37 +0000 (09:09 +0100)]
usb: dwc2: gadget: initialize controller in pullup callback

USB reset interrupt is no more used to reset the controller.
Thus, reset the controller in pullup callback as described by
Synopsys programming guide. Otherwise enumeration sometimes
fails when usb configuration is switched without physical
disconnection.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: gadget: replace constants with defines
Mian Yousaf Kaukab [Fri, 30 Jan 2015 08:09:36 +0000 (09:09 +0100)]
usb: dwc2: gadget: replace constants with defines

Defines are more readable and searchable than constants.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: gadget: fix phy interface configuration
Mian Yousaf Kaukab [Fri, 30 Jan 2015 08:09:35 +0000 (09:09 +0100)]
usb: dwc2: gadget: fix phy interface configuration

hsotg->phyif is set in dwc2_gadget_init according to phy interface
width. Use it for configuration instead of hardcoded value.
Moreover, set USB turnaround time according to phy width.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: gadget: fix debug message for zlp
Mian Yousaf Kaukab [Fri, 30 Jan 2015 08:09:34 +0000 (09:09 +0100)]
usb: dwc2: gadget: fix debug message for zlp

Print debug message according to zlp direction. Always saying
"Sending" is misleading.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: gadget: don't modify pullup status during reset
Gregory Herrero [Fri, 30 Jan 2015 08:09:33 +0000 (09:09 +0100)]
usb: dwc2: gadget: don't modify pullup status during reset

Pullup doesn't need to be enabled during usb reset since it is
already enabled. This leads to shorter chirp-k duration if done
during usb reset.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: gadget: add reset flag in init function
Gregory Herrero [Fri, 30 Jan 2015 08:09:32 +0000 (09:09 +0100)]
usb: dwc2: gadget: add reset flag in init function

Add a flag to request physical reset of the controller when
s3c_hsotg_core_init_disconnected is called.
During the usb reset, controller must not be fully reconfigured and
resetted. Else this leads to shorter chirp-k duration during
enumeration.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: gadget: add unaligned buffers support
Mian Yousaf Kaukab [Fri, 30 Jan 2015 08:09:31 +0000 (09:09 +0100)]
usb: dwc2: gadget: add unaligned buffers support

When using DMA, dwc2 requires buffers to be 4 bytes aligned. Use
bounce buffers if they are not.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: gadget: remove hardcoded if (0) and if (1) checks
Mian Yousaf Kaukab [Fri, 30 Jan 2015 08:09:30 +0000 (09:09 +0100)]
usb: dwc2: gadget: remove hardcoded if (0) and if (1) checks

Remove dead code as well.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: gadget: fix a typo in comment
Gregory Herrero [Fri, 30 Jan 2015 08:09:29 +0000 (09:09 +0100)]
usb: dwc2: gadget: fix a typo in comment

s3c_hsotg_process_req_feature comments was not correct

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: gadget: add TEST_MODE feature support
Gregory Herrero [Fri, 30 Jan 2015 08:09:28 +0000 (09:09 +0100)]
usb: dwc2: gadget: add TEST_MODE feature support

Handle SET_FEATURE TEST_MODE request sent by the host.
Slightly rework FEATURE request handling to allow parsing
other request types than Endpoint.
Also add a debugfs to change test mode value from user space.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: gadget: fix clear halt feature handling
Gregory Herrero [Fri, 30 Jan 2015 08:09:27 +0000 (09:09 +0100)]
usb: dwc2: gadget: fix clear halt feature handling

When clearing HALT on an endpoint, req->complete of in progress
requests must be called with locks off. New request should only be
started if there is not already a pending request on the endpoint.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: host: resume root hub on remote wakeup
Gregory Herrero [Fri, 30 Jan 2015 08:09:26 +0000 (09:09 +0100)]
usb: dwc2: host: resume root hub on remote wakeup

When a remote wakeup happens during bus_suspend, hcd needs to resume
its root hub.

Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: add omap-control dependency
Arnd Bergmann [Wed, 28 Jan 2015 21:51:04 +0000 (22:51 +0100)]
usb: musb: add omap-control dependency

The omap musb front-end calls into the phy driver directly
instead of using a generic phy interface, which causes a link
error when the specific driver is not built-in:

drivers/built-in.o: In function `omap2430_musb_disable':
usb/musb/omap2430.c:480: undefined reference to `omap_control_usb_set_mode'
drivers/built-in.o: In function `omap2430_musb_enable':
usb/musb/omap2430.c:466: undefined reference to `omap_control_usb_set_mode'
usb/musb/omap2430.c:447: undefined reference to `omap_control_usb_set_mode'
drivers/built-in.o: In function `omap_musb_set_mailbox':
usb/musb/omap2430.c:273: undefined reference to `omap_control_usb_set_mode'
usb/musb/omap2430.c:304: undefined reference to `omap_control_usb_set_mode'
drivers/built-in.o:(.debug_addr+0xbd9e0): more undefined references to `omap_control_usb_set_mode' follow

This adds an explicit dependency.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: ca784be36cc725 ("usb: start using the control module driver")
Cc: <stable@vger.kernel.org> # v3.9+
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: add generic usb phy dependencies
Arnd Bergmann [Wed, 28 Jan 2015 21:50:04 +0000 (22:50 +0100)]
usb: musb: add generic usb phy dependencies

Multiple musb glue drivers depend on the generic usb phy support,
but fail to list it as a dependency in Kconfig. This results
in build erros like:

drivers/built-in.o: In function `am35x_remove':
:(.text+0xadacc): undefined reference to `usb_phy_generic_unregister'
drivers/built-in.o: In function `am35x_probe':
:(.text+0xae1c8): undefined reference to `usb_phy_generic_register'
:(.text+0xae244): undefined reference to `usb_phy_generic_unregister'
drivers/built-in.o: In function `jz4740_remove':
:(.text+0xaf648): undefined reference to `usb_phy_generic_unregister'
drivers/built-in.o: In function `jz4740_musb_init':
:(.text+0xaf694): undefined reference to `usb_phy_generic_register'

This adds the ones that are missing.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: udc-core: add is_selfpowered sys entry
Peter Chen [Wed, 28 Jan 2015 08:32:42 +0000 (16:32 +0800)]
usb: udc-core: add is_selfpowered sys entry

The user can read it through sys entry.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: gadget: use common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:41 +0000 (16:32 +0800)]
usb: musb: gadget: use common is_selfpowered

Delete private selfpowered variable, and use common one.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc3: gadget: use common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:40 +0000 (16:32 +0800)]
usb: dwc3: gadget: use common is_selfpowered

Delete private selfpowered variable, and use common one.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: pch_udc: set value for common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:39 +0000 (16:32 +0800)]
usb: gadget: pch_udc: set value for common is_selfpowered

Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: atmel_usba_udc: set value for common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:38 +0000 (16:32 +0800)]
usb: gadget: atmel_usba_udc: set value for common is_selfpowered

Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: net2272: use common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:37 +0000 (16:32 +0800)]
usb: gadget: net2272: use common is_selfpowered

Delete private selfpowered variable, and use common one.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: s3c2410_udc: set value for common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:36 +0000 (16:32 +0800)]
usb: gadget: s3c2410_udc: set value for common is_selfpowered

Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: net2280: use common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:35 +0000 (16:32 +0800)]
usb: gadget: net2280: use common is_selfpowered

Delete private selfpowered variable, and use common one.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: r8a66597-udc: set value for common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:34 +0000 (16:32 +0800)]
usb: gadget: r8a66597-udc: set value for common is_selfpowered

Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: omap_udc: set value for common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:33 +0000 (16:32 +0800)]
usb: gadget: omap_udc: set value for common is_selfpowered

Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: fsl_udc_core: set value for common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:32 +0000 (16:32 +0800)]
usb: gadget: fsl_udc_core: set value for common is_selfpowered

fsl udc core assumes itself always self powered, so set is_selfpowered
is 1.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: lpc32xx_udc: use common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:31 +0000 (16:32 +0800)]
usb: gadget: lpc32xx_udc: use common is_selfpowered

Delete private selfpowered variable, and use common one.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: dummy_hcd: set value for common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:30 +0000 (16:32 +0800)]
usb: gadget: dummy_hcd: set value for common is_selfpowered

Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: bdc_udc: set value for common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:29 +0000 (16:32 +0800)]
usb: gadget: bdc_udc: set value for common is_selfpowered

Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: renesas_usbhs: gadget: set value for common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:28 +0000 (16:32 +0800)]
usb: renesas_usbhs: gadget: set value for common is_selfpowered

Set value for common is_selfpowered.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agostaging: emxx_udc: use common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:27 +0000 (16:32 +0800)]
staging: emxx_udc: use common is_selfpowered

Delete private selfpowered variable, and use common one.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: at91_udc: use common is_selfpowered
Peter Chen [Wed, 28 Jan 2015 08:32:26 +0000 (16:32 +0800)]
usb: gadget: at91_udc: use common is_selfpowered

Delete private selfpowered variable, and use common one.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: chipidea: udc: add set_selfpowered gaget ops
Peter Chen [Wed, 28 Jan 2015 08:32:25 +0000 (16:32 +0800)]
usb: chipidea: udc: add set_selfpowered gaget ops

The gadget power property will be used at get_status request.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: introduce is_selfpowered for usb_gadget
Peter Chen [Wed, 28 Jan 2015 08:32:24 +0000 (16:32 +0800)]
usb: gadget: introduce is_selfpowered for usb_gadget

Whether the gadget is selfpowerwed or not can be determined by composite
core, so we can use a common entry to indicate if the self-powered
is supported by gadget, and the related private variable at individual
udc driver can be deleted.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc3: gadget: add missing spin_lock()
Felipe Balbi [Thu, 29 Jan 2015 16:29:18 +0000 (10:29 -0600)]
usb: dwc3: gadget: add missing spin_lock()

commit 8e74475b0e0a (usb: dwc3: gadget: use udc-core's
reset notifier) added support for the new UDC core's
reset notifier to dwc3 but while at it, it removed
a spin_lock() from dwc3_reset_gadget() which might
cause an unbalanced spin_unlock() further down the line

Fixes: 8e74475b0e0a (usb: dwc3: gadget: use udc-core's reset notifier)
Cc: <stable@vger.kernel.org> # v3.19
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc3: remove reliance on dev_vdbg()
Felipe Balbi [Tue, 27 Jan 2015 19:48:14 +0000 (13:48 -0600)]
usb: dwc3: remove reliance on dev_vdbg()

By moving all dev_vdbg() to tracepoints, we
can finally get rid of dev_vdbg() usage from
dwc3.

Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc3: trace: add trace logs for core and gadget
Felipe Balbi [Tue, 27 Jan 2015 19:47:02 +0000 (13:47 -0600)]
usb: dwc3: trace: add trace logs for core and gadget

Sometimes we want to just print a formatted
string without passing any extra data. The
following will be used for removing reliance
on dev_vdbg() from dwc3.

Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc3: gadget: WARN() in case of unknown IRQ
Felipe Balbi [Tue, 27 Jan 2015 19:49:28 +0000 (13:49 -0600)]
usb: dwc3: gadget: WARN() in case of unknown IRQ

if an unknown IRQ event is triggered, that means
the HW is really misbehaving. Instead of printing
a debug message, let's WARN() so users report
when that happens.

Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc3: gadget: avoid variable shadowing
Felipe Balbi [Tue, 27 Jan 2015 19:24:26 +0000 (13:24 -0600)]
usb: dwc3: gadget: avoid variable shadowing

We already have both ret and dwc defined in this
same function.

Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: uvc: comments for iterating over streaming hierarchy
Andrzej Pietrasiewicz [Mon, 19 Jan 2015 12:52:58 +0000 (13:52 +0100)]
usb: gadget: uvc: comments for iterating over streaming hierarchy

The purpose of the functions and their parametrs might not be obvious
to the reader, so explain it.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: uvc: use explicit type instead of void *
Andrzej Pietrasiewicz [Mon, 19 Jan 2015 12:52:57 +0000 (13:52 +0100)]
usb: gadget: uvc: use explicit type instead of void *

The first parameter of __uvcg_iter_strm_cls() is always used in
the context of struct uvcg_streaming_header, so change the
function prototype accordingly.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: phy: mxs: add delay before set phyctrl.clkgate
Peter Chen [Fri, 16 Jan 2015 10:29:01 +0000 (18:29 +0800)]
usb: phy: mxs: add delay before set phyctrl.clkgate

There is a request from IC engineer that if we doesn't
set phypwd as 0xffffffff, we need to delay about five
32Khz cycles before set phy's pwd register, otherwise,
the wakeup signal may can't wake up controller.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: phy: mxs: do not set PWD.RXPWD1PT1 for low speed connection
Peter Chen [Fri, 16 Jan 2015 10:29:00 +0000 (18:29 +0800)]
usb: phy: mxs: do not set PWD.RXPWD1PT1 for low speed connection

At very rare cases, the SoF will not send out after resume with
low speed connection. The workaround is do not power down
PWD.RXPWD1PT1 bit during the suspend.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: phy: mxs: refine mxs_phy_disconnect_line
Li Jun [Fri, 16 Jan 2015 10:28:59 +0000 (18:28 +0800)]
usb: phy: mxs: refine mxs_phy_disconnect_line

For non-otg mode, we keep the usage of disconnect line between phy analog
and digital unchanging; for otg mode, at peripheral role, we keep the usage
unchanging too, at host role, the digital part needs to know dp/dm change
to respond device's data pulse when it is at low power mode.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: phy: mxs: don't need IP fix for imx6sx
Peter Chen [Fri, 16 Jan 2015 10:28:58 +0000 (18:28 +0800)]
usb: phy: mxs: don't need IP fix for imx6sx

The RLT code has already done it, so no software operation is needed.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Fix USB disabled check
Laurent Pinchart [Tue, 20 Jan 2015 22:56:05 +0000 (00:56 +0200)]
usb: isp1760: Fix USB disabled check

The isp1760 driver registration function returns an error if USB is
disabled. This made sense when the driver only supported host
controllers, but now that it supports peripheral controllers host
support isn't mandatory anymore.

Fix this by returning an error only when both the HCD and UDC functions
are disabled, either through the kernel configuration or at runtime.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Remove duplicate usb_disabled() check
Laurent Pinchart [Tue, 20 Jan 2015 22:56:04 +0000 (00:56 +0200)]
usb: isp1760: Remove duplicate usb_disabled() check

Both isp1760_register() and isp1761_pci_probe() check whether USB is
disabled by calling usb_disabled(), and bail out with an error if it is.
One check is enough, remove the PCI-specific check.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Make HCD support optional
Laurent Pinchart [Tue, 20 Jan 2015 22:56:03 +0000 (00:56 +0200)]
usb: isp1760: Make HCD support optional

Enable compilation of the isp1760 driver in pure host mode, pure device
mode, or dual-role mode.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Move driver from drivers/usb/host/ to drivers/usb/isp1760/
Laurent Pinchart [Tue, 20 Jan 2015 22:56:02 +0000 (00:56 +0200)]
usb: isp1760: Move driver from drivers/usb/host/ to drivers/usb/isp1760/

Now that this is DRD, it doesn't make sense to keep it under
drivers/usb/host.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Add device controller support
Laurent Pinchart [Tue, 20 Jan 2015 22:56:01 +0000 (00:56 +0200)]
usb: isp1760: Add device controller support

The ISP1761 is a dual-mode host and device controller backward
compatible on the host side with the ISP1760. Add support for the device
controller.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Move PORT1 configuration to core code
Laurent Pinchart [Tue, 20 Jan 2015 22:56:00 +0000 (00:56 +0200)]
usb: isp1760: Move PORT1 configuration to core code

Configuring the mode of operation of port 1 doesn't belong to the HCD
code, as it's related to the soon to come UDC support. Move the
configuration to core code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Initialize the bus interface in core code
Laurent Pinchart [Tue, 20 Jan 2015 22:55:59 +0000 (00:55 +0200)]
usb: isp1760: Initialize the bus interface in core code

Although the corresponding register is part of the HCD register space,
processor bus initialization is not specific to the HCD. To prepare for
device controller support, move bus interface initialization to core
code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Set IRQF_SHARED flag in core code
Laurent Pinchart [Tue, 20 Jan 2015 22:55:58 +0000 (00:55 +0200)]
usb: isp1760: Set IRQF_SHARED flag in core code

The IRQF_SHARED flag needs to be set regardless of the bus type. Don't
require glue code to set it manually.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Move core code to isp1760-core.c
Laurent Pinchart [Tue, 20 Jan 2015 22:55:57 +0000 (00:55 +0200)]
usb: isp1760: Move core code to isp1760-core.c

Move core device initialization to a central location in order to share
it with the device mode implementation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Reorganize header files
Laurent Pinchart [Tue, 20 Jan 2015 22:55:56 +0000 (00:55 +0200)]
usb: isp1760: Reorganize header files

The isp1760-rhcd.h header contains PTD constants and structures only
useful for the HCD implementation. It also contains register definitions
that will be needed by common code when implementing support for the
ISP1761 device controller, but doesn't contain the isp1760_hcd structure
definition that will also be used by common code.

Move definitions to the right location and create an isp1760-regs.h to
store register definitions. No change other than moving definitions and
modifying indentation is performed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Prefix driver data structures with isp1760_
Laurent Pinchart [Tue, 20 Jan 2015 22:55:55 +0000 (00:55 +0200)]
usb: isp1760: Prefix driver data structures with isp1760_

The slotinfo and memory_chunk structures are specific to the driver and
defined in a header file. Prefix them with isp1760_ to avoid namespace
clashes.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Decouple usb_hdc and isp1760_priv
Laurent Pinchart [Tue, 20 Jan 2015 22:55:54 +0000 (00:55 +0200)]
usb: isp1760: Decouple usb_hdc and isp1760_priv

Allocate the driver private data structure manually instead of using the
usb_hcd private space. This will allow skipping hcd registration for the
isp1761 when used in device mode only.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Refactor PCI initialization code
Laurent Pinchart [Tue, 20 Jan 2015 22:55:53 +0000 (00:55 +0200)]
usb: isp1760: Refactor PCI initialization code

Move the initialization code out of the PCI probe function to a new
function in order to simplify and fix error handling.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Use the managed devm_ioremap_resource() API
Laurent Pinchart [Tue, 20 Jan 2015 22:55:52 +0000 (00:55 +0200)]
usb: isp1760: Use the managed devm_ioremap_resource() API

This simplifies error and remove code paths.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Pass resource pointer to isp1760_register
Laurent Pinchart [Tue, 20 Jan 2015 22:55:51 +0000 (00:55 +0200)]
usb: isp1760: Pass resource pointer to isp1760_register

The function takes quite a few arguments, passing the resource pointer
instead of the start address and length simplifies it a bit.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Remove busname argument to isp1760_register
Laurent Pinchart [Tue, 20 Jan 2015 22:55:50 +0000 (00:55 +0200)]
usb: isp1760: Remove busname argument to isp1760_register

The argument is unused, remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Prefix init_kmem_once and deinit_kmem_cache with isp1760_
Laurent Pinchart [Tue, 20 Jan 2015 22:55:49 +0000 (00:55 +0200)]
usb: isp1760: Prefix init_kmem_once and deinit_kmem_cache with isp1760_

The two functions are specific to the driver but have very generic
names, subject to collisions. Rename them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Fix indentation in probe error path
Laurent Pinchart [Tue, 20 Jan 2015 22:55:48 +0000 (00:55 +0200)]
usb: isp1760: Fix indentation in probe error path

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Don't expose hcd to glue code from isp1760_register
Laurent Pinchart [Tue, 20 Jan 2015 22:55:47 +0000 (00:55 +0200)]
usb: isp1760: Don't expose hcd to glue code from isp1760_register

The glue code probe functions don't need to access the hcd structure
anymore. Modify isp1760_register to return an integer error code instead
of the hcd pointer.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Manage device driver data in common code
Laurent Pinchart [Tue, 20 Jan 2015 22:55:46 +0000 (00:55 +0200)]
usb: isp1760: Manage device driver data in common code

Don't duplicate *_set_drvdata calls in glue code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Move removal cleanup code to isp1760-hcd.c
Laurent Pinchart [Tue, 20 Jan 2015 22:55:45 +0000 (00:55 +0200)]
usb: isp1760: Move removal cleanup code to isp1760-hcd.c

The removal cleanup code is duplicated between the different bus glues.
Move it to a central location.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Merge platform and OF glue codes
Laurent Pinchart [Tue, 20 Jan 2015 22:55:44 +0000 (00:55 +0200)]
usb: isp1760: Merge platform and OF glue codes

Both handle platform devices, merge them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Unmap I/O registers at platform device removal
Laurent Pinchart [Tue, 20 Jan 2015 22:55:43 +0000 (00:55 +0200)]
usb: isp1760: Unmap I/O registers at platform device removal

The I/O registers are mapped in the HCD code but must be unmapped by
glue code. The OF and PCI glue code unmap them correctly but the
platform glue code is missing an iounmap() call. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Retrieve pdev memory resource from hcd at remove time
Laurent Pinchart [Tue, 20 Jan 2015 22:55:42 +0000 (00:55 +0200)]
usb: isp1760: Retrieve pdev memory resource from hcd at remove time

The platform driver remove function needs to release the memory resource
requested at probe time. Instead of retrieving the resource from the
platform device, retrieve it from the usb_hcd. This mimics the behaviour
of the PCI and OF glues, and will make it easier to share code between
all three glue layers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Remove isp1760 glue structure
Laurent Pinchart [Tue, 20 Jan 2015 22:55:41 +0000 (00:55 +0200)]
usb: isp1760: Remove isp1760 glue structure

The structure is allocated for the sole purpose of holding a pointer to
the HCD and being stored in platform device driver data. Store the HCD
pointer directly instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: isp1760: Use the gpio descriptor API
Laurent Pinchart [Tue, 20 Jan 2015 22:55:40 +0000 (00:55 +0200)]
usb: isp1760: Use the gpio descriptor API

Switching to the managed gpio descriptor API simplifies both error and
cleanup code paths (by removing the need to free the gpio) and runtime
code (by removing manual handling of the active low flag). It also
permits handling the reset gpio entirely from within the HCD code,
sharing it between the different glue layers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: zero: fix format string warnings
Asaf Vertz [Wed, 21 Jan 2015 09:06:34 +0000 (11:06 +0200)]
usb: gadget: zero: fix format string warnings

Fixed the following warnings (reported by cppcheck):
[drivers/usb/gadget/function/f_sourcesink.c:1217]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1261]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1305]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1349]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1393]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1437]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1476]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1520]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1564]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
[drivers/usb/gadget/function/f_sourcesink.c:1608]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'

Reviewed-by: Amit Virdi <amit.virdi@st.com>
Signed-off-by: Asaf Vertz <asaf.vertz@tandemg.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: ffs: add eventfd notification about ffs events
Robert Baldyga [Fri, 23 Jan 2015 12:41:01 +0000 (13:41 +0100)]
usb: gadget: ffs: add eventfd notification about ffs events

Add eventfd which notifies userspace about ep0 events and AIO completion
events. It simplifies using of FunctionFS with event loop, because now
we need to poll on single file (instead of polling on ep0 and eventfd's
supplied to AIO layer).

FunctionFS eventfd is not triggered if another eventfd is supplied to
AIO layer (in AIO request). It can be useful, for example, when we want
to handle AIO transations for chosen endpoint in separate thread.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: f_fs: Fix loop variable
Mario Schuknecht [Mon, 26 Jan 2015 19:40:21 +0000 (20:40 +0100)]
usb: gadget: f_fs: Fix loop variable

Use if-loop variable 'epfile' instead of start variable 'epfiles'. Now the
correct endpoint file name is stored.

Signed-off-by: Mario Schuknecht <mario.schuknecht@dresearch-fe.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: Fix os desc test
Mario Schuknecht [Mon, 26 Jan 2015 19:30:27 +0000 (20:30 +0100)]
usb: gadget: Fix os desc test

USB vendor type is encoded in field bmRequestType. Make test USB_TYPE_VENDOR
with bRequestType instead of bRequest.

Signed-off-by: Mario Schuknecht <mario.schuknecht@dresearch-fe.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: cppi41: improve rx channel abort routine
Bin Liu [Mon, 26 Jan 2015 22:22:07 +0000 (16:22 -0600)]
usb: musb: cppi41: improve rx channel abort routine

1. set AUTOREQ to NONE at the beginning of teardown;

2. add delay for dma pipeline to drain;

3. Do not set USB_TDOWN bit for RX teardown.

  The CPPI hw has an issue that when tearing down a RX channel, if
  another RX channel is receiving data, the CPPI will lockup.

  To workaround the issue, do not set the CPPI TD bit. The steps before
  this point ensures the CPPI channel will be torn down properly.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: cppi41: correct the macro name EP_MODE_AUTOREG_*
Bin Liu [Mon, 26 Jan 2015 22:22:06 +0000 (16:22 -0600)]
usb: musb: cppi41: correct the macro name EP_MODE_AUTOREG_*

The macro EP_MODE_AUTOREG_* should be called EP_MODE_AUTOREQ_*, as they
are used for register AUTOREQ.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: renesas_usbhs: add support for requesting DT DMA
Yoshihiro Shimoda [Mon, 19 Jan 2015 03:53:17 +0000 (12:53 +0900)]
usb: renesas_usbhs: add support for requesting DT DMA

This patch adds dma_request_slave_channel_reason() calling to request
dma slave channels for multiplatform environment.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: renesas_usbhs: add usbhsf_dma_init_pdev() function
Yoshihiro Shimoda [Mon, 19 Jan 2015 03:53:16 +0000 (12:53 +0900)]
usb: renesas_usbhs: add usbhsf_dma_init_pdev() function

To add support for requesting DT DMA in the future, this patch adds
usbhsf_dma_init_pdev() function.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: renesas_usbhs: mod_host: use HUB_CHAR_*
Sergei Shtylyov [Sun, 18 Jan 2015 22:59:09 +0000 (01:59 +0300)]
usb: renesas_usbhs: mod_host: use HUB_CHAR_*

Fix  using the  bare number  to set the 'wHubCharacteristics' field of the Hub
Descriptor while the values are #define'd in <linux/usb/ch11.h>.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: musb: virthub: use HUB_CHAR_*
Sergei Shtylyov [Sun, 18 Jan 2015 22:57:18 +0000 (01:57 +0300)]
usb: musb: virthub: use HUB_CHAR_*

Fix  using the  bare numbers to set the 'wHubCharacteristics' field of the Hub
Descriptor while the values are #define'd in <linux/usb/ch11.h>.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dummy_hcd: use HUB_CHAR_*
Sergei Shtylyov [Sun, 18 Jan 2015 22:55:55 +0000 (01:55 +0300)]
usb: dummy_hcd: use HUB_CHAR_*

Fix  using the  bare numbers to set the 'wHubCharacteristics' field of the Hub
Descriptor while the values are #define'd in <linux/usb/ch11.h>.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: dwc2: hcd: use HUB_CHAR_*
Sergei Shtylyov [Sun, 18 Jan 2015 22:54:15 +0000 (01:54 +0300)]
usb: dwc2: hcd: use HUB_CHAR_*

Fix  using the  bare number  to set the 'wHubCharacteristics' field of the Hub
Descriptor while the values are #define'd in <linux/usb/ch11.h>.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: uvc: preserve the address passed to kfree()
Andrzej Pietrasiewicz [Fri, 16 Jan 2015 14:14:27 +0000 (15:14 +0100)]
usb: gadget: uvc: preserve the address passed to kfree()

__uvcg_fill_strm() called from __uvcg_iter_stream_cls()
might have advanced the "data" even if __uvcg_iter_stream_cls()
returns an error, so use a backup copy as an argument to kfree().

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agoMAINTAINERS: update maintainer entry for dwc2 driver
Paul Zimmerman [Thu, 15 Jan 2015 20:14:10 +0000 (20:14 +0000)]
MAINTAINERS: update maintainer entry for dwc2 driver

Update the MAINTAINERS entry for the dwc2 driver to show John Youn
as the new maintainer

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agoRevert "usb: dwc2: add bus suspend/resume for dwc2"
Paul Zimmerman [Thu, 15 Jan 2015 19:21:46 +0000 (19:21 +0000)]
Revert "usb: dwc2: add bus suspend/resume for dwc2"

This reverts commit 0cf884e819e05437287a668b9bfcc198bab6329c.
Even after applying the follow-on patch at
https://patchwork.kernel.org/patch/5325111
there are still problems with device connect on the Altera SOCFPGA
platform at least. One possible fix would be to add a whitelist
to enable suspend/resume on platforms where it does work correctly.

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: ethernet: re-use %pM specifier to print MAC
Andy Shevchenko [Thu, 15 Jan 2015 11:40:04 +0000 (13:40 +0200)]
usb: gadget: ethernet: re-use %pM specifier to print MAC

Instead of custom approach the patch converts code to use %pM specifier to
print MAC.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: phy: make GPIOs optional for the generic phy
Paul Zimmerman [Thu, 15 Jan 2015 02:45:12 +0000 (02:45 +0000)]
usb: phy: make GPIOs optional for the generic phy

The use of GPIOs should be optional for the generic phy, otherwise
the Altera SOCFPGA platform at least is broken.

Fixes breakage caused by a combination of e9f2cefb0cd "usb: phy:
generic: migrate to gpio_desc" and 135b3c4304d "usb: dwc2: platform:
add generic PHY framework support".

Reviewed-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: uvc: cleanup UVCG_FRAME_ATTR macro
Dan Carpenter [Wed, 14 Jan 2015 21:06:35 +0000 (00:06 +0300)]
usb: gadget: uvc: cleanup UVCG_FRAME_ATTR macro

1) Change "conv" an "vnoc" to "to_cpu_endian" to "to_little_endian".
2) No need to check the "limit" because that is already handled in
   kstrtoXX so delete that parameter along with the check.
3) By using a "bits" parameter, we can combine the "uxx" parameter and
   the "str2u" parameters.
4) The kstrtou##bits() conversion does not need to be done under the
   mutex so move it to the start of the function.
5) Change the name of "identity_conv" to "noop_conversion".

Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: uvc: memory leak in uvcg_frame_make()
Dan Carpenter [Wed, 14 Jan 2015 21:03:08 +0000 (00:03 +0300)]
usb: gadget: uvc: memory leak in uvcg_frame_make()

We need to add a kfree(h) on an error path.

Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: uvc: remove an impossible condition
Dan Carpenter [Wed, 14 Jan 2015 21:02:18 +0000 (00:02 +0300)]
usb: gadget: uvc: remove an impossible condition

"num" is a u32 so "(num > 0xFFFFFFFF)" is never true.  Also the range
is already checked in kstrtou32().

Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agousb: gadget: uvc: fix some error codes
Dan Carpenter [Wed, 14 Jan 2015 20:59:48 +0000 (23:59 +0300)]
usb: gadget: uvc: fix some error codes

We're basically saying ERR_CAST(NULL) and PTR_ERR(NULL) here, which is
nonsensical.

Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
9 years agoMerge tag 'v3.19-rc5' into next
Felipe Balbi [Mon, 19 Jan 2015 15:57:20 +0000 (09:57 -0600)]
Merge tag 'v3.19-rc5' into next

Linux 3.19-rc5

Conflicts:
drivers/usb/dwc2/gadget.c
drivers/usb/gadget/udc/bdc/bdc_ep.c