ARM DaVinci: Adding CONFIG options for NAND ALE and CLE
Subsystems (2)
PATCH 1/1 ARM DaVinci: Adding CONFIG options for NAND ALE and CLE
The CLE and ALE for DaVinci DM644x is not the same as DM646x. This patch adds 2 CONFIG_ options to the config.h header files to all the DM6446 based boards. These values are then used by the driver. This has been tested on the DM644x, DM355, DM357 and DM365. Support for the latter 3 will be added soon.
--- drivers/mtd/nand/davinci_nand.c | 6 +++--- include/asm-arm/arch-davinci/nand_defs.h | 9 ++++----- include/configs/davinci_dvevm.h | 2 ++ include/configs/davinci_schmoogie.h | 2 ++ include/configs/davinci_sffsdr.h | 2 ++ include/configs/davinci_sonata.h | 2 ++ 6 files changed, 15 insertions(+), 8 deletions(-)
drivers/mtd/nand/davinci_nand.c +3 -3
@@ -54,13 +54,13 @@ static void nand_davinci_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int cstruct nand_chip *this = mtd->priv;u_int32_t IO_ADDR_W = (u_int32_t )this->IO_ADDR_W; -IO_ADDR_W &= ~(MASK_ALE |MASK_CLE ); +IO_ADDR_W &= ~(CONFIG_MASK_ALE |CONFIG_MASK_CLE );if (ctrl &NAND_CTRL_CHANGE ) {if ( ctrl &NAND_CLE ) -IO_ADDR_W |=MASK_CLE ; +IO_ADDR_W |=CONFIG_MASK_CLE ;if ( ctrl &NAND_ALE ) -IO_ADDR_W |=MASK_ALE ; +IO_ADDR_W |=CONFIG_MASK_ALE ; this->IO_ADDR_W = (void __iomem *)IO_ADDR_W ; }
include/asm-arm/arch-davinci/nand_defs.h +4 -5
@@ -28,11 +28,10 @@#include <asm/arch/hardware.h> -#define MASK_CLE 0x10 -#define MASK_ALE 0x0a - -#define NAND_CE0CLE ((volatile u_int8_t *)(CONFIG_SYS_NAND_BASE + 0x10)) -#define NAND_CE0ALE ((volatile u_int8_t *)(CONFIG_SYS_NAND_BASE + 0x0a)) +#define NAND_CE0CLE ((volatile u_int8_t *)(CONFIG_SYS_NAND_BASE + \ + CONFIG_MASK_CLE)) +#define NAND_CE0ALE ((volatile u_int8_t *)(CONFIG_SYS_NAND_BASE + \ + CONFIG_MASK_ALE))#define NAND_CE0DATA ((volatile u_int8_t *)CONFIG_SYS_NAND_BASE) typedef struct {
include/configs/davinci_dvevm.h +2 -0
@@ -128,6 +128,8 @@#define CONFIG_SYS_NAND_BASE 0x02000000#define CONFIG_SYS_NAND_HW_ECC #define CONFIG_SYS_MAX_NAND_DEVICE 1/* Max number of NAND devices */ +#define CONFIG_MASK_CLE 0x10 +#define CONFIG_MASK_ALE 0x0a#define CONFIG_ENV_OFFSET 0x0/* Block 0--not used by bootcode */ #define DEF_BOOTM ""#elif defined(CONFIG_SYS_USE_NOR )
include/configs/davinci_schmoogie.h +2 -0
@@ -90,6 +90,8 @@#define CONFIG_SYS_NAND_BASE 0x02000000#define CONFIG_SYS_NAND_HW_ECC #define CONFIG_SYS_MAX_NAND_DEVICE 1/* Max number of NAND devices */ +#define CONFIG_MASK_CLE 0x10 +#define CONFIG_MASK_ALE 0x0a#define CONFIG_ENV_OFFSET 0x0/* Block 0--not used by bootcode */ /*=====================*/ /* Board related stuff */
include/configs/davinci_sffsdr.h +2 -0
@@ -86,6 +86,8 @@#define CONFIG_SYS_NAND_BASE 0x02000000#define CONFIG_SYS_NAND_HW_ECC #define CONFIG_SYS_MAX_NAND_DEVICE 1/* Max number of NAND devices */ +#define CONFIG_MASK_CLE 0x10 +#define CONFIG_MASK_ALE 0x0a#define CONFIG_ENV_OFFSET 0x0/* Block 0--not used by bootcode */ /* I2C switch definitions for PCA9543 chip */ #define CONFIG_SYS_I2C_PCA9543_ADDR 0x70
include/configs/davinci_sonata.h +2 -0
@@ -123,6 +123,8 @@#define CONFIG_SYS_NAND_BASE 0x02000000#define CONFIG_SYS_NAND_HW_ECC #define CONFIG_SYS_MAX_NAND_DEVICE 1/* Max number of NAND devices */ +#define CONFIG_MASK_CLE 0x10 +#define CONFIG_MASK_ALE 0x0a#define CONFIG_ENV_OFFSET 0x0/* Block 0--not used by bootcode */ #define DEF_BOOTM ""#elif defined(CONFIG_SYS_USE_NOR )
Signature · 1 line
1.6.0.4
PATCH 1/1 ARM DaVinci: Adding CONFIG options for NAND ALE and CLE
Quoted 23 lines · s-paulraj at ti.com
The CLE and ALE for DaVinci DM644x is not the same as DM646x. This patch adds 2
CONFIG_options to theconfig.hheader files to all the DM6446 based boards. These values are then used by the driver. This has been tested on the DM644x, DM355, DM357 and DM365. Support for the latter 3 will be added soon.Signed-off-by Sandeep Paulraj <[email protected]>--- drivers/mtd/nand/davinci_nand.c | 6 +++--- include/asm-arm/arch-davinci/nand_defs.h | 9 ++++----- include/configs/davinci_dvevm.h | 2 ++ include/configs/davinci_schmoogie.h | 2 ++ include/configs/davinci_sffsdr.h | 2 ++ include/configs/davinci_sonata.h | 2 ++ 6 files changed, 15 insertions(+), 8 deletions(-)drivers/mtd/nand/davinci_nand.c +0
-0@@ -54,13 +54,13 @@ static void nand_davinci_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int cstruct nand_chip *this = mtd->priv;u_int32_t IO_ADDR_W = (u_int32_t )this->IO_ADDR_W;
drivers/mtd/nand/davinci_nand.c static void nand_davinci_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int c · line 63
Quoted 10 lines
drivers/mtd/nand/davinci_nand.c +3
-3-IO_ADDR_W &= ~(MASK_ALE |MASK_CLE ); +IO_ADDR_W &= ~(CONFIG_MASK_ALE |CONFIG_MASK_CLE );if (ctrl &NAND_CTRL_CHANGE ) {if ( ctrl &NAND_CLE ) -IO_ADDR_W |=MASK_CLE ; +IO_ADDR_W |=CONFIG_MASK_CLE ;if ( ctrl &NAND_ALE ) -IO_ADDR_W |=MASK_ALE ; +IO_ADDR_W |=CONFIG_MASK_ALE ;
When I modified this code in the MV kernel, I remember having to use += and -= instead of |= and &=. The reason is tha DM6467 CLE/ALE mask has large enough that the bits overlaps IO_ADDR_W.
Paulraj
PATCH 1/1 ARM DaVinci: Adding CONFIG options for NAND ALE and CLE
Steve,
My intention was to change that when I add the DM6467 Support which I am working on even as we speak.
I am aware of it.
Thanks,
Sandeep
Quoted 54 lines
-----Original Message-----
From: Steve Chen [mailto:schen at mvista.com]
Sent: Tuesday, April 28, 2009 4:54 PM
To: Paulraj, Sandeep
Cc: u-boot at lists.denx.de; davinci-linux-open-source at linux.davincidsp.com
Subject: Re: [PATCH] ARM DaVinci: Adding CONFIG options for NAND ALE and CLEQuoted 2 lines · s-paulraj at ti.com
The CLE and ALE for DaVinci DM644x is not the same as DM646x. This patch adds 2
CONFIG_options to theconfig.hheader files to all the DM6446based
Quoted 1 line
boards. These values are then used by the driver. This has been tested
on the
Quoted 1 line
DM644x, DM355, DM357 and DM365. Support for the latter 3 will be added
soon.
Quoted 11 lines
Signed-off-by Sandeep Paulraj <[email protected]>--- drivers/mtd/nand/davinci_nand.c | 6 +++--- include/asm-arm/arch-davinci/nand_defs.h | 9 ++++----- include/configs/davinci_dvevm.h | 2 ++ include/configs/davinci_schmoogie.h | 2 ++ include/configs/davinci_sffsdr.h | 2 ++ include/configs/davinci_sonata.h | 2 ++ 6 files changed, 15 insertions(+), 8 deletions(-)Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/mtd/nand/davinci_nand.cdrivers/mtd/nand/davinci_nand.c static void nand_davinci_hwcontrol(struct mtd_info
Quoted 4 lines
index a974667..dcc0f39 100644
drivers/mtd/nand/davinci_nand.c +0
-0@@ -54,13 +54,13 @@ static void nand_davinci_hwcontrol(struct mtd_info*mtd, int cmd, unsigned int c
drivers/mtd/nand/davinci_nand.c static void nand_davinci_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int c · line 63
Quoted 13 lines
drivers/mtd/nand/davinci_nand.c +3
-3struct nand_chip *this = mtd->priv;u_int32_t IO_ADDR_W = (u_int32_t )this->IO_ADDR_W; -IO_ADDR_W &= ~(MASK_ALE |MASK_CLE ); +IO_ADDR_W &= ~(CONFIG_MASK_ALE |CONFIG_MASK_CLE );if (ctrl &NAND_CTRL_CHANGE ) {if ( ctrl &NAND_CLE ) -IO_ADDR_W |=MASK_CLE ; +IO_ADDR_W |=CONFIG_MASK_CLE ;if ( ctrl &NAND_ALE ) -IO_ADDR_W |=MASK_ALE ; +IO_ADDR_W |=CONFIG_MASK_ALE ;When I modified this code in the MV kernel, I remember having to use += and -= instead of |= and &=. The reason is tha DM6467 CLE/ALE mask has large enough that the bits overlaps
IO_ADDR_W.
PATCH 1/1 ARM DaVinci: Adding CONFIG options for NAND ALE and CLE
In reply to s-paulraj at ti.cominclude/configs/davinci_dvevm.h line 132
Quoted 10 lines · s-paulraj at ti.com
include/configs/davinci_dvevm.h +2
-0@@ -128,6 +128,8 @@#define CONFIG_SYS_NAND_BASE 0x02000000#define CONFIG_SYS_NAND_HW_ECC #define CONFIG_SYS_MAX_NAND_DEVICE 1/* Max number of NAND devices */ +#define CONFIG_MASK_CLE 0x10 +#define CONFIG_MASK_ALE 0x0a
Make it CONFIG_SYS_DAVINCI_NAND_CLE/ALE.
Also, no tab after #define.
-Scott
Paulraj
PATCH 1/1 ARM DaVinci: Adding CONFIG options for NAND ALE and CLE
Scott,
I will resubmit after i take care of your comments.
Thanks,
Sandeep
________________________________________
From: Scott Wood [scottwood at freescale.com]
Sent: Tuesday, April 28, 2009 5:22 PM
To: Paulraj, Sandeep
Cc: u-boot at lists.denx.de; davinci-linux-open-source at linux.davincidsp.com
Subject: Re: [U-Boot] [PATCH] ARM DaVinci: Adding CONFIG options for NAND ALE and CLE
include/configs/davinci_dvevm.h line 132
Quoted 10 lines · s-paulraj at ti.com
include/configs/davinci_dvevm.h +2
-0@@ -128,6 +128,8 @@#define CONFIG_SYS_NAND_BASE 0x02000000#define CONFIG_SYS_NAND_HW_ECC #define CONFIG_SYS_MAX_NAND_DEVICE 1/* Max number of NAND devices */ +#define CONFIG_MASK_CLE 0x10 +#define CONFIG_MASK_ALE 0x0a
Make it CONFIG_SYS_DAVINCI_NAND_CLE/ALE.
Also, no tab after #define.
-Scott
PATCH 1/1 ARM DaVinci: Adding CONFIG options for NAND ALE and CLE
In reply to s-paulraj at ti.comQuoted 3 lines · s-paulraj at ti.com
The CLE and ALE for DaVinci DM644x is not the same as DM646x. This patch adds 2
CONFIG_options to theconfig.hheader files to all the DM6446 based boards. These values are then used by the driver.
I had been thinking that the davinci_nand driver should probably change to let board_nand_init() really become a board-specific function...
It would call a driver routine to init the callback functions and set up private data so that for example the 2GByte NAND could be properly treated as a single device with two chips, instead of two separate devices. (As Linux does; I'm just assuming that mechanism works right in U-Boot.)
Other private data could include CLE/ALE masks, if needed. I may well have missed something, but I thought that the ROM on all chips used the same mask values when booting from NAND flash... but that non-boot chips might end up using different values, if they wanted. (Burst memory access would work better if toggling low address bits didn't affect ALE/CLE, etc.)
Alternatively ... how about just letting those values be defined in the headers if the boot-from-NAND defaults shouldn't be used?
That is, the u-boot davinci_nand.c code could
#ifndef CONFIG_SYS_DAVINCI_NAND_CLE ... #define it to the default 0x10 ... #endif
I think the convention for these things (toplevel README) is that since they're hardware-specific, CONFIG_SYS_* is the prefix not CONFIG_* for those symbols.
Related: MASK_ALE should not be 0x0a by default, but 0x08; right? That's what newer docs say; I think the old stuff was just a bug. In Linux, 0x08 works just fine.
And for that matter, include/asm-arm/arch-davinci/nand_defs.h is starting to look almost un-necessary after those cleanup patches I sent. :)
Quoted 3 lines
This has been tested on the
DM644x, DM355, DM357 and DM365. Support for the latter 3 will be added soon.
I'm glad to see TI's latest U-Boot work becoming public...
However, this won't apply on top of the cleanup patches I just sent, which remove the NAND_CE0{ALE,CLE,DATA} symbols in favor of the relevant nand_chip pointer. As you know, that change is important for support of the EVM boards which include the socketed 2 GByte NAND chips, with multiple chip select lines.
- Dave
Paulraj
PATCH 1/1 ARM DaVinci: Adding CONFIG options for NAND ALE and CLE
Dave,
Please see inline.
Quoted 18 lines
-----Original Message-----
From: David Brownell [mailto:david-b at pacbell.net]
Sent: Tuesday, April 28, 2009 5:51 PM
To: Paulraj, Sandeep; u-boot at lists.denx.de
Cc: davinci-linux-open-source at linux.davincidsp.com
Subject: Re: [PATCH] ARM DaVinci: Adding CONFIG options for NAND ALE and CLEQuoted 2 lines · s-paulraj at ti.com
The CLE and ALE for DaVinci DM644x is not the same as DM646x. This patch adds 2
CONFIG_options to theconfig.hheader files to all the DM6446based
Quoted 1 line
boards. These values are then used by the driver.
I had been thinking that the
davinci_nanddriver should probably change to letboard_nand_init()really become a board-specific function...
Quoted 5 lines
It would call a driver routine to init the callback functions and set up private data so that for example the 2GByte NAND could be properly treated as a single device with two chips, instead of two separate devices. (As Linux does; I'm just assuming that mechanism works right in U-Boot.)
[Sandeep] At the U-Boot level do we really need this mechanism?
Quoted 2 lines
Other private data could include CLE/ALE masks, if needed.
[Sandeep] This is the way we do it in the kernel. Again does U-boot really need this much sophistication.
Quoted 12 lines
I may well have missed something, but I thought that the ROM on all chips used the same mask values when booting from NAND flash... but that non-boot chips might end up using different values, if they wanted. (Burst memory access would work better if toggling low address bits didn't affect ALE/CLE, etc.)
Alternatively ... how about just letting those values be defined in the headers if the boot-from-NAND defaults shouldn't be used?
Quoted 5 lines
That is, the u-boot
davinci_nand.ccode could#ifndef CONFIG_SYS_DAVINCI_NAND_CLE ... #define it to the default 0x10 ... #endif
[Sandeep] It is my personal opinion that we should try to avoid such #ifdefs in the driver. I would just define all these in the config.h file. Let me know your opinion. We will need such a #ifndef for the CLE as well so I would just put both the values in the config.h rather than have 2 #ifndefs in the NAND driver
Quoted 4 lines
I think the convention for these things (toplevel README) is that since they're hardware-specific, CONFIG_SYS_* is the prefix not CONFIG_* for those symbols.
[Sandeep] will do
Quoted 4 lines
Related:
MASK_ALEshould not be0x0aby default, but0x08; right?
[Sandeep] That is what I use in the internal LSP releases
That's what newer docs say; I think the old stuff
Quoted 1 line
was just a bug. In Linux,
0x08works just fine.
[Sandeep] Yes that is correct. I was going to send an e-mail tomorrow to see if anyone had any objections to me changing this value
Quoted 4 lines
And for that matter,
include/asm-arm/arch-davinci/nand_defs.his starting to look almost un-necessary after those cleanup patches I sent. :)
[Sandeep] yes I noticed that.
Quoted 5 lines
Quoted 5 lines
This has been tested on the
DM644x, DM355, DM357 and DM365. Support for the latter 3 will be added soon.
[Sandeep] Its ready, it just a matter of getting the patches to apply over other patches in a form acceptable to everybody.
Quoted 2 lines
I'm glad to see TI's latest U-Boot work becoming public...
[Sandeep] I don't know why version 1.3.4 has not become public yet but it will be soon.
Quoted 6 lines
However, this won't apply on top of the cleanup patches I just sent, which remove the NAND_CE0{ALE,CLE,DATA} symbols in favor of the relevant
nand_chippointer. As you know, that change is important for support of the EVM boards which include the socketed 2 GByte NAND chips, with multiple chip select lines.
[Sandeep] yes and I will send an updated patch tomorrow.
Quoted 3 lines
- Dave
PATCH 1/1 ARM DaVinci: Adding CONFIG options for NAND ALE and CLE
Hi Sandeep,
Quoted 5 lines · Sandeep
Quoted 5 lines
I had been thinking that the
davinci_nanddriver should probably change to letboard_nand_init()really become a board-specific function...
Quoted 7 lines
Quoted 5 lines
It would call a driver routine to init the callback functions and set up private data so that for example the 2GByte NAND could be properly treated as a single device with two chips, instead of two separate devices. (As Linux does; I'm just assuming that mechanism works right in U-Boot.)
[Sandeep] At the U-Boot level do we really need this mechanism?
I think it will improve Linux interop.
For example, the MTDPART support in U-Boot provides a string that can be passed on the kernel command line to ensure that U-Boot and Linux use the same partitioning.
But ... that won't work very well if Linux sees one big device, while U-Boot sees two smaller ones. That "mtdpart=..." command line string won't work for Linux.
Quoted 4 lines
Quoted 1 line
Other private data could include CLE/ALE masks, if needed.
[Sandeep] This is the way we do it in the kernel. Again does U-boot really need this much sophistication.
Erm, the 2.6.30 code (and davinci-git) passes the masks in through platform_data; they're not fixed at compile time.
Quoted 9 lines
Quoted 5 lines
That is, the u-boot
davinci_nand.ccode could#ifndef CONFIG_SYS_DAVINCI_NAND_CLE ... #define it to the default 0x10 ... #endif[Sandeep] It is my personal opinion that we should try to avoid such #ifdefs in the driver. I would just define all these in the
config.hfile. Let me know your opinion.
The place to *really* avoid #ifdefs is inside C functions. I could agree that putting such defaults into the DaVinci "nand.h" header might be prettier.
But I'd like to keep the config.h files free of such stuff. Especially, free of stuff that doesn't change from board to board (except in unusual cases).
Quoted 3 lines
We will need such a #ifndef for the CLE as well so I would just put both the values in the
config.hrather than have 2 #ifndefs in the NAND driver
Well, "nand.h" would be better. Especially considering that board using a non-default values are uncommon.
Quoted 10 lines
Quoted 2 lines
Related:
MASK_ALEshould not be0x0aby default, but0x08; right?[Sandeep] That is what I use in the internal LSP releases
Quoted 2 lines
That's what newer docs say; I think the old stuff
was just a bug. In Linux,0x08works just fine.[Sandeep] Yes that is correct. I was going to send an e-mail tomorrow to see if anyone had any objections to me changing this value
Nah ... just fixit. ;)
- Dave