Skip to content

Commit 7da1a38

Browse files
mdegeNipaLocal
authored andcommitted
net: renesas: rswitch: configure default ageing time
Enable MAC ageing by setting up the timer and setting the ageging time to the default of 300s. Signed-off-by: Michael Dege <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 57057a2 commit 7da1a38

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

drivers/net/ethernet/renesas/rswitch.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
22
/* Renesas Ethernet Switch device driver
33
*
4-
* Copyright (C) 2022 Renesas Electronics Corporation
4+
* Copyright (C) 2022-2025 Renesas Electronics Corporation
55
*/
66

77
#ifndef __RSWITCH_H__
@@ -826,6 +826,18 @@ enum rswitch_gwca_mode {
826826

827827
#define FWPBFCSDC(j, i) (FWPBFCSDC00 + (i) * 0x10 + (j) * 0x04)
828828

829+
#define FWMACAGUSPC_MACAGUSP GENMASK(9, 0)
830+
#define FWMACAGC_MACAGT GENMASK(15, 0)
831+
#define FWMACAGC_MACAGE BIT(16)
832+
#define FWMACAGC_MACAGSL BIT(17)
833+
#define FWMACAGC_MACAGPM BIT(18)
834+
#define FWMACAGC_MACDES BIT(24)
835+
#define FWMACAGC_MACAGOG BIT(28)
836+
#define FWMACAGC_MACDESOG BIT(29)
837+
838+
#define RSW_AGEING_CLK_PER_US 0x140
839+
#define RSW_AGEING_TIME 300
840+
829841
/* TOP */
830842
#define TPEMIMC7(queue) (TPEMIMC70 + (queue) * 4)
831843

drivers/net/ethernet/renesas/rswitch_main.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/* Renesas Ethernet Switch device driver
33
*
4-
* Copyright (C) 2022 Renesas Electronics Corporation
4+
* Copyright (C) 2022-2025 Renesas Electronics Corporation
55
*/
66

77
#include <linux/clk.h>
@@ -113,6 +113,7 @@ static void rswitch_fwd_init(struct rswitch_private *priv)
113113
{
114114
u32 all_ports_mask = GENMASK(RSWITCH_NUM_AGENTS - 1, 0);
115115
unsigned int i;
116+
u32 reg_val;
116117

117118
/* Start with empty configuration */
118119
for (i = 0; i < RSWITCH_NUM_AGENTS; i++) {
@@ -128,6 +129,14 @@ static void rswitch_fwd_init(struct rswitch_private *priv)
128129
iowrite32(0, priv->addr + FWPBFC(i));
129130
}
130131

132+
/* Configure MAC table aging */
133+
rswitch_modify(priv->addr, FWMACAGUSPC, FWMACAGUSPC_MACAGUSP,
134+
FIELD_PREP(FWMACAGUSPC_MACAGUSP, RSW_AGEING_CLK_PER_US));
135+
136+
reg_val = FIELD_PREP(FWMACAGC_MACAGT, RSW_AGEING_TIME);
137+
reg_val |= FWMACAGC_MACAGE | FWMACAGC_MACAGSL;
138+
iowrite32(reg_val, priv->addr + FWMACAGC);
139+
131140
/* For enabled ETHA ports, setup port based forwarding */
132141
rswitch_for_each_enabled_port(priv, i) {
133142
/* Port based forwarding from port i to GWCA port */

0 commit comments

Comments
 (0)