Patchwork [U-Boot] How to Change the DDR3 Speed to low in U-boot

login
register
mail settings
Submitter Balaji Sivakumar, ERS, HCLTech
Date Feb. 27, 2012, 1:26 p.m.
Message ID <A41DC312BCC9DA4E8B8B954805B8C9FDF7D170FDC0@CHN-HCLT-EVS06.HCLT.CORP.HCL.IN>
Download mbox | patch
Permalink /patch/143234/
State Not Applicable
Headers show

Comments

Balaji Sivakumar, ERS, HCLTech - Feb. 27, 2012, 1:26 p.m.
Hi,

I have verified the lowlwevel_init.s file but there are not initializing DDR3. They do only following instructions,

"Invalidate_dcache

Init L2 cache

Init AIPS

Init Clock"


And in the "mx6q_saberlite.C" board file they are just doing "dram_init" , this function does only banks and its size.

I want to control the speed of the DDR3 Bus , Can anyone guide me?

Thanks,
Balaji S

-----Original Message-----
From: Balaji Sivakumar, ERS, HCLTech
Sent: Monday, February 27, 2012 4:40 PM
To: 'u-boot-owner@lists.denx.de'
Subject: How to Change the DDR3 Speed to low in U-boot

Hi,

Am working on Freescale's IMX6 based Custom Board. I have done some changes according to my board specific design.

But I want currently to set the DDR3 speed to low, I have gone through the lowlevel_init.s file but am not sure which register to change.

Can you please guide me at which place I have to change?

Thanks
Balaji S

-----Original Message-----
From: u-boot-bounces@lists.denx.de [mailto:u-boot-bounces@lists.denx.de] On Behalf Of u-boot-request@lists.denx.de
Sent: Monday, February 27, 2012 4:30 PM
To: u-boot@lists.denx.de
Subject: U-Boot Digest, Vol 45, Issue 34

Send U-Boot mailing list submissions to
        u-boot@lists.denx.de

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.denx.de/mailman/listinfo/u-boot
or, via email, send a message with subject or body 'help' to
        u-boot-request@lists.denx.de

You can reach the person managing the list at
        u-boot-owner@lists.denx.de

When replying, please edit your Subject line so it is more specific
than "Re: Contents of U-Boot digest..."


Today's Topics:

   1. [PATCH 2/3] SPEAr: Configure FSMC driver for NAND interface
      (Amit Virdi)
   2. [PATCH 3/3] mtd/NAND: Remove obsolete SPEAr specific NAND
      drivers (Amit Virdi)
   3. Re: [PATCH 2/3] SPEAr: Configure FSMC driver for NAND
      interface (Stefan Roese)
   4. Re: [PATCH] USB:host: Attribute packed removed from usb
      structures (Amit Virdi)
   5. Re: [PATCH 2/3] SPEAr: Configure FSMC driver for NAND
      interface (Amit Virdi)
   6. Re: [PATCH v4 07/13] davinci: Use correct #ifdef around
      gdata/bdata (Sughosh Ganu)
   7. Re: [PATCH 03/11] st_smi: Return error in case TFF is not set
      (Stefan Roese)
   8. Re: [PATCH v4 07/13] davinci: Use correct #ifdef around
      gdata/bdata (Christian Riesch)
   9. Re: [PATCH v4 07/13] davinci: Use correct #ifdef around
      gdata/bdata (Sughosh Ganu)


----------------------------------------------------------------------

Message: 1
Date: Mon, 27 Feb 2012 15:08:23 +0530
From: Amit Virdi <amit.virdi@st.com>
Subject: [U-Boot] [PATCH 2/3] SPEAr: Configure FSMC driver for NAND
        interface
To: <u-boot@lists.denx.de>
Cc: armando.visconti@st.com, shiraz.hashim@st.com,      Amit Virdi
        <amit.virdi@st.com>, scottwood@freescale.com, sr@denx.de
Message-ID: <1330335504-32226-3-git-send-email-amit.virdi@st.com>
Content-Type: text/plain

From: Vipin KUMAR <vipin.kumar@st.com>

Since FSMC is a standard IP and it supports different memory interfaces, it
is supported independent of spear platform and spear is configured to use that
driver for interfacing with the NAND device

Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
---
 arch/arm/include/asm/arch-spear/hardware.h |    8 ++++----
 board/spear/spear300/spear300.c            |    7 ++++---
 board/spear/spear310/spear310.c            |    7 ++++---
 board/spear/spear320/spear320.c            |    7 ++++---
 board/spear/spear600/spear600.c            |    7 ++++---
 include/configs/spear-common.h             |    2 +-
 include/configs/spear3xx.h                 |    4 ++++
 include/configs/spear6xx.h                 |    3 +++
 8 files changed, 28 insertions(+), 17 deletions(-)

--
1.7.2.2



------------------------------

Message: 3
Date: Mon, 27 Feb 2012 11:02:18 +0100
From: Stefan Roese <sr@denx.de>
Subject: Re: [U-Boot] [PATCH 2/3] SPEAr: Configure FSMC driver for
        NAND    interface
To: u-boot@lists.denx.de
Cc: armando.visconti@st.com, shiraz.hashim@st.com,      Amit Virdi
        <amit.virdi@st.com>, scottwood@freescale.com
Message-ID: <201202271102.18797.sr@denx.de>
Content-Type: Text/Plain;  charset="iso-8859-1"

Hi Amit,

please find a few comments below.

On Monday 27 February 2012 10:38:23 Amit Virdi wrote:
> From: Vipin KUMAR <vipin.kumar@st.com>
>
> Since FSMC is a standard IP and it supports different memory interfaces, it
> is supported independent of spear platform and spear is configured to use
> that driver for interfacing with the NAND device
>
> Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
> Signed-off-by: Amit Virdi <amit.virdi@st.com>
> ---
>  arch/arm/include/asm/arch-spear/hardware.h |    8 ++++----
>  board/spear/spear300/spear300.c            |    7 ++++---
>  board/spear/spear310/spear310.c            |    7 ++++---
>  board/spear/spear320/spear320.c            |    7 ++++---
>  board/spear/spear600/spear600.c            |    7 ++++---
>  include/configs/spear-common.h             |    2 +-
>  include/configs/spear3xx.h                 |    4 ++++
>  include/configs/spear6xx.h                 |    3 +++
>  8 files changed, 28 insertions(+), 17 deletions(-)
>
> diff --git a/arch/arm/include/asm/arch-spear/hardware.h
> b/arch/arm/include/asm/arch-spear/hardware.h index 818f36c..a6517b2 100644
> --- a/arch/arm/include/asm/arch-spear/hardware.h
> +++ b/arch/arm/include/asm/arch-spear/hardware.h
> @@ -37,15 +37,15 @@
>
>  #if defined(CONFIG_SPEAR600)
>  #define CONFIG_SYS_I2C_BASE                  (0xD0200000)
> -#define CONFIG_SPEAR_FSMCBASE                        (0xD1800000)
> +#define CONFIG_SYS_FSMC_BASE                 (0xD1800000)

Please remove the parentheses here as they are not needed. Should be done to
all those defines, perhaps in a cosmetic cleanup patch at some time as well:

+#define CONFIG_SYS_FSMC_BASE                   0xD1800000

>  #elif defined(CONFIG_SPEAR300)
>  #define CONFIG_SYS_I2C_BASE                  (0xD0180000)
> -#define CONFIG_SPEAR_FSMCBASE                        (0x94000000)
> +#define CONFIG_SYS_FSMC_BASE                 (0x94000000)
>
>  #elif defined(CONFIG_SPEAR310)
>  #define CONFIG_SYS_I2C_BASE                  (0xD0180000)
> -#define CONFIG_SPEAR_FSMCBASE                        (0x44000000)
> +#define CONFIG_SYS_FSMC_BASE                 (0x44000000)
>
>  #undef CONFIG_SYS_NAND_CLE
>  #undef CONFIG_SYS_NAND_ALE
> @@ -57,7 +57,7 @@
>
>  #elif defined(CONFIG_SPEAR320)
>  #define CONFIG_SYS_I2C_BASE                  (0xD0180000)
> -#define CONFIG_SPEAR_FSMCBASE                        (0x4C000000)
> +#define CONFIG_SYS_FSMC_BASE                 (0x4C000000)
>
>  #define CONFIG_SPEAR_EMIBASE                 (0x40000000)
>  #define CONFIG_SPEAR_RASBASE                 (0xB3000000)
> diff --git a/board/spear/spear300/spear300.c
> b/board/spear/spear300/spear300.c index 60ee544..32bcb77 100644
> --- a/board/spear/spear300/spear300.c
> +++ b/board/spear/spear300/spear300.c
> @@ -24,10 +24,10 @@
>  #include <common.h>
>  #include <nand.h>
>  #include <asm/io.h>
> +#include <linux/mtd/fsmc_nand.h>
>  #include <asm/arch/hardware.h>
>  #include <asm/arch/spr_defs.h>
>  #include <asm/arch/spr_misc.h>
> -#include <asm/arch/spr_nand.h>
>
>  int board_init(void)
>  {
> @@ -46,13 +46,14 @@ int board_nand_init(struct nand_chip *nand)
>       struct misc_regs *const misc_regs_p =
>           (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
>
> +#if defined(CONFIG_NAND_FSMC)
>       if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
>            MISC_SOCCFG30) ||
>           ((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
>            MISC_SOCCFG31)) {
>
> -             return spear_nand_init(nand);
> +             return fsmc_nand_init(nand);
>       }
> -
> +#endif
>       return -1;
>  }
> diff --git a/board/spear/spear310/spear310.c
> b/board/spear/spear310/spear310.c index 03dfe16..8b58218 100644
> --- a/board/spear/spear310/spear310.c
> +++ b/board/spear/spear310/spear310.c
> @@ -25,10 +25,10 @@
>  #include <common.h>
>  #include <nand.h>
>  #include <asm/io.h>
> +#include <linux/mtd/fsmc_nand.h>
>  #include <asm/arch/hardware.h>
>  #include <asm/arch/spr_defs.h>
>  #include <asm/arch/spr_misc.h>
> -#include <asm/arch/spr_nand.h>
>
>  int board_init(void)
>  {
> @@ -47,13 +47,14 @@ int board_nand_init(struct nand_chip *nand)
>       struct misc_regs *const misc_regs_p =
>           (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
>
> +#if defined(CONFIG_NAND_FSMC)
>       if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
>            MISC_SOCCFG30) ||
>           ((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
>            MISC_SOCCFG31)) {
>
> -             return spear_nand_init(nand);
> +             return fsmc_nand_init(nand);
>       }
> -
> +#endif
>       return -1;
>  }
> diff --git a/board/spear/spear320/spear320.c
> b/board/spear/spear320/spear320.c index 2ba2dbb..172ad35 100644
> --- a/board/spear/spear320/spear320.c
> +++ b/board/spear/spear320/spear320.c
> @@ -25,10 +25,10 @@
>  #include <common.h>
>  #include <nand.h>
>  #include <asm/io.h>
> +#include <linux/mtd/fsmc_nand.h>
>  #include <asm/arch/hardware.h>
>  #include <asm/arch/spr_defs.h>
>  #include <asm/arch/spr_misc.h>
> -#include <asm/arch/spr_nand.h>
>
>  int board_init(void)
>  {
> @@ -47,13 +47,14 @@ int board_nand_init(struct nand_chip *nand)
>       struct misc_regs *const misc_regs_p =
>           (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
>
> +#if defined(CONFIG_NAND_FSMC)
>       if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
>            MISC_SOCCFG30) ||
>           ((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
>            MISC_SOCCFG31)) {
>
> -             return spear_nand_init(nand);
> +             return fsmc_nand_init(nand);
>       }
> -
> +#endif
>       return -1;
>  }
> diff --git a/board/spear/spear600/spear600.c
> b/board/spear/spear600/spear600.c index eef9a37..7cf63d6 100644
> --- a/board/spear/spear600/spear600.c
> +++ b/board/spear/spear600/spear600.c
> @@ -24,10 +24,10 @@
>  #include <common.h>
>  #include <nand.h>
>  #include <asm/io.h>
> +#include <linux/mtd/fsmc_nand.h>
>  #include <asm/arch/hardware.h>
>  #include <asm/arch/spr_defs.h>
>  #include <asm/arch/spr_misc.h>
> -#include <asm/arch/spr_nand.h>
>
>  int board_init(void)
>  {
> @@ -46,8 +46,9 @@ int board_nand_init(struct nand_chip *nand)
>       struct misc_regs *const misc_regs_p =
>           (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
>
> +#if defined(CONFIG_NAND_FSMC)
>       if (!(readl(&misc_regs_p->auto_cfg_reg) & MISC_NANDDIS))
> -             return spear_nand_init(nand);
> -
> +             return fsmc_nand_init(nand);
> +#endif
>       return -1;
>  }
> diff --git a/include/configs/spear-common.h
> b/include/configs/spear-common.h index 516b78e..c37305f 100644
> --- a/include/configs/spear-common.h
> +++ b/include/configs/spear-common.h
> @@ -90,7 +90,7 @@
>  /* NAND FLASH Configuration */
>  #define CONFIG_MTD_DEVICE
>  #define CONFIG_MTD_PARTITIONS
> -#define CONFIG_NAND_SPEAR                    1
> +#define CONFIG_NAND_FSMC
>  #define CONFIG_SYS_MAX_NAND_DEVICE           1
>  #define CONFIG_MTD_NAND_VERIFY_WRITE

I suggest that you remove this last define. Most likely it was added for
debugging purpose only. It slows down the speed and it brakes UBI support.

> diff --git a/include/configs/spear3xx.h b/include/configs/spear3xx.h
> index bd5d111..5bdd874 100644
> --- a/include/configs/spear3xx.h
> +++ b/include/configs/spear3xx.h
> @@ -117,6 +117,10 @@
>
>  #endif
>
> +/* NAND flash configuration */
> +#define CONFIG_SYS_FSMC_NAND_SP
> +#define CONFIG_SYS_FSMC_NAND_8BIT
> +
>  #if defined(CONFIG_SPEAR300)
>  #define CONFIG_SYS_NAND_BASE                 0x80000000
>
> diff --git a/include/configs/spear6xx.h b/include/configs/spear6xx.h
> index 8de7ebd..1e06c72 100644
> --- a/include/configs/spear6xx.h
> +++ b/include/configs/spear6xx.h
> @@ -38,6 +38,9 @@
>  #define CONFIG_PL01x_PORTS                   { (void
*)CONFIG_SYS_SERIAL0, \
>                                               (void
*)CONFIG_SYS_SERIAL1 }
>
> +/* NAND flash configuration */
> +#define CONFIG_SYS_FSMC_NAND_SP
> +#define CONFIG_SYS_FSMC_NAND_8BIT

