firefly-linux-kernel-4.4.55.git
8 years agoUPSTREAM: usb: dwc2: Reorder AHBIDLE and CSFTRST in dwc2_core_reset()
Jacob Chen [Tue, 16 Aug 2016 01:14:01 +0000 (09:14 +0800)]
UPSTREAM: usb: dwc2: Reorder AHBIDLE and CSFTRST in dwc2_core_reset()

According to the databook, the core soft reset should be done before
checking for AHBIDLE. The gadget version of core reset had it correct
but the hcd version did not. This fixes the hcd version.

Change-Id: I49540085036982e6c496a3b911805f0b67fa79e1
Signed-off-by: John Youn <johnyoun@synopsys.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
(cherry picked from commit b8ccc593eeeacde0e6794c4dcec0a57eba7356e6)

8 years agoUPSTREAM: usb: dwc2: Avoid more calls to dwc2_core_reset()
Jacob Chen [Tue, 16 Aug 2016 01:13:16 +0000 (09:13 +0800)]
UPSTREAM: usb: dwc2: Avoid more calls to dwc2_core_reset()

Calls to dwc2_core_reset() are currently very slow, taking at least
150ms (possibly more).  It behooves us to take as many of these calls
out as possible.

It turns out that the calls in dwc2_fs_phy_init() and dwc2_hs_phy_init()
should (as documented in the code) only be needed if we need to do a PHY
SELECT.  That means that if we see that we can avoid the PHY SELECT then
we can avoid the reset.

This patch appears to successfully bypass two resets (one per USB
device) on rk3288-based ARM Chromebooks.

Change-Id: If9f7275d61af6fd8558124ff9ebc7c3622c1f4a3
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
(cherry picked from commit 7d56cc2620f523eba7a831daa22186c8ae5bbdfe)

8 years agoUPSTREAM: usb: dwc2: reduce dwc2 driver probe time
Jacob Chen [Tue, 16 Aug 2016 01:12:26 +0000 (09:12 +0800)]
UPSTREAM: usb: dwc2: reduce dwc2 driver probe time

I found that the probe function of dwc2 driver takes much time
when kernel boot up. There are many long delays in the probe
function these take almost 1 second.

This patch trying to reduce unnecessary delay time.

In dwc2_core_reset() I see it use two at least 20ms delays to
wait AHB idle and core soft reset, but dwc2 data book said that
dwc2 core soft reset and AHB idle just need a few clocks (I think
it refers to AHB clock, and AHB clock run at 150MHz in my RK3288
board), so 20ms is too long, delay 1us for wait AHB idle and soft
reset is enough.

And in dwc2_get_hwparams() it takes 150ms to wait ForceHostMode
and ForceDeviceMode valid but in data book it said software must
wait at least 25ms before the change to take effect, so I reduce
this time to 25ms~50ms. By the way, is there any state bit show
that the force mode take effect ? Could we poll curmod bit for
figuring out if the change take effect ?

It seems that usleep_range() at boot time will pick the longest
value in the range. In dwc2_core_reset() there is a very long
delay takes 200ms, and this function run twice when probe, could
any one tell me is this delay time resonable ?

I have tried this patch in my RK3288-evb board. It works well.

Change-Id: I1f42ab6b6851f0721bf93d516bee895ebcdd994f
Signed-off-by: Yunzhi Li <lyz@rock-chips.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
(cherry picked from commit 20bde643434d541bc5f662c5836a05e9e276eca3)

8 years agoUPSTREAM: usb: dwc2: Speed dwc2_get_hwparams() on some host-only ports
Jacob Chen [Tue, 16 Aug 2016 01:11:25 +0000 (09:11 +0800)]
UPSTREAM: usb: dwc2: Speed dwc2_get_hwparams() on some host-only ports

On some host-only DWC2 ports (like the one in rk3288) when we set
GUSBCFG_FORCEHOSTMODE in GUSBCFG and then read back, we don't see the
bit set.  Presumably that's because the port is always forced to HOST
mode so there's no reason to implement these status bits.

Since we know dwc2_core_reset() is always called before
dwc2_get_hwparams() and we know dwc2_core_reset() should have set
GUSBCFG_FORCEHOSTMODE whenever hsotg->dr_mode == USB_DR_MODE_HOST, we
can just check hsotg->dr_mode to decide that we can skip the delays in
dwc2_get_hwparams().

