Deleted Added
full compact
27c27
< * $Id$
---
> * $Id: if_fxp.c,v 1.29 1997/02/22 09:44:05 peter Exp $
90a91,93
> int phy_primary_addr; /* address of primary PHY */
> int phy_primary_device; /* device type of primary PHY */
> int phy_10Mbps_only; /* PHY is 10Mbps-only device */
137d139
< static void fxp_get_macaddr __P((struct fxp_softc *));
139a142,144
> static int fxp_mdi_read __P((struct fxp_csr *, int, int));
> static void fxp_mdi_write __P((struct fxp_csr *, int, int, int));
> static void fxp_read_eeprom __P((struct fxp_csr *, u_short *, int, int));
140a146
>
211c217
< return ("Intel EtherExpress Pro/100B Fast Ethernet");
---
> return ("Intel EtherExpress Pro 10/100B Ethernet");
227a234
> u_short data;
277a285,292
> /*
> * Get info about the primary PHY
> */
> fxp_read_eeprom(sc->csr, (u_short *)&data, 6, 1);
> sc->phy_primary_addr = data & 0xff;
> sc->phy_primary_device = (data >> 8) & 0x3f;
> sc->phy_10Mbps_only = data >> 15;
>
290,292c305,312
< fxp_get_macaddr(sc);
< printf("fxp%d: Ethernet address %6D\n", unit,
< sc->arpcom.ac_enaddr, ":");
---
> /*
> * Read MAC address
> */
> fxp_read_eeprom(sc->csr, (u_short *)sc->arpcom.ac_enaddr, 0, 3);
> printf("fxp%d: Ethernet address %6D", unit, sc->arpcom.ac_enaddr, ":");
> if (sc->phy_10Mbps_only)
> printf(", 10Mbps");
> printf("\n");
331,336c351,355
< * Read station (MAC) address from serial EEPROM. Basically, you
< * manually shift in the read opcode (one bit at a time) and then
< * shift in the address, and then you shift out the data (all of
< * this one bit at a time). The word size is 16 bits, so you have
< * to provide the address for every 16 bits of data. The MAC address
< * is in the first 3 words (6 bytes total).
---
> * Read from the serial EEPROM. Basically, you manually shift in
> * the read opcode (one bit at a time) and then shift in the address,
> * and then you shift out the data (all of this one bit at a time).
> * The word size is 16 bits, so you have to provide the address for
> * every 16 bits of data.
339,341c358
< fxp_get_macaddr(sc)
< struct fxp_softc *sc;
< {
---
> fxp_read_eeprom(csr, data, offset, words)
343c360,364
< u_short reg, *data;
---
> u_short *data;
> int offset;
> int words;
> {
> u_short reg;
346,349c367
< csr = sc->csr;
< data = (u_short *)sc->arpcom.ac_enaddr;
<
< for (i = 0; i < 3; i++) {
---
> for (i = 0; i < words; i++) {
370c388
< if (i & (1 << (x - 1))) {
---
> if ((i + offset) & (1 << (x - 1))) {
867c885
< cbp->mediatype = 1; /* (MII) interface mode */
---
> cbp->mediatype = !sc->phy_10Mbps_only; /* interface mode */
943a962,972
> /*
> * Toggle a few bits in the DP83840 PHY.
> */
> if (sc->phy_primary_device == FXP_PHY_DP83840) {
> fxp_mdi_write(sc->csr, sc->phy_primary_addr, FXP_DP83840_PCR,
> fxp_mdi_read(sc->csr, sc->phy_primary_addr, FXP_DP83840_PCR) |
> FXP_DP83840_PCR_LED4_MODE | /* LED4 always indicates duplex */
> FXP_DP83840_PCR_F_CONNECT | /* force link disconnect bypass */
> FXP_DP83840_PCR_BIT10); /* XXX I have no idea */
> }
>
1016a1046,1083
> fxp_mdi_read(csr, phy, reg)
> struct fxp_csr *csr;
> int phy;
> int reg;
> {
> int count = 10000;
>
> csr->mdi_control = (FXP_MDI_READ << 26) | (reg << 16) | (phy << 21);
>
> while ((csr->mdi_control & 0x10000000) == 0 && count--)
> DELAY(1);
>
> if (count <= 0)
> printf("fxp_mdi_read: timed out\n");
>
> return (csr->mdi_control & 0xffff);
> }
>
> static void
> fxp_mdi_write(csr, phy, reg, value)
> struct fxp_csr *csr;
> int phy;
> int reg;
> int value;
> {
> int count = 10000;
>
> csr->mdi_control = (FXP_MDI_WRITE << 26) | (reg << 16) | (phy << 21)
> | (value & 0xffff);
>
> while ((csr->mdi_control & 10000000) == 0 && count--)
> DELAY(1);
>
> if (count <= 0)
> printf("fxp_mdi_write: timed out\n");
> }
>
> static int