All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] xilinx: Move initrd_high setup to common location
@ 2020-04-13  8:01 Michal Simek
  2020-04-13  8:01 ` [PATCH 2/2] xilinx: Move bootmode detection to separate function Michal Simek
  2020-04-30  7:35 ` [PATCH 1/2] xilinx: Move initrd_high setup to common location Michal Simek
  0 siblings, 2 replies; 4+ messages in thread
From: Michal Simek @ 2020-04-13  8:01 UTC (permalink / raw)
  To: u-boot

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 board/xilinx/common/board.c   | 7 +++++++
 board/xilinx/versal/board.c   | 6 ------
 board/xilinx/zynqmp/zynqmp.c  | 6 ------
 include/configs/zynq-common.h | 1 -
 4 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 7c191e53fb71..294a59df77da 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -8,6 +8,7 @@
 #include <asm/sections.h>
 #include <dm/uclass.h>
 #include <i2c.h>
+#include <linux/sizes.h>
 #include "board.h"
 
 int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
@@ -75,7 +76,13 @@ void *board_fdt_blob_setup(void)
 
 int board_late_init_xilinx(void)
 {
+	ulong initrd_hi;
+
 	env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET);
 
+	initrd_hi = gd->start_addr_sp - CONFIG_STACK_SIZE;
+	initrd_hi = round_down(initrd_hi, SZ_16M);
+	env_set_addr("initrd_high", (void *)initrd_hi);
+
 	return 0;
 }
diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c
index 908ea87163f8..2900dfb44e93 100644
--- a/board/xilinx/versal/board.c
+++ b/board/xilinx/versal/board.c
@@ -16,7 +16,6 @@
 #include <dm/device.h>
 #include <dm/uclass.h>
 #include <versalpl.h>
-#include <linux/sizes.h>
 #include "../common/board.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -94,7 +93,6 @@ int board_late_init(void)
 	const char *mode;
 	char *new_targets;
 	char *env_targets;
-	ulong initrd_hi;
 
 	if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
 		debug("Saved variables - Skipping\n");
@@ -201,10 +199,6 @@ int board_late_init(void)
 
 	env_set("boot_targets", new_targets);
 
-	initrd_hi = gd->start_addr_sp - CONFIG_STACK_SIZE;
-	initrd_hi = round_down(initrd_hi, SZ_16M);
-	env_set_addr("initrd_high", (void *)initrd_hi);
-
 	return board_late_init_xilinx();
 }
 
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index b2172356ad0a..66a43974e68d 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -26,7 +26,6 @@
 #include <zynqmppl.h>
 #include <zynqmp_firmware.h>
 #include <g_dnl.h>
-#include <linux/sizes.h>
 #include "../common/board.h"
 
 #include "pm_cfg_obj.h"
@@ -565,7 +564,6 @@ int board_late_init(void)
 	char *new_targets;
 	char *env_targets;
 	int ret;
-	ulong initrd_hi;
 
 #if defined(CONFIG_USB_ETHER) && !defined(CONFIG_USB_GADGET_DOWNLOAD)
 	usb_ether_init();
@@ -692,10 +690,6 @@ int board_late_init(void)
 
 	env_set("boot_targets", new_targets);
 
-	initrd_hi = gd->start_addr_sp - CONFIG_STACK_SIZE;
-	initrd_hi = round_down(initrd_hi, SZ_16M);
-	env_set_addr("initrd_high", (void *)initrd_hi);
-
 	reset_reason();
 
 	return board_late_init_xilinx();
diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
index 1eaf65b0a2a1..4ccc31e37655 100644
--- a/include/configs/zynq-common.h
+++ b/include/configs/zynq-common.h
@@ -198,7 +198,6 @@
 #ifndef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS	\
 	"fdt_high=0x20000000\0"		\
-	"initrd_high=0x20000000\0"	\
 	"scriptaddr=0x20000\0"	\
 	"script_size_f=0x40000\0"	\
 	"fdt_addr_r=0x1f00000\0"        \
-- 
2.26.0

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

* [PATCH 2/2] xilinx: Move bootmode detection to separate function
  2020-04-13  8:01 [PATCH 1/2] xilinx: Move initrd_high setup to common location Michal Simek
@ 2020-04-13  8:01 ` Michal Simek
  2020-04-30  7:35   ` Michal Simek
  2020-04-30  7:35 ` [PATCH 1/2] xilinx: Move initrd_high setup to common location Michal Simek
  1 sibling, 1 reply; 4+ messages in thread
From: Michal Simek @ 2020-04-13  8:01 UTC (permalink / raw)
  To: u-boot

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 board/xilinx/versal/board.c  | 23 ++++++++++++++++-------
 board/xilinx/zynqmp/zynqmp.c | 28 +++++++++++++++++++---------
 2 files changed, 35 insertions(+), 16 deletions(-)

diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c
index 2900dfb44e93..483e3ce2f79a 100644
--- a/board/xilinx/versal/board.c
+++ b/board/xilinx/versal/board.c
@@ -82,9 +82,23 @@ int board_early_init_r(void)
 	return 0;
 }
 
-int board_late_init(void)
+static u8 versal_get_bootmode(void)
 {
+	u8 bootmode;
 	u32 reg = 0;
+
+	reg = readl(&crp_base->boot_mode_usr);
+
+	if (reg >> BOOT_MODE_ALT_SHIFT)
+		reg >>= BOOT_MODE_ALT_SHIFT;
+
+	bootmode = reg & BOOT_MODES_MASK;
+
+	return bootmode;
+}
+
+int board_late_init(void)
+{
 	u8 bootmode;
 	struct udevice *dev;
 	int bootseq = -1;
@@ -99,12 +113,7 @@ int board_late_init(void)
 		return 0;
 	}
 
-	reg = readl(&crp_base->boot_mode_usr);
-
-	if (reg >> BOOT_MODE_ALT_SHIFT)
-		reg >>= BOOT_MODE_ALT_SHIFT;
-
-	bootmode = reg & BOOT_MODES_MASK;
+	bootmode = versal_get_bootmode();
 
 	puts("Bootmode: ");
 	switch (bootmode) {
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 66a43974e68d..a2a0d563318e 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -552,9 +552,26 @@ static int set_fdtfile(void)
 	return 0;
 }
 
-int board_late_init(void)
+static u8 zynqmp_get_bootmode(void)
 {
+	u8 bootmode;
 	u32 reg = 0;
+	int ret;
+
+	ret = zynqmp_mmio_read((ulong)&crlapb_base->boot_mode, &reg);
+	if (ret)
+		return -EINVAL;
+
+	if (reg >> BOOT_MODE_ALT_SHIFT)
+		reg >>= BOOT_MODE_ALT_SHIFT;
+
+	bootmode = reg & BOOT_MODES_MASK;
+
+	return bootmode;
+}
+
+int board_late_init(void)
+{
 	u8 bootmode;
 	struct udevice *dev;
 	int bootseq = -1;
@@ -578,14 +595,7 @@ int board_late_init(void)
 	if (ret)
 		return ret;
 
-	ret = zynqmp_mmio_read((ulong)&crlapb_base->boot_mode, &reg);
-	if (ret)
-		return -EINVAL;
-
-	if (reg >> BOOT_MODE_ALT_SHIFT)
-		reg >>= BOOT_MODE_ALT_SHIFT;
-
-	bootmode = reg & BOOT_MODES_MASK;
+	bootmode = zynqmp_get_bootmode();
 
 	puts("Bootmode: ");
 	switch (bootmode) {
-- 
2.26.0

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

* [PATCH 1/2] xilinx: Move initrd_high setup to common location
  2020-04-13  8:01 [PATCH 1/2] xilinx: Move initrd_high setup to common location Michal Simek
  2020-04-13  8:01 ` [PATCH 2/2] xilinx: Move bootmode detection to separate function Michal Simek
