8170917a495df81182a5232c244f01bac6b42a14
[openwrt/openwrt.git] / target / linux / gemini / patches-5.10 / 0003-ARM-dts-gemini-NAS4220-B-fis-index-block-with-128-Ki.patch
1 From 447fd4347f06af3a369045149ba74f9b914cd99e Mon Sep 17 00:00:00 2001
2 From: Christian Lamparter <chunkeey@gmail.com>
3 Date: Tue, 23 Nov 2021 21:42:21 +0100
4 Subject: [PATCH] ARM: dts: gemini: NAS4220-B: fis-index-block with 128 KiB
5 sectors
6
7 Steven Maddox reported in the OpenWrt bugzilla, that his
8 RaidSonic IB-NAS4220-B was no longer booting with the new
9 OpenWrt 21.02 (uses linux 5.10's device-tree). However, it was
10 working with the previous OpenWrt 19.07 series (uses 4.14).
11
12 |[ 5.548038] No RedBoot partition table detected in 30000000.flash
13 |[ 5.618553] Searching for RedBoot partition table in 30000000.flash at offset 0x0
14 |[ 5.739093] No RedBoot partition table detected in 30000000.flash
15 |...
16 |[ 7.039504] Waiting for root device /dev/mtdblock3...
17
18 The provided bootlog shows that the RedBoot partition parser was
19 looking for the partition table "at offset 0x0". Which is strange
20 since the comment in the device-tree says it should be at 0xfe0000.
21
22 Further digging on the internet led to a review site that took
23 some useful PCB pictures of their review unit back in February 2009.
24 Their picture shows a Spansion S29GL128N11TFI01 flash chip.
25
26 From Spansion's Datasheet:
27 "S29GL128N: One hundred twenty-eight 64 Kword (128 Kbyte) sectors"
28 The reported also provided a "cat /sys/class/mtd/mtd0/erasesize",
29 which returned "131072".
30
31 With the 128 KiB Sector/Erasesize in mind. This patch changes the
32 fis-index-block property to (0xfe0000 / 0x20000) = 0x7f.
33
34 Note:
35 Let's hope the vendor stuck to the 128 KiB sector size flash chip
36 for all units still out there.
37
38 Fixes: b5a923f8c739 ("ARM: dts: gemini: Switch to redboot partition parsing")
39 Bugzilla: https://bugs.openwrt.org/index.php?do=details&task_id=4137
40 Reported-by: Steven Maddox <s.maddox@lantizia.me.uk>
41 Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
42 --- a/arch/arm/boot/dts/gemini-nas4220b.dts
43 +++ b/arch/arm/boot/dts/gemini-nas4220b.dts
44 @@ -84,7 +84,7 @@
45 partitions {
46 compatible = "redboot-fis";
47 /* Eraseblock at 0xfe0000 */
48 - fis-index-block = <0x1fc>;
49 + fis-index-block = <0x7f>;
50 };
51 };
52