diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-07-07 01:50:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-08 11:53:33 -0400 |
commit | 8e11680f5e1abc85298c12a99e2b741249eadc0c (patch) | |
tree | af9f39ed9b3607e2480776d40a0845b1da612d69 | |
parent | aa5ca96c8fffea769aedd795f48695112393dc89 (diff) |
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: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/sky2.c | 25 | ||||
-rw-r--r-- | drivers/net/sky2.h | 7 |
2 files changed, 26 insertions, 6 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 3fc8683b2ff0..b1a675a94a17 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -714,6 +714,20 @@ static void sky2_phy_power_down(struct sky2_hw *hw, unsigned port) | |||
714 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | 714 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); |
715 | } | 715 | } |
716 | 716 | ||
717 | /* configure IPG according to used link speed */ | ||
718 | static void sky2_set_ipg(struct sky2_port *sky2) | ||
719 | { | ||
720 | u16 reg; | ||
721 | |||
722 | reg = gma_read16(sky2->hw, sky2->port, GM_SERIAL_MODE); | ||
723 | reg &= ~GM_SMOD_IPG_MSK; | ||
724 | if (sky2->speed > SPEED_100) | ||
725 | reg |= IPG_DATA_VAL(IPG_DATA_DEF_1000); | ||
726 | else | ||
727 | reg |= IPG_DATA_VAL(IPG_DATA_DEF_10_100); | ||
728 | gma_write16(sky2->hw, sky2->port, GM_SERIAL_MODE, reg); | ||
729 | } | ||
730 | |||
717 | /* Enable Rx/Tx */ | 731 | /* Enable Rx/Tx */ |
718 | static void sky2_enable_rx_tx(struct sky2_port *sky2) | 732 | static void sky2_enable_rx_tx(struct sky2_port *sky2) |
719 | { | 733 | { |
@@ -882,7 +896,7 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port) | |||
882 | 896 | ||
883 | /* serial mode register */ | 897 | /* serial mode register */ |
884 | reg = DATA_BLIND_VAL(DATA_BLIND_DEF) | | 898 | reg = DATA_BLIND_VAL(DATA_BLIND_DEF) | |
885 | GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF); | 899 | GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF_1000); |
886 | 900 | ||
887 | if (hw->dev[port]->mtu > ETH_DATA_LEN) | 901 | if (hw->dev[port]->mtu > ETH_DATA_LEN) |
888 | reg |= GM_SMOD_JUMBO_ENA; | 902 | reg |= GM_SMOD_JUMBO_ENA; |
@@ -2053,6 +2067,8 @@ static void sky2_link_up(struct sky2_port *sky2) | |||
2053 | [FC_BOTH] = "both", | 2067 | [FC_BOTH] = "both", |
2054 | }; | 2068 | }; |
2055 | 2069 | ||
2070 | sky2_set_ipg(sky2); | ||
2071 | |||
2056 | sky2_enable_rx_tx(sky2); | 2072 | sky2_enable_rx_tx(sky2); |
2057 | 2073 | ||
2058 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); | 2074 | 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 | dev->mtu = new_mtu; | 2306 | dev->mtu = new_mtu; |
2291 | netdev_update_features(dev); | 2307 | netdev_update_features(dev); |
2292 | 2308 | ||
2293 | mode = DATA_BLIND_VAL(DATA_BLIND_DEF) | | 2309 | mode = DATA_BLIND_VAL(DATA_BLIND_DEF) | GM_SMOD_VLAN_ENA; |
2294 | GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF); | 2310 | if (sky2->speed > SPEED_100) |
2311 | mode |= IPG_DATA_VAL(IPG_DATA_DEF_1000); | ||
2312 | else | ||
2313 | mode |= IPG_DATA_VAL(IPG_DATA_DEF_10_100); | ||
2295 | 2314 | ||
2296 | if (dev->mtu > ETH_DATA_LEN) | 2315 | if (dev->mtu > ETH_DATA_LEN) |
2297 | mode |= GM_SMOD_JUMBO_ENA; | 2316 | mode |= GM_SMOD_JUMBO_ENA; |
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index 030221f4ea83..530378a66021 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
@@ -1807,10 +1807,11 @@ enum { | |||
1807 | }; | 1807 | }; |
1808 | 1808 | ||
1809 | #define DATA_BLIND_VAL(x) (((x)<<11) & GM_SMOD_DATABL_MSK) | 1809 | #define DATA_BLIND_VAL(x) (((x)<<11) & GM_SMOD_DATABL_MSK) |
1810 | #define DATA_BLIND_DEF 0x04 | ||
1811 | |||
1812 | #define IPG_DATA_VAL(x) (x & GM_SMOD_IPG_MSK) | 1810 | #define IPG_DATA_VAL(x) (x & GM_SMOD_IPG_MSK) |
1813 | #define IPG_DATA_DEF 0x1e | 1811 | |
1812 | #define DATA_BLIND_DEF 0x04 | ||
1813 | #define IPG_DATA_DEF_1000 0x1e | ||
1814 | #define IPG_DATA_DEF_10_100 0x18 | ||
1814 | 1815 | ||
1815 | /* GM_SMI_CTRL 16 bit r/w SMI Control Register */ | 1816 | /* GM_SMI_CTRL 16 bit r/w SMI Control Register */ |
1816 | enum { | 1817 | enum { |