[PATCH 0/5] microblaze: Switch to distro boot

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/5] microblaze: Switch to distro boot

Michal Simek-3
Hi,

this series has only one purpose to move microblaze to distro boot to be
aligned with other platforms and ways how they boot.

Depends on https://lists.denx.de/pipermail/u-boot/2020-September/427495.html

Thanks,
Michal


T Karthik Reddy (5):
  microblaze: Enable spi for microblaze
  microblaze: trivial code fixes
  microblaze: board: Check return value whlie saving env variables
  microblaze: Setup distro boot env variables at run time
  microblaze: Add support for distro boot

 arch/microblaze/Kconfig                       |  3 +
 board/xilinx/microblaze-generic/Kconfig       |  5 ++
 .../microblaze-generic/microblaze-generic.c   | 24 ++++++-
 configs/microblaze-generic_defconfig          | 12 ++--
 include/configs/microblaze-generic.h          | 66 ++++++++++++++++---
 5 files changed, 92 insertions(+), 18 deletions(-)

--
2.28.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 1/5] microblaze: Enable spi for microblaze

Michal Simek-3
From: T Karthik Reddy <[hidden email]>

Enable SPI drivers and driver model for microblaze.

Signed-off-by: T Karthik Reddy <[hidden email]>
Signed-off-by: Michal Simek <[hidden email]>
---

 arch/microblaze/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index ff6b3c7e3d6c..2755cce884c5 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -16,6 +16,9 @@ config TARGET_MICROBLAZE_GENERIC
  select OF_CONTROL
  select SUPPORT_SPL
  select SYSRESET
+ select DM_SPI
+ select DM_SPI_FLASH
+ select SPI
  imply CMD_DM
 
 endchoice
--
2.28.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 2/5] microblaze: trivial code fixes

Michal Simek-3
In reply to this post by Michal Simek-3
From: T Karthik Reddy <[hidden email]>

Set proper indentation for env variables in microblaze header file.

Signed-off-by: T Karthik Reddy <[hidden email]>
Signed-off-by: Michal Simek <[hidden email]>
---

 include/configs/microblaze-generic.h | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h
index 8ca0e83c7833..0dcefcfa83b6 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -131,15 +131,16 @@
 #define CONFIG_SYS_USR_EXCEP /* user exception */
 
 #ifndef CONFIG_EXTRA_ENV_SETTINGS
-#define CONFIG_EXTRA_ENV_SETTINGS "unlock=yes\0" \
- "nor0=flash-0\0"\
- "mtdparts=mtdparts=flash-0:"\
- "256k(u-boot),256k(env),3m(kernel),"\
- "1m(romfs),1m(cramfs),-(jffs2)\0"\
- "nc=setenv stdout nc;"\
- "setenv stdin nc\0" \
- "serial=setenv stdout serial;"\
- "setenv stdin serial\0"
+#define CONFIG_EXTRA_ENV_SETTINGS \
+ "unlock=yes\0"\
+ "nor0=flash-0\0"\
+ "mtdparts=mtdparts=flash-0:"\
+ "256k(u-boot),256k(env),3m(kernel),"\
+ "1m(romfs),1m(cramfs),-(jffs2)\0"\
+ "nc=setenv stdout nc;"\
+ "setenv stdin nc\0" \
+ "serial=setenv stdout serial;"\
+ "setenv stdin serial\0"
 #endif
 
 #if defined(CONFIG_XILINX_AXIEMAC)
--
2.28.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 3/5] microblaze: board: Check return value whlie saving env variables

Michal Simek-3
In reply to this post by Michal Simek-3
From: T Karthik Reddy <[hidden email]>

Check and print warning if run time env variables are not saved.

Signed-off-by: T Karthik Reddy <[hidden email]>
Signed-off-by: Michal Simek <[hidden email]>
---

 board/xilinx/microblaze-generic/microblaze-generic.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c
index 4e569e910d90..724c33987ba4 100644
--- a/board/xilinx/microblaze-generic/microblaze-generic.c
+++ b/board/xilinx/microblaze-generic/microblaze-generic.c
@@ -37,6 +37,7 @@ int dram_init(void)
 int board_late_init(void)
 {
  ulong max_size, lowmem_size;
+ u32 status = 0;
 
 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_SYSRESET_MICROBLAZE)
  int ret;
