Add an EVT_LAST_STAGE_INIT hook that drives the +3V3_FAN fixed
regulator on, so the FAN daughterboard's EMC2305 / TMP411 / EEPROM
become visible with the "i2c probe" command.

Signed-off-by: Vincent Jardin <[email protected]>
---

(no changes since v1)

 board/nxp/lx2160a/nbxv3/Makefile    |  1 +
 board/nxp/lx2160a/nbxv3/fan_power.c | 33 +++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 board/nxp/lx2160a/nbxv3/fan_power.c

diff --git a/board/nxp/lx2160a/nbxv3/Makefile b/board/nxp/lx2160a/nbxv3/Makefile
index bea6b0aae8b..9c93965dc95 100644
--- a/board/nxp/lx2160a/nbxv3/Makefile
+++ b/board/nxp/lx2160a/nbxv3/Makefile
@@ -8,3 +8,4 @@ obj-y += psu_pmbus.o
 obj-y += vid_handoff.o
 obj-y += carrier.o
 obj-y += dpll_zl30733.o
+obj-y += fan_power.o
diff --git a/board/nxp/lx2160a/nbxv3/fan_power.c 
b/board/nxp/lx2160a/nbxv3/fan_power.c
new file mode 100644
index 00000000000..b569b695ae7
--- /dev/null
+++ b/board/nxp/lx2160a/nbxv3/fan_power.c
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2026 Free Mobile - Vincent Jardin
+ *
+ * Enforce Nodebox v3 FAN-daughterboard enable.
+ *
+ * Note: it tequires CONFIG_DM_REGULATOR_FIXED
+ */
+
+#include <dm.h>
+#include <event.h>
+#include <power/regulator.h>
+
+/* `regulator-name = "+3V3_FAN"` in the nbxv3 DTS. */
+#define NBXV3_FAN_REGULATOR_NAME       "+3V3_FAN"
+
+static int nbxv3_fan_power_last_stage_init(void)
+{
+       struct udevice *reg = NULL;
+       int ret;
+
+       if (regulator_get_by_platname(NBXV3_FAN_REGULATOR_NAME, &reg) || !reg)
+               return 0;
+
+       ret = regulator_set_enable_if_allowed(reg, true);
+       if (ret)
+               printf("nbxv3: %s enable failed (%d)\n",
+                      NBXV3_FAN_REGULATOR_NAME, ret);
+
+       return 0;
+}
+
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, nbxv3_fan_power_last_stage_init);
-- 
2.43.0

Reply via email to