Skip to content

Commit 62a71b0

Browse files
svenpeter42jannau
authored andcommitted
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> 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> Signed-off-by: Janne Grunau <j@jannau.net>
1 parent f69f6df commit 62a71b0

6 files changed

Lines changed: 2315 additions & 0 deletions

File tree

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,6 +2461,7 @@ F: drivers/mfd/macsmc.c
24612461
F: drivers/nvme/host/apple.c
24622462
F: drivers/nvmem/apple-efuses.c
24632463
F: drivers/nvmem/apple-spmi-nvmem.c
2464+
F: drivers/phy/apple/
24642465
F: drivers/pinctrl/pinctrl-apple-gpio.c
24652466
F: drivers/power/reset/macsmc-reboot.c
24662467
F: drivers/pwm/pwm-apple.c

drivers/phy/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ config PHY_NXP_PTN3222
103103

104104
source "drivers/phy/allwinner/Kconfig"
105105
source "drivers/phy/amlogic/Kconfig"
106+
source "drivers/phy/apple/Kconfig"
106107
source "drivers/phy/broadcom/Kconfig"
107108
source "drivers/phy/cadence/Kconfig"
108109
source "drivers/phy/freescale/Kconfig"

drivers/phy/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ obj-$(CONFIG_PHY_AIROHA_PCIE) += phy-airoha-pcie.o
1515
obj-$(CONFIG_PHY_NXP_PTN3222) += phy-nxp-ptn3222.o
1616
obj-y += allwinner/ \
1717
amlogic/ \
18+
apple/ \
1819
broadcom/ \
1920
cadence/ \
2021
freescale/ \

drivers/phy/apple/Kconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
2+
config PHY_APPLE_ATC
3+
tristate "Apple Type-C PHY"
4+
depends on (ARM64 && ARCH_APPLE) || (COMPILE_TEST && !GENERIC_ATOMIC64)
5+
depends on TYPEC
6+
select GENERIC_PHY
7+
select APPLE_TUNABLE
8+
help
9+
Enable this to add support for the Apple Type-C PHY found in
10+
Apple Silicon M-series SoCs. This PHY supports USB2,
11+
USB3, USB4, Thunderbolt, and DisplayPort.
12+
13+
If M is selected the module will be called 'phy-apple-atc'.
14+

drivers/phy/apple/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
2+
3+
obj-$(CONFIG_PHY_APPLE_ATC) += phy-apple-atc.o
4+
phy-apple-atc-y := atc.o

0 commit comments

Comments
 (0)