Skip to content

Commit

Permalink
net: freescale: ucc_geth: Simplify frame length check
Browse files Browse the repository at this point in the history
The frame length check is configured when the phy interface is setup.
However, it's configured according to an internal flag that is always
false. So, just make so that we disable the relevant bit in the MACCFG2
register upon accessing it for other MAC configuration operations.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Maxime Chevallier authored and David S. Miller committed Dec 6, 2024
1 parent 420d56e commit 270ec33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
21 changes: 3 additions & 18 deletions drivers/net/ethernet/freescale/ucc_geth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1205,22 +1205,6 @@ static int init_mac_station_addr_regs(u8 address_byte_0,
return 0;
}

static int init_check_frame_length_mode(int length_check,
u32 __iomem *maccfg2_register)
{
u32 value = 0;

value = in_be32(maccfg2_register);

if (length_check)
value |= MACCFG2_LC;
else
value &= ~MACCFG2_LC;

out_be32(maccfg2_register, value);
return 0;
}

static int init_preamble_length(u8 preamble_length,
u32 __iomem *maccfg2_register)
{
Expand Down Expand Up @@ -1304,6 +1288,9 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)

/* Set MACCFG2 */
maccfg2 = in_be32(&ug_regs->maccfg2);

/* Disable frame length check */
maccfg2 &= ~MACCFG2_LC;
maccfg2 &= ~MACCFG2_INTERFACE_MODE_MASK;
if ((ugeth->max_speed == SPEED_10) ||
(ugeth->max_speed == SPEED_100))
Expand Down Expand Up @@ -1365,8 +1352,6 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
put_device(&tbiphy->mdio.dev);
}

init_check_frame_length_mode(ug_info->lengthCheckRx, &ug_regs->maccfg2);

ret_val = init_preamble_length(ug_info->prel, &ug_regs->maccfg2);
if (ret_val != 0) {
if (netif_msg_probe(ugeth))
Expand Down
1 change: 0 additions & 1 deletion drivers/net/ethernet/freescale/ucc_geth.h
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,6 @@ struct ucc_geth_info {
u8 miminumInterFrameGapEnforcement;
u8 backToBackInterFrameGap;
int ipAddressAlignment;
int lengthCheckRx;
u32 mblinterval;
u16 nortsrbytetime;
u8 fracsiz;
Expand Down

0 comments on commit 270ec33

Please sign in to comment.