linux/drivers/phy/samsung
André Draszik 32267c29bc phy: exynos5-usbdrd: support Exynos USBDRD 3.1 combo phy (HS & SS)
Add support for the Exynos USB 3.1 DRD combo phy, as found in Exynos 9
SoCs like Google GS101. It supports USB SS, HS and DisplayPort.

In terms of UTMI+, this is very similar to the existing Exynos850
support in this driver. The difference is that this combo phy supports
both UTMI+ (HS) and PIPE3 (SS). It also supports DP alt mode.

The number of ports for UTMI+ and PIPE3 can be determined using the
LINKPORT register (which also exists on Exynos E850).

For SuperSpeed (SS) a new SS phy is in use and its PIPE3 interface is
new compared to Exynos E850, and also very different from the existing
support for older Exynos SoCs in this driver.

The SS phy needs a bit more configuration work and register tuning for
signal quality to work reliably, presumably due to the higher
frequency, e.g. to account for different board layouts. Additionally,
power needs to be enabled before writing to the SS phy registers.

This commit adds the necessary changes for USB HS and SS to work.
DisplayPort is out of scope in this commit.

Notes:
* For the register tuning, exynos5_usbdrd_apply_phy_tunes() has been
  added with the appropriate data structures to support tuning at
  various stages during initialisation. Since these are hardware
  specific, the platform data is supposed to be populated accordingly.
  The implementation is loosely modelled after the Samsung UFS PHY
  driver.

  There is one tuning state for UTMI+, PTS_UTMI_POSTINIT, to execute
  after init and generally intended for HS signal tuning, as done in
  this commit.

  PTS_PIPE3_PREINIT PTS_PIPE3_INIT PTS_PIPE3_POSTINIT
  PTS_PIPE3_POSTLOCK are tuning states for PIPE3. In the downstream
  driver, preinit differs by Exynos SoC, and postinit and postlock
  are different per board. The latter haven't been implemented for
  gs101 here, because downstream doesn't use them on gs101 either.

* Signal lock acquisition for SS depends on the orientation of the
  USB-C plug. Since there currently is no infrastructure to chain
  connector events to both the USB DWC3 driver and this phy driver, a
  work-around has been added in
  exynos5_usbdrd_usbdp_g2_v4_pma_check_cdr_lock() to check both
  registers if it failed in one of the orientations.

* Equally, we can only establish SS speed in one of the connector
  orientations due to programming differences when selecting the lane
  mux in exynos5_usbdrd_usbdp_g2_v4_pma_lane_mux_sel(), which really
  needs to be dynamic, based on the orientation of the connector.

* As is, we can establish a HS link using any cable, and an SS link in
  one orientation of the plug, falling back to HS if the orientation is
  reversed to the expectation.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
Reviewed-by: Peter Griffin <peter.griffin@linaro.org>
Tested-by: Peter Griffin <peter.griffin@linaro.org>
Tested-by: Will McVicker <willmcvicker@google.com>
Link: https://lore.kernel.org/r/20240617-usb-phy-gs101-v3-6-b66de9ae7424@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2024-07-02 18:52:05 +05:30
..
Kconfig phy: Revert "phy: Remove SOC_EXYNOS4212 dep. from PHY_EXYNOS4X12_USB" 2023-05-16 19:38:39 +05:30
Makefile phy: samsung-ufs: ufs: Add support for gs101 UFS phy tuning 2024-04-06 14:27:17 +05:30
phy-exynos4x12-usb2.c
phy-exynos5-usbdrd.c phy: exynos5-usbdrd: support Exynos USBDRD 3.1 combo phy (HS & SS) 2024-07-02 18:52:05 +05:30
phy-exynos7-ufs.c phy: samsung-ufs: ufs: Add SoC callbacks for calibration and clk data recovery 2024-04-06 14:27:17 +05:30
phy-exynos4210-usb2.c
phy-exynos5250-sata.c phy: samsung: exynos5250-sata: fix missing device put in probe error paths 2022-04-11 22:47:42 +05:30
phy-exynos5250-usb2.c phy: Fix the cacography in phy-exynos5250-usb2.c 2024-07-02 18:41:23 +05:30
phy-exynos-dp-video.c phy: Explicitly include correct DT includes 2023-07-17 11:52:56 +05:30
phy-exynos-mipi-video.c phy: constify of_phandle_args in xlate 2024-02-23 17:43:14 +05:30
phy-exynos-pcie.c phy: samsung: phy-exynos-pcie: sanitize init/power_on callbacks 2022-08-01 15:25:12 -05:00
phy-exynosautov9-ufs.c phy: samsung-ufs: ufs: Add SoC callbacks for calibration and clk data recovery 2024-04-06 14:27:17 +05:30
phy-fsd-ufs.c phy: samsung-ufs: ufs: Add SoC callbacks for calibration and clk data recovery 2024-04-06 14:27:17 +05:30
phy-gs101-ufs.c phy: samsung-ufs: ufs: Add support for gs101 UFS phy tuning 2024-04-06 14:27:17 +05:30
phy-s5pv210-usb2.c
phy-samsung-ufs.c phy: samsung-ufs: ufs: exit on first reported error 2024-05-04 17:24:28 +05:30
phy-samsung-ufs.h phy: samsung-ufs: ufs: Add support for gs101 UFS phy tuning 2024-04-06 14:27:17 +05:30
phy-samsung-usb2.c phy: constify of_phandle_args in xlate 2024-02-23 17:43:14 +05:30
phy-samsung-usb2.h