public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 6/6] riscv: sifive/fu540: Move SPL related functions to spl.c
Date: Sun,  2 Aug 2020 23:09:06 -0700	[thread overview]
Message-ID: <1596434946-12630-6-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1596434946-12630-1-git-send-email-bmeng.cn@gmail.com>

From: Bin Meng <bin.meng@windriver.com>

It's better to keep all SPL related functions in the same spl.c.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 board/sifive/fu540/fu540.c | 33 ---------------------------------
 board/sifive/fu540/spl.c   | 33 ++++++++++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 34 deletions(-)

diff --git a/board/sifive/fu540/fu540.c b/board/sifive/fu540/fu540.c
index 57753ba..54e5a4c 100644
--- a/board/sifive/fu540/fu540.c
+++ b/board/sifive/fu540/fu540.c
@@ -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
diff --git a/board/sifive/fu540/spl.c b/board/sifive/fu540/spl.c
index 135e118..fe27316 100644
--- a/board/sifive/fu540/spl.c
+++ b/board/sifive/fu540/spl.c
@@ -11,11 +11,17 @@
 #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
-- 
2.7.4

  parent reply	other threads:[~2020-08-03  6:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03  6:09 [PATCH 1/6] riscv: Call spl_board_init_f() in the generic SPL board_init_f() Bin Meng
2020-08-03  6:09 ` [PATCH 2/6] riscv: sifive/fu540: spl: Drop our own version of board_init_f() Bin Meng
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4730102@ATCPCS16.andestech.com>
2020-08-04  3:36     ` Rick Chen
2020-08-06  7:37   ` Pragnesh Patel
2020-08-03  6:09 ` [PATCH 3/6] riscv: sifive/fu540: spl: Rename soc_spl_init() Bin Meng
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA473144C@ATCPCS16.andestech.com>
2020-08-06  3:29     ` Rick Chen
2020-08-06  7:38   ` Pragnesh Patel
2020-08-03  6:09 ` [PATCH 4/6] riscv: sifive/fu540: kconfig: Move FU540 driver related options to the SoC level Bin Meng
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4731460@ATCPCS16.andestech.com>
2020-08-06  6:13     ` Rick Chen
2020-08-06  7:40   ` Pragnesh Patel
2020-08-03  6:09 ` [PATCH 5/6] riscv: sifive/fu540: Drop NET_RANDOM_ETHADDR Bin Meng
2020-08-06  3:35   ` Leo Liang
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA47314C2@ATCPCS16.andestech.com>
2020-08-06  6:56     ` Rick Chen
2020-08-06  7:40   ` Pragnesh Patel
2020-08-03  6:09 ` Bin Meng [this message]
2020-08-06  3:36   ` [PATCH 6/6] riscv: sifive/fu540: Move SPL related functions to spl.c Leo Liang
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA47314C9@ATCPCS16.andestech.com>
2020-08-06  7:00     ` Rick Chen
2020-08-06  8:10       ` Bin Meng
2020-08-06  7:42   ` Pragnesh Patel
     [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA47300EA@ATCPCS16.andestech.com>
2020-08-04  3:20   ` [PATCH 1/6] riscv: Call spl_board_init_f() in the generic SPL board_init_f() Rick Chen
2020-08-06  7:37 ` Pragnesh Patel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1596434946-12630-6-git-send-email-bmeng.cn@gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox