Skip to contentSkip to conversation

bcma: add basic NAND flash driver

PATCH Superseded Rafał Miłecki 1 participant 1 message Aug 5, 2012 Broadcom specific amba driver (bcma)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Rafał Miłecki

author maintainer
#0 lore raw

PATCH 1/1 bcma: add basic NAND flash driver

This is basic driver for NAND flash memory that allows reading it's content. It was succesfully tested on Netgear WNDR4500 which is BCM4706 based router.

This driver has been written using specs at:
http://bcm-v4.sipsolutions.net/NAND_Flash

CC Larry Finger <[email protected]>
CC Hauke Mehrtens <[email protected]>

---
John: I think I've heard somewhere that new drivers can go into currently developed release, skipping -next. Not sure if this is correct [at all/still]. Please grab this patch to the tree you find the best for it.

I've tested this patch by reading SQUASHFS header MAGIC from NAND flash with the following code:

u8 tmpbuf[512];
int ret = bcma_nflash_read(cc, 0x141400, 512, tmpbuf); if (ret != 512)

	pr_err("[ERR] NFLASH read failed. Function returned: %d\n", ret);
for (i = 0x120; i < 0x124; i++)
	pr_info("tmpbuf[%02d]: 0x%X\n", i, tmpbuf[i]);

(yeah, I had to figure out 0x141400 offset first).

---
 drivers/bcma/Kconfig                        |    4 +-
 drivers/bcma/bcma_private.h                 |    2 +-
 drivers/bcma/driver_chipcommon_nflash.c     |  377 ++++++++++++++++++++++++++-
 drivers/bcma/driver_chipcommon_pmu.c        |    2 +-
 include/linux/bcma/bcma_driver_chipcommon.h |   88 +++++++
 5 files changed, 466 insertions(+), 7 deletions(-)
drivers/bcma/Kconfig +2 -2
index 8d1f777..a58d7a9 100644
@@ -53,8 +53,8 @@ config BCMA_SFLASH
 	default y
 
 config BCMA_NFLASH
-	bool
-	depends on BCMA_DRIVER_MIPS && BROKEN
+	bool "Support for NAND flash"
+	depends on BCMA_DRIVER_MIPS
 	default y
 
 config BCMA_DRIVER_GMAC_CMN
drivers/bcma/bcma_private.h +1 -1
index 3cf9cc9..9895c7e 100644
@@ -68,7 +68,7 @@ int bcma_nflash_init(struct bcma_drv_cc *cc);
 #else
 static inline int bcma_nflash_init(struct bcma_drv_cc *cc)
 {
-	bcma_err(cc->core->bus, "NAND flash not supported\n");
+	bcma_err(cc->core->bus, "NAND flash support not enabled\n");
 	return 0;
 }
 #endif /* CONFIG_BCMA_NFLASH */
drivers/bcma/driver_chipcommon_nflash.c +374 -3

383 lines not on this page · raw message

drivers/bcma/driver_chipcommon_pmu.c +1 -1
index 4432617..fd6620e 100644
@@ -13,7 +13,7 @@
 #include <linux/export.h>
 #include <linux/bcma/bcma.h>
 
-static u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset)
+u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset)
 {
 	bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset);
 	bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR);
include/linux/bcma/bcma_driver_chipcommon.h +88 -0

126 lines not on this page · raw message

Signature · 1 line
1.7.7