[PATCH v15 35/35] crypto: amlogic: keep the bus clock enabled
From: Jose Nieto
Date: Wed Dec 02 2026 - 05:12:24 EST
The crypto node lists a clock (clk81 on GXL/G12A/AXG, the system clock on
A1/S4) and the binding requires it, but the driver stopped claiming and
enabling it. Relying on the bootloader or on the clock being marked
critical is fragile, so get and enable the clock from the device tree
again.
The clock has a single entry and no clock-names, so devm_clk_get_enabled()
is called with a NULL connection id.
Signed-off-by: Jose Nieto <jnieto.alaber@xxxxxxxxx>
---
drivers/crypto/amlogic/amlogic-gxl-core.c | 8 ++++++++
drivers/crypto/amlogic/amlogic-gxl.h | 4 ++++
2 files changed, 12 insertions(+)
diff --git a/drivers/crypto/amlogic/amlogic-gxl-core.c b/drivers/crypto/amlogic/amlogic-gxl-core.c
index 18c1edad9475..02d831ae2e1b 100644
--- a/drivers/crypto/amlogic/amlogic-gxl-core.c
+++ b/drivers/crypto/amlogic/amlogic-gxl-core.c
@@ -9,6 +9,7 @@
#include <crypto/engine.h>
#include <crypto/internal/skcipher.h>
+#include <linux/clk.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/interrupt.h>
@@ -236,6 +237,13 @@ static int meson_crypto_probe(struct platform_device *pdev)
if (IS_ERR(mc->base))
return PTR_ERR(mc->base);
+ mc->busclk = devm_clk_get_enabled(&pdev->dev, NULL);
+ if (IS_ERR(mc->busclk)) {
+ err = PTR_ERR(mc->busclk);
+ dev_err(&pdev->dev, "Cannot get/enable core clock err=%d\n", err);
+ return err;
+ }
+
err = meson_allocate_chanlist(mc);
if (err)
return err;
diff --git a/drivers/crypto/amlogic/amlogic-gxl.h b/drivers/crypto/amlogic/amlogic-gxl.h
index 2a298763b99b..122578fd0ab0 100644
--- a/drivers/crypto/amlogic/amlogic-gxl.h
+++ b/drivers/crypto/amlogic/amlogic-gxl.h
@@ -12,6 +12,8 @@
#include <linux/crypto.h>
#include <linux/scatterlist.h>
+struct clk;
+
#define MESON_DECRYPT 0
#define MESON_ENCRYPT 1
@@ -105,6 +107,7 @@ struct meson_pdata {
/*
* struct meson_dev - main container for all this driver information
* @base: base address of amlogic-crypto
+ * @busclk: bus clock for amlogic-crypto
* @dev: the platform device
* @chanlist: array of all flow
* @flow: flow to use in next request
@@ -113,6 +116,7 @@ struct meson_pdata {
*/
struct meson_dev {
void __iomem *base;
+ struct clk *busclk;
struct device *dev;
const struct meson_pdata *pdata;
struct meson_flow *chanlist;
--
2.47.3