firefly-linux-kernel-4.4.55.git
8 years agoFROMLIST: usb: dwc3: add dis_u2_freeclk_exists_quirk
William Wu [Thu, 2 Jun 2016 10:58:27 +0000 (18:58 +0800)]
FROMLIST: usb: dwc3: add dis_u2_freeclk_exists_quirk

Add a quirk to clear the GUSB2PHYCFG.U2_FREECLK_EXISTS bit,
which specifies whether the USB2.0 PHY provides a free-running
PHY clock, which is active when the clock control input is active.

Change-Id: I1b93715501f54231fc4dccebba2163d3484b2be6
Signed-off-by: William Wu <william.wu@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
8 years agoUPSTREAM: ARM: dts: rockchip: add eFuse config of rk3288 SoC
Jacob Chen [Tue, 16 Aug 2016 01:15:34 +0000 (09:15 +0800)]
UPSTREAM: ARM: dts: rockchip: add eFuse config of rk3288 SoC

This patch add the eFuse dt config of rk3288 SoC.

Change-Id: Ib0b316946ed362d4e4adb4a82448947bfc2c0e5b
Signed-off-by: ZhengShunQian <zhengsq@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
(cherry picked from commit 8818555964eed0010044c4d85f096452b14eb8b5)

8 years agoUPSTREAM: clk: rockchip: Add the clock ids of rk3288 eFuses
Jacob Chen [Tue, 16 Aug 2016 01:15:12 +0000 (09:15 +0800)]
UPSTREAM: clk: rockchip: Add the clock ids of rk3288 eFuses

Add clock-ids for the two efuse blocks of the rk3288.

Change-Id: I6cc8caf49e2f5aa3c0434a2f287b0fedbda190dc
Signed-off-by: ZhengShunQian <zhengsq@rock-chips.com>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
(cherry picked from commit b457c1e440fc8580563ed7a5c3156573ecaf3dfc)

8 years agodrm/panel: keep mute when panel has no device-tree timing
Mark Yao [Wed, 17 Aug 2016 00:56:56 +0000 (08:56 +0800)]
drm/panel: keep mute when panel has no device-tree timing

Since commit (f6972eb FROMLIST: drm/panel: add of display
timing support), when panel has no device-tree timing, would always
get noise message:
[    8.742157] /lvds_panel: could not find display-timings node
[    8.747878] /lvds_panel: no timings specified

Change-Id: I9104b3017faa837807a09c21d0f948e499827ad9
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
8 years agonet: wireless: rockchip_wlan: add rtl8188eu support
zzc [Thu, 11 Aug 2016 07:39:03 +0000 (15:39 +0800)]
net: wireless: rockchip_wlan: add rtl8188eu support

update rtl8188eu wifi driver to version v4.3.24_16705.20160509

Change-Id: Id28e185a24eb94877cb10cfcf54b63e04da75ca1
Signed-off-by: zzc <zzc@rock-chips.com>
8 years agophy: rockchip-inno-usb2: add SDP detect retry
Feng Mingli [Wed, 10 Aug 2016 03:43:04 +0000 (11:43 +0800)]
phy: rockchip-inno-usb2: add SDP detect retry

If detect a SDP charger type, we retry twice more to avoid
DCP falsely identified as SDP due to hardware signal error.

Change-Id: I1bf7bd076cd7767938f6944f1156daa7e64870e4
Signed-off-by: Feng Mingli <fml@rock-chips.com>
8 years agoARM64: configs: rockchip_defconfig: enable gsl3673
buluess.li [Wed, 3 Aug 2016 07:30:51 +0000 (15:30 +0800)]
ARM64: configs: rockchip_defconfig: enable gsl3673

Change-Id: Id9ae1a78fb0f4ecf1d7561dcc1320362bd181bb1
Signed-off-by: buluess.li <buluess.li@rock-chips.com>
8 years agoinput: touchscreen: add touch screen of gsl3673 for rk3399-evb
buluess.li [Wed, 3 Aug 2016 06:13:09 +0000 (14:13 +0800)]
input: touchscreen: add touch screen of gsl3673 for rk3399-evb

Change-Id: I16a4e44c75a16aefa153b002bce83392522c7d30
Signed-off-by: buluess.li <buluess.li@rock-chips.com>
8 years agoUPSTREAM: Documentation: dt: dwc3: Add snps,dis_rxdet_inp3_quirk property
Rajesh Bhagat [Mon, 14 Mar 2016 09:10:51 +0000 (14:40 +0530)]
UPSTREAM: Documentation: dt: dwc3: Add snps,dis_rxdet_inp3_quirk property

Add snps,dis_rxdet_inp3_quirk property which disables receiver detection
in PHY P3 power state.

Change-Id: I434f10041f5ff3f7d81b14ba4d6e5bcdb47b1ad7
Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 2c0b98ff29a7452edbbdc503857b74cfaa536808)

8 years agoUPSTREAM: usb: dwc3: st: Use explicit reset_control_get_exclusive() API
Lee Jones [Tue, 28 Jun 2016 08:24:40 +0000 (09:24 +0100)]
UPSTREAM: usb: dwc3: st: Use explicit reset_control_get_exclusive() API

We're making all reset line users specify whether their lines are
shared with other IP or they operate them exclusively.  In this case
the line is exclusively used only by this IP, so use the *_exclusive()
API accordingly.

Change-Id: I94d96af42ac63cd0c6445930f0458d36ec92f0e4
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 5baaf3b9efe127d239038de9219d381f4d882b26)

8 years agoUPSTREAM: usb: dwc3: st: Inform the reset framework that our reset line may be shared
Lee Jones [Tue, 28 Jun 2016 08:23:58 +0000 (09:23 +0100)]
UPSTREAM: usb: dwc3: st: Inform the reset framework that our reset line may be shared

On the STiH410 B2120 development board the MiPHY28lp shares its reset
line with the Synopsys DWC3 SuperSpeed (SS) USB 3.0 Dual-Role-Device
(DRD).  New functionality in the reset subsystems forces consumers to
be explicit when requesting shared/exclusive reset lines.

Change-Id: Id9ff5e3beadada3aeb5dc8a6085d9bd86255f45c
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 002f17bc54ff4005260d8e6e6700de97f5b25679)

8 years agoUPSTREAM: dwc3: gadget: Implement the suspend entry event handler
Baolin Wang [Mon, 16 May 2016 08:43:53 +0000 (16:43 +0800)]
UPSTREAM: dwc3: gadget: Implement the suspend entry event handler

It had changed to be suspend event for BIT6 in DEVT register from
version 2.30a and above. Thus this patch introduces one suspend
event handler to handle the suspend event.

Change-Id: I62751ee39a2ff13c1359350a8f6c43c14aa4ea12
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 72704f876f50b00f08d41d4b13d5a5d11262254f)

8 years agoUPSTREAM: usb: dwc3: core: cleanup IRQ resources
Roger Quadros [Fri, 10 Jun 2016 11:48:38 +0000 (14:48 +0300)]
UPSTREAM: usb: dwc3: core: cleanup IRQ resources

Implementations might use different IRQs for
host, gadget so use named interrupt resources
to allow device tree to specify the interrupts.

Following are the interrupt names

Peripheral Interrupt - peripheral
HOST Interrupt - host

Maintain backward compatibility for a single named
interrupt ("dwc3_usb3") for all interrupts as well as
unnamed interrupt at index 0 for all interrupts.

As platform_get_irq() variants are used, tackle
the -EPROBE_DEFER case as well.

Change-Id: Idb47d85ceee3353a219e4a9793942c7e92a6a6eb
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
(cherry picked from commit 9522def40065194aa75b0a7b7e1ff5b8e2014724)

Conflicts:
drivers/usb/dwc3/core.c

8 years agoUPSTREAM: usb: dwc3: gadget: Add the suspend state checking when stopping gadget
Baolin Wang [Mon, 20 Jun 2016 08:19:48 +0000 (16:19 +0800)]
UPSTREAM: usb: dwc3: gadget: Add the suspend state checking when stopping gadget

It will be crash to stop gadget when the dwc3 device had been into suspend
state, thus we need to check if the dwc3 device had been into suspend state
when UDC try to stop gadget.

Change-Id: I1a49d4c52131ef4b4357d4a12b5da55e8127d750
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit da1410be21bfedd16740aee6d772e669cf4e852f)

8 years agoUPSTREAM: usb: dwc3: gadget: issue ENDTRANSFER conditional on resource_index
Felipe Balbi [Tue, 21 Jun 2016 07:32:02 +0000 (10:32 +0300)]
UPSTREAM: usb: dwc3: gadget: issue ENDTRANSFER conditional on resource_index

Because of recent changes to transfer handling on
DWC3, we will not get XferComplete unless we
completely fill up our TRB ring. This means that we
might get a Reset or Disconnect without getting a
XferComplete first.

In order to correctly release our allocated Transfer
Resource, we must issue ENDTRANSFER command whenever
dep->resource_index is valid.

Change-Id: I6f78a239e26d754c2472f06789f820d42261d31d
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 0e146028eebf989e86d3fe9385b76434e954c84e)

8 years agoUPSTREAM: usb: dwc3: fix runtime PM in error path
Roger Quadros [Fri, 10 Jun 2016 11:38:02 +0000 (14:38 +0300)]
UPSTREAM: usb: dwc3: fix runtime PM in error path

If there is a failure after pm_runtime_enable/get_sync()
we need to call pm_runtime_disable/put_sync().

Otherwise it will lead to an unbalanced pm_runtime_enable() on the
subsequent probe if the earlier probe bailed out due to -EPROBE_DEFER.

pm_runtime_get_sync() can fail as well so deal with that case too.

Change-Id: Ia8af31867e996eeee4b0a18e34303280b661a86c
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 328082376aea6016b63bca1e5c067a9539f9e8c9)

8 years agoUPSTREAM: usb: dwc3: gadget: simplify run_stop() break condition
Felipe Balbi [Thu, 9 Jun 2016 13:47:05 +0000 (16:47 +0300)]
UPSTREAM: usb: dwc3: gadget: simplify run_stop() break condition

it's clear now that when is_on=true, we must loop
until DWC3_DSTS_DEVCTRLHLT clears; while when
is_on=false we must loop until DWC3_DSTS_DEVCTRLHLT
gets set.

Instead of adding actual if() statements, we can
rely on XOR operation to evaluate to true only when
the above conditions apply. Then, we can move the
break condition back to the while() statement
together with our timeout check and the resulting
code is very compact and simpler to read.

Change-Id: Id540c7422cd1d7e00120c26353d99e2e9888ea26
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit b6d4e16e831376b676edb3463f2bdaa192e5f7be)

8 years agoUPSTREAM: usb: dwc3: gadget: avoid while(1) in run_stop()
Felipe Balbi [Thu, 9 Jun 2016 13:31:34 +0000 (16:31 +0300)]
UPSTREAM: usb: dwc3: gadget: avoid while(1) in run_stop()

instead of looping forever and forcing a return if
timeout reaches zero, we can just use timeout and
loop's break condition directly.

Change-Id: Ibfbe125651d117cab717c5b0b73ef534ced79a67
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit f2df679b6c556fd3b0b7ffafea170f1679086455)

8 years agoUPSTREAM: usb: dwc3: gadget: remove udelay() from run_stop()
Felipe Balbi [Thu, 9 Jun 2016 13:24:08 +0000 (16:24 +0300)]
UPSTREAM: usb: dwc3: gadget: remove udelay() from run_stop()

testing shows that udelay() is unnecessary as
controller reaches Halted state almost
instantenously as can be seen by our timeout
variable never actually decrementing.

Change-Id: I39aa43a4d26c4e5bf7c2c49569bb5ab0c662e718
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit d807bdd02845d53047346a4ba6d8934597fba6d6)

8 years agoUPSTREAM: usb: dwc3: core: fixup dr_mode fallback selection
Felipe Balbi [Tue, 7 Jun 2016 09:55:19 +0000 (12:55 +0300)]
UPSTREAM: usb: dwc3: core: fixup dr_mode fallback selection

We shouldn't change a host-only dwc3 to gadget-only
if driver is built as gadget-only. Fix that up here.

Change-Id: I7ff835a565e1d4d06e142f3fa9990ce96e85556e
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 5f82279a0c76825bfc6f5fa213ff82c932161462)

8 years agoUPSTREAM: usb: dwc3: pci: add dr-mode for Intel dwc3
Felipe Balbi [Tue, 7 Jun 2016 09:49:52 +0000 (12:49 +0300)]
UPSTREAM: usb: dwc3: pci: add dr-mode for Intel dwc3

It's know that Intel's SoCs' dwc3 integration is
peripheral-only since Intel implements its own
portmux for role-swapping. In order to prevent dwc3
from ever registering and XHCI platform_device,
let's just set dr-mode to peripheral-only on Intel
SoCs.

Change-Id: Ic7a57ae89a4ea2a2f04a1aff581d728add15a034
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit e6fe66fe08cdf9c5d0eb6a6e209621f74f7ee60b)

8 years agoUPSTREAM: usb: dwc3: gadget: rename 'ignore' argument to 'modify'
Felipe Balbi [Thu, 2 Jun 2016 09:37:31 +0000 (12:37 +0300)]
UPSTREAM: usb: dwc3: gadget: rename 'ignore' argument to 'modify'

'modify' is what the current action is called. Let's
rename it so it matches databook. While at that,
also make sure to add support 'init' action too.

Change-Id: I9fb3b445a7f8dd6acb369407eddf6d7d0994543d
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 21e64bf20df5e120b37c403b46395d4f0c5d8e86)

8 years agoUPSTREAM: usb: dwc3: gadget: decrement trbs_left for each sg entry
Felipe Balbi [Mon, 30 May 2016 10:42:33 +0000 (13:42 +0300)]
UPSTREAM: usb: dwc3: gadget: decrement trbs_left for each sg entry

If we don't, we will overwrite valid TRBs.

Change-Id: I8076fa857b9ae016617d58836de3d9dcf5be9e4c
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit d6dc2e76a860d6be0129daae43e5f12461531d20)

8 years agoUPSTREAM: usb: dwc3: gadget: start Bulk endpoints more frequently
Felipe Balbi [Mon, 30 May 2016 10:41:22 +0000 (13:41 +0300)]
UPSTREAM: usb: dwc3: gadget: start Bulk endpoints more frequently

Now we can try to issue Update Transfer every time
gadget driver queues a new request. This will make
sure we keep controller's queue busy for as long as
possible.

Change-Id: Id0418f2b4930e442d3bae7be87270100c0b347f5
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit ba62c09d5cc240e55eb39e92d88f1036bb1d9221)

8 years agoUPSTREAM: usb: dwc3: gadget: disable XFER_NOT_READY
Felipe Balbi [Mon, 30 May 2016 10:40:00 +0000 (13:40 +0300)]
UPSTREAM: usb: dwc3: gadget: disable XFER_NOT_READY

We don't need this IRQ anymore for interrupt or bulk
endpoints.

Change-Id: I223ef88f807d7265a00d8d7be480320722d7ef88
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 13fa2e69b1dda31bddb11fe61f250b9415885ead)

8 years agoUPSTREAM: usb: dwc3: gadget: use allocated/queued reqs for LST bit
Felipe Balbi [Mon, 30 May 2016 10:38:32 +0000 (13:38 +0300)]
UPSTREAM: usb: dwc3: gadget: use allocated/queued reqs for LST bit

Let's only set LST bit when we run out of space in
our TRB ring. For all other cases, we keep LST bit
unset which will prevent constant allocation and
deallocation of endpoint transfer resources.

Change-Id: Ia846ea0e3540c151d04488f239eb0f847c85b1fd
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 55a0237f8f47957163125e20ee9260538c5c341c)

