All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] riscv: Call spl_board_init_f() in the generic SPL board_init_f()
@ 2020-08-03  6:09 Bin Meng
  2020-08-03  6:09 ` [PATCH 2/6] riscv: sifive/fu540: spl: Drop our own version of board_init_f() Bin Meng
                   ` (6 more replies)
  0 siblings, 7 replies; 21+ messages in thread
From: Bin Meng @ 2020-08-03  6:09 UTC (permalink / raw)
  To: u-boot

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

The generic SPL version of board_init_f() should give a call to
board specific codes to initialize board in the SPL phase.

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

 arch/riscv/include/asm/spl.h | 7 +++++++
 arch/riscv/lib/spl.c         | 9 +++++++++
 2 files changed, 16 insertions(+)

diff --git a/arch/riscv/include/asm/spl.h b/arch/riscv/include/asm/spl.h
index 45c03fb..1487f2d 100644
--- a/arch/riscv/include/asm/spl.h
+++ b/arch/riscv/include/asm/spl.h
@@ -28,4 +28,11 @@ enum {
 	BOOT_DEVICE_NONE
 };
 
+/**
+ * spl_board_init_f() - initialize board in the SPL phase
+ *
+ * @return 0 if succeeded, -ve on error
+ */
+int spl_board_init_f(void);
+
 #endif
diff --git a/arch/riscv/lib/spl.c b/arch/riscv/lib/spl.c
index c47dcd4..e24ec5a 100644
--- a/arch/riscv/lib/spl.c
+++ b/arch/riscv/lib/spl.c
@@ -13,6 +13,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+__weak int spl_board_init_f(void)
+{
+	return 0;
+}
+
 __weak void board_init_f(ulong dummy)
 {
 	int ret;
@@ -24,6 +29,10 @@ __weak void board_init_f(ulong dummy)
 	arch_cpu_init_dm();
 
 	preloader_console_init();
+
+	ret = spl_board_init_f();
+	if (ret)
+		panic("spl_board_init_f() failed: %d\n", ret);
 }
 
 void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 2/6] riscv: sifive/fu540: spl: Drop our own version of board_init_f()
  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 ` Bin Meng
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4730102@ATCPCS16.andestech.com>
  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
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 21+ messages in thread
From: Bin Meng @ 2020-08-03  6:09 UTC (permalink / raw)
  To: u-boot

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

Use the generic board_init_f() provided by the RISC-V library codes.

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

 board/sifive/fu540/spl.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/board/sifive/fu540/spl.c b/board/sifive/fu540/spl.c
index 55325cf..31d315d 100644
--- a/board/sifive/fu540/spl.c
+++ b/board/sifive/fu540/spl.c
@@ -17,7 +17,7 @@
 
 #define GEM_PHY_RESET	SIFIVE_GENERIC_GPIO_NR(0, 12)
 
-int init_clk_and_ddr(void)
+int spl_board_init_f(void)
 {
 	int ret;
 
@@ -55,20 +55,3 @@ int init_clk_and_ddr(void)
 
 	return 0;
 }
-
-void board_init_f(ulong dummy)
-{
-	int ret;
-
-	ret = spl_early_init();
-	if (ret)
-		panic("spl_early_init() failed: %d\n", ret);
-
-	arch_cpu_init_dm();
-
-	preloader_console_init();
-
-	ret = init_clk_and_ddr();
-	if (ret)
-		panic("init_clk_and_ddr() failed: %d\n", ret);
-}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 3/6] riscv: sifive/fu540: spl: Rename soc_spl_init()
  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
@ 2020-08-03  6:09 ` Bin Meng
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA473144C@ATCPCS16.andestech.com>
  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
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 21+ messages in thread
From: Bin Meng @ 2020-08-03  6:09 UTC (permalink / raw)
  To: u-boot

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

spl_soc_init() seems to be a better name, as all SPL functions
names start from the spl_ prefix.

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

 arch/riscv/cpu/fu540/spl.c              | 2 +-
 arch/riscv/include/asm/arch-fu540/spl.h | 2 +-
 board/sifive/fu540/spl.c                | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/riscv/cpu/fu540/spl.c b/arch/riscv/cpu/fu540/spl.c