You also need the following define for this to work with the latest NAND
subsystem:

#define CONFIG_MTD_ECC_SOFT

Not sure about SPEAr3xx. Most likely this needs it as well.

Thanks,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de


------------------------------

Message: 4
Date: Mon, 27 Feb 2012 15:32:14 +0530
From: Amit Virdi <amit.virdi@st.com>
Subject: Re: [U-Boot] [PATCH] USB:host: Attribute packed removed from
        usb structures
To: Mike Frysinger <vapier@gentoo.org>
Cc: Armando VISCONTI <armando.visconti@st.com>, "u-boot@lists.denx.de"
        <u-boot@lists.denx.de>, "sr@denx.de" <sr@denx.de>, Shiraz HASHIM
        <shiraz.hashim@st.com>
Message-ID: <4F4B54A6.4000907@st.com>
Content-Type: text/plain; charset="ISO-8859-1"; format=flowed

Hello Mike,

On 2/25/2012 12:48 AM, Mike Frysinger wrote:
> On Friday 24 February 2012 06:58:40 Amit Virdi wrote:
>> Packed attribute is forcing a bytewise write on device registers,
>> there by, resulting in a misbehavior on gcc-4.4.1.
>
> so use a compiler that isn't broken ?

It doesn't seem like compiler issue (on ARM).

Thanks
Amit Virdi


------------------------------

Message: 5
Date: Mon, 27 Feb 2012 15:45:11 +0530
From: Amit Virdi <amit.virdi@st.com>
Subject: Re: [U-Boot] [PATCH 2/3] SPEAr: Configure FSMC driver for
        NAND    interface
To: Stefan Roese <sr@denx.de>
Cc: Armando VISCONTI <armando.visconti@st.com>, "u-boot@lists.denx.de"
        <u-boot@lists.denx.de>, "scottwood@freescale.com"
        <scottwood@freescale.com>,      Shiraz HASHIM <shiraz.hashim@st.com>
Message-ID: <4F4B57AF.2050201@st.com>
Content-Type: text/plain; charset="ISO-8859-1"; format=flowed

Hello Stefan,

On 2/27/2012 3:32 PM, Stefan Roese wrote:
> Hi Amit,
>
> please find a few comments below.
>
> On Monday 27 February 2012 10:38:23 Amit Virdi wrote:
>> From: Vipin KUMAR<vipin.kumar@st.com>
>>
>> Since FSMC is a standard IP and it supports different memory interfaces, it
>> is supported independent of spear platform and spear is configured to use
>> that driver for interfacing with the NAND device
>>
>> Signed-off-by: Vipin Kumar<vipin.kumar@st.com>
>> Signed-off-by: Amit Virdi<amit.virdi@st.com>
>> ---
>>   arch/arm/include/asm/arch-spear/hardware.h |    8 ++++----
>>   board/spear/spear300/spear300.c            |    7 ++++---
>>   board/spear/spear310/spear310.c            |    7 ++++---
>>   board/spear/spear320/spear320.c            |    7 ++++---
>>   board/spear/spear600/spear600.c            |    7 ++++---
>>   include/configs/spear-common.h             |    2 +-
>>   include/configs/spear3xx.h                 |    4 ++++
>>   include/configs/spear6xx.h                 |    3 +++
>>   8 files changed, 28 insertions(+), 17 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/arch-spear/hardware.h
>> b/arch/arm/include/asm/arch-spear/hardware.h index 818f36c..a6517b2 100644
>> --- a/arch/arm/include/asm/arch-spear/hardware.h
>> +++ b/arch/arm/include/asm/arch-spear/hardware.h
>> @@ -37,15 +37,15 @@
>>
>>   #if defined(CONFIG_SPEAR600)
>>   #define CONFIG_SYS_I2C_BASE                        (0xD0200000)
>> -#define CONFIG_SPEAR_FSMCBASE                       (0xD1800000)
>> +#define CONFIG_SYS_FSMC_BASE                        (0xD1800000)
>
> Please remove the parentheses here as they are not needed. Should be done to
> all those defines, perhaps in a cosmetic cleanup patch at some time as well:
>

Yes. I'll be sending a separate cleanup commit.

> +#define CONFIG_SYS_FSMC_BASE                 0xD1800000
>
>>   #elif defined(CONFIG_SPEAR300)

<snip>

>> diff --git a/include/configs/spear-common.h
>> b/include/configs/spear-common.h index 516b78e..c37305f 100644
>> --- a/include/configs/spear-common.h
>> +++ b/include/configs/spear-common.h
>> @@ -90,7 +90,7 @@
>>   /* NAND FLASH Configuration */
>>   #define CONFIG_MTD_DEVICE
>>   #define CONFIG_MTD_PARTITIONS
>> -#define CONFIG_NAND_SPEAR                   1
>> +#define CONFIG_NAND_FSMC
>>   #define CONFIG_SYS_MAX_NAND_DEVICE         1
>>   #define CONFIG_MTD_NAND_VERIFY_WRITE
>
> I suggest that you remove this last define. Most likely it was added for
> debugging purpose only. It slows down the speed and it brakes UBI support.
>

Ok.

>> diff --git a/include/configs/spear3xx.h b/include/configs/spear3xx.h
>> index bd5d111..5bdd874 100644
>> --- a/include/configs/spear3xx.h
>> +++ b/include/configs/spear3xx.h
>> @@ -117,6 +117,10 @@
>>
>>   #endif
>>
>> +/* NAND flash configuration */
>> +#define CONFIG_SYS_FSMC_NAND_SP
>> +#define CONFIG_SYS_FSMC_NAND_8BIT
>> +
>>   #if defined(CONFIG_SPEAR300)
>>   #define CONFIG_SYS_NAND_BASE                       0x80000000
>>
>> diff --git a/include/configs/spear6xx.h b/include/configs/spear6xx.h
>> index 8de7ebd..1e06c72 100644
>> --- a/include/configs/spear6xx.h
>> +++ b/include/configs/spear6xx.h
>> @@ -38,6 +38,9 @@
>>   #define CONFIG_PL01x_PORTS                 { (void
> *)CONFIG_SYS_SERIAL0, \
>>                                              (void
> *)CONFIG_SYS_SERIAL1 }
>>
>> +/* NAND flash configuration */
>> +#define CONFIG_SYS_FSMC_NAND_SP
>> +#define CONFIG_SYS_FSMC_NAND_8BIT
>
> You also need the following define for this to work with the latest NAND
> subsystem:
>
> #define CONFIG_MTD_ECC_SOFT
>
> Not sure about SPEAr3xx. Most likely this needs it as well.
>

Ok. I'll verify the image after the making the changes you suggested and
then get back.

Thanks
Amit Virdi


------------------------------

Message: 6
Date: Mon, 27 Feb 2012 15:46:13 +0530
From: Sughosh Ganu <urwithsughosh@gmail.com>
Subject: Re: [U-Boot] [PATCH v4 07/13] davinci: Use correct #ifdef
        around gdata/bdata
To: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>, U-Boot Mailing List
        <u-boot@lists.denx.de>, hs@denx.de
Message-ID: <20120227101613.GA2183@Hardy>
Content-Type: text/plain; charset="iso-8859-1"

hi Simon,

On Sun Feb 26, 2012 at 09:56:37AM -0800, Simon Glass wrote:
> Hi Sughosh,
>
> On Thu, Feb 23, 2012 at 9:25 AM, Sughosh Ganu <urwithsughosh@gmail.com> wrote:
> > hi Simon,
> >
> > On Mon Feb 20, 2012 at 05:32:49PM -0800, Simon Glass wrote:
> >> This fixes the following warnings in an SPL build when libcommon is
> >> in use:
> >>
> >> spl.c:37: warning: 'gdata' defined but not used
> >> spl.c:38: warning: 'bdata' defined but not used
> >>
> >> Signed-off-by: Simon Glass <sjg@chromium.org>
> >> ---
> >> Changes in v4:
> >> - Add new patch to fix davinci build warnings
> >>
> >> ?arch/arm/cpu/arm926ejs/davinci/spl.c | ? ?2 ++
> >> ?1 files changed, 2 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c
> >> index b1eff26..2861907 100644
> >> --- a/arch/arm/cpu/arm926ejs/davinci/spl.c
> >> +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
> >> @@ -32,10 +32,12 @@
> >>
> >> ?#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
> >>
> >> +#ifdef CONFIG_SPL_SPI_LOAD
> >> ?DECLARE_GLOBAL_DATA_PTR;
> >> ?/* Define global data structure pointer to it*/
> >> ?static gd_t gdata __attribute__ ((section(".data")));
> >> ?static bd_t bdata __attribute__ ((section(".data")));
> >> +#endif
> >
> > ?Can you specify which boards you get this warning for. With your
> > ?patch to add libcommon to hawkboard's spl image, this is now also
> > ?needed for hawkboard which uses CONFIG_SPL_NAND_LOAD.
>
> Perhaps it is any davinci board, with SPI? I don't have any of these -
> I was just fixing what I thought was a minor #ifdef bug in the code.

  I checked the configs for all the davinci boards, and cam_enc_4xx,
  da850* and hawkboard use spl. Out of these the da850* use a spi
  flash, while cam_enc_4xx and hawkboard both use a nand. So we should
  not be using the CONFIG_SPL_SPI_LOAD check to exclude the gdata and
  bdata objects -- these are now needed after adding the libcommon
  support to the hawkboard.

  Also, the cam_enc_4xx board which uses a spl does not have
  CONFIG_SPL_LIBCOMMON_SUPPORT and CONFIG_SPL_LIBGENERIC_SUPPORT
  defined and this patchset does not add these defines for the
  board. Was adding these defines for the board missed out. If so,
  then this patch would no longer be needed.

-sughosh


------------------------------

Message: 7
Date: Mon, 27 Feb 2012 11:26:18 +0100
From: Stefan Roese <sr@denx.de>
Subject: Re: [U-Boot] [PATCH 03/11] st_smi: Return error in case TFF
        is not  set
To: Amit Virdi <amit.virdi@st.com>
Cc: armando.visconti@st.com, u-boot@lists.denx.de,
        shiraz.hashim@st.com
Message-ID: <201202271126.18256.sr@denx.de>
Content-Type: Text/Plain;  charset="iso-8859-15"

