All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mtd: nand: samsung: Disable subpage writes on E-die NAND
@ 2018-01-09 13:19 Ladislav Michl
  2018-01-10  8:46 ` Boris Brezillon
  0 siblings, 1 reply; 2+ messages in thread
From: Ladislav Michl @ 2018-01-09 13:19 UTC (permalink / raw)
  To: linux-mtd
  Cc: Boris Brezillon, Richard Weinberger, David Woodhouse,
	Brian Norris, Marek Vasut, Cyrille Pitchen

Samsung E-die SLC NAND manufactured using 21nm process (K9F1G08U0E)
does not support partial page programming, so disable subpage writes
for it. Manufacturing process is stored in lowest two bits of 5th ID
byte.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 Changes:
 - v2: 
   * Reword commit log
   * Check also for device type
   * Reimplement if statements using switch

 drivers/mtd/nand/nand_samsung.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/nand_samsung.c b/drivers/mtd/nand/nand_samsung.c
index f6b0a63a068c..6971c35b78e9 100644
--- a/drivers/mtd/nand/nand_samsung.c
+++ b/drivers/mtd/nand/nand_samsung.c
@@ -92,10 +92,22 @@ static void samsung_nand_decode_id(struct nand_chip *chip)
 	} else {
 		nand_decode_ext_id(chip);
 
-		/* Datasheet values for SLC Samsung K9F4G08U0D-S[I|C]B0(T00) */
-		if (nand_is_slc(chip) && chip->id.data[1] == 0xDC) {
-			chip->ecc_step_ds = 512;
-			chip->ecc_strength_ds = 1;
+		if (nand_is_slc(chip)) {
+			switch (chip->id.data[1]) {
+			/* K9F4G08U0D-S[I|C]B0(T00) */
+			case 0xDC:
+				chip->ecc_step_ds = 512;
+				chip->ecc_strength_ds = 1;
+				break;
+			/* K9F1G08U0E 21nm chips do not support subpage write */
+			case 0xF1:
+				if (chip->id.len > 4 &&
+				    (chip->id.data[4] & GENMASK(1,0)) == 0x1)
+					chip->options |= NAND_NO_SUBPAGE_WRITE;
+				break;
+			default:
+				break;
+			}
 		}
 	}
 }
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] mtd: nand: samsung: Disable subpage writes on E-die NAND
  2018-01-09 13:19 [PATCH v2] mtd: nand: samsung: Disable subpage writes on E-die NAND Ladislav Michl
@ 2018-01-10  8:46 ` Boris Brezillon
  0 siblings, 0 replies; 2+ messages in thread
From: Boris Brezillon @ 2018-01-10  8:46 UTC (permalink / raw)
  To: Ladislav Michl
  Cc: linux-mtd, Richard Weinberger, Marek Vasut, Cyrille Pitchen,
	Brian Norris, David Woodhouse

On Tue, 9 Jan 2018 14:19:11 +0100
Ladislav Michl <ladis@linux-mips.org> wrote:

> Samsung E-die SLC NAND manufactured using 21nm process (K9F1G08U0E)
> does not support partial page programming, so disable subpage writes
> for it. Manufacturing process is stored in lowest two bits of 5th ID
> byte.

Applied.

Thanks,

Boris

> 
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> ---
>  Changes:
>  - v2: 
>    * Reword commit log
>    * Check also for device type
>    * Reimplement if statements using switch
> 
>  drivers/mtd/nand/nand_samsung.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_samsung.c b/drivers/mtd/nand/nand_samsung.c
> index f6b0a63a068c..6971c35b78e9 100644
> --- a/drivers/mtd/nand/nand_samsung.c
> +++ b/drivers/mtd/nand/nand_samsung.c
> @@ -92,10 +92,22 @@ static void samsung_nand_decode_id(struct nand_chip *chip)
>  	} else {
>  		nand_decode_ext_id(chip);
>  
> -		/* Datasheet values for SLC Samsung K9F4G08U0D-S[I|C]B0(T00) */
> -		if (nand_is_slc(chip) && chip->id.data[1] == 0xDC) {
> -			chip->ecc_step_ds = 512;
> -			chip->ecc_strength_ds = 1;
> +		if (nand_is_slc(chip)) {
> +			switch (chip->id.data[1]) {
> +			/* K9F4G08U0D-S[I|C]B0(T00) */
> +			case 0xDC:
> +				chip->ecc_step_ds = 512;
> +				chip->ecc_strength_ds = 1;
> +				break;
> +			/* K9F1G08U0E 21nm chips do not support subpage write */
> +			case 0xF1:
> +				if (chip->id.len > 4 &&
> +				    (chip->id.data[4] & GENMASK(1,0)) == 0x1)
> +					chip->options |= NAND_NO_SUBPAGE_WRITE;
> +				break;
> +			default:
> +				break;
> +			}
>  		}
>  	}
>  }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-10  8:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-09 13:19 [PATCH v2] mtd: nand: samsung: Disable subpage writes on E-die NAND Ladislav Michl
2018-01-10  8:46 ` Boris Brezillon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.