[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree
zrouter-src-freebsd at zrouter.org
zrouter-src-freebsd at zrouter.org
Mon Apr 23 09:20:10 UTC 2012
details: http://zrouter.org/hg/FreeBSD/head//rev/a12e0130385e
changeset: 464:a12e0130385e
user: Aleksandr Rybalko <ray at ddteam.net>
date: Mon Apr 23 12:16:49 2012 +0300
description:
revert "read link status workaround"
diffstat:
head/sys/dev/switch/ar8x16_switch.c | 64 ++++--------------------------------
1 files changed, 7 insertions(+), 57 deletions(-)
diffs (96 lines):
diff -r be4db0d3a57d -r a12e0130385e head/sys/dev/switch/ar8x16_switch.c
--- a/head/sys/dev/switch/ar8x16_switch.c Mon Apr 23 12:15:23 2012 +0300
+++ b/head/sys/dev/switch/ar8x16_switch.c Mon Apr 23 12:16:49 2012 +0300
@@ -44,7 +44,6 @@
#include <dev/switch/switch_ioctl.h>
#include <dev/switch/ar8x16_switchreg.h>
#include <dev/switch/ar8x16_switchvar.h>
-#include <dev/mii/mii.h>
#include "switch_if.h"
#include "switchb_if.h"
@@ -129,52 +128,6 @@
}
static int
-get_link_status(device_t dev, int phy, int reg)
-{
- struct ar8x16_switch_softc *sc;
- uint16_t value = 0;
- uint32_t status;
-
- sc = device_get_softc(dev);
-
- /*
- * XXX: Hope it is only AR7242 with MII in PHY mode do not show PHY
- * regs via MDIO interface
- */
- if (sc->devid != 8216)
- return (miibus_readreg(dev, phy, reg));
-
- status = READ4(sc, AR8X16_REG_PORT_STS(phy));
-
- switch (reg) {
- case MII_BMCR:
- value = (BMSR_100TXFDX | BMSR_100TXHDX | BMSR_10TFDX |
- BMSR_10THDX | BMSR_ANEG);
- if (status & AR8X16_PORT_STS_LINK_UP)
- value |= (BMSR_LINK | BMSR_ACOMP);
- break;
- case MII_BMSR:
- switch (status & AR8X16_PORT_STS_SPEED_MASK) {
- case AR8X16_PORT_STS_SPEED_10:
- value = BMCR_S10;
- break;
- case AR8X16_PORT_STS_SPEED_100:
- value = BMCR_S100;
- break;
- case AR8X16_PORT_STS_SPEED_1000:
- value = BMCR_S1000;
- break;
- }
- if (status & AR8X16_PORT_STS_DUPLEX)
- value |= BMCR_FDX;
- if (status & AR8X16_PORT_STS_LINK_AUTO)
- value |= BMCR_AUTOEN;
- break;
- }
- return (value);
-}
-
-static int
get_reg(device_t dev, uint32_t reg, uint32_t *value)
{
struct ar8x16_switch_softc *sc;
@@ -182,10 +135,10 @@
sc = device_get_softc(dev);
if (reg & SWITCH_REG_TYPE_RAW)
*value = READ4(sc, reg);
- else if (reg & SWITCH_REG_TYPE_PHY) {
- *value = get_link_status(dev, ((reg >> 8) & 0xff),
+ else if (reg & SWITCH_REG_TYPE_PHY)
+ *value = miibus_readreg(dev, ((reg >> 8) & 0xff),
(reg & 0xff));
- } else
+ else
*value = MII_SW_READ4(sc, reg);
return (0);
}
@@ -201,13 +154,10 @@
old = READ4(sc, reg);
WRITE4(sc, reg, *value);
} else if (reg & SWITCH_REG_TYPE_PHY) {
- /* XXX: look into get_link_status */
- if (sc->devid != 8216) {
- old = miibus_readreg(dev, ((reg >> 8) & 0xff),
- (reg & 0xff));
- *value = miibus_writereg(dev, ((reg >> 8) & 0xff),
- (reg & 0xff), *value);
- }
+ old = miibus_readreg(dev, ((reg >> 8) & 0xff),
+ (reg & 0xff));
+ *value = miibus_writereg(dev, ((reg >> 8) & 0xff),
+ (reg & 0xff), *value);
} else {
old = MII_SW_READ4(sc, reg);
MII_SW_WRITE4(sc, reg, *value);
More information about the Zrouter-src-freebsd
mailing list