1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
3  */
4 #ifndef _SJA1105_DYNAMIC_CONFIG_H
5 #define _SJA1105_DYNAMIC_CONFIG_H
6 
7 #include "sja1105.h"
8 #include <linux/packing.h>
9 
10 /* Special index that can be used for sja1105_dynamic_config_read */
11 #define SJA1105_SEARCH		-1
12 
13 struct sja1105_dyn_cmd;
14 
15 struct sja1105_dynamic_table_ops {
16 	/* This returns size_t just to keep same prototype as the
17 	 * static config ops, of which we are reusing some functions.
18 	 */
19 	size_t (*entry_packing)(void *buf, void *entry_ptr, enum packing_op op);
20 	void (*cmd_packing)(void *buf, struct sja1105_dyn_cmd *cmd,
21 			    enum packing_op op);
22 	size_t max_entry_count;
23 	size_t packed_size;
24 	u64 addr;
25 	u8 access;
26 };
27 
28 struct sja1105_mgmt_entry {
29 	u64 tsreg;
30 	u64 takets;
31 	u64 macaddr;
32 	u64 destports;
33 	u64 enfport;
34 	u64 index;
35 };
36 
37 extern const struct sja1105_dynamic_table_ops sja1105et_dyn_ops[BLK_IDX_MAX_DYN];
38 extern const struct sja1105_dynamic_table_ops sja1105pqrs_dyn_ops[BLK_IDX_MAX_DYN];
39 extern const struct sja1105_dynamic_table_ops sja1110_dyn_ops[BLK_IDX_MAX_DYN];
40 
41 #endif
42