In the case hcd autosuspend is enabled, the hcd will enter L2 state
if no device connected. But if the controller works in otg mode, the
gadget driver still works in L0 state if connected with host. This
may result in transfer fail when gadget enqueue new request but the
hcd driver has set the global state into L2. This patch prevent the
hcd enter L2 state if the controller work in device mode.
Change-Id: If31873bebf05c100cf74e49c7d2813160a808f1e
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
Commit 4f519feed0 ("phy: rockchip-inno-usb2: delay suspending
phy if plug out device"), introduced the following issue:
BUG: sleeping function called from invalid context at kernel/workqueue.c:2717
in_atomic(): 1, irqs_disabled(): 128, pid: 4, name: kworker/0:0
INFO: lockdep is turned off.
irq event stamp: 19674
hardirqs last enabled at (19673): [<ffffff8008cd8818>] _raw_spin_unlock_irqrestore+0x40/0x70
hardirqs last disabled at (19674): [<ffffff8008cd8690>] _raw_spin_lock_irq+0x1c/0x60
softirqs last enabled at (19664): [<ffffff80088dd1c0>] dw_mci_request+0xe0/0xf0
softirqs last disabled at (19660): [<ffffff80088dd140>] dw_mci_request+0x60/0xf0
CPU: 0 PID: 4 Comm: kworker/0:0 Not tainted 4.4.83 #69
Hardware name: Rockchip RK3399 Evaluation Board v3 (Android) (DT)
Workqueue: fusb302_wq fusb302_work_func
Call trace:
[<ffffff8008089f78>] dump_backtrace+0x0/0x1cc
[<ffffff800808a158>] show_stack+0x14/0x1c
[<ffffff80083ca33c>] dump_stack+0xb8/0xf4
[<ffffff80080cec40>] ___might_sleep+0x1b8/0x1c8
[<ffffff80080cecc0>] __might_sleep+0x70/0x80
[<ffffff80080becbc>] flush_work+0x74/0x270
[<ffffff80080bf09c>] __cancel_work_timer+0x12c/0x1bc
[<ffffff80080bf154>] cancel_delayed_work_sync+0x10/0x18
[<ffffff80083f9de8>] rockchip_otg_event+0x18/0x3c
[<ffffff80080c6380>] notifier_call_chain+0x54/0x88
[<ffffff80080c63dc>] raw_notifier_call_chain+0x14/0x1c
[<ffffff80089a5354>] extcon_sync+0x74/0x1c4
[<ffffff80085ab980>] platform_fusb_notify+0x184/0x204
[<ffffff80085ac4ac>] set_state_unattached+0x5c/0x90
[<ffffff80085ac85c>] fusb302_work_func+0x288/0x1904
[<ffffff80080bdfa4>] process_one_work+0x354/0x6d0
[<ffffff80080bf4a4>] worker_thread+0x2f8/0x414
[<ffffff80080c4e58>] kthread+0xf0/0xf8
[<ffffff80080828d0>] ret_from_fork+0x10/0x40
Actually, we don't need to cancel the otg_sm_work in the
event EXTCON_USB_HOST notifier_call. So just remove the
cancel_delayed_work_sync() in the rockchip_otg_event().
With this patch, we may get USB BC1.2 detection error
if plug in USB peripheral/host cable alternately and
quickly. So we need to reinit chg_state and chg_type
if OTG host cable plug in.
Change-Id: I349d59de3188d39707c527acb858a7be20a999ac
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
RK3126-evb use andriod as system, so we put the common nodes for
andriod into rk312x-andriod.dtsi. This patch enable devices:
emmc/sdmmc/sdio/fiq-debugger/ramoops/cpufreq/ddrfreq.
Change-Id: I24993486711dd5b6050c03667545c9cb147e1b64
Signed-off-by: Liang Chen <cl@rock-chips.com>
This adds the necessary data for handling dfi on the rk3128.
Access the dfi via registers provided by GRF (general register
files) module.
Change-Id: Ife9e9987224088434e878102b7d1c3b132e761ad
Signed-off-by: Liang Chen <cl@rock-chips.com>
This adds the necessary data for handling efuse on the rk3128.
Change-Id: Ieda973675ff959b3157bb4afe6e1dcdfac65506c
Signed-off-by: Liang Chen <cl@rock-chips.com>
This adds the necessary data for handling dmcfreq on the rk3128.
Change-Id: I6aeae7103c1eaed0b4515d8d11863c4b190b6918
Signed-off-by: Liang Chen <cl@rock-chips.com>
rk3399 Type-C1 USB 2.0 PHY supports USB BC1.2. This patch
adds registers configuration for Type-C1 USB BC1.2.
With this patch, and set dr_mode of Type-C1 USB to "otg" or
"peripheral" in the DTS, then the Type-C1 USB can detect USB
battery charger.
Change-Id: I2f07ae675cc6066db46e428e6e27045b911a0773
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
After commit 23287661af ("ipv6: Inhibit IPv4-mapped src address on the wire.")
Android failed to pass DatagramSocketTest#test_getRemoteSocketAddress:
fail: java.net.ConnectException: Address family not supported by protocol
Android side has patch "Fix DatagramSocketTest#test_getRemoteSocketAddress".
Unfortunately, which may not merge to Android 7.1 branch, so we have to fixes
it on kernel side.
Change-Id: I7444c7636f02485abf6ddd4d7b9cad1f4e6d06e1
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
LSK 17.08 v4.4-android
* tag 'lsk-v4.4-17.08-android': (451 commits)
Linux 4.4.83
pinctrl: samsung: Remove bogus irq_[un]mask from resource management
pinctrl: sunxi: add a missing function of A10/A20 pinctrl driver
pnfs/blocklayout: require 64-bit sector_t
iio: adc: vf610_adc: Fix VALT selection value for REFSEL bits
usb:xhci:Add quirk for Certain failing HP keyboard on reset after resume
usb: quirks: Add no-lpm quirk for Moshi USB to Ethernet Adapter
usb: core: unlink urbs from the tail of the endpoint's urb_list
USB: Check for dropped connection before switching to full speed
uag: Add US_FL_IGNORE_RESIDUE for Initio Corporation INIC-3069
iio: light: tsl2563: use correct event code
iio: accel: bmc150: Always restore device to normal mode after suspend-resume
staging:iio:resolver:ad2s1210 fix negative IIO_ANGL_VEL read
USB: hcd: Mark secondary HCD as dead if the primary one died
usb: musb: fix tx fifo flush handling again
USB: serial: pl2303: add new ATEN device id
USB: serial: cp210x: add support for Qivicon USB ZigBee dongle
USB: serial: option: add D-Link DWM-222 device ID
nfs/flexfiles: fix leak of nfs4_ff_ds_version arrays
fuse: initialize the flock flag in fuse_file on allocation
...
If two vops are working, one of screens will flicker when change ddr
frequency.
Change-Id: I6e31ac1b7a2bfb0d57ec4507c2da1ee714e59c35
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Auto_min_rate is used to instead of normal_rate, if other sys_status is
exist, use status_rate as min_freq, otherwise use auto_min_rate.
Change-Id: If2df35396ec9e6038f18b173a78ff1a248ab87eb
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This patch enables the integrated phy for rk3228 evb board
by default.
To use the external 1000M phy on evb board, need to make
some switch of evb board to be on.
Change-Id: I5cff5445f6aa7a6245cb607a3565edc55e1ad0dd
Signed-off-by: David Wu <david.wu@rock-chips.com>
This patch adds integrated phy clock and integrated phy reset
for rk gmac using.
Change-Id: I6eb8cfa244a169915615b7689f3068bbdb15be49
Signed-off-by: David Wu <david.wu@rock-chips.com>
There are two mac controllers in the rk3328, the one connects
to external PHY, and the other one connects to integrated PHY.
Like the mac of external PHY, the integrated PHY's mac also
needs to configure the related mac registers at GRF.
Change-Id: I4e08264f67c0ea7850b44e2d62591617e299c65b
Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
There is only one mac controller in rk3228, which could connect to
external PHY or integrated PHY, use the grf_com_mux bit15 to route
external/integrated PHY.
Change-Id: I7f7661c1d489d7d88475da72a89642b7fd944cf8
Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Enable the gmac2phy, make the gmac2phy work on
the rk3328-evb board.
Change-Id: I69ffed728c73c1cbab914582965cafdfefe05807
Signed-off-by: David Wu <david.wu@rock-chips.com>
The gmac2phy controller of rk3328 is connected to integrated phy
directly inside, add the node for the integrated phy support.
Change-Id: Id96d65d838d17ae4912cf8fd80d0a1f2a2aa3bf7
Signed-off-by: David Wu <david.wu@rock-chips.com>
To make integrated PHY work, need to configure the PHY clock,
PHY cru reset and related registers.
Change-Id: I08484c5402a5300f581e968828940383c09faedd
Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This is wrong setting for rk3328_set_to_rmii(), so remove it.
Change-Id: Ie5c6e33f51c9e54eeaafcd9dd6a2c8e4ded4a3a8
Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Support integrated ethernet PHY currently.
Change-Id: Ie8a21b9abb6064f9d42848734fccc68f22930129
Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
In preparation for moving some of the phy_device structure members,
add macros for printing errors and debug information.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 72ba48be3e)
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I75021fb43a0317cab4dba81fe737a23dd3f8431c
Right now the dwmac-rk tries to set up the GRF-specific speed and link
options before enabling clocks, phys etc and on previous socs this works
because the GRF is supplied on the whole by one clock.
On the rk3399 however the GRF (General Register Files) clock-supply
has been split into multiple clocks and while there is no specific
grf-gmac clock like for other sub-blocks, it seems the mac-specific
portions are actually supplied by the general mac clock.
This results in hangs on rk3399 boards if the driver is build as module.
When built in te problem of course doesn't surface, as the clocks
are of course still on at the stage before clock_disable_unused.
To solve this, simply move the clock enablement to the first position
in the powerup callback. This is also a good idea in general to
enable clocks before everything else.
Tested on rk3288, rk3368 and rk3399 the dwmac still works on all of them.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f217bfde24)
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I0461d76f48cc9279e31136ce9a448f05cc16a761
Make sure to disable runtime PM, power down the PHY, and disable clocks
before returning on late probe errors.
Fixes: 27ffefd2d1 ("stmmac: dwmac-rk: create a new probe function")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 2d222656db)
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Id44143a0a92fc4d6ccb61293f44cf8dd1a3cd7a4
Instead of adding hooks inside stmmac_platform it is better to just use
the standard PM callbacks within the specific dwmac-driver. This only
used by the dwmac-rk driver.
This reverts commit cecbc5563a ("stmmac: allow to split suspend/resume
from init/exit callbacks").
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5a3c7805c4)
Conflicts:
include/linux/stmmac.h
Change-Id: I3864f8bfe4ee201b449ee766aba6810b498d8a74
Signed-off-by: David Wu <david.wu@rock-chips.com>
Since the rk_gmac_init() only calls another function move this
function call into probe so rk_gmac_init() can be removed.
Since commit cecbc5563a ("stmmac: allow to split suspend/resume
from init/exit callbacks") the init hook is no longer used in
dwmac-rk so this can be removed.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 07a5e76924)
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I5c591b38e53d5196e4da5fe144f35bbe675f07ba
Convert the exit hook into a standard driver remove function as
the hook doesn't really buy us anything extra.
Eventually the exit hook will be deprecated in favor of the driver
remove function.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0de8c4c9a9)
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I1f8cf997b136b17be9c7e227f57008ffaab6bf1f
Use standard PM resume/suspend callbacks instead of the hooks in
stmmac_platform. This gives the driver more control and flexibility
when implementing PM functionality. The hooks in stmmac_platform
also doesn't buy us anything extra.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5619468a41)
Conflicts:
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
Change-Id: I940e17fc5ef0032f91800646d39cc1a50b439df3
Signed-off-by: David Wu <david.wu@rock-chips.com>