Commit Graph

1942 Commits

Author SHA1 Message Date
baiywt 38b0a66a10 Merge linux-5.10-gen-rkr6 2024-01-19 18:35:00 +08:00
Zefa Chen fefe9843bc phy: rockchip: samsung-dcphy: restart rx after apb reset when rx is streaming
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
Change-Id: I9e5e8607b8c824daca8ea820d785323e0ac8c8fa
2023-06-12 10:52:59 +08:00
William Wu 27312ce9d8 phy: rockchip: naneng-combphy: Fix Rx squelch for RK3528 U3
This patch adjust the RK3528 U3 Rx squelch input filler
bandwidth to 3'b110 which is used for rx_lfps, reduce the
bandwidth to avoid filtering valid superspeed data.

With this patch, it can fix the issue that Kingston U3 Disk
(idVendor=0951, idProduct=1666, bcdDevice= 1.10) read error
on RK3528 platforms.

Change-Id: Ifa4eac24bbdebe020db356ba45dae146f4df22f1
Signed-off-by: William Wu <william.wu@rock-chips.com>
2023-06-06 09:30:14 +08:00
William Wu ae3a28752e phy: rockchip: naneng-combphy: Fix Rx squelch for RK3562 U3
This patch adjust the RK3562 U3 Rx squelch input filler
bandwidth to 3'b110 which is used for rx_lfps, reduce the
bandwidth to avoid filtering valid superspeed data.

With this patch, it can fix the issue that Kingston U3 Disk
(idVendor=0951, idProduct=1666, bcdDevice= 1.10) read error
on RK3562 platforms.

Change-Id: Idb667d159f9dba6b1de0a9ec04af9dae2d065927
Signed-off-by: William Wu <william.wu@rock-chips.com>
2023-06-06 09:30:14 +08:00
William Wu 4bbb16bf87 phy: rockchip: naneng-combphy: Fix Rx squelch for RK3568 U3
This patch adjust the RK3568 U3 Rx squelch input filler
bandwidth to 3'b110 which is used for rx_lfps, reduce the
bandwidth to avoid filtering valid superspeed data.

With this patch, it can fix the issue that Kingston U3 Disk
(idVendor=0951, idProduct=1666, bcdDevice= 1.10) read error
on RK3568 platforms.

Change-Id: I27410c5702862df2d8829a2ca3c2c1d9f57885be
Signed-off-by: William Wu <william.wu@rock-chips.com>
2023-06-06 09:30:14 +08:00
Jon Lin 13639746fa phy: rockchip: naneng-combphy: Fix swing to 650mv under 100M refclk for rk3562
Change-Id: Ia71ec0851c1d1bc686277a49af70488f413f423c
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2023-06-01 18:32:55 +08:00
Jon Lin 010c015455 phy: rockchip: naneng-combphy: Fix swing to 650mv under 100M refclk for rk3528
Change-Id: I30b988fe60a09ad3aafd6527238926526b1c3693
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2023-06-01 18:32:55 +08:00
Algea Cao 2f2ba4a8f8 phy: rockchip-samsung-hdptx-hdmi: Don't set bus_width 8 when probe
Fix set pll rate err when play hdr video first time after
system boot.

Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Change-Id: Ic85b8f8b20a2a588627f650ff402076decd23b63
2023-05-31 14:19:55 +08:00
William Wu 9e36581320 phy: rockchip: inno-usb2: power on phy if linestate is SE1
Some special devices connected to host port, the linestate
maybe SE1 (DP/DM both in High level).

The below devices are the known special devices

Wireless HID: VID = 0xa604, PID = 0x0715
RK3308BS ADB: VID = 0x2207, PID = 0x0006

In order to support these special devices, this patch
handle the linestate SE1 as device connected state,
and power on the phy if it has already suspended.

Change-Id: I55fe83150c18d6c2629fbc857790ef04cdb68da5
Signed-off-by: William Wu <william.wu@rock-chips.com>
2023-05-26 14:26:28 +08:00
Algea Cao 91a23b0515 phy: rockchip-samsung-hdptx-hdmi: Fix hdmi Inter-Pair Skew exceed the limits
In hdmi2.0 resolution, the phase of D2 lane is probabilistically
ahead of other lanes.  Set phy deskew FIFO works on shared pointer
to fix this problem.

According to vendor, this patch is also available for frl mode.

Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Change-Id: Ic6f5111ede5a553fb6d6511bd340d4f2010f3fe7
2023-05-25 19:19:31 +08:00
Zefa Chen d48ecfc5f7 phy: rockchip: mipi csi2 dphy fixes grf write error of val for lane select
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
Change-Id: Id56eb83d9a25c15b9d611232e6f82221a55c7e64
2023-05-19 09:35:01 +08:00
Jianwei Zheng 995a5e0ef5 phy: rockchip: naneng-combphy: Fix CTLE register setting error for rk3528
Signed-off-by: Jianwei Zheng <jianwei.zheng@rock-chips.com>
Change-Id: I6a217c1b041f5962c500bb4d03f689ce54a42443
2023-05-18 09:23:36 +08:00
Zhang Yubing bd29c245e6 phy: rockchip: typec: select TYPEC
Signed-off-by: Zhang Yubing <yubing.zhang@rock-chips.com>
Change-Id: I228cc3c034a0db29ea83c510a74c7a98ce15b534
2023-04-13 20:14:43 +08:00
Zhang Yubing b4b55361d6 phy: rockchip: phy-rockchip-typec: set phy default mode as usb
Signed-off-by: Zhang Yubing <yubing.zhang@rock-chips.com>
Change-Id: Iacc843ea86e1c63c54c85b8949682b1b8c708559
2023-04-10 14:33:56 +08:00
William Wu c3239eb297 phy: rockchip: inno-usb2: Fix mismatch id interrupt
Test on RK3588S Tablet, set the power supply of logic on
and set the power supply of usb2 phy off during deep sleep,
then the id falling edge interrupt will be triggered after
system resume, and kernel panic with the following log:

SError Interrupt on CPU0, code 0xbe000011 -- SError
CPU: 0 PID: 1946 Comm: kworker/0:0 Not tainted 5.10.110 #600
Hardware name: Rockchip RK3588S TABLET RK806 SINGLE Board (DT)
Workqueue: events rockchip_usb2phy_otg_sm_work
pstate: 20c00009 (nzCv daif +PAN +UAO -TCO BTYPE=--)
pc : _raw_spin_unlock_irqrestore+0x28/0x60
lr : regmap_unlock_spinlock+0x18/0x28
......
Kernel panic - not syncing: Asynchronous SError Interrupt
CPU: 0 PID: 1946 Comm: kworker/0:0 Not tainted 5.10.110 #600
Hardware name: Rockchip RK3588S TABLET RK806 SINGLE Board (DT)
Workqueue: events rockchip_usb2phy_otg_sm_work
Call trace:
 dump_backtrace+0x0/0x1c8
 show_stack+0x1c/0x2c
 dump_stack_lvl+0xdc/0x12c
 dump_stack+0x1c/0x64
 panic+0x150/0x3a4
 test_taint+0x0/0x30
 arm64_serror_panic+0x78/0x84
 do_serror+0xe0/0x100
 el1_error+0x94/0x118
 _raw_spin_unlock_irqrestore+0x28/0x60
 regmap_unlock_spinlock+0x18/0x28
 regmap_write+0x68/0x84
 rockchip_usb2phy_power_on+0x128/0x1f0
 rockchip_usb2phy_otg_sm_work+0x1d0/0x454
 process_one_work+0x1f4/0x490
 worker_thread+0x278/0x4dc
 kthread+0x13c/0x344
 ret_from_fork+0x10/0x30

In fact, there are two issues here.
1. The power of phy id belongs to the usb2 phy power supply.
And the id is pulled up to high level by default. So if we
power off usb2 phy supply during deep sleep, the id status
will fall to low level and trigger the falling edge interrupt.
In the id irq handler rockchip_usb2phy_id_irq(), it send Host
notification only depends the id falling edge irq status, it's
not enough in this case, it needs to check the iddig status
to make sure that the id status is indeed in low level.

2. For RK3588S, the pipe phystatus select register from the
usb grf, and the power domain of usb grf belongs to PD_USB.
So we must make sure the PD_USB is on when operate the pipe
phystatus select register. Originally, we operated the pipe
phystatus register in the phy ops of power_on, because we
expected that the phy ops of power_on called from the dwc3
controller pm runtime resume process which can power on the
PD_USB. However, in this test case, if the id falling edge
interrupt after system resume, the phy ops of power_on can
be called when PD_USB is off.

The call stack:
 rockchip_usb2phy_id_irq()
    -> send Host notification ->
 rockchip_otg_event()
    -> receive notification and schedule otg_sm_work ->
 rockchip_usb2phy_otg_sm_work()
    -> detect EXTCON_USB_HOST is set and call phy power_on ops
 rockchip_usb2phy_power_on()
    -> set the pipe phystatus select register

Change-Id: Ib7e5bc095ab1df2ca4c983d58a9f15720f0cccb9
Signed-off-by: William Wu <william.wu@rock-chips.com>
2023-04-07 14:16:20 +08:00
Tao Huang cc17504307 Merge tag 'android12-5.10-2023-02_r1' of https://android.googlesource.com/kernel/common
android12-5.10 February 2023 release 1

Artifacts:
  https://ci.android.com/builds/submitted/9611440/kernel_aarch64/latest

* tag 'android12-5.10-2023-02_r1': (5560 commits)
  ANDROID: GKI: Enable ARM64_ERRATUM_2454944
  ANDROID: dma-ops: Add restricted vendor hook
  ANDROID: arm64: Work around Cortex-A510 erratum 2454944
  ANDROID: mm/vmalloc: Add override for lazy vunmap
  ANDROID: cpuidle-psci: Fix suspicious RCU usage
  ANDROID: ABI: update allowed list for galaxy
  FROMGIT: f2fs: add sysfs nodes to set last_age_weight
  FROMGIT: f2fs: fix wrong calculation of block age
  ANDROID: struct io_uring ABI preservation hack for 5.10.162 changes
  ANDROID: fix up struct task_struct ABI change in 5.10.162
  ANDROID: add flags variable back to struct proto_ops
  UPSTREAM: io_uring: pass in EPOLL_URING_WAKE for eventfd signaling and wakeups
  UPSTREAM: eventfd: provide a eventfd_signal_mask() helper
  UPSTREAM: eventpoll: add EPOLL_URING_WAKE poll wakeup flag
  UPSTREAM: Revert "proc: don't allow async path resolution of /proc/self components"
  UPSTREAM: Revert "proc: don't allow async path resolution of /proc/thread-self components"
  UPSTREAM: net: remove cmsg restriction from io_uring based send/recvmsg calls
  UPSTREAM: task_work: unconditionally run task_work from get_signal()
  UPSTREAM: signal: kill JOBCTL_TASK_WORK
  UPSTREAM: io_uring: import 5.15-stable io_uring
  ...

Change-Id: I2b16474d6e3a91f1d702486ec6d1565a7bc310e3

Conflicts:
	Documentation/ABI/testing/configfs-usb-gadget-uac2
	Documentation/usb/gadget-testing.rst
	Makefile
	arch/arm/boot/dts/rk3288-evb-act8846.dts
	arch/arm64/mm/Makefile
	drivers/dma-buf/dma-buf.c
	drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
	drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
	drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
	drivers/gpu/drm/rockchip/rockchip_drm_vop.c
	drivers/mmc/core/mmc.c
	drivers/pci/controller/dwc/pcie-designware-host.c
	drivers/pinctrl/pinctrl-rockchip.c
	drivers/regulator/core.c
	drivers/usb/dwc3/ep0.c
	drivers/usb/dwc3/gadget.c
	drivers/usb/gadget/function/f_hid.c
	drivers/usb/gadget/function/f_uac1.c
	drivers/usb/gadget/function/f_uac2.c
	drivers/usb/gadget/function/u_audio.c
	drivers/usb/gadget/function/u_audio.h
	drivers/usb/gadget/function/u_uac2.h
	drivers/usb/host/xhci.h
	drivers/usb/storage/unusual_uas.h
	drivers/usb/typec/altmodes/displayport.c
	include/linux/page_ext.h
	mm/cma.c
	mm/page_ext.c
	sound/core/pcm_dmaengine.c
	sound/soc/codecs/hdmi-codec.c
	include/linux/stmmac.h
	sound/drivers/aloop.c
	drivers/pci/controller/dwc/pcie-designware.h
2023-03-14 09:44:51 +08:00
Algea Cao abb70c1b99 phy: rockchip: inno-hdmi: Fix rk3528 sink probabilistically fails to recognize signal
When switching modes, the synchronization reset time
of the four lanes cannot be too long, ldo cannot be
turned off either.

Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Change-Id: I3b8308bf03e9f5796f93189a009d22100c642894
2023-03-10 16:45:45 +08:00
Cai YiWei 3a15fce889 phy: rockchip: fix build warning
Change-Id: Ibc3998b3b624e51463dd5e0746839bbd31cb0158
Signed-off-by: Cai YiWei <cyw@rock-chips.com>
2023-03-03 10:55:56 +08:00
Jianwei Zheng b80051be40 phy: rockchip: inno-usb2: change HS disconnect detect mode for RV1106
This patch set HS disconnect detect mode to single ended detect mode
for RV1106, fix RV1106 can not recognize device plug out sometimes.

Signed-off-by: Jianwei Zheng <jianwei.zheng@rock-chips.com>
Change-Id: I6ee6ded4cc12032cf2825eadd207c1e5003957cd
2023-03-01 17:29:16 +08:00
Jon Lin f67f48f039 phy: rockchip-naneng-combo: Support phy grf reset
1.Assert phy-reset via PIPEPHY GRF instead of asserting via CRU that
would be useless when PD_PHP is off.
2.RK3562 change to use phy grf reset

Change-Id: Id30e8bf28c0bb8d30bab27ad069201978ec74785
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2023-02-20 14:21:04 +08:00
Algea Cao 28c7e47817 phy: rockchip: inno-hdmi: Fix 'warn: missing unwind goto'
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Change-Id: I7044cc4e7268c9899f43eb927f29084e2e2f34b2
2023-02-15 15:27:28 +08:00
Algea Cao 97811627ff phy: rockchip-samsung-hdptx-hdmi: Reduce ROPLL loop bandwidth
24M clock noise is carried into the PHY ROPLL loop filter.
Due to the low noise frequency, it can pass through the low-pass loop
filter of ROPLL, resulting in hdmi flash. Reduce ROPLL loop bandwidth
can solve this problem.

Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Change-Id: Ibea774bc26ea8c2b06cf79c84b6cd6456df66ea5
2023-02-15 15:14:18 +08:00
Zhang Yubing 8b2a7f9145 phy: rockchip-typec: add support to tcpm framework
add support to tcpm framework and remove extcon.

Change-Id: I6ea7aa21b65a50eca2d85f8959d8d317184204e2
Signed-off-by: Zhang Yubing <yubing.zhang@rock-chips.com>
2023-02-14 14:44:36 +08:00
Frank Wang 9cce7d5ac8 phy: rockchip: inno-usb2: fix incorrect perip_connected
The U2PHY sent "peripheral connected" extcon message to DWC3 even if
there is no USB cable pluuged when the otg_sm_work is scheduled first
time, this would be resumed DWC3 unexpectedly and cause the DWC3 gadget
to incorrect state. So initialize the perip_connected to false before
send the extcon message to fix it.

