diff options
author | adrian <adrian@FreeBSD.org> | 2012-05-12 21:08:07 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2012-05-12 21:08:07 +0000 |
commit | 75fa27bcfce0da47ad015b3aca358721443edce1 (patch) | |
tree | 4bbe52910af9fc72f5317c4608ad5a5b502740a5 | |
parent | 567e856364e9a6c28ce5aa474be3a80885480ce5 (diff) | |
download | FreeBSD-src-75fa27bcfce0da47ad015b3aca358721443edce1.zip FreeBSD-src-75fa27bcfce0da47ad015b3aca358721443edce1.tar.gz |
Setup the CPU port and broadcast map on the AR7240, rather than
depending upon the bootloader initialising it.
The aim is to eventually support a full switch set and reinitialisation
rather than relying on a consistent bootloader setup.
Remove the port flood config from arswitch.c, it's not yet used and
it's totally incorrect.
Whilst I'm here, also add in a comment describing why the full switch
reset is disabled.
Obtained from: Linux (OpenWRT) - Values
-rw-r--r-- | sys/dev/etherswitch/arswitch/arswitch.c | 12 | ||||
-rw-r--r-- | sys/dev/etherswitch/arswitch/arswitch_7240.c | 16 |
2 files changed, 18 insertions, 10 deletions
diff --git a/sys/dev/etherswitch/arswitch/arswitch.c b/sys/dev/etherswitch/arswitch/arswitch.c index 1410838..16f63f8 100644 --- a/sys/dev/etherswitch/arswitch/arswitch.c +++ b/sys/dev/etherswitch/arswitch/arswitch.c @@ -220,6 +220,15 @@ arswitch_attach(device_t dev) (void) resource_int_value(device_get_name(dev), device_get_unit(dev), "is_gmii", &sc->is_gmii); + /* + * This requires much more setup depending upon each chip, including: + * + * + Proper reinitialisation of the PHYs; + * + Initialising the VLAN table; + * + Initialising the port access table and CPU flood/broadcast + * configuration; + * + Other things I haven't yet thought of. + */ #ifdef NOTYET arswitch_writereg(dev, AR8X16_REG_MASK_CTRL, AR8X16_MASK_CTRL_SOFT_RESET); @@ -229,9 +238,6 @@ arswitch_attach(device_t dev) device_printf(dev, "unable to reset switch\n"); return (ENXIO); } - arswitch_modifyreg(dev, AR8X16_REG_GLOBAL_CTRL, - AR8X16_FLOOD_MASK_BCAST_TO_CPU, - AR8X16_FLOOD_MASK_BCAST_TO_CPU); #endif err = sc->hal.arswitch_hw_setup(sc); diff --git a/sys/dev/etherswitch/arswitch/arswitch_7240.c b/sys/dev/etherswitch/arswitch/arswitch_7240.c index 8809e07..c8f6426 100644 --- a/sys/dev/etherswitch/arswitch/arswitch_7240.c +++ b/sys/dev/etherswitch/arswitch/arswitch_7240.c @@ -64,10 +64,6 @@ #include "miibus_if.h" #include "etherswitch_if.h" -/* XXX belongs in arswitch_7240_reg.h */ - -#define AR7240_REG_TAG_PRIORITY 0x70 - /* * AR7240 specific functions */ @@ -96,14 +92,20 @@ ar7240_hw_global_setup(struct arswitch_softc *sc) { /* Setup TAG priority mapping */ - arswitch_writereg(sc->sc_dev, AR7240_REG_TAG_PRIORITY, 0xfa50); + arswitch_writereg(sc->sc_dev, AR8X16_REG_TAG_PRIO, 0xfa50); + + /* Enable broadcast frames transmitted to the CPU */ + arswitch_writereg(sc->sc_dev, AR8X16_REG_FLOOD_MASK, + AR8X16_FLOOD_MASK_BCAST_TO_CPU | 0x003f003f); - /* MTU */ + /* Setup MTU */ arswitch_modifyreg(sc->sc_dev, AR8X16_REG_GLOBAL_CTRL, AR7240_GLOBAL_CTRL_MTU_MASK, SM(1536, AR7240_GLOBAL_CTRL_MTU_MASK)); - /* XXX Service Tag */ + /* Service Tag */ + arswitch_modifyreg(sc->sc_dev, AR8X16_REG_SERVICE_TAG, + AR8X16_SERVICE_TAG_MASK, 0); return (0); } |