Commit Graph

1108 Commits

Author SHA1 Message Date
William Wu
c03b975591 phy: rockchip: inno-usb2: fix charger detection error
We found a charger detection error on RK3566 Tablet.

1. Plug in a Type-C to Type-A cable and connect to PC USB Host
   or USB charger, then the charger detection is normal.

2. Plug out the cable, then the charger disconnection detection
   is normal.

3. Plug in a Type-C to Type-A receptacle and plug out again. Then
   the charger is detected unexpectedly.

To fix this issue, reinitialize the cable state of USB charger to
EXTCON_NONE when USB charger is disconnected.

Signed-off-by: William Wu <william.wu@rock-chips.com>
Change-Id: Ic56e4ee865af129c222f4c90c3d6e753f4e785bd
2021-02-25 11:09:13 +08:00
David Wu
cabce2b042 phy: rockchip: naneng-combphy: Force to select mode from GRF for SGMII/QSGMII
Because phy1 is sata mode by default, and phy2 is pcie mode by default, when using qsgmii on phy1, it needs to be configured as pcie mode, because pcie mode is compatible with K28.1 and K28.5, while sata only has K28.5. If phy1 is in sata mode, qsgmii will not work, and both K codes need to be used at the same time. Based on this, we unified configuration into pcie mode.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I4a9e5a2cdcee448ec3457778bf4ee7135be70087
2021-02-23 09:52:10 +08:00
Shawn Lin
f28451cf39 phy: rockchip: naneng-combphy: Add ssc enable option from firmware
Change-Id: I0f620b6ff000ff4e7b9bc997ca2c30c14d3f8cde
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-02-08 11:40:01 +08:00
Shawn Lin
179638095d phy: rockchip: naneng-combphy: Adjust 100M refclk parameter for PCIe
Change-Id: I94321c0b6bb64cff279b79c44b54f273ee52c897
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-02-08 11:40:01 +08:00
William Wu
02a2f92e90 phy: rockchip: inno-usb2: delay power off phy when unplug otg host
If the OTG work in Host mode, delay power off phy in OTG_STATE_B_IDLE
state when unplug OTG cable, this can fix the xHCI deregistered error
with the following log on RK356x platforms:

[   16.856295] xhci-hcd xhci-hcd.5.auto: remove, state 4
[   16.856340] usb usb8: USB disconnect, device number 1
[   16.857778] xhci-hcd xhci-hcd.5.auto: USB bus 8 deregistered
[   16.858108] xhci-hcd xhci-hcd.5.auto: remove, state 4
[   16.858146] usb usb7: USB disconnect, device number 1
[   16.878109] xhci-hcd xhci-hcd.5.auto: Host halt failed, -110
[   16.878151] xhci-hcd xhci-hcd.5.auto: Host controller not halted, aborting reset.
[   16.878853] xhci-hcd xhci-hcd.5.auto: USB bus 7 deregistered

Change-Id: I4467afdd3fe20839a9ec967624868ce3773e048c
Signed-off-by: William Wu <william.wu@rock-chips.com>
2021-02-02 17:56:46 +08:00
William Wu
bc2fd405a7 phy: rockchip: inno-usb2: set bvalid and id filter time for rk356x
This patch sets the bvalid and id filter time to 10ms for rk356x
USB 2.0 PHY0 which is used for OTG. The filter count is base on
the USB 2.0 PHY GRF pclk 100MHz.

With this patch, it can avoid trigger the bvalid rising edge irq
when unplug the OTG cable.

Change-Id: I95794510921e6c065f4ec1102ab6c1f35994bf42
Signed-off-by: William Wu <william.wu@rock-chips.com>
2021-02-02 17:56:46 +08:00
Ren Jianing
ec70606fce phy: phy-core: remove mutex lock for rockchip rv1126-usb2phy calibrate
For RV1126, phy_calibrate will run in dwc3 reset irq function and lead
to dead lock. Besides, there is no critical area resources. So we should
remove mutex lock in phy calibrate for Rockchip platform.

Signed-off-by: Ren Jianing <jianing.ren@rock-chips.com>
Change-Id: Ic205959d96e7a6831aa9426738c1fd06deee1a22
2021-01-28 20:23:51 +08:00
Allon Huang
dd29de10cd Revert "phy: rockchip: mipi-rx: support rk3568 mipi dphy rx"
This reverts commit 9cb5128ee0.

