From c08293893aadca182b52ef96d3c2b1700282f0f2 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Fri, 3 Nov 2017 09:53:54 +0100
Subject: kernel: add support for limiting 4K erase sector support based on
 flash chip size

Some targets need 4K sectors for small flash chips (e.g. some
routerboards, where the entire chip is just one "erase block"), whereas
on other devices 4K sectors lead to horrible flash erase/write
performance.

Set the default limit in the generic kernel configuration to 4 MiB to
ensure that all new platforms don't use 4K sectors for bigger flash
chips. On all existing targets use 16 MiB for now to avoid regressions.
They will be changed individually in follow-up commits.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 target/linux/ramips/mt7620/config-4.9 | 1 +
 target/linux/ramips/rt305x/config-4.9 | 1 +
 target/linux/ramips/rt3883/config-4.9 | 1 +
 3 files changed, 3 insertions(+)

(limited to 'target/linux/ramips')

diff --git a/target/linux/ramips/mt7620/config-4.9 b/target/linux/ramips/mt7620/config-4.9
index dc3c8fcc0a..4f8c68629e 100644
--- a/target/linux/ramips/mt7620/config-4.9
+++ b/target/linux/ramips/mt7620/config-4.9
@@ -141,6 +141,7 @@ CONFIG_MTD_NAND_MT7620=y
 CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
+CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=16384
 CONFIG_MTD_SPLIT_FIRMWARE=y
 CONFIG_MTD_SPLIT_SEAMA_FW=y
 CONFIG_MTD_SPLIT_TPLINK_FW=y
diff --git a/target/linux/ramips/rt305x/config-4.9 b/target/linux/ramips/rt305x/config-4.9
index d7b53038d4..ae843f3720 100644
--- a/target/linux/ramips/rt305x/config-4.9
+++ b/target/linux/ramips/rt305x/config-4.9
@@ -134,6 +134,7 @@ CONFIG_MTD_M25P80=y
 CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
+CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=16384
 CONFIG_MTD_SPLIT_FIRMWARE=y
 CONFIG_MTD_SPLIT_SEAMA_FW=y
 CONFIG_MTD_SPLIT_UIMAGE_FW=y
diff --git a/target/linux/ramips/rt3883/config-4.9 b/target/linux/ramips/rt3883/config-4.9
index 3e6b73f80c..3b116e560f 100644
--- a/target/linux/ramips/rt3883/config-4.9
+++ b/target/linux/ramips/rt3883/config-4.9
@@ -134,6 +134,7 @@ CONFIG_MTD_M25P80=y
 CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
+CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=16384
 CONFIG_MTD_SPLIT_FIRMWARE=y
 CONFIG_MTD_SPLIT_SEAMA_FW=y
 CONFIG_MTD_SPLIT_UIMAGE_FW=y
-- 
cgit v1.2.3