Skip to content

Commit 1beafe0

Browse files
committed
[ambz2] Limit flash size to 2 MiB on RTL8720CF
1 parent 47cfbcd commit 1beafe0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ltchiptool/soc/ambz2/flash.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
AMBZ2_CODE_ADDR,
1717
AMBZ2_DATA_ADDR,
1818
AMBZ2_EFUSE_PHYSICAL_SIZE,
19+
AmbZ2FlashMode,
1920
AmbZ2Tool,
2021
)
2122

@@ -156,7 +157,14 @@ def flash_get_chip_info_string(self) -> str:
156157

157158
def flash_get_size(self, memory: FlashMemoryType = FlashMemoryType.FLASH) -> int:
158159
if memory == FlashMemoryType.FLASH:
159-
return 0x400000
160+
self.flash_connect()
161+
assert self.amb
162+
self.amb.flash_init(configure=False)
163+
return (
164+
0x200_000
165+
if self.amb.flash_mode == AmbZ2FlashMode.RTL8720CF
166+
else 0x400_000
167+
)
160168
if memory == FlashMemoryType.ROM:
161169
return 384 * 1024
162170
if memory == FlashMemoryType.EFUSE:

0 commit comments

Comments
 (0)