bcm63xx: update enetswitch driver

Update enetswith driver with latest fixes and additions.

Signed-off-by: Jonas Gorski <jonas.gorski+openwrt@gmail.com>

SVN-Revision: 32921
This commit is contained in:
Jonas Gorski 2012-07-31 14:27:31 +00:00
parent fa75bd977a
commit 94d257a851
31 changed files with 452 additions and 44 deletions

View File

@ -17,7 +17,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -2214,6 +2214,8 @@ static int bcm_enetsw_open(struct net_de @@ -2213,6 +2213,8 @@ static int bcm_enetsw_open(struct net_de
enetsw_writeb(priv, ENETSW_PTCTRL_RXDIS_MASK | enetsw_writeb(priv, ENETSW_PTCTRL_RXDIS_MASK |
ENETSW_PTCTRL_TXDIS_MASK, ENETSW_PTCTRL_TXDIS_MASK,
ENETSW_PTCTRL_REG(i)); ENETSW_PTCTRL_REG(i));

View File

@ -0,0 +1,20 @@
From e79bc74f76361020d820ed4611d28f70ebd845ca Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Tue, 10 Jul 2012 10:44:09 +0200
Subject: [PATCH 34/84] bcm63xx_enet: don't overwrite settings when setting duplex on force
---
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -2333,7 +2333,7 @@ static int bcm_enetsw_open(struct net_de
}
if (port->force_duplex_full)
- override = ENETSW_IMPOV_FDX_MASK;
+ override |= ENETSW_IMPOV_FDX_MASK;
enetsw_writeb(priv, override, ENETSW_PORTOV_REG(i));

View File

@ -0,0 +1,98 @@
From efe31ec8fca92162fc21630611971345014a81a0 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Tue, 10 Jul 2012 10:39:30 +0200
Subject: [PATCH 33/84] bcm63xx_enet: store the number of ports instead of hardcoding them
This will be needed for devices with a different number of ports
---
arch/mips/bcm63xx/dev-enet.c | 2 ++
.../include/asm/mach-bcm63xx/bcm63xx_dev_enet.h | 2 ++
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 9 +++++----
drivers/net/ethernet/broadcom/bcm63xx_enet.h | 1 +
4 files changed, 10 insertions(+), 4 deletions(-)
--- a/arch/mips/bcm63xx/dev-enet.c
+++ b/arch/mips/bcm63xx/dev-enet.c
@@ -239,6 +239,8 @@ bcm63xx_enetsw_register(const struct bcm
memcpy(bcm63xx_enetsw_device.dev.platform_data, pd, sizeof (*pd));
+ enetsw_pd.num_ports = ENETSW_PORTS_6368;
+
ret = platform_device_register(&bcm63xx_enetsw_device);
if (ret)
return ret;
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
@@ -43,6 +43,7 @@ struct bcm63xx_enet_platform_data {
* on board ethernet switch platform data
*/
#define ENETSW_MAX_PORT 6
+#define ENETSW_PORTS_6368 6 /* 4 FE PHY + 2 RGMII */
struct bcm63xx_enetsw_port {
int used;
@@ -58,6 +59,7 @@ struct bcm63xx_enetsw_port {
struct bcm63xx_enetsw_platform_data {
char mac_addr[ETH_ALEN];
+ int num_ports;
struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT];
};
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -2041,7 +2041,7 @@ static void swphy_poll_timer(unsigned lo
struct bcm_enet_priv *priv = (struct bcm_enet_priv *)data;
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(priv->used_ports); i++) {
+ for (i = 0; i < priv->num_ports; i++) {
struct bcm63xx_enetsw_port *port;
int val, j, up, advertise, lpa, lpa2, speed, duplex, media;
u8 override;
@@ -2207,7 +2207,7 @@ static int bcm_enetsw_open(struct net_de
priv->rx_curr_desc = 0;
/* disable all ports */
- for (i = 0; i < 6; i++) {
+ for (i = 0; i < priv->num_ports; i++) {
enetsw_writeb(priv, ENETSW_PORTOV_ENABLE_MASK,
ENETSW_PORTOV_REG(i));
enetsw_writeb(priv, ENETSW_PTCTRL_RXDIS_MASK |
@@ -2303,7 +2303,7 @@ static int bcm_enetsw_open(struct net_de
/*
* apply override config for bypass_link ports here.
*/
- for (i = 0; i < ARRAY_SIZE(priv->used_ports); i++) {
+ for (i = 0; i < priv->num_ports; i++) {
struct bcm63xx_enetsw_port *port;
u8 override;
port = &priv->used_ports[i];
@@ -2447,7 +2447,7 @@ static int bcm_enetsw_phy_is_external(st
{
int i;
- for (i = 0; i < (int)ARRAY_SIZE(priv->used_ports); ++i) {
+ for (i = 0; i < priv->num_ports; ++i) {
if (!priv->used_ports[i].used)
continue;
if (priv->used_ports[i].phy_id == phy_id)
@@ -2735,6 +2735,7 @@ static int __devinit bcm_enetsw_probe(st
memcpy(dev->dev_addr, pd->mac_addr, ETH_ALEN);
memcpy(priv->used_ports, pd->used_ports,
sizeof (pd->used_ports));
+ priv->num_ports = pd->num_ports;
}
ret = compute_hw_mtu(priv, dev->mtu);
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h
@@ -354,6 +354,7 @@ struct bcm_enet_priv {
unsigned int hw_mtu;
/* port mapping for switch devices */
+ int num_ports;
struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT];
int sw_port_link[ENETSW_MAX_PORT];

View File

@ -0,0 +1,73 @@
From ef581388c45dbc48f7bbe050e87deb1e3c63a698 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Tue, 10 Jul 2012 10:52:02 +0200
Subject: [PATCH 35/84] bcm63xx_enet: store is_sw in a variable instead of checking the cpuid
Reduces the number of changes needed for making enetsw work on new
chips.
---
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 7 +++++--
drivers/net/ethernet/broadcom/bcm63xx_enet.h | 10 ++--------
2 files changed, 7 insertions(+), 10 deletions(-)
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -364,7 +364,7 @@ static int bcm_enet_receive_queue(struct
}
/* recycle packet if it's marked as bad */
- if (!bcm_enet_is_sw(priv) &&
+ if (!priv->enet_is_sw &&
unlikely(len_stat & DMADESC_ERR_MASK)) {
dev->stats.rx_errors++;
@@ -597,7 +597,7 @@ static int bcm_enet_start_xmit(struct sk
}
/* pad small packets sent on a switch device */
- if (bcm_enet_is_sw(priv) && skb->len < 64) {
+ if (priv->enet_is_sw && skb->len < 64) {
int needed = 64 - skb->len;
char *data;
@@ -1700,6 +1700,8 @@ static int __devinit bcm_enet_probe(stru
return -ENOMEM;
priv = netdev_priv(dev);
+ priv->enet_is_sw = false;
+
ret = compute_hw_mtu(priv, dev->mtu);
if (ret)
goto out;
@@ -2725,6 +2727,7 @@ static int __devinit bcm_enetsw_probe(st
memset(priv, 0, sizeof(*priv));
/* initialize default and fetch platform data */
+ priv->enet_is_sw = true;
priv->irq_rx = irq_rx;
priv->irq_tx = irq_tx;
priv->rx_ring_size = BCMENET_DEF_RX_DESC;
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h
@@ -353,6 +353,8 @@ struct bcm_enet_priv {
/* maximum hardware transmit/receive size */
unsigned int hw_mtu;
+ bool enet_is_sw;
+
/* port mapping for switch devices */
int num_ports;
struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT];
@@ -363,12 +365,4 @@ struct bcm_enet_priv {
spinlock_t enetsw_mdio_lock;
};
-static inline int bcm_enet_is_sw(struct bcm_enet_priv *priv)
-{
- if (BCMCPU_IS_6368())
- return 1;
- else
- return 0;
-}
-
#endif /* ! BCM63XX_ENET_H_ */

View File

@ -0,0 +1,69 @@
From 625894c377ba266c0044675b53f05d65db6355b6 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Sun, 8 Jul 2012 13:07:52 +0200
Subject: [PATCH 38/84] BCM63XX: allow enetsw without tx irq
---
arch/mips/bcm63xx/dev-enet.c | 2 ++
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 18 +++++++++++-------
2 files changed, 13 insertions(+), 7 deletions(-)
--- a/arch/mips/bcm63xx/dev-enet.c
+++ b/arch/mips/bcm63xx/dev-enet.c
@@ -236,6 +236,8 @@ bcm63xx_enetsw_register(const struct bcm
enetsw_res[0].end += RSET_ENETSW_SIZE - 1;
enetsw_res[1].start = bcm63xx_get_irq_number(IRQ_ENETSW_RXDMA0);
enetsw_res[2].start = bcm63xx_get_irq_number(IRQ_ENETSW_TXDMA0);
+ if (!enetsw_res[2].start)
+ enetsw_res[2].start = -1;
memcpy(bcm63xx_enetsw_device.dev.platform_data, pd, sizeof (*pd));
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -2151,10 +2151,12 @@ static int bcm_enetsw_open(struct net_de
if (ret)
goto out_freeirq;
- ret = request_irq(priv->irq_tx, bcm_enet_isr_dma,
- IRQF_DISABLED, dev->name, dev);
- if (ret)
- goto out_freeirq_rx;
+ if (priv->irq_tx != -1) {
+ ret = request_irq(priv->irq_tx, bcm_enet_isr_dma,
+ IRQF_DISABLED, dev->name, dev);
+ if (ret)
+ goto out_freeirq_rx;
+ }
/* allocate rx dma ring */
size = priv->rx_ring_size * sizeof(struct bcm_enet_desc);
@@ -2376,7 +2378,8 @@ out_free_rx_ring:
priv->rx_desc_cpu, priv->rx_desc_dma);
out_freeirq_tx:
- free_irq(priv->irq_tx, dev);
+ if (priv->irq_tx != -1)
+ free_irq(priv->irq_tx, dev);
out_freeirq_rx:
free_irq(priv->irq_rx, dev);
@@ -2433,7 +2436,8 @@ static int bcm_enetsw_stop(struct net_de
priv->rx_desc_cpu, priv->rx_desc_dma);
dma_free_coherent(kdev, priv->tx_desc_alloc_size,
priv->tx_desc_cpu, priv->tx_desc_dma);
- free_irq(priv->irq_tx, dev);
+ if (priv->irq_tx != -1)
+ free_irq(priv->irq_tx, dev);
free_irq(priv->irq_rx, dev);
return 0;
@@ -2716,7 +2720,7 @@ static int __devinit bcm_enetsw_probe(st
res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq_rx = platform_get_irq(pdev, 0);
irq_tx = platform_get_irq(pdev, 1);
- if (!res_mem || irq_rx < 0 || irq_tx < 0)
+ if (!res_mem || irq_rx < 0)
return -ENODEV;
ret = 0;

View File

@ -0,0 +1,87 @@
From 85e4551e033df7cb043e93042661fc1e58799efa Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Sun, 8 Jul 2012 15:36:23 +0200
Subject: [PATCH 52/84] BCM63XX: use port id for deciding external phy
Ports 0-3 always use the internal phy, while 4+ always need an external
phy to work.
---
.../include/asm/mach-bcm63xx/bcm63xx_dev_enet.h | 3 ++-
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 15 ++++++++-------
drivers/net/ethernet/broadcom/bcm63xx_enet.h | 5 +++++
3 files changed, 15 insertions(+), 8 deletions(-)
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
@@ -45,9 +45,10 @@ struct bcm63xx_enet_platform_data {
#define ENETSW_MAX_PORT 6
#define ENETSW_PORTS_6368 6 /* 4 FE PHY + 2 RGMII */
+#define ENETSW_RGMII_PORT0 4
+
struct bcm63xx_enetsw_port {
int used;
- int external_phy;
int phy_id;
int bypass_link;
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -2046,6 +2046,7 @@ static void swphy_poll_timer(unsigned lo
for (i = 0; i < priv->num_ports; i++) {
struct bcm63xx_enetsw_port *port;
int val, j, up, advertise, lpa, lpa2, speed, duplex, media;
+ int external_phy = bcm_enet_port_is_rgmii(i);
u8 override;
port = &priv->used_ports[i];
@@ -2057,7 +2058,7 @@ static void swphy_poll_timer(unsigned lo
/* dummy read to clear */
for (j = 0; j < 2; j++)
- val = bcmenet_sw_mdio_read(priv, port->external_phy,
+ val = bcmenet_sw_mdio_read(priv, external_phy,
port->phy_id, MII_BMSR);
if (val == 0xffff)
@@ -2081,14 +2082,14 @@ static void swphy_poll_timer(unsigned lo
continue;
}
- advertise = bcmenet_sw_mdio_read(priv, port->external_phy,
+ advertise = bcmenet_sw_mdio_read(priv, external_phy,
port->phy_id, MII_ADVERTISE);
- lpa = bcmenet_sw_mdio_read(priv, port->external_phy,
- port->phy_id, MII_LPA);
+ lpa = bcmenet_sw_mdio_read(priv, external_phy, port->phy_id,
+ MII_LPA);
- lpa2 = bcmenet_sw_mdio_read(priv, port->external_phy,
- port->phy_id, MII_STAT1000);
+ lpa2 = bcmenet_sw_mdio_read(priv, external_phy, port->phy_id,
+ MII_STAT1000);
/* figure out media and duplex from advertise and LPA values */
media = mii_nway_result(lpa & advertise);
@@ -2457,7 +2458,7 @@ static int bcm_enetsw_phy_is_external(st
if (!priv->used_ports[i].used)
continue;
if (priv->used_ports[i].phy_id == phy_id)
- return priv->used_ports[i].external_phy;
+ return bcm_enet_port_is_rgmii(i);
}
printk_once(KERN_WARNING "bcm63xx_enet: could not find a used port "
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h
@@ -365,4 +365,9 @@ struct bcm_enet_priv {
spinlock_t enetsw_mdio_lock;
};
+static inline int bcm_enet_port_is_rgmii(int portid)
+{
+ return portid >= ENETSW_RGMII_PORT0;
+}
+
#endif /* ! BCM63XX_ENET_H_ */

View File

@ -0,0 +1,53 @@
From d8237d704fc25eb2fc25ef4403608b78c6a6d4be Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Sun, 15 Jul 2012 20:08:57 +0200
Subject: [PATCH 54/81] bcm63xx_enet: enable rgmii clock on external ports
---
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 13 +++++++++++++
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 12 ++++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
@@ -779,6 +779,19 @@
#define ENETSW_PORTOV_FDX_MASK (1 << 1)
#define ENETSW_PORTOV_LINKUP_MASK (1 << 0)
+/* Port RGMII control register */
+#define ENETSW_RGMII_CTRL_REG(x) (0x60 + (x))
+#define ENETSW_RGMII_CTRL_GMII_CLK_EN (1 << 7)
+#define ENETSW_RGMII_CTRL_MII_OVERRIDE_EN (1 << 6)
+#define ENETSW_RGMII_CTRL_MII_MODE_MASK (3 << 4)
+#define ENETSW_RGMII_CTRL_RGMII_MODE (0 << 4)
+#define ENETSW_RGMII_CTRL_MII_MODE (1 << 4)
+#define ENETSW_RGMII_CTRL_RVMII_MODE (2 << 4)
+#define ENETSW_RGMII_CTRL_TIMING_SEL_EN (1 << 0)
+
+/* Port RGMII timing register */
+#define ENETSW_RGMII_TIMING_REG(x) (0x68 + (x))
+
/* MDIO control register */
#define ENETSW_MDIOC_REG (0xb0)
#define ENETSW_MDIOC_EXT_MASK (1 << 16)
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -2222,6 +2222,18 @@ static int bcm_enetsw_open(struct net_de
priv->sw_port_link[i] = 0;
}
+ /* enable external ports */
+ for (i = ENETSW_RGMII_PORT0; i < priv->num_ports; i++) {
+ u8 rgmii_ctrl;
+
+ if (!priv->used_ports[i].used)
+ continue;
+
+ rgmii_ctrl = enetsw_readb(priv, ENETSW_RGMII_CTRL_REG(i));
+ rgmii_ctrl |= ENETSW_RGMII_CTRL_GMII_CLK_EN;
+ 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;

View File

@ -1,16 +1,16 @@
From 37d151859e09d09a950ad3ae615db1903bcc59d3 Mon Sep 17 00:00:00 2001 From 382a0b0dc4cbd0e0fbfd6c2d132e972c3d1245b0 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jonas.gorski@gmail.com> From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Sun, 13 Nov 2011 14:59:37 +0100 Date: Sun, 13 Nov 2011 14:59:37 +0100
Subject: [PATCH 43/79] bcm63xx_enet: fix lockup on BCM6328 Subject: [PATCH 39/84] bcm63xx_enet: fix lockup on BCM6328
BCM6328 locks up on a maxburst size of 16, reduce it to 8 for BCM6328 and BCM6328 locks up on a maxburst size of 16, reduce it to 8 for BCM6328 and
BCM6368. BCM6368.
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
--- ---
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 14 ++++++++------ drivers/net/ethernet/broadcom/bcm63xx_enet.c | 13 +++++++------
drivers/net/ethernet/broadcom/bcm63xx_enet.h | 4 ++++ drivers/net/ethernet/broadcom/bcm63xx_enet.h | 4 ++++
2 files changed, 12 insertions(+), 6 deletions(-) 2 files changed, 11 insertions(+), 6 deletions(-)
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@ -43,16 +43,15 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
return 0; return 0;
} }
@@ -1700,6 +1699,8 @@ static int __devinit bcm_enet_probe(stru @@ -1701,6 +1700,7 @@ static int __devinit bcm_enet_probe(stru
return -ENOMEM;
priv = netdev_priv(dev); priv = netdev_priv(dev);
+ priv->dma_maxburst = bcm_enet_is_sw(priv) ? priv->enet_is_sw = false;
+ BCMENETSW_DMA_MAXBURST : BCMENET_DMA_MAXBURST; + priv->dma_maxburst = BCMENET_DMA_MAXBURST;
ret = compute_hw_mtu(priv, dev->mtu); ret = compute_hw_mtu(priv, dev->mtu);
if (ret) if (ret)
goto out; @@ -2282,9 +2282,9 @@ static int bcm_enetsw_open(struct net_de
@@ -2263,9 +2264,9 @@ static int bcm_enetsw_open(struct net_de
enet_dmas_writel(priv, 0, ENETDMAS_SRAM4_REG(priv->tx_chan)); enet_dmas_writel(priv, 0, ENETDMAS_SRAM4_REG(priv->tx_chan));
/* set dma maximum burst len */ /* set dma maximum burst len */
@ -64,7 +63,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
ENETDMAC_MAXBURST_REG(priv->tx_chan)); ENETDMAC_MAXBURST_REG(priv->tx_chan));
/* set flow control low/high threshold to 1/3 / 2/3 */ /* set flow control low/high threshold to 1/3 / 2/3 */
@@ -2727,6 +2728,7 @@ static int __devinit bcm_enetsw_probe(st @@ -2749,6 +2749,7 @@ static int __devinit bcm_enetsw_probe(st
priv->irq_tx = irq_tx; priv->irq_tx = irq_tx;
priv->rx_ring_size = BCMENET_DEF_RX_DESC; priv->rx_ring_size = BCMENET_DEF_RX_DESC;
priv->tx_ring_size = BCMENET_DEF_TX_DESC; priv->tx_ring_size = BCMENET_DEF_TX_DESC;

View File

@ -1,14 +1,14 @@
From 44e21f4c7c556573fff0432f7846086763df3455 Mon Sep 17 00:00:00 2001 From f1c1bfa89cdac76a215d0e21161da9f8f8373437 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jonas.gorski@gmail.com> From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Tue, 14 Jun 2011 21:14:39 +0200 Date: Tue, 14 Jun 2011 21:14:39 +0200
Subject: [PATCH 44/79] MIPS: BCM63XX: add support for BCM6328 in bcm_enetsw Subject: [PATCH 40/84] MIPS: BCM63XX: add support for BCM6328 in bcm_enetsw
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
--- ---
arch/mips/bcm63xx/clk.c | 34 +++++++++++++++++++------- arch/mips/bcm63xx/clk.c | 34 ++++++++++++++-----
arch/mips/bcm63xx/dev-enet.c | 4 +-- arch/mips/bcm63xx/dev-enet.c | 9 +++--
drivers/net/ethernet/broadcom/bcm63xx_enet.h | 2 +- .../include/asm/mach-bcm63xx/bcm63xx_dev_enet.h | 1 +
3 files changed, 28 insertions(+), 12 deletions(-) 3 files changed, 32 insertions(+), 12 deletions(-)
--- a/arch/mips/bcm63xx/clk.c --- a/arch/mips/bcm63xx/clk.c
+++ b/arch/mips/bcm63xx/clk.c +++ b/arch/mips/bcm63xx/clk.c
@ -79,14 +79,25 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
return -ENODEV; return -ENODEV;
ret = register_shared(); ret = register_shared();
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h @@ -241,7 +241,10 @@ bcm63xx_enetsw_register(const struct bcm
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h
@@ -368,7 +368,7 @@ struct bcm_enet_priv {
static inline int bcm_enet_is_sw(struct bcm_enet_priv *priv) memcpy(bcm63xx_enetsw_device.dev.platform_data, pd, sizeof (*pd));
{
- if (BCMCPU_IS_6368()) - enetsw_pd.num_ports = ENETSW_PORTS_6368;
+ if (BCMCPU_IS_6328() || BCMCPU_IS_6368()) + if (BCMCPU_IS_6328())
return 1; + enetsw_pd.num_ports = ENETSW_PORTS_6328;
else + else if (BCMCPU_IS_6368())
return 0; + enetsw_pd.num_ports = ENETSW_PORTS_6368;
ret = platform_device_register(&bcm63xx_enetsw_device);
if (ret)
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
@@ -43,6 +43,7 @@ struct bcm63xx_enet_platform_data {
* on board ethernet switch platform data
*/
#define ENETSW_MAX_PORT 6
+#define ENETSW_PORTS_6328 5 /* 4 FE PHY + 1 RGMII */
#define ENETSW_PORTS_6368 6 /* 4 FE PHY + 2 RGMII */
#define ENETSW_RGMII_PORT0 4

View File

@ -92,7 +92,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
#define STRAPBUS_6368_BOOT_SEL_MASK 0x3 #define STRAPBUS_6368_BOOT_SEL_MASK 0x3
#define STRAPBUS_6368_BOOT_SEL_NAND 0 #define STRAPBUS_6368_BOOT_SEL_NAND 0
#define STRAPBUS_6368_BOOT_SEL_SERIAL 1 #define STRAPBUS_6368_BOOT_SEL_SERIAL 1
@@ -1227,6 +1228,7 @@ @@ -1240,6 +1241,7 @@
#define SERDES_PCIE_EXD_EN (1 << 15) #define SERDES_PCIE_EXD_EN (1 << 15)
#define MISC_STRAPBUS_6328_REG 0x240 #define MISC_STRAPBUS_6328_REG 0x240

View File

@ -10,7 +10,7 @@ Subject: [PATCH 32/63] bcm63xx: add support for 96368MVWG board.
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -2015,6 +2015,80 @@ static struct board_info __initdata boar @@ -2015,6 +2015,78 @@ static struct board_info __initdata boar
#endif #endif
/* /*
@ -42,14 +42,12 @@ Subject: [PATCH 32/63] bcm63xx: add support for 96368MVWG board.
+ [4] = { + [4] = {
+ .used = 1, + .used = 1,
+ .phy_id = 0x12, + .phy_id = 0x12,
+ .external_phy = 1,
+ .name = "port0", + .name = "port0",
+ }, + },
+ +
+ [5] = { + [5] = {
+ .used = 1, + .used = 1,
+ .phy_id = 0x11, + .phy_id = 0x11,
+ .external_phy = 1,
+ .name = "port3", + .name = "port3",
+ }, + },
+ }, + },
@ -91,7 +89,7 @@ Subject: [PATCH 32/63] bcm63xx: add support for 96368MVWG board.
* all boards * all boards
*/ */
static const struct board_info __initdata *bcm963xx_boards[] = { static const struct board_info __initdata *bcm963xx_boards[] = {
@@ -2063,6 +2137,10 @@ static const struct board_info __initdat @@ -2063,6 +2135,10 @@ static const struct board_info __initdat
&board_HW553, &board_HW553,
&board_spw303v, &board_spw303v,
#endif #endif
@ -102,7 +100,7 @@ Subject: [PATCH 32/63] bcm63xx: add support for 96368MVWG board.
}; };
static void __init nb4_nvram_fixup(void) static void __init nb4_nvram_fixup(void)
@@ -2244,12 +2322,25 @@ void __init board_prom_init(void) @@ -2244,12 +2320,25 @@ void __init board_prom_init(void)
bcm63xx_pci_enabled = 1; bcm63xx_pci_enabled = 1;
if (BCMCPU_IS_6348()) if (BCMCPU_IS_6348())
val |= GPIO_MODE_6348_G2_PCI; val |= GPIO_MODE_6348_G2_PCI;

View File

@ -9,7 +9,7 @@ Subject: [PATCH 33/63] bcm63xx: add support for 96368MVNgr board.
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -2086,6 +2086,72 @@ static struct board_info __initdata boar @@ -2084,6 +2084,72 @@ static struct board_info __initdata boar
.has_ohci0 = 1, .has_ohci0 = 1,
.has_ehci0 = 1, .has_ehci0 = 1,
}; };
@ -82,7 +82,7 @@ Subject: [PATCH 33/63] bcm63xx: add support for 96368MVNgr board.
#endif #endif
/* /*
@@ -2140,6 +2206,7 @@ static const struct board_info __initdat @@ -2138,6 +2204,7 @@ static const struct board_info __initdat
#ifdef CONFIG_BCM63XX_CPU_6368 #ifdef CONFIG_BCM63XX_CPU_6368
&board_96368mvwg, &board_96368mvwg,

View File

@ -90,7 +90,7 @@ Subject: [PATCH] MIPS: BCM63XX: add 96328avng reference board
* known 6338 boards * known 6338 boards
*/ */
#ifdef CONFIG_BCM63XX_CPU_6338 #ifdef CONFIG_BCM63XX_CPU_6338
@@ -2158,6 +2232,9 @@ static struct board_info __initdata boar @@ -2156,6 +2230,9 @@ static struct board_info __initdata boar
* all boards * all boards
*/ */
static const struct board_info __initdata *bcm963xx_boards[] = { static const struct board_info __initdata *bcm963xx_boards[] = {

View File

@ -86,7 +86,7 @@ Subject: [PATCH] MIPS: BCM63XX: add 963281TAN reference board
#endif #endif
/* /*
@@ -2234,6 +2304,7 @@ static struct board_info __initdata boar @@ -2232,6 +2302,7 @@ static struct board_info __initdata boar
static const struct board_info __initdata *bcm963xx_boards[] = { static const struct board_info __initdata *bcm963xx_boards[] = {
#ifdef CONFIG_BCM63XX_CPU_6328 #ifdef CONFIG_BCM63XX_CPU_6328
&board_96328avng, &board_96328avng,

View File

@ -120,7 +120,7 @@ Subject: [PATCH 70/79] MIPS: BCM63XX: Add board definition for D-Link
#endif #endif
/* /*
@@ -2305,6 +2408,7 @@ static const struct board_info __initdat @@ -2303,6 +2406,7 @@ static const struct board_info __initdat
#ifdef CONFIG_BCM63XX_CPU_6328 #ifdef CONFIG_BCM63XX_CPU_6328
&board_96328avng, &board_96328avng,
&board_963281TAN, &board_963281TAN,

View File

@ -58,7 +58,7 @@
#endif #endif
/* /*
@@ -2438,6 +2489,7 @@ static const struct board_info __initdat @@ -2436,6 +2487,7 @@ static const struct board_info __initdat
&board_ct536_ct5621, &board_ct536_ct5621,
&board_96348A_122, &board_96348A_122,
&board_CPVA502plus, &board_CPVA502plus,

View File

@ -126,7 +126,7 @@
static struct board_info __initdata board_HW553 = { static struct board_info __initdata board_HW553 = {
.name = "HW553", .name = "HW553",
.expected_cpu_id = 0x6358, .expected_cpu_id = 0x6358,
@@ -2504,6 +2616,7 @@ static const struct board_info __initdat @@ -2502,6 +2614,7 @@ static const struct board_info __initdat
&board_nb4_ser_r2, &board_nb4_ser_r2,
&board_nb4_fxc_r1, &board_nb4_fxc_r1,
&board_nb4_fxc_r2, &board_nb4_fxc_r2,

View File

@ -72,7 +72,7 @@
#endif #endif
/* /*
@@ -2619,6 +2684,7 @@ static const struct board_info __initdat @@ -2617,6 +2682,7 @@ static const struct board_info __initdat
&board_ct6373_1, &board_ct6373_1,
&board_HW553, &board_HW553,
&board_spw303v, &board_spw303v,

View File

@ -8,7 +8,7 @@
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/spi_gpio.h> #include <linux/spi/spi_gpio.h>
#include <linux/spi/74x164.h> #include <linux/spi/74x164.h>
@@ -2831,7 +2832,7 @@ static void __init nb4_nvram_fixup(void) @@ -2829,7 +2830,7 @@ static void __init nb4_nvram_fixup(void)
* bcm4318 WLAN work * bcm4318 WLAN work
*/ */
#ifdef CONFIG_SSB_PCIHOST #ifdef CONFIG_SSB_PCIHOST
@ -17,7 +17,7 @@
.revision = 0x02, .revision = 0x02,
.board_rev = 0x17, .board_rev = 0x17,
.country_code = 0x0, .country_code = 0x0,
@@ -2851,6 +2852,7 @@ static struct ssb_sprom bcm63xx_sprom = @@ -2849,6 +2850,7 @@ static struct ssb_sprom bcm63xx_sprom =
.boardflags_lo = 0x2848, .boardflags_lo = 0x2848,
.boardflags_hi = 0x0000, .boardflags_hi = 0x0000,
}; };