flash: Tidy up coding style for flash functions
[oweals/u-boot.git] / common / board_r.c
index cf3a5f7b7398d10373b69227aec791edc47d179b..96034b874e560f832a7f1f338b848fa2a850a30e 100644 (file)
@@ -13,6 +13,8 @@
 #include <api.h>
 #include <cpu_func.h>
 #include <exports.h>
+#include <hang.h>
+#include <image.h>
 #include <irq_func.h>
 #include <net.h>
 #include <u-boot/crc.h>
@@ -230,9 +232,8 @@ static int initr_unlock_ram_in_cache(void)
 #ifdef CONFIG_PCI
 static int initr_pci(void)
 {
-#ifndef CONFIG_DM_PCI
-       pci_init();
-#endif
+       if (IS_ENABLED(CONFIG_PCI_INIT_R))
+               pci_init();
 
        return 0;
 }
@@ -462,13 +463,14 @@ static int initr_mmc(void)
  */
 static int should_load_env(void)
 {
-#ifdef CONFIG_OF_CONTROL
-       return fdtdec_get_config_int(gd->fdt_blob, "load-environment", 1);
-#elif defined CONFIG_DELAY_ENVIRONMENT
-       return 0;
-#else
+       if (IS_ENABLED(CONFIG_OF_CONTROL))
+               return fdtdec_get_config_int(gd->fdt_blob,
+                                               "load-environment", 1);
+
+       if (IS_ENABLED(CONFIG_DELAY_ENVIRONMENT))
+               return 0;
+
        return 1;
-#endif
 }
 
 static int initr_env(void)
@@ -478,10 +480,10 @@ static int initr_env(void)
                env_relocate();
        else
                env_set_default(NULL, 0);
-#ifdef CONFIG_OF_CONTROL
-       env_set_hex("fdtcontroladdr",
-                   (unsigned long)map_to_sysmem(gd->fdt_blob));
-#endif
+
+       if (IS_ENABLED(CONFIG_OF_CONTROL))
+               env_set_hex("fdtcontroladdr",
+                           (unsigned long)map_to_sysmem(gd->fdt_blob));
 
        /* Initialize from environment */
        image_load_addr = env_get_ulong("loadaddr", 16, image_load_addr);
@@ -516,15 +518,6 @@ static int initr_api(void)
 }
 #endif
 
-/* enable exceptions */
-#ifdef CONFIG_ARM
-static int initr_enable_interrupts(void)
-{
-       enable_interrupts();
-       return 0;
-}
-#endif
-
 #ifdef CONFIG_CMD_NET
 static int initr_ethaddr(void)
 {
@@ -644,15 +637,6 @@ int initr_mem(void)
 }
 #endif
 
-#ifdef CONFIG_CMD_BEDBUG
-static int initr_bedbug(void)
-{
-       bedbug_init();
-
-       return 0;
-}
-#endif
-
 static int run_main_loop(void)
 {
 #ifdef CONFIG_SANDBOX
@@ -811,9 +795,6 @@ static init_fnc_t init_sequence_r[] = {
        initr_kgdb,
 #endif
        interrupt_init,
-#ifdef CONFIG_ARM
-       initr_enable_interrupts,
-#endif
 #if defined(CONFIG_MICROBLAZE) || defined(CONFIG_M68K)
        timer_init,             /* initialize timer */
 #endif
@@ -858,10 +839,13 @@ static init_fnc_t init_sequence_r[] = {
 #endif
 #ifdef CONFIG_CMD_BEDBUG
        INIT_FUNC_WATCHDOG_RESET
-       initr_bedbug,
+       bedbug_init,
 #endif
 #if defined(CONFIG_PRAM)
        initr_mem,
+#endif
+#if defined(CONFIG_M68K) && defined(CONFIG_BLOCK_CACHE)
+       blkcache_init,
 #endif
        run_main_loop,
 };