aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/forcedeth.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 20:48:54 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 20:48:54 -0400
commit1f1c2881f673671539b25686df463518d69c4649 (patch)
tree45f4a79f2371ae4525fd621d4b5820732efa161e /drivers/net/forcedeth.c
parent7608a864e5211df1e3c1948e2719aec7c27b9333 (diff)
parentc5e3ae8823693b260ce1f217adca8add1bc0b3de (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (37 commits) forcedeth bug fix: realtek phy forcedeth bug fix: vitesse phy forcedeth bug fix: cicada phy atl1: reorder atl1_main functions atl1: fix excessively indented code atl1: cleanup atl1_main atl1: header file cleanup atl1: remove irq_sem cdc-subset to support new vendor/product ID 8139cp: implement the missing dev->tx_timeout myri10ge: Remove nonsensical limit in the tx done routine gianfar: kill unused header EP93XX_ETH must select MII macb: Add multicast capability macb: Use generic PHY layer s390: add barriers to qeth driver s390: scatter-gather for inbound traffic in qeth driver eHEA: Introducing support vor DLPAR memory add Fix a potential NULL pointer dereference in free_shared_mem() in drivers/net/s2io.c [PATCH] softmac: Fix ESSID problem ...
Diffstat (limited to 'drivers/net/forcedeth.c')
-rw-r--r--drivers/net/forcedeth.c162
1 files changed, 152 insertions, 10 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 67046e8c21eb..136827f8dc2e 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -550,6 +550,8 @@ union ring_type {
550/* PHY defines */ 550/* PHY defines */
551#define PHY_OUI_MARVELL 0x5043 551#define PHY_OUI_MARVELL 0x5043
552#define PHY_OUI_CICADA 0x03f1 552#define PHY_OUI_CICADA 0x03f1
553#define PHY_OUI_VITESSE 0x01c1
554#define PHY_OUI_REALTEK 0x01c1
553#define PHYID1_OUI_MASK 0x03ff 555#define PHYID1_OUI_MASK 0x03ff
554#define PHYID1_OUI_SHFT 6 556#define PHYID1_OUI_SHFT 6
555#define PHYID2_OUI_MASK 0xfc00 557#define PHYID2_OUI_MASK 0xfc00
@@ -557,12 +559,36 @@ union ring_type {
557#define PHYID2_MODEL_MASK 0x03f0 559#define PHYID2_MODEL_MASK 0x03f0
558#define PHY_MODEL_MARVELL_E3016 0x220 560#define PHY_MODEL_MARVELL_E3016 0x220
559#define PHY_MARVELL_E3016_INITMASK 0x0300 561#define PHY_MARVELL_E3016_INITMASK 0x0300
560#define PHY_INIT1 0x0f000 562#define PHY_CICADA_INIT1 0x0f000
561#define PHY_INIT2 0x0e00 563#define PHY_CICADA_INIT2 0x0e00
562#define PHY_INIT3 0x01000 564#define PHY_CICADA_INIT3 0x01000
563#define PHY_INIT4 0x0200 565#define PHY_CICADA_INIT4 0x0200
564#define PHY_INIT5 0x0004 566#define PHY_CICADA_INIT5 0x0004
565#define PHY_INIT6 0x02000 567#define PHY_CICADA_INIT6 0x02000
568#define PHY_VITESSE_INIT_REG1 0x1f
569#define PHY_VITESSE_INIT_REG2 0x10
570#define PHY_VITESSE_INIT_REG3 0x11
571#define PHY_VITESSE_INIT_REG4 0x12
572#define PHY_VITESSE_INIT_MSK1 0xc
573#define PHY_VITESSE_INIT_MSK2 0x0180
574#define PHY_VITESSE_INIT1 0x52b5
575#define PHY_VITESSE_INIT2 0xaf8a
576#define PHY_VITESSE_INIT3 0x8
577#define PHY_VITESSE_INIT4 0x8f8a
578#define PHY_VITESSE_INIT5 0xaf86
579#define PHY_VITESSE_INIT6 0x8f86
580#define PHY_VITESSE_INIT7 0xaf82
581#define PHY_VITESSE_INIT8 0x0100
582#define PHY_VITESSE_INIT9 0x8f82
583#define PHY_VITESSE_INIT10 0x0
584#define PHY_REALTEK_INIT_REG1 0x1f
585#define PHY_REALTEK_INIT_REG2 0x19
586#define PHY_REALTEK_INIT_REG3 0x13
587#define PHY_REALTEK_INIT1 0x0000
588#define PHY_REALTEK_INIT2 0x8e00
589#define PHY_REALTEK_INIT3 0x0001
590#define PHY_REALTEK_INIT4 0xad17
591
566#define PHY_GIGABIT 0x0100 592#define PHY_GIGABIT 0x0100
567 593
568#define PHY_TIMEOUT 0x1 594#define PHY_TIMEOUT 0x1
@@ -1096,6 +1122,28 @@ static int phy_init(struct net_device *dev)
1096 return PHY_ERROR; 1122 return PHY_ERROR;
1097 } 1123 }
1098 } 1124 }
1125 if (np->phy_oui == PHY_OUI_REALTEK) {
1126 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT1)) {
1127 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1128 return PHY_ERROR;
1129 }
1130 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG2, PHY_REALTEK_INIT2)) {
1131 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1132 return PHY_ERROR;
1133 }
1134 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT3)) {
1135 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1136 return PHY_ERROR;
1137 }
1138 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG3, PHY_REALTEK_INIT4)) {
1139 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1140 return PHY_ERROR;
1141 }
1142 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT1)) {
1143 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1144 return PHY_ERROR;
1145 }
1146 }
1099 1147
1100 /* set advertise register */ 1148 /* set advertise register */
1101 reg = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ); 1149 reg = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ);
@@ -1141,14 +1189,14 @@ static int phy_init(struct net_device *dev)
1141 /* phy vendor specific configuration */ 1189 /* phy vendor specific configuration */
1142 if ((np->phy_oui == PHY_OUI_CICADA) && (phyinterface & PHY_RGMII) ) { 1190 if ((np->phy_oui == PHY_OUI_CICADA) && (phyinterface & PHY_RGMII) ) {
1143 phy_reserved = mii_rw(dev, np->phyaddr, MII_RESV1, MII_READ); 1191 phy_reserved = mii_rw(dev, np->phyaddr, MII_RESV1, MII_READ);
1144 phy_reserved &= ~(PHY_INIT1 | PHY_INIT2); 1192 phy_reserved &= ~(PHY_CICADA_INIT1 | PHY_CICADA_INIT2);
1145 phy_reserved |= (PHY_INIT3 | PHY_INIT4); 1193 phy_reserved |= (PHY_CICADA_INIT3 | PHY_CICADA_INIT4);
1146 if (mii_rw(dev, np->phyaddr, MII_RESV1, phy_reserved)) { 1194 if (mii_rw(dev, np->phyaddr, MII_RESV1, phy_reserved)) {
1147 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev)); 1195 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1148 return PHY_ERROR; 1196 return PHY_ERROR;
1149 } 1197 }
1150 phy_reserved = mii_rw(dev, np->phyaddr, MII_NCONFIG, MII_READ); 1198 phy_reserved = mii_rw(dev, np->phyaddr, MII_NCONFIG, MII_READ);
1151 phy_reserved |= PHY_INIT5; 1199 phy_reserved |= PHY_CICADA_INIT5;
1152 if (mii_rw(dev, np->phyaddr, MII_NCONFIG, phy_reserved)) { 1200 if (mii_rw(dev, np->phyaddr, MII_NCONFIG, phy_reserved)) {
1153 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev)); 1201 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1154 return PHY_ERROR; 1202 return PHY_ERROR;
@@ -1156,12 +1204,106 @@ static int phy_init(struct net_device *dev)
1156 } 1204 }
1157 if (np->phy_oui == PHY_OUI_CICADA) { 1205 if (np->phy_oui == PHY_OUI_CICADA) {
1158 phy_reserved = mii_rw(dev, np->phyaddr, MII_SREVISION, MII_READ); 1206 phy_reserved = mii_rw(dev, np->phyaddr, MII_SREVISION, MII_READ);
1159 phy_reserved |= PHY_INIT6; 1207 phy_reserved |= PHY_CICADA_INIT6;
1160 if (mii_rw(dev, np->phyaddr, MII_SREVISION, phy_reserved)) { 1208 if (mii_rw(dev, np->phyaddr, MII_SREVISION, phy_reserved)) {
1161 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev)); 1209 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1162 return PHY_ERROR; 1210 return PHY_ERROR;
1163 } 1211 }
1164 } 1212 }
1213 if (np->phy_oui == PHY_OUI_VITESSE) {
1214 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG1, PHY_VITESSE_INIT1)) {
1215 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1216 return PHY_ERROR;
1217 }
1218 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG2, PHY_VITESSE_INIT2)) {
1219 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1220 return PHY_ERROR;
1221 }
1222 phy_reserved = mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG4, MII_READ);
1223 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG4, phy_reserved)) {
1224 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1225 return PHY_ERROR;
1226 }
1227 phy_reserved = mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG3, MII_READ);
1228 phy_reserved &= ~PHY_VITESSE_INIT_MSK1;
1229 phy_reserved |= PHY_VITESSE_INIT3;
1230 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG3, phy_reserved)) {
1231 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1232 return PHY_ERROR;
1233 }
1234 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG2, PHY_VITESSE_INIT4)) {
1235 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1236 return PHY_ERROR;
1237 }
1238 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG2, PHY_VITESSE_INIT5)) {
1239 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1240 return PHY_ERROR;
1241 }
1242 phy_reserved = mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG4, MII_READ);
1243 phy_reserved &= ~PHY_VITESSE_INIT_MSK1;
1244 phy_reserved |= PHY_VITESSE_INIT3;
1245 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG4, phy_reserved)) {
1246 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1247 return PHY_ERROR;
1248 }
1249 phy_reserved = mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG3, MII_READ);
1250 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG3, phy_reserved)) {
1251 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1252 return PHY_ERROR;
1253 }
1254 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG2, PHY_VITESSE_INIT6)) {
1255 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1256 return PHY_ERROR;
1257 }
1258 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG2, PHY_VITESSE_INIT7)) {
1259 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1260 return PHY_ERROR;
1261 }
1262 phy_reserved = mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG4, MII_READ);
1263 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG4, phy_reserved)) {
1264 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1265 return PHY_ERROR;
1266 }
1267 phy_reserved = mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG3, MII_READ);
1268 phy_reserved &= ~PHY_VITESSE_INIT_MSK2;
1269 phy_reserved |= PHY_VITESSE_INIT8;
1270 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG3, phy_reserved)) {
1271 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1272 return PHY_ERROR;
1273 }
1274 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG2, PHY_VITESSE_INIT9)) {
1275 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1276 return PHY_ERROR;
1277 }
1278 if (mii_rw(dev, np->phyaddr, PHY_VITESSE_INIT_REG1, PHY_VITESSE_INIT10)) {
1279 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1280 return PHY_ERROR;
1281 }
1282 }
1283 if (np->phy_oui == PHY_OUI_REALTEK) {
1284 /* reset could have cleared these out, set them back */
1285 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT1)) {
1286 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1287 return PHY_ERROR;
1288 }
1289 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG2, PHY_REALTEK_INIT2)) {
1290 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1291 return PHY_ERROR;
1292 }
1293 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT3)) {
1294 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1295 return PHY_ERROR;
1296 }
1297 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG3, PHY_REALTEK_INIT4)) {
1298 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1299 return PHY_ERROR;
1300 }
1301 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT1)) {
1302 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1303 return PHY_ERROR;
1304 }
1305 }
1306
1165 /* some phys clear out pause advertisment on reset, set it back */ 1307 /* some phys clear out pause advertisment on reset, set it back */
1166 mii_rw(dev, np->phyaddr, MII_ADVERTISE, reg); 1308 mii_rw(dev, np->phyaddr, MII_ADVERTISE, reg);
1167 1309