Skip to contentSkip to conversation

mtd: bcm47part driver for BCM47XX chipsets

PATCH Superseded Rafał Miłecki 2 participants 3 messages Aug 29, 2012 Memory technology devices (MTD)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 mtd: bcm47part driver for BCM47XX chipsets

This driver provides parser detecting partitions on BCM47XX flash memories. It has many differences in comparison to BCM63XX, like:
1) Different CFE with no more trivial MAGICs
2) More partitions types (board_data, ML, POT)
3) Supporting more than 1 flash on a device
which resulted in decision of writing new parser.

It uses generic mtd interface and was successfully tested with Netgear WNDR4500 router which has 2 flash memories: serial one and NAND one.

---
V2: 1) Add support for more partitinos (ML and POT)
2) Optimize: don't scan whole flash (like up to 128 MiB)
3) Optimize: don't scan TRX partitions after detecting header

V3: 1) More defines less magic numbers
2) Less duplication by adding bcm47part_add_part
3) Mask out MTD_WRITEABLE only when needed

V4: 1) Use u32 *buf (no more fourcc casting)
2) Fix buf size
3) Optimize: put continue where possible
4) Don't check for filled .size - it was an old idea
5) Rename driver to match bcm64xx naming schema
6) Coding style fixes

---
 drivers/mtd/Kconfig       |    4 +
 drivers/mtd/Makefile      |    1 +
 drivers/mtd/bcm47xxpart.c |  201 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 206 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/bcm47xxpart.c
drivers/mtd/Kconfig +4 -0
index ee2330f..c75b386 100644
@@ -156,6 +156,10 @@ config MTD_BCM63XX_PARTS
 	  This provides partions parsing for BCM63xx devices with CFE
 	  bootloaders.
 
+config MTD_BCM47XX_PARTS
+	tristate "BCM47XX partitioning support"
+	depends on BCM47XX
+
 comment "User Modules And Translation Layers"
 
 config MTD_CHAR
drivers/mtd/Makefile +1 -0
index f901354..18a38e5 100644
@@ -12,6 +12,7 @@ obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
 obj-$(CONFIG_MTD_AFS_PARTS)	+= afs.o
 obj-$(CONFIG_MTD_AR7_PARTS)	+= ar7part.o
 obj-$(CONFIG_MTD_BCM63XX_PARTS)	+= bcm63xxpart.o
+obj-$(CONFIG_MTD_BCM47XX_PARTS)	+= bcm47xxpart.o
 
 # 'Users' - code which presents functionality to userspace.
 obj-$(CONFIG_MTD_CHAR)		+= mtdchar.o
drivers/mtd/bcm47xxpart.c new file +201 -0

201 lines not on this page · raw message

Signature · 1 line
1.7.7
#1 lore raw
Quoted 6 lines · Rafał Miłecki

This driver provides parser detecting partitions on BCM47XX flash memories. It has many differences in comparison to BCM63XX, like:
1) Different CFE with no more trivial MAGICs
2) More partitions types (board_data, ML, POT)
3) Supporting more than 1 flash on a device
which resulted in decision of writing new parser.

Aiaiai! [1] [2]

$:~/git/maintaining$ ./verify ../l2-mtd/ mips-bcm47xx_defconfig < ~/tmp/rafal.mbox 
Tested the patch(es) on top of the following commits:
1f7fb90 Quick fixes - applied by aiaiai
340b100 mtd: mtd_nandecctest: make module_init() return an error code if test fails
ef3b0f6 mtd: mtd_nandecctest: remove unnecessary srandom32() call
0f06219 mtd: m25p80: add support for the EON EN25Q64 chip

--------------------------------------------------------------------------------

Successfully built configuration "mips-bcm47xx_defconfig,mips,mips-linux-", results:

after_patching.log renamed from before_patching.log +0 -0
@@ @@
+drivers/mtd/bcm47xxpart.c:178 bcm47xxpart_parse() warn: possible memory leak of 'buf' [smatch]

--------------------------------------------------------------------------------

checkpatch.pl has some complaints:

--------------------------------------------------------------------------------

checkpatch.pl results for patch "[PATCH] mtd: bcm47part driver for BCM47XX chipsets"

WARNING:CONFIG_DESCRIPTION: please write a paragraph that describes the config symbol fully #35: FILE: drivers/mtd/Kconfig:151:
+config MTD_BCM47XX_PARTS

total: 0 errors, 1 warnings, 218 lines checked

--------------------------------------------------------------------------------

References:

1. http://git.infradead.org/users/dedekind/aiaiai.git
2. http://git.infradead.org/users/dedekind/maintaining.git

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#2 lore raw

2012/8/29 Artem Bityutskiy <[email protected]>:

Quoted 4 lines
after_patching.log renamed from before_patching.log +0 -0

@@ @@
+drivers/mtd/bcm47xxpart.c:178 bcm47xxpart_parse() warn: possible memory leak of 'buf' [smatch]

Ouch, my bad...

Quoted 5 lines

checkpatch.pl results for patch "[PATCH] mtd: bcm47part driver for BCM47XX chipsets"

WARNING:CONFIG_DESCRIPTION: please write a paragraph that describes the config symbol fully #35: FILE: drivers/mtd/Kconfig:151:
+config MTD_BCM47XX_PARTS

Do you think something like:

Quoted 1 line

This provides partitions parser for devices based on BCM47xx boards.

will be enough? checkpatch still generates error (it believes description is too short), but I'm not sure what else I could put here.

Signature · 1 line
Rafał