version 1.62, 2002/08/10 22:54:54 |
version 1.63, 2002/08/10 22:57:15 |
|
|
* |
* |
* TODO: |
* TODO: |
* |
* |
* - Support the 10-bit interface on the DP83820 (for fiber). |
|
* |
|
* - Reduce the Rx interrupt load. |
* - Reduce the Rx interrupt load. |
*/ |
*/ |
|
|
Line 923 SIP_DECL(attach)(struct device *parent, |
|
Line 921 SIP_DECL(attach)(struct device *parent, |
|
sc->sc_mii.mii_statchg = sip->sip_variant->sipv_mii_statchg; |
sc->sc_mii.mii_statchg = sip->sip_variant->sipv_mii_statchg; |
ifmedia_init(&sc->sc_mii.mii_media, 0, SIP_DECL(mediachange), |
ifmedia_init(&sc->sc_mii.mii_media, 0, SIP_DECL(mediachange), |
SIP_DECL(mediastatus)); |
SIP_DECL(mediastatus)); |
#ifdef DP83820 |
|
if (sc->sc_cfg & CFG_TBI_EN) { |
|
/* Using ten-bit interface. */ |
|
printf("%s: TBI -- FIXME\n", sc->sc_dev.dv_xname); |
|
} else { |
|
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY, |
|
MII_OFFSET_ANY, 0); |
|
if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) { |
|
ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE, |
|
0, NULL); |
|
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE); |
|
} else |
|
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO); |
|
} |
|
#else |
|
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY, |
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY, |
MII_OFFSET_ANY, 0); |
MII_OFFSET_ANY, 0); |
if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) { |
if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) { |
Line 945 SIP_DECL(attach)(struct device *parent, |
|
Line 929 SIP_DECL(attach)(struct device *parent, |
|
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE); |
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE); |
} else |
} else |
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO); |
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO); |
#endif /* DP83820 */ |
|
|
|
ifp = &sc->sc_ethercom.ec_if; |
ifp = &sc->sc_ethercom.ec_if; |
strcpy(ifp->if_xname, sc->sc_dev.dv_xname); |
strcpy(ifp->if_xname, sc->sc_dev.dv_xname); |
Line 2861 SIP_DECL(dp83815_set_filter)(struct sip_ |
|
Line 2844 SIP_DECL(dp83815_set_filter)(struct sip_ |
|
int |
int |
SIP_DECL(dp83820_mii_readreg)(struct device *self, int phy, int reg) |
SIP_DECL(dp83820_mii_readreg)(struct device *self, int phy, int reg) |
{ |
{ |
|
struct sip_softc *sc = (void *) self; |
|
|
|
if (sc->sc_cfg & CFG_TBI_EN) { |
|
bus_addr_t tbireg; |
|
int rv; |
|
|
|
if (phy != 0) |
|
return (0); |
|
|
|
switch (reg) { |
|
case MII_BMCR: tbireg = SIP_TBICR; break; |
|
case MII_BMSR: tbireg = SIP_TBISR; break; |
|
case MII_ANAR: tbireg = SIP_TANAR; break; |
|
case MII_ANLPAR: tbireg = SIP_TANLPAR; break; |
|
case MII_ANER: tbireg = SIP_TANER; break; |
|
case MII_EXTSR: tbireg = SIP_TESR; break; |
|
default: |
|
return (0); |
|
} |
|
|
|
rv = bus_space_read_4(sc->sc_st, sc->sc_sh, tbireg) & 0xffff; |
|
if (tbireg == SIP_TBISR) { |
|
/* LINK and ACOMP are switched! */ |
|
int val = rv; |
|
|
|
rv = 0; |
|
if (val & TBISR_MR_LINK_STATUS) |
|
rv |= BMSR_LINK; |
|
if (val & TBISR_MR_AN_COMPLETE) |
|
rv |= BMSR_ACOMP; |
|
} |
|
|
|
return (rv); |
|
} |
|
|
return (mii_bitbang_readreg(self, &SIP_DECL(dp83820_mii_bitbang_ops), |
return (mii_bitbang_readreg(self, &SIP_DECL(dp83820_mii_bitbang_ops), |
phy, reg)); |
phy, reg)); |
Line 2874 SIP_DECL(dp83820_mii_readreg)(struct dev |
|
Line 2891 SIP_DECL(dp83820_mii_readreg)(struct dev |
|
void |
void |
SIP_DECL(dp83820_mii_writereg)(struct device *self, int phy, int reg, int val) |
SIP_DECL(dp83820_mii_writereg)(struct device *self, int phy, int reg, int val) |
{ |
{ |
|
struct sip_softc *sc = (void *) self; |
|
|
|
if (sc->sc_cfg & CFG_TBI_EN) { |
|
bus_addr_t tbireg; |
|
|
|
if (phy != 0) |
|
return; |
|
|
|
switch (reg) { |
|
case MII_BMCR: tbireg = SIP_TBICR; break; |
|
case MII_ANAR: tbireg = SIP_TANAR; break; |
|
case MII_ANLPAR: tbireg = SIP_TANLPAR; break; |
|
default: |
|
return; |
|
} |
|
|
|
bus_space_write_4(sc->sc_st, sc->sc_sh, tbireg, val); |
|
return; |
|
} |
|
|
mii_bitbang_writereg(self, &SIP_DECL(dp83820_mii_bitbang_ops), |
mii_bitbang_writereg(self, &SIP_DECL(dp83820_mii_bitbang_ops), |
phy, reg, val); |
phy, reg, val); |