8 years agoUPSTREAM: usb: dwc3: gadget: halt and stop based HWO bit
Felipe Balbi [Mon, 30 May 2016 10:37:02 +0000 (13:37 +0300)]
UPSTREAM: usb: dwc3: gadget: halt and stop based HWO bit

Instead of relying on empty list of queued requests,
let's rely on the fact that we have a TRB being
processed right now.

Change-Id: I06075d3aaf695f74946ebd269746a240be7e51c0
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 69450c4dc164d9ecbc0b54cb47a2ec80cde45da4)

8 years agoUPSTREAM: usb: dwc3: gadget: keep track of allocated and queued reqs
Felipe Balbi [Mon, 30 May 2016 10:34:58 +0000 (13:34 +0300)]
UPSTREAM: usb: dwc3: gadget: keep track of allocated and queued reqs

We will be using this information to change how we
figure out when we need LST bit. For now, just
update our counters.

Change-Id: I3c2019ef6649d47b89dbf1c16ef2eed6012442c6
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 68d34c8a744d16ae449577a71c67b19a4b1100d0)

8 years agoUPSTREAM: usb: dwc3: gadget: update transfer needs transfer resource
Felipe Balbi [Mon, 30 May 2016 10:29:35 +0000 (13:29 +0300)]
UPSTREAM: usb: dwc3: gadget: update transfer needs transfer resource

According to SNPS databook, we need to pass transfer
resource on update transfer command, let's do it.

Change-Id: I972007913ca2511f76e565a624721300c9fb754e
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit b6b1c6db4c7f04ffe3fd411baa9df31f4dd355dd)

8 years agoUPSTREAM: usb: dwc3: remove handling of platform data
Heikki Krogerus [Fri, 22 Apr 2016 08:17:40 +0000 (11:17 +0300)]
UPSTREAM: usb: dwc3: remove handling of platform data

No more users for it.

Change-Id: Id887fd18a6f51799c2cc6e10fa47f618fdf24f40
Tested-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
(cherry picked from commit d18e65470a4d9b6f7d7a72a0d102d009b45cf9d4)

Conflicts:
drivers/usb/dwc3/core.c

8 years agoUPSTREAM: usb: dwc3: pci: use build-in properties instead of platform data
Heikki Krogerus [Fri, 22 Apr 2016 08:17:39 +0000 (11:17 +0300)]
UPSTREAM: usb: dwc3: pci: use build-in properties instead of platform data

This should allow the core driver to drop handling of
platform data and expect the platform specific details to
always come from properties.

Change-Id: I99f2aac600b49207982feaeadacd3d9489a85d45
Tested-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Huang Rui <ray.huang@amd.com>
CC: John Youn <John.Youn@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit cf48305de0c6b556ff6af64e93295cc54c4fe246)

8 years agoUPSTREAM: usb: dwc3: remove trailing newline from dwc3_trace
Felipe Balbi [Tue, 24 May 2016 10:45:17 +0000 (13:45 +0300)]
UPSTREAM: usb: dwc3: remove trailing newline from dwc3_trace

when passing strings to trace, we don't need the
trailing newline character. Trace already appends a
newline character automatically.

Change-Id: Ibd8d34a72cf03a41c57768e4c72a02fccf338a4d
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
(cherry picked from commit 60cfb37ac9bc620334fff6e644a2b09019115939)

Conflicts:
drivers/usb/dwc3/gadget.c

8 years agoUPSTREAM: usb: dwc3: omap: Pass VBUS and ID events transparently
Roger Quadros [Wed, 11 May 2016 14:36:45 +0000 (17:36 +0300)]
UPSTREAM: usb: dwc3: omap: Pass VBUS and ID events transparently

Don't make any decisions regarding VBUS session based on ID
status. That is best left to the OTG core.

Pass ID and VBUS events independent of each other so that OTG
core knows exactly what to do.

This makes dual-role with extcon work with OTG irq on OMAP platforms.

Change-Id: I141c03d4127b69530e77cfef3cee5f5b95f6df26
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit d2728fb3e01f9265571a5f7a5feeac4493d2a365)

8 years agoUPSTREAM: usb: dwc3: omap: Don't set POWERPRESENT
Roger Quadros [Wed, 11 May 2016 14:36:44 +0000 (17:36 +0300)]
UPSTREAM: usb: dwc3: omap: Don't set POWERPRESENT

TRM [1] recommends that POWERPRESENT bit must not be
set and left at it's default value of 0.

[1] OMAP542x TRM - http://www.ti.com/lit/pdf/swpu249
Section 23.11.4.5.1 Mailbox VBUS/ID Management

"Because PIPE powerpresent has a different meaning in host and in device mode,
and because of the redundancy with the UTMI signals, the controller ORes
together the appropriate PIPE and UTMI inputs to create its internal
VBUS status. For that reason, it is recommended to leave field
USBOTGSS_UTMI_OTG_STATUS[9] POWERPRESENT at its default value (=0), and only to
fill in the USB2 VBUS status fields in the same register."

Change-Id: Ieaf8450992e8f8ebba75558937610f428fd46bd5
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 9ab330bf4dfd677a19d03359af9bc0e168a2c4b2)

8 years agoUPSTREAM: usb: dwc3: omap: Mark the interrupt handler as shared
Roger Quadros [Wed, 11 May 2016 14:36:43 +0000 (17:36 +0300)]
UPSTREAM: usb: dwc3: omap: Mark the interrupt handler as shared

On OMAPs, OTG events come on the same IRQ so we need to share
this IRQ with the OTG device driver.

Change-Id: I04ad8896bdf7c698ea462cac547bc9fd9f5be423
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 12da8eae208d6f388c3aeecb91955c8b5a468654)

8 years agoUPSTREAM: usb: dwc3: omap: use request_threaded_irq()
Roger Quadros [Wed, 11 May 2016 14:36:42 +0000 (17:36 +0300)]
UPSTREAM: usb: dwc3: omap: use request_threaded_irq()

We intend to share this interrupt with the OTG driver an to ensure
that irqflags match for the shared interrupt handlers we use
request_threaded_irq()

If we don't use request_treaded_irq() then forced threaded irq will
set IRQF_ONESHOT and this won't match with the OTG IRQ handler's
IRQ flags.

NOTE: OTG IRQ handler is yet to be added. This is a preparatory step.

Change-Id: I5b9fee6e7b2b63221abba43878961079c20ffd6f
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 3f586c92d87778bc3d550435a31f8ac685541121)

8 years agoUPSTREAM: usb: dwc3: Fix DWC3_USB31_REVISION_110A definition
John Youn [Fri, 20 May 2016 23:34:23 +0000 (16:34 -0700)]
UPSTREAM: usb: dwc3: Fix DWC3_USB31_REVISION_110A definition

The DWC3_USB31_REVISION_110A macro uses an invalid constant name in its
definition. This is currently not used.

Change-Id: I8e37e8848b423de1a06bdeef7190ba4fb54cb21c
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit e77c561432bccf5ea9df2f49aa039c015529590e)

8 years agoUPSTREAM: usb: dwc3: Use the correct speed macros for DSTS/DCFG
John Youn [Fri, 20 May 2016 23:34:26 +0000 (16:34 -0700)]
UPSTREAM: usb: dwc3: Use the correct speed macros for DSTS/DCFG

Correct the use of the DWC3_DSTS_XXX_SPEED and DWC3_DCFG_XXX_SPEED
macros. The wrong set of macros were being used in a few places.

This is only a cosmetic change as the values for both sets are
identical.

Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
(cherry picked from commit 2da9ad761e70c6a22e3a84f9a3e67faeef122a58)

Conflicts:
drivers/usb/dwc3/gadget.c

Change-Id: I39aed8e30e6f150c2e4d5350caac7b3936ba784d

8 years agoUPSTREAM: usb: dwc3: gadget: Fix truncated cast issue
John Youn [Mon, 23 May 2016 18:32:45 +0000 (11:32 -0700)]
UPSTREAM: usb: dwc3: gadget: Fix truncated cast issue

From sparse:
warning: cast truncates bits from constant value (100 becomes 0)

