riscv: dts: spacemit: k1: fix the EEPROM page size
Subsystems (3)
PATCH 1/1 riscv: dts: spacemit: k1: fix the EEPROM page size
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. 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 TLV EEPROM on this board holds the base MAC address and the MAC count, so a corrupted write leaves both Ethernet ports without a MAC address, which is how this was found.
---
A TLV write through u-boot's i2c_eeprom driver scrambled the EEPROM contents and left both ports without a MAC address on bananapi-f3. I checked boards schematic and eeprom chip datasheet of bananapi-f3, whose links can be found in commit message. After changing pagesize to 8, TLV write and read works as expected.
Other k1 boards which includes k1-bananapi-cm6-io and k1-orangepi-rv2 changed together. However, I don’t have these two board. Be grateful if someone could test it. Schematic of k1-orangepi-r2s not found, so keep it as it is, but true knowledge comes from practice.
--- arch/riscv/boot/dts/spacemit/k1-bananapi-cm6-io.dts | 2 +- arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 2 +- arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/riscv/boot/dts/spacemit/k1-bananapi-cm6-io.dts +1 -1
@@ -101,7 +101,7 @@ eeprom@54 { compatible = "atmel,24c08"; reg = <0x54>; vcc-supply = <&buck3_1v8>; - pagesize = <16>; + pagesize = <8>; size = <1024>; }; };
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +1 -1
@@ -195,7 +195,7 @@ eeprom@50 { compatible = "atmel,24c02"; reg = <0x50>; vcc-supply = <&buck3_1v8>; /* EEPROM_VCC1V8 */ - pagesize = <16>; + pagesize = <8>; read-only; size = <256>;
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts +1 -1
@@ -185,7 +185,7 @@ &i2c2 { eeprom@50 { compatible = "atmel,24c02"; reg = <0x50>; - pagesize = <16>; + pagesize = <8>; size = <256>; read-only; vcc-supply = <&buck3_1v8>;
---
base-commit: 4843f6873f7c4835e62f2c73ba0fd538e57a2f22
change-id: 20261122-fix-bpf3-eeprom-51ba6e0f110a
Best regards,
Signature · 1 line
Zixian Zeng <[email protected]>
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] riscv: dts: spacemit: wrong EEPROM node updated on BPI-CM6 IO --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] riscv: dts: spacemit: wrong EEPROM node updated on BPI-CM6 IO --
commit 2ab11d07395f6ea4127a5f2a679e6b875d4bd75b
Author: Zixian Zeng <[email protected]>
riscv: dts: spacemit: k1: fix the EEPROM page size
This commit updates the EEPROM pagesize property from 16 to 8 across three SpacemiT K1 board device trees.
arch/riscv/boot/dts/spacemit/k1-bananapi-cm6-io.dts eeprom@54 { · line 107
Quoted 13 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-cm6-io.dts +1
-1@@ -101,7 +101,7 @@ eeprom@54 { compatible = "atmel,24c08"; reg = <0x54>; vcc-supply = <&buck3_1v8>; - pagesize = <16>; + pagesize = <8>; size = <1024>; }; };
[Severity: Medium]
Should this change update eeprom@50 in k1-bananapi-cm6.dtsi instead of eeprom@54 here?
Commit 46a8c01700ac ("riscv: dts: spacemit: k1: Add Banana Pi BPI-CM6 IO board") added two EEPROMs: eeprom@54 on the IO carrier board is a 1024-byte 24c08 (which uses 16-byte write pages), whereas the 256-byte 24c02 ONIE TLV EEPROM storing the MAC addresses lives in arch/riscv/boot/dts/spacemit/k1-bananapi-cm6.dtsi as eeprom@50 and still has pagesize = <16>.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Hi,
Quoted 4 lines · Zixian Zeng
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.
Quoted 2 lines
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).
Quoted 4 lines
The TLV EEPROM on this board holds the base MAC address and the MAC count, so a corrupted write leaves both Ethernet ports without a MAC address, which is how this was found.
Quoted 8 lines
Fixes bfce75e2345f ("riscv: dts: spacemit: add 24c02 eeprom on BPI-F3")Fixes 46a8c01700ac ("riscv: dts: spacemit: k1: Add Banana Pi BPI-CM6 IO board")Fixes ac436e6879f5 ("riscv: dts: spacemit: enable onboard eeprom for OrangePi")Signed-off-by Zixian Zeng <[email protected]>
Thanks for fixing that.
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://aurel32.net
Hi Aurelien,
Quoted 8 lines · Aurelien Jarno
Hi,
Quoted 4 lines · Zixian Zeng
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.
Quoted 8 lines
Oops, I am not sure how I got that wrong. Sorry about that.
Quoted 2 lines
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
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.
Best regards,
Zixian
Hi Zixian,
Quoted 12 lines · Zixian Zeng
Hi Aurelien,
Quoted 9 lines · Aurelien Jarno
Hi,
Quoted 4 lines · Zixian Zeng
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.
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
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.
Quoted 2 lines
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/[email protected]/
[2] https://www.giantec-semi.com/juchen1123/uploads/pdf/GT24C02_DS_Au.pdf
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://aurel32.net
Quoted 11 lines · Zixian Zeng
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. 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 TLV EEPROM on this board holds the base MAC address and the MAC count, so a corrupted write leaves both Ethernet ports without a MAC address, which is how this was found.
Quoted 8 lines
Fixes bfce75e2345f ("riscv: dts: spacemit: add 24c02 eeprom on BPI-F3")Fixes 46a8c01700ac ("riscv: dts: spacemit: k1: Add Banana Pi BPI-CM6 IO board")Fixes ac436e6879f5 ("riscv: dts: spacemit: enable onboard eeprom for OrangePi")Signed-off-by Zixian Zeng <[email protected]>
Signature · 1 line
Troy Mitchell