[PATCH v3 resend 5/7] arm64: dts: renesas: r8a779f4: Add UFS tuning parameters in E-FUSE

From: Geert Uytterhoeven
Date: Thu Oct 03 2024 - 10:04:51 EST


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@xxxxxxxxx>
---
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