Change-Id: I912ac2dd5e0ff3f8c12b8263ce268296bbed315f
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
(cherry picked from commit f619473140df4e1a10f4c10f693d214807ebdb03)

8 years agoUPSTREAM: usb: dwc2: Avoid double-reset at boot time
Jacob Chen [Tue, 16 Aug 2016 01:10:43 +0000 (09:10 +0800)]
UPSTREAM: usb: dwc2: Avoid double-reset at boot time

In (usb: dwc2: reset dwc2 core before dwc2_get_hwparams()) we added an
extra reset to the probe path for the dwc2 USB controllers.  This
allowed proper detection of parameters even if the firmware had already
used the USB part.

Unfortunately, this extra reset is quite slow and is affecting boot
speed.  We can avoid the double-reset by skipping the extra reset that
would happen just after the one we added.  Logic that explains why this
is safe:

* As of the CL mentioned above, we now always call dwc2_core_reset() in
  dwc2_driver_probe() before dwc2_hcd_init().

* The only caller of dwc2_hcd_init() is dwc2_driver_probe(), so we're
  guaranteed that dwc2_core_reset() was called before dwc2_hdc_init().

* dwc2_hdc_init() is the only caller that passes an irq other than -1 to
  dwc2_core_init().  Thus if dwc2_core_init() is called with an irq
  other than -1 we're guaranteed that dwc2_core_reset was called before
  dwc2_core_init().

...this allows us to remove the dwc2_core_reset() in dwc2_core_init() if
irq is not < 0.

Note that since "irq" wasn't used in the function dwc2_core_init()
anyway and since select_phy was always set at exactly the same times we
could avoid the reset, we remove "irq" and rename "select_phy" to
"initial_setup" and adjust the callers accordingly.

Change-Id: Id3b085ddc9d35baca140fc8a502fca74dcfd01b5
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
(cherry picked from commit 0fe239bc190453fe82252c6d41a74e685730cd93)

8 years agoUPSTREAM: usb: dwc2: reset dwc2 core before dwc2_get_hwparams()
Jacob Chen [Tue, 16 Aug 2016 01:16:17 +0000 (09:16 +0800)]
UPSTREAM: usb: dwc2: reset dwc2 core before dwc2_get_hwparams()

We initiate dwc2 usb controller in BIOS, dwc2_core_reset() should
be called before dwc2_get_hwparams() to reset core registers to
default value. Without this the FIFO setting might be incorrect
because calculating FIFO size need power-on value of
GRXFSIZ/GNPTXFSIZ/HPTXFSIZ registers.

This patch could avoid warnning massage like in rk3288 platform:
[    2.074764] dwc2 ff580000.usb: 256 invalid for
host_perio_tx_fifo_size. Check HW configuration.

Change-Id: Iab346c005c9f3ea940f4070f3e433e0c7ea89087
Signed-off-by: Yunzhi Li <lyz@rock-chips.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
(cherry picked from commit cebfdbf329ae929ccb71632888a7c2100c3d1eeb)

8 years agoUPSTREAM: usb: dwc2: Restore GUSBCFG in dwc2_get_hwparams()
Jacob Chen [Tue, 16 Aug 2016 01:15:55 +0000 (09:15 +0800)]
UPSTREAM: usb: dwc2: Restore GUSBCFG in dwc2_get_hwparams()

Previously dwc2_get_hwparams() was changing GUSBCFG and not putting it
back the way it was (specifically it set and cleared FORCEHOSTMODE).
Since we want to move dwc2_core_reset() _before_ dwc2_get_hwparams() we
should make sure dwc2_get_hwparams() isn't messing with things in a
permanent way.

Since we're now looking at GUSBCFG, it's obvious that we shouldn't need
all the extra delays if FORCEHOSTMODE was already set.  This will avoid
some delays for any ports that have forced host mode.

Change-Id: I514aaaf77a7ee3f0871efb15e659b93b9717c5f1
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
(cherry picked from commit 991824677fe0a555394d8093b64647dbd08b89b0)

8 years agoarm64: configs: add Rockchip linux default configure file
Yakir Yang [Wed, 10 Aug 2016 02:27:58 +0000 (10:27 +0800)]
arm64: configs: add Rockchip linux default configure file

This configure file is created for Linux Opensource project, and this
file is based on:
- arch/arm/configs/rockchip_linux_defconfig

Only have some light changes:

+ CONFIG_ARMV8_DEPRECATED=y
+ CONFIG_COMPAT=y
+ CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y
+ CONFIG_CPU_IDLE=y
+ CONFIG_ARM_CPUIDLE=y

+ CONFIG_REGULATOR=y
+ CONFIG_REGULATOR_DEBUG=y

+ CONFIG_MMC_BLOCK_MINORS=32
+ CONFIG_MMC_SDHCI_OF_ARASAN=y
+ CONFIG_PHY_ROCKCHIP_EMMC=y

+ CONFIG_FIQ_DEBUGGER=y
+ CONFIG_FIQ_DEBUGGER_NO_SLEEP=y
+ CONFIG_FIQ_DEBUGGER_CONSOLE=y
+ CONFIG_FIQ_DEBUGGER_CONSOLE_DEFAULT_ENABLE=y

- CONFIG_RT2X00=y
- CONFIG_RT2800USB=y

- CONFIG_VIDEO_ROCKCHIP_VPU=y

- CONFIG_MALI400=y
- CONFIG_MALI_SHARED_INTERRUPTS=y
- CONFIG_MALI_DT=y

Change-Id: I4557ca060647c88fd2de2d1e736f9cb0048e3c9a
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
8 years agoarm64: dts: rockchip: add RK3399 Excavator Board for Linux Opensource
Yakir Yang [Wed, 10 Aug 2016 01:43:46 +0000 (09:43 +0800)]
arm64: dts: rockchip: add RK3399 Excavator Board for Linux Opensource

Add Excavator board dts file for Linux Opensource project

Change-Id: I5e5375814d2a4cfa8ae613115b2cbced47cd56ab
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
8 years agoarm64: dts: rockchip: disabled the dw-hdmi-audio by default for Sapphire board
Yakir Yang [Thu, 11 Aug 2016 06:52:54 +0000 (14:52 +0800)]
arm64: dts: rockchip: disabled the dw-hdmi-audio by default for Sapphire board

The dw-hdmi-audio driver could only work on FB dw-hdmi driver, we can't
use it on DRM display sub-system. So I think it's better to disable the
dw-hdmi-audio by default for Sapphire board, but enable this device node
for excavator-edp and excavator-box boards.

Change-Id: I8c2639d535510f1092a3da02e008986394608998
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
8 years agoarm64: dts: rockchip: split the backlight device node to Sapphire SoC board
Yakir Yang [Thu, 11 Aug 2016 06:48:23 +0000 (14:48 +0800)]
arm64: dts: rockchip: split the backlight device node to Sapphire SoC board

Backlight is the common device node, this would help to reduce
dumplicate code.

Change-Id: If0ee83f0bf929c242ec6dde3808a680f28e408ed
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
8 years agoarm64: dts: rk3399-box: and 32.768K clk node for BT
xxh [Wed, 17 Aug 2016 09:11:17 +0000 (17:11 +0800)]
arm64: dts: rk3399-box: and 32.768K clk node for BT

Change-Id: I7288d8e7a20aba17dca9cdb699da24af745e5567
Signed-off-by: Xu Xuehui <xxh@rock-chips.com>
8 years agoarm64: dts: rockchip: use extcon for usb2/usb3 on rk3399 mid board
Bin Yang [Thu, 18 Aug 2016 01:39:55 +0000 (09:39 +0800)]
arm64: dts: rockchip: use extcon for usb2/usb3 on rk3399 mid board

Change-Id: I883fb6da8e9b136e6d94213a6675b8de9e131380
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
8 years agoarm64: dts: rockchip: enable Type-C phy for rk3399 mid
Bin Yang [Wed, 17 Aug 2016 15:09:09 +0000 (23:09 +0800)]
arm64: dts: rockchip: enable Type-C phy for rk3399 mid

Change-Id: I8973725588becb6620ff92da38f09e734e3fc320
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
8 years agoarm64: dts: rockchip: support fusb302 for rk3399 mid
Bin Yang [Wed, 17 Aug 2016 14:58:27 +0000 (22:58 +0800)]
arm64: dts: rockchip: support fusb302 for rk3399 mid

