From patchwork Tue Jul 6 10:01:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 470435 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4829525jao; Tue, 6 Jul 2021 03:02:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgMGcYka9ddY01Q0R4msTsgV9EYzBTqCRoqyt0ArYqOHkym/nmrVgW+ezlZuHblVfboA0B X-Received: by 2002:a05:6402:b79:: with SMTP id cb25mr21844143edb.164.1625565733849; Tue, 06 Jul 2021 03:02:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625565733; cv=none; d=google.com; s=arc-20160816; b=DcbE0w419ge4vlb94RX/M4gho/LWC2hOjkqmg38f+C3bAh9sKY5wl2tbsaelzlKyR7 syp6z8FH4mlmy2h4vDCZ7mPCEZLEh7gSTncFteizWSMb+hmcYoErUH2I0H3P89p+qBxw OxcjBKAbaS5w8P8cvfHKVMuZXwExIDXE3Ahf4V47UN59hZq+GWSA/UoCqhqpcbgshXjH o51x2p44l1bS39YOaZYC09jJYlwowhngHRlnsEz6ClZF/qEfVHMXJoMaOUzeGaK4YVsk zt1c9JqXCSAYfAP+BW0WtT8a22Fu4KWVIpITfvTbJaaUyoFFt2E20UaEV4htMzpmdGIA PaHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from; bh=SbEDtVZNJ4G2Djh8lde4kkMs+zRZKK76XA+OcFCWY3c=; b=WSF2DOBi1qqlopFtDCMuRGWT6R8D+sowa5rpImz/Itcy2r/JBiuQE/yKqanAvVUm/a 6UvibW56SItI0p0T4+uKocVFNYJf9/V3X7NllM/8PkEv0Tve7viLK2S92T9ptLSrl8Un qPR5WgHyTwW4iu8BPK/kMdmcvkIhOkaVUweNYv4RQSN9vER6zx7sVGV4mc41hG5AdGQ2 /zqJhWkpfC/a7f0UeM48l7cQ9TT9KFuSsnLfRQ3CMrd/85boCTLg/bnO86y8Jq+02WKo /g6yo2QDE8kBQVYR7d6++hE/RPMonrQtCHY+wTfdC5Y3aaT+r7nOed0HU4GXiNqrFsf3 06Bw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id q17si13197884edt.177.2021.07.06.03.02.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jul 2021 03:02:13 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0F92282C7D; Tue, 6 Jul 2021 12:01:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 78C7982C68; Tue, 6 Jul 2021 12:01:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mx.socionext.com (mx.socionext.com [202.248.49.38]) by phobos.denx.de (Postfix) with ESMTP id 0ABE682C34 for ; Tue, 6 Jul 2021 12:01:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=hayashi.kunihiko@socionext.com Received: from unknown (HELO kinkan2-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 06 Jul 2021 19:01:32 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by kinkan2-ex.css.socionext.com (Postfix) with ESMTP id 23150205902A; Tue, 6 Jul 2021 19:01:32 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Tue, 6 Jul 2021 19:01:32 +0900 Received: from plum.e01.socionext.com (unknown [10.212.243.119]) by kinkan2.css.socionext.com (Postfix) with ESMTP id D6F2BB62AB; Tue, 6 Jul 2021 19:01:31 +0900 (JST) From: Kunihiko Hayashi To: u-boot@lists.denx.de Cc: Masami Hiramatsu , Jassi Brar , Kunihiko Hayashi Subject: [PATCH 3/6] phy: socionext: Add UniPhier PCIe PHY driver Date: Tue, 6 Jul 2021 19:01:08 +0900 Message-Id: <1625565671-30022-4-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1625565671-30022-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1625565671-30022-1-git-send-email-hayashi.kunihiko@socionext.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Add PCIe PHY driver support for Pro5, LD20 and PXs3 SoCs. Signed-off-by: Kunihiko Hayashi --- drivers/Kconfig | 2 ++ drivers/Makefile | 1 + drivers/phy/socionext/Kconfig | 12 +++++++ drivers/phy/socionext/Makefile | 6 ++++ drivers/phy/socionext/phy-uniphier-pcie.c | 59 +++++++++++++++++++++++++++++++ 5 files changed, 80 insertions(+) create mode 100644 drivers/phy/socionext/Kconfig create mode 100644 drivers/phy/socionext/Makefile create mode 100644 drivers/phy/socionext/phy-uniphier-pcie.c -- 2.7.4 diff --git a/drivers/Kconfig b/drivers/Kconfig index b1ada1c..c9c812b 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -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" diff --git a/drivers/Makefile b/drivers/Makefile index 3510dab..4081289 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -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 index 0000000..bcd579e --- /dev/null +++ b/drivers/phy/socionext/Kconfig @@ -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 index 0000000..5484360 --- /dev/null +++ b/drivers/phy/socionext/Makefile @@ -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 index 0000000..d352c4c --- /dev/null +++ b/drivers/phy/socionext/phy-uniphier-pcie.c @@ -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 +#include +#include +#include +#include +#include +#include + +/* 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), +};