if (tulip_debug > 3)
dev_info(&dev->dev, "PNIC2 negotiation status %08x\n",
ioread32(ioaddr + CSR12));
if (next_tick) {
mod_timer(&tp->timer, RUN_AT(next_tick));
}
}
void pnic2_start_nway(struct net_device *dev)
{ struct tulip_private *tp = netdev_priv(dev); void __iomem *ioaddr = tp->base_addr; int csr14; int csr12;
/* set up what to advertise during the negotiation */
/* load in csr14 and mask off bits not to touch *commentattopoffileexplainsmaskvalue
*/
csr14 = (ioread32(ioaddr + CSR14) & 0xfff0ee39);
/* bit 17 - advetise 100baseTx-FD */ if (tp->sym_advertise & 0x0100) csr14 |= 0x00020000;
/* bit 16 - advertise 100baseTx-HD */ if (tp->sym_advertise & 0x0080) csr14 |= 0x00010000;
/* bit 6 - advertise 10baseT-HD */ if (tp->sym_advertise & 0x0020) csr14 |= 0x00000040;
/* Now set bit 12 Link Test Enable, Bit 7 Autonegotiation Enable *andbit0Don'tPowerDown10baseT
*/
csr14 |= 0x00001184;
if (tulip_debug > 1)
netdev_dbg(dev, "Restarting PNIC2 autonegotiation, csr14=%08x\n",
csr14);
/* tell pnic2_lnk_change we are doing an nway negotiation */
dev->if_port = 0;
tp->nway = tp->mediasense = 1;
tp->nwayset = tp->lpar = 0;
/* now we have to set up csr6 for NWAY state */
tp->csr6 = ioread32(ioaddr + CSR6); if (tulip_debug > 1)
netdev_dbg(dev, "On Entry to Nway, csr6=%08x\n", tp->csr6);
/* mask off any bits not to touch *commentattopoffileexplainsmaskvalue
*/
tp->csr6 = tp->csr6 & 0xfe3bd1fd;
/* don't forget that bit 9 is also used for advertising */ /* advertise 10baseT-FD for the negotiation (bit 9) */ if (tp->sym_advertise & 0x0040) tp->csr6 |= 0x00000200;
/* set bit 24 for nway negotiation mode ... *seeDataPortSelectioncommentattopoffile *and"Stop"-resetbothTransmit(bit13)andReceive(bit1)
*/
tp->csr6 |= 0x01000000;
iowrite32(csr14, ioaddr + CSR14);
iowrite32(tp->csr6, ioaddr + CSR6);
udelay(100);
/* all set up so now force the negotiation to begin */
/* read in current values and mask off all but the *Autonegotiationbits14:12.Writinga001tothosebits *shouldstarttheautonegotiation
*/
csr12 = (ioread32(ioaddr + CSR12) & 0xffff8fff);
csr12 |= 0x1000;
iowrite32(csr12, ioaddr + CSR12);
}
void pnic2_lnk_change(struct net_device *dev, int csr5)
{ struct tulip_private *tp = netdev_priv(dev); void __iomem *ioaddr = tp->base_addr; int csr14;
/* read the staus register to find out what is up */ int csr12 = ioread32(ioaddr + CSR12);
if (tulip_debug > 1)
dev_info(&dev->dev, "PNIC2 link status interrupt %08x, CSR5 %x, %08x\n",
csr12, csr5, ioread32(ioaddr + CSR14));
/* If NWay finished and we have a negotiated partner capability. *checkbits14:12forbitpattern101-allisgood
*/ if (tp->nway && !tp->nwayset) {
/* we did an auto negotiation */
if ((csr12 & 0x7000) == 0x5000) {
/* negotiation ended successfully */
/* get the link partners reply and mask out all but *bits24-21whichshowthepartnerscapabilities *andmatchthosetowhatweadvertised * *thenbegintointerprettheresultsofthenegotiation. *Alwaysgointhisorder:(weareignoringT4fornow) *100baseTx-FD,100baseTx-HD,10baseT-FD,10baseT-HD
*/
if (negotiated & 0x0100) dev->if_port = 5; elseif (negotiated & 0x0080) dev->if_port = 3; elseif (negotiated & 0x0040) dev->if_port = 4; elseif (negotiated & 0x0020) dev->if_port = 0; else { if (tulip_debug > 1)
dev_info(&dev->dev, "funny autonegotiate result csr12 %08x advertising %04x\n",
csr12, tp->sym_advertise);
tp->nwayset = 0; /* so check if 100baseTx link state is okay */ if ((csr12 & 2) == 0 && (tp->sym_advertise & 0x0180))
dev->if_port = 3;
}
/* now record the duplex that was negotiated */
tp->full_duplex = 0; if ((dev->if_port == 4) || (dev->if_port == 5))
tp->full_duplex = 1;
if (tulip_debug > 1) { if (tp->nwayset)
dev_info(&dev->dev, "Switching to %s based on link negotiation %04x & %04x = %04x\n",
medianame[dev->if_port],
tp->sym_advertise, tp->lpar,
negotiated);
}
/* remember to turn off bit 7 - autonegotiate *enablesowecanproperlyendnwaymodeand *setduplex(ie.usecsr6<9>again)
*/
csr14 = (ioread32(ioaddr + CSR14) & 0xffffff7f);
iowrite32(csr14,ioaddr + CSR14);
/* now set the data port and operating mode *(seetheDataPortSelectioncommentsat *thetopofthefile
*/
/* get current csr6 and mask off bits not to touch */ /* see comment at top of file */
/* so if using if_port 3 or 5 then select the 100baseT *portelseselectthe10baseTport. *SeetheDataPortSelectiontableatthetop *ofthefilewhichwastakenfromthePNIC_II.PDF *datasheet
*/ if (dev->if_port & 1) tp->csr6 |= 0x01840000; else tp->csr6 |= 0x00400000;
/* now set the full duplex bit appropriately */ if (tp->full_duplex) tp->csr6 |= 0x00000200;
/* now the following actually writes out the *newcsr6values
*/
tulip_start_rxtx(tp);
return;
} else {
dev_info(&dev->dev, "Autonegotiation failed, using %s, link beat status %04x\n",
medianame[dev->if_port], csr12);
/* remember to turn off bit 7 - autonegotiate *enablesowedon'tforget
*/
csr14 = (ioread32(ioaddr + CSR14) & 0xffffff7f);
iowrite32(csr14,ioaddr + CSR14);
/* what should we do when autonegotiate fails? *shouldwetryagainordefaulttobaseline *case.Ijustdon'tknow. * *fornowdefaulttosomebaselinecase
*/
dev->if_port = 0;
tp->nway = 0;
tp->nwayset = 1;
/* set to 10baseTx-HD - see Data Port Selection *commentgivenatthetopofthefile
*/
tp->csr6 = (ioread32(ioaddr + CSR6) & 0xfe3bd1fd);
tp->csr6 |= 0x00400000;
/* we are at 100mb and a potential link change occurred */
if (tulip_debug > 1)
dev_info(&dev->dev, "PNIC2 %s link beat %s\n",
medianame[dev->if_port],
(csr12 & 2) ? "failed" : "good");
/* check 100 link beat */
tp->nway = 0;
tp->nwayset = 1;
/* if failed then try doing an nway to get in sync */ if ((csr12 & 2) && ! tp->medialock) {
timer_delete_sync(&tp->timer);
pnic2_start_nway(dev);
tp->timer.expires = RUN_AT(3*HZ);
add_timer(&tp->timer);
}
return;
}
if (dev->if_port == 0 || dev->if_port == 4) {
/* we are at 10mb and a potential link change occurred */
if (tulip_debug > 1)
dev_info(&dev->dev, "PNIC2 %s link beat %s\n",
medianame[dev->if_port],
(csr12 & 4) ? "failed" : "good");
tp->nway = 0;
tp->nwayset = 1;
/* if failed, try doing an nway to get in sync */ if ((csr12 & 4) && ! tp->medialock) {
timer_delete_sync(&tp->timer);
pnic2_start_nway(dev);
tp->timer.expires = RUN_AT(3*HZ);
add_timer(&tp->timer);
}
return;
}
if (tulip_debug > 1)
dev_info(&dev->dev, "PNIC2 Link Change Default?\n");
/* if all else fails default to trying 10baseT-HD */
dev->if_port = 0;
/* make sure autonegotiate enable is off */
csr14 = (ioread32(ioaddr + CSR14) & 0xffffff7f);
iowrite32(csr14,ioaddr + CSR14);
/* set to 10baseTx-HD - see Data Port Selection *commentgivenatthetopofthefile
*/
tp->csr6 = (ioread32(ioaddr + CSR6) & 0xfe3bd1fd);
tp->csr6 |= 0x00400000;
tulip_restart_rxtx(tp);
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet am 2026-10-03)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.