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: <5c9ba9543222f4b7a8199ad5992aee9fecd8bc1f.1721999833.git.geert+renesas@glider.be>
Date: Fri, 26 Jul 2024 15:38:10 +0200
From: Geert Uytterhoeven <geert+renesas@...der.be>
To: Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Magnus Damm <magnus.damm@...il.com>,
	Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
	Arnd Bergmann <arnd@...db.de>
Cc: devicetree@...r.kernel.org,
	linux-renesas-soc@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Geert Uytterhoeven <geert+renesas@...der.be>
Subject: [PATCH v3 5/7] arm64: dts: renesas: r8a779f4: Add UFS tuning parameters in E-FUSE

Describe the location in the E-FUSE block of the PLL and AFE tuning
parameters for the Universal Flash Storage controller.

Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
---
v3:
  - New.

After adding:

    &ufs {
	    nvmem-cells = <&ufs_tune>;
	    nvmem-cell-names = "calibration";
    };

The calibration data can be retrieved using the following sample code:

    #include <linux/nvmem-consumer.h>

    static int nvmem_dump_cell(struct platform_device *pdev, const char *name)
    {
	    struct device *dev = &pdev->dev;
	    struct nvmem_cell *cell;
	    int res = 0;
	    void *data;
	    size_t len;

	    cell = nvmem_cell_get(dev, name);
	    if (IS_ERR(cell))
		    return dev_err_probe(dev, PTR_ERR(cell),
					 "Failed to get cell %s\n", name);

	    data = nvmem_cell_read(cell, &len);
	    if (IS_ERR(data)) {
		    res = dev_err_probe(dev, PTR_ERR(data),
					"Failed to read cell %s\n", name);
		    goto put;
	    }

	    pr_info("Cell %s contains %zu bytes of data\n", name, len);
	    print_hex_dump(KERN_INFO, "| ", DUMP_PREFIX_NONE, 32, 1, data, len, 0);

	    kfree(data);
    put:
	    nvmem_cell_put(cell);
	    return res;
    }

Calling nvmem_dump_cell(pdev, "calibration") from ufs_renesas_probe() on
the R-Car S4 Starter Kit development board gives:

    Cell calibration contains 8 bytes of data
    | 23 51 23 51 52 98 52 98
---
 arch/arm64/boot/dts/renesas/r8a779f4.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a779f4.dtsi b/arch/arm64/boot/dts/renesas/r8a779f4.dtsi
index ebed41892df3346c..dfa3c015e04b740c 100644
--- a/arch/arm64/boot/dts/renesas/r8a779f4.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a779f4.dtsi
@@ -10,3 +10,15 @@
 / {
 	compatible = "renesas,r8a779f4", "renesas,r8a779f0";
 };
+
+&fuse {
+	nvmem-layout {
+		compatible = "fixed-layout";
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		ufs_tune: calib@144 {
+			reg = <0x144 0x08>;
+		};
+	};
+};
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