The DWC3_TRB_NUM constant is too big for u8. Do the calculation a
slightly different way that should still be optimized out for the case
where DWC3_TRB_NUM == 256.

Change-Id: If6f9d66a7545230b0d0f21ab05dacd0f572f10b6
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 3de2685f0c395a56b909dbefd40fb287c9df31b2)

8 years agoUPSTREAM: usb: dwc3: gadget: Handle TRB index 0 when full or empty
John Youn [Fri, 20 May 2016 00:26:17 +0000 (17:26 -0700)]
UPSTREAM: usb: dwc3: gadget: Handle TRB index 0 when full or empty

If the trb->enqueue == trb->dequeue, then it could be full or empty.
This could also happen at TRB index 0, so modify the check to handle
that condition. At index 0, the previous TRB is the one just before the
link TRB.

Change-Id: I17d5fd4e7592507dac08bef6c458ff14d7426461
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 361572b5f7a95b341a92d34b9bf41f71bbdae34d)

8 years agoUPSTREAM: usb: dwc3: gadget: Account for link TRB in TRBs left
John Youn [Fri, 20 May 2016 00:26:15 +0000 (17:26 -0700)]
UPSTREAM: usb: dwc3: gadget: Account for link TRB in TRBs left

The TRBs left calculation didn't account for the link TRB taking up one
spot.

If the trb_dequeue < trb_enqueue, then the result includes the link
TRB slot so it must be adjusted.

Change-Id: If03f89ea1f523b4bce1b5f096ae81aebc891c63f
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 7d0a038b130cde7265d6bbc5e148734cb127f341)

8 years agoUPSTREAM: usb: dwc3: gadget: Account for max size in TRB space
John Youn [Fri, 20 May 2016 00:26:12 +0000 (17:26 -0700)]
UPSTREAM: usb: dwc3: gadget: Account for max size in TRB space

The current calculation takes dep->trb_dequeue - dep->trb_enqueue to
find the TRB space left.

If you enqueue 1, that results in:
(u8) 0 - (u8) 1 = 0xff = 255 TRBs left.

This is correct if DWC3_TRB_NUM == 256.

If DWC3_TRB_NUM is less than 256 (but still a power of 2) you need to
mod the result by DWC3_TRB_NUM.

For example the same calculation with DWC3_TRB_NUM = 8, results in:
255 % 6 = 7 TRBs left.

Change-Id: I2b41bf750e767fc7062a72da054d581c56d42f5a
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 32db3d9437b6bd560daeef82a8325436a4ac3366)

8 years agoUPSTREAM: usb: dwc3: gadget: Don't prepare TRBs if no space
John Youn [Fri, 20 May 2016 00:26:10 +0000 (17:26 -0700)]
UPSTREAM: usb: dwc3: gadget: Don't prepare TRBs if no space

If trbs_left == 0, we don't have any space left in the TRB ring so don't
prepare anything.

Change-Id: I1dc6c665b778a7988fca9cd890884ad27dc830ef
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 89bc856e5a7462e47d90d5a3f5396bd5795efd0c)

8 years agoUPSTREAM: usb: dwc3: gadget: Initialize the TRB ring
John Youn [Fri, 20 May 2016 00:26:08 +0000 (17:26 -0700)]
UPSTREAM: usb: dwc3: gadget: Initialize the TRB ring

Clears out all the TRBs in the ring to clean up any stale data that
might be in them from the previous time the endpoint was enabled.

Also removed the existing clear of the LINK trb since the entire ring is
cleard just before.

Change-Id: I311d0931dc9daa6b6f6e39d252e54c37c516c190
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 0d25744ad107b6c9010153f3ebf8b59672b5b8e7)

8 years agoUPSTREAM: usb: dwc3: gadget: Simplify skipping of link TRBs
John Youn [Fri, 20 May 2016 00:26:05 +0000 (17:26 -0700)]
UPSTREAM: usb: dwc3: gadget: Simplify skipping of link TRBs

Make the skipping of the link TRBS built-in to the increment operation.
This simplifies the code wherever we increment the trb index and ensures
that we never end up pointing to a link trb.

Change-Id: I72063fcf672a07c3ac5132c488e75df1a6d91e94
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit dca0119c3ab69fea2429ec2db7e3686614bd1439)

8 years agoUPSTREAM: usb: dwc3: Endianness issue on dwc3_log_ctrl
John Youn [Mon, 23 May 2016 18:32:47 +0000 (11:32 -0700)]
UPSTREAM: usb: dwc3: Endianness issue on dwc3_log_ctrl

Sparse complains even though it looks ok. Probably it cannot detect that
the wValue, wIndex, and wLength are declared __le16 due to the macro
magic.

Redeclare them as CPU endianness and make the conversion on assignment.

Change-Id: I9682aa96ba8e1115c02f5df54d51fccdcb0ed4e1
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 96bedb637a1e1ad8e7ed781fa020550aae2a8f16)

8 years agoUPSTREAM: usb: dwc3: gadget: Fix usage of bitwise operator
John Youn [Mon, 23 May 2016 18:32:43 +0000 (11:32 -0700)]
UPSTREAM: usb: dwc3: gadget: Fix usage of bitwise operator

Cleans up the sparse warning:
warning: dubious: x | !y

Since we do want a bitwise OR here, don't use a logical (true/false)
value. Probably is not a real issue but it cleans up the warning.

Change-Id: I741c66da3f31a26402334bf5edfd9f969580b64b
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit d07fa665c79d85fead080f4b611c3f7645576454)

8 years agoUPSTREAM: usb: dwc3: ep0: Use the correct type for SET_SEL data
John Youn [Mon, 23 May 2016 18:32:40 +0000 (11:32 -0700)]
UPSTREAM: usb: dwc3: ep0: Use the correct type for SET_SEL data

u2sel and u2pel should be __le16. Doesn't fix any issue.

Found with sparse.

Change-Id: Ibe09f6e4c938246afa664bb511c8b912216f2671
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 501058edebf957a3c101c8119c3286e496873840)

8 years agoUPSTREAM: usb: dwc3: ep0: Fix endianness of wIndex passed to dwc3_wIndex_to_dep
John Youn [Mon, 23 May 2016 18:32:38 +0000 (11:32 -0700)]
UPSTREAM: usb: dwc3: ep0: Fix endianness of wIndex passed to dwc3_wIndex_to_dep

The wIndex passed in here is CPU endianness, but the function expects
little endian.

Found with sparse.

Change-Id: Ib33f0b9b4e8c3320eb590496460e2cc7274b6a0e
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 958b9fa7f8cfd5799534e98ba3d05d96a5e7ccb9)

8 years agoUPSTREAM: usb: dwc3: gadget: improve gcmd trace
Felipe Balbi [Mon, 23 May 2016 11:16:19 +0000 (14:16 +0300)]
UPSTREAM: usb: dwc3: gadget: improve gcmd trace

Just like we did for endpoint commands, let's have a
single trace output for the command and its
status. This will improve trace readability

Change-Id: I2d092268347a92d1b6987c4283580a63ed4cfda9
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 71f7e7027028d5a8ef15dccc587dbd6c6b7f544f)

8 years agoUPSTREAM: usb: dwc3: gadget: remove udelay() from generic cmd
Felipe Balbi [Mon, 23 May 2016 11:08:47 +0000 (14:08 +0300)]
UPSTREAM: usb: dwc3: gadget: remove udelay() from generic cmd

We want commands to finish ASAP, so let's remove
that udelay() call.

Change-Id: I521945dc6242cfe1a8cf730ab2f7d9010a1e65a9
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 88811f7b722c417ececbc7f278c26d8df8606d02)

8 years agoUPSTREAM: usb: dwc3: gadget: single return point on generic commands
Felipe Balbi [Mon, 23 May 2016 11:06:07 +0000 (14:06 +0300)]
UPSTREAM: usb: dwc3: gadget: single return point on generic commands

Just like we did for endpoint commands, let's use a
single return point for generic commands as
well. This aids readability.

