mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v3] Add new ARM entry point for barebox
@ 2013-02-03 15:03 Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:03 UTC (permalink / raw)
  To: barebox

Third version. I update at91 and test it on all at91 core

Best Regards,
J.

Second version. I updated the series to current -next. Besides, I dropped
the board reserved memory chunk at the end of SDRAM as it does not work
for configurations which run in tight SRAM. Boards are now required to
reserve some memory themselves and skip this area from barebox_arm_entry
should they need some space.

This version is compile tested only currently. My plan is to do some
additional runtime tests on Monday when I'm back from the FOSDEM and
apply it afterwards. So I won't apply any patches conflicting to this
series before applying this one.

Sascha

The following changes since commit 531c3cd6adcea6b874772221f2f7787472550cee:

  at91sam9_ddrsdr: fix register on mdr read and sdram detection for ddr size (2013-02-03 08:27:57 +0800)

are available in the git repository at:

  git://git.jcrosoft.org/barebox.git delivery/arm-entry

for you to fetch changes up to cd5f8e8aaf808ae19e7c1d2890f90f7de809a2c5:

  ARM pbl: inline decompress function (2013-02-03 08:27:59 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (3):
      ARM AT91: switch at91sam9g45 to barebox_arm_entry
      ARM AT91: switch at91sam9x5 to barebox_arm_entry
      ARM AT91: switch at91sam9n12 to barebox_arm_entry

Sascha Hauer (33):
      ARM: Add new entry point for barebox
      ARM: add __noreturn to board_init_lowlevel_return
      ARM i.MX: Use SRAM stack in lowlevel code
      ARM i.MX: Add i.MX specific entry point for barebox
      ARM i.MX: prepare external nand boot for SoC specific entry
      ARM i.MX boards: switch to barebox_arm_entry
      ARM MXS boards: switch to barebox_arm_entry
      ARM OMAP boards: switch to barebox_arm_entry
      ARM Samsung boards: switch to barebox_arm_entry
      ARM PXA boards: switch to barebox_arm_entry
      ARM ep93xx boards: switch to barebox_arm_entry
      ARM tegra boards: switch to barebox_arm_entry
      ARM nomadik boards: switch to barebox_arm_entry
      ARM versatile boards: switch to barebox_arm_entry
      ARM netx boards: switch to barebox_arm_entry
      ARM clep7212: switch to barebox_arm_entry
      ARM raspberrypi: switch to barebox_arm_entry
      ARM AT91: switch at91sam9 to barebox_arm_entry part1
      ARM AT91: switch at91rm9200 board to barebox_arm_entry
      ARM AT91: switch sama5d3 to barebox_arm_entry
      ARM: remove now unused MACH_[HAS|DO]_LOWLEVEL_INIT
      ARM start-pbl: make board_init_lowlevel_return static
      ARM start-pbl: call uncompressed binary with arguments
      ARM start: pickup parameters from pbl
      ARM: Setup stack at end of SDRAM
      ARM pbl: Use dynamic parameters for early malloc space
      ARM mmu: pickup already enabled mmu
      ARM: Factor out early mmu code
      ARM: Enable mmu early
      ARM: Automatically determine malloc size
      generic memory layout: fix deps for [MALLOC|STACK]_BASE
      ARM: disable HAVE_CONFIGURABLE_MEMORY_LAYOUT
      ARM pbl: inline decompress function

 arch/arm/Kconfig                                       |    1 -
 arch/arm/boards/a9m2410/lowlevel_init.S                |    9 +++++++--
 arch/arm/boards/a9m2440/lowlevel_init.S                |    9 +++++++--
 arch/arm/boards/archosg9/Makefile                      |    4 ++--
 arch/arm/boards/archosg9/lowlevel.c                    |    3 ++-
 arch/arm/boards/at91sam9261ek/Makefile                 |    4 ++--
 arch/arm/boards/at91sam9263ek/Makefile                 |    4 ++--
 arch/arm/boards/beagle/lowlevel.c                      |   16 ++++++++++++++--
 arch/arm/boards/beaglebone/Makefile                    |    2 ++
 arch/arm/boards/beaglebone/lowlevel.c                  |   12 +++++++++++-
 arch/arm/boards/ccxmx51/Makefile                       |    2 ++
 arch/arm/boards/ccxmx51/lowlevel.c                     |    9 +++++++++
 arch/arm/boards/chumby_falconwing/Makefile             |    2 ++
 arch/arm/boards/chumby_falconwing/lowlevel.c           |   11 +++++++++++
 arch/arm/boards/clep7212/lowlevel.c                    |    3 ++-
 arch/arm/boards/crystalfontz-cfa10036/Makefile         |    2 ++
 arch/arm/boards/crystalfontz-cfa10036/lowlevel.c       |   11 +++++++++++
 arch/arm/boards/edb93xx/sdram_cfg.c                    |    4 ++++
 arch/arm/boards/efika-mx-smartbook/Makefile            |    2 ++
 arch/arm/boards/efika-mx-smartbook/lowlevel.c          |    9 +++++++++
 arch/arm/boards/eukrea_cpuimx25/lowlevel.c             |    6 +++---
 arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S        |    7 ++++---
 arch/arm/boards/eukrea_cpuimx35/lowlevel.c             |    8 ++++----
 arch/arm/boards/eukrea_cpuimx51/Makefile               |    2 ++
 arch/arm/boards/eukrea_cpuimx51/lowlevel.c             |    9 +++++++++
 arch/arm/boards/freescale-mx23-evk/Makefile            |    2 ++
 arch/arm/boards/freescale-mx23-evk/lowlevel.c          |   11 +++++++++++
 arch/arm/boards/freescale-mx25-3-stack/lowlevel_init.S |    7 ++++---
 arch/arm/boards/freescale-mx28-evk/Makefile            |    2 ++
 arch/arm/boards/freescale-mx28-evk/lowlevel.c          |   11 +++++++++++
 arch/arm/boards/freescale-mx35-3-stack/3stack.c        |    1 +
 arch/arm/boards/freescale-mx35-3-stack/lowlevel_init.S |    7 ++++---
 arch/arm/boards/freescale-mx51-pdk/Makefile            |    2 ++
 arch/arm/boards/freescale-mx51-pdk/lowlevel.c          |    9 +++++++++
 arch/arm/boards/freescale-mx53-loco/Makefile           |    2 ++
 arch/arm/boards/freescale-mx53-loco/lowlevel.c         |    9 +++++++++
 arch/arm/boards/freescale-mx53-smd/Makefile            |    2 ++
 arch/arm/boards/freescale-mx53-smd/lowlevel.c          |    9 +++++++++
 arch/arm/boards/freescale-mx6-arm2/Makefile            |    2 ++
 arch/arm/boards/freescale-mx6-arm2/lowlevel.c          |   10 ++++++++++
 arch/arm/boards/freescale-mx6-sabrelite/Makefile       |    2 ++
 arch/arm/boards/freescale-mx6-sabrelite/lowlevel.c     |   10 ++++++++++
 arch/arm/boards/friendlyarm-mini2440/lowlevel_init.S   |    9 +++++++--
 arch/arm/boards/friendlyarm-mini6410/Makefile          |    2 ++
 arch/arm/boards/friendlyarm-mini6410/lowlevel.c        |   11 +++++++++++
 arch/arm/boards/friendlyarm-tiny210/lowlevel.c         |    4 +++-
 arch/arm/boards/friendlyarm-tiny6410/Makefile          |    3 ++-
 arch/arm/boards/friendlyarm-tiny6410/lowlevel.c        |   11 +++++++++++
 arch/arm/boards/guf-cupid/lowlevel.c                   |    8 ++++----
 arch/arm/boards/guf-neso/lowlevel.c                    |    8 ++++----
 arch/arm/boards/guf-vincell/lowlevel.c                 |    5 +++--
 arch/arm/boards/imx21ads/imx21ads.c                    |    3 ++-
 arch/arm/boards/imx21ads/lowlevel_init.S               |   11 ++++++++---
 arch/arm/boards/imx233-olinuxino/Makefile              |    2 ++
 arch/arm/boards/imx233-olinuxino/lowlevel.c            |   11 +++++++++++
 arch/arm/boards/imx27ads/lowlevel_init.S               |    4 ++--
 arch/arm/boards/karo-tx25/lowlevel.c                   |   10 ++++++----
 arch/arm/boards/karo-tx28/Makefile                     |    2 ++
 arch/arm/boards/karo-tx28/lowlevel.c                   |   11 +++++++++++
 arch/arm/boards/karo-tx51/Makefile                     |    2 ++
 arch/arm/boards/karo-tx51/lowlevel.c                   |    9 +++++++++
 arch/arm/boards/karo-tx53/lowlevel.c                   |    6 ++----
 arch/arm/boards/mioa701/Makefile                       |    2 ++
 arch/arm/boards/mioa701/lowlevel.c                     |   10 ++++++++++
 arch/arm/boards/mmccpu/Makefile                        |    4 ++--
 arch/arm/boards/netx/platform.S                        |    7 +++++--
 arch/arm/boards/nhk8815/Makefile                       |    2 ++
 arch/arm/boards/nhk8815/lowlevel.c                     |   10 ++++++++++
 arch/arm/boards/omap343xdsp/lowlevel.c                 |   15 +++++++++++++--
 arch/arm/boards/omap3evm/lowlevel.c                    |   13 +++++++++++--
 arch/arm/boards/panda/lowlevel.c                       |    7 ++++---
 arch/arm/boards/pcm027/lowlevel_init.S                 |    7 +++++--
 arch/arm/boards/pcm037/lowlevel.c                      |    6 +++---
 arch/arm/boards/pcm038/lowlevel.c                      |    8 +++++---
 arch/arm/boards/pcm043/lowlevel.c                      |    8 ++++----
 arch/arm/boards/pcm049/lowlevel.c                      |    7 ++++---
 arch/arm/boards/pcm051/Makefile                        |    2 ++
 arch/arm/boards/pcm051/lowlevel.c                      |   11 +++++++++++
 arch/arm/boards/phycard-a-l1/lowlevel.c                |   12 ++++++++++--
 arch/arm/boards/phycard-a-xl2/lowlevel.c               |    7 ++++---
 arch/arm/boards/phycard-i.MX27/lowlevel_init.S         |    4 ++--
 arch/arm/boards/pm9261/Makefile                        |    4 ++--
 arch/arm/boards/pm9263/Makefile                        |    4 ++--
 arch/arm/boards/raspberry-pi/Makefile                  |    2 ++
 arch/arm/boards/raspberry-pi/lowlevel.c                |   11 +++++++++++
 arch/arm/boards/scb9328/lowlevel_init.S                |    4 ++--
 arch/arm/boards/tny-a926x/Makefile                     |    4 ++--
 arch/arm/boards/toshiba-ac100/Makefile                 |    2 ++
 arch/arm/boards/toshiba-ac100/lowlevel.c               |   10 ++++++++++
 arch/arm/boards/tqma53/Makefile                        |    2 ++
 arch/arm/boards/tqma53/lowlevel.c                      |    9 +++++++++
 arch/arm/boards/usb-a926x/Makefile                     |    4 ++--
 arch/arm/boards/versatile/Makefile                     |    3 ++-
 arch/arm/boards/versatile/lowlevel.c                   |   10 ++++++++++
 arch/arm/configs/archosg9_defconfig                    |    1 -
 arch/arm/configs/phycard_a_l1_defconfig                |    2 --
 arch/arm/cpu/Makefile                                  |    4 ++--
 arch/arm/cpu/cpu.c                                     |   12 ++++++++++++
 arch/arm/cpu/mmu-early.c                               |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/cpu/mmu-early.h                               |    6 ++++++
 arch/arm/cpu/mmu.c                                     |    9 ++++++++-
 arch/arm/cpu/start-pbl.c                               |  163 +++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------
 arch/arm/cpu/start.c                                   |  107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------
 arch/arm/include/asm/barebox-arm.h                     |    4 +++-
 arch/arm/lib/Makefile                                  |    1 -
 arch/arm/lib/arm.c                                     |   14 --------------
 arch/arm/mach-at91/Kconfig                             |   19 +++++++++----------
 arch/arm/mach-at91/Makefile                            |   11 ++++++++---
 arch/arm/mach-at91/at91rm9200_lowlevel_init.c          |    2 +-
 arch/arm/mach-at91/at91sam9260_lowlevel_init.c         |    2 ++
 arch/arm/mach-at91/at91sam9261_lowlevel_init.c         |    2 ++
 arch/arm/mach-at91/at91sam9263_lowlevel_init.c         |    2 ++
 arch/arm/mach-at91/at91sam926x_lowlevel_init.c         |    7 ++-----
 arch/arm/mach-at91/at91sam9g45_lowlevel_init.c         |   26 ++++++++++++++++++++++++++
 arch/arm/mach-at91/at91sam9n12_lowlevel_init.c         |   26 ++++++++++++++++++++++++++
 arch/arm/mach-at91/at91sam9x5_lowlevel_init.c          |   26 ++++++++++++++++++++++++++
 arch/arm/mach-at91/include/mach/at91_lowlevel_init.h   |    5 +++++
 arch/arm/mach-at91/sama5d3_lowlevel_init.c             |   25 +++++++++++++++++++++++++
 arch/arm/mach-clps711x/Kconfig                         |    2 --
 arch/arm/mach-ep93xx/Kconfig                           |    8 --------
 arch/arm/mach-ep93xx/Makefile                          |    4 ++--
 arch/arm/mach-ep93xx/lowlevel_init.S                   |   11 ++++++++++-
 arch/arm/mach-imx/Kconfig                              |   17 -----------------
 arch/arm/mach-imx/Makefile                             |    5 ++++-
 arch/arm/mach-imx/esdctl.c                             |  136 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------
 arch/arm/mach-imx/external-nand-boot.c                 |   74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------
 arch/arm/mach-imx/include/mach/esdctl.h                |   11 +++++++++++
 arch/arm/mach-imx/include/mach/imx-nand.h              |    1 -
 arch/arm/mach-imx/include/mach/imx21-regs.h            |    1 +
 arch/arm/mach-imx/include/mach/imx25-regs.h            |    3 +++
 arch/arm/mach-imx/include/mach/imx27-regs.h            |    1 +
 arch/arm/mach-imx/include/mach/imx31-regs.h            |    3 +++
 arch/arm/mach-netx/Kconfig                             |    1 -
 arch/arm/mach-omap/Kconfig                             |    5 -----
 arch/arm/mach-omap/arch-omap.dox                       |    1 -
 arch/arm/mach-omap/include/mach/omap3-silicon.h        |    1 +
 arch/arm/mach-omap/omap3_core.S                        |   11 ++++-------
 arch/arm/mach-pxa/Kconfig                              |    1 -
 arch/arm/mach-samsung/Kconfig                          |    6 ------
 arch/arm/pbl/zbarebox.lds.S                            |    8 ++++----
 common/Kconfig                                         |   21 +++++++++------------
 common/meminfo.c                                       |    5 -----
 include/asm-generic/memory_layout.h                    |    6 ++----
 143 files changed, 1064 insertions(+), 400 deletions(-)
 create mode 100644 arch/arm/boards/ccxmx51/lowlevel.c
 create mode 100644 arch/arm/boards/chumby_falconwing/lowlevel.c
 create mode 100644 arch/arm/boards/crystalfontz-cfa10036/lowlevel.c
 create mode 100644 arch/arm/boards/efika-mx-smartbook/lowlevel.c
 create mode 100644 arch/arm/boards/eukrea_cpuimx51/lowlevel.c
 create mode 100644 arch/arm/boards/freescale-mx23-evk/lowlevel.c
 create mode 100644 arch/arm/boards/freescale-mx28-evk/lowlevel.c
 create mode 100644 arch/arm/boards/freescale-mx51-pdk/lowlevel.c
 create mode 100644 arch/arm/boards/freescale-mx53-loco/lowlevel.c
 create mode 100644 arch/arm/boards/freescale-mx53-smd/lowlevel.c
 create mode 100644 arch/arm/boards/freescale-mx6-arm2/lowlevel.c
 create mode 100644 arch/arm/boards/freescale-mx6-sabrelite/lowlevel.c
 create mode 100644 arch/arm/boards/friendlyarm-mini6410/lowlevel.c
 create mode 100644 arch/arm/boards/friendlyarm-tiny6410/lowlevel.c
 create mode 100644 arch/arm/boards/imx233-olinuxino/lowlevel.c
 create mode 100644 arch/arm/boards/karo-tx28/lowlevel.c
 create mode 100644 arch/arm/boards/karo-tx51/lowlevel.c
 create mode 100644 arch/arm/boards/mioa701/lowlevel.c
 create mode 100644 arch/arm/boards/nhk8815/lowlevel.c
 create mode 100644 arch/arm/boards/pcm051/lowlevel.c
 create mode 100644 arch/arm/boards/raspberry-pi/lowlevel.c
 create mode 100644 arch/arm/boards/toshiba-ac100/lowlevel.c
 create mode 100644 arch/arm/boards/tqma53/lowlevel.c
 create mode 100644 arch/arm/boards/versatile/lowlevel.c
 create mode 100644 arch/arm/cpu/mmu-early.c
 create mode 100644 arch/arm/cpu/mmu-early.h
 delete mode 100644 arch/arm/lib/arm.c
 create mode 100644 arch/arm/mach-at91/at91sam9g45_lowlevel_init.c
 create mode 100644 arch/arm/mach-at91/at91sam9n12_lowlevel_init.c
 create mode 100644 arch/arm/mach-at91/at91sam9x5_lowlevel_init.c
 create mode 100644 arch/arm/mach-at91/sama5d3_lowlevel_init.c

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 01/36] ARM: Add new entry point for barebox
  2013-02-03 15:03 [PATCH v3] Add new ARM entry point for barebox Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10 ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 02/36] ARM: add __noreturn to board_init_lowlevel_return Jean-Christophe PLAGNIOL-VILLARD
                     ` (34 more replies)
  0 siblings, 35 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Memory is a precious resource, so it makes sense to make it available as
early as possible. By definition the lowlevel init code already knows where
to find memory because it's the lowlevel init code which sets up the memory.
Until all boards are converted this new entry is just a fallback to the old
entry point.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/start-pbl.c           |   13 +++++++++++++
 arch/arm/cpu/start.c               |   13 +++++++++++++
 arch/arm/include/asm/barebox-arm.h |    1 +
 3 files changed, 27 insertions(+)

diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c
index f506792..f1ce2c5 100644
--- a/arch/arm/cpu/start-pbl.c
+++ b/arch/arm/cpu/start-pbl.c
@@ -183,3 +183,16 @@ void __naked board_init_lowlevel_return(void)
 
 	barebox_uncompress((void *)pg_start, pg_len);
 }
+
+/*
+ * Main ARM entry point in the compressed image. Call this with the memory
+ * region you can spare for barebox. This doesn't necessarily have to be the
+ * full SDRAM. The currently running binary can be inside or outside of this
+ * region. TEXT_BASE can be inside or outside of this region. boarddata will
+ * be preserved and can be accessed later with barebox_arm_boarddata().
+ */
+void __naked __noreturn barebox_arm_entry(uint32_t membase, uint32_t memsize,
+		uint32_t boarddata)
+{
+	board_init_lowlevel_return();
+}
diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index 793445a..0b7eee8 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -63,3 +63,16 @@ void __naked board_init_lowlevel_return(void)
 
 	start_barebox();
 }
+
+/*
+ * Main ARM entry point in the uncompressed image. Call this with the memory
+ * region you can spare for barebox. This doesn't necessarily have to be the
+ * full SDRAM. The currently running binary can be inside or outside of this
+ * region. TEXT_BASE can be inside or outside of this region. boarddata will
+ * be preserved and can be accessed later with barebox_arm_boarddata().
+ */
+void __naked __noreturn barebox_arm_entry(uint32_t membase, uint32_t memsize,
+                uint32_t boarddata)
+{
+	board_init_lowlevel_return();
+}
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 993130d..4ccf938 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -39,5 +39,6 @@ void board_init_lowlevel_return(void);
 uint32_t get_runtime_offset(void);
 
 void setup_c(void);
+void __noreturn barebox_arm_entry(uint32_t membase, uint32_t memsize, uint32_t boarddata);
 
 #endif	/* _BAREBOX_ARM_H_ */
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 02/36] ARM: add __noreturn to board_init_lowlevel_return
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 03/36] ARM i.MX: Use SRAM stack in lowlevel code Jean-Christophe PLAGNIOL-VILLARD
                     ` (33 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/start-pbl.c           |    6 +++---
 arch/arm/cpu/start.c               |    2 +-
 arch/arm/include/asm/barebox-arm.h |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c
index f1ce2c5..da62111 100644
--- a/arch/arm/cpu/start-pbl.c
+++ b/arch/arm/cpu/start-pbl.c
@@ -118,9 +118,9 @@ static void mmu_disable(void)
 	__mmu_cache_off();
 }
 
-static void barebox_uncompress(void *compressed_start, unsigned int len)
+static void __noreturn barebox_uncompress(void *compressed_start, unsigned int len)
 {
-	void (*barebox)(void);
+	void __noreturn (*barebox)(void);
 	/*
 	 * remap_cached currently does not work rendering the feature
 	 * of enabling the MMU in the PBL useless. disable for now.
@@ -155,7 +155,7 @@ static void barebox_uncompress(void *compressed_start, unsigned int len)
  * Board code can jump here by either returning from board_init_lowlevel
  * or by calling this function directly.
  */
-void __naked board_init_lowlevel_return(void)
+void __naked __noreturn board_init_lowlevel_return(void)
 {
 	uint32_t offset;
 	uint32_t pg_start, pg_end, pg_len;
diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index 0b7eee8..f212b61 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -55,7 +55,7 @@ void __naked __bare_init reset(void)
  * Board code can jump here by either returning from board_init_lowlevel
  * or by calling this function directly.
  */
-void __naked board_init_lowlevel_return(void)
+void __naked __noreturn board_init_lowlevel_return(void)
 {
 	arm_setup_stack(STACK_BASE + STACK_SIZE - 16);
 
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 4ccf938..0574f34 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -35,7 +35,7 @@ int	dram_init (void);
 extern char __exceptions_start[], __exceptions_stop[];
 
 void board_init_lowlevel(void);
-void board_init_lowlevel_return(void);
+void __noreturn board_init_lowlevel_return(void);
 uint32_t get_runtime_offset(void);
 
 void setup_c(void);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 03/36] ARM i.MX: Use SRAM stack in lowlevel code
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 02/36] ARM: add __noreturn to board_init_lowlevel_return Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 04/36] ARM i.MX: Add i.MX specific entry point for barebox Jean-Christophe PLAGNIOL-VILLARD
                     ` (32 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Several i.MX boards setup a temporary stack in their lowlevel code.
Instead of using STACK_BASE use a stack in internal SRAM to get rid
of the STACK_BASE compile time dependency.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S        |    3 ++-
 arch/arm/boards/eukrea_cpuimx35/lowlevel.c             |    2 +-
 arch/arm/boards/freescale-mx25-3-stack/lowlevel_init.S |    3 ++-
 arch/arm/boards/freescale-mx35-3-stack/lowlevel_init.S |    3 ++-
 arch/arm/boards/guf-cupid/lowlevel.c                   |    2 +-
 arch/arm/boards/guf-neso/lowlevel.c                    |    2 +-
 arch/arm/boards/imx21ads/lowlevel_init.S               |    3 ++-
 arch/arm/boards/karo-tx25/lowlevel.c                   |    3 ++-
 arch/arm/boards/pcm037/lowlevel.c                      |    2 +-
 arch/arm/boards/pcm038/lowlevel.c                      |    2 +-
 arch/arm/boards/pcm043/lowlevel.c                      |    2 +-
 arch/arm/mach-imx/include/mach/imx21-regs.h            |    1 +
 arch/arm/mach-imx/include/mach/imx25-regs.h            |    3 +++
 arch/arm/mach-imx/include/mach/imx27-regs.h            |    1 +
 arch/arm/mach-imx/include/mach/imx31-regs.h            |    3 +++
 15 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S b/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S
index 4e69aac..287b513 100644
--- a/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S
+++ b/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S
@@ -124,7 +124,8 @@ reset:
 	sdram_init
 
 #ifdef CONFIG_NAND_IMX_BOOT
-	ldr	sp, =STACK_BASE + STACK_SIZE - 12	/* Setup a temporary stack in SDRAM */
+	/* Setup a temporary stack in SDRAM */
+	ldr	sp, =MX27_IRAM_BASE_ADDR + MX27_IRAM_SIZE - 4;
 
 	b	imx27_barebox_boot_nand_external
 #endif /* CONFIG_NAND_IMX_BOOT */
diff --git a/arch/arm/boards/eukrea_cpuimx35/lowlevel.c b/arch/arm/boards/eukrea_cpuimx35/lowlevel.c
index 8f4615a..c43f7fe 100644
--- a/arch/arm/boards/eukrea_cpuimx35/lowlevel.c
+++ b/arch/arm/boards/eukrea_cpuimx35/lowlevel.c
@@ -138,7 +138,7 @@ void __bare_init __naked reset(void)
 	writel(r, MX35_CCM_BASE_ADDR + MX35_CCM_PDR4);
 
 	/* setup a stack to be able to call imx35_barebox_boot_nand_external() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX35_IRAM_BASE_ADDR + MX35_IRAM_SIZE - 8);
 
 	imx35_barebox_boot_nand_external();
 #else
diff --git a/arch/arm/boards/freescale-mx25-3-stack/lowlevel_init.S b/arch/arm/boards/freescale-mx25-3-stack/lowlevel_init.S
index 595c485..2e49e6e 100644
--- a/arch/arm/boards/freescale-mx25-3-stack/lowlevel_init.S
+++ b/arch/arm/boards/freescale-mx25-3-stack/lowlevel_init.S
@@ -98,7 +98,8 @@ reset:
 	str r3, [r0, #0x30]
 
 #ifdef CONFIG_NAND_IMX_BOOT
-	ldr	sp, =STACK_BASE + STACK_SIZE - 12 /* Setup a temporary stack in SDRAM */
+	/* Setup a temporary stack in SRAM */
+	ldr	sp, =MX25_IRAM_BASE_ADDR + MX25_IRAM_SIZE - 4
 
 	b	imx25_barebox_boot_nand_external
 #endif /* CONFIG_NAND_IMX_BOOT */
diff --git a/arch/arm/boards/freescale-mx35-3-stack/lowlevel_init.S b/arch/arm/boards/freescale-mx35-3-stack/lowlevel_init.S
index 5461b61..c63c953 100644
--- a/arch/arm/boards/freescale-mx35-3-stack/lowlevel_init.S
+++ b/arch/arm/boards/freescale-mx35-3-stack/lowlevel_init.S
@@ -155,7 +155,8 @@ reset:
 	str	r3, [r0, #0x30]
 
 #ifdef CONFIG_NAND_IMX_BOOT
-	ldr	sp, =STACK_BASE + STACK_SIZE - 12		/* Setup a temporary stack in SDRAM */
+	/* Setup a temporary stack in internal SRAM */
+	ldr	sp, =MX35_IRAM_BASE_ADDR + MX35_IRAM_SIZE - 4
 
 	b	imx35_barebox_boot_nand_external
 #endif /* CONFIG_NAND_IMX_BOOT */
diff --git a/arch/arm/boards/guf-cupid/lowlevel.c b/arch/arm/boards/guf-cupid/lowlevel.c
index f2994eb..c141b54 100644
--- a/arch/arm/boards/guf-cupid/lowlevel.c
+++ b/arch/arm/boards/guf-cupid/lowlevel.c
@@ -314,7 +314,7 @@ void __bare_init __naked reset(void)
 	writel(r0, MX35_CCM_BASE_ADDR + MX35_CCM_PDR4);
 
 	/* setup a stack to be able to call imx35_barebox_boot_nand_external() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX35_IRAM_BASE_ADDR + MX35_IRAM_SIZE - 8);
 
 	imx35_barebox_boot_nand_external();
 #else
diff --git a/arch/arm/boards/guf-neso/lowlevel.c b/arch/arm/boards/guf-neso/lowlevel.c
index 7a366d9..ca44607 100644
--- a/arch/arm/boards/guf-neso/lowlevel.c
+++ b/arch/arm/boards/guf-neso/lowlevel.c
@@ -88,7 +88,7 @@ void __bare_init __naked reset(void)
 
 #ifdef CONFIG_NAND_IMX_BOOT
 	/* setup a stack to be able to call imx27_barebox_boot_nand_external() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX27_IRAM_BASE_ADDR + MX27_IRAM_SIZE - 8);
 
 	imx27_barebox_boot_nand_external();
 #else
diff --git a/arch/arm/boards/imx21ads/lowlevel_init.S b/arch/arm/boards/imx21ads/lowlevel_init.S
index f06c964..5be4995 100644
--- a/arch/arm/boards/imx21ads/lowlevel_init.S
+++ b/arch/arm/boards/imx21ads/lowlevel_init.S
@@ -118,7 +118,8 @@ reset:
 	str	r1, [r0]
 
 #ifdef CONFIG_NAND_IMX_BOOT
-	ldr	sp, =STACK_BASE + STACK_SIZE - 12	/* Setup a temporary stack in SDRAM */
+	/* Setup a temporary stack in SRAM */
+	ldr	sp, =MX21_IRAM_BASE_ADDR + MX21_IRAM_SIZE - 4
 
 	b	imx21_barebox_boot_nand_external
 #endif /* CONFIG_NAND_IMX_BOOT */
diff --git a/arch/arm/boards/karo-tx25/lowlevel.c b/arch/arm/boards/karo-tx25/lowlevel.c
index b1afe18..9e96e39 100644
--- a/arch/arm/boards/karo-tx25/lowlevel.c
+++ b/arch/arm/boards/karo-tx25/lowlevel.c
@@ -21,6 +21,7 @@
 #include <mach/imx25-regs.h>
 #include <mach/esdctl.h>
 #include <io.h>
+#include <sizes.h>
 #include <mach/imx-nand.h>
 #include <asm/barebox-arm.h>
 #include <asm/barebox-arm-head.h>
@@ -134,7 +135,7 @@ void __bare_init __naked reset(void)
 
 #ifdef CONFIG_NAND_IMX_BOOT
 	/* setup a stack to be able to call imx25_barebox_boot_nand_external() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX25_IRAM_BASE_ADDR + MX25_IRAM_SIZE - 8);
 
 	imx25_barebox_boot_nand_external();
 #else
diff --git a/arch/arm/boards/pcm037/lowlevel.c b/arch/arm/boards/pcm037/lowlevel.c
index da01732..b531615 100644
--- a/arch/arm/boards/pcm037/lowlevel.c
+++ b/arch/arm/boards/pcm037/lowlevel.c
@@ -127,7 +127,7 @@ void __bare_init __naked reset(void)
 
 #ifdef CONFIG_NAND_IMX_BOOT
 	/* setup a stack to be able to call imx31_barebox_boot_nand_external() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX31_IRAM_BASE_ADDR + MX31_IRAM_SIZE - 12);
 
 	imx31_barebox_boot_nand_external();
 #else
diff --git a/arch/arm/boards/pcm038/lowlevel.c b/arch/arm/boards/pcm038/lowlevel.c
index 4515107..aecdbf3 100644
--- a/arch/arm/boards/pcm038/lowlevel.c
+++ b/arch/arm/boards/pcm038/lowlevel.c
@@ -95,7 +95,7 @@ void __bare_init __naked reset(void)
 
 #ifdef CONFIG_NAND_IMX_BOOT
 	/* setup a stack to be able to call mx27_barebox_boot_nand_external() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX27_IRAM_BASE_ADDR + MX27_IRAM_SIZE - 8);
 
 	imx27_barebox_boot_nand_external();
 #else
diff --git a/arch/arm/boards/pcm043/lowlevel.c b/arch/arm/boards/pcm043/lowlevel.c
index 639064f..a9832e2 100644
--- a/arch/arm/boards/pcm043/lowlevel.c
+++ b/arch/arm/boards/pcm043/lowlevel.c
@@ -190,7 +190,7 @@ void __bare_init __naked reset(void)
 	writel(r, MX35_CCM_BASE_ADDR + MX35_CCM_PDR4);
 
 	/* setup a stack to be able to call imx35_barebox_boot_nand_external() */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
+	arm_setup_stack(MX35_IRAM_BASE_ADDR + MX35_IRAM_SIZE - 8);
 
 	imx35_barebox_boot_nand_external();
 #else
diff --git a/arch/arm/mach-imx/include/mach/imx21-regs.h b/arch/arm/mach-imx/include/mach/imx21-regs.h
index 87bd99c..1fa463a 100644
--- a/arch/arm/mach-imx/include/mach/imx21-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx21-regs.h
@@ -70,6 +70,7 @@
 #define MX21_NFC_BASE_ADDR		(MX21_X_MEMC_BASE_ADDR + 0x3000)
 
 #define MX21_IRAM_BASE_ADDR		0xffffe800	/* internal ram */
+#define MX21_IRAM_SIZE			0x00001800
 
 /* AIPI (base MX21_AIPI_BASE_ADDR) */
 #define MX21_AIPI1_PSR0	0x00
diff --git a/arch/arm/mach-imx/include/mach/imx25-regs.h b/arch/arm/mach-imx/include/mach/imx25-regs.h
index b8ae45a..9ab0fb3 100644
--- a/arch/arm/mach-imx/include/mach/imx25-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx25-regs.h
@@ -76,6 +76,9 @@
 #define MX25_USB_HS_BASE_ADDR			(MX25_USB_BASE_ADDR + 0x0400)
 #define MX25_CSI_BASE_ADDR		0x53ff8000
 
+#define MX25_IRAM_BASE_ADDR		0x78000000	/* internal ram */
+#define MX25_IRAM_SIZE			SZ_128K
+
 /*
  * Clock Controller Module (CCM)
  */
diff --git a/arch/arm/mach-imx/include/mach/imx27-regs.h b/arch/arm/mach-imx/include/mach/imx27-regs.h
index 44bc1d3..c45befb 100644
--- a/arch/arm/mach-imx/include/mach/imx27-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx27-regs.h
@@ -100,6 +100,7 @@
 
 /* IRAM */
 #define MX27_IRAM_BASE_ADDR		0xffff4c00	/* internal ram */
+#define MX27_IRAM_SIZE			0x0000b400
 
 /* PCMCIA (base: MX27_PCMCIA_CTL_BASE_ADDR) */
 #define MX27_PCMCIA_PIPR	0x00
diff --git a/arch/arm/mach-imx/include/mach/imx31-regs.h b/arch/arm/mach-imx/include/mach/imx31-regs.h
index f641fe6..be3e4c1 100644
--- a/arch/arm/mach-imx/include/mach/imx31-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx31-regs.h
@@ -21,6 +21,9 @@
 
 #include <sizes.h>
 
+#define MX31_IRAM_BASE_ADDR		0x1fffc000
+#define MX31_IRAM_SIZE			0x00004000
+
 #define MX31_AIPS1_BASE_ADDR		0x43f00000
 #define MX31_AIPS1_SIZE			SZ_1M
 #define MX31_MAX_BASE_ADDR			(MX31_AIPS1_BASE_ADDR + 0x04000)
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 04/36] ARM i.MX: Add i.MX specific entry point for barebox
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 02/36] ARM: add __noreturn to board_init_lowlevel_return Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 03/36] ARM i.MX: Use SRAM stack in lowlevel code Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 05/36] ARM i.MX: prepare external nand boot for SoC specific entry Jean-Christophe PLAGNIOL-VILLARD
                     ` (31 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Additionally to the generic entry point the i.MX specific ones
calculate the SDRAM size automatically so the boards do not have
to care.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/start-pbl.c                |   12 +++
 arch/arm/mach-imx/esdctl.c              |  136 ++++++++++++++++++++++++++-----
 arch/arm/mach-imx/include/mach/esdctl.h |   11 +++
 3 files changed, 138 insertions(+), 21 deletions(-)

diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c
index da62111..11ab025 100644
--- a/arch/arm/cpu/start-pbl.c
+++ b/arch/arm/cpu/start-pbl.c
@@ -190,6 +190,18 @@ void __naked __noreturn board_init_lowlevel_return(void)
  * full SDRAM. The currently running binary can be inside or outside of this
  * region. TEXT_BASE can be inside or outside of this region. boarddata will
  * be preserved and can be accessed later with barebox_arm_boarddata().
+ *
+ * -> membase + memsize
+ *   ARM_RESERVE_MEM_SIZE    - reserved for board usage. Will not be touched
+ *                             by barebox
+ *   STACK_SIZE              - stack
+ *   16KiB, aligned to 16KiB - First level page table if early MMU support
+ *                             is enabled
+ *   128KiB                  - early memory space
+ * -> maximum end of barebox binary
+ *
+ * Usually a TEXT_BASE of 1MiB below your lowest possible end of memory should
+ * be fine.
  */
 void __naked __noreturn barebox_arm_entry(uint32_t membase, uint32_t memsize,
 		uint32_t boarddata)
diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
index 841a9ed..3585e27 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -127,32 +127,18 @@ static inline unsigned long imx_v4_sdram_size(void __iomem *esdctlbase, int cs)
 		return 0;
 	if (cs == 1 && !(ctlval & ESDCTL_V4_ESDCTLx_SDE1))
 		return 0;
-
 	/* one 2GiB cs, memory is returned for cs0 only */
 	if (cs == 1 && (esdmisc & ESDCTL_V4_ESDMISC_ONE_CS))
-		return 9;
-
+		return 0;
 	rows = ((ctlval >> 24) & 0x7) + 11;
-	switch ((ctlval >> 20) & 0x7) {
-	case 0:
-		cols = 9;
-		break;
-	case 1:
-		cols = 10;
-		break;
-	case 2:
-		cols = 11;
-		break;
-	case 3:
+
+	cols = (ctlval >> 20) & 0x7;
+	if (cols == 3)
 		cols = 8;
-		break;
-	case 4:
+	else if (cols == 4)
 		cols = 12;
-		break;
-	default:
-		cols = 0;
-		break;
-	}
+	else
+		cols += 9;
 
 	if (ctlval & ESDCTL_V4_ESDCTLx_DSIZ_32B)
 		width = 4;
@@ -353,3 +339,111 @@ static int imx_esdctl_init(void)
 }
 
 mem_initcall(imx_esdctl_init);
+
+/*
+ * The i.MX SoCs usually have two SDRAM chipselects. The following
+ * SoC specific functions return:
+ *
+ * - cs0 disabled, cs1 disabled: 0
+ * - cs0 enabled, cs1 disabled: SDRAM size for cs0
+ * - cs0 disabled, c1 enabled: 0 (currently assumed that no hardware does this)
+ * - cs0 enabled, cs1 enabled: The largest continuous region, that is, cs0 + cs1
+ *                             if cs0 is taking the whole address space.
+ */
+void __naked __noreturn imx1_barebox_entry(uint32_t boarddata)
+{
+	unsigned long base;
+	unsigned long size;
+
+	base = 0x08000000;
+
+	size = imx_v1_sdram_size((void *)MX1_SDRAMC_BASE_ADDR, 0);
+	if (size == SZ_64M)
+		size += imx_v1_sdram_size((void *)MX1_SDRAMC_BASE_ADDR, 1);
+
+	barebox_arm_entry(base, size, boarddata);
+}
+
+void __naked __noreturn imx25_barebox_entry(uint32_t boarddata)
+{
+	unsigned long base;
+	unsigned long size;
+
+	base = MX25_CSD0_BASE_ADDR;
+
+	size = imx_v2_sdram_size((void *)MX25_ESDCTL_BASE_ADDR, 0);
+	if (size == SZ_256M)
+		size += imx_v2_sdram_size((void *)MX25_ESDCTL_BASE_ADDR, 1);
+
+	barebox_arm_entry(base, size, boarddata);
+}
+
+void __naked __noreturn imx27_barebox_entry(uint32_t boarddata)
+{
+	unsigned long base;
+	unsigned long size;
+
+	base = MX27_CSD0_BASE_ADDR;
+
+	size = imx_v2_sdram_size((void *)MX27_ESDCTL_BASE_ADDR, 0);
+	if (size == SZ_256M)
+		size += imx_v2_sdram_size((void *)MX27_ESDCTL_BASE_ADDR, 1);
+
+	barebox_arm_entry(base, size, boarddata);
+}
+
+void __naked __noreturn imx31_barebox_entry(uint32_t boarddata)
+{
+	unsigned long base;
+	unsigned long size;
+
+	base = MX31_CSD0_BASE_ADDR;
+
+	size = imx_v2_sdram_size((void *)MX31_ESDCTL_BASE_ADDR, 0);
+	if (size == SZ_256M)
+		size += imx_v2_sdram_size((void *)MX31_ESDCTL_BASE_ADDR, 1);
+
+	barebox_arm_entry(base, size, boarddata);
+}
+
+void __naked __noreturn imx35_barebox_entry(uint32_t boarddata)
+{
+	unsigned long base;
+	unsigned long size;
+
+	base = MX35_CSD0_BASE_ADDR;
+
+	size = imx_v2_sdram_size((void *)MX35_ESDCTL_BASE_ADDR, 0);
+	if (size == SZ_256M)
+		size += imx_v2_sdram_size((void *)MX35_ESDCTL_BASE_ADDR, 1);
+
+	barebox_arm_entry(base, size, boarddata);
+}
+
+void __naked __noreturn imx51_barebox_entry(uint32_t boarddata)
+{
+	unsigned long base;
+	unsigned long size;
+
+	base = MX51_CSD0_BASE_ADDR;
+
+	size = imx_v3_sdram_size((void *)MX51_ESDCTL_BASE_ADDR, 0);
+	if (size == SZ_256M)
+		size += imx_v3_sdram_size((void *)MX51_ESDCTL_BASE_ADDR, 1);
+
+	barebox_arm_entry(base, size, boarddata);
+}
+
+void __naked __noreturn imx53_barebox_entry(uint32_t boarddata)
+{
+	unsigned long base;
+	unsigned long size;
+
+	base = MX53_CSD0_BASE_ADDR;
+
+	size = imx_v4_sdram_size((void *)MX53_ESDCTL_BASE_ADDR, 0);
+	if (size == SZ_1G)
+		size += imx_v4_sdram_size((void *)MX53_ESDCTL_BASE_ADDR, 1);
+
+	barebox_arm_entry(base, size, boarddata);
+}
diff --git a/arch/arm/mach-imx/include/mach/esdctl.h b/arch/arm/mach-imx/include/mach/esdctl.h
index 1a265c8..26436d9 100644
--- a/arch/arm/mach-imx/include/mach/esdctl.h
+++ b/arch/arm/mach-imx/include/mach/esdctl.h
@@ -127,4 +127,15 @@
 //#define ESDCFGx_tRC_14		0x0000000e	// 15 seems to not exist
 #define ESDCFGx_tRC_16			0x0000000f
 
+#ifndef __ASSEMBLY__
+void __naked __noreturn imx1_barebox_entry(uint32_t boarddata);
+void __naked __noreturn imx25_barebox_entry(uint32_t boarddata);
+void __naked __noreturn imx27_barebox_entry(uint32_t boarddata);
+void __naked __noreturn imx31_barebox_entry(uint32_t boarddata);
+void __naked __noreturn imx35_barebox_entry(uint32_t boarddata);
+void __naked __noreturn imx51_barebox_entry(uint32_t boarddata);
+void __naked __noreturn imx53_barebox_entry(uint32_t boarddata);
+void __naked __noreturn imx6_barebox_entry(uint32_t boarddata);
+#endif
+
 #endif /* __MACH_ESDCTL_V2_H */
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 05/36] ARM i.MX: prepare external nand boot for SoC specific entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (2 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 04/36] ARM i.MX: Add i.MX specific entry point for barebox Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 06/36] ARM i.MX boards: switch to barebox_arm_entry Jean-Christophe PLAGNIOL-VILLARD
                     ` (30 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

i.MX will get SoC specific entry points for barebox. To find the
correct one we have to call these from the SoC specific
imx*_barebox_boot_nand_external functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/external-nand-boot.c    |   73 +++++++++++++++++++++--------
 arch/arm/mach-imx/include/mach/imx-nand.h |    1 -
 2 files changed, 53 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-imx/external-nand-boot.c b/arch/arm/mach-imx/external-nand-boot.c
index 39ffb94..c97fec9 100644
--- a/arch/arm/mach-imx/external-nand-boot.c
+++ b/arch/arm/mach-imx/external-nand-boot.c
@@ -259,14 +259,19 @@ void __bare_init imx_nand_load_image(void *dest, int size)
 }
 
 /*
- * We are now running at the address we are linked at. Now load the image from
- * NAND to SDRAM and continue booting.
+ * This function assumes the currently running binary has been
+ * copied from its current position to an offset. It returns
+ * to the calling function - offset.
+ * NOTE: The calling function may not return itself since it still
+ * works on the old content of the lr register. Only call this
+ * from a __noreturn function.
  */
-static void __bare_init __naked insdram(void)
+static __bare_init __naked void jump_sdram(unsigned long offset)
 {
-	imx_nand_load_image((void *)_text, barebox_image_size);
-
-	board_init_lowlevel_return();
+	__asm__ __volatile__ (
+			"sub lr, lr, %0;"
+			"mov pc, lr;" : : "r"(offset)
+			);
 }
 
 /*
@@ -274,7 +279,7 @@ static void __bare_init __naked insdram(void)
  * running inside the NFC address space. If not, barebox is started from the
  * currently running address without loading anything from NAND.
  */
-void __bare_init __noreturn imx_barebox_boot_nand_external(unsigned long nfc_base)
+void __bare_init imx_barebox_boot_nand_external(unsigned long nfc_base)
 {
 	u32 r;
 	u32 *src, *trg;
@@ -283,7 +288,7 @@ void __bare_init __noreturn imx_barebox_boot_nand_external(unsigned long nfc_bas
 	/* skip NAND boot if not running from NFC space */
 	r = get_pc();
 	if (r < nfc_base || r > nfc_base + 0x800)
-		board_init_lowlevel_return();
+		return;
 
 	src = (unsigned int *)nfc_base;
 	trg = (unsigned int *)_text;
@@ -291,13 +296,6 @@ void __bare_init __noreturn imx_barebox_boot_nand_external(unsigned long nfc_bas
 	/* Move ourselves out of NFC SRAM */
 	for (i = 0; i < 0x800 / sizeof(int); i++)
 		*trg++ = *src++;
-
-	/* Jump to SDRAM */
-	r = (unsigned int)&insdram;
-	__asm__ __volatile__("mov pc, %0" : : "r"(r));
-
-	/* not reached */
-	while (1);
 }
 
 /*
@@ -306,30 +304,65 @@ void __bare_init __noreturn imx_barebox_boot_nand_external(unsigned long nfc_bas
  * NAND. In this case the booting is continued without loading an image from
  * NAND. This function needs a stack to be set up.
  */
+#ifdef CONFIG_ARCH_IMX21
 void __bare_init __noreturn imx21_barebox_boot_nand_external(void)
 {
-	imx_barebox_boot_nand_external(MX21_NFC_BASE_ADDR);
+	unsigned long nfc_base = MX21_NFC_BASE_ADDR;
+
+	imx_barebox_boot_nand_external(nfc_base);
+	jump_sdram(nfc_base - (unsigned long)_text);
+	imx_nand_load_image((void *)_text, barebox_image_size);
+	board_init_lowlevel_return();
 }
+#endif
 
+#ifdef CONFIG_ARCH_IMX25
 void __bare_init __noreturn imx25_barebox_boot_nand_external(void)
 {
-	imx_barebox_boot_nand_external(MX25_NFC_BASE_ADDR);
+	unsigned long nfc_base = MX25_NFC_BASE_ADDR;
+
+	imx_barebox_boot_nand_external(nfc_base);
+	jump_sdram(nfc_base - (unsigned long)_text);
+	imx_nand_load_image((void *)_text, barebox_image_size);
+	board_init_lowlevel_return();
 }
+#endif
 
+#ifdef CONFIG_ARCH_IMX27
 void __bare_init __noreturn imx27_barebox_boot_nand_external(void)
 {
-	imx_barebox_boot_nand_external(MX27_NFC_BASE_ADDR);
+	unsigned long nfc_base = MX27_NFC_BASE_ADDR;
+
+	imx_barebox_boot_nand_external(nfc_base);
+	jump_sdram(nfc_base - (unsigned long)_text);
+	imx_nand_load_image((void *)_text, barebox_image_size);
+	board_init_lowlevel_return();
 }
+#endif
 
+#ifdef CONFIG_ARCH_IMX31
 void __bare_init __noreturn imx31_barebox_boot_nand_external(void)
 {
-	imx_barebox_boot_nand_external(MX31_NFC_BASE_ADDR);
+	unsigned long nfc_base = MX31_NFC_BASE_ADDR;
+
+	imx_barebox_boot_nand_external(nfc_base);
+	jump_sdram(nfc_base - (unsigned long)_text);
+	imx_nand_load_image((void *)_text, barebox_image_size);
+	board_init_lowlevel_return();
 }
+#endif
 
+#ifdef CONFIG_ARCH_IMX35
 void __bare_init __noreturn imx35_barebox_boot_nand_external(void)
 {
-	imx_barebox_boot_nand_external(MX35_NFC_BASE_ADDR);
+	unsigned long nfc_base = MX35_NFC_BASE_ADDR;
+
+	imx_barebox_boot_nand_external(nfc_base);
+	jump_sdram(nfc_base - (unsigned long)_text);
+	imx_nand_load_image((void *)_text, barebox_image_size);
+	board_init_lowlevel_return();
 }
+#endif
 
 #define CONFIG_NAND_IMX_BOOT_DEBUG
 #ifdef CONFIG_NAND_IMX_BOOT_DEBUG
diff --git a/arch/arm/mach-imx/include/mach/imx-nand.h b/arch/arm/mach-imx/include/mach/imx-nand.h
index a1f209e..8352d79 100644
--- a/arch/arm/mach-imx/include/mach/imx-nand.h
+++ b/arch/arm/mach-imx/include/mach/imx-nand.h
@@ -3,7 +3,6 @@
 
 #include <linux/mtd/mtd.h>
 
-void imx_nand_load_image(void *dest, int size);
 void imx21_barebox_boot_nand_external(void);
 void imx25_barebox_boot_nand_external(void);
 void imx27_barebox_boot_nand_external(void);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 06/36] ARM i.MX boards: switch to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (3 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 05/36] ARM i.MX: prepare external nand boot for SoC specific entry Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 07/36] ARM MXS " Jean-Christophe PLAGNIOL-VILLARD
                     ` (29 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Most i.MX boards can use the imx*_barebox_entry functions. The remaining
(i.MX21, i.MX6) use hardcoded base addresses.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/Kconfig                                      |    2 ++
 arch/arm/boards/ccxmx51/Makefile                      |    2 ++
 arch/arm/boards/ccxmx51/lowlevel.c                    |    9 +++++++++
 arch/arm/boards/efika-mx-smartbook/Makefile           |    2 ++
 arch/arm/boards/efika-mx-smartbook/lowlevel.c         |    9 +++++++++
 arch/arm/boards/eukrea_cpuimx25/lowlevel.c            |    6 +++---
 arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S       |    4 ++--
 arch/arm/boards/eukrea_cpuimx35/lowlevel.c            |    6 +++---
 arch/arm/boards/eukrea_cpuimx51/Makefile              |    2 ++
 arch/arm/boards/eukrea_cpuimx51/lowlevel.c            |    9 +++++++++
 .../arm/boards/freescale-mx25-3-stack/lowlevel_init.S |    4 ++--
 arch/arm/boards/freescale-mx35-3-stack/3stack.c       |    1 +
 .../arm/boards/freescale-mx35-3-stack/lowlevel_init.S |    4 ++--
 arch/arm/boards/freescale-mx51-pdk/Makefile           |    2 ++
 arch/arm/boards/freescale-mx51-pdk/lowlevel.c         |    9 +++++++++
 arch/arm/boards/freescale-mx53-loco/Makefile          |    2 ++
 arch/arm/boards/freescale-mx53-loco/lowlevel.c        |    9 +++++++++
 arch/arm/boards/freescale-mx53-smd/Makefile           |    2 ++
 arch/arm/boards/freescale-mx53-smd/lowlevel.c         |    9 +++++++++
 arch/arm/boards/freescale-mx6-arm2/Makefile           |    2 ++
 arch/arm/boards/freescale-mx6-arm2/lowlevel.c         |   10 ++++++++++
 arch/arm/boards/freescale-mx6-sabrelite/Makefile      |    2 ++
 arch/arm/boards/freescale-mx6-sabrelite/lowlevel.c    |   10 ++++++++++
 arch/arm/boards/guf-cupid/lowlevel.c                  |    6 +++---
 arch/arm/boards/guf-neso/lowlevel.c                   |    6 +++---
 arch/arm/boards/guf-vincell/lowlevel.c                |    5 +++--
 arch/arm/boards/imx21ads/imx21ads.c                   |    3 ++-
 arch/arm/boards/imx21ads/lowlevel_init.S              |    8 ++++++--
 arch/arm/boards/imx27ads/lowlevel_init.S              |    4 ++--
 arch/arm/boards/karo-tx25/lowlevel.c                  |    7 ++++---
 arch/arm/boards/karo-tx51/Makefile                    |    2 ++
 arch/arm/boards/karo-tx51/lowlevel.c                  |    9 +++++++++
 arch/arm/boards/karo-tx53/lowlevel.c                  |    6 ++----
 arch/arm/boards/pcm037/lowlevel.c                     |    4 ++--
 arch/arm/boards/pcm038/lowlevel.c                     |    6 ++++--
 arch/arm/boards/pcm043/lowlevel.c                     |    6 +++---
 arch/arm/boards/phycard-i.MX27/lowlevel_init.S        |    4 ++--
 arch/arm/boards/scb9328/lowlevel_init.S               |    4 ++--
 arch/arm/boards/tqma53/Makefile                       |    2 ++
 arch/arm/boards/tqma53/lowlevel.c                     |    9 +++++++++
 arch/arm/mach-imx/Kconfig                             |   17 -----------------
 arch/arm/mach-imx/Makefile                            |    5 ++++-
 arch/arm/mach-imx/external-nand-boot.c                |   11 ++++++-----
 43 files changed, 175 insertions(+), 66 deletions(-)
 create mode 100644 arch/arm/boards/ccxmx51/lowlevel.c
 create mode 100644 arch/arm/boards/efika-mx-smartbook/lowlevel.c
 create mode 100644 arch/arm/boards/eukrea_cpuimx51/lowlevel.c
 create mode 100644 arch/arm/boards/freescale-mx51-pdk/lowlevel.c
 create mode 100644 arch/arm/boards/freescale-mx53-loco/lowlevel.c
 create mode 100644 arch/arm/boards/freescale-mx53-smd/lowlevel.c
 create mode 100644 arch/arm/boards/freescale-mx6-arm2/lowlevel.c
 create mode 100644 arch/arm/boards/freescale-mx6-sabrelite/lowlevel.c
 create mode 100644 arch/arm/boards/karo-tx51/lowlevel.c
 create mode 100644 arch/arm/boards/tqma53/lowlevel.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6f7a71f..cac3360 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -58,6 +58,8 @@ config ARCH_IMX
 	select CLKDEV_LOOKUP
 	select WATCHDOG_IMX_RESET_SOURCE
 	select HAS_DEBUG_LL
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_MXS
 	bool "Freescale i.MX23/28 (mxs) based"
diff --git a/arch/arm/boards/ccxmx51/Makefile b/arch/arm/boards/ccxmx51/Makefile
index f9eb2db..d392533 100644
--- a/arch/arm/boards/ccxmx51/Makefile
+++ b/arch/arm/boards/ccxmx51/Makefile
@@ -1,3 +1,5 @@
 obj-y					+= flash_header.o ccxmx51.o
 pbl-y					+= flash_header.o
 obj-$(CONFIG_MACH_CCMX51_BASEBOARD)	+= ccxmx51js.o
+obj-y					+= lowlevel.o
+pbl-y					+= lowlevel.o
diff --git a/arch/arm/boards/ccxmx51/lowlevel.c b/arch/arm/boards/ccxmx51/lowlevel.c
new file mode 100644
index 0000000..282024e
--- /dev/null
+++ b/arch/arm/boards/ccxmx51/lowlevel.c
@@ -0,0 +1,9 @@
+#include <common.h>
+#include <mach/esdctl.h>
+#include <asm/barebox-arm-head.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	imx51_barebox_entry(0);
+}
diff --git a/arch/arm/boards/efika-mx-smartbook/Makefile b/arch/arm/boards/efika-mx-smartbook/Makefile
index d08bb68..6ca1c06 100644
--- a/arch/arm/boards/efika-mx-smartbook/Makefile
+++ b/arch/arm/boards/efika-mx-smartbook/Makefile
@@ -1,3 +1,5 @@
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
 obj-y += board.o
 obj-y += flash_header.o
 pbl-y += flash_header.o
diff --git a/arch/arm/boards/efika-mx-smartbook/lowlevel.c b/arch/arm/boards/efika-mx-smartbook/lowlevel.c
new file mode 100644
index 0000000..282024e
--- /dev/null
+++ b/arch/arm/boards/efika-mx-smartbook/lowlevel.c
@@ -0,0 +1,9 @@
+#include <common.h>
+#include <mach/esdctl.h>
+#include <asm/barebox-arm-head.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	imx51_barebox_entry(0);
+}
diff --git a/arch/arm/boards/eukrea_cpuimx25/lowlevel.c b/arch/arm/boards/eukrea_cpuimx25/lowlevel.c
index 3c1b50c..6afdd17 100644
--- a/arch/arm/boards/eukrea_cpuimx25/lowlevel.c
+++ b/arch/arm/boards/eukrea_cpuimx25/lowlevel.c
@@ -107,7 +107,7 @@ void __bare_init __naked reset(void)
 	/* Skip SDRAM initialization if we run from RAM */
 	r = get_pc();
 	if (r > 0x80000000 && r < 0x90000000)
-		board_init_lowlevel_return();
+		goto out;
 
 	/* Init Mobile DDR */
 	writel(0x0000000E, MX25_ESDCTL_BASE_ADDR + IMX_ESDMISC);
@@ -132,7 +132,7 @@ void __bare_init __naked reset(void)
 	arm_setup_stack(STACK_BASE + STACK_SIZE - 12);
 
 	imx25_barebox_boot_nand_external();
-#else
-	board_init_lowlevel_return();
 #endif
+out:
+	imx25_barebox_entry(0);
 }
diff --git a/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S b/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S
index 287b513..c37d271 100644
--- a/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S
+++ b/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S
@@ -119,7 +119,7 @@ reset:
 	cmp	pc, #0xc0000000
 	bhi	1f
 
-	b	board_init_lowlevel_return
+	b	imx27_barebox_entry
 1:
 	sdram_init
 
@@ -131,4 +131,4 @@ reset:
 #endif /* CONFIG_NAND_IMX_BOOT */
 
 ret:
-	b	board_init_lowlevel_return
+	b	imx27_barebox_entry
diff --git a/arch/arm/boards/eukrea_cpuimx35/lowlevel.c b/arch/arm/boards/eukrea_cpuimx35/lowlevel.c
index c43f7fe..0533c1d 100644
--- a/arch/arm/boards/eukrea_cpuimx35/lowlevel.c
+++ b/arch/arm/boards/eukrea_cpuimx35/lowlevel.c
@@ -110,7 +110,7 @@ void __bare_init __naked reset(void)
 	/* Skip SDRAM initialization if we run from RAM */
 	r = get_pc();
 	if (r > 0x80000000 && r < 0x90000000)
-		board_init_lowlevel_return();
+		goto out;
 
 	/* Init Mobile DDR */
 	writel(0x0000000E, MX35_ESDCTL_BASE_ADDR + IMX_ESDMISC);
@@ -141,7 +141,7 @@ void __bare_init __naked reset(void)
 	arm_setup_stack(MX35_IRAM_BASE_ADDR + MX35_IRAM_SIZE - 8);
 
 	imx35_barebox_boot_nand_external();
-#else
-	board_init_lowlevel_return();
 #endif
+out:
+	imx35_barebox_entry(0);
 }
diff --git a/arch/arm/boards/eukrea_cpuimx51/Makefile b/arch/arm/boards/eukrea_cpuimx51/Makefile
index ce81ffa..1a23797 100644
--- a/arch/arm/boards/eukrea_cpuimx51/Makefile
+++ b/arch/arm/boards/eukrea_cpuimx51/Makefile
@@ -1,3 +1,5 @@
 obj-y += eukrea_cpuimx51.o
 obj-y += flash_header.o
 pbl-y += flash_header.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/eukrea_cpuimx51/lowlevel.c b/arch/arm/boards/eukrea_cpuimx51/lowlevel.c
new file mode 100644
index 0000000..282024e
--- /dev/null
+++ b/arch/arm/boards/eukrea_cpuimx51/lowlevel.c
@@ -0,0 +1,9 @@
+#include <common.h>
+#include <mach/esdctl.h>
+#include <asm/barebox-arm-head.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	imx51_barebox_entry(0);
+}
diff --git a/arch/arm/boards/freescale-mx25-3-stack/lowlevel_init.S b/arch/arm/boards/freescale-mx25-3-stack/lowlevel_init.S
index 2e49e6e..a55508e 100644
--- a/arch/arm/boards/freescale-mx25-3-stack/lowlevel_init.S
+++ b/arch/arm/boards/freescale-mx25-3-stack/lowlevel_init.S
@@ -77,7 +77,7 @@ reset:
 	cmp	pc, #0x90000000
 	bhi	1f
 
-	b	board_init_lowlevel_return
+	b	imx25_barebox_entry
 
 1:
 	ldr r0, ESDCTL_BASE_W
@@ -105,7 +105,7 @@ reset:
 #endif /* CONFIG_NAND_IMX_BOOT */
 
 ret:
-	b	board_init_lowlevel_return
+	b	imx25_barebox_entry
 
 /*
  * r0: control base, r1: ram bank base
diff --git a/arch/arm/boards/freescale-mx35-3-stack/3stack.c b/arch/arm/boards/freescale-mx35-3-stack/3stack.c
index 02844c5..e1cb73c 100644
--- a/arch/arm/boards/freescale-mx35-3-stack/3stack.c
+++ b/arch/arm/boards/freescale-mx35-3-stack/3stack.c
@@ -30,6 +30,7 @@
 #include <init.h>
 #include <nand.h>
 #include <net.h>
+#include <sizes.h>
 #include <partition.h>
 
 #include <asm/armlinux.h>
diff --git a/arch/arm/boards/freescale-mx35-3-stack/lowlevel_init.S b/arch/arm/boards/freescale-mx35-3-stack/lowlevel_init.S
index c63c953..7b0a32b 100644
--- a/arch/arm/boards/freescale-mx35-3-stack/lowlevel_init.S
+++ b/arch/arm/boards/freescale-mx35-3-stack/lowlevel_init.S
@@ -126,7 +126,7 @@ reset:
 	cmp	pc, #CSD1_BASE_ADDR
 	bhi	1f
 
-	b	board_init_lowlevel_return
+	b	imx35_barebox_entry
 
 1:
 	ldr	r0, =ESDCTL_BASE_ADDR
@@ -161,7 +161,7 @@ reset:
 	b	imx35_barebox_boot_nand_external
 #endif /* CONFIG_NAND_IMX_BOOT */
 
-	b	board_init_lowlevel_return
+	b	imx35_barebox_entry
 
 /*
  * r0: ESDCTL control base, r1: sdram slot base
diff --git a/arch/arm/boards/freescale-mx51-pdk/Makefile b/arch/arm/boards/freescale-mx51-pdk/Makefile
index d08bb68..2f45976 100644
--- a/arch/arm/boards/freescale-mx51-pdk/Makefile
+++ b/arch/arm/boards/freescale-mx51-pdk/Makefile
@@ -1,3 +1,5 @@
 obj-y += board.o
 obj-y += flash_header.o
 pbl-y += flash_header.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/freescale-mx51-pdk/lowlevel.c b/arch/arm/boards/freescale-mx51-pdk/lowlevel.c
new file mode 100644
index 0000000..282024e
--- /dev/null
+++ b/arch/arm/boards/freescale-mx51-pdk/lowlevel.c
@@ -0,0 +1,9 @@
+#include <common.h>
+#include <mach/esdctl.h>
+#include <asm/barebox-arm-head.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	imx51_barebox_entry(0);
+}
diff --git a/arch/arm/boards/freescale-mx53-loco/Makefile b/arch/arm/boards/freescale-mx53-loco/Makefile
index d08bb68..2f45976 100644
--- a/arch/arm/boards/freescale-mx53-loco/Makefile
+++ b/arch/arm/boards/freescale-mx53-loco/Makefile
@@ -1,3 +1,5 @@
 obj-y += board.o
 obj-y += flash_header.o
 pbl-y += flash_header.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/freescale-mx53-loco/lowlevel.c b/arch/arm/boards/freescale-mx53-loco/lowlevel.c
new file mode 100644
index 0000000..c6f79ca
--- /dev/null
+++ b/arch/arm/boards/freescale-mx53-loco/lowlevel.c
@@ -0,0 +1,9 @@
+#include <common.h>
+#include <mach/esdctl.h>
+#include <asm/barebox-arm-head.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	imx53_barebox_entry(0);
+}
diff --git a/arch/arm/boards/freescale-mx53-smd/Makefile b/arch/arm/boards/freescale-mx53-smd/Makefile
index d08bb68..2f45976 100644
--- a/arch/arm/boards/freescale-mx53-smd/Makefile
+++ b/arch/arm/boards/freescale-mx53-smd/Makefile
@@ -1,3 +1,5 @@
 obj-y += board.o
 obj-y += flash_header.o
 pbl-y += flash_header.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/freescale-mx53-smd/lowlevel.c b/arch/arm/boards/freescale-mx53-smd/lowlevel.c
new file mode 100644
index 0000000..c6f79ca
--- /dev/null
+++ b/arch/arm/boards/freescale-mx53-smd/lowlevel.c
@@ -0,0 +1,9 @@
+#include <common.h>
+#include <mach/esdctl.h>
+#include <asm/barebox-arm-head.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	imx53_barebox_entry(0);
+}
diff --git a/arch/arm/boards/freescale-mx6-arm2/Makefile b/arch/arm/boards/freescale-mx6-arm2/Makefile
index 11199d2..21fb7d9 100644
--- a/arch/arm/boards/freescale-mx6-arm2/Makefile
+++ b/arch/arm/boards/freescale-mx6-arm2/Makefile
@@ -1,2 +1,4 @@
 obj-y += board.o flash_header.o
 pbl-y += flash_header.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/freescale-mx6-arm2/lowlevel.c b/arch/arm/boards/freescale-mx6-arm2/lowlevel.c
new file mode 100644
index 0000000..810b890
--- /dev/null
+++ b/arch/arm/boards/freescale-mx6-arm2/lowlevel.c
@@ -0,0 +1,10 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	barebox_arm_entry(0x10000000, SZ_2G, 0);
+}
diff --git a/arch/arm/boards/freescale-mx6-sabrelite/Makefile b/arch/arm/boards/freescale-mx6-sabrelite/Makefile
index 11199d2..21fb7d9 100644
--- a/arch/arm/boards/freescale-mx6-sabrelite/Makefile
+++ b/arch/arm/boards/freescale-mx6-sabrelite/Makefile
@@ -1,2 +1,4 @@
 obj-y += board.o flash_header.o
 pbl-y += flash_header.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/freescale-mx6-sabrelite/lowlevel.c b/arch/arm/boards/freescale-mx6-sabrelite/lowlevel.c
new file mode 100644
index 0000000..8f995ee
--- /dev/null
+++ b/arch/arm/boards/freescale-mx6-sabrelite/lowlevel.c
@@ -0,0 +1,10 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	barebox_arm_entry(0x10000000, SZ_1G, 0);
+}
diff --git a/arch/arm/boards/guf-cupid/lowlevel.c b/arch/arm/boards/guf-cupid/lowlevel.c
index c141b54..9620abd 100644
--- a/arch/arm/boards/guf-cupid/lowlevel.c
+++ b/arch/arm/boards/guf-cupid/lowlevel.c
@@ -234,7 +234,7 @@ void __bare_init __naked reset(void)
 	/* Skip SDRAM initialization if we run from RAM */
 	r0 = get_pc();
 	if (r0 > 0x80000000 && r0 < 0x90000000)
-		board_init_lowlevel_return();
+		goto out;
 
 	/* Configure drive strength */
 
@@ -317,7 +317,7 @@ void __bare_init __naked reset(void)
 	arm_setup_stack(MX35_IRAM_BASE_ADDR + MX35_IRAM_SIZE - 8);
 
 	imx35_barebox_boot_nand_external();
-#else
-	board_init_lowlevel_return();
 #endif
+out:
+	imx35_barebox_entry(0);
 }
diff --git a/arch/arm/boards/guf-neso/lowlevel.c b/arch/arm/boards/guf-neso/lowlevel.c
index ca44607..ebb8d56 100644
--- a/arch/arm/boards/guf-neso/lowlevel.c
+++ b/arch/arm/boards/guf-neso/lowlevel.c
@@ -48,7 +48,7 @@ void __bare_init __naked reset(void)
 	/* Skip SDRAM initialization if we run from RAM */
 	r = get_pc();
 	if (r > 0xa0000000 && r < 0xb0000000)
-		board_init_lowlevel_return();
+		goto out;
 
 	/*
 	 * DDR on CSD0
@@ -91,7 +91,7 @@ void __bare_init __naked reset(void)
 	arm_setup_stack(MX27_IRAM_BASE_ADDR + MX27_IRAM_SIZE - 8);
 
 	imx27_barebox_boot_nand_external();
-#else
-	board_init_lowlevel_return();
 #endif
+out:
+	imx27_barebox_entry(0);
 }
diff --git a/arch/arm/boards/guf-vincell/lowlevel.c b/arch/arm/boards/guf-vincell/lowlevel.c
index 8003c67..1243b9a 100644
--- a/arch/arm/boards/guf-vincell/lowlevel.c
+++ b/arch/arm/boards/guf-vincell/lowlevel.c
@@ -5,6 +5,7 @@
 #include <mach/imx5.h>
 #include <mach/iomux-v3.h>
 #include <mach/esdctl-v4.h>
+#include <mach/esdctl.h>
 #include <asm/barebox-arm.h>
 #include <asm/barebox-arm-head.h>
 #include <io.h>
@@ -131,7 +132,7 @@ void __bare_init __naked reset(void)
 	/* Skip SDRAM initialization if we run from RAM */
 	r = get_pc();
 	if (r > 0x70000000 && r < 0xf0000000)
-		board_init_lowlevel_return();
+		imx51_barebox_entry(0);
 
 	/* Setup a preliminary stack */
 	r = 0xf8000000 + 0x60000 - 16;
@@ -145,5 +146,5 @@ void __bare_init __naked reset(void)
 
 	imx_esdctlv4_init();
 
-	board_init_lowlevel_return();
+	imx51_barebox_entry(0);
 }
diff --git a/arch/arm/boards/imx21ads/imx21ads.c b/arch/arm/boards/imx21ads/imx21ads.c
index 3d07633..6087ad4 100644
--- a/arch/arm/boards/imx21ads/imx21ads.c
+++ b/arch/arm/boards/imx21ads/imx21ads.c
@@ -30,6 +30,7 @@
 #include <mach/weim.h>
 #include <partition.h>
 #include <fs.h>
+#include <sizes.h>
 #include <fcntl.h>
 #include <generated/mach-types.h>
 #include <mach/imx-nand.h>
@@ -107,7 +108,7 @@ core_initcall(imx21ads_timing_init);
 
 static int mx21ads_mem_init(void)
 {
-	arm_add_mem_device("ram0", 0xc0000000, 64 * 1024 * 1024);
+	arm_add_mem_device("ram0", 0xc0000000, SZ_64M);
 
 	return 0;
 }
diff --git a/arch/arm/boards/imx21ads/lowlevel_init.S b/arch/arm/boards/imx21ads/lowlevel_init.S
index 5be4995..5c6d3f7 100644
--- a/arch/arm/boards/imx21ads/lowlevel_init.S
+++ b/arch/arm/boards/imx21ads/lowlevel_init.S
@@ -14,6 +14,7 @@
  */
 
 #include <config.h>
+#include <sizes.h>
 #include <asm-generic/memory_layout.h>
 #include <mach/imx21-regs.h>
 #include <asm/barebox-arm-head.h>
@@ -75,7 +76,7 @@ reset:
 	cmp	pc, #0xc8000000
 	bhi	1f
 
-	b	board_init_lowlevel_return
+	b	ret
 1:
 
 	/* Precharge */
@@ -125,7 +126,10 @@ reset:
 #endif /* CONFIG_NAND_IMX_BOOT */
 
 ret:
-	b	board_init_lowlevel_return
+	mov	r0, #0xc0000000
+	mov	r1, #SZ_64M
+	mov	r2, #0
+	b	barebox_arm_entry
 
 /*
  *  spin for a while.  we need to wait at least 200 usecs.
diff --git a/arch/arm/boards/imx27ads/lowlevel_init.S b/arch/arm/boards/imx27ads/lowlevel_init.S
index 2dc34b5..8939f6a 100644
--- a/arch/arm/boards/imx27ads/lowlevel_init.S
+++ b/arch/arm/boards/imx27ads/lowlevel_init.S
@@ -167,9 +167,9 @@ reset:
 	cmp	pc, #0xc0000000
 	bhi	1f
 
-	b board_init_lowlevel_return
+	b imx27_barebox_entry
 1:
 	sdram_init_sha
 
-	b board_init_lowlevel_return
+	b imx27_barebox_entry
 
diff --git a/arch/arm/boards/karo-tx25/lowlevel.c b/arch/arm/boards/karo-tx25/lowlevel.c
index 9e96e39..45fa17f 100644
--- a/arch/arm/boards/karo-tx25/lowlevel.c
+++ b/arch/arm/boards/karo-tx25/lowlevel.c
@@ -23,6 +23,7 @@
 #include <io.h>
 #include <sizes.h>
 #include <mach/imx-nand.h>
+#include <mach/esdctl.h>
 #include <asm/barebox-arm.h>
 #include <asm/barebox-arm-head.h>
 #include <asm/system.h>
@@ -115,7 +116,7 @@ void __bare_init __naked reset(void)
 	/* Skip SDRAM initialization if we run from RAM */
 	r = get_pc();
 	if (r > 0x80000000 && r < 0xa0000000)
-		board_init_lowlevel_return();
+		goto out;
 
 	/* set to 3.3v SDRAM */
 	writel(0x800, MX25_IOMUXC_BASE_ADDR + 0x454);
@@ -138,7 +139,7 @@ void __bare_init __naked reset(void)
 	arm_setup_stack(MX25_IRAM_BASE_ADDR + MX25_IRAM_SIZE - 8);
 
 	imx25_barebox_boot_nand_external();
-#else
-	board_init_lowlevel_return();
 #endif
+out:
+	imx25_barebox_entry(0);
 }
diff --git a/arch/arm/boards/karo-tx51/Makefile b/arch/arm/boards/karo-tx51/Makefile
index 6f51586..00f2b05 100644
--- a/arch/arm/boards/karo-tx51/Makefile
+++ b/arch/arm/boards/karo-tx51/Makefile
@@ -1,3 +1,5 @@
 obj-y += tx51.o
 obj-$(CONFIG_ARCH_IMX_INTERNAL_BOOT) += flash_header.o
 pbl-$(CONFIG_ARCH_IMX_INTERNAL_BOOT) += flash_header.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/karo-tx51/lowlevel.c b/arch/arm/boards/karo-tx51/lowlevel.c
new file mode 100644
index 0000000..282024e
--- /dev/null
+++ b/arch/arm/boards/karo-tx51/lowlevel.c
@@ -0,0 +1,9 @@
+#include <common.h>
+#include <mach/esdctl.h>
+#include <asm/barebox-arm-head.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	imx51_barebox_entry(0);
+}
diff --git a/arch/arm/boards/karo-tx53/lowlevel.c b/arch/arm/boards/karo-tx53/lowlevel.c
index 0ca164b..fe9dac1 100644
--- a/arch/arm/boards/karo-tx53/lowlevel.c
+++ b/arch/arm/boards/karo-tx53/lowlevel.c
@@ -2,8 +2,7 @@
 #include <asm/barebox-arm-head.h>
 #include <asm/barebox-arm.h>
 #include <mach/imx5.h>
-
-#ifdef CONFIG_MACH_DO_LOWLEVEL_INIT
+#include <mach/esdctl.h>
 
 void __naked reset(void)
 {
@@ -17,6 +16,5 @@ void __naked reset(void)
 	if (IS_ENABLED(CONFIG_TX53_REV_XX30))
 		imx53_init_lowlevel(800);
 
-	board_init_lowlevel_return();
+	imx53_barebox_entry(0);
 }
-#endif
diff --git a/arch/arm/boards/pcm037/lowlevel.c b/arch/arm/boards/pcm037/lowlevel.c
index b531615..176c968 100644
--- a/arch/arm/boards/pcm037/lowlevel.c
+++ b/arch/arm/boards/pcm037/lowlevel.c
@@ -84,7 +84,7 @@ void __bare_init __naked reset(void)
 	/* Skip SDRAM initialization if we run from RAM */
 	r = get_pc();
 	if (r > 0x80000000 && r < 0xa0000000)
-		board_init_lowlevel_return();
+		imx31_barebox_entry(0);
 
 #if defined CONFIG_PCM037_SDRAM_BANK0_128MB
 #define ROWS0	ESDCTL0_ROW13
@@ -131,6 +131,6 @@ void __bare_init __naked reset(void)
 
 	imx31_barebox_boot_nand_external();
 #else
-	board_init_lowlevel_return();
+	imx31_barebox_entry(0);
 #endif
 }
diff --git a/arch/arm/boards/pcm038/lowlevel.c b/arch/arm/boards/pcm038/lowlevel.c
index aecdbf3..c00b3b4 100644
--- a/arch/arm/boards/pcm038/lowlevel.c
+++ b/arch/arm/boards/pcm038/lowlevel.c
@@ -49,7 +49,7 @@ void __bare_init __naked reset(void)
 	/* Skip SDRAM initialization if we run from RAM */
 	r = get_pc();
 	if (r > 0xa0000000 && r < 0xb0000000)
-		board_init_lowlevel_return();
+		goto out;
 
 	/* re-program the PLL prior(!) starting the SDRAM controller */
 	writel(MPCTL0_VAL, MX27_CCM_BASE_ADDR + MX27_MPCTL0);
@@ -99,6 +99,8 @@ void __bare_init __naked reset(void)
 
 	imx27_barebox_boot_nand_external();
 #else
-	board_init_lowlevel_return();
+	imx27_barebox_entry(0);
 #endif
+out:
+	imx27_barebox_entry(0);
 }
diff --git a/arch/arm/boards/pcm043/lowlevel.c b/arch/arm/boards/pcm043/lowlevel.c
index a9832e2..d19d5b5 100644
--- a/arch/arm/boards/pcm043/lowlevel.c
+++ b/arch/arm/boards/pcm043/lowlevel.c
@@ -117,7 +117,7 @@ void __bare_init __naked reset(void)
 	/* Skip SDRAM initialization if we run from RAM */
 	r = get_pc();
 	if (r > 0x80000000 && r < 0x90000000)
-		board_init_lowlevel_return();
+		goto out;
 
 	/* Set DDR Type to SDRAM, drive strength workaround	*
 	 * 0x00000000	MDDR					*
@@ -193,7 +193,7 @@ void __bare_init __naked reset(void)
 	arm_setup_stack(MX35_IRAM_BASE_ADDR + MX35_IRAM_SIZE - 8);
 
 	imx35_barebox_boot_nand_external();
-#else
-	board_init_lowlevel_return();
 #endif
+out:
+	imx35_barebox_entry(0);
 }
diff --git a/arch/arm/boards/phycard-i.MX27/lowlevel_init.S b/arch/arm/boards/phycard-i.MX27/lowlevel_init.S
index cb5d83d..d81066e 100644
--- a/arch/arm/boards/phycard-i.MX27/lowlevel_init.S
+++ b/arch/arm/boards/phycard-i.MX27/lowlevel_init.S
@@ -82,7 +82,7 @@ reset:
 	cmp	pc, #0xc0000000
 	bhi	1f
 
-	b	board_init_lowlevel_return
+	b	imx27_barebox_entry
 
 1:
 	/* 399 MHz */
@@ -115,5 +115,5 @@ reset:
 #endif /* CONFIG_NAND_IMX_BOOT */
 
 ret:
-	b	board_init_lowlevel_return
+	b	imx27_barebox_entry
 
