Patchwork [U-Boot,v5,8/8] nand: mxc: Switch NAND SPL to generic SPL

login
register
mail settings
Submitter Benoît Thébaudeau
Date Feb. 8, 2013, 10:49 p.m.
Message ID <1360363767-8658-8-git-send-email-benoit.thebaudeau@advansee.com>
Download mbox | patch
Permalink /patch/219345/
State Changes Requested
Delegated to: Stefano Babic
Headers show

Comments

Benoît Thébaudeau - Feb. 8, 2013, 10:49 p.m.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
---
Changes in v5:
 - Remove spaces between function name and open parenthesis.
 - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts.
 - Remove the useless definition of CONFIG_SPL_LDSCRIPT.
 - Fix the call to nand_boot().

Changes in v4:
 - New patch.

Changes in v3: None
Changes in v2: None

 Makefile                                           |    3 +
 arch/arm/cpu/arm1136/config.mk                     |    3 -
 arch/arm/cpu/arm1136/start.S                       |    2 -
 arch/arm/cpu/arm926ejs/start.S                     |    9 +-
 board/freescale/mx31pdk/Makefile                   |    4 +
 board/freescale/mx31pdk/config.mk                  |    5 --
 .../freescale/mx31pdk/u-boot-spl.lds               |   20 +++--
 board/karo/tx25/Makefile                           |    5 +-
 board/karo/tx25/config.mk                          |    5 --
 .../u-boot.lds => board/karo/tx25/u-boot-spl.lds   |   16 ++--
 boards.cfg                                         |    2 +-
 drivers/mtd/nand/Makefile                          |    1 +
 drivers/mtd/nand/mxc_nand.c                        |   10 +--
 include/fsl_nfc.h => drivers/mtd/nand/mxc_nand.h   |   10 +--
 .../mtd/nand/mxc_nand_spl.c                        |   26 +++---
 include/common.h                                   |    6 +-
 include/configs/mx31pdk.h                          |   10 ++-
 include/configs/tx25.h                             |   13 ++-
 include/configs/woodburn_sd.h                      |    1 +
 nand_spl/board/freescale/mx31pdk/Makefile          |   68 ---------------
 nand_spl/board/karo/tx25/Makefile                  |   89 --------------------
 nand_spl/board/karo/tx25/config.mk                 |    1 -
 22 files changed, 87 insertions(+), 222 deletions(-)
 delete mode 100644 board/freescale/mx31pdk/config.mk
 rename nand_spl/board/karo/tx25/u-boot.lds => board/freescale/mx31pdk/u-boot-spl.lds (86%)
 delete mode 100644 board/karo/tx25/config.mk
 rename nand_spl/board/freescale/mx31pdk/u-boot.lds => board/karo/tx25/u-boot-spl.lds (89%)
 rename include/fsl_nfc.h => drivers/mtd/nand/mxc_nand.h (98%)
 rename nand_spl/nand_boot_fsl_nfc.c => drivers/mtd/nand/mxc_nand_spl.c (92%)
 delete mode 100644 nand_spl/board/freescale/mx31pdk/Makefile
 delete mode 100644 nand_spl/board/karo/tx25/Makefile
 delete mode 100644 nand_spl/board/karo/tx25/config.mk
Benoît Thébaudeau - Feb. 8, 2013, 11:47 p.m.
On Friday, February 8, 2013 11:49:27 PM, Benoît Thébaudeau wrote:
> Subject: [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
> 
> Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
> ---
> Changes in v5:
>  - Remove spaces between function name and open parenthesis.
>  - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts.
>  - Remove the useless definition of CONFIG_SPL_LDSCRIPT.
>  - Fix the call to nand_boot().
> 
> Changes in v4:
>  - New patch.
> 
> Changes in v3: None
> Changes in v2: None

This is now supposed to be working and compile-tested.

Custodians, please review and advise.

Board maintainers, please test.

Tell me if I should split away some stuff.

Should doc/README.arm-relocation be updated, and how since tx25 no longer uses
NAND SPL, which is also deprecated?

Note that mx31pdk and tx25 had been broken by commit
e05e5de7fae5bec79617e113916dac6631251156. After this commit, for those boards,
_main called board_init_f, which called relocate_code, which unexpectedly (for
their users) returned to nowhere in ctr0.S instead of calling nand_boot. Also,
crt0.S calls nand_boot if CONFIG_SPL_BUILD is not defined but CONFIG_NAND_SPL
is, which is not normal for NAND SPL. Other NAND SPL boards may be broken too,
but that's not too much of an issue since they are supposed to migrate to
generic SPL.

Best regards,
Benoît
Benoît Thébaudeau - Feb. 9, 2013, 1:53 p.m.
On Saturday, February 9, 2013 12:47:25 AM, Benoît Thébaudeau wrote:
> On Friday, February 8, 2013 11:49:27 PM, Benoît Thébaudeau wrote:
> > Subject: [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
> > 
> > Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
> > ---
> > Changes in v5:
> >  - Remove spaces between function name and open parenthesis.
> >  - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts.
> >  - Remove the useless definition of CONFIG_SPL_LDSCRIPT.
> >  - Fix the call to nand_boot().
> > 
> > Changes in v4:
> >  - New patch.
> > 
> > Changes in v3: None
> > Changes in v2: None
> 
> This is now supposed to be working and compile-tested.
> 
> Custodians, please review and advise.
> 
> Board maintainers, please test.
> 
> Tell me if I should split away some stuff.
> 
> Should doc/README.arm-relocation be updated, and how since tx25 no longer
> uses
> NAND SPL, which is also deprecated?
> 
> Note that mx31pdk and tx25 had been broken by commit
> e05e5de7fae5bec79617e113916dac6631251156. After this commit, for those
> boards,
> _main called board_init_f, which called relocate_code, which unexpectedly
> (for
> their users) returned to nowhere in ctr0.S instead of calling nand_boot.
> Also,
> crt0.S calls nand_boot if CONFIG_SPL_BUILD is not defined but CONFIG_NAND_SPL
> is, which is not normal for NAND SPL. Other NAND SPL boards may be broken
> too,
> but that's not too much of an issue since they are supposed to migrate to
> generic SPL.

I am also wondering if board_init_f should not be moved out of mxc_nand_spl.c to
either <board>/lowlevel_init.S or <board>/<board>.c. That would make
mxc_nand_spl.c more generic if for some reason a board needs to do specific
things. Any opinion?

For the start.S files, since it's not possible to know from CONFIG_SPL_BUILD and
CONFIG_NAND_SPL if relocate_code is needed or not, I see the following choices:
1) Let it defined in all cases. It's quite small, so it won't hurt much.
2) Create a specific SPL #define (e.g. CONFIG_SPL_RELOCATE_CODE) to define it
   for generic SPL only if needed.
3) Just create a specific linker section for it so that it's automatically
   garbage-collected if unneeded.
Any opinion?

Best regards,
Benoît
Benoît Thébaudeau - Feb. 9, 2013, 4:38 p.m.
On Saturday, February 9, 2013 2:53:44 PM, Benoît Thébaudeau wrote:
> On Saturday, February 9, 2013 12:47:25 AM, Benoît Thébaudeau wrote:
> > On Friday, February 8, 2013 11:49:27 PM, Benoît Thébaudeau wrote:
> > > Subject: [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
> > > 
> > > Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
> > > ---
> > > Changes in v5:
> > >  - Remove spaces between function name and open parenthesis.
> > >  - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts.
> > >  - Remove the useless definition of CONFIG_SPL_LDSCRIPT.
> > >  - Fix the call to nand_boot().
> > > 
> > > Changes in v4:
> > >  - New patch.
> > > 
> > > Changes in v3: None
> > > Changes in v2: None
> > 
> > This is now supposed to be working and compile-tested.
> > 
> > Custodians, please review and advise.
> > 
> > Board maintainers, please test.
> > 
> > Tell me if I should split away some stuff.
> > 
> > Should doc/README.arm-relocation be updated, and how since tx25 no longer
> > uses
> > NAND SPL, which is also deprecated?
> > 
> > Note that mx31pdk and tx25 had been broken by commit
> > e05e5de7fae5bec79617e113916dac6631251156. After this commit, for those
> > boards,
> > _main called board_init_f, which called relocate_code, which unexpectedly
> > (for
> > their users) returned to nowhere in ctr0.S instead of calling nand_boot.
> > Also,
> > crt0.S calls nand_boot if CONFIG_SPL_BUILD is not defined but
> > CONFIG_NAND_SPL
> > is, which is not normal for NAND SPL. Other NAND SPL boards may be broken
> > too,
> > but that's not too much of an issue since they are supposed to migrate to
> > generic SPL.
> 
> I am also wondering if board_init_f should not be moved out of mxc_nand_spl.c
> to
> either <board>/lowlevel_init.S or <board>/<board>.c. That would make
> mxc_nand_spl.c more generic if for some reason a board needs to do specific
> things. Any opinion?
> 
> For the start.S files, since it's not possible to know from CONFIG_SPL_BUILD
> and
> CONFIG_NAND_SPL if relocate_code is needed or not, I see the following
> choices:
> 1) Let it defined in all cases. It's quite small, so it won't hurt much.
> 2) Create a specific SPL #define (e.g. CONFIG_SPL_RELOCATE_CODE) to define it
>    for generic SPL only if needed.
> 3) Just create a specific linker section for it so that it's automatically
>    garbage-collected if unneeded.
> Any opinion?

I'm also considering to factorize relocate_code to crt0.S. There's not really a
good reason for it to be depending on each ARM processor. Any opinion?

Best regards,
Benoît
Marek Vasut - Feb. 9, 2013, 11:24 p.m.
Dear Benoît Thébaudeau,

> On Saturday, February 9, 2013 2:53:44 PM, Benoît Thébaudeau wrote:
> > On Saturday, February 9, 2013 12:47:25 AM, Benoît Thébaudeau wrote:
> > > On Friday, February 8, 2013 11:49:27 PM, Benoît Thébaudeau wrote:
> > > > Subject: [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
> > > > 
> > > > Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
> > > > ---
> > > > 
> > > > Changes in v5:
> > > >  - Remove spaces between function name and open parenthesis.
> > > >  - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts.
> > > >  - Remove the useless definition of CONFIG_SPL_LDSCRIPT.
> > > >  - Fix the call to nand_boot().
> > > > 
> > > > Changes in v4:
> > > >  - New patch.
> > > > 
> > > > Changes in v3: None
> > > > Changes in v2: None
> > > 
> > > This is now supposed to be working and compile-tested.
> > > 
> > > Custodians, please review and advise.
> > > 
> > > Board maintainers, please test.
> > > 
> > > Tell me if I should split away some stuff.
> > > 
> > > Should doc/README.arm-relocation be updated, and how since tx25 no
> > > longer uses
> > > NAND SPL, which is also deprecated?
> > > 
> > > Note that mx31pdk and tx25 had been broken by commit
> > > e05e5de7fae5bec79617e113916dac6631251156. After this commit, for those
> > > boards,
> > > _main called board_init_f, which called relocate_code, which
> > > unexpectedly (for
> > > their users) returned to nowhere in ctr0.S instead of calling
> > > nand_boot. Also,
> > > crt0.S calls nand_boot if CONFIG_SPL_BUILD is not defined but
> > > CONFIG_NAND_SPL
> > > is, which is not normal for NAND SPL. Other NAND SPL boards may be
> > > broken too,
> > > but that's not too much of an issue since they are supposed to migrate
> > > to generic SPL.
> > 
> > I am also wondering if board_init_f should not be moved out of
> > mxc_nand_spl.c to
> > either <board>/lowlevel_init.S or <board>/<board>.c. That would make
> > mxc_nand_spl.c more generic if for some reason a board needs to do
> > specific things. Any opinion?
> > 
> > For the start.S files, since it's not possible to know from
> > CONFIG_SPL_BUILD and
> > CONFIG_NAND_SPL if relocate_code is needed or not, I see the following
> > choices:
> > 1) Let it defined in all cases. It's quite small, so it won't hurt much.
> > 2) Create a specific SPL #define (e.g. CONFIG_SPL_RELOCATE_CODE) to
> > define it
> > 
> >    for generic SPL only if needed.
> > 
> > 3) Just create a specific linker section for it so that it's
> > automatically
> > 
> >    garbage-collected if unneeded.
> > 
> > Any opinion?

How much of start.S can be actually rewritten in pure-C ?

Best regards,
Marek Vasut
Benoît Thébaudeau - Feb. 10, 2013, 12:02 a.m.
Dear Marek Vasut,

On Sunday, February 10, 2013 12:24:04 AM, Marek Vasut wrote:
> Dear Benoît Thébaudeau,
> 
> > On Saturday, February 9, 2013 2:53:44 PM, Benoît Thébaudeau wrote:
> > > On Saturday, February 9, 2013 12:47:25 AM, Benoît Thébaudeau wrote:
> > > > On Friday, February 8, 2013 11:49:27 PM, Benoît Thébaudeau wrote:
> > > > > Subject: [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
> > > > > 
> > > > > Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
> > > > > ---
> > > > > 
> > > > > Changes in v5:
> > > > >  - Remove spaces between function name and open parenthesis.
> > > > >  - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts.
> > > > >  - Remove the useless definition of CONFIG_SPL_LDSCRIPT.
> > > > >  - Fix the call to nand_boot().
> > > > > 
> > > > > Changes in v4:
> > > > >  - New patch.
> > > > > 
> > > > > Changes in v3: None
> > > > > Changes in v2: None
> > > > 
> > > > This is now supposed to be working and compile-tested.
> > > > 
> > > > Custodians, please review and advise.
> > > > 
> > > > Board maintainers, please test.
> > > > 
> > > > Tell me if I should split away some stuff.
> > > > 
> > > > Should doc/README.arm-relocation be updated, and how since tx25 no
> > > > longer uses
> > > > NAND SPL, which is also deprecated?
> > > > 
> > > > Note that mx31pdk and tx25 had been broken by commit
> > > > e05e5de7fae5bec79617e113916dac6631251156. After this commit, for those
> > > > boards,
> > > > _main called board_init_f, which called relocate_code, which
> > > > unexpectedly (for
> > > > their users) returned to nowhere in ctr0.S instead of calling
> > > > nand_boot. Also,
> > > > crt0.S calls nand_boot if CONFIG_SPL_BUILD is not defined but
> > > > CONFIG_NAND_SPL
> > > > is, which is not normal for NAND SPL. Other NAND SPL boards may be
> > > > broken too,
> > > > but that's not too much of an issue since they are supposed to migrate
> > > > to generic SPL.
> > > 
> > > I am also wondering if board_init_f should not be moved out of
> > > mxc_nand_spl.c to
> > > either <board>/lowlevel_init.S or <board>/<board>.c. That would make
> > > mxc_nand_spl.c more generic if for some reason a board needs to do
> > > specific things. Any opinion?
> > > 
> > > For the start.S files, since it's not possible to know from
> > > CONFIG_SPL_BUILD and
> > > CONFIG_NAND_SPL if relocate_code is needed or not, I see the following
> > > choices:
> > > 1) Let it defined in all cases. It's quite small, so it won't hurt much.
> > > 2) Create a specific SPL #define (e.g. CONFIG_SPL_RELOCATE_CODE) to
> > > define it
> > > 
> > >    for generic SPL only if needed.
> > > 
> > > 3) Just create a specific linker section for it so that it's
> > > automatically
> > > 
> > >    garbage-collected if unneeded.
> > > 
> > > Any opinion?
> 
> How much of start.S can be actually rewritten in pure-C ?

I would say only relocate_code(). Apart from this function, start.S only deals
with preprocessor register accesses and IRQ / exception handling that require
assembly.

As to relocate_code(), it would still be tricky in pure C because it mixes
absolute addresses with position-independent code and data accesses, so one
would have to be very careful about the C coding of this function in order to
avoid a dependency on compiler choices. Having it written in assembly guarantees
a correct result and emphasizes the absolute/relative access constraints for
easier maintenance.

But this is only my opinion.

Best regards,
Benoît
Benoît Thébaudeau - Feb. 10, 2013, 1:37 p.m.
On Sunday, February 10, 2013 1:02:58 AM, Benoît Thébaudeau wrote:
> Dear Marek Vasut,
> 
> On Sunday, February 10, 2013 12:24:04 AM, Marek Vasut wrote:
> > Dear Benoît Thébaudeau,
> > 
> > > On Saturday, February 9, 2013 2:53:44 PM, Benoît Thébaudeau wrote:
> > > > On Saturday, February 9, 2013 12:47:25 AM, Benoît Thébaudeau wrote:
> > > > > On Friday, February 8, 2013 11:49:27 PM, Benoît Thébaudeau wrote:
> > > > > > Subject: [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
> > > > > > 
> > > > > > Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
> > > > > > ---
> > > > > > 
> > > > > > Changes in v5:
> > > > > >  - Remove spaces between function name and open parenthesis.
> > > > > >  - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts.
> > > > > >  - Remove the useless definition of CONFIG_SPL_LDSCRIPT.
> > > > > >  - Fix the call to nand_boot().
> > > > > > 
> > > > > > Changes in v4:
> > > > > >  - New patch.
> > > > > > 
> > > > > > Changes in v3: None
> > > > > > Changes in v2: None
> > > > > 
> > > > > This is now supposed to be working and compile-tested.
> > > > > 
> > > > > Custodians, please review and advise.
> > > > > 
> > > > > Board maintainers, please test.
> > > > > 
> > > > > Tell me if I should split away some stuff.
> > > > > 
> > > > > Should doc/README.arm-relocation be updated, and how since tx25 no
> > > > > longer uses
> > > > > NAND SPL, which is also deprecated?
> > > > > 
> > > > > Note that mx31pdk and tx25 had been broken by commit
> > > > > e05e5de7fae5bec79617e113916dac6631251156. After this commit, for
> > > > > those
> > > > > boards,
> > > > > _main called board_init_f, which called relocate_code, which
> > > > > unexpectedly (for
> > > > > their users) returned to nowhere in ctr0.S instead of calling
> > > > > nand_boot. Also,
> > > > > crt0.S calls nand_boot if CONFIG_SPL_BUILD is not defined but
> > > > > CONFIG_NAND_SPL
> > > > > is, which is not normal for NAND SPL. Other NAND SPL boards may be
> > > > > broken too,
> > > > > but that's not too much of an issue since they are supposed to
> > > > > migrate
> > > > > to generic SPL.
> > > > 
> > > > I am also wondering if board_init_f should not be moved out of
> > > > mxc_nand_spl.c to
> > > > either <board>/lowlevel_init.S or <board>/<board>.c. That would make
> > > > mxc_nand_spl.c more generic if for some reason a board needs to do
> > > > specific things. Any opinion?
> > > > 
> > > > For the start.S files, since it's not possible to know from
> > > > CONFIG_SPL_BUILD and
> > > > CONFIG_NAND_SPL if relocate_code is needed or not, I see the following
> > > > choices:
> > > > 1) Let it defined in all cases. It's quite small, so it won't hurt
> > > > much.
> > > > 2) Create a specific SPL #define (e.g. CONFIG_SPL_RELOCATE_CODE) to
> > > > define it
> > > > 
> > > >    for generic SPL only if needed.
> > > > 
> > > > 3) Just create a specific linker section for it so that it's
> > > > automatically
> > > > 
> > > >    garbage-collected if unneeded.
> > > > 
> > > > Any opinion?
> > 
> > How much of start.S can be actually rewritten in pure-C ?
> 
> I would say only relocate_code(). Apart from this function, start.S only
> deals
> with preprocessor register accesses and IRQ / exception handling that require
> assembly.

s/preprocessor/coprocessor/

> As to relocate_code(), it would still be tricky in pure C because it mixes
> absolute addresses with position-independent code and data accesses, so one
> would have to be very careful about the C coding of this function in order to
> avoid a dependency on compiler choices. Having it written in assembly
> guarantees
> a correct result and emphasizes the absolute/relative access constraints for
> easier maintenance.
> 
> But this is only my opinion.
> 
> Best regards,
> Benoît
>
Benoît Thébaudeau - Feb. 12, 2013, 1:45 p.m.
Hi Stefano,

On Saturday, February 9, 2013 5:38:26 PM, Benoît Thébaudeau wrote:
> On Saturday, February 9, 2013 2:53:44 PM, Benoît Thébaudeau wrote:
> > On Saturday, February 9, 2013 12:47:25 AM, Benoît Thébaudeau wrote:
> > > On Friday, February 8, 2013 11:49:27 PM, Benoît Thébaudeau wrote:
> > > > Subject: [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
> > > > 
> > > > Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
> > > > ---
> > > > Changes in v5:
> > > >  - Remove spaces between function name and open parenthesis.
> > > >  - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts.
> > > >  - Remove the useless definition of CONFIG_SPL_LDSCRIPT.
> > > >  - Fix the call to nand_boot().
> > > > 
> > > > Changes in v4:
> > > >  - New patch.
> > > > 
> > > > Changes in v3: None
> > > > Changes in v2: None
> > > 
> > > This is now supposed to be working and compile-tested.
> > > 
> > > Custodians, please review and advise.
> > > 
> > > Board maintainers, please test.
> > > 
> > > Tell me if I should split away some stuff.
> > > 
> > > Should doc/README.arm-relocation be updated, and how since tx25 no longer
> > > uses
> > > NAND SPL, which is also deprecated?
> > > 
> > > Note that mx31pdk and tx25 had been broken by commit
> > > e05e5de7fae5bec79617e113916dac6631251156. After this commit, for those
> > > boards,
> > > _main called board_init_f, which called relocate_code, which unexpectedly
> > > (for
> > > their users) returned to nowhere in ctr0.S instead of calling nand_boot.
> > > Also,
> > > crt0.S calls nand_boot if CONFIG_SPL_BUILD is not defined but
> > > CONFIG_NAND_SPL
> > > is, which is not normal for NAND SPL. Other NAND SPL boards may be broken
> > > too,
> > > but that's not too much of an issue since they are supposed to migrate to
> > > generic SPL.
> > 
> > I am also wondering if board_init_f should not be moved out of
> > mxc_nand_spl.c
> > to
> > either <board>/lowlevel_init.S or <board>/<board>.c. That would make
> > mxc_nand_spl.c more generic if for some reason a board needs to do specific
> > things. Any opinion?
> > 
> > For the start.S files, since it's not possible to know from
> > CONFIG_SPL_BUILD
> > and
> > CONFIG_NAND_SPL if relocate_code is needed or not, I see the following
> > choices:
> > 1) Let it defined in all cases. It's quite small, so it won't hurt much.
> > 2) Create a specific SPL #define (e.g. CONFIG_SPL_RELOCATE_CODE) to define
> > it
> >    for generic SPL only if needed.
> > 3) Just create a specific linker section for it so that it's automatically
> >    garbage-collected if unneeded.
> > Any opinion?
> 
> I'm also considering to factorize relocate_code to crt0.S. There's not really
> a
> good reason for it to be depending on each ARM processor. Any opinion?

FYI, I will post soon a v6 with a lot of cleanup.

Best regards,
Benoît
Stefano Babic - Feb. 12, 2013, 2:44 p.m.
On 12/02/2013 14:45, Benoît Thébaudeau wrote:
> Hi Stefano,
> 

>>
>> I'm also considering to factorize relocate_code to crt0.S. There's not really
>> a
>> good reason for it to be depending on each ARM processor. Any opinion?
> 
> FYI, I will post soon a v6 with a lot of cleanup.

Ok, thanks.
Stefano

Patch

diff --git a/Makefile b/Makefile
index d28e608..cc2298a 100644
--- a/Makefile
+++ b/Makefile
@@ -470,6 +470,9 @@  $(obj)u-boot.img:	$(obj)u-boot.bin
 $(OBJTREE)/u-boot.imx : $(obj)u-boot.bin $(SUBDIR_TOOLS) depend
 		$(MAKE) -C $(SRCTREE)/arch/arm/imx-common $@
 
+$(OBJTREE)/SPL : $(obj)spl/u-boot-spl.bin depend
+		$(MAKE) -C $(SRCTREE)/arch/arm/imx-common $@
+
 $(obj)u-boot.kwb:       $(obj)u-boot.bin
 		$(obj)tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
 		-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@
diff --git a/arch/arm/cpu/arm1136/config.mk b/arch/arm/cpu/arm1136/config.mk
index 9092d91..efee0d1 100644
--- a/arch/arm/cpu/arm1136/config.mk
+++ b/arch/arm/cpu/arm1136/config.mk
@@ -31,6 +31,3 @@  PLATFORM_CPPFLAGS += -march=armv5
 # =========================================================================
 PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
 PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
-ifdef CONFIG_SPL_BUILD
-ALL-y	+= $(OBJTREE)/SPL
-endif
diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
index a067b8a..3818768 100644
--- a/arch/arm/cpu/arm1136/start.S
+++ b/arch/arm/cpu/arm1136/start.S
@@ -235,8 +235,6 @@  fixnext:
 	add	r2, r2, #8		/* each rel.dyn entry is 8 bytes */
 	cmp	r2, r3
 	blo	fixloop
-	bx	lr
-
 #endif
 
 relocate_done:
diff --git a/arch/arm/cpu/arm926ejs/start.S b/arch/arm/cpu/arm926ejs/start.S
index 66a8b65..dee45f7 100644
--- a/arch/arm/cpu/arm926ejs/start.S
+++ b/arch/arm/cpu/arm926ejs/start.S
@@ -140,6 +140,10 @@  _TEXT_BASE:
 _bss_start_ofs:
 	.word __bss_start - _start
 
+.global	_image_copy_end_ofs
+_image_copy_end_ofs:
+	.word 	__image_copy_end - _start
+
 .globl _bss_end_ofs
 _bss_end_ofs:
 	.word __bss_end__ - _start
@@ -196,7 +200,6 @@  reset:
 
 /*------------------------------------------------------------------------------*/
 
-#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_NAND_SPL)
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
@@ -216,7 +219,7 @@  relocate_code:
 	moveq	r9, #0			/* no relocation. offset(r9) = 0 */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy loop */
-	ldr	r3, _bss_start_ofs
+	ldr	r3, _image_copy_end_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
@@ -270,6 +273,8 @@  relocate_done:
 
 	bx	lr
 
+#ifndef CONFIG_SPL_BUILD
+
 _rel_dyn_start_ofs:
 	.word __rel_dyn_start - _start
 _rel_dyn_end_ofs:
diff --git a/board/freescale/mx31pdk/Makefile b/board/freescale/mx31pdk/Makefile
index 5b7cafd..a1e01f0 100644
--- a/board/freescale/mx31pdk/Makefile
+++ b/board/freescale/mx31pdk/Makefile
@@ -27,7 +27,11 @@  include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
+ifdef CONFIG_SPL_BUILD
+SOBJS	:= lowlevel_init.o
+else
 COBJS	:= mx31pdk.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
diff --git a/board/freescale/mx31pdk/config.mk b/board/freescale/mx31pdk/config.mk
deleted file mode 100644
index de2c642..0000000
--- a/board/freescale/mx31pdk/config.mk
+++ /dev/null
@@ -1,5 +0,0 @@ 
-ifdef CONFIG_NAND_SPL
-CONFIG_SYS_TEXT_BASE = 0x87ec0000
-else
-CONFIG_SYS_TEXT_BASE = 0x87f00000
-endif
diff --git a/nand_spl/board/karo/tx25/u-boot.lds b/board/freescale/mx31pdk/u-boot-spl.lds
similarity index 86%
rename from nand_spl/board/karo/tx25/u-boot.lds
rename to board/freescale/mx31pdk/u-boot-spl.lds
index ee36131..96e04ce 100644
--- a/nand_spl/board/karo/tx25/u-boot.lds
+++ b/board/freescale/mx31pdk/u-boot-spl.lds
@@ -30,30 +30,32 @@  SECTIONS
 	. = ALIGN(4);
 	.text :
 	{
-		start.o			(.text)
-		lowlevel_init.o		(.text)
-		nand_boot_fsl_nfc.o	(.text)
-		*(.text)
+		arch/arm/cpu/arm1136/start.o		(.text*)
+		board/freescale/mx31pdk/libmx31pdk.o	(.text*)
+		drivers/mtd/nand/libnand.o		(.text*)
+		*(.text*)
 		. = 2K;
 	}
 
 	. = ALIGN(4);
-	.rodata : { *(.rodata) }
+	.rodata : { *(.rodata*) }
 
 	. = ALIGN(4);
 	.data : {
-		*(.data)
+		*(.data*)
 	}
 
 	. = ALIGN(4);
 
 	. = ALIGN(4);
 	.u_boot_list : {
-	#include <u-boot.lst>
+		#include <u-boot.lst>
 	}
 
 	. = ALIGN(4);
 
+	__image_copy_end = .;
+
 	.rel.dyn : {
 		__rel_dyn_start = .;
 		*(.rel*)
@@ -62,14 +64,14 @@  SECTIONS
 
 	.dynsym : {
 		__dynsym_start = .;
-		*(.dynsym)
+		*(.dynsym*)
 	}
 
 	_end = .;
 
 	.bss __rel_dyn_start (OVERLAY) : {
 		__bss_start = .;
-		*(.bss)
+		*(.bss*)
 		 . = ALIGN(4);
 		__bss_end__ = .;
 	}
diff --git a/board/karo/tx25/Makefile b/board/karo/tx25/Makefile
index 9617fa5..cf83a6b 100644
--- a/board/karo/tx25/Makefile
+++ b/board/karo/tx25/Makefile
@@ -25,8 +25,11 @@  include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
-COBJS	:= tx25.o
+ifdef CONFIG_SPL_BUILD
 SOBJS	:= lowlevel_init.o
+else
+COBJS	:= tx25.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
diff --git a/board/karo/tx25/config.mk b/board/karo/tx25/config.mk
deleted file mode 100644
index 18b2883..0000000
--- a/board/karo/tx25/config.mk
+++ /dev/null
@@ -1,5 +0,0 @@ 
-ifdef CONFIG_NAND_SPL
-CONFIG_SYS_TEXT_BASE = 0x810c0000
-else
-CONFIG_SYS_TEXT_BASE = 0x81200000
-endif
diff --git a/nand_spl/board/freescale/mx31pdk/u-boot.lds b/board/karo/tx25/u-boot-spl.lds
similarity index 89%
rename from nand_spl/board/freescale/mx31pdk/u-boot.lds
rename to board/karo/tx25/u-boot-spl.lds
index a26110f..0d7f140 100644
--- a/nand_spl/board/freescale/mx31pdk/u-boot.lds
+++ b/board/karo/tx25/u-boot-spl.lds
@@ -30,19 +30,19 @@  SECTIONS
 	. = ALIGN(4);
 	.text :
 	{
-		start.o			(.text)
-		lowlevel_init.o		(.text)
-		nand_boot_fsl_nfc.o	(.text)
-		*(.text)
+		arch/arm/cpu/arm926ejs/start.o	(.text*)
+		board/karo/tx25/libtx25.o	(.text*)
+		drivers/mtd/nand/libnand.o	(.text*)
+		*(.text*)
 		. = 2K;
 	}
 
 	. = ALIGN(4);
-	.rodata : { *(.rodata) }
+	.rodata : { *(.rodata*) }
 
 	. = ALIGN(4);
 	.data : {
-		*(.data)
+		*(.data*)
 	}
 
 	. = ALIGN(4);
@@ -64,14 +64,14 @@  SECTIONS
 
 	.dynsym : {
 		__dynsym_start = .;
-		*(.dynsym)
+		*(.dynsym*)
 	}
 
 	_end = .;
 
 	.bss __rel_dyn_start (OVERLAY) : {
 		__bss_start = .;
-		*(.bss)
+		*(.bss*)
 		 . = ALIGN(4);
 		__bss_end__ = .;
 	}
diff --git a/boards.cfg b/boards.cfg
index 7d03620..2649c88 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -45,7 +45,7 @@  imx31_phycore                arm         arm1136     -                   -
 imx31_phycore_eet            arm         arm1136     imx31_phycore       -              mx31         imx31_phycore:IMX31_PHYCORE_EET
 qong                         arm         arm1136     -                   davedenx       mx31
 mx31ads                      arm         arm1136     -                   freescale      mx31
-mx31pdk                      arm         arm1136     -                   freescale      mx31         mx31pdk:NAND_U_BOOT
+mx31pdk                      arm         arm1136     -                   freescale      mx31
 tt01                         arm         arm1136     -                   hale           mx31
 imx31_litekit                arm         arm1136     -                   logicpd        mx31
 flea3                        arm         arm1136     -                   CarMediaLab    mx35
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index c77c0c4..bcb7161 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -82,6 +82,7 @@  COBJS-$(CONFIG_NAND_PLAT) += nand_plat.o
 else  # minimal SPL drivers
 
 COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_spl.o
+COBJS-$(CONFIG_NAND_MXC) += mxc_nand_spl.o
 
 endif # drivers
 endif # nand
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 001c2c0..159e3b4 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -26,7 +26,7 @@ 
 	defined(CONFIG_MX51) || defined(CONFIG_MX53)
 #include <asm/arch/imx-regs.h>
 #endif
-#include <fsl_nfc.h>
+#include "mxc_nand.h"
 
 #define DRIVER_NAME "mxc_nand"
 
@@ -36,9 +36,9 @@  struct mxc_nand_host {
 	struct mtd_info			mtd;
 	struct nand_chip		*nand;
 
-	struct fsl_nfc_regs __iomem	*regs;
+	struct mxc_nand_regs __iomem	*regs;
 #ifdef MXC_NFC_V3_2
-	struct fsl_nfc_ip_regs __iomem	*ip_regs;
+	struct mxc_nand_ip_regs __iomem	*ip_regs;
 #endif
 	int				spare_only;
 	int				status_request;
@@ -1254,10 +1254,10 @@  int board_nand_init(struct nand_chip *this)
 	this->read_buf = mxc_nand_read_buf;
 	this->verify_buf = mxc_nand_verify_buf;
 
-	host->regs = (struct fsl_nfc_regs __iomem *)CONFIG_MXC_NAND_REGS_BASE;
+	host->regs = (struct mxc_nand_regs __iomem *)CONFIG_MXC_NAND_REGS_BASE;
 #ifdef MXC_NFC_V3_2
 	host->ip_regs =
-		(struct fsl_nfc_ip_regs __iomem *)CONFIG_MXC_NAND_IP_REGS_BASE;
+		(struct mxc_nand_ip_regs __iomem *)CONFIG_MXC_NAND_IP_REGS_BASE;
 #endif
 	host->clk_act = 1;
 
diff --git a/include/fsl_nfc.h b/drivers/mtd/nand/mxc_nand.h
similarity index 98%
rename from include/fsl_nfc.h
rename to drivers/mtd/nand/mxc_nand.h
index 48a6448..308ff8d 100644
--- a/include/fsl_nfc.h
+++ b/drivers/mtd/nand/mxc_nand.h
@@ -20,8 +20,8 @@ 
  * MA 02111-1307 USA
  */
 
-#ifndef __FSL_NFC_H
-#define __FSL_NFC_H
+#ifndef __MXC_NAND_H
+#define __MXC_NAND_H
 
 /*
  * Register map and bit definitions for the Freescale NAND Flash Controller
@@ -73,7 +73,7 @@ 
 #define NAND_MXC_REG_OFFSET		0x1e00
 #endif
 
-struct fsl_nfc_regs {
+struct mxc_nand_regs {
 	u8 main_area[NAND_MXC_NR_BUFS][0x200];
 	u8 spare_area[NAND_MXC_NR_BUFS][NAND_MXC_SPARE_BUF_SIZE];
 	/*
@@ -131,7 +131,7 @@  struct fsl_nfc_regs {
 };
 
 #ifdef MXC_NFC_V3_2
-struct fsl_nfc_ip_regs {
+struct mxc_nand_ip_regs {
 	u32 wrprot;
 	u32 wrprot_unlock_blkaddr[8];
 	u32 config2;
@@ -222,4 +222,4 @@  struct fsl_nfc_ip_regs {
 #define writenfc	writel
 #endif
 
-#endif /* __FSL_NFC_H */
+#endif /* __MXC_NAND_H */
diff --git a/nand_spl/nand_boot_fsl_nfc.c b/drivers/mtd/nand/mxc_nand_spl.c
similarity index 92%
rename from nand_spl/nand_boot_fsl_nfc.c
rename to drivers/mtd/nand/mxc_nand_spl.c
index 1096727..5f7108d 100644
--- a/nand_spl/nand_boot_fsl_nfc.c
+++ b/drivers/mtd/nand/mxc_nand_spl.c
@@ -28,13 +28,13 @@ 
 #include <nand.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/io.h>
-#include <fsl_nfc.h>
+#include "mxc_nand.h"
 
 #if defined(MXC_NFC_V1) || defined(MXC_NFC_V2_1)
-static struct fsl_nfc_regs *const nfc = (void *)NFC_BASE_ADDR;
+static struct mxc_nand_regs *const nfc = (void *)NFC_BASE_ADDR;
 #elif defined(MXC_NFC_V3_2)
-static struct fsl_nfc_regs *const nfc = (void *)NFC_BASE_ADDR_AXI;
-static struct fsl_nfc_ip_regs *const nfc_ip = (void *)NFC_BASE_ADDR;
+static struct mxc_nand_regs *const nfc = (void *)NFC_BASE_ADDR_AXI;
+static struct mxc_nand_ip_regs *const nfc_ip = (void *)NFC_BASE_ADDR;
 #endif
 
 static void nfc_wait_ready(void)
@@ -68,7 +68,7 @@  static void nfc_nand_init(void)
 
 	tmp = (readnfc(&nfc_ip->config2) & ~(NFC_V3_CONFIG2_SPAS_MASK |
 			NFC_V3_CONFIG2_EDC_MASK | NFC_V3_CONFIG2_PS_MASK)) |
-		NFC_V3_CONFIG2_SPAS(CONFIG_SYS_NAND_SPARE_SIZE / 2) |
+		NFC_V3_CONFIG2_SPAS(CONFIG_SYS_NAND_OOBSIZE / 2) |
 		NFC_V3_CONFIG2_INT_MSK | NFC_V3_CONFIG2_ECC_EN |
 		NFC_V3_CONFIG2_ONE_CYCLE;
 	if (CONFIG_SYS_NAND_PAGE_SIZE == 4096)
@@ -81,7 +81,7 @@  static void nfc_nand_init(void)
 	 * if spare size is larger that 16 bytes per 512 byte hunk
 	 * then use 8 symbol correction instead of 4
 	 */
-	if (CONFIG_SYS_NAND_SPARE_SIZE / ecc_per_page > 16)
+	if (CONFIG_SYS_NAND_OOBSIZE / ecc_per_page > 16)
 		tmp |= NFC_V3_CONFIG2_ECC_MODE_8;
 	else
 		tmp &= ~NFC_V3_CONFIG2_ECC_MODE_8;
@@ -102,7 +102,7 @@  static void nfc_nand_init(void)
 	int ecc_per_page = CONFIG_SYS_NAND_PAGE_SIZE / 512;
 	int config1;
 
-	writenfc(CONFIG_SYS_NAND_SPARE_SIZE / 2, &nfc->spare_area_size);
+	writenfc(CONFIG_SYS_NAND_OOBSIZE / 2, &nfc->spare_area_size);
 
 	/* unlocking RAM Buff */
 	writenfc(0x2, &nfc->config);
@@ -115,7 +115,7 @@  static void nfc_nand_init(void)
 	 * if spare size is larger that 16 bytes per 512 byte hunk
 	 * then use 8 symbol correction instead of 4
 	 */
-	if (CONFIG_SYS_NAND_SPARE_SIZE / ecc_per_page > 16)
+	if (CONFIG_SYS_NAND_OOBSIZE / ecc_per_page > 16)
 		config1 &= ~NFC_V2_CONFIG1_ECC_MODE_4;
 	else
 		config1 |= NFC_V2_CONFIG1_ECC_MODE_4;
@@ -204,7 +204,7 @@  static int nfc_nand_check_ecc(void)
 #elif defined(MXC_NFC_V2_1) || defined(MXC_NFC_V3_2)
 	u32 ecc_status = readl(&nfc->ecc_status_result);
 	int ecc_per_page = CONFIG_SYS_NAND_PAGE_SIZE / 512;
-	int err_limit = CONFIG_SYS_NAND_SPARE_SIZE / ecc_per_page > 16 ? 8 : 4;
+	int err_limit = CONFIG_SYS_NAND_OOBSIZE / ecc_per_page > 16 ? 8 : 4;
 	int subpages = CONFIG_SYS_NAND_PAGE_SIZE / 512;
 
 	do {
@@ -333,10 +333,12 @@  static int nand_load(unsigned int from, unsigned int size, unsigned char *buf)
 }
 
 #if defined(CONFIG_ARM)
-void board_init_f (ulong bootflag)
+void board_init_f(ulong bootflag)
 {
-	relocate_code (CONFIG_SYS_TEXT_BASE - TOTAL_MALLOC_LEN, NULL,
-		       CONFIG_SYS_TEXT_BASE);
+	relocate_code(CONFIG_SPL_TEXT_BASE - TOTAL_MALLOC_LEN, NULL,
+		      CONFIG_SPL_TEXT_BASE);
+
+	asm volatile("ldr pc, =nand_boot\n");
 }
 #endif
 
diff --git a/include/common.h b/include/common.h
index 4ad17ea..43a5ee4 100644
--- a/include/common.h
+++ b/include/common.h
@@ -515,7 +515,11 @@  int	dcache_status (void);
 void	dcache_enable (void);
 void	dcache_disable(void);
 void	mmu_disable(void);
-void	relocate_code (ulong, gd_t *, ulong) __attribute__ ((noreturn));
+void	relocate_code (ulong, gd_t *, ulong)
+#if !defined(CONFIG_ARM)
+__attribute__ ((noreturn))
+#endif
+;
 ulong	get_endaddr   (void);
 void	trap_init     (ulong);
 #if defined (CONFIG_4xx)	|| \
diff --git a/include/configs/mx31pdk.h b/include/configs/mx31pdk.h
index 34e4295..8892e89 100644
--- a/include/configs/mx31pdk.h
+++ b/include/configs/mx31pdk.h
@@ -45,7 +45,15 @@ 
 
 #define CONFIG_MACH_TYPE	MACH_TYPE_MX31_3DS
 
-#if defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
+#define CONFIG_SPL
+#define CONFIG_SPL_TARGET	"u-boot-with-spl.bin"
+#define CONFIG_SPL_MAX_SIZE	2048
+#define CONFIG_SPL_NAND_SUPPORT
+
+#define CONFIG_SPL_TEXT_BASE	0x87ec0000
+#define CONFIG_SYS_TEXT_BASE	0x87f00000
+
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #endif
 
diff --git a/include/configs/tx25.h b/include/configs/tx25.h
index 80194d8..e362fe9 100644
--- a/include/configs/tx25.h
+++ b/include/configs/tx25.h
@@ -31,8 +31,13 @@ 
 
 #define	CONFIG_SYS_MONITOR_LEN		(256 << 10)	/* 256 kB for U-Boot */
 
-/* NAND BOOT is the only boot method */
-#define CONFIG_NAND_U_BOOT
+#define CONFIG_SPL
+#define CONFIG_SPL_TARGET		"u-boot-with-spl.bin"
+#define CONFIG_SPL_MAX_SIZE		2048
+#define CONFIG_SPL_NAND_SUPPORT
+
+#define CONFIG_SPL_TEXT_BASE		0x810c0000
+#define CONFIG_SYS_TEXT_BASE		0x81200000
 
 #ifndef MACH_TYPE_TX25
 #define MACH_TYPE_TX25	2177
@@ -40,7 +45,7 @@ 
 
 #define CONFIG_MACH_TYPE MACH_TYPE_TX25
 
-#ifdef CONFIG_NAND_SPL
+#ifdef CONFIG_SPL_BUILD
 /* Start copying real U-boot from the second page */
 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x800
 #define CONFIG_SYS_NAND_U_BOOT_SIZE	0x30000
@@ -49,7 +54,7 @@ 
 #define CONFIG_SYS_NAND_U_BOOT_START    CONFIG_SYS_NAND_U_BOOT_DST
 
 #define CONFIG_SYS_NAND_PAGE_SIZE	2048
-#define CONFIG_SYS_NAND_SPARE_SIZE	64
+#define CONFIG_SYS_NAND_OOBSIZE		64
 #define CONFIG_SYS_NAND_BLOCK_SIZE	(128 * 1024)
 #define CONFIG_SYS_NAND_PAGE_COUNT	64
 #define CONFIG_SYS_NAND_SIZE		(128 * 1024 * 1024)
diff --git a/include/configs/woodburn_sd.h b/include/configs/woodburn_sd.h
index 63185c5..1cc0e95 100644
--- a/include/configs/woodburn_sd.h
+++ b/include/configs/woodburn_sd.h
@@ -38,6 +38,7 @@ 
 #define	CONFIG_SPL
 #define CONFIG_SPL_FRAMEWORK
 #define	CONFIG_SPL_LDSCRIPT	"arch/arm/cpu/arm1136/u-boot-spl.lds"
+#define CONFIG_SPL_TARGET	"SPL"
 #define	CONFIG_SPL_LIBCOMMON_SUPPORT
 #define	CONFIG_SPL_LIBGENERIC_SUPPORT
 #define CONFIG_SPL_LIBDISK_SUPPORT
diff --git a/nand_spl/board/freescale/mx31pdk/Makefile b/nand_spl/board/freescale/mx31pdk/Makefile
deleted file mode 100644
index fd0dfc1..0000000
--- a/nand_spl/board/freescale/mx31pdk/Makefile
+++ /dev/null
@@ -1,68 +0,0 @@ 
-CONFIG_NAND_SPL	= y
-PAD_TO	:= 2048
-
-include $(TOPDIR)/config.mk
-
-nandobj	:= $(OBJTREE)/nand_spl/
-
-LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
-LSTSCRIPT= $(nandobj)/board/$(BOARDDIR)/u-boot.lst
-LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
-	   $(LDFLAGS_FINAL)
-AFLAGS	+= -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
-CFLAGS	+= -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
-
-SOBJS	= start.o crt0.o lowlevel_init.o
-COBJS	= nand_boot_fsl_nfc.o
-
-SRCS	:= $(SRCTREE)/nand_spl/nand_boot_fsl_nfc.c
-SRCS	+= $(SRCTREE)/arch/arm/cpu/arm1136/start.S
-SRCS	+= $(SRCTREE)/arch/arm/lib/crt0.S
-SRCS	+= $(SRCTREE)/board/freescale/mx31pdk/lowlevel_init.S
-OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
-__OBJS	:= $(SOBJS) $(COBJS)
-LNDIR	:= $(nandobj)board/$(BOARDDIR)
-
-ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
-
-all:	$(obj).depend $(ALL)
-
-$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
-	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
-
-$(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl
-	$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
-
-$(nandobj)u-boot-spl:	$(OBJS) $(nandobj)u-boot.lds
-	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
-		-Map $(nandobj)u-boot-spl.map \
-		-o $@
-
-# The following line expands into whole rule which generates $(LSTSCRIPT),
-# the file containing u-boots LG-array linker section. This is included into
-# $(LDSCRIPT). The function make_u_boot_list is defined in helper.mk file.
-$(eval $(call make_u_boot_list, $(LSTSCRIPT), $(OBJS)))
-$(nandobj)u-boot.lds: $(LDSCRIPT) $(LSTSCRIPT)
-	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
-		-ansi -D__ASSEMBLY__ -P - <$< >$@
-
-#########################################################################
-
-$(obj)%.o:	$(SRCTREE)/arch/arm/cpu/arm1136/%.S
-	$(CC) $(AFLAGS) -c -o $@ $<
-
-$(obj)%.o:	$(SRCTREE)/arch/arm/lib/%.S
-	$(CC) $(AFLAGS) -c -o $@ $<
-
-$(obj)%.o:	$(SRCTREE)/board/freescale/mx31pdk/%.S
-	$(CC) $(AFLAGS) -c -o $@ $<
-
-$(obj)%.o:	$(SRCTREE)/nand_spl/%.c
-	$(CC) $(CFLAGS) -c -o $@ $<
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/nand_spl/board/karo/tx25/Makefile b/nand_spl/board/karo/tx25/Makefile
deleted file mode 100644
index 82489d2..0000000
--- a/nand_spl/board/karo/tx25/Makefile
+++ /dev/null
@@ -1,89 +0,0 @@ 
-#
-# (C) Copyright 2009 DENX Software Engineering
-#
-# 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 Foundatio; 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
-#
-CONFIG_NAND_SPL	= y
-
-include $(TOPDIR)/config.mk
-include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
-
-nandobj	:= $(OBJTREE)/nand_spl/
-
-LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
-LSTSCRIPT= $(nandobj)/board/$(BOARDDIR)/u-boot.lst
-LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
-	   $(LDFLAGS_FINAL)
-AFLAGS	+= -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
-CFLAGS	+= -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
-
-SOBJS	= start.o crt0.o lowlevel_init.o
-COBJS	= nand_boot_fsl_nfc.o
-
-SRCS	:= $(SRCTREE)/nand_spl/nand_boot_fsl_nfc.c
-SRCS	+= $(SRCTREE)/arch/arm/cpu/arm926ejs/start.S
-SRCS	+= $(SRCTREE)/arch/arm/lib/crt0.S
-SRCS	+= $(SRCTREE)/board/karo/tx25/lowlevel_init.S
-OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
-__OBJS	:= $(SOBJS) $(COBJS)
-LNDIR	:= $(nandobj)board/$(BOARDDIR)
-
-ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
-
-all:	$(obj).depend $(ALL)
-
-$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
-	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
-
-$(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl
-	$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
-
-$(nandobj)u-boot-spl:	$(OBJS) $(nandobj)u-boot.lds
-	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
-		-Map $(nandobj)u-boot-spl.map \
-		-o $@
-
-# The following line expands into whole rule which generates $(LSTSCRIPT),
-# the file containing u-boots LG-array linker section. This is included into
-# $(LDSCRIPT). The function make_u_boot_list is defined in helper.mk file.
-$(eval $(call make_u_boot_list, $(LSTSCRIPT), $(OBJS)))
-$(nandobj)u-boot.lds: $(LDSCRIPT) $(LSTSCRIPT)
-	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
-		-ansi -D__ASSEMBLY__ -P - <$< >$@
-
-#########################################################################
-
-$(obj)%.o:	$(SRCTREE)/arch/arm/cpu/arm926ejs/%.S
-	$(CC) $(AFLAGS) -c -o $@ $<
-
-$(obj)%.o:	$(SRCTREE)/arch/arm/lib/%.S
-	$(CC) $(AFLAGS) -c -o $@ $<
-
-$(obj)%.o:	$(SRCTREE)/board/karo/tx25/%.S
-	$(CC) $(AFLAGS) -c -o $@ $<
-
-$(obj)%.o:	$(SRCTREE)/nand_spl/%.c
-	$(CC) $(CFLAGS) -c -o $@ $<
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
diff --git a/nand_spl/board/karo/tx25/config.mk b/nand_spl/board/karo/tx25/config.mk
deleted file mode 100644
index 68afbf1..0000000
--- a/nand_spl/board/karo/tx25/config.mk
+++ /dev/null
@@ -1 +0,0 @@ 
-PAD_TO	:= 2048