Change-Id: Idc1bf9bc4fe2e50cb0841e9a8483c24346b4974d
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 0fe886cdb07aeaf75a61154f34abc8dd6860978e)

8 years agoUPSTREAM: usb: dwc3: trace: print ep cmd status with a single trace
Felipe Balbi [Mon, 23 May 2016 11:02:33 +0000 (14:02 +0300)]
UPSTREAM: usb: dwc3: trace: print ep cmd status with a single trace

Instead of printing command's status with a separate
trace printout, let's print it within a single call.

Change-Id: I6ea888e0b8c7afee70b90f748a9d20c469da8c04
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 0933df159c5c82f97c6bb811b149fa1158a26087)

8 years agoUPSTREAM: usb: dwc3: gadget: loop while (timeout)
Felipe Balbi [Mon, 23 May 2016 10:53:34 +0000 (13:53 +0300)]
UPSTREAM: usb: dwc3: gadget: loop while (timeout)

instead of having infinite loop and always checking
timeout value as a break condition, we can just
decrement timeout inside while's condition.

Change-Id: I665d39e7205463f5f4439f3a6d4fdfc6e3ed67b2
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit f6bb225bb3ca7988ff373c62cc298e56cae1eee5)

8 years agoUPSTREAM: usb: dwc3: gadget: fix trace output when command fails
Felipe Balbi [Mon, 23 May 2016 10:50:29 +0000 (13:50 +0300)]
UPSTREAM: usb: dwc3: gadget: fix trace output when command fails

We don't need the extra %s when command fails.
Let's remove it

Change-Id: I4cbad651f7b386ceb24f077a4c3f2036cd619ee9
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit ba1598410eff646e10be4e42d773e5bdc511d898)

8 years agoUPSTREAM: usb: dwc3: trace: fully decode IRQ events
Felipe Balbi [Mon, 23 May 2016 08:10:08 +0000 (11:10 +0300)]
UPSTREAM: usb: dwc3: trace: fully decode IRQ events

This will make it more human-friendly to read trace
output from dwc3.

Change-Id: I484b309a164c069fa06c45330ece4bded3150e65
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit f75cacc468edc4826305909d6102d60fba55199f)

8 years agoUPSTREAM: usb: dwc3: gadget: no more tracking endpoint type with its name
Felipe Balbi [Mon, 23 May 2016 08:27:26 +0000 (11:27 +0300)]
UPSTREAM: usb: dwc3: gadget: no more tracking endpoint type with its name

I really thought this would be useful, but as it
turns out, it creates more problems than fixes. The
amount of times we had to fix this because some
other commit shuffled things around and ended up
regressing this tiny little string manupulation...

Might as well remove it, since it has a negligible
added benefit.

Change-Id: I6b64399df59313f6572df7dfd93c35e2894377b5
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 7ab373aadbd0463c0f020d368947b05e67a20bd5)

8 years agoUPSTREAM: usb: dwc3: trace: pretty-print TRB's ctrl field
Janusz Dziedzic [Fri, 20 May 2016 08:37:13 +0000 (10:37 +0200)]
UPSTREAM: usb: dwc3: trace: pretty-print TRB's ctrl field

Improve trb tracing by showing trb flags, interrupts
trb type.

trb flags:
- h - hardware owner of descriptor
- l - last TRB
- c - chain buffers
- s - continue on short packet

interrupt flags:
- s - interrupt on short packet
- c - interrupt on complete

Capital letter means that bit is set, while
lowercase letter means bit is cleared.

Change-Id: I1f709f56a2fcc707858805289cb66fbace718abb
Signed-off-by: Janusz Dziedzic <januszx.dziedzic@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 22f2c619a116f120fe57de1225cfe7fdeb0b12d2)

8 years agoUPSTREAM: usb: dwc3: gadget: add a per-endpoint request queue lock
Felipe Balbi [Wed, 13 Apr 2016 13:44:39 +0000 (16:44 +0300)]
UPSTREAM: usb: dwc3: gadget: add a per-endpoint request queue lock

This will allow us to process several endpoints at a
time by making sure that we lock only shared
resources.

Change-Id: I87b6ffd1db1fbbdaeed30271b984918b5e0d9b6c
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 74674cbf858ff6a83c3f06f4ab0ffa5d3c91bf0b)

8 years agoUPSTREAM: usb: dwc3: pci: add Power Management dummy hooks
Felipe Balbi [Tue, 17 May 2016 07:15:02 +0000 (10:15 +0300)]
UPSTREAM: usb: dwc3: pci: add Power Management dummy hooks

Allow for dwc3-pci to reach D3 and enable pm_runtime
by providing dummy PM hooks. Without them, PCI
subsystem won't put device to D3.

Change-Id: Id104274d9c25bbbee73fc3d82e416a236485b33b
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit e9af9229098d92145d0b894b78878bbc6ac7c910)

8 years agoUPSTREAM: usb: dwc3: implement runtime PM
Felipe Balbi [Mon, 16 May 2016 10:14:48 +0000 (13:14 +0300)]
UPSTREAM: usb: dwc3: implement runtime PM

this patch implements the most basic pm_runtime
support for dwc3. Whenever USB cable is dettached,
then we will allow core to runtime_suspend.

Runtime suspending will involve completely tearing
down event buffers and require a full soft-reset of
the IP.

Note that a further optimization could be
implemented once we decide to support hibernation,
which is to allow runtime_suspend with cable
connected when bus is in U3. That's subject to a
separate patch, however.

Change-Id: I2ff3ca0424151eb15066ccc3a6d8e46e7dc9ec4e
Tested-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit fc8bb91bc83ef82868533e75f5a11abc1158ec81)

8 years agoUPSTREAM: usb: dwc3: gadget: fix for possible endpoint disable race
Felipe Balbi [Wed, 18 May 2016 09:37:21 +0000 (12:37 +0300)]
UPSTREAM: usb: dwc3: gadget: fix for possible endpoint disable race

when we call dwc3_gadget_giveback(), we end up
releasing our controller's lock. Another thread
could get scheduled and disable the endpoint,
subsequently setting dep->endpoint.desc to NULL.

In that case, we would end up dereferencing a NULL
pointer which would result in a Kernel Oops. Let's
avoid the problem by simply returning early if we
have a NULL descriptor.

Change-Id: Ib2ee62e6e93ad47385f2a2d57191cbe32c720110
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 4cb4221764ef473cd36e1953f1fea11865786d65)

8 years agoUPSTREAM: usb: dwc3: fix for the isoc transfer EP_BUSY flag
Konrad Leszczynski [Mon, 8 Feb 2016 15:13:12 +0000 (16:13 +0100)]
UPSTREAM: usb: dwc3: fix for the isoc transfer EP_BUSY flag

commit f3af36511e60 ("usb: dwc3: gadget: always
enable IOC on bulk/interrupt transfers") ended up
regressing Isochronous endpoints by clearing
DWC3_EP_BUSY flag too early, which resulted in
choppy audio playback over USB.

Fix that by partially reverting original commit and
making sure that we check for isochronous endpoints.

Change-Id: If2b5897f005bc5f6a4f475e8371c2654ac04a44a
Fixes: f3af36511e60 ("usb: dwc3: gadget: always enable IOC
on bulk/interrupt transfers")
Cc: <stable@vger.kernel.org>
Signed-off-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 9cad39fe4e4a4fe95d8ea5a7b0692b0a6e89e38b)

8 years agoUPSTREAM: usb: dwc3: gadget: only resume USB2 PHY in <=HIGHSPEED
Felipe Balbi [Tue, 17 May 2016 11:55:58 +0000 (14:55 +0300)]
UPSTREAM: usb: dwc3: gadget: only resume USB2 PHY in <=HIGHSPEED

As a micro-power optimization, let's only resume the
USB2 PHY if we're working on <=HIGHSPEED. If we're
gonna work on SUPERSPEED or SUPERSPEED+, there's no
point in resuming the USB2 PHY.

Change-Id: I2661fcde935c6b20afbd54f7a9f74e1ebde2a0d0
Fixes: 2b0f11df84bb ("usb: dwc3: gadget: clear SUSPHY bit before ep cmds")
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit ab2a92e7a608c09f13baf1730b9ba24c73c35d52)

