1 /*
2  * Copyright 2022 Google LLC
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #include <zephyr/device.h>
7 #include <zephyr/devicetree.h>
8 
9 #define DT_DRV_COMPAT zephyr_espi_emul_espi_host
10 
11 /* Stub out an espi host device struct to use espi_host emulator. */
emul_espi_host_init_stub(const struct device * dev)12 static int emul_espi_host_init_stub(const struct device *dev)
13 {
14 	ARG_UNUSED(dev);
15 
16 	return 0;
17 }
18 
19 struct emul_espi_host_stub_dev_data {
20 	/* Stub */
21 };
22 struct emul_espi_host_stub_dev_config {
23 	/* Stub */
24 };
25 struct emul_espi_host_stub_dev_api {
26 	/* Stub */
27 };
28 
29 /* Since this is only stub, allocate the structs once. */
30 static struct emul_espi_host_stub_dev_data stub_host_data;
31 static struct emul_espi_host_stub_dev_config stub_host_config;
32 static struct emul_espi_host_stub_dev_api stub_host_api;
33 
34 #define EMUL_ESPI_HOST_DEVICE_STUB(n)                                                              \
35 	DEVICE_DT_INST_DEFINE(n, &emul_espi_host_init_stub, NULL, &stub_host_data,                 \
36 			      &stub_host_config, POST_KERNEL, CONFIG_ESPI_INIT_PRIORITY,           \
37 			      &stub_host_api)
38 
39 DT_INST_FOREACH_STATUS_OKAY(EMUL_ESPI_HOST_DEVICE_STUB);
40