From patchwork Fri Oct 11 15:41:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gatien CHEVALLIER X-Patchwork-Id: 834711 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A07D51991C9; Fri, 11 Oct 2024 15:48:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.182.106 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728661682; cv=none; b=MFDO1x3OTSE6Y9fcilXB9vYQEDxxuvei1r888EpsVBIXyqawYjxuhMn9v4icmjSN9ptxVEbeBm/NQ3qn4zu3AZLZ7qBi7z6vrXprTZUjpK1lnEOShK1lC0Upww6lJIXa01pKTLmgBRXIFke6fjifBRwZGaWwoWWsxe+0FoMxXl4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728661682; c=relaxed/simple; bh=yLqmVhSHfqTQBGze9c6HZjg8/DSXw+/10tUzsQ8jcYg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Bxt3JcOOPyeGPl3Mguvvi4WztGVTWyYjvhDF9wrYsmdUXMBpJ5NssnDAi5iWi4P+16/tskm6RmCTTdqJ4mklPHuoAuWTcQ64/hdlfN9y922Q4B/+o6eDpTso8FvXC1LBeI4CVDgcxVMI3UMX/Comz059flHNTlNlmvvVAZ2nIZ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=Hc2MNPNh; arc=none smtp.client-ip=185.132.182.106 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="Hc2MNPNh" Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49BCRMtM031378; Fri, 11 Oct 2024 17:47:30 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= UmHwzMEjgGYMyzKc5Pjv1VczBa5oeGehyd30tiANaqM=; b=Hc2MNPNhnu7Qxf9u 7nDrRYTVpVx0FdR1wYIUoyu3+7LXy0K4T8SpcjpObNX9d02j0lMzvQdoV+KmtcZ7 7MIp/uyb6oUhwNifuhS23+Xy5KG4ZJ9p+48Qr/IlskCqXKXweqvI22Rtu7pk6xMe dn463ACaMnix/EloPXV7fEy1IERJ5A7NZQGa1DdgahhQsEu9uRnCxO7RTP5pJZqi 4x+0Z9hot4eiTFZgJ1o17ftin6Kcwbzay4tO2WGTB/N5NTcMRsWY7VjOBHyM5qrp nAPKtr946ndc781m59Y16emtSKiemVfRNRADDeNGFKFjWAFnrXN7hOO3av9UGPUo Siaxyg== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 425q5wd33a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Oct 2024 17:47:30 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id AB43C4005E; Fri, 11 Oct 2024 17:46:15 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id C3F0D29E024; Fri, 11 Oct 2024 17:43:15 +0200 (CEST) Received: from localhost (10.252.28.117) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Fri, 11 Oct 2024 17:43:15 +0200 From: Gatien Chevallier Date: Fri, 11 Oct 2024 17:41:41 +0200 Subject: [PATCH v2 1/4] dt-bindings: rng: add st,stm32mp25-rng support Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241011-rng-mp25-v2-v2-1-76fd6170280c@foss.st.com> References: <20241011-rng-mp25-v2-v2-0-76fd6170280c@foss.st.com> In-Reply-To: <20241011-rng-mp25-v2-v2-0-76fd6170280c@foss.st.com> To: Olivia Mackall , Herbert Xu , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Lionel Debieve , CC: , , , , , Gatien Chevallier X-Mailer: b4 0.14.2 X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 Add RNG STM32MP25x platforms compatible. Update the clock properties management to support all versions. Signed-off-by: Gatien Chevallier --- Changes in V2 -Fix missing min/maxItems -Removed MP25 RNG example -Renamed RNG clocks for mp25 to "core" and "bus" --- .../devicetree/bindings/rng/st,stm32-rng.yaml | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml b/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml index 340d01d481d12ce8664a60db42182ddaf0d1385b..5d553f7f706f8d7c17aea07e4130a34af764a635 100644 --- a/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml +++ b/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml @@ -18,12 +18,20 @@ properties: enum: - st,stm32-rng - st,stm32mp13-rng + - st,stm32mp25-rng reg: maxItems: 1 clocks: - maxItems: 1 + minItems: 1 + maxItems: 2 + + clock-names: + minItems: 1 + items: + - const: core + - const: bus resets: maxItems: 1 @@ -57,6 +65,26 @@ allOf: properties: st,rng-lock-conf: false + - if: + properties: + compatible: + contains: + enum: + - st,stm32-rng + - st,stm32mp13-rng + then: + properties: + clocks: + maxItems: 1 + clock-names: false + else: + properties: + clocks: + minItems: 2 + maxItems: 2 + required: + - clock-names + additionalProperties: false examples: From patchwork Fri Oct 11 15:41:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gatien CHEVALLIER X-Patchwork-Id: 834713 Received: from mx08-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 374778121F; Fri, 11 Oct 2024 15:47:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728661666; cv=none; b=hvh7+CBpFFddCjwhMpU7QB63//KA5lDRC7I3bZZqjUoYSsmShTBxdrIPyKYYLCWokxBt2WdcbGpdqpzAGB0LZf2R4oFhaMgC9Ntd5CUXMrALrSqetTBvgxyMAdDoq/Jkr3BjthYq0sqlfe0M13ZzvRW/m1ns31PHqWHXLfyHIyM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728661666; c=relaxed/simple; bh=pY3HPUzNjPgjv0Cmibc6l9JbTz0qD5wkGAYRN/dsxf0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ojiqoaAH4OdRJhVCejwuQYjFkp6V6hndWbets9vVNWn48ywlhWj44XHlWkelf99+Li2Ez5savCVqc6pk5ZJNZjDboQRp4zs5r1CWb+uY3Cj94pUq8pqphizP3tZ0Da/r2aW5viUW+iU9oS5F4rdk4zOEm+IEORjtr9SUhg0BslM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=nvDTr9PX; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="nvDTr9PX" Received: from pps.filterd (m0369457.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49BCM4jP004698; Fri, 11 Oct 2024 17:47:04 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= zvHyj2kl9ZF339cIQfBGt0O6QAjQz8aYGjJ+YqPTeOE=; b=nvDTr9PXdtkpB33l RnKwqZmHB90vrQEeUYkSYqrKTcZWwGoGnJERUX6fqxO6a9+Yt3EcHO0D5sna53dI SnF6teRQ02+TlViCCeVuW7HCj6DnqQiIRcO4W4XS0gqiKMppQPK+16QwWPKyPrb2 7er5VEb2cDM0EjceDnKAfBEYLxhfMLDLNCSmDTlIF3hYkjzuMbA7jEglMp5FS6BK MzEuNYvS3wM+emfaHn1NLqaWf28artTCWr7Yn+25FIM+zi5Ru5pgY/66mvaPiyPV CefvERY/yE8qT0ZtWVPWg5hF4wXdmOi8PrWdSueq8TPVH/+VdBwNJiKIn3fkVn0O AM3DMg== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 425w7xtut0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Oct 2024 17:47:04 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 313A8400A2; Fri, 11 Oct 2024 17:45:50 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 9ADE829E027; Fri, 11 Oct 2024 17:43:16 +0200 (CEST) Received: from localhost (10.252.28.117) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Fri, 11 Oct 2024 17:43:16 +0200 From: Gatien Chevallier Date: Fri, 11 Oct 2024 17:41:42 +0200 Subject: [PATCH v2 2/4] hwrng: stm32 - implement support for STM32MP25x platforms Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241011-rng-mp25-v2-v2-2-76fd6170280c@foss.st.com> References: <20241011-rng-mp25-v2-v2-0-76fd6170280c@foss.st.com> In-Reply-To: <20241011-rng-mp25-v2-v2-0-76fd6170280c@foss.st.com> To: Olivia Mackall , Herbert Xu , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Lionel Debieve , CC: , , , , , Gatien Chevallier X-Mailer: b4 0.14.2 X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 Implement the support for STM32MP25x platforms. On this platform, a security clock is shared between some hardware blocks. For the RNG, it is the RNG kernel clock. Therefore, the gate is no more shared between the RNG bus and kernel clocks as on STM32MP1x platforms and the bus clock has to be managed on its own. Signed-off-by: Gatien Chevallier --- Changes in V2 -Renamed RNG clocks to "core" and "bus" -Use clk_bulk_* APIs instead of handling each clock. Just make sure that the RNG core clock is first --- drivers/char/hw_random/stm32-rng.c | 85 ++++++++++++++++++++++++++++++-------- 1 file changed, 67 insertions(+), 18 deletions(-) diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c index 9d041a67c295a54d283d235bbcf5a9ab7a8baa5c..62aa9f87415d2518b0c1cb5fb51b0b646422ed35 100644 --- a/drivers/char/hw_random/stm32-rng.c +++ b/drivers/char/hw_random/stm32-rng.c @@ -49,6 +49,7 @@ struct stm32_rng_data { uint max_clock_rate; + uint nb_clock; u32 cr; u32 nscr; u32 htcr; @@ -72,7 +73,7 @@ struct stm32_rng_private { struct hwrng rng; struct device *dev; void __iomem *base; - struct clk *clk; + struct clk_bulk_data *clk_bulk; struct reset_control *rst; struct stm32_rng_config pm_conf; const struct stm32_rng_data *data; @@ -266,7 +267,7 @@ static uint stm32_rng_clock_freq_restrain(struct hwrng *rng) unsigned long clock_rate = 0; uint clock_div = 0; - clock_rate = clk_get_rate(priv->clk); + clock_rate = clk_get_rate(priv->clk_bulk[0].clk); /* * Get the exponent to apply on the CLKDIV field in RNG_CR register @@ -276,7 +277,7 @@ static uint stm32_rng_clock_freq_restrain(struct hwrng *rng) while ((clock_rate >> clock_div) > priv->data->max_clock_rate) clock_div++; - pr_debug("RNG clk rate : %lu\n", clk_get_rate(priv->clk) >> clock_div); + pr_debug("RNG clk rate : %lu\n", clk_get_rate(priv->clk_bulk[0].clk) >> clock_div); return clock_div; } @@ -288,7 +289,7 @@ static int stm32_rng_init(struct hwrng *rng) int err; u32 reg; - err = clk_prepare_enable(priv->clk); + err = clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk); if (err) return err; @@ -328,7 +329,7 @@ static int stm32_rng_init(struct hwrng *rng) (!(reg & RNG_CR_CONDRST)), 10, 50000); if (err) { - clk_disable_unprepare(priv->clk); + clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk); dev_err(priv->dev, "%s: timeout %x!\n", __func__, reg); return -EINVAL; } @@ -356,12 +357,13 @@ static int stm32_rng_init(struct hwrng *rng) reg & RNG_SR_DRDY, 10, 100000); if (err || (reg & ~RNG_SR_DRDY)) { - clk_disable_unprepare(priv->clk); + clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk); dev_err(priv->dev, "%s: timeout:%x SR: %x!\n", __func__, err, reg); + return -EINVAL; } - clk_disable_unprepare(priv->clk); + clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk); return 0; } @@ -379,7 +381,8 @@ static int __maybe_unused stm32_rng_runtime_suspend(struct device *dev) reg = readl_relaxed(priv->base + RNG_CR); reg &= ~RNG_CR_RNGEN; writel_relaxed(reg, priv->base + RNG_CR); - clk_disable_unprepare(priv->clk); + + clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk); return 0; } @@ -389,7 +392,7 @@ static int __maybe_unused stm32_rng_suspend(struct device *dev) struct stm32_rng_private *priv = dev_get_drvdata(dev); int err; - err = clk_prepare_enable(priv->clk); + err = clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk); if (err) return err; @@ -403,7 +406,7 @@ static int __maybe_unused stm32_rng_suspend(struct device *dev) writel_relaxed(priv->pm_conf.cr, priv->base + RNG_CR); - clk_disable_unprepare(priv->clk); + clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk); return 0; } @@ -414,7 +417,7 @@ static int __maybe_unused stm32_rng_runtime_resume(struct device *dev) int err; u32 reg; - err = clk_prepare_enable(priv->clk); + err = clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk); if (err) return err; @@ -434,7 +437,7 @@ static int __maybe_unused stm32_rng_resume(struct device *dev) int err; u32 reg; - err = clk_prepare_enable(priv->clk); + err = clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk); if (err) return err; @@ -462,7 +465,7 @@ static int __maybe_unused stm32_rng_resume(struct device *dev) reg & ~RNG_CR_CONDRST, 10, 100000); if (err) { - clk_disable_unprepare(priv->clk); + clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk); dev_err(priv->dev, "%s: timeout:%x CR: %x!\n", __func__, err, reg); return -EINVAL; } @@ -472,7 +475,7 @@ static int __maybe_unused stm32_rng_resume(struct device *dev) writel_relaxed(reg, priv->base + RNG_CR); } - clk_disable_unprepare(priv->clk); + clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk); return 0; } @@ -484,9 +487,19 @@ static const struct dev_pm_ops __maybe_unused stm32_rng_pm_ops = { stm32_rng_resume) }; +static const struct stm32_rng_data stm32mp25_rng_data = { + .has_cond_reset = true, + .max_clock_rate = 48000000, + .nb_clock = 2, + .cr = 0x00F00D00, + .nscr = 0x2B5BB, + .htcr = 0x969D, +}; + static const struct stm32_rng_data stm32mp13_rng_data = { .has_cond_reset = true, .max_clock_rate = 48000000, + .nb_clock = 1, .cr = 0x00F00D00, .nscr = 0x2B5BB, .htcr = 0x969D, @@ -495,9 +508,14 @@ static const struct stm32_rng_data stm32mp13_rng_data = { static const struct stm32_rng_data stm32_rng_data = { .has_cond_reset = false, .max_clock_rate = 3000000, + .nb_clock = 1, }; static const struct of_device_id stm32_rng_match[] = { + { + .compatible = "st,stm32mp25-rng", + .data = &stm32mp25_rng_data, + }, { .compatible = "st,stm32mp13-rng", .data = &stm32mp13_rng_data, @@ -525,10 +543,6 @@ static int stm32_rng_probe(struct platform_device *ofdev) if (IS_ERR(priv->base)) return PTR_ERR(priv->base); - priv->clk = devm_clk_get(&ofdev->dev, NULL); - if (IS_ERR(priv->clk)) - return PTR_ERR(priv->clk); - priv->rst = devm_reset_control_get(&ofdev->dev, NULL); if (!IS_ERR(priv->rst)) { reset_control_assert(priv->rst); @@ -551,6 +565,41 @@ static int stm32_rng_probe(struct platform_device *ofdev) priv->rng.read = stm32_rng_read; priv->rng.quality = 900; + if (!priv->data->nb_clock || priv->data->nb_clock > 2) + return -EINVAL; + + priv->clk_bulk = devm_kzalloc(dev, priv->data->nb_clock * sizeof(*priv->clk_bulk), + GFP_KERNEL); + if (!priv->clk_bulk) + return -ENOMEM; + + if (priv->data->nb_clock == 2) { + struct clk *clk; + struct clk *bus_clk; + + clk = devm_clk_get(&ofdev->dev, "core"); + if (IS_ERR(clk)) + return PTR_ERR(clk); + + bus_clk = devm_clk_get(&ofdev->dev, "bus"); + if (IS_ERR(clk)) + return PTR_ERR(bus_clk); + + priv->clk_bulk[0].clk = clk; + priv->clk_bulk[0].id = "core"; + priv->clk_bulk[1].clk = bus_clk; + priv->clk_bulk[1].id = "bus"; + } else { + struct clk *clk; + + clk = devm_clk_get(&ofdev->dev, NULL); + if (IS_ERR(clk)) + return PTR_ERR(clk); + + priv->clk_bulk[0].clk = clk; + priv->clk_bulk[0].id = "core"; + } + pm_runtime_set_autosuspend_delay(dev, 100); pm_runtime_use_autosuspend(dev); pm_runtime_enable(dev); From patchwork Fri Oct 11 15:41:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gatien CHEVALLIER X-Patchwork-Id: 835256 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8FD5D18EFC1; Fri, 11 Oct 2024 15:47:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.182.106 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728661680; cv=none; b=QfrACwUDnjWbDwhRxkeMZ9IBAKXHJIwzXTmTDT0tIkEiI5kj7cu4742JaXur761M0dTdPnDiCckojjBclpz6rG9Vn5hSA6JlVMTWeOHtt6dFCrMfQZ+tOnZvrCtQxl9tO0z3r0vEkKchW66iWFoTXQi1gWJukXKF9n9+oblV8CY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728661680; c=relaxed/simple; bh=0RwzkCShxixzquuFPmLNwqODb5GGHOx3BH/dIfUsYTU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=OFIyHYZ7i7JzIMTlZmVkyh77XcTjPZtrB+vdWa+suohodGMWwI0D2I3asjWdC7i43Puv180+MnpZmxstFGwoXCd6THrRlS6gZSg+2n//P+XJ1vyXnUW9gg8tYveKuqQz/RbnPLk6FXG8znzyINebvJV51J9YDta0OABQDjGMnyI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=mPnPzU7O; arc=none smtp.client-ip=185.132.182.106 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="mPnPzU7O" Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49BCmEYT029283; Fri, 11 Oct 2024 17:47:31 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= vQsFEfKGHVxqMjB9A0r/ahU4vbVBNlphLxlklfsARqY=; b=mPnPzU7OQKjHnr1d OPVIu1y8TxLbdb+Speh7SRO/ltVb1+8zi18Y13kzcqFnAMIvWdMcvghAVf9lJPff RHt53OQzJBgP0W/UcJUWoxY21DsMCHaNZNaVfIlfFp6Vtccjn85Swu1Q0y7VkHB6 GU/3HvMIJGMR34jyZM0z1JTm9p9iOdnAXH9SUCLPbfo3NGD+mqFGOu/bFLmHiLPB 5ZgKfn+9aDz6cWXvxXAu0fY2zSVwDCrgynAcwMk0d0x4xjcyefwcTiK8iVCzivVu nGdOpTu1vACQNpceqM3qiLH4RKKtQ5Zx1Nvmrp3Ax08VdvaVoikbcrOjsyOsW3Rc 7nlTPw== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 4263439ty6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Oct 2024 17:47:31 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id A7A3B4005D; Fri, 11 Oct 2024 17:46:15 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 7907A29E028; Fri, 11 Oct 2024 17:43:17 +0200 (CEST) Received: from localhost (10.252.28.117) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Fri, 11 Oct 2024 17:43:17 +0200 From: Gatien Chevallier Date: Fri, 11 Oct 2024 17:41:43 +0200 Subject: [PATCH v2 3/4] hwrng: stm32 - update STM32MP15 RNG max clock frequency Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241011-rng-mp25-v2-v2-3-76fd6170280c@foss.st.com> References: <20241011-rng-mp25-v2-v2-0-76fd6170280c@foss.st.com> In-Reply-To: <20241011-rng-mp25-v2-v2-0-76fd6170280c@foss.st.com> To: Olivia Mackall , Herbert Xu , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Lionel Debieve , CC: , , , , , Gatien Chevallier X-Mailer: b4 0.14.2 X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 RNG max clock frequency can be updated to 48MHz for stm32mp1x platforms according to the latest specifications. Signed-off-by: Gatien Chevallier --- drivers/char/hw_random/stm32-rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c index 62aa9f87415d2518b0c1cb5fb51b0b646422ed35..ef8324b914fc2de2e7a6bd9eb69c081c26cd1ecd 100644 --- a/drivers/char/hw_random/stm32-rng.c +++ b/drivers/char/hw_random/stm32-rng.c @@ -507,7 +507,7 @@ static const struct stm32_rng_data stm32mp13_rng_data = { static const struct stm32_rng_data stm32_rng_data = { .has_cond_reset = false, - .max_clock_rate = 3000000, + .max_clock_rate = 48000000, .nb_clock = 1, }; From patchwork Fri Oct 11 15:41:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gatien CHEVALLIER X-Patchwork-Id: 834712 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98472188CB1; Fri, 11 Oct 2024 15:47:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.182.106 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728661679; cv=none; b=NQ6J39uvJ6OuHnyOsJ5PUgZD2u3/vuBRlFJWRsKhbozu9PC7Tvm1HDe2GdmG7u7DZawoxZo6JYeoF8NtC29Rqsj+JpcrioOxy/2YVH7A9C9jixQvY+UJFwYTze/pR1J+G+YEo3ubI5ix7tgh1aY1hLrdivVZ8dD9AcE7C3HGqgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728661679; c=relaxed/simple; bh=ndRqdEUqlqoDLYoq/DyZovcBsgKifHrEueihar37Ea8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=LqzgHz1ve8NJZrNQqrbcCwQdsJaMiljM//+l5sQYFBPTPhtfozydQYvzLwGg3LfTfpVhp54ghNV2P2Luz81pYIENYSa/2L+WZVruDGFIsKqkr9iOZqMwf4yv0uGjbBPv90QmWMmCicZ8lKxRP3aFrplk0Z1gghhNgr735Gv+7Is= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=ERD1Z+nj; arc=none smtp.client-ip=185.132.182.106 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="ERD1Z+nj" Received: from pps.filterd (m0369458.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49BCZZVH000599; Fri, 11 Oct 2024 17:47:30 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= kxjVQ5QlVpWbTNWs/BiZxzev2jarsoMh2Wv+B6YsV/0=; b=ERD1Z+njRiE1sYOu fPo44S39zhqYA0IW6NGtZw/mWje1L52ALGTm9FugHPn/EuQ1zosrFQRu/K71APm2 tWX1bF0XJZwIhgq4UVwSEafKegtuSA0mnASIEvsL1LjJ0SU02kvxwvd4Ue4f5dUf NmfjGi4pVgDr8TEy25AcZSm3w3uskZ9NAr4R2I5sijB2rL5KcvXA8jVudFsr9/Dg bug4T4n3tWDUeaSazY8OPG/kljHyXR3eT4PJ9Ekel/sH8stJkaPoisvBOqPz7yRA KGUZutd6//hHFC49t1mHyR45RK5HRlKHEqrmzeAu25w5EVloA3gXkL3z2Yl5GTJ1 qHs3cA== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 423f11da79-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Oct 2024 17:47:30 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id AC0554005F; Fri, 11 Oct 2024 17:46:15 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 5780129E02B; Fri, 11 Oct 2024 17:43:18 +0200 (CEST) Received: from localhost (10.252.28.117) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Fri, 11 Oct 2024 17:43:18 +0200 From: Gatien Chevallier Date: Fri, 11 Oct 2024 17:41:44 +0200 Subject: [PATCH v2 4/4] arm64: dts: st: add RNG node on stm32mp251 Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241011-rng-mp25-v2-v2-4-76fd6170280c@foss.st.com> References: <20241011-rng-mp25-v2-v2-0-76fd6170280c@foss.st.com> In-Reply-To: <20241011-rng-mp25-v2-v2-0-76fd6170280c@foss.st.com> To: Olivia Mackall , Herbert Xu , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Lionel Debieve , CC: , , , , , Gatien Chevallier X-Mailer: b4 0.14.2 X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 Update the device-tree stm32mp251.dtsi by adding the Random Number Generator(RNG) node. Signed-off-by: Gatien Chevallier Reviewed-by: Marek Vasut --- Changes in V2 -Renamed RNG clocks to "core" and "bus" --- arch/arm64/boot/dts/st/stm32mp251.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/boot/dts/st/stm32mp251.dtsi b/arch/arm64/boot/dts/st/stm32mp251.dtsi index 1167cf63d7e87aaa15c5c1ed70a9f6511fd818d4..273da5f62294422b587b13404b499b5ffe6c148e 100644 --- a/arch/arm64/boot/dts/st/stm32mp251.dtsi +++ b/arch/arm64/boot/dts/st/stm32mp251.dtsi @@ -493,6 +493,16 @@ uart8: serial@40380000 { status = "disabled"; }; + rng: rng@42020000 { + compatible = "st,stm32mp25-rng"; + reg = <0x42020000 0x400>; + clocks = <&clk_rcbsec>, <&rcc CK_BUS_RNG>; + clock-names = "core", "bus"; + resets = <&rcc RNG_R>; + access-controllers = <&rifsc 92>; + status = "disabled"; + }; + spi8: spi@46020000 { #address-cells = <1>; #size-cells = <0>;