summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/phytec-phycore-imx27/lowlevel.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/boards/phytec-phycore-imx27/lowlevel.c')
-rw-r--r--arch/arm/boards/phytec-phycore-imx27/lowlevel.c65
1 files changed, 29 insertions, 36 deletions
diff --git a/arch/arm/boards/phytec-phycore-imx27/lowlevel.c b/arch/arm/boards/phytec-phycore-imx27/lowlevel.c
index a9e296a0af..a42b30a7bb 100644
--- a/arch/arm/boards/phytec-phycore-imx27/lowlevel.c
+++ b/arch/arm/boards/phytec-phycore-imx27/lowlevel.c
@@ -1,28 +1,13 @@
-/*
- *
- * (c) 2007 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// SPDX-License-Identifier: GPL-2.0-or-later
+// SPDX-FileCopyrightText: Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
+
#include <common.h>
#include <init.h>
-#include <mach/imx27-regs.h>
-#include <mach/imx-pll.h>
-#include <mach/esdctl.h>
+#include <mach/imx/imx27-regs.h>
+#include <mach/imx/imx-pll.h>
+#include <mach/imx/esdctl.h>
#include <io.h>
-#include <mach/imx-nand.h>
+#include <mach/imx/imx-nand.h>
#include <asm/barebox-arm.h>
#include <asm/system.h>
#include <asm-generic/memory_layout.h>
@@ -33,7 +18,24 @@
#define ESDCTL0_VAL (ESDCTL0_SDE | ESDCTL0_ROW13 | ESDCTL0_COL10)
-static void __bare_init __naked noinline phytec_phycorce_imx27_common_init(void *fdt)
+extern char __dtb_imx27_phytec_phycore_rdk_start[];
+
+static void __noreturn phytec_phycore_imx27_start(void)
+{
+ void *fdt;
+
+ fdt = __dtb_imx27_phytec_phycore_rdk_start + get_runtime_offset();
+
+ imx27_barebox_entry(fdt);
+}
+
+static void __noreturn phytec_phycore_imx27_load_nand(void)
+{
+ imx27_nand_load_image();
+ phytec_phycore_imx27_start();
+}
+
+static void __bare_init noinline phytec_phycore_imx27_common_init(void)
{
uint32_t r;
int i;
@@ -49,7 +51,7 @@ static void __bare_init __naked noinline phytec_phycorce_imx27_common_init(void
/* Skip SDRAM initialization if we run from RAM */
r = get_pc();
if (r > 0xa0000000 && r < 0xb0000000)
- goto out;
+ phytec_phycore_imx27_start();
/* re-program the PLL prior(!) starting the SDRAM controller */
writel(MPCTL0_VAL, MX27_CCM_BASE_ADDR + MX27_MPCTL0);
@@ -93,22 +95,13 @@ static void __bare_init __naked noinline phytec_phycorce_imx27_common_init(void
ESDCTL0_BL | ESDCTL0_SMODE_NORMAL,
MX27_ESDCTL_BASE_ADDR + IMX_ESDCTL0);
- if (IS_ENABLED(CONFIG_ARCH_IMX_EXTERNAL_BOOT_NAND))
- imx27_barebox_boot_nand_external(fdt);
-
-out:
- imx27_barebox_entry(fdt);
+ imx27_nand_relocate_to_sdram(phytec_phycore_imx27_load_nand);
+ phytec_phycore_imx27_start();
}
-extern char __dtb_imx27_phytec_phycore_rdk_start[];
-
ENTRY_FUNCTION(start_phytec_phycore_imx27, r0, r1, r2)
{
- void *fdt;
-
arm_setup_stack(MX27_IRAM_BASE_ADDR + MX27_IRAM_SIZE);
- fdt = __dtb_imx27_phytec_phycore_rdk_start + get_runtime_offset();
-
- phytec_phycorce_imx27_common_init(fdt);
+ phytec_phycore_imx27_common_init();
}