@ 2020-04-30  7:35 ` Michal Simek
  1 sibling, 0 replies; 4+ messages in thread
From: Michal Simek @ 2020-04-30  7:35 UTC (permalink / raw)
  To: u-boot

po 13. 4. 2020 v 10:01 odes?latel Michal Simek <michal.simek@xilinx.com> napsal:
>
> Moving to common location initrd_high is also setup for Zynq which hasn't
> done in run time code.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  board/xilinx/common/board.c   | 7 +++++++
>  board/xilinx/versal/board.c   | 6 ------
>  board/xilinx/zynqmp/zynqmp.c  | 6 ------
>  include/configs/zynq-common.h | 1 -
>  4 files changed, 7 insertions(+), 13 deletions(-)
>
> diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
> index 7c191e53fb71..294a59df77da 100644
> --- a/board/xilinx/common/board.c
> +++ b/board/xilinx/common/board.c
> @@ -8,6 +8,7 @@
>  #include <asm/sections.h>
>  #include <dm/uclass.h>
>  #include <i2c.h>
> +#include <linux/sizes.h>
>  #include "board.h"
>
>  int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
> @@ -75,7 +76,13 @@ void *board_fdt_blob_setup(void)
>
>  int board_late_init_xilinx(void)
>  {
> +       ulong initrd_hi;
> +
>         env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET);
>
> +       initrd_hi = gd->start_addr_sp - CONFIG_STACK_SIZE;
> +       initrd_hi = round_down(initrd_hi, SZ_16M);
> +       env_set_addr("initrd_high", (void *)initrd_hi);
> +
>         return 0;
>  }
> diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c
> index 908ea87163f8..2900dfb44e93 100644
> --- a/board/xilinx/versal/board.c
> +++ b/board/xilinx/versal/board.c
> @@ -16,7 +16,6 @@
>  #include <dm/device.h>
>  #include <dm/uclass.h>
>  #include <versalpl.h>
> -#include <linux/sizes.h>
>  #include "../common/board.h"
>
>  DECLARE_GLOBAL_DATA_PTR;
> @@ -94,7 +93,6 @@ int board_late_init(void)
>         const char *mode;
>         char *new_targets;
>         char *env_targets;
> -       ulong initrd_hi;
>
>         if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
>                 debug("Saved variables - Skipping\n");
> @@ -201,10 +199,6 @@ int board_late_init(void)
>
>         env_set("boot_targets", new_targets);
>
> -       initrd_hi = gd->start_addr_sp - CONFIG_STACK_SIZE;
> -       initrd_hi = round_down(initrd_hi, SZ_16M);
> -       env_set_addr("initrd_high", (void *)initrd_hi);
> -
>         return board_late_init_xilinx();
>  }
>
> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
> index b2172356ad0a..66a43974e68d 100644
> --- a/board/xilinx/zynqmp/zynqmp.c
> +++ b/board/xilinx/zynqmp/zynqmp.c
> @@ -26,7 +26,6 @@
>  #include <zynqmppl.h>
>  #include <zynqmp_firmware.h>
>  #include <g_dnl.h>
> -#include <linux/sizes.h>
>  #include "../common/board.h"
>
>  #include "pm_cfg_obj.h"
> @@ -565,7 +564,6 @@ int board_late_init(void)
>         char *new_targets;
>         char *env_targets;
>         int ret;
> -       ulong initrd_hi;
>
>  #if defined(CONFIG_USB_ETHER) && !defined(CONFIG_USB_GADGET_DOWNLOAD)
>         usb_ether_init();
> @@ -692,10 +690,6 @@ int board_late_init(void)
>
>         env_set("boot_targets", new_targets);
>
> -       initrd_hi = gd->start_addr_sp - CONFIG_STACK_SIZE;
> -       initrd_hi = round_down(initrd_hi, SZ_16M);
> -       env_set_addr("initrd_high", (void *)initrd_hi);
> -
>         reset_reason();
>
>         return board_late_init_xilinx();
> diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
> index 1eaf65b0a2a1..4ccc31e37655 100644
> --- a/include/configs/zynq-common.h
> +++ b/include/configs/zynq-common.h
> @@ -198,7 +198,6 @@
>  #ifndef CONFIG_EXTRA_ENV_SETTINGS
>  #define CONFIG_EXTRA_ENV_SETTINGS      \
>         "fdt_high=0x20000000\0"         \
> -       "initrd_high=0x20000000\0"      \
>         "scriptaddr=0x20000\0"  \
>         "script_size_f=0x40000\0"       \
>         "fdt_addr_r=0x1f00000\0"        \
> --
> 2.26.0
>

Applied.
M


-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

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

* [PATCH 2/2] xilinx: Move bootmode detection to separate function
  2020-04-13  8:01 ` [PATCH 2/2] xilinx: Move bootmode detection to separate function Michal Simek
@ 2020-04-30  7:35   ` Michal Simek
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2020-04-30  7:35 UTC (permalink / raw)
  To: u-boot

po 13. 4. 2020 v 10:01 odes?latel Michal Simek <michal.simek@xilinx.com> napsal:
>
> Create special function for reading bootmode on Versal and ZynqMP.
> Zynq is using specific function (without mask) already.
> Future patches will be calling this function from different location too.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  board/xilinx/versal/board.c  | 23 ++++++++++++++++-------
>  board/xilinx/zynqmp/zynqmp.c | 28 +++++++++++++++++++---------
>  2 files changed, 35 insertions(+), 16 deletions(-)
>
> diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c
> index 2900dfb44e93..483e3ce2f79a 100644
> --- a/board/xilinx/versal/board.c
> +++ b/board/xilinx/versal/board.c
> @@ -82,9 +82,23 @@ int board_early_init_r(void)
>         return 0;
>  }
>
> -int board_late_init(void)
> +static u8 versal_get_bootmode(void)
>  {
> +       u8 bootmode;
>         u32 reg = 0;
> +
> +       reg = readl(&crp_base->boot_mode_usr);
> +
> +       if (reg >> BOOT_MODE_ALT_SHIFT)
> +               reg >>= BOOT_MODE_ALT_SHIFT;
> +
> +       bootmode = reg & BOOT_MODES_MASK;
> +
> +       return bootmode;
> +}
> +
> +int board_late_init(void)
> +{
>         u8 bootmode;
>         struct udevice *dev;
>         int bootseq = -1;
> @@ -99,12 +113,7 @@ int board_late_init(void)
>                 return 0;
>         }
>
> -       reg = readl(&crp_base->boot_mode_usr);
> -
> -       if (reg >> BOOT_MODE_ALT_SHIFT)
> -               reg >>= BOOT_MODE_ALT_SHIFT;
> -
> -       bootmode = reg & BOOT_MODES_MASK;
> +       bootmode = versal_get_bootmode();
>
>         puts("Bootmode: ");
>         switch (bootmode) {
> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
> index 66a43974e68d..a2a0d563318e 100644
> --- a/board/xilinx/zynqmp/zynqmp.c
> +++ b/board/xilinx/zynqmp/zynqmp.c
> @@ -552,9 +552,26 @@ static int set_fdtfile(void)
>         return 0;
>  }
>
> -int board_late_init(void)
> +static u8 zynqmp_get_bootmode(void)
>  {
> +       u8 bootmode;
>         u32 reg = 0;
> +       int ret;
> +
> +       ret = zynqmp_mmio_read((ulong)&crlapb_base->boot_mode, &reg);
> +       if (ret)
> +               return -EINVAL;
> +
> +       if (reg >> BOOT_MODE_ALT_SHIFT)
> +               reg >>= BOOT_MODE_ALT_SHIFT;
> +
> +       bootmode = reg & BOOT_MODES_MASK;
> +
> +       return bootmode;
> +}
> +
> +int board_late_init(void)
> +{
>         u8 bootmode;
>         struct udevice *dev;
>         int bootseq = -1;
> @@ -578,14 +595,7 @@ int board_late_init(void)
>         if (ret)
>                 return ret;
>
> -       ret = zynqmp_mmio_read((ulong)&crlapb_base->boot_mode, &reg);
> -       if (ret)
> -               return -EINVAL;
> -
> -       if (reg >> BOOT_MODE_ALT_SHIFT)
> -               reg >>= BOOT_MODE_ALT_SHIFT;
> -
> -       bootmode = reg & BOOT_MODES_MASK;
> +       bootmode = zynqmp_get_bootmode();
>
>         puts("Bootmode: ");
>         switch (bootmode) {
> --
> 2.26.0
>

Applied.
M

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

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

end of thread, other threads:[~2020-04-30  7:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-13  8:01 [PATCH 1/2] xilinx: Move initrd_high setup to common location Michal Simek
2020-04-13  8:01 ` [PATCH 2/2] xilinx: Move bootmode detection to separate function Michal Simek
2020-04-30  7:35   ` Michal Simek
2020-04-30  7:35 ` [PATCH 1/2] xilinx: Move initrd_high setup to common location Michal Simek

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.