arm64: versal: Misc patches
Subsystems (3)
cover arm64: versal: Misc patches
Hi,
I am sending some patches in series to make sure that they are applied in the proper order.
They can be applied an reviewed independently.
Thanks,
Michal
Michal Simek (3):
arm64: versal: Disable showing information about console
arm64: versal: Remove one level of indentation in board_early_init_r()
arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig
Siva Durga Prasad Paladugu (3):
arm64: versal: Define distro boot commnads for qspi ospi and mmc
arm64: versal: Define board_late_init for versal
arm64: versal: Add mini configuration for Versal
arch/arm/Kconfig | 1 + arch/arm/dts/Makefile | 1 + arch/arm/dts/versal-mini.dts | 36 ++++++ arch/arm/mach-versal/Kconfig | 6 + arch/arm/mach-versal/include/mach/hardware.h | 23 ++++ board/xilinx/versal/board.c | 169 ++++++++++++++++++++++----- configs/xilinx_versal_mini_defconfig | 53 +++++++++ configs/xilinx_versal_mini_emmc0_defconfig | 2 + configs/xilinx_versal_mini_emmc1_defconfig | 2 + include/configs/xilinx_versal.h | 26 ++++- 10 files changed, 291 insertions(+), 28 deletions(-) create mode 100644 arch/arm/dts/versal-mini.dts create mode 100644 configs/xilinx_versal_mini_defconfig
Signature · 1 line
1.9.1
PATCH 1/6 arm64: versal: Disable showing information about console
There is no need to see this info. It is just wasting of space/time. It saves 308Bytes.
---
configs/xilinx_versal_mini_emmc0_defconfig | 1 + configs/xilinx_versal_mini_emmc1_defconfig | 1 + 2 files changed, 2 insertions(+)
configs/xilinx_versal_mini_emmc0_defconfig +1 -0
@@ -6,6 +6,7 @@ CONFIG_ENV_SIZE=0x80 CONFIG_SYS_MALLOC_LEN=0x80000 CONFIG_COUNTER_FREQUENCY=2720000 CONFIG_NR_DRAM_BANKS=1 +CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_BOARD_EARLY_INIT_R=y # CONFIG_CMDLINE_EDITING is not set
configs/xilinx_versal_mini_emmc1_defconfig +1 -0
@@ -6,6 +6,7 @@ CONFIG_ENV_SIZE=0x80 CONFIG_SYS_MALLOC_LEN=0x80000 CONFIG_COUNTER_FREQUENCY=2720000 CONFIG_NR_DRAM_BANKS=1 +CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_BOARD_EARLY_INIT_R=y # CONFIG_CMDLINE_EDITING is not set
Signature · 1 line
1.9.1
PATCH 2/6 arm64: versal: Define distro boot commnads for qspi ospi and mmc
In reply to Michal SimekFrom: Siva Durga Prasad Paladugu <[email protected]>
This patch adds distro boot commands for qspi, ospi and mmc. The distro boot commands now reads the script from flash offset of 63.5MB for qspi and ospi and executes it. For mmc its same as generic distro boot command. As either one of the qspi or ospi can exist on hardware, defined a single distroboot command as xspi that works for both.
Setup default location via script_offset_f to 63.5MB to match the most xilinx reference boards for qspi, ospi for now.
512kB allocated space for script size (script_size_f) should be more than enough to cover custom boot logic.
---
include/configs/xilinx_versal.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
include/configs/xilinx_versal.h +25 -1
@@ -73,9 +73,33 @@"pxefile_addr_r=0x10000000\0" \"kernel_addr_r=0x18000000\0" \"scriptaddr=0x02000000\0" \ - "ramdisk_addr_r=0x02100000\0" +"ramdisk_addr_r=0x02100000\0" \ +"script_offset_f=0x3f80000\0" \ + "script_size_f=0x80000\0" + +#if defined(CONFIG_MMC_SDHCI_ZYNQ ) +# define BOOT_TARGET_DEVICES_MMC (func) func(MMC, mmc, 0) func(MMC, mmc, 1) +#else +# define BOOT_TARGET_DEVICES_MMC (func) +#endif + +#if defined(CONFIG_ZYNQMP_GQSPI ) || defined(CONFIG_CADENCE_OSPI_VERSAL ) +# define BOOT_TARGET_DEVICES_XSPI (func) func(XSPI, xspi, 0) +#else +# define BOOT_TARGET_DEVICES_XSPI (func) +#endif + +#define BOOTENV_DEV_XSPI (devtypeu, devtypel, instance) \ + "bootcmd_xspi0=sf probe 0 0 0 && " \ + "sf read $scriptaddr $script_offset_f $script_size_f && " \ + "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0" + +#define BOOTENV_DEV_NAME_XSPI (devtypeu, devtypel, instance) \ + "xspi "#define BOOT_TARGET_DEVICES (func) \ + BOOT_TARGET_DEVICES_MMC(func) \ + BOOT_TARGET_DEVICES_XSPI(func) \ func(PXE, pxe, na) \ func(DHCP, dhcp, na)
Signature · 1 line
1.9.1
PATCH 3/6 arm64: versal: Define board_late_init for versal
In reply to Michal SimekFrom: Siva Durga Prasad Paladugu <[email protected]>
Define board_late_init which performs bootmode detection and prepares corresponding distro boot commaand sequence.
---
arch/arm/Kconfig | 1 + arch/arm/mach-versal/include/mach/hardware.h | 23 ++++++ board/xilinx/versal/board.c | 111 +++++++++++++++++++++++++++ configs/xilinx_versal_mini_emmc0_defconfig | 1 + configs/xilinx_versal_mini_emmc1_defconfig | 1 + 5 files changed, 137 insertions(+)
arch/arm/Kconfig +1 -0
@@ -892,6 +892,7 @@ config ARCH_VERSAL select DM_MMC if MMC select DM_SERIAL select OF_CONTROL + imply BOARD_LATE_INIT config ARCH_VF610 bool "Freescale Vybrid"
arch/arm/mach-versal/include/mach/hardware.h +23 -0
@@ -51,3 +51,26 @@ struct rpu_regs { };#define rpu_base ((struct rpu_regs *)VERSAL_RPU_BASEADDR) + +#define VERSAL_CRP_BASEADDR 0xF1260000 + +struct crp_regs { +u32 reserved0[128 ]; +u32 boot_mode_usr; +}; + +#define crp_base ((struct crp_regs *)VERSAL_CRP_BASEADDR) + +/* Bootmode setting values */ +#define BOOT_MODES_MASK 0x0000000F +#define QSPI_MODE_24BIT 0x00000001 +#define QSPI_MODE_32BIT 0x00000002 +#define SD_MODE 0x00000003/* sd 0 */ +#define SD_MODE1 0x00000005/* sd 1 */ +#define EMMC_MODE 0x00000006 +#define USB_MODE 0x00000007 +#define OSPI_MODE 0x00000008 +#define SD1_LSHFT_MODE 0x0000000E/* SD1 Level shifter */ +#define JTAG_MODE 0x00000000 +#define BOOT_MODE_USE_ALT 0x100 +#define BOOT_MODE_ALT_SHIFT 12
board/xilinx/versal/board.c +111 -0
123 lines not on this page · raw message
configs/xilinx_versal_mini_emmc0_defconfig +1 -0
@@ -7,6 +7,7 @@ CONFIG_SYS_MALLOC_LEN=0x80000 CONFIG_COUNTER_FREQUENCY=2720000 CONFIG_NR_DRAM_BANKS=1 CONFIG_SYS_CONSOLE_INFO_QUIET=y +# CONFIG_BOARD_LATE_INIT is not set # CONFIG_DISPLAY_CPUINFO is not set CONFIG_BOARD_EARLY_INIT_R=y # CONFIG_CMDLINE_EDITING is not set
configs/xilinx_versal_mini_emmc1_defconfig +1 -0
@@ -7,6 +7,7 @@ CONFIG_SYS_MALLOC_LEN=0x80000 CONFIG_COUNTER_FREQUENCY=2720000 CONFIG_NR_DRAM_BANKS=1 CONFIG_SYS_CONSOLE_INFO_QUIET=y +# CONFIG_BOARD_LATE_INIT is not set # CONFIG_DISPLAY_CPUINFO is not set CONFIG_BOARD_EARLY_INIT_R=y # CONFIG_CMDLINE_EDITING is not set
Signature · 1 line
1.9.1
PATCH 4/6 arm64: versal: Remove one level of indentation in board_early_init_r()
In reply to Michal SimekSimplify code indentation.
---
board/xilinx/versal/board.c | 57 +++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 28 deletions(-)
board/xilinx/versal/board.c +29 -28
@@ -23,42 +23,43 @@ int board_init(void)int board_early_init_r (void ) { -if (current_el () ==3 ) { -u32 val; +u32 val; -writel (IOU_SWITCH_CTRL_CLKACT_BIT | - (0x20 <<IOU_SWITCH_CTRL_DIVISOR0_SHIFT ), - &crlapb_base->iou_switch_ctrl); +if (current_el () !=3 ) +return 0 ; -/* Global timer init - Program time stamp reference clk */ - val =readl (&crlapb_base->timestamp_ref_ctrl); - val |=CRL_APB_TIMESTAMP_REF_CTRL_CLKACT_BIT ; -writel (val, &crlapb_base->timestamp_ref_ctrl); +writel (IOU_SWITCH_CTRL_CLKACT_BIT | + (0x20 <<IOU_SWITCH_CTRL_DIVISOR0_SHIFT ), + &crlapb_base->iou_switch_ctrl); -debug ("ref ctrl 0x%x\n" , -readl (&crlapb_base->timestamp_ref_ctrl)); +/* Global timer init - Program time stamp reference clk */ + val =readl (&crlapb_base->timestamp_ref_ctrl); + val |=CRL_APB_TIMESTAMP_REF_CTRL_CLKACT_BIT ; +writel (val, &crlapb_base->timestamp_ref_ctrl); -/* Clear reset of timestamp reg */ -writel (0 , &crlapb_base->rst_timestamp); +debug ("ref ctrl 0x%x\n" , +readl (&crlapb_base->timestamp_ref_ctrl)); -/* -* Program freq register in System counter and -* enable system counter. -*/ -writel (COUNTER_FREQUENCY , - &iou_scntr_secure->base_frequency_id_register); +/* Clear reset of timestamp reg */ +writel (0 , &crlapb_base->rst_timestamp); -debug ("counter val 0x%x\n" , -readl (&iou_scntr_secure->base_frequency_id_register)); +/* +* Program freq register in System counter and +* enable system counter. +*/ +writel (COUNTER_FREQUENCY , + &iou_scntr_secure->base_frequency_id_register); -writel (IOU_SCNTRS_CONTROL_EN , - &iou_scntr_secure->counter_control_register); +debug ("counter val 0x%x\n" , +readl (&iou_scntr_secure->base_frequency_id_register)); -debug ("scntrs control 0x%x\n" , -readl (&iou_scntr_secure->counter_control_register)); -debug ("timer 0x%llx\n" ,get_ticks ()); -debug ("timer 0x%llx\n" ,get_ticks ()); - } +writel (IOU_SCNTRS_CONTROL_EN , + &iou_scntr_secure->counter_control_register); + +debug ("scntrs control 0x%x\n" , +readl (&iou_scntr_secure->counter_control_register)); +debug ("timer 0x%llx\n" ,get_ticks ()); +debug ("timer 0x%llx\n" ,get_ticks ());return 0 ; }
Signature · 1 line
1.9.1
PATCH 5/6 arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig
In reply to Michal SimekMove hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up for different platforms.
---
arch/arm/mach-versal/Kconfig | 6 ++++++ board/xilinx/versal/board.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-)
arch/arm/mach-versal/Kconfig +6 -0
@@ -41,6 +41,12 @@ config VERSAL_OF_BOARD_DTB_ADDR default 0x1000 depends on OF_BOARD +config IOU_SWITCH_DIVISOR0 + hex "IOU switch divisor0" + default 0x20 + help + Setup time clock divisor for input clock. + config SYS_MEM_RSVD_FOR_MMU bool "Reserve memory for MMU Table" help
board/xilinx/versal/board.c +4 -1
@@ -28,8 +28,11 @@ int board_early_init_r(void)if (current_el () !=3 )return 0 ; +debug ("iou_switch ctrl div0 %x\n" , +readl (&crlapb_base->iou_switch_ctrl)); +writel (IOU_SWITCH_CTRL_CLKACT_BIT | - (0x20 <<IOU_SWITCH_CTRL_DIVISOR0_SHIFT ), + (CONFIG_IOU_SWITCH_DIVISOR0 <<IOU_SWITCH_CTRL_DIVISOR0_SHIFT ), &crlapb_base->iou_switch_ctrl);/* Global timer init - Program time stamp reference clk */
Signature · 1 line
1.9.1
PATCH 6/6 arm64: versal: Add mini configuration for Versal
In reply to Michal SimekFrom: Siva Durga Prasad Paladugu <[email protected]>
This patch adds new mini target for versal. This configuration is very minimal in size which runs from OCM. It contains support for mtest which can be used for running DDR memory tests.
---
arch/arm/dts/Makefile | 1 + arch/arm/dts/versal-mini.dts | 36 ++++++++++++++++++++++++ configs/xilinx_versal_mini_defconfig | 53 ++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 arch/arm/dts/versal-mini.dts create mode 100644 configs/xilinx_versal_mini_defconfig
arch/arm/dts/Makefile +1 -0
@@ -186,6 +186,7 @@ dtb-$(CONFIG_ARCH_ZYNQMP) += \ zynqmp-zc1751-xm018-dc4.dtb \ zynqmp-zc1751-xm019-dc5.dtb dtb-$(CONFIG_ARCH_VERSAL) += \ + versal-mini.dtb \ versal-mini-emmc0.dtb \ versal-mini-emmc1.dtb dtb-$(CONFIG_ARCH_ZYNQMP_R5) += \
arch/arm/dts/versal-mini.dts new file +36 -0
@@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * dts file for Xilinx Versal Mini Configuration + * + * (C) Copyright 2019, Xilinx, Inc. + * + * Siva Durga Prasad Paladugu <[email protected]> + */ + +/dts-v1/; + +/ { + model = "Versal MINI"; + compatible = "xlnx,versal"; + #address-cells = <2>; + #size-cells = <2>; + + aliases { + serial0 = &dcc; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory at 0 { + device_type = "memory"; + reg = <0x0 0xfffc0000 0x0 0x40000>, <0x0 0x0 0x0 0x80000000>; + }; + + dcc: dcc { + compatible = "arm,dcc"; + status = "okay"; + u-boot,dm-pre-reloc; + }; +};
configs/xilinx_versal_mini_defconfig new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
1.9.1