[PATCH 2/5] ARM: stm32mp: migrate to barebox,machine-id-path

Ahmad Fatoum a.fatoum at pengutronix.de
Sun Jun 27 23:40:33 PDT 2021


All STM32MP1 boards use a device tree that includes stm32mp151.dtsi, so
we can just make use of the new property there and drop machine_id_set_hashable
without affecting behavior.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/arm/dts/stm32mp151.dtsi |  8 ++++++++
 drivers/nvmem/bsec.c         | 17 -----------------
 2 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/arch/arm/dts/stm32mp151.dtsi b/arch/arm/dts/stm32mp151.dtsi
index f1fd888fa1c6..eb3c6222e785 100644
--- a/arch/arm/dts/stm32mp151.dtsi
+++ b/arch/arm/dts/stm32mp151.dtsi
@@ -31,6 +31,10 @@
 		tamp.reboot_mode = &reboot_mode_tamp;
 	};
 
+	chosen {
+		barebox,machine-id-path = &otp_serial;
+	};
+
 };
 
 &{/clocks} {
@@ -61,6 +65,10 @@
 
 &bsec {
 	barebox,provide-mac-address = <&ethernet0 0x39>;
+
+	otp_serial: serial-number at 34 {
+		reg = <0x34 0xc>;
+	};
 };
 
 &vrefbuf {
diff --git a/drivers/nvmem/bsec.c b/drivers/nvmem/bsec.c
index d9b38c8414fb..097d34069afd 100644
--- a/drivers/nvmem/bsec.c
+++ b/drivers/nvmem/bsec.c
@@ -15,7 +15,6 @@
 #include <of.h>
 #include <regmap.h>
 #include <mach/bsec.h>
-#include <machine_id.h>
 #include <linux/nvmem-provider.h>
 
 #define BSEC_OTP_SERIAL	13
@@ -69,19 +68,6 @@ static struct regmap_bus stm32_bsec_regmap_bus = {
 	.reg_read = stm32_bsec_read_shadow,
 };
 
-static void stm32_bsec_set_unique_machine_id(struct regmap *map)
-{
-	u32 unique_id[3];
-	int ret;
-
-	ret = regmap_bulk_read(map, BSEC_OTP_SERIAL * 4,
-			       unique_id, sizeof(unique_id));
-	if (ret)
-		return;
-
-	machine_id_set_hashable(unique_id, sizeof(unique_id));
-}
-
 static int stm32_bsec_read_mac(struct regmap *map, int offset, u8 *mac)
 {
 	u8 res[8];
@@ -156,9 +142,6 @@ static int stm32_bsec_probe(struct device_d *dev)
 	if (IS_ERR(nvmem))
 		return PTR_ERR(nvmem);
 
-	if (IS_ENABLED(CONFIG_MACHINE_ID))
-		stm32_bsec_set_unique_machine_id(map);
-
 	stm32_bsec_init_dt(dev, map);
 
 	return 0;
-- 
2.30.2




More information about the barebox mailing list