Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp280322pxf; Wed, 17 Mar 2021 23:10:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0SbxOg5nEcqpe6KJwhT5qUp2e2LPM+vddqAvAo5pv9hyc+WhWn0Y2Z9GW++F6CZ/Yh87d X-Received: by 2002:a50:ed83:: with SMTP id h3mr1665387edr.140.1616047823220; Wed, 17 Mar 2021 23:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616047823; cv=none; d=google.com; s=arc-20160816; b=Na5TAeHFbA3OEtTbBbb2yuQECNbKT1xfsFQhXfwJqUEGiIH0XLpoA5BkwgWEvjpM1v ZpWEA9ue4caGQxSvj1m8gWapd17iUzhz+Y9bkJuLdjEQzliyS7yX+xfB2507bNuo9/Ag +eNtTpmfzH8s/IbqgbOMn4RAXQP3AWrYgm0agrFpjHxzv6UuwJchmRF8x3FRKRifhosP 7APXRhMDV10+7q1ruWovM2KEcsN+72ADtMkO8PpU3zaJXUVYHYB+djX1q/Nlou0+flkT UTDZu8t5bV1mi92ZYKChg02+v3KK17zHL6FNvcYg57z1S/cAf0xJUCvfHQdZnBbjj23P DsWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=+Ajx//Hrn2Nysbs5OX32IPY3AqQ7T4AzxnnPGV+AONg=; b=LTXDVFR8KvyVjiGKihKOlJdiDOnjKaQ9xWPdIfofFkS0086oT9Npfltj54+XDKl+n3 nKL9lw8/fXEDgGROD5SsfELYJdf1759Zln8pDmi38HXbJlU1YAolvZLJhSTxPlN8ck9C d+2ckg9dwovOnMHw/4/lV/KN5WeTN9IjsvUbmFWjpYuD+Pa69198E4fvFgVS1SozTxIT L/wwKrS/rOg01RmUkGQoW2Vbl9Pp3x8HIF7IIKUH/kJO843RKOSA0bAw3mOJc2V7/zPV yQgDq0o/Nd91QHSc/YocmhwnLJUIurth4d4yijpCC0XZ+JPt8WvaD84YIlObrUHOevlL LeJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=Ep5j77s2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n1si837607edd.229.2021.03.17.23.10.01; Wed, 17 Mar 2021 23:10:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=Ep5j77s2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229710AbhCRGJJ (ORCPT + 99 others); Thu, 18 Mar 2021 02:09:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbhCRGIg (ORCPT ); Thu, 18 Mar 2021 02:08:36 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E24B5C061762 for ; Wed, 17 Mar 2021 23:08:35 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id 11so2753340pfn.9 for ; Wed, 17 Mar 2021 23:08:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=+Ajx//Hrn2Nysbs5OX32IPY3AqQ7T4AzxnnPGV+AONg=; b=Ep5j77s2uyFhZTdf2aWch6QKWGcwQGf2ydAGmR47fOokZTEPEMazSqbWYDEYuHUf2j gwpMSrzYPEoTtReWWYPWQdT7ksvroeD54vnbeiA5ZTCS7Eox8HjvP9v3qtW5spoM65cF hN0CHfGpceU4Amh8rrVqA01C7+JCznukhEyfcNWlYgFfyXCKXZJZcC2JVUQOECzCxiqK 7gMl7G1zv4TQsmyvVWgHL49wqFNcwpbVosR7MaUZl5VjsemFmNKTRe/5fk19a5Ljyfej yE+jlpGn4h7i6K8lR7QNi9h6nCf8lgZM5QHwI+YifN+kYIDp3vW4AxJNwmEP25ZF9ESU zVaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+Ajx//Hrn2Nysbs5OX32IPY3AqQ7T4AzxnnPGV+AONg=; b=HzsmUgE2WgV4iRYHepgKQP20dCe10htn7oLeAgIkr2WXiupC6qqnXh5P396BVNsBzf FumKnyTtLoPQ1l8dmxJrLhx0pzrxNHcUzz0TqbIvKnnlPGqFlBoq/jCkGwqGhXBLZrhn mGNIeXCyyiERiuk84hoXvrvaLo0ajWdrTvk5eTOThFC3L7Z7+VCP/TL3ZHzWxSDhpOXF vziU/YAPdAj+ZV+cWO9/Q6JhyUx16N6qwEe7OfXNS2arau/7DjtOz511t+ddsyAJoufZ inyxcexuG5trggUNAn9XnaoMvvf8TrAbHbWIxZC/MK7NHuneLV+Ywwf6kfuQINtcnzH+ +uog== X-Gm-Message-State: AOAM531rtPuG5pMbvS5GldUlZnTAZskRv1QiKoAKvOkXJ4dyam7waaUD 5C5IDRhWPznMSZkLh33tLwFIJg== X-Received: by 2002:a63:2c8f:: with SMTP id s137mr5521095pgs.51.1616047715433; Wed, 17 Mar 2021 23:08:35 -0700 (PDT) Received: from hsinchu02.internal.sifive.com (114-34-229-221.HINET-IP.hinet.net. [114.34.229.221]) by smtp.gmail.com with ESMTPSA id 68sm967353pfd.75.2021.03.17.23.08.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 23:08:35 -0700 (PDT) From: Greentime Hu To: greentime.hu@sifive.com, paul.walmsley@sifive.com, hes@sifive.com, erik.danie@sifive.com, zong.li@sifive.com, bhelgaas@google.com, robh+dt@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, mturquette@baylibre.com, sboyd@kernel.org, lorenzo.pieralisi@arm.com, p.zabel@pengutronix.de, alex.dewar90@gmail.com, khilman@baylibre.com, hayashi.kunihiko@socionext.com, vidyas@nvidia.com, jh80.chung@samsung.com, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, helgaas@kernel.org Subject: [PATCH v2 2/6] clk: sifive: Use reset-simple in prci driver for PCIe driver Date: Thu, 18 Mar 2021 14:08:09 +0800 Message-Id: <91d016e59bab9d9175168a63e7bcd81fdb69b549.1615954046.git.greentime.hu@sifive.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We use reset-simple in this patch so that pcie driver can use devm_reset_control_get() to get this reset data structure and use reset_control_deassert() to deassert pcie_power_up_rst_n. Reviewed-by: Philipp Zabel Signed-off-by: Greentime Hu --- drivers/clk/sifive/Kconfig | 2 ++ drivers/clk/sifive/sifive-prci.c | 13 +++++++++++++ drivers/clk/sifive/sifive-prci.h | 4 ++++ drivers/reset/Kconfig | 3 ++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/clk/sifive/Kconfig b/drivers/clk/sifive/Kconfig index 1c14eb20c066..9132c3c4aa86 100644 --- a/drivers/clk/sifive/Kconfig +++ b/drivers/clk/sifive/Kconfig @@ -10,6 +10,8 @@ if CLK_SIFIVE config CLK_SIFIVE_PRCI bool "PRCI driver for SiFive SoCs" + select RESET_CONTROLLER + select RESET_SIMPLE select CLK_ANALOGBITS_WRPLL_CLN28HPC help Supports the Power Reset Clock interface (PRCI) IP block found in diff --git a/drivers/clk/sifive/sifive-prci.c b/drivers/clk/sifive/sifive-prci.c index baf7313dac92..871ccb287993 100644 --- a/drivers/clk/sifive/sifive-prci.c +++ b/drivers/clk/sifive/sifive-prci.c @@ -583,6 +583,19 @@ static int sifive_prci_probe(struct platform_device *pdev) if (IS_ERR(pd->va)) return PTR_ERR(pd->va); + pd->reset.rcdev.owner = THIS_MODULE; + pd->reset.rcdev.nr_resets = PRCI_RST_NR; + pd->reset.rcdev.ops = &reset_simple_ops; + pd->reset.rcdev.of_node = pdev->dev.of_node; + pd->reset.active_low = true; + pd->reset.membase = pd->va + PRCI_DEVICESRESETREG_OFFSET; + spin_lock_init(&pd->reset.lock); + + r = devm_reset_controller_register(&pdev->dev, &pd->reset.rcdev); + if (r) { + dev_err(dev, "could not register reset controller: %d\n", r); + return r; + } r = __prci_register_clocks(dev, pd, desc); if (r) { dev_err(dev, "could not register clocks: %d\n", r); diff --git a/drivers/clk/sifive/sifive-prci.h b/drivers/clk/sifive/sifive-prci.h index 022c67cf053c..91658a88af4e 100644 --- a/drivers/clk/sifive/sifive-prci.h +++ b/drivers/clk/sifive/sifive-prci.h @@ -11,6 +11,7 @@ #include #include +#include #include /* @@ -121,6 +122,8 @@ #define PRCI_DEVICESRESETREG_CHIPLINK_RST_N_MASK \ (0x1 << PRCI_DEVICESRESETREG_CHIPLINK_RST_N_SHIFT) +#define PRCI_RST_NR 7 + /* CLKMUXSTATUSREG */ #define PRCI_CLKMUXSTATUSREG_OFFSET 0x2c #define PRCI_CLKMUXSTATUSREG_TLCLKSEL_STATUS_SHIFT 1 @@ -221,6 +224,7 @@ */ struct __prci_data { void __iomem *va; + struct reset_simple_data reset; struct clk_hw_onecell_data hw_clks; }; diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 71ab75a46491..f094df93d911 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -173,7 +173,7 @@ config RESET_SCMI config RESET_SIMPLE bool "Simple Reset Controller Driver" if COMPILE_TEST - default ARCH_AGILEX || ARCH_ASPEED || ARCH_BITMAIN || ARCH_REALTEK || ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || ARCH_ZX || ARC + default ARCH_AGILEX || ARCH_ASPEED || ARCH_BITMAIN || ARCH_REALTEK || ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || ARCH_ZX || ARC || RISCV help This enables a simple reset controller driver for reset lines that that can be asserted and deasserted by toggling bits in a contiguous, @@ -187,6 +187,7 @@ config RESET_SIMPLE - RCC reset controller in STM32 MCUs - Allwinner SoCs - ZTE's zx2967 family + - SiFive FU740 SoCs config RESET_STM32MP157 bool "STM32MP157 Reset Driver" if COMPILE_TEST -- 2.30.2