From nobody Tue Nov 26 19:59:52 2024 Received: from mx07-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 54B821D27B7; Wed, 16 Oct 2024 08:06:46 +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=1729066008; cv=none; b=pVuqHAVPzTDLtVUUWOWf7VoorpOYnqEPc6BZK5FU+jIrDD2ciSIWbZgflOvbo63r6mqpXsNCu+7O7lU5u6R9k+BgSo2cZF8G2EkFMHrAw0yTBBLEWO0w6UZicZTmZLEk5yVNyPHKaGDLUcowfA8Q7Sif2dgsBsnXLbC5rIKdmKo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729066008; c=relaxed/simple; bh=ClFwqko2ceVIAX+sK8Vlz5k7zAuyGHrDL8DnwHmeI00=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=PDHw2TiK2jXtD8y7vT0mSKv7wI/mBrne5vP4JrlgH14whBolxMgiQR+S4+9h/EQyoUXib6JNASHBYMGNgPLitd0qn5cIE0supFIDv33a8PWwSm/RA2M1HAd+1s4Rtfv0RlCgtItWRMcs4oakH3v4Ot2bBNMgpCDhpQLknqOd2e0= 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=mQeKyna6; 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="mQeKyna6" Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49G6sjRV018447; Wed, 16 Oct 2024 10:06:26 +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= yqoe5xAomf7D/YUG6xkzdLNqV/te8d+Mhnck8LtooPk=; b=mQeKyna6V5hkpT1h q4A2QHJTCut0kZq76aBtGOCidtQfFeBQ9BAJWvxC4Zy75BmmlM+u1CfL83rPTnSN qKcn8OXlhXQcddMflDJ9AdMZiy8Fw6uDrFm8gyoysfwyFC9Q+//4VTJxZd4rkTcl 5ggcZ6jBRBvEgLlfqBByqR+vtYY5Co4XNUZIq4t3ZtnHjojkGX+Ub34bNQndTPjr NTUa5hqQBQBbYV1amvkNtE5tMw+A1LhDtW9tmcRYrn2t5E+KlxTbiXdJXentDJsZ QNzufXznJpCbBOPRTH0o0WbS2EJZJnVwu54kr8dscD7UCu/sbmCEpqftHRMMYoA2 nC9Q2g== 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 42a8mv8c9m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Oct 2024 10:06:26 +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 370F540046; Wed, 16 Oct 2024 10:05:17 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id D66E423CB4B; Wed, 16 Oct 2024 10:04:32 +0200 (CEST) Received: from localhost (10.48.86.225) 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; Wed, 16 Oct 2024 10:04:32 +0200 From: Gatien Chevallier Date: Wed, 16 Oct 2024 10:04:18 +0200 Subject: [PATCH v4 1/4] dt-bindings: rng: add st,stm32mp25-rng support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20241016-rng-mp25-v2-v4-1-5dca590cb092@foss.st.com> References: <20241016-rng-mp25-v2-v4-0-5dca590cb092@foss.st.com> In-Reply-To: <20241016-rng-mp25-v2-v4-0-5dca590cb092@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: EQNCAS1NODE3.st.com (10.75.129.80) 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 Reviewed-by: Rob Herring (Arm) --- Changes in V4: - Changed the restrictions on clock-names per compatible - Removed a useless constraint on clocks Items Changes in V3: - Add constraint on clock-names for st,stm32mp25-rng compatible 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 | 28 ++++++++++++++++++= +++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml b/Docu= mentation/devicetree/bindings/rng/st,stm32-rng.yaml index 340d01d481d12ce8664a60db42182ddaf0d1385b..7db65f49773b5b9b1b6193fec49= 5c752327a149a 100644 --- a/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml +++ b/Documentation/devicetree/bindings/rng/st,stm32-rng.yaml @@ -18,12 +18,19 @@ properties: enum: - st,stm32-rng - st,stm32mp13-rng + - st,stm32mp25-rng =20 reg: maxItems: 1 =20 clocks: - maxItems: 1 + minItems: 1 + maxItems: 2 + + clock-names: + items: + - const: core + - const: bus =20 resets: maxItems: 1 @@ -57,6 +64,25 @@ allOf: properties: st,rng-lock-conf: false =20 + - if: + properties: + compatible: + contains: + enum: + - st,stm32-rng + - st,stm32mp13-rng + then: + properties: + clocks: + maxItems: 1 + clock-names: false + else: + properties: + clocks: + minItems: 2 + required: + - clock-names + additionalProperties: false =20 examples: --=20 2.25.1 From nobody Tue Nov 26 19:59:52 2024 Received: from mx07-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 534CD1D27B4; Wed, 16 Oct 2024 08:06:46 +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=1729066008; cv=none; b=mnYPhPlom0SOMyI9DFrcskYqZM/KAw+bvDMoUoH3tS+DYMTZc5rI3KZs9ifkevuV5zI0HwreX8N2DRkiYB4t2KjcMcey+oPyH12qWr28aKicvwId7kf6YGA656YYXg721DRYyDz7kjiyIo6ggYtmit9+64Vxrc4Ot+BSYorkdxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729066008; c=relaxed/simple; bh=dm69zLlAyOqjpblFsxT8rIwfjadrhYwmYtcCnyUT+Mw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Q1qP2I94T7Ed24HUzLYDByyH3UX0RhHPSHghf/3jAyZEDIAHeJctVCciKZ3qQSMHOWMmpS2Wq9igoxvLg4sA3Sac/G3qKahg5435OtSxbubjFRheKMEmqI5IqN0ohZiIB8wspP+kr8+UoTniMqTPcbpEgNROXhRWG5V6M8/ONCk= 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=ZmMbgWji; 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="ZmMbgWji" Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49G6soUY018493; Wed, 16 Oct 2024 10:06:26 +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= OMBkIP4yBxlbCoEGmX8+sMGiFNm4Ds3W/buqBNATsD8=; b=ZmMbgWji5b5glPf2 ldx6wF9j8t7RmfSUn8zHEaM1G25UJlwYqOdDhGXx5uJOLGE4QfoRtpRoKj1VmA6x 0rYcgwWSufreaDIbgy3GdrxVbGTYI4yGcnBXLigvPiVUjEMrHGPRQBCo3KjSEPmu yJoJgrbkmD3whWBlLmEBwyQ4rp5WyMVS+70qImCAASi6m+YTZf9iitTZI6pL6IJI Zw4wvvAVvJc7VWtXwhR+bj/+pHV2NvESLuWwBQj8oAn8BMbOVJ92zqnGTAsveveJ l2X3PRKJnGJoQ8FUoek96bVBVSpbODTuYkYcRt6BnXQaE/WNVkfdtwalbSM3Zaf/ +t57sA== 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 42a8mv8c9n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Oct 2024 10:06:26 +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 4889A40050; Wed, 16 Oct 2024 10:05:18 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 9551923CB2C; Wed, 16 Oct 2024 10:04:33 +0200 (CEST) Received: from localhost (10.48.86.225) 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; Wed, 16 Oct 2024 10:04:33 +0200 From: Gatien Chevallier Date: Wed, 16 Oct 2024 10:04:19 +0200 Subject: [PATCH v4 2/4] hwrng: stm32 - implement support for STM32MP25x platforms Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20241016-rng-mp25-v2-v4-2-5dca590cb092@foss.st.com> References: <20241016-rng-mp25-v2-v4-0-5dca590cb092@foss.st.com> In-Reply-To: <20241016-rng-mp25-v2-v4-0-5dca590cb092@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: EQNCAS1NODE3.st.com (10.75.129.80) 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 Reviewed-by: Marek Vasut --- Changes in V4: - Added Marek's tag Changes in V3: - Use clk_bulk APIs in the RNG driver to avoid manually handling clocks. 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 | 74 ++++++++++++++++++++++++++++------= ---- 1 file changed, 56 insertions(+), 18 deletions(-) diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/st= m32-rng.c index 9d041a67c295a54d283d235bbcf5a9ab7a8baa5c..279328902bf89af15b8ca9df9a0= 61bf2a1ddcf55 100644 --- a/drivers/char/hw_random/stm32-rng.c +++ b/drivers/char/hw_random/stm32-rng.c @@ -4,6 +4,7 @@ */ =20 #include +#include #include #include #include @@ -49,6 +50,7 @@ =20 struct stm32_rng_data { uint max_clock_rate; + uint nb_clock; u32 cr; u32 nscr; u32 htcr; @@ -72,7 +74,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 +268,7 @@ static uint stm32_rng_clock_freq_restrain(struct hwrng = *rng) unsigned long clock_rate =3D 0; uint clock_div =3D 0; =20 - clock_rate =3D clk_get_rate(priv->clk); + clock_rate =3D clk_get_rate(priv->clk_bulk[0].clk); =20 /* * Get the exponent to apply on the CLKDIV field in RNG_CR register @@ -276,7 +278,7 @@ static uint stm32_rng_clock_freq_restrain(struct hwrng = *rng) while ((clock_rate >> clock_div) > priv->data->max_clock_rate) clock_div++; =20 - 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) >> c= lock_div); =20 return clock_div; } @@ -288,7 +290,7 @@ static int stm32_rng_init(struct hwrng *rng) int err; u32 reg; =20 - err =3D clk_prepare_enable(priv->clk); + err =3D clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk); if (err) return err; =20 @@ -328,7 +330,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 +358,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; } =20 - clk_disable_unprepare(priv->clk); + clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk); =20 return 0; } @@ -379,7 +382,8 @@ static int __maybe_unused stm32_rng_runtime_suspend(str= uct device *dev) reg =3D readl_relaxed(priv->base + RNG_CR); reg &=3D ~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); =20 return 0; } @@ -389,7 +393,7 @@ static int __maybe_unused stm32_rng_suspend(struct devi= ce *dev) struct stm32_rng_private *priv =3D dev_get_drvdata(dev); int err; =20 - err =3D clk_prepare_enable(priv->clk); + err =3D clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk); if (err) return err; =20 @@ -403,7 +407,7 @@ static int __maybe_unused stm32_rng_suspend(struct devi= ce *dev) =20 writel_relaxed(priv->pm_conf.cr, priv->base + RNG_CR); =20 - clk_disable_unprepare(priv->clk); + clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk); =20 return 0; } @@ -414,7 +418,7 @@ static int __maybe_unused stm32_rng_runtime_resume(stru= ct device *dev) int err; u32 reg; =20 - err =3D clk_prepare_enable(priv->clk); + err =3D clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk); if (err) return err; =20 @@ -434,7 +438,7 @@ static int __maybe_unused stm32_rng_resume(struct devic= e *dev) int err; u32 reg; =20 - err =3D clk_prepare_enable(priv->clk); + err =3D clk_bulk_prepare_enable(priv->data->nb_clock, priv->clk_bulk); if (err) return err; =20 @@ -462,7 +466,7 @@ static int __maybe_unused stm32_rng_resume(struct devic= e *dev) reg & ~RNG_CR_CONDRST, 10, 100000); =20 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 +476,7 @@ static int __maybe_unused stm32_rng_resume(struct devic= e *dev) writel_relaxed(reg, priv->base + RNG_CR); } =20 - clk_disable_unprepare(priv->clk); + clk_bulk_disable_unprepare(priv->data->nb_clock, priv->clk_bulk); =20 return 0; } @@ -484,9 +488,19 @@ static const struct dev_pm_ops __maybe_unused stm32_rn= g_pm_ops =3D { stm32_rng_resume) }; =20 +static const struct stm32_rng_data stm32mp25_rng_data =3D { + .has_cond_reset =3D true, + .max_clock_rate =3D 48000000, + .nb_clock =3D 2, + .cr =3D 0x00F00D00, + .nscr =3D 0x2B5BB, + .htcr =3D 0x969D, +}; + static const struct stm32_rng_data stm32mp13_rng_data =3D { .has_cond_reset =3D true, .max_clock_rate =3D 48000000, + .nb_clock =3D 1, .cr =3D 0x00F00D00, .nscr =3D 0x2B5BB, .htcr =3D 0x969D, @@ -495,9 +509,14 @@ static const struct stm32_rng_data stm32mp13_rng_data = =3D { static const struct stm32_rng_data stm32_rng_data =3D { .has_cond_reset =3D false, .max_clock_rate =3D 3000000, + .nb_clock =3D 1, }; =20 static const struct of_device_id stm32_rng_match[] =3D { + { + .compatible =3D "st,stm32mp25-rng", + .data =3D &stm32mp25_rng_data, + }, { .compatible =3D "st,stm32mp13-rng", .data =3D &stm32mp13_rng_data, @@ -516,6 +535,7 @@ static int stm32_rng_probe(struct platform_device *ofde= v) struct device_node *np =3D ofdev->dev.of_node; struct stm32_rng_private *priv; struct resource *res; + int ret; =20 priv =3D devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -525,10 +545,6 @@ static int stm32_rng_probe(struct platform_device *ofd= ev) if (IS_ERR(priv->base)) return PTR_ERR(priv->base); =20 - priv->clk =3D devm_clk_get(&ofdev->dev, NULL); - if (IS_ERR(priv->clk)) - return PTR_ERR(priv->clk); - priv->rst =3D devm_reset_control_get(&ofdev->dev, NULL); if (!IS_ERR(priv->rst)) { reset_control_assert(priv->rst); @@ -551,6 +567,28 @@ static int stm32_rng_probe(struct platform_device *ofd= ev) priv->rng.read =3D stm32_rng_read; priv->rng.quality =3D 900; =20 + if (!priv->data->nb_clock || priv->data->nb_clock > 2) + return -EINVAL; + + ret =3D devm_clk_bulk_get_all(dev, &priv->clk_bulk); + if (ret !=3D priv->data->nb_clock) + return dev_err_probe(dev, -EINVAL, "Failed to get clocks: %d\n", ret); + + if (priv->data->nb_clock =3D=3D 2) { + const char *id =3D priv->clk_bulk[1].id; + struct clk *clk =3D priv->clk_bulk[1].clk; + + if (!priv->clk_bulk[0].id || !priv->clk_bulk[1].id) + return dev_err_probe(dev, -EINVAL, "Missing clock name\n"); + + if (strcmp(priv->clk_bulk[0].id, "core")) { + priv->clk_bulk[1].id =3D priv->clk_bulk[0].id; + priv->clk_bulk[1].clk =3D priv->clk_bulk[0].clk; + priv->clk_bulk[0].id =3D id; + priv->clk_bulk[0].clk =3D clk; + } + } + pm_runtime_set_autosuspend_delay(dev, 100); pm_runtime_use_autosuspend(dev); pm_runtime_enable(dev); --=20 2.25.1 From nobody Tue Nov 26 19:59:52 2024 Received: from mx07-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 506B61D26E0; Wed, 16 Oct 2024 08:06:46 +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=1729066009; cv=none; b=EtSXiOLSgIG43lr36kOwMAIzQUVVKZ7xLW0iT1GoMcV8pAZs7HAjwDskfANU2/wMp5qG/AAra+XONmH/xd6R+KaG4EYg1+6RQeuOii5uMl5hBRrHsypyyK1+CQY1mkAkhLbp7LrjvU8p44xWA6B3gX+G8wl9YcEq7S7Waetfy+s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729066009; c=relaxed/simple; bh=I4iWyFgFIpIpyNQzJqLRDERhYBCEmkQ41tqVFqd2kk8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=iQWoBq7zEdUMMPF6Wyi+Iqub5V7JY75oZA/2TTRqXcgmgY1+7OudA4B8jOY71EhRzZ3sXeYfTQo3EuSTl6fa/GtQJE+llSRvEaASEBADnpRkn8Fv1A7CBuqeJo1C8/Y0/e64Q4TBEgAKruXBMTOvE+rl5WtI6Ewhpj54frfKBRc= 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=tY+4DGXF; 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="tY+4DGXF" Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49G3SgLE011399; Wed, 16 Oct 2024 10:06:26 +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= QYf7I5bZM+g/zbxxwONC8wmKlEdNvZg+vARUi+5HicI=; b=tY+4DGXFGVQN7z+3 7G/HdKmFOCq1mtJoKRlPdY5CyHRprLFsgcWUirLNBnKEb1lLdG+vBNrclGsNdlhh 4/Q1DGod6MtC5unDD3bYONam8k8PeAtCvQRhSTRUjorN4uBkWUtXrHz59tCnlU0A IU2VrNsS95CoeVdVdhrnHD3Zo0JpPcA72bXoGGjZsGBe9IBgWwpGLD6S+hZS/KqM B8UZjIVpB1775y8ix7jZxvAu8DBfkwwYRZpXRTdQX6Fqbm8vQYR42knGhddaQDIE iNrcP0+fV4V0Th+ykhpN9aTYEwT0hK5S65JdVNqdWFi0/Depo4iWnBXoVrx0HjFc m/aF3A== 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 429qybc30u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Oct 2024 10:06:26 +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 0CC664004A; Wed, 16 Oct 2024 10:05:18 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 6071323CB55; Wed, 16 Oct 2024 10:04:34 +0200 (CEST) Received: from localhost (10.48.86.225) 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; Wed, 16 Oct 2024 10:04:34 +0200 From: Gatien Chevallier Date: Wed, 16 Oct 2024 10:04:20 +0200 Subject: [PATCH v4 3/4] hwrng: stm32 - update STM32MP15 RNG max clock frequency Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20241016-rng-mp25-v2-v4-3-5dca590cb092@foss.st.com> References: <20241016-rng-mp25-v2-v4-0-5dca590cb092@foss.st.com> In-Reply-To: <20241016-rng-mp25-v2-v4-0-5dca590cb092@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: EQNCAS1NODE3.st.com (10.75.129.80) 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 Reviewed-by: Marek Vasut --- Changes in V3: - Added Marek's tag --- 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/st= m32-rng.c index 279328902bf89af15b8ca9df9a061bf2a1ddcf55..5b4fb35bcb5cf7faa257286660b= 88c5840f0d07d 100644 --- a/drivers/char/hw_random/stm32-rng.c +++ b/drivers/char/hw_random/stm32-rng.c @@ -508,7 +508,7 @@ static const struct stm32_rng_data stm32mp13_rng_data = =3D { =20 static const struct stm32_rng_data stm32_rng_data =3D { .has_cond_reset =3D false, - .max_clock_rate =3D 3000000, + .max_clock_rate =3D 48000000, .nb_clock =3D 1, }; =20 --=20 2.25.1 From nobody Tue Nov 26 19:59:52 2024 Received: from mx07-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 4E14E1D1F7B; Wed, 16 Oct 2024 08:06:46 +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=1729066008; cv=none; b=Jw4CPiDcp1Xv6tv6fGzD2YuYUEneDgc1OUp8TWSYWtX1isYmZC/ha/9ILM3I9SSiPlDaw9F0CrGpu76G+i2jbnHJ+yzaWbzikix1+zBvXdBayiZaKO8IP17wzL6aNOTzcrnoLbVClyPWnEx5GVS+5fKNdm28p+eo/qZzR6o7n3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729066008; c=relaxed/simple; bh=OoWOGY/fJLZ3KKu0Dz/9OyTXJqtsYBG2qgsIrKosHHs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=pK5e41alYi9lkiIQjW6IKdoPRfDxlLYIlSEYN8qDJtFE+ygiUSW+IudRucqZhkhrIUNpIcVg9DLKjaCy14vQqXoB5W3vSdWjova/Nl/pgBO1G2Wx8YrsRYiUcAnSH/jJQcdI6YhEitk6fSmexPoMnDjRwLqyuLqHriP1lLdCUic= 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=khrtD/Mm; 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="khrtD/Mm" Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49G3xQ9L011471; Wed, 16 Oct 2024 10:06:26 +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= ujwJiGYrgOTn+uhgNNQmIEEtl3sMpGZHZQWu+RiZjSY=; b=khrtD/Mm7Y83qsgZ nO2AgP1P/1jvUN0Aig4IA70mJ8mKWH3sx9IHAR/ffZrB+cic9evP5DSRRYDInkt8 8fOr9LlHT/etBg3atLTOI85tM0RjeFrAaFdiGKZFmOMecffj6qRY7dEujiQhJZti ws2q4C8jv5bmSsKQvT6dcHI6OPJi+tPJIqJGZiv0xFIruZ2RYstdgtaPOXPd81Uy 69gK3dBMNgoYmui3LSSJE9I+L0vqmXRa7v1JhOEhIf9VrV/UGOS4w7dW0FmNPUNR HnwrX8cYhatCSd8amxvzXoEzXnQtTFU6qsUUqoKRazn7eCoyfardu/4vs7qdhWvU RPsMqg== 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 429qybc30v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Oct 2024 10:06:26 +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 8113840056; Wed, 16 Oct 2024 10:05:21 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 29CF92347CF; Wed, 16 Oct 2024 10:04:35 +0200 (CEST) Received: from localhost (10.48.86.225) 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; Wed, 16 Oct 2024 10:04:34 +0200 From: Gatien Chevallier Date: Wed, 16 Oct 2024 10:04:21 +0200 Subject: [PATCH v4 4/4] arm64: dts: st: add RNG node on stm32mp251 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20241016-rng-mp25-v2-v4-4-5dca590cb092@foss.st.com> References: <20241016-rng-mp25-v2-v4-0-5dca590cb092@foss.st.com> In-Reply-To: <20241016-rng-mp25-v2-v4-0-5dca590cb092@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: EQNCAS1NODE3.st.com (10.75.129.80) 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 V3 -Applied Marek tag 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/s= t/stm32mp251.dtsi index 1167cf63d7e87aaa15c5c1ed70a9f6511fd818d4..273da5f62294422b587b13404b4= 99b5ffe6c148e 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 =3D "disabled"; }; =20 + rng: rng@42020000 { + compatible =3D "st,stm32mp25-rng"; + reg =3D <0x42020000 0x400>; + clocks =3D <&clk_rcbsec>, <&rcc CK_BUS_RNG>; + clock-names =3D "core", "bus"; + resets =3D <&rcc RNG_R>; + access-controllers =3D <&rifsc 92>; + status =3D "disabled"; + }; + spi8: spi@46020000 { #address-cells =3D <1>; #size-cells =3D <0>; --=20 2.25.1