Change-Id: I6eac543d9791e55d3b11b5367ac336c9c2f27296
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
8 years agoFROMLIST: mmc: core: fall back host->f_init if failing to init mmc card after resume
Shawn Lin [Tue, 16 Aug 2016 02:41:35 +0000 (10:41 +0800)]
FROMLIST: mmc: core: fall back host->f_init if failing to init mmc card after resume

We observed the failure of initializing card after resume
accidentally. It's hard to reproduce but we did get report from
the suspend/resume test of our RK3399 mp test farm . Unfortunately,
we still fail to figure out what was going wrong at that time.
Also we can't achieve it by retrying the host->f_init without falling
back it. But this patch will solve the problem as we could add some log
there and see that we resume the mmc card successfully after falling
back the host->f_init. There is no obvious side effect found, so it seems
this patch will improve the stability.

[   93.405085] mmc1: unexpected status 0x800900 after switch
[   93.408474] mmc1: switch to bus width 1 failed
[   93.408482] mmc1: mmc_select_hs200 failed, error -110
[   93.408492] mmc1: error -110 during resume (card was removed?)
[   93.408705] PM: resume of devices complete after 213.453 msecs

Change-Id: I5b24cb84a223394392450a1f10d8bbacb9e1006e
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
8 years agoFROMLIST: mmc: core: move freqs table into core.h
Shawn Lin [Tue, 16 Aug 2016 02:39:10 +0000 (10:39 +0800)]
FROMLIST: mmc: core: move freqs table into core.h

We will reuse it outside the core.c file, so let's
move it to the header file.

Change-Id: Ibc40268d104d503603d59911d71157fcee0e5196
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
8 years agoFROMLIST: mmc: sdhci: Do not allow tuning procedure to be interrupted
Christopher Freeman [Tue, 16 Aug 2016 02:37:12 +0000 (10:37 +0800)]
FROMLIST: mmc: sdhci: Do not allow tuning procedure to be interrupted

wait_event_interruptible_timeout() will return early if the blocked
process receives a signal, causing the driver to abort the tuning
procedure and possibly leaving the controller in a bad state.  Since the
tuning command is expected to complete quickly (<50ms) and we've set a
timeout, use wait_event_timeout() instead.

Change-Id: Ibd1c5e8076c5fde4b4e9c4ebb0a2733c8d2d4eda
Signed-off-by: Christopher Freeman <cfreeman@nvidia.com>
Tested-by: Robert Foss <robert.foss@collabora.com>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
8 years agommc: sdhci-of-arasan: wakeup genpd when being in suspend
Shawn Lin [Mon, 15 Aug 2016 03:09:26 +0000 (11:09 +0800)]
mmc: sdhci-of-arasan: wakeup genpd when being in suspend

Let's keep genpd for sdhci alive while entering deep
sleep which gte me out of yapping around.

Change-Id: I0da20b417621d277745bafd53d1ee461aae72e11
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
8 years agodrivers,inv_mpu: fix reg name err
Zorro Liu [Thu, 18 Aug 2016 06:35:00 +0000 (14:35 +0800)]
drivers,inv_mpu: fix reg name err

Change-Id: I965cdb614b2ba28bb8b61af561799fd237d7e50d
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
8 years agoarm64: dts: rockchip: use extcon for usb2/usb3 on rk3399 evb/box
Wu Liang feng [Wed, 17 Aug 2016 06:50:19 +0000 (14:50 +0800)]
arm64: dts: rockchip: use extcon for usb2/usb3 on rk3399 evb/box

Change-Id: I582381af1dfc5c7bb06736d3a92d2636b1523863
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoarm64: dts: rockchip: change dr_mode for rk3399 dwc3
Wu Liang feng [Wed, 17 Aug 2016 06:32:11 +0000 (14:32 +0800)]
arm64: dts: rockchip: change dr_mode for rk3399 dwc3

The DesignWare USB3 integrated in rockchip SoCs is a configurable
IP Core which can be instantiated as Dual-Role Device (DRD), Host
Only (XHCI) and Peripheral Only configurations. For rk3399, it has
two DWC3 controllers, we set DRD for DWC3_0 and Host only for DWC3_1
by default.

Change-Id: Ia0063e04e48770d8d0ec7ec86cb621c5e9979fb9
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoarm64: dts: rockchip: add usb3 phy for rk3399 dwc3
Wu Liang feng [Wed, 17 Aug 2016 06:23:10 +0000 (14:23 +0800)]
arm64: dts: rockchip: add usb3 phy for rk3399 dwc3

For now, we have enabled Type-C phy, so we can add
usb3 phy which integrated in Type-C phy for rk3399
dwc3, and support super speed.

Change-Id: I3da984e4f35b35d46e0b84755bcc23deaf97d18f
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoarm64: dts: rockchip: enable Type-C phy for rk3399 evb/box
Wu Liang feng [Wed, 17 Aug 2016 06:14:03 +0000 (14:14 +0800)]
arm64: dts: rockchip: enable Type-C phy for rk3399 evb/box

Change-Id: Idb2f919e008c37aa030c114c9a11df2d69126e99
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoarm64: dts: rockchip: add usb3 controller reset for rk3399
Wu Liang feng [Wed, 17 Aug 2016 04:02:04 +0000 (12:02 +0800)]
arm64: dts: rockchip: add usb3 controller reset for rk3399

We can assert the reset to keep the whole USB3 Controller
in resetting to hold pipe power state in P2 before
initializing Type-C PHY.

Change-Id: Ibb5716bac645ae01ee27fd019a3dfcbd3c0ffd84
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoarm64: rockchip_cros_defconfig: enable rockchip Type-C phy
Wu Liang feng [Wed, 17 Aug 2016 03:55:41 +0000 (11:55 +0800)]
arm64: rockchip_cros_defconfig: enable rockchip Type-C phy

Change-Id: I1fe575bd027d4843c4e5c21a4fef5bdb6a9b417a
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoarm64: rockchip_defconfig: enable rockchip Type-C phy
Wu Liang feng [Wed, 17 Aug 2016 03:53:47 +0000 (11:53 +0800)]
arm64: rockchip_defconfig: enable rockchip Type-C phy

Change-Id: Ifef876af8f54019d7a72a3953a0b90535df23242
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agousb: dwc3: fix PM resume error for rockchip platforms
Wu Liang feng [Tue, 16 Aug 2016 06:20:11 +0000 (14:20 +0800)]
usb: dwc3: fix PM resume error for rockchip platforms

We enable PM runtime auto suspend on rockchip platforms (e.g. rk3399),
it allows DWC3 controller to enter runtime suspend if usb cable detached.
So we don't need to do anything in dwc3_suspend() and dwc3_resume()
which duplicated the same operations as dwc3_runtime_suspend() and
dwc3_runtime_resume().

And if DWC3 controller works on HOST mode, we can't do runtime resume
DWC3 gadget.

Change-Id: I63e734f51b05274251d8a88a664eee768568eb7b
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agophy: rockchip-inno-usb2: don't cancel otg_sm_work when phy exit
Wu Liang feng [Mon, 15 Aug 2016 07:47:21 +0000 (15:47 +0800)]
phy: rockchip-inno-usb2: don't cancel otg_sm_work when phy exit

The otg_sm_work is a OTG state machine delay work. It will hold
a wake lock if SDP cable or CDP cable is attached, and release
the wake lock if cable dettached. If usb controller(e.g. DWC3)
call phy exit When USB cable is dettached and cancel otg_sm_work,
it will cause the usb phy keeping hold of wake lock.

Change-Id: Ie6a89e481b8d4999a996083709bacc5be901805a
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agousb: dwc3: add rockchip specific glue layer
Wu Liang feng [Mon, 15 Aug 2016 03:18:37 +0000 (11:18 +0800)]
usb: dwc3: add rockchip specific glue layer

Add rockchip specific glue layer to support USB3 Peripheral mode
and Host mode on rockchip platforms (e.g. rk3399).

The DesignWare USB3 integrated in rockchip SoCs is a configurable
IP Core which can be instantiated as Dual-Role Device (DRD), Host
Only (XHCI) and Peripheral Only configurations.

We use extcon notifier to manage usb cable detection and mode switch.
Enable DWC3 PM runtime auto suspend to allow core enter runtime_suspend
if USB cable is dettached. For host mode, it requires to keep whole
DWC3 controller in reset state to hold pipe power state in P2 before
initializing PHY. And it need to reconfigure USB PHY interface of DWC3
core after deassert DWC3 controller reset.

