bcm63xx: update patches with upstream submissions
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36407 3c298f89-4303-0410-b956-a3cf2f4a3e73master
parent
c818e05fef
commit
50884b75be
|
@ -0,0 +1,25 @@
|
|||
From 2a26efda4d16f7d25f1c55e5c387fa3d7d18e9af Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Cernekee <cernekee@gmail.com>
|
||||
Date: Sat, 14 Jul 2012 23:25:03 -0700
|
||||
Subject: [PATCH 01/12] spi/bcm63xx: Remove unused variable
|
||||
|
||||
This fixes the following warning:
|
||||
|
||||
drivers/spi/spi-bcm63xx.c: In function 'bcm63xx_spi_setup':
|
||||
drivers/spi/spi-bcm63xx.c:157:6: warning: unused variable 'ret'
|
||||
|
||||
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
|
||||
---
|
||||
drivers/spi/spi-bcm63xx.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
--- a/drivers/spi/spi-bcm63xx.c
|
||||
+++ b/drivers/spi/spi-bcm63xx.c
|
||||
@@ -152,7 +152,6 @@ static void bcm63xx_spi_setup_transfer(s
|
||||
static int bcm63xx_spi_setup(struct spi_device *spi)
|
||||
{
|
||||
struct bcm63xx_spi *bs;
|
||||
- int ret;
|
||||
|
||||
bs = spi_master_get_devdata(spi->master);
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
From f32b46ec9c307753e2418a0f5df1b5cd066b1394 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Mon, 11 Mar 2013 13:27:43 +0100
|
||||
Subject: [PATCH 02/12] spi/bcm63xx: don't disable non enabled clocks in probe
|
||||
error path
|
||||
|
||||
When msg_ctl_width is set to an invalid value we try to disable the
|
||||
clock despite it never being enabled. Fix it by jumping to the correct
|
||||
label.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/spi/spi-bcm63xx.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/spi/spi-bcm63xx.c
|
||||
+++ b/drivers/spi/spi-bcm63xx.c
|
||||
@@ -489,7 +489,7 @@ static int bcm63xx_spi_probe(struct plat
|
||||
default:
|
||||
dev_err(dev, "unsupported MSG_CTL width: %d\n",
|
||||
bs->msg_ctl_width);
|
||||
- goto out_clk_disable;
|
||||
+ goto out_err;
|
||||
}
|
||||
|
||||
/* Initialize hardware */
|
|
@ -0,0 +1,61 @@
|
|||
From e504d3ed9b35f43e61cf239b103667d87cd7bf3c Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Mon, 10 Sep 2012 01:26:55 +0200
|
||||
Subject: [PATCH 03/12] spi/bcm63xx: properly prepare clocks before enabling
|
||||
them
|
||||
|
||||
Use proper clk_prepare/unprepare calls in preparation for switching
|
||||
to the generic clock framework.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/spi/spi-bcm63xx.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/spi/spi-bcm63xx.c
|
||||
+++ b/drivers/spi/spi-bcm63xx.c
|
||||
@@ -493,7 +493,7 @@ static int bcm63xx_spi_probe(struct plat
|
||||
}
|
||||
|
||||
/* Initialize hardware */
|
||||
- clk_enable(bs->clk);
|
||||
+ clk_prepare_enable(bs->clk);
|
||||
bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS);
|
||||
|
||||
/* register and we are done */
|
||||
@@ -509,7 +509,7 @@ static int bcm63xx_spi_probe(struct plat
|
||||
return 0;
|
||||
|
||||
out_clk_disable:
|
||||
- clk_disable(clk);
|
||||
+ clk_disable_unprepare(clk);
|
||||
out_err:
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
spi_master_put(master);
|
||||
@@ -530,7 +530,7 @@ static int bcm63xx_spi_remove(struct pla
|
||||
bcm_spi_writeb(bs, 0, SPI_INT_MASK);
|
||||
|
||||
/* HW shutdown */
|
||||
- clk_disable(bs->clk);
|
||||
+ clk_disable_unprepare(bs->clk);
|
||||
clk_put(bs->clk);
|
||||
|
||||
platform_set_drvdata(pdev, 0);
|
||||
@@ -549,7 +549,7 @@ static int bcm63xx_spi_suspend(struct de
|
||||
|
||||
spi_master_suspend(master);
|
||||
|
||||
- clk_disable(bs->clk);
|
||||
+ clk_disable_unprepare(bs->clk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -560,7 +560,7 @@ static int bcm63xx_spi_resume(struct dev
|
||||
platform_get_drvdata(to_platform_device(dev));
|
||||
struct bcm63xx_spi *bs = spi_master_get_devdata(master);
|
||||
|
||||
- clk_enable(bs->clk);
|
||||
+ clk_prepare_enable(bs->clk);
|
||||
|
||||
spi_master_resume(master);
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
From 3abf34d4e0460bb098fabe3cc8207108bae1905a Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Mon, 11 Mar 2013 13:40:26 +0100
|
||||
Subject: [PATCH 04/12] spi/bcm63xx: remove duplicated mode bits check
|
||||
|
||||
The spi subsystem already checks the mode bits before calling setup.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/spi/spi-bcm63xx.c | 6 ------
|
||||
1 file changed, 6 deletions(-)
|
||||
|
||||
--- a/drivers/spi/spi-bcm63xx.c
|
||||
+++ b/drivers/spi/spi-bcm63xx.c
|
||||
@@ -158,12 +158,6 @@ static int bcm63xx_spi_setup(struct spi_
|
||||
if (!spi->bits_per_word)
|
||||
spi->bits_per_word = 8;
|
||||
|
||||
- if (spi->mode & ~MODEBITS) {
|
||||
- dev_err(&spi->dev, "%s, unsupported mode bits %x\n",
|
||||
- __func__, spi->mode & ~MODEBITS);
|
||||
- return -EINVAL;
|
||||
- }
|
||||
-
|
||||
dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec/bit\n",
|
||||
__func__, spi->mode & MODEBITS, spi->bits_per_word, 0);
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
From ee18b0ac561afb9dd7d87a4217e80151a7e29dfc Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Mon, 11 Mar 2013 13:42:22 +0100
|
||||
Subject: [PATCH 05/12] spi/bcm63xx: remove unneeded debug message
|
||||
|
||||
The spi subsystem already provides this info in a more extensive
|
||||
debug print except for the nsecs/bit - which wasn't calculated anyway
|
||||
and fixed to 0.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/spi/spi-bcm63xx.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
--- a/drivers/spi/spi-bcm63xx.c
|
||||
+++ b/drivers/spi/spi-bcm63xx.c
|
||||
@@ -158,9 +158,6 @@ static int bcm63xx_spi_setup(struct spi_
|
||||
if (!spi->bits_per_word)
|
||||
spi->bits_per_word = 8;
|
||||
|
||||
- dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec/bit\n",
|
||||
- __func__, spi->mode & MODEBITS, spi->bits_per_word, 0);
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
From 30151fe21befa84d9cd27d63f1bf3973988c811e Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Mon, 11 Mar 2013 13:47:19 +0100
|
||||
Subject: [PATCH 06/12] spi/bcm63xx: remove unused variable bs from
|
||||
bcm63xx_spi_setup
|
||||
|
||||
It is only written, but never read.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/spi/spi-bcm63xx.c | 4 ----
|
||||
1 file changed, 4 deletions(-)
|
||||
|
||||
--- a/drivers/spi/spi-bcm63xx.c
|
||||
+++ b/drivers/spi/spi-bcm63xx.c
|
||||
@@ -151,10 +151,6 @@ static void bcm63xx_spi_setup_transfer(s
|
||||
|
||||
static int bcm63xx_spi_setup(struct spi_device *spi)
|
||||
{
|
||||
- struct bcm63xx_spi *bs;
|
||||
-
|
||||
- bs = spi_master_get_devdata(spi->master);
|
||||
-
|
||||
if (!spi->bits_per_word)
|
||||
spi->bits_per_word = 8;
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
From 13a364be644ed9b4666d452756556bb98afdcc56 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Mon, 11 Mar 2013 13:48:27 +0100
|
||||
Subject: [PATCH 07/12] spi/bcm63xx: check spi bits_per_word in spi_setup
|
||||
|
||||
Instead of fixing up the bits_per_word (which the spi subsystem already
|
||||
does for us), check it for supported values.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/spi/spi-bcm63xx.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/spi/spi-bcm63xx.c
|
||||
+++ b/drivers/spi/spi-bcm63xx.c
|
||||
@@ -151,8 +151,11 @@ static void bcm63xx_spi_setup_transfer(s
|
||||
|
||||
static int bcm63xx_spi_setup(struct spi_device *spi)
|
||||
{
|
||||
- if (!spi->bits_per_word)
|
||||
- spi->bits_per_word = 8;
|
||||
+ if (spi->bits_per_word != 8) {
|
||||
+ dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
|
||||
+ __func__, spi->bits_per_word);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
From d69ac73da38f0d16cc6b4524cd734b907db6eab8 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Mon, 11 Mar 2013 13:51:10 +0100
|
||||
Subject: [PATCH 08/12] spi/bcm63xx: simplify bcm63xx_spi_check_transfer
|
||||
|
||||
bcm63xx_spi_check_transfer is only called from one place that has
|
||||
t always set, so directly check the transfer's bits_per_word.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/spi/spi-bcm63xx.c | 7 ++-----
|
||||
1 file changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/spi/spi-bcm63xx.c
|
||||
+++ b/drivers/spi/spi-bcm63xx.c
|
||||
@@ -96,12 +96,9 @@ static const unsigned bcm63xx_spi_freq_t
|
||||
static int bcm63xx_spi_check_transfer(struct spi_device *spi,
|
||||
struct spi_transfer *t)
|
||||
{
|
||||
- u8 bits_per_word;
|
||||
-
|
||||
- bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word;
|
||||
- if (bits_per_word != 8) {
|
||||
+ if (t->bits_per_word != 8) {
|
||||
dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
|
||||
- __func__, bits_per_word);
|
||||
+ __func__, t->bits_per_word);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
From 9c5a988562468823a5e2973f04134a8bd97e7718 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Mon, 11 Mar 2013 13:53:16 +0100
|
||||
Subject: [PATCH 09/12] spi/bcm63xx: remove spi chip select validity check
|
||||
|
||||
The check would belong in bcm63xx_spi_setup if the spi subsystem
|
||||
weren't already doing the check for us, so just drop it.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/spi/spi-bcm63xx.c | 6 ------
|
||||
1 file changed, 6 deletions(-)
|
||||
|
||||
--- a/drivers/spi/spi-bcm63xx.c
|
||||
+++ b/drivers/spi/spi-bcm63xx.c
|
||||
@@ -102,12 +102,6 @@ static int bcm63xx_spi_check_transfer(st
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
- if (spi->chip_select > spi->master->num_chipselect) {
|
||||
- dev_err(&spi->dev, "%s, unsupported slave %d\n",
|
||||
- __func__, spi->chip_select);
|
||||
- return -EINVAL;
|
||||
- }
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
From 3fffc5f76c830c375692a67948734168ee4c516a Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Mon, 11 Mar 2013 13:59:30 +0100
|
||||
Subject: [PATCH 10/12] spi/bcm63xx: inline bcm63xx_spi_check_transfer
|
||||
|
||||
It only does one check, so just do the check directly in the caller.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/spi/spi-bcm63xx.c | 19 +++++--------------
|
||||
1 file changed, 5 insertions(+), 14 deletions(-)
|
||||
|
||||
--- a/drivers/spi/spi-bcm63xx.c
|
||||
+++ b/drivers/spi/spi-bcm63xx.c
|
||||
@@ -93,18 +93,6 @@ static const unsigned bcm63xx_spi_freq_t
|
||||
{ 391000, SPI_CLK_0_391MHZ }
|
||||
};
|
||||
|
||||
-static int bcm63xx_spi_check_transfer(struct spi_device *spi,
|
||||
- struct spi_transfer *t)
|
||||
-{
|
||||
- if (t->bits_per_word != 8) {
|
||||
- dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
|
||||
- __func__, t->bits_per_word);
|
||||
- return -EINVAL;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static void bcm63xx_spi_setup_transfer(struct spi_device *spi,
|
||||
struct spi_transfer *t)
|
||||
{
|
||||
@@ -293,9 +281,12 @@ static int bcm63xx_spi_transfer_one(stru
|
||||
* full-duplex transfers.
|
||||
*/
|
||||
list_for_each_entry(t, &m->transfers, transfer_list) {
|
||||
- status = bcm63xx_spi_check_transfer(spi, t);
|
||||
- if (status < 0)
|
||||
+ if (t->bits_per_word != 8) {
|
||||
+ dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
|
||||
+ __func__, t->bits_per_word);
|
||||
+ status = -EINVAL;
|
||||
goto exit;
|
||||
+ }
|
||||
|
||||
if (!first)
|
||||
first = t;
|
|
@ -0,0 +1,43 @@
|
|||
From 2646be877afc663d1688a2add8386b027c9d7e31 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Mon, 11 Mar 2013 14:08:06 +0100
|
||||
Subject: [PATCH 11/12] spi/bcm63xx: inline hz usage in
|
||||
bcm63xx_spi_setup_transfer
|
||||
|
||||
bcm63xx_spi_setup_transfer is called from only one place, and that has
|
||||
t always set, to hz will always be t->speed_hz - just use it directly in
|
||||
the two places instead of moving it in a local variable.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/spi/spi-bcm63xx.c | 7 ++-----
|
||||
1 file changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/spi/spi-bcm63xx.c
|
||||
+++ b/drivers/spi/spi-bcm63xx.c
|
||||
@@ -97,15 +97,12 @@ static void bcm63xx_spi_setup_transfer(s
|
||||
struct spi_transfer *t)
|
||||
{
|
||||
struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master);
|
||||
- u32 hz;
|
||||
u8 clk_cfg, reg;
|
||||
int i;
|
||||
|
||||
- hz = (t) ? t->speed_hz : spi->max_speed_hz;
|
||||
-
|
||||
/* Find the closest clock configuration */
|
||||
for (i = 0; i < SPI_CLK_MASK; i++) {
|
||||
- if (hz >= bcm63xx_spi_freq_table[i][0]) {
|
||||
+ if (t->speed_hz >= bcm63xx_spi_freq_table[i][0]) {
|
||||
clk_cfg = bcm63xx_spi_freq_table[i][1];
|
||||
break;
|
||||
}
|
||||
@@ -122,7 +119,7 @@ static void bcm63xx_spi_setup_transfer(s
|
||||
|
||||
bcm_spi_writeb(bs, reg, SPI_CLK_CFG);
|
||||
dev_dbg(&spi->dev, "Setting clock register to %02x (hz %d)\n",
|
||||
- clk_cfg, hz);
|
||||
+ clk_cfg, t->speed_hz);
|
||||
}
|
||||
|
||||
/* the spi->mode bits understood by this driver: */
|
|
@ -0,0 +1,36 @@
|
|||
From 95af2d7751d31ea07b7a0d8ec7030f6c62df0ae2 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Mon, 11 Mar 2013 14:20:33 +0100
|
||||
Subject: [PATCH 12/12] spi/bcm63xx: use devm_ioremap_resource()
|
||||
|
||||
Use devm_ioremap_resource() which provides its own error messages.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/spi/spi-bcm63xx.c | 15 +++------------
|
||||
1 file changed, 3 insertions(+), 12 deletions(-)
|
||||
|
||||
--- a/drivers/spi/spi-bcm63xx.c
|
||||
+++ b/drivers/spi/spi-bcm63xx.c
|
||||
@@ -412,18 +412,9 @@ static int bcm63xx_spi_probe(struct plat
|
||||
platform_set_drvdata(pdev, master);
|
||||
bs->pdev = pdev;
|
||||
|
||||
- if (!devm_request_mem_region(&pdev->dev, r->start,
|
||||
- resource_size(r), PFX)) {
|
||||
- dev_err(dev, "iomem request failed\n");
|
||||
- ret = -ENXIO;
|
||||
- goto out_err;
|
||||
- }
|
||||
-
|
||||
- bs->regs = devm_ioremap_nocache(&pdev->dev, r->start,
|
||||
- resource_size(r));
|
||||
- if (!bs->regs) {
|
||||
- dev_err(dev, "unable to ioremap regs\n");
|
||||
- ret = -ENOMEM;
|
||||
+ bs->regs = devm_ioremap_resource(&pdev->dev, r);
|
||||
+ if (IS_ERR(bs->regs)) {
|
||||
+ ret = PTR_ERR(bs->regs);
|
||||
goto out_err;
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
From 5ff6b05a18295fa7e03de0fdf32d681a90b69df5 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Sat, 30 Mar 2013 10:26:55 +0100
|
||||
Subject: [PATCH] spi/bcm63xx: remove unused speed_hz member variable
|
||||
|
||||
speed_hz is a write only member, so we can safely remove it and its
|
||||
generation. Also fixes the missing clk_put after getting the periph
|
||||
clock.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/bcm63xx/dev-spi.c | 11 -----------
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h | 1 -
|
||||
drivers/spi/spi-bcm63xx.c | 2 --
|
||||
3 files changed, 14 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/dev-spi.c
|
||||
+++ b/arch/mips/bcm63xx/dev-spi.c
|
||||
@@ -85,20 +85,9 @@ static struct platform_device bcm63xx_sp
|
||||
|
||||
int __init bcm63xx_spi_register(void)
|
||||
{
|
||||
- struct clk *periph_clk;
|
||||
-
|
||||
if (BCMCPU_IS_6328() || BCMCPU_IS_6345())
|
||||
return -ENODEV;
|
||||
|
||||
- periph_clk = clk_get(NULL, "periph");
|
||||
- if (IS_ERR(periph_clk)) {
|
||||
- pr_err("unable to get periph clock\n");
|
||||
- return -ENODEV;
|
||||
- }
|
||||
-
|
||||
- /* Set bus frequency */
|
||||
- spi_pdata.speed_hz = clk_get_rate(periph_clk);
|
||||
-
|
||||
spi_resources[0].start = bcm63xx_regset_address(RSET_SPI);
|
||||
spi_resources[0].end = spi_resources[0].start;
|
||||
spi_resources[1].start = bcm63xx_get_irq_number(IRQ_SPI);
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
|
||||
@@ -13,7 +13,6 @@ struct bcm63xx_spi_pdata {
|
||||
unsigned int msg_ctl_width;
|
||||
int bus_num;
|
||||
int num_chipselect;
|
||||
- u32 speed_hz;
|
||||
};
|
||||
|
||||
enum bcm63xx_regs_spi {
|
||||
--- a/drivers/spi/spi-bcm63xx.c
|
||||
+++ b/drivers/spi/spi-bcm63xx.c
|
||||
@@ -46,7 +46,6 @@ struct bcm63xx_spi {
|
||||
int irq;
|
||||
|
||||
/* Platform data */
|
||||
- u32 speed_hz;
|
||||
unsigned fifo_size;
|
||||
unsigned int msg_type_shift;
|
||||
unsigned int msg_ctl_width;
|
||||
@@ -436,7 +435,6 @@ static int bcm63xx_spi_probe(struct plat
|
||||
master->unprepare_transfer_hardware = bcm63xx_spi_unprepare_transfer;
|
||||
master->transfer_one_message = bcm63xx_spi_transfer_one;
|
||||
master->mode_bits = MODEBITS;
|
||||
- bs->speed_hz = pdata->speed_hz;
|
||||
bs->msg_type_shift = pdata->msg_type_shift;
|
||||
bs->msg_ctl_width = pdata->msg_ctl_width;
|
||||
bs->tx_io = (u8 *)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA));
|
|
@ -1,14 +1,21 @@
|
|||
From 5e6669fe7487c58b123da1df5c2d95db43185264 Mon Sep 17 00:00:00 2001
|
||||
From 152addd3a965759b69fbdb9a76526f1f5070bc9a Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Tue, 12 Feb 2013 22:00:10 +0100
|
||||
Subject: [PATCH] MIPS: BCM63XX: make nvram checksum failure non fatal
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Some vendors modify the nvram layout moving the checksum to a different
|
||||
place or drop it entirely, so reduce the checksum failure to a warning.
|
||||
place or dropping entirely, so reduce the checksum failure to a warning.
|
||||
|
||||
Reported-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
|
||||
I'm not sure if it should be that "loud" (pr_warn) because users can't
|
||||
actually do anything to fix it, so maybe pr_debug would be fine, too.
|
||||
|
||||
arch/mips/bcm63xx/boards/board_bcm963xx.c | 5 +----
|
||||
arch/mips/bcm63xx/nvram.c | 7 +++----
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h | 4 +---
|
||||
|
@ -16,7 +23,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
|||
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -747,10 +747,7 @@ void __init board_prom_init(void)
|
||||
@@ -745,10 +745,7 @@ void __init board_prom_init(void)
|
||||
strcpy(cfe_version, "unknown");
|
||||
printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
|
||||
|
||||
|
@ -46,7 +53,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
|||
- return -EINVAL;
|
||||
-
|
||||
- return 0;
|
||||
+ pr_warn("nvram checksum invalid (expected %08x, actual %08x)\n",
|
||||
+ pr_warn("nvram checksum failed, contents may be invalid (expected %08x, got %08x)\n",
|
||||
+ expected_crc, crc);
|
||||
}
|
||||
|
|
@ -1,17 +1,24 @@
|
|||
From a7d2622b6614fdca504c074a0cd307d5a1165c30 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
From 76d82677cb010b28346aa4c7aa9d36d94916392b Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Tue, 8 May 2012 09:39:01 +0200
|
||||
Subject: [PATCH 04/59] Revert "MIPS: BCM63XX: Call board_register_device from device_initcall()"
|
||||
Subject: [PATCH] Revert "MIPS: BCM63XX: Call board_register_device from
|
||||
device_initcall()"
|
||||
|
||||
This commit causes a race between PCI scan and SSB fallback SPROM handler
|
||||
registration, causing the wifi to not work on slower systems. The only
|
||||
subsystem touched from board_register_device is platform device
|
||||
registration, which should be safe as an arch init call.
|
||||
subsystem touched from board_register_devices is platform device
|
||||
registration, which is safe as an arch init call.
|
||||
|
||||
This reverts commit d64ed7ada2f689d2c62af1892ca55e47d3653e36.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
|
||||
This patch is in OpenWrt since ages, and we never encountered any issues
|
||||
from this revert.
|
||||
|
||||
arch/mips/bcm63xx/setup.c | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/setup.c
|
||||
+++ b/arch/mips/bcm63xx/setup.c
|
|
@ -0,0 +1,57 @@
|
|||
From 715d03e5409fac9cbe76fd802db49ca15158378f Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Sat, 30 Mar 2013 20:31:48 +0100
|
||||
Subject: [PATCH] MIPS: BCM63XX: merge bcm63xx_clk.h into bcm63xx/clk.c
|
||||
|
||||
All the header file does is provide the internal structure of clk,
|
||||
which shouldn't be used by anyone except clk.c itself anyway.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/bcm63xx/clk.c | 8 +++++++-
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_clk.h | 11 -----------
|
||||
drivers/tty/serial/bcm63xx_uart.c | 1 -
|
||||
3 files changed, 7 insertions(+), 13 deletions(-)
|
||||
delete mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_clk.h
|
||||
|
||||
--- a/arch/mips/bcm63xx/clk.c
|
||||
+++ b/arch/mips/bcm63xx/clk.c
|
||||
@@ -15,7 +15,13 @@
|
||||
#include <bcm63xx_io.h>
|
||||
#include <bcm63xx_regs.h>
|
||||
#include <bcm63xx_reset.h>
|
||||
-#include <bcm63xx_clk.h>
|
||||
+
|
||||
+struct clk {
|
||||
+ void (*set)(struct clk *, int);
|
||||
+ unsigned int rate;
|
||||
+ unsigned int usage;
|
||||
+ int id;
|
||||
+};
|
||||
|
||||
static DEFINE_MUTEX(clocks_mutex);
|
||||
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_clk.h
|
||||
+++ /dev/null
|
||||
@@ -1,11 +0,0 @@
|
||||
-#ifndef BCM63XX_CLK_H_
|
||||
-#define BCM63XX_CLK_H_
|
||||
-
|
||||
-struct clk {
|
||||
- void (*set)(struct clk *, int);
|
||||
- unsigned int rate;
|
||||
- unsigned int usage;
|
||||
- int id;
|
||||
-};
|
||||
-
|
||||
-#endif /* ! BCM63XX_CLK_H_ */
|
||||
--- a/drivers/tty/serial/bcm63xx_uart.c
|
||||
+++ b/drivers/tty/serial/bcm63xx_uart.c
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <linux/serial.h>
|
||||
#include <linux/serial_core.h>
|
||||
|
||||
-#include <bcm63xx_clk.h>
|
||||
#include <bcm63xx_irq.h>
|
||||
#include <bcm63xx_regs.h>
|
||||
#include <bcm63xx_io.h>
|
|
@ -0,0 +1,118 @@
|
|||
From 80b0356aea30e9fc9e075d31c2bf37e7cbfea8c9 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Sun, 10 Mar 2013 13:59:55 +0100
|
||||
Subject: [PATCH 1/3] bcm63xx_enet: use managed io memory allocations
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 43 +++++---------------------
|
||||
1 file changed, 7 insertions(+), 36 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
@@ -1620,7 +1620,6 @@ static int bcm_enet_probe(struct platfor
|
||||
struct resource *res_mem, *res_irq, *res_irq_rx, *res_irq_tx;
|
||||
struct mii_bus *bus;
|
||||
const char *clk_name;
|
||||
- unsigned int iomem_size;
|
||||
int i, ret;
|
||||
|
||||
/* stop if shared driver failed, assume driver->probe will be
|
||||
@@ -1645,17 +1644,12 @@ static int bcm_enet_probe(struct platfor
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
- iomem_size = resource_size(res_mem);
|
||||
- if (!request_mem_region(res_mem->start, iomem_size, "bcm63xx_enet")) {
|
||||
- ret = -EBUSY;
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- priv->base = ioremap(res_mem->start, iomem_size);
|
||||
+ priv->base = devm_request_and_ioremap(&pdev->dev, res_mem);
|
||||
if (priv->base == NULL) {
|
||||
ret = -ENOMEM;
|
||||
- goto out_release_mem;
|
||||
+ goto out;
|
||||
}
|
||||
+
|
||||
dev->irq = priv->irq = res_irq->start;
|
||||
priv->irq_rx = res_irq_rx->start;
|
||||
priv->irq_tx = res_irq_tx->start;
|
||||
@@ -1675,7 +1669,7 @@ static int bcm_enet_probe(struct platfor
|
||||
priv->mac_clk = clk_get(&pdev->dev, clk_name);
|
||||
if (IS_ERR(priv->mac_clk)) {
|
||||
ret = PTR_ERR(priv->mac_clk);
|
||||
- goto out_unmap;
|
||||
+ goto out;
|
||||
}
|
||||
clk_enable(priv->mac_clk);
|
||||
|
||||
@@ -1815,12 +1809,6 @@ out_uninit_hw:
|
||||
out_put_clk_mac:
|
||||
clk_disable(priv->mac_clk);
|
||||
clk_put(priv->mac_clk);
|
||||
-
|
||||
-out_unmap:
|
||||
- iounmap(priv->base);
|
||||
-
|
||||
-out_release_mem:
|
||||
- release_mem_region(res_mem->start, iomem_size);
|
||||
out:
|
||||
free_netdev(dev);
|
||||
return ret;
|
||||
@@ -1834,7 +1822,6 @@ static int bcm_enet_remove(struct platfo
|
||||
{
|
||||
struct bcm_enet_priv *priv;
|
||||
struct net_device *dev;
|
||||
- struct resource *res;
|
||||
|
||||
/* stop netdevice */
|
||||
dev = platform_get_drvdata(pdev);
|
||||
@@ -1857,11 +1844,6 @@ static int bcm_enet_remove(struct platfo
|
||||
bcm_enet_mdio_write_mii);
|
||||
}
|
||||
|
||||
- /* release device resources */
|
||||
- iounmap(priv->base);
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- release_mem_region(res->start, resource_size(res));
|
||||
-
|
||||
/* disable hw block clocks */
|
||||
if (priv->phy_clk) {
|
||||
clk_disable(priv->phy_clk);
|
||||
@@ -1890,31 +1872,20 @@ struct platform_driver bcm63xx_enet_driv
|
||||
static int bcm_enet_shared_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct resource *res;
|
||||
- unsigned int iomem_size;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res)
|
||||
return -ENODEV;
|
||||
|
||||
- iomem_size = resource_size(res);
|
||||
- if (!request_mem_region(res->start, iomem_size, "bcm63xx_enet_dma"))
|
||||
- return -EBUSY;
|
||||
-
|
||||
- bcm_enet_shared_base = ioremap(res->start, iomem_size);
|
||||
- if (!bcm_enet_shared_base) {
|
||||
- release_mem_region(res->start, iomem_size);
|
||||
+ bcm_enet_shared_base = devm_request_and_ioremap(&pdev->dev, res);
|
||||
+ if (!bcm_enet_shared_base)
|
||||
return -ENOMEM;
|
||||
- }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bcm_enet_shared_remove(struct platform_device *pdev)
|
||||
{
|
||||
- struct resource *res;
|
||||
-
|
||||
- iounmap(bcm_enet_shared_base);
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- release_mem_region(res->start, resource_size(res));
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
From 451a609ca472f80838df056689359c5486d832c1 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Sun, 10 Mar 2013 14:05:01 +0100
|
||||
Subject: [PATCH 2/3] bcm63xx_enet: use managed memory allocations
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 8 +++-----
|
||||
1 file changed, 3 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
@@ -1728,7 +1728,8 @@ static int bcm_enet_probe(struct platfor
|
||||
* if a slave is not present on hw */
|
||||
bus->phy_mask = ~(1 << priv->phy_id);
|
||||
|
||||
- bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);
|
||||
+ bus->irq = devm_kzalloc(&pdev->dev, sizeof(int) * PHY_MAX_ADDR,
|
||||
+ GFP_KERNEL);
|
||||
if (!bus->irq) {
|
||||
ret = -ENOMEM;
|
||||
goto out_free_mdio;
|
||||
@@ -1789,10 +1790,8 @@ static int bcm_enet_probe(struct platfor
|
||||
return 0;
|
||||
|
||||
out_unregister_mdio:
|
||||
- if (priv->mii_bus) {
|
||||
+ if (priv->mii_bus)
|
||||
mdiobus_unregister(priv->mii_bus);
|
||||
- kfree(priv->mii_bus->irq);
|
||||
- }
|
||||
|
||||
out_free_mdio:
|
||||
if (priv->mii_bus)
|
||||
@@ -1833,7 +1832,6 @@ static int bcm_enet_remove(struct platfo
|
||||
|
||||
if (priv->has_phy) {
|
||||
mdiobus_unregister(priv->mii_bus);
|
||||
- kfree(priv->mii_bus->irq);
|
||||
mdiobus_free(priv->mii_bus);
|
||||
} else {
|
||||
struct bcm63xx_enet_platform_data *pd;
|
|
@ -0,0 +1,62 @@
|
|||
From 8d6b746129f11efe4ba69aeb2c982359d33c6ec3 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Mon, 10 Sep 2012 01:28:47 +0200
|
||||
Subject: [PATCH 3/3] bcm63xx_enet: properly prepare/unprepare clocks
|
||||
before/after usage
|
||||
|
||||
Use clk_prepare_enable/disable_unprepare calls in preparation for
|
||||
switching to the generic clock framework.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
@@ -1671,7 +1671,7 @@ static int bcm_enet_probe(struct platfor
|
||||
ret = PTR_ERR(priv->mac_clk);
|
||||
goto out;
|
||||
}
|
||||
- clk_enable(priv->mac_clk);
|
||||
+ clk_prepare_enable(priv->mac_clk);
|
||||
|
||||
/* initialize default and fetch platform data */
|
||||
priv->rx_ring_size = BCMENET_DEF_RX_DESC;
|
||||
@@ -1700,7 +1700,7 @@ static int bcm_enet_probe(struct platfor
|
||||
priv->phy_clk = NULL;
|
||||
goto out_put_clk_mac;
|
||||
}
|
||||
- clk_enable(priv->phy_clk);
|
||||
+ clk_prepare_enable(priv->phy_clk);
|
||||
}
|
||||
|
||||
/* do minimal hardware init to be able to probe mii bus */
|
||||
@@ -1801,12 +1801,12 @@ out_uninit_hw:
|
||||
/* turn off mdc clock */
|
||||
enet_writel(priv, 0, ENET_MIISC_REG);
|
||||
if (priv->phy_clk) {
|
||||
- clk_disable(priv->phy_clk);
|
||||
+ clk_disable_unprepare(priv->phy_clk);
|
||||
clk_put(priv->phy_clk);
|
||||
}
|
||||
|
||||
out_put_clk_mac:
|
||||
- clk_disable(priv->mac_clk);
|
||||
+ clk_disable_unprepare(priv->mac_clk);
|
||||
clk_put(priv->mac_clk);
|
||||
out:
|
||||
free_netdev(dev);
|
||||
@@ -1844,10 +1844,10 @@ static int bcm_enet_remove(struct platfo
|
||||
|
||||
/* disable hw block clocks */
|
||||
if (priv->phy_clk) {
|
||||
- clk_disable(priv->phy_clk);
|
||||
+ clk_disable_unprepare(priv->phy_clk);
|
||||
clk_put(priv->phy_clk);
|
||||
}
|
||||
- clk_disable(priv->mac_clk);
|
||||
+ clk_disable_unprepare(priv->mac_clk);
|
||||
clk_put(priv->mac_clk);
|
||||
|
||||
platform_set_drvdata(pdev, NULL);
|
|
@ -0,0 +1,166 @@
|
|||
From e1a3ace7260fad338a76595b116a6bf5b5627aa2 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Thu, 7 Mar 2013 12:20:10 +0100
|
||||
Subject: [PATCH 1/7] MIPS: BCM63XX: remove duplicate spi register definitions
|
||||
|
||||
BCM6338 and BCM6348, and BCM6358 and everything after that share the
|
||||
same register layout. To not have to redefine them for each new chip
|
||||
and keep the code size small, only use the definitions for the first
|
||||
chip with the certain layout.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/bcm63xx/dev-spi.c | 24 +++---------
|
||||
.../include/asm/mach-bcm63xx/bcm63xx_dev_spi.h | 10 +----
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 40 +-------------------
|
||||
3 files changed, 10 insertions(+), 64 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/dev-spi.c
|
||||
+++ b/arch/mips/bcm63xx/dev-spi.c
|
||||
@@ -22,10 +22,6 @@
|
||||
/*
|
||||
* register offsets
|
||||
*/
|
||||
-static const unsigned long bcm6338_regs_spi[] = {
|
||||
- __GEN_SPI_REGS_TABLE(6338)
|
||||
-};
|
||||
-
|
||||
static const unsigned long bcm6348_regs_spi[] = {
|
||||
__GEN_SPI_REGS_TABLE(6348)
|
||||
};
|
||||
@@ -34,23 +30,15 @@ static const unsigned long bcm6358_regs_
|
||||
__GEN_SPI_REGS_TABLE(6358)
|
||||
};
|
||||
|
||||
-static const unsigned long bcm6368_regs_spi[] = {
|
||||
- __GEN_SPI_REGS_TABLE(6368)
|
||||
-};
|
||||
-
|
||||
const unsigned long *bcm63xx_regs_spi;
|
||||
EXPORT_SYMBOL(bcm63xx_regs_spi);
|
||||
|
||||
static __init void bcm63xx_spi_regs_init(void)
|
||||
{
|
||||
- if (BCMCPU_IS_6338())
|
||||
- bcm63xx_regs_spi = bcm6338_regs_spi;
|
||||
- if (BCMCPU_IS_6348())
|
||||
+ if (BCMCPU_IS_6338() || BCMCPU_IS_6348())
|
||||
bcm63xx_regs_spi = bcm6348_regs_spi;
|
||||
- if (BCMCPU_IS_6358())
|
||||
+ if (BCMCPU_IS_6358() || BCMCPU_IS_6368())
|
||||
bcm63xx_regs_spi = bcm6358_regs_spi;
|
||||
- if (BCMCPU_IS_6368())
|
||||
- bcm63xx_regs_spi = bcm6368_regs_spi;
|
||||
}
|
||||
#else
|
||||
static __init void bcm63xx_spi_regs_init(void) { }
|
||||
@@ -93,10 +81,10 @@ int __init bcm63xx_spi_register(void)
|
||||
spi_resources[1].start = bcm63xx_get_irq_number(IRQ_SPI);
|
||||
|
||||
if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) {
|
||||
- spi_resources[0].end += BCM_6338_RSET_SPI_SIZE - 1;
|
||||
- spi_pdata.fifo_size = SPI_6338_MSG_DATA_SIZE;
|
||||
- spi_pdata.msg_type_shift = SPI_6338_MSG_TYPE_SHIFT;
|
||||
- spi_pdata.msg_ctl_width = SPI_6338_MSG_CTL_WIDTH;
|
||||
+ spi_resources[0].end += BCM_6348_RSET_SPI_SIZE - 1;
|
||||
+ spi_pdata.fifo_size = SPI_6348_MSG_DATA_SIZE;
|
||||
+ spi_pdata.msg_type_shift = SPI_6348_MSG_TYPE_SHIFT;
|
||||
+ spi_pdata.msg_ctl_width = SPI_6348_MSG_CTL_WIDTH;
|
||||
}
|
||||
|
||||
if (BCMCPU_IS_6358() || BCMCPU_IS_6368()) {
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
|
||||
@@ -71,18 +71,12 @@ static inline unsigned long bcm63xx_spir
|
||||
|
||||
return bcm63xx_regs_spi[reg];
|
||||
#else
|
||||
-#ifdef CONFIG_BCM63XX_CPU_6338
|
||||
- __GEN_SPI_RSET(6338)
|
||||
-#endif
|
||||
-#ifdef CONFIG_BCM63XX_CPU_6348
|
||||
+#if defined(CONFIG_BCM63XX_CPU_6338) || defined(CONFIG_BCM63XX_CPU_6348)
|
||||
__GEN_SPI_RSET(6348)
|
||||
#endif
|
||||
-#ifdef CONFIG_BCM63XX_CPU_6358
|
||||
+#if defined(CONFIG_BCM63XX_CPU_6358) || defined(CONFIG_BCM63XX_CPU_6368)
|
||||
__GEN_SPI_RSET(6358)
|
||||
#endif
|
||||
-#ifdef CONFIG_BCM63XX_CPU_6368
|
||||
- __GEN_SPI_RSET(6368)
|
||||
-#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
|
||||
@@ -1223,24 +1223,7 @@
|
||||
* _REG relative to RSET_SPI
|
||||
*************************************************************************/
|
||||
|
||||
-/* BCM 6338 SPI core */
|
||||
-#define SPI_6338_CMD 0x00 /* 16-bits register */
|
||||
-#define SPI_6338_INT_STATUS 0x02
|
||||
-#define SPI_6338_INT_MASK_ST 0x03
|
||||
-#define SPI_6338_INT_MASK 0x04
|
||||
-#define SPI_6338_ST 0x05
|
||||
-#define SPI_6338_CLK_CFG 0x06
|
||||
-#define SPI_6338_FILL_BYTE 0x07
|
||||
-#define SPI_6338_MSG_TAIL 0x09
|
||||
-#define SPI_6338_RX_TAIL 0x0b
|
||||
-#define SPI_6338_MSG_CTL 0x40 /* 8-bits register */
|
||||
-#define SPI_6338_MSG_CTL_WIDTH 8
|
||||
-#define SPI_6338_MSG_DATA 0x41
|
||||
-#define SPI_6338_MSG_DATA_SIZE 0x3f
|
||||
-#define SPI_6338_RX_DATA 0x80
|
||||
-#define SPI_6338_RX_DATA_SIZE 0x3f
|
||||
-
|
||||
-/* BCM 6348 SPI core */
|
||||
+/* BCM 6338/6348 SPI core */
|
||||
#define SPI_6348_CMD 0x00 /* 16-bits register */
|
||||
#define SPI_6348_INT_STATUS 0x02
|
||||
#define SPI_6348_INT_MASK_ST 0x03
|
||||
@@ -1257,7 +1240,7 @@
|
||||
#define SPI_6348_RX_DATA 0x80
|
||||
#define SPI_6348_RX_DATA_SIZE 0x3f
|
||||
|
||||
-/* BCM 6358 SPI core */
|
||||
+/* BCM 6358/6368 SPI core */
|
||||
#define SPI_6358_MSG_CTL 0x00 /* 16-bits register */
|
||||
#define SPI_6358_MSG_CTL_WIDTH 16
|
||||
#define SPI_6358_MSG_DATA 0x02
|
||||
@@ -1274,23 +1257,6 @@
|
||||
#define SPI_6358_MSG_TAIL 0x709
|
||||
#define SPI_6358_RX_TAIL 0x70B
|
||||
|
||||
-/* BCM 6358 SPI core */
|
||||
-#define SPI_6368_MSG_CTL 0x00 /* 16-bits register */
|
||||
-#define SPI_6368_MSG_CTL_WIDTH 16
|
||||
-#define SPI_6368_MSG_DATA 0x02
|
||||
-#define SPI_6368_MSG_DATA_SIZE 0x21e
|
||||
-#define SPI_6368_RX_DATA 0x400
|
||||
-#define SPI_6368_RX_DATA_SIZE 0x220
|
||||
-#define SPI_6368_CMD 0x700 /* 16-bits register */
|
||||
-#define SPI_6368_INT_STATUS 0x702
|
||||
-#define SPI_6368_INT_MASK_ST 0x703
|
||||
-#define SPI_6368_INT_MASK 0x704
|
||||
-#define SPI_6368_ST 0x705
|
||||
-#define SPI_6368_CLK_CFG 0x706
|
||||
-#define SPI_6368_FILL_BYTE 0x707
|
||||
-#define SPI_6368_MSG_TAIL 0x709
|
||||
-#define SPI_6368_RX_TAIL 0x70B
|
||||
-
|
||||
/* Shared SPI definitions */
|
||||
|
||||
/* Message configuration */
|
||||
@@ -1298,10 +1264,8 @@
|
||||
#define SPI_HD_W 0x01
|
||||
#define SPI_HD_R 0x02
|
||||
#define SPI_BYTE_CNT_SHIFT 0
|
||||
-#define SPI_6338_MSG_TYPE_SHIFT 6
|
||||
#define SPI_6348_MSG_TYPE_SHIFT 6
|
||||
#define SPI_6358_MSG_TYPE_SHIFT 14
|
||||
-#define SPI_6368_MSG_TYPE_SHIFT 14
|
||||
|
||||
/* Command */
|
||||
#define SPI_CMD_NOOP 0x00
|
|
@ -0,0 +1,68 @@
|
|||
From 609c69339a24bd034f5359dad14087276ce5a83f Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Sun, 15 Jan 2012 14:41:22 +0100
|
||||
Subject: [PATCH 2/7] MIPS: BCM63XX: fix revision ID width
|
||||
|
||||
The REVID is only 8 bit wide.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/bcm63xx/cpu.c | 4 ++--
|
||||
arch/mips/bcm63xx/setup.c | 2 +-
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 2 +-
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 2 +-
|
||||
4 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/cpu.c
|
||||
+++ b/arch/mips/bcm63xx/cpu.c
|
||||
@@ -25,7 +25,7 @@ const int *bcm63xx_irqs;
|
||||
EXPORT_SYMBOL(bcm63xx_irqs);
|
||||
|
||||
static u16 bcm63xx_cpu_id;
|
||||
-static u16 bcm63xx_cpu_rev;
|
||||
+static u8 bcm63xx_cpu_rev;
|
||||
static unsigned int bcm63xx_cpu_freq;
|
||||
static unsigned int bcm63xx_memory_size;
|
||||
|
||||
@@ -87,7 +87,7 @@ u16 __bcm63xx_get_cpu_id(void)
|
||||
|
||||
EXPORT_SYMBOL(__bcm63xx_get_cpu_id);
|
||||
|
||||
-u16 bcm63xx_get_cpu_rev(void)
|
||||
+u8 bcm63xx_get_cpu_rev(void)
|
||||
{
|
||||
return bcm63xx_cpu_rev;
|
||||
}
|
||||
--- a/arch/mips/bcm63xx/setup.c
|
||||
+++ b/arch/mips/bcm63xx/setup.c
|
||||
@@ -126,7 +126,7 @@ static void __bcm63xx_machine_reboot(cha
|
||||
const char *get_system_type(void)
|
||||
{
|
||||
static char buf[128];
|
||||
- snprintf(buf, sizeof(buf), "bcm63xx/%s (0x%04x/0x%04X)",
|
||||
+ snprintf(buf, sizeof(buf), "bcm63xx/%s (0x%04x/0x%02X)",
|
||||
board_get_name(),
|
||||
bcm63xx_get_cpu_id(), bcm63xx_get_cpu_rev());
|
||||
return buf;
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
void __init bcm63xx_cpu_init(void);
|
||||
u16 __bcm63xx_get_cpu_id(void);
|
||||
-u16 bcm63xx_get_cpu_rev(void);
|
||||
+u8 bcm63xx_get_cpu_rev(void);
|
||||
unsigned int bcm63xx_get_cpu_freq(void);
|
||||
|
||||
#ifdef CONFIG_BCM63XX_CPU_6328
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
|
||||
@@ -10,7 +10,7 @@
|
||||
#define REV_CHIPID_SHIFT 16
|
||||
#define REV_CHIPID_MASK (0xffff << REV_CHIPID_SHIFT)
|
||||
#define REV_REVID_SHIFT 0
|
||||
-#define REV_REVID_MASK (0xffff << REV_REVID_SHIFT)
|
||||
+#define REV_REVID_MASK (0xff << REV_REVID_SHIFT)
|
||||
|
||||
/* Clock Control register */
|
||||
#define PERF_CKCTL_REG 0x4
|
|
@ -0,0 +1,133 @@
|
|||
From 3f4570c9794fcae1cf62fbf3266a2e23edac67a5 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Wed, 27 Jun 2012 15:01:09 +0200
|
||||
Subject: [PATCH 3/7] MIPS: BCM63XX: rework chip detection
|
||||
|
||||
Instead of trying to use a correlation of cpu prid and chip id and
|
||||
hoping they will always be unique, use the cpu prid to determine the
|
||||
chip id register location and just read out the chip id.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/bcm63xx/cpu.c | 87 +++++++++++++++++++++++------------------------
|
||||
1 file changed, 42 insertions(+), 45 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/cpu.c
|
||||
+++ b/arch/mips/bcm63xx/cpu.c
|
||||
@@ -240,53 +240,27 @@ static unsigned int detect_memory_size(v
|
||||
|
||||
void __init bcm63xx_cpu_init(void)
|
||||
{
|
||||
- unsigned int tmp, expected_cpu_id;
|
||||
+ unsigned int tmp;
|
||||
struct cpuinfo_mips *c = ¤t_cpu_data;
|
||||
unsigned int cpu = smp_processor_id();
|
||||
+ u32 chipid_reg;
|
||||
|
||||
/* soc registers location depends on cpu type */
|
||||
- expected_cpu_id = 0;
|
||||
+ chipid_reg = 0;
|
||||
|
||||
switch (c->cputype) {
|
||||
case CPU_BMIPS3300:
|
||||
- if ((read_c0_prid() & 0xff00) == PRID_IMP_BMIPS3300_ALT) {
|
||||
- expected_cpu_id = BCM6348_CPU_ID;
|
||||
- bcm63xx_regs_base = bcm6348_regs_base;
|
||||
- bcm63xx_irqs = bcm6348_irqs;
|
||||
- } else {
|
||||
+ if ((read_c0_prid() & 0xff00) != PRID_IMP_BMIPS3300_ALT)
|
||||
__cpu_name[cpu] = "Broadcom BCM6338";
|
||||
- expected_cpu_id = BCM6338_CPU_ID;
|
||||
- bcm63xx_regs_base = bcm6338_regs_base;
|
||||
- bcm63xx_irqs = bcm6338_irqs;
|
||||
- }
|
||||
- break;
|
||||
+ /* fall-through */
|
||||
case CPU_BMIPS32:
|
||||
- expected_cpu_id = BCM6345_CPU_ID;
|
||||
- bcm63xx_regs_base = bcm6345_regs_base;
|
||||
- bcm63xx_irqs = bcm6345_irqs;
|
||||
+ chipid_reg = BCM_6345_PERF_BASE;
|
||||
break;
|
||||
case CPU_BMIPS4350:
|
||||
- if ((read_c0_prid() & 0xf0) == 0x10) {
|
||||
- expected_cpu_id = BCM6358_CPU_ID;
|
||||
- bcm63xx_regs_base = bcm6358_regs_base;
|
||||
- bcm63xx_irqs = bcm6358_irqs;
|
||||
- } else {
|
||||
- /* all newer chips have the same chip id location */
|
||||
- u16 chip_id = bcm_readw(BCM_6368_PERF_BASE);
|
||||
-
|
||||
- switch (chip_id) {
|
||||
- case BCM6328_CPU_ID:
|
||||
- expected_cpu_id = BCM6328_CPU_ID;
|
||||
- bcm63xx_regs_base = bcm6328_regs_base;
|
||||
- bcm63xx_irqs = bcm6328_irqs;
|
||||
- break;
|
||||
- case BCM6368_CPU_ID:
|
||||
- expected_cpu_id = BCM6368_CPU_ID;
|
||||
- bcm63xx_regs_base = bcm6368_regs_base;
|
||||
- bcm63xx_irqs = bcm6368_irqs;
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
+ if ((read_c0_prid() & 0xf0) == 0x10)
|
||||
+ chipid_reg = BCM_6345_PERF_BASE;
|
||||
+ else
|
||||
+ chipid_reg = BCM_6368_PERF_BASE;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -294,20 +268,43 @@ void __init bcm63xx_cpu_init(void)
|
||||
* really early to panic, but delaying panic would not help since we
|
||||
* will never get any working console
|
||||
*/
|
||||
- if (!expected_cpu_id)
|
||||
+ if (!chipid_reg)
|
||||
panic("unsupported Broadcom CPU");
|
||||
|
||||
- /*
|
||||
- * bcm63xx_regs_base is set, we can access soc registers
|
||||
- */
|
||||
-
|
||||
- /* double check CPU type */
|
||||
- tmp = bcm_perf_readl(PERF_REV_REG);
|
||||
+ /* read out CPU type */
|
||||
+ tmp = bcm_readl(chipid_reg);
|
||||
bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT;
|
||||
bcm63xx_cpu_rev = (tmp & REV_REVID_MASK) >> REV_REVID_SHIFT;
|
||||
|
||||
- if (bcm63xx_cpu_id != expected_cpu_id)
|
||||
- panic("bcm63xx CPU id mismatch");
|
||||
+ switch (bcm63xx_cpu_id) {
|
||||
+ case BCM6328_CPU_ID:
|
||||
+ bcm63xx_regs_base = bcm6328_regs_base;
|
||||
+ bcm63xx_irqs = bcm6328_irqs;
|
||||
+ break;
|
||||
+ case BCM6338_CPU_ID:
|
||||
+ bcm63xx_regs_base = bcm6338_regs_base;
|
||||
+ bcm63xx_irqs = bcm6338_irqs;
|
||||
+ break;
|
||||
+ case BCM6345_CPU_ID:
|
||||
+ bcm63xx_regs_base = bcm6345_regs_base;
|
||||
+ bcm63xx_irqs = bcm6345_irqs;
|
||||
+ break;
|
||||
+ case BCM6348_CPU_ID:
|
||||
+ bcm63xx_regs_base = bcm6348_regs_base;
|
||||
+ bcm63xx_irqs = bcm6348_irqs;
|
||||
+ break;
|
||||
+ case BCM6358_CPU_ID:
|
||||
+ bcm63xx_regs_base = bcm6358_regs_base;
|
||||
+ bcm63xx_irqs = bcm6358_irqs;
|
||||
+ break;
|
||||
+ case BCM6368_CPU_ID:
|
||||
+ bcm63xx_regs_base = bcm6368_regs_base;
|
||||
+ bcm63xx_irqs = bcm6368_irqs;
|
||||
+ break;
|
||||
+ default:
|
||||
+ panic("unsupported broadcom CPU %x", bcm63xx_cpu_id);
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
bcm63xx_cpu_freq = detect_cpu_clock();
|
||||
bcm63xx_memory_size = detect_memory_size();
|
|
@ -1,28 +1,30 @@
|
|||
From 2665f554de21676a4cf609b1e1bb39d0597a1985 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
From 1071a9c9527d68eca4605e2eb1686609bfecf287 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Mon, 21 Nov 2011 00:48:52 +0100
|
||||
Subject: [PATCH 28/72] MIPS: BCM63XX: add basic BCM6362 support
|
||||
Subject: [PATCH 4/7] MIPS: BCM63XX: add basic BCM6362 support
|
||||
|
||||
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
Add basic support for detecting and booting the BCM6362.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/bcm63xx/Kconfig | 4 +
|
||||
arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +-
|
||||
arch/mips/bcm63xx/cpu.c | 52 +++++++-
|
||||
arch/mips/bcm63xx/irq.c | 19 +++
|
||||
arch/mips/bcm63xx/boards/board_bcm963xx.c | 6 +-
|
||||
arch/mips/bcm63xx/cpu.c | 51 +++++++-
|
||||
arch/mips/bcm63xx/irq.c | 22 ++++
|
||||
arch/mips/bcm63xx/prom.c | 2 +
|
||||
arch/mips/bcm63xx/reset.c | 28 +++++
|
||||
arch/mips/bcm63xx/setup.c | 3 +
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 139 +++++++++++++++++++++
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h | 2 +
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 59 +++++++++
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 61 ++++++++-
|
||||
arch/mips/include/asm/mach-bcm63xx/ioremap.h | 1 +
|
||||
11 files changed, 309 insertions(+), 2 deletions(-)
|
||||
11 files changed, 314 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/Kconfig
|
||||
+++ b/arch/mips/bcm63xx/Kconfig
|
||||
@@ -37,6 +37,10 @@ config BCM63XX_CPU_6358
|
||||
select BCM63XX_OHCI
|
||||
select BCM63XX_EHCI
|
||||
@@ -25,6 +25,10 @@ config BCM63XX_CPU_6358
|
||||
bool "support 6358 CPU"
|
||||
select HW_HAS_PCI
|
||||
|
||||
+config BCM63XX_CPU_6362
|
||||
+ bool "support 6362 CPU"
|
||||
|
@ -33,15 +35,21 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
select HW_HAS_PCI
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -785,7 +785,7 @@ void __init board_prom_init(void)
|
||||
@@ -726,11 +726,11 @@ void __init board_prom_init(void)
|
||||
u32 val;
|
||||
|
||||
/* read base address of boot chip select (0)
|
||||
* 6328 does not have MPI but boots from a fixed address
|
||||
- * 6328 does not have MPI but boots from a fixed address
|
||||
+ * 6328/6362 do not have MPI but boot from a fixed address
|
||||
*/
|
||||
- if (BCMCPU_IS_6328())
|
||||
+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362())
|
||||
+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) {
|
||||
val = 0x18000000;
|
||||
else {
|
||||
- else {
|
||||
+ } else {
|
||||
val = bcm_mpi_readl(MPI_CSBASE_REG(0));
|
||||
val &= MPI_CSBASE_BASE_MASK;
|
||||
}
|
||||
--- a/arch/mips/bcm63xx/cpu.c
|
||||
+++ b/arch/mips/bcm63xx/cpu.c
|
||||
@@ -71,6 +71,15 @@ static const int bcm6358_irqs[] = {
|
||||
|
@ -112,21 +120,20 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
return bcm_ddr_readl(DDR_CSEND_REG) << 24;
|
||||
|
||||
if (BCMCPU_IS_6345()) {
|
||||
@@ -280,6 +325,11 @@ void __init bcm63xx_cpu_init(void)
|
||||
bcm63xx_regs_base = bcm6328_regs_base;
|
||||
bcm63xx_irqs = bcm6328_irqs;
|
||||
break;
|
||||
+ case BCM6362_CPU_ID:
|
||||
+ expected_cpu_id = BCM6362_CPU_ID;
|
||||
+ bcm63xx_regs_base = bcm6362_regs_base;
|
||||
+ bcm63xx_irqs = bcm6362_irqs;
|
||||
+ break;
|
||||
case BCM6368_CPU_ID:
|
||||
expected_cpu_id = BCM6368_CPU_ID;
|
||||
bcm63xx_regs_base = bcm6368_regs_base;
|
||||
@@ -297,6 +342,10 @@ void __init bcm63xx_cpu_init(void)
|
||||
bcm63xx_regs_base = bcm6358_regs_base;
|
||||
bcm63xx_irqs = bcm6358_irqs;
|
||||
break;
|
||||
+ case BCM6362_CPU_ID:
|
||||
+ bcm63xx_regs_base = bcm6362_regs_base;
|
||||
+ bcm63xx_irqs = bcm6362_irqs;
|
||||
+ break;
|
||||
case BCM6368_CPU_ID:
|
||||
bcm63xx_regs_base = bcm6368_regs_base;
|
||||
bcm63xx_irqs = bcm6368_irqs;
|
||||
--- a/arch/mips/bcm63xx/irq.c
|
||||
+++ b/arch/mips/bcm63xx/irq.c
|
||||
@@ -82,6 +82,14 @@ static void __internal_irq_unmask_64(uns
|
||||
@@ -82,6 +82,17 @@ static void __internal_irq_unmask_64(uns
|
||||
#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6358
|
||||
#define ext_irq_cfg_reg2 0
|
||||
#endif
|
||||
|
@ -137,11 +144,14 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
+#define is_ext_irq_cascaded 1
|
||||
+#define ext_irq_start (BCM_6362_EXT_IRQ0 - IRQ_INTERNAL_BASE)
|
||||
+#define ext_irq_end (BCM_6362_EXT_IRQ3 - IRQ_INTERNAL_BASE)
|
||||
+#define ext_irq_count 4
|
||||
+#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6362
|
||||
+#define ext_irq_cfg_reg2 0
|
||||
+#endif
|
||||
#ifdef CONFIG_BCM63XX_CPU_6368
|
||||
#define irq_stat_reg PERF_IRQSTAT_6368_REG
|
||||
#define irq_mask_reg PERF_IRQMASK_6368_REG
|
||||
@@ -170,6 +178,16 @@ static void bcm63xx_init_irq(void)
|
||||
@@ -170,6 +181,16 @@ static void bcm63xx_init_irq(void)
|
||||
ext_irq_end = BCM_6358_EXT_IRQ3 - IRQ_INTERNAL_BASE;
|
||||
ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6358;
|
||||
break;
|
||||
|
@ -158,7 +168,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
case BCM6368_CPU_ID:
|
||||
irq_stat_addr += PERF_IRQSTAT_6368_REG;
|
||||
irq_mask_addr += PERF_IRQMASK_6368_REG;
|
||||
@@ -458,6 +476,7 @@ static int bcm63xx_external_irq_set_type
|
||||
@@ -458,6 +479,7 @@ static int bcm63xx_external_irq_set_type
|
||||
case BCM6338_CPU_ID:
|
||||
case BCM6345_CPU_ID:
|
||||
case BCM6358_CPU_ID:
|
||||
|
@ -278,7 +288,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#ifdef CONFIG_BCM63XX_CPU_6368
|
||||
# ifdef bcm63xx_get_cpu_id
|
||||
# undef bcm63xx_get_cpu_id
|
||||
@@ -413,6 +428,62 @@ enum bcm63xx_regs_set {
|
||||
@@ -406,6 +421,62 @@ enum bcm63xx_regs_set {
|
||||
|
||||
|
||||
/*
|
||||
|
@ -341,7 +351,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
* 6368 register sets base address
|
||||
*/
|
||||
#define BCM_6368_DSL_LMEM_BASE (0xdeadbeef)
|
||||
@@ -574,6 +645,9 @@ static inline unsigned long bcm63xx_regs
|
||||
@@ -564,6 +635,9 @@ static inline unsigned long bcm63xx_regs
|
||||
#ifdef CONFIG_BCM63XX_CPU_6358
|
||||
__GEN_RSET(6358)
|
||||
#endif
|
||||
|
@ -351,7 +361,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#ifdef CONFIG_BCM63XX_CPU_6368
|
||||
__GEN_RSET(6368)
|
||||
#endif
|
||||
@@ -836,6 +910,71 @@ enum bcm63xx_irq {
|
||||
@@ -820,6 +894,71 @@ enum bcm63xx_irq {
|
||||
#define BCM_6358_EXT_IRQ3 (IRQ_INTERNAL_BASE + 28)
|
||||
|
||||
/*
|
||||
|
@ -531,7 +541,16 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#define SOFTRESET_6368_SPI_MASK (1 << 0)
|
||||
#define SOFTRESET_6368_MPI_MASK (1 << 3)
|
||||
#define SOFTRESET_6368_EPHY_MASK (1 << 6)
|
||||
@@ -1352,6 +1405,12 @@
|
||||
@@ -1240,7 +1293,7 @@
|
||||
#define SPI_6348_RX_DATA 0x80
|
||||
#define SPI_6348_RX_DATA_SIZE 0x3f
|
||||
|
||||
-/* BCM 6358/6368 SPI core */
|
||||
+/* BCM 6358/6262/6368 SPI core */
|
||||
#define SPI_6358_MSG_CTL 0x00 /* 16-bits register */
|
||||
#define SPI_6358_MSG_CTL_WIDTH 16
|
||||
#define SPI_6358_MSG_DATA 0x02
|
||||
@@ -1316,6 +1369,12 @@
|
||||
#define SERDES_PCIE_EN (1 << 0)
|
||||
#define SERDES_PCIE_EXD_EN (1 << 15)
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
From 5da349ee614f61a2e6edb403098f40c6d40f2553 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Thu, 5 Jul 2012 21:19:20 +0200
|
||||
Subject: [PATCH 5/7] MIPS: BCM63XX: enable SPI controller for BCM6362
|
||||
|
||||
The SPI controller shares the same register layout as the 6358 one.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/bcm63xx/clk.c | 2 ++
|
||||
arch/mips/bcm63xx/dev-spi.c | 4 ++--
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h | 3 ++-
|
||||
3 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/clk.c
|
||||
+++ b/arch/mips/bcm63xx/clk.c
|
||||
@@ -202,6 +202,8 @@ static void spi_set(struct clk *clk, int
|
||||
mask = CKCTL_6348_SPI_EN;
|
||||
else if (BCMCPU_IS_6358())
|
||||
mask = CKCTL_6358_SPI_EN;
|
||||
+ else if (BCMCPU_IS_6362())
|
||||
+ mask = CKCTL_6362_SPI_EN;
|
||||
else
|
||||
/* BCMCPU_IS_6368 */
|
||||
mask = CKCTL_6368_SPI_EN;
|
||||
--- a/arch/mips/bcm63xx/dev-spi.c
|
||||
+++ b/arch/mips/bcm63xx/dev-spi.c
|
||||
@@ -37,7 +37,7 @@ static __init void bcm63xx_spi_regs_init
|
||||
{
|
||||
if (BCMCPU_IS_6338() || BCMCPU_IS_6348())
|
||||
bcm63xx_regs_spi = bcm6348_regs_spi;
|
||||
- if (BCMCPU_IS_6358() || BCMCPU_IS_6368())
|
||||
+ if (BCMCPU_IS_6358() || BCMCPU_IS_6362() || BCMCPU_IS_6368())
|
||||
bcm63xx_regs_spi = bcm6358_regs_spi;
|
||||
}
|
||||
#else
|
||||
@@ -87,7 +87,7 @@ int __init bcm63xx_spi_register(void)
|
||||
spi_pdata.msg_ctl_width = SPI_6348_MSG_CTL_WIDTH;
|
||||
}
|
||||
|
||||
- if (BCMCPU_IS_6358() || BCMCPU_IS_6368()) {
|
||||
+ if (BCMCPU_IS_6358() || BCMCPU_IS_6362() || BCMCPU_IS_6368()) {
|
||||
spi_resources[0].end += BCM_6358_RSET_SPI_SIZE - 1;
|
||||
spi_pdata.fifo_size = SPI_6358_MSG_DATA_SIZE;
|
||||
spi_pdata.msg_type_shift = SPI_6358_MSG_TYPE_SHIFT;
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
|
||||
@@ -74,7 +74,8 @@ static inline unsigned long bcm63xx_spir
|
||||
#if defined(CONFIG_BCM63XX_CPU_6338) || defined(CONFIG_BCM63XX_CPU_6348)
|
||||
__GEN_SPI_RSET(6348)
|
||||
#endif
|
||||
-#if defined(CONFIG_BCM63XX_CPU_6358) || defined(CONFIG_BCM63XX_CPU_6368)
|
||||
+#if defined(CONFIG_BCM63XX_CPU_6358) || defined(CONFIG_BCM63XX_CPU_6362) || \
|
||||
+ defined(CONFIG_BCM63XX_CPU_6368)
|
||||
__GEN_SPI_RSET(6358)
|
||||
#endif
|
||||
#endif
|
|
@ -1,16 +1,20 @@
|
|||
From 2f94c414e554531e2a65a7c4a7fa2d1ba0380c0a Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
From ec6f1e53b22d01e628b79b99f7a33960034e97e7 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Mon, 21 Nov 2011 00:53:26 +0100
|
||||
Subject: [PATCH 29/72] MIPS: BCM63XX: enable pcie for BCM6362
|
||||
Subject: [PATCH 6/7] MIPS: BCM63XX: enable pcie for BCM6362
|
||||
|
||||
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
The PCIe controller is almost the same as the BCM6328 one, with only
|
||||
the SERDES register being at a different location.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/pci/pci-bcm63xx.c | 19 ++++++++++++++++---
|
||||
1 file changed, 16 insertions(+), 3 deletions(-)
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 3 ++-
|
||||
arch/mips/pci/pci-bcm63xx.c | 11 +++++++++--
|
||||
2 files changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
|
||||
@@ -1401,7 +1401,8 @@
|
||||
@@ -1365,7 +1365,8 @@
|
||||
/*************************************************************************
|
||||
* _REG relative to RSET_MISC
|
||||
*************************************************************************/
|
|
@ -0,0 +1,38 @@
|
|||
From 01034e48e72783ced82a050e862f82ee3dfdb783 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Mon, 21 Nov 2011 00:48:52 +0100
|
||||
Subject: [PATCH 7/7] MIPS: BCM63XX: add flash detection for BCM6362
|
||||
|
||||
BCM6362 support booting from SPI flash and NAND.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/bcm63xx/dev-flash.c | 6 ++++++
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 1 +
|
||||
2 files changed, 7 insertions(+)
|
||||
|
||||
--- a/arch/mips/bcm63xx/dev-flash.c
|
||||
+++ b/arch/mips/bcm63xx/dev-flash.c
|
||||
@@ -77,6 +77,12 @@ static int __init bcm63xx_detect_flash_t
|
||||
return BCM63XX_FLASH_TYPE_PARALLEL;
|
||||
else
|
||||
return BCM63XX_FLASH_TYPE_SERIAL;
|
||||
+ case BCM6362_CPU_ID:
|
||||
+ val = bcm_misc_readl(MISC_STRAPBUS_6362_REG);
|
||||
+ if (val & STRAPBUS_6362_BOOT_SEL_SERIAL)
|
||||
+ return BCM63XX_FLASH_TYPE_SERIAL;
|
||||
+ else
|
||||
+ return BCM63XX_FLASH_TYPE_NAND;
|
||||
case BCM6368_CPU_ID:
|
||||
val = bcm_gpio_readl(GPIO_STRAPBUS_REG);
|
||||
switch (val & STRAPBUS_6368_BOOT_SEL_MASK) {
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
|
||||
@@ -1372,6 +1372,7 @@
|
||||
|
||||
#define MISC_STRAPBUS_6362_REG 0x14
|
||||
#define STRAPBUS_6362_FCVO_SHIFT 1
|
||||
+#define STRAPBUS_6362_HSSPI_CLK_FAST (1 << 13)
|
||||
#define STRAPBUS_6362_FCVO_MASK (0x1f << STRAPBUS_6362_FCVO_SHIFT)
|
||||
#define STRAPBUS_6362_BOOT_SEL_SERIAL (1 << 15)
|
||||
#define STRAPBUS_6362_BOOT_SEL_NAND (0 << 15)
|
|
@ -0,0 +1,91 @@
|
|||
From d31454bc822e1957e758e75d4367bcd12af89743 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Thu, 18 Apr 2013 21:23:11 +0200
|
||||
Subject: [PATCH] MIPS: BCM63XX: add missing clocks for BCM6328 and BCM6362
|
||||
|
||||
Add currently unused missing clocks for BCM6328 and BCM6362.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/bcm63xx/clk.c | 33 +++++++++++++++++++++++++--------
|
||||
1 file changed, 25 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/clk.c
|
||||
+++ b/arch/mips/bcm63xx/clk.c
|
||||
@@ -125,11 +125,18 @@ static struct clk clk_ephy = {
|
||||
*/
|
||||
static void enetsw_set(struct clk *clk, int enable)
|
||||
{
|
||||
- if (!BCMCPU_IS_6368())
|
||||
+ if (BCMCPU_IS_6328())
|
||||
+ bcm_hwclock_set(CKCTL_6328_ROBOSW_EN, enable);
|
||||
+ else if (BCMCPU_IS_6362())
|
||||
+ bcm_hwclock_set(CKCTL_6362_ROBOSW_EN, enable);
|
||||
+ else if (BCMCPU_IS_6368())
|
||||
+ bcm_hwclock_set(CKCTL_6368_ROBOSW_EN |
|
||||
+ CKCTL_6368_SWPKT_USB_EN |
|
||||
+ CKCTL_6368_SWPKT_SAR_EN,
|
||||
+ enable);
|
||||
+ else
|
||||
return;
|
||||
- bcm_hwclock_set(CKCTL_6368_ROBOSW_EN |
|
||||
- CKCTL_6368_SWPKT_USB_EN |
|
||||
- CKCTL_6368_SWPKT_SAR_EN, enable);
|
||||
+
|
||||
if (enable) {
|
||||
/* reset switch core afer clock change */
|
||||
bcm63xx_core_set_reset(BCM63XX_RESET_ENETSW, 1);
|
||||
@@ -166,6 +173,8 @@ static void usbh_set(struct clk *clk, in
|
||||
bcm_hwclock_set(CKCTL_6328_USBH_EN, enable);
|
||||
else if (BCMCPU_IS_6348())
|
||||
bcm_hwclock_set(CKCTL_6348_USBH_EN, enable);
|
||||
+ else if (BCMCPU_IS_6362())
|
||||
+ bcm_hwclock_set(CKCTL_6362_USBH_EN, enable);
|
||||
else if (BCMCPU_IS_6368())
|
||||
bcm_hwclock_set(CKCTL_6368_USBH_EN, enable);
|
||||
}
|
||||
@@ -181,6 +190,8 @@ static void usbd_set(struct clk *clk, in
|
||||
{
|
||||
if (BCMCPU_IS_6328())
|
||||
bcm_hwclock_set(CKCTL_6328_USBD_EN, enable);
|
||||
+ else if (BCMCPU_IS_6362())
|
||||
+ bcm_hwclock_set(CKCTL_6362_USBD_EN, enable);
|
||||
else if (BCMCPU_IS_6368())
|
||||
bcm_hwclock_set(CKCTL_6368_USBD_EN, enable);
|
||||
}
|
||||
@@ -244,7 +255,10 @@ static struct clk clk_xtm = {
|
||||
*/
|
||||
static void ipsec_set(struct clk *clk, int enable)
|
||||
{
|
||||
- bcm_hwclock_set(CKCTL_6368_IPSEC_EN, enable);
|
||||
+ if (BCMCPU_IS_6362())
|
||||
+ bcm_hwclock_set(CKCTL_6362_IPSEC_EN, enable);
|
||||
+ else if (BCMCPU_IS_6368())
|
||||
+ bcm_hwclock_set(CKCTL_6368_IPSEC_EN, enable);
|
||||
}
|
||||
|
||||
static struct clk clk_ipsec = {
|
||||
@@ -257,7 +271,10 @@ static struct clk clk_ipsec = {
|
||||
|
||||
static void pcie_set(struct clk *clk, int enable)
|
||||
{
|
||||
- bcm_hwclock_set(CKCTL_6328_PCIE_EN, enable);
|
||||
+ if (BCMCPU_IS_6328())
|
||||
+ bcm_hwclock_set(CKCTL_6328_PCIE_EN, enable);
|
||||
+ else if (BCMCPU_IS_6362())
|
||||
+ bcm_hwclock_set(CKCTL_6362_PCIE_EN, enable);
|
||||
}
|
||||
|
||||
static struct clk clk_pcie = {
|
||||
@@ -323,9 +340,9 @@ struct clk *clk_get(struct device *dev,
|
||||
return &clk_periph;
|
||||
if (BCMCPU_IS_6358() && !strcmp(id, "pcm"))
|
||||
return &clk_pcm;
|
||||
- if (BCMCPU_IS_6368() && !strcmp(id, "ipsec"))
|
||||
+ if ((BCMCPU_IS_6362() || BCMCPU_IS_6368()) && !strcmp(id, "ipsec"))
|
||||
return &clk_ipsec;
|
||||
- if (BCMCPU_IS_6328() && !strcmp(id, "pcie"))
|
||||
+ if ((BCMCPU_IS_6328() || BCMCPU_IS_6362()) && !strcmp(id, "pcie"))
|
||||
return &clk_pcie;
|
||||
return ERR_PTR(-ENOENT);
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
From e2092cf1b164ede62b740c7c95905171fb6232ff Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Sat, 23 Mar 2013 12:32:56 +0100
|
||||
Subject: [PATCH v2 1/3] MTD: bcm63xxpart: use size macro for CFE block size
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/mtd/bcm63xxpart.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/mtd/bcm63xxpart.c
|
||||
+++ b/drivers/mtd/bcm63xxpart.c
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <linux/crc32.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
+#include <linux/sizes.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
@@ -37,7 +38,7 @@
|
||||
|
||||
#define BCM63XX_EXTENDED_SIZE 0xBFC00000 /* Extended flash address */
|
||||
|
||||
-#define BCM63XX_CFE_BLOCK_SIZE 0x10000 /* always at least 64KiB */
|
||||
+#define BCM63XX_CFE_BLOCK_SIZE SZ_64K /* always at least 64KiB */
|
||||
|
||||
#define BCM63XX_CFE_MAGIC_OFFSET 0x4e0
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
From bda508f975d1372568a4fc9862be501a6176fd46 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Sat, 12 May 2012 23:04:17 +0200
|
||||
Subject: [PATCH v2 2/3] MIPS: BCM63XX: export PSI size from nvram
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/bcm63xx/nvram.c | 13 +++++++++++++
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h | 7 +++++++
|
||||
2 files changed, 20 insertions(+)
|
||||
|
||||
--- a/arch/mips/bcm63xx/nvram.c
|
||||
+++ b/arch/mips/bcm63xx/nvram.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <linux/export.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/if_ether.h>
|
||||
+#include <linux/sizes.h>
|
||||
|
||||
#include <bcm63xx_nvram.h>
|
||||
|
||||
@@ -35,6 +36,8 @@ struct bcm963xx_nvram {
|
||||
u32 checksum_high;
|
||||
};
|
||||
|
||||
+#define BCM63XX_DEFAULT_PSI_SIZE SZ_64K
|
||||
+
|
||||
static struct bcm963xx_nvram nvram;
|
||||
static int mac_addr_used;
|
||||
|
||||
@@ -104,3 +107,13 @@ int bcm63xx_nvram_get_mac_address(u8 *ma
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(bcm63xx_nvram_get_mac_address);
|
||||
+
|
||||
+unsigned int bcm63xx_nvram_get_psi_size(void)
|
||||
+{
|
||||
+ /* max is 64k, but some vendors use higher values */
|
||||
+ if (nvram.psi_size > 0 && nvram.psi_size <= 512)
|
||||
+ return nvram.psi_size * SZ_1K;
|
||||
+
|
||||
+ return BCM63XX_DEFAULT_PSI_SIZE;
|
||||
+}
|
||||
+EXPORT_SYMBOL(bcm63xx_nvram_get_psi_size);
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
|
||||
@@ -30,4 +30,11 @@ u8 *bcm63xx_nvram_get_name(void);
|
||||
*/
|
||||
int bcm63xx_nvram_get_mac_address(u8 *mac);
|
||||
|
||||
+/**
|
||||
+ * bcm63xx_nvram_get_psi_size() - returns the size of the PSI area
|
||||
+ *
|
||||
+ * Returns the size of the Persitent Storage Information area in bytes.
|
||||
+ */
|
||||
+unsigned int bcm63xx_nvram_get_psi_size(void);
|
||||
+
|
||||
#endif /* BCM63XX_NVRAM_H */
|
|
@ -0,0 +1,42 @@
|
|||
From f6eefaa4a08ec27c69485c2fc4db23247b84f8c9 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Tue, 1 May 2012 14:10:39 +0200
|
||||
Subject: [PATCH v2 3/3] MTD: bcm63xxpart: use nvram for PSI size
|
||||
|
||||
Read out the SPI size from nvram instead of defaulting to 64K - some
|
||||
vendors actually use values larger than the "max" value of 64.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
drivers/mtd/bcm63xxpart.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/mtd/bcm63xxpart.c
|
||||
+++ b/drivers/mtd/bcm63xxpart.c
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright © 2006-2008 Florian Fainelli <florian@openwrt.org>
|
||||
* Mike Albon <malbon@openwrt.org>
|
||||
* Copyright © 2009-2010 Daniel Dickinson <openwrt@cshore.neomailbox.net>
|
||||
- * Copyright © 2011-2012 Jonas Gorski <jonas.gorski@gmail.com>
|
||||
+ * Copyright © 2011-2013 Jonas Gorski <jonas.gorski@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
#include <linux/bcm963xx_tag.h>
|
||||
+#include <asm/mach-bcm63xx/bcm63xx_nvram.h>
|
||||
#include <asm/mach-bcm63xx/board_bcm963xx.h>
|
||||
|
||||
#define BCM63XX_EXTENDED_SIZE 0xBFC00000 /* Extended flash address */
|
||||
@@ -91,7 +92,8 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
BCM63XX_CFE_BLOCK_SIZE);
|
||||
|
||||
cfelen = cfe_erasesize;
|
||||
- nvramlen = cfe_erasesize;
|
||||
+ nvramlen = bcm63xx_nvram_get_psi_size();
|
||||
+ nvramlen = roundup(nvramlen, cfe_erasesize);
|
||||
|
||||
/* Allocate memory for buffer */
|
||||
buf = vmalloc(sizeof(struct bcm_tag));
|
|
@ -14,8 +14,8 @@ Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
|||
|
||||
--- a/arch/mips/bcm63xx/clk.c
|
||||
+++ b/arch/mips/bcm63xx/clk.c
|
||||
@@ -162,6 +162,11 @@ static void usbh_set(struct clk *clk, in
|
||||
bcm_hwclock_set(CKCTL_6348_USBH_EN, enable);
|
||||
@@ -177,6 +177,11 @@ static void usbh_set(struct clk *clk, in
|
||||
bcm_hwclock_set(CKCTL_6362_USBH_EN, enable);
|
||||
else if (BCMCPU_IS_6368())
|
||||
bcm_hwclock_set(CKCTL_6368_USBH_EN, enable);
|
||||
+ else
|
|
@ -17,8 +17,8 @@ Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
|||
|
||||
--- a/arch/mips/bcm63xx/clk.c
|
||||
+++ b/arch/mips/bcm63xx/clk.c
|
||||
@@ -182,6 +182,11 @@ static void usbd_set(struct clk *clk, in
|
||||
bcm_hwclock_set(CKCTL_6328_USBD_EN, enable);
|
||||
@@ -199,6 +199,11 @@ static void usbd_set(struct clk *clk, in
|
||||
bcm_hwclock_set(CKCTL_6362_USBD_EN, enable);
|
||||
else if (BCMCPU_IS_6368())
|
||||
bcm_hwclock_set(CKCTL_6368_USBD_EN, enable);
|
||||
+ else
|
|
@ -109,7 +109,7 @@ Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
|||
+ bcm_rset_writel(RSET_USBH_PRIV, 0x1c0020,
|
||||
+ USBH_PRIV_TEST_6358_REG);
|
||||
+
|
||||
+ } else if (BCMCPU_IS_6328() || BCMCPU_IS_6368()) {
|
||||
+ } else if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368()) {
|
||||
+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG);
|
||||
+ reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK;
|
||||
+ reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK;
|
||||
|
@ -144,7 +144,7 @@ Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
|||
+ bcm_rset_writel(RSET_USBH_PRIV, 0x1c0020,
|
||||
+ USBH_PRIV_TEST_6358_REG);
|
||||
+
|
||||
+ } else if (BCMCPU_IS_6328() || BCMCPU_IS_6368()) {
|
||||
+ } else if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368()) {
|
||||
+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG);
|
||||
+ reg &= ~USBH_PRIV_SWAP_EHCI_ENDN_MASK;
|
||||
+ reg |= USBH_PRIV_SWAP_EHCI_DATA_MASK;
|
|
@ -16,7 +16,7 @@ Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
|||
|
||||
--- a/arch/mips/bcm63xx/Kconfig
|
||||
+++ b/arch/mips/bcm63xx/Kconfig
|
||||
@@ -1,33 +1,38 @@
|
||||
@@ -1,37 +1,43 @@
|
||||
menu "CPU support"
|
||||
depends on BCM63XX
|
||||
|
||||
|
@ -53,6 +53,11 @@ Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
|||
select HW_HAS_PCI
|
||||
+ select BCM63XX_OHCI
|
||||
|
||||
config BCM63XX_CPU_6362
|
||||
bool "support 6362 CPU"
|
||||
select HW_HAS_PCI
|
||||
+ select BCM63XX_OHCI
|
||||
|
||||
config BCM63XX_CPU_6368
|
||||
bool "support 6368 CPU"
|
||||
select HW_HAS_PCI
|
|
@ -24,7 +24,7 @@ Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
|||
#include <bcm63xx_dev_usb_usbd.h>
|
||||
#include <board_bcm963xx.h>
|
||||
|
||||
@@ -851,6 +852,9 @@ int __init board_register_devices(void)
|
||||
@@ -848,6 +849,9 @@ int __init board_register_devices(void)
|
||||
if (board.has_usbd)
|
||||
bcm63xx_usbd_register(&board.usbd);
|
||||
|
|
@ -37,12 +37,18 @@ Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
|||
|
||||
config BCM63XX_CPU_6338
|
||||
bool "support 6338 CPU"
|
||||
@@ -28,11 +35,13 @@ config BCM63XX_CPU_6358
|
||||
@@ -28,16 +35,19 @@ config BCM63XX_CPU_6358
|
||||
bool "support 6358 CPU"
|
||||
select HW_HAS_PCI
|
||||
select BCM63XX_OHCI
|
||||
+ select BCM63XX_EHCI
|
||||
|
||||
config BCM63XX_CPU_6362
|
||||
bool "support 6362 CPU"
|
||||
select HW_HAS_PCI
|
||||
select BCM63XX_OHCI
|
||||
+ select BCM63XX_EHCI
|
||||
|
||||
config BCM63XX_CPU_6368
|
||||
bool "support 6368 CPU"
|
||||
select HW_HAS_PCI
|
|
@ -115,7 +115,7 @@ Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
|||
+
|
||||
+int __init bcm63xx_ehci_register(void)
|
||||
+{
|
||||
+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6358() && !BCMCPU_IS_6368())
|
||||
+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6358() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368())
|
||||
+ return 0;
|
||||
+
|
||||
+ ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0);
|
|
@ -24,7 +24,7 @@ Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
|||
#include <bcm63xx_dev_usb_ohci.h>
|
||||
#include <bcm63xx_dev_usb_usbd.h>
|
||||
#include <board_bcm963xx.h>
|
||||
@@ -852,6 +853,9 @@ int __init board_register_devices(void)
|
||||
@@ -849,6 +850,9 @@ int __init board_register_devices(void)
|
||||
if (board.has_usbd)
|
||||
bcm63xx_usbd_register(&board.usbd);
|
||||
|
|
@ -10,7 +10,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
|
||||
--- a/arch/mips/bcm63xx/clk.c
|
||||
+++ b/arch/mips/bcm63xx/clk.c
|
||||
@@ -217,6 +217,26 @@ static struct clk clk_spi = {
|
||||
@@ -236,6 +236,26 @@ static struct clk clk_spi = {
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -37,7 +37,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
* XTM clock
|
||||
*/
|
||||
static void xtm_set(struct clk *clk, int enable)
|
||||
@@ -319,6 +339,8 @@ struct clk *clk_get(struct device *dev,
|
||||
@@ -344,6 +364,8 @@ struct clk *clk_get(struct device *dev,
|
||||
return &clk_usbd;
|
||||
if (!strcmp(id, "spi"))
|
||||
return &clk_spi;
|
|
@ -11,7 +11,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
|
||||
@@ -116,6 +116,7 @@ enum bcm63xx_regs_set {
|
||||
@@ -131,6 +131,7 @@ enum bcm63xx_regs_set {
|
||||
RSET_UART1,
|
||||
RSET_GPIO,
|
||||
RSET_SPI,
|
||||
|
@ -19,7 +19,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
RSET_UDC0,
|
||||
RSET_OHCI0,
|
||||
RSET_OHCI_PRIV,
|
||||
@@ -161,6 +162,7 @@ enum bcm63xx_regs_set {
|
||||
@@ -176,6 +177,7 @@ enum bcm63xx_regs_set {
|
||||
#define RSET_ENETDMA_SIZE 2048
|
||||
#define RSET_ENETSW_SIZE 65536
|
||||
#define RSET_UART_SIZE 24
|
||||
|
@ -27,7 +27,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#define RSET_UDC_SIZE 256
|
||||
#define RSET_OHCI_SIZE 256
|
||||
#define RSET_EHCI_SIZE 256
|
||||
@@ -186,6 +188,7 @@ enum bcm63xx_regs_set {
|
||||
@@ -201,6 +203,7 @@ enum bcm63xx_regs_set {
|
||||
#define BCM_6328_UART1_BASE (0xb0000120)
|
||||
#define BCM_6328_GPIO_BASE (0xb0000080)
|
||||
#define BCM_6328_SPI_BASE (0xdeadbeef)
|
||||
|
@ -35,7 +35,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#define BCM_6328_UDC0_BASE (0xdeadbeef)
|
||||
#define BCM_6328_USBDMA_BASE (0xb000c000)
|
||||
#define BCM_6328_OHCI0_BASE (0xb0002600)
|
||||
@@ -232,6 +235,7 @@ enum bcm63xx_regs_set {
|
||||
@@ -247,6 +250,7 @@ enum bcm63xx_regs_set {
|
||||
#define BCM_6338_UART1_BASE (0xdeadbeef)
|
||||
#define BCM_6338_GPIO_BASE (0xfffe0400)
|
||||
#define BCM_6338_SPI_BASE (0xfffe0c00)
|
||||
|
@ -43,7 +43,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#define BCM_6338_UDC0_BASE (0xdeadbeef)
|
||||
#define BCM_6338_USBDMA_BASE (0xfffe2400)
|
||||
#define BCM_6338_OHCI0_BASE (0xdeadbeef)
|
||||
@@ -279,6 +283,7 @@ enum bcm63xx_regs_set {
|
||||
@@ -294,6 +298,7 @@ enum bcm63xx_regs_set {
|
||||
#define BCM_6345_UART1_BASE (0xdeadbeef)
|
||||
#define BCM_6345_GPIO_BASE (0xfffe0400)
|
||||
#define BCM_6345_SPI_BASE (0xdeadbeef)
|
||||
|
@ -51,7 +51,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#define BCM_6345_UDC0_BASE (0xdeadbeef)
|
||||
#define BCM_6345_USBDMA_BASE (0xfffe2800)
|
||||
#define BCM_6345_ENET0_BASE (0xfffe1800)
|
||||
@@ -325,6 +330,7 @@ enum bcm63xx_regs_set {
|
||||
@@ -340,6 +345,7 @@ enum bcm63xx_regs_set {
|
||||
#define BCM_6348_UART1_BASE (0xdeadbeef)
|
||||
#define BCM_6348_GPIO_BASE (0xfffe0400)
|
||||
#define BCM_6348_SPI_BASE (0xfffe0c00)
|
||||
|
@ -59,7 +59,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#define BCM_6348_UDC0_BASE (0xfffe1000)
|
||||
#define BCM_6348_USBDMA_BASE (0xdeadbeef)
|
||||
#define BCM_6348_OHCI0_BASE (0xfffe1b00)
|
||||
@@ -370,6 +376,7 @@ enum bcm63xx_regs_set {
|
||||
@@ -385,6 +391,7 @@ enum bcm63xx_regs_set {
|
||||
#define BCM_6358_UART1_BASE (0xfffe0120)
|
||||
#define BCM_6358_GPIO_BASE (0xfffe0080)
|
||||
#define BCM_6358_SPI_BASE (0xfffe0800)
|
||||
|
@ -67,7 +67,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#define BCM_6358_UDC0_BASE (0xfffe0800)
|
||||
#define BCM_6358_USBDMA_BASE (0xdeadbeef)
|
||||
#define BCM_6358_OHCI0_BASE (0xfffe1400)
|
||||
@@ -416,6 +423,7 @@ enum bcm63xx_regs_set {
|
||||
@@ -487,6 +494,7 @@ enum bcm63xx_regs_set {
|
||||
#define BCM_6368_UART1_BASE (0xb0000120)
|
||||
#define BCM_6368_GPIO_BASE (0xb0000080)
|
||||
#define BCM_6368_SPI_BASE (0xb0000800)
|
||||
|
@ -75,7 +75,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#define BCM_6368_UDC0_BASE (0xdeadbeef)
|
||||
#define BCM_6368_USBDMA_BASE (0xb0004800)
|
||||
#define BCM_6368_OHCI0_BASE (0xb0001600)
|
||||
@@ -467,6 +475,7 @@ extern const unsigned long *bcm63xx_regs
|
||||
@@ -538,6 +546,7 @@ extern const unsigned long *bcm63xx_regs
|
||||
__GEN_RSET_BASE(__cpu, UART1) \
|
||||
__GEN_RSET_BASE(__cpu, GPIO) \
|
||||
__GEN_RSET_BASE(__cpu, SPI) \
|
||||
|
@ -83,7 +83,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
__GEN_RSET_BASE(__cpu, UDC0) \
|
||||
__GEN_RSET_BASE(__cpu, OHCI0) \
|
||||
__GEN_RSET_BASE(__cpu, OHCI_PRIV) \
|
||||
@@ -510,6 +519,7 @@ extern const unsigned long *bcm63xx_regs
|
||||
@@ -581,6 +590,7 @@ extern const unsigned long *bcm63xx_regs
|
||||
[RSET_UART1] = BCM_## __cpu ##_UART1_BASE, \
|
||||
[RSET_GPIO] = BCM_## __cpu ##_GPIO_BASE, \
|
||||
[RSET_SPI] = BCM_## __cpu ##_SPI_BASE, \
|
||||
|
@ -91,7 +91,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
[RSET_UDC0] = BCM_## __cpu ##_UDC0_BASE, \
|
||||
[RSET_OHCI0] = BCM_## __cpu ##_OHCI0_BASE, \
|
||||
[RSET_OHCI_PRIV] = BCM_## __cpu ##_OHCI_PRIV_BASE, \
|
||||
@@ -584,6 +594,7 @@ enum bcm63xx_irq {
|
||||
@@ -658,6 +668,7 @@ enum bcm63xx_irq {
|
||||
IRQ_ENET0,
|
||||
IRQ_ENET1,
|
||||
IRQ_ENET_PHY,
|
||||
|
@ -99,7 +99,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
IRQ_OHCI0,
|
||||
IRQ_EHCI0,
|
||||
IRQ_USBD,
|
||||
@@ -626,6 +637,7 @@ enum bcm63xx_irq {
|
||||
@@ -700,6 +711,7 @@ enum bcm63xx_irq {
|
||||
#define BCM_6328_ENET0_IRQ 0
|
||||
#define BCM_6328_ENET1_IRQ 0
|
||||
#define BCM_6328_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12)
|
||||
|
@ -107,7 +107,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#define BCM_6328_OHCI0_IRQ (BCM_6328_HIGH_IRQ_BASE + 9)
|
||||
#define BCM_6328_EHCI0_IRQ (BCM_6328_HIGH_IRQ_BASE + 10)
|
||||
#define BCM_6328_USBD_IRQ (IRQ_INTERNAL_BASE + 4)
|
||||
@@ -671,6 +683,7 @@ enum bcm63xx_irq {
|
||||
@@ -745,6 +757,7 @@ enum bcm63xx_irq {
|
||||
#define BCM_6338_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
|
||||
#define BCM_6338_ENET1_IRQ 0
|
||||
#define BCM_6338_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
|
||||
|
@ -115,7 +115,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#define BCM_6338_OHCI0_IRQ 0
|
||||
#define BCM_6338_EHCI0_IRQ 0
|
||||
#define BCM_6338_USBD_IRQ 0
|
||||
@@ -709,6 +722,7 @@ enum bcm63xx_irq {
|
||||
@@ -783,6 +796,7 @@ enum bcm63xx_irq {
|
||||
#define BCM_6345_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
|
||||
#define BCM_6345_ENET1_IRQ 0
|
||||
#define BCM_6345_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12)
|
||||
|
@ -123,7 +123,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#define BCM_6345_OHCI0_IRQ 0
|
||||
#define BCM_6345_EHCI0_IRQ 0
|
||||
#define BCM_6345_USBD_IRQ 0
|
||||
@@ -747,6 +761,7 @@ enum bcm63xx_irq {
|
||||
@@ -821,6 +835,7 @@ enum bcm63xx_irq {
|
||||
#define BCM_6348_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
|
||||
#define BCM_6348_ENET1_IRQ (IRQ_INTERNAL_BASE + 7)
|
||||
#define BCM_6348_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
|
||||
|
@ -131,7 +131,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#define BCM_6348_OHCI0_IRQ (IRQ_INTERNAL_BASE + 12)
|
||||
#define BCM_6348_EHCI0_IRQ 0
|
||||
#define BCM_6348_USBD_IRQ 0
|
||||
@@ -785,6 +800,7 @@ enum bcm63xx_irq {
|
||||
@@ -859,6 +874,7 @@ enum bcm63xx_irq {
|
||||
#define BCM_6358_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
|
||||
#define BCM_6358_ENET1_IRQ (IRQ_INTERNAL_BASE + 6)
|
||||
#define BCM_6358_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
|
||||
|
@ -139,7 +139,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#define BCM_6358_OHCI0_IRQ (IRQ_INTERNAL_BASE + 5)
|
||||
#define BCM_6358_EHCI0_IRQ (IRQ_INTERNAL_BASE + 10)
|
||||
#define BCM_6358_USBD_IRQ 0
|
||||
@@ -832,6 +848,7 @@ enum bcm63xx_irq {
|
||||
@@ -971,6 +987,7 @@ enum bcm63xx_irq {
|
||||
#define BCM_6368_ENET0_IRQ 0
|
||||
#define BCM_6368_ENET1_IRQ 0
|
||||
#define BCM_6368_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 15)
|
||||
|
@ -147,7 +147,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
#define BCM_6368_OHCI0_IRQ (IRQ_INTERNAL_BASE + 5)
|
||||
#define BCM_6368_EHCI0_IRQ (IRQ_INTERNAL_BASE + 7)
|
||||
#define BCM_6368_USBD_IRQ (IRQ_INTERNAL_BASE + 8)
|
||||
@@ -879,6 +896,7 @@ extern const int *bcm63xx_irqs;
|
||||
@@ -1018,6 +1035,7 @@ extern const int *bcm63xx_irqs;
|
||||
[IRQ_ENET0] = BCM_## __cpu ##_ENET0_IRQ, \
|
||||
[IRQ_ENET1] = BCM_## __cpu ##_ENET1_IRQ, \
|
||||
[IRQ_ENET_PHY] = BCM_## __cpu ##_ENET_PHY_IRQ, \
|
||||
|
@ -157,7 +157,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
[IRQ_USBD] = BCM_## __cpu ##_USBD_IRQ, \
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
|
||||
@@ -1409,4 +1409,51 @@
|
||||
@@ -1434,4 +1434,51 @@
|
||||
|
||||
#define PCIE_DEVICE_OFFSET 0x8000
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
|
||||
--- a/drivers/mtd/bcm63xxpart.c
|
||||
+++ b/drivers/mtd/bcm63xxpart.c
|
||||
@@ -54,10 +54,10 @@ static int bcm63xx_detect_cfe(struct mtd
|
||||
@@ -56,10 +56,10 @@ static int bcm63xx_detect_cfe(struct mtd
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
/* 240-255: Unused at present */
|
||||
--- a/drivers/mtd/bcm63xxpart.c
|
||||
+++ b/drivers/mtd/bcm63xxpart.c
|
||||
@@ -131,7 +131,8 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
@@ -134,7 +134,8 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
} else {
|
||||
/* OpenWrt layout */
|
||||
rootfsaddr = kerneladdr + kernellen;
|
|
@ -100,7 +100,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
return 0;
|
||||
}
|
||||
|
||||
@@ -1714,6 +1673,8 @@ static int bcm_enet_probe(struct platfor
|
||||
@@ -1708,6 +1667,8 @@ static int bcm_enet_probe(struct platfor
|
||||
|
||||
/* MII bus registration */
|
||||
if (priv->has_phy) {
|
||||
|
@ -109,7 +109,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
|
||||
priv->mii_bus = mdiobus_alloc();
|
||||
if (!priv->mii_bus) {
|
||||
@@ -1750,6 +1711,38 @@ static int bcm_enet_probe(struct platfor
|
||||
@@ -1745,6 +1706,38 @@ static int bcm_enet_probe(struct platfor
|
||||
dev_err(&pdev->dev, "unable to register mdio bus\n");
|
||||
goto out_free_mdio;
|
||||
}
|
||||
|
@ -148,22 +148,22 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
} else {
|
||||
|
||||
/* run platform code to initialize PHY device */
|
||||
@@ -1795,6 +1788,9 @@ static int bcm_enet_probe(struct platfor
|
||||
@@ -1790,6 +1783,9 @@ static int bcm_enet_probe(struct platfor
|
||||
return 0;
|
||||
|
||||
out_unregister_mdio:
|
||||
+ if (priv->phydev)
|
||||
+ phy_disconnect(priv->phydev);
|
||||
+
|
||||
if (priv->mii_bus) {
|
||||
if (priv->mii_bus)
|
||||
mdiobus_unregister(priv->mii_bus);
|
||||
kfree(priv->mii_bus->irq);
|
||||
@@ -1845,6 +1841,8 @@ static int bcm_enet_remove(struct platfo
|
||||
|
||||
@@ -1831,6 +1827,8 @@ static int bcm_enet_remove(struct platfo
|
||||
enet_writel(priv, 0, ENET_MIISC_REG);
|
||||
|
||||
if (priv->has_phy) {
|
||||
+ phy_disconnect(priv->phydev);
|
||||
+ priv->phydev = NULL;
|
||||
mdiobus_unregister(priv->mii_bus);
|
||||
kfree(priv->mii_bus->irq);
|
||||
mdiobus_free(priv->mii_bus);
|
||||
} else {
|
|
@ -1,13 +1,13 @@
|
|||
From 305579c1f946ed1aa6c125252ace21c53d47c11d Mon Sep 17 00:00:00 2001
|
||||
From 2e5b0197443fcb454ca88619e36bb33d7a79e3ea Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Bizon <mbizon@freebox.fr>
|
||||
Date: Thu, 21 Jan 2010 17:50:54 +0100
|
||||
Subject: [PATCH 30/63] bcm63xx_enet: split dma registers access.
|
||||
Subject: [PATCH] bcm63xx_enet: split dma registers access.
|
||||
|
||||
---
|
||||
arch/mips/bcm63xx/dev-enet.c | 23 +++-
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 4 +-
|
||||
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 179 ++++++++++++++--------
|
||||
3 files changed, 138 insertions(+), 68 deletions(-)
|
||||
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 144 +++++++++++++---------
|
||||
3 files changed, 111 insertions(+), 62 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/dev-enet.c
|
||||
+++ b/arch/mips/bcm63xx/dev-enet.c
|
||||
|
@ -304,78 +304,34 @@ Subject: [PATCH 30/63] bcm63xx_enet: split dma registers access.
|
|||
return -ENODEV;
|
||||
|
||||
res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
@@ -1904,30 +1926,61 @@ struct platform_driver bcm63xx_enet_driv
|
||||
@@ -1883,14 +1905,24 @@ struct platform_driver bcm63xx_enet_driv
|
||||
static int bcm_enet_shared_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct resource *res;
|
||||
+ int ret, i, requested[3];
|
||||
+ void __iomem *p[3];
|
||||
+ unsigned int i;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- if (!res)
|
||||
- return -ENODEV;
|
||||
+ memset(bcm_enet_shared_base, 0, sizeof (bcm_enet_shared_base));
|
||||
+ memset(requested, 0, sizeof (requested));
|
||||
+ memset(bcm_enet_shared_base, 0, sizeof(bcm_enet_shared_base));
|
||||
|
||||
- if (!request_mem_region(res->start, resource_size(res),
|
||||
- "bcm63xx_enet_dma"))
|
||||
- return -EBUSY;
|
||||
+ for (i = 0; i < 3; i++) {
|
||||
+ void __iomem *p;
|
||||
|
||||
- bcm_enet_shared_base = ioremap(res->start, resource_size(res));
|
||||
- if (!bcm_enet_shared_base) {
|
||||
- release_mem_region(res->start, resource_size(res));
|
||||
- bcm_enet_shared_base = devm_request_and_ioremap(&pdev->dev, res);
|
||||
- if (!bcm_enet_shared_base)
|
||||
- return -ENOMEM;
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, i);
|
||||
+ if (!res) {
|
||||
+ ret = -EINVAL;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ if (!request_mem_region(res->start, resource_size(res),
|
||||
+ "bcm63xx_enet_dma")) {
|
||||
+ ret = -EBUSY;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ requested[i] = 0;
|
||||
+
|
||||
+ p = ioremap(res->start, resource_size(res));
|
||||
+ if (!p) {
|
||||
+ ret = -ENOMEM;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ bcm_enet_shared_base[i] = p;
|
||||
}
|
||||
+
|
||||
return 0;
|
||||
+
|
||||
+fail:
|
||||
+ for (i = 0; i < 3; i++) {
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, i);
|
||||
+ if (!res)
|
||||
+ continue;
|
||||
+ if (bcm_enet_shared_base[i])
|
||||
+ iounmap(bcm_enet_shared_base[i]);
|
||||
+ if (requested[i])
|
||||
+ release_mem_region(res->start, resource_size(res));
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ p[i] = devm_request_and_ioremap(&pdev->dev, res);
|
||||
+ if (!p[i])
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ bcm_enet_shared_base[i] = p;
|
||||
+ }
|
||||
+ return ret;
|
||||
}
|
||||
+
|
||||
+ memcpy(bcm_enet_shared_base, p, sizeof(bcm_enet_shared_base));
|
||||
|
||||
static int bcm_enet_shared_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct resource *res;
|
||||
+ int i;
|
||||
|
||||
- iounmap(bcm_enet_shared_base);
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- release_mem_region(res->start, resource_size(res));
|
||||
+ for (i = 0; i < 3; i++) {
|
||||
+ iounmap(bcm_enet_shared_base[i]);
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, i);
|
||||
+ release_mem_region(res->start, resource_size(res));
|
||||
+ }
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,47 +1,33 @@
|
|||
From 1324bb5db6815d19b09c1b7bcac3cc2804412205 Mon Sep 17 00:00:00 2001
|
||||
From d16c1a1410f6c35a835baaa445774b4421db6c96 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Bizon <mbizon@freebox.fr>
|
||||
Date: Sat, 23 Jan 2010 03:01:02 +0100
|
||||
Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet switch.
|
||||
Subject: [PATCH 8/8] bcm63xx_enet: add support for bcm6368 internal ethernet
|
||||
switch.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
---
|
||||
arch/mips/bcm63xx/dev-enet.c | 106 ++-
|
||||
.../include/asm/mach-bcm63xx/bcm63xx_dev_enet.h | 25 +
|
||||
arch/mips/bcm63xx/boards/board_bcm963xx.c | 4 +
|
||||
arch/mips/bcm63xx/dev-enet.c | 113 ++-
|
||||
.../include/asm/mach-bcm63xx/bcm63xx_dev_enet.h | 28 +
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 50 +
|
||||
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 1054 ++++++++++++++++++--
|
||||
drivers/net/ethernet/broadcom/bcm63xx_enet.h | 71 ++
|
||||
5 files changed, 1221 insertions(+), 85 deletions(-)
|
||||
.../mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 2 +
|
||||
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 1018 +++++++++++++++++++-
|
||||
drivers/net/ethernet/broadcom/bcm63xx_enet.h | 75 ++
|
||||
8 files changed, 1239 insertions(+), 66 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -927,6 +927,10 @@ int __init board_register_devices(void)
|
||||
if (board.has_usbd)
|
||||
bcm63xx_usbd_register(&board.usbd);
|
||||
@@ -924,6 +924,10 @@ int __init board_register_devices(void)
|
||||
!bcm63xx_nvram_get_mac_address(board.enet1.mac_addr))
|
||||
bcm63xx_enet_register(1, &board.enet1);
|
||||
|
||||
+ if (board.has_enetsw &&
|
||||
+ !bcm63xx_nvram_get_mac_address(board.enetsw.mac_addr))
|
||||
+ bcm63xx_enetsw_register(&board.enetsw);
|
||||
+
|
||||
if (board.has_ehci0)
|
||||
bcm63xx_ehci_register();
|
||||
if (board.has_usbd)
|
||||
bcm63xx_usbd_register(&board.usbd);
|
||||
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
|
||||
@@ -25,6 +25,7 @@ struct board_info {
|
||||
/* enabled feature/device */
|
||||
unsigned int has_enet0:1;
|
||||
unsigned int has_enet1:1;
|
||||
+ unsigned int has_enetsw:1;
|
||||
unsigned int has_pci:1;
|
||||
unsigned int has_pccard:1;
|
||||
unsigned int has_ohci0:1;
|
||||
@@ -37,6 +38,7 @@ struct board_info {
|
||||
/* ethernet config */
|
||||
struct bcm63xx_enet_platform_data enet0;
|
||||
struct bcm63xx_enet_platform_data enet1;
|
||||
+ struct bcm63xx_enetsw_platform_data enetsw;
|
||||
|
||||
/* USB config */
|
||||
struct bcm63xx_usbd_platform_data usbd;
|
||||
--- a/arch/mips/bcm63xx/dev-enet.c
|
||||
+++ b/arch/mips/bcm63xx/dev-enet.c
|
||||
@@ -104,6 +104,64 @@ static struct platform_device bcm63xx_en
|
||||
|
@ -85,7 +71,7 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ shared_res[0].end = shared_res[0].start;
|
||||
+ shared_res[0].end += (RSET_ENETDMA_SIZE) - 1;
|
||||
+
|
||||
+ if (BCMCPU_IS_6368())
|
||||
+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368())
|
||||
+ chan_count = 32;
|
||||
+ else
|
||||
+ chan_count = 16;
|
||||
|
@ -137,7 +123,7 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
|
||||
if (unit == 0) {
|
||||
enet0_res[0].start = bcm63xx_regset_address(RSET_ENET0);
|
||||
@@ -175,3 +218,30 @@ int __init bcm63xx_enet_register(int uni
|
||||
@@ -175,3 +218,37 @@ int __init bcm63xx_enet_register(int uni
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
@ -147,7 +133,7 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!BCMCPU_IS_6368())
|
||||
+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368())
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ ret = register_shared();
|
||||
|
@ -159,8 +145,15 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ 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));
|
||||
+ memcpy(bcm63xx_enetsw_device.dev.platform_data, pd, sizeof(*pd));
|
||||
+
|
||||
+ if (BCMCPU_IS_6328())
|
||||
+ enetsw_pd.num_ports = ENETSW_PORTS_6328;
|
||||
+ else if (BCMCPU_IS_6362() || BCMCPU_IS_6368())
|
||||
+ enetsw_pd.num_ports = ENETSW_PORTS_6368;
|
||||
+
|
||||
+ ret = platform_device_register(&bcm63xx_enetsw_device);
|
||||
+ if (ret)
|
||||
|
@ -170,18 +163,21 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+}
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
|
||||
@@ -39,7 +39,32 @@ struct bcm63xx_enet_platform_data {
|
||||
@@ -39,7 +39,35 @@ struct bcm63xx_enet_platform_data {
|
||||
int phy_id, int reg, int val));
|
||||
};
|
||||
|
||||
+/*
|
||||
+ * on board ethernet switch platform data
|
||||
+ */
|
||||
+#define ENETSW_MAX_PORT 6
|
||||
+#define ENETSW_MAX_PORT 8
|
||||
+#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
|
||||
+
|
||||
+struct bcm63xx_enetsw_port {
|
||||
+ int used;
|
||||
+ int external_phy;
|
||||
+ int phy_id;
|
||||
+
|
||||
+ int bypass_link;
|
||||
|
@ -193,14 +189,14 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+
|
||||
+struct bcm63xx_enetsw_platform_data {
|
||||
+ char mac_addr[ETH_ALEN];
|
||||
+ int num_ports;
|
||||
+ struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT];
|
||||
+};
|
||||
+
|
||||
int __init bcm63xx_enet_register(int unit,
|
||||
const struct bcm63xx_enet_platform_data *pd);
|
||||
|
||||
+int __init
|
||||
+bcm63xx_enetsw_register(const struct bcm63xx_enetsw_platform_data *pd);
|
||||
+int bcm63xx_enetsw_register(const struct bcm63xx_enetsw_platform_data *pd);
|
||||
+
|
||||
#endif /* ! BCM63XX_DEV_ENET_H_ */
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
|
||||
|
@ -266,6 +262,24 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
|
||||
/*************************************************************************
|
||||
* _REG relative to RSET_OHCI_PRIV
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
|
||||
@@ -25,6 +25,7 @@ struct board_info {
|
||||
/* enabled feature/device */
|
||||
unsigned int has_enet0:1;
|
||||
unsigned int has_enet1:1;
|
||||
+ unsigned int has_enetsw:1;
|
||||
unsigned int has_pci:1;
|
||||
unsigned int has_pccard:1;
|
||||
unsigned int has_ohci0:1;
|
||||
@@ -37,6 +38,7 @@ struct board_info {
|
||||
/* ethernet config */
|
||||
struct bcm63xx_enet_platform_data enet0;
|
||||
struct bcm63xx_enet_platform_data enet1;
|
||||
+ struct bcm63xx_enetsw_platform_data enetsw;
|
||||
|
||||
/* USB config */
|
||||
struct bcm63xx_usbd_platform_data usbd;
|
||||
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
@@ -59,6 +59,49 @@ static inline void enet_writel(struct bc
|
||||
|
@ -318,22 +332,30 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
* io helpers to access shared registers
|
||||
*/
|
||||
static inline u32 enet_dma_readl(struct bcm_enet_priv *priv, u32 off)
|
||||
@@ -321,7 +364,8 @@ static int bcm_enet_receive_queue(struct
|
||||
@@ -218,7 +261,6 @@ static int bcm_enet_refill_rx(struct net
|
||||
if (!skb)
|
||||
break;
|
||||
priv->rx_skb[desc_idx] = skb;
|
||||
-
|
||||
p = dma_map_single(&priv->pdev->dev, skb->data,
|
||||
priv->rx_skb_size,
|
||||
DMA_FROM_DEVICE);
|
||||
@@ -321,7 +363,8 @@ static int bcm_enet_receive_queue(struct
|
||||
}
|
||||
|
||||
/* recycle packet if it's marked as bad */
|
||||
- if (unlikely(len_stat & DMADESC_ERR_MASK)) {
|
||||
+ if (!bcm_enet_is_sw(priv) &&
|
||||
+ if (!priv->enet_is_sw &&
|
||||
+ unlikely(len_stat & DMADESC_ERR_MASK)) {
|
||||
dev->stats.rx_errors++;
|
||||
|
||||
if (len_stat & DMADESC_OVSIZE_MASK)
|
||||
@@ -552,6 +596,26 @@ static int bcm_enet_start_xmit(struct sk
|
||||
@@ -552,6 +595,26 @@ static int bcm_enet_start_xmit(struct sk
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
+ /* 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;
|
||||
+
|
||||
|
@ -355,7 +377,38 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
/* point to the next available desc */
|
||||
desc = &priv->tx_desc_cpu[priv->tx_curr_desc];
|
||||
priv->tx_skb[priv->tx_curr_desc] = skb;
|
||||
@@ -1921,96 +1985,951 @@ struct platform_driver bcm63xx_enet_driv
|
||||
@@ -931,9 +994,9 @@ static int bcm_enet_open(struct net_devi
|
||||
enet_writel(priv, priv->hw_mtu, ENET_TXMAXLEN_REG);
|
||||
|
||||
/* set dma maximum burst len */
|
||||
- enet_dmac_writel(priv, BCMENET_DMA_MAXBURST,
|
||||
+ enet_dmac_writel(priv, priv->dma_maxburst,
|
||||
ENETDMAC_MAXBURST_REG(priv->rx_chan));
|
||||
- enet_dmac_writel(priv, BCMENET_DMA_MAXBURST,
|
||||
+ enet_dmac_writel(priv, priv->dma_maxburst,
|
||||
ENETDMAC_MAXBURST_REG(priv->tx_chan));
|
||||
|
||||
/* set correct transmit fifo watermark */
|
||||
@@ -1529,7 +1592,7 @@ static int compute_hw_mtu(struct bcm_ene
|
||||
* it's appended
|
||||
*/
|
||||
priv->rx_skb_size = ALIGN(actual_mtu + ETH_FCS_LEN,
|
||||
- BCMENET_DMA_MAXBURST * 4);
|
||||
+ priv->dma_maxburst * 4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1636,6 +1699,9 @@ static int bcm_enet_probe(struct platfor
|
||||
return -ENOMEM;
|
||||
priv = netdev_priv(dev);
|
||||
|
||||
+ priv->enet_is_sw = false;
|
||||
+ priv->dma_maxburst = BCMENET_DMA_MAXBURST;
|
||||
+
|
||||
ret = compute_hw_mtu(priv, dev->mtu);
|
||||
if (ret)
|
||||
goto out;
|
||||
@@ -1900,65 +1966,928 @@ struct platform_driver bcm63xx_enet_driv
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -367,17 +420,19 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ int ext, int phy_id, int location)
|
||||
{
|
||||
- struct resource *res;
|
||||
- int ret, i, requested[3];
|
||||
- void __iomem *p[3];
|
||||
- unsigned int i;
|
||||
+ u32 reg;
|
||||
+ int ret;
|
||||
|
||||
- memset(bcm_enet_shared_base, 0, sizeof (bcm_enet_shared_base));
|
||||
- memset(requested, 0, sizeof (requested));
|
||||
- memset(bcm_enet_shared_base, 0, sizeof(bcm_enet_shared_base));
|
||||
+ spin_lock_bh(&priv->enetsw_mdio_lock);
|
||||
+ enetsw_writel(priv, 0, ENETSW_MDIOC_REG);
|
||||
|
||||
- for (i = 0; i < 3; i++) {
|
||||
- void __iomem *p;
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, i);
|
||||
- if (!res)
|
||||
- return -EINVAL;
|
||||
+ reg = ENETSW_MDIOC_RD_MASK |
|
||||
+ (phy_id << ENETSW_MDIOC_PHYID_SHIFT) |
|
||||
+ (location << ENETSW_MDIOC_REG_SHIFT);
|
||||
|
@ -392,77 +447,62 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ return ret;
|
||||
+}
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, i);
|
||||
- if (!res) {
|
||||
- ret = -EINVAL;
|
||||
- goto fail;
|
||||
- }
|
||||
- p[i] = devm_request_and_ioremap(&pdev->dev, res);
|
||||
- if (!p[i])
|
||||
- return -ENOMEM;
|
||||
+static void bcmenet_sw_mdio_write(struct bcm_enet_priv *priv,
|
||||
+ int ext, int phy_id, int location,
|
||||
+ uint16_t data)
|
||||
+{
|
||||
+ u32 reg;
|
||||
|
||||
- if (!request_mem_region(res->start, resource_size(res),
|
||||
- "bcm63xx_enet_dma")) {
|
||||
- ret = -EBUSY;
|
||||
- goto fail;
|
||||
- }
|
||||
- requested[i] = 0;
|
||||
- bcm_enet_shared_base[i] = p;
|
||||
- }
|
||||
+ spin_lock_bh(&priv->enetsw_mdio_lock);
|
||||
+ enetsw_writel(priv, 0, ENETSW_MDIOC_REG);
|
||||
|
||||
- p = ioremap(res->start, resource_size(res));
|
||||
- if (!p) {
|
||||
- ret = -ENOMEM;
|
||||
- goto fail;
|
||||
- }
|
||||
- memcpy(bcm_enet_shared_base, p, sizeof(bcm_enet_shared_base));
|
||||
+ reg = ENETSW_MDIOC_WR_MASK |
|
||||
+ (phy_id << ENETSW_MDIOC_PHYID_SHIFT) |
|
||||
+ (location << ENETSW_MDIOC_REG_SHIFT);
|
||||
|
||||
- bcm_enet_shared_base[i] = p;
|
||||
- }
|
||||
- return 0;
|
||||
-}
|
||||
+ if (ext)
|
||||
+ reg |= ENETSW_MDIOC_EXT_MASK;
|
||||
|
||||
-static int bcm_enet_shared_remove(struct platform_device *pdev)
|
||||
-{
|
||||
- return 0;
|
||||
+ reg |= data;
|
||||
|
||||
-fail:
|
||||
- for (i = 0; i < 3; i++) {
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, i);
|
||||
- if (!res)
|
||||
- continue;
|
||||
- if (bcm_enet_shared_base[i])
|
||||
- iounmap(bcm_enet_shared_base[i]);
|
||||
- if (requested[i])
|
||||
- release_mem_region(res->start, resource_size(res));
|
||||
- }
|
||||
- return ret;
|
||||
+
|
||||
+ enetsw_writel(priv, reg, ENETSW_MDIOC_REG);
|
||||
+ udelay(50);
|
||||
+ spin_unlock_bh(&priv->enetsw_mdio_lock);
|
||||
}
|
||||
|
||||
-static int bcm_enet_shared_remove(struct platform_device *pdev)
|
||||
+/*
|
||||
/*
|
||||
- * this "shared" driver is needed because both macs share a single
|
||||
- * address space
|
||||
+ * enet sw PHY polling
|
||||
+ */
|
||||
*/
|
||||
-struct platform_driver bcm63xx_enet_shared_driver = {
|
||||
- .probe = bcm_enet_shared_probe,
|
||||
- .remove = bcm_enet_shared_remove,
|
||||
- .driver = {
|
||||
- .name = "bcm63xx_enet_shared",
|
||||
- .owner = THIS_MODULE,
|
||||
- },
|
||||
-};
|
||||
+static void swphy_poll_timer(unsigned long data)
|
||||
{
|
||||
- struct resource *res;
|
||||
- int i;
|
||||
+{
|
||||
+ struct bcm_enet_priv *priv = (struct bcm_enet_priv *)data;
|
||||
+ unsigned int i;
|
||||
|
||||
- for (i = 0; i < 3; i++) {
|
||||
- iounmap(bcm_enet_shared_base[i]);
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, i);
|
||||
- release_mem_region(res->start, resource_size(res));
|
||||
+ 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;
|
||||
+ int external_phy = bcm_enet_port_is_rgmii(i);
|
||||
+ u8 override;
|
||||
+
|
||||
+ port = &priv->used_ports[i];
|
||||
|
@ -474,7 +514,7 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+
|
||||
+ /* 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)
|
||||
|
@ -498,14 +538,14 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ 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);
|
||||
|
@ -538,22 +578,8 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+
|
||||
+ enetsw_writeb(priv, override, ENETSW_PORTOV_REG(i));
|
||||
+ enetsw_writeb(priv, 0, ENETSW_PTCTRL_REG(i));
|
||||
}
|
||||
- return 0;
|
||||
-}
|
||||
|
||||
-/*
|
||||
- * this "shared" driver is needed because both macs share a single
|
||||
- * address space
|
||||
- */
|
||||
-struct platform_driver bcm63xx_enet_shared_driver = {
|
||||
- .probe = bcm_enet_shared_probe,
|
||||
- .remove = bcm_enet_shared_remove,
|
||||
- .driver = {
|
||||
- .name = "bcm63xx_enet_shared",
|
||||
- .owner = THIS_MODULE,
|
||||
- },
|
||||
-};
|
||||
+ }
|
||||
+
|
||||
+ priv->swphy_poll.expires = jiffies + HZ;
|
||||
+ add_timer(&priv->swphy_poll);
|
||||
+}
|
||||
|
@ -574,25 +600,28 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ u32 val;
|
||||
|
||||
- ret = platform_driver_register(&bcm63xx_enet_shared_driver);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
+ priv = netdev_priv(dev);
|
||||
+ kdev = &priv->pdev->dev;
|
||||
+
|
||||
|
||||
- ret = platform_driver_register(&bcm63xx_enet_driver);
|
||||
+ /* mask all interrupts and request them */
|
||||
+ enet_dmac_writel(priv, 0, ENETDMAC_IRMASK_REG(priv->rx_chan));
|
||||
+ enet_dmac_writel(priv, 0, ENETDMAC_IRMASK_REG(priv->tx_chan));
|
||||
+
|
||||
+ ret = request_irq(priv->irq_rx, bcm_enet_isr_dma,
|
||||
+ IRQF_DISABLED, dev->name, dev);
|
||||
if (ret)
|
||||
- return ret;
|
||||
+ goto out_freeirq;
|
||||
|
||||
- ret = platform_driver_register(&bcm63xx_enet_driver);
|
||||
+ ret = request_irq(priv->irq_tx, bcm_enet_isr_dma,
|
||||
+ IRQF_DISABLED, dev->name, dev);
|
||||
if (ret)
|
||||
- platform_driver_unregister(&bcm63xx_enet_shared_driver);
|
||||
+ goto out_freeirq_rx;
|
||||
+ goto out_freeirq;
|
||||
+
|
||||
+ 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);
|
||||
|
@ -647,12 +676,14 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ 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 |
|
||||
+ ENETSW_PTCTRL_TXDIS_MASK,
|
||||
+ ENETSW_PTCTRL_REG(i));
|
||||
+
|
||||
+ priv->sw_port_link[i] = 0;
|
||||
+ }
|
||||
+
|
||||
+ /* reset mib */
|
||||
|
@ -703,9 +734,9 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ enet_dmas_writel(priv, 0, ENETDMAS_SRAM4_REG(priv->tx_chan));
|
||||
+
|
||||
+ /* set dma maximum burst len */
|
||||
+ enet_dmac_writel(priv, BCMENET_DMA_MAXBURST,
|
||||
+ enet_dmac_writel(priv, priv->dma_maxburst,
|
||||
+ ENETDMAC_MAXBURST_REG(priv->rx_chan));
|
||||
+ enet_dmac_writel(priv, BCMENET_DMA_MAXBURST,
|
||||
+ enet_dmac_writel(priv, priv->dma_maxburst,
|
||||
+ ENETDMAC_MAXBURST_REG(priv->tx_chan));
|
||||
+
|
||||
+ /* set flow control low/high threshold to 1/3 / 2/3 */
|
||||
|
@ -741,7 +772,7 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ /*
|
||||
+ * 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];
|
||||
|
@ -764,14 +795,13 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ case 10:
|
||||
+ break;
|
||||
+ default:
|
||||
+ printk(KERN_WARNING "invalid forced speed on port %s: "
|
||||
+ "assume 10\n",
|
||||
+ printk(KERN_WARNING "invalid forced speed on port %s: assume 10\n",
|
||||
+ port->name);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (port->force_duplex_full)
|
||||
+ override = ENETSW_IMPOV_FDX_MASK;
|
||||
+ override |= ENETSW_IMPOV_FDX_MASK;
|
||||
+
|
||||
+
|
||||
+ enetsw_writeb(priv, override, ENETSW_PORTOV_REG(i));
|
||||
|
@ -812,7 +842,8 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ 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);
|
||||
|
@ -869,7 +900,8 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ 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;
|
||||
|
@ -885,15 +917,15 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+{
|
||||
+ 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)
|
||||
+ 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 "
|
||||
+ "with phy_id %i, assuming phy is external\n", phy_id);
|
||||
+ printk_once(KERN_WARNING "bcm63xx_enet: could not find a used port with phy_id %i, assuming phy is external\n",
|
||||
+ phy_id);
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
|
@ -1061,8 +1093,9 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ if (s->sizeof_stat == sizeof(u64)) {
|
||||
+ hi = enetsw_readl(priv, ENETSW_MIB_REG(reg + 1));
|
||||
+ *(u64 *)p = ((u64)hi << 32 | lo);
|
||||
+ } else
|
||||
+ } else {
|
||||
+ *(u32 *)p = lo;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < BCM_ENETSW_STATS_LEN; i++) {
|
||||
|
@ -1152,7 +1185,7 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ 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;
|
||||
|
@ -1163,16 +1196,19 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ 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;
|
||||
+ priv->tx_ring_size = BCMENET_DEF_TX_DESC;
|
||||
+ priv->dma_maxburst = BCMENETSW_DMA_MAXBURST;
|
||||
+
|
||||
+ pd = pdev->dev.platform_data;
|
||||
+ if (pd) {
|
||||
+ 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);
|
||||
|
@ -1279,61 +1315,28 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+static int bcm_enet_shared_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct resource *res;
|
||||
+ int ret, i, requested[3];
|
||||
+ void __iomem *p[3];
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ memset(bcm_enet_shared_base, 0, sizeof (bcm_enet_shared_base));
|
||||
+ memset(requested, 0, sizeof (requested));
|
||||
+ memset(bcm_enet_shared_base, 0, sizeof(bcm_enet_shared_base));
|
||||
+
|
||||
+ for (i = 0; i < 3; i++) {
|
||||
+ void __iomem *p;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, i);
|
||||
+ if (!res) {
|
||||
+ ret = -EINVAL;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ if (!request_mem_region(res->start, resource_size(res),
|
||||
+ "bcm63xx_enet_dma")) {
|
||||
+ ret = -EBUSY;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ requested[i] = 0;
|
||||
+
|
||||
+ p = ioremap(res->start, resource_size(res));
|
||||
+ if (!p) {
|
||||
+ ret = -ENOMEM;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ bcm_enet_shared_base[i] = p;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+fail:
|
||||
+ for (i = 0; i < 3; i++) {
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, i);
|
||||
+ if (!res)
|
||||
+ continue;
|
||||
+ if (bcm_enet_shared_base[i])
|
||||
+ iounmap(bcm_enet_shared_base[i]);
|
||||
+ if (requested[i])
|
||||
+ release_mem_region(res->start, resource_size(res));
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ p[i] = devm_request_and_ioremap(&pdev->dev, res);
|
||||
+ if (!p[i])
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+ return ret;
|
||||
+
|
||||
+ memcpy(bcm_enet_shared_base, p, sizeof(bcm_enet_shared_base));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int bcm_enet_shared_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct resource *res;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < 3; i++) {
|
||||
+ iounmap(bcm_enet_shared_base[i]);
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, i);
|
||||
+ release_mem_region(res->start, resource_size(res));
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
|
@ -1373,7 +1376,7 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
|
||||
return ret;
|
||||
}
|
||||
@@ -2018,6 +2937,7 @@ static int __init bcm_enet_init(void)
|
||||
@@ -1966,6 +2895,7 @@ static int __init bcm_enet_init(void)
|
||||
static void __exit bcm_enet_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&bcm63xx_enet_driver);
|
||||
|
@ -1383,7 +1386,15 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
|
||||
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h
|
||||
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h
|
||||
@@ -84,11 +84,60 @@
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
/* maximum burst len for dma (4 bytes unit) */
|
||||
#define BCMENET_DMA_MAXBURST 16
|
||||
+#define BCMENETSW_DMA_MAXBURST 8
|
||||
|
||||
/* tx transmit threshold (4 bytes unit), fifo is 256 bytes, the value
|
||||
* must be low enough so that a DMA transfer of above burst length can
|
||||
@@ -84,11 +85,60 @@
|
||||
#define ETH_MIB_RX_CNTRL 54
|
||||
|
||||
|
||||
|
@ -1444,7 +1455,7 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
u32 tx_brdcast;
|
||||
u32 tx_mult;
|
||||
u32 tx_64;
|
||||
@@ -97,7 +146,12 @@ struct bcm_enet_mib_counters {
|
||||
@@ -97,7 +147,12 @@ struct bcm_enet_mib_counters {
|
||||
u32 tx_256_511;
|
||||
u32 tx_512_1023;
|
||||
u32 tx_1024_max;
|
||||
|
@ -1457,7 +1468,7 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
u32 tx_ovr;
|
||||
u32 tx_frag;
|
||||
u32 tx_underrun;
|
||||
@@ -114,6 +168,7 @@ struct bcm_enet_mib_counters {
|
||||
@@ -114,6 +169,7 @@ struct bcm_enet_mib_counters {
|
||||
u32 rx_all_octets;
|
||||
u32 rx_all_pkts;
|
||||
u32 rx_brdcast;
|
||||
|
@ -1465,12 +1476,25 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
u32 rx_mult;
|
||||
u32 rx_64;
|
||||
u32 rx_65_127;
|
||||
@@ -269,6 +324,22 @@ struct bcm_enet_priv {
|
||||
@@ -197,6 +253,9 @@ struct bcm_enet_priv {
|
||||
/* number of dma desc in tx ring */
|
||||
int tx_ring_size;
|
||||
|
||||
+ /* maximum dma burst size */
|
||||
+ int dma_maxburst;
|
||||
+
|
||||
/* cpu view of rx dma ring */
|
||||
struct bcm_enet_desc *tx_desc_cpu;
|
||||
|
||||
@@ -269,6 +328,22 @@ 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];
|
||||
+ int sw_port_link[ENETSW_MAX_PORT];
|
||||
+
|
||||
|
@ -1479,12 +1503,9 @@ Subject: [PATCH 31/63] bcm63xx_enet: add support for bcm6368 internal ethernet s
|
|||
+ spinlock_t enetsw_mdio_lock;
|
||||
};
|
||||
|
||||
+static inline int bcm_enet_is_sw(struct bcm_enet_priv *priv)
|
||||
+static inline int bcm_enet_port_is_rgmii(int portid)
|
||||
+{
|
||||
+ if (BCMCPU_IS_6368())
|
||||
+ return 1;
|
||||
+ else
|
||||
+ return 0;
|
||||
+ return portid >= ENETSW_RGMII_PORT0;
|
||||
+}
|
||||
+
|
||||
#endif /* ! BCM63XX_ENET_H_ */
|
|
@ -32,7 +32,7 @@ Subject: [PATCH 54/81] bcm63xx_enet: enable rgmii clock on external ports
|
|||
#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
|
||||
@@ -2201,6 +2201,18 @@ static int bcm_enetsw_open(struct net_de
|
||||
priv->sw_port_link[i] = 0;
|
||||
}
|
||||
|
|
@ -47,7 +47,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/bcm63xx/dev-hsspi.c
|
||||
@@ -0,0 +1,57 @@
|
||||
@@ -0,0 +1,60 @@
|
||||
+/*
|
||||
+ * This file is subject to the terms and conditions of the GNU General Public
|
||||
+ * License. See the file "COPYING" in the main directory of this archive
|
||||
|
@ -93,7 +93,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
+int __init bcm63xx_hsspi_register(void)
|
||||
+{
|
||||
+
|
||||
+ if (!BCMCPU_IS_6328())
|
||||
+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362())
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI);
|
||||
|
@ -101,13 +101,16 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
+ spi_resources[0].end += RSET_HSSPI_SIZE - 1;
|
||||
+ spi_resources[1].start = bcm63xx_get_irq_number(IRQ_HSSPI);
|
||||
+
|
||||
+ spi_pdata.speed_hz = HSSPI_PLL_HZ_6328;
|
||||
+ if (BCMCPU_IS_6328())
|
||||
+ spi_pdata.speed_hz = HSSPI_PLL_HZ_6328;
|
||||
+ else if (BCMCPU_IS_6362())
|
||||
+ spi_pdata.speed_hz = HSSPI_PLL_HZ_6362;
|
||||
+
|
||||
+ return platform_device_register(&bcm63xx_hsspi_device);
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h
|
||||
@@ -0,0 +1,20 @@
|
||||
@@ -0,0 +1,21 @@
|
||||
+#ifndef BCM63XX_DEV_HSSPI_H
|
||||
+#define BCM63XX_DEV_HSSPI_H
|
||||
+
|
||||
|
@ -126,5 +129,6 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
+#define bcm_hsspi_writel(v, o) bcm_rset_writel(RSET_HSSPI, (v), (o))
|
||||
+
|
||||
+#define HSSPI_PLL_HZ_6328 133333333
|
||||
+#define HSSPI_PLL_HZ_6362 400000000
|
||||
+
|
||||
+#endif /* BCM63XX_DEV_HSSPI_H */
|
|
@ -16,9 +16,9 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h
|
||||
@@ -17,4 +17,6 @@ struct bcm63xx_hsspi_pdata {
|
||||
|
||||
@@ -18,4 +18,6 @@ struct bcm63xx_hsspi_pdata {
|
||||
#define HSSPI_PLL_HZ_6328 133333333
|
||||
#define HSSPI_PLL_HZ_6362 400000000
|
||||
|
||||
+#define HSSPI_BUFFER_LEN 512
|
||||
+
|
|
@ -58,8 +58,8 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
if (val & STRAPBUS_6328_BOOT_SEL_SERIAL)
|
||||
return BCM63XX_FLASH_TYPE_SERIAL;
|
||||
else
|
||||
@@ -79,6 +102,9 @@ static int __init bcm63xx_detect_flash_t
|
||||
return BCM63XX_FLASH_TYPE_SERIAL;
|
||||
@@ -85,6 +108,9 @@ static int __init bcm63xx_detect_flash_t
|
||||
return BCM63XX_FLASH_TYPE_NAND;
|
||||
case BCM6368_CPU_ID:
|
||||
val = bcm_gpio_readl(GPIO_STRAPBUS_REG);
|
||||
+ if (val & STRAPBUS_6368_SPI_CLK_FAST)
|
||||
|
@ -68,7 +68,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|||
switch (val & STRAPBUS_6368_BOOT_SEL_MASK) {
|
||||
case STRAPBUS_6368_BOOT_SEL_NAND:
|
||||
return BCM63XX_FLASH_TYPE_NAND;
|
||||
@@ -110,8 +136,11 @@ int __init bcm63xx_flash_register(void)
|
||||
@@ -116,8 +142,11 @@ int __init bcm63xx_flash_register(void)
|
||||
|
||||
return platform_device_register(&mtd_dev);
|
||||
case BCM63XX_FLASH_TYPE_SERIAL:
|
||||
|
@ -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_NAND 0
|
||||
#define STRAPBUS_6368_BOOT_SEL_SERIAL 1
|
||||
@@ -1478,6 +1479,7 @@
|
||||
@@ -1443,6 +1444,7 @@
|
||||
#define STRAPBUS_6362_BOOT_SEL_NAND (0 << 15)
|
||||
|
||||
#define MISC_STRAPBUS_6328_REG 0x240
|
|
@ -1,69 +0,0 @@
|
|||
From dbd9b51204aa4114756b8659e180139ef3878032 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Bizon <mbizon@freebox.fr>
|
||||
Date: Thu, 21 Jan 2010 17:28:36 +0100
|
||||
Subject: [PATCH 28/63] bcm63xx_enet: use resource_size().
|
||||
|
||||
---
|
||||
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 18 ++++++++----------
|
||||
1 files changed, 8 insertions(+), 10 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
@@ -1594,7 +1594,6 @@ static int bcm_enet_probe(struct platfor
|
||||
struct resource *res_mem, *res_irq, *res_irq_rx, *res_irq_tx;
|
||||
struct mii_bus *bus;
|
||||
const char *clk_name;
|
||||
- unsigned int iomem_size;
|
||||
int i, ret;
|
||||
|
||||
/* stop if shared driver failed, assume driver->probe will be
|
||||
@@ -1619,13 +1618,13 @@ static int bcm_enet_probe(struct platfor
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
- iomem_size = resource_size(res_mem);
|
||||
- if (!request_mem_region(res_mem->start, iomem_size, "bcm63xx_enet")) {
|
||||
+ if (!request_mem_region(res_mem->start, resource_size(res_mem),
|
||||
+ "bcm63xx_enet")) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
- priv->base = ioremap(res_mem->start, iomem_size);
|
||||
+ priv->base = ioremap(res_mem->start, resource_size(res_mem));
|
||||
if (priv->base == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto out_release_mem;
|
||||
@@ -1831,7 +1830,7 @@ out_unmap:
|
||||
iounmap(priv->base);
|
||||
|
||||
out_release_mem:
|
||||
- release_mem_region(res_mem->start, iomem_size);
|
||||
+ release_mem_region(res_mem->start, resource_size(res_mem));
|
||||
out:
|
||||
free_netdev(dev);
|
||||
return ret;
|
||||
@@ -1903,19 +1902,18 @@ struct platform_driver bcm63xx_enet_driv
|
||||
static int bcm_enet_shared_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct resource *res;
|
||||
- unsigned int iomem_size;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res)
|
||||
return -ENODEV;
|
||||
|
||||
- iomem_size = resource_size(res);
|
||||
- if (!request_mem_region(res->start, iomem_size, "bcm63xx_enet_dma"))
|
||||
+ if (!request_mem_region(res->start, resource_size(res),
|
||||
+ "bcm63xx_enet_dma"))
|
||||
return -EBUSY;
|
||||
|
||||
- bcm_enet_shared_base = ioremap(res->start, iomem_size);
|
||||
+ bcm_enet_shared_base = ioremap(res->start, resource_size(res));
|
||||
if (!bcm_enet_shared_base) {
|
||||
- release_mem_region(res->start, iomem_size);
|
||||
+ release_mem_region(res->start, resource_size(res));
|
||||
return -ENOMEM;
|
||||
}
|
||||
return 0;
|
|
@ -1,20 +0,0 @@
|
|||
From fd15ecd10c95480be5635f8993b781fe3a1527c2 Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Bizon <mbizon@freebox.fr>
|
||||
Date: Fri, 29 Apr 2011 16:54:50 +0200
|
||||
Subject: [PATCH 29/63] bcm63xx_enet: disable clock when uninitializing device.
|
||||
|
||||
---
|
||||
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 2 ++
|
||||
1 files changed, 2 insertions(+), 0 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
@@ -1870,6 +1870,8 @@ static int bcm_enet_remove(struct platfo
|
||||
}
|
||||
|
||||
/* release device resources */
|
||||
+ clk_disable(priv->mac_clk);
|
||||
+ clk_put(priv->mac_clk);
|
||||
iounmap(priv->base);
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
release_mem_region(res->start, resource_size(res));
|
|
@ -19,7 +19,7 @@ Subject: [PATCH 38/59] MIPS: BCM63XX: store the flash type in global variable
|
|||
static struct mtd_partition mtd_partitions[] = {
|
||||
{
|
||||
.name = "cfe",
|
||||
@@ -86,20 +88,23 @@ static int __init bcm63xx_detect_flash_t
|
||||
@@ -86,26 +88,30 @@ static int __init bcm63xx_detect_flash_t
|
||||
bcm63xx_spi_flash_info[0].max_speed_hz = 16666667;
|
||||
|
||||
if (val & STRAPBUS_6328_BOOT_SEL_SERIAL)
|
||||
|
@ -47,10 +47,6 @@ Subject: [PATCH 38/59] MIPS: BCM63XX: store the flash type in global variable
|
|||
+ break;
|
||||
case BCM6362_CPU_ID:
|
||||
val = bcm_misc_readl(MISC_STRAPBUS_6362_REG);
|
||||
if (val & STRAPBUS_6362_HSSPI_CLK_FAST)
|
||||
@@ -108,9 +113,10 @@ static int __init bcm63xx_detect_flash_t
|
||||
bcm63xx_spi_flash_info[0].max_speed_hz = 20000000;
|
||||
|
||||
if (val & STRAPBUS_6362_BOOT_SEL_SERIAL)
|
||||
- return BCM63XX_FLASH_TYPE_SERIAL;
|
||||
+ bcm63xx_attached_flash = BCM63XX_FLASH_TYPE_SERIAL;
|
||||
|
@ -61,7 +57,7 @@ Subject: [PATCH 38/59] MIPS: BCM63XX: store the flash type in global variable
|
|||
case BCM6368_CPU_ID:
|
||||
val = bcm_gpio_readl(GPIO_STRAPBUS_REG);
|
||||
if (val & STRAPBUS_6368_SPI_CLK_FAST)
|
||||
@@ -118,25 +124,32 @@ static int __init bcm63xx_detect_flash_t
|
||||
@@ -113,25 +119,32 @@ static int __init bcm63xx_detect_flash_t
|
||||
|
||||
switch (val & STRAPBUS_6368_BOOT_SEL_MASK) {
|
||||
case STRAPBUS_6368_BOOT_SEL_NAND:
|
||||
|
@ -100,7 +96,7 @@ Subject: [PATCH 38/59] MIPS: BCM63XX: store the flash type in global variable
|
|||
case BCM63XX_FLASH_TYPE_PARALLEL:
|
||||
/* read base address of boot chip select (0) */
|
||||
val = bcm_mpi_readl(MPI_CSBASE_REG(0));
|
||||
@@ -157,7 +170,7 @@ int __init bcm63xx_flash_register(void)
|
||||
@@ -152,7 +165,7 @@ int __init bcm63xx_flash_register(void)
|
||||
return -ENODEV;
|
||||
default:
|
||||
pr_err("flash detection failed for BCM%x: %d\n",
|
|
@ -1,28 +0,0 @@
|
|||
From 6d5c5bb13db3fd8e3dd0b82742b3957f41a4a3ac Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
Date: Thu, 24 May 2012 20:38:58 +0200
|
||||
Subject: [PATCH] bcm63xx_enet: reset port link state in bcm_enetsw_open
|
||||
|
||||
bcm_enetsw_open disables all ports, but does not reset their link state.
|
||||
This results in connected ports staying disabled after a ifdown/ifup
|
||||
cycle, since bcm_enetsw_phy_poll only enables them if their current state
|
||||
is different from the stored link state.
|
||||
|
||||
Fix this by also resetting the port link state.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
---
|
||||
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
@@ -2213,6 +2213,8 @@ static int bcm_enetsw_open(struct net_de
|
||||
enetsw_writeb(priv, ENETSW_PTCTRL_RXDIS_MASK |
|
||||
ENETSW_PTCTRL_TXDIS_MASK,
|
||||
ENETSW_PTCTRL_REG(i));
|
||||
+
|
||||
+ priv->sw_port_link[i] = 0;
|
||||
}
|
||||
|
||||
/* reset mib */
|
|
@ -7,7 +7,7 @@ contained in flash.
|
|||
|
||||
--- a/drivers/mtd/bcm63xxpart.c
|
||||
+++ b/drivers/mtd/bcm63xxpart.c
|
||||
@@ -76,10 +76,12 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
@@ -77,10 +77,12 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
struct mtd_partition *parts;
|
||||
int ret;
|
||||
size_t retlen;
|
||||
|
@ -21,9 +21,9 @@ contained in flash.
|
|||
int i;
|
||||
u32 computed_crc;
|
||||
bool rootfs_first = false;
|
||||
@@ -93,6 +95,24 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
@@ -94,6 +96,24 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
cfelen = cfe_erasesize;
|
||||
nvramlen = bcm63xx_nvram_get_psi_size() * 1024;
|
||||
nvramlen = bcm63xx_nvram_get_psi_size();
|
||||
nvramlen = roundup(nvramlen, cfe_erasesize);
|
||||
+ nvramaddr = master->size - nvramlen;
|
||||
+
|
||||
|
@ -46,7 +46,7 @@ contained in flash.
|
|||
|
||||
/* Allocate memory for buffer */
|
||||
buf = vmalloc(sizeof(struct bcm_tag));
|
||||
@@ -144,7 +164,7 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
@@ -145,7 +165,7 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
rootfsaddr = 0;
|
||||
spareaddr = cfelen;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ contained in flash.
|
|||
|
||||
/* Determine number of partitions */
|
||||
if (rootfslen > 0)
|
||||
@@ -153,6 +173,12 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
@@ -154,6 +174,12 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
if (kernellen > 0)
|
||||
nrparts++;
|
||||
|
||||
|
@ -68,7 +68,7 @@ contained in flash.
|
|||
/* Ask kernel for more memory */
|
||||
parts = kzalloc(sizeof(*parts) * nrparts + 10 * nrparts, GFP_KERNEL);
|
||||
if (!parts) {
|
||||
@@ -190,15 +216,32 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
@@ -191,15 +217,32 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
curpart++;
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
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));
|
|
@ -46,7 +46,7 @@ Subject: [PATCH 69/80] MIPS: BCM63XX: pass caldata info to flash
|
|||
};
|
||||
|
||||
static struct spi_board_info bcm63xx_spi_flash_info[] = {
|
||||
@@ -142,10 +146,13 @@ static int __init bcm63xx_detect_flash_t
|
||||
@@ -137,10 +141,13 @@ static int __init bcm63xx_detect_flash_t
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
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 bcm_enetsw_probe(struct platf
|
||||
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
|
||||
@@ -326,6 +326,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];
|
||||
|
|
@ -110,8 +110,8 @@ Subject: [PATCH 69/72] 443-MIPS-BCM63XX-enable-enet-for-BCM6345.patch
|
|||
ret = platform_device_register(pdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -248,6 +303,10 @@ bcm63xx_enetsw_register(const struct bcm
|
||||
else if (BCMCPU_IS_6368())
|
||||
@@ -246,6 +301,10 @@ bcm63xx_enetsw_register(const struct bcm
|
||||
else if (BCMCPU_IS_6362() || BCMCPU_IS_6368())
|
||||
enetsw_pd.num_ports = ENETSW_PORTS_6368;
|
||||
|
||||
+ enetsw_pd.dma_chan_width = ENETDMA_CHAN_WIDTH;
|
||||
|
@ -173,7 +173,7 @@ Subject: [PATCH 69/72] 443-MIPS-BCM63XX-enable-enet-for-BCM6345.patch
|
|||
};
|
||||
|
||||
/*
|
||||
@@ -64,6 +81,15 @@ struct bcm63xx_enetsw_platform_data {
|
||||
@@ -63,6 +80,15 @@ struct bcm63xx_enetsw_platform_data {
|
||||
char mac_addr[ETH_ALEN];
|
||||
int num_ports;
|
||||
struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT];
|
||||
|
@ -189,9 +189,9 @@ Subject: [PATCH 69/72] 443-MIPS-BCM63XX-enable-enet-for-BCM6345.patch
|
|||
};
|
||||
|
||||
int __init bcm63xx_enet_register(int unit,
|
||||
@@ -72,4 +98,66 @@ int __init bcm63xx_enet_register(int uni
|
||||
int __init
|
||||
bcm63xx_enetsw_register(const struct bcm63xx_enetsw_platform_data *pd);
|
||||
@@ -70,4 +96,66 @@ int __init bcm63xx_enet_register(int uni
|
||||
|
||||
int bcm63xx_enetsw_register(const struct bcm63xx_enetsw_platform_data *pd);
|
||||
|
||||
+enum bcm63xx_regs_enetdmac {
|
||||
+ ENETDMAC_CHANCFG,
|
||||
|
@ -671,7 +671,7 @@ Subject: [PATCH 69/72] 443-MIPS-BCM63XX-enable-enet-for-BCM6345.patch
|
|||
|
||||
/* make sure no mib update is scheduled */
|
||||
cancel_work_sync(&priv->mib_update_task);
|
||||
@@ -1757,6 +1788,11 @@ static int bcm_enet_probe(struct platfor
|
||||
@@ -1752,6 +1783,11 @@ static int bcm_enet_probe(struct platfor
|
||||
priv->pause_tx = pd->pause_tx;
|
||||
priv->force_duplex_full = pd->force_duplex_full;
|
||||
priv->force_speed_100 = pd->force_speed_100;
|
||||
|
@ -683,7 +683,7 @@ Subject: [PATCH 69/72] 443-MIPS-BCM63XX-enable-enet-for-BCM6345.patch
|
|||
}
|
||||
|
||||
if (priv->mac_id == 0 && priv->has_phy && !priv->use_external_mii) {
|
||||
@@ -2144,8 +2180,8 @@ static int bcm_enetsw_open(struct net_de
|
||||
@@ -2123,8 +2159,8 @@ static int bcm_enetsw_open(struct net_de
|
||||
kdev = &priv->pdev->dev;
|
||||
|
||||
/* mask all interrupts and request them */
|
||||
|
@ -694,7 +694,7 @@ Subject: [PATCH 69/72] 443-MIPS-BCM63XX-enable-enet-for-BCM6345.patch
|
|||
|
||||
ret = request_irq(priv->irq_rx, bcm_enet_isr_dma,
|
||||
IRQF_DISABLED, dev->name, dev);
|
||||
@@ -2269,23 +2305,23 @@ static int bcm_enetsw_open(struct net_de
|
||||
@@ -2248,23 +2284,23 @@ static int bcm_enetsw_open(struct net_de
|
||||
|
||||
/* write rx & tx ring addresses */
|
||||
enet_dmas_writel(priv, priv->rx_desc_dma,
|
||||
|
@ -728,7 +728,7 @@ Subject: [PATCH 69/72] 443-MIPS-BCM63XX-enable-enet-for-BCM6345.patch
|
|||
|
||||
/* set flow control low/high threshold to 1/3 / 2/3 */
|
||||
val = priv->rx_ring_size / 3;
|
||||
@@ -2298,21 +2334,21 @@ static int bcm_enetsw_open(struct net_de
|
||||
@@ -2277,21 +2313,21 @@ static int bcm_enetsw_open(struct net_de
|
||||
wmb();
|
||||
enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG);
|
||||
enet_dmac_writel(priv, ENETDMAC_CHANCFG_EN_MASK,
|
||||
|
@ -755,7 +755,7 @@ Subject: [PATCH 69/72] 443-MIPS-BCM63XX-enable-enet-for-BCM6345.patch
|
|||
|
||||
netif_carrier_on(dev);
|
||||
netif_start_queue(dev);
|
||||
@@ -2419,8 +2455,8 @@ static int bcm_enetsw_stop(struct net_de
|
||||
@@ -2397,8 +2433,8 @@ static int bcm_enetsw_stop(struct net_de
|
||||
del_timer_sync(&priv->rx_timeout);
|
||||
|
||||
/* mask all interrupts */
|
||||
|
@ -766,7 +766,7 @@ Subject: [PATCH 69/72] 443-MIPS-BCM63XX-enable-enet-for-BCM6345.patch
|
|||
|
||||
/* disable dma & mac */
|
||||
bcm_enet_disable_dma(priv, priv->tx_chan);
|
||||
@@ -2757,6 +2793,9 @@ static int bcm_enetsw_probe(struct platf
|
||||
@@ -2736,6 +2772,9 @@ static int bcm_enetsw_probe(struct platf
|
||||
memcpy(priv->used_ports, pd->used_ports,
|
||||
sizeof (pd->used_ports));
|
||||
priv->num_ports = pd->num_ports;
|
|
@ -1,73 +0,0 @@
|
|||
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 bcm_enet_probe(struct platfor
|
||||
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 bcm_enetsw_probe(struct platf
|
||||
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
|
||||
@@ -325,6 +325,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];
|
||||
@@ -335,12 +337,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_ */
|
|
@ -1,69 +0,0 @@
|
|||
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 bcm_enetsw_probe(struct platf
|
||||
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;
|
|
@ -1,87 +0,0 @@
|
|||
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
|
||||
@@ -337,4 +337,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_ */
|
|
@ -61,7 +61,7 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices
|
|||
}
|
||||
--- a/arch/mips/bcm63xx/dev-flash.c
|
||||
+++ b/arch/mips/bcm63xx/dev-flash.c
|
||||
@@ -146,7 +146,7 @@ static int __init bcm63xx_detect_flash_t
|
||||
@@ -141,7 +141,7 @@ static int __init bcm63xx_detect_flash_t
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
From 382a0b0dc4cbd0e0fbfd6c2d132e972c3d1245b0 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
Date: Sun, 13 Nov 2011 14:59:37 +0100
|
||||
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
|
||||
BCM6368.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
---
|
||||
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 13 +++++++------
|
||||
drivers/net/ethernet/broadcom/bcm63xx_enet.h | 4 ++++
|
||||
2 files changed, 11 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
|
||||
@@ -261,7 +261,6 @@ static int bcm_enet_refill_rx(struct net
|
||||
if (!skb)
|
||||
break;
|
||||
priv->rx_skb[desc_idx] = skb;
|
||||
-
|
||||
p = dma_map_single(&priv->pdev->dev, skb->data,
|
||||
priv->rx_skb_size,
|
||||
DMA_FROM_DEVICE);
|
||||
@@ -995,9 +994,9 @@ static int bcm_enet_open(struct net_devi
|
||||
enet_writel(priv, priv->hw_mtu, ENET_TXMAXLEN_REG);
|
||||
|
||||
/* set dma maximum burst len */
|
||||
- enet_dmac_writel(priv, BCMENET_DMA_MAXBURST,
|
||||
+ enet_dmac_writel(priv, priv->dma_maxburst,
|
||||
ENETDMAC_MAXBURST_REG(priv->rx_chan));
|
||||
- enet_dmac_writel(priv, BCMENET_DMA_MAXBURST,
|
||||
+ enet_dmac_writel(priv, priv->dma_maxburst,
|
||||
ENETDMAC_MAXBURST_REG(priv->tx_chan));
|
||||
|
||||
/* set correct transmit fifo watermark */
|
||||
@@ -1593,7 +1592,7 @@ static int compute_hw_mtu(struct bcm_ene
|
||||
* it's appended
|
||||
*/
|
||||
priv->rx_skb_size = ALIGN(actual_mtu + ETH_FCS_LEN,
|
||||
- BCMENET_DMA_MAXBURST * 4);
|
||||
+ priv->dma_maxburst * 4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1701,6 +1700,7 @@ static int bcm_enet_probe(struct platfor
|
||||
priv = netdev_priv(dev);
|
||||
|
||||
priv->enet_is_sw = false;
|
||||
+ priv->dma_maxburst = BCMENET_DMA_MAXBURST;
|
||||
|
||||
ret = compute_hw_mtu(priv, dev->mtu);
|
||||
if (ret)
|
||||
@@ -2282,9 +2282,9 @@ static int bcm_enetsw_open(struct net_de
|
||||
enet_dmas_writel(priv, 0, ENETDMAS_SRAM4_REG(priv->tx_chan));
|
||||
|
||||
/* set dma maximum burst len */
|
||||
- enet_dmac_writel(priv, BCMENET_DMA_MAXBURST,
|
||||
+ enet_dmac_writel(priv, priv->dma_maxburst,
|
||||
ENETDMAC_MAXBURST_REG(priv->rx_chan));
|
||||
- enet_dmac_writel(priv, BCMENET_DMA_MAXBURST,
|
||||
+ enet_dmac_writel(priv, priv->dma_maxburst,
|
||||
ENETDMAC_MAXBURST_REG(priv->tx_chan));
|
||||
|
||||
/* set flow control low/high threshold to 1/3 / 2/3 */
|
||||
@@ -2749,6 +2749,7 @@ static int bcm_enetsw_probe(struct platf
|
||||
priv->irq_tx = irq_tx;
|
||||
priv->rx_ring_size = BCMENET_DEF_RX_DESC;
|
||||
priv->tx_ring_size = BCMENET_DEF_TX_DESC;
|
||||
+ priv->dma_maxburst = BCMENETSW_DMA_MAXBURST;
|
||||
|
||||
pd = pdev->dev.platform_data;
|
||||
if (pd) {
|
||||
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h
|
||||
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
/* maximum burst len for dma (4 bytes unit) */
|
||||
#define BCMENET_DMA_MAXBURST 16
|
||||
+#define BCMENETSW_DMA_MAXBURST 8
|
||||
|
||||
/* tx transmit threshold (4 bytes unit), fifo is 256 bytes, the value
|
||||
* must be low enough so that a DMA transfer of above burst length can
|
||||
@@ -252,6 +253,9 @@ struct bcm_enet_priv {
|
||||
/* number of dma desc in tx ring */
|
||||
int tx_ring_size;
|
||||
|
||||
+ /* maximum dma burst size */
|
||||
+ int dma_maxburst;
|
||||
+
|
||||
/* cpu view of rx dma ring */
|
||||
struct bcm_enet_desc *tx_desc_cpu;
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <bcm63xx_dev_enet.h>
|
||||
#include "bcm63xx_enet.h"
|
||||
@@ -2013,7 +2014,8 @@ static int bcm_enet_remove(struct platfo
|
||||
@@ -1992,7 +1993,8 @@ static int bcm_enet_remove(struct platfo
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
.probe = bcm_enet_probe,
|
||||
.remove = bcm_enet_remove,
|
||||
.driver = {
|
||||
@@ -2022,6 +2024,42 @@ struct platform_driver bcm63xx_enet_driv
|
||||
@@ -2001,6 +2003,42 @@ struct platform_driver bcm63xx_enet_driv
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -73,7 +73,7 @@
|
|||
/*
|
||||
* switch mii access callbacks
|
||||
*/
|
||||
@@ -2270,29 +2308,6 @@ static int bcm_enetsw_open(struct net_de
|
||||
@@ -2249,29 +2287,6 @@ static int bcm_enetsw_open(struct net_de
|
||||
enetsw_writeb(priv, rgmii_ctrl, ENETSW_RGMII_CTRL_REG(i));
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@
|
|||
/* initialize flow control buffer allocation */
|
||||
enet_dma_writel(priv, ENETDMA_BUFALLOC_FORCE_MASK | 0,
|
||||
ENETDMA_BUFALLOC_REG(priv->rx_chan));
|
||||
@@ -2760,6 +2775,9 @@ static int bcm_enetsw_probe(struct platf
|
||||
@@ -2739,6 +2754,9 @@ static int bcm_enetsw_probe(struct platf
|
||||
struct bcm63xx_enetsw_platform_data *pd;
|
||||
struct resource *res_mem;
|
||||
int ret, irq_rx, irq_tx;
|
||||
|
@ -113,7 +113,7 @@
|
|||
|
||||
/* stop if shared driver failed, assume driver->probe will be
|
||||
* called in the same order we register devices (correct ?) */
|
||||
@@ -2847,6 +2865,43 @@ static int bcm_enetsw_probe(struct platf
|
||||
@@ -2826,6 +2844,43 @@ static int bcm_enetsw_probe(struct platf
|
||||
priv->pdev = pdev;
|
||||
priv->net_dev = dev;
|
||||
|
||||
|
@ -157,7 +157,7 @@
|
|||
return 0;
|
||||
|
||||
out_put_clk:
|
||||
@@ -2877,6 +2932,9 @@ static int bcm_enetsw_remove(struct plat
|
||||
@@ -2856,6 +2911,9 @@ static int bcm_enetsw_remove(struct plat
|
||||
priv = netdev_priv(dev);
|
||||
unregister_netdev(dev);
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
From a1bd0479a1ddac4f21afd4ebfe8f667b9fa5eff2 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
Date: Tue, 14 Jun 2011 21:14:39 +0200
|
||||
Subject: [PATCH 50/72] MIPS: BCM63XX: add support for BCM6328 in bcm_enetsw
|
||||
|
||||
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
---
|
||||
arch/mips/bcm63xx/clk.c | 15 +++++++++++----
|
||||
arch/mips/bcm63xx/dev-enet.c | 9 ++++++---
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h | 1 +
|
||||
3 files changed, 18 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/clk.c
|
||||
+++ b/arch/mips/bcm63xx/clk.c
|
||||
@@ -119,11 +119,18 @@ static struct clk clk_ephy = {
|
||||
*/
|
||||
static void enetsw_set(struct clk *clk, int enable)
|
||||
{
|
||||
- if (!BCMCPU_IS_6368())
|
||||
+ u32 mask;
|
||||
+
|
||||
+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6368())
|
||||
return;
|
||||
- bcm_hwclock_set(CKCTL_6368_ROBOSW_EN |
|
||||
- CKCTL_6368_SWPKT_USB_EN |
|
||||
- CKCTL_6368_SWPKT_SAR_EN, enable);
|
||||
+
|
||||
+ if (BCMCPU_IS_6328())
|
||||
+ mask = CKCTL_6328_ROBOSW_EN;
|
||||
+ else
|
||||
+ mask = CKCTL_6368_ROBOSW_EN | CKCTL_6368_SWPKT_USB_EN |
|
||||
+ CKCTL_6368_SWPKT_SAR_EN;
|
||||
+
|
||||
+ bcm_hwclock_set(mask, enable);
|
||||
if (enable) {
|
||||
/* reset switch core afer clock change */
|
||||
bcm63xx_core_set_reset(BCM63XX_RESET_ENETSW, 1);
|
||||
--- a/arch/mips/bcm63xx/dev-enet.c
|
||||
+++ b/arch/mips/bcm63xx/dev-enet.c
|
||||
@@ -141,7 +141,7 @@ static int __init register_shared(void)
|
||||
shared_res[0].end = shared_res[0].start;
|
||||
shared_res[0].end += (RSET_ENETDMA_SIZE) - 1;
|
||||
|
||||
- if (BCMCPU_IS_6368())
|
||||
+ if (BCMCPU_IS_6328() || BCMCPU_IS_6368())
|
||||
chan_count = 32;
|
||||
else
|
||||
chan_count = 16;
|
||||
@@ -224,7 +224,7 @@ bcm63xx_enetsw_register(const struct bcm
|
||||
{
|
||||
int ret;
|
||||
|
||||
- if (!BCMCPU_IS_6368())
|
||||
+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6368())
|
||||
return -ENODEV;
|
||||
|
||||
ret = register_shared();
|
||||
@@ -241,7 +241,10 @@ bcm63xx_enetsw_register(const struct bcm
|
||||
|
||||
memcpy(bcm63xx_enetsw_device.dev.platform_data, pd, sizeof (*pd));
|
||||
|
||||
- enetsw_pd.num_ports = ENETSW_PORTS_6368;
|
||||
+ if (BCMCPU_IS_6328())
|
||||
+ enetsw_pd.num_ports = ENETSW_PORTS_6328;
|
||||
+ else if (BCMCPU_IS_6368())
|
||||
+ 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
|
|
@ -1,50 +0,0 @@
|
|||
From d9666553a10ea85ea64e3e8784a42167a1709ed5 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
Date: Mon, 21 Nov 2011 00:48:52 +0100
|
||||
Subject: [PATCH 55/84] MIPS: BCM63XX: add flash detection for BCM6362
|
||||
|
||||
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
---
|
||||
arch/mips/bcm63xx/dev-flash.c | 13 ++++++++++++-
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 1 +
|
||||
2 files changed, 13 insertions(+), 1 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/dev-flash.c
|
||||
+++ b/arch/mips/bcm63xx/dev-flash.c
|
||||
@@ -100,6 +100,17 @@ static int __init bcm63xx_detect_flash_t
|
||||
return BCM63XX_FLASH_TYPE_PARALLEL;
|
||||
else
|
||||
return BCM63XX_FLASH_TYPE_SERIAL;
|
||||
+ case BCM6362_CPU_ID:
|
||||
+ val = bcm_misc_readl(MISC_STRAPBUS_6362_REG);
|
||||
+ if (val & STRAPBUS_6362_HSSPI_CLK_FAST)
|
||||
+ bcm63xx_spi_flash_info[0].max_speed_hz = 50000000;
|
||||
+ else
|
||||
+ bcm63xx_spi_flash_info[0].max_speed_hz = 20000000;
|
||||
+
|
||||
+ if (val & STRAPBUS_6362_BOOT_SEL_SERIAL)
|
||||
+ return BCM63XX_FLASH_TYPE_SERIAL;
|
||||
+ else
|
||||
+ return BCM63XX_FLASH_TYPE_NAND;
|
||||
case BCM6368_CPU_ID:
|
||||
val = bcm_gpio_readl(GPIO_STRAPBUS_REG);
|
||||
if (val & STRAPBUS_6368_SPI_CLK_FAST)
|
||||
@@ -136,7 +147,7 @@ int __init bcm63xx_flash_register(void)
|
||||
|
||||
return platform_device_register(&mtd_dev);
|
||||
case BCM63XX_FLASH_TYPE_SERIAL:
|
||||
- if (BCMCPU_IS_6328())
|
||||
+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362())
|
||||
bcm63xx_flash_data.max_transfer_len = HSSPI_BUFFER_LEN;
|
||||
|
||||
return spi_register_board_info(bcm63xx_spi_flash_info,
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
|
||||
@@ -1474,6 +1474,7 @@
|
||||
|
||||
#define MISC_STRAPBUS_6362_REG 0x14
|
||||
#define STRAPBUS_6362_FCVO_SHIFT 1
|
||||
+#define STRAPBUS_6362_HSSPI_CLK_FAST (1 << 13)
|
||||
#define STRAPBUS_6362_FCVO_MASK (0x1f << STRAPBUS_6362_FCVO_SHIFT)
|
||||
#define STRAPBUS_6362_BOOT_SEL_SERIAL (1 << 15)
|
||||
#define STRAPBUS_6362_BOOT_SEL_NAND (0 << 15)
|
|
@ -1,44 +0,0 @@
|
|||
From ffbeb183bf0e9e12fd607c5352f48420c32f588f Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
Date: Sat, 12 May 2012 23:04:17 +0200
|
||||
Subject: [PATCH 61/79] MIPS: BCM63XX: export PSI size from nvram
|
||||
|
||||
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
---
|
||||
arch/mips/bcm63xx/nvram.c | 11 +++++++++++
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h | 2 ++
|
||||
2 files changed, 13 insertions(+)
|
||||
|
||||
--- a/arch/mips/bcm63xx/nvram.c
|
||||
+++ b/arch/mips/bcm63xx/nvram.c
|
||||
@@ -35,6 +35,8 @@ struct bcm963xx_nvram {
|
||||
u32 checksum_high;
|
||||
};
|
||||
|
||||
+#define BCM63XX_DEFAULT_PSI_SIZE 64
|
||||
+
|
||||
static struct bcm963xx_nvram nvram;
|
||||
static int mac_addr_used;
|
||||
|
||||
@@ -104,3 +106,12 @@ int bcm63xx_nvram_get_mac_address(u8 *ma
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(bcm63xx_nvram_get_mac_address);
|
||||
+
|
||||
+int bcm63xx_nvram_get_psi_size(void)
|
||||
+{
|
||||
+ if (nvram.psi_size > 0)
|
||||
+ return nvram.psi_size;
|
||||
+
|
||||
+ return BCM63XX_DEFAULT_PSI_SIZE;
|
||||
+}
|
||||
+EXPORT_SYMBOL(bcm63xx_nvram_get_psi_size);
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
|
||||
@@ -30,4 +30,6 @@ u8 *bcm63xx_nvram_get_name(void);
|
||||
*/
|
||||
int bcm63xx_nvram_get_mac_address(u8 *mac);
|
||||
|
||||
+int bcm63xx_nvram_get_psi_size(void);
|
||||
+
|
||||
#endif /* BCM63XX_NVRAM_H */
|
|
@ -1,29 +0,0 @@
|
|||
From 658afad639a9456e1bb6fe5bba0032f3c0c3f699 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
Date: Tue, 1 May 2012 14:10:39 +0200
|
||||
Subject: [PATCH 62/79] MTD: bcm63xxpart: use nvram for PSI size
|
||||
|
||||
---
|
||||
drivers/mtd/bcm63xxpart.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/mtd/bcm63xxpart.c
|
||||
+++ b/drivers/mtd/bcm63xxpart.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
+#include <asm/mach-bcm63xx/bcm63xx_nvram.h>
|
||||
#include <linux/bcm963xx_tag.h>
|
||||
#include <asm/mach-bcm63xx/board_bcm963xx.h>
|
||||
|
||||
@@ -90,7 +91,8 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
BCM63XX_CFE_BLOCK_SIZE);
|
||||
|
||||
cfelen = cfe_erasesize;
|
||||
- nvramlen = cfe_erasesize;
|
||||
+ nvramlen = bcm63xx_nvram_get_psi_size() * 1024;
|
||||
+ nvramlen = roundup(nvramlen, cfe_erasesize);
|
||||
|
||||
/* Allocate memory for buffer */
|
||||
buf = vmalloc(sizeof(struct bcm_tag));
|
|
@ -1,56 +0,0 @@
|
|||
From ed225910f0e062d9c28d5cf216f97b3cf457a8c5 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
Date: Mon, 21 Nov 2011 00:55:49 +0100
|
||||
Subject: [PATCH 58/81] MIPS: BCM63XX: wire up the HS SPI controller for BCM6362
|
||||
|
||||
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
---
|
||||
arch/mips/bcm63xx/clk.c | 2 ++
|
||||
arch/mips/bcm63xx/dev-hsspi.c | 7 +++++--
|
||||
.../include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h | 1 +
|
||||
3 files changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/clk.c
|
||||
+++ b/arch/mips/bcm63xx/clk.c
|
||||
@@ -232,6 +232,8 @@ static void hsspi_set(struct clk *clk, i
|
||||
|
||||
if (BCMCPU_IS_6328())
|
||||
mask = CKCTL_6328_HSSPI_EN;
|
||||
+ else if (BCMCPU_IS_6362())
|
||||
+ mask = CKCTL_6362_HSSPI_EN;
|
||||
else
|
||||
return;
|
||||
|
||||
--- a/arch/mips/bcm63xx/dev-hsspi.c
|
||||
+++ b/arch/mips/bcm63xx/dev-hsspi.c
|
||||
@@ -43,7 +43,7 @@ static struct platform_device bcm63xx_hs
|
||||
int __init bcm63xx_hsspi_register(void)
|
||||
{
|
||||
|
||||
- if (!BCMCPU_IS_6328())
|
||||
+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362())
|
||||
return -ENODEV;
|
||||
|
||||
spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI);
|
||||
@@ -51,7 +51,10 @@ int __init bcm63xx_hsspi_register(void)
|
||||
spi_resources[0].end += RSET_HSSPI_SIZE - 1;
|
||||
spi_resources[1].start = bcm63xx_get_irq_number(IRQ_HSSPI);
|
||||
|
||||
- spi_pdata.speed_hz = HSSPI_PLL_HZ_6328;
|
||||
+ if (BCMCPU_IS_6328())
|
||||
+ spi_pdata.speed_hz = HSSPI_PLL_HZ_6328;
|
||||
+ else
|
||||
+ spi_pdata.speed_hz = HSSPI_PLL_HZ;
|
||||
|
||||
return platform_device_register(&bcm63xx_hsspi_device);
|
||||
}
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h
|
||||
@@ -16,6 +16,7 @@ struct bcm63xx_hsspi_pdata {
|
||||
#define bcm_hsspi_writel(v, o) bcm_rset_writel(RSET_HSSPI, (v), (o))
|
||||
|
||||
#define HSSPI_PLL_HZ_6328 133333333
|
||||
+#define HSSPI_PLL_HZ 400000000
|
||||
|
||||
#define HSSPI_BUFFER_LEN 512
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
From eef84812bc7ffd590da6ad6b83bfeebaa43a7055 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
Date: Thu, 5 Jul 2012 21:19:20 +0200
|
||||
Subject: [PATCH 58/84] MIPS: BCM63XX: enable SPI controller for BCM6362
|
||||
|
||||
---
|
||||
arch/mips/bcm63xx/clk.c | 2 ++
|
||||
arch/mips/bcm63xx/dev-spi.c | 11 ++++++++++-
|
||||
.../include/asm/mach-bcm63xx/bcm63xx_dev_spi.h | 3 +++
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 16 ++++++++++++++++
|
||||
4 files changed, 31 insertions(+), 1 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/clk.c
|
||||
+++ b/arch/mips/bcm63xx/clk.c
|
||||
@@ -213,6 +213,8 @@ static void spi_set(struct clk *clk, int
|
||||
mask = CKCTL_6348_SPI_EN;
|
||||
else if (BCMCPU_IS_6358())
|
||||
mask = CKCTL_6358_SPI_EN;
|
||||
+ else if (BCMCPU_IS_6362())
|
||||
+ mask = CKCTL_6362_SPI_EN;
|
||||
else
|
||||
/* BCMCPU_IS_6368 */
|
||||
mask = CKCTL_6368_SPI_EN;
|
||||
--- a/arch/mips/bcm63xx/dev-spi.c
|
||||
+++ b/arch/mips/bcm63xx/dev-spi.c
|
||||
@@ -34,6 +34,10 @@ static const unsigned long bcm6358_regs_
|
||||
__GEN_SPI_REGS_TABLE(6358)
|
||||
};
|
||||
|
||||
+static const unsigned long bcm6362_regs_spi[] = {
|
||||
+ __GEN_SPI_REGS_TABLE(6362)
|
||||
+};
|
||||
+
|
||||
static const unsigned long bcm6368_regs_spi[] = {
|
||||
__GEN_SPI_REGS_TABLE(6368)
|
||||
};
|
||||
@@ -49,6 +53,8 @@ static __init void bcm63xx_spi_regs_init
|
||||
bcm63xx_regs_spi = bcm6348_regs_spi;
|
||||
if (BCMCPU_IS_6358())
|
||||
bcm63xx_regs_spi = bcm6358_regs_spi;
|
||||
+ if (BCMCPU_IS_6362())
|
||||
+ bcm63xx_regs_spi = bcm6362_regs_spi;
|
||||
if (BCMCPU_IS_6368())
|
||||
bcm63xx_regs_spi = bcm6368_regs_spi;
|
||||
}
|
||||
@@ -99,6 +105,9 @@ int __init bcm63xx_spi_register(void)
|
||||
/* Set bus frequency */
|
||||
spi_pdata.speed_hz = clk_get_rate(periph_clk);
|
||||
|
||||
+ if (BCMCPU_IS_6362())
|
||||
+ spi_pdata.bus_num = 1;
|
||||
+
|
||||
spi_resources[0].start = bcm63xx_regset_address(RSET_SPI);
|
||||
spi_resources[0].end = spi_resources[0].start;
|
||||
spi_resources[1].start = bcm63xx_get_irq_number(IRQ_SPI);
|
||||
@@ -110,7 +119,7 @@ int __init bcm63xx_spi_register(void)
|
||||
spi_pdata.msg_ctl_width = SPI_6338_MSG_CTL_WIDTH;
|
||||
}
|
||||
|
||||
- if (BCMCPU_IS_6358() || BCMCPU_IS_6368()) {
|
||||
+ if (BCMCPU_IS_6358() || BCMCPU_IS_6362() || BCMCPU_IS_6368()) {
|
||||
spi_resources[0].end += BCM_6358_RSET_SPI_SIZE - 1;
|
||||
spi_pdata.fifo_size = SPI_6358_MSG_DATA_SIZE;
|
||||
spi_pdata.msg_type_shift = SPI_6358_MSG_TYPE_SHIFT;
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
|
||||
@@ -81,6 +81,9 @@ static inline unsigned long bcm63xx_spir
|
||||
#ifdef CONFIG_BCM63XX_CPU_6358
|
||||
__GEN_SPI_RSET(6358)
|
||||
#endif
|
||||
+#ifdef CONFIG_BCM63XX_CPU_6362
|
||||
+ __GEN_SPI_RSET(6362)
|
||||
+#endif
|
||||
#ifdef CONFIG_BCM63XX_CPU_6368
|
||||
__GEN_SPI_RSET(6368)
|
||||
#endif
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
|
||||
@@ -1393,6 +1393,22 @@
|
||||
#define SPI_6358_MSG_TAIL 0x709
|
||||
#define SPI_6358_RX_TAIL 0x70B
|
||||
|
||||
+/* BCM 6362 SPI core */
|
||||
+#define SPI_6362_MSG_CTL 0x00 /* 16-bits register */
|
||||
+#define SPI_6362_MSG_DATA 0x02
|
||||
+#define SPI_6362_MSG_DATA_SIZE 0x21e
|
||||
+#define SPI_6362_RX_DATA 0x400
|
||||
+#define SPI_6362_RX_DATA_SIZE 0x220
|
||||
+#define SPI_6362_CMD 0x700 /* 16-bits register */
|
||||
+#define SPI_6362_INT_STATUS 0x702
|
||||
+#define SPI_6362_INT_MASK_ST 0x703
|
||||
+#define SPI_6362_INT_MASK 0x704
|
||||
+#define SPI_6362_ST 0x705
|
||||
+#define SPI_6362_CLK_CFG 0x706
|
||||
+#define SPI_6362_FILL_BYTE 0x707
|
||||
+#define SPI_6362_MSG_TAIL 0x709
|
||||
+#define SPI_6362_RX_TAIL 0x70B
|
||||
+
|
||||
/* BCM 6358 SPI core */
|
||||
#define SPI_6368_MSG_CTL 0x00 /* 16-bits register */
|
||||
#define SPI_6368_MSG_CTL_WIDTH 16
|
|
@ -1,71 +0,0 @@
|
|||
From fb9e98936590637c26b66d60137a7b44b329a254 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
Date: Sun, 12 Feb 2012 14:40:56 +0100
|
||||
Subject: [PATCH 59/84] MIPS: BCM63XX: enable USB for BCM6362
|
||||
|
||||
BCM6362 has the same USB controller as BCM6368.
|
||||
|
||||
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
---
|
||||
arch/mips/bcm63xx/Kconfig | 2 ++
|
||||
arch/mips/bcm63xx/clk.c | 4 ++++
|
||||
arch/mips/bcm63xx/dev-usb-ehci.c | 3 ++-
|
||||
arch/mips/bcm63xx/dev-usb-ohci.c | 2 +-
|
||||
drivers/usb/host/ehci-bcm63xx.c | 2 +-
|
||||
drivers/usb/host/ohci-bcm63xx.c | 2 +-
|
||||
6 files changed, 11 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/Kconfig
|
||||
+++ b/arch/mips/bcm63xx/Kconfig
|
||||
@@ -40,6 +40,8 @@ config BCM63XX_CPU_6358
|
||||
config BCM63XX_CPU_6362
|
||||
bool "support 6362 CPU"
|
||||
select HW_HAS_PCI
|
||||
+ select BCM63XX_OHCI
|
||||
+ select BCM63XX_EHCI
|
||||
|
||||
config BCM63XX_CPU_6368
|
||||
bool "support 6368 CPU"
|
||||
--- a/arch/mips/bcm63xx/clk.c
|
||||
+++ b/arch/mips/bcm63xx/clk.c
|
||||
@@ -167,6 +167,8 @@ static void usbh_set(struct clk *clk, in
|
||||
bcm_hwclock_set(CKCTL_6328_USBH_EN, enable);
|
||||
else if (BCMCPU_IS_6348())
|
||||
bcm_hwclock_set(CKCTL_6348_USBH_EN, enable);
|
||||
+ else if (BCMCPU_IS_6362())
|
||||
+ bcm_hwclock_set(CKCTL_6362_USBH_EN, enable);
|
||||
else if (BCMCPU_IS_6368())
|
||||
bcm_hwclock_set(CKCTL_6368_USBH_EN, enable);
|
||||
else
|
||||
--- a/arch/mips/bcm63xx/dev-usb-ehci.c
|
||||
+++ b/arch/mips/bcm63xx/dev-usb-ehci.c
|
||||
@@ -81,7 +81,8 @@ static struct platform_device bcm63xx_eh
|
||||
|
||||
int __init bcm63xx_ehci_register(void)
|
||||
{
|
||||
- if (!BCMCPU_IS_6328() && !BCMCPU_IS_6358() && !BCMCPU_IS_6368())
|
||||
+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6358() && !BCMCPU_IS_6362() &&
|
||||
+ !BCMCPU_IS_6368())
|
||||
return 0;
|
||||
|
||||
ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0);
|
||||
--- a/arch/mips/bcm63xx/usb-common.c
|
||||
+++ b/arch/mips/bcm63xx/usb-common.c
|
||||
@@ -100,7 +100,7 @@ void bcm63xx_usb_priv_ohci_cfg_set(void)
|
||||
bcm_rset_writel(RSET_USBH_PRIV, 0x1c0020,
|
||||
USBH_PRIV_TEST_6358_REG);
|
||||
|
||||
- } else if (BCMCPU_IS_6328() || BCMCPU_IS_6368()) {
|
||||
+ } else if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368()) {
|
||||
reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG);
|
||||
reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK;
|
||||
reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK;
|
||||
@@ -135,7 +135,7 @@ void bcm63xx_usb_priv_ehci_cfg_set(void)
|
||||
bcm_rset_writel(RSET_USBH_PRIV, 0x1c0020,
|
||||
USBH_PRIV_TEST_6358_REG);
|
||||
|
||||
- } else if (BCMCPU_IS_6328() || BCMCPU_IS_6368()) {
|
||||
+ } else if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368()) {
|
||||
reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG);
|
||||
reg &= ~USBH_PRIV_SWAP_EHCI_ENDN_MASK;
|
||||
reg |= USBH_PRIV_SWAP_EHCI_DATA_MASK;
|
|
@ -1,67 +0,0 @@
|
|||
From eac04ec501cac3069c279ccaa72fce4f530a4071 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jonas.gorski@gmail.com>
|
||||
Date: Sun, 8 Jul 2012 21:07:12 +0200
|
||||
Subject: [PATCH 68/72] MIPS: BCM63XX: enable enetsw for BCM6362
|
||||
|
||||
---
|
||||
arch/mips/bcm63xx/clk.c | 4 +++-
|
||||
arch/mips/bcm63xx/dev-enet.c | 6 ++++--
|
||||
arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h | 1 +
|
||||
3 files changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/arch/mips/bcm63xx/clk.c
|
||||
+++ b/arch/mips/bcm63xx/clk.c
|
||||
@@ -121,11 +121,13 @@ static void enetsw_set(struct clk *clk,
|
||||
{
|
||||
u32 mask;
|
||||
|
||||
- if (!BCMCPU_IS_6328() && !BCMCPU_IS_6368())
|
||||
+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368())
|
||||
return;
|
||||
|
||||
if (BCMCPU_IS_6328())
|
||||
mask = CKCTL_6328_ROBOSW_EN;
|
||||
+ else if (BCMCPU_IS_6362())
|
||||
+ mask = CKCTL_6362_ROBOSW_EN;
|
||||
else
|
||||
mask = CKCTL_6368_ROBOSW_EN | CKCTL_6368_SWPKT_USB_EN |
|
||||
CKCTL_6368_SWPKT_SAR_EN;
|
||||
--- a/arch/mips/bcm63xx/dev-enet.c
|
||||
+++ b/arch/mips/bcm63xx/dev-enet.c
|
||||
@@ -141,7 +141,7 @@ static int __init register_shared(void)
|
||||
shared_res[0].end = shared_res[0].start;
|
||||
shared_res[0].end += (RSET_ENETDMA_SIZE) - 1;
|
||||
|
||||
- if (BCMCPU_IS_6328() || BCMCPU_IS_6368())
|
||||
+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368())
|
||||
chan_count = 32;
|
||||
else
|
||||
chan_count = 16;
|
||||
@@ -224,7 +224,7 @@ bcm63xx_enetsw_register(const struct bcm
|
||||
{
|
||||
int ret;
|
||||
|
||||
- if (!BCMCPU_IS_6328() && !BCMCPU_IS_6368())
|
||||
+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368())
|
||||
return -ENODEV;
|
||||
|
||||
ret = register_shared();
|
||||
@@ -243,6 +243,8 @@ bcm63xx_enetsw_register(const struct bcm
|
||||
|
||||
if (BCMCPU_IS_6328())
|
||||
enetsw_pd.num_ports = ENETSW_PORTS_6328;
|
||||
+ else if (BCMCPU_IS_6362())
|
||||
+ enetsw_pd.num_ports = ENETSW_PORTS_6362;
|
||||
else if (BCMCPU_IS_6368())
|
||||
enetsw_pd.num_ports = ENETSW_PORTS_6368;
|
||||
|
||||
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
|
||||
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
|
||||
@@ -44,6 +44,7 @@ struct bcm63xx_enet_platform_data {
|
||||
*/
|
||||
#define ENETSW_MAX_PORT 6
|
||||
#define ENETSW_PORTS_6328 5 /* 4 FE PHY + 1 RGMII */
|
||||
+#define ENETSW_PORTS_6362 6 /* 4 FE PHY + 2 RGMII */
|
||||
#define ENETSW_PORTS_6368 6 /* 4 FE PHY + 2 RGMII */
|
||||
|
||||
#define ENETSW_RGMII_PORT0 4
|
|
@ -107,7 +107,7 @@
|
|||
#include <bcm63xx_cpu.h>
|
||||
#include <bcm63xx_dev_flash.h>
|
||||
#include <bcm63xx_dev_hsspi.h>
|
||||
@@ -162,6 +163,13 @@ int __init bcm63xx_flash_register(int nu
|
||||
@@ -157,6 +158,13 @@ int __init bcm63xx_flash_register(int nu
|
||||
val = bcm_mpi_readl(MPI_CSBASE_REG(0));
|
||||
val &= MPI_CSBASE_BASE_MASK;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#endif
|
||||
|
||||
/*
|
||||
@@ -3313,6 +3362,7 @@ static const struct board_info __initcon
|
||||
@@ -3196,6 +3245,7 @@ static const struct board_info __initcon
|
||||
#endif
|
||||
#ifdef CONFIG_BCM63XX_CPU_6345
|
||||
&board_96345gw2,
|
|
@ -1,6 +1,6 @@
|
|||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -2973,6 +2973,374 @@ static struct board_info __initdata boar
|
||||
@@ -2856,6 +2856,374 @@ static struct board_info __initdata boar
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -375,7 +375,7 @@
|
|||
/* T-Home Speedport W 303V Typ B */
|
||||
static struct board_info __initdata board_spw303v = {
|
||||
.name = "96358-502V",
|
||||
@@ -3401,6 +3769,10 @@ static const struct board_info __initcon
|
||||
@@ -3284,6 +3652,10 @@ static const struct board_info __initcon
|
||||
&board_nb4_fxc_r2,
|
||||
&board_ct6373_1,
|
||||
&board_HW553,
|
||||
|
@ -386,7 +386,7 @@
|
|||
&board_spw303v,
|
||||
&board_DVAG3810BN,
|
||||
#endif
|
||||
@@ -3466,13 +3838,37 @@ static void __init boardid_fixup(u8 *boo
|
||||
@@ -3349,13 +3721,37 @@ static void __init boardid_fixup(u8 *boo
|
||||
struct bcm_tag *tag = (struct bcm_tag *)(boot_addr + CFE_OFFSET_64K);
|
||||
char *board_name = (char *)bcm63xx_nvram_get_name();
|
||||
|
||||
|
@ -433,7 +433,7 @@
|
|||
|
||||
--- a/drivers/mtd/bcm63xxpart.c
|
||||
+++ b/drivers/mtd/bcm63xxpart.c
|
||||
@@ -93,6 +93,11 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
@@ -94,6 +94,11 @@ static int bcm63xx_parse_cfe_partitions(
|
||||
BCM63XX_CFE_BLOCK_SIZE);
|
||||
|
||||
cfelen = cfe_erasesize;
|
||||
|
@ -442,6 +442,6 @@
|
|||
+ if (!strncmp(bcm63xx_nvram_get_name(), "HW556", 5))
|
||||
+ cfelen = 0x20000;
|
||||
+
|
||||
nvramlen = bcm63xx_nvram_get_psi_size() * 1024;
|
||||
nvramlen = bcm63xx_nvram_get_psi_size();
|
||||
nvramlen = roundup(nvramlen, cfe_erasesize);
|
||||
nvramaddr = master->size - nvramlen;
|
|
@ -1,6 +1,6 @@
|
|||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -803,6 +803,60 @@ static struct board_info __initdata boar
|
||||
@@ -799,6 +799,60 @@ static struct board_info __initdata boar
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -61,7 +61,7 @@
|
|||
#endif
|
||||
|
||||
/*
|
||||
@@ -3757,6 +3811,7 @@ static const struct board_info __initcon
|
||||
@@ -3614,6 +3668,7 @@ static const struct board_info __initcon
|
||||
#ifdef CONFIG_BCM63XX_CPU_6345
|
||||
&board_96345gw2,
|
||||
&board_rta770bw,
|
|
@ -1,6 +1,6 @@
|
|||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -1953,6 +1953,99 @@ static struct board_info __initdata boar
|
||||
@@ -2056,6 +2056,99 @@ static struct board_info __initdata boar
|
||||
|
||||
.has_ohci0 = 1,
|
||||
.has_ehci0 = 1,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -1398,6 +1398,19 @@ static struct board_info __initdata boar
|
||||
@@ -1501,6 +1501,19 @@ static struct board_info __initdata boar
|
||||
},
|
||||
|
||||
.has_ohci0 = 1,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
|
||||
@@ -858,6 +858,17 @@ static struct board_info __initdata boar
|
||||
@@ -961,6 +961,17 @@ static struct board_info __initdata boar
|
||||
.active_low = 1,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
.force_speed_100 = 1,
|
||||
.force_duplex_full = 1,
|
||||
},
|
||||
@@ -863,6 +867,8 @@ static struct board_info __initdata boar
|
||||
@@ -917,6 +921,8 @@ static struct board_info __initdata boar
|
||||
.use_internal_phy = 1,
|
||||
},
|
||||
.enet1 = {
|
||||
|
@ -27,7 +27,7 @@
|
|||
.force_speed_100 = 1,
|
||||
.force_duplex_full = 1,
|
||||
},
|
||||
@@ -935,6 +941,8 @@ static struct board_info __initdata boar
|
||||
@@ -989,6 +995,8 @@ static struct board_info __initdata boar
|
||||
},
|
||||
|
||||
.enet1 = {
|
||||
|
@ -36,7 +36,7 @@
|
|||
.force_speed_100 = 1,
|
||||
.force_duplex_full = 1,
|
||||
},
|
||||
@@ -1164,6 +1172,8 @@ static struct board_info __initdata boar
|
||||
@@ -1218,6 +1226,8 @@ static struct board_info __initdata boar
|
||||
.use_internal_phy = 1,
|
||||
},
|
||||
.enet1 = {
|
||||
|
@ -45,7 +45,7 @@
|
|||
.force_speed_100 = 1,
|
||||
.force_duplex_full = 1,
|
||||
},
|
||||
@@ -1339,6 +1349,8 @@ static struct board_info __initdata boar
|
||||
@@ -1393,6 +1403,8 @@ static struct board_info __initdata boar
|
||||
},
|
||||
|
||||
.enet1 = {
|
||||
|
@ -54,7 +54,7 @@
|
|||
.force_speed_100 = 1,
|
||||
.force_duplex_full = 1,
|
||||
},
|
||||
@@ -1413,6 +1425,8 @@ static struct board_info __initdata boar
|
||||
@@ -1467,6 +1479,8 @@ static struct board_info __initdata boar
|
||||
.use_internal_phy = 1,
|
||||
},
|
||||
.enet1 = {
|
||||
|
@ -63,7 +63,7 @@
|
|||
.force_speed_100 = 1,
|
||||
.force_duplex_full = 1,
|
||||
},
|
||||
@@ -1434,6 +1448,8 @@ static struct board_info __initdata boar
|
||||
@@ -1488,6 +1502,8 @@ static struct board_info __initdata boar
|
||||
.use_internal_phy = 1,
|
||||
},
|
||||
.enet1 = {
|
||||
|
@ -72,7 +72,7 @@
|
|||
.force_speed_100 = 1,
|
||||
.force_duplex_full = 1,
|
||||
},
|
||||
@@ -1453,6 +1469,8 @@ static struct board_info __initdata boar
|
||||
@@ -1507,6 +1523,8 @@ static struct board_info __initdata boar
|
||||
.use_internal_phy = 1,
|
||||
},
|
||||
.enet1 = {
|
||||
|
@ -81,7 +81,7 @@
|
|||
.force_speed_100 = 1,
|
||||
.force_duplex_full = 1,
|
||||
},
|
||||
@@ -1828,6 +1846,8 @@ static struct board_info __initdata boar
|
||||
@@ -1882,6 +1900,8 @@ static struct board_info __initdata boar
|
||||
},
|
||||
|
||||
.enet1 = {
|
||||
|
@ -90,7 +90,7 @@
|
|||
.force_speed_100 = 1,
|
||||
.force_duplex_full = 1,
|
||||
},
|
||||
@@ -1880,6 +1900,8 @@ static struct board_info __initdata boar
|
||||
@@ -1934,6 +1954,8 @@ static struct board_info __initdata boar
|
||||
},
|
||||
|
||||
.enet1 = {
|
||||
|
@ -99,7 +99,7 @@
|
|||
.force_speed_100 = 1,
|
||||
.force_duplex_full = 1,
|
||||
},
|
||||
@@ -2020,6 +2042,8 @@ static struct board_info __initdata boar
|
||||
@@ -2074,6 +2096,8 @@ static struct board_info __initdata boar
|
||||
},
|
||||
|
||||
.enet1 = {
|
||||
|
@ -108,7 +108,7 @@
|
|||
.force_speed_100 = 1,
|
||||
.force_duplex_full = 1,
|
||||
},
|
||||
@@ -2137,6 +2161,8 @@ static struct board_info __initdata boar
|
||||
@@ -2191,6 +2215,8 @@ static struct board_info __initdata boar
|
||||
},
|
||||
|
||||
.enet1 = {
|
|
@ -1,6 +1,6 @@
|
|||
--- a/arch/mips/bcm63xx/nvram.c
|
||||
+++ b/arch/mips/bcm63xx/nvram.c
|
||||
@@ -40,6 +40,13 @@ struct bcm963xx_nvram {
|
||||
@@ -41,6 +41,13 @@ struct bcm963xx_nvram {
|
||||
static struct bcm963xx_nvram nvram;
|
||||
static int mac_addr_used;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
|||
void __init bcm63xx_nvram_init(void *addr)
|
||||
{
|
||||
unsigned int check_len;
|
||||
@@ -47,6 +54,7 @@ void __init bcm63xx_nvram_init(void *add
|
||||
@@ -48,6 +55,7 @@ void __init bcm63xx_nvram_init(void *add
|
||||
|
||||
/* extract nvram data */
|
||||
memcpy(&nvram, addr, sizeof(nvram));
|
||||
|
|
Loading…
Reference in New Issue