From c5729f0b1fb8777c5dcfd2e510bc351045e9b1c4 Mon Sep 17 00:00:00 2001 From: Zang Roy-R61911 Date: Mon, 4 Mar 2013 03:59:20 +0000 Subject: fman/mEMAC: set SETSP bit in IF_MODE regisgter for RGMII speed Some legacy RGMII phys don't have in band signaling for the speed information. so set the RGMII MAC mode according to the speed got from PHY. Signed-off-by: Roy Zang Reported-by: John Traill Signed-off-by: Andy Fleming --- drivers/net/fm/memac.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'drivers/net/fm') diff --git a/drivers/net/fm/memac.c b/drivers/net/fm/memac.c index 32c7054e35..d3eee248ac 100644 --- a/drivers/net/fm/memac.c +++ b/drivers/net/fm/memac.c @@ -112,6 +112,23 @@ static void memac_set_interface_mode(struct fsl_enet_mac *mac, /* Enable automatic speed selection */ if_mode |= IF_MODE_EN_AUTO; + if (type == PHY_INTERFACE_MODE_RGMII) { + if_mode &= ~IF_MODE_EN_AUTO; + if_mode &= ~IF_MODE_SETSP_MASK; + switch (speed) { + case SPEED_1000: + if_mode |= IF_MODE_SETSP_1000M; + break; + case SPEED_100: + if_mode |= IF_MODE_SETSP_100M; + break; + case SPEED_10: + if_mode |= IF_MODE_SETSP_10M; + default: + break; + } + } + debug(" %s, if_mode = %x\n", __func__, if_mode); debug(" %s, if_status = %x\n", __func__, if_status); out_be32(®s->if_mode, if_mode); -- cgit v1.2.1