8 years agoUPSTREAM: usb: dwc3: gadget: hold gadget IRQ in dwc->irq_gadget
Felipe Balbi [Mon, 16 May 2016 11:17:06 +0000 (14:17 +0300)]
UPSTREAM: usb: dwc3: gadget: hold gadget IRQ in dwc->irq_gadget

by holding gadget's IRQ number in dwc->irq_gadget,
it'll be simpler to free_irq() and disable the IRQ
in case an IRQ fires while we are runtime suspended.

Change-Id: I17ed4486bfcc1cd9fabb11fccb802e3a80d61501
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 3f308d17d7abbf35a6d40a7f16dc70cf43f12c98)

8 years agoUPSTREAM: usb: dwc3: core: simplify suspend/resume operations
Felipe Balbi [Mon, 16 May 2016 07:52:58 +0000 (10:52 +0300)]
UPSTREAM: usb: dwc3: core: simplify suspend/resume operations

now that we have re-factored dwc3_core_init() and
dwc3_core_exit() we can use them for suspend/resume
operations.

This will help us avoid some common mistakes when
patching code when we have duplicated pieces of code
doing the same thing.

Change-Id: I295c3b354123ce0449e7e4ee10e96fa444994488
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 51f5d49ad6f011ee380b866ea617fd90584189a2)

8 years agoUPSTREAM: usb: dwc3: core: re-factor init and exit paths
Felipe Balbi [Mon, 16 May 2016 07:49:01 +0000 (10:49 +0300)]
UPSTREAM: usb: dwc3: core: re-factor init and exit paths

The idea of this patch is for dwc3_core_init() to
abstract all the details about how to initialize
dwc3 and dwc3_core_exit() to do the same for
teardown.

With this, we can simplify suspend/resume operations
by a large margin and always know that we're going
to start dwc3 from a known starting point.

Change-Id: I3193f375fa153e1636de8f86fb752ef88afa5d95
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
(cherry picked from commit c499ff71ff2a281366c6ec7a904c547d806cbcd1)

Conflicts:
drivers/usb/dwc3/core.c

8 years agoUPSTREAM: usb: dwc3: core: move fladj to dwc3 structure
Felipe Balbi [Mon, 16 May 2016 07:42:23 +0000 (10:42 +0300)]
UPSTREAM: usb: dwc3: core: move fladj to dwc3 structure

this patch is in preparation for some further
re-factoring in dwc3 initialization. No functional
changes.

Change-Id: I19eaeca8e94616a98fe92696b05aa43d819a1d93
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit bcdb3272e889f4d2a5c8efc5e12b0fb2dcbf75e9)

8 years agoUPSTREAM: usb: dwc3: gadget: add a pointer to endpoint registers
Felipe Balbi [Tue, 12 Apr 2016 13:53:39 +0000 (16:53 +0300)]
UPSTREAM: usb: dwc3: gadget: add a pointer to endpoint registers

By adding a pointer to endpoint registers' base
address, we can avoid using our controller-wide
struct dwc3 pointer for everything. At some point
this will allow us to have per-endpoint locks which
will, in turn, let us queue requests to separate
endpoints in parallel.

Because of this change our debugfs interface and io
accessors need to be changed accordingly.

Change-Id: I51229661378e4756f89770e9a813a132b822631c
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 2eb8801650b315394ca376a56be2971c867aa9ec)

8 years agoUPSTREAM: usb: dwc3: gadget: pass dep as argument to endpoint command
Felipe Balbi [Tue, 12 Apr 2016 13:42:43 +0000 (16:42 +0300)]
UPSTREAM: usb: dwc3: gadget: pass dep as argument to endpoint command

In all call sites of dwc3_send_gadget_ep_cmd() we
already had a valid dep pointer, so instead of
passing dwc and dep->number, which would be used to
fetch the same pointer we already had, just pass dep
directly.

In other words, we're changing:

struct dwc3_ep *dep = dwc[dep->number];

to just passing struct dwc3_ep *dep as argument.

Change-Id: I2e4bd7e30f1814db1dea9521b3b083707595e864
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 2cd4718d0bbe1906fcf517f0b254fbd7c072383a)

8 years agoUPSTREAM: usb: dwc3: gadget: initialize NUMP based on RxFIFO Size
Felipe Balbi [Fri, 13 May 2016 11:09:59 +0000 (14:09 +0300)]
UPSTREAM: usb: dwc3: gadget: initialize NUMP based on RxFIFO Size

Instead of using burst size to configure NUMP, we
should be using RxFIFO Size instead. DWC3 is smart
enough to know that it shouldn't burst in case burst
size is 0.

Change-Id: I03b0290e19ed204047ff35fdf7383f57bf3566df
Reported-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 4e99472bc10bda9906526d725ff6d5f27b4ddca1)

8 years agoUPSTREAM: usb: dwc3: gadget: split __dwc3_gadget_kick_transfer()
Felipe Balbi [Fri, 13 May 2016 09:42:44 +0000 (12:42 +0300)]
UPSTREAM: usb: dwc3: gadget: split __dwc3_gadget_kick_transfer()

To aid code readability, we're gonna split
__dwc3_gadget_kick_transfer() into its constituent
parts: scatter gather and linear buffers.

That way, it's easier to follow the code and focus
debug effort when one or the other fails.

Change-Id: I5116b050ab757a177df9e4fe40996b215f6eb2e0
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 5ee85d890f8de5c6f1ab22ba13734a63fdf3ff2d)

8 years agoUPSTREAM: usb: dwc3: gadget: return 0 if we try to Wakeup in superspeed
Felipe Balbi [Fri, 13 May 2016 07:19:42 +0000 (10:19 +0300)]
UPSTREAM: usb: dwc3: gadget: return 0 if we try to Wakeup in superspeed

Instead of returning -EINVAL when someone calls
__dwc3_gadget_wakeup() in speeds > highspeed, let's
return 0. There are no problems for the driver for
calling it in superspeed as we cleanly just return.

This avoids an annoying WARN_ONCE() always
triggering during superspeed enumeration with LPM
enabled.

Change-Id: Iff35ee46a782684db1c2339ad71a73a303cb3a89
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 6b74289937f624439c87135cfabb3deb2955fb53)

8 years agoUPSTREAM: usb: dwc3: gadget: remove udelay(1) when sending ep cmds
Felipe Balbi [Fri, 13 May 2016 07:11:59 +0000 (10:11 +0300)]
UPSTREAM: usb: dwc3: gadget: remove udelay(1) when sending ep cmds

When we send an endpoint command, we want that to
complete as soon as possible, so let's remove the
unnecessary udelay(1) call.

Change-Id: I601a8a4c80aa5abd6ccf68f2169f38a08ef3bc5f
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit b43bba96b9036e42b2c2c71ee15e1f77b0b37aec)

8 years agoUPSTREAM: usb: dwc3: gadget: rely on sg_is_last() and list_is_last()
Felipe Balbi [Fri, 13 May 2016 07:07:47 +0000 (10:07 +0300)]
UPSTREAM: usb: dwc3: gadget: rely on sg_is_last() and list_is_last()

sg_is_last() and list_is_last() will encode the
required information for the driver to make
decisions WRT CHN and LST bits.

While at that, also replace '1' with 'true' for
consistency.

Change-Id: I827e39df3058f696d753e03130a951017ed45bf5
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 6aff483295950abcf3be1a99f56f308bd6a1bab4)

8 years agoUPSTREAM: usb: dwc3: gadget: simplify __dwc3_gadget_kick_transfer()
Felipe Balbi [Thu, 12 May 2016 13:53:59 +0000 (16:53 +0300)]
UPSTREAM: usb: dwc3: gadget: simplify __dwc3_gadget_kick_transfer()

as it turns out, we don't need the extra 'start_new'
argument as that can be inferred from DWC3_EP_BUSY
flag.