On Friday 24 February 2012 13:23:06 Amit Virdi wrote:
> Curently the code makes wrong assumption that the Transfer finished flag
> shall be set within the stipulated time. However, there may occur a
> scenario in which the TFF flag is not set. Return error in that case.
>
> Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
> Signed-off-by: Amit Virdi <amit.virdi@st.com>
> ---
>  drivers/mtd/st_smi.c |   22 ++++++++++++++--------
>  1 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
> index 82f1fe1..ec19b0d 100644
> --- a/drivers/mtd/st_smi.c
> +++ b/drivers/mtd/st_smi.c
> @@ -58,13 +58,15 @@ static struct flash_dev flash_ids[] = {
>   *
>   * Wait until TFF is set in status register
>   */
> -static void smi_wait_xfer_finish(int timeout)
> +static int smi_wait_xfer_finish(int timeout)
>  {
> -     while (timeout--) {
> +     do {
>               if (readl(&smicntl->smi_sr) & TFF)
> -                     break;
> +                     return 0;
>               udelay(1000);
> -     }
> +     } while (timeout--);
> +
> +     return -1;

Somewhat unrelated to the patch topic, but I don't really like this kind of
timeout loops. Since it always adds at least 1ms delay after initial failing
test. Better use something like this:

static int smi_wait_xfer_finish(int timeout)
{
        ulong start = get_timer(0);

        while (get_timer(start) < timeout) {
                if (readl(&smicntl->smi_sr) & TFF)
                        return 0;

                /* Try again after 100usec */
                udelay(100);
        }

        return -1;
}

You could tune this udelay(100) down more or even remove it completely.

But such a change could be done in a addon cleanup patch, changing all timeout
loops this way. I suggest you take a look at my version, here these loops are
changes. In the designware networking driver as well, iirc.

Thanks,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de


------------------------------

Message: 8
Date: Mon, 27 Feb 2012 11:39:42 +0100
From: Christian Riesch <christian.riesch@omicron.at>
Subject: Re: [U-Boot] [PATCH v4 07/13] davinci: Use correct #ifdef
        around  gdata/bdata
To: Sughosh Ganu <urwithsughosh@gmail.com>
Cc: Tom Rini <trini@ti.com>, U-Boot Mailing List
        <u-boot@lists.denx.de>, hs@denx.de
Message-ID:
        <CABkLObrRUcyio2n3gOVf7Q89iXKfiBdemwHXNsJ4PEAjn3gG3A@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Hi,

On Mon, Feb 27, 2012 at 11:16 AM, Sughosh Ganu <urwithsughosh@gmail.com> wrote:
> hi Simon,
>
> On Sun Feb 26, 2012 at 09:56:37AM -0800, Simon Glass wrote:
>> Hi Sughosh,
>>
>> On Thu, Feb 23, 2012 at 9:25 AM, Sughosh Ganu <urwithsughosh@gmail.com> wrote:
>> > hi Simon,
>> >
>> > On Mon Feb 20, 2012 at 05:32:49PM -0800, Simon Glass wrote:
>> >> This fixes the following warnings in an SPL build when libcommon is
>> >> in use:
>> >>
>> >> spl.c:37: warning: 'gdata' defined but not used
>> >> spl.c:38: warning: 'bdata' defined but not used
>> >>
>> >> Signed-off-by: Simon Glass <sjg@chromium.org>
>> >> ---
>> >> Changes in v4:
>> >> - Add new patch to fix davinci build warnings
>> >>
>> >> ?arch/arm/cpu/arm926ejs/davinci/spl.c | ? ?2 ++
>> >> ?1 files changed, 2 insertions(+), 0 deletions(-)
>> >>
>> >> diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c
>> >> index b1eff26..2861907 100644
>> >> --- a/arch/arm/cpu/arm926ejs/davinci/spl.c
>> >> +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
>> >> @@ -32,10 +32,12 @@
>> >>
>> >> ?#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
>> >>
>> >> +#ifdef CONFIG_SPL_SPI_LOAD
>> >> ?DECLARE_GLOBAL_DATA_PTR;
>> >> ?/* Define global data structure pointer to it*/
>> >> ?static gd_t gdata __attribute__ ((section(".data")));
>> >> ?static bd_t bdata __attribute__ ((section(".data")));
>> >> +#endif

In arch/arm/cpu/arm926ejs/davinci/spl.c gdata and bdata are used for
serial_init() to allow output to the console from the SPL. However,
this is only the case when LIBCOMMON is used. LIBCOMMON is required
for booting from SPI, but not for booting from NAND. Up to now davinci
boards that boot from NAND with SPL did not use LIBCOMMON but used the
puts and putc functions defined in spl.c for console output.

>> > ?Can you specify which boards you get this warning for. With your
>> > ?patch to add libcommon to hawkboard's spl image, this is now also
>> > ?needed for hawkboard which uses CONFIG_SPL_NAND_LOAD.

Simon's patch is for the hawkboard, since due to another patch in his
patchset LIBCOMMON is enabled in hawkboard's SPL. Now we have a board
that boots from NAND with SPL and has LIBCOMMON enabled (Simon, I did
not check the rest of your patchset, why do you need LIBCOMMON on the
hawkboard at all?)

However, the patch fixes the warning, but now we use putc and puts
from LIBCOMMON without initializing them. Thus it breaks the console
output of the hawkboard SPL.

So the correct solution would be to keep the ifdefs around the
definition of gdata and bdata as they are, but change board_init_f()
like this:

void board_init_r(gd_t *id, ulong dummy)
{
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
        mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
                        CONFIG_SYS_MALLOC_LEN);

        gd = &gdata;
        gd->bd = &bdata;
        gd->flags |= GD_FLG_RELOC;
        gd->baudrate = CONFIG_BAUDRATE;
        serial_init();          /* serial communications setup */
        gd->have_console = 1;
#endif
#ifdef CONFIG_SPL_NAND_LOAD
        nand_init();
        puts("Nand boot...\n");
        nand_boot();
#endif
#ifdef CONFIG_SPL_SPI_LOAD
        puts("SPI boot...\n");
        spi_boot();
#endif
}

Regards, Christian


------------------------------

Message: 9
Date: Mon, 27 Feb 2012 16:26:28 +0530
From: Sughosh Ganu <urwithsughosh@gmail.com>
Subject: Re: [U-Boot] [PATCH v4 07/13] davinci: Use correct #ifdef
        around gdata/bdata
To: Christian Riesch <christian.riesch@omicron.at>
Cc: Tom Rini <trini@ti.com>, U-Boot, hs@denx.de, List
        <u-boot@lists.denx.de>
Message-ID: <20120227105628.GA2991@Hardy>
Content-Type: text/plain; charset="iso-8859-1"

hi Christian,

On Mon Feb 27, 2012 at 11:39:42AM +0100, Christian Riesch wrote:
> Hi,
>
> On Mon, Feb 27, 2012 at 11:16 AM, Sughosh Ganu <urwithsughosh@gmail.com> wrote:

<snip>

> >> >> ?arch/arm/cpu/arm926ejs/davinci/spl.c | ? ?2 ++
> >> >> ?1 files changed, 2 insertions(+), 0 deletions(-)
> >> >>
> >> >> diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c
> >> >> index b1eff26..2861907 100644
> >> >> --- a/arch/arm/cpu/arm926ejs/davinci/spl.c
> >> >> +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
> >> >> @@ -32,10 +32,12 @@
> >> >>
> >> >> ?#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
> >> >>
> >> >> +#ifdef CONFIG_SPL_SPI_LOAD
> >> >> ?DECLARE_GLOBAL_DATA_PTR;
> >> >> ?/* Define global data structure pointer to it*/
> >> >> ?static gd_t gdata __attribute__ ((section(".data")));
> >> >> ?static bd_t bdata __attribute__ ((section(".data")));
> >> >> +#endif

<snip>

> >> > ?Can you specify which boards you get this warning for. With your
> >> > ?patch to add libcommon to hawkboard's spl image, this is now also
> >> > ?needed for hawkboard which uses CONFIG_SPL_NAND_LOAD.
>
> Simon's patch is for the hawkboard, since due to another patch in his
> patchset LIBCOMMON is enabled in hawkboard's SPL. Now we have a board
> that boots from NAND with SPL and has LIBCOMMON enabled (Simon, I did
> not check the rest of your patchset, why do you need LIBCOMMON on the
> hawkboard at all?)

  LIBCOMMON is now needed as the generic relocation based functions
  are part of the libcommon.o, which are being enabled in the same
  patchset for all arm boards. So if i understand correct, all arm
  board based spl's now need libcommon and libgeneric.

  The only thing i see is that libcommon and libgeneric are not
  defined for cam_enc_4xx board which uses spl, and this patchset does
  not add it either. Not sure whether it got missed.


> However, the patch fixes the warning, but now we use putc and puts
> from LIBCOMMON without initializing them. Thus it breaks the console
> output of the hawkboard SPL.
>
> So the correct solution would be to keep the ifdefs around the
> definition of gdata and bdata as they are, but change board_init_f()
> like this:

  I have a patch for this, which i will send today. There is only one
  question i have though.

>
> void board_init_r(gd_t *id, ulong dummy)
> {
> #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
>         mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
>                         CONFIG_SYS_MALLOC_LEN);

  Can you please explain why we need the mem_malloc_init. I did not
  include this, and spl boots up just fine on my board.

-sughosh


------------------------------

Patch

diff --git a/arch/arm/include/asm/arch-spear/hardware.h b/arch/arm/include/asm/arch-spear/hardware.h
index 818f36c..a6517b2 100644
--- a/arch/arm/include/asm/arch-spear/hardware.h
+++ b/arch/arm/include/asm/arch-spear/hardware.h
@@ -37,15 +37,15 @@ 

 #if defined(CONFIG_SPEAR600)
 #define CONFIG_SYS_I2C_BASE                    (0xD0200000)
-#define CONFIG_SPEAR_FSMCBASE                  (0xD1800000)
+#define CONFIG_SYS_FSMC_BASE                   (0xD1800000)

 #elif defined(CONFIG_SPEAR300)
 #define CONFIG_SYS_I2C_BASE                    (0xD0180000)
-#define CONFIG_SPEAR_FSMCBASE                  (0x94000000)
+#define CONFIG_SYS_FSMC_BASE                   (0x94000000)

 #elif defined(CONFIG_SPEAR310)
 #define CONFIG_SYS_I2C_BASE                    (0xD0180000)
-#define CONFIG_SPEAR_FSMCBASE                  (0x44000000)
+#define CONFIG_SYS_FSMC_BASE                   (0x44000000)

 #undef CONFIG_SYS_NAND_CLE
 #undef CONFIG_SYS_NAND_ALE
@@ -57,7 +57,7 @@ 

 #elif defined(CONFIG_SPEAR320)
 #define CONFIG_SYS_I2C_BASE                    (0xD0180000)
-#define CONFIG_SPEAR_FSMCBASE                  (0x4C000000)
+#define CONFIG_SYS_FSMC_BASE                   (0x4C000000)

 #define CONFIG_SPEAR_EMIBASE                   (0x40000000)
 #define CONFIG_SPEAR_RASBASE                   (0xB3000000)
diff --git a/board/spear/spear300/spear300.c b/board/spear/spear300/spear300.c
index 60ee544..32bcb77 100644
--- a/board/spear/spear300/spear300.c
+++ b/board/spear/spear300/spear300.c
@@ -24,10 +24,10 @@ 
 #include <common.h>
 #include <nand.h>
 #include <asm/io.h>
+#include <linux/mtd/fsmc_nand.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_defs.h>
 #include <asm/arch/spr_misc.h>
-#include <asm/arch/spr_nand.h>

 int board_init(void)
 {
@@ -46,13 +46,14 @@  int board_nand_init(struct nand_chip *nand)
        struct misc_regs *const misc_regs_p =
            (struct misc_regs *)CONFIG_SPEAR_MISCBASE;

+#if defined(CONFIG_NAND_FSMC)
        if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
             MISC_SOCCFG30) ||
            ((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
             MISC_SOCCFG31)) {

-               return spear_nand_init(nand);
+               return fsmc_nand_init(nand);
        }
-
+#endif
        return -1;
 }