@@ -58,9 +59,12 @@ int board_late_init(void)
  /* Linux default LOWMEM_SIZE is 0x30000000 = 768MB */
  lowmem_size = gd->ram_base + 768 * 1024 * 1024;
 
- env_set_addr("initrd_high", (void *)min_t(ulong, max_size,
-  lowmem_size));
- env_set_addr("fdt_high", (void *)min_t(ulong, max_size, lowmem_size));
+ status |= env_set_addr("initrd_high", (void *)min_t(ulong, max_size,
+ lowmem_size));
+ status |= env_set_addr("fdt_high", (void *)min_t(ulong, max_size,
+ lowmem_size));
+ if (status)
+ printf("%s: Saving run time variables FAILED\n", __func__);
 
  return 0;
 }
--
2.28.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 4/5] microblaze: Setup distro boot env variables at run time

Michal Simek-3
In reply to this post by Michal Simek-3
From: T Karthik Reddy <[hidden email]>

Setup all the distro boot related environment variables at
run time. Add BOOT_SCRIPT_OFFSET config to microblaze board
Kconfig.

Signed-off-by: T Karthik Reddy <[hidden email]>
Signed-off-by: Michal Simek <[hidden email]>
---

 board/xilinx/microblaze-generic/Kconfig            |  5 +++++
 .../xilinx/microblaze-generic/microblaze-generic.c | 14 ++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/board/xilinx/microblaze-generic/Kconfig b/board/xilinx/microblaze-generic/Kconfig
index f2fa0f72b13f..7a97211a1ecd 100644
--- a/board/xilinx/microblaze-generic/Kconfig
+++ b/board/xilinx/microblaze-generic/Kconfig
@@ -38,4 +38,9 @@ config XILINX_MICROBLAZE0_HW_VER
  string "Core version number"
  default "7.10.d"
 
+config BOOT_SCRIPT_OFFSET
+        hex "Boot script offset"
+        default 0xFC0000
+        help
+           Specifies distro boot script offset in NAND/QSPI flash.
 endif
diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c
index 724c33987ba4..c1ae8fbfe742 100644
--- a/board/xilinx/microblaze-generic/microblaze-generic.c
+++ b/board/xilinx/microblaze-generic/microblaze-generic.c
@@ -63,6 +63,20 @@ int board_late_init(void)
  lowmem_size));
  status |= env_set_addr("fdt_high", (void *)min_t(ulong, max_size,
  lowmem_size));
+
+ status |= env_set_hex("scriptaddr", max_size + SZ_2M);
+
+ status |= env_set_hex("pxefile_addr_r", max_size + SZ_1M);
+
+ status |= env_set_hex("kernel_addr_r", gd->ram_base + SZ_32M);
+
+ status |= env_set_hex("fdt_addr_r", gd->ram_base + SZ_32M - SZ_1M);
+
+ status |= env_set_hex("ramdisk_addr_r",
+       gd->ram_base + SZ_32M + SZ_4M + SZ_2M);
+
+ status |= env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET);
+
  if (status)
  printf("%s: Saving run time variables FAILED\n", __func__);
 
--
2.28.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 5/5] microblaze: Add support for distro boot

Michal Simek-3
In reply to this post by Michal Simek-3
From: T Karthik Reddy <[hidden email]>

Add distro boot support for microblaze and enable jtag, qspi,
dhcp, pxe boot targets for distro boot.
Enable DISTRO_DEFAULTS config in microblaze defconfig and also
enable support for spi xilinx driver & spi vendors to access
spi flash by distro boot.

Signed-off-by: T Karthik Reddy <[hidden email]>
Signed-off-by: Ashok Reddy Soma <[hidden email]>
Signed-off-by: Michal Simek <[hidden email]>
---

 configs/microblaze-generic_defconfig | 12 ++++---
 include/configs/microblaze-generic.h | 49 ++++++++++++++++++++++++++--
 2 files changed, 54 insertions(+), 7 deletions(-)

diff --git a/configs/microblaze-generic_defconfig b/configs/microblaze-generic_defconfig
index bfbdb4928933..832796291e64 100644
--- a/configs/microblaze-generic_defconfig
+++ b/configs/microblaze-generic_defconfig
@@ -26,8 +26,6 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_NOR_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_OS_BASE=0x2c060000
-CONFIG_HUSH_PARSER=y
-# CONFIG_AUTO_COMPLETE is not set
 CONFIG_SYS_PROMPT="U-Boot-mONStR> "
 CONFIG_CMD_IMLS=y
 CONFIG_CMD_SPL=y
@@ -35,10 +33,7 @@ CONFIG_CMD_ASKENV=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_SAVES=y
 # CONFIG_CMD_SETEXPR is not set
-CONFIG_CMD_DHCP=y
 CONFIG_CMD_TFTPPUT=y
-CONFIG_CMD_MII=y
-CONFIG_CMD_PING=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_JFFS2=y
 CONFIG_SPL_OF_CONTROL=y
@@ -56,6 +51,12 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SPI_FLASH_ISSI=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_SPANSION=y
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_SST=y
+CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_PHY_ATHEROS=y
 CONFIG_PHY_BROADCOM=y
 CONFIG_PHY_DAVICOM=y
@@ -71,6 +72,7 @@ CONFIG_XILINX_AXIEMAC=y
 CONFIG_XILINX_EMACLITE=y
 CONFIG_SYS_NS16550=y
 CONFIG_XILINX_UARTLITE=y
+CONFIG_XILINX_SPI=y
 CONFIG_SYSRESET_GPIO=y
 CONFIG_SYSRESET_MICROBLAZE=y
 CONFIG_WDT=y
diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h
index 0dcefcfa83b6..955bee675a5f 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -125,11 +125,54 @@
 #define CONFIG_SYS_LOAD_ADDR 0
 
 #define CONFIG_HOSTNAME "microblaze-generic"
-#define CONFIG_BOOTCOMMAND "base 0;tftp 11000000 image.img;bootm"
 
 /* architecture dependent code */
 #define CONFIG_SYS_USR_EXCEP /* user exception */
 
+#if defined(CONFIG_CMD_PXE) && defined(CONFIG_CMD_DHCP)
+#define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
+#else
+#define BOOT_TARGET_DEVICES_PXE(func)
+#endif
+
+#if defined(CONFIG_CMD_DHCP)
+#define BOOT_TARGET_DEVICES_DHCP(func) func(DHCP, dhcp, na)
+#else
+#define BOOT_TARGET_DEVICES_DHCP(func)
+#endif
+
+#if defined(CONFIG_SPI_FLASH)
+# define BOOT_TARGET_DEVICES_QSPI(func) func(QSPI, qspi, na)
+#else
+# define BOOT_TARGET_DEVICES_QSPI(func)
+#endif
+
+#define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
+ "bootcmd_qspi=sf probe 0 0 0 && " \
+ "sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
+ "echo QSPI: Trying to boot script at ${scriptaddr} && " \
+ "source ${scriptaddr}; echo QSPI: SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
+ "qspi "
+
+#define BOOT_TARGET_DEVICES_JTAG(func) func(JTAG, jtag, na)
+
+#define BOOTENV_DEV_JTAG(devtypeu, devtypel, instance) \
+ "bootcmd_jtag=echo JTAG: Trying to boot script at ${scriptaddr} && " \
+ "source ${scriptaddr}; echo JTAG: SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_JTAG(devtypeu, devtypel, instance) \
+ "jtag "
+
+#define BOOT_TARGET_DEVICES(func) \
+ BOOT_TARGET_DEVICES_JTAG(func) \
+ BOOT_TARGET_DEVICES_QSPI(func)  \
+ BOOT_TARGET_DEVICES_DHCP(func) \
+ BOOT_TARGET_DEVICES_PXE(func)
+
+#include <config_distro_bootcmd.h>
+
 #ifndef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS \
  "unlock=yes\0"\
@@ -140,7 +183,9 @@
  "nc=setenv stdout nc;"\
  "setenv stdin nc\0" \
  "serial=setenv stdout serial;"\
- "setenv stdin serial\0"
+ "setenv stdin serial\0"\
+ "script_size_f=0x40000\0"\
+ BOOTENV
 #endif
 
 #if defined(CONFIG_XILINX_AXIEMAC)
--
2.28.0