summaryrefslogtreecommitdiff
path: root/zephyr/projects/intelrvp/src/intel_rvp_board_id.c
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/projects/intelrvp/src/intel_rvp_board_id.c')
-rw-r--r--zephyr/projects/intelrvp/src/intel_rvp_board_id.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/zephyr/projects/intelrvp/src/intel_rvp_board_id.c b/zephyr/projects/intelrvp/src/intel_rvp_board_id.c
new file mode 100644
index 0000000000..77d4e93afd
--- /dev/null
+++ b/zephyr/projects/intelrvp/src/intel_rvp_board_id.c
@@ -0,0 +1,30 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <zephyr/devicetree.h>
+#include "intel_rvp_board_id.h"
+
+#define DT_DRV_COMPAT intel_rvp_board_id
+
+BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) <= 1,
+ "Unsupported RVP Board ID instance");
+
+#define RVP_ID_GPIO_DT_SPEC_GET(idx, node_id, prop) \
+ GPIO_DT_SPEC_GET_BY_IDX(node_id, prop, idx),
+
+#define RVP_ID_CONFIG_LIST(node_id, prop) \
+ LISTIFY(DT_PROP_LEN(node_id, prop), RVP_ID_GPIO_DT_SPEC_GET, (), \
+ node_id, prop)
+
+#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
+const struct gpio_dt_spec bom_id_config[] = { RVP_ID_CONFIG_LIST(DT_DRV_INST(0),
+ bom_gpios) };
+
+const struct gpio_dt_spec fab_id_config[] = { RVP_ID_CONFIG_LIST(DT_DRV_INST(0),
+ fab_gpios) };
+
+const struct gpio_dt_spec board_id_config[] = { RVP_ID_CONFIG_LIST(
+ DT_DRV_INST(0), board_gpios) };
+#endif /* #if DT_HAS_COMPAT_STATUS_OKAY */