]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
phy: socionext: Add UniPhier PCIe PHY driver
authorKunihiko Hayashi <hayashi.kunihiko@socionext.com>
Tue, 6 Jul 2021 10:01:08 +0000 (19:01 +0900)
committerTom Rini <trini@konsulko.com>
Wed, 14 Jul 2021 20:48:07 +0000 (16:48 -0400)
Add PCIe PHY driver support for Pro5, LD20 and PXs3 SoCs.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
drivers/Kconfig
drivers/Makefile
drivers/phy/socionext/Kconfig [new file with mode: 0644]
drivers/phy/socionext/Makefile [new file with mode: 0644]
drivers/phy/socionext/phy-uniphier-pcie.c [new file with mode: 0644]

index b1ada1cb7f8d3480c756a808c00dad9897c67097..c9c812b7526e6958de049ca0532bfcd6b96c70e3 100644 (file)
@@ -80,6 +80,8 @@ source "drivers/phy/allwinner/Kconfig"
 
 source "drivers/phy/marvell/Kconfig"
 
+source "drivers/phy/socionext/Kconfig"
+
 source "drivers/pinctrl/Kconfig"
 
 source "drivers/power/Kconfig"
index 3510daba29f81e90f4fc1ab1322c2e4b466413a8..40812891046527df3bb966cf4d680f4b0395514d 100644 (file)
@@ -96,6 +96,7 @@ obj-$(CONFIG_PCH) += pch/
 obj-y += phy/allwinner/
 obj-y += phy/marvell/
 obj-y += phy/rockchip/
+obj-y += phy/socionext/
 obj-y += rtc/
 obj-y += scsi/
 obj-y += sound/
diff --git a/drivers/phy/socionext/Kconfig b/drivers/phy/socionext/Kconfig
new file mode 100644 (file)
index 0000000..bcd579e
--- /dev/null
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# PHY drivers for Socionext platforms.
+#
+
+config PHY_UNIPHIER_PCIE
+       bool "UniPhier PCIe PHY driver"
+       depends on PHY && ARCH_UNIPHIER
+       imply REGMAP
+       help
+         Enable this to support PHY implemented in PCIe controller
+         on UniPhier SoCs.
diff --git a/drivers/phy/socionext/Makefile b/drivers/phy/socionext/Makefile
new file mode 100644 (file)
index 0000000..5484360
--- /dev/null
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for the phy drivers.
+#
+
+obj-$(CONFIG_PHY_UNIPHIER_PCIE)        += phy-uniphier-pcie.o
diff --git a/drivers/phy/socionext/phy-uniphier-pcie.c b/drivers/phy/socionext/phy-uniphier-pcie.c
new file mode 100644 (file)
index 0000000..d352c4c
--- /dev/null
@@ -0,0 +1,59 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * phy_uniphier_pcie.c - Socionext UniPhier PCIe PHY driver
+ * Copyright 2019-2021 Socionext, Inc.
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <generic-phy.h>
+#include <linux/bitops.h>
+#include <linux/compat.h>
+#include <regmap.h>
+#include <syscon.h>
+
+/* SG */
+#define SG_USBPCIESEL          0x590
+#define SG_USBPCIESEL_PCIE     BIT(0)
+
+struct uniphier_pciephy_priv {
+       int dummy;
+};
+
+static int uniphier_pciephy_init(struct phy *phy)
+{
+       return 0;
+}
+
+static int uniphier_pciephy_probe(struct udevice *dev)
+{
+       struct regmap *regmap;
+
+       regmap = syscon_regmap_lookup_by_phandle(dev,
+                                                "socionext,syscon");
+       if (!IS_ERR(regmap))
+               regmap_update_bits(regmap, SG_USBPCIESEL,
+                                  SG_USBPCIESEL_PCIE, SG_USBPCIESEL_PCIE);
+
+       return 0;
+}
+
+static struct phy_ops uniphier_pciephy_ops = {
+       .init = uniphier_pciephy_init,
+};
+
+static const struct udevice_id uniphier_pciephy_ids[] = {
+       { .compatible = "socionext,uniphier-pro5-pcie-phy" },
+       { .compatible = "socionext,uniphier-ld20-pcie-phy" },
+       { .compatible = "socionext,uniphier-pxs3-pcie-phy" },
+       { }
+};
+
+U_BOOT_DRIVER(uniphier_pcie_phy) = {
+       .name           = "uniphier-pcie-phy",
+       .id             = UCLASS_PHY,
+       .of_match       = uniphier_pciephy_ids,
+       .ops            = &uniphier_pciephy_ops,
+       .probe          = uniphier_pciephy_probe,
+       .priv_auto      = sizeof(struct uniphier_pciephy_priv),
+};