Because of that, we can simplify
__dwc3_gadget_kick_transfer() by quite a bit, even
allowing us to prepare more TRBs unconditionally.

Change-Id: I74346bf9ec48e7cd7d59bb890e40a9395fb27962
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 4fae2e3e15157ac312b91234389e79f7a76667b3)

8 years agoUPSTREAM: usb: dwc3: gadget: prepare TRBs on update transfers too
Felipe Balbi [Thu, 12 May 2016 11:08:34 +0000 (14:08 +0300)]
UPSTREAM: usb: dwc3: gadget: prepare TRBs on update transfers too

If we're updating transfers, we can also prepare as
many TRBs as we can fit in the ring. Let's start
doing that.

This patch 'solves' a limitation of how many TRBs we
can prepare when we're getting close the end of the
ring. Instead driver to prepare only up to end of
the ring, we check if we have space to wrap around
the ring properly.

Note that this only happens when our enqueue and
dequeue pointers are equal (which is the case for
bulk endpoints after an XferComplete event).

Change-Id: I3a3614061234f2408b39bd3bc235bb2bf5289dff
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit c4233573f6ee611033faa9116fc7003775a450b9)

8 years agoUPSTREAM: usb: dwc3: core: get rid of DWC3_PM_OPS macro
Felipe Balbi [Mon, 9 May 2016 12:27:01 +0000 (15:27 +0300)]
UPSTREAM: usb: dwc3: core: get rid of DWC3_PM_OPS macro

that macro is unnecessary and just adds pointless
obfuscation. Let's remove it.

Change-Id: I67e73c5a6c6155fc66c1ac05047173c0e783b205
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 7f370ed0cfe9aa1520696c1c71e8a51e2c0bbcc1)

8 years agoUPSTREAM: usb: dwc3: gadget: fix gadget suspend/resume
Felipe Balbi [Wed, 4 May 2016 12:50:27 +0000 (15:50 +0300)]
UPSTREAM: usb: dwc3: gadget: fix gadget suspend/resume

Instead of trying hard to stay connected to the
host, it's best (and far easier) to disconnect from
the host already.

Anything relying on KEEP_CONNECT will just have that
ignored, but we don't have proper hibernation
implementation yet, so there are no regressions.

In any case, hibernation is only useful for runtime
PM, not system sleep.

While at that, also remove dwc3.dcfg which has been
rendered unnecessary.

Change-Id: I605a452a416b3a2e2b98b6b6505ecc545846d5dd
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 9f8a67b65a49d0e35c6ca782136c84541d948a64)

8 years agoUPSTREAM: usb: dwc3: gadget: re-factor ->udc_start and ->udc_stop
Felipe Balbi [Wed, 4 May 2016 12:49:37 +0000 (15:49 +0300)]
UPSTREAM: usb: dwc3: gadget: re-factor ->udc_start and ->udc_stop

we will be re-using it for suspend/resume, so
instead of duplicating code, let's just re-factor
the functions so they can be re-used.

Change-Id: I4db5569156adb27e2fc2d8b28b85a9b9e6f2116a
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit d7be295243bbe53649986d869b398403eaa41bb7)

8 years agoUPSTREAM: usb: dwc3: Set the ClearPendIN bit on Clear Stall EP command
John Youn [Wed, 1 Jun 2016 00:49:56 +0000 (17:49 -0700)]
UPSTREAM: usb: dwc3: Set the ClearPendIN bit on Clear Stall EP command

As of core revision 2.60a the recommended programming model is to set
the ClearPendIN bit when issuing a Clear Stall EP command for IN
endpoints. This is to prevent an issue where some (non-compliant) hosts
may not send ACK TPs for pending IN transfers due to a mishandled error
condition. Synopsys STAR 9000614252.

Change-Id: Ic513ca50aa900fbfc64b8197a6311113630ce18a
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 50c763f8c1bac0dc00f7788a75f227276c0efd54)

8 years agoUPSTREAM: usb: dwc3: st: Fix USB_DR_MODE_PERIPHERAL configuration.
Peter Griffin [Wed, 11 May 2016 16:33:11 +0000 (17:33 +0100)]
UPSTREAM: usb: dwc3: st: Fix USB_DR_MODE_PERIPHERAL configuration.

Set USB3_FORCE_VBUSVALID when configured for USB_DR_MODE_PERIPHERAL
mode, as it is required to have a working setup.

This worked on the internal driver by relying on the reset
value of the syscfg register as the bits aren't explicity cleared
and set like the upstream driver.

Also add a comment about what setting this bit means.

Change-Id: Ibd3a18b3a85b53dcf8471a1231b502185641c010
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 27a0faafdca53bda21ed340ca8f8960696dda049)

8 years agoUPSTREAM: usb: dwc3: gadget: fix mask and shift order in DWC3_DCFG_NUMP()
Dan Carpenter [Tue, 3 May 2016 07:49:00 +0000 (10:49 +0300)]
UPSTREAM: usb: dwc3: gadget: fix mask and shift order in DWC3_DCFG_NUMP()

In the original DWC3_DCFG_NUMP() was always zero.  It looks like the
intent was to shift first and then do the mask.

Change-Id: I290fe7bb82bbf7adf626fcb5ee2474fce60167bd
Fixes: 2a58f9c12bb3 ('usb: dwc3: gadget: disable automatic calculation of ACK TP NUMP')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 973986126a4152ab83d09263a02bf7d2d1bf3b6e)

8 years agoUPSTREAM: usb: dwc3: gadget: disable automatic calculation of ACK TP NUMP
Felipe Balbi [Thu, 28 Apr 2016 07:56:28 +0000 (10:56 +0300)]
UPSTREAM: usb: dwc3: gadget: disable automatic calculation of ACK TP NUMP

Now that we calculate DCFG.NUMP, we can disable
dwc3's automatic calculation so we maximize our
chances of very high throughtput through the use of
bursts.

Change-Id: Icf53af4cd1fc7a9fed1731dbef3ba3abbaa68783
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 2a58f9c12bb360f38fb39e470bb5ff94014356e6)

8 years agoUPSTREAM: usb: dwc3: gadget: update DCFG.NumP to max burst size
Felipe Balbi [Tue, 26 Apr 2016 07:49:07 +0000 (10:49 +0300)]
UPSTREAM: usb: dwc3: gadget: update DCFG.NumP to max burst size

NumP field of DCFG register is used on NumP field of
ACK TP header and it tells the host how many packets
an endpoint can receive before waiting for
synchronization.

Documentation says it should be set to anything
<=bMaxBurst. Interestingly, however, this setting is
not per-endpoint how it should be (different
endpoints could have different burst sizes), but
things seem to work okay right now.

Change-Id: I2fd8e68f88b15e64fc06770ffdc6376fcb4cff62
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
(cherry picked from commit 676e3497448177bdb1934cbc4402f921730a5864)

Conflicts:
drivers/usb/dwc3/gadget.c

8 years agoUPSTREAM: usb: dwc3: gadget: give better command return code
Konrad Leszczynski [Fri, 12 Feb 2016 15:21:46 +0000 (15:21 +0000)]
UPSTREAM: usb: dwc3: gadget: give better command return code

if Start Transfer command fails, let's try a little
harder to figure out why the command failed and give
slightly better return codes. This will be usefulf
or isochronous endpoints, at least, which could
decide to retry a given request.

Change-Id: Id3ce609ba9149235dc8c9203798dc19cb2fae4bd
Signed-off-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 7b9cc7a2b101cc73f6abe3468441381c98817e54)

8 years agoUPSTREAM: usb: dwc3: pci: pass the platform device as a parameter to dwc3_pci_quirks()
Heikki Krogerus [Fri, 22 Apr 2016 08:17:38 +0000 (11:17 +0300)]
UPSTREAM: usb: dwc3: pci: pass the platform device as a parameter to dwc3_pci_quirks()

For convenience, passing the dwc3 platform device as a
parameter to dwc3_pci_quirks() function.

