diff --git a/patches/openwrt/0008-mtd-spi-nor-add-property-to-unlock-entire-chip.patch b/patches/openwrt/0008-mtd-spi-nor-add-property-to-unlock-entire-chip.patch new file mode 100644 index 00000000000..3d3ab8e10bc --- /dev/null +++ b/patches/openwrt/0008-mtd-spi-nor-add-property-to-unlock-entire-chip.patch @@ -0,0 +1,76 @@ +From: David Bauer +Date: Thu, 4 Jan 2024 12:47:08 +0100 +Subject: mtd: spi-nor: add property to unlock entire chip + +Add a new device-tree porperty "swp-disable" which can be added to +spi-nor OF-nodes to indicate the whole flash-chip should be unlocked. + +This avoids changing the default behavior of all SPI-NOR chips and helps +to indicate devices which require the old kernel behavior explicitly. + +Signed-off-by: David Bauer +[backport to openwrt-23.05] +Signed-off-by: Tom Herbers + +diff --git a/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch +index 36f5331bd017f9727185889f33f0575c93397952..d0caed4d579ab1c3a18f5dffb32b7ab5ec91dfbc 100644 +--- a/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch ++++ b/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch +@@ -10,7 +10,7 @@ Signed-off-by: Abhimanyu Vishwakarma + + --- a/drivers/mtd/spi-nor/core.c + +++ b/drivers/mtd/spi-nor/core.c +-@@ -3108,6 +3108,7 @@ int spi_nor_scan(struct spi_nor *nor, co ++@@ -3110,6 +3110,7 @@ int spi_nor_scan(struct spi_nor *nor, co + struct device *dev = nor->dev; + struct mtd_info *mtd = &nor->mtd; + struct device_node *np = spi_nor_get_flash_node(nor); +@@ -18,7 +18,7 @@ Signed-off-by: Abhimanyu Vishwakarma + int ret; + int i; + +-@@ -3162,7 +3163,12 @@ int spi_nor_scan(struct spi_nor *nor, co ++@@ -3164,7 +3165,12 @@ int spi_nor_scan(struct spi_nor *nor, co + if (ret) + return ret; + +diff --git a/target/linux/generic/hack-5.15/400-mtd-spi-nor-add-property-to-unlock-entire-chip.patch b/target/linux/generic/hack-5.15/400-mtd-spi-nor-add-property-to-unlock-entire-chip.patch +new file mode 100644 +index 0000000000000000000000000000000000000000..2ebac01bde5401d0a137058c2ed7fa777b31266d +--- /dev/null ++++ b/target/linux/generic/hack-5.15/400-mtd-spi-nor-add-property-to-unlock-entire-chip.patch +@@ -0,0 +1,34 @@ ++From 228fcb0738a9e582a15666e717bb2fc5078c694c Mon Sep 17 00:00:00 2001 ++From: David Bauer ++Date: Thu, 4 Jan 2024 12:44:06 +0100 ++Subject: [PATCH] mtd: spi-nor: add property to unlock entire chip ++ ++Add a new device-tree porperty "swp-disable" which can be added to ++spi-nor OF-nodes to indicate the whole flash-chip should be unlocked. ++ ++This avoids changing the default behavior of all SPI-NOR chips and helps ++to indicate devices which require the old kernel behavior explicitly. ++ ++Signed-off-by: David Bauer ++--- ++ drivers/mtd/spi-nor/core.c | 2 +++ ++ 1 file changed, 3 insertions(+) ++ ++--- a/drivers/mtd/spi-nor/core.c +++++ b/drivers/mtd/spi-nor/core.c ++@@ -2820,6 +2820,7 @@ static int spi_nor_quad_enable(struct sp ++ ++ static int spi_nor_init(struct spi_nor *nor) ++ { +++ struct device_node *np = spi_nor_get_flash_node(nor); ++ int err; ++ ++ err = spi_nor_octal_dtr_enable(nor, true); ++@@ -2845,6 +2846,7 @@ static int spi_nor_init(struct spi_nor * ++ * SNOR_F_SWP_IS_VOLATILE. ++ */ ++ if (IS_ENABLED(CONFIG_MTD_SPI_NOR_SWP_DISABLE) || +++ of_property_read_bool(np, "swp-disable") || ++ (IS_ENABLED(CONFIG_MTD_SPI_NOR_SWP_DISABLE_ON_VOLATILE) && ++ nor->flags & SNOR_F_SWP_IS_VOLATILE)) ++ spi_nor_try_unlock_all(nor); diff --git a/patches/openwrt/0009-ath79-unlock-full-flash-on-Ubiquiti-airMax-boards.patch b/patches/openwrt/0009-ath79-unlock-full-flash-on-Ubiquiti-airMax-boards.patch new file mode 100644 index 00000000000..fb9a9e7bdb3 --- /dev/null +++ b/patches/openwrt/0009-ath79-unlock-full-flash-on-Ubiquiti-airMax-boards.patch @@ -0,0 +1,61 @@ +From: David Bauer +Date: Sun, 7 Jan 2024 21:16:07 +0100 +Subject: ath79: unlock full flash on Ubiquiti airMax boards + +Instead of unlocking full flash on all devices, selectively unlock the +full flash on Ubiquiti airMax boards. + +The flash unlock was only necessary on these boards in the first place. + +Signed-off-by: David Bauer +[added swp-disable flag for qca955x_ubnt_xc] +Signed-off-by: Tom Herbers + +diff --git a/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi b/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi +index 341d0bad0d6f700abfc4bbee69c776ed21839c93..66779042555705e57c9316342103098df12d6849 100644 +--- a/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi ++++ b/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi +@@ -22,6 +22,7 @@ + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; ++ swp-disable; + + partitions { + compatible = "fixed-partitions"; +diff --git a/target/linux/ath79/dts/ar9342_ubnt_wa.dtsi b/target/linux/ath79/dts/ar9342_ubnt_wa.dtsi +index ba0f7ad23e52940b1bc4ec2971a8d8e8c73062a6..60d930e434a866a6a891814b7eaec1025d898aef 100644 +--- a/target/linux/ath79/dts/ar9342_ubnt_wa.dtsi ++++ b/target/linux/ath79/dts/ar9342_ubnt_wa.dtsi +@@ -36,6 +36,7 @@ + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; ++ swp-disable; + + partitions { + compatible = "fixed-partitions"; +diff --git a/target/linux/ath79/dts/ar9342_ubnt_xw.dtsi b/target/linux/ath79/dts/ar9342_ubnt_xw.dtsi +index ce49c10e5ccb5bc634444cd2dbbce1deb60ef73c..5ddf89488ceb3958926465413515de33506e5817 100644 +--- a/target/linux/ath79/dts/ar9342_ubnt_xw.dtsi ++++ b/target/linux/ath79/dts/ar9342_ubnt_xw.dtsi +@@ -64,6 +64,7 @@ + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; ++ swp-disable; + + partitions { + compatible = "fixed-partitions"; +diff --git a/target/linux/ath79/dts/qca955x_ubnt_xc.dtsi b/target/linux/ath79/dts/qca955x_ubnt_xc.dtsi +index 0f803945db632873a6d7e97cb0a482106354e8c2..196e1b5382f5508610a65247832e47006a3ca11b 100644 +--- a/target/linux/ath79/dts/qca955x_ubnt_xc.dtsi ++++ b/target/linux/ath79/dts/qca955x_ubnt_xc.dtsi +@@ -16,6 +16,7 @@ + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; ++ swp-disable; + + partitions { + compatible = "fixed-partitions";