mtd: spinand: gigadevice: Fix the get ecc status issue
[ Upstream commit 59950610c0c00c7a06d8a75d2ee5d73dba4274cf ]
Some GigaDevice ecc_get_status functions use on-stack buffer for
spi_mem_op causes spi_mem_check_op failing, fix the issue by using
spinand scratchbuf.
Fixes: c40c7a990a
("mtd: spinand: Add support for GigaDevice GD5F1GQ4UExxG")
Signed-off-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20231108150701.593912-1-han.xu@nxp.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
87632bc9ec
commit
65a389ef97
@ -186,7 +186,7 @@ static int gd5fxgq4uexxg_ecc_get_status(struct spinand_device *spinand,
|
|||||||
{
|
{
|
||||||
u8 status2;
|
u8 status2;
|
||||||
struct spi_mem_op op = SPINAND_GET_FEATURE_OP(GD5FXGQXXEXXG_REG_STATUS2,
|
struct spi_mem_op op = SPINAND_GET_FEATURE_OP(GD5FXGQXXEXXG_REG_STATUS2,
|
||||||
&status2);
|
spinand->scratchbuf);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
switch (status & STATUS_ECC_MASK) {
|
switch (status & STATUS_ECC_MASK) {
|
||||||
@ -207,6 +207,7 @@ static int gd5fxgq4uexxg_ecc_get_status(struct spinand_device *spinand,
|
|||||||
* report the maximum of 4 in this case
|
* report the maximum of 4 in this case
|
||||||
*/
|
*/
|
||||||
/* bits sorted this way (3...0): ECCS1,ECCS0,ECCSE1,ECCSE0 */
|
/* bits sorted this way (3...0): ECCS1,ECCS0,ECCSE1,ECCSE0 */
|
||||||
|
status2 = *(spinand->scratchbuf);
|
||||||
return ((status & STATUS_ECC_MASK) >> 2) |
|
return ((status & STATUS_ECC_MASK) >> 2) |
|
||||||
((status2 & STATUS_ECC_MASK) >> 4);
|
((status2 & STATUS_ECC_MASK) >> 4);
|
||||||
|
|
||||||
@ -228,7 +229,7 @@ static int gd5fxgq5xexxg_ecc_get_status(struct spinand_device *spinand,
|
|||||||
{
|
{
|
||||||
u8 status2;
|
u8 status2;
|
||||||
struct spi_mem_op op = SPINAND_GET_FEATURE_OP(GD5FXGQXXEXXG_REG_STATUS2,
|
struct spi_mem_op op = SPINAND_GET_FEATURE_OP(GD5FXGQXXEXXG_REG_STATUS2,
|
||||||
&status2);
|
spinand->scratchbuf);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
switch (status & STATUS_ECC_MASK) {
|
switch (status & STATUS_ECC_MASK) {
|
||||||
@ -248,6 +249,7 @@ static int gd5fxgq5xexxg_ecc_get_status(struct spinand_device *spinand,
|
|||||||
* 1 ... 4 bits are flipped (and corrected)
|
* 1 ... 4 bits are flipped (and corrected)
|
||||||
*/
|
*/
|
||||||
/* bits sorted this way (1...0): ECCSE1, ECCSE0 */
|
/* bits sorted this way (1...0): ECCSE1, ECCSE0 */
|
||||||
|
status2 = *(spinand->scratchbuf);
|
||||||
return ((status2 & STATUS_ECC_MASK) >> 4) + 1;
|
return ((status2 & STATUS_ECC_MASK) >> 4) + 1;
|
||||||
|
|
||||||
case STATUS_ECC_UNCOR_ERROR:
|
case STATUS_ECC_UNCOR_ERROR:
|
||||||
|
Loading…
Reference in New Issue
Block a user