The current driver supports Host only and Peripheral Only well, for
now, we will add support for OTG after we have it all stabilized.

Change-Id: I821dd19eedec73e6517f0cca184f939a9f313904
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoUPSTREAM: xhci: fix platform quirks overwrite regression in 4.7-rc1
Mathias Nyman [Wed, 1 Jun 2016 15:09:10 +0000 (18:09 +0300)]
UPSTREAM: xhci: fix platform quirks overwrite regression in 4.7-rc1

commit b1c127ae990b ("usb: host: xhci: plat: make use of new methods in
xhci_plat_priv") sets xhci->quirks before calling xhci_gen_setup(), which
will overwrite them.

Don't overwite the quirks, just add the new ones

Fixes: b1c127ae990b ("usb: host: xhci: plat: make use of new methods in xhci_plat_priv")
Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Change-Id: I7751ccaa1f3c8000ad0d47f9fba84084b2db96da
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 757de492f2d5711d4f5b386eb9bdd5cdc99eb30e)

8 years agoarm64: dts: rockchip: modify dwc3 properties for rk3399
Wu Liang feng [Wed, 10 Aug 2016 13:02:01 +0000 (21:02 +0800)]
arm64: dts: rockchip: modify dwc3 properties for rk3399

We have merged dwc3 driver from upstream, and some properties
need to be modified according to upstream coding style.

Change-Id: I4f8c4b23a941932a08eb29a0282dfb0903193c8a
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agousb: dwc3: add a quirk xhci_slow_suspend_quirk
Wu Liang feng [Wed, 10 Aug 2016 12:55:53 +0000 (20:55 +0800)]
usb: dwc3: add a quirk xhci_slow_suspend_quirk

On some xHCI controllers (e.g. Rockchip SoCs), which are
integrated in DWC3 IP, need an extraordinary delay to wait
for xHCI enter the Halted state(i.e. HCH in the USBSTS
register is '1'), especially if DWC3 is in DRD mode.

Change-Id: I67c84d4768df95f7616d6716a77cf743e4334122
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoFROMLIST: usb: dwc3: rockchip: add devicetree bindings documentation
William Wu [Thu, 2 Jun 2016 12:09:23 +0000 (20:09 +0800)]
FROMLIST: usb: dwc3: rockchip: add devicetree bindings documentation

This patch adds the devicetree documentation required for Rockchip
USB3.0 core wrapper consisting of USB3.0 IP from Synopsys.

It supports DRD mode, and could operate in device mode (SS, HS, FS)
and host mode (SS, HS, FS, LS).

Change-Id: I8b45a43a1a2c0399188d601c794015b4305c4795
Signed-off-by: William Wu <william.wu@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoFROMLIST: usb: dwc3: add dis_del_phy_power_chg_quirk
William Wu [Thu, 2 Jun 2016 11:52:27 +0000 (19:52 +0800)]
FROMLIST: usb: dwc3: add dis_del_phy_power_chg_quirk

Add a quirk to clear the GUSB3PIPECTL.DELAYP1TRANS bit,
which specifies whether disable delay PHY power change
from P0 to P1/P2/P3 when link state changing from U0
to U1/U2/U3 respectively.

Change-Id: I84ce14c328aa27c5000cf76c44cbdc1ea7a926b9
Signed-off-by: William Wu <william.wu@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoFROMLIST: usb: dwc3: make usb2 phy utmi interface configurable
William Wu [Wed, 3 Aug 2016 11:01:52 +0000 (19:01 +0800)]
FROMLIST: usb: dwc3: make usb2 phy utmi interface configurable

Support to configure the UTMI+ PHY with an 8- or 16-bit
interface via DT. The UTMI+ PHY interface is a hardware
capability, and it's platform dependent. Normally, the
PHYIF can be configured during coreconsultant.

But for some specific USB cores(e.g. rk3399 SoC DWC3),
the default PHYIF configuration value is false, so we
need to reconfigure it by software.

Change-Id: I5c5a44dcd9ef4c3b8f2b722cd066819a2983fcfc
Signed-off-by: William Wu <william.wu@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
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)