18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> 38c2ecf20Sopenharmony_ci */ 48c2ecf20Sopenharmony_ci#ifndef _SJA1105_DYNAMIC_CONFIG_H 58c2ecf20Sopenharmony_ci#define _SJA1105_DYNAMIC_CONFIG_H 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include "sja1105.h" 88c2ecf20Sopenharmony_ci#include <linux/packing.h> 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/* Special index that can be used for sja1105_dynamic_config_read */ 118c2ecf20Sopenharmony_ci#define SJA1105_SEARCH -1 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_cistruct sja1105_dyn_cmd; 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_cistruct sja1105_dynamic_table_ops { 168c2ecf20Sopenharmony_ci /* This returns size_t just to keep same prototype as the 178c2ecf20Sopenharmony_ci * static config ops, of which we are reusing some functions. 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_ci size_t (*entry_packing)(void *buf, void *entry_ptr, enum packing_op op); 208c2ecf20Sopenharmony_ci void (*cmd_packing)(void *buf, struct sja1105_dyn_cmd *cmd, 218c2ecf20Sopenharmony_ci enum packing_op op); 228c2ecf20Sopenharmony_ci size_t max_entry_count; 238c2ecf20Sopenharmony_ci size_t packed_size; 248c2ecf20Sopenharmony_ci u64 addr; 258c2ecf20Sopenharmony_ci u8 access; 268c2ecf20Sopenharmony_ci}; 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_cistruct sja1105_mgmt_entry { 298c2ecf20Sopenharmony_ci u64 tsreg; 308c2ecf20Sopenharmony_ci u64 takets; 318c2ecf20Sopenharmony_ci u64 macaddr; 328c2ecf20Sopenharmony_ci u64 destports; 338c2ecf20Sopenharmony_ci u64 enfport; 348c2ecf20Sopenharmony_ci u64 index; 358c2ecf20Sopenharmony_ci}; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ciextern const struct sja1105_dynamic_table_ops sja1105et_dyn_ops[BLK_IDX_MAX_DYN]; 388c2ecf20Sopenharmony_ciextern const struct sja1105_dynamic_table_ops sja1105pqrs_dyn_ops[BLK_IDX_MAX_DYN]; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#endif 41