]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
riscv: sifive/fu540: Move SPL related functions to spl.c
authorBin Meng <bin.meng@windriver.com>
Mon, 3 Aug 2020 06:09:06 +0000 (23:09 -0700)
committerAndes <uboot@andestech.com>
Fri, 14 Aug 2020 06:38:53 +0000 (14:38 +0800)
It's better to keep all SPL related functions in the same spl.c.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Leo Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Tested-by: Pragnesh Patel <pragnesh.patel@sifive.com>
board/sifive/fu540/fu540.c
board/sifive/fu540/spl.c

index 57753ba50bab80f7e5518bde87b5c08b165575b4..54e5a4c16739e46ca97f2bf74719278a71270d76 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/bitops.h>
 #include <linux/bug.h>
 #include <linux/delay.h>
-#include <linux/io.h>
 #include <misc.h>
 #include <spl.h>
 #include <asm/arch/cache.h>
@@ -127,35 +126,3 @@ int board_init(void)
 
        return 0;
 }
-
-#ifdef CONFIG_SPL
-#define MODE_SELECT_REG                0x1000
-#define MODE_SELECT_QSPI       0x6
-#define MODE_SELECT_SD         0xb
-#define MODE_SELECT_MASK       GENMASK(3, 0)
-
-u32 spl_boot_device(void)
-{
-       u32 mode_select = readl((void *)MODE_SELECT_REG);
-       u32 boot_device = mode_select & MODE_SELECT_MASK;
-
-       switch (boot_device) {
-       case MODE_SELECT_QSPI:
-               return BOOT_DEVICE_SPI;
-       case MODE_SELECT_SD:
-               return BOOT_DEVICE_MMC1;
-       default:
-               debug("Unsupported boot device 0x%x but trying MMC1\n",
-                     boot_device);
-               return BOOT_DEVICE_MMC1;
-       }
-}
-#endif
-
-#ifdef CONFIG_SPL_LOAD_FIT
-int board_fit_config_name_match(const char *name)
-{
-       /* boot using first FIT config */
-       return 0;
-}
-#endif
index 135e118617c9945f9f12787a157c114edb8e3d6e..fe27316b2d9ac75c371774fb1d35ca28d24bee4c 100644 (file)
 #include <misc.h>
 #include <log.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 #include <asm/gpio.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/spl.h>
 
-#define GEM_PHY_RESET  SIFIVE_GENERIC_GPIO_NR(0, 12)
+#define GEM_PHY_RESET          SIFIVE_GENERIC_GPIO_NR(0, 12)
+
+#define MODE_SELECT_REG                0x1000
+#define MODE_SELECT_QSPI       0x6
+#define MODE_SELECT_SD         0xb
+#define MODE_SELECT_MASK       GENMASK(3, 0)
 
 int spl_board_init_f(void)
 {
@@ -55,3 +61,28 @@ int spl_board_init_f(void)
 
        return 0;
 }
+
+u32 spl_boot_device(void)
+{
+       u32 mode_select = readl((void *)MODE_SELECT_REG);
+       u32 boot_device = mode_select & MODE_SELECT_MASK;
+
+       switch (boot_device) {
+       case MODE_SELECT_QSPI:
+               return BOOT_DEVICE_SPI;
+       case MODE_SELECT_SD:
+               return BOOT_DEVICE_MMC1;
+       default:
+               debug("Unsupported boot device 0x%x but trying MMC1\n",
+                     boot_device);
+               return BOOT_DEVICE_MMC1;
+       }
+}
+
+#ifdef CONFIG_SPL_LOAD_FIT
+int board_fit_config_name_match(const char *name)
+{
+       /* boot using first FIT config */
+       return 0;
+}
+#endif