Bug 206867

Summary: Lock/Unlock fails for N25Q128A - Micron Serial NOR Flash Memory
Product: Drivers Reporter: Shreyas (shreyas.joshi)
Component: Flash/Memory Technology DevicesAssignee: David Woodhouse (dwmw2)
Status: RESOLVED PATCH_ALREADY_AVAILABLE    
Severity: blocking CC: deshawndylan, shreyas.joshi
Priority: P1    
Hardware: Other   
OS: Linux   
Kernel Version: 5.6 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: n25Q128 patch
n25q128 datasheet

Description Shreyas 2020-03-17 01:58:22 UTC
Created attachment 287951 [details]
n25Q128 patch

Situation- 

Currently, the spi-nor.c has a generic lock/unlock for the spi nor dev id - n25q128a11. Like, /* Micron <--> ST Micro */ are treated similar. 
The locking logic takes care of the truth table that comprises of   
"SEC  |  TB   |  BP2  |  BP1  |  BP0 ". However, the Micron 128Mb N25Q128A uses - 

"TB BP3 BP2 BP1 BP0". Attached is the datasheet for N25Q128A11. 

Problem - 
Since, we are not using BP3, the logic is wrong and the lock/unlock fails for this device.


Tried Solution - I have tried to put the 3.x kernel solution for the n25Q128Mb flash micron for 4.12.x version and it has worked. Here is my patch for 4.12.x. But, I don't know how to put this patch for the latest kernel version - 5.6. This new version has tried to make the locking/unlocking quite generic.
Comment 1 Shreyas 2020-03-17 01:59:13 UTC
Created attachment 287953 [details]
n25q128 datasheet
Comment 3 Shreyas 2020-04-20 23:38:20 UTC
---------- Forwarded message ---------
From: <Tudor.Ambarus@microchip.com>
Date: Mon, Apr 20, 2020 at 5:29 PM
Subject: Re: [PATCH] driver/mtd/spi-nor: Regression lock/unlock fail
To: <shreyasjoshi15@gmail.com>
Cc: <marek.vasut@gmail.com>, <linux-mtd@lists.infradead.org>


Hi, Shreyas,

This is not a regression because locking was never enabled for n25q128a11.
Please apply the following patch on spi-nor/next, it should solve your locking 
problems:

https://patchwork.ozlabs.org/project/linux-mtd/patch/1587103677-244754-1-git-send-email-chenxiang66@hisilicon.com/
Comment 4 Shreyas 2020-04-20 23:38:32 UTC
---------- Forwarded message ---------
From: <Tudor.Ambarus@microchip.com>
Date: Mon, Apr 20, 2020 at 5:29 PM
Subject: Re: [PATCH] driver/mtd/spi-nor: Regression lock/unlock fail
To: <shreyasjoshi15@gmail.com>
Cc: <marek.vasut@gmail.com>, <linux-mtd@lists.infradead.org>


Hi, Shreyas,

This is not a regression because locking was never enabled for n25q128a11.
Please apply the following patch on spi-nor/next, it should solve your locking 
problems:

https://patchwork.ozlabs.org/project/linux-mtd/patch/1587103677-244754-1-git-send-email-chenxiang66@hisilicon.com/