--- a/arch/mips/bcm47xx/Kconfig
+++ b/arch/mips/bcm47xx/Kconfig
-@@ -24,6 +24,7 @@ config BCM47XX_BCMA
- select BCMA_DRIVER_MIPS
+@@ -25,6 +25,7 @@ config BCM47XX_BCMA
+ select BCMA_HOST_PCI if PCI
select BCMA_DRIVER_PCI_HOSTMODE if PCI
select BCMA_SFLASH
+ select BCMA_NFLASH
*
* 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
-@@ -80,3 +81,9 @@ void bcm47xx_sflash_struct_ssb_init(stru
- sflash->numblocks = scc->sflash.numblocks;
- sflash->size = scc->sflash.size;
+@@ -46,6 +47,12 @@ void bcm47xx_sflash_struct_bcma_init(str
+ sflash->numblocks = bcc->sflash.numblocks;
+ sflash->size = bcc->sflash.size;
}
+
+void bcm47xx_nflash_struct_bcma_init(struct bcm47xx_nflash *nflash, struct bcma_drv_cc *bcc)
+ nflash->nflash_type = BCM47XX_BUS_TYPE_BCMA;
+ nflash->bcc = bcc;
+}
+ #endif
+
+ #ifdef CONFIG_BCM47XX_SSB
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -4,6 +4,7 @@
static char nvram_buf[NVRAM_SPACE];
-@@ -139,6 +141,51 @@ static int early_nvram_init_sflash(void)
- return 0;
- }
+@@ -160,6 +162,51 @@ static void early_nvram_init_ssb(void)
+ #endif
+ #ifdef CONFIG_BCM47XX_BCMA
+static int early_nvram_init_nflash(void)
+{
+ struct nvram_header *header;
+ return ret;
+}
+
- #ifdef CONFIG_BCM47XX_SSB
- static void early_nvram_init_ssb(void)
+ static void early_nvram_init_bcma(void)
{
+ int err;
@@ -173,6 +220,11 @@ static void early_nvram_init_bcma(void)
if (err < 0)
printk(KERN_WARNING "can not read from flash: %i\n", err);
@@ -4,6 +4,7 @@
* Copyright (C) 2006 Michael Buesch <m@bues.ch>
* 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
-@@ -46,6 +47,7 @@ enum bcm47xx_bus_type bcm47xx_bus_type;
- EXPORT_SYMBOL(bcm47xx_bus_type);
+@@ -234,6 +235,21 @@ static int bcm47xx_get_sprom_bcma(struct
+ }
+ }
- struct bcm47xx_sflash bcm47xx_sflash;
+struct bcm47xx_nflash bcm47xx_nflash;
-
- static struct resource bcm47xx_pflash_resource = {
- .name = "bcm47xx_pflash",
-@@ -73,6 +75,19 @@ static struct platform_device bcm47xx_sf
- .num_resources = 1,
- };
-
++
+static struct resource bcm47xx_nflash_resource = {
+ .name = "bcm47xx_nflash",
+ .start = 0,
+ .num_resources = 1,
+};
+
- static void bcm47xx_machine_restart(char *command)
+ static void __init bcm47xx_register_bcma(void)
{
- printk(KERN_ALERT "Please stand by while rebooting the system...\n");
-@@ -369,6 +384,9 @@ static void __init bcm47xx_register_bcma
+ int err;
+@@ -248,6 +264,9 @@ static void __init bcm47xx_register_bcma
if (bcm47xx_bus.bcma.bus.drv_cc.flash_type == BCMA_SFLASH)
bcm47xx_sflash_struct_bcma_init(&bcm47xx_sflash, &bcm47xx_bus.bcma.bus.drv_cc);
+
+ if (bcm47xx_bus.bcma.bus.drv_cc.flash_type == BCMA_NFLASH)
+ bcm47xx_nflash_struct_bcma_init(&bcm47xx_nflash, &bcm47xx_bus.bcma.bus.drv_cc);
- }
- static int __init bcm47xx_register_flash_bcma(void)
-@@ -383,6 +401,9 @@ static int __init bcm47xx_register_flash
+ bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL);
+ }
+@@ -264,6 +283,9 @@ static int __init bcm47xx_register_flash
case BCMA_SFLASH:
bcm47xx_sflash_dev.dev.platform_data = &bcm47xx_sflash;
return platform_device_register(&bcm47xx_sflash_dev);
*
* 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
-@@ -13,6 +14,7 @@
+@@ -12,6 +13,7 @@
+ #include <linux/ssb/ssb.h>
#include <linux/bcma/bcma.h>
- #include <linux/mtd/mtd.h>
#include <bcm47xx.h>
+#include <linux/mtd/nand.h>
struct bcm47xx_sflash {
enum bcm47xx_bus_type sflash_type;
-@@ -29,11 +31,24 @@ struct bcm47xx_sflash {
- u32 blocksize; /* Block size */
- u32 numblocks; /* Number of blocks */
- u32 size; /* Total size in bytes */
--
-- struct mtd_info *mtd;
- };
-
- void bcm47xx_sflash_struct_bcma_init(struct bcm47xx_sflash *sflash, struct bcma_drv_cc *bcc);
+@@ -34,3 +36,18 @@ void bcm47xx_sflash_struct_bcma_init(str
void bcm47xx_sflash_struct_ssb_init(struct bcm47xx_sflash *sflash, struct ssb_chipcommon *scc);
extern struct bcm47xx_sflash bcm47xx_sflash;
bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o
--- a/drivers/bcma/bcma_private.h
+++ b/drivers/bcma/bcma_private.h
-@@ -47,6 +47,11 @@ u32 bcma_pmu_get_clockcpu(struct bcma_dr
+@@ -56,6 +56,11 @@ u32 bcma_pmu_get_clockcpu(struct bcma_dr
int bcma_sflash_init(struct bcma_drv_cc *cc);
#endif /* CONFIG_BCMA_SFLASH */
+config MTD_NAND_BCM47XX
+ tristate "bcm47xx nand flash support"
+ default y
-+ depends on BCM47XX
++ depends on BCM47XX && BCMA_NFLASH
+ select MTD_PARTITIONS
+ help
+ Support for bcm47xx nand flash
+MODULE_DESCRIPTION("BCM47XX NAND flash driver");
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
-@@ -422,6 +422,7 @@ struct bcma_chipcommon_pmu {
+@@ -436,6 +436,7 @@ struct bcma_chipcommon_pmu {
enum bcma_flash_type {
BCMA_PFLASH,
BCMA_SFLASH,
};
struct bcma_pflash {
-@@ -438,6 +439,14 @@ struct bcma_sflash {
+@@ -452,6 +453,14 @@ struct bcma_sflash {
};
#endif /* CONFIG_BCMA_SFLASH */
struct bcma_serial_port {
void *regs;
unsigned long clockspeed;
-@@ -463,6 +472,9 @@ struct bcma_drv_cc {
+@@ -477,6 +486,9 @@ struct bcma_drv_cc {
#ifdef CONFIG_BCMA_SFLASH
struct bcma_sflash sflash;
#endif /* CONFIG_BCMA_SFLASH */
};
int nr_serial_ports;
-@@ -528,4 +540,13 @@ int bcma_sflash_write(struct bcma_drv_cc
+@@ -542,4 +554,13 @@ int bcma_sflash_write(struct bcma_drv_cc
int bcma_sflash_erase(struct bcma_drv_cc *cc, u32 offset);
#endif /* CONFIG_BCMA_SFLASH */