mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] imx25: Feed the unique id to machine_id_set_hashable()
@ 2024-03-12 15:48 Uwe Kleine-König
  2024-03-13  7:41 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2024-03-12 15:48 UTC (permalink / raw)
  To: barebox

This enables barebox on i.MX25 to generate a per-machine eth address.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 arch/arm/mach-imx/iim.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/mach-imx/iim.c b/arch/arm/mach-imx/iim.c
index 90ca644c2e62..f4581396b1a5 100644
--- a/arch/arm/mach-imx/iim.c
+++ b/arch/arm/mach-imx/iim.c
@@ -22,6 +22,7 @@
 #include <linux/regmap.h>
 #include <regulator.h>
 #include <linux/err.h>
+#include <machine_id.h>
 
 #include <mach/imx/iim.h>
 #include <mach/imx/imx51-regs.h>
@@ -504,6 +505,25 @@ static int imx_iim_probe(struct device *dev)
 	dev_add_param_bool(&iim->dev, "explicit_sense_enable",
 			NULL, NULL, &iim->sense_enable, NULL);
 
+	/* Maybe this is too strict? This might also work on i.MX31 and i.MX35 */
+	if (IS_ENABLED(CONFIG_MACHINE_ID) &&
+	    of_device_is_compatible(dev->of_node, "fsl,imx25-iim")) {
+		char uid[8];
+
+		for (i = 0; i < 8; ++i) {
+			unsigned int value;
+
+			ret = imx_iim_read_field(IMX25_IIM_UID(i), &value);
+			if (ret)
+				break;
+
+			uid[i] = value;
+		}
+
+		if (!ret)
+			machine_id_set_hashable(uid, 8);
+	}
+
 	return 0;
 }
 

base-commit: d27c50c131e7393f4640c20c711e2aad83543066
-- 
2.43.0




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] imx25: Feed the unique id to machine_id_set_hashable()
  2024-03-12 15:48 [PATCH] imx25: Feed the unique id to machine_id_set_hashable() Uwe Kleine-König
@ 2024-03-13  7:41 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-03-13  7:41 UTC (permalink / raw)
  To: barebox, Uwe Kleine-König


On Tue, 12 Mar 2024 16:48:27 +0100, Uwe Kleine-König wrote:
> This enables barebox on i.MX25 to generate a per-machine eth address.
> 
> 

Applied, thanks!

[1/1] imx25: Feed the unique id to machine_id_set_hashable()
      https://git.pengutronix.de/cgit/barebox/commit/?id=fccedb1a18e7 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-13  7:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-12 15:48 [PATCH] imx25: Feed the unique id to machine_id_set_hashable() Uwe Kleine-König
2024-03-13  7:41 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox