Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 May 2012 21:08:07 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r235377 - head/sys/dev/etherswitch/arswitch
Message-ID:  <201205122108.q4CL87tq052540@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Sat May 12 21:08:07 2012
New Revision: 235377
URL: http://svn.freebsd.org/changeset/base/235377

Log:
  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

Modified:
  head/sys/dev/etherswitch/arswitch/arswitch.c
  head/sys/dev/etherswitch/arswitch/arswitch_7240.c

Modified: head/sys/dev/etherswitch/arswitch/arswitch.c
==============================================================================
--- head/sys/dev/etherswitch/arswitch/arswitch.c	Sat May 12 20:53:00 2012	(r235376)
+++ head/sys/dev/etherswitch/arswitch/arswitch.c	Sat May 12 21:08:07 2012	(r235377)
@@ -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);

Modified: head/sys/dev/etherswitch/arswitch/arswitch_7240.c
==============================================================================
--- head/sys/dev/etherswitch/arswitch/arswitch_7240.c	Sat May 12 20:53:00 2012	(r235376)
+++ head/sys/dev/etherswitch/arswitch/arswitch_7240.c	Sat May 12 21:08:07 2012	(r235377)
@@ -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_s
 {
 
 	/* 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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205122108.q4CL87tq052540>