]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
phy: Add support for the Apple Type-C PHY
authorMark Kettenis <kettenis@openbsd.org>
Fri, 14 Jul 2023 20:21:42 +0000 (22:21 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 14 Aug 2023 21:51:51 +0000 (17:51 -0400)
This is merely a dummy driver that makes sure the DWC3 XHCI driver
finds its reset and PHY controllers.  We rely on iBoot to set up
the PHY for us.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
MAINTAINERS
arch/arm/Kconfig
configs/apple_m1_defconfig
drivers/phy/Kconfig
drivers/phy/Makefile
drivers/phy/phy-apple-atc.c [new file with mode: 0644]

index 2db052961b26cfccfc90ad96c4d88a4d94fd56cc..77a8b0ac21812bf31f831d01afe25006511d6c5d 100644 (file)
@@ -123,6 +123,7 @@ F:  configs/apple_m1_defconfig
 F:     drivers/iommu/apple_dart.c
 F:     drivers/nvme/nvme_apple.c
 F:     drivers/pci/pcie_apple.c
+F:     drivers/phy/phy-apple-atc.c
 F:     drivers/pinctrl/pinctrl-apple.c
 F:     drivers/watchdog/apple_wdt.c
 F:     include/configs/apple.h
index 97c25b4f146d8d7d822c736c8160b393f7223959..36ee1e9a3cdae57830127b8c01fe44790fd52a3d 100644 (file)
@@ -998,6 +998,7 @@ config ARCH_APPLE
        select OF_BOARD_SETUP
        select OF_CONTROL
        select PCI
+       select PHY
        select PINCTRL
        select POSITION_INDEPENDENT
        select POWER_DOMAIN
index 755560971e57c4557125de946de1af467799e2fc..d58a9030dbd08e4ac2da89d28f03ce339511df4b 100644 (file)
@@ -16,6 +16,7 @@ CONFIG_NVME_APPLE=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_XHCI_PCI=y
+CONFIG_USB_DWC3=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_NO_FB_CLEAR=y
index 7a2d54f71d21bbfd4950af29c2151c89711f0947..8ac5769ed9a04625a0832d3645ea63c23f6312d2 100644 (file)
@@ -70,6 +70,16 @@ config AB8500_USB_PHY
        help
          Support for the USB OTG PHY in ST-Ericsson AB8500.
 
+config APPLE_ATCPHY
+       bool "Apple Type-C PHY Driver"
+       depends on PHY && ARCH_APPLE
+       default y
+       help
+         Support for the Apple Type-C PHY.
+
+        This is a dummy driver since the PHY is initialized
+        sufficiently by previous stage firmware.
+
 config BCM6318_USBH_PHY
        bool "BCM6318 USBH PHY support"
        depends on PHY && ARCH_BMIPS
index aca365d219c4b325eedb4b94659453194cfe0890..5d4de86e71ad3d492240d376a2792777bd2eb230 100644 (file)
@@ -12,6 +12,7 @@ obj-$(CONFIG_$(SPL_)PHY) += phy-uclass.o
 obj-$(CONFIG_$(SPL_)NOP_PHY) += nop-phy.o
 obj-$(CONFIG_MIPI_DPHY_HELPERS) += phy-core-mipi-dphy.o
 obj-$(CONFIG_AB8500_USB_PHY) += phy-ab8500-usb.o
+obj-$(CONFIG_APPLE_ATCPHY) += phy-apple-atc.o
 obj-$(CONFIG_BCM6318_USBH_PHY) += bcm6318-usbh-phy.o
 obj-$(CONFIG_BCM6348_USBH_PHY) += bcm6348-usbh-phy.o
 obj-$(CONFIG_BCM6358_USBH_PHY) += bcm6358-usbh-phy.o
diff --git a/drivers/phy/phy-apple-atc.c b/drivers/phy/phy-apple-atc.c
new file mode 100644 (file)
index 0000000..15c5b8a
--- /dev/null
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2022 Mark Kettenis <kettenis@openbsd.org>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dm/device-internal.h>
+#include <generic-phy.h>
+#include <reset-uclass.h>
+
+static const struct phy_ops apple_atcphy_ops = {
+};
+
+static struct driver apple_atcphy_driver = {
+       .name = "apple-atcphy",
+       .id = UCLASS_PHY,
+       .ops = &apple_atcphy_ops,
+};
+
+static int apple_atcphy_reset_of_xlate(struct reset_ctl *reset_ctl,
+                                      struct ofnode_phandle_args *args)
+{
+       if (args->args_count != 0)
+               return -EINVAL;
+
+       return 0;
+}
+
+static const struct reset_ops apple_atcphy_reset_ops = {
+       .of_xlate = apple_atcphy_reset_of_xlate,
+};
+
+static int apple_atcphy_reset_probe(struct udevice *dev)
+{
+       struct udevice *child;
+
+       device_bind(dev, &apple_atcphy_driver, "apple-atcphy", NULL,
+                   dev_ofnode(dev), &child);
+
+       return 0;
+}
+
+static const struct udevice_id apple_atcphy_ids[] = {
+       { .compatible = "apple,t6000-atcphy" },
+       { .compatible = "apple,t8103-atcphy" },
+       { }
+};
+
+U_BOOT_DRIVER(apple_atcphy_reset) = {
+       .name = "apple-atcphy-reset",
+       .id = UCLASS_RESET,
+       .of_match = apple_atcphy_ids,
+       .ops = &apple_atcphy_reset_ops,
+       .probe = apple_atcphy_reset_probe,
+};