Skip to contentSkip to conversation

nand/denali: Adding Denali NAND driver support

PATCH New Chin Liang See 3 participants 5 messages Sep 12, 2014 – Sep 25, 2014

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

PATCH v10 1/1 nand/denali: Adding Denali NAND driver support

To add the Denali NAND driver support into U-Boot. This driver is leveraged from Linux with commit ID fdbad98dff8007f2b8bee6698b5d25ebba0471c9. For Denali controller 64 variance, you need to declare macro CONFIG_SYS_NAND_DENALI_64BIT.

Cc Scott Wood <[email protected]>
Cc Masahiro Yamada <[email protected]>

---
Changes for v10
- Updated the commit message to include Linux driver commit ID, usage of macro CONFIG_SYS_NAND_DENALI_64BIT
- Removed casting for memcpy function
- Removed NAND_CMD_LOCK_TIGHT support as no longer in latest NAND driver Changes for v9
- Updated the commit message
- Removed macro kern_xx
- Removed debug macro
- Changed CONFIG_NAND_DENALI_64BIT to CONFIG_SYS_NAND_DENALI_64BIT Changes for v8
- Applied Masahiro's patch as below
- Replaced "denali->foo" with "denali.foo"
- Fixed denali_write_oob() handler
- Made denali_read_oob() 10x faster
Changes for v7
- Adding Masahiro's code to support 64bit version controller
- Removed unused stub functions
- Enhanced the ECC calculation
Changes for v6
- Remove chip_delay as its unused
- Remove ECC bit assignment in nand_para functions
Changes for v5
- Rename denali_nand to denali only
- Rename the macro for ctrl and data address
Changes for v4
- Added cache flush to handle dcache enabled
- Used standard return where 0 for pass
- Removed unnecessary casting
- Used standard readl and writel
Changes for v3
- Fixed coding style
Changes for v2
- Enable this driver support for SOCFPGA

---
 drivers/mtd/nand/Makefile |    1 +
 drivers/mtd/nand/denali.c | 1205 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/nand/denali.h |  467 ++++++++++++++++++
 3 files changed, 1673 insertions(+)
 create mode 100644 drivers/mtd/nand/denali.c
 create mode 100644 drivers/mtd/nand/denali.h
drivers/mtd/nand/Makefile +1 -0
index bf1312a..f298f84 100644
@@ -42,6 +42,7 @@ obj-$(CONFIG_NAND_ECC_BCH) += nand_bch.o
 obj-$(CONFIG_NAND_ATMEL) += atmel_nand.o
 obj-$(CONFIG_DRIVER_NAND_BFIN) += bfin_nand.o
 obj-$(CONFIG_NAND_DAVINCI) += davinci_nand.o
+obj-$(CONFIG_NAND_DENALI) += denali.o
 obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o
 obj-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
drivers/mtd/nand/denali.c new file +1205 -0

1,205 lines not on this page · raw message

drivers/mtd/nand/denali.h new file +467 -0

467 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v10 1/1 nand/denali: Adding Denali NAND driver support

Quoted 9 lines · On Fri, 12 Sep 2014 00:42:17 -0500 Chin Liang See <[email protected]> wrote:

To add the Denali NAND driver support into U-Boot. This driver is leveraged from Linux with commit ID fdbad98dff8007f2b8bee6698b5d25ebba0471c9. For Denali controller 64 variance, you need to declare macro CONFIG_SYS_NAND_DENALI_64BIT.

Cc Scott Wood <[email protected]>
Cc Masahiro Yamada <[email protected]>
Quoted 6 lines

---
Changes for v10
- Updated the commit message to include Linux driver commit ID, usage of macro CONFIG_SYS_NAND_DENALI_64BIT
- Removed casting for memcpy function
- Removed NAND_CMD_LOCK_TIGHT support as no longer in latest NAND driver

I am looking forward to get this driver in.

Best Regards
Masahiro Yamada

#2 lore raw

PATCH v10 1/1 nand/denali: Adding Denali NAND driver support

Hi Scott, Tom,

2014-09-12 19:43 GMT+09:00 Masahiro Yamada <[email protected]>:

Quoted 21 lines
Quoted 9 lines · On Fri, 12 Sep 2014 00:42:17 -0500 Chin Liang See <[email protected]> wrote:

To add the Denali NAND driver support into U-Boot. This driver is leveraged from Linux with commit ID fdbad98dff8007f2b8bee6698b5d25ebba0471c9. For Denali controller 64 variance, you need to declare macro CONFIG_SYS_NAND_DENALI_64BIT.

Cc Scott Wood <[email protected]>
Cc Masahiro Yamada <[email protected]>
Quoted 6 lines

---
Changes for v10
- Updated the commit message to include Linux driver commit ID, usage of macro CONFIG_SYS_NAND_DENALI_64BIT
- Removed casting for memcpy function
- Removed NAND_CMD_LOCK_TIGHT support as no longer in latest NAND driver

Quoted 7 lines

I am looking forward to get this driver in.

How about this patch?

There are only some cosmetic updates in v10. I think enough time has passed for the review.

If Scott could apply it, that would be the best,
but he seems really busy for Linux work these days
as he stated in http://lists.denx.de/pipermail/u-boot/2014-May/180399.html.

Tom,
If Scott is too busy to take care of this patch, could you apply it directly onto u-boot/master, please?

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw

PATCH v10 1/1 nand/denali: Adding Denali NAND driver support

Quoted 40 lines · Masahiro YAMADA

Hi Scott, Tom,

2014-09-12 19:43 GMT+09:00 Masahiro Yamada <[email protected]>:

Quoted 21 lines
Quoted 9 lines · On Fri, 12 Sep 2014 00:42:17 -0500 Chin Liang See <[email protected]> wrote:

To add the Denali NAND driver support into U-Boot. This driver is leveraged from Linux with commit ID fdbad98dff8007f2b8bee6698b5d25ebba0471c9. For Denali controller 64 variance, you need to declare macro CONFIG_SYS_NAND_DENALI_64BIT.

Cc Scott Wood <[email protected]>
Cc Masahiro Yamada <[email protected]>
Quoted 6 lines

---
Changes for v10
- Updated the commit message to include Linux driver commit ID, usage of macro CONFIG_SYS_NAND_DENALI_64BIT
- Removed casting for memcpy function
- Removed NAND_CMD_LOCK_TIGHT support as no longer in latest NAND driver

Quoted 7 lines

I am looking forward to get this driver in.

How about this patch?

There are only some cosmetic updates in v10. I think enough time has passed for the review.

Quoted 7 lines

If Scott could apply it, that would be the best,
but he seems really busy for Linux work these days
as he stated in http://lists.denx.de/pipermail/u-boot/2014-May/180399.html.

Tom,
If Scott is too busy to take care of this patch, could you apply it directly onto u-boot/master, please?

How would I go about testing that this builds? I don't see any code in the tree that defines CONFIG_NAND_DENALI, nor is it obvious which board I should add it to as a test.

Also, CONFIG_SYS_NAND_DENALI_64BIT should be documented in a README, not just in the git changelog.

-Scott

#4 lore raw

PATCH v10 1/1 nand/denali: Adding Denali NAND driver support

Hi Scott,

Quoted 45 lines · On Wed, 24 Sep 2014 18:34:52 -0500 Scott Wood <[email protected]> wrote:
Quoted 44 lines · Masahiro YAMADA

Hi Scott, Tom,

2014-09-12 19:43 GMT+09:00 Masahiro Yamada <[email protected]>:

Quoted 21 lines
Quoted 9 lines · On Fri, 12 Sep 2014 00:42:17 -0500 Chin Liang See <[email protected]> wrote:

To add the Denali NAND driver support into U-Boot. This driver is leveraged from Linux with commit ID fdbad98dff8007f2b8bee6698b5d25ebba0471c9. For Denali controller 64 variance, you need to declare macro CONFIG_SYS_NAND_DENALI_64BIT.

Cc Scott Wood <[email protected]>
Cc Masahiro Yamada <[email protected]>
Quoted 6 lines

---
Changes for v10
- Updated the commit message to include Linux driver commit ID, usage of macro CONFIG_SYS_NAND_DENALI_64BIT
- Removed casting for memcpy function
- Removed NAND_CMD_LOCK_TIGHT support as no longer in latest NAND driver

Quoted 7 lines

I am looking forward to get this driver in.

How about this patch?

There are only some cosmetic updates in v10. I think enough time has passed for the review.

If Scott could apply it, that would be the best,
but he seems really busy for Linux work these days
as he stated in http://lists.denx.de/pipermail/u-boot/2014-May/180399.html.

Quoted 7 lines
Quoted 3 lines

Tom,
If Scott is too busy to take care of this patch, could you apply it directly onto u-boot/master, please?

How would I go about testing that this builds? I don't see any code in the tree that defines CONFIG_NAND_DENALI, nor is it obvious which board I should add it to as a test.

If you want to do build test,
apply the following patches in this order:

[U-Boot,v10] nand/denali: Adding Denali NAND driver support
http://patchwork.ozlabs.org/patch/388486/

[U-Boot,v3,1/6] nand: denali: add Denali NAND driver for SPL
http://patchwork.ozlabs.org/patch/385078/

[U-Boot,v3,2/6] serial: add UniPhier serial driver
http://patchwork.ozlabs.org/patch/385077/

[U-Boot,v3,3/6] arm: uniphier: add UniPhier SoC support code
http://patchwork.ozlabs.org/patch/385082/

[U-Boot,v3,4/6] arm: uniphier: add Kconfig and defconfig
http://patchwork.ozlabs.org/patch/385080/

Or you can use a branch I prepared for you:

$ git clone git://github.com/masahir0y/u-boot-kbuild.git
Cloning into 'u-boot-kbuild'...
remote: Counting objects: 10073, done.
remote: Compressing objects: 100% (4378/4378), done.
remote: Total 10073 (delta 4231), reused 8489 (delta 3511)
Receiving objects: 100% (10073/10073), 1.84 MiB | 265.00 KiB/s, done.
Resolving deltas: 100% (4231/4231), done.
Checking connectivity... done.
$ cd u-boot-kbuild/
$ git checkout -b denali_test origin/denali_test 
Branch denali_test set up to track remote branch denali_test from origin.
Switched to a new branch 'denali_test'
$ make ph1_ld4_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
#
# configuration written to spl/.config
#
$ make CROSS_COMPILE=arm-linux-gnueabi- 
scripts/kconfig/conf --silentoldconfig Kconfig
scripts/kconfig/conf --silentoldconfig Kconfig
  CHK     include/config.h
  UPD     include/config.h
  GEN     include/autoconf.mk
  GEN     include/autoconf.mk.dep
  GEN     spl/include/autoconf.mk
  CHK     include/config/uboot.release
  UPD     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  UPD     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  [ snip ]
  CC      drivers/mtd/mtdcore.o
  CC      drivers/mtd/cfi_flash.o
  LD      drivers/mtd/built-in.o
  CC      drivers/mtd/nand/nand.o
  CC      drivers/mtd/nand/nand_bbt.o
  CC      drivers/mtd/nand/nand_ids.o
  CC      drivers/mtd/nand/nand_util.o
  CC      drivers/mtd/nand/nand_ecc.o
  CC      drivers/mtd/nand/nand_base.o
  CC      drivers/mtd/nand/denali.o                      <=====
  LD      drivers/mtd/nand/built-in.o
  LD      drivers/mtd/onenand/built-in.o
  LD      drivers/mtd/spi/built-in.o
Quoted 3 lines

Also, CONFIG_SYS_NAND_DENALI_64BIT should be documented in a README, not just in the git changelog.

I will send a follow up patch.
Anyway, it is an old style to document each option in README.

I will add it to Kconfig with a help doc, something like this:

config SYS_NAND_DENALI_64BIT
bool "Support Denali NAND controller with 64bit AXI interface" depends on NAND_DENALI
help
The Denali NAND controller has some variations depending on the bus interface. DMA setup sequence is completely differenct between 32bit / 64bit AXI bus version.

If you want to use the Denali NAND controller with 64bit AXI interface, say Y. Otherwise (32bit AXI), say N.

Best Regards
Masahiro Yamada