summaryrefslogtreecommitdiff
path: root/zephyr/projects/intelrvp/src/intel_rvp_board_id.c
blob: d4172a468e675f80b3a4dd29b1dbb93a7d07a5ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* Copyright 2022 The Chromium OS Authors. All rights reserved.
 * 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 */