index a2034e9..45657b7 100644
--- a/arch/riscv/cpu/fu540/spl.c
+++ b/arch/riscv/cpu/fu540/spl.c
@@ -7,7 +7,7 @@
 #include <dm.h>
 #include <log.h>
 
-int soc_spl_init(void)
+int spl_soc_init(void)
 {
 	int ret;
 	struct udevice *dev;
diff --git a/arch/riscv/include/asm/arch-fu540/spl.h b/arch/riscv/include/asm/arch-fu540/spl.h
index 0c188be..4697279 100644
--- a/arch/riscv/include/asm/arch-fu540/spl.h
+++ b/arch/riscv/include/asm/arch-fu540/spl.h
@@ -9,6 +9,6 @@
 #ifndef _SPL_SIFIVE_H
 #define _SPL_SIFIVE_H
 
-int soc_spl_init(void);
+int spl_soc_init(void);
 
 #endif /* _SPL_SIFIVE_H */
diff --git a/board/sifive/fu540/spl.c b/board/sifive/fu540/spl.c
index 31d315d..135e118 100644
--- a/board/sifive/fu540/spl.c
+++ b/board/sifive/fu540/spl.c
@@ -21,7 +21,7 @@ int spl_board_init_f(void)
 {
 	int ret;
 
-	ret = soc_spl_init();
+	ret = spl_soc_init();
 	if (ret) {
 		debug("FU540 SPL init failed: %d\n", ret);
 		return ret;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 4/6] riscv: sifive/fu540: kconfig: Move FU540 driver related options to the SoC level
  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
  2020-08-03  6:09 ` [PATCH 3/6] riscv: sifive/fu540: spl: Rename soc_spl_init() Bin Meng
@ 2020-08-03  6:09 ` Bin Meng
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4731460@ATCPCS16.andestech.com>
  2020-08-06  7:40   ` Pragnesh Patel
  2020-08-03  6:09 ` [PATCH 5/6] riscv: sifive/fu540: Drop NET_RANDOM_ETHADDR Bin Meng
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 21+ messages in thread
From: Bin Meng @ 2020-08-03  6:09 UTC (permalink / raw)
  To: u-boot

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

All FU540 driver related options should be in the SoC level Kconfig.

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

 arch/riscv/cpu/fu540/Kconfig | 22 ++++++++++++++++++++++
 board/sifive/fu540/Kconfig   | 22 ----------------------
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/arch/riscv/cpu/fu540/Kconfig b/arch/riscv/cpu/fu540/Kconfig
index 2dcad8e..53e1963 100644
--- a/arch/riscv/cpu/fu540/Kconfig
+++ b/arch/riscv/cpu/fu540/Kconfig
@@ -5,6 +5,9 @@
 config SIFIVE_FU540
 	bool
 	select ARCH_EARLY_INIT_R
+	select SUPPORT_SPL
+	select RAM
+	select SPL_RAM if SPL
 	imply CPU
 	imply CPU_RISCV
 	imply RISCV_TIMER
@@ -13,6 +16,25 @@ config SIFIVE_FU540
 	imply SPL_CPU_SUPPORT
 	imply SPL_OPENSBI
 	imply SPL_LOAD_FIT
+	imply SMP
+	imply CLK_SIFIVE
+	imply CLK_SIFIVE_FU540_PRCI
+	imply SIFIVE_SERIAL
+	imply MACB
+	imply MII
+	imply SPI
+	imply SPI_SIFIVE
+	imply MMC
+	imply MMC_SPI
+	imply MMC_BROKEN_CD
+	imply CMD_MMC
+	imply DM_GPIO
+	imply SIFIVE_GPIO
+	imply CMD_GPIO
+	imply MISC
+	imply SIFIVE_OTP
+	imply DM_PWM
+	imply PWM_SIFIVE
 
 if ENV_IS_IN_SPI_FLASH
 
diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig
index f3217f6..fc28120 100644
--- a/board/sifive/fu540/Kconfig
+++ b/board/sifive/fu540/Kconfig
@@ -26,10 +26,7 @@ config SPL_OPENSBI_LOAD_ADDR
 config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y
 	select SIFIVE_FU540
-	select SUPPORT_SPL
 	select ENV_IS_IN_SPI_FLASH
-	select RAM
-	select SPL_RAM if SPL
 	imply CMD_DHCP
 	imply CMD_EXT2
 	imply CMD_EXT4
@@ -40,34 +37,15 @@ config BOARD_SPECIFIC_OPTIONS # dummy
 	imply CMD_NET
 	imply CMD_PING
 	imply CMD_SF
-	imply CLK_SIFIVE
-	imply CLK_SIFIVE_FU540_PRCI
 	imply DOS_PARTITION
 	imply EFI_PARTITION
 	imply IP_DYN
 	imply ISO_PARTITION
-	imply MACB
-	imply MII
 	imply NET_RANDOM_ETHADDR
 	imply PHY_LIB
 	imply PHY_MSCC
-	imply SIFIVE_SERIAL
-	imply SPI
-	imply SPI_SIFIVE
 	imply SPI_FLASH
 	imply SPI_FLASH_ISSI
-	imply MMC
-	imply MMC_SPI
-	imply MMC_BROKEN_CD
-	imply CMD_MMC
-	imply DM_GPIO
-	imply SIFIVE_GPIO
-	imply CMD_GPIO
-	imply SMP
-	imply MISC
-	imply SIFIVE_OTP
-	imply DM_PWM
-	imply PWM_SIFIVE
 	imply SYSRESET
 	imply SYSRESET_GPIO
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 5/6] riscv: sifive/fu540: Drop NET_RANDOM_ETHADDR
  2020-08-03  6:09 [PATCH 1/6] riscv: Call spl_board_init_f() in the generic SPL board_init_f() Bin Meng
                   ` (2 preceding siblings ...)
  2020-08-03  6:09 ` [PATCH 4/6] riscv: sifive/fu540: kconfig: Move FU540 driver related options to the SoC level Bin Meng
@ 2020-08-03  6:09 ` Bin Meng
  2020-08-06  3:35   ` Leo Liang
                     ` (2 more replies)
  2020-08-03  6:09 ` [PATCH 6/6] riscv: sifive/fu540: Move SPL related functions to spl.c Bin Meng
                   ` (2 subsequent siblings)
  6 siblings, 3 replies; 21+ messages in thread
From: Bin Meng @ 2020-08-03  6:09 UTC (permalink / raw)
  To: u-boot

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

This option was enabled during the earlier U-Boot porting time. Now
we already have the OTP driver in place and the unique MAC address
is read from the OTP, there is no need to turn on this option.

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

 board/sifive/fu540/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig
index fc28120..e70d1e5 100644
--- a/board/sifive/fu540/Kconfig
+++ b/board/sifive/fu540/Kconfig
@@ -41,7 +41,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy
 	imply EFI_PARTITION
 	imply IP_DYN
 	imply ISO_PARTITION
-	imply NET_RANDOM_ETHADDR
 	imply PHY_LIB
 	imply PHY_MSCC
 	imply SPI_FLASH
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 6/6] riscv: sifive/fu540: Move SPL related functions to spl.c
  2020-08-03  6:09 [PATCH 1/6] riscv: Call spl_board_init_f() in the generic SPL board_init_f() Bin Meng
                   ` (3 preceding siblings ...)
  2020-08-03  6:09 ` [PATCH 5/6] riscv: sifive/fu540: Drop NET_RANDOM_ETHADDR Bin Meng
@ 2020-08-03  6:09 ` Bin Meng
  2020-08-06  3:36   ` Leo Liang
                     ` (2 more replies)
       [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA47300EA@ATCPCS16.andestech.com>
  2020-08-06  7:37 ` Pragnesh Patel
  6 siblings, 3 replies; 21+ messages in thread
From: Bin Meng @ 2020-08-03  6:09 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 1/6] riscv: Call spl_board_init_f() in the generic SPL board_init_f()
       [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA47300EA@ATCPCS16.andestech.com>
@ 2020-08-04  3:20   ` Rick Chen
  0 siblings, 0 replies; 21+ messages in thread
From: Rick Chen @ 2020-08-04  3:20 UTC (permalink / raw)
  To: u-boot

> From: Bin Meng [mailto:bmeng.cn at gmail.com]
> Sent: Monday, August 03, 2020 2:09 PM
> To: Rick Jian-Zhi Chen(???); Pragnesh Patel; U-Boot Mailing List
> Cc: Bin Meng
> Subject: [PATCH 1/6] riscv: Call spl_board_init_f() in the generic SPL board_init_f()
>
> From: Bin Meng <bin.meng@windriver.com>
>
> The generic SPL version of board_init_f() should give a call to board specific codes to initialize board in the SPL phase.
>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---

Reviewed-by: Rick Chen <rick@andestech.com>

>
>  arch/riscv/include/asm/spl.h | 7 +++++++
>  arch/riscv/lib/spl.c         | 9 +++++++++
>  2 files changed, 16 insertions(+)
>
> diff --git a/arch/riscv/include/asm/spl.h b/arch/riscv/include/asm/spl.h index 45c03fb..1487f2d 100644
> --- a/arch/riscv/include/asm/spl.h
> +++ b/arch/riscv/include/asm/spl.h
> @@ -28,4 +28,11 @@ enum {
>         BOOT_DEVICE_NONE
>  };
>
> +/**
> + * spl_board_init_f() - initialize board in the SPL phase
> + *
> + * @return 0 if succeeded, -ve on error  */ int spl_board_init_f(void);
> +
>  #endif
> diff --git a/arch/riscv/lib/spl.c b/arch/riscv/lib/spl.c index c47dcd4..e24ec5a 100644
> --- a/arch/riscv/lib/spl.c
> +++ b/arch/riscv/lib/spl.c
> @@ -13,6 +13,11 @@
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> +__weak int spl_board_init_f(void)
> +{
> +       return 0;
> +}
> +
>  __weak void board_init_f(ulong dummy)
>  {
>         int ret;
> @@ -24,6 +29,10 @@ __weak void board_init_f(ulong dummy)
>         arch_cpu_init_dm();
>
>         preloader_console_init();
> +
> +       ret = spl_board_init_f();
> +       if (ret)
> +               panic("spl_board_init_f() failed: %d\n", ret);
>  }
>
>  void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/6] riscv: sifive/fu540: spl: Drop our own version of board_init_f()
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4730102@ATCPCS16.andestech.com>
@ 2020-08-04  3:36     ` Rick Chen
  0 siblings, 0 replies; 21+ messages in thread
From: Rick Chen @ 2020-08-04  3:36 UTC (permalink / raw)
  To: u-boot

> From: Bin Meng [mailto:bmeng.cn at gmail.com]
> Sent: Monday, August 03, 2020 2:09 PM
> To: Rick Jian-Zhi Chen(???); Pragnesh Patel; U-Boot Mailing List
> Cc: Bin Meng
> Subject: [PATCH 2/6] riscv: sifive/fu540: spl: Drop our own version of board_init_f()
>
> From: Bin Meng <bin.meng@windriver.com>
>
> Use the generic board_init_f() provided by the RISC-V library codes.
>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---

Reviewed-by: Rick Chen <rick@andestech.com>

>
>  board/sifive/fu540/spl.c | 19 +------------------
>  1 file changed, 1 insertion(+), 18 deletions(-)
>
> diff --git a/board/sifive/fu540/spl.c b/board/sifive/fu540/spl.c index 55325cf..31d315d 100644
> --- a/board/sifive/fu540/spl.c
> +++ b/board/sifive/fu540/spl.c
> @@ -17,7 +17,7 @@
>
>  #define GEM_PHY_RESET  SIFIVE_GENERIC_GPIO_NR(0, 12)
>
> -int init_clk_and_ddr(void)
> +int spl_board_init_f(void)
>  {
>         int ret;
>
> @@ -55,20 +55,3 @@ int init_clk_and_ddr(void)
>
>         return 0;
>  }
> -
> -void board_init_f(ulong dummy)
> -{
> -       int ret;
> -
> -       ret = spl_early_init();
> -       if (ret)
> -               panic("spl_early_init() failed: %d\n", ret);
> -
> -       arch_cpu_init_dm();
> -
> -       preloader_console_init();
> -
> -       ret = init_clk_and_ddr();
> -       if (ret)
> -               panic("init_clk_and_ddr() failed: %d\n", ret);
> -}
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 3/6] riscv: sifive/fu540: spl: Rename soc_spl_init()
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA473144C@ATCPCS16.andestech.com>
@ 2020-08-06  3:29     ` Rick Chen
  0 siblings, 0 replies; 21+ messages in thread
From: Rick Chen @ 2020-08-06  3:29 UTC (permalink / raw)
  To: u-boot

> From: Bin Meng [mailto:bmeng.cn at gmail.com]
> Sent: Monday, August 03, 2020 2:09 PM
> To: Rick Jian-Zhi Chen(???); Pragnesh Patel; U-Boot Mailing List
> Cc: Bin Meng
> Subject: [PATCH 3/6] riscv: sifive/fu540: spl: Rename soc_spl_init()
>
> From: Bin Meng <bin.meng@windriver.com>
>
> spl_soc_init() seems to be a better name, as all SPL functions names start from the spl_ prefix.
>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
>  arch/riscv/cpu/fu540/spl.c              | 2 +-
>  arch/riscv/include/asm/arch-fu540/spl.h | 2 +-
>  board/sifive/fu540/spl.c                | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Rick Chen <rick@andestech.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 5/6] riscv: sifive/fu540: Drop NET_RANDOM_ETHADDR
  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  7:40   ` Pragnesh Patel
  2 siblings, 0 replies; 21+ messages in thread
From: Leo Liang @ 2020-08-06  3:35 UTC (permalink / raw)
  To: u-boot

On Sun, Aug 02, 2020 at 11:09:05PM -0700, Bin Meng wrote:
> From: Bin Meng <bin.meng@windriver.com>
> 
> This option was enabled during the earlier U-Boot porting time. Now
> we already have the OTP driver in place and the unique MAC address
> is read from the OTP, there is no need to turn on this option.
> 
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
> 
>  board/sifive/fu540/Kconfig | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig
> index fc28120..e70d1e5 100644
> --- a/board/sifive/fu540/Kconfig
> +++ b/board/sifive/fu540/Kconfig
> @@ -41,7 +41,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy
>  	imply EFI_PARTITION
>  	imply IP_DYN
>  	imply ISO_PARTITION
> -	imply NET_RANDOM_ETHADDR
>  	imply PHY_LIB
>  	imply PHY_MSCC
>  	imply SPI_FLASH
> -- 
> 2.7.4
> 

Reviewed-by: Leo Liang <ycliang@andestech.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 6/6] riscv: sifive/fu540: Move SPL related functions to spl.c
  2020-08-03  6:09 ` [PATCH 6/6] riscv: sifive/fu540: Move SPL related functions to spl.c Bin Meng
@ 2020-08-06  3:36   ` Leo Liang
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA47314C9@ATCPCS16.andestech.com>
  2020-08-06  7:42   ` Pragnesh Patel
  2 siblings, 0 replies; 21+ messages in thread
From: Leo Liang @ 2020-08-06  3:36 UTC (permalink / raw)
  To: u-boot

On Sun, Aug 02, 2020 at 11:09:06PM -0700, Bin Meng wrote:
> 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
>

Reviewed-by: Leo Liang <ycliang@andestech.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 4/6] riscv: sifive/fu540: kconfig: Move FU540 driver related options to the SoC level
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4731460@ATCPCS16.andestech.com>
@ 2020-08-06  6:13     ` Rick Chen
  0 siblings, 0 replies; 21+ messages in thread
From: Rick Chen @ 2020-08-06  6:13 UTC (permalink / raw)
  To: u-boot

> From: Bin Meng [mailto:bmeng.cn at gmail.com]
> Sent: Monday, August 03, 2020 2:09 PM
> To: Rick Jian-Zhi Chen(???); Pragnesh Patel; U-Boot Mailing List
> Cc: Bin Meng
> Subject: [PATCH 4/6] riscv: sifive/fu540: kconfig: Move FU540 driver related options to the SoC level
>
> From: Bin Meng <bin.meng@windriver.com>
>
> All FU540 driver related options should be in the SoC level Kconfig.
>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
>  arch/riscv/cpu/fu540/Kconfig | 22 ++++++++++++++++++++++
>  board/sifive/fu540/Kconfig   | 22 ----------------------
>  2 files changed, 22 insertions(+), 22 deletions(-)

Reviewed-by: Rick Chen <rick@andestech.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 5/6] riscv: sifive/fu540: Drop NET_RANDOM_ETHADDR
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA47314C2@ATCPCS16.andestech.com>
@ 2020-08-06  6:56     ` Rick Chen
  0 siblings, 0 replies; 21+ messages in thread
From: Rick Chen @ 2020-08-06  6:56 UTC (permalink / raw)
  To: u-boot

> From: Bin Meng [mailto:bmeng.cn at gmail.com]
> Sent: Monday, August 03, 2020 2:09 PM
> To: Rick Jian-Zhi Chen(???); Pragnesh Patel; U-Boot Mailing List
> Cc: Bin Meng
> Subject: [PATCH 5/6] riscv: sifive/fu540: Drop NET_RANDOM_ETHADDR
>
> From: Bin Meng <bin.meng@windriver.com>
>
> This option was enabled during the earlier U-Boot porting time. Now we already have the OTP driver in place and the unique MAC address is read from the OTP, there is no need to turn on this option.
>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
>  board/sifive/fu540/Kconfig | 1 -
>  1 file changed, 1 deletion(-)

Reviewed-by: Rick Chen <rick@andestech.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 6/6] riscv: sifive/fu540: Move SPL related functions to spl.c
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA47314C9@ATCPCS16.andestech.com>
@ 2020-08-06  7:00     ` Rick Chen
  2020-08-06  8:10       ` Bin Meng
  0 siblings, 1 reply; 21+ messages in thread
From: Rick Chen @ 2020-08-06  7:00 UTC (permalink / raw)
  To: u-boot

