Skip to contentSkip to conversation

mtd: msm_nand: Add initial msm nand driver support.

PATCH New Murali Nalajala 4 participants 7 messages Apr 16, 2011 – Apr 27, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 2/2 mtd: msm_nand: Add initial msm nand driver support.

Add initial msm nand driver support for Qualcomm MSM platforms. This driver is capable of handling both 2k and 4k page support nand devices.

This driver was originally developed by Arve Hjønnevåg at google. Its source is available at
http://android.git.kernel.org/?p=kernel/msm.git under android-msm-2.6.35 branch.

CC Dima Zavin <[email protected]>
CC Brian Swetland <[email protected]>
CC Arve Hjønnevåg <[email protected]>

---
Changes in V2
* Turn most of the pr_info() calls into pr_debug().

 drivers/mtd/devices/Kconfig    |   11 +
 drivers/mtd/devices/Makefile   |    1 +
 drivers/mtd/devices/msm_nand.c | 1597 ++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/devices/msm_nand.h |   77 ++
 4 files changed, 1686 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/devices/msm_nand.c
 create mode 100644 drivers/mtd/devices/msm_nand.h
drivers/mtd/devices/Kconfig +11 -0
index 35081ce..c2900c5 100644
@@ -49,6 +49,17 @@ config MTD_MS02NV
 	  say M here and read <file:Documentation/kbuild/modules.txt>.
 	  The module will be called ms02-nv.
 
+config MTD_MSM_NAND
+	tristate "MSM on-chip NAND Flash Controller driver"
+	depends on MTD && ARCH_MSM
+	select MTD_NAND_IDS
+	help
+	  This enables the on-chip NAND flash controller driver on Qualcomm's
+	  MSM and QSD platforms.
+
+	  MSM NAND controller is capable of interfacing to all leading nand
+	  flash vendor devices ie Samsung, Micron, Hynix etc.
+
 config MTD_DATAFLASH
 	tristate "Support for AT45xxx DataFlash"
 	depends on SPI_MASTER && EXPERIMENTAL
drivers/mtd/devices/Makefile +1 -0
index f3226b1..fe959e8 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_MTD_SLRAM)		+= slram.o
 obj-$(CONFIG_MTD_PHRAM)		+= phram.o
 obj-$(CONFIG_MTD_PMC551)	+= pmc551.o
 obj-$(CONFIG_MTD_MS02NV)	+= ms02-nv.o
+obj-$(CONFIG_MTD_MSM_NAND)	+= msm_nand.o
 obj-$(CONFIG_MTD_MTDRAM)	+= mtdram.o
 obj-$(CONFIG_MTD_LART)		+= lart.o
 obj-$(CONFIG_MTD_BLOCK2MTD)	+= block2mtd.o
drivers/mtd/devices/msm_nand.c new file +1597 -0

1,597 lines not on this page · raw message

drivers/mtd/devices/msm_nand.h new file +77 -0

77 lines not on this page · raw message

--
1.7.1.1

--
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

#1 lore raw

PATCH v2 2/2 mtd: msm_nand: Add initial msm nand driver support.

Hi,

Murali Nalajala a ?crit :

Quoted 17 lines

Add initial msm nand driver support for Qualcomm MSM platforms. This driver is capable of handling both 2k and 4k page support nand devices.

This driver was originally developed by Arve Hj?nnev?g at google. Its source is available at
http://android.git.kernel.org/?p=kernel/msm.git under android-msm-2.6.35 branch.

CC Dima Zavin <[email protected]>
CC Brian Swetland <[email protected]>
CC Arve Hj?nnev?g <[email protected]>

---
Changes in V2
* Turn most of the pr_info() calls into pr_debug().

Quoted 8 lines
 drivers/mtd/devices/Kconfig    |   11 +
 drivers/mtd/devices/Makefile   |    1 +
 drivers/mtd/devices/msm_nand.c | 1597 ++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/devices/msm_nand.h |   77 ++
 4 files changed, 1686 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/devices/msm_nand.c
 create mode 100644 drivers/mtd/devices/msm_nand.h

For the record, I am not sure it is a great idea to make nand drivers independent of the nand layer.
By doing that you could change the expected behavior, and introduce bug difficult to debug.

Why do you need that ? Nand drivers can override callbacks of nand framework.

Maybe because the nand layer call the driver page per page, and you want to work with more than one page. But in this case you can extend nand layer.

Or does your controller don't allow sending raw command ? And in that case all the nand logic is in the nand controller ?

Matthieu

#2 lore raw

PATCH v2 2/2 mtd: msm_nand: Add initial msm nand driver support.

Quoted 29 lines · Matthieu CASTET

Hi,

Murali Nalajala a ?crit :

Quoted 17 lines

Add initial msm nand driver support for Qualcomm MSM platforms. This driver is capable of handling both 2k and 4k page support nand devices.

This driver was originally developed by Arve Hj?nnev?g at google. Its source is available at
http://android.git.kernel.org/?p=kernel/msm.git under android-msm-2.6.35 branch.

CC Dima Zavin <[email protected]>
CC Brian Swetland <[email protected]>
CC Arve Hj?nnev?g <[email protected]>

---
Changes in V2
* Turn most of the pr_info() calls into pr_debug().

Quoted 8 lines
 drivers/mtd/devices/Kconfig    |   11 +
 drivers/mtd/devices/Makefile   |    1 +
 drivers/mtd/devices/msm_nand.c | 1597 ++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/devices/msm_nand.h |   77 ++
 4 files changed, 1686 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/devices/msm_nand.c
 create mode 100644 drivers/mtd/devices/msm_nand.h
Quoted 2 lines

For the record, I am not sure it is a great idea to make nand drivers independent of the nand layer.

This is not acceptable. Nand drivers should use the nand_base framework. If the framework is limiting, buggy, slow, etc for your case (which is quite possible) - the framework should be improved.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (????? ????????)
#3 lore raw

PATCH v2 2/2 mtd: msm_nand: Add initial msm nand driver support.

In reply to Matthieu CASTET
Quoted 34 lines · Matthieu CASTET

Hi,

Murali Nalajala a ?crit :

Quoted 17 lines

Add initial msm nand driver support for Qualcomm MSM platforms. This driver is capable of handling both 2k and 4k page support nand devices.

This driver was originally developed by Arve Hj?nnev?g at google. Its source is available at
http://android.git.kernel.org/?p=kernel/msm.git under android-msm-2.6.35 branch.

CC Dima Zavin<[email protected]>
CC Brian Swetland<[email protected]>
CC Arve Hj?nnev?g<[email protected]>

---
Changes in V2
* Turn most of the pr_info() calls into pr_debug().

Quoted 8 lines
  drivers/mtd/devices/Kconfig    |   11 +
  drivers/mtd/devices/Makefile   |    1 +
  drivers/mtd/devices/msm_nand.c | 1597 ++++++++++++++++++++++++++++++++++++++++
  drivers/mtd/devices/msm_nand.h |   77 ++
  4 files changed, 1686 insertions(+), 0 deletions(-)

create mode 100644 drivers/mtd/devices/msm_nand.c create mode 100644 drivers/mtd/devices/msm_nand.h

For the record, I am not sure it is a great idea to make nand drivers independent of the nand layer.
By doing that you could change the expected behavior, and introduce bug difficult to debug.

Quoted 7 lines

Why do you need that ? Nand drivers can override callbacks of nand framework.

Maybe because the nand layer call the driver page per page, and you want to work with more than one page. But in this case you can extend nand layer.

Or does your controller don't allow sending raw command ? And in that case all the nand logic is in the nand controller ?

Our controller doesn't allow sending RAW commands to the flash. All these commands are abstracted by the controller logic. Please refer the msm_nand.h file where you will find the commands which are different from the actual NAND device commands.

eg: To send read/write data command to the device we configure the controller with page address & controller specific command. Then the controller itself takes care of generating the internal h/w signals required by the flash and it polls for the R/B signal & wait states are internally controlled by the h/w.

Quoted 2 lines

Matthieu

Thanks,
Murali N

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#4 lore raw

PATCH v2 2/2 mtd: msm_nand: Add initial msm nand driver support.

Hi,

Murali Nalajala a ?crit :

Quoted 39 lines · Matthieu CASTET
Quoted 38 lines

Hi,

Murali Nalajala a ?crit :

Quoted 17 lines

Add initial msm nand driver support for Qualcomm MSM platforms. This driver is capable of handling both 2k and 4k page support nand devices.

This driver was originally developed by Arve Hj?nnev?g at google. Its source is available at
http://android.git.kernel.org/?p=kernel/msm.git under android-msm-2.6.35 branch.

CC Dima Zavin<[email protected]>
CC Brian Swetland<[email protected]>
CC Arve Hj?nnev?g<[email protected]>

---
Changes in V2
* Turn most of the pr_info() calls into pr_debug().

Quoted 8 lines
  drivers/mtd/devices/Kconfig    |   11 +
  drivers/mtd/devices/Makefile   |    1 +
  drivers/mtd/devices/msm_nand.c | 1597 ++++++++++++++++++++++++++++++++++++++++
  drivers/mtd/devices/msm_nand.h |   77 ++
  4 files changed, 1686 insertions(+), 0 deletions(-)

create mode 100644 drivers/mtd/devices/msm_nand.c create mode 100644 drivers/mtd/devices/msm_nand.h

For the record, I am not sure it is a great idea to make nand drivers independent of the nand layer.
By doing that you could change the expected behavior, and introduce bug difficult to debug.

Why do you need that ? Nand drivers can override callbacks of nand framework.

Maybe because the nand layer call the driver page per page, and you want to work with more than one page. But in this case you can extend nand layer.

Quoted 7 lines
Quoted 2 lines

Or does your controller don't allow sending raw command ? And in that case all the nand logic is in the nand controller ?

Our controller doesn't allow sending RAW commands to the flash. All these commands are abstracted by the controller logic. Please refer the msm_nand.h file where you will find the commands which are different from the actual NAND device commands.

Ok, but does the controller does all other check : status check, ...

In the nand framework there is already controller like yours : see the denali.c as example.

Quoted 7 lines

eg: To send read/write data command to the device we configure the controller with page address & controller specific command. Then the controller itself takes care of generating the internal h/w signals required by the flash and it polls for the R/B signal & wait states are internally controlled by the h/w.

So you provide your own

    chip->ecc.read_page
    chip->ecc.read_page_raw
    chip->ecc.read_oob
    chip->write_page
    chip->ecc.write_oob

and your done.

Matthieu

#5 lore raw

PATCH v2 2/2 mtd: msm_nand: Add initial msm nand driver support.

On 4/27/2011 6:08 PM, Matthieu CASTET wrote:

Hi,

Quoted 42 lines

Hi,

Murali Nalajala a ?crit :

Quoted 39 lines · Matthieu CASTET
Quoted 38 lines

Hi,

Murali Nalajala a ?crit :

Quoted 17 lines

Add initial msm nand driver support for Qualcomm MSM platforms. This driver is capable of handling both 2k and 4k page support nand devices.

This driver was originally developed by Arve Hj?nnev?g at google. Its source is available at
http://android.git.kernel.org/?p=kernel/msm.git under android-msm-2.6.35 branch.

CC Dima Zavin<[email protected]>
CC Brian Swetland<[email protected]>
CC Arve Hj?nnev?g<[email protected]>

---
Changes in V2
* Turn most of the pr_info() calls into pr_debug().

Quoted 8 lines
   drivers/mtd/devices/Kconfig    |   11 +
   drivers/mtd/devices/Makefile   |    1 +
   drivers/mtd/devices/msm_nand.c | 1597 ++++++++++++++++++++++++++++++++++++++++
   drivers/mtd/devices/msm_nand.h |   77 ++
   4 files changed, 1686 insertions(+), 0 deletions(-)

create mode 100644 drivers/mtd/devices/msm_nand.c create mode 100644 drivers/mtd/devices/msm_nand.h

For the record, I am not sure it is a great idea to make nand drivers independent of the nand layer.
By doing that you could change the expected behavior, and introduce bug difficult to debug.

Why do you need that ? Nand drivers can override callbacks of nand framework.

Maybe because the nand layer call the driver page per page, and you want to work with more than one page. But in this case you can extend nand layer.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

Or does your controller don't allow sending raw command ? And in that case all the nand logic is in the nand controller ?

Our controller doesn't allow sending RAW commands to the flash. All these commands are abstracted by the controller logic. Please refer the msm_nand.h file where you will find the commands which are different from the actual NAND device commands.

Ok, but does the controller does all other check : status check, ...

Yes, it does the automatic update of the status registers for every read/writes do report any ECC errors.

Quoted 3 lines

In the nand framework there is already controller like yours : see the denali.c as example.

I had gone through it, here in driver i saw something like "nand_scan_ident" calls which still use the RAW commands.

So i need to do most of the custom nand scan implementation which i am doing it right now in my code!!!

Quoted 7 lines
Quoted 7 lines

eg: To send read/write data command to the device we configure the controller with page address& controller specific command. Then the controller itself takes care of generating the internal h/w signals required by the flash and it polls for the R/B signal& wait states are internally controlled by the h/w.

Quoted 6 lines

So you provide your own

     chip->ecc.read_page
     chip->ecc.read_page_raw
     chip->ecc.read_oob
     chip->write_page
     chip->ecc.write_oob

I don't see great advantage of re-writing these call backs in my driver ( Which are very well written and tested ). Also the DMA handling is bit different than what i had seen in the denali.c code.
In my case most of the limitation comes from the controller.

We have used nand base kind of implementation wherever is possible.
eg: We have leveraged the code from nand base to detect the nand device properties.

Quoted 5 lines

and your done.

Matthieu

Thanks,
Murali N

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#6 lore raw

PATCH v2 2/2 mtd: msm_nand: Add initial msm nand driver support.

Quoted 3 lines · Murali Nalajala

We have used nand base kind of implementation wherever is possible.
eg: We have leveraged the code from nand base to detect the nand device properties.

Basing code off of other code but with modification is very different than using that other code. Copying and modifying creates more code that can miss fixes and other changes.

I do think there is value in working with the nand code. Remember that the nand code is not immutable. If there is something that almost does what msm_nand needs, perhaps is can be changed to support that as well.

David

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.