Change-Id: Ibe81e416772780cf98c8606e84e9fbd558d88d52
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit ce046d323d74ee9d280688a2cb499716f555a89f)

8 years agoUPSTREAM: usb: dwc3: pci: make build-in device properties available
Heikki Krogerus [Fri, 22 Apr 2016 08:17:37 +0000 (11:17 +0300)]
UPSTREAM: usb: dwc3: pci: make build-in device properties available

Setting the ACPI companion before calling dwc3_pci_quirks.
The ACPI companion will be set unconditionally as the
primary fwnode, overriding any previously set primary
fwnode. This will make sure that any build-in properties
added to the platform device will be added as the secondary
fwnode in cases where also ACPI companion exists.

Change-Id: Ib1a5ff15cc644f8c42e6dccf7c5cf0368857e9c8
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 474799f073763b868e158b04b74f8ddd1da38da2)

8 years agoUPSTREAM: usb: dwc3: ep0: sanity check test mode selector
Fei Yang [Wed, 20 Apr 2016 06:08:43 +0000 (09:08 +0300)]
UPSTREAM: usb: dwc3: ep0: sanity check test mode selector

In case host sends us an unsupported test mode, we
*must* stall this request. This will tell the host
that the selector is invalid and we won't put the
controller in unsupported test modes which could
have undetermined side-effects.

Change-Id: Iaf6a0ae78864efa342a514fdd5e6fc7f2e94e314
Signed-off-by: Fei Yang <fei.yang@intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit ae411413760785a0a2ce6cb44d5afe95115aa24d)

8 years agoUPSTREAM: usb: dwc3: debugfs: dump out endpoint details
Felipe Balbi [Thu, 14 Apr 2016 11:53:44 +0000 (14:53 +0300)]
UPSTREAM: usb: dwc3: debugfs: dump out endpoint details

There's a bunch of information in the debug register
set from dwc3 which is useful in some debugging
scenarios. Let's dump them out in endpoint-specific
directories and designated files.

Change-Id: I8e29084ee8edb426e3ccf501c1c895022d4c1bcd
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 818ec3aba883f58225c9f5a2318cf373263869ed)

8 years agoUPSTREAM: usb: dwc3: core: add helper to extract trb type
Felipe Balbi [Thu, 14 Apr 2016 13:05:54 +0000 (16:05 +0300)]
UPSTREAM: usb: dwc3: core: add helper to extract trb type

This helper will be used later to convert trb type
into a human-readable string for debugfs.

Change-Id: I00ef9c5270465765bf0e03209172359f32368527
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit b058f3e8a3991ba3ea3504fea1faf81974cf17fa)

8 years agoUPSTREAM: usb: dwc3: core: add fifo space helper
Felipe Balbi [Thu, 14 Apr 2016 12:03:39 +0000 (15:03 +0300)]
UPSTREAM: usb: dwc3: core: add fifo space helper

this helper will be used, initially, to dump space
of different queues and fifos in dwc3 to
debugfs. Later, it'll be used to issue remote wakeup
when we want to start a transfer and there's
something in a TX FIFO.

Change-Id: I4ebd7a0c0df1757fbfdb561eab84617710e0a580
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit cf6d867d3b57d4eca229b3c506216d98d88be49c)

8 years agoUPSTREAM: usb: dwc3: make dwc3_debugfs_init return value be void
Du, Changbin [Tue, 12 Apr 2016 11:10:18 +0000 (19:10 +0800)]
UPSTREAM: usb: dwc3: make dwc3_debugfs_init return value be void

Debugfs init failure is not so important. We can continue our job on
this failure. Also no break need for debugfs_create_file call failure.

Signed-off-by: Du, Changbin <changbin.du@intel.com>
[felipe.balbi@linux.intel.com :
- remove out-of-memory message, we get that from OOM.
- switch dev_err() to dev_dbg() ]

Change-Id: I73e5345b64c20e327d0b941e256c518e5c2b195e
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
(cherry picked from commit 4e9f311833a946e984c82086b21b128918f4a6a4)

Conflicts:
drivers/usb/dwc3/debugfs.c

8 years agoUPSTREAM: usb: dwc3: omap: get rid of dma_status
Roger Quadros [Mon, 11 Apr 2016 14:18:25 +0000 (17:18 +0300)]
UPSTREAM: usb: dwc3: omap: get rid of dma_status

dma_status bit flag is set but never really used
so get rid of it.

Change-Id: If11b9522e8592dbeebf1e5d8e9a1eaad43d65f7d
Reported-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit af566a0be6e49b946708532a6a7a7ae29ab83aed)

8 years agoUPSTREAM: usb: dwc3: gadget: don't interrupt when chained
Felipe Balbi [Wed, 6 Apr 2016 07:01:14 +0000 (10:01 +0300)]
UPSTREAM: usb: dwc3: gadget: don't interrupt when chained

It makes no sense to interrupt in the middle of
chained transfer. This patch just makes sure we
don't do that.

Change-Id: Ic90f7482b1f4367532199155c51fb790c3566cdc
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 8e7046b71daeb6dfbf8c6eaa164e55d4e1dcb5c8)

8 years agoUPSTREAM: usb: dwc3: gadget: remove newline from trace
Felipe Balbi [Tue, 5 Apr 2016 12:05:05 +0000 (15:05 +0300)]
UPSTREAM: usb: dwc3: gadget: remove newline from trace

trace already adds a newline character for us, we
don't need to do it ourselves.

Change-Id: I1cf87e312e9f7f89916911f347fe1b4b93681c19
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 052ba52efa1717651d303a9b88f2e8cbb91702c6)

8 years agoUPSTREAM: usb: dwc3: gadget: use link TRB for all endpoint types
Felipe Balbi [Tue, 5 Apr 2016 10:24:36 +0000 (13:24 +0300)]
UPSTREAM: usb: dwc3: gadget: use link TRB for all endpoint types

instead of limiting link TRB only to Isoc endpoints,
let's use it for all endpoint types, this way we are
more likely to transfer more data before a
XferComplete event.

Change-Id: Id0e34e43bd1cecf59addcfcfca8e58f727a4a8fa
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 36b68aae8e39ad456eec1ec2073eee388cbcc106)

8 years agoUPSTREAM: usb: dwc3: gadget: move % operation to increment helpers
Felipe Balbi [Tue, 5 Apr 2016 10:14:31 +0000 (13:14 +0300)]
UPSTREAM: usb: dwc3: gadget: move % operation to increment helpers

By moving our % DWC3_NUM_TRB operation to the
increment helpers, the rest of the driver can be
simplified.

It's also a good practice to make sure we will have
a single place dealing with details about how to
increment our enqueue and dequeue pointers.

Change-Id: I4a218a52f6d7c8c2797c64772e25dc734fc6c861
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 4faf75504a7db790483aa419d8f61e58cec4934c)

8 years agoUPSTREAM: usb: dwc3: gadget: add trb enqueue/dequeue helpers
Felipe Balbi [Tue, 5 Apr 2016 10:09:51 +0000 (13:09 +0300)]
UPSTREAM: usb: dwc3: gadget: add trb enqueue/dequeue helpers

Add three little helpers which will aid in making
the code slightly easier to read. One helper
increments enqueue pointer, another increments
dequeue pointer and the last one tests if we're
dealing with the last TRB.

Change-Id: I98da6b44c0a348978f5e03a374af5b951bb2adc5
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit ef966b9d33533b0bf01fb8c4d586ac3b20a3bdb5)

8 years agoUPSTREAM: usb: dwc3: get rid of DWC3_TRB_MASK
Felipe Balbi [Tue, 5 Apr 2016 09:47:15 +0000 (12:47 +0300)]
UPSTREAM: usb: dwc3: get rid of DWC3_TRB_MASK

instead of using a bitwise and, let's rely on the %
operator since that's a lot more clear. Also, GCC
will optimize % 256 to nothing anyway.

Change-Id: I7c12be2d080f3c70b1028def9736d73084100de7
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 70fdb273db37196e9e5d292d5778a99fededb32f)