Replaced by commit 118103 and 118606:
e0e682453e ("phy: rockchip: add rk3568 mipi dphy hw driver")
a9e17370bb ("phy: rockchip: csi2-dphy: add mipi dphy dual mode driver for rk3568")

Signed-off-by: Allon Huang <allon.huang@rock-chips.com>
Change-Id: I3a8f70860c859724199197b9aa10d75565cb6c5e
2021-01-28 14:10:49 +08:00
Shawn Lin
d7c0bd4acd phy: phy-rockchip-snps-pcie3: Remove unused reset signal
We have move p30x1 and p30x2 reset signal to corresponding
controller drivers. So we need to remove them in PHY driver
in order not to add misleading debug message.

Change-Id: I5f180bf51a449ce2db6c49f937d3898a61d7c4d9
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-01-26 14:09:04 +08:00
Allon Huang
a9e17370bb phy: rockchip: csi2-dphy: add mipi dphy dual mode driver for rk3568
divide rk3568 mipi csi2 dphy dev into three logic dev:
dphy0 for full mode, dphy1 and dphy2 for split mode

Signed-off-by: Allon Huang <allon.huang@rock-chips.com>
Change-Id: Icd4b282b72aa90ca7acd2e02625ae56830c3b12a
2021-01-22 20:12:58 +08:00
Allon Huang
e0e682453e phy: rockchip: add rk3568 mipi dphy hw driver
Signed-off-by: Allon Huang <allon.huang@rock-chips.com>
Change-Id: I6afabfa78abe3202b308e8a4cfd547761bc2a6be
2021-01-22 20:12:58 +08:00
David Wu
6f8089df70 phy: rockchip: naneng-combphy: Add SGMII/QSGMII mode support
Change-Id: I56f30af84b8a2c2207a1c61afa1638736705d1f8
Signed-off-by: David Wu <david.wu@rock-chips.com>
2021-01-06 10:14:41 +08:00
David Wu
8768a53391 phy: rockchip: naneng-combphy: Sort rockchip_combphy_grfcfg struct member by register
Change-Id: I3c0593574a442c4de460ff3b0dde651a7fcae901
Signed-off-by: David Wu <david.wu@rock-chips.com>
2021-01-06 10:14:41 +08:00
Tao Huang
5647c1d492 Merge tag 'ASB-2020-12-05_4.19-stable' of https://android.googlesource.com/kernel/common
https://source.android.com/security/bulletin/2020-12-01
CVE-2020-0444
CVE-2020-0465
CVE-2020-0466

* tag 'ASB-2020-12-05_4.19-stable': (636 commits)
  ANDROID: kbuild: use grep -F instead of fgrep
  ANDROID: GKI: usb: gadget: support claiming indexed endpoints by name
  UPSTREAM: arm64: sysreg: Clean up instructions for modifying PSTATE fields
  Revert "Revert "ANDROID: clang: update to 11.0.5""
  ANDROID: kbuild: speed up ksym_dep_filter
  Revert "drm/atomic_helper: Stop modesets on unregistered connectors harder"
  Linux 4.19.161
  USB: core: Fix regression in Hercules audio card
  x86/resctrl: Add necessary kernfs_put() calls to prevent refcount leak
  x86/resctrl: Remove superfluous kernfs_get() calls to prevent refcount leak
  x86/speculation: Fix prctl() when spectre_v2_user={seccomp,prctl},ibpb
  usb: gadget: Fix memleak in gadgetfs_fill_super
  USB: quirks: Add USB_QUIRK_DISCONNECT_SUSPEND quirk for Lenovo A630Z TIO built-in usb-audio card
  usb: gadget: f_midi: Fix memleak in f_midi_alloc
  USB: core: Change %pK for __user pointers to %px
  perf probe: Fix to die_entrypc() returns error correctly
  can: m_can: fix nominal bitiming tseg2 min for version >= 3.1
  platform/x86: toshiba_acpi: Fix the wrong variable assignment
  platform/x86: thinkpad_acpi: Send tablet mode switch at wakeup time
  can: gs_usb: fix endianess problem with candleLight firmware
  ...

Change-Id: I82ccfc3d6561d3ef3b1b06ac98d48fac997c8fb6

Conflicts:
	drivers/pinctrl/pinctrl-rockchip.c
	drivers/usb/dwc3/gadget.c
	drivers/usb/host/xhci.c
	drivers/usb/host/xhci.h
2020-12-29 16:10:48 +08:00
William Wu
b8c2578c5a phy: rockchip: naneng-combphy: check status after deassert phy rst
Check the phy status after deassert phy reset for USB 3.0
mode, and wait at most 1ms for phy ready. If wait for phy
status ready timeout, just print warning log and continue
phy init for the time being.

Change-Id: I2677679a99153cf9ee0a043ab6cfb56d9e8dfdf2
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-12-28 16:55:31 +08:00
Shawn Lin
b3f78165e5 phy: rockchip: naneng-combphy: Reset phy if not being used
Change-Id: Ia62481ebf5aa5684c359fd00a3933bb02e2caaff
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2020-12-28 09:36:01 +08:00
Allon Huang
9cb5128ee0 phy: rockchip: mipi-rx: support rk3568 mipi dphy rx
Signed-off-by: Allon Huang <allon.huang@rock-chips.com>
Change-Id: I47dd414b518f8b79f60c36fe47223cc636ed774d
2020-12-24 16:15:39 +08:00
Shawn Lin
f43f195636 phy: rockchip: naneng-combphy: Adjust PCIe signal
Set SSC downward spread spectrum for PCIe and set proper
RMJ for inner 100M and external 100M refclk.

Change-Id: Ic7d9d1651f7687858e6c5e399bc98ee03b5ee964
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2020-12-18 17:31:19 +08:00
William Wu
c9faa14df7 phy: rockchip: naneng-combphy: add new func for parse dt
This patch adds a new function rockchip_combphy_parse_dt()
to parse devicetree for combphy, and get reset properties
for later reset control.

Change-Id: I41821ec9c99a866b04c4514f0fbca55d118b7175
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-12-16 15:23:35 +08:00
Ren Jianing
c13a49d1f7 phy: rockchip-naneng-usb2: support to force otg mode
This patch creates an usb2 phy attribute group and
provides an attribute "otg_mode" for otg port to
force otg mode independently of the voltage of otg
id pin.

In order to implement the force mode function, we can
select otg plug indicator output (AKA iddig) from GRF,
and set GRF USB otg plug indicator to "0" or "1" to
control iddig status.

Attention, we set iddig to "0" by disable idpullup rather
than set GRF, the otg_suspendm will be set to 1 to enable
the disconnect detection module, and the LS_PAR_EN will be
set to 1 to enable low speed device enumerate.

Usage:
[1] Force host mode
echo host > /sys/devices/platform/<u2phy dev name>/otg_mode

[2] Force peripheral mode
echo peripheral > /sys/devices/platform/<u2phy dev name>/otg_mode

[3] Force otg mode
echo otg > /sys/devices/platform/<u2phy dev name>/otg_mode

For RV1109 and RV1126 EVB, the <u2phy dev name> is ff4c0000.usb2-phy.

Change-Id: Icba5e4a3d2aae6cd1df5435d64fd0caea4348ec2
Signed-off-by: Ren Jianing <jianing.ren@rock-chips.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-12-15 18:55:41 +08:00
Wyon Bi
fcfe49fdb3 phy/rockchip: naneng-edp: Add delay after release aux_idle
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
Change-Id: Id82b2983c174f8d99c686af61586c731a9ec91f9
2020-12-14 17:56:32 +08:00
William Wu
4244fc70bb phy: rockchip: inno-usb2: select bvalid of phy for otg port
Since RK356x, the USB PHY GRF adds new registers to select
bvalid from USB PHY or GRF. And in RK356x Maskrom USB driver,
it selects the bvalid from GRF and sets the bvalid value to 1,
it aims to improve the compatibility of various USB circuits
for Maskrom USB. However, the charger detection and USB PHY
power consumption control depends on the bvalid of USB PHY.
So this patch selects bvalid from USB PHY for otg port.

Change-Id: I3fc9faf06f30e0a3390bc4fd40c732fb856131f8
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-12-11 14:35:48 +08:00
Shawn Lin
c07bd0ba5e phy: rockchip: naneng-combphy: Add external refclk support
Change-Id: Iac968aa7ffd862533c7ca76dea82e083e957345c
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2020-12-08 20:40:46 +08:00
William Wu
f028645555 phy: rockchip: inno-usb2: fix force mode for rk3568 otg
This patch adds a new vbus_detect helper function to control
the vbus voltage level detection for rk3568 otg port. And
fix the issue that the bvalid irq status and id irq status
are not handled in the rockchip_usb2phy_irq() for otg host
mode when force mode via the sys interface "otg_mode".