This can fix the ADB can not be enumerated when plug the USB cable
in the first time after the system boot up and the below messages
may find in the Kernel log on RK3562-EVB2 board.

[    7.218101] read descriptors
[    7.218191] read strings
[    7.306784] dwc3 fe500000.usb: failed to enable ep0out

Fixes: 00168bb5b5 ("phy: rockchip: inno-usb2: fix otg port with vbus always on")
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Change-Id: I90209f15605d16ca746dd6c44fbaf6d9c1684eaa
2023-02-08 18:04:08 +08:00
Guochun Huang b6de31a022 phy/rockchip: inno-dsidphy: add support px30s
Change-Id: I275d589f56e5963649aee9397eba3a9994e5901d
Signed-off-by: Guochun Huang <hero.huang@rock-chips.com>
2023-02-08 16:17:22 +08:00
Jianqun Xu a8c4dcb234 phy: rockchip: mipi-rx: fix compile error when CONFIG_PM is not set
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Change-Id: Ieb9df05a2c71c090de9ebec2d40678dd79630f55
2023-02-03 17:40:50 +08:00
Zefa Chen 6d31ebb3ec phy: rockchip: csi2-dphy: support rk3562
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
Change-Id: I938047b37e2feba021a19f953f859679468fee1a
2023-02-02 19:02:08 +08:00
Jon Lin 0cdb526c1f phy: rockchip-naneng-combo: Support rk3562
Change-Id: I4da12613bb01c477f8fca9c38c516f5dab0851d9
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2023-02-02 19:02:08 +08:00
Frank Wang 63f30f7541 phy: rockchip: inno-usb2: add usb2 phy support for rk3562
RK3652 has one USB2.0 PHY with two ports, the OTG port support OTG
and BC1.2, the SoC provide USB GRF and APB to access the registers.

This adds vbus detection function control and make the below tuning
to enhance the usb2-phy SQ for RK3562 SoC.
 - enable pre-emphasis during non-chirp phase
 - set HS eye height to 425mv
 - turn off differential receiver by default to save power

Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
Change-Id: If93c3a072be4c532aa823cf3cd9f05fe9414f727
2023-02-02 19:02:08 +08:00
Frank Wang 0d694e35d4 phy: rockchip: inno-usb2: add devm action for otg wake lock
The otg wakelock should be destroyed when the device probe failed
or removed, else may cause the following kernel errors.

  list_add corruption. next->prev should be prev (ffffffc01209d3c8), but
  was 0000000000000000. (next=ffffff800350faf8).
  ------------[ cut here ]------------
  kernel BUG at lib/list_debug.c:25!
  Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
  Modules linked in:
  CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.10.110 #83
  Hardware name: Rockchip RK3562 EVB1 LP4X V10 Board (DT)
  pstate: 60400085 (nZCv daIf +PAN -UAO -TCO BTYPE=--)
  pc : __list_add_valid+0x6c/0x88
  lr : __list_add_valid+0x6c/0x88
  [...]
  Call trace:
   __list_add_valid+0x7c/0x98
   wakeup_source_register+0x120/0x160
   wakeup_source_register+0x120/0x160
   device_init_wakeup+0x60/0xf4
   [...]

So add devm action to fix it.

Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Change-Id: If54a299a694414ad759002e4f6c4187448ccdb15
2023-01-12 10:47:56 +08:00
Jon Lin 432666b59b phy: rockchip: naneng-combphy: add support rk3528
1. The layout of controller registers has changed, remove legacy config;
2. Using the default value for grf register;
3. sync to use rk3568 parameter for phy PLL, signal test pass
4. Add 24MHz refclk for rk3528 PCIe, Enable the counting clock of the
rterm detect by setting tx_trim[14] bit for rx detecting.
5. set SSC modulation frequency to 31.5KHz

Change-Id: I45742c416d452037e61b7a7b8765269931d56402
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
Signed-off-by: Jianwei Zheng <jianwei.zheng@rock-chips.com>
2022-12-30 17:19:19 +08:00
Jianwei Zheng 197562a087 phy: rockchip: inno-usb2: support usb wakeup for rk3528
This patch set the linestate filter time to support wakeup for
rk3528. Different from other platforms, Both the otg port and
host port have linestate_filter_con register, so we need to set
them separately.

Signed-off-by: Jianwei Zheng <jianwei.zheng@rock-chips.com>
Change-Id: I4a78dccbdb73c48436876b72e106a2eb608ea99d
2022-12-30 17:19:19 +08:00
Jianwei Zheng 7c24d9902e phy: rockchip: inno-usb2: add usb2 phy support for rk3528
This patch add usb2 phy support for rk3528 and modified the
rk3568_vbus_detect_control as a universal interface due to
more and more platforms may use this interface in the future.

Usb2 phy also has one different design for rk3528. It doesn't
has commonon control bit, we found that there is a phy inner
debug register which can control the pll out. So we can use
this register to support phy pll control for rk3528.

Add usb2 phy tuning for rk3528:

1. Turn off differential receiver in suspend mode for
   the otg and host port to save power consumption.

2. Choose the Tx fs/ls data as linestate from TX driver
   for otg port which uses dwc3 controller to improve
   fs/ls devices compatibility with long cable.

3. Enable both the otg and host ports phy irq to pmu
   wakeup source.

4. Set HS eye-height to 400mV for rk3528

Signed-off-by: Jianwei Zheng <jianwei.zheng@rock-chips.com>
Change-Id: Ia4a861bccd6a37db4e1ba42cede66a6b07947b5d
2022-12-30 17:19:19 +08:00
Algea Cao e528f6340a phy: rockchip: inno-hdmi: Support rk3528 hdmi phy
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Change-Id: Ie555fa26eb482e045cf97e72f6f396526df3c257
2022-12-27 14:59:53 +08:00
Wyon Bi 9e8c381e3e phy/rockchip: samsung-hdptx: Fix link train EQ failed
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
Change-Id: I72b78e063eb014e756ba9d39d9e79909a09dce5e
2022-12-26 15:38:01 +08:00
Kever Yang cbf3eb9b7f phy: rockchip-snps-pcie3: update fw when init
This fw fix some RX issue:
1. connect detect error;
2. transfer error in ssd huge data write(more than 10GB).

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Change-Id: If9b8d7fbe4414ae4d28ff6bbd4415d88b582113d
2022-12-06 14:27:00 +08:00
Kever Yang 1b493c5412 Revert "phy: phy-rockchip-snps-pcie3: Update calibration controls for rk356x"
This reverts commit 8e908294a5.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Change-Id: I063f98312f5fa94309fc72c983516f222d0addf7
2022-12-06 14:26:31 +08:00
William Wu 061c383405 phy: rockchip-naneng-combo: config usb3 port in phy init
Rockchip platforms support to force usb3 to usb2 only
via the property "rockchip,dis-u3otg*-port". With this
property, we can disable the usb3 port and select the
clk utmi for the source clk of usb3 controller.

However, during system PM suspend, the related registers
may lost power, so the usb3 port configurations will
lost. This patch initializes the usb3 port in the usb3
phy init, and it doesn't need to configure the usb3 mode
if the property "rockchip,dis-u3otg*-port" is set.

Change-Id: If82cfb9e3e34dc799db32b2b84f843fce2028df5
Signed-off-by: William Wu <william.wu@rock-chips.com>
2022-12-05 15:34:33 +08:00
Frank Wang f07500720b phy: rockchip: usbdp: init flip variable in fixed lane mux case
It should be initialized the USB flip for fixed lane mapping case
if the USB lanes are assigned. The ln0/ln1 is normal (!flip) and ln2/ln3
is reverse (flip).

This also amend "rx cdr lock timeout" log level to notice since it
may not cause the functional defect in most cases.

Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Change-Id: I693f772b87df97581a60f89219ec4dc6cafb79a3
2022-11-30 16:22:03 +08:00
Jianwei Zheng 5df41387b9 phy: rockchip: inno-usb2: fix phy power off causes usb controller abnormal
Usb controller require the clk from phy to work normally. In the
current code, if the dr_mode is set to peripheral and limit to
high speed, there are two cases that usb controller will work
abnormally due to phy power off.

1. The USB cable is not plug in when system start up, at this
time, the otg_sm_work will call rockchip_usb2phy_power_off to
suspend phy. However, if the upper layer uses configfs to operate
the controller after phy power off, controller will work abnormally.

2. Plug in the usb cable and start up the system, the controller
works in peripheral mode and PC recongnize it. IF we unplug the
usb cable, the vbus will not detected, otg_sm_work will also call
rockchip_usb2phy_power_off to suspend phy, when the upper layer
use configfs to operate the controller, phy has been suspended,
controller will work abnormally.

To fix these cases, this patch add a new property "rockchip,dis-u2-
susphy" to avoid phy power off.

Signed-off-by: Jianwei Zheng <jianwei.zheng@rock-chips.com>
Change-Id: I6c9921c8060747667d7bedb2cf76a38a896c05f5
2022-11-28 15:07:09 +08:00
Dan Carpenter 72ea2fc299 phy: stm32: fix an error code in probe
[ Upstream commit ca1c73628f5bd0c1ef6e46073cc3be2450605b06 ]

If "index > usbphyc->nphys" is true then this returns success but it
should return -EINVAL.

Fixes: 94c358da3a ("phy: stm32: add support for STM32 USB PHY Controller (USBPHYC)")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/r/Y0kq8j6S+5nDdMpr@kili
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-11-16 09:57:08 +01:00
Algea Cao 66d9343d63 phy: rockchip-samsung-hdptx-hdmi: FRL 8Gbps * 4 lanes mode use pll cascade mode
Vendor suggest FRL 8G * 4 lanes mode use ROPLL/LCPLL cascade mode.
ROPLL ref clock is from LCPLL.

Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Change-Id: If40f4ec55e44f1e53995cf932c68fa374662d636
2022-11-09 14:34:05 +08:00
Algea Cao d97cce5a64 phy: rockchip-samsung-hdptx-hdmi: LCPLL is also used for low rate frl mode
In RK3588C, 24M clock noise is carried into the PHY ROPLL loop filter.
Due to the low noise frequency, it can pass through the low-pass loop
filter of ROPLL, resulting in hdmi clk jitter test fail.
The loop bandwidth of LCPLL is low, so LCPLL can be used to circumvent
this problem. RK3588 is also suitable for this scheme.

Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Change-Id: I1eafbc3db3daca6b86c97a6682d120f88b71dfa0
2022-11-09 14:34:05 +08:00
Jianwei Fan edfb48bcad phy: rockchip: csi2-dphy: modify to adapt fast reverse camera if CONFIG_VIDEO_REVERSE_IMAGE=y
Signed-off-by: Jianwei Fan <jianwei.fan@rock-chips.com>
Change-Id: I9ce4c20ea056f1b39b2f29e57a55d79331919759
2022-10-28 16:25:50 +08:00
Tao Huang 240a5660d7 phy: rockchip: inno-usb3: Use fallthrough pseudo-keyword
Replace /* fall through */ comment with pseudo-keyword macro fallthrough[1]

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I862e6acd6d9d202131d3cbc7e7fb461a8997a1f2
2022-10-28 16:25:49 +08:00
Dongliang Mu 878f987166 phy: qualcomm: call clk_disable_unprepare in the error handling
[ Upstream commit c3966ced8eb8dc53b6c8d7f97d32cc8a2107d83e ]

Smatch reports the following error:

drivers/phy/qualcomm/phy-qcom-usb-hsic.c:82 qcom_usb_hsic_phy_power_on()
warn: 'uphy->cal_clk' from clk_prepare_enable() not released on lines:
58.
drivers/phy/qualcomm/phy-qcom-usb-hsic.c:82 qcom_usb_hsic_phy_power_on()
warn: 'uphy->cal_sleep_clk' from clk_prepare_enable() not released on
lines: 58.
drivers/phy/qualcomm/phy-qcom-usb-hsic.c:82 qcom_usb_hsic_phy_power_on()
warn: 'uphy->phy_clk' from clk_prepare_enable() not released on lines:
58.