diff --git a/arch/arm/boards/scb9328/lowlevel_init.S b/arch/arm/boards/scb9328/lowlevel_init.S
index cefac84..f8197bd 100644
--- a/arch/arm/boards/scb9328/lowlevel_init.S
+++ b/arch/arm/boards/scb9328/lowlevel_init.S
@@ -151,7 +151,7 @@ reset:
 	cmp	pc, #0x09000000
 	bhi	1f
 
-	b board_init_lowlevel_return
+	b imx1_barebox_entry
 
 1:
 
@@ -181,4 +181,4 @@ reset:
 	/* Set to Normal Mode CAS 2 */
 	writel(0x810a8200, MX1_SDRAMC_BASE_ADDR + MX1_SDCTL0)
 
-	b board_init_lowlevel_return
+	b imx1_barebox_entry
diff --git a/arch/arm/boards/tqma53/Makefile b/arch/arm/boards/tqma53/Makefile
index d08bb68..2f45976 100644
--- a/arch/arm/boards/tqma53/Makefile
+++ b/arch/arm/boards/tqma53/Makefile
@@ -1,3 +1,5 @@
 obj-y += board.o
 obj-y += flash_header.o
 pbl-y += flash_header.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/tqma53/lowlevel.c b/arch/arm/boards/tqma53/lowlevel.c
new file mode 100644
index 0000000..c6f79ca
--- /dev/null
+++ b/arch/arm/boards/tqma53/lowlevel.c
@@ -0,0 +1,9 @@
+#include <common.h>
+#include <mach/esdctl.h>
+#include <asm/barebox-arm-head.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	imx53_barebox_entry(0);
+}
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 3cb35a0..4115d35 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -206,7 +206,6 @@ choice
 config MACH_SCB9328
 	bool "Synertronixx scb9328"
 	select HAS_DM9000
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say Y here if you are using the Synertronixx scb9328 board
 
@@ -223,7 +222,6 @@ choice
 
 config MACH_IMX21ADS
 	bool "Freescale i.MX21ADS"
-	select MACH_HAS_LOWLEVEL_INIT
 	select HAS_CS8900
 	help
 	  Say Y here if you are using the Freescale i.MX21ads board equipped
@@ -242,14 +240,12 @@ choice
 
 config MACH_EUKREA_CPUIMX25
 	bool "Eukrea CPUIMX25"
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say Y here if you are using the Eukrea Electromatique's CPUIMX25
 	  equipped with a Freescale i.MX25 Processor
 
 config MACH_FREESCALE_MX25_3STACK
 	bool "Freescale MX25 3stack"
-	select MACH_HAS_LOWLEVEL_INIT
 	select I2C
 	select I2C_MC34704
 	help
@@ -258,7 +254,6 @@ config MACH_FREESCALE_MX25_3STACK
 
 config MACH_TX25
 	bool "Ka-Ro TX25"
-	select MACH_HAS_LOWLEVEL_INIT
 	select HAVE_DEFAULT_ENVIRONMENT_NEW
 	help
 	  Say Y here if you are using the Ka-Ro tx25 board
@@ -276,28 +271,24 @@ choice
 
 config MACH_EUKREA_CPUIMX27
 	bool "EUKREA CPUIMX27"
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say Y here if you are using Eukrea's CPUIMX27 equipped
 	  with a Freescale i.MX27 Processor
 
 config MACH_IMX27ADS
 	bool "Freescale i.MX27ADS"
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say Y here if you are using the Freescale i.MX27ads board equipped
 	  with a Freescale i.MX27 Processor
 
 config MACH_PCA100
 	bool "phyCard-i.MX27"
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say Y here if you are using Phytec's phyCard-i.MX27 (pca100) equipped
 	  with a Freescale i.MX27 Processor
 
 config MACH_PCM038
 	bool "phyCORE-i.MX27"
-	select MACH_HAS_LOWLEVEL_INIT
 	select SPI
 	select DRIVER_SPI_IMX
 	select MFD_MC13XXX
@@ -316,7 +307,6 @@ config MACH_PCM970_BASEBOARD
 
 config MACH_NESO
 	bool "Garz+Fricke Neso"
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say Y here if you are using the Garz+Fricke Neso board equipped
 	  with a Freescale i.MX27 Processor
@@ -334,7 +324,6 @@ choice
 
 config MACH_PCM037
 	bool "phyCORE-i.MX31"
-	select MACH_HAS_LOWLEVEL_INIT
 	select USB_ULPI if USB
 	select HAVE_DEFAULT_ENVIRONMENT_NEW
 	select ARCH_HAS_L2X0
@@ -355,7 +344,6 @@ choice
 
 config MACH_EUKREA_CPUIMX35
 	bool "EUKREA CPUIMX35"
-	select MACH_HAS_LOWLEVEL_INIT
 	select ARCH_HAS_L2X0
 	help
 	  Say Y here if you are using Eukrea's CPUIMX35 equipped
@@ -363,7 +351,6 @@ config MACH_EUKREA_CPUIMX35
 
 config MACH_FREESCALE_MX35_3STACK
 	bool "Freescale MX35 3stack"
-	select MACH_HAS_LOWLEVEL_INIT
 	select I2C
 	select I2C_IMX
 	select MFD_MC13XXX
@@ -374,7 +361,6 @@ config MACH_FREESCALE_MX35_3STACK
 
 config MACH_PCM043
 	bool "phyCORE-i.MX35"
-	select MACH_HAS_LOWLEVEL_INIT
 	select ARCH_HAS_L2X0
 	help
 	  Say Y here if you are using Phytec's phyCORE-i.MX35 (pcm043) equipped
@@ -382,7 +368,6 @@ config MACH_PCM043
 
 config MACH_GUF_CUPID
 	bool "Garz+Fricke Cupid"
-	select MACH_HAS_LOWLEVEL_INIT
 	select ARCH_HAS_L2X0
 	help
 	  Say Y here if you are using the Garz+Fricke Neso board equipped
@@ -469,13 +454,11 @@ config MACH_TQMA53_1GB_RAM
 config MACH_TX53
 	bool "Ka-Ro TX53"
 	select HAVE_DEFAULT_ENVIRONMENT_NEW
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say Y here if you are using the Ka-Ro tx53 board
 
 config MACH_GUF_VINCELL
 	select HAVE_DEFAULT_ENVIRONMENT_NEW
-	select MACH_HAS_LOWLEVEL_INIT
 	bool "Garz-Fricke Vincell"
 
 endchoice
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 104ab21..1c28035 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -11,8 +11,11 @@ pbl-$(CONFIG_ARCH_IMX53) += imx53.o imx5.o esdctl-v4.o
 obj-$(CONFIG_ARCH_IMX6) += imx6.o iomux-v3.o usb-imx6.o clk-imx6.o
 obj-$(CONFIG_IMX_IIM)	+= iim.o
 obj-$(CONFIG_NAND_IMX) += nand.o
-obj-$(CONFIG_ARCH_IMX_EXTERNAL_BOOT_NAND) += external-nand-boot.o
+ifdef CONFIG_PBL_IMAGE
 pbl-$(CONFIG_ARCH_IMX_EXTERNAL_BOOT_NAND) += external-nand-boot.o
+else
+obj-$(CONFIG_ARCH_IMX_EXTERNAL_BOOT_NAND) += external-nand-boot.o
+endif
 obj-$(CONFIG_COMMON_CLK) += clk-pllv1.o clk-pllv2.o clk-pllv3.o clk-pfd.o
 obj-y += devices.o imx.o esdctl.o
 obj-y += boot.o
diff --git a/arch/arm/mach-imx/external-nand-boot.c b/arch/arm/mach-imx/external-nand-boot.c
index c97fec9..2c353d7 100644
--- a/arch/arm/mach-imx/external-nand-boot.c
+++ b/arch/arm/mach-imx/external-nand-boot.c
@@ -18,6 +18,7 @@
 #include <asm/sections.h>
 #include <asm/barebox-arm.h>
 #include <mach/imx-nand.h>
+#include <mach/esdctl.h>
 #include <mach/generic.h>
 #include <mach/imx21-regs.h>
 #include <mach/imx25-regs.h>
@@ -312,7 +313,7 @@ void __bare_init __noreturn imx21_barebox_boot_nand_external(void)
 	imx_barebox_boot_nand_external(nfc_base);
 	jump_sdram(nfc_base - (unsigned long)_text);
 	imx_nand_load_image((void *)_text, barebox_image_size);
-	board_init_lowlevel_return();
+	imx21_barebox_entry(0);
 }
 #endif
 
@@ -324,7 +325,7 @@ void __bare_init __noreturn imx25_barebox_boot_nand_external(void)
 	imx_barebox_boot_nand_external(nfc_base);
 	jump_sdram(nfc_base - (unsigned long)_text);
 	imx_nand_load_image((void *)_text, barebox_image_size);
-	board_init_lowlevel_return();
+	imx25_barebox_entry(0);
 }
 #endif
 
@@ -336,7 +337,7 @@ void __bare_init __noreturn imx27_barebox_boot_nand_external(void)
 	imx_barebox_boot_nand_external(nfc_base);
 	jump_sdram(nfc_base - (unsigned long)_text);
 	imx_nand_load_image((void *)_text, barebox_image_size);
-	board_init_lowlevel_return();
+	imx27_barebox_entry(0);
 }
 #endif
 
@@ -348,7 +349,7 @@ void __bare_init __noreturn imx31_barebox_boot_nand_external(void)
 	imx_barebox_boot_nand_external(nfc_base);
 	jump_sdram(nfc_base - (unsigned long)_text);
 	imx_nand_load_image((void *)_text, barebox_image_size);
-	board_init_lowlevel_return();
+	imx31_barebox_entry(0);
 }
 #endif
 
@@ -360,7 +361,7 @@ void __bare_init __noreturn imx35_barebox_boot_nand_external(void)
 	imx_barebox_boot_nand_external(nfc_base);
 	jump_sdram(nfc_base - (unsigned long)_text);
 	imx_nand_load_image((void *)_text, barebox_image_size);
-	board_init_lowlevel_return();
+	imx35_barebox_entry(0);
 }
 #endif
 
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 07/36] ARM MXS boards: switch to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (4 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 06/36] ARM i.MX boards: switch to barebox_arm_entry Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 08/36] ARM OMAP " Jean-Christophe PLAGNIOL-VILLARD
                     ` (28 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

All boards use hardcoded SDRAM addresses, copied from the board init file.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/Kconfig                                 |    2 ++
 arch/arm/boards/chumby_falconwing/Makefile       |    2 ++
 arch/arm/boards/chumby_falconwing/lowlevel.c     |   11 +++++++++++
 arch/arm/boards/crystalfontz-cfa10036/Makefile   |    2 ++
 arch/arm/boards/crystalfontz-cfa10036/lowlevel.c |   11 +++++++++++
 arch/arm/boards/freescale-mx23-evk/Makefile      |    2 ++
 arch/arm/boards/freescale-mx23-evk/lowlevel.c    |   11 +++++++++++
 arch/arm/boards/freescale-mx28-evk/Makefile      |    2 ++
 arch/arm/boards/freescale-mx28-evk/lowlevel.c    |   11 +++++++++++
 arch/arm/boards/imx233-olinuxino/Makefile        |    2 ++
 arch/arm/boards/imx233-olinuxino/lowlevel.c      |   11 +++++++++++
 arch/arm/boards/karo-tx28/Makefile               |    2 ++
 arch/arm/boards/karo-tx28/lowlevel.c             |   11 +++++++++++
 13 files changed, 80 insertions(+)
 create mode 100644 arch/arm/boards/chumby_falconwing/lowlevel.c
 create mode 100644 arch/arm/boards/crystalfontz-cfa10036/lowlevel.c
 create mode 100644 arch/arm/boards/freescale-mx23-evk/lowlevel.c
 create mode 100644 arch/arm/boards/freescale-mx28-evk/lowlevel.c
 create mode 100644 arch/arm/boards/imx233-olinuxino/lowlevel.c
 create mode 100644 arch/arm/boards/karo-tx28/lowlevel.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index cac3360..627c1b5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -64,6 +64,8 @@ config ARCH_IMX
 config ARCH_MXS
 	bool "Freescale i.MX23/28 (mxs) based"
 	select GENERIC_GPIO
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_NETX
 	bool "Hilscher NetX based"
diff --git a/arch/arm/boards/chumby_falconwing/Makefile b/arch/arm/boards/chumby_falconwing/Makefile
index 0bc79d9..360b55c 100644
--- a/arch/arm/boards/chumby_falconwing/Makefile
+++ b/arch/arm/boards/chumby_falconwing/Makefile
@@ -1 +1,3 @@
 obj-y = falconwing.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/chumby_falconwing/lowlevel.c b/arch/arm/boards/chumby_falconwing/lowlevel.c
new file mode 100644
index 0000000..df28ad4
--- /dev/null
+++ b/arch/arm/boards/chumby_falconwing/lowlevel.c
@@ -0,0 +1,11 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+#include <mach/imx23-regs.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	barebox_arm_entry(IMX_MEMORY_BASE, SZ_64M, 0);
+}
diff --git a/arch/arm/boards/crystalfontz-cfa10036/Makefile b/arch/arm/boards/crystalfontz-cfa10036/Makefile
index 7e8d5e2..0b701ed 100644
--- a/arch/arm/boards/crystalfontz-cfa10036/Makefile
+++ b/arch/arm/boards/crystalfontz-cfa10036/Makefile
@@ -1 +1,3 @@
 obj-y += cfa10036.o hwdetect.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/crystalfontz-cfa10036/lowlevel.c b/arch/arm/boards/crystalfontz-cfa10036/lowlevel.c
new file mode 100644
index 0000000..467194f
--- /dev/null
+++ b/arch/arm/boards/crystalfontz-cfa10036/lowlevel.c
@@ -0,0 +1,11 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+#include <mach/imx28-regs.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	barebox_arm_entry(IMX_MEMORY_BASE, SZ_128M, 0);
+}
diff --git a/arch/arm/boards/freescale-mx23-evk/Makefile b/arch/arm/boards/freescale-mx23-evk/Makefile
index cffb561..9386603 100644
--- a/arch/arm/boards/freescale-mx23-evk/Makefile
+++ b/arch/arm/boards/freescale-mx23-evk/Makefile
@@ -1,2 +1,4 @@
 #
 obj-y := mx23-evk.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/freescale-mx23-evk/lowlevel.c b/arch/arm/boards/freescale-mx23-evk/lowlevel.c
new file mode 100644
index 0000000..0c7e665
--- /dev/null
+++ b/arch/arm/boards/freescale-mx23-evk/lowlevel.c
@@ -0,0 +1,11 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+#include <mach/imx23-regs.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	barebox_arm_entry(IMX_MEMORY_BASE, SZ_32M, 0);
+}
diff --git a/arch/arm/boards/freescale-mx28-evk/Makefile b/arch/arm/boards/freescale-mx28-evk/Makefile
index 3e1f53b..2039610 100644
--- a/arch/arm/boards/freescale-mx28-evk/Makefile
+++ b/arch/arm/boards/freescale-mx28-evk/Makefile
@@ -1 +1,3 @@
 obj-y += mx28-evk.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/freescale-mx28-evk/lowlevel.c b/arch/arm/boards/freescale-mx28-evk/lowlevel.c
new file mode 100644
index 0000000..467194f
--- /dev/null
+++ b/arch/arm/boards/freescale-mx28-evk/lowlevel.c
@@ -0,0 +1,11 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+#include <mach/imx28-regs.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	barebox_arm_entry(IMX_MEMORY_BASE, SZ_128M, 0);
+}
diff --git a/arch/arm/boards/imx233-olinuxino/Makefile b/arch/arm/boards/imx233-olinuxino/Makefile
index 6d71450..b8d9223 100644
--- a/arch/arm/boards/imx233-olinuxino/Makefile
+++ b/arch/arm/boards/imx233-olinuxino/Makefile
@@ -1 +1,3 @@
 obj-y = imx23-olinuxino.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/imx233-olinuxino/lowlevel.c b/arch/arm/boards/imx233-olinuxino/lowlevel.c
new file mode 100644
index 0000000..df28ad4
--- /dev/null
+++ b/arch/arm/boards/imx233-olinuxino/lowlevel.c
@@ -0,0 +1,11 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+#include <mach/imx23-regs.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	barebox_arm_entry(IMX_MEMORY_BASE, SZ_64M, 0);
+}
diff --git a/arch/arm/boards/karo-tx28/Makefile b/arch/arm/boards/karo-tx28/Makefile
index d80ba17..c90bf36 100644
--- a/arch/arm/boards/karo-tx28/Makefile
+++ b/arch/arm/boards/karo-tx28/Makefile
@@ -1,2 +1,4 @@
 obj-y += tx28.o
 obj-$(CONFIG_MACH_TX28STK5) += tx28-stk5.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/karo-tx28/lowlevel.c b/arch/arm/boards/karo-tx28/lowlevel.c
new file mode 100644
index 0000000..467194f
--- /dev/null
+++ b/arch/arm/boards/karo-tx28/lowlevel.c
@@ -0,0 +1,11 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+#include <mach/imx28-regs.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	barebox_arm_entry(IMX_MEMORY_BASE, SZ_128M, 0);
+}
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 08/36] ARM OMAP boards: switch to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (5 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 07/36] ARM MXS " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 09/36] ARM Samsung " Jean-Christophe PLAGNIOL-VILLARD
                     ` (27 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

All boards use hardcoded SDRAM addresses, copied from the board init file.
OMAP3 boards are a bit special, they had a SoC specific reset() function. This
is renamed to omap3_invalidate_dcache() and called from the board lowlevel init
code now.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/Kconfig                                |    2 ++
 arch/arm/boards/archosg9/Makefile               |    4 ++--
 arch/arm/boards/archosg9/lowlevel.c             |    3 ++-
 arch/arm/boards/beagle/lowlevel.c               |   16 ++++++++++++++--
 arch/arm/boards/beaglebone/Makefile             |    2 ++
 arch/arm/boards/beaglebone/lowlevel.c           |   12 +++++++++++-
 arch/arm/boards/omap343xdsp/lowlevel.c          |   15 +++++++++++++--
 arch/arm/boards/omap3evm/lowlevel.c             |   13 +++++++++++--
 arch/arm/boards/panda/lowlevel.c                |    7 ++++---
 arch/arm/boards/pcm049/lowlevel.c               |    7 ++++---
 arch/arm/boards/pcm051/Makefile                 |    2 ++
 arch/arm/boards/pcm051/lowlevel.c               |   11 +++++++++++
 arch/arm/boards/phycard-a-l1/lowlevel.c         |   12 ++++++++++--
 arch/arm/boards/phycard-a-xl2/lowlevel.c        |    7 ++++---
 arch/arm/mach-omap/Kconfig                      |    5 -----
 arch/arm/mach-omap/include/mach/omap3-silicon.h |    1 +
 arch/arm/mach-omap/omap3_core.S                 |   11 ++++-------
 17 files changed, 97 insertions(+), 33 deletions(-)
 create mode 100644 arch/arm/boards/pcm051/lowlevel.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 627c1b5..96ee516 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -82,6 +82,8 @@ config ARCH_OMAP
 	bool "TI OMAP"
 	select HAS_DEBUG_LL
 	select GPIOLIB
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_PXA
 	bool "Intel/Marvell PXA based"
diff --git a/arch/arm/boards/archosg9/Makefile b/arch/arm/boards/archosg9/Makefile
index 450c03f..4cc5a2e 100644
--- a/arch/arm/boards/archosg9/Makefile
+++ b/arch/arm/boards/archosg9/Makefile
@@ -1,4 +1,4 @@
 obj-y += board.o
 obj-$(CONFIG_ARM_BOARD_APPEND_ATAG) += archos_features.o
-obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel.o mux.o
-pbl-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel.o mux.o
+obj-y += lowlevel.o mux.o
+pbl-y += lowlevel.o mux.o
diff --git a/arch/arm/boards/archosg9/lowlevel.c b/arch/arm/boards/archosg9/lowlevel.c
index aea6342..26808f6 100644
--- a/arch/arm/boards/archosg9/lowlevel.c
+++ b/arch/arm/boards/archosg9/lowlevel.c
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <io.h>
 #include <init.h>
+#include <sizes.h>
 #include <mach/omap4-mux.h>
 #include <mach/omap4-silicon.h>
 #include <mach/omap4-clock.h>
@@ -63,7 +64,7 @@ static noinline void archosg9_init_lowlevel(void)
 
 	omap4_ddr_init(&ddr_regs_400_mhz_2cs, &core);
 
-	board_init_lowlevel_return();
+	barebox_arm_entry(0x80000000, SZ_1G, 0);
 }
 
 void __naked __bare_init reset(void)
diff --git a/arch/arm/boards/beagle/lowlevel.c b/arch/arm/boards/beagle/lowlevel.c
index 677f055..c0abbe8 100644
--- a/arch/arm/boards/beagle/lowlevel.c
+++ b/arch/arm/boards/beagle/lowlevel.c
@@ -1,5 +1,7 @@
 #include <io.h>
-#include <init.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
 #include <mach/control.h>
 #include <mach/omap3-silicon.h>
 #include <mach/omap3-mux.h>
@@ -164,4 +166,14 @@ static int beagle_board_init(void)
 
 	return 0;
 }
-pure_initcall(beagle_board_init);
+
+void __naked reset(void)
+{
+	omap3_invalidate_dcache();
+
+	common_reset();
+
+	beagle_board_init();
+
+	barebox_arm_entry(0x80000000, SZ_128M, 0);
+}
diff --git a/arch/arm/boards/beaglebone/Makefile b/arch/arm/boards/beaglebone/Makefile
index 88c223a..3b7261c 100644
--- a/arch/arm/boards/beaglebone/Makefile
+++ b/arch/arm/boards/beaglebone/Makefile
@@ -1,3 +1,5 @@
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
 obj-y += board.o
 obj-y += lowlevel.o
 pbl-y += lowlevel.o
diff --git a/arch/arm/boards/beaglebone/lowlevel.c b/arch/arm/boards/beaglebone/lowlevel.c
index d446e8d..b565c74 100644
--- a/arch/arm/boards/beaglebone/lowlevel.c
+++ b/arch/arm/boards/beaglebone/lowlevel.c
@@ -1,6 +1,8 @@
 #include <init.h>
 #include <sizes.h>
 #include <io.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
 #include <mach/am33xx-silicon.h>
 #include <mach/am33xx-clock.h>
 #include <mach/sdrc.h>
@@ -245,4 +247,12 @@ static int beaglebone_board_init(void)
 
 	return 0;
 }
-pure_initcall(beaglebone_board_init);
+
+void __naked reset(void)
+{
+	common_reset();
+
+	beaglebone_board_init();
+
+	barebox_arm_entry(0x80000000, SZ_256M, 0);
+}
diff --git a/arch/arm/boards/omap343xdsp/lowlevel.c b/arch/arm/boards/omap343xdsp/lowlevel.c
index 0d2ccd4..403de91 100644
--- a/arch/arm/boards/omap343xdsp/lowlevel.c
+++ b/arch/arm/boards/omap343xdsp/lowlevel.c
@@ -1,7 +1,8 @@
 #include <common.h>
 #include <io.h>
-#include <init.h>
 #include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
 #include <mach/omap3-mux.h>
 #include <mach/sdrc.h>
 #include <mach/control.h>
@@ -543,4 +544,14 @@ static int sdp343x_board_init(void)
 
 	return 0;
 }
-pure_initcall(sdp343x_board_init);
+
+void __naked reset(void)
+{
+	omap3_invalidate_dcache();
+
+	common_reset();
+
+	sdp343x_board_init();
+
+	barebox_arm_entry(0x80000000, SZ_128M, 0);
+}
diff --git a/arch/arm/boards/omap3evm/lowlevel.c b/arch/arm/boards/omap3evm/lowlevel.c
index 9050c09..49ecb85 100644
--- a/arch/arm/boards/omap3evm/lowlevel.c
+++ b/arch/arm/boards/omap3evm/lowlevel.c
@@ -1,7 +1,8 @@
-#include <common.h>
 #include <io.h>
 #include <init.h>
 #include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
 #include <mach/omap3-mux.h>
 #include <mach/sdrc.h>
 #include <mach/control.h>
@@ -157,4 +158,12 @@ static int omap3_evm_board_init(void)
 
 	return 0;
 }
-pure_initcall(omap3_evm_board_init);
+
+void __naked reset(void)
+{
+	common_reset();
+
+	omap3_evm_board_init();
+
+	barebox_arm_entry(0x80000000, SZ_128M, 0);
+}
diff --git a/arch/arm/boards/panda/lowlevel.c b/arch/arm/boards/panda/lowlevel.c
index 36e2bc5..df0f9c1 100644
--- a/arch/arm/boards/panda/lowlevel.c
+++ b/arch/arm/boards/panda/lowlevel.c
@@ -18,6 +18,7 @@
  */
 #include <common.h>
 #include <io.h>
+#include <sizes.h>
 #include <mach/omap4-mux.h>
 #include <mach/omap4-silicon.h>
 #include <mach/omap4-clock.h>
@@ -70,8 +71,6 @@ static void noinline panda_init_lowlevel(void)
 
 	/* Set VCORE1 = 1.3 V, VCORE2 = VCORE3 = 1.21V */
 	omap4_scale_vcores(TPS62361_VSEL0_GPIO);
-
-	board_init_lowlevel_return();
 }
 
 void reset(void)
@@ -79,9 +78,11 @@ void reset(void)
 	common_reset();
 
 	if (get_pc() > 0x80000000)
-		board_init_lowlevel_return();
+		goto out;
 
 	arm_setup_stack(0x4030d000);
 
 	panda_init_lowlevel();
+out:
+	barebox_arm_entry(0x80000000, SZ_1G, 0);
 }
diff --git a/arch/arm/boards/pcm049/lowlevel.c b/arch/arm/boards/pcm049/lowlevel.c
index b64244c..8ecf81a 100644
--- a/arch/arm/boards/pcm049/lowlevel.c
+++ b/arch/arm/boards/pcm049/lowlevel.c
@@ -18,6 +18,7 @@
  */
 #include <common.h>
 #include <io.h>
+#include <sizes.h>
 #include <mach/omap4-mux.h>
 #include <mach/omap4-silicon.h>
 #include <mach/omap4-clock.h>
@@ -80,8 +81,6 @@ static void noinline pcm049_init_lowlevel(void)
 	sr32(0x4A30a31C, 16, 4, 0x0); /* set divisor to 1 */
 	sr32(0x4A30a110, 0, 1, 0x1);  /* set the clock source to active */
 	sr32(0x4A30a110, 2, 2, 0x3);  /* enable clocks */
-
-	board_init_lowlevel_return();
 }
 
 void reset(void)
@@ -89,9 +88,11 @@ void reset(void)
 	common_reset();
 
 	if (get_pc() > 0x80000000)
-		board_init_lowlevel_return();
+		goto out;
 
 	arm_setup_stack(0x4030d000);
 
 	pcm049_init_lowlevel();
+out:
+	barebox_arm_entry(0x80000000, SZ_512M, 0);
 }
