-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
patches/openwrt/0008-mtd-spi-nor-add-property-to-unlock-entire-chip.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
From: David Bauer <[email protected]> | ||
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 <[email protected]> | ||
[backport to openwrt-23.05] | ||
Signed-off-by: Tom Herbers <[email protected]> | ||
|
||
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 <[email protected]> | ||
|
||
--- 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 <[email protected]> | ||
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/401-mtd-spi-nor-add-property-to-unlock-entire-chip.patch b/target/linux/generic/hack-5.15/401-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/401-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 <[email protected]> | ||
+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 <[email protected]> | ||
+--- | ||
+ 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); |
47 changes: 47 additions & 0 deletions
47
patches/openwrt/0009-ath79-unlock-full-flash-on-Ubiquiti-airMax-boards.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
From: David Bauer <[email protected]> | ||
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 <[email protected]> | ||
|
||
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"; |