Change-Id: I75a102034e8dd3ad47de67da4e5120e28564368e
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-12-08 20:40:46 +08:00
Shawn Lin
9dc5ea5543 phy: rockchip: naneng-combphy: Fix support for pipe clock settings
pipe clock settings were done before PCIe's and SATA's catch-all
pipe settings. So it would be covered by con1_for_pcie and
con1_for_sata. Fix this by moving pipe clock settings to the end.

Change-Id: I19a8943b6a99d8e4ef198345ec3f62bdac491c58
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2020-12-03 17:03:53 +08:00
Wyon Bi
06e3c4c550 phy/rockchip: naneng-edp: Update for Compliance Test Pass
Change AUX amplitude level to 300mV.

Fixes: 6110f21e08 ("phy/rockchip: naneng-edp: Update for Compliance Test Pass")
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
Change-Id: I7a38407eb7d54389f3648f523616c7027c221545
2020-12-03 02:32:38 +00:00
Marc Zyngier
ce744a898e phy: tegra: xusb: Fix dangling pointer on probe failure
[ Upstream commit eb9c4dd9bd ]

If, for some reason, the xusb PHY fails to probe, it leaves
a dangling pointer attached to the platform device structure.

This would normally be harmless, but the Tegra XHCI driver then
goes and extract that pointer from the PHY device. Things go
downhill from there:

    8.752082] [004d554e5145533c] address between user and kernel address ranges
[    8.752085] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[    8.752088] Modules linked in: max77620_regulator(E+) xhci_tegra(E+) sdhci_tegra(E+) xhci_hcd(E) sdhci_pltfm(E) cqhci(E) fixed(E) usbcore(E) scsi_mod(E) sdhci(E) host1x(E+)
[    8.752103] CPU: 4 PID: 158 Comm: systemd-udevd Tainted: G S      W   E     5.9.0-rc7-00298-gf6337624c4fe #1980
[    8.752105] Hardware name: NVIDIA Jetson TX2 Developer Kit (DT)
[    8.752108] pstate: 20000005 (nzCv daif -PAN -UAO BTYPE=--)
[    8.752115] pc : kobject_put+0x1c/0x21c
[    8.752120] lr : put_device+0x20/0x30
[    8.752121] sp : ffffffc012eb3840
[    8.752122] x29: ffffffc012eb3840 x28: ffffffc010e82638
[    8.752125] x27: ffffffc008d56440 x26: 0000000000000000
[    8.752128] x25: ffffff81eb508200 x24: 0000000000000000
[    8.752130] x23: ffffff81eb538800 x22: 0000000000000000
[    8.752132] x21: 00000000fffffdfb x20: ffffff81eb538810
[    8.752134] x19: 3d4d554e51455300 x18: 0000000000000020
[    8.752136] x17: ffffffc008d00270 x16: ffffffc008d00c94
[    8.752138] x15: 0000000000000004 x14: ffffff81ebd4ae90
[    8.752140] x13: 0000000000000000 x12: ffffff81eb86a4e8
[    8.752142] x11: ffffff81eb86a480 x10: ffffff81eb862fea
[    8.752144] x9 : ffffffc01055fb28 x8 : ffffff81eb86a4a8
[    8.752146] x7 : 0000000000000001 x6 : 0000000000000001
[    8.752148] x5 : ffffff81dff8bc38 x4 : 0000000000000000
[    8.752150] x3 : 0000000000000001 x2 : 0000000000000001
[    8.752152] x1 : 0000000000000002 x0 : 3d4d554e51455300
[    8.752155] Call trace:
[    8.752157]  kobject_put+0x1c/0x21c
[    8.752160]  put_device+0x20/0x30
[    8.752164]  tegra_xusb_padctl_put+0x24/0x3c
[    8.752170]  tegra_xusb_probe+0x8b0/0xd10 [xhci_tegra]
[    8.752174]  platform_drv_probe+0x60/0xb4
[    8.752176]  really_probe+0xf0/0x504
[    8.752179]  driver_probe_device+0x100/0x170
[    8.752181]  device_driver_attach+0xcc/0xd4
[    8.752183]  __driver_attach+0xb0/0x17c
[    8.752185]  bus_for_each_dev+0x7c/0xd4
[    8.752187]  driver_attach+0x30/0x3c
[    8.752189]  bus_add_driver+0x154/0x250
[    8.752191]  driver_register+0x84/0x140
[    8.752193]  __platform_driver_register+0x54/0x60
[    8.752197]  tegra_xusb_init+0x40/0x1000 [xhci_tegra]
[    8.752201]  do_one_initcall+0x54/0x2d0
[    8.752205]  do_init_module+0x68/0x29c
[    8.752207]  load_module+0x2178/0x26c0
[    8.752209]  __do_sys_finit_module+0xb0/0x120
[    8.752211]  __arm64_sys_finit_module+0x2c/0x40
[    8.752215]  el0_svc_common.constprop.0+0x80/0x240
[    8.752218]  do_el0_svc+0x30/0xa0
[    8.752220]  el0_svc+0x18/0x50
[    8.752223]  el0_sync_handler+0x90/0x318
[    8.752225]  el0_sync+0x158/0x180
[    8.752230] Code: a9bd7bfd 910003fd a90153f3 aa0003f3 (3940f000)
[    8.752232] ---[ end trace 90f6c89d62d85ff5 ]---

Reset the pointer on probe failure fixes the issue.

Fixes: 53d2a715c2 ("phy: Add Tegra XUSB pad controller support")
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20201013095820.311376-1-maz@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-12-02 08:48:10 +01:00
Wyon Bi
6110f21e08 phy/rockchip: naneng-edp: Update for Compliance Test Pass
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
Change-Id: Ia3366c6a6c97cd77222a7df55b74d731719e74c3
2020-12-01 09:11:31 +08:00
Yifeng Zhao
0195546e0d phy: rockchip: naneng-combphy: enable rx adpt for SATA
Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
Change-Id: I185e99e571331b8199d2eaacbd3c67bbb58bfcac
2020-11-30 18:41:13 +08:00
William Wu
d67dccc128 phy: rockchip: naneng-combphy: add pipe clk for rk3568
The pipe clk of rk3568 is used for PIPE_GRF module, we
need to manage this clk so that the USB IP can access
the registers of PIPE_GRF.

Change-Id: I9ebfd5d25bdf1e95a9c5a3390b1030aed5f5c7ba
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-11-26 16:41:21 +08:00
William Wu
70192edddf phy: rockchip: naneng-combphy: support to disable u3 port
This patch support to disable u3 root port for USB3.0 controller
if needed. Such as RK3568 EVB6 USB3.0 OTG1 xHCI controller, it
only used USB2.0 PHY, so we need to disable u3 port by set the
xHCI u3 port number to zero and select the clk_usb3otg0_utmi for
source clk at the same time.

Change-Id: I4aee7cc0d2947e478ff7437e47e329411e67297c
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-11-25 14:13:53 +08:00
Sandy Huang
71e3638c0f phy/rockchip: inno-video-combo-phy: update for rk356x
Change-Id: Id19e3c13350d9d393f053901fd1252b2807a56be
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2020-11-23 16:23:44 +08:00
William Wu
bdd14d77f9 phy: rockchip: inno-usb2: fix suspend control for rk3568 phy0 host port
RK3568 USB2.0 PHY0 Host port is used for USB3.0 Host interface.
When USB3.0 Host controller is working at super speed, it may
still need the USB2.0 PHY0 to work in normal mode and get clks
from the PHY0. So we select PHY suspend control from USB3.O
Host controller utmi interface.

Change-Id: I66df057e200d04f66082257d26120764c54af3cf
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-11-23 09:52:12 +08:00
William Wu
da93f3c37a phy: rockchip: naneng-combphy: enable adaptive CTLE for RK3568 USB3.0
This patch enable the adaptive Continuous Time Linear Equalizer (CTLE)
for RK3568 USB3.0 to improve compatibility.

Change-Id: I04d3077e37f15a8d41df875b8d84dc7e6c8aeda9
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-11-19 14:20:53 +08:00
Ren Jianing
90e983fe31 phy: rockchip: inno-usb2: add tuning function for rk3568
We turn off the differential reciver in suspend mode, which can
save about 300uA at AVCC_1V8 in suspend mode.

Signed-off-by: Ren Jianing <jianing.ren@rock-chips.com>
Change-Id: Ic9f2b931d7ee3fc687d8bb3f3e9dfe2d966c6542
2020-11-19 10:15:07 +08:00
Shawn Lin
266ef3dda3 phy: rockchip: naneng-combphy: Add RMJ control for PCIe
Change-Id: Iaf2d8fab379aa77dc127778b3943000b0e4bf2a6
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2020-11-18 10:27:08 +08:00
Ren Jianing
fe9e64f566 phy: rockchip: naneng-combphy: improve phy init for rk3568
1. Add clks enable and disable control.
2. Do PCIe/USB3/SATA phy init in their own helper.
3. Select ref clk according to ref clk rate for RK3568
4. Set SSC clk rate and SSC derection for the USB3 of RK3568.

Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Ren Jianing <jianing.ren@rock-chips.com>
Change-Id: If2959147cfe9f799c88c31ef7cefbccc872a3bf4
2020-11-18 09:58:19 +08:00
Ziyuan Xu
0f8f894bb7 phy: phy-rockchip-naneng-usb2: update USB_DCP state if cable plug-out
The *USB_DCP* should be updated when the cable plug out from dedicated
charging port. As a result, the charger could set the charging current
by *EXTCON_CHG_USB_DCP*.

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Change-Id: I478e584552a627de928378c6da1e6392a8fb04c4
2020-11-16 16:30:00 +08:00
Yifeng Zhao
c258c68ce6 phy: rockchip: naneng-combphy: Add sata configs for CON0~3 regs
Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
Change-Id: Id91eb780cbe43cf58862c20a1d8c51b7dc4b39f7
2020-11-13 09:45:34 +08:00
Shawn Lin
eabde4b76f phy: phy-rockchip-snps-pcie3: Fix PMA output clamp mode
PMA output clamp mode should be configured.

Change-Id: I3f622d8dbde00b7f91caf9ba1c3868d6f9ad8d3e
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2020-11-12 19:06:35 +08:00
Shawn Lin
83294f1897 phy: rockchip: naneng-combphy: Add pcie configs for CON0~3 regs
Change-Id: I2ac42b888c4de9e373c9de91e5cdb1d2c18cc3c2
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2020-11-12 19:06:35 +08:00
William Wu
096abe6464 phy: rockchip: naneng-combphy: select pipe to controller for rk3568
RK3568 has three combo phys, and PCIe/USB3/SATA/QSGMII controllers
share one pipe interface for each combo phy, here is the diagram of
the complex connection. This patch select the pipe to the corresponding
controller when set phy mode.

+----------------+
|                |     +------+
| USB3 OTG CTRL0 |---->|      |
|                |     |      |     +------------+
+----------------+     | PIPE |     |            |
                       | MUX  |---->| Combo PHY0 |
+----------------+     |      |     |            |
|                |     |      |     +------------+
|   SATA CTRL0   |---->|      |
|                |     +------+
+----------------+

+----------------+
|                |     +------+
| USB3 HOST CTRL1|---->|      |
|                |     |      |     +------------+
+----------------+     | PIPE |     |            |
                       | MUX  |---->| Combo PHY1 |
+----------------+     |      |     |            |
|                |---->|      |     +------------+
|   SATA CTRL1   |  -->|      |
|                |  |  +------+
+----------------+  |
                    |
+----------------+  |
|                |  |  +------+
|  QSGMII CTRL   |---->|      |
|                |     |      |     +------------+
+----------------+     | PIPE |     |            |
                       | MUX  |---->| Combo PHY2 |
+----------------+     |      |     |            |
|                |---->|      |     +------------+
|   SATA CTRL2   |  -->|      |
|                |  |  +------+
+----------------+  |
                    |
+----------------+  |
|                |  |
|  PCIe2 1-Lane  |---
|                |
+----------------+

Change-Id: I6ec6dd0a0202119633e594c9a72f361156330b06
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-11-11 22:06:40 +08:00
Ren Jianing
b9d9feb075 phy: rockchip: inno-usb2: fix some issues for rk3568 usb2 phy
This patch fixes the following issues for rk3568 usb2 phy.

1. Set utmi opmode to normal mode for rk3568 usb phy when usb
   phy enter suspend mode via usb phy grf. It can help to avoid
   the DM/DP floating and the line state be detected as 2'b11.

2. Fix the offset of INT_STATUS_CLR. It can help to avoid
   triggering the linestate irq constantly.

Signed-off-by: Ren Jianing <jianing.ren@rock-chips.com>
Change-Id: Iba53e416c44a45baa180ad3abcc91d1d71900158
2020-11-11 21:58:10 +08:00
William Wu
62f5258931 phy: rockchip: naneng-combphy: fix mode set for usb3
This patch select pipe_txcompliance and pipe_l0_txelecidle
from usb3 controller for usb3 mode.

Change-Id: I6d354a974e431079e0f11fe84b75df583125818b
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-11-11 10:51:31 +08:00
William Wu
a7f0b9fde1 phy: rockchip: inno-usb2: fix some issues for rk3568 usb2 phy
This patch fixes the following issues for rk3568 usb2 phy.

1. Only enable the id irq and bvalid irq for the port of combphy
   which used shared interrupt and work as otg/peripheral mode.

2. Enable the DP/DM pulldown resistors for the port of combphy
   if the port is used for usb host controller.

3. Set utmi opmode to no-driving for rk3568 usb phy when usb
   phy enter suspend mode via usb phy grf. It can help to
   avoid triggering the linestate irq constantly.

Change-Id: I3efe964c79865bef8ba70047f2ee20c59901ca6c
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-11-10 19:47:00 +08:00
Wyon Bi
40a5f5d476 phy/rockchip: Add driver for Rockchip Naneng eDP Transmitter PHY
DPTPHYT22ULP is designed for chips that perform eDP/DP data
communication while operating at low power consumption.
The main link is a multi-gigabit transmitter macro which
enable speed up to 4.0Gbps data transmitter with optimized
power and die size, also it can be easily fabricated and
implemented in a video system. The AUX channel is a halfduplex,
bidirectional channel consisting of one differential pair,
supporting the bit rate of about 1Mbps.

Macro consists of multi-main link transmitter channels,
AUX channel, one PLL and bias-gen unit. The main link
transmitter performs dedicated P2S, clock generator,
driver with preemphasis and self-test. Each of the channels
can be turned off individually.

Change-Id: Idf58991ff1bdd4557c4cfadf2dc047e95eca7668
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2020-11-10 14:17:57 +08:00
Maxime Ripard
01503fa839 UPSTREAM: phy: Add configuration interface
The phy framework is only allowing to configure the power state of the PHY
using the init and power_on hooks, and their power_off and exit
counterparts.

While it works for most, simple, PHYs supported so far, some more advanced
PHYs need some configuration depending on runtime parameters. These PHYs
have been supported by a number of means already, often by using ad-hoc
drivers in their consumer drivers.

That doesn't work too well however, when a consumer device needs to deal
with multiple PHYs, or when multiple consumers need to deal with the same
PHY (a DSI driver and a CSI driver for example).

So we'll add a new interface, through two funtions, phy_validate and
phy_configure. The first one will allow to check that a current
configuration, for a given mode, is applicable. It will also allow the PHY
driver to tune the settings given as parameters as it sees fit.

phy_configure will actually apply that configuration in the phy itself.

Change-Id: I252cb7733740a28728e9ff228cba9a6b407b1b07
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
(cherry picked from commit aeaac93ddb)
2020-11-10 12:53:05 +08:00
William Wu
4a9087f17c phy: rockchip: naneng-combphy: refactor the combphy_reg and ops
This patch refactor the combphy_reg so that we can init
PCIe/USB3.0/SATA/QSGMII separately.

Change-Id: I8febce777a5b29948acdb66a1640245983cfe6cd
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-11-09 09:58:09 +08:00
Sandy Huang
f64bc11207 phy/rockchip: inno-video-combo-phy: add support rk3568 lvds
Change-Id: I0021eec263aa6436f7e2055a3a361cc2728fd858
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2020-11-04 16:07:50 +08:00
William Wu
a7e892c783 phy: rockchip: inno-combphy: remove redundant param_exped
The function param_read() and param_exped() do the same thing,
so this patch uses the more general param_read() instead of
the param_exped(), and delete the param_exped() directly.

Change-Id: Ic097069c28a717ff5f70ceaa36a22ea1bd26b76f
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-11-04 11:52:51 +08:00