diff --git a/arch/arm/boards/pcm051/Makefile b/arch/arm/boards/pcm051/Makefile
index dcfc293..8a571d9 100644
--- a/arch/arm/boards/pcm051/Makefile
+++ b/arch/arm/boards/pcm051/Makefile
@@ -1 +1,3 @@
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
 obj-y += board.o
diff --git a/arch/arm/boards/pcm051/lowlevel.c b/arch/arm/boards/pcm051/lowlevel.c
new file mode 100644
index 0000000..683fdce
--- /dev/null
+++ b/arch/arm/boards/pcm051/lowlevel.c
@@ -0,0 +1,11 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+
+void __naked reset(void)
+{
+	common_reset();
+
+	barebox_arm_entry(0x80000000, SZ_512M, 0);
+}
diff --git a/arch/arm/boards/phycard-a-l1/lowlevel.c b/arch/arm/boards/phycard-a-l1/lowlevel.c
index d82c43d..6043d8a 100644
--- a/arch/arm/boards/phycard-a-l1/lowlevel.c
+++ b/arch/arm/boards/phycard-a-l1/lowlevel.c
@@ -1,7 +1,8 @@
-#include <common.h>
 #include <io.h>
 #include <init.h>
 #include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
 #include <mach/omap3-mux.h>
 #include <mach/sdrc.h>
 #include <mach/control.h>
@@ -247,5 +248,12 @@ static int pcaal1_board_init(void)
 
 	return 0;
 }
-pure_initcall(pcaal1_board_init);
 
+void __naked reset(void)
+{
+	common_reset();
+
+	pcaal1_board_init();
+
+	barebox_arm_entry(0x80000000, SZ_256M, 0);
+}
diff --git a/arch/arm/boards/phycard-a-xl2/lowlevel.c b/arch/arm/boards/phycard-a-xl2/lowlevel.c
index 5d8693a..f8f4db5 100644
--- a/arch/arm/boards/phycard-a-xl2/lowlevel.c
+++ b/arch/arm/boards/phycard-a-xl2/lowlevel.c
@@ -18,6 +18,7 @@
  */
 #include <common.h>
 #include <io.h>
+#include <sizes.h>
 #include <mach/omap4-mux.h>
 #include <mach/omap4-silicon.h>
 #include <mach/omap4-clock.h>
@@ -80,8 +81,6 @@ static noinline void pcaaxl2_init_lowlevel(void)
 	sr32(0x4A30a31C, 16, 4, 0x0); /* set divisor to 1 */
 	sr32(0x4A30a110, 0, 1, 0x1);  /* set the clock source to active */
 	sr32(0x4A30a110, 2, 2, 0x3);  /* enable clocks */
-
-	board_init_lowlevel_return();
 }
 
 void reset(void)
@@ -89,9 +88,11 @@ void reset(void)
 	common_reset();
 
 	if (get_pc() > 0x80000000)
-		board_init_lowlevel_return();
+		goto out;
 
 	arm_setup_stack(0x4030d000);
 
 	pcaaxl2_init_lowlevel();
+out:
+	barebox_arm_entry(0x80000000, SZ_512M, 0);
 }
diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
index f659184..a87fc4b 100644
--- a/arch/arm/mach-omap/Kconfig
+++ b/arch/arm/mach-omap/Kconfig
@@ -29,7 +29,6 @@ config ARCH_OMAP3
 	bool "OMAP3"
 	select CPU_V7
 	select GENERIC_GPIO
-	select MACH_HAS_LOWLEVEL_INIT
 	select OMAP_CLOCK_SOURCE_S32K
 	help
 	  Say Y here if you are using Texas Instrument's OMAP343x based platform
@@ -148,7 +147,6 @@ config MACH_OMAP3EVM
 
 config MACH_PANDA
 	bool "Texas Instrument's Panda Board"
-	select MACH_HAS_LOWLEVEL_INIT
 	select HAVE_DEFAULT_ENVIRONMENT_NEW
 	depends on ARCH_OMAP4
 	help
@@ -156,7 +154,6 @@ config MACH_PANDA
 
 config MACH_ARCHOSG9
 	bool "Archos G9 tablets"
-	select MACH_HAS_LOWLEVEL_INIT
 	depends on ARCH_OMAP4
 	help
 	  Say Y here if you are using OMAP4-based Archos G9 tablet
@@ -164,7 +161,6 @@ config MACH_ARCHOSG9
 config MACH_PCM049
 	bool "Phytec phyCORE pcm049"
 	depends on ARCH_OMAP4
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say Y here if you are using Phytecs phyCORE pcm049 board
 	  based on OMAP4
@@ -177,7 +173,6 @@ config MACH_PCAAL1
 
 config MACH_PCAAXL2
 	bool "Phytec phyCARD XL2"
-	select MACH_HAS_LOWLEVEL_INIT
 	depends on ARCH_OMAP4
 	help
 	  Say Y here if you are using a phyCARD-A-XL1 PCA-A-XL1
diff --git a/arch/arm/mach-omap/include/mach/omap3-silicon.h b/arch/arm/mach-omap/include/mach/omap3-silicon.h
index 282b587..43b2953 100644
--- a/arch/arm/mach-omap/include/mach/omap3-silicon.h
+++ b/arch/arm/mach-omap/include/mach/omap3-silicon.h
@@ -133,6 +133,7 @@
 /* If Architecture specific init functions are present */
 #ifndef __ASSEMBLY__
 void omap3_core_init(void);
+void omap3_invalidate_dcache(void);
 #endif /* __ASSEMBLY__ */
 
 #endif /* __ASM_ARCH_OMAP3_H */
diff --git a/arch/arm/mach-omap/omap3_core.S b/arch/arm/mach-omap/omap3_core.S
index bc32f55..a47e248 100644
--- a/arch/arm/mach-omap/omap3_core.S
+++ b/arch/arm/mach-omap/omap3_core.S
@@ -33,9 +33,8 @@
 #include <mach/clocks.h>
 #include <asm/barebox-arm-head.h>
 
-#ifdef CONFIG_MACH_DO_LOWLEVEL_INIT
-.section .text.__reset
-ENTRY(reset)
+.section .text.__omap3_invalidate_dcache
+ENTRY(omap3_invalidate_dcache)
 	/* Invalidate all Dcaches */
 #ifndef CONFIG_CPU_V7_DCACHE_SKIP
 	/* If Arch specific ROM code SMI handling does not exist */
@@ -83,8 +82,6 @@ finished_inval:
 	mcr	p15, 2, r10, c0, c0, 0	/* select current cache level in cssr */
 	isb
 #endif /* CONFIG_CPU_V7_DCACHE_SKIP */
-	common_reset r0
 	/* back to arch calling code */
-	b board_init_lowlevel_return
-ENDPROC(reset)
-#endif
+	bx lr
+ENDPROC(omap3_invalidate_dcache)
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 09/36] ARM Samsung boards: switch to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (6 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 08/36] ARM OMAP " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 10/36] ARM PXA " Jean-Christophe PLAGNIOL-VILLARD
                     ` (26 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

All Samsung boards automatically detect their SDRAM size. The size detection
code can't be called safely from lowlevel C code, so instead the minimum SDRAM
size is guessed from the defconfig files.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/Kconfig                                     |    6 ++++++
 arch/arm/boards/a9m2410/lowlevel_init.S              |    9 +++++++--
 arch/arm/boards/a9m2440/lowlevel_init.S              |    9 +++++++--
 arch/arm/boards/friendlyarm-mini2440/lowlevel_init.S |    9 +++++++--
 arch/arm/boards/friendlyarm-mini6410/Makefile        |    2 ++
 arch/arm/boards/friendlyarm-mini6410/lowlevel.c      |   11 +++++++++++
 arch/arm/boards/friendlyarm-tiny210/lowlevel.c       |    4 +++-
 arch/arm/boards/friendlyarm-tiny6410/Makefile        |    3 ++-
 arch/arm/boards/friendlyarm-tiny6410/lowlevel.c      |   11 +++++++++++
 arch/arm/mach-samsung/Kconfig                        |    6 ------
 10 files changed, 56 insertions(+), 14 deletions(-)
 create mode 100644 arch/arm/boards/friendlyarm-mini6410/lowlevel.c
 create mode 100644 arch/arm/boards/friendlyarm-tiny6410/lowlevel.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 96ee516..1e509a4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -94,18 +94,24 @@ config ARCH_S3C24xx
 	select ARCH_SAMSUNG
 	select CPU_ARM920T
 	select GENERIC_GPIO
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_S5PCxx
 	bool "Samsung S5PC110, S5PV210"
 	select ARCH_SAMSUNG
 	select CPU_V7
 	select GENERIC_GPIO
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_S3C64xx
 	bool "Samsung S3C64xx"
 	select ARCH_SAMSUNG
 	select CPU_V6
 	select GENERIC_GPIO
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_VERSATILE
 	bool "ARM Versatile boards (ARM926EJ-S)"
diff --git a/arch/arm/boards/a9m2410/lowlevel_init.S b/arch/arm/boards/a9m2410/lowlevel_init.S
index 502ecdd..178e73a 100644
--- a/arch/arm/boards/a9m2410/lowlevel_init.S
+++ b/arch/arm/boards/a9m2410/lowlevel_init.S
@@ -3,6 +3,7 @@
  */
 
 #include <config.h>
+#include <sizes.h>
 #include <mach/s3c-iomap.h>
 #include <asm/barebox-arm-head.h>
 
@@ -21,7 +22,7 @@ reset:
 	cmp pc, #S3C_SDRAM_END
 	bhs 1f
 
-	b board_init_lowlevel_return
+	b out
 
 /* we are running from NOR or NAND/SRAM memory. Do further initialisation */
 1:
@@ -33,4 +34,8 @@ reset:
 /* up to here we are running from the internal SRAM area */
 	bl s3c24x0_nand_boot
 #endif
-	b board_init_lowlevel_return
+out:
+	mov r0, #S3C_SDRAM_BASE
+	mov r1, #SZ_32M
+	mov r2, #0
+	b barebox_arm_entry
diff --git a/arch/arm/boards/a9m2440/lowlevel_init.S b/arch/arm/boards/a9m2440/lowlevel_init.S
index 8f6cfcb..bd51717 100644
--- a/arch/arm/boards/a9m2440/lowlevel_init.S
+++ b/arch/arm/boards/a9m2440/lowlevel_init.S
@@ -3,6 +3,7 @@
  */
 
 #include <config.h>
+#include <sizes.h>
 #include <mach/s3c-iomap.h>
 #include <mach/s3c24xx-gpio.h>
 #include <asm/barebox-arm-head.h>
@@ -225,7 +226,7 @@ reset:
 	cmp pc, #S3C_SDRAM_END
 	bhs 1f
 
-	b board_init_lowlevel_return
+	b out
 
 /* we are running from NOR or NAND/SRAM memory. Do further initialisation */
 1:
@@ -237,4 +238,8 @@ reset:
 /* up to here we are running from the internal SRAM area */
 	bl s3c24x0_nand_boot
 #endif
-	b board_init_lowlevel_return
+out:
+	mov r0, #S3C_SDRAM_BASE
+	mov r1, #SZ_32M
+	mov r2, #0
+	b barebox_arm_entry
diff --git a/arch/arm/boards/friendlyarm-mini2440/lowlevel_init.S b/arch/arm/boards/friendlyarm-mini2440/lowlevel_init.S
index 5c06b1c..a6e06ed 100644
--- a/arch/arm/boards/friendlyarm-mini2440/lowlevel_init.S
+++ b/arch/arm/boards/friendlyarm-mini2440/lowlevel_init.S
@@ -3,6 +3,7 @@
  */
 
 #include <config.h>
+#include <sizes.h>
 #include <mach/s3c-iomap.h>
 #include <asm/barebox-arm-head.h>
 
@@ -22,7 +23,7 @@ reset:
 	cmp pc, #S3C_SDRAM_END
 	bhs 1f
 
-	b board_init_lowlevel_return
+	b out
 
 /* we are running from NOR or NAND/SRAM memory. Do further initialisation */
 1:
@@ -34,4 +35,8 @@ reset:
 /* up to here we are running from the internal SRAM area */
 	bl s3c24x0_nand_boot
 #endif
-	b board_init_lowlevel_return
+out:
+	mov r0, #S3C_SDRAM_BASE
+	mov r1, #SZ_32M
+	mov r2, #0
+	b barebox_arm_entry
diff --git a/arch/arm/boards/friendlyarm-mini6410/Makefile b/arch/arm/boards/friendlyarm-mini6410/Makefile
index cd7a427..d5fa853 100644
--- a/arch/arm/boards/friendlyarm-mini6410/Makefile
+++ b/arch/arm/boards/friendlyarm-mini6410/Makefile
@@ -1 +1,3 @@
 obj-y += mini6410.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/friendlyarm-mini6410/lowlevel.c b/arch/arm/boards/friendlyarm-mini6410/lowlevel.c
new file mode 100644
index 0000000..61ed757
--- /dev/null
+++ b/arch/arm/boards/friendlyarm-mini6410/lowlevel.c
@@ -0,0 +1,11 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+#include <mach/s3c-iomap.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	barebox_arm_entry(S3C_SDRAM_BASE, SZ_128M, 0);
+}
diff --git a/arch/arm/boards/friendlyarm-tiny210/lowlevel.c b/arch/arm/boards/friendlyarm-tiny210/lowlevel.c
index 695f97d..5d9582e 100644
--- a/arch/arm/boards/friendlyarm-tiny210/lowlevel.c
+++ b/arch/arm/boards/friendlyarm-tiny210/lowlevel.c
@@ -23,6 +23,7 @@
 #include <common.h>
 #include <init.h>
 #include <io.h>
+#include <sizes.h>
 #include <asm/barebox-arm.h>
 #include <asm/barebox-arm-head.h>
 #include <asm/sections.h>
@@ -61,7 +62,8 @@ void __bare_init reset(void)
 #endif
 
 	if (get_pc() < 0xD0000000) /* Are we running from iRAM? */
-		board_init_lowlevel_return(); /* No, we don't. */
+		/* No, we don't. */
+		barebox_arm_entry(S3C_SDRAM_BASE, SZ_64M, 0);
 
 	s5p_init_dram_bank_ddr2(S5P_DMC0_BASE, 0x20E00323, 0, 0);
 
diff --git a/arch/arm/boards/friendlyarm-tiny6410/Makefile b/arch/arm/boards/friendlyarm-tiny6410/Makefile
index b3ab12e..eb0e0ed 100644
--- a/arch/arm/boards/friendlyarm-tiny6410/Makefile
+++ b/arch/arm/boards/friendlyarm-tiny6410/Makefile
@@ -1,3 +1,4 @@
 obj-y += tiny6410.o
-
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
 obj-$(CONFIG_MACH_TINY6410_FA) += development-board.o
diff --git a/arch/arm/boards/friendlyarm-tiny6410/lowlevel.c b/arch/arm/boards/friendlyarm-tiny6410/lowlevel.c
new file mode 100644
index 0000000..61ed757
--- /dev/null
+++ b/arch/arm/boards/friendlyarm-tiny6410/lowlevel.c
@@ -0,0 +1,11 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+#include <mach/s3c-iomap.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	barebox_arm_entry(S3C_SDRAM_BASE, SZ_128M, 0);
+}
diff --git a/arch/arm/mach-samsung/Kconfig b/arch/arm/mach-samsung/Kconfig
index 80575cb..a4dc301 100644
--- a/arch/arm/mach-samsung/Kconfig
+++ b/arch/arm/mach-samsung/Kconfig
@@ -40,7 +40,6 @@ choice
 config MACH_A9M2410
 	bool "Digi A9M2410"
 	select CPU_S3C2410
-	select MACH_HAS_LOWLEVEL_INIT
 	select S3C_PLL_INIT
 	select S3C_SDRAM_INIT
 	help
@@ -50,7 +49,6 @@ config MACH_A9M2410
 config MACH_A9M2440
 	bool "Digi A9M2440"
 	select CPU_S3C2440
-	select MACH_HAS_LOWLEVEL_INIT
 	select S3C_PLL_INIT
 	help
 	  Say Y here if you are using Digi's Connect Core 9M equipped
@@ -59,8 +57,6 @@ config MACH_A9M2440
 config MACH_MINI2440
 	bool "Mini 2440"
 	select CPU_S3C2440
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 	select S3C_PLL_INIT
 	select S3C_SDRAM_INIT
 	select HAS_DM9000
@@ -138,8 +134,6 @@ choice
 config MACH_TINY210
 	bool "Tiny 210"
 	select CPU_S5PV210
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 	select S3C_SDRAM_INIT
 
 endchoice
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 10/36] ARM PXA boards: switch to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (7 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 09/36] ARM Samsung " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 11/36] ARM ep93xx " Jean-Christophe PLAGNIOL-VILLARD
                     ` (25 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

All boards use hardcoded base addresses.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/Kconfig                       |    2 ++
 arch/arm/boards/mioa701/Makefile       |    2 ++
 arch/arm/boards/mioa701/lowlevel.c     |   10 ++++++++++
 arch/arm/boards/pcm027/lowlevel_init.S |    7 +++++--
 4 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/boards/mioa701/lowlevel.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1e509a4..dd8f01e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -88,6 +88,8 @@ config ARCH_OMAP
 config ARCH_PXA
 	bool "Intel/Marvell PXA based"
 	select GENERIC_GPIO
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_S3C24xx
 	bool "Samsung S3C2410, S3C2440"
diff --git a/arch/arm/boards/mioa701/Makefile b/arch/arm/boards/mioa701/Makefile
index dcfc293..88c223a 100644
--- a/arch/arm/boards/mioa701/Makefile
+++ b/arch/arm/boards/mioa701/Makefile
@@ -1 +1,3 @@
 obj-y += board.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/mioa701/lowlevel.c b/arch/arm/boards/mioa701/lowlevel.c
new file mode 100644
index 0000000..6d48c97
--- /dev/null
+++ b/arch/arm/boards/mioa701/lowlevel.c
@@ -0,0 +1,10 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	barebox_arm_entry(0xa0000000, SZ_64M, 0);
+}
diff --git a/arch/arm/boards/pcm027/lowlevel_init.S b/arch/arm/boards/pcm027/lowlevel_init.S
index cf5fcd9..b90682c 100644
--- a/arch/arm/boards/pcm027/lowlevel_init.S
+++ b/arch/arm/boards/pcm027/lowlevel_init.S
@@ -24,6 +24,7 @@
  */
 
 #include <config.h>
+#include <sizes.h>
 #include <mach/pxa-regs.h>
 #include <mach/regs-ost.h>
 #include <mach/regs-intc.h>
@@ -452,5 +453,7 @@ initclks:
 	/* -------------------------------------------------------------------- */
 
 endlowlevel_init:
-	b board_init_lowlevel_return
-
+	mov	r0, #0xa0000000
+	mov	r1, #SZ_64M
+	mov	r2, #0
+	b	barebox_arm_entry
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 11/36] ARM ep93xx boards: switch to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (8 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 10/36] ARM PXA " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 12/36] ARM tegra " Jean-Christophe PLAGNIOL-VILLARD
                     ` (24 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

This architecture is a bit strange. It has up to four SDRAM banks, but
all have a quite limited size. The SDRAM size for the different boards
currently is unknown as it's configurable with Kconfig. We use a SDRAM
size based on the value of the only board we have in the defconfigs:
edb9301. This likely breaks other ep93xx boards.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/Kconfig                     |    2 ++
 arch/arm/boards/edb93xx/sdram_cfg.c  |    4 ++++
 arch/arm/mach-ep93xx/Kconfig         |    8 --------
 arch/arm/mach-ep93xx/Makefile        |    4 ++--
 arch/arm/mach-ep93xx/lowlevel_init.S |   11 ++++++++++-
 5 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index dd8f01e..7b0e59a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -49,6 +49,8 @@ config ARCH_EP93XX
 	bool "Cirrus Logic EP93xx"
 	select CPU_ARM920T
 	select GENERIC_GPIO
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_IMX
 	bool "Freescale iMX-based"
diff --git a/arch/arm/boards/edb93xx/sdram_cfg.c b/arch/arm/boards/edb93xx/sdram_cfg.c
index 9442129..5c2a537 100644
--- a/arch/arm/boards/edb93xx/sdram_cfg.c
+++ b/arch/arm/boards/edb93xx/sdram_cfg.c
@@ -36,6 +36,10 @@ static void program_mode_registers(void);
 void sdram_cfg(void)
 {
 	struct sdram_regs *sdram = (struct sdram_regs *)SDRAM_BASE;
+	unsigned long pc = get_pc();
+
+	if (pc < CONFIG_EP93XX_SDRAM_BANK3_BASE + CONFIG_EP93XX_SDRAM_BANK3_SIZE)
+		return;
 
 	writel(SDRAM_DEVCFG_VAL, &sdram->SDRAM_DEVCFG_REG);
 
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index ed6e986..90859d5 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -38,7 +38,6 @@ choice
 config MACH_EDB9301
 	bool "Cirrus Logic EDB9301"
 	select EP93XX_SDCE3_SYNC_PHYS_OFFSET
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say y here if you are using Cirrus Logic's EDB9301 Evaluation board
 
@@ -103,14 +102,12 @@ choice
 config MACH_EDB9302
 	bool "Cirrus Logic EDB9302"
 	select EP93XX_SDCE3_SYNC_PHYS_OFFSET
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say y here if you are using Cirrus Logic's EDB9302 Evaluation board
 
 config MACH_EDB9302A
 	bool "Cirrus Logic EDB9302A"
 	select EP93XX_SDCE0_PHYS_OFFSET
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say y here if you are using Cirrus Logic's EDB9302A Evaluation board
 
@@ -222,14 +219,12 @@ choice
 config MACH_EDB9307
 	bool "Cirrus Logic EDB9307"
 	select EP93XX_SDCE3_SYNC_PHYS_OFFSET
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say y here if you are using Cirrus Logic's EDB9307 Evaluation board
 
 config MACH_EDB9307A
 	bool "Cirrus Logic EDB9307A"
 	select EP93XX_SDCE0_PHYS_OFFSET
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say y here if you are using Cirrus Logic's EDB9307A Evaluation board
 
@@ -309,7 +304,6 @@ choice
 config MACH_EDB9312
 	bool "Cirrus Logic EDB9312"
 	select EP93XX_SDCE3_SYNC_PHYS_OFFSET
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say y here if you are using Cirrus Logic's EDB9312 Evaluation board
 
@@ -358,14 +352,12 @@ choice
 config MACH_EDB9315
 	bool "Cirrus Logic EDB9315"
 	select EP93XX_SDCE3_SYNC_PHYS_OFFSET
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say y here if you are using Cirrus Logic's EDB9315 Evaluation board
 
 config MACH_EDB9315A
 	bool "Cirrus Logic EDB9315A"
 	select EP93XX_SDCE0_PHYS_OFFSET
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say y here if you are using Cirrus Logic's EDB9315A Evaluation board
 
diff --git a/arch/arm/mach-ep93xx/Makefile b/arch/arm/mach-ep93xx/Makefile
index 5615394..0ff0b66 100644
--- a/arch/arm/mach-ep93xx/Makefile
+++ b/arch/arm/mach-ep93xx/Makefile
@@ -1,4 +1,4 @@
 obj-y += clocksource.o gpio.o led.o header.o
 
-obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o
-pbl-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o led.o
+obj-y += lowlevel_init.o
+pbl-y += lowlevel_init.o led.o
diff --git a/arch/arm/mach-ep93xx/lowlevel_init.S b/arch/arm/mach-ep93xx/lowlevel_init.S
index 6de53dd..154d38d 100644
--- a/arch/arm/mach-ep93xx/lowlevel_init.S
+++ b/arch/arm/mach-ep93xx/lowlevel_init.S
@@ -20,6 +20,7 @@
  *
  */
 
+#include <sizes.h>
 #include <mach/ep93xx-regs.h>
 #include <asm/barebox-arm-head.h>
 
@@ -52,4 +53,12 @@ reset:
 	orr r0, r0, #0xc0000000
 	mcr p15, 0, r0, c1, c0, 0
 
-	b board_init_lowlevel_return
+	/*
+	 * FIXME: This is suitable for the edb9301, the
+	 * only ep93xx board we have in our defconfigs.
+	 * Other boards need different values here.
+	 */
+	mov	r0, #0x05000000
+	mov	r1, #SZ_8M
+	mov	r2, #0
+	b	barebox_arm_entry
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 12/36] ARM tegra boards: switch to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (9 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 11/36] ARM ep93xx " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 13/36] ARM nomadik " Jean-Christophe PLAGNIOL-VILLARD
                     ` (23 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Only one board, Toshiba AC100. This uses hardcoded SDRAM values.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/Kconfig                         |    2 ++
 arch/arm/boards/toshiba-ac100/Makefile   |    2 ++
 arch/arm/boards/toshiba-ac100/lowlevel.c |   10 ++++++++++
 3 files changed, 14 insertions(+)
 create mode 100644 arch/arm/boards/toshiba-ac100/lowlevel.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7b0e59a..5f5b965 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -126,6 +126,8 @@ config ARCH_TEGRA
 	bool "Nvidia Tegra-based boards"
 	select CPU_ARM926T
 	select HAS_DEBUG_LL
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 endchoice
 
diff --git a/arch/arm/boards/toshiba-ac100/Makefile b/arch/arm/boards/toshiba-ac100/Makefile
index 9e14763..5b74351 100644
--- a/arch/arm/boards/toshiba-ac100/Makefile
+++ b/arch/arm/boards/toshiba-ac100/Makefile
@@ -1,2 +1,4 @@
 obj-y += board.o
 obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/toshiba-ac100/lowlevel.c b/arch/arm/boards/toshiba-ac100/lowlevel.c
new file mode 100644
index 0000000..68706a5
--- /dev/null
+++ b/arch/arm/boards/toshiba-ac100/lowlevel.c
@@ -0,0 +1,10 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	barebox_arm_entry(0x0, SZ_512M, 0);
+}
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 13/36] ARM nomadik boards: switch to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (10 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 12/36] ARM tegra " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 14/36] ARM versatile " Jean-Christophe PLAGNIOL-VILLARD
                     ` (22 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Only one board, the nhk8815. This uses hardcoded SDRAM values.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/Kconfig                   |    2 ++
 arch/arm/boards/nhk8815/Makefile   |    2 ++
 arch/arm/boards/nhk8815/lowlevel.c |   10 ++++++++++
 3 files changed, 14 insertions(+)
 create mode 100644 arch/arm/boards/nhk8815/lowlevel.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5f5b965..dcd48a9 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -77,6 +77,8 @@ config ARCH_NOMADIK
 	bool "STMicroelectronics Nomadik"
 	select CPU_ARM926T
 	select CLOCKSOURCE_NOMADIK
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 	help
 	  Support for the Nomadik platform by ST-Ericsson
 
diff --git a/arch/arm/boards/nhk8815/Makefile b/arch/arm/boards/nhk8815/Makefile
index 2b9dba4..dbb2a71 100644
--- a/arch/arm/boards/nhk8815/Makefile
+++ b/arch/arm/boards/nhk8815/Makefile
@@ -1 +1,3 @@
 obj-y += setup.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/nhk8815/lowlevel.c b/arch/arm/boards/nhk8815/lowlevel.c
new file mode 100644
index 0000000..3956347
--- /dev/null
+++ b/arch/arm/boards/nhk8815/lowlevel.c
@@ -0,0 +1,10 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	barebox_arm_entry(0x0, SZ_64M, 0);
+}
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 14/36] ARM versatile boards: switch to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (11 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 13/36] ARM nomadik " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 15/36] ARM netx " Jean-Christophe PLAGNIOL-VILLARD
                     ` (21 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Only one board, the qemu based Versatile/PB. Uses hardcoded SDRAM settings.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/Kconfig                     |    2 ++
 arch/arm/boards/versatile/Makefile   |    3 ++-
 arch/arm/boards/versatile/lowlevel.c |   10 ++++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boards/versatile/lowlevel.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index dcd48a9..79f797e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -123,6 +123,8 @@ config ARCH_VERSATILE
 	bool "ARM Versatile boards (ARM926EJ-S)"
 	select CPU_ARM926T
 	select GPIOLIB
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_TEGRA
 	bool "Nvidia Tegra-based boards"
diff --git a/arch/arm/boards/versatile/Makefile b/arch/arm/boards/versatile/Makefile
index a17aed3..9dc6869 100644
--- a/arch/arm/boards/versatile/Makefile
+++ b/arch/arm/boards/versatile/Makefile
@@ -1,2 +1,3 @@
-
 obj-$(CONFIG_MACH_VERSATILEPB) += versatilepb.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/versatile/lowlevel.c b/arch/arm/boards/versatile/lowlevel.c
new file mode 100644
index 0000000..3956347
--- /dev/null
+++ b/arch/arm/boards/versatile/lowlevel.c
@@ -0,0 +1,10 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+
+void __naked reset(void)
+{
+	common_reset();
+	barebox_arm_entry(0x0, SZ_64M, 0);
+}
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 15/36] ARM netx boards: switch to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (12 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 14/36] ARM versatile " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 16/36] ARM clep7212: " Jean-Christophe PLAGNIOL-VILLARD
                     ` (20 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Only one board supported, the nxdb500. Uses hardcoded SDRAM settings.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/Kconfig                |    2 ++
 arch/arm/boards/netx/platform.S |    7 +++++--
 arch/arm/mach-netx/Kconfig      |    1 -
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 79f797e..3197f8b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -72,6 +72,8 @@ config ARCH_MXS
 config ARCH_NETX
 	bool "Hilscher NetX based"
 	select CPU_ARM926T
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_NOMADIK
 	bool "STMicroelectronics Nomadik"
diff --git a/arch/arm/boards/netx/platform.S b/arch/arm/boards/netx/platform.S
index 0438921..95ac13b 100644
--- a/arch/arm/boards/netx/platform.S
+++ b/arch/arm/boards/netx/platform.S
@@ -16,10 +16,13 @@
  * GNU General Public License for more details.
  *
  */
-
+#include <sizes.h>
 #include <asm/barebox-arm-head.h>
 
 .globl reset
 reset:
 	common_reset r0
-	b board_init_lowlevel_return
+	mov	r0, #0x80000000
+	mov	r1, #SZ_64M
+	mov	r2, #0
+	b	barebox_arm_entry
diff --git a/arch/arm/mach-netx/Kconfig b/arch/arm/mach-netx/Kconfig
index b767e54..8d8f49b 100644
--- a/arch/arm/mach-netx/Kconfig
+++ b/arch/arm/mach-netx/Kconfig
@@ -45,7 +45,6 @@ choice
 config MACH_NXDB500
 	bool "Hilscher Netx nxdb500"
 	select HAS_NETX_ETHER
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say Y here if you are using the Hilscher Netx nxdb500 board
 
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 16/36] ARM clep7212: switch to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (13 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 15/36] ARM netx " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 17/36] ARM raspberrypi: " Jean-Christophe PLAGNIOL-VILLARD
                     ` (19 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/Kconfig                    |    2 ++
 arch/arm/boards/clep7212/lowlevel.c |    3 ++-
 arch/arm/mach-clps711x/Kconfig      |    2 --
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3197f8b..6ed9bf0 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -44,6 +44,8 @@ config ARCH_CLPS711X
 	bool "Cirrus Logic EP711x/EP721x/EP731x"
 	select CLKDEV_LOOKUP
 	select CPU_32v4T
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_EP93XX
 	bool "Cirrus Logic EP93xx"
diff --git a/arch/arm/boards/clep7212/lowlevel.c b/arch/arm/boards/clep7212/lowlevel.c
index 9b7e241..7465a42 100644
--- a/arch/arm/boards/clep7212/lowlevel.c
+++ b/arch/arm/boards/clep7212/lowlevel.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <sizes.h>
 
 #include <asm/io.h>
 #include <asm/barebox-arm.h>
@@ -52,5 +53,5 @@ void __naked __bare_init reset(void)
 	writel(SDCONF_CASLAT_3 | SDCONF_SIZE_256 | SDCONF_WIDTH_16 |
 	       SDCONF_CLKCTL | SDCONF_ACTIVE, SDCONF);
 
-	board_init_lowlevel_return();
+	barebox_arm_entry(SDRAM0_BASE, SZ_32M, 0);
 }
diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig
index 469ca72..f0adeda 100644
--- a/arch/arm/mach-clps711x/Kconfig
+++ b/arch/arm/mach-clps711x/Kconfig
@@ -5,8 +5,6 @@ choice
 
 config MACH_CLEP7212
 	bool "Cirrus Logic CLEP7212"
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 	help
 	  Boards based on the Cirrus Logic 7212/7312 CPU.
 
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 17/36] ARM raspberrypi: switch to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (14 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 16/36] ARM clep7212: " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 18/36] ARM AT91: switch at91sam9 to barebox_arm_entry part1 Jean-Christophe PLAGNIOL-VILLARD
                     ` (18 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/Kconfig                        |    2 ++
 arch/arm/boards/raspberry-pi/Makefile   |    2 ++
 arch/arm/boards/raspberry-pi/lowlevel.c |   11 +++++++++++
 3 files changed, 15 insertions(+)
 create mode 100644 arch/arm/boards/raspberry-pi/lowlevel.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6ed9bf0..c7daebe 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -39,6 +39,8 @@ config ARCH_BCM2835
 	select COMMON_CLK
 	select CLOCKSOURCE_BCM2835
 	select ARM_AMBA
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_CLPS711X
 	bool "Cirrus Logic EP711x/EP721x/EP731x"
diff --git a/arch/arm/boards/raspberry-pi/Makefile b/arch/arm/boards/raspberry-pi/Makefile
index 6ce5ede..825b30b 100644
--- a/arch/arm/boards/raspberry-pi/Makefile
+++ b/arch/arm/boards/raspberry-pi/Makefile
@@ -1 +1,3 @@
 obj-$(CONFIG_MACH_RPI) += rpi.o
+obj-y += lowlevel.o
+pbl-y += lowlevel.o
diff --git a/arch/arm/boards/raspberry-pi/lowlevel.c b/arch/arm/boards/raspberry-pi/lowlevel.c
new file mode 100644
index 0000000..7a09eed
--- /dev/null
+++ b/arch/arm/boards/raspberry-pi/lowlevel.c
@@ -0,0 +1,11 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+#include <mach/platform.h>
+
+void __naked reset(void)
+{
+        common_reset();
+        barebox_arm_entry(BCM2835_SDRAM_BASE, SZ_128M, 0);
+}
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 18/36] ARM AT91: switch at91sam9 to barebox_arm_entry part1
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (15 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 17/36] ARM raspberrypi: " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 19/36] ARM AT91: switch at91rm9200 board to barebox_arm_entry Jean-Christophe PLAGNIOL-VILLARD
                     ` (17 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

This switches the at91sam926x, 9g10 and 9g20 over to barebox_arm_entry.
For these SoCs we currently support reading back the memory size from
the SDRAM controller, so all of these can have a common reset() function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/at91sam9261ek/Makefile               |    4 ++--
 arch/arm/boards/at91sam9263ek/Makefile               |    4 ++--
 arch/arm/boards/mmccpu/Makefile                      |    4 ++--
 arch/arm/boards/pm9261/Makefile                      |    4 ++--
 arch/arm/boards/pm9263/Makefile                      |    4 ++--
 arch/arm/boards/tny-a926x/Makefile                   |    4 ++--
 arch/arm/boards/usb-a926x/Makefile                   |    4 ++--
 arch/arm/mach-at91/Kconfig                           |   16 +++++++++++-----
 arch/arm/mach-at91/Makefile                          |    7 ++++---
 arch/arm/mach-at91/at91sam9260_lowlevel_init.c       |    2 ++
 arch/arm/mach-at91/at91sam9261_lowlevel_init.c       |    2 ++
 arch/arm/mach-at91/at91sam9263_lowlevel_init.c       |    2 ++
 arch/arm/mach-at91/at91sam926x_lowlevel_init.c       |    7 ++-----
 arch/arm/mach-at91/include/mach/at91_lowlevel_init.h |    5 +++++
 14 files changed, 42 insertions(+), 27 deletions(-)

diff --git a/arch/arm/boards/at91sam9261ek/Makefile b/arch/arm/boards/at91sam9261ek/Makefile
index b6460c3..1702783 100644
--- a/arch/arm/boards/at91sam9261ek/Makefile
+++ b/arch/arm/boards/at91sam9261ek/Makefile
@@ -1,5 +1,5 @@
 obj-y += init.o
 
-obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o
+obj-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += lowlevel_init.o
 
-pbl-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o
+pbl-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += lowlevel_init.o
diff --git a/arch/arm/boards/at91sam9263ek/Makefile b/arch/arm/boards/at91sam9263ek/Makefile
index b6460c3..1702783 100644
--- a/arch/arm/boards/at91sam9263ek/Makefile
+++ b/arch/arm/boards/at91sam9263ek/Makefile
@@ -1,5 +1,5 @@
 obj-y += init.o
 
-obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o
+obj-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += lowlevel_init.o
 
-pbl-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o
+pbl-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += lowlevel_init.o
diff --git a/arch/arm/boards/mmccpu/Makefile b/arch/arm/boards/mmccpu/Makefile
index b6460c3..1702783 100644
--- a/arch/arm/boards/mmccpu/Makefile
+++ b/arch/arm/boards/mmccpu/Makefile
@@ -1,5 +1,5 @@
 obj-y += init.o
 
-obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o
+obj-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += lowlevel_init.o
 
-pbl-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o
+pbl-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += lowlevel_init.o
diff --git a/arch/arm/boards/pm9261/Makefile b/arch/arm/boards/pm9261/Makefile
index b6460c3..1702783 100644
--- a/arch/arm/boards/pm9261/Makefile
+++ b/arch/arm/boards/pm9261/Makefile
@@ -1,5 +1,5 @@
 obj-y += init.o
 
-obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o
+obj-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += lowlevel_init.o
 
-pbl-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o
+pbl-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += lowlevel_init.o
diff --git a/arch/arm/boards/pm9263/Makefile b/arch/arm/boards/pm9263/Makefile
index b6460c3..1702783 100644
--- a/arch/arm/boards/pm9263/Makefile
+++ b/arch/arm/boards/pm9263/Makefile
@@ -1,5 +1,5 @@
 obj-y += init.o
 
-obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o
+obj-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += lowlevel_init.o
 
-pbl-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o
+pbl-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += lowlevel_init.o
diff --git a/arch/arm/boards/tny-a926x/Makefile b/arch/arm/boards/tny-a926x/Makefile
index 36ea09f..caa7163 100644
--- a/arch/arm/boards/tny-a926x/Makefile
+++ b/arch/arm/boards/tny-a926x/Makefile
@@ -5,6 +5,6 @@ obj-$(CONFIG_AT91_BOOTSTRAP) += $(bootstrap-y)
 
 lowlevel_init-$(CONFIG_MACH_TNY_A9263) = tny_a9263_lowlevel_init.o
 
-obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += $(lowlevel_init-y)
+obj-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += $(lowlevel_init-y)
 
-pbl-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += $(lowlevel_init-y)
+pbl-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += $(lowlevel_init-y)
diff --git a/arch/arm/boards/usb-a926x/Makefile b/arch/arm/boards/usb-a926x/Makefile
index e314dd5..88f163f 100644
--- a/arch/arm/boards/usb-a926x/Makefile
+++ b/arch/arm/boards/usb-a926x/Makefile
@@ -5,6 +5,6 @@ obj-$(CONFIG_AT91_BOOTSTRAP) += $(bootstrap-y)
 
 lowlevel_init-$(CONFIG_MACH_USB_A9263) = usb_a9263_lowlevel_init.o
 
-obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += $(lowlevel_init-y)
+obj-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += $(lowlevel_init-y)
 
-pbl-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += $(lowlevel_init-y)
+pbl-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) += $(lowlevel_init-y)
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 14bab55..4e687c4 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -6,6 +6,9 @@ config HAVE_AT91_DBGU0
 config HAVE_AT91_DBGU1
 	bool
 
+config HAVE_AT91_LOWLEVEL_INIT
+	bool
+
 config AT91SAM9_SMC
 	bool
 
@@ -76,6 +79,8 @@ config HAVE_AT91_LOAD_BAREBOX_SRAM
 
 config AT91SAM9_LOWLEVEL_INIT
 	bool
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 comment "Atmel AT91 System-on-Chip"
 
@@ -293,6 +298,7 @@ config MACH_AT91SAM9261EK
 	select HAVE_AT91_DATAFLASH_CARD
 	select MACH_HAS_LOWLEVEL_INIT
 	select HAVE_NAND_ATMEL_BUSWIDTH_16
+	select HAVE_AT91_LOWLEVEL_INIT
 	help
 	  Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit.
 	  <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3820>
@@ -300,7 +306,7 @@ config MACH_AT91SAM9261EK
 config MACH_PM9261
 	bool "Ronetix PM9261"
 	select HAS_DM9000
-	select MACH_HAS_LOWLEVEL_INIT
+	select HAVE_AT91_LOWLEVEL_INIT
 	help
 	  Say y here if you are using the Ronetix PM9261 Board
 
@@ -375,7 +381,7 @@ choice
 
 config MACH_AT91SAM9263EK
 	bool "Atmel AT91SAM9263-EK"
-	select MACH_HAS_LOWLEVEL_INIT
+	select HAVE_AT91_LOWLEVEL_INIT
 	select HAVE_NAND_ATMEL_BUSWIDTH_16
 	help
 	  Say y here if you are using Atmel's AT91SAM9263-EK Evaluation board
@@ -387,7 +393,7 @@ config MACH_MMCCPU
 
 config MACH_PM9263
 	bool "Ronetix PM9263"
-	select MACH_HAS_LOWLEVEL_INIT
+	select HAVE_AT91_LOWLEVEL_INIT
 	help
 	  Say y here if you are using the Ronetix PM9263 Board
 
@@ -401,7 +407,7 @@ config MACH_TNY_A9263
 
 config MACH_USB_A9263
 	bool "CALAO USB-A9263"
-	select MACH_HAS_LOWLEVEL_INIT
+	select HAVE_AT91_LOWLEVEL_INIT
 	help
 	  Select this if you are using a Calao Systems USB-A9263.
 	  <http://www.calao-systems.com>
@@ -565,7 +571,7 @@ endif
 
 config AT91_BOOTSTRAP
 	bool "at91 bootstrap"
-	depends on MACH_HAS_LOWLEVEL_INIT
+	depends on HAVE_AT91_LOWLEVEL_INIT
 	select BOOTSTRAP
 
 config AT91_LOAD_BAREBOX_SRAM
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index f6c8500..1f335f6 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -2,14 +2,15 @@ obj-y += setup.o clock.o gpio.o
 obj-$(CONFIG_CMD_AT91_BOOT_TEST) += boot_test_cmd.o
 
 obj-$(CONFIG_AT91_BOOTSTRAP) += bootstrap.o
-lowlevel_init-$(CONFIG_AT91SAM9_LOWLEVEL_INIT) = at91sam926x_lowlevel_init.o
+sam926x_lowlevel_init-$(CONFIG_AT91SAM9_LOWLEVEL_INIT) = at91sam926x_lowlevel_init.o
+lowlevel_init-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) = $(sam926x_lowlevel_init-y)
 lowlevel_init-$(CONFIG_SOC_AT91SAM9260) += at91sam9260_lowlevel_init.o
 lowlevel_init-$(CONFIG_SOC_AT91SAM9261) += at91sam9261_lowlevel_init.o
 lowlevel_init-$(CONFIG_SOC_AT91SAM9263) += at91sam9263_lowlevel_init.o
 lowlevel_init-$(CONFIG_ARCH_AT91RM9200) = at91rm9200_lowlevel_init.o
-obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += $(lowlevel_init-y)
+obj-y += $(lowlevel_init-y)
 
-pbl-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += $(lowlevel_init-y)
+pbl-y += $(lowlevel_init-y)
 
 obj-$(CONFIG_AT91SAM9_RESET) += at91sam9_reset.o
 obj-$(CONFIG_AT91SAM9G45_RESET) += at91sam9g45_reset.o
diff --git a/arch/arm/mach-at91/at91sam9260_lowlevel_init.c b/arch/arm/mach-at91/at91sam9260_lowlevel_init.c
index c2cf8bf..875c767 100644
--- a/arch/arm/mach-at91/at91sam9260_lowlevel_init.c
+++ b/arch/arm/mach-at91/at91sam9260_lowlevel_init.c
@@ -31,4 +31,6 @@ void __naked __bare_init reset(void)
 
 	at91sam926x_lowlevel_init(IOMEM(AT91SAM9260_BASE_PIOC), false,
 				  AT91_MATRIX_EBICSA);
+
+	barebox_arm_entry(AT91_CHIPSELECT_1, at91_get_sdram_size(), 0);
 }
diff --git a/arch/arm/mach-at91/at91sam9261_lowlevel_init.c b/arch/arm/mach-at91/at91sam9261_lowlevel_init.c
index a2e065f..beaddc8 100644
--- a/arch/arm/mach-at91/at91sam9261_lowlevel_init.c
+++ b/arch/arm/mach-at91/at91sam9261_lowlevel_init.c
@@ -31,4 +31,6 @@ void __naked __bare_init reset(void)
 
 	at91sam926x_lowlevel_init(IOMEM(AT91SAM9261_BASE_PIOC), false,
 				  AT91_MATRIX_EBICSA);
+
+	barebox_arm_entry(AT91_CHIPSELECT_1, at91_get_sdram_size(), 0);
 }
diff --git a/arch/arm/mach-at91/at91sam9263_lowlevel_init.c b/arch/arm/mach-at91/at91sam9263_lowlevel_init.c
index 5260658..5102051 100644
--- a/arch/arm/mach-at91/at91sam9263_lowlevel_init.c
+++ b/arch/arm/mach-at91/at91sam9263_lowlevel_init.c
@@ -31,4 +31,6 @@ void __naked __bare_init reset(void)
 
 	at91sam926x_lowlevel_init(IOMEM(AT91SAM9263_BASE_PIOD), true,
 				  AT91_MATRIX_EBI0CSA);
+
+	barebox_arm_entry(AT91_CHIPSELECT_1, at91_get_sdram_size(), 0);
 }
diff --git a/arch/arm/mach-at91/at91sam926x_lowlevel_init.c b/arch/arm/mach-at91/at91sam926x_lowlevel_init.c
index 8b9b33e..b62615e 100644
--- a/arch/arm/mach-at91/at91sam926x_lowlevel_init.c
+++ b/arch/arm/mach-at91/at91sam926x_lowlevel_init.c
@@ -80,7 +80,7 @@ void __bare_init at91sam926x_lowlevel_init(void *pio, bool is_pio_asr,
 	 */
 	r = at91_pmc_read(AT91_PMC_MCKR);
 	if (r & AT91_PMC_CSS && !in_sram)
-		goto end;
+		return;
 
 	/*
 	 * Enable the Main Oscillator
@@ -123,7 +123,7 @@ void __bare_init at91sam926x_lowlevel_init(void *pio, bool is_pio_asr,
 	 */
 	r = at91_sys_read(AT91_SDRAMC_TR);
 	if (r && !in_sram)
-		goto end;
+		return;
 
 	/* SDRAMC_MR : Normal Mode */
 	at91_sys_write(AT91_SDRAMC_MR, AT91_SDRAMC_MODE_NORMAL);
@@ -182,7 +182,4 @@ void __bare_init at91sam926x_lowlevel_init(void *pio, bool is_pio_asr,
 	 * We will shutdown what we don't need later
 	 */
 	at91_pmc_write(AT91_PMC_PCER, 0xffffffff);
-
-end:
-	board_init_lowlevel_return();
 }
diff --git a/arch/arm/mach-at91/include/mach/at91_lowlevel_init.h b/arch/arm/mach-at91/include/mach/at91_lowlevel_init.h
index 8c53ce7..f8c020b 100644
--- a/arch/arm/mach-at91/include/mach/at91_lowlevel_init.h
+++ b/arch/arm/mach-at91/include/mach/at91_lowlevel_init.h
@@ -28,7 +28,12 @@ struct at91sam926x_lowlevel_cfg {
 	u32 rstc_rmr;
 };
 
+#ifdef CONFIG_HAVE_AT91_LOWLEVEL_INIT
 void at91sam926x_lowlevel_board_config(struct at91sam926x_lowlevel_cfg *cfg);
 void at91sam926x_lowlevel_init(void *pio, bool is_pio_asr, u32 matrix_csa);
+#else
+static inline void at91sam926x_lowlevel_board_config(struct at91sam926x_lowlevel_cfg *cfg) {}
+static inline void at91sam926x_lowlevel_init(void *pio, bool is_pio_asr, u32 matrix_csa) {}
+#endif
 
 #endif /* __AT91_LOWLEVEL_INIT_H__ */
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 19/36] ARM AT91: switch at91rm9200 board to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (16 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 18/36] ARM AT91: switch at91sam9 to barebox_arm_entry part1 Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 20/36] ARM AT91: switch at91sam9g45 " Jean-Christophe PLAGNIOL-VILLARD
                     ` (16 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/Kconfig                    |    1 +
 arch/arm/mach-at91/at91rm9200_lowlevel_init.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 4e687c4..f54b6dc 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -90,6 +90,7 @@ config SOC_AT91RM9200
 	select HAVE_AT91_DBGU0
 	select HAS_AT91_ETHER
 	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 config SOC_AT91SAM9260
 	bool
diff --git a/arch/arm/mach-at91/at91rm9200_lowlevel_init.c b/arch/arm/mach-at91/at91rm9200_lowlevel_init.c
index 4add3d9..221c05d 100644
--- a/arch/arm/mach-at91/at91rm9200_lowlevel_init.c
+++ b/arch/arm/mach-at91/at91rm9200_lowlevel_init.c
@@ -129,5 +129,5 @@ void __naked __bare_init reset(void)
 	set_cr(r);
 
 end:
-	board_init_lowlevel_return();
+	barebox_arm_entry(AT91_CHIPSELECT_1, at91rm9200_get_sdram_size(), 0);
 }
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 20/36] ARM AT91: switch at91sam9g45 to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (17 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 19/36] ARM AT91: switch at91rm9200 board to barebox_arm_entry Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 21/36] ARM AT91: switch at91sam9x5 " Jean-Christophe PLAGNIOL-VILLARD
                     ` (15 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/Kconfig                     |    2 ++
 arch/arm/mach-at91/Makefile                    |    1 +
 arch/arm/mach-at91/at91sam9g45_lowlevel_init.c |   26 ++++++++++++++++++++++++
 3 files changed, 29 insertions(+)
 create mode 100644 arch/arm/mach-at91/at91sam9g45_lowlevel_init.c

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index f54b6dc..69426e4 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -127,6 +127,8 @@ config SOC_AT91SAM9G45
 	select HAVE_AT91_DBGU1
 	select HAS_MACB
 	select AT91SAM9G45_RESET
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 	help
 	  Select this if you are using one of Atmel's AT91SAM9G45 family SoC.
 	  This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11.
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 1f335f6..0ead23c 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -7,6 +7,7 @@ lowlevel_init-$(CONFIG_HAVE_AT91_LOWLEVEL_INIT) = $(sam926x_lowlevel_init-y)
 lowlevel_init-$(CONFIG_SOC_AT91SAM9260) += at91sam9260_lowlevel_init.o
 lowlevel_init-$(CONFIG_SOC_AT91SAM9261) += at91sam9261_lowlevel_init.o
 lowlevel_init-$(CONFIG_SOC_AT91SAM9263) += at91sam9263_lowlevel_init.o
+lowlevel_init-$(CONFIG_SOC_AT91SAM9G45) += at91sam9g45_lowlevel_init.o
 lowlevel_init-$(CONFIG_ARCH_AT91RM9200) = at91rm9200_lowlevel_init.o
 obj-y += $(lowlevel_init-y)
 
diff --git a/arch/arm/mach-at91/at91sam9g45_lowlevel_init.c b/arch/arm/mach-at91/at91sam9g45_lowlevel_init.c
new file mode 100644
index 0000000..689312f
--- /dev/null
+++ b/arch/arm/mach-at91/at91sam9g45_lowlevel_init.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2009-2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Under GPLv2
+  */
+
+#define __LOWLEVEL_INIT__
+
+#include <common.h>
+#include <asm/system.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+#include <mach/hardware.h>
+#include <mach/io.h>
+#include <mach/at91sam9_ddrsdr.h>
+#include <init.h>
+#include <sizes.h>
+
+void __naked __bare_init reset(void)
+{
+	common_reset();
+
+	arm_setup_stack(AT91SAM9G45_SRAM_BASE + AT91SAM9G45_SRAM_SIZE - 16);
+
+	barebox_arm_entry(AT91_CHIPSELECT_6, at91sam9g45_get_ddram_size(1), 0);
+}
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 21/36] ARM AT91: switch at91sam9x5 to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (18 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 20/36] ARM AT91: switch at91sam9g45 " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 22/36] ARM AT91: switch at91sam9n12 " Jean-Christophe PLAGNIOL-VILLARD
                     ` (14 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/Kconfig                    |    2 ++
 arch/arm/mach-at91/Makefile                   |    1 +
 arch/arm/mach-at91/at91sam9x5_lowlevel_init.c |   26 +++++++++++++++++++++++++
 3 files changed, 29 insertions(+)
 create mode 100644 arch/arm/mach-at91/at91sam9x5_lowlevel_init.c

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 69426e4..21949e7 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -139,6 +139,8 @@ config SOC_AT91SAM9X5
 	select HAVE_AT91_DBGU0
 	select HAS_MACB
 	select AT91SAM9G45_RESET
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 	help
 	  Select this if you are using one of Atmel's AT91SAM9x5 family SoC.
 	  This means that your SAM9 name finishes with a '5' (except if it is
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 0ead23c..a03398e 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -8,6 +8,7 @@ lowlevel_init-$(CONFIG_SOC_AT91SAM9260) += at91sam9260_lowlevel_init.o
 lowlevel_init-$(CONFIG_SOC_AT91SAM9261) += at91sam9261_lowlevel_init.o
 lowlevel_init-$(CONFIG_SOC_AT91SAM9263) += at91sam9263_lowlevel_init.o
 lowlevel_init-$(CONFIG_SOC_AT91SAM9G45) += at91sam9g45_lowlevel_init.o
+lowlevel_init-$(CONFIG_SOC_AT91SAM9X5) += at91sam9x5_lowlevel_init.o
 lowlevel_init-$(CONFIG_ARCH_AT91RM9200) = at91rm9200_lowlevel_init.o
 obj-y += $(lowlevel_init-y)
 
diff --git a/arch/arm/mach-at91/at91sam9x5_lowlevel_init.c b/arch/arm/mach-at91/at91sam9x5_lowlevel_init.c
new file mode 100644
index 0000000..e1befcb
--- /dev/null
+++ b/arch/arm/mach-at91/at91sam9x5_lowlevel_init.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2009-2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Under GPLv2
+  */
+
+#define __LOWLEVEL_INIT__
+
+#include <common.h>
+#include <asm/system.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+#include <mach/hardware.h>
+#include <mach/io.h>
+#include <mach/at91sam9_ddrsdr.h>
+#include <init.h>
+#include <sizes.h>
+
+void __naked __bare_init reset(void)
+{
+	common_reset();
+
+	arm_setup_stack(AT91SAM9X5_SRAM_BASE + AT91SAM9X5_SRAM_SIZE - 16);
+
+	barebox_arm_entry(AT91_CHIPSELECT_1, at91sam9x5_get_ddram_size(), 0);
+}
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 22/36] ARM AT91: switch at91sam9n12 to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (19 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 21/36] ARM AT91: switch at91sam9x5 " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 23/36] ARM AT91: switch sama5d3 " Jean-Christophe PLAGNIOL-VILLARD
                     ` (13 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/Kconfig                     |    2 ++
 arch/arm/mach-at91/Makefile                    |    1 +
 arch/arm/mach-at91/at91sam9n12_lowlevel_init.c |   26 ++++++++++++++++++++++++
 3 files changed, 29 insertions(+)
 create mode 100644 arch/arm/mach-at91/at91sam9n12_lowlevel_init.c

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 21949e7..f4b8f9f 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -153,6 +153,8 @@ config SOC_AT91SAM9N12
 	select SOC_AT91SAM9
 	select HAVE_AT91_DBGU0
 	select AT91SAM9G45_RESET
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 	help
 	  Select this if you are using Atmel's AT91SAM9N12 SoC.
 
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index a03398e..c4cbe36 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -9,6 +9,7 @@ lowlevel_init-$(CONFIG_SOC_AT91SAM9261) += at91sam9261_lowlevel_init.o
 lowlevel_init-$(CONFIG_SOC_AT91SAM9263) += at91sam9263_lowlevel_init.o
 lowlevel_init-$(CONFIG_SOC_AT91SAM9G45) += at91sam9g45_lowlevel_init.o
 lowlevel_init-$(CONFIG_SOC_AT91SAM9X5) += at91sam9x5_lowlevel_init.o
+lowlevel_init-$(CONFIG_SOC_AT91SAM9N12) += at91sam9n12_lowlevel_init.o
 lowlevel_init-$(CONFIG_ARCH_AT91RM9200) = at91rm9200_lowlevel_init.o
 obj-y += $(lowlevel_init-y)
 
diff --git a/arch/arm/mach-at91/at91sam9n12_lowlevel_init.c b/arch/arm/mach-at91/at91sam9n12_lowlevel_init.c
new file mode 100644
index 0000000..6acbd06
--- /dev/null
+++ b/arch/arm/mach-at91/at91sam9n12_lowlevel_init.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2009-2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Under GPLv2
+  */
+
+#define __LOWLEVEL_INIT__
+
+#include <common.h>
+#include <asm/system.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+#include <mach/hardware.h>
+#include <mach/io.h>
+#include <mach/at91sam9_ddrsdr.h>
+#include <init.h>
+#include <sizes.h>
+
+void __naked __bare_init reset(void)
+{
+	common_reset();
+
+	arm_setup_stack(AT91SAM9N12_SRAM_BASE + AT91SAM9N12_SRAM_SIZE - 16);
+
+	barebox_arm_entry(AT91_CHIPSELECT_1, at91sam9n12_get_ddram_size(), 0);
+}
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 23/36] ARM AT91: switch sama5d3 to barebox_arm_entry
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (20 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 22/36] ARM AT91: switch at91sam9n12 " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 24/36] ARM: remove now unused MACH_[HAS|DO]_LOWLEVEL_INIT Jean-Christophe PLAGNIOL-VILLARD
                     ` (12 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-at91/Kconfig                 |    2 ++
 arch/arm/mach-at91/Makefile                |    1 +
 arch/arm/mach-at91/sama5d3_lowlevel_init.c |   25 +++++++++++++++++++++++++
 3 files changed, 28 insertions(+)
 create mode 100644 arch/arm/mach-at91/sama5d3_lowlevel_init.c

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index f4b8f9f..723d25e 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -26,6 +26,8 @@ config SOC_SAMA5
 	select CPU_V7
 	select AT91SAM9_SMC
 	select AT91SAM9_TIMER
+	select MACH_HAS_LOWLEVEL_INIT
+	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_TEXT_BASE
 	hex
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index c4cbe36..53ca570 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -11,6 +11,7 @@ lowlevel_init-$(CONFIG_SOC_AT91SAM9G45) += at91sam9g45_lowlevel_init.o
 lowlevel_init-$(CONFIG_SOC_AT91SAM9X5) += at91sam9x5_lowlevel_init.o
 lowlevel_init-$(CONFIG_SOC_AT91SAM9N12) += at91sam9n12_lowlevel_init.o
 lowlevel_init-$(CONFIG_ARCH_AT91RM9200) = at91rm9200_lowlevel_init.o
+lowlevel_init-$(CONFIG_ARCH_SAMA5D3) += sama5d3_lowlevel_init.o
 obj-y += $(lowlevel_init-y)
 
 pbl-y += $(lowlevel_init-y)
diff --git a/arch/arm/mach-at91/sama5d3_lowlevel_init.c b/arch/arm/mach-at91/sama5d3_lowlevel_init.c
new file mode 100644
index 0000000..1d30da6
--- /dev/null
+++ b/arch/arm/mach-at91/sama5d3_lowlevel_init.c
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2009-2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Under GPLv2
+  */
+
+#define __LOWLEVEL_INIT__
+
+#include <common.h>
+#include <sizes.h>
+#include <init.h>
+#include <asm/system.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+#include <mach/hardware.h>
+#include <mach/at91sam9_ddrsdr.h>
+
+void __naked __bare_init reset(void)
+{
+	common_reset();
+
+	arm_setup_stack(SAMA5D3_SRAM_BASE + SAMA5D3_SRAM_SIZE - 16);
+
+	barebox_arm_entry(SAMA5_DDRCS, at91sama5_get_ddram_size(), 0);
+}
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 24/36] ARM: remove now unused MACH_[HAS|DO]_LOWLEVEL_INIT
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (21 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 23/36] ARM AT91: switch sama5d3 " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 25/36] ARM start-pbl: make board_init_lowlevel_return static Jean-Christophe PLAGNIOL-VILLARD
                     ` (11 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/Kconfig                        |   28 ----------------------------
 arch/arm/configs/archosg9_defconfig     |    1 -
 arch/arm/configs/phycard_a_l1_defconfig |    2 --
 arch/arm/cpu/start-pbl.c                |   12 ------------
 arch/arm/cpu/start.c                    |   12 ------------
 arch/arm/mach-at91/Kconfig              |   16 ----------------
 arch/arm/mach-omap/arch-omap.dox        |    1 -
 arch/arm/mach-pxa/Kconfig               |    1 -
 common/Kconfig                          |   12 ------------
 9 files changed, 85 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c7daebe..6f7a71f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -39,22 +39,16 @@ config ARCH_BCM2835
 	select COMMON_CLK
 	select CLOCKSOURCE_BCM2835
 	select ARM_AMBA
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_CLPS711X
 	bool "Cirrus Logic EP711x/EP721x/EP731x"
 	select CLKDEV_LOOKUP
 	select CPU_32v4T
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_EP93XX
 	bool "Cirrus Logic EP93xx"
 	select CPU_ARM920T
 	select GENERIC_GPIO
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_IMX
 	bool "Freescale iMX-based"
@@ -64,27 +58,19 @@ config ARCH_IMX
 	select CLKDEV_LOOKUP
 	select WATCHDOG_IMX_RESET_SOURCE
 	select HAS_DEBUG_LL
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_MXS
 	bool "Freescale i.MX23/28 (mxs) based"
 	select GENERIC_GPIO
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_NETX
 	bool "Hilscher NetX based"
 	select CPU_ARM926T
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_NOMADIK
 	bool "STMicroelectronics Nomadik"
 	select CPU_ARM926T
 	select CLOCKSOURCE_NOMADIK
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 	help
 	  Support for the Nomadik platform by ST-Ericsson
 
@@ -92,52 +78,38 @@ config ARCH_OMAP
 	bool "TI OMAP"
 	select HAS_DEBUG_LL
 	select GPIOLIB
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_PXA
 	bool "Intel/Marvell PXA based"
 	select GENERIC_GPIO
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_S3C24xx
 	bool "Samsung S3C2410, S3C2440"
 	select ARCH_SAMSUNG
 	select CPU_ARM920T
 	select GENERIC_GPIO
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_S5PCxx
 	bool "Samsung S5PC110, S5PV210"
 	select ARCH_SAMSUNG
 	select CPU_V7
 	select GENERIC_GPIO
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_S3C64xx
 	bool "Samsung S3C64xx"
 	select ARCH_SAMSUNG
 	select CPU_V6
 	select GENERIC_GPIO
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_VERSATILE
 	bool "ARM Versatile boards (ARM926EJ-S)"
 	select CPU_ARM926T
 	select GPIOLIB
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_TEGRA
 	bool "Nvidia Tegra-based boards"
 	select CPU_ARM926T
 	select HAS_DEBUG_LL
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 endchoice
 
diff --git a/arch/arm/configs/archosg9_defconfig b/arch/arm/configs/archosg9_defconfig
index 1f3d105..9a051da 100644
--- a/arch/arm/configs/archosg9_defconfig
+++ b/arch/arm/configs/archosg9_defconfig
@@ -2,7 +2,6 @@ CONFIG_MACH_ARCHOSG9=y
 CONFIG_ARCH_OMAP=y
 CONFIG_ARCH_OMAP4=y
 CONFIG_AEABI=y
-# CONFIG_MACH_DO_LOWLEVEL_INIT is not set
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 CONFIG_ARM_UNWIND=y
 # CONFIG_MMU is not set
diff --git a/arch/arm/configs/phycard_a_l1_defconfig b/arch/arm/configs/phycard_a_l1_defconfig
index 5170722..d90a333 100644
--- a/arch/arm/configs/phycard_a_l1_defconfig
+++ b/arch/arm/configs/phycard_a_l1_defconfig
@@ -36,8 +36,6 @@ CONFIG_STACK_SIZE=0x8000
 CONFIG_MALLOC_SIZE=0x1000000
 CONFIG_EXPERIMENTAL=y
 CONFIG_MALLOC_DLMALLOC=y
-CONFIG_MACH_HAS_LOWLEVEL_INIT=y
-CONFIG_MACH_DO_LOWLEVEL_INIT=y
 CONFIG_ARCH_HAS_LOWLEVEL_INIT=y
 CONFIG_PROMPT="phyCARD-A-L1 >"
 CONFIG_BAUDRATE=115200
diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c
index 11ab025..06c0a17 100644
--- a/arch/arm/cpu/start-pbl.c
+++ b/arch/arm/cpu/start-pbl.c
@@ -45,18 +45,6 @@ void __naked __section(.text_head_entry) pbl_start(void)
 	barebox_arm_head();
 }
 
-/*
- * The actual reset vector. This code is position independent and usually
- * does not run at the address it's linked at.
- */
-#ifndef CONFIG_MACH_DO_LOWLEVEL_INIT
-void __naked __bare_init reset(void)
-{
-	common_reset();
-	board_init_lowlevel_return();
-}
-#endif
-
 extern void *input_data;
 extern void *input_data_end;
 
diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index f212b61..4966ab6 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -40,18 +40,6 @@ void __naked __section(.text_entry) start(void)
 }
 
 /*
- * The actual reset vector. This code is position independent and usually
- * does not run at the address it's linked at.
- */
-#ifndef CONFIG_MACH_DO_LOWLEVEL_INIT
-void __naked __bare_init reset(void)
-{
-	common_reset();
-	board_init_lowlevel_return();
-}
-#endif
-
-/*
  * Board code can jump here by either returning from board_init_lowlevel
  * or by calling this function directly.
  */
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 723d25e..b8528d0 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -26,8 +26,6 @@ config SOC_SAMA5
 	select CPU_V7
 	select AT91SAM9_SMC
 	select AT91SAM9_TIMER
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 config ARCH_TEXT_BASE
 	hex
@@ -81,8 +79,6 @@ config HAVE_AT91_LOAD_BAREBOX_SRAM
 
 config AT91SAM9_LOWLEVEL_INIT
 	bool
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 comment "Atmel AT91 System-on-Chip"
 
@@ -91,8 +87,6 @@ config SOC_AT91RM9200
 	select CPU_ARM920T
 	select HAVE_AT91_DBGU0
 	select HAS_AT91_ETHER
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 
 config SOC_AT91SAM9260
 	bool
@@ -129,8 +123,6 @@ config SOC_AT91SAM9G45
 	select HAVE_AT91_DBGU1
 	select HAS_MACB
 	select AT91SAM9G45_RESET
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 	help
 	  Select this if you are using one of Atmel's AT91SAM9G45 family SoC.
 	  This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11.
@@ -141,8 +133,6 @@ config SOC_AT91SAM9X5
 	select HAVE_AT91_DBGU0
 	select HAS_MACB
 	select AT91SAM9G45_RESET
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 	help
 	  Select this if you are using one of Atmel's AT91SAM9x5 family SoC.
 	  This means that your SAM9 name finishes with a '5' (except if it is
@@ -155,8 +145,6 @@ config SOC_AT91SAM9N12
 	select SOC_AT91SAM9
 	select HAVE_AT91_DBGU0
 	select AT91SAM9G45_RESET
-	select MACH_HAS_LOWLEVEL_INIT
-	select MACH_DO_LOWLEVEL_INIT
 	help
 	  Select this if you are using Atmel's AT91SAM9N12 SoC.
 
@@ -165,7 +153,6 @@ choice
 
 config ARCH_AT91RM9200
 	bool "AT91RM9200"
-	select MACH_DO_LOWLEVEL_INIT
 	select SOC_AT91RM9200
 
 config ARCH_AT91SAM9260
@@ -305,7 +292,6 @@ config MACH_AT91SAM9261EK
 	bool "Atmel AT91SAM9261-EK Evaluation Kit"
 	select HAS_DM9000
 	select HAVE_AT91_DATAFLASH_CARD
-	select MACH_HAS_LOWLEVEL_INIT
 	select HAVE_NAND_ATMEL_BUSWIDTH_16
 	select HAVE_AT91_LOWLEVEL_INIT
 	help
@@ -409,7 +395,6 @@ config MACH_PM9263
 config MACH_TNY_A9263
 	bool "CALAO TNY-A9263"
 	select SUPPORT_CALAO_MOB_TNY_MD2
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Select this if you are using a Calao Systems TNY-A9263.
 	  <http://www.calao-systems.com>
@@ -585,7 +570,6 @@ config AT91_BOOTSTRAP
 
 config AT91_LOAD_BAREBOX_SRAM
 	bool "at91 laad barebox in sram"
-	depends on MACH_HAS_LOWLEVEL_INIT
 	depends on SHELL_NONE || HAVE_AT91_LOAD_BAREBOX_SRAM
 	default y if SHELL_NONE
 
diff --git a/arch/arm/mach-omap/arch-omap.dox b/arch/arm/mach-omap/arch-omap.dox
index 6b6b3a8..8c2b47d 100644
--- a/arch/arm/mach-omap/arch-omap.dox
+++ b/arch/arm/mach-omap/arch-omap.dox
@@ -70,7 +70,6 @@ The responsibility of arch_init_lowlevel and related calls is to setup OMAP. No
 Once this is past, the code returns back to arm common code (cpu/start-arm.S). Here Instruction and Data caches are disabled. The execution proceeds to normal board initialization.
 
 @section board_boot The board boot path
-If the proper CONFIG_MACH_DO_LOWLEVEL_INIT flag is setup, board_init_lowlevel is called. This again would call a common file arch/arm/boards/omap/platform.S which setups a temporary SRAM stack and bumps the control to board_init.
 Every Board in OMAP platform can potentially define a board_init and enable defconfig in arch/arm/configs directory. The responsibility here is to setup OMAP for board configurations - this includes SDRAM configuration and pin muxing configuration.
 
 Once this is complete, @a barebox boot process proceeds by calling init functions and finally entering shell prompt
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 6808d2f..2bc040c 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -42,7 +42,6 @@ config MACH_MIOA701
 
 config MACH_PCM027
 	bool "Phytec phyCORE-PXA270"
-	select MACH_HAS_LOWLEVEL_INIT
 	help
 	  Say Y here if you are using a Phytec phyCORE PXA270
 	  board
diff --git a/common/Kconfig b/common/Kconfig
index 2e062ba..595e91f 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -244,18 +244,6 @@ config RELOCATABLE
 	  allowing it to relocate to the end of the available RAM. This
 	  way you have the whole memory in a single piece.
 
-config MACH_HAS_LOWLEVEL_INIT
-	bool
-
-config MACH_DO_LOWLEVEL_INIT
-	bool "run machine low-level init"
-	depends on MACH_HAS_LOWLEVEL_INIT
-	default y
-	help
-	  This entry enables SDRAM and other board low level initialization
-	  on many platforms. Disabling this option allows configurations to use
-	  barebox as a second stage boot loader.
-
 config PROMPT
 	string
 	prompt "barebox command prompt"
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 25/36] ARM start-pbl: make board_init_lowlevel_return static
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (22 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 24/36] ARM: remove now unused MACH_[HAS|DO]_LOWLEVEL_INIT Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 26/36] ARM start-pbl: call uncompressed binary with arguments Jean-Christophe PLAGNIOL-VILLARD
                     ` (10 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/start-pbl.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c
index 06c0a17..0da4fef 100644
--- a/arch/arm/cpu/start-pbl.c
+++ b/arch/arm/cpu/start-pbl.c
@@ -139,18 +139,12 @@ static void __noreturn barebox_uncompress(void *compressed_start, unsigned int l
 	barebox();
 }
 
-/*
- * Board code can jump here by either returning from board_init_lowlevel
- * or by calling this function directly.
- */
-void __naked __noreturn board_init_lowlevel_return(void)
+static noinline __noreturn void __barebox_arm_entry(uint32_t membase,
+		uint32_t memsize, uint32_t boarddata)
 {
 	uint32_t offset;
 	uint32_t pg_start, pg_end, pg_len;
 
-	/* Setup the stack */
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 16);
-
 	/* Get offset between linked address and runtime address */
 	offset = get_runtime_offset();
 
@@ -194,5 +188,7 @@ void __naked __noreturn board_init_lowlevel_return(void)
 void __naked __noreturn barebox_arm_entry(uint32_t membase, uint32_t memsize,
 		uint32_t boarddata)
 {
-	board_init_lowlevel_return();
+	arm_setup_stack(STACK_BASE + STACK_SIZE - 16);
+
+	__barebox_arm_entry(membase, memsize, boarddata);
 }
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 26/36] ARM start-pbl: call uncompressed binary with arguments
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (23 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 25/36] ARM start-pbl: make board_init_lowlevel_return static Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 27/36] ARM start: pickup parameters from pbl Jean-Christophe PLAGNIOL-VILLARD
                     ` (9 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/start-pbl.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c
index 0da4fef..64cd6ff 100644
--- a/arch/arm/cpu/start-pbl.c
+++ b/arch/arm/cpu/start-pbl.c
@@ -106,9 +106,8 @@ static void mmu_disable(void)
 	__mmu_cache_off();
 }
 
-static void __noreturn barebox_uncompress(void *compressed_start, unsigned int len)
+static void barebox_uncompress(void *compressed_start, unsigned int len)
 {
-	void __noreturn (*barebox)(void);
 	/*
 	 * remap_cached currently does not work rendering the feature
 	 * of enabling the MMU in the PBL useless. disable for now.
@@ -124,19 +123,12 @@ static void __noreturn barebox_uncompress(void *compressed_start, unsigned int l
 	if (use_mmu)
 		mmu_enable((unsigned long)compressed_start, len);
 
-	if (IS_ENABLED(CONFIG_THUMB2_BAREBOX))
-		barebox = (void *)(TEXT_BASE + 1);
-	else
-		barebox = (void *)TEXT_BASE;
-
 	pbl_barebox_uncompress((void*)TEXT_BASE, compressed_start, len);
 
 	if (use_mmu)
 		mmu_disable();
 
 	flush_icache();
-
-	barebox();
 }
 
 static noinline __noreturn void __barebox_arm_entry(uint32_t membase,
@@ -144,6 +136,7 @@ static noinline __noreturn void __barebox_arm_entry(uint32_t membase,
 {
 	uint32_t offset;
 	uint32_t pg_start, pg_end, pg_len;
+	void __noreturn (*barebox)(uint32_t, uint32_t, uint32_t);
 
 	/* Get offset between linked address and runtime address */
 	offset = get_runtime_offset();
@@ -164,6 +157,13 @@ static noinline __noreturn void __barebox_arm_entry(uint32_t membase,
 	setup_c();
 
 	barebox_uncompress((void *)pg_start, pg_len);
+
+	if (IS_ENABLED(CONFIG_THUMB2_BAREBOX))
+		barebox = (void *)(TEXT_BASE + 1);
+	else
+		barebox = (void *)TEXT_BASE;
+
+	barebox(membase, memsize, boarddata);
 }
 
 /*
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 27/36] ARM start: pickup parameters from pbl
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (24 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 26/36] ARM start-pbl: call uncompressed binary with arguments Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 28/36] ARM: Setup stack at end of SDRAM Jean-Christophe PLAGNIOL-VILLARD
                     ` (8 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/start.c               |   44 +++++++++++++++++++-----------------
 arch/arm/include/asm/barebox-arm.h |    1 -
 2 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index 4966ab6..9fd1e8d 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -26,32 +26,21 @@
 #include <asm/cache.h>
 #include <memory.h>
 
-/*
- * First function in the uncompressed image. We get here from
- * the pbl.
- */
-void __naked __section(.text_entry) start(void)
+static noinline __noreturn void __start(uint32_t membase, uint32_t memsize,
+		uint32_t boarddata)
 {
-#ifdef CONFIG_PBL_IMAGE
-	board_init_lowlevel_return();
-#else
-	barebox_arm_head();
-#endif
-}
-
-/*
- * Board code can jump here by either returning from board_init_lowlevel
- * or by calling this function directly.
- */
-void __naked __noreturn board_init_lowlevel_return(void)
-{
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 16);
-
 	setup_c();
 
 	start_barebox();
 }
 
+#ifndef CONFIG_PBL_IMAGE
+
+void __naked __section(.text_entry) start(void)
+{
+	barebox_arm_head();
+}
+
 /*
  * Main ARM entry point in the uncompressed image. Call this with the memory
  * region you can spare for barebox. This doesn't necessarily have to be the
@@ -62,5 +51,18 @@ void __naked __noreturn board_init_lowlevel_return(void)
 void __naked __noreturn barebox_arm_entry(uint32_t membase, uint32_t memsize,
                 uint32_t boarddata)
 {
-	board_init_lowlevel_return();
+	arm_setup_stack(STACK_BASE + STACK_SIZE - 16);
+
+	__start(membase, memsize, boarddata);
 }
+#else
+/*
+ * First function in the uncompressed image. We get here from
+ * the pbl. The stack already has been set up by the pbl.
+ */
+void __naked __section(.text_entry) start(uint32_t membase, uint32_t memsize,
+                uint32_t boarddata)
+{
+	__start(membase, memsize, boarddata);
+}
+#endif
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 0574f34..42b7a3f 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -35,7 +35,6 @@ int	dram_init (void);
 extern char __exceptions_start[], __exceptions_stop[];
 
 void board_init_lowlevel(void);
-void __noreturn board_init_lowlevel_return(void);
 uint32_t get_runtime_offset(void);
 
 void setup_c(void);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 28/36] ARM: Setup stack at end of SDRAM
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (25 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 27/36] ARM start: pickup parameters from pbl Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 29/36] ARM pbl: Use dynamic parameters for early malloc space Jean-Christophe PLAGNIOL-VILLARD
                     ` (7 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/cpu.c                 |   12 ++++++++++++
 arch/arm/cpu/start-pbl.c           |    4 +---
 arch/arm/cpu/start.c               |   18 +++++++++++++++++-
 arch/arm/include/asm/barebox-arm.h |    2 ++
 common/meminfo.c                   |    5 -----
 5 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/arch/arm/cpu/cpu.c b/arch/arm/cpu/cpu.c
index 2ca871f..7761f5c 100644
--- a/arch/arm/cpu/cpu.c
+++ b/arch/arm/cpu/cpu.c
@@ -28,6 +28,7 @@
 #include <asm/mmu.h>
 #include <asm/system.h>
 #include <asm/memory.h>
+#include <asm-generic/memory_layout.h>
 #include <asm/system_info.h>
 #include <asm/cputype.h>
 #include <asm/cache.h>
@@ -91,6 +92,17 @@ void arch_shutdown(void)
 	__asm__ __volatile__("msr cpsr, %0" : : "r"(r));
 }
 
+extern unsigned long arm_stack_top;
+
+static int arm_request_stack(void)
+{
+	if (!request_sdram_region("stack", arm_stack_top - STACK_SIZE, STACK_SIZE))
+		pr_err("Error: Cannot request SDRAM region for stack\n");
+
+	return 0;
+}
+coredevice_initcall(arm_request_stack);
+
 #ifdef CONFIG_THUMB2_BAREBOX
 static void thumb2_execute(void *func, int argc, char *argv[])
 {
diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c
index 64cd6ff..89839f0 100644
--- a/arch/arm/cpu/start-pbl.c
+++ b/arch/arm/cpu/start-pbl.c
@@ -174,8 +174,6 @@ static noinline __noreturn void __barebox_arm_entry(uint32_t membase,
  * be preserved and can be accessed later with barebox_arm_boarddata().
  *
  * -> membase + memsize
- *   ARM_RESERVE_MEM_SIZE    - reserved for board usage. Will not be touched
- *                             by barebox
  *   STACK_SIZE              - stack
  *   16KiB, aligned to 16KiB - First level page table if early MMU support
  *                             is enabled
@@ -188,7 +186,7 @@ static noinline __noreturn void __barebox_arm_entry(uint32_t membase,
 void __naked __noreturn barebox_arm_entry(uint32_t membase, uint32_t memsize,
 		uint32_t boarddata)
 {
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 16);
+	arm_setup_stack(membase + memsize - 16);
 
 	__barebox_arm_entry(membase, memsize, boarddata);
 }
diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index 9fd1e8d..a621161 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -26,11 +26,18 @@
 #include <asm/cache.h>
 #include <memory.h>
 
+unsigned long arm_stack_top;
+
 static noinline __noreturn void __start(uint32_t membase, uint32_t memsize,
 		uint32_t boarddata)
 {
+	unsigned long endmem = membase + memsize;
+
 	setup_c();
 
+	arm_stack_top = endmem;
+	endmem -= STACK_SIZE; /* Stack */
+
 	start_barebox();
 }
 
@@ -47,11 +54,20 @@ void __naked __section(.text_entry) start(void)
  * full SDRAM. The currently running binary can be inside or outside of this
  * region. TEXT_BASE can be inside or outside of this region. boarddata will
  * be preserved and can be accessed later with barebox_arm_boarddata().
+ *
+ * -> membase + memsize
+ *   STACK_SIZE              - stack
+ *   16KiB, aligned to 16KiB - First level page table if early MMU support
+ *                             is enabled
+ * -> maximum end of barebox binary
+ *
+ * Usually a TEXT_BASE of 1MiB below your lowest possible end of memory should
+ * be fine.
  */
 void __naked __noreturn barebox_arm_entry(uint32_t membase, uint32_t memsize,
                 uint32_t boarddata)
 {
-	arm_setup_stack(STACK_BASE + STACK_SIZE - 16);
+	arm_setup_stack(membase + memsize - 16);
 
 	__start(membase, memsize, boarddata);
 }
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 42b7a3f..9c10e36 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -25,6 +25,8 @@
 #ifndef _BAREBOX_ARM_H_
 #define _BAREBOX_ARM_H_
 
+#include <sizes.h>
+
 /* cpu/.../cpu.c */
 int	cleanup_before_linux(void);
 
diff --git a/common/meminfo.c b/common/meminfo.c
index a09b2d2..5e3ff71 100644
--- a/common/meminfo.c
+++ b/common/meminfo.c
@@ -14,11 +14,6 @@ static int display_meminfo(void)
 	debug("bss segment:  0x%p -> 0x%p\n", __bss_start, __bss_stop - 1);
 	printf("malloc space: 0x%08lx -> 0x%08lx (size %s)\n",
 		mstart, mend, size_human_readable(msize));
-#ifdef CONFIG_ARM
-	printf("stack space:  0x%08x -> 0x%08x (size %s)\n",
-		STACK_BASE, STACK_BASE + STACK_SIZE - 1,
-		size_human_readable(STACK_SIZE));
-#endif
 	return 0;
 }
 late_initcall(display_meminfo);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 29/36] ARM pbl: Use dynamic parameters for early malloc space
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (26 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 28/36] ARM: Setup stack at end of SDRAM Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 30/36] ARM mmu: pickup already enabled mmu Jean-Christophe PLAGNIOL-VILLARD
                     ` (6 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/start-pbl.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c
index 89839f0..9c168b3 100644
--- a/arch/arm/cpu/start-pbl.c
+++ b/arch/arm/cpu/start-pbl.c
@@ -114,10 +114,6 @@ static void barebox_uncompress(void *compressed_start, unsigned int len)
 	 */
 	int use_mmu = 0;
 
-	/* set 128 KiB at the end of the MALLOC_BASE for early malloc */
-	free_mem_ptr = MALLOC_BASE + MALLOC_SIZE - SZ_128K;
-	free_mem_end_ptr = free_mem_ptr + SZ_128K;
-
 	ttb = (void *)((free_mem_ptr - 0x4000) & ~0x3fff);
 
 	if (use_mmu)
@@ -137,6 +133,9 @@ static noinline __noreturn void __barebox_arm_entry(uint32_t membase,
 	uint32_t offset;
 	uint32_t pg_start, pg_end, pg_len;
 	void __noreturn (*barebox)(uint32_t, uint32_t, uint32_t);
+	uint32_t endmem = membase + memsize;
+
+	endmem -= STACK_SIZE; /* stack */
 
 	/* Get offset between linked address and runtime address */
 	offset = get_runtime_offset();
@@ -156,6 +155,10 @@ static noinline __noreturn void __barebox_arm_entry(uint32_t membase,
 
 	setup_c();
 
+	endmem -= SZ_128K; /* early malloc */
+	free_mem_ptr = endmem;
+	free_mem_end_ptr = free_mem_ptr + SZ_128K;
+
 	barebox_uncompress((void *)pg_start, pg_len);
 
 	if (IS_ENABLED(CONFIG_THUMB2_BAREBOX))
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 30/36] ARM mmu: pickup already enabled mmu
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (27 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 29/36] ARM pbl: Use dynamic parameters for early malloc space Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 31/36] ARM: Factor out early mmu code Jean-Christophe PLAGNIOL-VILLARD
                     ` (5 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/mmu.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c
index 8f9a43e..73dd0d3 100644
--- a/arch/arm/cpu/mmu.c
+++ b/arch/arm/cpu/mmu.c
@@ -276,7 +276,14 @@ static int mmu_init(void)
 		pte_flags_uncached = PTE_FLAGS_UNCACHED_V4;
 	}
 
-	ttb = memalign(0x10000, 0x4000);
+	if (get_cr() & CR_M) {
+		asm volatile ("mrc  p15,0,%0,c2,c0,0" : "=r"(ttb));
+
+		if (!request_sdram_region("ttb", (unsigned long)ttb, SZ_16K))
+			pr_err("Error: Can't request SDRAM region for ttb\n");
+	} else {
+		ttb = memalign(0x10000, 0x4000);
+	}
 
 	pr_debug("ttb: 0x%p\n", ttb);
 
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 31/36] ARM: Factor out early mmu code
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (28 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 30/36] ARM mmu: pickup already enabled mmu Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 32/36] ARM: Enable mmu early Jean-Christophe PLAGNIOL-VILLARD
                     ` (4 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Move early mmu code to a separate file so that it can be
used from the pbl and the regular image. Disabling the mmu
can be dropped since the regular mmu code is now able to
pickup an enabled mmu.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/Makefile    |    4 +--
 arch/arm/cpu/mmu-early.c |   53 ++++++++++++++++++++++++++++++++++
 arch/arm/cpu/mmu-early.h |    6 ++++
 arch/arm/cpu/start-pbl.c |   72 ----------------------------------------------
 4 files changed, 61 insertions(+), 74 deletions(-)
 create mode 100644 arch/arm/cpu/mmu-early.c
 create mode 100644 arch/arm/cpu/mmu-early.h

diff --git a/arch/arm/cpu/Makefile b/arch/arm/cpu/Makefile
index 4b0259c..44410ee 100644
--- a/arch/arm/cpu/Makefile
+++ b/arch/arm/cpu/Makefile
@@ -8,8 +8,8 @@ obj-y += start.o setupc.o
 #
 obj-$(CONFIG_CMD_ARM_CPUINFO) += cpuinfo.o
 obj-$(CONFIG_CMD_ARM_MMUINFO) += mmuinfo.o
-obj-$(CONFIG_MMU) += mmu.o cache.o
-pbl-$(CONFIG_MMU) += cache.o
+obj-$(CONFIG_MMU) += mmu.o cache.o mmu-early.o
+pbl-$(CONFIG_MMU) += cache.o mmu-early.o
 obj-$(CONFIG_CPU_32v4T) += cache-armv4.o
 pbl-$(CONFIG_CPU_32v4T) += cache-armv4.o
 obj-$(CONFIG_CPU_32v5) += cache-armv5.o
diff --git a/arch/arm/cpu/mmu-early.c b/arch/arm/cpu/mmu-early.c
new file mode 100644
index 0000000..b8b30df
--- /dev/null
+++ b/arch/arm/cpu/mmu-early.c
@@ -0,0 +1,53 @@
+#include <common.h>
+#include <asm/mmu.h>
+#include <errno.h>
+#include <sizes.h>
+#include <asm/memory.h>
+#include <asm/system.h>
+#include <asm/cache.h>
+
+#include "mmu.h"
+
+static uint32_t *ttb;
+
+static void create_sections(unsigned long addr, int size_m, unsigned int flags)
+{
+	int i;
+
+	addr >>= 20;
+
+	for (i = size_m; i > 0; i--, addr++)
+		ttb[addr] = (addr << 20) | flags;
+}
+
+static void map_cachable(unsigned long start, unsigned long size)
+{
+	start &= ~(SZ_1M - 1);
+	size = (size + (SZ_1M - 1)) & ~(SZ_1M - 1);
+
+	create_sections(start, size >> 20, PMD_SECT_AP_WRITE |
+			PMD_SECT_AP_READ | PMD_TYPE_SECT | PMD_SECT_WB);
+}
+
+void mmu_early_enable(uint32_t membase, uint32_t memsize, uint32_t _ttb)
+{
+	int i;
+
+	ttb = (uint32_t *)_ttb;
+
+	arm_set_cache_functions();
+
+	/* Set the ttb register */
+	asm volatile ("mcr  p15,0,%0,c2,c0,0" : : "r"(ttb) /*:*/);
+
+	/* Set the Domain Access Control Register */
+	i = 0x3;
+	asm volatile ("mcr  p15,0,%0,c3,c0,0" : : "r"(i) /*:*/);
+
+	create_sections(0, 4096, PMD_SECT_AP_WRITE |
+			PMD_SECT_AP_READ | PMD_TYPE_SECT);
+
+	map_cachable(membase, memsize);
+
+	__mmu_cache_on();
+}
diff --git a/arch/arm/cpu/mmu-early.h b/arch/arm/cpu/mmu-early.h
new file mode 100644
index 0000000..af21f52
--- /dev/null
+++ b/arch/arm/cpu/mmu-early.h
@@ -0,0 +1,6 @@
+#ifndef __ARM_CPU_MMU_EARLY_H
+#define __ARM_CPU_MMU_EARLY_H
+
+void mmu_early_enable(uint32_t membase, uint32_t memsize, uint32_t ttb);
+
+#endif /* __ARM_CPU_MMU_EARLY_H */
diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c
index 9c168b3..0599c57 100644
--- a/arch/arm/cpu/start-pbl.c
+++ b/arch/arm/cpu/start-pbl.c
@@ -48,82 +48,10 @@ void __naked __section(.text_head_entry) pbl_start(void)
 extern void *input_data;
 extern void *input_data_end;
 
-static unsigned long *ttb;
-
-static void create_sections(unsigned long addr, int size_m, unsigned int flags)
-{
-	int i;
-
-	addr >>= 20;
-
-	for (i = size_m; i > 0; i--, addr++)
-		ttb[addr] = (addr << 20) | flags;
-}
-
-static void map_cachable(unsigned long start, unsigned long size)
-{
-	start &= ~(SZ_1M - 1);
-	size = (size + (SZ_1M - 1)) & ~(SZ_1M - 1);
-
-	create_sections(start, size >> 20, PMD_SECT_AP_WRITE |
-			PMD_SECT_AP_READ | PMD_TYPE_SECT | PMD_SECT_WB);
-}
-
-static void mmu_enable(unsigned long compressed_start, unsigned int len)
-{
-	int i;
-
-	/* Set the ttb register */
-	asm volatile ("mcr  p15,0,%0,c2,c0,0" : : "r"(ttb) /*:*/);
-
-	/* Set the Domain Access Control Register */
-	i = 0x3;
-	asm volatile ("mcr  p15,0,%0,c3,c0,0" : : "r"(i) /*:*/);
-
-	create_sections(0, 4096, PMD_SECT_AP_WRITE |
-			PMD_SECT_AP_READ | PMD_TYPE_SECT);
-	/*
-	 * Setup all regions we need cacheable, namely:
-	 * - the stack
-	 * - the decompressor code
-	 * - the compressed image
-	 * - the uncompressed image
-	 * - the early malloc space
-	 */
-	map_cachable(STACK_BASE, STACK_SIZE);
-	map_cachable((unsigned long)&_text,
-			(unsigned long)&_end - (unsigned long)&_text);
-	map_cachable((unsigned long)compressed_start, len);
-	map_cachable(TEXT_BASE, len * 4);
-	map_cachable(free_mem_ptr, free_mem_end_ptr - free_mem_ptr);
-
-	__mmu_cache_on();
-}
-
-static void mmu_disable(void)
-{
-	__mmu_cache_flush();
-	__mmu_cache_off();
-}
-
 static void barebox_uncompress(void *compressed_start, unsigned int len)
 {
-	/*
-	 * remap_cached currently does not work rendering the feature
-	 * of enabling the MMU in the PBL useless. disable for now.
-	 */
-	int use_mmu = 0;
-
-	ttb = (void *)((free_mem_ptr - 0x4000) & ~0x3fff);
-
-	if (use_mmu)
-		mmu_enable((unsigned long)compressed_start, len);
-
 	pbl_barebox_uncompress((void*)TEXT_BASE, compressed_start, len);
 
-	if (use_mmu)
-		mmu_disable();
-
 	flush_icache();
 }
 
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 32/36] ARM: Enable mmu early
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (29 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 31/36] ARM: Factor out early mmu code Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 33/36] ARM: Automatically determine malloc size Jean-Christophe PLAGNIOL-VILLARD
                     ` (3 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

This optionally enabled the MMU in the PBL or during early startup for
the non PBL case. The regular MMU init code will pickup the already enabled
MMU later. This might complicate debugging early code, so this has been
made optional.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/start-pbl.c |    8 +++++++-
 arch/arm/cpu/start.c     |   12 ++++++++++++
 common/Kconfig           |    9 +++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c
index 0599c57..a825e9f 100644
--- a/arch/arm/cpu/start-pbl.c
+++ b/arch/arm/cpu/start-pbl.c
@@ -32,7 +32,7 @@
 #include <asm/pgtable.h>
 #include <asm/cache.h>
 
-#include "mmu.h"
+#include "mmu-early.h"
 
 unsigned long free_mem_ptr;
 unsigned long free_mem_end_ptr;
@@ -83,6 +83,12 @@ static noinline __noreturn void __barebox_arm_entry(uint32_t membase,
 
 	setup_c();
 
+	if (IS_ENABLED(CONFIG_MMU_EARLY)) {
+		endmem &= ~0x3fff;
+		endmem -= SZ_16K; /* ttb */
+		mmu_early_enable(membase, memsize, endmem);
+	}
+
 	endmem -= SZ_128K; /* early malloc */
 	free_mem_ptr = endmem;
 	free_mem_end_ptr = free_mem_ptr + SZ_128K;
diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index a621161..d90b244 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -19,6 +19,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <sizes.h>
 #include <asm/barebox-arm.h>
 #include <asm/barebox-arm-head.h>
 #include <asm-generic/memory_layout.h>
@@ -26,6 +27,8 @@
 #include <asm/cache.h>
 #include <memory.h>
 
+#include "mmu-early.h"
+
 unsigned long arm_stack_top;
 
 static noinline __noreturn void __start(uint32_t membase, uint32_t memsize,
@@ -38,6 +41,15 @@ static noinline __noreturn void __start(uint32_t membase, uint32_t memsize,
 	arm_stack_top = endmem;
 	endmem -= STACK_SIZE; /* Stack */
 
+	if (IS_ENABLED(CONFIG_MMU_EARLY)) {
+
+		endmem &= ~0x3fff;
+		endmem -= SZ_16K; /* ttb */
+
+		if (!IS_ENABLED(CONFIG_PBL_IMAGE))
+			mmu_early_enable(membase, memsize, endmem);
+	}
+
 	start_barebox();
 }
 
diff --git a/common/Kconfig b/common/Kconfig
index 595e91f..3f6c11e 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -114,6 +114,15 @@ config MMU
 	  to enable the data cache which depends on the MMU. See Documentation/mmu.txt
 	  for further information.
 
+config MMU_EARLY
+	bool "Enable MMU early"
+	depends on ARM
+	depends on MMU
+	default y
+	help
+	  This enables the MMU during early startup. This speeds up things during startup
+	  of barebox, but may lead to harder to debug code. If unsure say yes here.
+
 config HAVE_CONFIGURABLE_TEXT_BASE
 	bool
 
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 33/36] ARM: Automatically determine malloc size
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (30 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 32/36] ARM: Enable mmu early Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 34/36] generic memory layout: fix deps for [MALLOC|STACK]_BASE Jean-Christophe PLAGNIOL-VILLARD
                     ` (2 subsequent siblings)
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/start.c  |   28 ++++++++++++++++++++++++++++
 arch/arm/lib/Makefile |    1 -
 arch/arm/lib/arm.c    |   14 --------------
 3 files changed, 28 insertions(+), 15 deletions(-)
 delete mode 100644 arch/arm/lib/arm.c

diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index d90b244..cd34d9c 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -35,6 +35,7 @@ static noinline __noreturn void __start(uint32_t membase, uint32_t memsize,
 		uint32_t boarddata)
 {
 	unsigned long endmem = membase + memsize;
+	unsigned long malloc_start, malloc_end;
 
 	setup_c();
 
@@ -50,6 +51,33 @@ static noinline __noreturn void __start(uint32_t membase, uint32_t memsize,
 			mmu_early_enable(membase, memsize, endmem);
 	}
 
+	if ((unsigned long)_text > membase + memsize ||
+			(unsigned long)_text < membase)
+		/*
+		 * barebox is either outside SDRAM or in another
+		 * memory bank, so we can use the whole bank for
+		 * malloc.
+		 */
+		malloc_end = endmem;
+	else
+		malloc_end = (unsigned long)_text;
+
+	/*
+	 * Maximum malloc space is the Kconfig value if given
+	 * or 64MB.
+	 */
+	if (MALLOC_SIZE > 0) {
+		malloc_start = malloc_end - MALLOC_SIZE;
+		if (malloc_start < membase)
+			malloc_start = membase;
+	} else {
+		malloc_start = malloc_end - (malloc_end - membase) / 2;
+		if (malloc_end - malloc_start > SZ_64M)
+			malloc_start = malloc_end - SZ_64M;
+	}
+
+	mem_malloc_init((void *)malloc_start, (void *)malloc_end - 1);
+
 	start_barebox();
 }
 
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 2e624cd..3ea695c 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -4,7 +4,6 @@ obj-$(CONFIG_CMD_BOOTZ)	+= bootz.o
 obj-$(CONFIG_CMD_BOOTU)	+= bootu.o
 obj-y	+= div0.o
 obj-y	+= findbit.o
-obj-y	+= arm.o
 obj-y	+= io.o
 obj-y	+= io-readsb.o
 obj-y	+= io-readsw-armv4.o
diff --git a/arch/arm/lib/arm.c b/arch/arm/lib/arm.c
deleted file mode 100644
index 80b62e9..0000000
--- a/arch/arm/lib/arm.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <common.h>
-#include <init.h>
-#include <memory.h>
-#include <asm/barebox-arm.h>
-#include <asm-generic/memory_layout.h>
-
-static int arm_mem_malloc_init(void)
-{
-	mem_malloc_init((void *)MALLOC_BASE,
-			(void *)(MALLOC_BASE + MALLOC_SIZE - 1));
-	return 0;
-}
-
-core_initcall(arm_mem_malloc_init);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 34/36] generic memory layout: fix deps for [MALLOC|STACK]_BASE
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (31 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 33/36] ARM: Automatically determine malloc size Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 35/36] ARM: disable HAVE_CONFIGURABLE_MEMORY_LAYOUT Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 36/36] ARM pbl: inline decompress function Jean-Christophe PLAGNIOL-VILLARD
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Defining STACK_BASE and MALLOC_BASE only makes sense when
either CONFIG_MEMORY_LAYOUT_DEFAULT or CONFIG_MEMORY_LAYOUT_FIXED
is set, so use separate #ifdefs instead ot #if/#else

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 include/asm-generic/memory_layout.h |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/asm-generic/memory_layout.h b/include/asm-generic/memory_layout.h
index eb1607f..45e0ed8 100644
--- a/include/asm-generic/memory_layout.h
+++ b/include/asm-generic/memory_layout.h
@@ -2,15 +2,13 @@
 #define __ASM_GENERIC_MEMORY_LAYOUT_H
 
 #ifdef CONFIG_MEMORY_LAYOUT_DEFAULT
-
 #define MALLOC_BASE (TEXT_BASE - CONFIG_MALLOC_SIZE)
 #define STACK_BASE (TEXT_BASE - CONFIG_MALLOC_SIZE - CONFIG_STACK_SIZE)
+#endif
 
-#else
-
+#ifdef CONFIG_MEMORY_LAYOUT_FIXED
 #define STACK_BASE CONFIG_STACK_BASE
 #define MALLOC_BASE CONFIG_MALLOC_BASE
-
 #endif
 
 #define HEAD_TEXT_BASE MALLOC_BASE
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 35/36] ARM: disable HAVE_CONFIGURABLE_MEMORY_LAYOUT
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (32 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 34/36] generic memory layout: fix deps for [MALLOC|STACK]_BASE Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-03 15:10   ` [PATCH 36/36] ARM pbl: inline decompress function Jean-Christophe PLAGNIOL-VILLARD
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

HAVE_CONFIGURABLE_MEMORY_LAYOUT was first meant as a feature, now it's a
feature to remove it. barebox on ARM now completely uses the memory passed
in from the lowlevel code and configures the malloc area and stack space
during runtime making it obsolete to hardcode these values.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/Kconfig            |    1 -
 arch/arm/pbl/zbarebox.lds.S |    8 ++++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6f7a71f..28332ec 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -2,7 +2,6 @@ config ARM
 	bool
 	select HAS_KALLSYMS
 	select HAS_MODULES
-	select HAVE_CONFIGURABLE_MEMORY_LAYOUT
 	select HAVE_CONFIGURABLE_TEXT_BASE
 	select HAVE_PBL_IMAGE
 	select HAVE_IMAGE_COMPRESSION
diff --git a/arch/arm/pbl/zbarebox.lds.S b/arch/arm/pbl/zbarebox.lds.S
index 37af4e9..564b3c6 100644
--- a/arch/arm/pbl/zbarebox.lds.S
+++ b/arch/arm/pbl/zbarebox.lds.S
@@ -20,7 +20,7 @@
  * MA 02111-1307 USA
  *
  */
-
+#include <sizes.h>
 #include <asm-generic/barebox.lds.h>
 #include <asm-generic/memory_layout.h>
 
@@ -29,7 +29,7 @@ OUTPUT_ARCH(arm)
 ENTRY(pbl_start)
 SECTIONS
 {
-	. = HEAD_TEXT_BASE;
+	. = TEXT_BASE - SZ_2M;
 
 	PRE_IMAGE
 
@@ -71,6 +71,6 @@ SECTIONS
 	}
 	__piggydata_end = .;
 
-	_barebox_image_size = __piggydata_end - HEAD_TEXT_BASE;
-	_barebox_pbl_size = __bss_start - HEAD_TEXT_BASE;
+	_barebox_image_size = __piggydata_end - (TEXT_BASE - SZ_2M);
+	_barebox_pbl_size = __bss_start - (TEXT_BASE - SZ_2M);
 }
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 36/36] ARM pbl: inline decompress function
  2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
                     ` (33 preceding siblings ...)
  2013-02-03 15:10   ` [PATCH 35/36] ARM: disable HAVE_CONFIGURABLE_MEMORY_LAYOUT Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-03 15:10   ` Jean-Christophe PLAGNIOL-VILLARD
  34 siblings, 0 replies; 37+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-03 15:10 UTC (permalink / raw)
  To: barebox

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/start-pbl.c |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c
index a825e9f..91bc8fe 100644
--- a/arch/arm/cpu/start-pbl.c
+++ b/arch/arm/cpu/start-pbl.c
@@ -48,13 +48,6 @@ void __naked __section(.text_head_entry) pbl_start(void)
 extern void *input_data;
 extern void *input_data_end;
 
-static void barebox_uncompress(void *compressed_start, unsigned int len)
-{
-	pbl_barebox_uncompress((void*)TEXT_BASE, compressed_start, len);
-
-	flush_icache();
-}
-
 static noinline __noreturn void __barebox_arm_entry(uint32_t membase,
 		uint32_t memsize, uint32_t boarddata)
 {
@@ -93,7 +86,9 @@ static noinline __noreturn void __barebox_arm_entry(uint32_t membase,
 	free_mem_ptr = endmem;
 	free_mem_end_ptr = free_mem_ptr + SZ_128K;
 
-	barebox_uncompress((void *)pg_start, pg_len);
+	pbl_barebox_uncompress((void*)TEXT_BASE, (void *)pg_start, pg_len);
+
+	flush_icache();
 
 	if (IS_ENABLED(CONFIG_THUMB2_BAREBOX))
 		barebox = (void *)(TEXT_BASE + 1);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2013-02-03 15:14 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-03 15:03 [PATCH v3] Add new ARM entry point for barebox Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10 ` [PATCH 01/36] ARM: Add new " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 02/36] ARM: add __noreturn to board_init_lowlevel_return Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 03/36] ARM i.MX: Use SRAM stack in lowlevel code Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 04/36] ARM i.MX: Add i.MX specific entry point for barebox Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 05/36] ARM i.MX: prepare external nand boot for SoC specific entry Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 06/36] ARM i.MX boards: switch to barebox_arm_entry Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 07/36] ARM MXS " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 08/36] ARM OMAP " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 09/36] ARM Samsung " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 10/36] ARM PXA " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 11/36] ARM ep93xx " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 12/36] ARM tegra " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 13/36] ARM nomadik " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 14/36] ARM versatile " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 15/36] ARM netx " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 16/36] ARM clep7212: " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 17/36] ARM raspberrypi: " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 18/36] ARM AT91: switch at91sam9 to barebox_arm_entry part1 Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 19/36] ARM AT91: switch at91rm9200 board to barebox_arm_entry Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 20/36] ARM AT91: switch at91sam9g45 " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 21/36] ARM AT91: switch at91sam9x5 " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 22/36] ARM AT91: switch at91sam9n12 " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 23/36] ARM AT91: switch sama5d3 " Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 24/36] ARM: remove now unused MACH_[HAS|DO]_LOWLEVEL_INIT Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 25/36] ARM start-pbl: make board_init_lowlevel_return static Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 26/36] ARM start-pbl: call uncompressed binary with arguments Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 27/36] ARM start: pickup parameters from pbl Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 28/36] ARM: Setup stack at end of SDRAM Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 29/36] ARM pbl: Use dynamic parameters for early malloc space Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 30/36] ARM mmu: pickup already enabled mmu Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 31/36] ARM: Factor out early mmu code Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 32/36] ARM: Enable mmu early Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 33/36] ARM: Automatically determine malloc size Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 34/36] generic memory layout: fix deps for [MALLOC|STACK]_BASE Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 35/36] ARM: disable HAVE_CONFIGURABLE_MEMORY_LAYOUT Jean-Christophe PLAGNIOL-VILLARD
2013-02-03 15:10   ` [PATCH 36/36] ARM pbl: inline decompress function Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox