diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2011-04-20 03:57:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-21 20:05:58 -0400 |
commit | b4bd292933537e19107c3e151b27a15fefa5f8d0 (patch) | |
tree | 83b0f75b02bfe670b7dfe2a24b7b749123a461dc | |
parent | 15ee95c36d355a9f47746eaa4ae8cc0ecafec550 (diff) |
tg3: Add write accessor for AUX CTRL phy reg
This patch adds a write accessor for the aux ctrl phy register.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/tg3.c | 48 | ||||
-rw-r--r-- | drivers/net/tg3.h | 4 |
2 files changed, 35 insertions, 17 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 7be10cfb0a5f..69cd7cfa276b 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -962,6 +962,14 @@ static int tg3_phy_auxctl_read(struct tg3 *tp, int reg, u32 *val) | |||
962 | return err; | 962 | return err; |
963 | } | 963 | } |
964 | 964 | ||
965 | static int tg3_phy_auxctl_write(struct tg3 *tp, int reg, u32 set) | ||
966 | { | ||
967 | if (reg == MII_TG3_AUXCTL_SHDWSEL_MISC) | ||
968 | set |= MII_TG3_AUXCTL_MISC_WREN; | ||
969 | |||
970 | return tg3_writephy(tp, MII_TG3_AUX_CTRL, set | reg); | ||
971 | } | ||
972 | |||
965 | static int tg3_bmcr_reset(struct tg3 *tp) | 973 | static int tg3_bmcr_reset(struct tg3 *tp) |
966 | { | 974 | { |
967 | u32 phy_control; | 975 | u32 phy_control; |
@@ -1701,8 +1709,8 @@ static void tg3_phy_toggle_automdix(struct tg3 *tp, int enable) | |||
1701 | phy |= MII_TG3_AUXCTL_MISC_FORCE_AMDIX; | 1709 | phy |= MII_TG3_AUXCTL_MISC_FORCE_AMDIX; |
1702 | else | 1710 | else |
1703 | phy &= ~MII_TG3_AUXCTL_MISC_FORCE_AMDIX; | 1711 | phy &= ~MII_TG3_AUXCTL_MISC_FORCE_AMDIX; |
1704 | phy |= MII_TG3_AUXCTL_MISC_WREN; | 1712 | tg3_phy_auxctl_write(tp, |
1705 | tg3_writephy(tp, MII_TG3_AUX_CTRL, phy); | 1713 | MII_TG3_AUXCTL_SHDWSEL_MISC, phy); |
1706 | } | 1714 | } |
1707 | } | 1715 | } |
1708 | } | 1716 | } |
@@ -1717,8 +1725,8 @@ static void tg3_phy_set_wirespeed(struct tg3 *tp) | |||
1717 | 1725 | ||
1718 | ret = tg3_phy_auxctl_read(tp, MII_TG3_AUXCTL_SHDWSEL_MISC, &val); | 1726 | ret = tg3_phy_auxctl_read(tp, MII_TG3_AUXCTL_SHDWSEL_MISC, &val); |
1719 | if (!ret) | 1727 | if (!ret) |
1720 | tg3_writephy(tp, MII_TG3_AUX_CTRL, | 1728 | tg3_phy_auxctl_write(tp, MII_TG3_AUXCTL_SHDWSEL_MISC, |
1721 | (val | (1 << 15) | (1 << 4))); | 1729 | val | MII_TG3_AUXCTL_MISC_WIRESPD_EN); |
1722 | } | 1730 | } |
1723 | 1731 | ||
1724 | static void tg3_phy_apply_otp(struct tg3 *tp) | 1732 | static void tg3_phy_apply_otp(struct tg3 *tp) |
@@ -2104,13 +2112,14 @@ out: | |||
2104 | /* support jumbo frames */ | 2112 | /* support jumbo frames */ |
2105 | if ((tp->phy_id & TG3_PHY_ID_MASK) == TG3_PHY_ID_BCM5401) { | 2113 | if ((tp->phy_id & TG3_PHY_ID_MASK) == TG3_PHY_ID_BCM5401) { |
2106 | /* Cannot do read-modify-write on 5401 */ | 2114 | /* Cannot do read-modify-write on 5401 */ |
2107 | tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4c20); | 2115 | tg3_phy_auxctl_write(tp, MII_TG3_AUXCTL_SHDWSEL_AUXCTL, 0x4c20); |
2108 | } else if (tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) { | 2116 | } else if (tp->tg3_flags & TG3_FLAG_JUMBO_CAPABLE) { |
2109 | /* Set bit 14 with read-modify-write to preserve other bits */ | 2117 | /* Set bit 14 with read-modify-write to preserve other bits */ |
2110 | err = tg3_phy_auxctl_read(tp, | 2118 | err = tg3_phy_auxctl_read(tp, |
2111 | MII_TG3_AUXCTL_SHDWSEL_AUXCTL, &val); | 2119 | MII_TG3_AUXCTL_SHDWSEL_AUXCTL, &val); |
2112 | if (!err) | 2120 | if (!err) |
2113 | tg3_writephy(tp, MII_TG3_AUX_CTRL, val | 0x4000); | 2121 | tg3_phy_auxctl_write(tp, MII_TG3_AUXCTL_SHDWSEL_AUXCTL, |
2122 | val | MII_TG3_AUXCTL_ACTL_EXTPKTLEN); | ||
2114 | } | 2123 | } |
2115 | 2124 | ||
2116 | /* Set phy register 0x10 bit 0 to high fifo elasticity to support | 2125 | /* Set phy register 0x10 bit 0 to high fifo elasticity to support |
@@ -2319,11 +2328,10 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) | |||
2319 | tg3_writephy(tp, MII_TG3_EXT_CTRL, | 2328 | tg3_writephy(tp, MII_TG3_EXT_CTRL, |
2320 | MII_TG3_EXT_CTRL_FORCE_LED_OFF); | 2329 | MII_TG3_EXT_CTRL_FORCE_LED_OFF); |
2321 | 2330 | ||
2322 | tg3_writephy(tp, MII_TG3_AUX_CTRL, | 2331 | val = MII_TG3_AUXCTL_PCTL_100TX_LPWR | |
2323 | MII_TG3_AUXCTL_SHDWSEL_PWRCTL | | 2332 | MII_TG3_AUXCTL_PCTL_SPR_ISOLATE | |
2324 | MII_TG3_AUXCTL_PCTL_100TX_LPWR | | 2333 | MII_TG3_AUXCTL_PCTL_VREG_11V; |
2325 | MII_TG3_AUXCTL_PCTL_SPR_ISOLATE | | 2334 | tg3_phy_auxctl_write(tp, MII_TG3_AUXCTL_SHDWSEL_PWRCTL, val); |
2326 | MII_TG3_AUXCTL_PCTL_VREG_11V); | ||
2327 | } | 2335 | } |
2328 | 2336 | ||
2329 | /* The PHY should not be powered down on some chips because | 2337 | /* The PHY should not be powered down on some chips because |
@@ -2717,8 +2725,13 @@ static int tg3_power_down_prepare(struct tg3 *tp) | |||
2717 | u32 mac_mode; | 2725 | u32 mac_mode; |
2718 | 2726 | ||
2719 | if (!(tp->phy_flags & TG3_PHYFLG_PHY_SERDES)) { | 2727 | if (!(tp->phy_flags & TG3_PHYFLG_PHY_SERDES)) { |
2720 | if (do_low_power) { | 2728 | if (do_low_power && |
2721 | tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x5a); | 2729 | !(tp->phy_flags & TG3_PHYFLG_IS_FET)) { |
2730 | tg3_phy_auxctl_write(tp, | ||
2731 | MII_TG3_AUXCTL_SHDWSEL_PWRCTL, | ||
2732 | MII_TG3_AUXCTL_PCTL_WOL_EN | | ||
2733 | MII_TG3_AUXCTL_PCTL_100TX_LPWR | | ||
2734 | MII_TG3_AUXCTL_PCTL_CL_AB_TXDAC); | ||
2722 | udelay(40); | 2735 | udelay(40); |
2723 | } | 2736 | } |
2724 | 2737 | ||
@@ -3092,7 +3105,7 @@ static int tg3_init_5401phy_dsp(struct tg3 *tp) | |||
3092 | 3105 | ||
3093 | /* Turn off tap power management. */ | 3106 | /* Turn off tap power management. */ |
3094 | /* Set Extended packet length bit */ | 3107 | /* Set Extended packet length bit */ |
3095 | err = tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4c20); | 3108 | err = tg3_phy_auxctl_write(tp, MII_TG3_AUXCTL_SHDWSEL_AUXCTL, 0x4c20); |
3096 | 3109 | ||
3097 | err |= tg3_phydsp_write(tp, 0x0012, 0x1804); | 3110 | err |= tg3_phydsp_write(tp, 0x0012, 0x1804); |
3098 | err |= tg3_phydsp_write(tp, 0x0013, 0x1204); | 3111 | err |= tg3_phydsp_write(tp, 0x0013, 0x1204); |
@@ -3198,7 +3211,7 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset) | |||
3198 | udelay(80); | 3211 | udelay(80); |
3199 | } | 3212 | } |
3200 | 3213 | ||
3201 | tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x02); | 3214 | tg3_phy_auxctl_write(tp, MII_TG3_AUXCTL_SHDWSEL_PWRCTL, 0); |
3202 | 3215 | ||
3203 | /* Some third-party PHYs need to be reset on link going | 3216 | /* Some third-party PHYs need to be reset on link going |
3204 | * down. | 3217 | * down. |
@@ -3283,8 +3296,9 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset) | |||
3283 | MII_TG3_AUXCTL_SHDWSEL_MISCTEST, | 3296 | MII_TG3_AUXCTL_SHDWSEL_MISCTEST, |
3284 | &val); | 3297 | &val); |
3285 | if (!err && !(val & (1 << 10))) { | 3298 | if (!err && !(val & (1 << 10))) { |
3286 | val |= (1 << 10); | 3299 | tg3_phy_auxctl_write(tp, |
3287 | tg3_writephy(tp, MII_TG3_AUX_CTRL, val); | 3300 | MII_TG3_AUXCTL_SHDWSEL_MISCTEST, |
3301 | val | (1 << 10)); | ||
3288 | goto relink; | 3302 | goto relink; |
3289 | } | 3303 | } |
3290 | } | 3304 | } |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index b9382f18b631..eaa76694efb5 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -2197,15 +2197,19 @@ | |||
2197 | #define MII_TG3_AUXCTL_SHDWSEL_AUXCTL 0x0000 | 2197 | #define MII_TG3_AUXCTL_SHDWSEL_AUXCTL 0x0000 |
2198 | #define MII_TG3_AUXCTL_ACTL_TX_6DB 0x0400 | 2198 | #define MII_TG3_AUXCTL_ACTL_TX_6DB 0x0400 |
2199 | #define MII_TG3_AUXCTL_ACTL_SMDSP_ENA 0x0800 | 2199 | #define MII_TG3_AUXCTL_ACTL_SMDSP_ENA 0x0800 |
2200 | #define MII_TG3_AUXCTL_ACTL_EXTPKTLEN 0x4000 | ||
2200 | 2201 | ||
2201 | #define MII_TG3_AUXCTL_SHDWSEL_PWRCTL 0x0002 | 2202 | #define MII_TG3_AUXCTL_SHDWSEL_PWRCTL 0x0002 |
2203 | #define MII_TG3_AUXCTL_PCTL_WOL_EN 0x0008 | ||
2202 | #define MII_TG3_AUXCTL_PCTL_100TX_LPWR 0x0010 | 2204 | #define MII_TG3_AUXCTL_PCTL_100TX_LPWR 0x0010 |
2203 | #define MII_TG3_AUXCTL_PCTL_SPR_ISOLATE 0x0020 | 2205 | #define MII_TG3_AUXCTL_PCTL_SPR_ISOLATE 0x0020 |
2206 | #define MII_TG3_AUXCTL_PCTL_CL_AB_TXDAC 0x0040 | ||
2204 | #define MII_TG3_AUXCTL_PCTL_VREG_11V 0x0180 | 2207 | #define MII_TG3_AUXCTL_PCTL_VREG_11V 0x0180 |
2205 | 2208 | ||
2206 | #define MII_TG3_AUXCTL_SHDWSEL_MISCTEST 0x0004 | 2209 | #define MII_TG3_AUXCTL_SHDWSEL_MISCTEST 0x0004 |
2207 | 2210 | ||
2208 | #define MII_TG3_AUXCTL_SHDWSEL_MISC 0x0007 | 2211 | #define MII_TG3_AUXCTL_SHDWSEL_MISC 0x0007 |
2212 | #define MII_TG3_AUXCTL_MISC_WIRESPD_EN 0x0010 | ||
2209 | #define MII_TG3_AUXCTL_MISC_FORCE_AMDIX 0x0200 | 2213 | #define MII_TG3_AUXCTL_MISC_FORCE_AMDIX 0x0200 |
2210 | #define MII_TG3_AUXCTL_MISC_RDSEL_SHIFT 12 | 2214 | #define MII_TG3_AUXCTL_MISC_RDSEL_SHIFT 12 |
2211 | #define MII_TG3_AUXCTL_MISC_WREN 0x8000 | 2215 | #define MII_TG3_AUXCTL_MISC_WREN 0x8000 |