Commit 8e98ca1e authored by Sven Peter's avatar Sven Peter Committed by Vinod Koul
Browse files

phy: apple: Add Apple Type-C PHY



The Apple Type-C PHY (ATCPHY) is a PHY for USB 2.0, USB 3.x,
USB4/Thunderbolt, and DisplayPort connectivity found in Apple Silicon SoCs.
The PHY handles muxing between these different protocols and also provides
the reset controller for the attached dwc3 USB controller.

There is no documentation available for this PHY and the entire sequence
of MMIO pokes has been figured out by tracing all MMIO access of Apple's
driver under a thin hypervisor and correlating the register reads/writes
to their kernel's debug output to find their names. Deviations from this
sequence generally results in the port not working or, especially when
the mode is switched to USB4 or Thunderbolt, to some watchdog resetting
the entire SoC.

This initial commit already introduces support for Display Port and
USB4/Thunderbolt but the drivers for these are not ready. We cannot
control the alternate mode negotiation and are stuck with whatever Apple's
firmware decides such that any DisplayPort or USB4/Thunderbolt device will
result in a correctly setup PHY but not be usable until the other drivers
are upstreamed as well.

Co-developed-by: default avatarJanne Grunau <j@jannau.net>
Signed-off-by: default avatarJanne Grunau <j@jannau.net>
Co-developed-by: default avatarHector Martin <marcan@marcan.st>
Signed-off-by: default avatarHector Martin <marcan@marcan.st>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> # for reset controller
Reviewed-by: default avatarNeal Gompa <neal@gompa.dev>
Signed-off-by: default avatarSven Peter <sven@kernel.org>
Link: https://patch.msgid.link/20251214-b4-atcphy-v3-3-ba82b20e9459@kernel.org


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent c1538b87
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2500,6 +2500,7 @@ F: drivers/mfd/macsmc.c
F:	drivers/nvme/host/apple.c
F:	drivers/nvmem/apple-efuses.c
F:	drivers/nvmem/apple-spmi-nvmem.c
F:	drivers/phy/apple/
F:	drivers/pinctrl/pinctrl-apple-gpio.c
F:	drivers/power/reset/macsmc-reboot.c
F:	drivers/pwm/pwm-apple.c
+1 −0
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ config PHY_SPACEMIT_K1_PCIE

source "drivers/phy/allwinner/Kconfig"
source "drivers/phy/amlogic/Kconfig"
source "drivers/phy/apple/Kconfig"
source "drivers/phy/broadcom/Kconfig"
source "drivers/phy/cadence/Kconfig"
source "drivers/phy/freescale/Kconfig"
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ obj-$(CONFIG_PHY_NXP_PTN3222) += phy-nxp-ptn3222.o
obj-$(CONFIG_PHY_SPACEMIT_K1_PCIE)	+= phy-spacemit-k1-pcie.o
obj-y					+= allwinner/	\
					   amlogic/	\
					   apple/	\
					   broadcom/	\
					   cadence/	\
					   freescale/	\
+13 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
config PHY_APPLE_ATC
	tristate "Apple Type-C PHY"
	depends on (ARM64 && ARCH_APPLE) || (COMPILE_TEST && !GENERIC_ATOMIC64)
	depends on TYPEC
	select GENERIC_PHY
	select APPLE_TUNABLE
	help
	  Enable this to add support for the Apple Type-C PHY found in
	  Apple Silicon M-series SoCs. This PHY supports USB2,
	  USB3, USB4, Thunderbolt, and DisplayPort.

	  If M is selected the module will be called 'phy-apple-atc'.
+4 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause

obj-$(CONFIG_PHY_APPLE_ATC)		+= phy-apple-atc.o
phy-apple-atc-y			:= atc.o
Loading