net: dsa: sja1105: make the AVB table dynamically reconfigurable
The AVB table contains the CAS_MASTER field (to be added in the next patch) which decides the direction of the PTP_CLK pin. Reconfiguring this field dynamically is highly preferable to having to reset the switch and upload a new static configuration, so we add support for exactly that. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4bfa1616d9
commit
0a7e984c92
|
@ -214,5 +214,7 @@ size_t sja1105_vlan_lookup_entry_packing(void *buf, void *entry_ptr,
|
|||
enum packing_op op);
|
||||
size_t sja1105pqrs_mac_config_entry_packing(void *buf, void *entry_ptr,
|
||||
enum packing_op op);
|
||||
size_t sja1105pqrs_avb_params_entry_packing(void *buf, void *entry_ptr,
|
||||
enum packing_op op);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -124,6 +124,9 @@
|
|||
#define SJA1105ET_SIZE_GENERAL_PARAMS_DYN_CMD \
|
||||
SJA1105_SIZE_DYN_CMD
|
||||
|
||||
#define SJA1105PQRS_SIZE_AVB_PARAMS_DYN_CMD \
|
||||
(SJA1105_SIZE_DYN_CMD + SJA1105PQRS_SIZE_AVB_PARAMS_ENTRY)
|
||||
|
||||
#define SJA1105_MAX_DYN_CMD_SIZE \
|
||||
SJA1105PQRS_SIZE_MAC_CONFIG_DYN_CMD
|
||||
|
||||
|
@ -481,6 +484,18 @@ sja1105et_general_params_entry_packing(void *buf, void *entry_ptr,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
sja1105pqrs_avb_params_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd,
|
||||
enum packing_op op)
|
||||
{
|
||||
u8 *p = buf + SJA1105PQRS_SIZE_AVB_PARAMS_ENTRY;
|
||||
const int size = SJA1105_SIZE_DYN_CMD;
|
||||
|
||||
sja1105_packing(p, &cmd->valid, 31, 31, size, op);
|
||||
sja1105_packing(p, &cmd->errors, 30, 30, size, op);
|
||||
sja1105_packing(p, &cmd->rdwrset, 29, 29, size, op);
|
||||
}
|
||||
|
||||
#define OP_READ BIT(0)
|
||||
#define OP_WRITE BIT(1)
|
||||
#define OP_DEL BIT(2)
|
||||
|
@ -610,7 +625,14 @@ struct sja1105_dynamic_table_ops sja1105pqrs_dyn_ops[BLK_IDX_MAX_DYN] = {
|
|||
.addr = 0x38,
|
||||
},
|
||||
[BLK_IDX_L2_FORWARDING_PARAMS] = {0},
|
||||
[BLK_IDX_AVB_PARAMS] = {0},
|
||||
[BLK_IDX_AVB_PARAMS] = {
|
||||
.entry_packing = sja1105pqrs_avb_params_entry_packing,
|
||||
.cmd_packing = sja1105pqrs_avb_params_cmd_packing,
|
||||
.max_entry_count = SJA1105_MAX_AVB_PARAMS_COUNT,
|
||||
.access = (OP_READ | OP_WRITE),
|
||||
.packed_size = SJA1105PQRS_SIZE_AVB_PARAMS_DYN_CMD,
|
||||
.addr = 0x8003,
|
||||
},
|
||||
[BLK_IDX_GENERAL_PARAMS] = {
|
||||
.entry_packing = sja1105et_general_params_entry_packing,
|
||||
.cmd_packing = sja1105et_general_params_cmd_packing,
|
||||
|
|
|
@ -102,8 +102,8 @@ static size_t sja1105et_avb_params_entry_packing(void *buf, void *entry_ptr,
|
|||
return size;
|
||||
}
|
||||
|
||||
static size_t sja1105pqrs_avb_params_entry_packing(void *buf, void *entry_ptr,
|
||||
enum packing_op op)
|
||||
size_t sja1105pqrs_avb_params_entry_packing(void *buf, void *entry_ptr,
|
||||
enum packing_op op)
|
||||
{
|
||||
const size_t size = SJA1105PQRS_SIZE_AVB_PARAMS_ENTRY;
|
||||
struct sja1105_avb_params_entry *entry = entry_ptr;
|
||||
|
|
Loading…
Reference in New Issue