Commit 57e920b9 authored by Alex Elder's avatar Alex Elder Committed by Vinod Koul
Browse files

phy: spacemit: Introduce PCIe/combo PHY



Introduce a driver that supports three PHYs found on the SpacemiT
K1 SoC.  The first PHY is a combo PHY that can be configured for
use for either USB 3 or PCIe.  The other two PHYs support PCIe
only.

All three PHYs must be programmed with an 8 bit receiver termination
value, which must be determined dynamically.  Only the combo PHY is
able to determine this value.  The combo PHY performs a special
calibration step at probe time to discover this, and that value is
used to program each PHY that operates in PCIe mode.  The combo
PHY must therefore be probed before either of the PCIe-only PHYs
will be used.

Each PHY has an internal PLL driven from an external oscillator.
This PLL started when the PHY is first initialized, and stays
on thereafter.

During normal operation, the USB or PCIe driver using the PHY must
ensure (other) clocks and resets are set up properly.

However PCIe mode clocks are enabled and resets are de-asserted
temporarily by this driver to perform the calibration step on the
combo PHY.

Tested-by: default avatarJunzhong Pan <panjunzhong@linux.spacemit.com>
Signed-off-by: default avatarAlex Elder <elder@riscstar.com>
Reviewed-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/all/ba532f8d-a452-40e5-af46-b58b89f70a92@linaro.org/

 [1]
Tested-by: default avatarYixun Lan <dlan@gentoo.org>
Link: https://patch.msgid.link/20251218151235.454997-4-elder@riscstar.com


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 326a278a
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -101,6 +101,17 @@ config PHY_NXP_PTN3222
	  schemes. It supports all three USB 2.0 data rates: Low Speed, Full
	  Speed and High Speed.

config PHY_SPACEMIT_K1_PCIE
	tristate "PCIe and combo PHY driver for the SpacemiT K1 SoC"
	depends on ARCH_SPACEMIT || COMPILE_TEST
	depends on HAS_IOMEM
	depends on OF
	select GENERIC_PHY
	default ARCH_SPACEMIT
	help
	  Enable support for the PCIe and USB 3 combo PHY and two
	  PCIe-only PHYs used in the SpacemiT K1 SoC.

source "drivers/phy/allwinner/Kconfig"
source "drivers/phy/amlogic/Kconfig"
source "drivers/phy/broadcom/Kconfig"
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ obj-$(CONFIG_PHY_SNPS_EUSB2) += phy-snps-eusb2.o
obj-$(CONFIG_USB_LGM_PHY)		+= phy-lgm-usb.o
obj-$(CONFIG_PHY_AIROHA_PCIE)		+= phy-airoha-pcie.o
obj-$(CONFIG_PHY_NXP_PTN3222)		+= phy-nxp-ptn3222.o
obj-$(CONFIG_PHY_SPACEMIT_K1_PCIE)	+= phy-spacemit-k1-pcie.o
obj-y					+= allwinner/	\
					   amlogic/	\
					   broadcom/	\
+670 −0

File added.

Preview size limit exceeded, changes collapsed.