Skip to contentSkip to conversation

dt-bindings: mtd: document Broadcom's TRX firmware format binding

PATCH Superseded Rafał Miłecki 5 participants 9 messages Jun 12, 2018 – Jul 7, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dt-bindings: mtd: document Broadcom's TRX firmware format binding

From: Rafał Miłecki <[email protected]>

Broadcom based home router devices use TRX firmware format. It's a container that can hold few partitions. If operating system is expected to access them it has to understand that format and parse flash data accordingly.

---
 .../bindings/mtd/partitions/brcm,trx.txt           | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt
Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +35 -0
new file mode 100644
index 000000000000..e590b884e5ac
@@ -0,0 +1,35 @@
+Broadcom TRX Container Partition
+================================
+
+TRX is Broadcom's official firmware format for the BCM947xx boards. It's used by
+most of the vendors building devices based on Broadcom's BCM47xx SoCs and is
+supported by the CFE bootloader.
+
+Design of the TRX format is very minimalistic. Its header contains
+identification fields, CRC32 checksum and the locations of embedded partitions.
+Its purpose is to store a few partitions in a format that can be distributed as
+a standalone file and written in a flash memory.
+
+Container can hold up to 4 partitions. The first partition has to contain a
+device executable binary (e.g. a kernel) as it's what the CFE bootloader starts
+executing. Other partitions can be used for operating system purposes. This is
+useful for systems that keep kernel and rootfs separated.
+
+TRX doesn't enforce any strict partition boundaries or size limits. All
+partitions have to be less than the 4GiB max size limit.
+
+There are two existing/known TRX variants:
+1) v1 which contains 3 partitions
+2) v2 which contains 4 partitions
+
+Required properties:
+- compatible : (required) must be either: "brcm,trx-v1" or "brcm,trx-v2"
+	followed by "brcm,trx"
+
+Example:
+
+flash@0 {
+	partitions {
+		compatible = "brcm,trx-v1", "brcm,trx";
+	};
+};
Signature · 6 lines
2.13.7


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#1 lore raw

PATCH 2/2 mtd: parsers: trx: add of_match_table with the new DT binding

From: Rafał Miłecki <[email protected]>

This allows using TRX parser to find TRX partitions on flash device described in DT using a proper binding. It's useful for devices storing firmware on a separated flash and having rootfs partition in it.

---
 drivers/mtd/parsers/parser_trx.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/mtd/parsers/parser_trx.c +8 -0
index df360a75e1eb..e4fc3611110a 100644
@@ -116,9 +116,17 @@ static int parser_trx_parse(struct mtd_info *mtd,
 	return i;
 };
 
+static const struct of_device_id mtd_parser_trx_of_match_table[] = {
+	{ .compatible = "brcm,trx" },
+	{ .compatible = "brcm,trx-v1" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, mtd_parser_trx_of_match_table);
+
 static struct mtd_part_parser mtd_parser_trx = {
 	.parse_fn = parser_trx_parse,
 	.name = "trx",
+	.of_match_table = mtd_parser_trx_of_match_table,
 };
 module_mtd_part_parser(mtd_parser_trx);
 
Signature · 6 lines
2.13.7


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
maintainer
#2 lore raw
In reply to Rafał Miłecki
Quoted 36 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Broadcom based home router devices use TRX firmware format. It's a container that can hold few partitions. If operating system is expected to access them it has to understand that format and parse flash data accordingly.

---
 .../bindings/mtd/partitions/brcm,trx.txt           | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt
Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +17 -0
new file mode 100644
index 000000000000..e590b884e5ac
@@ -0,0 +1,35 @@
+Broadcom TRX Container Partition
+================================
+
+TRX is Broadcom's official firmware format for the BCM947xx boards. It's used by
+most of the vendors building devices based on Broadcom's BCM47xx SoCs and is
+supported by the CFE bootloader.
+
+Design of the TRX format is very minimalistic. Its header contains
+identification fields, CRC32 checksum and the locations of embedded partitions.
+Its purpose is to store a few partitions in a format that can be distributed as
+a standalone file and written in a flash memory.
+
+Container can hold up to 4 partitions. The first partition has to contain a
+device executable binary (e.g. a kernel) as it's what the CFE bootloader starts
+executing. Other partitions can be used for operating system purposes. This is
+useful for systems that keep kernel and rootfs separated.
+

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt line 27

Quoted 10 lines
Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +10 -0
+TRX doesn't enforce any strict partition boundaries or size limits. All
+partitions have to be less than the 4GiB max size limit.
+
+There are two existing/known TRX variants:
+1) v1 which contains 3 partitions
+2) v2 which contains 4 partitions
+
+Required properties:
+- compatible : (required) must be either: "brcm,trx-v1" or "brcm,trx-v2"
+	followed by "brcm,trx"

What is the purpose of brcm,trx? Either that alone is enough or you need v1/v2 to distinguish the difference. You shouldn't need both.

Rob

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#3 lore raw
Quoted 53 lines · Rob Herring
Quoted 52 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Broadcom based home router devices use TRX firmware format. It's a container that can hold few partitions. If operating system is expected to access them it has to understand that format and parse flash data accordingly.

---
 .../bindings/mtd/partitions/brcm,trx.txt           | 35 
++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +4 -0
new file mode 100644
index 000000000000..e590b884e5ac
@@ -0,0 +1,35 @@
+Broadcom TRX Container Partition
+================================
+
+TRX is Broadcom's official firmware format for the BCM947xx boards. 

It's used by
+most of the vendors building devices based on Broadcom's BCM47xx SoCs and is

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +4 -0
+supported by the CFE bootloader.
+
+Design of the TRX format is very minimalistic. Its header contains
+identification fields, CRC32 checksum and the locations of embedded 

partitions.
+Its purpose is to store a few partitions in a format that can be distributed as

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +3 -0
+a standalone file and written in a flash memory.
+
+Container can hold up to 4 partitions. The first partition has to 

contain a
+device executable binary (e.g. a kernel) as it's what the CFE bootloader starts
+executing. Other partitions can be used for operating system purposes. This is

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +3 -0
+useful for systems that keep kernel and rootfs separated.
+
+TRX doesn't enforce any strict partition boundaries or size limits. 

All

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +5 -0
+partitions have to be less than the 4GiB max size limit.
+
+There are two existing/known TRX variants:
+1) v1 which contains 3 partitions
+2) v2 which contains 4 partitions
Quoted 8 lines

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt line 27

Quoted 5 lines
Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +3 -0
+
+Required properties:
+- compatible : (required) must be either: "brcm,trx-v1" or 

"brcm,trx-v2"

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +1 -0
+	followed by "brcm,trx"

What is the purpose of brcm,trx? Either that alone is enough or you need v1/v2 to distinguish the difference. You shouldn't need both.

I guess I incorrectly tried some pattern I saw when specifying SoC compatibility.

Can I have you advise here, please?

No TRX supporting code really needs a hint about used TRX version. TRX format (header) contains "version" field so any code dealing with TRX format can check that field. Then it knows what version it's dealing with.

Which binding(s) should I use in that case?

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

maintainer
#4 lore raw
Quoted 71 lines · Rafał Miłecki
Quoted 57 lines · Rob Herring
Quoted 56 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Broadcom based home router devices use TRX firmware format. It's a container that can hold few partitions. If operating system is expected
to access them it has to understand that format and parse flash data accordingly.

---
 .../bindings/mtd/partitions/brcm,trx.txt           | 35
++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt

diff --git a/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt b/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file mode 100644
index 000000000000..e590b884e5ac

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +4 -0
@@ -0,0 +1,35 @@
+Broadcom TRX Container Partition
+================================
+
+TRX is Broadcom's official firmware format for the BCM947xx boards.

It's used by
+most of the vendors building devices based on Broadcom's BCM47xx SoCs and is

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +4 -0
+supported by the CFE bootloader.
+
+Design of the TRX format is very minimalistic. Its header contains
+identification fields, CRC32 checksum and the locations of embedded

partitions.
+Its purpose is to store a few partitions in a format that can be distributed as

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +3 -0
+a standalone file and written in a flash memory.
+
+Container can hold up to 4 partitions. The first partition has to

contain a
+device executable binary (e.g. a kernel) as it's what the CFE bootloader starts
+executing. Other partitions can be used for operating system purposes. This is

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +3 -0
+useful for systems that keep kernel and rootfs separated.
+
+TRX doesn't enforce any strict partition boundaries or size limits.

All

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +6 -0
+partitions have to be less than the 4GiB max size limit.
+
+There are two existing/known TRX variants:
+1) v1 which contains 3 partitions
+2) v2 which contains 4 partitions
+
Quoted 8 lines
Quoted 4 lines

+Required properties:
+- compatible : (required) must be either: "brcm,trx-v1" or "brcm,trx-v2"
+ followed by "brcm,trx"

What is the purpose of brcm,trx? Either that alone is enough or you need
v1/v2 to distinguish the difference. You shouldn't need both.

I guess I incorrectly tried some pattern I saw when specifying SoC compatibility.

Quoted 8 lines

Can I have you advise here, please?

No TRX supporting code really needs a hint about used TRX version. TRX format (header) contains "version" field so any code dealing with TRX format can check that field. Then it knows what version it's dealing with.

Which binding(s) should I use in that case?

I'd just use "brcm,trx" then.

Rob

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#5 lore raw

PATCH v2 1/2 dt-bindings: mtd: document Broadcom's TRX firmware format binding

In reply to Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Broadcom based home router devices use TRX firmware format. It's a container that can hold few partitions. If operating system is expected to access them it has to understand that format and parse flash data accordingly.

---
V2: Drop unneeded "brcm,trx-v1" and "brcm,trx-v2" bindings.

---
 .../bindings/mtd/partitions/brcm,trx.txt           | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt
Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +37 -0
new file mode 100644
index 000000000000..b677147ca4e1
@@ -0,0 +1,37 @@
+Broadcom TRX Container Partition
+================================
+
+TRX is Broadcom's official firmware format for the BCM947xx boards. It's used by
+most of the vendors building devices based on Broadcom's BCM47xx SoCs and is
+supported by the CFE bootloader.
+
+Design of the TRX format is very minimalistic. Its header contains
+identification fields, CRC32 checksum and the locations of embedded partitions.
+Its purpose is to store a few partitions in a format that can be distributed as
+a standalone file and written in a flash memory.
+
+Container can hold up to 4 partitions. The first partition has to contain a
+device executable binary (e.g. a kernel) as it's what the CFE bootloader starts
+executing. Other partitions can be used for operating system purposes. This is
+useful for systems that keep kernel and rootfs separated.
+
+TRX doesn't enforce any strict partition boundaries or size limits. All
+partitions have to be less than the 4GiB max size limit.
+
+There are two existing/known TRX variants:
+1) v1 which contains 3 partitions
+2) v2 which contains 4 partitions
+
+There aren't separated compatible bindings for them as version can be trivialy
+detected by a software parsing TRX header.
+
+Required properties:
+- compatible : (required) must be "brcm,trx"
+
+Example:
+
+flash@0 {
+	partitions {
+		compatible = "brcm,trx";
+	};
+};
Signature · 6 lines
2.13.7


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#6 lore raw

PATCH v2 2/2 mtd: parsers: trx: add of_match_table with the new DT binding

From: Rafał Miłecki <[email protected]>

This allows using TRX parser to find TRX partitions on flash device described in DT using a proper binding. It's useful for devices storing firmware on a separated flash and having rootfs partition in it.

---
V2: Update to support only the "brcm,trx" binding

---
 drivers/mtd/parsers/parser_trx.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mtd/parsers/parser_trx.c +7 -0
index df360a75e1eb..f580a41a52b8 100644
@@ -116,9 +116,16 @@ static int parser_trx_parse(struct mtd_info *mtd,
 	return i;
 };
 
+static const struct of_device_id mtd_parser_trx_of_match_table[] = {
+	{ .compatible = "brcm,trx" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, mtd_parser_trx_of_match_table);
+
 static struct mtd_part_parser mtd_parser_trx = {
 	.parse_fn = parser_trx_parse,
 	.name = "trx",
+	.of_match_table = mtd_parser_trx_of_match_table,
 };
 module_mtd_part_parser(mtd_parser_trx);
 
Signature · 6 lines
2.13.7


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Reviewed-by on v2 1/2
#7 lore raw
In reply to Rafał Miłecki
Quoted 8 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Broadcom based home router devices use TRX firmware format. It's a container that can hold few partitions. If operating system is expected to access them it has to understand that format and parse flash data accordingly.

Quoted 7 lines

---
V2: Drop unneeded "brcm,trx-v1" and "brcm,trx-v2" bindings.

---
 .../bindings/mtd/partitions/brcm,trx.txt           | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#8 lore raw
In reply to Rafał Miłecki
Quoted 8 lines · On Tue, 26 Jun 2018 00:05:07 +0200 Rafał Miłecki <[email protected]> wrote:

From: Rafał Miłecki <[email protected]>

Broadcom based home router devices use TRX firmware format. It's a container that can hold few partitions. If operating system is expected to access them it has to understand that format and parse flash data accordingly.

Applied both patches.

Thanks,

Boris

Quoted 40 lines

---
V2: Drop unneeded "brcm,trx-v1" and "brcm,trx-v2" bindings.

---
 .../bindings/mtd/partitions/brcm,trx.txt           | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt
Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +27 -0
new file mode 100644
index 000000000000..b677147ca4e1
@@ -0,0 +1,37 @@
+Broadcom TRX Container Partition
+================================
+
+TRX is Broadcom's official firmware format for the BCM947xx boards. It's used by
+most of the vendors building devices based on Broadcom's BCM47xx SoCs and is
+supported by the CFE bootloader.
+
+Design of the TRX format is very minimalistic. Its header contains
+identification fields, CRC32 checksum and the locations of embedded partitions.
+Its purpose is to store a few partitions in a format that can be distributed as
+a standalone file and written in a flash memory.
+
+Container can hold up to 4 partitions. The first partition has to contain a
+device executable binary (e.g. a kernel) as it's what the CFE bootloader starts
+executing. Other partitions can be used for operating system purposes. This is
+useful for systems that keep kernel and rootfs separated.
+
+TRX doesn't enforce any strict partition boundaries or size limits. All
+partitions have to be less than the 4GiB max size limit.
+
+There are two existing/known TRX variants:
+1) v1 which contains 3 partitions
+2) v2 which contains 4 partitions
+
+There aren't separated compatible bindings for them as version can be trivialy
+detected by a software parsing TRX header.
+

Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt line 37

Quoted 10 lines
Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt new file +10 -0
+Required properties:
+- compatible : (required) must be "brcm,trx"
+
+Example:
+
+flash@0 {
+	partitions {
+		compatible = "brcm,trx";
+	};
+};

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/