> From: Bin Meng [mailto:bmeng.cn at gmail.com]
> Sent: Monday, August 03, 2020 2:09 PM
> To: Rick Jian-Zhi Chen(???); Pragnesh Patel; U-Boot Mailing List
> Cc: Bin Meng
> Subject: [PATCH 6/6] riscv: sifive/fu540: Move SPL related functions to spl.c
>
> 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
> --

WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef'
where possible
#216: FILE: board/sifive/fu540/spl.c:82:
+#ifdef CONFIG_SPL_LOAD_FIT

LGTM.
Other than that,

Reviewed-by: Rick Chen <rick@andestech.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 1/6] riscv: Call spl_board_init_f() in the generic SPL board_init_f()
  2020-08-03  6:09 [PATCH 1/6] riscv: Call spl_board_init_f() in the generic SPL board_init_f() Bin Meng
                   ` (5 preceding siblings ...)
       [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA47300EA@ATCPCS16.andestech.com>
@ 2020-08-06  7:37 ` Pragnesh Patel
  6 siblings, 0 replies; 21+ messages in thread
From: Pragnesh Patel @ 2020-08-06  7:37 UTC (permalink / raw)
  To: u-boot

>-----Original Message-----
>From: Bin Meng <bmeng.cn@gmail.com>
>Sent: 03 August 2020 11:39
>To: Rick Chen <rick@andestech.com>; Pragnesh Patel
><pragnesh.patel@sifive.com>; U-Boot Mailing List <u-boot@lists.denx.de>
>Cc: Bin Meng <bin.meng@windriver.com>
>Subject: [PATCH 1/6] riscv: Call spl_board_init_f() in the generic SPL
>board_init_f()
>
>[External Email] Do not click links or attachments unless you recognize the
>sender and know the content is safe
>
>From: Bin Meng <bin.meng@windriver.com>
>
>The generic SPL version of board_init_f() should give a call to board specific
>codes to initialize board in the SPL phase.
>
>Signed-off-by: Bin Meng <bin.meng@windriver.com>
>---
>
> arch/riscv/include/asm/spl.h | 7 +++++++
> arch/riscv/lib/spl.c         | 9 +++++++++
> 2 files changed, 16 insertions(+)

Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Tested-by: Pragnesh Patel <pragnesh.patel@sifive.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/6] riscv: sifive/fu540: spl: Drop our own version of board_init_f()
  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-06  7:37   ` Pragnesh Patel
  1 sibling, 0 replies; 21+ messages in thread
From: Pragnesh Patel @ 2020-08-06  7:37 UTC (permalink / raw)
  To: u-boot

>-----Original Message-----
>From: Bin Meng <bmeng.cn@gmail.com>
>Sent: 03 August 2020 11:39
>To: Rick Chen <rick@andestech.com>; Pragnesh Patel
><pragnesh.patel@sifive.com>; U-Boot Mailing List <u-boot@lists.denx.de>
>Cc: Bin Meng <bin.meng@windriver.com>
>Subject: [PATCH 2/6] riscv: sifive/fu540: spl: Drop our own version of
>board_init_f()
>
>[External Email] Do not click links or attachments unless you recognize the
>sender and know the content is safe
>
>From: Bin Meng <bin.meng@windriver.com>
>
>Use the generic board_init_f() provided by the RISC-V library codes.
>
>Signed-off-by: Bin Meng <bin.meng@windriver.com>
>---
>
> board/sifive/fu540/spl.c | 19 +------------------
> 1 file changed, 1 insertion(+), 18 deletions(-)
>

Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Tested-by: Pragnesh Patel <pragnesh.patel@sifive.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 3/6] riscv: sifive/fu540: spl: Rename soc_spl_init()
  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  7:38   ` Pragnesh Patel
  1 sibling, 0 replies; 21+ messages in thread
From: Pragnesh Patel @ 2020-08-06  7:38 UTC (permalink / raw)
  To: u-boot

>-----Original Message-----
>From: Bin Meng <bmeng.cn@gmail.com>
>Sent: 03 August 2020 11:39
>To: Rick Chen <rick@andestech.com>; Pragnesh Patel
><pragnesh.patel@sifive.com>; U-Boot Mailing List <u-boot@lists.denx.de>
>Cc: Bin Meng <bin.meng@windriver.com>
>Subject: [PATCH 3/6] riscv: sifive/fu540: spl: Rename soc_spl_init()
>
>[External Email] Do not click links or attachments unless you recognize the
>sender and know the content is safe
>
>From: Bin Meng <bin.meng@windriver.com>
>
>spl_soc_init() seems to be a better name, as all SPL functions names start from
>the spl_ prefix.
>
>Signed-off-by: Bin Meng <bin.meng@windriver.com>
>---
>
> arch/riscv/cpu/fu540/spl.c              | 2 +-
> arch/riscv/include/asm/arch-fu540/spl.h | 2 +-
> board/sifive/fu540/spl.c                | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>

Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Tested-by: Pragnesh Patel <pragnesh.patel@sifive.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 4/6] riscv: sifive/fu540: kconfig: Move FU540 driver related options to the SoC level
  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  7:40   ` Pragnesh Patel
  1 sibling, 0 replies; 21+ messages in thread
From: Pragnesh Patel @ 2020-08-06  7:40 UTC (permalink / raw)
  To: u-boot

>-----Original Message-----
>From: Bin Meng <bmeng.cn@gmail.com>
>Sent: 03 August 2020 11:39
>To: Rick Chen <rick@andestech.com>; Pragnesh Patel
><pragnesh.patel@sifive.com>; U-Boot Mailing List <u-boot@lists.denx.de>
>Cc: Bin Meng <bin.meng@windriver.com>
>Subject: [PATCH 4/6] riscv: sifive/fu540: kconfig: Move FU540 driver related
>options to the SoC level
>
>[External Email] Do not click links or attachments unless you recognize the
>sender and know the content is safe
>
>From: Bin Meng <bin.meng@windriver.com>
>
>All FU540 driver related options should be in the SoC level Kconfig.
>
>Signed-off-by: Bin Meng <bin.meng@windriver.com>
>---
>
> arch/riscv/cpu/fu540/Kconfig | 22 ++++++++++++++++++++++
> board/sifive/fu540/Kconfig   | 22 ----------------------
> 2 files changed, 22 insertions(+), 22 deletions(-)
>

Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Tested-by: Pragnesh Patel <pragnesh.patel@sifive.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 5/6] riscv: sifive/fu540: Drop NET_RANDOM_ETHADDR
  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  7:40   ` Pragnesh Patel
  2 siblings, 0 replies; 21+ messages in thread
From: Pragnesh Patel @ 2020-08-06  7:40 UTC (permalink / raw)
  To: u-boot

>-----Original Message-----
>From: Bin Meng <bmeng.cn@gmail.com>
>Sent: 03 August 2020 11:39
>To: Rick Chen <rick@andestech.com>; Pragnesh Patel
><pragnesh.patel@sifive.com>; U-Boot Mailing List <u-boot@lists.denx.de>
>Cc: Bin Meng <bin.meng@windriver.com>
>Subject: [PATCH 5/6] riscv: sifive/fu540: Drop NET_RANDOM_ETHADDR
>
>[External Email] Do not click links or attachments unless you recognize the
>sender and know the content is safe
>
>From: Bin Meng <bin.meng@windriver.com>
>
>This option was enabled during the earlier U-Boot porting time. Now we already
>have the OTP driver in place and the unique MAC address is read from the OTP,
>there is no need to turn on this option.
>
>Signed-off-by: Bin Meng <bin.meng@windriver.com>
>---
>
> board/sifive/fu540/Kconfig | 1 -
> 1 file changed, 1 deletion(-)
>

Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Tested-by: Pragnesh Patel <pragnesh.patel@sifive.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 6/6] riscv: sifive/fu540: Move SPL related functions to spl.c
  2020-08-03  6:09 ` [PATCH 6/6] riscv: sifive/fu540: Move SPL related functions to spl.c Bin Meng
  2020-08-06  3:36   ` Leo Liang
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA47314C9@ATCPCS16.andestech.com>
@ 2020-08-06  7:42   ` Pragnesh Patel
  2 siblings, 0 replies; 21+ messages in thread
From: Pragnesh Patel @ 2020-08-06  7:42 UTC (permalink / raw)
  To: u-boot

>-----Original Message-----
>From: Bin Meng <bmeng.cn@gmail.com>
>Sent: 03 August 2020 11:39
>To: Rick Chen <rick@andestech.com>; Pragnesh Patel
><pragnesh.patel@sifive.com>; U-Boot Mailing List <u-boot@lists.denx.de>
>Cc: Bin Meng <bin.meng@windriver.com>
>Subject: [PATCH 6/6] riscv: sifive/fu540: Move SPL related functions to spl.c
>
>[External Email] Do not click links or attachments unless you recognize the
>sender and know the content is safe
>
>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(-)
>

Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Tested-by: Pragnesh Patel <pragnesh.patel@sifive.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 6/6] riscv: sifive/fu540: Move SPL related functions to spl.c
  2020-08-06  7:00     ` Rick Chen
@ 2020-08-06  8:10       ` Bin Meng
  0 siblings, 0 replies; 21+ messages in thread
From: Bin Meng @ 2020-08-06  8:10 UTC (permalink / raw)
  To: u-boot

Hi Rick,

On Thu, Aug 6, 2020 at 3:00 PM Rick Chen <rickchen36@gmail.com> wrote:
>
> > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > Sent: Monday, August 03, 2020 2:09 PM
> > To: Rick Jian-Zhi Chen(???); Pragnesh Patel; U-Boot Mailing List
> > Cc: Bin Meng
> > Subject: [PATCH 6/6] riscv: sifive/fu540: Move SPL related functions to spl.c
> >
> > 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
> > --
>
> WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef'
> where possible
> #216: FILE: board/sifive/fu540/spl.c:82:
> +#ifdef CONFIG_SPL_LOAD_FIT
>

This file is only built for SPL so the warning can be ignored safely.

> LGTM.
> Other than that,
>
> Reviewed-by: Rick Chen <rick@andestech.com>

Regards,
Bin

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2020-08-06  8:10 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 6/6] riscv: sifive/fu540: Move SPL related functions to spl.c Bin Meng
2020-08-06  3:36   ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.