aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ixp4xx/base-files
Commit message (Expand)AuthorAgeFilesLines
* scripts: fix wrong usage of '==' operatorJohn Crispin2014-10-141-4/+4
* target/linux/*/base-files/lib/upgrade/platform.sh - wrong check for ARGCJohn Crispin2014-06-021-1/+1
* ixp4xx: upgrade: don't copy extra binariesLuka Perkov2013-12-301-5/+2
* add support for the Tonze AP-422/425Imre Kaloz2012-11-111-0/+9
* ixp4xx: add sysupgrade supportFelix Fietkau2012-10-172-0/+181
* add preinit modularization work by Daniel Dickinson (cshore)Felix Fietkau2010-01-252-15/+23
* handle the nonstandard redboot mac variable for the WG302v1Imre Kaloz2008-07-311-0/+7
* remove unnecessary ixp4xx network config overrideFelix Fietkau2008-07-311-13/+0
* on IXP46x we can have up to 3 npe ethernet interfaces, so set the mac for the...Imre Kaloz2008-07-141-1/+1
* fix up mac address setting on ixp4xx for devices that store this info in the ...Imre Kaloz2008-05-281-0/+8
* get rid of per-profile base-filesGabor Juhos2007-09-291-0/+0
* strip the kernel version suffix from target directories, except for brcm-2.4 ...Felix Fietkau2007-09-061-0/+13
cial { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; } .highlight .hll { background-color: #ffffcc } .highlight { background: #ffffff; } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h
@@ -336,6 +336,9 @@ struct bcm_enet_priv {
 	struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT];
 	int sw_port_link[ENETSW_MAX_PORT];
 
+	/* platform device for associated switch */
+	struct platform_device *b53_device;
+
 	/* used to poll switch port state */
 	struct timer_list swphy_poll;
 	spinlock_t enetsw_mdio_lock;
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -31,6 +31,7 @@
 #include <linux/platform_device.h>
 #include <linux/if_vlan.h>
 #include <linux/gpio/consumer.h>
+#include <linux/platform_data/b53.h>
 
 #include <bcm63xx_dev_enet.h>
 #include "bcm63xx_enet.h"
@@ -1975,7 +1976,8 @@ static int bcm_enet_remove(struct platfo
 	return 0;
 }
 
-struct platform_driver bcm63xx_enet_driver = {
+
+static struct platform_driver bcm63xx_enet_driver = {
 	.probe	= bcm_enet_probe,
 	.remove	= bcm_enet_remove,
 	.driver	= {
@@ -1984,6 +1986,42 @@ struct platform_driver bcm63xx_enet_driv
 	},
 };
 
+struct b53_platform_data bcm63xx_b53_pdata = {
+	.chip_id = 0x6300,
+	.big_endian = 1,
+};
+
+struct platform_device bcm63xx_b53_dev = {
+	.name		= "b53-switch",
+	.id		= -1,
+	.dev		= {
+		.platform_data = &bcm63xx_b53_pdata,
+	},
+};
+
+static int bcmenet_switch_register(struct bcm_enet_priv *priv, u16 port_mask)
+{
+	int ret;
+
+	bcm63xx_b53_pdata.regs = priv->base;
+	bcm63xx_b53_pdata.enabled_ports = port_mask;
+	bcm63xx_b53_pdata.alias = priv->net_dev->name;
+
+	ret = platform_device_register(&bcm63xx_b53_dev);
+	if (!ret)
+		priv->b53_device = &bcm63xx_b53_dev;
+
+	return ret;
+}
+
+static void bcmenet_switch_unregister(struct bcm_enet_priv *priv)
+{
+	if (priv->b53_device)
+		platform_device_unregister(&bcm63xx_b53_dev);
+
+	priv->b53_device = NULL;
+}
+
 /*
  * switch mii access callbacks
  */
@@ -2237,29 +2275,6 @@ static int bcm_enetsw_open(struct net_de
 		enetsw_writeb(priv, rgmii_ctrl, ENETSW_RGMII_CTRL_REG(i));
 	}
 
-	/* reset mib */
-	val = enetsw_readb(priv, ENETSW_GMCR_REG);
-	val |= ENETSW_GMCR_RST_MIB_MASK;
-	enetsw_writeb(priv, val, ENETSW_GMCR_REG);
-	mdelay(1);
-	val &= ~ENETSW_GMCR_RST_MIB_MASK;
-	enetsw_writeb(priv, val, ENETSW_GMCR_REG);
-	mdelay(1);
-
-	/* force CPU port state */
-	val = enetsw_readb(priv, ENETSW_IMPOV_REG);
-	val |= ENETSW_IMPOV_FORCE_MASK | ENETSW_IMPOV_LINKUP_MASK;
-	enetsw_writeb(priv, val, ENETSW_IMPOV_REG);
-
-	/* enable switch forward engine */
-	val = enetsw_readb(priv, ENETSW_SWMODE_REG);
-	val |= ENETSW_SWMODE_FWD_EN_MASK;
-	enetsw_writeb(priv, val, ENETSW_SWMODE_REG);
-
-	/* enable jumbo on all ports */
-	enetsw_writel(priv, 0x1ff, ENETSW_JMBCTL_PORT_REG);
-	enetsw_writew(priv, 9728, ENETSW_JMBCTL_MAXSIZE_REG);
-
 	/* initialize flow control buffer allocation */
 	enet_dma_writel(priv, ENETDMA_BUFALLOC_FORCE_MASK | 0,
 			ENETDMA_BUFALLOC_REG(priv->rx_chan));
@@ -2719,6 +2734,9 @@ static int bcm_enetsw_probe(struct platf
 	struct bcm63xx_enetsw_platform_data *pd;
 	struct resource *res_mem;
 	int ret, irq_rx, irq_tx;
+	unsigned i, num_ports = 0;
+	u16 port_mask = BIT(8);
+	u8 val;
 
 	/* stop if shared driver failed, assume driver->probe will be
 	 * called in the same order we register devices (correct ?)
@@ -2808,6 +2826,43 @@ static int bcm_enetsw_probe(struct platf
 	priv->pdev = pdev;
 	priv->net_dev = dev;
 
+	/* reset mib */
+	val = enetsw_readb(priv, ENETSW_GMCR_REG);
+	val |= ENETSW_GMCR_RST_MIB_MASK;
+	enetsw_writeb(priv, val, ENETSW_GMCR_REG);
+	mdelay(1);
+	val &= ~ENETSW_GMCR_RST_MIB_MASK;
+	enetsw_writeb(priv, val, ENETSW_GMCR_REG);
+	mdelay(1);
+
+	/* force CPU port state */
+	val = enetsw_readb(priv, ENETSW_IMPOV_REG);
+	val |= ENETSW_IMPOV_FORCE_MASK | ENETSW_IMPOV_LINKUP_MASK;
+	enetsw_writeb(priv, val, ENETSW_IMPOV_REG);
+
+	/* enable switch forward engine */
+	val = enetsw_readb(priv, ENETSW_SWMODE_REG);
+	val |= ENETSW_SWMODE_FWD_EN_MASK;
+	enetsw_writeb(priv, val, ENETSW_SWMODE_REG);
+
+	/* enable jumbo on all ports */
+	enetsw_writel(priv, 0x1ff, ENETSW_JMBCTL_PORT_REG);
+	enetsw_writew(priv, 9728, ENETSW_JMBCTL_MAXSIZE_REG);
+
+	for (i = 0; i < priv->num_ports; i++) {
+		struct bcm63xx_enetsw_port *port = &priv->used_ports[i];
+
+		if (!port->used)
+			continue;
+
+		num_ports++;
+		port_mask |= BIT(i);
+	}
+
+	/* only register if there is more than one external port */
+	if (num_ports > 1)
+		bcmenet_switch_register(priv, port_mask);
+
 	return 0;
 
 out_put_clk:
@@ -2836,6 +2891,9 @@ static int bcm_enetsw_remove(struct plat
 	priv = netdev_priv(dev);
 	unregister_netdev(dev);
 
+	/* remove switch */
+	bcmenet_switch_unregister(priv);
+
 	/* release device resources */
 	iounmap(priv->base);
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);