Fix this by calling proper clk_disable_unprepare calls.

Fixes: 0b56e9a7e8 ("phy: Group vendor specific phy drivers")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20220914051334.69282-1-dzm91@hust.edu.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-10-26 13:25:37 +02:00
William Wu d8db0c1fa4 phy: rockchip: inno-usb2: fix phy reset during power on for rk3588
The RK3588 USB2 PHY provides CLK12MOHCI and CLK48MOHCI to
OHCI controllers, and the two clocks are turned off upon
PHY reset, therefore it shouldn't access OHCI Controller
if USB2 PHY in reset. However, during the system PM resume,
the current USB2 PHY power on sequence with PHY reset
operation has potential risk that reset PHY accidentally
when OHCI platform resume access OHCI Controller, and
cause system hung.

The reason is EHCI/OHCI controllers resume ordering on
RK3588. In outline form, the hcd_bus_resume() of EHCI
and the ohci_resume() of OHCI operating concurrently on
different CPUs perform the following actions:

CPU 0                                   CPU 1
----------------------------            ---------------------------------
async_resume()
  usb_resume()
    hcd_bus_resume() -- EHCI
      usb_phy_roothub_resume()
        phy_power_on()
          rockchip_usb2phy_power_on()   ohci_platform_resume()
            rockchip_usb2phy_reset()      ohci_resume()
              assert phy reset              ...
                udelay(10);                 ohci_readl or ohci_writel

This patch fixes USB2 PHY reset during power on for RK3588,
only do USB2 PHY reset for RK3588 USB OTG0 and OTG1, because
their 'common_on_n' bit can be set to 1'b1 (aka REFCLK_LOGIC,
Bias, and PLL blocks are powered down) in PM runtime process.
And keep the 'common_on_n' to 1'b0 for RK3588 USB2 HOST0 and
HOST1, thus we don't need to do PHY reset during power on for
them.

This patch doesn't increase the USB2 PHY power consumption,
because the USB2 HOST0 and HOST1 don't support PM runtime
management, so actually the PHY PLL blocks of USB2 HOST0 and
HOST1 are always powered on.

Signed-off-by: William Wu <william.wu@rock-chips.com>
Change-Id: Ia0121a7c49bef4f0f3a1fb11a810e4ef95b29982
2022-10-12 14:10:15 +08:00
Kever Yang a648efab5e phy: rockchip-naneng-combo: Add ssc support for pcie
Best parameter: 24M T0_1 650mV.

Should co-work with change like below:

&combphy0_ps {
+	rockchip,enable-ssc;
+       assigned-clock-rates = <24000000>;
        status = "okay";
};

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Change-Id: I863b8d1758431c0037332e7da1b2c64cd7113573
2022-09-22 18:49:19 +08:00
Jianwei Zheng adc69507ac phy: rockchip: inno-usb2: fix miss line irq for rk3588
RK3588 platform may miss line irq if the line state is not in
SE0(D+ low, D- low) before usb controller call phy init function
and enable line irq.

To resolve this, when usb controller call phy init function, we
can clear host_disconnect state if the line state is not in SE0
which means there is an usb device connected to the port.

Signed-off-by: Jianwei Zheng <jianwei.zheng@rock-chips.com>
Change-Id: Icb3f1abd790f16ddd66bbc098e0c06cc5d922d86
2022-09-08 21:04:31 +08:00
Yifeng Zhao 2f5fe2c0bb phy: rockchip: naneng-combophy: config sata2 rate to 6G for rk3588
Fixes: 1a6396458b ("phy: rockchip: naneng-combphy: add support rk3588")
Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
Change-Id: I9ca63ea12d1b08e8aac5ecb439b4ee1516f11768
2022-09-05 17:09:11 +08:00