Skip to content

Commit

Permalink
net: w5100: fix MAC filtering for W5500
Browse files Browse the repository at this point in the history
W5500 has different bit position for MAC filter in Socket n mode
register from W5100 and W5200.

Signed-off-by: Akinobu Mita <[email protected]>
Cc: Mike Sinkovsky <[email protected]>
Cc: David S. Miller <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
mita authored and davem330 committed May 16, 2016
1 parent e9f0cd9 commit d41cd5f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions drivers/net/ethernet/wiznet/w5100.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ MODULE_LICENSE("GPL");
#define S0_REGS(priv) ((priv)->s0_regs)

#define W5100_S0_MR(priv) (S0_REGS(priv) + W5100_Sn_MR)
#define S0_MR_MACRAW 0x04 /* MAC RAW mode (promiscuous) */
#define S0_MR_MACRAW_MF 0x44 /* MAC RAW mode (filtered) */
#define S0_MR_MACRAW 0x04 /* MAC RAW mode */
#define S0_MR_MF 0x40 /* MAC Filter for W5100 and W5200 */
#define W5500_S0_MR_MF 0x80 /* MAC Filter for W5500 */
#define W5100_S0_CR(priv) (S0_REGS(priv) + W5100_Sn_CR)
#define S0_CR_OPEN 0x01 /* OPEN command */
#define S0_CR_CLOSE 0x10 /* CLOSE command */
Expand Down Expand Up @@ -702,8 +703,16 @@ static int w5100_hw_reset(struct w5100_priv *priv)

static void w5100_hw_start(struct w5100_priv *priv)
{
w5100_write(priv, W5100_S0_MR(priv), priv->promisc ?
S0_MR_MACRAW : S0_MR_MACRAW_MF);
u8 mode = S0_MR_MACRAW;

if (!priv->promisc) {
if (priv->ops->chip_id == W5500)
mode |= W5500_S0_MR_MF;
else
mode |= S0_MR_MF;
}

w5100_write(priv, W5100_S0_MR(priv), mode);
w5100_command(priv, S0_CR_OPEN);
w5100_enable_intr(priv);
}
Expand Down

0 comments on commit d41cd5f

Please sign in to comment.