Lines Matching +full:startup +full:- +full:time +full:- +full:ms
5 Written/copyright 1994-2001 by Donald Becker.
21 met by back-to-back PCI I/O cycles, but we insert a delay to avoid
25 /* Read and write the MII registers using software-generated serial
41 Read and write the MII registers using software-generated serial
43 See IEEE 802.3-2002.pdf (Section 2, Chapter "22.2.4 Management functions")
53 void __iomem *ioaddr = tp->base_addr; in tulip_mdio_read()
60 if (tp->chip_id == COMET && phy_id == 30) { in tulip_mdio_read()
66 spin_lock_irqsave(&tp->mii_lock, flags); in tulip_mdio_read()
67 if (tp->chip_id == LC82C168) { in tulip_mdio_read()
71 for (i = 1000; i >= 0; --i) { in tulip_mdio_read()
76 spin_unlock_irqrestore(&tp->mii_lock, flags); in tulip_mdio_read()
81 for (i = 32; i >= 0; i--) { in tulip_mdio_read()
88 for (i = 15; i >= 0; i--) { in tulip_mdio_read()
96 /* Read the two transition, 16 data, and wire-idle bits. */ in tulip_mdio_read()
97 for (i = 19; i > 0; i--) { in tulip_mdio_read()
105 spin_unlock_irqrestore(&tp->mii_lock, flags); in tulip_mdio_read()
114 void __iomem *ioaddr = tp->base_addr; in tulip_mdio_write()
121 if (tp->chip_id == COMET && phy_id == 30) { in tulip_mdio_write()
127 spin_lock_irqsave(&tp->mii_lock, flags); in tulip_mdio_write()
128 if (tp->chip_id == LC82C168) { in tulip_mdio_write()
130 for (i = 1000; i >= 0; --i) { in tulip_mdio_write()
135 spin_unlock_irqrestore(&tp->mii_lock, flags); in tulip_mdio_write()
140 for (i = 32; i >= 0; i--) { in tulip_mdio_write()
147 for (i = 31; i >= 0; i--) { in tulip_mdio_write()
155 for (i = 2; i > 0; i--) { in tulip_mdio_write()
162 spin_unlock_irqrestore(&tp->mii_lock, flags); in tulip_mdio_write()
167 void tulip_select_media(struct net_device *dev, int startup) in tulip_select_media() argument
170 void __iomem *ioaddr = tp->base_addr; in tulip_select_media()
171 struct mediatable *mtable = tp->mtable; in tulip_select_media()
176 struct medialeaf *mleaf = &mtable->mleaf[tp->cur_index]; in tulip_select_media()
177 unsigned char *p = mleaf->leafdata; in tulip_select_media()
178 switch (mleaf->type) { in tulip_select_media()
179 case 0: /* 21140 non-MII xcvr. */ in tulip_select_media()
181 netdev_dbg(dev, "Using a 21140 non-MII transceiver with control setting %02x\n", in tulip_select_media()
183 dev->if_port = p[0]; in tulip_select_media()
184 if (startup) in tulip_select_media()
185 iowrite32(mtable->csr12dir | 0x100, ioaddr + CSR12); in tulip_select_media()
195 dev->if_port = p[0] & MEDIA_MASK; in tulip_select_media()
196 if (tulip_media_cap[dev->if_port] & MediaAlwaysFD) in tulip_select_media()
197 tp->full_duplex = 1; in tulip_select_media()
199 if (startup && mtable->has_reset) { in tulip_select_media()
200 struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset]; in tulip_select_media()
201 unsigned char *rst = rleaf->leafdata; in tulip_select_media()
208 netdev_dbg(dev, "21143 non-MII %s transceiver control %04x/%04x\n", in tulip_select_media()
209 medianame[dev->if_port], in tulip_select_media()
211 if (p[0] & 0x40) { /* SIA (CSR13-15) setup values are provided. */ in tulip_select_media()
226 if (dev->if_port <= 4) in tulip_select_media()
227 csr14val = t21142_csr14[dev->if_port]; in tulip_select_media()
228 if (startup) { in tulip_select_media()
234 if (startup) iowrite32(csr13val, ioaddr + CSR13); in tulip_select_media()
239 if (mleaf->type == 4) in tulip_select_media()
250 dev->if_port = 11; in tulip_select_media()
252 if (mleaf->type == 3) { /* 21142 */ in tulip_select_media()
257 if (startup) { in tulip_select_media()
258 int timeout = 10; /* max 1 ms */ in tulip_select_media()
270 while (timeout-- && in tulip_select_media()
283 if (startup) { in tulip_select_media()
284 int timeout = 10; /* max 1 ms */ in tulip_select_media()
285 iowrite32(mtable->csr12dir | 0x100, ioaddr + CSR12); in tulip_select_media()
297 while (timeout-- && in tulip_select_media()
309 tp->advertising[phy_num] = tmp_info | 1; in tulip_select_media()
310 if (tmp_info && startup < 2) { in tulip_select_media()
311 if (tp->mii_advertise == 0) in tulip_select_media()
312 tp->mii_advertise = tp->advertising[phy_num]; in tulip_select_media()
315 tp->mii_advertise, in tulip_select_media()
316 tp->phys[phy_num]); in tulip_select_media()
317 tulip_mdio_write(dev, tp->phys[phy_num], 4, tp->mii_advertise); in tulip_select_media()
324 if (startup && mtable->has_reset) { in tulip_select_media()
325 struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset]; in tulip_select_media()
326 unsigned char *rst = rleaf->leafdata; in tulip_select_media()
337 mleaf->type); in tulip_select_media()
342 medianame[dev->if_port], in tulip_select_media()
344 } else if (tp->chip_id == LC82C168) { in tulip_select_media()
345 if (startup && ! tp->medialock) in tulip_select_media()
346 dev->if_port = tp->mii_cnt ? 11 : 0; in tulip_select_media()
350 medianame[dev->if_port]); in tulip_select_media()
351 if (tp->mii_cnt) { in tulip_select_media()
355 } else if (startup) { in tulip_select_media()
361 } else if (dev->if_port == 3 || dev->if_port == 5) { in tulip_select_media()
372 if (tp->default_port == 0) in tulip_select_media()
373 dev->if_port = tp->mii_cnt ? 11 : 3; in tulip_select_media()
374 if (tulip_media_cap[dev->if_port] & MediaIsMII) { in tulip_select_media()
376 } else if (tulip_media_cap[dev->if_port] & MediaIsFx) { in tulip_select_media()
382 medianame[dev->if_port], in tulip_select_media()
386 tp->csr6 = new_csr6 | (tp->csr6 & 0xfdff) | (tp->full_duplex ? 0x0200 : 0); in tulip_select_media()
402 bmsr = tulip_mdio_read(dev, tp->phys[0], MII_BMSR); in tulip_check_duplex()
403 lpa = tulip_mdio_read(dev, tp->phys[0], MII_LPA); in tulip_check_duplex()
405 dev_info(&dev->dev, "MII status %04x, Link partner report %04x\n", in tulip_check_duplex()
408 return -2; in tulip_check_duplex()
410 int new_bmsr = tulip_mdio_read(dev, tp->phys[0], MII_BMSR); in tulip_check_duplex()
413 dev_info(&dev->dev, in tulip_check_duplex()
416 return -1; in tulip_check_duplex()
419 negotiated = lpa & tp->advertising[0]; in tulip_check_duplex()
420 tp->full_duplex = mii_duplex(tp->full_duplex_lock, negotiated); in tulip_check_duplex()
422 new_csr6 = tp->csr6; in tulip_check_duplex()
426 if (tp->full_duplex) new_csr6 |= FullDuplex; in tulip_check_duplex()
429 if (new_csr6 != tp->csr6) { in tulip_check_duplex()
430 tp->csr6 = new_csr6; in tulip_check_duplex()
434 dev_info(&dev->dev, in tulip_check_duplex()
435 "Setting %s-duplex based on MII#%d link partner capability of %04x\n", in tulip_check_duplex()
436 tp->full_duplex ? "full" : "half", in tulip_check_duplex()
437 tp->phys[0], lpa); in tulip_check_duplex()
454 but takes much time. */ in tulip_find_mii()
455 for (phyn = 1; phyn <= 32 && phy_idx < ARRAY_SIZE(tp->phys); phyn++) { in tulip_find_mii()
479 if (tp->mii_advertise) { in tulip_find_mii()
480 tp->advertising[phy_idx] = in tulip_find_mii()
481 to_advert = tp->mii_advertise; in tulip_find_mii()
482 } else if (tp->advertising[phy_idx]) { in tulip_find_mii()
483 to_advert = tp->advertising[phy_idx]; in tulip_find_mii()
485 tp->advertising[phy_idx] = in tulip_find_mii()
486 tp->mii_advertise = in tulip_find_mii()
490 tp->phys[phy_idx++] = phy; in tulip_find_mii()
503 if (tp->default_port == 0) { in tulip_find_mii()
522 if (tp->full_duplex) in tulip_find_mii()
524 if (tulip_media_cap[tp->default_port] & MediaIs100) in tulip_find_mii()
541 tp->mii_cnt = phy_idx; in tulip_find_mii()
542 if (tp->mtable && tp->mtable->has_mii && phy_idx == 0) { in tulip_find_mii()
545 tp->phys[0] = 1; in tulip_find_mii()