Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / arch / arm / mach-omap2 / omap3 / board.c
index f1436fbf519217a6fbed9f87911520a90fd51425..f08c8ab43a06b80de88f467719a84e3eeac0c243 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  *
  * Common board functions for OMAP3 based boards.
  *      Richard Woodruff <r-woodruff2@ti.com>
  *      Syed Mohammed Khasim <khasim@ti.com>
  *
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
+#include <command.h>
 #include <dm.h>
+#include <init.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/omap_common.h>
 #include <linux/compiler.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 /* Declarations */
 extern omap3_sysinfo sysinfo;
 #ifndef CONFIG_SYS_L2CACHE_OFF
 static void omap3_invalidate_l2_cache_secure(void);
 #endif
 
-#ifdef CONFIG_DM_GPIO
+#if CONFIG_IS_ENABLED(DM_GPIO)
+#if !CONFIG_IS_ENABLED(OF_CONTROL)
+/* Manually initialize GPIO banks when OF_CONTROL doesn't */
 static const struct omap_gpio_platdata omap34xx_gpio[] = {
        { 0, OMAP34XX_GPIO1_BASE },
        { 1, OMAP34XX_GPIO2_BASE },
@@ -46,7 +47,7 @@ static const struct omap_gpio_platdata omap34xx_gpio[] = {
        { 5, OMAP34XX_GPIO6_BASE },
 };
 
-U_BOOT_DEVICES(am33xx_gpios) = {
+U_BOOT_DEVICES(omap34xx_gpios) = {
        { "gpio_omap", &omap34xx_gpio[0] },
        { "gpio_omap", &omap34xx_gpio[1] },
        { "gpio_omap", &omap34xx_gpio[2] },
@@ -54,7 +55,7 @@ U_BOOT_DEVICES(am33xx_gpios) = {
        { "gpio_omap", &omap34xx_gpio[4] },
        { "gpio_omap", &omap34xx_gpio[5] },
 };
-
+#endif
 #else
 
 static const struct gpio_bank gpio_bank_34xx[6] = {
@@ -173,6 +174,11 @@ void try_unlock_memory(void)
        return;
 }
 
+void early_system_init(void)
+{
+       hw_data_init();
+}
+
 /******************************************************************************
  * Routine: s_init
  * Description: Does early system init of muxing and clocks.
@@ -181,6 +187,7 @@ void try_unlock_memory(void)
 void s_init(void)
 {
        watchdog_init();
+       early_system_init();
 
        try_unlock_memory();
 
@@ -204,7 +211,14 @@ void s_init(void)
 #ifdef CONFIG_SPL_BUILD
 void board_init_f(ulong dummy)
 {
+       early_system_init();
        mem_init();
+       /*
+       * Save the boot parameters passed from romcode.
+       * We cannot delay the saving further than this,
+       * to prevent overwrites.
+       */
+       save_omap_boot_params();
 }
 #endif
 
@@ -267,7 +281,8 @@ void abort(void)
 /******************************************************************************
  * OMAP3 specific command to switch between NAND HW and SW ecc
  *****************************************************************************/
-static int do_switch_ecc(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_switch_ecc(struct cmd_tbl *cmdtp, int flag, int argc,
+                        char *const argv[])
 {
        int hw, strength = 1;