[PATCH] riscv: dts: spacemit: k1: fix the EEPROM page size
Anand Moon
linux.amoon at gmail.com
Wed Nov 25 06:21:54 PST 2026
Hi Zixian,
On Wed, 25 Nov 2026 at 15:08, Zixian Zeng <sycamoremoon376 at gmail.com> wrote:
>
> Hi Anand,
>
> On Wed, Nov 25, 2026 at 3:52 PM Anand Moon <linux.amoon at gmail.com> wrote:
> >
> > Hi Aurelien,
> >
> > On Wed, 25 Nov 2026 at 00:14, Aurelien Jarno <aurelien at aurel32.net> wrote:
> > >
> > > Hi Zixian,
> > >
> > > On 2026-11-24 11:31, Zixian Zeng wrote:
> > > > Hi Aurelien,
> > > >
> > > > On 2026/11/24 5:58, Aurelien Jarno wrote:
> > > > > Hi,
> > > > >
> > > > > On 2026-11-23 12:41, Zixian Zeng wrote:
> > > > > > The bananapi-f3 carries an AT24C02 compatible EEPROM GT24C02B [1]:
> > > > > > 256 bytes with an 8-byte write page, which can be found in schematic[2].
> > > > > > The device tree declares pagesize = <16>, which does not match the
> > > > > > eeprom chip datasheet which declares pagesize 8 bytes.
> > > > >
> > > > > Oops, I am not sure how I got that wrong. Sorry about that.
> > >
> > > The question of the page size has been raised in the initial review [1],
> > > and it seems that the GT24C02 has a 16-byte page size, while the
> > > GT24C02B [2] has a 8-byte page size. The BPI-F3 schematics confirms that
> > > the B version is used. Sorry about the mistake.
> > >
> > > > > > EEPROM pagesize of k1-bananapi-cm6-io[3] and k1-orangepi-rv2[4] changed
> > > > > > together, based on the chip model shown in the schematic diagram.
> > > > >
> > > > > The k1-milkv-jupiter board is also affected with the same issue, despite
> > > > > using a slightly different EEPROM (24C04).
> > > > >
> > > >
> > > > The GT24C04A EEPROM used on k1-milkv-jupiter board doesn't seem to have
> > > > the same issue, which you can find "Page Size: 16 bytes" in datasheet:
> > > > https://www.giantec-semi.com/uploads/20220929/GT24C04A.pdf
> > >
> > > Indeed you are correct, and I confirm that this is the exact version
> > > used on the schematics. Therefore there is no need to extend your patch,
> > > it can be merged that way.
> > >
> > > > But I don't have the board, simple test would be appreciated. Perhaps I
> > > > should include test steps in the commit message for the next revision.
> > >
> > > Unfortunately the board has the EEPROM write protection pin connected to
> > > VCC, which means the write protection is enabled. Therefore testing is
> > > not so easy.
> > >
> > > Regards
> > > Aurelien
> > >
> > > [1] https://lore.kernel.org/linux-riscv/aNLzRJcKCYOngc7z@aurel32.net/
> > > [2] https://www.giantec-semi.com/juchen1123/uploads/pdf/GT24C02_DS_Au.pdf
> > >
> > Apologies, this is a different issue.
> >
> > I am currently working on enabling multi-DTB support in U-Boot SPL
> > for SpacemiT K1 boards.
> >
> > While investigating the board detection issue, I noticed that the EEPROM
> > on my Banana Pi BPI-F3 does not contain a Product Name TLV entry.
> >
> > alarm at k1:~$ sudo hexdump -C /sys/bus/i2c/devices/2-0050/eeprom
> > 00000000 54 6c 76 49 6e 66 6f 00 01 00 20 24 06 fe fe fe |TlvInfo... $....|
> > 00000010 d5 52 bd 2a 02 00 02 23 0c 39 38 61 39 63 33 61 |.R.*...#.98a9c3a|
> > 00000020 32 62 64 34 37 fe 04 3b e3 ff bd ff ff ff ff ff |2bd47..;........|
> > 00000030 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
> > *
> > 00000100
> >
> > Although the EEPROM is readable, the missing Product Name TLV entry
> > explains why read_product_name() returns `-ENOENT` (-2), assuming the
> > EEPROM read and validation succeed.
> >
> > Consequently, automatic board detection fails, and U-Boot falls back to
> > CONFIG_DEFAULT_DEVICE_TREE, which may select an incorrect device
> > tree for the target board.
>
> Yes, exactly. I encountered the same problem. Board detect failed and then used
> default device tree (MusePi Pro).
>
> > Since the SD card-detect GPIO polarity differs between the Banana Pi BPI-F3
> > and MusePi Pro, selecting the incorrect device tree can result in SD
> > card detection
> > and boot failures.
> >
> > The following SPL boot log shows the board detection failure, although
> > DDR initialization completes successfully:
> >
> > ```
> > U-Boot SPL 2026.10-01060-gf3080abcfe92-dirty (Oct 24 2026 - 17:30:03 +0530)
> > Fail to detect board:-2
> > vdd_core, value:900000
> > vdd_1v8, value:1800000
> > vdd_1v8_mmc, value:1800000
> > DDR firmware: [0xc0820900]:0xf0227179, size:0x8d98
> > DDR is ready
> > ```
> > Could you please confirm whether the Product Name TLV entry is
> > expected to be programmed into the EEPROM during manufacturing?
>
> Yes, No product name TLV entry in my Bananapi-f3 EEPROM. That's the reason
> I wanted to write EEPROM and found this EEPROM pagesize issue.
>
> > Also, is there a recommended approach for handling boards with missing
> > product information in the EEPROM to ensure reliable automatic device
> > tree selection?
>
> I'm not sure. Currently, after I corrected pagesize, I wrote EEPROM manually:
> ```
> U-Boot SPL 2027.01-rc2-00039-g4cff50f40343
> Get board name:k1-x_deb1
> vdd_core, value:900000
> vdd_1v8, value:1800000
> DDR firmware: [0xc081df80]:0xf0227179, size:0x8d98
> DDR is ready
> No SPI controller (-19)
> Trying to boot from MMC2
> ....
> => tlv_eeprom
> TLV: 0
> TlvInfo Header:
> Id String: TlvInfo
> Version: 1
> Total Length: 29
> TLV Name Code Len Value
> -------------------- ---- --- -----
> Base MAC Address 0x24 6 FE:FE:FE:90:1E:F0
> Product Name 0x21 9 k1-x_deb1
> MAC Addresses 0x2A 2 2
> CRC-32 0xFE 4 0xA88C93F0
> ```
> Maybe we can discuss this in u-boot mailling list? This is indeed a
> separate issue.
Correct, I will raise this issue over there.
Reviewed-by: Anand Moon <linux.amoon at gmail.com>
Tested-by: Anand Moon <linux.amoon at gmail.com>
Can you follow up with the patch to read the MAC address from the EEPROM.
$ git diff .
diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
index 1db896536256..3928a47b7702 100644
--- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
@@ -137,6 +137,8 @@ ð0 {
pinctrl-0 = <&gmac0_cfg>, <&gmac0_clk_ref_cfg>;
rx-internal-delay-ps = <0>;
tx-internal-delay-ps = <0>;
+ nvmem-cells = <&mac_address 0>;
+ nvmem-cell-names = "mac-address";
status = "okay";
mdio-bus {
@@ -160,6 +162,8 @@ ð1 {
pinctrl-0 = <&gmac1_cfg>, <&gmac1_clk_ref_cfg>;
rx-internal-delay-ps = <0>;
tx-internal-delay-ps = <250>;
+ nvmem-cells = <&mac_address 1>;
+ nvmem-cell-names = "mac-address";
status = "okay";
mdio-bus {
@@ -202,7 +206,7 @@ eeprom at 50 {
nvmem-layout {
compatible = "onie,tlv-layout";
- mac-address {
+ mac_address: mac-address {
#nvmem-cell-cells = <1>;
};
>
> Best regards,
> Zixian
Thanks
-Anand
More information about the linux-riscv
mailing list