Skip to contentSkip to conversation

mtd: bcm47part driver for BCM47XX chipsets

RFC PATCH Superseded Rafał Miłecki 3 participants 6 messages Aug 24, 2012 – Aug 29, 2012 Memory technology devices (MTD)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

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

This driver provides parser detecting partitions on BCM47XX flash memories. It has many differences in comparision to older 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.
---
Example of scanning (from my WNDR4500):

[    3.144000] Creating 3 MTD partitions on "bcm47sflash":
[    3.148000] 0x000000000000-0x0000001e0000 : "boot"
[    3.156000] 0x0000001e0000-0x0000001f0000 : "board_data"
[    3.164000] 0x0000001f0000-0x000000200000 : "nvram"
[    4.632000] Creating 2 MTD partitions on "NAND 128MiB 3,3V 8-bit":
[    4.636000] 0x00000000001c-0x0000001416a4 : "linux"
[    4.644000] 0x0000001416a4-0x0000007ba000 : "rootfs"

Right now there aren't any mainline MTD devices driver using this parser. It was tested with out-of-tree drivers floating around (for example on linux-wireless mailing list).

As this driver uses generic mtd interface, it should be safe to include it in kernel without breaking anything in the future.

TODO:
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

---
 drivers/mtd/Kconfig     |    4 +
 drivers/mtd/Makefile    |    1 +
 drivers/mtd/bcm47part.c |  154 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 159 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/bcm47part.c
drivers/mtd/Kconfig +4 -0
index 27143e0..0cd4096 100644
@@ -148,6 +148,10 @@ config MTD_BCM63XX_PARTS
 	  This provides partions parsing for BCM63xx devices with CFE
 	  bootloaders.
 
+config MTD_BCM47_PARTS
+	tristate "BCM47XX partitioning support"
+	depends on BCM47XX
+
 comment "User Modules And Translation Layers"
 
 config MTD_CHAR
drivers/mtd/Makefile +1 -0
index f901354..dac90e6 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_BCM47_PARTS)	+= bcm47part.o
 
 # 'Users' - code which presents functionality to userspace.
 obj-$(CONFIG_MTD_CHAR)		+= mtdchar.o
drivers/mtd/bcm47part.c new file +154 -0

154 lines not on this page · raw message

Signature · 1 line
1.7.7
#1 lore raw

2012/8/25 Rafał Miłecki <[email protected]>:

Quoted 25 lines

This driver provides parser detecting partitions on BCM47XX flash memories. It has many differences in comparision to older 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.
---
Example of scanning (from my WNDR4500):

[    3.144000] Creating 3 MTD partitions on "bcm47sflash":
[    3.148000] 0x000000000000-0x0000001e0000 : "boot"
[    3.156000] 0x0000001e0000-0x0000001f0000 : "board_data"
[    3.164000] 0x0000001f0000-0x000000200000 : "nvram"
[    4.632000] Creating 2 MTD partitions on "NAND 128MiB 3,3V 8-bit":
[    4.636000] 0x00000000001c-0x0000001416a4 : "linux"
[    4.644000] 0x0000001416a4-0x0000007ba000 : "rootfs"

Right now there aren't any mainline MTD devices driver using this parser. It was tested with out-of-tree drivers floating around (for example on linux-wireless mailing list).

Quoted 7 lines

As this driver uses generic mtd interface, it should be safe to include it in kernel without breaking anything in the future.

TODO:
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

For development I've masked out MTD_WRITEABLE everywhere. It should be done only for "boot" probably.

Signature · 1 line
Rafał
#2 lore raw
In reply to Rafał Miłecki
Quoted 9 lines · Rafał Miłecki

This driver provides parser detecting partitions on BCM47XX flash memories. It has many differences in comparision to older 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.

Would you please send a defconfig which I could use to compile-test this?

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#3 lore raw
Quoted 8 lines · Artem Bityutskiy
Quoted 7 lines · Rafał Miłecki

This driver provides parser detecting partitions on BCM47XX flash memories. It has many differences in comparision to older 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.

Quoted 5 lines
Quoted 2 lines

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

Would you please send a defconfig which I could use to compile-test this?

Also, why did you decide to add one more bcm partitions parser instead of extending the existing one to support more types?

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#4 lore raw
Quoted 9 lines · Artem Bityutskiy
Quoted 8 lines · Artem Bityutskiy
Quoted 7 lines · Rafał Miłecki

This driver provides parser detecting partitions on BCM47XX flash memories. It has many differences in comparision to older 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.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

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

Would you please send a defconfig which I could use to compile-test this?

Also, why did you decide to add one more bcm partitions parser instead of extending the existing one to support more types?

bcm63xx and bcm47xx partitioning layout were (likely) developed independently by two different teams, they have nothing in common which could be reused. The bcm_tag for bcm63xx is only used there, and the trx header for bcm47xx is used only on these systems. bcm63xx's nvram looks also looks completely different (it has a fixed layout instead of being key-value pairs as in bcm47xx), so there is no real gain from trying to merge them.

Regards
Jonas

#5 lore raw
In reply to Artem Bityutskiy

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

Quoted 9 lines · Artem Bityutskiy
Quoted 8 lines · Rafał Miłecki
Quoted 7 lines

This driver provides parser detecting partitions on BCM47XX flash memories. It has many differences in comparision to older 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.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

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

Would you please send a defconfig which I could use to compile-test this?

Also, why did you decide to add one more bcm partitions parser instead of extending the existing one to support more types?

Artem: attached is config I use for compiling kernel for WNDR4500. Is that what you needed?

Signature · 1 line
Rafał