diff options
author | Francois Romieu <romieu@fr.zoreil.com> | 2007-08-17 12:21:58 -0400 |
---|---|---|
committer | Francois Romieu <romieu@fr.zoreil.com> | 2007-10-18 15:25:54 -0400 |
commit | 867763c113494106574a64dc81175d66741a01cb (patch) | |
tree | 3f878bb5a73840f1e501555d26e5736570faf0cf /drivers/net/r8169.c | |
parent | 5615d9f1b9f5221d5b69dfa3722c16918c896cdd (diff) |
r8169: phy init for the 8168
The values have been extracted from Realtek's r8168 driver
version 8.002.00.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Edward Hsu <edward_hsu@realtek.com.tw>
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r-- | drivers/net/r8169.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index aed36b7e38b3..cb7bb7f3c784 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -1168,6 +1168,19 @@ static void rtl8169_print_mac_version(struct rtl8169_private *tp) | |||
1168 | dprintk("mac_version = 0x%02x\n", tp->mac_version); | 1168 | dprintk("mac_version = 0x%02x\n", tp->mac_version); |
1169 | } | 1169 | } |
1170 | 1170 | ||
1171 | struct phy_reg { | ||
1172 | u16 reg; | ||
1173 | u16 val; | ||
1174 | }; | ||
1175 | |||
1176 | static void rtl_phy_write(void __iomem *ioaddr, struct phy_reg *regs, int len) | ||
1177 | { | ||
1178 | while (len-- > 0) { | ||
1179 | mdio_write(ioaddr, regs->reg, regs->val); | ||
1180 | regs++; | ||
1181 | } | ||
1182 | } | ||
1183 | |||
1171 | static void rtl8169s_hw_phy_config(void __iomem *ioaddr) | 1184 | static void rtl8169s_hw_phy_config(void __iomem *ioaddr) |
1172 | { | 1185 | { |
1173 | struct { | 1186 | struct { |
@@ -1227,6 +1240,39 @@ static void rtl8169sb_hw_phy_config(void __iomem *ioaddr) | |||
1227 | mdio_write(ioaddr, 31, 0x0000); | 1240 | mdio_write(ioaddr, 31, 0x0000); |
1228 | } | 1241 | } |
1229 | 1242 | ||
1243 | static void rtl8168cp_hw_phy_config(void __iomem *ioaddr) | ||
1244 | { | ||
1245 | struct phy_reg phy_reg_init[] = { | ||
1246 | { 0x1f, 0x0000 }, | ||
1247 | { 0x1d, 0x0f00 }, | ||
1248 | { 0x1f, 0x0002 }, | ||
1249 | { 0x0c, 0x1ec8 }, | ||
1250 | { 0x1f, 0x0000 } | ||
1251 | }; | ||
1252 | |||
1253 | rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); | ||
1254 | } | ||
1255 | |||
1256 | static void rtl8168c_hw_phy_config(void __iomem *ioaddr) | ||
1257 | { | ||
1258 | struct phy_reg phy_reg_init[] = { | ||
1259 | { 0x1f, 0x0002 }, | ||
1260 | { 0x00, 0x88d4 }, | ||
1261 | { 0x01, 0x82b1 }, | ||
1262 | { 0x03, 0x7002 }, | ||
1263 | { 0x08, 0x9e30 }, | ||
1264 | { 0x09, 0x01f0 }, | ||
1265 | { 0x0a, 0x5500 }, | ||
1266 | { 0x0c, 0x00c8 }, | ||
1267 | { 0x1f, 0x0003 }, | ||
1268 | { 0x12, 0xc096 }, | ||
1269 | { 0x16, 0x000a }, | ||
1270 | { 0x1f, 0x0000 } | ||
1271 | }; | ||
1272 | |||
1273 | rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); | ||
1274 | } | ||
1275 | |||
1230 | static void rtl_hw_phy_config(struct net_device *dev) | 1276 | static void rtl_hw_phy_config(struct net_device *dev) |
1231 | { | 1277 | { |
1232 | struct rtl8169_private *tp = netdev_priv(dev); | 1278 | struct rtl8169_private *tp = netdev_priv(dev); |
@@ -1244,6 +1290,12 @@ static void rtl_hw_phy_config(struct net_device *dev) | |||
1244 | case RTL_GIGA_MAC_VER_04: | 1290 | case RTL_GIGA_MAC_VER_04: |
1245 | rtl8169sb_hw_phy_config(ioaddr); | 1291 | rtl8169sb_hw_phy_config(ioaddr); |
1246 | break; | 1292 | break; |
1293 | case RTL_GIGA_MAC_VER_18: | ||
1294 | rtl8168cp_hw_phy_config(ioaddr); | ||
1295 | break; | ||
1296 | case RTL_GIGA_MAC_VER_19: | ||
1297 | rtl8168c_hw_phy_config(ioaddr); | ||
1298 | break; | ||
1247 | default: | 1299 | default: |
1248 | break; | 1300 | break; |
1249 | } | 1301 | } |