diff --git a/board/spear/spear310/spear310.c b/board/spear/spear310/spear310.c
index 03dfe16..8b58218 100644
--- a/board/spear/spear310/spear310.c
+++ b/board/spear/spear310/spear310.c
@@ -25,10 +25,10 @@ 
 #include <common.h>
 #include <nand.h>
 #include <asm/io.h>
+#include <linux/mtd/fsmc_nand.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_defs.h>
 #include <asm/arch/spr_misc.h>
-#include <asm/arch/spr_nand.h>

 int board_init(void)
 {
@@ -47,13 +47,14 @@  int board_nand_init(struct nand_chip *nand)
        struct misc_regs *const misc_regs_p =
            (struct misc_regs *)CONFIG_SPEAR_MISCBASE;

+#if defined(CONFIG_NAND_FSMC)
        if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
             MISC_SOCCFG30) ||
            ((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
             MISC_SOCCFG31)) {

-               return spear_nand_init(nand);
+               return fsmc_nand_init(nand);
        }
-
+#endif
        return -1;
 }
diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c
index 2ba2dbb..172ad35 100644
--- a/board/spear/spear320/spear320.c
+++ b/board/spear/spear320/spear320.c
@@ -25,10 +25,10 @@ 
 #include <common.h>
 #include <nand.h>
 #include <asm/io.h>
+#include <linux/mtd/fsmc_nand.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_defs.h>
 #include <asm/arch/spr_misc.h>
-#include <asm/arch/spr_nand.h>

 int board_init(void)
 {
@@ -47,13 +47,14 @@  int board_nand_init(struct nand_chip *nand)
        struct misc_regs *const misc_regs_p =
            (struct misc_regs *)CONFIG_SPEAR_MISCBASE;

+#if defined(CONFIG_NAND_FSMC)
        if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
             MISC_SOCCFG30) ||
            ((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
             MISC_SOCCFG31)) {

-               return spear_nand_init(nand);
+               return fsmc_nand_init(nand);
        }
-
+#endif
        return -1;
 }
diff --git a/board/spear/spear600/spear600.c b/board/spear/spear600/spear600.c
index eef9a37..7cf63d6 100644
--- a/board/spear/spear600/spear600.c
+++ b/board/spear/spear600/spear600.c
@@ -24,10 +24,10 @@ 
 #include <common.h>
 #include <nand.h>
 #include <asm/io.h>
+#include <linux/mtd/fsmc_nand.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_defs.h>
 #include <asm/arch/spr_misc.h>
-#include <asm/arch/spr_nand.h>

 int board_init(void)
 {
@@ -46,8 +46,9 @@  int board_nand_init(struct nand_chip *nand)
        struct misc_regs *const misc_regs_p =
            (struct misc_regs *)CONFIG_SPEAR_MISCBASE;

+#if defined(CONFIG_NAND_FSMC)
        if (!(readl(&misc_regs_p->auto_cfg_reg) & MISC_NANDDIS))
-               return spear_nand_init(nand);
-
+               return fsmc_nand_init(nand);
+#endif
        return -1;
 }
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h
index 516b78e..c37305f 100644
--- a/include/configs/spear-common.h
+++ b/include/configs/spear-common.h
@@ -90,7 +90,7 @@ 
 /* NAND FLASH Configuration */
 #define CONFIG_MTD_DEVICE
 #define CONFIG_MTD_PARTITIONS
-#define CONFIG_NAND_SPEAR                      1
+#define CONFIG_NAND_FSMC
 #define CONFIG_SYS_MAX_NAND_DEVICE             1
 #define CONFIG_MTD_NAND_VERIFY_WRITE

diff --git a/include/configs/spear3xx.h b/include/configs/spear3xx.h
index bd5d111..5bdd874 100644
--- a/include/configs/spear3xx.h
+++ b/include/configs/spear3xx.h
@@ -117,6 +117,10 @@ 

 #endif

+/* NAND flash configuration */
+#define CONFIG_SYS_FSMC_NAND_SP
+#define CONFIG_SYS_FSMC_NAND_8BIT
+
 #if defined(CONFIG_SPEAR300)
 #define CONFIG_SYS_NAND_BASE                   0x80000000

diff --git a/include/configs/spear6xx.h b/include/configs/spear6xx.h
index 8de7ebd..1e06c72 100644
--- a/include/configs/spear6xx.h
+++ b/include/configs/spear6xx.h
@@ -38,6 +38,9 @@ 
 #define CONFIG_PL01x_PORTS                     { (void *)CONFIG_SYS_SERIAL0, \
                                                (void *)CONFIG_SYS_SERIAL1 }

+/* NAND flash configuration */
+#define CONFIG_SYS_FSMC_NAND_SP
+#define CONFIG_SYS_FSMC_NAND_8BIT
 #define CONFIG_SYS_NAND_BASE                   (0xD2000000)

 #endif  /* __CONFIG_H */
--
1.7.2.2



------------------------------

Message: 2
Date: Mon, 27 Feb 2012 15:08:24 +0530
From: Amit Virdi <amit.virdi@st.com>
Subject: [U-Boot] [PATCH 3/3] mtd/NAND: Remove obsolete SPEAr specific
        NAND    drivers
To: <u-boot@lists.denx.de>
Cc: armando.visconti@st.com, shiraz.hashim@st.com,      Amit Virdi
        <amit.virdi@st.com>, scottwood@freescale.com, sr@denx.de
Message-ID: <1330335504-32226-4-git-send-email-amit.virdi@st.com>
Content-Type: text/plain

From: Vipin KUMAR <vipin.kumar@st.com>

Since, SPEAr platform uses generic FSMC driver now, so spear specific files
drivers/mtd/nand/spr_nand.c, arch/arm/include/asm/arch-spear/spr_nand.h are
removed

Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
---
 arch/arm/include/asm/arch-spear/spr_nand.h |   57 -------------
 drivers/mtd/nand/spr_nand.c                |  124 ----------------------------
 2 files changed, 0 insertions(+), 181 deletions(-)
 delete mode 100644 arch/arm/include/asm/arch-spear/spr_nand.h
 delete mode 100644 drivers/mtd/nand/spr_nand.c

diff --git a/arch/arm/include/asm/arch-spear/spr_nand.h b/arch/arm/include/asm/arch-spear/spr_nand.h
deleted file mode 100644
index 2b63dc7..0000000
--- a/arch/arm/include/asm/arch-spear/spr_nand.h
+++ /dev/null
@@ -1,57 +0,0 @@ 
-/*
- * (C) Copyright 2009
- * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#ifndef __SPR_NAND_H__
-#define __SPR_NAND_H__
-
-struct fsmc_regs {
-       u32 reserved_1[0x10];
-       u32 genmemctrl_pc;
-       u32 reserved_2;
-       u32 genmemctrl_comm;
-       u32 genmemctrl_attrib;
-       u32 reserved_3;
-       u32 genmemctrl_ecc;
-};
-
-/* genmemctrl_pc register definitions */
-#define FSMC_RESET             (1 << 0)
-#define FSMC_WAITON            (1 << 1)
-#define FSMC_ENABLE            (1 << 2)
-#define FSMC_DEVTYPE_NAND      (1 << 3)
-#define FSMC_DEVWID_8          (0 << 4)
-#define FSMC_DEVWID_16         (1 << 4)
-#define FSMC_ECCEN             (1 << 6)
-#define FSMC_ECCPLEN_512       (0 << 7)
-#define FSMC_ECCPLEN_256       (1 << 7)
-#define FSMC_TCLR_1            (1 << 9)
-#define FSMC_TAR_1             (1 << 13)
-
-/* genmemctrl_comm register definitions */
-#define FSMC_TSET_0            (0 << 0)
-#define FSMC_TWAIT_6           (6 << 8)
-#define FSMC_THOLD_4           (4 << 16)
-#define FSMC_THIZ_1            (1 << 24)
-
-extern int spear_nand_init(struct nand_chip *nand);
-#endif
diff --git a/drivers/mtd/nand/spr_nand.c b/drivers/mtd/nand/spr_nand.c
deleted file mode 100644
index 097d0c6..0000000
--- a/drivers/mtd/nand/spr_nand.c
+++ /dev/null
@@ -1,124 +0,0 @@ 
-/*
- * (C) Copyright 2009
- * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <nand.h>
-#include <linux/mtd/nand_ecc.h>
-#include <asm/io.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/spr_nand.h>
-
-static struct fsmc_regs *const fsmc_regs_p =
-    (struct fsmc_regs *)CONFIG_SPEAR_FSMCBASE;
-
-static struct nand_ecclayout spear_nand_ecclayout = {
-       .eccbytes = 24,
-       .eccpos = {2, 3, 4, 18, 19, 20, 34, 35, 36, 50, 51, 52,
-                  66, 67, 68, 82, 83, 84, 98, 99, 100, 114, 115, 116},
-       .oobfree = {
-                   {.offset = 8, .length = 8},
-                   {.offset = 24, .length = 8},
-                   {.offset = 40, .length = 8},
-                   {.offset = 56, .length = 8},
-                   {.offset = 72, .length = 8},
-                   {.offset = 88, .length = 8},
-                   {.offset = 104, .length = 8},
-                   {.offset = 120, .length = 8}
-                   }
-};
-
-static void spear_nand_hwcontrol(struct mtd_info *mtd, int cmd, uint ctrl)
-{
-       struct nand_chip *this = mtd->priv;
-       ulong IO_ADDR_W;
-
-       if (ctrl & NAND_CTRL_CHANGE) {
-               IO_ADDR_W = (ulong)this->IO_ADDR_W;
-
-               IO_ADDR_W &= ~(CONFIG_SYS_NAND_CLE | CONFIG_SYS_NAND_ALE);
-               if (ctrl & NAND_CLE)
-                       IO_ADDR_W |= CONFIG_SYS_NAND_CLE;
-               if (ctrl & NAND_ALE)
-                       IO_ADDR_W |= CONFIG_SYS_NAND_ALE;
-
-               if (ctrl & NAND_NCE) {
-                       writel(readl(&fsmc_regs_p->genmemctrl_pc) |
-                              FSMC_ENABLE, &fsmc_regs_p->genmemctrl_pc);
-               } else {
-                       writel(readl(&fsmc_regs_p->genmemctrl_pc) &
-                              ~FSMC_ENABLE, &fsmc_regs_p->genmemctrl_pc);
-               }
-               this->IO_ADDR_W = (void *)IO_ADDR_W;
-       }
-
-       if (cmd != NAND_CMD_NONE)
-               writeb(cmd, this->IO_ADDR_W);
-}
-
-static int spear_read_hwecc(struct mtd_info *mtd,
-                           const u_char *data, u_char ecc[3])
-{
-       u_int ecc_tmp;
-
-       /* read the h/w ECC */
-       ecc_tmp = readl(&fsmc_regs_p->genmemctrl_ecc);
-
-       ecc[0] = (u_char) (ecc_tmp & 0xFF);
-       ecc[1] = (u_char) ((ecc_tmp & 0xFF00) >> 8);
-       ecc[2] = (u_char) ((ecc_tmp & 0xFF0000) >> 16);
-
-       return 0;
-}
-
-void spear_enable_hwecc(struct mtd_info *mtd, int mode)
-{
-       writel(readl(&fsmc_regs_p->genmemctrl_pc) & ~0x80,
-              &fsmc_regs_p->genmemctrl_pc);
-       writel(readl(&fsmc_regs_p->genmemctrl_pc) & ~FSMC_ECCEN,
-              &fsmc_regs_p->genmemctrl_pc);
-       writel(readl(&fsmc_regs_p->genmemctrl_pc) | FSMC_ECCEN,
-              &fsmc_regs_p->genmemctrl_pc);
-}
-
-int spear_nand_init(struct nand_chip *nand)
-{
-       writel(FSMC_DEVWID_8 | FSMC_DEVTYPE_NAND | FSMC_ENABLE | FSMC_WAITON,
-              &fsmc_regs_p->genmemctrl_pc);
-       writel(readl(&fsmc_regs_p->genmemctrl_pc) | FSMC_TCLR_1 | FSMC_TAR_1,
-              &fsmc_regs_p->genmemctrl_pc);
-       writel(FSMC_THIZ_1 | FSMC_THOLD_4 | FSMC_TWAIT_6 | FSMC_TSET_0,
-              &fsmc_regs_p->genmemctrl_comm);
-       writel(FSMC_THIZ_1 | FSMC_THOLD_4 | FSMC_TWAIT_6 | FSMC_TSET_0,
-              &fsmc_regs_p->genmemctrl_attrib);
-
-       nand->options = 0;
-       nand->ecc.mode = NAND_ECC_HW;
-       nand->ecc.layout = &spear_nand_ecclayout;
-       nand->ecc.size = 512;
-       nand->ecc.bytes = 3;
-       nand->ecc.calculate = spear_read_hwecc;
-       nand->ecc.hwctl = spear_enable_hwecc;
-       nand->ecc.correct = nand_correct_data;
-       nand->cmd_ctrl = spear_nand_hwcontrol;
-       return 0;
-}