lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240821105943.230281-12-ada@thorsis.com>
Date: Wed, 21 Aug 2024 12:59:42 +0200
From: Alexander Dahl <ada@...rsis.com>
To: Claudiu Beznea <claudiu.beznea@...on.dev>
Cc: Christian Melki <christian.melki@...ata.com>,
	Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
	linux-arm-kernel@...ts.infradead.org (moderated list:MICROCHIP OTPC DRIVER),
	linux-kernel@...r.kernel.org (open list)
Subject: [PATCH v1 11/12] nvmem: microchip-otpc: Enable main RC oscillator clock

Without enabling that clock, initializing the packet list leads to a
read timeout on the first packet.

According to SAM9X60 datasheet (DS60001579G) section "23.4 Product
Dependencies" the clock must be enabled for reading and writing.

Tested on sam9x60-curiosity board.

Signed-off-by: Alexander Dahl <ada@...rsis.com>
---
 drivers/nvmem/microchip-otpc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/nvmem/microchip-otpc.c b/drivers/nvmem/microchip-otpc.c
index a80535c3d162..047ca5ac6407 100644
--- a/drivers/nvmem/microchip-otpc.c
+++ b/drivers/nvmem/microchip-otpc.c
@@ -8,6 +8,7 @@
  */
 
 #include <linux/bitfield.h>
+#include <linux/clk.h>
 #include <linux/dev_printk.h>
 #include <linux/iopoll.h>
 #include <linux/module.h>
@@ -54,6 +55,7 @@
 struct mchp_otpc {
 	void __iomem *base;
 	struct device *dev;
+	struct clk *clk;
 	struct list_head packets;
 	u32 npackets;
 };
@@ -272,6 +274,15 @@ static int mchp_otpc_probe(struct platform_device *pdev)
 	if (IS_ERR(otpc->base))
 		return PTR_ERR(otpc->base);
 
+	// NOTE: Maybe make this optional, especially if sama7g5 testing
+	// shows the clock is not required there?
+	otpc->clk = devm_clk_get_enabled(&pdev->dev, "main_rc_osc");
+	if (IS_ERR(otpc->clk)) {
+		dev_err(&pdev->dev, "Error (%ld) getting clock!\n",
+			PTR_ERR(otpc->clk));
+		return PTR_ERR(otpc->clk);
+	}
+
 	reg = readl_relaxed(otpc->base + MCHP_OTPC_WPSR);
 	if (reg)
 		dev_warn(&pdev->dev,
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