Skip to contentSkip to conversation

ARM: dts: BCM5301X: Linksys EA9500 add fixed partitions

PATCH Superseded Vivek Unune 3 participants 8 messages Oct 26, 2020 – Nov 9, 2020 Device tree bindings

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: dts: BCM5301X: Linksys EA9500 add fixed partitions

This router has dual paritions to store trx firmware image and dual partitions for nvram. The second one in each of these cases acts as a backup store.

When tested with OpenWrt, the default partition parser causes two issues:

1. It labels both nvram partitions as nvram. In factory, second one is labeled devinfo.
2. It parses second trx image and tries to create second 'linux' partition and fails with - cannot create duplicate 'linux' partition. I've set this partition to read-only for now

The following patch works around both of these issues.

---
 .../boot/dts/bcm47094-linksys-panamera.dts    | 41 +++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/boot/dts/bcm47094-linksys-panamera.dts +41 -0
index 5d5930edfb9d..13da16c5de68 100644
@@ -292,3 +292,44 @@ fixed-link {
 &usb3_phy {
 	status = "okay";
 };
+
+&nandcs {
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		partition@0 {
+			label = "boot";
+			reg = <0x0000000 0x0080000>;
+			read-only;
+		};
+
+		partition@80000 {
+			label = "nvram";
+			reg = <0x080000 0x0100000>;
+		};
+
+		partition@180000{
+			label = "devinfo";
+			reg = <0x0180000 0x080000>;
+		};
+
+		partition@200000 {
+			label = "firmware";
+			reg = <0x0200000 0x01D00000>;
+			compatible = "brcm,trx";
+		};
+
+		partition@1F00000 {
+			label = "failsafe";
+			reg = <0x01F00000 0x01D00000>;
+			read-only;
+		};
+
+		partition@0x5200000 {
+			label = "brcmnand";
+			reg = <0x05200000 0x02E00000>;
+		};
+	};
+};
Signature · 1 line
2.25.1
#1 lore raw
Quoted 53 lines · Vivek Unune

This router has dual paritions to store trx firmware image and dual partitions for nvram. The second one in each of these cases acts as a backup store.

When tested with OpenWrt, the default partition parser causes two issues:

1. It labels both nvram partitions as nvram. In factory, second one is labeled devinfo.
2. It parses second trx image and tries to create second 'linux' partition and fails with - cannot create duplicate 'linux' partition. I've set this partition to read-only for now

The following patch works around both of these issues.

---
  .../boot/dts/bcm47094-linksys-panamera.dts    | 41 +++++++++++++++++++
  1 file changed, 41 insertions(+)
arch/arm/boot/dts/bcm47094-linksys-panamera.dts +26 -0
index 5d5930edfb9d..13da16c5de68 100644
@@ -292,3 +292,44 @@ fixed-link {
  &usb3_phy {
  	status = "okay";
  };
+
+&nandcs {
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		partition@0 {
+			label = "boot";
+			reg = <0x0000000 0x0080000>;
+			read-only;
+		};
+
+		partition@80000 {
+			label = "nvram";
+			reg = <0x080000 0x0100000>;
+		};
+
+		partition@180000{
+			label = "devinfo";
+			reg = <0x0180000 0x080000>;
+		};
+
+		partition@200000 {
+			label = "firmware";
+			reg = <0x0200000 0x01D00000>;

arch/arm/boot/dts/bcm47094-linksys-panamera.dts fixed-link { · line 330

Quoted 10 lines
arch/arm/boot/dts/bcm47094-linksys-panamera.dts +10 -0
+			compatible = "brcm,trx";
+		};
+
+		partition@1F00000 {
+			label = "failsafe";
+			reg = <0x01F00000 0x01D00000>;
+			read-only;
+		};
+
+		partition@0x5200000 {

You would need to remove the 0x from the hex number here.

arch/arm/boot/dts/bcm47094-linksys-panamera.dts fixed-link { · line 331

Quoted 1 line
arch/arm/boot/dts/bcm47094-linksys-panamera.dts +1 -0
+			label = "brcmnand";

Not sure how useful naming this partition brcmnand is, can we find a better name for it?

Signature · 1 line
Florian
#2 lore raw
Quoted 60 lines · Florian Fainelli
Quoted 57 lines · Vivek Unune

This router has dual paritions to store trx firmware image and dual partitions for nvram. The second one in each of these cases acts as a backup store.

When tested with OpenWrt, the default partition parser causes two issues:

1. It labels both nvram partitions as nvram. In factory, second one is labeled devinfo.
2. It parses second trx image and tries to create second 'linux' partition and fails with - cannot create duplicate 'linux' partition. I've set this partition to read-only for now

The following patch works around both of these issues.

---
  .../boot/dts/bcm47094-linksys-panamera.dts    | 41 +++++++++++++++++++
  1 file changed, 41 insertions(+)
arch/arm/boot/dts/bcm47094-linksys-panamera.dts +30 -0
index 5d5930edfb9d..13da16c5de68 100644
@@ -292,3 +292,44 @@ fixed-link {
  &usb3_phy {
  	status = "okay";
  };
+
+&nandcs {
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		partition@0 {
+			label = "boot";
+			reg = <0x0000000 0x0080000>;
+			read-only;
+		};
+
+		partition@80000 {
+			label = "nvram";
+			reg = <0x080000 0x0100000>;
+		};
+
+		partition@180000{
+			label = "devinfo";
+			reg = <0x0180000 0x080000>;
+		};
+
+		partition@200000 {
+			label = "firmware";
+			reg = <0x0200000 0x01D00000>;
+			compatible = "brcm,trx";
+		};
+
+		partition@1F00000 {
Quoted 8 lines

arch/arm/boot/dts/bcm47094-linksys-panamera.dts fixed-link { · line 330

Quoted 6 lines
arch/arm/boot/dts/bcm47094-linksys-panamera.dts +6 -0
+			label = "failsafe";
+			reg = <0x01F00000 0x01D00000>;
+			read-only;
+		};
+
+		partition@0x5200000 {

You would need to remove the 0x from the hex number here.

Sure, I'll fix this in next version

Quoted 5 lines

arch/arm/boot/dts/bcm47094-linksys-panamera.dts fixed-link { · line 331

Quoted 2 lines
arch/arm/boot/dts/bcm47094-linksys-panamera.dts +1 -0
+			label = "brcmnand";

Not sure how useful naming this partition brcmnand is, can we find a better name for it?

I'll be more than happy to rename this that makes sense. Factory uses this name as well. This is used as a general persistent storage for system cofigs. Could we name it System?

Thanks,

Vivek

#3 lore raw

PATCH v2 1/1 ARM: dts: BCM5301X: Linksys EA9500 add fixed partitions

In reply to Florian Fainelli

This router has dual paritions to store trx firmware image and dual partitions for nvram. The second one in each of these cases acts as a backup store.

When tested with OpenWrt, the default partition parser causes two issues:

1. It labels both nvram partitions as nvram. In factory, second one is labeled devinfo.
2. It parses second trx image and tries to create second 'linux' partition and fails with - cannot create duplicate 'linux' partition

The following patch works around both of these issues.

---
V2:
- Removed 0x before partition offset
- Renamed brcmnand to system

---
 .../boot/dts/bcm47094-linksys-panamera.dts    | 41 +++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/boot/dts/bcm47094-linksys-panamera.dts +41 -0
index 5d5930edfb9d..13da16c5de68 100644
@@ -292,3 +292,44 @@ fixed-link {
 &usb3_phy {
 	status = "okay";
 };
+
+&nandcs {
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		partition@0 {
+			label = "boot";
+			reg = <0x0000000 0x0080000>;
+			read-only;
+		};
+
+		partition@80000 {
+			label = "nvram";
+			reg = <0x080000 0x0100000>;
+		};
+
+		partition@180000{
+			label = "devinfo";
+			reg = <0x0180000 0x080000>;
+		};
+
+		partition@200000 {
+			label = "firmware";
+			reg = <0x0200000 0x01D00000>;
+			compatible = "brcm,trx";
+		};
+
+		partition@1F00000 {
+			label = "failsafe";
+			reg = <0x01F00000 0x01D00000>;
+			read-only;
+		};
+
+		partition@5200000 {
+			label = "system";
+			reg = <0x05200000 0x02E00000>;
+		};
+	};
+};
Signature · 1 line
2.25.1
#4 lore raw
Quoted 11 lines · Vivek Unune

This router has dual paritions to store trx firmware image and dual partitions for nvram. The second one in each of these cases acts as a backup store.

When tested with OpenWrt, the default partition parser causes two issues:

1. It labels both nvram partitions as nvram. In factory, second one is labeled devinfo.
2. It parses second trx image and tries to create second 'linux' partition and fails with - cannot create duplicate 'linux' partition

Quoted 4 lines

The following patch works around both of these issues.

---

Applied to devicetree/next, thanks!
--
Florian

#5 lore raw
Quoted 12 lines · Florian Fainelli
Quoted 11 lines · Vivek Unune

This router has dual paritions to store trx firmware image and dual partitions for nvram. The second one in each of these cases acts as a backup store.

When tested with OpenWrt, the default partition parser causes two issues:

1. It labels both nvram partitions as nvram. In factory, second one is labeled devinfo.
2. It parses second trx image and tries to create second 'linux' partition and fails with - cannot create duplicate 'linux' partition

Quoted 8 lines
Quoted 4 lines

The following patch works around both of these issues.

---

Applied to devicetree/next, thanks!
--
Florian

Thanks Florian

#6 lore raw
In reply to Vivek Unune
Quoted 3 lines · Vivek Unune

This router has dual paritions to store trx firmware image and dual partitions for nvram. The second one in each of these cases acts as a backup store.

I'm quite sure CFE is supposed to flash new firmware to the backup partition and then mark it as main one. The old firmware partition becomes a new backup then.

That means you need to check which partition bootloader used to handle partitioning properly.

arch/arm/boot/dts/bcm47094-linksys-panamera.dts fixed-link { · line 328

Quoted 11 lines
arch/arm/boot/dts/bcm47094-linksys-panamera.dts +11 -0
+		partition@200000 {
+			label = "firmware";
+			reg = <0x0200000 0x01D00000>;
+			compatible = "brcm,trx";
+		};
+
+		partition@1F00000 {
+			label = "failsafe";
+			reg = <0x01F00000 0x01D00000>;
+			read-only;
+		};

Here you assume CFE always boots from the first firmware partition.

Unless EA9500 CFE does sth stupid it seems like a 50% - 50% guess.

#7 lore raw
Quoted 27 lines · Rafał Miłecki
Quoted 3 lines · Vivek Unune

This router has dual paritions to store trx firmware image and dual partitions for nvram. The second one in each of these cases acts as a backup store.

I'm quite sure CFE is supposed to flash new firmware to the backup partition and then mark it as main one. The old firmware partition becomes a new backup then.

That means you need to check which partition bootloader used to handle partitioning properly.

arch/arm/boot/dts/bcm47094-linksys-panamera.dts fixed-link { · line 328

Quoted 11 lines
arch/arm/boot/dts/bcm47094-linksys-panamera.dts +11 -0
+		partition@200000 {
+			label = "firmware";
+			reg = <0x0200000 0x01D00000>;
+			compatible = "brcm,trx";
+		};
+
+		partition@1F00000 {
+			label = "failsafe";
+			reg = <0x01F00000 0x01D00000>;
+			read-only;
+		};

Here you assume CFE always boots from the first firmware partition.

Quoted 1 line

Unless EA9500 CFE does sth stupid it seems like a 50% - 50% guess.

Hi Rafał,

Indeed, my assumption is to only boot using first partition.

If we ever want to support true dual partitions in future, we need to:

1. Read the boot flag 'bootpartition' and skip the backup partition parsing
2. Updagrading firmware will write to backup partition and flip the bootpartition

Thanks,

Vivek