Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#3699 - MT7620 platform with spi flash has very low read & write performance #8715

Open
openwrt-bot opened this issue Mar 21, 2021 · 2 comments · Fixed by #12602
Open

FS#3699 - MT7620 platform with spi flash has very low read & write performance #8715

openwrt-bot opened this issue Mar 21, 2021 · 2 comments · Fixed by #12602
Labels

Comments

@openwrt-bot
Copy link

DragonBluep:

Device: Youku YK-L1(in fact I believe in all mt7620, rt3883, rt305x devices)
Software versions: v19.07
Problem: YK-L1 has a 32 MB flash chip and device has very poor flash read and write performance. It will need 10 minutes to format filesystem after install OpenWrt.
Reason: In kernel config file(/target/linux/ramips/mt7620/config-xxx) it defined CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y. But MT7621 and MT7628 do not has this define. So one block is only 4 KB in MT7620 but 64 KB in MT7628/MT7621. MT7628 is much faster than MT7620 in the same spi frequency.
I do not know why we use 4K sectors in these platform because it seems like won't waste storage space by set block size to 64 KB.

Here is a rt5350 device and we can see erasesize is 4 KB, same as mt7620.
root@OpenWrt:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00020000 00001000 "u-boot"
mtd1: 00010000 00001000 "factory"
mtd2: 003d0000 00001000 "firmware"
mtd3: 0013891e 00001000 "kernel"
mtd4: 002976e2 00001000 "rootfs"
mtd5: 00039000 00001000 "rootfs_data"

@DragonBluep
Copy link
Contributor

Can be closed.

This is not a bug, it would be more appropriate to call it a missing feature. It can be solved by modifying the kernel config file like this:

- CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
- CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=16384
+ CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y

Here's a PR trying to fix this: #3271 mtd spi-nor: use 4K erase only where need, with 64K erasesize otherwise

@f00b4r0
Copy link
Contributor

f00b4r0 commented Jul 24, 2022

Can be closed.

This is not a bug, it would be more appropriate to call it a missing feature. It can be solved by modifying the kernel config file like this:

- CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
- CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=16384
+ CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y

Here's a PR trying to fix this: #3271 mtd spi-nor: use 4K erase only where need, with 64K erasesize otherwise

Purely FYI, when enabling VARIABLE_ERASE, the larger 64K erase blocks will be used. Consequently, affected devices must also adjust the image BLOCKSIZE (as defined in e.g. target/linux/ramips/image/mt7620.mk) to match, otherwise the configuration may not be preserved across upgrades.

Ideally, BLOCKSIZE should be updated concurrently with VARIABLE_ERASE, see #3271 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants