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: Janne Grunau <j@jannau.net>
Signed-off-by: Janne Grunau <j@jannau.net>
Co-developed-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> # for reset controller
Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Sven Peter <sven@kernel.org>
Link: https://patch.msgid.link/20251214-b4-atcphy-v3-3-ba82b20e9459@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
Sven Peter
2025-12-14 11:51:36 +00:00
committed by Vinod Koul
parent c1538b87ca
commit 8e98ca1e74
6 changed files with 2314 additions and 0 deletions

View File

@@ -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

View File

@@ -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"

View File

@@ -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
drivers/phy/apple/Kconfig Normal file
View File

@@ -0,0 +1,13 @@
# 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'.

View File

@@ -0,0 +1,4 @@
# 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

2294
drivers/phy/apple/atc.c Normal file

File diff suppressed because it is too large Load Diff