Commit 8e11680f authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

sky2: use correct Inter Packet Gap at 10/100mbit

This is another fix picked out of the vendor driver. The IPG value
in the serial mode register is supposed to be programmed differently
at lower speeds.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent aa5ca96c
...@@ -714,6 +714,20 @@ static void sky2_phy_power_down(struct sky2_hw *hw, unsigned port) ...@@ -714,6 +714,20 @@ static void sky2_phy_power_down(struct sky2_hw *hw, unsigned port)
sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
} }
/* configure IPG according to used link speed */
static void sky2_set_ipg(struct sky2_port *sky2)
{
u16 reg;
reg = gma_read16(sky2->hw, sky2->port, GM_SERIAL_MODE);
reg &= ~GM_SMOD_IPG_MSK;
if (sky2->speed > SPEED_100)
reg |= IPG_DATA_VAL(IPG_DATA_DEF_1000);
else
reg |= IPG_DATA_VAL(IPG_DATA_DEF_10_100);
gma_write16(sky2->hw, sky2->port, GM_SERIAL_MODE, reg);
}
/* Enable Rx/Tx */ /* Enable Rx/Tx */
static void sky2_enable_rx_tx(struct sky2_port *sky2) static void sky2_enable_rx_tx(struct sky2_port *sky2)
{ {
...@@ -882,7 +896,7 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port) ...@@ -882,7 +896,7 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
/* serial mode register */ /* serial mode register */
reg = DATA_BLIND_VAL(DATA_BLIND_DEF) | reg = DATA_BLIND_VAL(DATA_BLIND_DEF) |
GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF); GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF_1000);
if (hw->dev[port]->mtu > ETH_DATA_LEN) if (hw->dev[port]->mtu > ETH_DATA_LEN)
reg |= GM_SMOD_JUMBO_ENA; reg |= GM_SMOD_JUMBO_ENA;
...@@ -2053,6 +2067,8 @@ static void sky2_link_up(struct sky2_port *sky2) ...@@ -2053,6 +2067,8 @@ static void sky2_link_up(struct sky2_port *sky2)
[FC_BOTH] = "both", [FC_BOTH] = "both",
}; };
sky2_set_ipg(sky2);
sky2_enable_rx_tx(sky2); sky2_enable_rx_tx(sky2);
gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK);
...@@ -2290,8 +2306,11 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) ...@@ -2290,8 +2306,11 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
dev->mtu = new_mtu; dev->mtu = new_mtu;
netdev_update_features(dev); netdev_update_features(dev);
mode = DATA_BLIND_VAL(DATA_BLIND_DEF) | mode = DATA_BLIND_VAL(DATA_BLIND_DEF) | GM_SMOD_VLAN_ENA;
GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF); if (sky2->speed > SPEED_100)
mode |= IPG_DATA_VAL(IPG_DATA_DEF_1000);
else
mode |= IPG_DATA_VAL(IPG_DATA_DEF_10_100);
if (dev->mtu > ETH_DATA_LEN) if (dev->mtu > ETH_DATA_LEN)
mode |= GM_SMOD_JUMBO_ENA; mode |= GM_SMOD_JUMBO_ENA;
......
...@@ -1807,10 +1807,11 @@ enum { ...@@ -1807,10 +1807,11 @@ enum {
}; };
#define DATA_BLIND_VAL(x) (((x)<<11) & GM_SMOD_DATABL_MSK) #define DATA_BLIND_VAL(x) (((x)<<11) & GM_SMOD_DATABL_MSK)
#define DATA_BLIND_DEF 0x04
#define IPG_DATA_VAL(x) (x & GM_SMOD_IPG_MSK) #define IPG_DATA_VAL(x) (x & GM_SMOD_IPG_MSK)
#define IPG_DATA_DEF 0x1e
#define DATA_BLIND_DEF 0x04
#define IPG_DATA_DEF_1000 0x1e
#define IPG_DATA_DEF_10_100 0x18
/* GM_SMI_CTRL 16 bit r/w SMI Control Register */ /* GM_SMI_CTRL 16 bit r/w SMI Control Register */
enum { enum {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment