Skip to contentSkip to conversation

ARM: mtd: nand: davinci: add OF support for davinci nand controller

PATCH Superseded Heiko Schocher 5 participants 10 messages Jul 30, 2012 – Jan 3, 2013

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

PATCH v6 1/1 ARM: mtd: nand: davinci: add OF support for davinci nand controller

add OF support for the davinci nand controller.

Cc davinci-linux-open-source at linux.davincidsp.com
Cc linux-arm-kernel at lists.infradead.org
Cc devicetree-discuss at lists.ozlabs.org
Cc linux-mtd at lists.infradead.org
Cc David Woodhouse <[email protected]>
Cc Grant Likely <[email protected]>
Cc Sekhar Nori <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Scott Wood <[email protected]>

---
- changes for v2:
- add comments from Scott Wood:
- add "ti,davinci-" prefix
- Dashes are preferred to underscores
- rename "nandflash" to "nand"
- introduce new "ti,davinci" specific properties for setting up ecc_mode, ecc_bits, options and bbt options, instead using linux defines
- readme fixes
- no changes for v3
- changes for v4
remove "pinmux-handle" property as discussed here:
http://www.spinics.net/lists/arm-kernel/msg175701.html
with Nori Sekhar
- no changes for v5

- changes for v6:
add comments from Sekhar Nori:
- remove unnecessary includes
- use devm_kzalloc instead of kzalloc
- remove AEMIF timing specific bindings, as this has to be done later.

 .../devicetree/bindings/arm/davinci/nand.txt       |   51 ++++++++++++++
 drivers/mtd/nand/davinci_nand.c                    |   72 +++++++++++++++++++-
 2 files changed, 122 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/davinci/nand.txt
Documentation/devicetree/bindings/arm/davinci/nand.txt new file +51 -0
new file mode 100644
index 0000000..e37241f
@@ -0,0 +1,51 @@
+* Texas Instruments Davinci NAND
+
+This file provides information, what the device node for the
+davinci nand interface contain.
+
+Required properties:
+- compatible: "ti,davinci-nand";
+- reg : contain 2 offset/length values:
+        - offset and length for the access window
+        - offset and length for accessing the aemif control registers
+- ti,davinci-chipselect: Indicates on the davinci_nand driver which
+                         chipselect is used for accessing the nand.
+
+Recommended properties :
+- ti,davinci-mask-ale: mask for ale
+- ti,davinci-mask-cle: mask for cle
+- ti,davinci-mask-chipsel: mask for chipselect
+- ti,davinci-ecc-mode: ECC mode valid values for davinci driver:
+		- "none"
+		- "soft"
+		- "hw"
+- ti,davinci-ecc-bits: used ECC bits, currently supported 1 or 4.
+- ti,davinci-nand-buswidth: buswidth 8 or 16
+- ti,davinci-nand-use-bbt: use flash based bad block table support.
+
+Example (enbw_cmc board):
+aemif at 60000000 {
+	compatible = "ti,davinci-aemif";
+	#address-cells = <2>;
+	#size-cells = <1>;
+	reg = <0x68000000 0x80000>;
+	ranges = <2 0 0x60000000 0x02000000
+		  3 0 0x62000000 0x02000000
+		  4 0 0x64000000 0x02000000
+		  5 0 0x66000000 0x02000000
+		  6 0 0x68000000 0x02000000>;
+	nand at 3,0 {
+		compatible = "ti,davinci-nand";
+		reg = <3 0x0 0x807ff
+			6 0x0 0x8000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ti,davinci-chipselect = <1>;
+		ti,davinci-mask-ale = <0>;
+		ti,davinci-mask-cle = <0>;
+		ti,davinci-mask-chipsel = <0>;
+		ti,davinci-ecc-mode = "hw";
+		ti,davinci-ecc-bits = <4>;
+		ti,davinci-nand-use-bbt;
+	};
+};
drivers/mtd/nand/davinci_nand.c +71 -1

98 lines not on this page · raw message

Signature · 1 line
1.7.7.6
#1 lore raw

PATCH v6 1/1 ARM: mtd: nand: davinci: add OF support for davinci nand controller

Hello,

Quoted 37 lines · Heiko Schocher

add OF support for the davinci nand controller.

Cc davinci-linux-open-source at linux.davincidsp.com
Cc linux-arm-kernel at lists.infradead.org
Cc devicetree-discuss at lists.ozlabs.org
Cc linux-mtd at lists.infradead.org
Cc David Woodhouse<[email protected]>
Cc Grant Likely<[email protected]>
Cc Sekhar Nori<[email protected]>
Cc Wolfgang Denk<[email protected]>
Cc Scott Wood<[email protected]>

---
- changes for v2:
- add comments from Scott Wood:
- add "ti,davinci-" prefix
- Dashes are preferred to underscores
- rename "nandflash" to "nand"
- introduce new "ti,davinci" specific properties for setting up ecc_mode, ecc_bits, options and bbt options, instead using linux defines
- readme fixes
- no changes for v3
- changes for v4
remove "pinmux-handle" property as discussed here:
http://www.spinics.net/lists/arm-kernel/msg175701.html
with Nori Sekhar
- no changes for v5

- changes for v6:
add comments from Sekhar Nori:
- remove unnecessary includes
- use devm_kzalloc instead of kzalloc
- remove AEMIF timing specific bindings, as this has to be done later.

Quoted 4 lines
  .../devicetree/bindings/arm/davinci/nand.txt       |   51 ++++++++++++++
  drivers/mtd/nand/davinci_nand.c                    |   72 +++++++++++++++++++-
  2 files changed, 122 insertions(+), 1 deletions(-)

create mode 100644 Documentation/devicetree/bindings/arm/davinci/nand.txt

ping ... any comments?

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#3 lore raw

PATCH v6 1/1 ARM: mtd: nand: davinci: add OF support for davinci nand controller

In reply to Heiko Schocher
Quoted 3 lines · Heiko Schocher

add OF support for the davinci nand controller.

Pushed to l2-mtd.git, thanks!

Signature · 9 lines
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120823/2bd20e75/attachment.sig>
#4 lore raw

PATCH v6 1/1 ARM: mtd: nand: davinci: add OF support for davinci nand controller

In reply to Heiko Schocher

Hello.

Quoted 12 lines · Heiko Schocher

add OF support for the davinci nand controller.

[...]

Quoted 4 lines
drivers/mtd/nand/davinci_nand.c +0 -0
index d94b03c..f386b3c 100644

[...]

drivers/mtd/nand/davinci_nand.c static struct nand_ecclayout hwecc4_2048 __initconst = { · line 526

Quoted 9 lines
drivers/mtd/nand/davinci_nand.c +5 -0
@@ -518,9 +519,75 @@ static struct nand_ecclayout hwecc4_2048 __initconst = {
 	},
 };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id davinci_nand_of_match[] = {
+	{.compatible = "ti,davinci-nand", },
+	{},
+}

I have only one question: have you ever try to compile this patch with
CONFIG_OF enabled? If you have, you would have noticed:

drivers/mtd/nand/davinci_nand.c:527: error: expected ‘,’ or ‘;’ before ‘extern’

drivers/mtd/nand/davinci_nand.c static struct nand_ecclayout hwecc4_2048 __initconst = { · line 527

Quoted 1 line
drivers/mtd/nand/davinci_nand.c +1 -0
+MODULE_DEVICE_TABLE(of, davinci_nand_of_match);

No need to worry now, I'll send out the trivial patch...

WBR, Sergei

#5 lore raw

PATCH v6 1/1 ARM: mtd: nand: davinci: add OF support for davinci nand controller

Hello Sergei,

Quoted 37 lines · Sergei Shtylyov

Hello.

Quoted 12 lines · Heiko Schocher

add OF support for the davinci nand controller.

Cc davinci-linux-open-source at linux.davincidsp.com
Cc linux-arm-kernel at lists.infradead.org
Cc devicetree-discuss at lists.ozlabs.org
Cc linux-mtd at lists.infradead.org
Cc David Woodhouse<[email protected]>
Cc Grant Likely<[email protected]>
Cc Sekhar Nori<[email protected]>
Cc Wolfgang Denk<[email protected]>
Cc Scott Wood<[email protected]>

[...]

Quoted 4 lines
drivers/mtd/nand/davinci_nand.c +0 -0
index d94b03c..f386b3c 100644

[...]

drivers/mtd/nand/davinci_nand.c static struct nand_ecclayout hwecc4_2048 __initconst = { · line 526

Quoted 9 lines
drivers/mtd/nand/davinci_nand.c +5 -0
@@ -518,9 +519,75 @@ static struct nand_ecclayout hwecc4_2048 __initconst = {
  	},
  };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id davinci_nand_of_match[] = {
+	{.compatible = "ti,davinci-nand", },
+	{},
+}

I have only one question: have you ever try to compile this patch with
CONFIG_OF enabled? If you have, you would have noticed:

Quoted 3 lines

drivers/mtd/nand/davinci_nand.c:527: error: expected ?,? or ?;? before ?extern?

Quoted 1 line
drivers/mtd/nand/davinci_nand.c +1 -0
+MODULE_DEVICE_TABLE(of, davinci_nand_of_match);

Hmm.. maybe this crept in later after I sent the patches? They were pending for a while ... I compiled it just yet again (based on my tree when I posted this patch based on commit:

commit 3bf671af14d591ede9251acb0085e8017f3705e7
Merge: 1c212c6 4a5a418
Author: Linus Torvalds <[email protected]>
Date: Mon Aug 13 09:59:04 2012 +0300

Merge branch 'fixes-for-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds

and it compiled fine:

$ eldk-switch -r 5.2 armv7a
Setup for armv7a (using ELDK 5.2)
$ make -s uImage
arch/arm/kernel/return_address.c:62:2: warning: #warning "TODO: return_address should use unwind tables" [-Wcpp]
arch/arm/kernel/return_address.c:62:2: warning: #warning "TODO: return_address should use unwind tables" [-Wcpp]
arch/arm/mm/alignment.c: In function 'do_alignment':
arch/arm/mm/alignment.c:327:15: warning: 'offset.un' may be used uninitialized in this function [-Wuninitialized]
arch/arm/mm/alignment.c:749:21: note: 'offset.un' was declared here
drivers/mtd/chips/cfi_cmdset_0002.c: In function 'cfi_amdstd_panic_write':
include/linux/mtd/map.h:331:11: warning: 'r.x[0]' may be used uninitialized in this function [-Wuninitialized]
drivers/mtd/chips/cfi_cmdset_0002.c: In function 'cfi_amdstd_write_words':
include/linux/mtd/map.h:331:11: warning: 'r.x[0]' may be used uninitialized in this function [-Wuninitialized]
drivers/mtd/chips/cfi_cmdset_0001.c: In function 'cfi_intelext_write_words':
include/linux/mtd/map.h:331:11: warning: 'r.x[0]' may be used uninitialized in this function [-Wuninitialized]
   Kernel: arch/arm/boot/Image is ready
   Kernel: arch/arm/boot/zImage is ready
Image Name:   Linux-3.6.0-rc1-01880-g0227e8b
Created:      Thu Jan  3 06:55:26 2013
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    2432040 Bytes = 2375.04 kB = 2.32 MB
Load Address: c0008000
Entry Point:  c0008000
   Image arch/arm/boot/uImage is ready
$
$ ${CROSS_COMPILE}gcc --version
arm-linux-gnueabi-gcc (GCC) 4.6.4 20120303 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ grep -n CONFIG_OF .config
707:CONFIG_OF=y
713:# CONFIG_OF_SELFTEST is not set
714:CONFIG_OF_FLATTREE=y
715:CONFIG_OF_EARLY_FLATTREE=y
716:CONFIG_OF_ADDRESS=y
717:CONFIG_OF_IRQ=y
718:CONFIG_OF_DEVICE=y
719:CONFIG_OF_I2C=y
720:CONFIG_OF_NET=y
721:CONFIG_OF_MDIO=y
722:CONFIG_OF_MTD=y
1067:CONFIG_OF_GPIO=y
1629:CONFIG_OF_IOMMU=y
$
Quoted 1 line

No need to worry now, I'll send out the trivial patch...

Thanks!

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#6 lore raw

PATCH v6 1/1 ARM: mtd: nand: davinci: add OF support for davinci nand controller

Hello.

Quoted 33 lines · Heiko Schocher
Quoted 32 lines
Quoted 12 lines

add OF support for the davinci nand controller.

Cc davinci-linux-open-source at linux.davincidsp.com
Cc linux-arm-kernel at lists.infradead.org
Cc devicetree-discuss at lists.ozlabs.org
Cc linux-mtd at lists.infradead.org
Cc David Woodhouse<[email protected]>
Cc Grant Likely<[email protected]>
Cc Sekhar Nori<[email protected]>
Cc Wolfgang Denk<[email protected]>
Cc Scott Wood<[email protected]>

[...]

Quoted 4 lines
drivers/mtd/nand/davinci_nand.c +0 -0
index d94b03c..f386b3c 100644

[...]

drivers/mtd/nand/davinci_nand.c static struct nand_ecclayout hwecc4_2048 __initconst = { · line 526

Quoted 9 lines
drivers/mtd/nand/davinci_nand.c +5 -0
@@ -518,9 +519,75 @@ static struct nand_ecclayout hwecc4_2048 __initconst = {
      },
  };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id davinci_nand_of_match[] = {
+    {.compatible = "ti,davinci-nand", },
+    {},
+}

I have only one question: have you ever try to compile this patch with
CONFIG_OF enabled? If you have, you would have noticed:

Quoted 7 lines
Quoted 3 lines

drivers/mtd/nand/davinci_nand.c:527: error: expected ?,? or ?;? before ?extern?

Quoted 1 line
drivers/mtd/nand/davinci_nand.c +1 -0
+MODULE_DEVICE_TABLE(of, davinci_nand_of_match);

Hmm.. maybe this crept in later after I sent the patches? They were pending for a while ... I compiled it just yet again (based on my tree when I posted this patch based on commit:

I've just checked the archives: every patch version you posted had ';'
after '}' missing.

WBR, Sergei

#7 lore raw

PATCH v6 1/1 ARM: mtd: nand: davinci: add OF support for davinci nand controller

Quoted 11 lines · Sergei Shtylyov
Quoted 10 lines
Quoted 6 lines

drivers/mtd/nand/davinci_nand.c static struct nand_ecclayout hwecc4_2048 __initconst = { · line 527

Quoted 6 lines
drivers/mtd/nand/davinci_nand.c +6 -0
+#if defined(CONFIG_OF)
+static const struct of_device_id davinci_nand_of_match[] = {
+    {.compatible = "ti,davinci-nand", },
+    {},
+}
+MODULE_DEVICE_TABLE(of, davinci_nand_of_match);

Hmm.. maybe this crept in later after I sent the patches? They were pending for a while ... I compiled it just yet again (based on my tree when I posted this patch based on commit:

Quoted 2 lines

I've just checked the archives: every patch version you posted had ';'
after '}' missing.

If it was built-in, rather than as a module, then MODULE_DEVICE_TABLE(?) expands to nothing, and the structure gets to use the semicolon from the end of that line.

Signature · 12 lines
David Woodhouse                            Open Source Technology Centre
David.Woodhouse at intel.com                              Intel Corporation



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6171 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130103/589e7477/attachment-0001.bin>
#8 lore raw

PATCH v6 1/1 ARM: mtd: nand: davinci: add OF support for davinci nand controller

Hello.

Quoted 11 lines · David Woodhouse
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines

drivers/mtd/nand/davinci_nand.c static struct nand_ecclayout hwecc4_2048 __initconst = { · line 527

Quoted 6 lines
drivers/mtd/nand/davinci_nand.c +6 -0
+#if defined(CONFIG_OF)
+static const struct of_device_id davinci_nand_of_match[] = {
+    {.compatible = "ti,davinci-nand", },
+    {},
+}
+MODULE_DEVICE_TABLE(of, davinci_nand_of_match);

Hmm.. maybe this crept in later after I sent the patches? They were pending for a while ... I compiled it just yet again (based on my tree when I posted this patch based on commit:

Quoted 6 lines
Quoted 2 lines

I've just checked the archives: every patch version you posted had ';'
after '}' missing.

If it was built-in, rather than as a module, then MODULE_DEVICE_TABLE(?) expands to nothing, and the structure gets to use the semicolon from the end of that line.

Ah, that explains it: 'davinci_all_defconfig' has
CONFIG_MTD_NAND_DAVINCI=m, so that's how the error got triggered at last. Probably worth adding this explanation to the changelog, how do you think?

WBR, Sergei

#9 lore raw

PATCH v6 1/1 ARM: mtd: nand: davinci: add OF support for davinci nand controller

Hello.

Quoted 14 lines · Sergei Shtylyov
Quoted 13 lines
Quoted 13 lines
Quoted 10 lines
Quoted 6 lines

drivers/mtd/nand/davinci_nand.c static struct nand_ecclayout hwecc4_2048 __initconst = { · line 527

Quoted 6 lines
drivers/mtd/nand/davinci_nand.c +6 -0
+#if defined(CONFIG_OF)
+static const struct of_device_id davinci_nand_of_match[] = {
+    {.compatible = "ti,davinci-nand", },
+    {},
+}
+MODULE_DEVICE_TABLE(of, davinci_nand_of_match);

Hmm.. maybe this crept in later after I sent the patches? They were pending for a while ... I compiled it just yet again (based on my tree when I posted this patch based on commit:

I've just checked the archives: every patch version you posted had ';'
after '}' missing.

Quoted 7 lines
Quoted 3 lines

If it was built-in, rather than as a module, then MODULE_DEVICE_TABLE(…) expands to nothing, and the structure gets to use the semicolon from the end of that line.

Ah, that explains it: 'davinci_all_defconfig' has CONFIG_MTD_NAND_DAVINCI=m,
so that's how the error got triggered at last. Probably worth adding this explanation to the changelog, how do you think?

OK, I take your silence as a sign of consent. Changelog indeed needs to be
rewritten a bit now.

WBR, Sergei