|
20 | 20 | extern "C" { |
21 | 21 | #endif |
22 | 22 |
|
| 23 | +/* Helper macros for checking property status across instances */ |
| 24 | +#define DT_INST_NODE_PROP_NOT_OR(inst, prop) !DT_INST_PROP(inst, prop) || |
| 25 | +#define DT_ANY_INST_NOT_PROP_STATUS_OKAY(prop) \ |
| 26 | + (DT_INST_FOREACH_STATUS_OKAY_VARGS(DT_INST_NODE_PROP_NOT_OR, prop) 0) |
| 27 | + |
| 28 | +#define DT_INST_NODE_PROP_AND_OR(inst, prop) DT_INST_PROP(inst, prop) || |
| 29 | +#define DT_ANY_INST_PROP_STATUS_OKAY(prop) \ |
| 30 | + (DT_INST_FOREACH_STATUS_OKAY_VARGS(DT_INST_NODE_PROP_AND_OR, prop) 0) |
| 31 | + |
23 | 32 | typedef void (*spi_dw_config_t)(void); |
24 | 33 | typedef uint32_t (*spi_dw_read_t)(uint8_t size, mm_reg_t addr, uint32_t off); |
25 | 34 | typedef void (*spi_dw_write_t)(uint8_t size, uint32_t data, mm_reg_t addr, uint32_t off); |
@@ -48,22 +57,14 @@ struct spi_dw_config { |
48 | 57 | struct spi_dw_data { |
49 | 58 | DEVICE_MMIO_RAM; |
50 | 59 | struct spi_context ctx; |
| 60 | +#if !DT_ANY_INST_PROP_STATUS_OKAY(aux_reg) |
51 | 61 | uint32_t version; /* ssi comp version */ |
| 62 | +#endif |
52 | 63 | uint8_t dfs; /* dfs in bytes: 1,2 or 4 */ |
53 | 64 | uint8_t fifo_diff; /* cannot be bigger than FIFO depth */ |
54 | 65 | }; |
55 | 66 |
|
56 | 67 | /* Register operation functions */ |
57 | | -#define DT_INST_NODE_PROP_NOT_OR(inst, prop) \ |
58 | | - !DT_INST_PROP(inst, prop) || |
59 | | -#define DT_ANY_INST_NOT_PROP_STATUS_OKAY(prop) \ |
60 | | - (DT_INST_FOREACH_STATUS_OKAY_VARGS(DT_INST_NODE_PROP_NOT_OR, prop) 0) |
61 | | - |
62 | | -#define DT_INST_NODE_PROP_AND_OR(inst, prop) \ |
63 | | - DT_INST_PROP(inst, prop) || |
64 | | -#define DT_ANY_INST_PROP_STATUS_OKAY(prop) \ |
65 | | - (DT_INST_FOREACH_STATUS_OKAY_VARGS(DT_INST_NODE_PROP_AND_OR, prop) 0) |
66 | | - |
67 | 68 | #if DT_ANY_INST_PROP_STATUS_OKAY(aux_reg) |
68 | 69 | static uint32_t aux_reg_read(uint8_t size, mm_reg_t addr, uint32_t off) |
69 | 70 | { |
|
0 commit comments