brcm47xx: add support for NAND flash on devices using bcma

This patch add support for the NAND flash on BCM5357 based devices like the WNR3500Lv2.

Thank you Tathagata Das <tathagata@alumnux.com> for the patch

SVN-Revision: 30943
This commit is contained in:
Hauke Mehrtens 2012-03-14 22:59:39 +00:00
parent 7fee567dc0
commit cee31ca238
14 changed files with 1171 additions and 28 deletions

View file

@ -24,6 +24,7 @@ CONFIG_BCMA_DRIVER_PCI_HOSTMODE=y
CONFIG_BCMA_HOST_PCI=y
CONFIG_BCMA_HOST_PCI_POSSIBLE=y
CONFIG_BCMA_HOST_SOC=y
CONFIG_BCMA_NFLASH=y
CONFIG_BCMA_POSSIBLE=y
CONFIG_BCMA_SFLASH=y
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@ -94,6 +95,10 @@ CONFIG_MIPS_MT_DISABLED=y
CONFIG_MTD_BCM47XX_PARTS=y
CONFIG_MTD_BCM47XX_PFLASH=y
CONFIG_MTD_BCM47XX_SFLASH=y
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_BCM47XX=y
CONFIG_MTD_NAND_ECC=y
# CONFIG_MTD_SM_COMMON is not set
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_PER_CPU_KM=y
CONFIG_PAGEFLAGS_EXTENDED=y

File diff suppressed because it is too large Load diff

View file

@ -13,9 +13,9 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
--- a/drivers/bcma/bcma_private.h
+++ b/drivers/bcma/bcma_private.h
@@ -46,6 +46,8 @@ u32 bcma_pmu_get_clockcpu(struct bcma_dr
int bcma_sflash_init(struct bcma_drv_cc *cc);
#endif /* CONFIG_BCMA_SFLASH */
@@ -51,6 +51,8 @@ int bcma_sflash_init(struct bcma_drv_cc
int bcma_nflash_init(struct bcma_drv_cc *cc);
#endif /* CONFIG_BCMA_NFLASH */
+u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
+

View file

@ -28,7 +28,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
void bcma_bus_unregister(struct bcma_bus *bus);
int __init bcma_bus_early_register(struct bcma_bus *bus,
struct bcma_device *core_cc,
@@ -55,7 +55,7 @@ extern void __exit bcma_host_pci_exit(vo
@@ -60,7 +60,7 @@ extern void __exit bcma_host_pci_exit(vo
#endif /* CONFIG_BCMA_HOST_PCI */
#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE

View file

@ -96,7 +96,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+}
--- a/drivers/bcma/bcma_private.h
+++ b/drivers/bcma/bcma_private.h
@@ -55,6 +55,7 @@ extern void __exit bcma_host_pci_exit(vo
@@ -60,6 +60,7 @@ extern void __exit bcma_host_pci_exit(vo
#endif /* CONFIG_BCMA_HOST_PCI */
#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE

View file

@ -15,7 +15,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -32,6 +32,8 @@
@@ -33,6 +33,8 @@
#include <linux/ssb/ssb_embedded.h>
#include <linux/bcma/bcma_soc.h>
#include <linux/platform_device.h>
@ -24,7 +24,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
#include <asm/bootinfo.h>
#include <asm/reboot.h>
#include <asm/time.h>
@@ -279,6 +281,31 @@ static int bcm47xx_get_invariants(struct
@@ -281,6 +283,31 @@ static int bcm47xx_get_invariants(struct
return 0;
}
@ -56,7 +56,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
static void __init bcm47xx_register_ssb(void)
{
int err;
@@ -311,6 +338,10 @@ static void __init bcm47xx_register_ssb(
@@ -313,6 +340,10 @@ static void __init bcm47xx_register_ssb(
memcpy(&mcore->serial_ports[1], &port, sizeof(port));
}
}

View file

@ -12,7 +12,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -192,8 +192,7 @@ int nvram_getenv(char *name, char *val,
@@ -243,8 +243,7 @@ int nvram_getenv(char *name, char *val,
value = eq + 1;
if ((eq - var) == strlen(name) &&
strncmp(var, name, (eq - var)) == 0) {

View file

@ -28,7 +28,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -91,156 +91,7 @@ static void bcm47xx_machine_halt(void)
@@ -93,156 +93,7 @@ static void bcm47xx_machine_halt(void)
}
#ifdef CONFIG_BCM47XX_SSB

View file

@ -20,10 +20,10 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org>
- * Copyright (C) 2010-2011 Hauke Mehrtens <hauke@hauke-m.de>
+ * Copyright (C) 2010-2012 Hauke Mehrtens <hauke@hauke-m.de>
* Copyright (C) 2011-2012 Tathagata Das <tathagata@alumnux.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 the
@@ -91,7 +91,7 @@ static void bcm47xx_machine_halt(void)
@@ -93,7 +93,7 @@ static void bcm47xx_machine_halt(void)
}
#ifdef CONFIG_BCM47XX_SSB
@ -32,7 +32,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
{
char prefix[10];
@@ -108,7 +108,7 @@ static int bcm47xx_get_sprom(struct ssb_
@@ -110,7 +110,7 @@ static int bcm47xx_get_sprom(struct ssb_
}
static int bcm47xx_get_invariants(struct ssb_bus *bus,
@ -41,7 +41,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
{
char buf[20];
@@ -163,7 +163,7 @@ static void __init bcm47xx_register_ssb(
@@ -165,7 +165,7 @@ static void __init bcm47xx_register_ssb(
char buf[100];
struct ssb_mipscore *mcore;
@ -50,7 +50,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
if (err)
printk(KERN_WARNING "bcm47xx: someone else already registered"
" a ssb SPROM callback handler (err %d)\n", err);
@@ -197,10 +197,41 @@ static void __init bcm47xx_register_ssb(
@@ -199,10 +199,41 @@ static void __init bcm47xx_register_ssb(
#endif
#ifdef CONFIG_BCM47XX_BCMA

View file

@ -1,6 +1,6 @@
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -96,6 +96,7 @@ static int bcm47xx_get_sprom_ssb(struct
@@ -98,6 +98,7 @@ static int bcm47xx_get_sprom_ssb(struct
char prefix[10];
if (bus->bustype == SSB_BUSTYPE_PCI) {
@ -8,7 +8,7 @@
snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
bus->host_pci->bus->number + 1,
PCI_SLOT(bus->host_pci->devfn));
@@ -124,6 +125,7 @@ static int bcm47xx_get_invariants(struct
@@ -126,6 +127,7 @@ static int bcm47xx_get_invariants(struct
if (nvram_getenv("boardrev", buf, sizeof(buf)) >= 0)
iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0);
@ -16,7 +16,7 @@
bcm47xx_fill_sprom(&iv->sprom, NULL);
if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
@@ -203,12 +205,14 @@ static int bcm47xx_get_sprom_bcma(struct
@@ -205,12 +207,14 @@ static int bcm47xx_get_sprom_bcma(struct
struct bcma_device *core;
if (bus->hosttype == BCMA_HOSTTYPE_PCI) {

View file

@ -1,6 +1,6 @@
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -198,3 +198,30 @@ int nvram_getenv(char *name, char *val,
@@ -249,3 +249,30 @@ int nvram_getenv(char *name, char *val,
return NVRAM_ERR_ENVNOTFOUND;
}
EXPORT_SYMBOL(nvram_getenv);
@ -33,7 +33,7 @@
+EXPORT_SYMBOL(nvram_get);
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -355,3 +355,20 @@ static int __init bcm47xx_register_flash
@@ -376,3 +376,20 @@ static int __init bcm47xx_register_flash
return -1;
}
fs_initcall(bcm47xx_register_flash);

View file

@ -245,8 +245,8 @@ out the configuration than the in kernel cfe config reader.
+
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -23,6 +23,8 @@
#include <asm/mach-bcm47xx/bus.h>
@@ -25,6 +25,8 @@
#include <linux/mtd/bcm47xx_nand.h>
static char nvram_buf[NVRAM_SPACE];
+static int cfe_env;
@ -254,7 +254,7 @@ out the configuration than the in kernel cfe config reader.
/* Probe for NVRAM header */
static void early_nvram_init_pflash(void)
@@ -59,6 +61,25 @@ static void early_nvram_init_pflash(void
@@ -61,6 +63,25 @@ static void early_nvram_init_pflash(void
break;
#endif
}
@ -280,7 +280,7 @@ out the configuration than the in kernel cfe config reader.
off = FLASH_MIN;
while (off <= lim) {
@@ -181,6 +202,12 @@ int nvram_getenv(char *name, char *val,
@@ -232,6 +253,12 @@ int nvram_getenv(char *name, char *val,
if (!nvram_buf[0])
early_nvram_init();
@ -293,7 +293,7 @@ out the configuration than the in kernel cfe config reader.
/* Look for name=value and return value */
var = &nvram_buf[sizeof(struct nvram_header)];
end = nvram_buf + sizeof(nvram_buf) - 2;
@@ -209,6 +236,9 @@ char *nvram_get(const char *name)
@@ -260,6 +287,9 @@ char *nvram_get(const char *name)
if (!nvram_buf[0])
early_nvram_init();

View file

@ -1,6 +1,6 @@
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -131,6 +131,10 @@ static int bcm47xx_get_invariants(struct
@@ -133,6 +133,10 @@ static int bcm47xx_get_invariants(struct
if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10);

View file

@ -1,8 +1,8 @@
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -22,7 +22,8 @@
#include <asm/mach-bcm47xx/bcm47xx.h>
@@ -24,7 +24,8 @@
#include <asm/mach-bcm47xx/bus.h>
#include <linux/mtd/bcm47xx_nand.h>
-static char nvram_buf[NVRAM_SPACE];
+char nvram_buf[NVRAM_SPACE];