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
ath79: fix block protection clearing #3536
Closed
PolynomialDivision
wants to merge
1
commit into
openwrt:master
from
PolynomialDivision:fix-block-protection-clearing
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
target/linux/ath79/patches-5.4/450-fix-block-protection-clearing.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,28 @@ | ||
From: Nick Hainke <vincent@systemli.org> | ||
Date: Sun, 25 Oct 2020 00:52:47 +0200 | ||
Subject: [PATCH] ath79: fix block protection clearing | ||
|
||
The block protection bits of macronix do not match the implementation. | ||
The chip has 3 BP bits. Bit 5 is actually the third BP but here the | ||
5th bit is SR_TB. Therefore the patch adds SR_TB to the mask. In the | ||
4.19er kernel the whole register was simply set to 0. | ||
|
||
The wrong implementation did not remove the block protection. This led | ||
to jffs2 errors in the form of: | ||
"jffs2: Newly-erased block contained word 0x19852003 at offset 0x..." | ||
This caused inconsistent memory and other errors. | ||
|
||
Suggested-by: David Bauer <mail@david-bauer.net> | ||
Signed-off-by: Nick Hainke <vincent@systemli.org> | ||
|
||
--- a/drivers/mtd/spi-nor/spi-nor.c | ||
+++ b/drivers/mtd/spi-nor/spi-nor.c | ||
@@ -1981,7 +1981,7 @@ static int sr2_bit7_quad_enable(struct s | ||
static int spi_nor_clear_sr_bp(struct spi_nor *nor) | ||
{ | ||
int ret; | ||
- u8 mask = SR_BP2 | SR_BP1 | SR_BP0; | ||
+ u8 mask = SR_TB | SR_BP2 | SR_BP1 | SR_BP0; | ||
|
||
ret = read_sr(nor); | ||
if (ret < 0) { |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add your commit description also to the top of the patch file. This way, the intention of the patch is immediately clear to the reader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added my commit. Different patches do that in different ways. I hope the way I decided is okay? :)