Staging: MTD: Micron SPINAND Driver support
Subsystems (3)
PATCH 1/1 Staging: MTD: Micron SPINAND Driver support
This patch adds support for Micron SPINAND via MTD.
---
This patch has to be merged via staging tree.
This is a driver from Micron for MT29F1G01ZACH4 SPI based NAND chips. This driver had been posted multiple times to the mtd list.
1. http://lists.infradead.org/pipermail/linux-mtd/2010-May/031975.html
2. http://lists.infradead.org/pipermail/linux-mtd/2010-April/029523.html
3. patchwork.ozlabs.org/patch/258697/
This has not been merged into the main kernel yet.
I have cleaned and updated it for current kernel. Since there are many users for this driver, it may be useful to add it to the staging tree, where further fixes and cleanups can be done. Once it reaches to the standard will be moved to the mtd.
This driver has been tested with Micron SPINAND MT29F1G01ZACH4 chip on kernel 3.11 on the Netlogic XLP platform.
Mona Anonuevo, I have retained your sign-offs from the original patch.
drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/mt29f_spinand/Kconfig | 16 + drivers/staging/mt29f_spinand/Makefile | 1 + drivers/staging/mt29f_spinand/TODO | 13 + drivers/staging/mt29f_spinand/mt29f_spinand.c | 917 ++++++++++++++++++++++++++ drivers/staging/mt29f_spinand/mt29f_spinand.h | 109 +++ 7 files changed, 1059 insertions(+) create mode 100644 drivers/staging/mt29f_spinand/Kconfig create mode 100644 drivers/staging/mt29f_spinand/Makefile create mode 100644 drivers/staging/mt29f_spinand/TODO create mode 100644 drivers/staging/mt29f_spinand/mt29f_spinand.c create mode 100644 drivers/staging/mt29f_spinand/mt29f_spinand.h
drivers/staging/Kconfig +2 -0
@@ -136,6 +136,8 @@ source "drivers/staging/goldfish/Kconfig" source "drivers/staging/netlogic/Kconfig" +source "drivers/staging/mt29f_spinand/Kconfig" + source "drivers/staging/dwc2/Kconfig" source "drivers/staging/lustre/Kconfig"
drivers/staging/Makefile +1 -0
@@ -63,3 +63,4 @@ obj-$(CONFIG_GOLDFISH) += goldfish/ obj-$(CONFIG_USB_DWC2) += dwc2/ obj-$(CONFIG_LUSTRE_FS) += lustre/ obj-$(CONFIG_USB_BTMTK) += btmtk_usb/ +obj-$(CONFIG_MTD_SPINAND_MT29F) += mt29f_spinand/
drivers/staging/mt29f_spinand/Kconfig new file +16 -0
@@ -0,0 +1,16 @@ +config MTD_SPINAND_MT29F + tristate "SPINAND Device Support for Micron" + depends on MTD + help + This enables support for accessing Micron SPI NAND flash + devices. + If you have Micron SPI NAND chip say yes. + + If unsure, say no here. + +config MTD_SPINAND_ONDIEECC + bool "Use SPINAND internal ECC" + help + Internel ECC. + Enables Hardware ECC support for Micron SPI NAND. +
drivers/staging/mt29f_spinand/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_MTD_SPINAND_MT29F) += mt29f_spinand.o
drivers/staging/mt29f_spinand/TODO new file +13 -0
@@ -0,0 +1,13 @@ +TODO: + - Tested on XLP platform, needs to be tested on other platforms. + - Checkpatch.pl cleanups + - Sparce fixes. + - Clean up coding style to meet kernel standard. + +Please send patches +To: +Kamlakant Patel <[email protected]> +Cc: +Greg Kroah-Hartman <[email protected]> +Mona Anonuevo <[email protected]> [email protected]
drivers/staging/mt29f_spinand/mt29f_spinand.c new file +917 -0
917 lines not on this page · raw message
drivers/staging/mt29f_spinand/mt29f_spinand.h new file +109 -0
109 lines not on this page · raw message
Signature · 1 line
1.8.1.3
Greg KH
maintainerQuoted 67 lines · Kamlakant Patel
This patch adds support for Micron SPINAND via MTD.
Signed-off-by Mona Anonuevo <[email protected]>Signed-off-by Kamlakant Patel <[email protected]>---
This patch has to be merged via staging tree.This is a driver from Micron for MT29F1G01ZACH4 SPI based NAND chips. This driver had been posted multiple times to the mtd list.
1. http://lists.infradead.org/pipermail/linux-mtd/2010-May/031975.html
2. http://lists.infradead.org/pipermail/linux-mtd/2010-April/029523.html
3. patchwork.ozlabs.org/patch/258697/
This has not been merged into the main kernel yet.I have cleaned and updated it for current kernel. Since there are many users for this driver, it may be useful to add it to the staging tree, where further fixes and cleanups can be done. Once it reaches to the standard will be moved to the mtd.
This driver has been tested with Micron SPINAND MT29F1G01ZACH4 chip on kernel 3.11 on the Netlogic XLP platform.
Mona Anonuevo, I have retained your sign-offs from the original patch.
drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/mt29f_spinand/Kconfig | 16 + drivers/staging/mt29f_spinand/Makefile | 1 + drivers/staging/mt29f_spinand/TODO | 13 + drivers/staging/mt29f_spinand/mt29f_spinand.c | 917 ++++++++++++++++++++++++++ drivers/staging/mt29f_spinand/mt29f_spinand.h | 109 +++ 7 files changed, 1059 insertions(+) create mode 100644 drivers/staging/mt29f_spinand/Kconfig create mode 100644 drivers/staging/mt29f_spinand/Makefile create mode 100644 drivers/staging/mt29f_spinand/TODO create mode 100644 drivers/staging/mt29f_spinand/mt29f_spinand.c create mode 100644 drivers/staging/mt29f_spinand/mt29f_spinand.hdrivers/staging/Kconfig +2
-0@@ -136,6 +136,8 @@ source "drivers/staging/goldfish/Kconfig" source "drivers/staging/netlogic/Kconfig" +source "drivers/staging/mt29f_spinand/Kconfig" + source "drivers/staging/dwc2/Kconfig" source "drivers/staging/lustre/Kconfig"drivers/staging/Makefile +1
-0@@ -63,3 +63,4 @@ obj-$(CONFIG_GOLDFISH) += goldfish/ obj-$(CONFIG_XILLYBUS) += xillybus/ obj-$(CONFIG_DGNC) += dgnc/ obj-$(CONFIG_DGAP) += dgap/ +obj-$(CONFIG_MTD_SPINAND_MT29F) += mt29f_spinand/drivers/staging/mt29f_spinand/Kconfig new file +2
-0@@ -0,0 +1,16 @@ +config MTD_SPINAND_MT29F + tristate "SPINAND Device Support for Micron"
drivers/staging/mt29f_spinand/Kconfig line 12
Quoted 10 lines
drivers/staging/mt29f_spinand/Kconfig new file +10
-0+ depends on MTD + help + This enables support for accessing Micron SPI NAND flash + devices. + If you have Micron SPI NAND chip say yes. + + If unsure, say no here. + +config MTD_SPINAND_ONDIEECC + bool "Use SPINAND internal ECC"
This needs to depend on MTD_SPINAND_MT29F in order to make any sense, right?
Can you please send a follow-on patch for it?
thanks,
greg k-h
Greg KH
maintainerQuoted 14 lines · Kamlakant Patel
This patch adds support for Micron SPINAND via MTD.
Signed-off-by Mona Anonuevo <[email protected]>Signed-off-by Kamlakant Patel <[email protected]>---
This patch has to be merged via staging tree.This is a driver from Micron for MT29F1G01ZACH4 SPI based NAND chips. This driver had been posted multiple times to the mtd list.
1. http://lists.infradead.org/pipermail/linux-mtd/2010-May/031975.html
2. http://lists.infradead.org/pipermail/linux-mtd/2010-April/029523.html
3. patchwork.ozlabs.org/patch/258697/
This has not been merged into the main kernel yet.
Quoted 8 lines
I have cleaned and updated it for current kernel. Since there are many users for this driver, it may be useful to add it to the staging tree, where further fixes and cleanups can be done. Once it reaches to the standard will be moved to the mtd.
This driver has been tested with Micron SPINAND MT29F1G01ZACH4 chip on kernel 3.11 on the Netlogic XLP platform.
Mona Anonuevo, I have retained your sign-offs from the original patch.
With this applied, I get the following build error:
../ERROR: "nand_scan" [drivers/staging/mt29f_spinand/mt29f_spinand.ko] undefined!
Can you please fix this and resend a working version?
thanks,
greg k-h
Quoted 22 lines · Greg KH
Quoted 21 lines · Kamlakant Patel
This patch adds support for Micron SPINAND via MTD.
Signed-off-by Mona Anonuevo <[email protected]>Signed-off-by Kamlakant Patel <[email protected]>---
This patch has to be merged via staging tree.This is a driver from Micron for MT29F1G01ZACH4 SPI based NAND chips. This driver had been posted multiple times to the mtd list.
1. http://lists.infradead.org/pipermail/linux-mtd/2010-May/031975.html
2. http://lists.infradead.org/pipermail/linux-mtd/2010-April/029523.html
3. patchwork.ozlabs.org/patch/258697/
This has not been merged into the main kernel yet.I have cleaned and updated it for current kernel. Since there are many users for this driver, it may be useful to add it to the staging tree, where further fixes and cleanups can be done. Once it reaches to the standard will be moved to the mtd.
This driver has been tested with Micron SPINAND MT29F1G01ZACH4 chip on kernel 3.11 on the Netlogic XLP platform.
Quoted 6 lines
Quoted 1 line
Mona Anonuevo, I have retained your sign-offs from the original patch.
With this applied, I get the following build error:
../ERROR: "nand_scan" [drivers/staging/mt29f_spinand/mt29f_spinand.ko] undefined!Can you please fix this and resend a working version?
Thank you for the review, I will fix the dependency issue and resubmit the patch.
Thanks,
Kamlakant Patel
Quoted 5 lines
thanks,
greg k-h
PATCH 1/1 Staging: MTD: Micron SPINAND Driver support
In reply to Kamlakant PatelThis patch adds support for Micron SPINAND via MTD.
---
This patch has to be merged via staging tree.
This is a driver from Micron for MT29F1G01ZACH4 SPI based NAND chips. This driver had been posted multiple times to the mtd list.
1. http://lists.infradead.org/pipermail/linux-mtd/2010-May/031975.html
2. http://lists.infradead.org/pipermail/linux-mtd/2010-April/029523.html
3. patchwork.ozlabs.org/patch/258697/
This has not been merged into the main kernel yet.
I have cleaned and updated it for current kernel. Since there are many users for this driver, it may be useful to add it to the staging tree, where further fixes and cleanups can be done. Once it reaches to the standard will be moved to the mtd.
This driver has been tested with Micron SPINAND MT29F1G01ZACH4 chip on kernel 3.12 on the Netlogic XLP platforms.
Mona Anonuevo, I have retained your sign-offs from the original patch.
v1:
* Added MTD_SPINAND_MT29F and MTD_NAND dependencies to avoid build errors.
* Some more code cleanup.
drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/mt29f_spinand/Kconfig | 16 + drivers/staging/mt29f_spinand/Makefile | 1 + drivers/staging/mt29f_spinand/TODO | 13 + drivers/staging/mt29f_spinand/mt29f_spinand.c | 962 ++++++++++++++++++++++++++ drivers/staging/mt29f_spinand/mt29f_spinand.h | 107 +++ 7 files changed, 1102 insertions(+) create mode 100644 drivers/staging/mt29f_spinand/Kconfig create mode 100644 drivers/staging/mt29f_spinand/Makefile create mode 100644 drivers/staging/mt29f_spinand/TODO create mode 100644 drivers/staging/mt29f_spinand/mt29f_spinand.c create mode 100644 drivers/staging/mt29f_spinand/mt29f_spinand.h
drivers/staging/Kconfig +2 -0
@@ -136,6 +136,8 @@ source "drivers/staging/goldfish/Kconfig" source "drivers/staging/netlogic/Kconfig" +source "drivers/staging/mt29f_spinand/Kconfig" + source "drivers/staging/dwc2/Kconfig" source "drivers/staging/lustre/Kconfig"
drivers/staging/Makefile +1 -0
@@ -66,3 +66,4 @@ obj-$(CONFIG_USB_BTMTK) += btmtk_usb/ obj-$(CONFIG_XILLYBUS) += xillybus/ obj-$(CONFIG_DGNC) += dgnc/ obj-$(CONFIG_DGAP) += dgap/ +obj-$(CONFIG_MTD_SPINAND_MT29F) += mt29f_spinand/
drivers/staging/mt29f_spinand/Kconfig new file +16 -0
@@ -0,0 +1,16 @@ +config MTD_SPINAND_MT29F + tristate "SPINAND Device Support for Micron" + depends on MTD_NAND && SPI + help + This enables support for accessing Micron SPI NAND flash + devices. + If you have Micron SPI NAND chip say yes. + + If unsure, say no here. + +config MTD_SPINAND_ONDIEECC + bool "Use SPINAND internal ECC" + depends on MTD_SPINAND_MT29F + help + Internel ECC. + Enables Hardware ECC support for Micron SPI NAND.
drivers/staging/mt29f_spinand/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_MTD_SPINAND_MT29F) += mt29f_spinand.o
drivers/staging/mt29f_spinand/TODO new file +13 -0
@@ -0,0 +1,13 @@ +TODO: + - Tested on XLP platform, needs to be tested on other platforms. + - Checkpatch.pl cleanups + - Sparce fixes. + - Clean up coding style to meet kernel standard. + +Please send patches +To: +Kamlakant Patel <[email protected]> +Cc: +Greg Kroah-Hartman <[email protected]> +Mona Anonuevo <[email protected]> [email protected]
drivers/staging/mt29f_spinand/mt29f_spinand.c new file +962 -0
962 lines not on this page · raw message
drivers/staging/mt29f_spinand/mt29f_spinand.h new file +107 -0
107 lines not on this page · raw message
Signature · 1 line
1.8.1.3
Quoted 40 lines · Kamlakant Patel
This patch adds support for Micron SPINAND via MTD.
Signed-off-by Mona Anonuevo <[email protected]>Signed-off-by Kamlakant Patel <[email protected]>---
This patch has to be merged via staging tree.This is a driver from Micron for MT29F1G01ZACH4 SPI based NAND chips. This driver had been posted multiple times to the mtd list.
1. http://lists.infradead.org/pipermail/linux-mtd/2010-May/031975.html
2. http://lists.infradead.org/pipermail/linux-mtd/2010-April/029523.html
3. patchwork.ozlabs.org/patch/258697/
This has not been merged into the main kernel yet.I have cleaned and updated it for current kernel. Since there are many users for this driver, it may be useful to add it to the staging tree, where further fixes and cleanups can be done. Once it reaches to the standard will be moved to the mtd.
This driver has been tested with Micron SPINAND MT29F1G01ZACH4 chip on kernel 3.12 on the Netlogic XLP platforms.
Mona Anonuevo, I have retained your sign-offs from the original patch.
v1:
* AddedMTD_SPINAND_MT29FandMTD_NANDdependencies to avoid build errors.
* Some more code cleanup.drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/mt29f_spinand/Kconfig | 16 + drivers/staging/mt29f_spinand/Makefile | 1 + drivers/staging/mt29f_spinand/TODO | 13 + drivers/staging/mt29f_spinand/mt29f_spinand.c | 962 ++++++++++++++++++++++++++ drivers/staging/mt29f_spinand/mt29f_spinand.h | 107 +++ 7 files changed, 1102 insertions(+) create mode 100644 drivers/staging/mt29f_spinand/Kconfig create mode 100644 drivers/staging/mt29f_spinand/Makefile create mode 100644 drivers/staging/mt29f_spinand/TODO create mode 100644 drivers/staging/mt29f_spinand/mt29f_spinand.c create mode 100644 drivers/staging/mt29f_spinand/mt29f_spinand.h
...
Quoted 6 lines
drivers/staging/mt29f_spinand/mt29f_spinand.c new file +0
-0@@ -0,0 +1,962 @@
...
drivers/staging/mt29f_spinand/mt29f_spinand.c line 176
Quoted 12 lines
drivers/staging/mt29f_spinand/mt29f_spinand.c new file +12
-0+#define MAX_WAIT_JIFFIES (40 * HZ) +static int wait_till_ready (struct spi_device *spi_nand) +{ +unsigned long deadline; +int retval; +u8 stat =0 ; + + deadline = jiffies +MAX_WAIT_JIFFIES ; + do { + retval = spinand_read_status(spi_nand, &stat); + if (retval < 0) + return -1;
You might want to look at using proper error codes here.
drivers/staging/mt29f_spinand/mt29f_spinand.c line 186
Quoted 10 lines
drivers/staging/mt29f_spinand/mt29f_spinand.c new file +10
-0+else if (!(stat &0x1 )) +break ; + +cond_resched (); + }while (!time_after_eq (jiffies, deadline)); + +if ((stat &0x1 ) ==0 ) +return 0 ; + +return -1 ;
Same.
Quoted 1 line
+}
...
drivers/staging/mt29f_spinand/mt29f_spinand.c line 685
Quoted 12 lines
drivers/staging/mt29f_spinand/mt29f_spinand.c new file +12
-0+static int spinand_wait (struct mtd_info *mtd,struct nand_chip *chip) +{ +struct spinand_info *info = (struct spinand_info *)chip->priv; + +unsigned long timeo = jiffies; +int retval, state = chip->state; +u8 status; + +if (state ==FL_ERASING ) + timeo += (HZ *400 ) /1000 ; +else + timeo += (HZ *20 ) /1000 ;
msecs_to_jiffies()?
drivers/staging/mt29f_spinand/mt29f_spinand.c line 696
Quoted 11 lines
drivers/staging/mt29f_spinand/mt29f_spinand.c new file +11
-0+ +while (time_before (jiffies, timeo)) { + retval =spinand_read_status (info->spi, &status); +if ((status &STATUS_OIP_MASK ) ==STATUS_READY ) +return 0 ; + +cond_resched (); + } +return 0 ; +} +
You can address these comments in follow up patches after it's included in staging, though. There's probably more review needed anyway eventually (I see that no one really has reviewed this on the MTD mailing list yet).
Brian
Greg KH
maintainerdrivers/staging/Kconfig source "drivers/staging/goldfish/Kconfig" · line 140
Quoted 8 lines · Kamlakant Patel
drivers/staging/Kconfig +2
-0@@ -136,6 +136,8 @@ source "drivers/staging/goldfish/Kconfig" source "drivers/staging/netlogic/Kconfig" +source "drivers/staging/mt29f_spinand/Kconfig" +
Any reason you don't put it at the end of the file, and need it here in the middle?
thanks,
greg k-h
Greg KH
maintainerQuoted 8 lines · Kamlakant Patel
drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/mt29f_spinand/Kconfig | 16 + drivers/staging/mt29f_spinand/Makefile | 1 + drivers/staging/mt29f_spinand/TODO | 13 + drivers/staging/mt29f_spinand/mt29f_spinand.c | 962 ++++++++++++++++++++++++++ drivers/staging/mt29f_spinand/mt29f_spinand.h | 107 +++
Why do you need a separate .h file for a single driver?
It's not a reason to reject this, just curious if it's that way for a reason. I'll look at this closer tomorrow and apply it if it passes my minor amount of build testing.
thanks,
greg k-h
Quoted 18 lines
From: linux-mtd On Behalf Of Brian Norris
Quoted 9 lines · Kamlakant Patel
This patch adds support for Micron SPINAND via MTD.
Signed-off-by Mona Anonuevo <[email protected]>Signed-off-by Kamlakant Patel <[email protected]>---
This patch has to be merged via staging tree.This is a driver from Micron for MT29F1G01ZACH4 SPI based NAND chips.
This driver had
Quoted 7 lines
been posted multiple times to the mtd list.
1. http://lists.infradead.org/pipermail/linux-mtd/2010-May/031975.html
2. http://lists.infradead.org/pipermail/linux-mtd/2010-April/029523.html
3. patchwork.ozlabs.org/patch/258697/
This has not been merged into the main kernel yet.I have cleaned and updated it for current kernel. Since there are many
Quoted 12 lines
users for
Quoted 1 line
this driver, it may be useful to add it to the staging tree, where further fixes
and
Quoted 1 line
cleanups can be done. Once it reaches to the standard will be moved to the
mtd.
Quoted 2 lines
This driver has been tested with Micron SPINAND MT29F1G01ZACH4 chip
on kernel 3.12 on
Quoted 4 lines
the Netlogic XLP platforms.
Mona Anonuevo, I have retained your sign-offs from the original patch.
I see that major portion (especially the generic framework) is ported from
http://lists.infradead.org/pipermail/linux-mtd/2010-May/031975.html
So shouldn't you just maintain the original authorship ?
And the original headers ?
Quoted 6 lines
You can address these comments in follow up patches after it's included in staging, though. There's probably more review needed anyway eventually (I see that no one really has reviewed this on the MTD mailing list yet).
The original version of this patch in 2010 added *generic spinand* framework. And support for m29f (Micron devices) should have been added using that generic framework. But due to lack of response generic framework never went in.
Therefore I think this patch series adds a customized driver just for 'm29f' (Micron serial NAND) devices, removing the generalization.
There was a refreshed version of original patch (with generic framework) but no response on that too. I don't want to hold this patch, but it would be good, if you can review generic framework also ..
https://lkml.org/lkml/2013/6/26/88
with regards, pekon
Quoted 26 lines · Pekon
Quoted 26 lines
From: linux-mtd On Behalf Of Brian Norris
Quoted 9 lines · Kamlakant Patel
This patch adds support for Micron SPINAND via MTD.
Signed-off-by Mona Anonuevo <[email protected]>Signed-off-by Kamlakant Patel <[email protected]>---
This patch has to be merged via staging tree.This is a driver from Micron for MT29F1G01ZACH4 SPI based NAND chips.
This driver had
Quoted 7 lines
been posted multiple times to the mtd list.
1. http://lists.infradead.org/pipermail/linux-mtd/2010-May/031975.html
2. http://lists.infradead.org/pipermail/linux-mtd/2010-April/029523.html
3. patchwork.ozlabs.org/patch/258697/
This has not been merged into the main kernel yet.I have cleaned and updated it for current kernel. Since there are many
users for
Quoted 1 line
this driver, it may be useful to add it to the staging tree, where further fixes
and
Quoted 1 line
cleanups can be done. Once it reaches to the standard will be moved to the
mtd.
Quoted 2 lines
This driver has been tested with Micron SPINAND MT29F1G01ZACH4 chip
on kernel 3.12 on
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
the Netlogic XLP platforms.
Mona Anonuevo, I have retained your sign-offs from the original patch.
I see that major portion (especially the generic framework) is ported from
http://lists.infradead.org/pipermail/linux-mtd/2010-May/031975.html
So shouldn't you just maintain the original authorship ?
And the original headers ?
I have retained signoff, module_author name and copyright from the original patch. There are significant changes in the code, so it will not be correct to keep the commit author.
Quoted 13 lines
Quoted 6 lines
You can address these comments in follow up patches after it's included in staging, though. There's probably more review needed anyway eventually (I see that no one really has reviewed this on the MTD mailing list yet).
The original version of this patch in 2010 added *generic spinand* framework. And support for m29f (Micron devices) should have been added using that generic framework. But due to lack of response generic framework never went in.
Therefore I think this patch series adds a customized driver just for 'm29f' (Micron serial NAND) devices, removing the generalization.
Quoted 4 lines
There was a refreshed version of original patch (with generic framework) but no response on that too. I don't want to hold this patch, but it would be good, if you can review generic framework also ..
https://lkml.org/lkml/2013/6/26/88
Right now, we don't want do merge the framework code into staging, that has to go through linux-mtd after discussion. This patch is to add a working driver for mt29f chip using the existing NAND framework.
Quoted 3 lines
with regards, pekon