Probes the +3V3_FAN fixed regulator

The rail is regulator-always-on, so the probe drives it on and the FAN
daughterboard's EMC2305 / TMP411 / EEPROM become visible to
  i2c probe

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

 board/nxp/lx2160a/Kconfig           |  6 ++++++
 board/nxp/lx2160a/nbxv3/Makefile    |  1 +
 board/nxp/lx2160a/nbxv3/fan_power.c | 32 +++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+)
 create mode 100644 board/nxp/lx2160a/nbxv3/fan_power.c

diff --git a/board/nxp/lx2160a/Kconfig b/board/nxp/lx2160a/Kconfig
index 12d2e418aa5..efd245bb68a 100644
--- a/board/nxp/lx2160a/Kconfig
+++ b/board/nxp/lx2160a/Kconfig
@@ -83,4 +83,10 @@ config NBXV3_DPLL
        select DM_SPI
        select FSL_DSPI
 
+config NBXV3_FAN
+       bool
+       default y
+       select DM_REGULATOR
+       select DM_REGULATOR_FIXED
+
 endif
diff --git a/board/nxp/lx2160a/nbxv3/Makefile b/board/nxp/lx2160a/nbxv3/Makefile
index c8a676fb708..82063017432 100644
--- a/board/nxp/lx2160a/nbxv3/Makefile
+++ b/board/nxp/lx2160a/nbxv3/Makefile
@@ -8,3 +8,4 @@ obj-y += dpll_zl30733.o
 obj-y += mps_pmbus.o
 obj-y += psu_pmbus.o
 obj-y += vid_handoff.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..faa882b8bf8
--- /dev/null
+++ b/board/nxp/lx2160a/nbxv3/fan_power.c
@@ -0,0 +1,32 @@
+// 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