Re: [U-Boot] rockchip: dts: fix unnecessary '-cells' warning
> Fix warning below: > unnecessary #address-cells/#size-cells without "ranges" or child "reg" > property > > Signed-off-by: Kever Yang > Reviewed-by: Philipp Tomsich > Acked-by: Philipp Tomsich > --- > > arch/arm/dts/rk3288-evb.dtsi | 2 -- > arch/arm/dts/rk3288-firefly.dtsi | 2 -- > arch/arm/dts/rk3288-tinker.dtsi | 2 -- > arch/arm/dts/rk3288-veyron.dtsi | 2 -- > arch/arm/dts/rk3288.dtsi | 2 -- > arch/arm/dts/rk3328.dtsi | 2 -- > arch/arm/dts/rk3399-puma.dtsi| 2 -- > arch/arm/dts/rk3399.dtsi | 4 > 8 files changed, 18 deletions(-) > Applied to u-boot-rockchip, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, v5, 1/2] spl: add support to booting with OP-TEE
> OP-TEE is an open source trusted OS, in armv7, its loading and > running are like this: > loading: > - SPL load both OP-TEE and U-Boot > running: > - SPL run into OP-TEE in secure mode; > - OP-TEE run into U-Boot in non-secure mode; > > To make code simple, it would be fine to use IH_OS_TEE for the > os tyle in TPL(just like IH_OS_LINUX is using both in SPL and U-Boot). > > Here is the diagram for SPL loading OP-TEE, > IH_OS_TEE:(make u-boot.itb for SPL) > Non-Secure Secure > > BootROM >| >v > SPL >| >v > - OP-TEE > | > v >U-Boot > | > V >Linux > For other two king of OP-TEE loading/booting, see commit message: > 45b55712d4 image: Add IH_OS_TEE for TEE chain-load boot > > More detail: > https://github.com/OP-TEE/optee_os > and search for 'boot arguments' for detail entry parameter in: > core/arch/arm/kernel/generic_entry_a32.S > > Signed-off-by: Kever Yang > Cc: Bryan O'Donoghue > --- > > Changes in v5: > - Split the patch out from rk3229 seris > - Use IH_OS_TEE instead of IH_OS_OP-TEE > > Changes in v4: > - use NULL instead of '0' > - add fdt_addr as arg2 of entry > > Changes in v2: > - Using new image type for op-tee > > common/spl/Kconfig | 7 +++ > common/spl/Makefile| 1 + > common/spl/spl.c | 7 +++ > common/spl/spl_optee.S | 12 > include/spl.h | 13 + > 5 files changed, 40 insertions(+) > create mode 100644 common/spl/spl_optee.S > Reviewed-by: Philipp Tomsich ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 00/12] riscv: Add QEMU virt board support
This series adds QEMU RISC-V 'virt' board target support, with the hope of helping people easily test U-Boot on RISC-V. Some existing RISC-V codes have been changed to make it easily to support new targets. Some spotted coding style issues are fixed. This series is available at u-boot-x86/riscv-working for testing. Bin Meng (12): riscv: kconfig: Normalize architecture name spelling riscv: Remove setup.h riscv: bootm: Correct the 1st kernel argument to hart id riscv: Remove mach type riscv: Move the linker script to the CPU root directory riscv: Fix coding style issues in the linker script riscv: Explicitly pass -march and -mabi to the compiler riscv: Add a helper routine to print CPU information riscv: Make start.S available for all targets riscv: ae350: Clean up mixed tabs and spaces in the dts riscv: kconfig: Select DM and OF_CONTROL riscv: Add QEMU virt board support arch/Kconfig| 5 +- arch/riscv/Kconfig | 10 +- arch/riscv/Makefile | 3 +- arch/riscv/config.mk| 9 +- arch/riscv/cpu/Makefile | 7 ++ arch/riscv/cpu/ax25/Makefile| 2 - arch/riscv/cpu/cpu.c| 49 arch/riscv/cpu/qemu/Makefile| 6 + arch/riscv/cpu/qemu/cpu.c | 29 + arch/riscv/cpu/qemu/dram.c | 17 +++ arch/riscv/cpu/{ax25 => }/start.S | 0 arch/riscv/cpu/{ax25 => }/u-boot.lds| 60 +- arch/riscv/dts/ae350.dts| 177 +++-- arch/riscv/include/asm/bootm.h | 13 --- arch/riscv/include/asm/csr.h| 124 arch/riscv/include/asm/mach-types.h | 29 - arch/riscv/include/asm/setup.h | 194 arch/riscv/include/asm/u-boot.h | 1 - arch/riscv/lib/bootm.c | 19 +--- board/AndesTech/ax25-ae350/ax25-ae350.c | 2 - board/emulation/qemu-riscv/Kconfig | 21 board/emulation/qemu-riscv/MAINTAINERS | 7 ++ board/emulation/qemu-riscv/Makefile | 5 + board/emulation/qemu-riscv/qemu-riscv.c | 23 cmd/bdinfo.c| 1 - configs/ax25-ae350_defconfig| 2 - configs/qemu-riscv32_defconfig | 10 ++ configs/qemu-riscv64_defconfig | 11 ++ doc/README.qemu-riscv | 46 include/configs/qemu-riscv.h| 21 30 files changed, 520 insertions(+), 383 deletions(-) create mode 100644 arch/riscv/cpu/Makefile create mode 100644 arch/riscv/cpu/cpu.c create mode 100644 arch/riscv/cpu/qemu/Makefile create mode 100644 arch/riscv/cpu/qemu/cpu.c create mode 100644 arch/riscv/cpu/qemu/dram.c rename arch/riscv/cpu/{ax25 => }/start.S (100%) rename arch/riscv/cpu/{ax25 => }/u-boot.lds (54%) delete mode 100644 arch/riscv/include/asm/bootm.h create mode 100644 arch/riscv/include/asm/csr.h delete mode 100644 arch/riscv/include/asm/mach-types.h delete mode 100644 arch/riscv/include/asm/setup.h create mode 100644 board/emulation/qemu-riscv/Kconfig create mode 100644 board/emulation/qemu-riscv/MAINTAINERS create mode 100644 board/emulation/qemu-riscv/Makefile create mode 100644 board/emulation/qemu-riscv/qemu-riscv.c create mode 100644 configs/qemu-riscv32_defconfig create mode 100644 configs/qemu-riscv64_defconfig create mode 100644 doc/README.qemu-riscv create mode 100644 include/configs/qemu-riscv.h -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 01/12] riscv: kconfig: Normalize architecture name spelling
It's RISC-V that is the official name, not RISCV. Signed-off-by: Bin Meng --- arch/Kconfig | 2 +- arch/riscv/Kconfig | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index bf1b4a9..42c23b5 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -60,7 +60,7 @@ config PPC select SYS_BOOT_GET_KBD config RISCV - bool "riscv architecture" + bool "RISC-V architecture" select SUPPORT_OF_CONTROL config SANDBOX diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 20a43d8..49f87de 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -1,4 +1,4 @@ -menu "RISCV architecture" +menu "RISC-V architecture" depends on RISCV config SYS_ARCH @@ -20,13 +20,13 @@ choice default CPU_RISCV_32 config CPU_RISCV_32 - bool "RISCV 32 bit" + bool "RISC-V 32-bit" select 32BIT help Choose this option to build an U-Boot for RISCV32 architecture. config CPU_RISCV_64 - bool "RISCV 64 bit" + bool "RISC-V 64-bit" select 64BIT help Choose this option to build an U-Boot for RISCV64 architecture. -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 02/12] riscv: Remove setup.h
This was copied from ARM, and does not apply to RISC-V. While we are here, bootm.h is eventually removed as its content is only the inclusion of setup.h. Signed-off-by: Bin Meng --- arch/riscv/include/asm/bootm.h | 13 --- arch/riscv/include/asm/setup.h | 194 - arch/riscv/lib/bootm.c | 1 - 3 files changed, 208 deletions(-) delete mode 100644 arch/riscv/include/asm/bootm.h delete mode 100644 arch/riscv/include/asm/setup.h diff --git a/arch/riscv/include/asm/bootm.h b/arch/riscv/include/asm/bootm.h deleted file mode 100644 index 6786345..000 --- a/arch/riscv/include/asm/bootm.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright (c) 2013, Google Inc. - * - * Copyright (C) 2011 - * Corscience GmbH & Co. KG - Simon Schwarz - */ -#ifndef NDS32_BOOTM_H -#define NDS32_BOOTM_H - -#include - -#endif diff --git a/arch/riscv/include/asm/setup.h b/arch/riscv/include/asm/setup.h deleted file mode 100644 index ff8de16..000 --- a/arch/riscv/include/asm/setup.h +++ /dev/null @@ -1,194 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * linux/arch/nds32/include/asm/setup.h - * - * Copyright (C) 1997-1999 Russell King - * Copyright (C) 2008 Andes Technology Corporation - * Copyright (C) 2013 Ken Kuo (ken_...@andestech.com) - * Copyright (C) 2017 Rick Chen (r...@andestech.com) - * - * Structure passed to kernel to tell it about the - * hardware it's running on. See Documentation/arm/Setup - * for more info. - */ -#ifndef __RISCV_SETUP_H -#define __RISCV_SETUP_H - -#define COMMAND_LINE_SIZE 256 - -/* The list ends with an ATAG_NONE node. */ -#define ATAG_NONE 0x - -struct tag_header { - u32 size; - u32 tag; -}; - -/* The list must start with an ATAG_CORE node */ -#define ATAG_CORE 0x54410001 - -struct tag_core { - u32 flags; /* bit 0 = read-only */ - u32 pagesize; - u32 rootdev; -}; - -/* it is allowed to have multiple ATAG_MEM nodes */ -#define ATAG_MEM 0x54410002 - -struct tag_mem32 { - u32 size; - u32 start; /* physical start address */ -}; - -/* VGA text type displays */ -#define ATAG_VIDEOTEXT 0x54410003 - -struct tag_videotext { - u8 x; - u8 y; - u16 video_page; - u8 video_mode; - u8 video_cols; - u16 video_ega_bx; - u8 video_lines; - u8 video_isvga; - u16 video_points; -}; - -/* describes how the ramdisk will be used in kernel */ -#define ATAG_RAMDISK 0x54410004 - -struct tag_ramdisk { - u32 flags; /* bit 0 = load, bit 1 = prompt */ - u32 size; /* decompressed ramdisk size in _kilo_ bytes */ - u32 start; /* starting block of floppy-based RAM disk image */ -}; - -/* - * this one accidentally used virtual addresses - as such, - * it's deprecated. - * describes where the compressed ramdisk image lives (virtual address) - */ -#define ATAG_INITRD0x54410005 - -/* describes where the compressed ramdisk image lives (physical address) */ -#define ATAG_INITRD2 0x54420005 - -struct tag_initrd { - u32 start; /* physical start address */ - u32 size; /* size of compressed ramdisk image in bytes */ -}; - -/* board serial number. "64 bits should be enough for everybody" */ -#define ATAG_SERIAL0x54410006 - -struct tag_serialnr { - u32 low; - u32 high; -}; - -/* board revision */ -#define ATAG_REVISION 0x54410007 - -struct tag_revision { - u32 rev; -}; - -/* initial values for vesafb-type framebuffers. see struct screen_info - * in include/linux/tty.h - */ -#define ATAG_VIDEOLFB 0x54410008 - -struct tag_videolfb { - u16 lfb_width; - u16 lfb_height; - u16 lfb_depth; - u16 lfb_linelength; - u32 lfb_base; - u32 lfb_size; - u8 red_size; - u8 red_pos; - u8 green_size; - u8 green_pos; - u8 blue_size; - u8 blue_pos; - u8 rsvd_size; - u8 rsvd_pos; -}; - -/* command line: \0 terminated string */ -#define ATAG_CMDLINE 0x54410009 - -struct tag_cmdline { - charcmdline[COMMAND_LINE_SIZE]; -}; - -struct tag { - struct tag_header hdr; - union { - struct tag_core core; - struct tag_mem32mem; - struct tag_videotextvideotext; - struct tag_ramdisk ramdisk; - struct tag_initrd initrd; - struct tag_serialnr serialnr; - struct tag_revision revision; - struct tag_videolfb videolfb; - struct tag_cmdline cmdline; - } u; -}; - -struct tag
[U-Boot] [PATCH 04/12] riscv: Remove mach type
Since the mach_id is not used by RISC-V, remove it. Signed-off-by: Bin Meng --- arch/riscv/include/asm/mach-types.h | 29 - arch/riscv/include/asm/u-boot.h | 1 - board/AndesTech/ax25-ae350/ax25-ae350.c | 2 -- cmd/bdinfo.c| 1 - 4 files changed, 33 deletions(-) delete mode 100644 arch/riscv/include/asm/mach-types.h diff --git a/arch/riscv/include/asm/mach-types.h b/arch/riscv/include/asm/mach-types.h deleted file mode 100644 index f219ced..000 --- a/arch/riscv/include/asm/mach-types.h +++ /dev/null @@ -1,29 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright (C) 2017 Andes Technology Corporation - * Rick Chen, Andes Technology Corporation - */ - -#ifndef __ASM_RISCV_MACH_TYPE_H -#define __ASM_RISCV_MACH_TYPE_H - -#ifndef __ASSEMBLY__ -/* The type of machine we're running on */ -extern unsigned int __machine_arch_type; -#endif - -#define MACH_TYPE_AE3501 - -#ifdef CONFIG_ARCH_AE350 -# ifdef machine_arch_type -# undef machine_arch_type -# define machine_arch_type __machine_arch_type -# else -# define machine_arch_type MACH_TYPE_AE350 -# endif -# define machine_is_ae350() (machine_arch_type == MACH_TYPE_AE350) -#else -# define machine_is_ae350() (1) -#endif - -#endif /* __ASM_RISCV_MACH_TYPE_H */ diff --git a/arch/riscv/include/asm/u-boot.h b/arch/riscv/include/asm/u-boot.h index 9e5b32d..3186835 100644 --- a/arch/riscv/include/asm/u-boot.h +++ b/arch/riscv/include/asm/u-boot.h @@ -23,7 +23,6 @@ #include typedef struct bd_info { - unsigned long bi_arch_number; /* unique id for this board */ unsigned long bi_boot_params; /* where this board expects params */ unsigned long bi_memstart;/* start of DRAM memory */ unsigned long bi_memsize; /* size of DRAM memory in bytes */ diff --git a/board/AndesTech/ax25-ae350/ax25-ae350.c b/board/AndesTech/ax25-ae350/ax25-ae350.c index fd5aaa1..5f4ca0f 100644 --- a/board/AndesTech/ax25-ae350/ax25-ae350.c +++ b/board/AndesTech/ax25-ae350/ax25-ae350.c @@ -4,7 +4,6 @@ * Rick Chen, Andes Technology Corporation */ -#include #include #if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH) #include @@ -21,7 +20,6 @@ DECLARE_GLOBAL_DATA_PTR; int board_init(void) { - gd->bd->bi_arch_number = MACH_TYPE_AE350; gd->bd->bi_boot_params = PHYS_SDRAM_0 + 0x400; return 0; diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 397dd15..bc440e4 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -424,7 +424,6 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { bd_t *bd = gd->bd; - print_num("arch_number", bd->bi_arch_number); print_bi_boot_params(bd); print_bi_dram(bd); print_eth_ip_addr(); -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 05/12] riscv: Move the linker script to the CPU root directory
The linker script can be shared by all RISC-V targets. Move it to a common place. Signed-off-by: Bin Meng --- arch/riscv/cpu/{ax25 => }/u-boot.lds | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename arch/riscv/cpu/{ax25 => }/u-boot.lds (100%) diff --git a/arch/riscv/cpu/ax25/u-boot.lds b/arch/riscv/cpu/u-boot.lds similarity index 100% rename from arch/riscv/cpu/ax25/u-boot.lds rename to arch/riscv/cpu/u-boot.lds -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 03/12] riscv: bootm: Correct the 1st kernel argument to hart id
The first argument of Linux kernel is the risc-v core hart id, from which the kernel is booted from. It is not the mach_id, which seems to be copied from arm. Signed-off-by: Bin Meng --- arch/riscv/lib/bootm.c | 18 +- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c index 6662aff..754bbff 100644 --- a/arch/riscv/lib/bootm.c +++ b/arch/riscv/lib/bootm.c @@ -25,10 +25,7 @@ int arch_fixup_fdt(void *blob) int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) { - bd_t*bd = gd->bd; - char*s; - int machid = bd->bi_arch_number; - void(*theKernel)(int arch, uint params); + void(*kernel)(int hart, uint dtb); /* * allow the PREP bootm subcommand, it is required for bootm to work @@ -39,18 +36,12 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) return 1; - theKernel = (void (*)(int, uint))images->ep; - - s = env_get("machid"); - if (s) { - machid = simple_strtoul(s, NULL, 16); - printf("Using machid 0x%x from environment\n", machid); - } + kernel = (void (*)(int, uint))images->ep; bootstage_mark(BOOTSTAGE_ID_RUN_OS); debug("## Transferring control to Linux (at address %08lx) ...\n", - (ulong)theKernel); + (ulong)kernel); if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) { #ifdef CONFIG_OF_LIBFDT @@ -66,8 +57,9 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) printf("\nStarting kernel ...\n\n"); cleanup_before_linux(); + /* TODO: hardcode the hart id to zero for now */ if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) - theKernel(machid, (unsigned long)images->ft_addr); + kernel(0, (unsigned long)images->ft_addr); /* does not return */ -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 08/12] riscv: Add a helper routine to print CPU information
This adds a helper routine to print CPU information. Currently it prints all the instruction set extensions that the processor core supports. Signed-off-by: Bin Meng --- arch/riscv/Makefile | 1 + arch/riscv/cpu/Makefile | 5 ++ arch/riscv/cpu/cpu.c | 49 + arch/riscv/include/asm/csr.h | 124 +++ 4 files changed, 179 insertions(+) create mode 100644 arch/riscv/cpu/Makefile create mode 100644 arch/riscv/cpu/cpu.c create mode 100644 arch/riscv/include/asm/csr.h diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 084888a..af432e1 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -5,5 +5,6 @@ head-y := arch/riscv/cpu/$(CPU)/start.o +libs-y += arch/riscv/cpu/ libs-y += arch/riscv/cpu/$(CPU)/ libs-y += arch/riscv/lib/ diff --git a/arch/riscv/cpu/Makefile b/arch/riscv/cpu/Makefile new file mode 100644 index 000..63de163 --- /dev/null +++ b/arch/riscv/cpu/Makefile @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2018, Bin Meng + +obj-y += cpu.o diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c new file mode 100644 index 000..ae57fb8 --- /dev/null +++ b/arch/riscv/cpu/cpu.c @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018, Bin Meng + */ + +#include +#include + +enum { + ISA_INVALID = 0, + ISA_32BIT, + ISA_64BIT, + ISA_128BIT +}; + +static const char * const isa_bits[] = { + [ISA_INVALID] = NULL, + [ISA_32BIT] = "32", + [ISA_64BIT] = "64", + [ISA_128BIT] = "128" +}; + +static inline bool supports_extension(char ext) +{ + return csr_read(misa) & (1 << (ext - 'a')); +} + +int print_cpuinfo(void) +{ + char name[32]; + char *s = name; + int bit; + + s += sprintf(name, "rv"); + bit = csr_read(misa) >> (sizeof(long) * 8 - 2); + s += sprintf(s, isa_bits[bit]); + + supports_extension('i') ? *s++ = 'i' : 'r'; + supports_extension('m') ? *s++ = 'm' : 'i'; + supports_extension('a') ? *s++ = 'a' : 's'; + supports_extension('f') ? *s++ = 'f' : 'c'; + supports_extension('d') ? *s++ = 'd' : '-'; + supports_extension('c') ? *s++ = 'c' : 'v'; + *s++ = '\0'; + + printf("CPU: %s\n", name); + + return 0; +} diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h new file mode 100644 index 000..50fccea --- /dev/null +++ b/arch/riscv/include/asm/csr.h @@ -0,0 +1,124 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2015 Regents of the University of California + * + * Taken from Linux arch/riscv/include/asm/csr.h + */ + +#ifndef _ASM_RISCV_CSR_H +#define _ASM_RISCV_CSR_H + +/* Status register flags */ +#define SR_SIE _AC(0x0002, UL) /* Supervisor Interrupt Enable */ +#define SR_SPIE_AC(0x0020, UL) /* Previous Supervisor IE */ +#define SR_SPP _AC(0x0100, UL) /* Previously Supervisor */ +#define SR_SUM _AC(0x0004, UL) /* Supervisor access User Memory */ + +#define SR_FS _AC(0x6000, UL) /* Floating-point Status */ +#define SR_FS_OFF _AC(0x, UL) +#define SR_FS_INITIAL _AC(0x2000, UL) +#define SR_FS_CLEAN_AC(0x4000, UL) +#define SR_FS_DIRTY_AC(0x6000, UL) + +#define SR_XS _AC(0x00018000, UL) /* Extension Status */ +#define SR_XS_OFF _AC(0x, UL) +#define SR_XS_INITIAL _AC(0x8000, UL) +#define SR_XS_CLEAN_AC(0x0001, UL) +#define SR_XS_DIRTY_AC(0x00018000, UL) + +#ifndef CONFIG_64BIT +#define SR_SD _AC(0x8000, UL) /* FS/XS dirty */ +#else +#define SR_SD _AC(0x8000, UL) /* FS/XS dirty */ +#endif + +/* SATP flags */ +#if __riscv_xlen == 32 +#define SATP_PPN _AC(0x003F, UL) +#define SATP_MODE_32 _AC(0x8000, UL) +#define SATP_MODE SATP_MODE_32 +#else +#define SATP_PPN _AC(0x0FFF, UL) +#define SATP_MODE_39 _AC(0x8000, UL) +#define SATP_MODE SATP_MODE_39 +#endif + +/* Interrupt Enable and Interrupt Pending flags */ +#define SIE_SSIE _AC(0x0002, UL) /* Software Interrupt Enable */ +#define SIE_STIE _AC(0x0020, UL) /* Timer Interrupt Enable */ + +#define EXC_INST_MISALIGNED0 +#define EXC_INST_ACCESS1 +#define EXC_BREAKPOINT 3 +#define EXC_LOAD_ACCESS5 +#define EXC_STORE_ACCESS 7 +#define EXC_SYSCALL8 +#define EXC_INST_PAGE_FAULT12 +#define EXC_LOAD_PAGE_FAULT13 +#define EXC_STORE_PAGE_FAULT 15 + +#ifndef __ASSEMBLY__ + +#define csr_swap(csr, val) \ +({ \ + unsigned long __v = (unsigned long)(val); \ + __asm__ __volatile__ ("csrrw %0, " #csr ", %1" \ + : "=r" (__v) : "rK" (__v) \ +
[U-Boot] [PATCH 06/12] riscv: Fix coding style issues in the linker script
There are several coding style issues in the linker script. Fix them. Signed-off-by: Bin Meng --- arch/riscv/cpu/u-boot.lds | 58 +++ 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/arch/riscv/cpu/u-boot.lds b/arch/riscv/cpu/u-boot.lds index c50b964..f414473 100644 --- a/arch/riscv/cpu/u-boot.lds +++ b/arch/riscv/cpu/u-boot.lds @@ -3,28 +3,27 @@ * Copyright (C) 2017 Andes Technology Corporation * Rick Chen, Andes Technology Corporation */ + OUTPUT_ARCH("riscv") ENTRY(_start) SECTIONS { . = ALIGN(4); - .text : - { + .text : { arch/riscv/cpu/ax25/start.o (.text) } /* This needs to come before *(.text*) */ .efi_runtime : { -__efi_runtime_start = .; + __efi_runtime_start = .; *(.text.efi_runtime*) *(.rodata.efi_runtime*) *(.data.efi_runtime*) -__efi_runtime_stop = .; + __efi_runtime_stop = .; } - .text_rest : - { + .text_rest : { *(.text*) } @@ -39,10 +38,10 @@ SECTIONS . = ALIGN(4); .got : { - __got_start = .; - *(.got.plt) *(.got) - __got_end = .; -} + __got_start = .; + *(.got.plt) *(.got) + __got_end = .; + } . = ALIGN(4); @@ -50,41 +49,40 @@ SECTIONS KEEP(*(SORT(.u_boot_list*))); } -. = ALIGN(4); + . = ALIGN(4); .efi_runtime_rel : { -__efi_runtime_rel_start = .; + __efi_runtime_rel_start = .; *(.rel*.efi_runtime) *(.rel*.efi_runtime.*) -__efi_runtime_rel_stop = .; + __efi_runtime_rel_stop = .; } -. = ALIGN(4); + . = ALIGN(4); -/DISCARD/ : { *(.rela.plt*) } -.rela.dyn : { -__rel_dyn_start = .; -*(.rela*) -__rel_dyn_end = .; -} + /DISCARD/ : { *(.rela.plt*) } + .rela.dyn : { + __rel_dyn_start = .; + *(.rela*) + __rel_dyn_end = .; + } -. = ALIGN(4); + . = ALIGN(4); -.dynsym : { -__dyn_sym_start = .; -*(.dynsym) -__dyn_sym_end = .; -} + .dynsym : { + __dyn_sym_start = .; + *(.dynsym) + __dyn_sym_end = .; + } -. = ALIGN(4); + . = ALIGN(4); _end = .; .bss : { -__bss_start = .; -*(.bss*) + __bss_start = .; + *(.bss*) . = ALIGN(4); __bss_end = .; } - } -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 09/12] riscv: Make start.S available for all targets
Currently start.S is inside arch/riscv/cpu/ax25/, but it can be common for all RISC-V targets. Signed-off-by: Bin Meng --- arch/riscv/Makefile | 2 +- arch/riscv/cpu/Makefile | 2 ++ arch/riscv/cpu/ax25/Makefile | 2 -- arch/riscv/cpu/{ax25 => }/start.S | 0 arch/riscv/cpu/u-boot.lds | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename arch/riscv/cpu/{ax25 => }/start.S (100%) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index af432e1..8fb6a88 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -3,7 +3,7 @@ # Copyright (C) 2017 Andes Technology Corporation. # Rick Chen, Andes Technology Corporation -head-y := arch/riscv/cpu/$(CPU)/start.o +head-y := arch/riscv/cpu/start.o libs-y += arch/riscv/cpu/ libs-y += arch/riscv/cpu/$(CPU)/ diff --git a/arch/riscv/cpu/Makefile b/arch/riscv/cpu/Makefile index 63de163..2cc6757 100644 --- a/arch/riscv/cpu/Makefile +++ b/arch/riscv/cpu/Makefile @@ -2,4 +2,6 @@ # # Copyright (C) 2018, Bin Meng +extra-y = start.o + obj-y += cpu.o diff --git a/arch/riscv/cpu/ax25/Makefile b/arch/riscv/cpu/ax25/Makefile index c3f164c..2ab0342 100644 --- a/arch/riscv/cpu/ax25/Makefile +++ b/arch/riscv/cpu/ax25/Makefile @@ -3,6 +3,4 @@ # Copyright (C) 2017 Andes Technology Corporation # Rick Chen, Andes Technology Corporation -extra-y= start.o - obj-y := cpu.o diff --git a/arch/riscv/cpu/ax25/start.S b/arch/riscv/cpu/start.S similarity index 100% rename from arch/riscv/cpu/ax25/start.S rename to arch/riscv/cpu/start.S diff --git a/arch/riscv/cpu/u-boot.lds b/arch/riscv/cpu/u-boot.lds index f414473..11bc4a7 100644 --- a/arch/riscv/cpu/u-boot.lds +++ b/arch/riscv/cpu/u-boot.lds @@ -11,7 +11,7 @@ SECTIONS { . = ALIGN(4); .text : { - arch/riscv/cpu/ax25/start.o (.text) + arch/riscv/cpu/start.o (.text) } /* This needs to come before *(.text*) */ -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 10/12] riscv: ae350: Clean up mixed tabs and spaces in the dts
There are quite a lot of mixed tabs and spaces in the ae350.dts. Clean them up. Signed-off-by: Bin Meng --- arch/riscv/dts/ae350.dts | 177 --- 1 file changed, 90 insertions(+), 87 deletions(-) diff --git a/arch/riscv/dts/ae350.dts b/arch/riscv/dts/ae350.dts index 2927e41..4717ae8 100644 --- a/arch/riscv/dts/ae350.dts +++ b/arch/riscv/dts/ae350.dts @@ -1,144 +1,147 @@ /dts-v1/; / { - #address-cells = <2>; - #size-cells = <2>; - compatible = "andestech,ax25"; - model = "andestech,ax25"; + #address-cells = <2>; + #size-cells = <2>; + compatible = "andestech,ax25"; + model = "andestech,ax25"; aliases { uart0 = &serial0; spi0 = &spi; - } ; + }; chosen { bootargs = "console=ttyS0,38400n8 earlyprintk=uart8250-32bit,0xf030 debug loglevel=7"; stdout-path = "uart0:38400n8"; - }; - - cpus { -#address-cells = <1>; -#size-cells = <0>; -timebase-frequency = <1000>; -CPU0: cpu@0 { - device_type = "cpu"; - reg = <0>; - status = "okay"; - compatible = "riscv"; - riscv,isa = "rv64imafdc"; - mmu-type = "riscv,sv39"; - clock-frequency = <6000>; - CPU0_intc: interrupt-controller { -#interrupt-cells = <1>; -interrupt-controller; -compatible = "riscv,cpu-intc"; - }; -}; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + timebase-frequency = <1000>; + + CPU0: cpu@0 { + device_type = "cpu"; + reg = <0>; + status = "okay"; + compatible = "riscv"; + riscv,isa = "rv64imafdc"; + mmu-type = "riscv,sv39"; + clock-frequency = <6000>; + + CPU0_intc: interrupt-controller { + #interrupt-cells = <1>; + interrupt-controller; + compatible = "riscv,cpu-intc"; + }; + }; }; memory@0 { device_type = "memory"; -reg = <0x0 0x 0x0 0x4000>; + reg = <0x0 0x 0x0 0x4000>; }; - soc { -#address-cells = <2>; -#size-cells = <2>; -compatible = "andestech,riscv-ae350-soc"; -ranges; + soc { + #address-cells = <2>; + #size-cells = <2>; + compatible = "andestech,riscv-ae350-soc"; + ranges; }; - plmt0@e600 { -compatible = "riscv,plmt0"; -interrupts-extended = <&CPU0_intc 7>; -reg = <0x0 0xe600 0x0 0x10>; - }; + plmt0@e600 { + compatible = "riscv,plmt0"; + interrupts-extended = <&CPU0_intc 7>; + reg = <0x0 0xe600 0x0 0x10>; + }; - plic0: interrupt-controller@e400 { -compatible = "riscv,plic0"; -#address-cells = <2>; -#interrupt-cells = <2>; -interrupt-controller; -reg = <0x0 0xe400 0x0 0x200>; -riscv,ndev=<31>; -interrupts-extended = <&CPU0_intc 11 &CPU0_intc 9>; + plic0: interrupt-controller@e400 { + compatible = "riscv,plic0"; + #address-cells = <2>; + #interrupt-cells = <2>; + interrupt-controller; + reg = <0x0 0xe400 0x0 0x200>; + riscv,ndev=<31>; + interrupts-extended = <&CPU0_intc 11 &CPU0_intc 9>; }; - plic1: interrupt-controller@e640 { -compatible = "riscv,plic1"; -#address-cells = <2>; -#interrupt-cells = <2>; + plic1: interrupt-controller@e640 { + compatible = "riscv,plic1"; + #address-cells = <2>; + #interrupt-cells = <2>; interrupt-controller; -reg = <0x0 0xe640 0x0 0x40>; -riscv,ndev=<1>; -interrupts-extended = <&CPU0_intc 3>; - }; + reg = <0x0 0xe640 0x0 0x40>; + riscv,ndev=<1>; + interrupts-extended = <&CPU0_intc 3>; + }; - spiclk: virt_100mhz { -#clock-cells = <0>; -compatible = "fixed-clock"; -clock-frequency = <1>; - }; + spiclk: virt_100mhz { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <1>; + }; - timer0: timer@f040 { -compatible = "andestech,atcpit100"; -reg = <0x0 0xf040 0x0 0x1000>; -clock-frequency = <4000>; -interrupts = <3 4>; -interrupt-parent = <&plic0>; + timer0: timer@f040 { + compatible = "andestech,atcpit100"; + reg = <0x0 0xf040 0x0 0x1000>; + clock-frequency = <4000>; +
[U-Boot] [PATCH 12/12] riscv: Add QEMU virt board support
This adds QEMU RISC-V 'virt' board target support, with the hope of helping people easily test U-Boot on RISC-V. The QEMU virt machine models a generic RISC-V virtual machine with support for the VirtIO standard networking and block storage devices. It has CLINT, PLIC, 16550A UART devices in addition to VirtIO and it also uses device-tree to pass configuration information to guest software. It implements RISC-V privileged architecture spec v1.10. Both 32-bit and 64-bit builds are supported. Support is pretty much preliminary, only booting to U-Boot shell with the UART driver on a single core. Booting Linux is not supported yet. Signed-off-by: Bin Meng --- arch/riscv/Kconfig | 4 +++ arch/riscv/cpu/qemu/Makefile| 6 + arch/riscv/cpu/qemu/cpu.c | 29 + arch/riscv/cpu/qemu/dram.c | 17 board/emulation/qemu-riscv/Kconfig | 21 +++ board/emulation/qemu-riscv/MAINTAINERS | 7 + board/emulation/qemu-riscv/Makefile | 5 board/emulation/qemu-riscv/qemu-riscv.c | 23 + configs/qemu-riscv32_defconfig | 10 +++ configs/qemu-riscv64_defconfig | 11 doc/README.qemu-riscv | 46 + include/configs/qemu-riscv.h| 21 +++ 12 files changed, 200 insertions(+) create mode 100644 arch/riscv/cpu/qemu/Makefile create mode 100644 arch/riscv/cpu/qemu/cpu.c create mode 100644 arch/riscv/cpu/qemu/dram.c create mode 100644 board/emulation/qemu-riscv/Kconfig create mode 100644 board/emulation/qemu-riscv/MAINTAINERS create mode 100644 board/emulation/qemu-riscv/Makefile create mode 100644 board/emulation/qemu-riscv/qemu-riscv.c create mode 100644 configs/qemu-riscv32_defconfig create mode 100644 configs/qemu-riscv64_defconfig create mode 100644 doc/README.qemu-riscv create mode 100644 include/configs/qemu-riscv.h diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 49f87de..168ca3d 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -11,9 +11,13 @@ choice config TARGET_AX25_AE350 bool "Support ax25-ae350" +config TARGET_QEMU_VIRT + bool "Support QEMU Virt Board" + endchoice source "board/AndesTech/ax25-ae350/Kconfig" +source "board/emulation/qemu-riscv/Kconfig" choice prompt "CPU selection" diff --git a/arch/riscv/cpu/qemu/Makefile b/arch/riscv/cpu/qemu/Makefile new file mode 100644 index 000..258e462 --- /dev/null +++ b/arch/riscv/cpu/qemu/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2018, Bin Meng + +obj-y += dram.o +obj-y += cpu.o diff --git a/arch/riscv/cpu/qemu/cpu.c b/arch/riscv/cpu/qemu/cpu.c new file mode 100644 index 000..a064639 --- /dev/null +++ b/arch/riscv/cpu/qemu/cpu.c @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018, Bin Meng + */ + +#include +#include + +/* + * cleanup_before_linux() is called just before we call linux + * it prepares the processor for linux + * + * we disable interrupt and caches. + */ +int cleanup_before_linux(void) +{ + disable_interrupts(); + + /* turn off I/D-cache */ + + return 0; +} + +int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + printf("reset unsupported yet\n"); + + return 0; +} diff --git a/arch/riscv/cpu/qemu/dram.c b/arch/riscv/cpu/qemu/dram.c new file mode 100644 index 000..84d87d2 --- /dev/null +++ b/arch/riscv/cpu/qemu/dram.c @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018, Bin Meng + */ + +#include +#include + +int dram_init(void) +{ + return fdtdec_setup_mem_size_base(); +} + +int dram_init_banksize(void) +{ + return fdtdec_setup_memory_banksize(); +} diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig new file mode 100644 index 000..029f5efb --- /dev/null +++ b/board/emulation/qemu-riscv/Kconfig @@ -0,0 +1,21 @@ +if TARGET_QEMU_VIRT + +config SYS_BOARD + default "qemu-riscv" + +config SYS_VENDOR + default "emulation" + +config SYS_CPU + default "qemu" + +config SYS_CONFIG_NAME + default "qemu-riscv" + +config SYS_TEXT_BASE + default 0x8000 + +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + +endif diff --git a/board/emulation/qemu-riscv/MAINTAINERS b/board/emulation/qemu-riscv/MAINTAINERS new file mode 100644 index 000..3c6eb4f --- /dev/null +++ b/board/emulation/qemu-riscv/MAINTAINERS @@ -0,0 +1,7 @@ +QEMU RISC-V 'VIRT' BOARD +M: Bin Meng +S: Maintained +F: board/emulation/qemu-riscv/ +F: include/configs/qemu-riscv.h +F: configs/qemu-riscv32_defconfig +F: configs/qemu-riscv64_defconfig diff --git a/board/emulation/qemu-riscv/Makefile b/board/emulation/qemu-riscv/Makefile new file mode 100644 index 000..3f29b90 --- /dev/null +++ b/board/emulation/qemu-riscv/Makefile @
[U-Boot] [PATCH 07/12] riscv: Explicitly pass -march and -mabi to the compiler
At present the compiler flag against which architecture and abi variant the riscv image is built for is not explicitly indicated which means the default compiler configuration is used. But this does not work if we want to build a different target (eg: 32-bit riscv images using a toolchain configured for 64-bit riscv). Fix this by explicitly passing -march and -mabi to the compiler. Since generically we don't use floating point in U-Boot, specify the RV[32|64]IMA ISA and software floating ABI. This also fix some alignment coding style issues. Signed-off-by: Bin Meng --- arch/riscv/config.mk | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk index 219e666..1484887 100644 --- a/arch/riscv/config.mk +++ b/arch/riscv/config.mk @@ -18,12 +18,16 @@ endif 64bit-emul := elf64lriscv ifdef CONFIG_32BIT +PLATFORM_CPPFLAGS += -march=rv32ima -mabi=ilp32 PLATFORM_LDFLAGS += -m $(32bit-emul) +CFLAGS_EFI += -march=rv32ima -mabi=ilp32 EFI_LDS:= elf_riscv32_efi.lds endif ifdef CONFIG_64BIT +PLATFORM_CPPFLAGS += -march=rv64ima -mabi=lp64 PLATFORM_LDFLAGS += -m $(64bit-emul) +CFLAGS_EFI += -march=rv64ima -mabi=lp64 EFI_LDS:= elf_riscv64_efi.lds endif @@ -31,8 +35,9 @@ CONFIG_STANDALONE_LOAD_ADDR = 0x \ -T $(srctree)/examples/standalone/riscv.lds PLATFORM_CPPFLAGS += -ffixed-gp -fpic -PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -gdwarf-2 -ffunction-sections -LDFLAGS_u-boot += --gc-sections -static -pie +PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -gdwarf-2 \ + -ffunction-sections +LDFLAGS_u-boot += --gc-sections -static -pie EFI_CRT0 := crt0_riscv_efi.o EFI_RELOC := reloc_riscv_efi.o -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 11/12] riscv: kconfig: Select DM and OF_CONTROL
RISC-V is a pretty new architecture and should support DM and OF_CONTROL by default. Signed-off-by: Bin Meng --- arch/Kconfig | 3 +++ configs/ax25-ae350_defconfig | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 42c23b5..01330a4 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -62,6 +62,9 @@ config PPC config RISCV bool "RISC-V architecture" select SUPPORT_OF_CONTROL + select OF_CONTROL + select DM + imply CMD_DM config SANDBOX bool "Sandbox" diff --git a/configs/ax25-ae350_defconfig b/configs/ax25-ae350_defconfig index a853c99..9a05eed 100644 --- a/configs/ax25-ae350_defconfig +++ b/configs/ax25-ae350_defconfig @@ -16,11 +16,9 @@ CONFIG_CMD_SF_TEST=y # CONFIG_CMD_SETEXPR is not set CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_CMD_CACHE=y -CONFIG_OF_CONTROL=y CONFIG_OF_BOARD=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_NET_RANDOM_ETHADDR=y -CONFIG_DM=y CONFIG_CLK=y CONFIG_MMC=y CONFIG_DM_MMC=y -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 2/8] rockchip: rk322x: sdram: use udelay instead of rockchip_udelay
> Use system api for udelay instead of vendor defined api, > and rockchip_udelay() will be removed. > > Signed-off-by: Kever Yang > --- > > drivers/ram/rockchip/sdram_rk322x.c | 29 ++--- > 1 file changed, 14 insertions(+), 15 deletions(-) > Reviewed-by: Philipp Tomsich ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 4/8] rockchip: rk3036: sdram: use udelay instead of rockchip_udelay
> Use system api for udelay instead of vendor defined api, > and rockchip_udelay() will be removed. > > Signed-off-by: Kever Yang > --- > > arch/arm/mach-rockchip/rk3036/sdram_rk3036.c | 19 +-- > 1 file changed, 9 insertions(+), 10 deletions(-) > Reviewed-by: Philipp Tomsich ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot,8/8] rockchip: remove unused rk_timer.c
> All other SoCs have conver to use ARM arch timer or Rockchip DM timer, > so we can remove rk_timer.c now. > > Signed-off-by: Kever Yang > --- > > arch/arm/mach-rockchip/rk_timer.c | 48 > --- > 1 file changed, 48 deletions(-) > delete mode 100644 arch/arm/mach-rockchip/rk_timer.c > Reviewed-by: Philipp Tomsich ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 7/8] rockchip: rk3128: use ARM arch timer instead of rk_timer
> We prefer to use ARM arch timer instead of rockchip timer, so that > we are using the same timer for SPL, U-Boot and Kernel, which will > make things simple and easy to track to boot time. > > Signed-off-by: Kever Yang > --- > > arch/arm/mach-rockchip/Makefile | 6 -- > arch/arm/mach-rockchip/rk3128-board.c | 2 -- > include/configs/rk3128_common.h | 6 +++--- > 3 files changed, 3 insertions(+), 11 deletions(-) > Reviewed-by: Philipp Tomsich ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 1/8] rockchip: add STIMER_BASE for Rockchip SoCs
On Wed, 18 Apr 2018, Kever Yang wrote: Most of Rockchip SoCs have ARM arch/generic timer whose clock source is from one of secure timer(if the soc supports Trust environment). STIMER can only access in secure mode, so it should be init before the proper U-Boot(usually in non-secure mode). Add a MACRO for timer base addr so that we can init with a common function in SPL/TPL. Signed-off-by: Kever Yang See below for required changes. --- arch/arm/mach-rockchip/Kconfig | 16 1 file changed, 16 insertions(+) diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig index 0adaed4..55d3d5c 100644 --- a/arch/arm/mach-rockchip/Kconfig +++ b/arch/arm/mach-rockchip/Kconfig @@ -191,6 +191,22 @@ config ROCKCHIP_BOOT_MODE_REG The Soc will enter to different boot mode(defined in asm/arch/boot_mode.h) according to the value from this register. +config ROCKCHIP_STIMER_BASE + hex "Rockchip Secure timer base address" + default 0x200440a0 if ROCKCHIP_RK3036 + default 0x20018020 if ROCKCHIP_RK3126 + default 0x200440a0 if ROCKCHIP_RK3128 + default 0x110d0020 if ROCKCHIP_RK322X + default 0xff810020 if ROCKCHIP_RK3288 + default 0xff1d0020 if ROCKCHIP_RK3328 + default 0xff830020 if ROCKCHIP_RK3368 + default 0xff8680a0 if ROCKCHIP_RK3399 + default 0x10350020 if ROCKCHIP_RV1108 + default 0 + help + The secure timer inited in SPL/TPL in secure word, ARM generic timer + works after this timer work. NAK. This is not a user-configurable/selectable option, but rather a function of the chip used. This belongs into a header file in arch/arm/include/asm/arch-rockchip. + config ROCKCHIP_SPL_RESERVE_IRAM hex "Size of IRAM reserved in SPL" default 0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 3/8] rockchip: rk322x: use ARM arch timer instead of rk_timer
On Wed, 18 Apr 2018, Kever Yang wrote: We prefer to use ARM arch timer instead of rockchip timer, so that we are using the same timer for SPL, U-Boot and Kernel, which will make things simple and easy to track to boot time. Signed-off-by: Kever Yang See below for requested changes. --- arch/arm/mach-rockchip/Makefile | 2 +- arch/arm/mach-rockchip/rk322x-board-spl.c | 19 --- include/configs/rk322x_common.h | 6 +++--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile index 096dbac..c1eeefb 100644 --- a/arch/arm/mach-rockchip/Makefile +++ b/arch/arm/mach-rockchip/Makefile @@ -40,7 +40,7 @@ endif obj-$(CONFIG_$(SPL_TPL_)RAM) += sdram_common.o ifndef CONFIG_ARM64 -ifndef CONFIG_ROCKCHIP_RK3188 +ifeq ($(CONFIG_ROCKCHIP_RK3188)$(CONFIG_ROCKCHIP_RK322X),) Please have a config-option for the rk_timer and force (i.e. SELECT) it for these chips. I am not keen on a list that grows like this... obj-y += rk_timer.o endif endif diff --git a/arch/arm/mach-rockchip/rk322x-board-spl.c b/arch/arm/mach-rockchip/rk322x-board-spl.c index d3d0446..b5b178f 100644 --- a/arch/arm/mach-rockchip/rk322x-board-spl.c +++ b/arch/arm/mach-rockchip/rk322x-board-spl.c @@ -14,7 +14,6 @@ #include #include #include -#include #include u32 spl_boot_device(void) @@ -62,6 +61,17 @@ void board_debug_uart_init(void) CON_IOMUX_UART2SEL_21 << CON_IOMUX_UART2SEL_SHIFT); } +void rockchip_stimer_init(void) +{ + asm volatile("mcr p15, 0, %0, c14, c0, 0" +: : "r"(COUNTER_FREQUENCY)); + + writel(0, CONFIG_ROCKCHIP_STIMER_BASE + 0x10); + writel(0x, CONFIG_ROCKCHIP_STIMER_BASE); + writel(0x, CONFIG_ROCKCHIP_STIMER_BASE + 4); + writel(1, CONFIG_ROCKCHIP_STIMER_BASE + 0x10); +} NAK. See comment on patch #1. + #define SGRF_DDR_CON0 0x1015 Can we have this as a const uint32_t * ? void board_init_f(ulong dummy) { @@ -85,8 +95,11 @@ void board_init_f(ulong dummy) hang(); } - rockchip_timer_init(); - printf("timer init done\n"); + /* Init secure timer */ + rockchip_stimer_init(); + /* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */ + timer_init(); + ret = uclass_get_device(UCLASS_RAM, 0, &dev); if (ret) { printf("DRAM init failed: %d\n", ret); diff --git a/include/configs/rk322x_common.h b/include/configs/rk322x_common.h index b437b85..8f8a1ef 100644 --- a/include/configs/rk322x_common.h +++ b/include/configs/rk322x_common.h @@ -14,9 +14,9 @@ #define CONFIG_SYS_CBSIZE 1024 #define CONFIG_SYS_BOOTM_LEN(64 << 20)/* 64M */ -#define CONFIG_SYS_TIMER_RATE (24 * 1000 * 1000) -#define CONFIG_SYS_TIMER_BASE 0x110c00a0 /* TIMER5 */ -#define CONFIG_SYS_TIMER_COUNTER (CONFIG_SYS_TIMER_BASE + 8) +#define COUNTER_FREQUENCY 2400 +#define CONFIG_SYS_ARCH_TIMER +#define CONFIG_SYS_HZ_CLOCK2400 #define CONFIG_SYS_NS16550_MEM32 #define CONFIG_SYS_INIT_SP_ADDR 0x6010 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [RFC 1/3] test/py: convert fs-test.sh to pytest
On 08/30/2018 08:52 AM, AKASHI Takahiro wrote: > On Wed, Aug 29, 2018 at 11:36:51PM +0200, Heinrich Schuchardt wrote: >> On 08/23/2018 09:25 AM, AKASHI Takahiro wrote: >>> In this commit, the same set of test cases as in test/fs/fs-test.sh >>> is provided using pytest framework. >>> Actually, fs-test.sh provides three variants:"sb" (sb command), "nonfs" >>> (fatxx and etc.) and "fs" (hostfs), and this patch currently supports >>> only "nonfs" variant; So it is not a replacement of fs-test.sh for now. >>> >>> Simple usage: >>> $ py.test test/py/tests/test_fs [] >>> >>> You may also specify filesystem types to be tested: >>> $ py.test test/py/tests/test_fs --fs-type fat32 [] >>> >>> Signed-off-by: AKASHI Takahiro >>> --- >>> test/py/tests/test_fs/conftest.py| 175 +++ >>> test/py/tests/test_fs/fstest_defs.py | 10 ++ >>> test/py/tests/test_fs/test_basic.py | 246 +++ >>> 3 files changed, 431 insertions(+) >>> create mode 100644 test/py/tests/test_fs/conftest.py >>> create mode 100644 test/py/tests/test_fs/fstest_defs.py >>> create mode 100644 test/py/tests/test_fs/test_basic.py >>> >>> diff --git a/test/py/tests/test_fs/conftest.py >>> b/test/py/tests/test_fs/conftest.py >>> new file mode 100644 >>> index ..fefeb4c9663f >>> --- /dev/null >>> +++ b/test/py/tests/test_fs/conftest.py >>> @@ -0,0 +1,175 @@ >>> +# SPDX-License-Identifier: GPL-2.0+ >>> +# Copyright (c) 2018, Linaro Limited >>> +# Author: Takahiro Akashi >>> + >>> +import pytest >>> +import re >>> +from subprocess import call, check_call, check_output, CalledProcessError >>> +from fstest_defs import * >>> + >>> +supported_fs_basic = ['fat16', 'fat32', 'ext4'] >>> + >>> +# >>> +# Filesystem test specific setup >>> +# >>> +def pytest_addoption(parser): >>> +parser.addoption('--fs-type', action='append', default=None, >>> +help='Targeting Filesystem Types') >>> + >>> +def pytest_configure(config): >>> +global supported_fs_basic >>> + >>> +def intersect(listA, listB): >>> +return [x for x in listA if x in listB] >>> + >>> +supported_fs = config.getoption('fs_type') >>> +if supported_fs: >>> +print("*** FS TYPE modified: %s" % supported_fs) >>> +supported_fs_basic = intersect(supported_fs, supported_fs_basic) >>> + >>> +def pytest_generate_tests(metafunc): >>> +if 'fs_obj_basic' in metafunc.fixturenames: >>> +metafunc.parametrize('fs_obj_basic', supported_fs_basic, >>> +indirect=True, scope='module') >>> + >>> +# >>> +# Helper functions >>> +# >>> +def fstype_to_ubname(fs_type): >>> +if re.match('fat', fs_type): >>> +return 'fat' >>> +else: >>> +return fs_type >>> + >>> +def check_ubconfig(config, fs_type): >>> +if not config.buildconfig.get('config_cmd_%s' % fs_type, None): >>> +pytest.skip('.config feature "CMD_%s" not enabled' % >>> fs_type.upper()) >>> +if not config.buildconfig.get('config_%s_write' % fs_type, None): >>> +pytest.skip('.config feature "%s_WRITE" not enabled' >>> +% fs_type.upper()) >>> + >>> +def mk_fs(config, fs_type, size, id): >>> +fs_img = '%s.%s.img' % (id, fs_type) >>> +fs_img = config.persistent_data_dir + '/' + fs_img >>> + >>> +if fs_type == 'fat16': >>> +mkfs_opt = '-F 16' >>> +elif fs_type == 'fat32': >>> +mkfs_opt = '-F 32' >>> +else: >>> +mkfs_opt = '' >>> + >>> +if re.match('fat', fs_type): >>> +fs_lnxtype = 'vfat' >>> +else: >>> +fs_lnxtype = fs_type >>> + >>> +count = (size + 1023) / 1024 >>> + >>> +try: >>> +check_call('rm -f %s' % fs_img, shell=True) >>> +check_call('dd if=/dev/zero of=%s bs=1K count=%d' >>> +% (fs_img, count), shell=True) >>> +check_call('mkfs.%s %s %s' >>> +% (fs_lnxtype, mkfs_opt, fs_img), shell=True) >>> +return fs_img >>> +except CalledProcessError: >>> +call('rm -f %s' % fs_img, shell=True) >>> +raise >>> + >>> +# >>> +# Fixture for basic fs test >>> +# derived from test/fs/fs-test.sh >>> +# >>> +# NOTE: yield_fixture was deprecated since pytest-3.0 >>> +@pytest.yield_fixture() >>> +def fs_obj_basic(request, u_boot_config): >>> +fs_type = request.param >>> +fs_img = '' >>> + >>> +fs_ubtype = fstype_to_ubname(fs_type) >>> +check_ubconfig(u_boot_config, fs_ubtype) >>> + >>> +mount_dir = u_boot_config.persistent_data_dir + '/mnt' >>> +small_file = mount_dir + '/' + SMALL_FILE >>> +big_file = mount_dir + '/' + BIG_FILE >>> +try: >>> + >>> +# 3GiB volume >>> +fs_img = mk_fs(u_boot_config, fs_type, 0xc000, '3GB') >>> + >>> +# Mount the image so we can populate it. >>> +check_call('mkdir -p %s' % mount_dir, shell=True) >>> +check_call('sudo mount -o loop,rw %s %s' >>> +% (fs_img, mount_dir), shell=True) >> >> Should I grant sudo to anybody who can commit
Re: [U-Boot] [RFC 1/3] test/py: convert fs-test.sh to pytest
On Thu, Aug 30, 2018 at 12:01:32PM +0200, Heinrich Schuchardt wrote: > On 08/30/2018 08:52 AM, AKASHI Takahiro wrote: > > On Wed, Aug 29, 2018 at 11:36:51PM +0200, Heinrich Schuchardt wrote: > >> On 08/23/2018 09:25 AM, AKASHI Takahiro wrote: > >>> In this commit, the same set of test cases as in test/fs/fs-test.sh > >>> is provided using pytest framework. > >>> Actually, fs-test.sh provides three variants:"sb" (sb command), "nonfs" > >>> (fatxx and etc.) and "fs" (hostfs), and this patch currently supports > >>> only "nonfs" variant; So it is not a replacement of fs-test.sh for now. > >>> > >>> Simple usage: > >>> $ py.test test/py/tests/test_fs [] > >>> > >>> You may also specify filesystem types to be tested: > >>> $ py.test test/py/tests/test_fs --fs-type fat32 [] > >>> > >>> Signed-off-by: AKASHI Takahiro > >>> --- > >>> test/py/tests/test_fs/conftest.py| 175 +++ > >>> test/py/tests/test_fs/fstest_defs.py | 10 ++ > >>> test/py/tests/test_fs/test_basic.py | 246 +++ > >>> 3 files changed, 431 insertions(+) > >>> create mode 100644 test/py/tests/test_fs/conftest.py > >>> create mode 100644 test/py/tests/test_fs/fstest_defs.py > >>> create mode 100644 test/py/tests/test_fs/test_basic.py > >>> > >>> diff --git a/test/py/tests/test_fs/conftest.py > >>> b/test/py/tests/test_fs/conftest.py > >>> new file mode 100644 > >>> index ..fefeb4c9663f > >>> --- /dev/null > >>> +++ b/test/py/tests/test_fs/conftest.py > >>> @@ -0,0 +1,175 @@ > >>> +# SPDX-License-Identifier: GPL-2.0+ > >>> +# Copyright (c) 2018, Linaro Limited > >>> +# Author: Takahiro Akashi > >>> + > >>> +import pytest > >>> +import re > >>> +from subprocess import call, check_call, check_output, CalledProcessError > >>> +from fstest_defs import * > >>> + > >>> +supported_fs_basic = ['fat16', 'fat32', 'ext4'] > >>> + > >>> +# > >>> +# Filesystem test specific setup > >>> +# > >>> +def pytest_addoption(parser): > >>> +parser.addoption('--fs-type', action='append', default=None, > >>> +help='Targeting Filesystem Types') > >>> + > >>> +def pytest_configure(config): > >>> +global supported_fs_basic > >>> + > >>> +def intersect(listA, listB): > >>> +return [x for x in listA if x in listB] > >>> + > >>> +supported_fs = config.getoption('fs_type') > >>> +if supported_fs: > >>> +print("*** FS TYPE modified: %s" % supported_fs) > >>> +supported_fs_basic = intersect(supported_fs, supported_fs_basic) > >>> + > >>> +def pytest_generate_tests(metafunc): > >>> +if 'fs_obj_basic' in metafunc.fixturenames: > >>> +metafunc.parametrize('fs_obj_basic', supported_fs_basic, > >>> +indirect=True, scope='module') > >>> + > >>> +# > >>> +# Helper functions > >>> +# > >>> +def fstype_to_ubname(fs_type): > >>> +if re.match('fat', fs_type): > >>> +return 'fat' > >>> +else: > >>> +return fs_type > >>> + > >>> +def check_ubconfig(config, fs_type): > >>> +if not config.buildconfig.get('config_cmd_%s' % fs_type, None): > >>> +pytest.skip('.config feature "CMD_%s" not enabled' % > >>> fs_type.upper()) > >>> +if not config.buildconfig.get('config_%s_write' % fs_type, None): > >>> +pytest.skip('.config feature "%s_WRITE" not enabled' > >>> +% fs_type.upper()) > >>> + > >>> +def mk_fs(config, fs_type, size, id): > >>> +fs_img = '%s.%s.img' % (id, fs_type) > >>> +fs_img = config.persistent_data_dir + '/' + fs_img > >>> + > >>> +if fs_type == 'fat16': > >>> +mkfs_opt = '-F 16' > >>> +elif fs_type == 'fat32': > >>> +mkfs_opt = '-F 32' > >>> +else: > >>> +mkfs_opt = '' > >>> + > >>> +if re.match('fat', fs_type): > >>> +fs_lnxtype = 'vfat' > >>> +else: > >>> +fs_lnxtype = fs_type > >>> + > >>> +count = (size + 1023) / 1024 > >>> + > >>> +try: > >>> +check_call('rm -f %s' % fs_img, shell=True) > >>> +check_call('dd if=/dev/zero of=%s bs=1K count=%d' > >>> +% (fs_img, count), shell=True) > >>> +check_call('mkfs.%s %s %s' > >>> +% (fs_lnxtype, mkfs_opt, fs_img), shell=True) > >>> +return fs_img > >>> +except CalledProcessError: > >>> +call('rm -f %s' % fs_img, shell=True) > >>> +raise > >>> + > >>> +# > >>> +# Fixture for basic fs test > >>> +# derived from test/fs/fs-test.sh > >>> +# > >>> +# NOTE: yield_fixture was deprecated since pytest-3.0 > >>> +@pytest.yield_fixture() > >>> +def fs_obj_basic(request, u_boot_config): > >>> +fs_type = request.param > >>> +fs_img = '' > >>> + > >>> +fs_ubtype = fstype_to_ubname(fs_type) > >>> +check_ubconfig(u_boot_config, fs_ubtype) > >>> + > >>> +mount_dir = u_boot_config.persistent_data_dir + '/mnt' > >>> +small_file = mount_dir + '/' + SMALL_FILE > >>> +big_file = mount_dir + '/' + BIG_FILE > >>> +try: > >>> + > >>> +# 3GiB volume > >>> +fs_img
Re: [U-Boot] [RFC 1/3] test/py: convert fs-test.sh to pytest
Hi Heinrich, Takahiro On 08/30/2018 01:26 PM, AKASHI Takahiro wrote: On Thu, Aug 30, 2018 at 12:01:32PM +0200, Heinrich Schuchardt wrote: On 08/30/2018 08:52 AM, AKASHI Takahiro wrote: On Wed, Aug 29, 2018 at 11:36:51PM +0200, Heinrich Schuchardt wrote: On 08/23/2018 09:25 AM, AKASHI Takahiro wrote: In this commit, the same set of test cases as in test/fs/fs-test.sh is provided using pytest framework. Actually, fs-test.sh provides three variants:"sb" (sb command), "nonfs" (fatxx and etc.) and "fs" (hostfs), and this patch currently supports only "nonfs" variant; So it is not a replacement of fs-test.sh for now. Simple usage: $ py.test test/py/tests/test_fs [] You may also specify filesystem types to be tested: $ py.test test/py/tests/test_fs --fs-type fat32 [] Signed-off-by: AKASHI Takahiro --- test/py/tests/test_fs/conftest.py| 175 +++ test/py/tests/test_fs/fstest_defs.py | 10 ++ test/py/tests/test_fs/test_basic.py | 246 +++ 3 files changed, 431 insertions(+) create mode 100644 test/py/tests/test_fs/conftest.py create mode 100644 test/py/tests/test_fs/fstest_defs.py create mode 100644 test/py/tests/test_fs/test_basic.py diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py new file mode 100644 index ..fefeb4c9663f --- /dev/null +++ b/test/py/tests/test_fs/conftest.py @@ -0,0 +1,175 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2018, Linaro Limited +# Author: Takahiro Akashi + +import pytest +import re +from subprocess import call, check_call, check_output, CalledProcessError +from fstest_defs import * + +supported_fs_basic = ['fat16', 'fat32', 'ext4'] + +# +# Filesystem test specific setup +# +def pytest_addoption(parser): +parser.addoption('--fs-type', action='append', default=None, +help='Targeting Filesystem Types') + +def pytest_configure(config): +global supported_fs_basic + +def intersect(listA, listB): +return [x for x in listA if x in listB] + +supported_fs = config.getoption('fs_type') +if supported_fs: +print("*** FS TYPE modified: %s" % supported_fs) +supported_fs_basic = intersect(supported_fs, supported_fs_basic) + +def pytest_generate_tests(metafunc): +if 'fs_obj_basic' in metafunc.fixturenames: +metafunc.parametrize('fs_obj_basic', supported_fs_basic, +indirect=True, scope='module') + +# +# Helper functions +# +def fstype_to_ubname(fs_type): +if re.match('fat', fs_type): +return 'fat' +else: +return fs_type + +def check_ubconfig(config, fs_type): +if not config.buildconfig.get('config_cmd_%s' % fs_type, None): +pytest.skip('.config feature "CMD_%s" not enabled' % fs_type.upper()) +if not config.buildconfig.get('config_%s_write' % fs_type, None): +pytest.skip('.config feature "%s_WRITE" not enabled' +% fs_type.upper()) + +def mk_fs(config, fs_type, size, id): +fs_img = '%s.%s.img' % (id, fs_type) +fs_img = config.persistent_data_dir + '/' + fs_img + +if fs_type == 'fat16': +mkfs_opt = '-F 16' +elif fs_type == 'fat32': +mkfs_opt = '-F 32' +else: +mkfs_opt = '' + +if re.match('fat', fs_type): +fs_lnxtype = 'vfat' +else: +fs_lnxtype = fs_type + +count = (size + 1023) / 1024 + +try: +check_call('rm -f %s' % fs_img, shell=True) +check_call('dd if=/dev/zero of=%s bs=1K count=%d' +% (fs_img, count), shell=True) +check_call('mkfs.%s %s %s' +% (fs_lnxtype, mkfs_opt, fs_img), shell=True) +return fs_img +except CalledProcessError: +call('rm -f %s' % fs_img, shell=True) +raise + +# +# Fixture for basic fs test +# derived from test/fs/fs-test.sh +# +# NOTE: yield_fixture was deprecated since pytest-3.0 +@pytest.yield_fixture() +def fs_obj_basic(request, u_boot_config): +fs_type = request.param +fs_img = '' + +fs_ubtype = fstype_to_ubname(fs_type) +check_ubconfig(u_boot_config, fs_ubtype) + +mount_dir = u_boot_config.persistent_data_dir + '/mnt' +small_file = mount_dir + '/' + SMALL_FILE +big_file = mount_dir + '/' + BIG_FILE +try: + +# 3GiB volume +fs_img = mk_fs(u_boot_config, fs_type, 0xc000, '3GB') + +# Mount the image so we can populate it. +check_call('mkdir -p %s' % mount_dir, shell=True) +check_call('sudo mount -o loop,rw %s %s' +% (fs_img, mount_dir), shell=True) Should I grant sudo to anybody who can commit to U-Boot? I don't get your point. I think using "sudo" solely in testing should be allowed. Just use exfat-fuse and fuse2fs. It will not be a good idea to use those tools which are not provided in every distribution. I'd like to leave "sudo mount" statement as a backstop. Fuse is a base functionality of Linux. On Travis we are using the Ubuntu distribution which contains said
Re: [U-Boot] [PATCH] pci: Support parsing PCI controller DT subnodes
On 08/30/2018 02:29 AM, Simon Glass wrote: > Hi Marek, Hi, [...] >>> If you have both EHCI and a xHCI controller which can occupy the same >>> BFD, then how would you supply in the DT options needed by the >>> controller itself? Don't you need two nodes in that case? >> >> For the PHY case, it's controller-type-independent. > > What do you mean? Your example of why you can't use compatible strings > says you might have two different PHYs. But I think you should answer > my questions: > >>> If you have both EHCI and a xHCI controller which can occupy the same >>> BFD, then how would you supply in the DT options needed by the >>> controller itself? Don't you need two nodes in that case? You need only one node (if the PHY works with both controller options), which contains "reg" and "phy" properties. The driver matching is done on the PCI ID/class and the node is associated with the driver based on the "reg" property. > [...] > >>> In any case, re Bin's list of things that need doing, I worry about >>> having different code for sandbox than other archs. It invalidates our >>> sandbox testing. Granted, we have to support the PCI emulators, but >>> that's OK since that code is not used except in sandbox. We still want >>> to support compatible strings in the DT for PCI devices, right? >> >> We do, since there seems to be usecase for those too. > > OK, well let's make sure we have some compatible notes too in sandbox, > so we retain testing. I'm not changing anything in sandbox, so the original case is covered as is. -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v4] gpio: dwapb_gpio: Add reset ctrl to driver
On 08/30/2018 02:45 AM, Ley Foon Tan wrote: > On Wed, Aug 29, 2018 at 7:57 PM Marek Vasut wrote: >> >> On 08/29/2018 10:44 AM, Ley Foon Tan wrote: >>> Add code to reset all reset signals as in gpio DT node. A reset property >>> is an optional feature, so only print out a warning and do not fail if a >>> reset property is not present. >>> >>> If a reset property is discovered, then use it to deassert, thus >>> bringing the IP out of reset. >>> >>> Signed-off-by: Ley Foon Tan >> >> This is much better. >> >>> +static int gpio_dwapb_reset(struct udevice *dev) >>> +{ >>> + int ret; >>> + struct gpio_dwapb_priv *priv = dev_get_priv(dev); >>> + >>> + ret = reset_get_bulk(dev, &priv->resets); >>> + if (ret) { >>> + dev_warn(dev, "Can't get reset: %d\n", ret); >> >> Won't this barf on machines which either don't have DM_RESET enabled or >> don't have it described in DT ? > By default, dev_warn() is not show up. Or we can move this dev_warn > when "return ret" error below. I think that'd be better. If there is no reset support, no point in warning. Or what do you think ? btw you could then also flatten the indent with some ret = reset if (ret == -ENOENT || ) return 0; dev_warn(); return ret; >>> + /* Return 0 if error due to !CONFIG_DM_RESET and reset >>> + * DT property is not present. >>> + */ >>> + if (ret == -ENOENT || ret == -ENOTSUPP) >>> + return 0; >>> + else >>> + return ret; >>> + } >> [...] >> >> -- >> Best regards, >> Marek Vasut -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH V2 2/2] pci: Update documentation to make 'compatible' string optional
On 08/30/2018 02:29 AM, Simon Glass wrote: > Hi Marek, Hi, > On 24 August 2018 at 12:27, Marek Vasut wrote: >> Reword the documentation to make it clear the compatible string is now >> optional, yet still matching on it takes precedence over PCI IDs and >> PCI classes. >> >> Signed-off-by: Marek Vasut >> Cc: Simon Glass >> Cc: Tom Rini >> --- >> V2: New patch >> --- >> doc/driver-model/pci-info.txt | 14 +- >> 1 file changed, 9 insertions(+), 5 deletions(-) >> >> diff --git a/doc/driver-model/pci-info.txt b/doc/driver-model/pci-info.txt >> index e1701d1fbc..14364c5c75 100644 >> --- a/doc/driver-model/pci-info.txt >> +++ b/doc/driver-model/pci-info.txt >> @@ -34,11 +34,15 @@ under that bus. >> Note that this is all done on a lazy basis, as needed, so until something is >> touched on PCI (eg: a call to pci_find_devices()) it will not be probed. >> >> -PCI devices can appear in the flattened device tree. If they do this serves >> to >> -specify the driver to use for the device. In this case they will be bound at >> -first. Each PCI device node must have a compatible string list as well as a >> - property, as defined by the IEEE Std 1275-1994 PCI bus binding >> document >> -v2.1. Note we must describe PCI devices with the same bus hierarchy as the >> +PCI devices can appear in the flattened device tree. If they do, their node >> +often contains extra information which cannot be derived from the PCI IDs or >> +PCI class of the device. Each PCI device node must have a property, as >> +defined by the IEEE Std 1275-1994 PCI bus binding document v2.1. Compatible >> +string list is optional and generally not needed, since PCI is discoverable >> +bus, albeit there are justified exceptions. If the compatible string is >> +present, matching on it takes precedence over PCI IDs and PCI classes. >> + >> +Note we must describe PCI devices with the same bus hierarchy as the >> hardware, otherwise driver model cannot detect the correct parent/children >> relationship during PCI bus enumeration thus PCI devices won't be bound to >> their drivers accordingly. A working example like below: >> -- >> 2.16.2 >> > > Are we really saying that compatible strings are 'generally not needed'? Yes, PCI is a discoverable bus. > device tree pci supplement 2.1 talks about some new formats for the > compatible string, but doesn't say it is not needed. I much prefer a > compatible string since it is easy to find the driver in the source > code. But it duplicates (badly) what the PCI IDs and classes are used for since PCI's inception. > Can way say that a compatible string is preferred, but in extremis you > can avoid it by... No, see above, PCI is discoverable by design. -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v6 00/31] SPI-NAND support
Hello, Miquel Raynal wrote on Fri, 17 Aug 2018 10:38:46 +0200: > Hi Tom, Jagan, > > Boris Brezillon wrote on Thu, 16 Aug 2018 > 18:58:58 +0200: > > > Tom, Jagan, > > > > On Thu, 16 Aug 2018 17:29:58 +0200 > > Miquel Raynal wrote: > > > > > During the last months, Boris Brezillon shared his work to support > > > serial flashes within Linux. First, he delivered (and merged) a new > > > layer called spi-mem. He also initiated in Linux MTD subsystem the move > > > of all 'raw' NAND related code to a raw/ subdirectory, adding at the > > > same time a NAND core that would be shared with all NAND devices. Then, > > > he contributed a generic SPI-NAND driver, making use of this NAND core, > > > as well as some vendor code to drive a few chips. > > > > > > On top of this work, I made some cleanups in the MTD layer and added an > > > 'mtd' U-Boot command to handle all sort of MTD devices. This should > > > become the default command instead of having one per flash flavor > > > ('sf', 'nand', 'spi-nand' ?). > > > > > > The series has been tested on an Ocelot board PCB123 (VSC7514), > > > featuring a Macronix SPI NAND chip. > > > > > > TL;DR: the series contains: > > > - A few patches from Linux to resynchronize some areas of the MTD layer. > > > - Various fixes and re-organization of the MTD subsystem. > > > - The introduction of the SPI-mem interface. > > > - The addition of the generic SPI-NAND driver (and its bindings). > > > - Several SPI NAND chip drivers (Macronix, Micron, Winbond). > > > - A new 'mtd' command. > > > - Support for spi-nand devices in mtdparts. > > > > > > To test your SPI-NAND device with U-Boot simply follow these lines: > > > > > > > setenv mtdparts mtdparts=spi-nand0:1m(foo),-(bar) > > > > ubi part bar # create a static UBI volume in the bar partition > > > > mtd list # show the current MTD devices/partitions > > > > > > Thanks, > > > Miquèl > > > > > > > [...] > > > > Can we get some of those patches merged to avoid sending another > > version containing more than 30 patches. Here is a list of patches which > > IMO are ready to be merged: > > > > - 1 to 4 > > - 5 and 6 if 6 is squashed in 5 > > - 7 to 23 > > > > Yes, I agree with Boris, I do not want to resend another 30+ patch > series while the changes are on the last 5 only, could one of you > please apply them from 1 to 23 (with 6 squashed in 5) ? > > Next week I will send a v7 for patches 24..31. I am almost ready to send a new iteration for the last set of patches, can I have your feedback on the first set (up to 23)? Thanks, Miquèl ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] travis: Use kernel.org pre-built toolchain for riscv
This updates travis configuration to use kernel.org pre-built toolchain for riscv. Signed-off-by: Bin Meng --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4db629d..95cfa5b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -87,9 +87,8 @@ before_script: fi - if [[ "${TOOLCHAIN}" == "powerpc" ]]; then ./tools/buildman/buildman --fetch-arch powerpc; fi - if [[ "${TOOLCHAIN}" == "riscv" ]]; then -wget https://github.com/andestech/prebuilt/releases/download/20180530/riscv64-unknown-linux-gnu.tar.gz && -tar -C /tmp -xf riscv64-unknown-linux-gnu.tar.gz && -echo -e "\n[toolchain-prefix]\nriscv = /tmp/riscv64-unknown-linux-gnu/bin/riscv64-unknown-linux-gnu-" >> ~/.buildman; + ./tools/buildman/buildman --fetch-arch riscv64; + echo -e "\n[toolchain-alias]\nriscv = riscv64" >> ~/.buildman; fi - if [[ "${QEMU_TARGET}" != "" ]]; then git clone git://git.qemu.org/qemu.git /tmp/qemu; -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 05/15] Add UCLASS_TEE for Trusted Execution Environment
On Wed, Aug 29, 2018 at 06:28:48PM -0600, Simon Glass wrote: > Hi Jens, > > On 23 August 2018 at 04:43, Jens Wiklander wrote: > > Adds a uclass to interface with a TEE (Trusted Execution Environment). > > > > A TEE driver is a driver that interfaces with a trusted OS running in > > some secure environment, for example, TrustZone on ARM cpus, or a > > separate secure co-processor etc. > > > > The TEE subsystem can serve a TEE driver for a Global Platform compliant > > TEE, but it's not limited to only Global Platform TEEs. > > > > The over all design is based on the TEE subsystem in the Linux kernel, > > tailored for U-boot. > > U-Boot > > > > > Tested-by: Igor Opaniuk > > Signed-off-by: Jens Wiklander > > --- > > MAINTAINERS | 6 + > > drivers/Kconfig | 2 + > > drivers/Makefile | 1 + > > drivers/tee/Kconfig | 8 ++ > > drivers/tee/Makefile | 3 + > > drivers/tee/tee-uclass.c | 192 ++ > > include/dm/uclass-id.h | 1 + > > include/tee.h| 290 +++ > > 8 files changed, 503 insertions(+) > > create mode 100644 drivers/tee/Kconfig > > create mode 100644 drivers/tee/Makefile > > create mode 100644 drivers/tee/tee-uclass.c > > create mode 100644 include/tee.h > > Reviewed-by: Simon Glass > > Various nits below. > > > > > diff --git a/MAINTAINERS b/MAINTAINERS > > index 58b61ac05882..7458c606ee92 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -571,6 +571,12 @@ TQ GROUP > > S: Orphaned (Since 2016-02) > > T: git git://git.denx.de/u-boot-tq-group.git > > > > +TEE > > +M: Jens Wiklander > > +S: Maintained > > +F: drivers/tee/ > > +F: include/tee.h > > + > > UBI > > M: Kyungmin Park > > M: Heiko Schocher > > diff --git a/drivers/Kconfig b/drivers/Kconfig > > index c72abf893297..f3249ab1d143 100644 > > --- a/drivers/Kconfig > > +++ b/drivers/Kconfig > > @@ -94,6 +94,8 @@ source "drivers/spmi/Kconfig" > > > > source "drivers/sysreset/Kconfig" > > > > +source "drivers/tee/Kconfig" > > + > > source "drivers/thermal/Kconfig" > > > > source "drivers/timer/Kconfig" > > diff --git a/drivers/Makefile b/drivers/Makefile > > index d53208540ea6..0fcae36f50f7 100644 > > --- a/drivers/Makefile > > +++ b/drivers/Makefile > > @@ -103,6 +103,7 @@ obj-y += smem/ > > obj-y += soc/ > > obj-$(CONFIG_REMOTEPROC) += remoteproc/ > > obj-y += thermal/ > > +obj-$(CONFIG_TEE) += tee/ > > > > obj-$(CONFIG_MACH_PIC32) += ddr/microchip/ > > endif > > diff --git a/drivers/tee/Kconfig b/drivers/tee/Kconfig > > new file mode 100644 > > index ..817ab331b0f8 > > --- /dev/null > > +++ b/drivers/tee/Kconfig > > @@ -0,0 +1,8 @@ > > +# Generic Trusted Execution Environment Configuration > > +config TEE > > + bool "Trusted Execution Environment support" > > + depends on ARM && (ARM64 || CPU_V7A) > > + select ARM_SMCCC > > + help > > + This implements a generic interface towards a Trusted Execution > > + Environment (TEE). > > Please expand this. What is it? Why would I use it? Also perhaps add a > web link? I'll expand it. I'll skip the why part though. > > > diff --git a/drivers/tee/Makefile b/drivers/tee/Makefile > > new file mode 100644 > > index ..b6d8e16e6211 > > --- /dev/null > > +++ b/drivers/tee/Makefile > > @@ -0,0 +1,3 @@ > > +# SPDX-License-Identifier: GPL-2.0+ > > + > > +obj-y += tee-uclass.o > > diff --git a/drivers/tee/tee-uclass.c b/drivers/tee/tee-uclass.c > > new file mode 100644 > > index ..0209983491a0 > > --- /dev/null > > +++ b/drivers/tee/tee-uclass.c > > @@ -0,0 +1,192 @@ > > +// SPDX-License-Identifier: GPL-2.0+ > > +/* > > + * Copyright (c) 2018 Linaro Limited > > + */ > > + > > +#include > > +#include > > +#include > > + > > +/** > > + * struct tee_uclass_priv - information of a TEE, stored by the uclass > > + * > > + * @list_shm: list of structe tee_shm representing memory blocks shared > > + * with the TEE. > > + */ > > +struct tee_uclass_priv { > > + struct list_head list_shm; > > +}; > > + > > +static const struct tee_driver_ops *tee_get_ops(struct udevice *dev) > > +{ > > + return device_get_ops(dev); > > +} > > + > > +void tee_get_version(struct udevice *dev, struct tee_version_data *vers) > > +{ > > + tee_get_ops(dev)->get_version(dev, vers); > > +} > > + > > +int tee_open_session(struct udevice *dev, struct tee_open_session_arg *arg, > > +ulong num_param, struct tee_param *param) > > +{ > > + return tee_get_ops(dev)->open_session(dev, arg, num_param, param); > > +} > > + > > +int tee_close_session(struct udevice *dev, u32 session) > > +{ > > + return tee_get_ops(dev)->close_session(dev, session); > > +} > > + > > +int tee_invoke_func(struct udevice *dev, struct tee_invoke_arg *arg, > > + ulong num_param, struct tee_param *param) > > +{ > > + return tee_get_ops
[U-Boot] [PATCH] mmc: renesas-sdhi: Use priv directly
The dev_get_priv(dev) is used twice in the probe function. Replace the second invocation with priv variable. Signed-off-by: Marek Vasut Cc: Masahiro Yamada Cc: Nobuhiro Iwamatsu --- drivers/mmc/renesas-sdhi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/renesas-sdhi.c b/drivers/mmc/renesas-sdhi.c index ecdb088ac4..f8dc5f57ce 100644 --- a/drivers/mmc/renesas-sdhi.c +++ b/drivers/mmc/renesas-sdhi.c @@ -374,7 +374,7 @@ static int renesas_sdhi_probe(struct udevice *dev) ret = tmio_sd_probe(dev, quirks); #if CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) if (!ret) - renesas_sdhi_reset_tuning(dev_get_priv(dev)); + renesas_sdhi_reset_tuning(priv); #endif return ret; } -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH V2 1/2] pci: Support parsing PCI controller DT subnodes
Hi Marek, On Thu, Aug 30, 2018 at 1:07 AM Marek Vasut wrote: > > On 08/29/2018 05:15 PM, Bin Meng wrote: > > +Simon > > > > Hi Marek, > > > > On Wed, Aug 29, 2018 at 10:22 PM Marek Vasut wrote: > >> > >> On 08/24/2018 08:27 PM, Marek Vasut wrote: > >>> The PCI controller can have DT subnodes describing extra properties > >>> of particular PCI devices, ie. a PHY attached to an EHCI controller > >>> on a PCI bus. This patch parses those DT subnodes and assigns a node > >>> to the PCI device instance, so that the driver can extract details > >>> from that node and ie. configure the PHY using the PHY subsystem. > >>> > >>> Signed-off-by: Marek Vasut > >>> Cc: Simon Glass > >>> Cc: Tom Rini > >> > >> Well, bump ? > >> > >> This is the only missing patch to get my hardware working properly. > > > > I don't think we ever had an agreement on the v1 patch. Simon had a > > long email that pointed out what Linux does seems like a 'fallback' to > > find a node with no compatible string. > > > > Back to this, if we have to go with this way, please create a test > > case to cover this scenario. > > The fact that it works on a particular board is not tested enough? > Do we need a custom, special, synthetic test ? > I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this. > Anyway, any feedback on the patch ? Did you test it ? I again only see > "do this random stuff and that random stuff" , but zero actual feedback. > If "this and that random stuff" means test case I asked for, please check my proposal on the v1 patch thread which indicated that a proper test case should be created. You seems to have missed that. Regards, Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 01/11] sh: sh7723: ap325rxa: Drop duplicate HIZCRB macro
Drop the macro as it is defined in sh7723.h already. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- board/renesas/ap325rxa/cpld-ap325rxa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/board/renesas/ap325rxa/cpld-ap325rxa.c b/board/renesas/ap325rxa/cpld-ap325rxa.c index 16fadcbca7..5d9dc9387e 100644 --- a/board/renesas/ap325rxa/cpld-ap325rxa.c +++ b/board/renesas/ap325rxa/cpld-ap325rxa.c @@ -61,8 +61,6 @@ #define CPLD_DONE_ADR ((vu_char *)0xA4050132) #define CPLD_DONE_DAT 0x20 -#defineHIZCRB ((vu_short *)0xA405015A) - /* data */ #define CPLD_NOMAL_START 0xA0A8 #define CPLD_SAFE_START0xA0AC @@ -191,7 +189,7 @@ void init_cpld(void) if (*CPLD_DONE_ADR & CPLD_DONE_DAT) /* Already DONE */ return; - *HIZCRB = 0x; + *((vu_short *)HIZCRB) = 0x; *CPLD_PFC_ADR = 0x7c00; /* FPGA PROG = OUTPUT */ /* write CPLD data from NOR flash to device */ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 03/11] sh: tmu: Clean up CONFIG_SYS_TMU_CLK_DIV
This constant is always 4 , for all boards that exist. Define it once in arch/sh/lib/time.c and remove it from the configs. Signed-off-by: Marek Vasut --- arch/sh/lib/time.c | 1 + include/configs/MigoR.h| 1 - include/configs/alt.h | 1 - include/configs/ap325rxa.h | 1 - include/configs/ap_sh4a_4a.h | 1 - include/configs/armadillo-800eva.h | 1 - include/configs/blanche.h | 1 - include/configs/ecovec.h | 1 - include/configs/espt.h | 1 - include/configs/gose.h | 1 - include/configs/koelsch.h | 1 - include/configs/lager.h| 1 - include/configs/mpr2.h | 1 - include/configs/ms7720se.h | 1 - include/configs/ms7722se.h | 1 - include/configs/ms7750se.h | 1 - include/configs/porter.h | 1 - include/configs/r0p7734.h | 1 - include/configs/r2dplus.h | 1 - include/configs/r7780mp.h | 1 - include/configs/sh7752evb.h| 1 - include/configs/sh7753evb.h| 1 - include/configs/sh7757lcr.h| 1 - include/configs/sh7763rdp.h| 1 - include/configs/sh7785lcr.h| 1 - include/configs/shmin.h| 1 - include/configs/silk.h | 1 - include/configs/stout.h| 1 - scripts/config_whitelist.txt | 1 - 29 files changed, 1 insertion(+), 28 deletions(-) diff --git a/arch/sh/lib/time.c b/arch/sh/lib/time.c index eb642969aa..aac79889dc 100644 --- a/arch/sh/lib/time.c +++ b/arch/sh/lib/time.c @@ -16,6 +16,7 @@ #include #define TCR_TPSC 0x07 +#define CONFIG_SYS_TMU_CLK_DIV 4 static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE; diff --git a/include/configs/MigoR.h b/include/configs/MigoR.h index 5cb23482fe..57e36e8605 100644 --- a/include/configs/MigoR.h +++ b/include/configs/MigoR.h @@ -93,6 +93,5 @@ #define CONFIG_SYS_CLK_FREQ #define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ -#define CONFIG_SYS_TMU_CLK_DIV (4) /* 4 (default), 16, 64, 256 or 1024 */ #endif /* __MIGO_R_H */ diff --git a/include/configs/alt.h b/include/configs/alt.h index d44a0b3007..d884831d96 100644 --- a/include/configs/alt.h +++ b/include/configs/alt.h @@ -39,7 +39,6 @@ #define CONFIG_SYS_CLK_FREQRMOBILE_XTAL_CLK #define CONFIG_SH_TMU_CLK_FREQ (CONFIG_SYS_CLK_FREQ / 2) -#define CONFIG_SYS_TMU_CLK_DIV 4 #define CONFIG_EXTRA_ENV_SETTINGS \ "fdt_high=0x\0" \ diff --git a/include/configs/ap325rxa.h b/include/configs/ap325rxa.h index 8680eb6ef5..a6e6a436b0 100644 --- a/include/configs/ap325rxa.h +++ b/include/configs/ap325rxa.h @@ -114,6 +114,5 @@ #define CONFIG_SYS_CLK_FREQ #define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ -#define CONFIG_SYS_TMU_CLK_DIV (4) /* 4 (default), 16, 64, 256 or 1024 */ #endif /* __AP325RXA_H */ diff --git a/include/configs/ap_sh4a_4a.h b/include/configs/ap_sh4a_4a.h index a4bdd44a9e..c8e22de4b8 100644 --- a/include/configs/ap_sh4a_4a.h +++ b/include/configs/ap_sh4a_4a.h @@ -102,6 +102,5 @@ #endif #define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ -#define CONFIG_SYS_TMU_CLK_DIV 4 #endif /* __AP_SH4A_4A_H */ diff --git a/include/configs/armadillo-800eva.h b/include/configs/armadillo-800eva.h index c0e1740219..f14ea9a4b1 100644 --- a/include/configs/armadillo-800eva.h +++ b/include/configs/armadillo-800eva.h @@ -93,6 +93,5 @@ #define CONFIG_SYS_CLK_FREQ5000 #define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ -#define CONFIG_SYS_TMU_CLK_DIV 4 #endif /* __ARMADILLO_800EVA_H */ diff --git a/include/configs/blanche.h b/include/configs/blanche.h index 6df0e9bcc0..7a5abf99de 100644 --- a/include/configs/blanche.h +++ b/include/configs/blanche.h @@ -53,7 +53,6 @@ #define RMOBILE_XTAL_CLK 2000u #define CONFIG_SYS_CLK_FREQRMOBILE_XTAL_CLK #define CONFIG_SH_TMU_CLK_FREQ (CONFIG_SYS_CLK_FREQ / 2) /* EXT / 2 */ -#define CONFIG_SYS_TMU_CLK_DIV 4 /* ENV setting */ #if !defined(CONFIG_MTD_NOR_FLASH) diff --git a/include/configs/ecovec.h b/include/configs/ecovec.h index e99564dbdf..9084d2e4c3 100644 --- a/include/configs/ecovec.h +++ b/include/configs/ecovec.h @@ -133,6 +133,5 @@ #define CONFIG_SYS_CLK_FREQ 4166 #define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ -#define CONFIG_SYS_TMU_CLK_DIV 4 #endif /* __ECOVEC_H */ diff --git a/include/configs/espt.h b/include/configs/espt.h index 978a9e006b..fe8b84c7a5 100644 --- a/include/configs/espt.h +++ b/include/configs/espt.h @@ -71,7 +71,6 @@ #define CONFIG_SYS_CLK_FREQ #define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ -#define CONFIG_SYS_
[U-Boot] [PATCH 02/11] sh: sh7724: Drop EDMR macro
Drop the macro as it is never used and it collides with sh_eth.h macros. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- arch/sh/include/asm/cpu_sh7724.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/sh/include/asm/cpu_sh7724.h b/arch/sh/include/asm/cpu_sh7724.h index 7a81e1677e..7b217959ed 100644 --- a/arch/sh/include/asm/cpu_sh7724.h +++ b/arch/sh/include/asm/cpu_sh7724.h @@ -203,9 +203,6 @@ #define PYDR0xA405016A #define PZDR0xA405016C -/* Ether */ -#define EDMR 0xA460 - /* UBC */ /* H-UDI */ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 05/11] sh: tmu: Inline tmu_timer_{start,stop}()
These functions are always called for timer = 0, so drop the timer check. Since these functions are called from one place only and they are reduced to one line of code, just inline them. Signed-off-by: Marek Vasut --- arch/sh/lib/time.c | 20 +++- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/arch/sh/lib/time.c b/arch/sh/lib/time.c index 302f6bed83..6273f39f21 100644 --- a/arch/sh/lib/time.c +++ b/arch/sh/lib/time.c @@ -16,6 +16,7 @@ #include #define TCR_TPSC 0x07 +#define TSTR_STR0 BIT(0) static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE; @@ -29,26 +30,11 @@ unsigned long timer_read_counter(void) return ~readl(&tmu->tcnt0); } -static void tmu_timer_start(unsigned int timer) -{ - if (timer > 2) - return; - writeb(readb(&tmu->tstr) | (1 << timer), &tmu->tstr); -} - -static void tmu_timer_stop(unsigned int timer) -{ - if (timer > 2) - return; - writeb(readb(&tmu->tstr) & ~(1 << timer), &tmu->tstr); -} - int timer_init(void) { writew(readw(&tmu->tcr0) & ~TCR_TPSC, &tmu->tcr0); - - tmu_timer_stop(0); - tmu_timer_start(0); + writeb(readb(&tmu->tstr) & ~TSTR_STR0, &tmu->tstr); + writeb(readb(&tmu->tstr) | TSTR_STR0, &tmu->tstr); return 0; } -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 06/11] sh: tmu: Inline get_tmu0_clk_rate()
This function just returns CONFIG_SH_TMU_CLK_FREQ, use the constant directly instead. Signed-off-by: Marek Vasut --- arch/sh/lib/time.c | 2 +- include/sh_tmu.h | 5 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/sh/lib/time.c b/arch/sh/lib/time.c index 6273f39f21..0f3127106a 100644 --- a/arch/sh/lib/time.c +++ b/arch/sh/lib/time.c @@ -22,7 +22,7 @@ static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE; unsigned long get_tbclk(void) { - return get_tmu0_clk_rate() >> 2; + return CONFIG_SH_TMU_CLK_FREQ / 4; } unsigned long timer_read_counter(void) diff --git a/include/sh_tmu.h b/include/sh_tmu.h index aa60c98750..70aca2149a 100644 --- a/include/sh_tmu.h +++ b/include/sh_tmu.h @@ -67,9 +67,4 @@ struct tmu_regs { }; #endif /* CONFIG_CPU_SH4 */ -static inline unsigned long get_tmu0_clk_rate(void) -{ - return CONFIG_SH_TMU_CLK_FREQ; -} - #endif /* __SH_TMU_H */ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 08/11] sh: tmu: Inline sh_tmu.h
The header contains only the TMU register layout, just inline it into the TMU timer implementation and drop the header completely. Signed-off-by: Marek Vasut --- arch/sh/lib/time.c | 43 +++- include/sh_tmu.h | 70 -- 2 files changed, 42 insertions(+), 71 deletions(-) delete mode 100644 include/sh_tmu.h diff --git a/arch/sh/lib/time.c b/arch/sh/lib/time.c index 9a1d3fb013..a650c9478c 100644 --- a/arch/sh/lib/time.c +++ b/arch/sh/lib/time.c @@ -13,7 +13,48 @@ #include #include #include -#include + +#if defined(CONFIG_CPU_SH3) +struct tmu_regs { + u8 tocr; + u8 reserved0; + u8 tstr; + u8 reserved1; + u32 tcor0; + u32 tcnt0; + u16 tcr0; + u16 reserved2; + u32 tcor1; + u32 tcnt1; + u16 tcr1; + u16 reserved3; + u32 tcor2; + u32 tcnt2; + u16 tcr2; + u16 reserved4; + u32 tcpr2; +}; +#endif /* CONFIG_CPU_SH3 */ + +#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_RMOBILE) +struct tmu_regs { + u32 reserved; + u8 tstr; + u8 reserved2[3]; + u32 tcor0; + u32 tcnt0; + u16 tcr0; + u16 reserved3; + u32 tcor1; + u32 tcnt1; + u16 tcr1; + u16 reserved4; + u32 tcor2; + u32 tcnt2; + u16 tcr2; + u16 reserved5; +}; +#endif /* CONFIG_CPU_SH4 */ #define TCR_TPSC 0x07 #define TSTR_STR0 BIT(0) diff --git a/include/sh_tmu.h b/include/sh_tmu.h deleted file mode 100644 index 70aca2149a..00 --- a/include/sh_tmu.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2012 Renesas Solutions Corp. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#ifndef __SH_TMU_H -#define __SH_TMU_H - -#include - -#if defined(CONFIG_CPU_SH3) -struct tmu_regs { - u8 tocr; - u8 reserved0; - u8 tstr; - u8 reserved1; - u32 tcor0; - u32 tcnt0; - u16 tcr0; - u16 reserved2; - u32 tcor1; - u32 tcnt1; - u16 tcr1; - u16 reserved3; - u32 tcor2; - u32 tcnt2; - u16 tcr2; - u16 reserved4; - u32 tcpr2; -}; -#endif /* CONFIG_CPU_SH3 */ - -#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_RMOBILE) -struct tmu_regs { - u32 reserved; - u8 tstr; - u8 reserved2[3]; - u32 tcor0; - u32 tcnt0; - u16 tcr0; - u16 reserved3; - u32 tcor1; - u32 tcnt1; - u16 tcr1; - u16 reserved4; - u32 tcor2; - u32 tcnt2; - u16 tcr2; - u16 reserved5; -}; -#endif /* CONFIG_CPU_SH4 */ - -#endif /* __SH_TMU_H */ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 07/11] sh: tmu: Clean up CONFIG_SH_TMU_CLK_FREQ
The R-Car Gen2 feeds the TMU with CONFIG_SYS_CLK_FREQ / 2, while the old SH parts use CONFIG_SYS_CLK_FREQ directly. Just put this into the TMU implementation and drop the CONFIG_SH_TMU_CLK_FREQ config option. Signed-off-by: Marek Vasut --- arch/sh/lib/time.c | 6 +- include/configs/MigoR.h| 1 - include/configs/alt.h | 2 -- include/configs/ap325rxa.h | 1 - include/configs/ap_sh4a_4a.h | 1 - include/configs/armadillo-800eva.h | 1 - include/configs/blanche.h | 1 - include/configs/ecovec.h | 1 - include/configs/espt.h | 1 - include/configs/gose.h | 2 -- include/configs/koelsch.h | 2 -- include/configs/lager.h| 2 -- include/configs/mpr2.h | 1 - include/configs/ms7720se.h | 1 - include/configs/ms7722se.h | 1 - include/configs/ms7750se.h | 1 - include/configs/porter.h | 2 -- include/configs/r0p7734.h | 1 - include/configs/r2dplus.h | 1 - include/configs/r7780mp.h | 1 - include/configs/rsk7203.h | 1 - include/configs/rsk7264.h | 1 - include/configs/rsk7269.h | 1 - include/configs/sh7752evb.h| 1 - include/configs/sh7753evb.h| 1 - include/configs/sh7757lcr.h| 1 - include/configs/sh7763rdp.h| 1 - include/configs/sh7785lcr.h| 1 - include/configs/shmin.h| 1 - include/configs/silk.h | 2 -- include/configs/stout.h| 2 -- 31 files changed, 5 insertions(+), 38 deletions(-) diff --git a/arch/sh/lib/time.c b/arch/sh/lib/time.c index 0f3127106a..9a1d3fb013 100644 --- a/arch/sh/lib/time.c +++ b/arch/sh/lib/time.c @@ -22,7 +22,11 @@ static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE; unsigned long get_tbclk(void) { - return CONFIG_SH_TMU_CLK_FREQ / 4; +#ifdef CONFIG_RCAR_GEN2 + return CONFIG_SYS_CLK_FREQ / 8; +#else + return CONFIG_SYS_CLK_FREQ / 4; +#endif } unsigned long timer_read_counter(void) diff --git a/include/configs/MigoR.h b/include/configs/MigoR.h index 57e36e8605..1ff04c3794 100644 --- a/include/configs/MigoR.h +++ b/include/configs/MigoR.h @@ -91,7 +91,6 @@ /* Board Clock */ #define CONFIG_SYS_CLK_FREQ -#define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ #endif /* __MIGO_R_H */ diff --git a/include/configs/alt.h b/include/configs/alt.h index d884831d96..cc6a7bf638 100644 --- a/include/configs/alt.h +++ b/include/configs/alt.h @@ -37,8 +37,6 @@ /* Board Clock */ #define RMOBILE_XTAL_CLK 2000u #define CONFIG_SYS_CLK_FREQRMOBILE_XTAL_CLK -#define CONFIG_SH_TMU_CLK_FREQ (CONFIG_SYS_CLK_FREQ / 2) - #define CONFIG_EXTRA_ENV_SETTINGS \ "fdt_high=0x\0" \ diff --git a/include/configs/ap325rxa.h b/include/configs/ap325rxa.h index a6e6a436b0..40a843a95e 100644 --- a/include/configs/ap325rxa.h +++ b/include/configs/ap325rxa.h @@ -112,7 +112,6 @@ /* Board Clock */ #define CONFIG_SYS_CLK_FREQ -#define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ #endif /* __AP325RXA_H */ diff --git a/include/configs/ap_sh4a_4a.h b/include/configs/ap_sh4a_4a.h index c8e22de4b8..b9ff965b92 100644 --- a/include/configs/ap_sh4a_4a.h +++ b/include/configs/ap_sh4a_4a.h @@ -100,7 +100,6 @@ #else #define CONFIG_SYS_CLK_FREQ #endif -#define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ #endif /* __AP_SH4A_4A_H */ diff --git a/include/configs/armadillo-800eva.h b/include/configs/armadillo-800eva.h index f14ea9a4b1..b17d597766 100644 --- a/include/configs/armadillo-800eva.h +++ b/include/configs/armadillo-800eva.h @@ -91,7 +91,6 @@ /* Board Clock */ #define CONFIG_SYS_CLK_FREQ5000 -#define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ #endif /* __ARMADILLO_800EVA_H */ diff --git a/include/configs/blanche.h b/include/configs/blanche.h index 7a5abf99de..e0acde3f91 100644 --- a/include/configs/blanche.h +++ b/include/configs/blanche.h @@ -52,7 +52,6 @@ /* Board Clock */ #define RMOBILE_XTAL_CLK 2000u #define CONFIG_SYS_CLK_FREQRMOBILE_XTAL_CLK -#define CONFIG_SH_TMU_CLK_FREQ (CONFIG_SYS_CLK_FREQ / 2) /* EXT / 2 */ /* ENV setting */ #if !defined(CONFIG_MTD_NOR_FLASH) diff --git a/include/configs/ecovec.h b/include/configs/ecovec.h index 9084d2e4c3..1e358ec6ad 100644 --- a/include/configs/ecovec.h +++ b/include/configs/ecovec.h @@ -131,7 +131,6 @@ /* Board Clock */ #define CONFIG_SYS_CLK_FREQ 4166 -#define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ #endif /* __ECOVEC_H */ diff --git a/include/configs/espt.h b/include/configs/espt.h index fe8b84c7a5..6bb23c6ad4 100644 --- a/include/configs/espt.h +++ b/in
[U-Boot] [PATCH 09/11] sh: tmu: Clean up register usage
The code uses all in all three TMU registers, drop the massive register layout structures and just define the required timer registers and use them throughout the code. Signed-off-by: Marek Vasut --- arch/sh/lib/time.c | 54 ++ 1 file changed, 11 insertions(+), 43 deletions(-) diff --git a/arch/sh/lib/time.c b/arch/sh/lib/time.c index a650c9478c..d531a4958e 100644 --- a/arch/sh/lib/time.c +++ b/arch/sh/lib/time.c @@ -15,52 +15,20 @@ #include #if defined(CONFIG_CPU_SH3) -struct tmu_regs { - u8 tocr; - u8 reserved0; - u8 tstr; - u8 reserved1; - u32 tcor0; - u32 tcnt0; - u16 tcr0; - u16 reserved2; - u32 tcor1; - u32 tcnt1; - u16 tcr1; - u16 reserved3; - u32 tcor2; - u32 tcnt2; - u16 tcr2; - u16 reserved4; - u32 tcpr2; -}; +#define TSTR 0x2 +#define TCNT0 0x8 +#define TCR0 0xc #endif /* CONFIG_CPU_SH3 */ #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_RMOBILE) -struct tmu_regs { - u32 reserved; - u8 tstr; - u8 reserved2[3]; - u32 tcor0; - u32 tcnt0; - u16 tcr0; - u16 reserved3; - u32 tcor1; - u32 tcnt1; - u16 tcr1; - u16 reserved4; - u32 tcor2; - u32 tcnt2; - u16 tcr2; - u16 reserved5; -}; +#define TSTR 0x4 +#define TCNT0 0xc +#define TCR0 0x10 #endif /* CONFIG_CPU_SH4 */ -#define TCR_TPSC 0x07 +#define TCR_TPSC 0x07 #define TSTR_STR0 BIT(0) -static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE; - unsigned long get_tbclk(void) { #ifdef CONFIG_RCAR_GEN2 @@ -72,14 +40,14 @@ unsigned long get_tbclk(void) unsigned long timer_read_counter(void) { - return ~readl(&tmu->tcnt0); + return ~readl(TMU_BASE + TCNT0); } int timer_init(void) { - writew(readw(&tmu->tcr0) & ~TCR_TPSC, &tmu->tcr0); - writeb(readb(&tmu->tstr) & ~TSTR_STR0, &tmu->tstr); - writeb(readb(&tmu->tstr) | TSTR_STR0, &tmu->tstr); + writew(readw(TMU_BASE + TCR0) & ~TCR_TPSC, TMU_BASE + TCR0); + writeb(readb(TMU_BASE + TSTR) & ~TSTR_STR0, TMU_BASE + TSTR); + writeb(readb(TMU_BASE + TSTR) | TSTR_STR0, TMU_BASE + TSTR); return 0; } -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 11/11] ARM: rmobile: Repair TMU clock on Gen2
The Gen2 TMU is fed with fixed 32.5 MHz signal from CP . This is then divided by 4 in TMU. Fix the timer clock setting in Gen2. Signed-off-by: Marek Vasut --- include/configs/rcar-gen2-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/configs/rcar-gen2-common.h b/include/configs/rcar-gen2-common.h index d606da8b0e..01583f8cc2 100644 --- a/include/configs/rcar-gen2-common.h +++ b/include/configs/rcar-gen2-common.h @@ -60,6 +60,6 @@ #define CONFIG_TMU_TIMER #define CONFIG_SYS_TIMER_COUNTS_DOWN #define CONFIG_SYS_TIMER_COUNTER (TMU_BASE + 0xc)/* TCNT0 */ -#define CONFIG_SYS_TIMER_RATE (CONFIG_SYS_CLK_FREQ / 8) +#define CONFIG_SYS_TIMER_RATE (3250 / 4) /* CP/4 */ #endif /* __RCAR_GEN2_COMMON_H */ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 10/11] sh: tmu: Zap get_tbclk and timer_read_counter
Replace those two functions with generic ones by defining the timer macros in include/config/*.h . Signed-off-by: Marek Vasut --- arch/sh/include/asm/config.h | 9 + arch/sh/lib/time.c | 16 include/configs/armadillo-800eva.h | 3 +++ include/configs/rcar-gen2-common.h | 7 ++- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/arch/sh/include/asm/config.h b/arch/sh/include/asm/config.h index bad0026648..d2862df4a5 100644 --- a/arch/sh/include/asm/config.h +++ b/arch/sh/include/asm/config.h @@ -6,4 +6,13 @@ #ifndef _ASM_CONFIG_H_ #define _ASM_CONFIG_H_ +#if !defined(CONFIG_CPU_SH2) +#include + +/* Timer */ +#define CONFIG_SYS_TIMER_COUNTS_DOWN +#define CONFIG_SYS_TIMER_COUNTER (TMU_BASE + 0x8)/* TCNT0 */ +#define CONFIG_SYS_TIMER_RATE (CONFIG_SYS_CLK_FREQ / 4) +#endif + #endif diff --git a/arch/sh/lib/time.c b/arch/sh/lib/time.c index d531a4958e..fb317f95d5 100644 --- a/arch/sh/lib/time.c +++ b/arch/sh/lib/time.c @@ -16,33 +16,17 @@ #if defined(CONFIG_CPU_SH3) #define TSTR 0x2 -#define TCNT0 0x8 #define TCR0 0xc #endif /* CONFIG_CPU_SH3 */ #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_RMOBILE) #define TSTR 0x4 -#define TCNT0 0xc #define TCR0 0x10 #endif /* CONFIG_CPU_SH4 */ #define TCR_TPSC 0x07 #define TSTR_STR0 BIT(0) -unsigned long get_tbclk(void) -{ -#ifdef CONFIG_RCAR_GEN2 - return CONFIG_SYS_CLK_FREQ / 8; -#else - return CONFIG_SYS_CLK_FREQ / 4; -#endif -} - -unsigned long timer_read_counter(void) -{ - return ~readl(TMU_BASE + TCNT0); -} - int timer_init(void) { writew(readw(TMU_BASE + TCR0) & ~TCR_TPSC, TMU_BASE + TCR0); diff --git a/include/configs/armadillo-800eva.h b/include/configs/armadillo-800eva.h index b17d597766..3c6b2c3cd7 100644 --- a/include/configs/armadillo-800eva.h +++ b/include/configs/armadillo-800eva.h @@ -18,6 +18,9 @@ #define CONFIG_ARCH_CPU_INIT #define CONFIG_TMU_TIMER +#define CONFIG_SYS_TIMER_COUNTS_DOWN +#define CONFIG_SYS_TIMER_COUNTER (TMU_BASE + 0xc)/* TCNT0 */ +#define CONFIG_SYS_TIMER_RATE (CONFIG_SYS_CLK_FREQ / 4) #define CONFIG_SYS_DCACHE_OFF /* STACK */ diff --git a/include/configs/rcar-gen2-common.h b/include/configs/rcar-gen2-common.h index 2a5cd6b832..d606da8b0e 100644 --- a/include/configs/rcar-gen2-common.h +++ b/include/configs/rcar-gen2-common.h @@ -22,7 +22,6 @@ #define CONFIG_ARCH_CPU_INIT -#define CONFIG_TMU_TIMER #ifndef CONFIG_PINCTRL_PFC #define CONFIG_SH_GPIO_PFC #endif @@ -57,4 +56,10 @@ #undef CONFIG_SPI_FLASH_MTD #endif +/* Timer */ +#define CONFIG_TMU_TIMER +#define CONFIG_SYS_TIMER_COUNTS_DOWN +#define CONFIG_SYS_TIMER_COUNTER (TMU_BASE + 0xc)/* TCNT0 */ +#define CONFIG_SYS_TIMER_RATE (CONFIG_SYS_CLK_FREQ / 8) + #endif /* __RCAR_GEN2_COMMON_H */ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 04/11] sh: tmu: Simplify the tmu_bit math
The tmu_bit value evaluates to (ffs(4) >> 1) - 1 = (3 >> 1) - 1 = 0. Just drop the tmu_bit completely as well as CONFIG_SYS_TMU_CLK_DIV. Signed-off-by: Marek Vasut --- arch/sh/lib/time.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/sh/lib/time.c b/arch/sh/lib/time.c index aac79889dc..302f6bed83 100644 --- a/arch/sh/lib/time.c +++ b/arch/sh/lib/time.c @@ -16,14 +16,12 @@ #include #define TCR_TPSC 0x07 -#define CONFIG_SYS_TMU_CLK_DIV 4 static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE; unsigned long get_tbclk(void) { - u16 tmu_bit = (ffs(CONFIG_SYS_TMU_CLK_DIV) >> 1) - 1; - return get_tmu0_clk_rate() >> ((tmu_bit + 1) * 2); + return get_tmu0_clk_rate() >> 2; } unsigned long timer_read_counter(void) @@ -47,8 +45,7 @@ static void tmu_timer_stop(unsigned int timer) int timer_init(void) { - u16 tmu_bit = (ffs(CONFIG_SYS_TMU_CLK_DIV) >> 1) - 1; - writew((readw(&tmu->tcr0) & ~TCR_TPSC) | tmu_bit, &tmu->tcr0); + writew(readw(&tmu->tcr0) & ~TCR_TPSC, &tmu->tcr0); tmu_timer_stop(0); tmu_timer_start(0); -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH V2 1/2] pci: Support parsing PCI controller DT subnodes
On 08/30/2018 03:32 PM, Bin Meng wrote: > Hi Marek, > > On Thu, Aug 30, 2018 at 1:07 AM Marek Vasut wrote: >> >> On 08/29/2018 05:15 PM, Bin Meng wrote: >>> +Simon >>> >>> Hi Marek, >>> >>> On Wed, Aug 29, 2018 at 10:22 PM Marek Vasut wrote: On 08/24/2018 08:27 PM, Marek Vasut wrote: > The PCI controller can have DT subnodes describing extra properties > of particular PCI devices, ie. a PHY attached to an EHCI controller > on a PCI bus. This patch parses those DT subnodes and assigns a node > to the PCI device instance, so that the driver can extract details > from that node and ie. configure the PHY using the PHY subsystem. > > Signed-off-by: Marek Vasut > Cc: Simon Glass > Cc: Tom Rini Well, bump ? This is the only missing patch to get my hardware working properly. >>> >>> I don't think we ever had an agreement on the v1 patch. Simon had a >>> long email that pointed out what Linux does seems like a 'fallback' to >>> find a node with no compatible string. >>> >>> Back to this, if we have to go with this way, please create a test >>> case to cover this scenario. >> >> The fact that it works on a particular board is not tested enough? >> Do we need a custom, special, synthetic test ? >> > > I believe that's always been the requirement against the DM code > changes. I was requested in the past when I changed something in the > DM and I see other people were asked to do so. Like Alex said, it does > not mean this patch was not tested enough, but to ensure future > commits won't break this. So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox. >> Anyway, any feedback on the patch ? Did you test it ? I again only see >> "do this random stuff and that random stuff" , but zero actual feedback. >> > > If "this and that random stuff" means test case I asked for, please > check my proposal on the v1 patch thread which indicated that a proper > test case should be created. You seems to have missed that. So, any feedback on this actual patch ? -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PULL] u-boot-usb/master
The following changes since commit 11ed312896c5f5814064c5d45dcb2f53dc121437: configs: am57xx: change default board name to beagle_x15 (2018-08-26 12:26:16 -0400) are available in the Git repository at: git://git.denx.de/u-boot-usb.git master for you to fetch changes up to 88c34b8da62cfb4188ff9a59acb32f88ce9ed1b0: usb: dwc2: Add reset ctrl to driver (2018-08-29 03:10:30 +0200) Ley Foon Tan (1): usb: dwc2: Add reset ctrl to driver Marek Vasut (3): phy: Fix warning due to missing definition of structure usb: ehci: Make the PHY handling generic usb: ehci: Add PHY support to ehci-pci drivers/usb/host/dwc2.c | 37 + drivers/usb/host/ehci-generic.c | 56 +++- drivers/usb/host/ehci-hcd.c | 66 ++ drivers/usb/host/ehci-pci.c | 31 +++ drivers/usb/host/ehci.h | 5 + include/generic-phy.h | 1 + 6 files changed, 139 insertions(+), 57 deletions(-) ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PULL] u-boot-sh/master
The following changes since commit 11ed312896c5f5814064c5d45dcb2f53dc121437: configs: am57xx: change default board name to beagle_x15 (2018-08-26 12:26:16 -0400) are available in the Git repository at: git://git.denx.de/u-boot-sh.git master for you to fetch changes up to 65186977ee06e0df9a9524fa4b6689af4efecac1: mmc: renesas-sdhi: Use priv directly (2018-08-30 15:32:59 +0200) Marek Vasut (2): pci: rmobile: Filter out device 1 and 2 mmc: renesas-sdhi: Use priv directly drivers/mmc/renesas-sdhi.c | 2 +- drivers/pci/pci-rcar-gen2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 13/15] optee: support routing of rpmb data frames to mmc
Hi Simon, On Wed, Aug 29, 2018 at 06:29:12PM -0600, Simon Glass wrote: > Hi Jens, > > On 23 August 2018 at 04:43, Jens Wiklander wrote: > > Adds support in optee supplicant to route signed (MACed) RPMB frames > > from OP-TEE Secure OS to MMC and vice versa to manipulate the RPMB > > partition. > > > > Tested-by: Igor Opaniuk > > Signed-off-by: Jens Wiklander > > --- > > drivers/tee/optee/Makefile| 1 + > > drivers/tee/optee/core.c | 8 ++ > > drivers/tee/optee/optee_private.h | 31 - > > drivers/tee/optee/rpmb.c | 184 ++ > > drivers/tee/optee/supplicant.c| 3 + > > 5 files changed, 226 insertions(+), 1 deletion(-) > > create mode 100644 drivers/tee/optee/rpmb.c > > > > diff --git a/drivers/tee/optee/Makefile b/drivers/tee/optee/Makefile > > index 6148feb474a5..928d3f80027f 100644 > > --- a/drivers/tee/optee/Makefile > > +++ b/drivers/tee/optee/Makefile > > @@ -2,3 +2,4 @@ > > > > obj-y += core.o > > obj-y += supplicant.o > > +obj-$(CONFIG_SUPPORT_EMMC_RPMB) += rpmb.o > > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c > > index f2d92d96551b..e297d206af3a 100644 > > --- a/drivers/tee/optee/core.c > > +++ b/drivers/tee/optee/core.c > > @@ -280,6 +280,13 @@ static u32 do_call_with_arg(struct udevice *dev, > > struct optee_msg_arg *arg) > > param.a3 = res.a3; > > handle_rpc(dev, ¶m, &page_list); > > } else { > > + /* > > +* In case we've accessed RPMB to serve an RPC > > +* request we need to restore the previously > > +* selected partition as the caller may expect it > > +* to remain unchanged. > > +*/ > > + optee_suppl_rpmb_release(dev); > > return call_err_to_res(res.a0); > > } > > } > > @@ -611,4 +618,5 @@ U_BOOT_DRIVER(optee) = { > > .probe = optee_probe, > > .ops = &optee_ops, > > .platdata_auto_alloc_size = sizeof(struct optee_pdata), > > + .priv_auto_alloc_size = sizeof(struct optee_private), > > }; > > diff --git a/drivers/tee/optee/optee_private.h > > b/drivers/tee/optee/optee_private.h > > index daa470f812a9..b76979d21011 100644 > > --- a/drivers/tee/optee/optee_private.h > > +++ b/drivers/tee/optee/optee_private.h > > @@ -6,7 +6,36 @@ > > #ifndef __OPTEE_PRIVATE_H > > #define __OPTEE_PRIVATE_H > > > > +#include > > +#include > > + > > +struct optee_private { > > doc comment OK, I'll fix. > > > + struct mmc *rpmb_mmc; > > + int rpmb_dev_id; > > + char rpmb_original_part; > > Why is this char? Are you trying to save memory? I doubt it will work :-) Good question. I think I got it from struct blk_desc::hwpart, but still got it slightly wrong. I'll change it into an int instead. > > > > +}; > > + > > +struct optee_msg_arg; > > + > > +void optee_suppl_cmd(struct udevice *dev, struct tee_shm *shm_arg, > > +void **page_list); > > Function comments. > > > + > > +#ifdef CONFIG_SUPPORT_EMMC_RPMB > > +void optee_suppl_cmd_rpmb(struct udevice *dev, struct optee_msg_arg *arg); > > +void optee_suppl_rpmb_release(struct udevice *dev); > > +#else > > +static inline void optee_suppl_cmd_rpmb(struct udevice *dev, > > + struct optee_msg_arg *arg) > > +{ > > + debug("OPTEE_MSG_RPC_CMD_RPMB not implemented\n"); > > + arg->ret = TEE_ERROR_NOT_IMPLEMENTED; > > +} > > + > > +static inline void optee_suppl_rpmb_release(struct udevice *dev) > > +{ > > +} > > +#endif > > + > > void *optee_alloc_and_init_page_list(void *buf, ulong len, u64 > > *phys_buf_ptr); > > -void optee_suppl_cmd(struct udevice *dev, void *shm, void **page_list); > > > > #endif /*__OPTEE_PRIVATE_H*/ > > diff --git a/drivers/tee/optee/rpmb.c b/drivers/tee/optee/rpmb.c > > new file mode 100644 > > index ..c1447a5561c2 > > --- /dev/null > > +++ b/drivers/tee/optee/rpmb.c > > @@ -0,0 +1,184 @@ > > +// SPDX-License-Identifier: BSD-2-Clause > > +/* > > + * Copyright (c) 2018 Linaro Limited > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > + > > +#include "optee_msg.h" > > +#include "optee_private.h" > > + > > +/* > > + * Request and response definitions must be in sync with the secure side of > > + * OP-TEE. > > + */ > > + > > +/* Request */ > > +struct rpmb_req { > > + u16 cmd; > > +#define RPMB_CMD_DATA_REQ 0x00 > > +#define RPMB_CMD_GET_DEV_INFO 0x01 > > + u16 dev_id; > > + u16 block_count; > > + /* Optional data frames (rpmb_data_frame) follow */ > > +}; > > + > > +#define RPMB_REQ_DATA(req) ((void *)((struct rpmb_req *)(req) + 1)) > > + > > +/* Response to device info request */ > > +struct rpmb_dev_info { > > + u8 cid[16]; > > + u8 rpmb_size_mult; /* EXT CSD-slice 16
Re: [U-Boot] [PATCH V2 1/2] ARM: tegra: reserve unmapped RAM so EFI doesn't use it
On 08/30/2018 12:43 AM, Alexander Graf wrote: On 29.08.18 23:52, Heinrich Schuchardt wrote: On 08/29/2018 11:34 PM, Stephen Warren wrote: From: Stephen Warren Tegra U-Boot ensures that board_get_usable_ram_top() never returns a value over 4GB, since some peripherals can't access such addresses. However, on systems with more than 2GB of RAM, RAM bank 1 does describe this extra RAM, so that Linux (or whatever OS) can use it, subject to DMA limitations. Since board_get_usable_ram_top() points at the top of RAM bank 0, the memory locations describes by RAM bank 1 are not mapped by U-Boot's MMU configuration, and so cannot be used for anything. For some completely inexplicable reason, U-Boot's EFI support ignores the value returned by board_get_usable_ram_top(), and EFI memory allocation routines will return values above U-Boot's RAM top. This causes U-Boot to crash when it accesses that RAM, since it isn't mapped by the MMU. One use-case where this happens is TFTP download of a file on Jetson TX1 (p2371-2180). This change explicitly tells the EFI code that this extra RAM should not be used, thus avoiding the crash. A previous attempt to make EFI honor board_get_usable_ram_top() was rejected. So, this patch will need to be replicated for any board that implements board_get_usable_ram_top(). Fixes: aa909462d018 ("efi_loader: efi_allocate_pages is too restrictive") Signed-off-by: Stephen Warren --- v2: - Don't hard-code EFI page size. - Register RAM as a boot services data rather than reserved. --- arch/arm/mach-tegra/board2.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c index 421a71b3014d..f893966140a1 100644 --- a/arch/arm/mach-tegra/board2.c +++ b/arch/arm/mach-tegra/board2.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -210,6 +211,19 @@ int board_early_init_f(void) int board_late_init(void) { +#ifdef CONFIG_EFI_LOADER + if (gd->bd->bi_dram[1].start) { + /* +* Only bank 0 is below board_get_usable_ram_top(), so all of +* bank 1 is not mapped by the U-Boot MMU configuration, and so +* we must prevent EFI from using it. +*/ + efi_add_memory_map(gd->bd->bi_dram[1].start, + gd->bd->bi_dram[1].size / EFI_PAGE_SIZE, Are you sure all boards do the division without library function? This is why I prefer >> EFI_PAGE_SHIFT. Compiling SPL fails for harmony_defconfig. LD spl/common/spl/built-in.o arch/arm/mach-tegra/board2.c: In function ‘board_late_init’: arch/arm/mach-tegra/board2.c:221:3: warning: implicit declaration of function ‘efi_add_memory_map’; did you mean ‘fdt_add_mem_rsv’? [-Wimplicit-function-declaration] efi_add_memory_map(gd->bd->bi_dram[1].start, ^~ fdt_add_mem_rsv Oh, I figured that warning were errors and only checked that Jenkins passed, not for warnings in the logs. I think that means you want #if CONFIG_IS_ENABLED(EFI_LOADER) because the file is also compiled for SPL. That does work, but include/efi_loader.h uses the following, so I think it makes sense to use the exact same ifdef in the source code: #if defined(CONFIG_EFI_LOADER) && !defined(CONFIG_SPL_BUILD) Or, should I update the header to use CONFIG_IS_ENABLED too (and hope that won't break any other boards). ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 01/13] pico-imx6ul: Convert to distro config
From: Fabio Estevam Instead of keeping a custom environment, use a more generic approach by switching to disto config. Signed-off-by: Fabio Estevam Signed-off-by: Otavio Salvador --- configs/pico-imx6ul_defconfig | 2 + include/configs/pico-imx6ul.h | 69 ++- 2 files changed, 21 insertions(+), 50 deletions(-) diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index 59ef7b7f22..3f969a2d6e 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -4,7 +4,9 @@ CONFIG_SYS_TEXT_BASE=0x8780 CONFIG_TARGET_PICO_IMX6UL=y # CONFIG_CMD_BMODE is not set CONFIG_NR_DRAM_BANKS=1 +CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/technexion/pico-imx6ul/imximage.cfg" +CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd" CONFIG_BOOTDELAY=3 CONFIG_SUPPORT_RAW_INITRD=y CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-hobbit.dtb" diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index 80a2d1fbdb..1a148bf1a6 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -52,64 +52,33 @@ #define CONFIG_SYS_MMC_IMG_LOAD_PART 1 #define CONFIG_EXTRA_ENV_SETTINGS \ + "script=boot.scr\0" \ "image=zImage\0" \ "console=ttymxc5\0" \ "fdt_high=0x\0" \ "initrd_high=0x\0" \ - "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ "fdt_addr=0x8300\0" \ - "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \ - "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \ + "fdt_addr_r=0x8300\0" \ + "kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \ + "pxefile_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \ + "ramdisk_addr_r=0x8300\0" \ + "ramdiskaddr=0x8300\0" \ + "scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \ CONFIG_DFU_ENV_SETTINGS \ - "finduuid=part uuid mmc 0:2 uuid\0" \ + "finduuid=part uuid mmc 0:1 uuid\0" \ "partitions=" \ "uuid_disk=${uuid_gpt_disk};" \ - "name=boot,size=16MiB;name=rootfs,size=0,uuid=${uuid_gpt_rootfs}\0" \ - "setup_emmc=gpt write mmc 0 $partitions; reset;\0" \ - "mmcargs=setenv bootargs console=${console},${baudrate} " \ - "root=PARTUUID=${uuid} rootwait rw\0" \ - "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ - "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ - "mmcboot=echo Booting from mmc ...; " \ - "run finduuid; " \ - "run mmcargs; " \ - "if run loadfdt; then " \ - "bootz ${loadaddr} - ${fdt_addr}; " \ - "else " \ - "echo WARN: Cannot load the DT; " \ - "fi;\0" \ - "netargs=setenv bootargs console=${console},${baudrate} " \ - "root=/dev/nfs " \ - "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ - "netboot=echo Booting from net ...; " \ - "run netargs; " \ - "if test ${ip_dyn} = yes; then " \ - "setenv get_cmd dhcp; " \ - "else " \ - "setenv get_cmd tftp; " \ - "fi; " \ - "${get_cmd} ${image}; " \ - "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ - "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ - "bootz ${loadaddr} - ${fdt_addr}; " \ - "else " \ - "if test ${boot_fdt} = try; then " \ - "bootz; " \ - "else " \ - "echo WARN: Cannot load the DT; " \ - "fi; " \ - "fi; " \ - "else " \ - "bootz; " \ - "fi;\0" \ - -#define CONFIG_BOOTCOMMAND \ - "if mmc rescan; then " \ - "if run loadimage; then " \ - "run mmcboot; " \ - "else run netboot; " \ - "fi; " \ - "else run netboot; fi" + "name=rootfs,size=0,uuid=${uuid_gpt_rootfs}\0" \ + "fastboot_partition_alias_system=rootfs\0" \ + "setup_emmc=mmc dev 0; gpt write mmc 0 $partitions; reset;\0" \ + BOOTENV + +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 0) \ + func(DHCP, dhcp, na) + +#include #define CONFIG_SYS_MEMTEST_START 0x8000 #define CONFIG_SYS_MEMTEST_END CONFIG_SYS_MEMTEST_START + SZ_128M -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 03/13] pico-imx6ul: Add fastboot support
From: Fabio Estevam fastboot tool is a convenient way to flash the eMMC, so add support for it. Examples of usages: On the pico-imx6ul U-Boot prompt: => fastboot 0 On the Linux PC connected via USB: 1. Retrieving the U-Boot version $ sudo fastboot getvar bootloader-version -i 0x0525 bootloader-version: U-Boot 2018.07-rc2-00130-g0881835-dirty finished. total time: 0.000s 2. Resetting the board $ sudo fastboot reboot -i 0x0525 (this causes the pico-imx6ul to reboot) Signed-off-by: Fabio Estevam Signed-off-by: Fabio Berton Signed-off-by: Otavio Salvador --- configs/pico-imx6ul_defconfig | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index 589e67be96..cae7ded1fa 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -45,6 +45,12 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_ENV_IS_IN_MMC=y CONFIG_DFU_MMC=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_FASTBOOT_BUF_ADDR=0x8200 +CONFIG_FASTBOOT_BUF_SIZE=0x1000 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=0 +CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_FSL_ESDHC=y CONFIG_PHYLIB=y CONFIG_PHY_MICREL=y @@ -56,5 +62,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y -CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_OF_LIBFDT=y -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 02/13] pico-imx6ul: Convert to SPL
From: Fabio Estevam There are two versions of imx6ul pico SOMs: one with 256MB and another one with 512MB of RAM. Convert to SPL so that both versions can be supported. Currently only the 256MB is tested/supported. Signed-off-by: Fabio Estevam Signed-off-by: Fabio Berton Signed-off-by: Otavio Salvador --- arch/arm/mach-imx/mx6/Kconfig | 1 + board/technexion/pico-imx6ul/Makefile | 2 +- board/technexion/pico-imx6ul/spl.c| 115 ++ configs/pico-imx6ul_defconfig | 14 +++- include/configs/pico-imx6ul.h | 1 + 5 files changed, 131 insertions(+), 2 deletions(-) create mode 100644 board/technexion/pico-imx6ul/spl.c diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig index a2799c436e..06c25bae36 100644 --- a/arch/arm/mach-imx/mx6/Kconfig +++ b/arch/arm/mach-imx/mx6/Kconfig @@ -402,6 +402,7 @@ config TARGET_OT1200 config TARGET_PICO_IMX6UL bool "PICO-IMX6UL-EMMC" select MX6UL + select SUPPORT_SPL config TARGET_LITEBOARD bool "Grinn liteBoard (i.MX6UL)" diff --git a/board/technexion/pico-imx6ul/Makefile b/board/technexion/pico-imx6ul/Makefile index 8fdb7875ac..b7493df01c 100644 --- a/board/technexion/pico-imx6ul/Makefile +++ b/board/technexion/pico-imx6ul/Makefile @@ -2,4 +2,4 @@ # (C) Copyright 2015 Technexion Ltd. # (C) Copyright 2015 Freescale Semiconductor, Inc. -obj-y := pico-imx6ul.o +obj-y := pico-imx6ul.o spl.o diff --git a/board/technexion/pico-imx6ul/spl.c b/board/technexion/pico-imx6ul/spl.c new file mode 100644 index 00..6989c81946 --- /dev/null +++ b/board/technexion/pico-imx6ul/spl.c @@ -0,0 +1,115 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(CONFIG_SPL_BUILD) +#include + +static struct mx6ul_iomux_grp_regs mx6_grp_ioregs = { + .grp_addds = 0x0030, + .grp_ddrmode_ctl = 0x0002, + .grp_b0ds = 0x0030, + .grp_ctlds = 0x0030, + .grp_b1ds = 0x0030, + .grp_ddrpke = 0x, + .grp_ddrmode = 0x0002, + .grp_ddr_type = 0x0008, +}; + +static struct mx6ul_iomux_ddr_regs mx6_ddr_ioregs = { + .dram_dqm0 = 0x0030, + .dram_dqm1 = 0x0030, + .dram_ras = 0x0030, + .dram_cas = 0x0030, + .dram_odt0 = 0x0030, + .dram_odt1 = 0x0030, + .dram_sdba2 = 0x, + .dram_sdclk_0 = 0x0030, + .dram_sdqs0 = 0x0030, + .dram_sdqs1 = 0x0030, + .dram_reset = 0x0030, +}; + +static struct mx6_mmdc_calibration mx6_mmcd_calib = { + .p0_mpwldectrl0 = 0x, + .p0_mpdgctrl0 = 0x01380134, + .p0_mprddlctl = 0x40404244, + .p0_mpwrdlctl = 0x40405050, +}; + +static struct mx6_ddr_sysinfo ddr_sysinfo = { + .dsize = 0, + .cs1_mirror = 0, + .cs_density = 32, + .ncs= 1, + .bi_on = 1, + .rtt_nom= 1, + .rtt_wr = 0, + .ralat = 5, + .walat = 0, + .mif3_mode = 3, + .rst_to_cke = 0x23, + .sde_to_rst = 0x10, + .refsel = 1, + .refr = 3, +}; + +static struct mx6_ddr3_cfg mem_ddr = { + .mem_speed = 1333, + .density = 2, + .width = 16, + .banks = 8, + .rowaddr = 14, + .coladdr = 10, + .pagesz = 2, + .trcd = 1350, + .trcmin = 4950, + .trasmin = 3600, +}; + +static void ccgr_init(void) +{ + struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; + + writel(0x, &ccm->CCGR0); + writel(0x, &ccm->CCGR1); + writel(0x, &ccm->CCGR2); + writel(0x, &ccm->CCGR3); + writel(0x, &ccm->CCGR4); + writel(0x, &ccm->CCGR5); + writel(0x, &ccm->CCGR6); + writel(0x, &ccm->CCGR7); +} + +static void spl_dram_init(void) +{ + mx6ul_dram_iocfg(mem_ddr.width, &mx6_ddr_ioregs, &mx6_grp_ioregs); + mx6_dram_cfg(&ddr_sysinfo, &mx6_mmcd_calib, &mem_ddr); +} + +void board_init_f(ulong dummy) +{ + ccgr_init(); + arch_cpu_init(); + board_early_init_f(); + timer_init(); + preloader_console_init(); + spl_dram_init(); + memset(__bss_start, 0, __bss_end - __bss_start); + board_init_r(NULL, 0); +} + +void reset_cpu(ulong addr) +{ +} +#endif diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index 3f969a2d6e..589e67be96 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -1,12 +1,23 @@ CONFIG_ARM=y CONFIG_ARCH_MX6=y CONFIG_SYS_TEXT_BASE=0x8780 +CONFIG_SPL_GPIO_SUPPORT=y +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_TARGET_PICO_IMX6UL=y +CONFIG_SPL_MMC_SUPPORT=y +CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL=y +CONFIG_SPL_L
[U-Boot] [PATCH 05/13] pico-imx6ul: Add support for the 512MB module
From: Fabio Estevam Currently only the module with 256MB of RAM is supported. Add support for the 512MB of RAM variant as well. Signed-off-by: Fabio Estevam Signed-off-by: Fabio Berton Signed-off-by: Otavio Salvador --- board/technexion/pico-imx6ul/spl.c | 27 --- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/board/technexion/pico-imx6ul/spl.c b/board/technexion/pico-imx6ul/spl.c index 6989c81946..428d3b10fb 100644 --- a/board/technexion/pico-imx6ul/spl.c +++ b/board/technexion/pico-imx6ul/spl.c @@ -69,7 +69,6 @@ static struct mx6_ddr3_cfg mem_ddr = { .density = 2, .width = 16, .banks = 8, - .rowaddr = 14, .coladdr = 10, .pagesz = 2, .trcd = 1350, @@ -91,12 +90,34 @@ static void ccgr_init(void) writel(0x, &ccm->CCGR7); } -static void spl_dram_init(void) +static void imx6ul_spl_dram_cfg_size(u32 ram_size) { + if (ram_size == SZ_256M) + mem_ddr.rowaddr = 14; + else + mem_ddr.rowaddr = 15; + mx6ul_dram_iocfg(mem_ddr.width, &mx6_ddr_ioregs, &mx6_grp_ioregs); mx6_dram_cfg(&ddr_sysinfo, &mx6_mmcd_calib, &mem_ddr); } +static void imx6ul_spl_dram_cfg(void) +{ + ulong ram_size_test, ram_size = 0; + + for (ram_size = SZ_512M; ram_size >= SZ_256M; ram_size >>= 1) { + imx6ul_spl_dram_cfg_size(ram_size); + ram_size_test = get_ram_size((long int *)PHYS_SDRAM, ram_size); + if (ram_size_test == ram_size) + break; + } + + if (ram_size < SZ_256M) { + puts("ERROR: DRAM size detection failed\n"); + hang(); + } +} + void board_init_f(ulong dummy) { ccgr_init(); @@ -104,7 +125,7 @@ void board_init_f(ulong dummy) board_early_init_f(); timer_init(); preloader_console_init(); - spl_dram_init(); + imx6ul_spl_dram_cfg(); memset(__bss_start, 0, __bss_end - __bss_start); board_init_r(NULL, 0); } -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 06/13] pico-imx7d: Update the README file
From: Fabio Estevam Update the README file to take into accound the switch to SPL. Signed-off-by: Fabio Estevam Signed-off-by: Fabio Berton Signed-off-by: Otavio Salvador --- board/technexion/pico-imx7d/README | 24 +--- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/board/technexion/pico-imx7d/README b/board/technexion/pico-imx7d/README index aa9d72c5d1..24eb97e82c 100644 --- a/board/technexion/pico-imx7d/README +++ b/board/technexion/pico-imx7d/README @@ -11,7 +11,13 @@ $ make mrproper $ make pico-imx7d_defconfig $ make -This generates the U-Boot binary called u-boot.imx. +This generates the SPL and u-boot.img binaries. + +1. Loading U-Boot via USB Serial Download Protocol + +Note: This method is convenient for development purposes. +If the eMMC has already a U-Boot flashed with DFU support then +the user can go to step 2 below in order to update U-Boot. Put pico board in USB download mode (refer to the PICO-iMX7D Quick Start Guide page 3) @@ -22,11 +28,15 @@ Connect a USB cable between the OTG pico port and the host PC. Open a terminal program such as minicom. -Copy u-boot.imx to the imx_usb_loader folder. +Copy SPL and u-boot.img to the imx_usb_loader folder. + +Load the SPL binary via USB: -Load u-boot.imx via USB: +$ sudo ./imx_usb SPL -$ sudo ./imx_usb u-boot.imx +Load the u-boot.img binary via USB: + +$ sudo ./imx_usb u-boot.img Then U-Boot starts and its messages appear in the console program. @@ -35,16 +45,16 @@ Use the default environment variables: => env default -f -a => saveenv +2. Flashing U-Boot into the eMMC + Run the DFU agent so we can flash the new images using dfu-util tool: => dfu 0 mmc 0 -Flash SPL into the eMMC: +Flash SPL and u-boot.img into the eMMC running the following commands on a PC: $ sudo dfu-util -D SPL -a spl -Flash u-boot.img into the eMMC: - $ sudo dfu-util -D u-boot.img -a u-boot Remove power from the pico board. -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 12/13] pico-imx6ul: Add new pico-hobbit config
The new config skips the boot menu which asks which board is in use. This is useful to allow direct booting of image without user iteration. Signed-off-by: Otavio Salvador --- board/technexion/pico-imx6ul/MAINTAINERS | 5 +++ configs/pico-hobbit-imx6ul_defconfig | 53 2 files changed, 58 insertions(+) create mode 100644 configs/pico-hobbit-imx6ul_defconfig diff --git a/board/technexion/pico-imx6ul/MAINTAINERS b/board/technexion/pico-imx6ul/MAINTAINERS index 594a883d15..334847cf71 100644 --- a/board/technexion/pico-imx6ul/MAINTAINERS +++ b/board/technexion/pico-imx6ul/MAINTAINERS @@ -5,3 +5,8 @@ S: Maintained F: board/technexion/pico-imx6ul/ F: include/configs/pico-imx6ul.h F: configs/pico-imx6ul_defconfig + +Technexion PICO-HOBBIT-IMX6UL +M: Otavio Salvador +S: Maintained +F: configs/pico-hobbit-imx6ul_defconfig diff --git a/configs/pico-hobbit-imx6ul_defconfig b/configs/pico-hobbit-imx6ul_defconfig new file mode 100644 index 00..362c0a251d --- /dev/null +++ b/configs/pico-hobbit-imx6ul_defconfig @@ -0,0 +1,53 @@ +CONFIG_ARM=y +CONFIG_ARCH_MX6=y +CONFIG_SYS_TEXT_BASE=0x8780 +CONFIG_SPL_GPIO_SUPPORT=y +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_TARGET_PICO_IMX6UL=y +CONFIG_SPL_MMC_SUPPORT=y +CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL=y +CONFIG_SPL_LIBDISK_SUPPORT=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" +CONFIG_BOOTDELAY=3 +CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" +CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-hobbit.dtb" +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_USB_HOST_SUPPORT=y +CONFIG_SPL_USB_GADGET_SUPPORT=y +CONFIG_SPL_USB_SDP_SUPPORT=y +CONFIG_CMD_BOOTMENU=y +CONFIG_CMD_MEMTEST=y +CONFIG_CMD_DFU=y +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y +CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y +CONFIG_CMD_USB_SDP=y +CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_CACHE=y +CONFIG_CMD_EXT4_WRITE=y +CONFIG_ENV_IS_IN_MMC=y +CONFIG_DFU_MMC=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_FASTBOOT_BUF_SIZE=0x1000 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=0 +CONFIG_FASTBOOT_CMD_OEM_FORMAT=y +CONFIG_FSL_ESDHC=y +CONFIG_PHYLIB=y +CONFIG_PHY_MICREL=y +CONFIG_MII=y +CONFIG_USB=y +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_USB_GADGET_VENDOR_NUM=0x0525 +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 +CONFIG_CI_UDC=y +CONFIG_OF_LIBFDT=y -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 04/13] pico-imx6ul: Add bmode support
From: Fabio Estevam The 'bmode' command is helpful for switching the boot media. In the case of pico-imx6ul there are two possible boot media: eMMC or USB. To boot from eMMC: => bmode emmc To boot from USB (via Serial Download Protocol): => bmode usb Signed-off-by: Fabio Estevam Signed-off-by: Fabio Berton Signed-off-by: Otavio Salvador --- configs/pico-imx6ul_defconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index cae7ded1fa..daa898fb22 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -9,7 +9,6 @@ CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL=y CONFIG_SPL_LIBDISK_SUPPORT=y -# CONFIG_CMD_BMODE is not set CONFIG_NR_DRAM_BANKS=1 CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 09/13] pico-imx6ul: Add bootmenu to choose the baseboard
Currently the baseboards do not offer a way to autodetect which one is in use, so we ask the user if no value has been set. Signed-off-by: Otavio Salvador --- configs/pico-imx6ul_defconfig | 5 +++-- include/configs/pico-imx6ul.h | 10 ++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index 56cb4810dc..3d4063b136 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -13,13 +13,14 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_NR_DRAM_BANKS=1 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTDELAY=3 -CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd" -CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-hobbit.dtb" +CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" +CONFIG_DEFAULT_FDT_FILE="ask" CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_USB_HOST_SUPPORT=y CONFIG_SPL_USB_GADGET_SUPPORT=y CONFIG_SPL_USB_SDP_SUPPORT=y +CONFIG_CMD_BOOTMENU=y CONFIG_CMD_MEMTEST=y CONFIG_CMD_DFU=y # CONFIG_CMD_FLASH is not set diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index 14d5cc3ddb..2276f72bae 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -50,6 +50,10 @@ "/imx6ul-pico-hobbit.dtb ext4 0 1;" \ "rootfs part 0 2\0" \ +#define BOOTMENU_ENV \ + "bootmenu_0=Boot using PICO-Hobbit baseboard=" \ + "setenv fdtfile imx6ul-pico-hobbit.dtb\0" \ + #define CONFIG_SYS_MMC_IMG_LOAD_PART 1 #define CONFIG_EXTRA_ENV_SETTINGS \ @@ -59,6 +63,7 @@ "fdt_high=0x\0" \ "initrd_high=0x\0" \ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ + BOOTMENU_ENV \ "fdt_addr=0x8300\0" \ "fdt_addr_r=0x8300\0" \ "kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \ @@ -67,6 +72,11 @@ "ramdiskaddr=0x8300\0" \ "scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \ CONFIG_DFU_ENV_SETTINGS \ + "findfdt=" \ + "if test $fdtfile = ask ; then " \ + "bootmenu -1; fi;" \ + "if test $fdtfile != ask ; then " \ + "saveenv; fi;\0" \ "finduuid=part uuid mmc 0:1 uuid\0" \ "partitions=" \ "uuid_disk=${uuid_gpt_disk};" \ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 07/13] pico-imx6ul: Update the README file
From: Fabio Estevam Update the README file to take into accound the switch to SPL. Signed-off-by: Fabio Estevam Signed-off-by: Fabio Berton Signed-off-by: Otavio Salvador --- board/technexion/pico-imx6ul/README | 26 -- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/board/technexion/pico-imx6ul/README b/board/technexion/pico-imx6ul/README index 2f66095097..a5415714ee 100644 --- a/board/technexion/pico-imx6ul/README +++ b/board/technexion/pico-imx6ul/README @@ -13,7 +13,13 @@ $ make mrproper $ make pico-imx6ul_defconfig $ make -This will generate the U-Boot binary called u-boot.imx. +This generates the SPL and u-boot.img binaries. + +1. Loading U-Boot via USB Serial Download Protocol + +Note: This method is convenient for development purposes. +If the eMMC has already a U-Boot flashed with DFU support then +the user can go to step 2 below in order to update U-Boot. Put pico board in USB download mode (refer to the document http://www.wandboard.org/images/hobbit/hobbitboard-imx6ul-reva1.pdf page 15) @@ -24,11 +30,15 @@ Connect a USB cable between the OTG pico port and the host PC Open a terminal program such as minicom -Copy u-boot.imx to the imx_usb_loader folder. +Copy SPL and u-boot.img to the imx_usb_loader folder. + +Load the SPL binary via USB: -Load u-boot.imx via USB: +$ sudo ./imx_usb SPL -$ sudo ./imx_usb u-boot.imx +Load the u-boot.img binary via USB: + +$ sudo ./imx_usb u-boot.img Then U-Boot should start and its messages will appear in the console program. @@ -37,12 +47,16 @@ Use the default environment variables: => env default -f -a => saveenv +2. Flashing U-Boot into the eMMC + Run the DFU command: => dfu 0 mmc 0 -Transfer u-boot.imx that will be flashed into the eMMC: +Flash SPL and u-boot.img into the eMMC running the following commands on a PC: + +$ sudo dfu-util -D SPL -a spl -$ sudo dfu-util -D u-boot.imx -a boot +$ sudo dfu-util -D u-boot.img -a u-boot Then on the U-Boot prompt the following message should be seen after a successful upgrade: -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 08/13] pico-imx6ul: Sync defconfig with new changes
Due the changes in previous commits, we need to resync the defconfig to reduce noise in next commits. Signed-off-by: Otavio Salvador --- configs/pico-imx6ul_defconfig | 20 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index daa898fb22..56cb4810dc 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -9,43 +9,31 @@ CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL=y CONFIG_SPL_LIBDISK_SUPPORT=y -CONFIG_NR_DRAM_BANKS=1 CONFIG_DISTRO_DEFAULTS=y +CONFIG_NR_DRAM_BANKS=1 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" +CONFIG_BOOTDELAY=3 CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd" +CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-hobbit.dtb" +CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_USB_HOST_SUPPORT=y CONFIG_SPL_USB_GADGET_SUPPORT=y CONFIG_SPL_USB_SDP_SUPPORT=y -CONFIG_BOOTDELAY=3 -CONFIG_SUPPORT_RAW_INITRD=y -CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-hobbit.dtb" -CONFIG_BOARD_EARLY_INIT_F=y -CONFIG_HUSH_PARSER=y -CONFIG_CMD_BOOTZ=y CONFIG_CMD_MEMTEST=y CONFIG_CMD_DFU=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y -CONFIG_CMD_PART=y CONFIG_CMD_USB=y CONFIG_CMD_USB_SDP=y CONFIG_CMD_USB_MASS_STORAGE=y -CONFIG_CMD_DHCP=y -CONFIG_CMD_MII=y -CONFIG_CMD_PING=y CONFIG_CMD_CACHE=y -CONFIG_CMD_EXT2=y -CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_FAT=y -CONFIG_CMD_FS_GENERIC=y CONFIG_ENV_IS_IN_MMC=y CONFIG_DFU_MMC=y CONFIG_USB_FUNCTION_FASTBOOT=y -CONFIG_FASTBOOT_BUF_ADDR=0x8200 CONFIG_FASTBOOT_BUF_SIZE=0x1000 CONFIG_FASTBOOT_FLASH=y CONFIG_FASTBOOT_FLASH_MMC_DEV=0 -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 13/13] pico-imx6ul: Remove CONFIG_FSL_USDHC from .h
The FSL_USDHC support is now handled by Kconfig and it is enabled on the respective `defconfig` so the setting in .h is pointless. Signed-off-by: Otavio Salvador --- include/configs/pico-imx6ul.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index a510fd1554..94c14a7a43 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -28,7 +28,6 @@ #define CONFIG_MXC_UART_BASE UART6_BASE_ADDR /* MMC Configs */ -#define CONFIG_FSL_USDHC #define CONFIG_SYS_FSL_ESDHC_ADDR USDHC1_BASE_ADDR #define CONFIG_SUPPORT_EMMC_BOOT -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 11/13] pico-imx6ul: Sync README with pico-imx7d
Signed-off-by: Otavio Salvador --- board/technexion/pico-imx6ul/README | 22 +- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/board/technexion/pico-imx6ul/README b/board/technexion/pico-imx6ul/README index a5415714ee..66dc977d49 100644 --- a/board/technexion/pico-imx6ul/README +++ b/board/technexion/pico-imx6ul/README @@ -22,13 +22,14 @@ If the eMMC has already a U-Boot flashed with DFU support then the user can go to step 2 below in order to update U-Boot. Put pico board in USB download mode (refer to the document -http://www.wandboard.org/images/hobbit/hobbitboard-imx6ul-reva1.pdf page 15) +http://www.wandboard.org/images/hobbit/hobbitboard-imx6ul-reva1.pdf +page 15). -Connect a USB to serial adapter between the host PC and pico +Connect a USB to serial adapter between the host PC and pico. -Connect a USB cable between the OTG pico port and the host PC +Connect a USB cable between the OTG pico port and the host PC. -Open a terminal program such as minicom +Open a terminal program such as minicom. Copy SPL and u-boot.img to the imx_usb_loader folder. @@ -40,7 +41,7 @@ Load the u-boot.img binary via USB: $ sudo ./imx_usb u-boot.img -Then U-Boot should start and its messages will appear in the console program. +Then U-Boot starts and its messages appear in the console program. Use the default environment variables: @@ -49,7 +50,8 @@ Use the default environment variables: 2. Flashing U-Boot into the eMMC -Run the DFU command: +Run the DFU agent so we can flash the new images using dfu-util tool: + => dfu 0 mmc 0 Flash SPL and u-boot.img into the eMMC running the following commands on a PC: @@ -58,14 +60,8 @@ $ sudo dfu-util -D SPL -a spl $ sudo dfu-util -D u-boot.img -a u-boot -Then on the U-Boot prompt the following message should be seen after a -successful upgrade: - -#DOWNLOAD ... OK -Ctrl+C to exit ... - Remove power from the pico board. -Put pico board into normal boot mode +Put pico board into normal boot mode. Power up the board and the new updated U-Boot should boot from eMMC. -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 10/13] pico-imx6ul: Improve default DFU settings
This rework the DFU settings so it supports the SPL and U-Boot image, as well as the single partition layout we are using by default. Signed-off-by: Otavio Salvador --- include/configs/pico-imx6ul.h | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index 2276f72bae..a510fd1554 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -44,11 +44,12 @@ #define DFU_DEFAULT_POLL_TIMEOUT 300 #define CONFIG_DFU_ENV_SETTINGS \ - "dfu_alt_info=uboot raw 0x2 0x400 mmcpart 1;" \ - "boot part 0 1;" \ - "/zImage ext4 0 1;" \ - "/imx6ul-pico-hobbit.dtb ext4 0 1;" \ - "rootfs part 0 2\0" \ + "dfu_alt_info=" \ + "spl raw 0x2 0x400 mmcpart 1;" \ + "u-boot raw 0x8a 0x400 mmcpart 1;" \ + "/boot/zImage ext4 0 1;" \ + "/boot/imx6ul-pico-hobbit.dtb ext4 0 1;" \ + "rootfs part 0 1\0" \ #define BOOTMENU_ENV \ "bootmenu_0=Boot using PICO-Hobbit baseboard=" \ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 5/8] rockchip: rk3036: use ARM arch timer instead of rk_timer
On Wed, 18 Apr 2018, Kever Yang wrote: We prefer to use ARM arch timer instead of rockchip timer, so that we are using the same timer for SPL, U-Boot and Kernel, which will make things simple and easy to track the boot time. Signed-off-by: Kever Yang --- arch/arm/mach-rockchip/Makefile | 2 +- arch/arm/mach-rockchip/rk3036-board-spl.c | 19 +-- include/configs/rk3036_common.h | 6 +++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile index c1eeefb..02aa58a 100644 --- a/arch/arm/mach-rockchip/Makefile +++ b/arch/arm/mach-rockchip/Makefile @@ -40,7 +40,7 @@ endif obj-$(CONFIG_$(SPL_TPL_)RAM) += sdram_common.o ifndef CONFIG_ARM64 -ifeq ($(CONFIG_ROCKCHIP_RK3188)$(CONFIG_ROCKCHIP_RK322X),) +ifeq ($(CONFIG_ROCKCHIP_RK3188)$(CONFIG_ROCKCHIP_RK322X)$(CONFIG_ROCKCHIP_RK3036),) Same as for the previous patch. Now it has become apparent, that this list is growing... obj-y += rk_timer.o endif endif diff --git a/arch/arm/mach-rockchip/rk3036-board-spl.c b/arch/arm/mach-rockchip/rk3036-board-spl.c index 550e3a1..4b4016b 100644 --- a/arch/arm/mach-rockchip/rk3036-board-spl.c +++ b/arch/arm/mach-rockchip/rk3036-board-spl.c @@ -11,7 +11,6 @@ #include #include #include -#include #include DECLARE_GLOBAL_DATA_PTR; @@ -20,6 +19,17 @@ DECLARE_GLOBAL_DATA_PTR; #define DEBUG_UART_BASE 0x20068000 Please make this a const uint32_t * ... or even better: use a pointer to a structure representing the peripheral's register layout. +void rockchip_stimer_init(void) +{ + asm volatile("mcr p15, 0, %0, c14, c0, 0" +: : "r"(COUNTER_FREQUENCY)); + + writel(0, CONFIG_ROCKCHIP_STIMER_BASE + 0x10); Unless we really want a 0, we should clrbits the specific bits involved via symbolic constants. + writel(0x, CONFIG_ROCKCHIP_STIMER_BASE); + writel(0x, CONFIG_ROCKCHIP_STIMER_BASE + 4); + writel(1, CONFIG_ROCKCHIP_STIMER_BASE + 0x10); This should be a symbolic 'enable' bit that gets written. I'd prefer a setbits on this, as we only want a single bit. Once again (I had this in the comments on the first revision a few weeks back already): the STIMER_BASE is not user-configurable. +} + void board_init_f(ulong dummy) { #ifdef EARLY_DEBUG @@ -36,7 +46,12 @@ void board_init_f(ulong dummy) GPIO1C2_UART2_SIN << GPIO1C2_SHIFT); debug_uart_init(); #endif - rockchip_timer_init(); + + /* Init secure timer */ + rockchip_stimer_init(); + /* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */ + timer_init(); + sdram_init(); /* return to maskrom */ diff --git a/include/configs/rk3036_common.h b/include/configs/rk3036_common.h index f39a272..7d83f81 100644 --- a/include/configs/rk3036_common.h +++ b/include/configs/rk3036_common.h @@ -14,9 +14,9 @@ #define CONFIG_SYS_CBSIZE 1024 #define CONFIG_SKIP_LOWLEVEL_INIT -#define CONFIG_SYS_TIMER_RATE (24 * 1000 * 1000) -#define CONFIG_SYS_TIMER_BASE 0x200440a0 /* TIMER5 */ -#define CONFIG_SYS_TIMER_COUNTER (CONFIG_SYS_TIMER_BASE + 8) +#define COUNTER_FREQUENCY 2400 +#define CONFIG_SYS_ARCH_TIMER +#define CONFIG_SYS_HZ_CLOCK2400 #define CONFIG_SYS_NS16550 #define CONFIG_SYS_NS16550_MEM32 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 6/8] rockchip: rk3288: use ARM arch timer instead of rk_timer
On Wed, 18 Apr 2018, Kever Yang wrote: We prefer to use ARM arch timer instead of rockchip timer, so that we are using the same timer for SPL, U-Boot and Kernel, which will make things simple and easy to track to boot time. Signed-off-by: Kever Yang Same comments as for the other patches apply. Thanks, Philipp. --- arch/arm/mach-rockchip/Makefile | 2 +- arch/arm/mach-rockchip/rk3288-board-spl.c | 18 -- arch/arm/mach-rockchip/rk3288-board-tpl.c | 18 -- include/configs/rk3288_common.h | 6 +++--- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile index 02aa58a..86efd7b 100644 --- a/arch/arm/mach-rockchip/Makefile +++ b/arch/arm/mach-rockchip/Makefile @@ -40,7 +40,7 @@ endif obj-$(CONFIG_$(SPL_TPL_)RAM) += sdram_common.o ifndef CONFIG_ARM64 -ifeq ($(CONFIG_ROCKCHIP_RK3188)$(CONFIG_ROCKCHIP_RK322X)$(CONFIG_ROCKCHIP_RK3036),) +ifeq ($(CONFIG_ROCKCHIP_RK3188)$(CONFIG_ROCKCHIP_RK322X)$(CONFIG_ROCKCHIP_RK3036)$(CONFIG_ROCKCHIP_RK3288),) obj-y += rk_timer.o endif endif diff --git a/arch/arm/mach-rockchip/rk3288-board-spl.c b/arch/arm/mach-rockchip/rk3288-board-spl.c index f3ea624..8f22549 100644 --- a/arch/arm/mach-rockchip/rk3288-board-spl.c +++ b/arch/arm/mach-rockchip/rk3288-board-spl.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -143,6 +142,17 @@ static int phycore_init(void) } #endif +void rockchip_stimer_init(void) +{ + asm volatile("mcr p15, 0, %0, c14, c0, 0" +: : "r"(COUNTER_FREQUENCY)); + + writel(0, CONFIG_ROCKCHIP_STIMER_BASE + 0x10); + writel(0x, CONFIG_ROCKCHIP_STIMER_BASE); + writel(0x, CONFIG_ROCKCHIP_STIMER_BASE + 4); + writel(1, CONFIG_ROCKCHIP_STIMER_BASE + 0x10); +} + void board_init_f(ulong dummy) { struct udevice *pinctrl; @@ -175,7 +185,11 @@ void board_init_f(ulong dummy) hang(); } - rockchip_timer_init(); + /* Init secure timer */ + rockchip_stimer_init(); + /* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */ + timer_init(); + configure_l2ctlr(); ret = rockchip_get_clk(&dev); diff --git a/arch/arm/mach-rockchip/rk3288-board-tpl.c b/arch/arm/mach-rockchip/rk3288-board-tpl.c index 150beea..e34142c 100644 --- a/arch/arm/mach-rockchip/rk3288-board-tpl.c +++ b/arch/arm/mach-rockchip/rk3288-board-tpl.c @@ -17,10 +17,20 @@ #include #include #include -#include DECLARE_GLOBAL_DATA_PTR; +void rockchip_stimer_init(void) +{ + asm volatile("mcr p15, 0, %0, c14, c0, 0" +: : "r"(COUNTER_FREQUENCY)); + + writel(0, CONFIG_ROCKCHIP_STIMER_BASE + 0x10); + writel(0x, CONFIG_ROCKCHIP_STIMER_BASE); + writel(0x, CONFIG_ROCKCHIP_STIMER_BASE + 4); + writel(1, CONFIG_ROCKCHIP_STIMER_BASE + 0x10); +} + #define GRF_BASE0xff77 void board_init_f(ulong dummy) { @@ -51,7 +61,11 @@ void board_init_f(ulong dummy) hang(); } - rockchip_timer_init(); + /* Init secure timer */ + rockchip_stimer_init(); + /* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */ + timer_init(); + configure_l2ctlr(); ret = rockchip_get_clk(&dev); diff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h index 78595b8..98cc9be 100644 --- a/include/configs/rk3288_common.h +++ b/include/configs/rk3288_common.h @@ -15,9 +15,9 @@ #define CONFIG_SYS_MALLOC_LEN (32 << 20) #define CONFIG_SYS_CBSIZE 1024 -#define CONFIG_SYS_TIMER_RATE (24 * 1000 * 1000) -#defineCONFIG_SYS_TIMER_BASE 0xff810020 /* TIMER7 */ -#define CONFIG_SYS_TIMER_COUNTER (CONFIG_SYS_TIMER_BASE + 8) +#define COUNTER_FREQUENCY 2400 +#define CONFIG_SYS_ARCH_TIMER +#define CONFIG_SYS_HZ_CLOCK2400 #define CONFIG_SYS_NS16550_MEM32 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH V2 1/2] ARM: tegra: reserve unmapped RAM so EFI doesn't use it
On 30.08.18 17:45, Stephen Warren wrote: > On 08/30/2018 12:43 AM, Alexander Graf wrote: >> >> >> On 29.08.18 23:52, Heinrich Schuchardt wrote: >>> On 08/29/2018 11:34 PM, Stephen Warren wrote: From: Stephen Warren Tegra U-Boot ensures that board_get_usable_ram_top() never returns a value over 4GB, since some peripherals can't access such addresses. However, on systems with more than 2GB of RAM, RAM bank 1 does describe this extra RAM, so that Linux (or whatever OS) can use it, subject to DMA limitations. Since board_get_usable_ram_top() points at the top of RAM bank 0, the memory locations describes by RAM bank 1 are not mapped by U-Boot's MMU configuration, and so cannot be used for anything. For some completely inexplicable reason, U-Boot's EFI support ignores the value returned by board_get_usable_ram_top(), and EFI memory allocation routines will return values above U-Boot's RAM top. This causes U-Boot to crash when it accesses that RAM, since it isn't mapped by the MMU. One use-case where this happens is TFTP download of a file on Jetson TX1 (p2371-2180). This change explicitly tells the EFI code that this extra RAM should not be used, thus avoiding the crash. A previous attempt to make EFI honor board_get_usable_ram_top() was rejected. So, this patch will need to be replicated for any board that implements board_get_usable_ram_top(). Fixes: aa909462d018 ("efi_loader: efi_allocate_pages is too restrictive") Signed-off-by: Stephen Warren --- v2: - Don't hard-code EFI page size. - Register RAM as a boot services data rather than reserved. --- arch/arm/mach-tegra/board2.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c index 421a71b3014d..f893966140a1 100644 --- a/arch/arm/mach-tegra/board2.c +++ b/arch/arm/mach-tegra/board2.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -210,6 +211,19 @@ int board_early_init_f(void) int board_late_init(void) { +#ifdef CONFIG_EFI_LOADER + if (gd->bd->bi_dram[1].start) { + /* + * Only bank 0 is below board_get_usable_ram_top(), so all of + * bank 1 is not mapped by the U-Boot MMU configuration, and so + * we must prevent EFI from using it. + */ + efi_add_memory_map(gd->bd->bi_dram[1].start, + gd->bd->bi_dram[1].size / EFI_PAGE_SIZE, >>> >>> Are you sure all boards do the division without library function? >>> This is why I prefer >> EFI_PAGE_SHIFT. >>> >>> Compiling SPL fails for harmony_defconfig. >>> >>> LD spl/common/spl/built-in.o >>> arch/arm/mach-tegra/board2.c: In function ‘board_late_init’: >>> arch/arm/mach-tegra/board2.c:221:3: warning: implicit declaration of >>> function ‘efi_add_memory_map’; did you mean ‘fdt_add_mem_rsv’? >>> [-Wimplicit-function-declaration] >>> efi_add_memory_map(gd->bd->bi_dram[1].start, >>> ^~ >>> fdt_add_mem_rsv > > Oh, I figured that warning were errors and only checked that Jenkins > passed, not for warnings in the logs. > >> I think that means you want #if CONFIG_IS_ENABLED(EFI_LOADER) because >> the file is also compiled for SPL. > > That does work, but include/efi_loader.h uses the following, so I think > it makes sense to use the exact same ifdef in the source code: > > #if defined(CONFIG_EFI_LOADER) && !defined(CONFIG_SPL_BUILD) > > Or, should I update the header to use CONFIG_IS_ENABLED too (and hope > that won't break any other boards). Yes, please. I just didn't know about CONFIG_IS_ENABLED() back when I wrote those lines. Alex ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Please pull u-boot-x86
On Thu, Aug 30, 2018 at 11:33:37AM +0800, Bin Meng wrote: > Hi Tom, > > This includes a small x86 efi payload enhancement to support booting > Linux, as well as a clean up on kernel boot protocol setup parameters > to match upstream and avoid confusion. > > The following changes since commit 11ed312896c5f5814064c5d45dcb2f53dc121437: > > configs: am57xx: change default board name to beagle_x15 (2018-08-26 > 12:26:16 -0400) > > are available in the git repository at: > > git://git.denx.de/u-boot-x86.git > > for you to fetch changes up to e69cc6bc42c37598e2fdda421360be6cbc0470fd: > > x86: zimage: Remove acpi_rsdp_addr propagation to kernel boot > parameters (2018-08-30 11:23:15 +0800) > Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PULL] u-boot-sh/master
On Thu, Aug 30, 2018 at 04:11:36PM +0200, Marek Vasut wrote: > The following changes since commit 11ed312896c5f5814064c5d45dcb2f53dc121437: > > configs: am57xx: change default board name to beagle_x15 (2018-08-26 > 12:26:16 -0400) > > are available in the Git repository at: > > git://git.denx.de/u-boot-sh.git master > > for you to fetch changes up to 65186977ee06e0df9a9524fa4b6689af4efecac1: > > mmc: renesas-sdhi: Use priv directly (2018-08-30 15:32:59 +0200) > Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PULL] u-boot-usb/master
On Thu, Aug 30, 2018 at 03:35:19PM +0200, Marek Vasut wrote: > The following changes since commit 11ed312896c5f5814064c5d45dcb2f53dc121437: > > configs: am57xx: change default board name to beagle_x15 (2018-08-26 > 12:26:16 -0400) > > are available in the Git repository at: > > git://git.denx.de/u-boot-usb.git master > > for you to fetch changes up to 88c34b8da62cfb4188ff9a59acb32f88ce9ed1b0: > > usb: dwc2: Add reset ctrl to driver (2018-08-29 03:10:30 +0200) > Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH V3 1/3] efi_loader: simplify ifdefs
From: Stephen Warren Use CONFIG_IS_ENABLED(EFI_LOADER) to avoid explicitly checking CONFIG_SPL too. This simplifies the conditional. Signed-off-by: Stephen Warren --- v3: New patch. --- arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 2 +- arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 2 +- arch/x86/lib/e820.c | 4 ++-- include/efi_loader.h| 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c index 052e0708d454..be00bd55ab68 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c @@ -835,7 +835,7 @@ int dram_init_banksize(void) return 0; } -#if defined(CONFIG_EFI_LOADER) && !defined(CONFIG_SPL_BUILD) +#if CONFIG_IS_ENABLED(EFI_LOADER) void efi_add_known_memory(void) { int i; diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c index fc9de73bcef4..c9c2c3f6d3e8 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c @@ -135,7 +135,7 @@ remove_psci_node: fdt_add_mem_rsv(blob, (uintptr_t)&secondary_boot_code, *boot_code_size); -#if defined(CONFIG_EFI_LOADER) && !defined(CONFIG_SPL_BUILD) +#if CONFIG_IS_ENABLED(EFI_LOADER) efi_add_memory_map((uintptr_t)&secondary_boot_code, ALIGN(*boot_code_size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT, EFI_RESERVED_MEMORY_TYPE, false); diff --git a/arch/x86/lib/e820.c b/arch/x86/lib/e820.c index 8b34f677d96d..d6ae2c4e9d77 100644 --- a/arch/x86/lib/e820.c +++ b/arch/x86/lib/e820.c @@ -36,7 +36,7 @@ __weak unsigned int install_e820_map(unsigned int max_entries, return 4; } -#if defined(CONFIG_EFI_LOADER) && !defined(CONFIG_SPL_BUILD) +#if CONFIG_IS_ENABLED(EFI_LOADER) void efi_add_known_memory(void) { struct e820_entry e820[E820MAX]; @@ -72,4 +72,4 @@ void efi_add_known_memory(void) efi_add_memory_map(start, pages, type, false); } } -#endif /* defined(EFI_LOADER) && !defined(CONFIG_SPL_BUILD) */ +#endif /* CONFIG_IS_ENABLED(EFI_LOADER) */ diff --git a/include/efi_loader.h b/include/efi_loader.h index f162adfff7e2..b46babf9316f 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -13,7 +13,7 @@ #include /* No need for efi loader support in SPL */ -#if defined(CONFIG_EFI_LOADER) && !defined(CONFIG_SPL_BUILD) +#if CONFIG_IS_ENABLED(EFI_LOADER) #include @@ -460,7 +460,7 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name, efi_guid_t *vendor, void *efi_bootmgr_load(struct efi_device_path **device_path, struct efi_device_path **file_path); -#else /* defined(EFI_LOADER) && !defined(CONFIG_SPL_BUILD) */ +#else /* CONFIG_IS_ENABLED(EFI_LOADER) */ /* Without CONFIG_EFI_LOADER we don't have a runtime section, stub it out */ #define __efi_runtime_data @@ -477,6 +477,6 @@ static inline void efi_set_bootdev(const char *dev, const char *devnr, static inline void efi_net_set_dhcp_ack(void *pkt, int len) { } static inline void efi_print_image_infos(void *pc) { } -#endif /* CONFIG_EFI_LOADER && !CONFIG_SPL_BUILD */ +#endif /* CONFIG_IS_ENABLED(EFI_LOADER) */ #endif /* _EFI_LOADER_H */ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH V3 2/3] ARM: tegra: reserve unmapped RAM so EFI doesn't use it
From: Stephen Warren Tegra U-Boot ensures that board_get_usable_ram_top() never returns a value over 4GB, since some peripherals can't access such addresses. However, on systems with more than 2GB of RAM, RAM bank 1 does describe this extra RAM, so that Linux (or whatever OS) can use it, subject to DMA limitations. Since board_get_usable_ram_top() points at the top of RAM bank 0, the memory locations describes by RAM bank 1 are not mapped by U-Boot's MMU configuration, and so cannot be used for anything. For some completely inexplicable reason, U-Boot's EFI support ignores the value returned by board_get_usable_ram_top(), and EFI memory allocation routines will return values above U-Boot's RAM top. This causes U-Boot to crash when it accesses that RAM, since it isn't mapped by the MMU. One use-case where this happens is TFTP download of a file on Jetson TX1 (p2371-2180). This change explicitly tells the EFI code that this extra RAM should not be used, thus avoiding the crash. A previous attempt to make EFI honor board_get_usable_ram_top() was rejected. So, this patch will need to be replicated for any board that implements board_get_usable_ram_top(). Fixes: aa909462d018 ("efi_loader: efi_allocate_pages is too restrictive") Signed-off-by: Stephen Warren --- v3: - Use shift not divide for page count calculation. - Enhance ifdef to avoid EFI references from SPL builds. v2: - Don't hard-code EFI page size. - Register RAM as a boot services data rather than reserved. --- arch/arm/mach-tegra/board2.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c index 421a71b3014d..12257a42b51b 100644 --- a/arch/arm/mach-tegra/board2.c +++ b/arch/arm/mach-tegra/board2.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -210,6 +211,19 @@ int board_early_init_f(void) int board_late_init(void) { +#if CONFIG_IS_ENABLED(EFI_LOADER) + if (gd->bd->bi_dram[1].start) { + /* +* Only bank 0 is below board_get_usable_ram_top(), so all of +* bank 1 is not mapped by the U-Boot MMU configuration, and so +* we must prevent EFI from using it. +*/ + efi_add_memory_map(gd->bd->bi_dram[1].start, + gd->bd->bi_dram[1].size >> EFI_PAGE_SHIFT, + EFI_BOOT_SERVICES_DATA, false); + } +#endif + #if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE) if (tegra_cpu_is_non_secure()) { printf("CPU is in NS mode\n"); -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH V3 3/3] Revert "Revert "efi_loader: efi_allocate_pages is too restrictive""
From: Stephen Warren This reverts commit ccfc78b820e5e431c5bd73b072e7536a972e1710. Now that the underlying issue is fixed, we can revert the revert and hence restore the original EFI code. Signed-off-by: Stephen Warren --- v3: No change. v2: No change. --- lib/efi_loader/efi_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index e2b40aa85b5a..e902d5a280bb 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -304,7 +304,7 @@ efi_status_t efi_allocate_pages(int type, int memory_type, switch (type) { case EFI_ALLOCATE_ANY_PAGES: /* Any page */ - addr = efi_find_free_memory(len, gd->start_addr_sp); + addr = efi_find_free_memory(len, -1ULL); if (!addr) { r = EFI_NOT_FOUND; break; -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v6 1/8] dm: mmc: use block layer in mmc driver
Hi York, My v8 version patch could you give me some advice? Some sata patch need rely on it to upstream, so if no other issue, could you help me merge it to upstream code Thanks Best Regards, Yinbo Zhu -Original Message- From: Yinbo Zhu Sent: 2018年8月23日 11:10 To: York Sun ; Y.b. Lu ; u-boot@lists.denx.de Cc: Xiaobo Xie ; Andy Tang ; Peng Ma Subject: RE: [PATCH v6 1/8] dm: mmc: use block layer in mmc driver -Original Message- From: York Sun Sent: 2018年8月15日 22:58 To: Yinbo Zhu ; Y.b. Lu ; u-boot@lists.denx.de Cc: Xiaobo Xie ; Andy Tang ; Peng Ma Subject: Re: [PATCH v6 1/8] dm: mmc: use block layer in mmc driver First of all, your subject is wrong. You are not making any change to dm or mmc. On 08/13/2018 12:09 AM, Yinbo Zhu wrote: > At present the MMC subsystem maintains its own list of MMC devices. > This cannot work with driver model when CONFIG_BLK is enabled, use > blk_dread to replace previous mmc read interface, use mmc_get_blk_desc > to get the mmc device property > > Signed-off-by: Yinbo Zhu > --- > Change in v6: > remove block layer in mmc_legacy. > > arch/arm/cpu/armv8/fsl-layerscape/ppa.c |5 ++--- >You didn't replace all. If you compiled all targets, you would see >errors on secure boot targets. Please fix >and test _ALL_ targets before sending another version. >York >Hi York, >I had tested all targets, for 1088 sd secure boot, upstream code has a >original issue, need upstream to >cover it other targets that I had tested okay, I will send it to upstream as >v7 version. >Thanks, >Best Regards, >Yinbo Zhu. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v6 1/8] dm: mmc: use block layer in mmc driver
Cannot merge at this moment. It has to wait for next merge window. York York From: Yinbo Zhu Sent: Thursday, August 30, 2018 19:44 To: York Sun; Y.b. Lu; u-boot@lists.denx.de Cc: Xiaobo Xie; Andy Tang; Peng Ma Subject: RE: [PATCH v6 1/8] dm: mmc: use block layer in mmc driver Hi York, My v8 version patch could you give me some advice? Some sata patch need rely on it to upstream, so if no other issue, could you help me merge it to upstream code Thanks Best Regards, Yinbo Zhu -Original Message- From: Yinbo Zhu Sent: 2018年8月23日 11:10 To: York Sun ; Y.b. Lu ; u-boot@lists.denx.de Cc: Xiaobo Xie ; Andy Tang ; Peng Ma Subject: RE: [PATCH v6 1/8] dm: mmc: use block layer in mmc driver -Original Message- From: York Sun Sent: 2018年8月15日 22:58 To: Yinbo Zhu ; Y.b. Lu ; u-boot@lists.denx.de Cc: Xiaobo Xie ; Andy Tang ; Peng Ma Subject: Re: [PATCH v6 1/8] dm: mmc: use block layer in mmc driver First of all, your subject is wrong. You are not making any change to dm or mmc. On 08/13/2018 12:09 AM, Yinbo Zhu wrote: > At present the MMC subsystem maintains its own list of MMC devices. > This cannot work with driver model when CONFIG_BLK is enabled, use > blk_dread to replace previous mmc read interface, use mmc_get_blk_desc > to get the mmc device property > > Signed-off-by: Yinbo Zhu > --- > Change in v6: > remove block layer in mmc_legacy. > > arch/arm/cpu/armv8/fsl-layerscape/ppa.c | 5 ++--- >You didn't replace all. If you compiled all targets, you would see >errors on secure boot targets. Please fix >and test _ALL_ targets before sending another version. >York >Hi York, >I had tested all targets, for 1088 sd secure boot, upstream code has a >original issue, need upstream to >cover it other targets that I had tested okay, I will send it to upstream as >v7 version. >Thanks, >Best Regards, >Yinbo Zhu. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 3/8] binman: Add a new "skip-at-start" property in Section class
Hi, > -Original Message- > From: s...@google.com On Behalf Of Simon Glass > Sent: Thursday, August 30, 2018 8:21 AM > To: Jagdish Gediya > Cc: U-Boot Mailing List ; Prabhakar Kushwaha > ; York Sun ; Poonam > Aggrwal ; Bin Meng ; > Tom Rini > Subject: Re: [PATCH v2 3/8] binman: Add a new "skip-at-start" property in > Section class > > Hi, > > On 28 August 2018 at 08:49, Jagdish Gediya > wrote: > > > > Currently binman calculates '_skip_at_start' based on 'end-at-4gb' > > property and it is used for x86 images. > > > > For Powerpc mpc85xx based CPU, CONFIG_SYS_TEXT_BASE is the first entry > > offset which can be 0xeff4 or 0xfff4 for nor flash boot, > > 0x201000 for sd boot etc, so "_skip_at_start" should be set to > > CONFIG_SYS_TEXT_BASE. > > > > 'end-at-4gb' property is not applicable where CONFIG_SYS_TEXT_BASE + > > Image size != 4gb. > > > > Add new property "skip-at-start" in Section class so that > > '_skip_at_start' can be calculated either based on "end-at-4gb" > > or based on "skip-at-start". > > > > Signed-off-by: Jagdish Gediya > > --- > > Changes for v2: > > - Renamed 'start-pos' property to 'skip-at-start' > > - Updated README > > > > tools/binman/README | 9 + > > tools/binman/bsection.py | 1 + > > 2 files changed, 10 insertions(+) > > > > Please add a test for this feature. You will need to add a new numbered dts > in tools/binman/tests and test in ftest.py > > > diff --git a/tools/binman/README b/tools/binman/README index > > cb34171..7b4bf2e 100644 > > --- a/tools/binman/README > > +++ b/tools/binman/README > > @@ -397,6 +397,15 @@ end-at-4gb: > > 8MB ROM, the offset of the first entry would be 0xfff8 with > > this option, instead of 0 without this option. > > > > +skip-at-start: > > + This property specifies the first entry offset if not 0. > > + > > + For Powerpc Book-E architecture, CONFIG_SYS_TEXT_BASE is the first > > + entry offset which can be 0xeff4 or 0xfff4 for nor flash > > boot, > > + 0x201000 for sd boot etc. > > Can you say 'entry offset of the first entry. It can be ...'. I think it is > clearer. > > > + > > + 'end-at-4gb' property is not applicable where CONFIG_SYS_TEXT_BASE > + > > + Image size != 4gb. > > > > Examples of the above options can be found in the tests. See the > > tools/binman/test directory. > > diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py index > > a0bd1b6..68997b7 100644 > > --- a/tools/binman/bsection.py > > +++ b/tools/binman/bsection.py > > @@ -79,6 +79,7 @@ class Section(object): > > self._pad_byte = fdt_util.GetInt(self._node, 'pad-byte', 0) > > self._sort = fdt_util.GetBool(self._node, 'sort-by-offset') > > self._end_4gb = fdt_util.GetBool(self._node, 'end-at-4gb') > > +self._skip_at_start = fdt_util.GetInt(self._node, > > + 'skip-at-start', 0) > > This is a bit pedantic, but... > > I think this needs to drop the '0' default value. Also in the __init__ > constructor, set _skip_at_start to None > > > if self._end_4gb and not self._size: > > self._Raise("Section size must be provided when using > > end-at-4gb") > > if self._end_4gb: > > ...here you need to check that self._skip_at_start is None, so people don't > set > both properties. Then set it to 0 if not set and not end_4gb. Something like: > > if self._end_4gb: >if if self._skip_at_start is not None: > self.Raise... >self._skip_at_start = 0x1 - self._size > else: >self._skip_at_start = 0 > > Does that make sense? This needs a test too... I think it should be checked that self._skip_at_start is None before setting it to 0 in else part. What's your opinion on below implementation? self._end_4gb = fdt_util.GetBool(self._node, 'end-at-4gb') self._skip_at_start = fdt_util.GetInt(self._node, 'skip-at-start') if self._end_4gb: if not self._size: self._Raise("Section size must be provided when using end-at-4gb") if self._skip_at_start is not None: self._Raise("Provide either 'end-at-4gb' or 'skip-at-start'") else: self._skip_at_start = 0x1 - self._size else: if self._skip_at_start is None: self._skip_at_start = 0 Thanks, Jagdish ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 6/8] powerpc: mpc85xx: Use binman to embed dtb inside u-boot
Hi, > -Original Message- > From: Bin Meng > Sent: Tuesday, August 28, 2018 2:47 PM > To: Jagdish Gediya > Cc: U-Boot Mailing List ; Prabhakar Kushwaha > ; York Sun ; Poonam > Aggrwal ; Simon Glass ; > Tom Rini > Subject: Re: [PATCH v2 6/8] powerpc: mpc85xx: Use binman to embed dtb > inside u-boot > > On Tue, Aug 28, 2018 at 11:53 AM Jagdish Gediya > wrote: > > > > Below is the sequence to embed dtb inside u-boot, > > nits: U-Boot > > > 1. Remove bootpg and resetvec section if needed 2. Append dtb 3. > > Append bootpg and resetvec section back if removed in step 1 > > > > Above procedure is required only when CONFIG_MPC85xx and > > CONFIG_OF_SEPARATE are defined. > > > > Add new config CONFIG_MPC85XX_HAVE_RESET_VECTOR to indicate that > image > > have resetvec section. step 1 and step 3 described above are > > have -> has. step 1 -> Step 1 > > > required only if this config is y. > > > > Signed-off-by: Jagdish Gediya > > --- > > Changes for v2: > > - Don't change the generic target > > - Add new config option to use binman > > > > Makefile | 23 ++- > > arch/powerpc/cpu/mpc85xx/Kconfig | 4 > > 2 files changed, 26 insertions(+), 1 deletion(-) > > > > diff --git a/Makefile b/Makefile > > index b5bf8ab..03baa74 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -861,6 +861,10 @@ ifneq ($(CONFIG_SYS_INIT_SP_BSS_OFFSET),) > > ALL-y += init_sp_bss_offset_check > > endif > > > > +ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) > > +ALL-y += u-boot-with-dtb.bin > > +endif > > + > > LDFLAGS_u-boot += $(LDFLAGS_FINAL) > > > > # Avoid 'Not enough room for program headers' error on binutils 2.28 > onwards. > > @@ -983,7 +987,8 @@ spl/u-boot-spl.srec: spl/u-boot-spl FORCE > > $(call if_changed,objcopy) > > > > OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \ > > - $(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) > > + $(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \ > > + $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),-R .bootpg -R > > + .resetvec) > > > > binary_size_check: u-boot-nodtb.bin FORCE > > @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') > > ; \ @@ -1202,6 +1207,18 @@ u-boot-with-spl.sfp: spl/u-boot-spl.sfp u- > boot.img FORCE > > $(call if_changed,socboot) > > endif > > > > +ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) > > This looks odd. Both CONFIG_OF_SEPARATE and CONFIG_OF_EMBED should > be supported by binman. Entry type 'u-boot-dtb-with-ucode' requires file 'u-boot.dtb' which is built only for CONFIG_OF_SEPARATE. > > +u-boot-with-dtb.bin: u-boot.bin u-boot.dtb \ > > + $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR), u-boot-br.bin) > FORCE > > + $(call if_changed,binman) > > + > > +ifeq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR),y) > > +OBJCOPYFLAGS_u-boot-br.bin := -O binary -j .bootpg -j .resetvec > > +u-boot-br.bin: u-boot FORCE > > + $(call if_changed,objcopy) > > +endif > > +endif > > + > > # x86 uses a large ROM. We fill it with 0xff, put the 16-bit stuff > > (including # reset vector) at the top, Intel ME descriptor at the > > bottom, and U-Boot in # the middle. This is handled by binman based > > on an image description in the @@ -1296,8 +1313,12 @@ > > spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE ifeq ($(ARCH),arm) > > UBOOT_BINLOAD := u-boot.img else > > +ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) > > +UBOOT_BINLOAD := u-boot-with-dtb.bin > > +else > > UBOOT_BINLOAD := u-boot.bin > > endif > > +endif > > > > OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O binary --pad- > to=$(CONFIG_SPL_PAD_TO) \ > > --gap-fill=0xff diff --git > > a/arch/powerpc/cpu/mpc85xx/Kconfig > b/arch/powerpc/cpu/mpc85xx/Kconfig > > index 19e8d02..7d139ff 100644 > > --- a/arch/powerpc/cpu/mpc85xx/Kconfig > > +++ b/arch/powerpc/cpu/mpc85xx/Kconfig > > @@ -1143,6 +1143,10 @@ config ARCH_T4240 > > imply CMD_REGINFO > > imply FSL_SATA > > > > +config MPC85XX_HAVE_RESET_VECTOR > > + bool "Indicate reset vector at CONFIG_RESET_VECTOR_ADDRESS - > 0xffc" > > I don't think you want people to turn this option on and off, no? You > probably need move the "string" to the help paragraph. This option need to be turned on/off. Only NOR boot have the reset vector and bootpg section at CONFIG_RESET_VECTOR_ADDRESS - 0xffc. Other boot do not have the reset vector but they have the bootpg section at some other address where it don't need to be removed and joined. This option indicates that reset vector and bootpg sections are placed at CONFIG_RESET_VECTOR_ADDRESS - 0xffc and it need to be turned on/off according to boot device. > > + depends on MPC85xx > > + > > config BOOKE > > bool > > default y > > -- > > Regards, > Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH V5 00/31] imx: add i.MX8M support and i.MX8MQ EVK
On Mon, Jan 22, 2018 at 2:04 PM Diego Dorta wrote: > > Hi Peng, > > 2018-01-10 3:20 GMT-02:00 Peng Fan : > > This patchset is to add i.MX8M and i.MX8MQ-EVK support > > > > V5: > > Drop wait_mask_set/clr_timeout and switch to use readl_poll_timeout in > > the patchset. > > > > V4: > > Regenerate patchset based on Tom's master tree. > > In this patchset, https://patchwork.ozlabs.org/patch/855027/ > > "arm: imx: Rework i.MX specific commands to be excluded from SPL" from > > Tom is included to avoid merge conflicts because the i.mx8m change > > also has some modification to bootaux and arch/arm/mach-imx/Makefile. > > Because CONFIG_GPT_TIMER change, I did a small modification to apply > > Tom's patch, no function change. > > > > Include ATF link in README. > > > > V3: > > This patchset based on https://patchwork.ozlabs.org/patch/855027/ > > "arm: imx: Rework i.MX specific commands to be excluded from SPL" from > > Tom to avoid this patchset fail apply after Tom's patch merged. > > > > Previously "power: pmic/regulator allow dm be omited by SPL" broke other > > boards, in V3 patchset, only touch pfuze100 related options. > > > > Sharing code about get mac from fuse between mx7/mx8m > > Sharing code about bootaux between mx6/7/mx8m > > Sharing code about cpu speed grade between mx7/mx8m > > Sharing code about get boot device between mx7/mx8m > > Sharding code about mmc env between mx7/mx8m > > > > Introduce wait_mask_set/clr_timeout to avoid deadloop in clock pll > > configuration > > > > Correct authorship of fix building warning on fec arm64, patch 27/31. > > > > Switch to use structure for DDR Controller. For DDR PHY registers, > > there are about more than 10 thousands registers, I could not convert > > them with detailed register name, and the script is generated from IC team, > > So I use regs[0x] arrays here fo easily converting between IC team > > released script and uboot ddr phy cod. > > > > Improve REAMME file to include where to download firmware and imx-mkimage > > and how to build > > > > Add review tags on the V2 patchset. > > > > Hope this patchset could catch up next release :) > > > > V2: > > > > patch 02/23: convert to structure, drop is_boot_from_usb and > > disconnect_from_usb > > patch 04/23: conver to use structure for the clock driver, removed the > > CCM_xxx macros. Add static for local functons. > > Add init_usdhc_clk, init_uart_clk and etc to not enable > > them all at default. > > patch 05/23: Add more commit msg for the sip part. > > patch 08/23: Merge the spl boot device with i.MX7 > > patch 12/23: Typo fix and return error fix from Heiko for the SoC related > > part > > patch 22/23: Use a weak function ddr_init. If patch 23/23 could not be > > accepted at current stage, to make others still be could be > > compiled. > > > > The patchset depends on > > https://patchwork.ozlabs.org/patch/841934/ > > https://patchwork.ozlabs.org/patch/841958/ > > to be tested on real hardware. > > > > V1: > > > > patch: "power: pmic.h: include dm/ofnode.h" and > > "power: pmic/regulator allow dm be omited by SPL" is previously reviewed > > in mailist to not merged. If no issue, you may pick it up. > > > > The board support is a large patch because of the ddr related code. > > If it is not good, please first review/pick-up other patches if they > > are ok. > > > > > > > > Peng Fan (29): > > imx: add i.MX8M into Kconfig > > imx: mx8m: add register definition header file > > imx: mx8m: add pin header file > > imx: mx8m: add clock driver > > imx: add sip function > > imx: boot_mode: add USB_BOOT entry > > imx: cpu: update cpu file to support i.MX8M > > imx: spl: implement spl_boot_device for i.MX8M > > imx: add i.MX8MQ SoC Revision and is_mx8m helper > > imx: add pad settings bit definition for i.MX8M > > imx: cpu: move speed/temp to common cpu > > imx: cpu: add cpu speed/grade for i.MX8M > > imx: refactor imx_get_mac_from_fuse > > imx: cleanup bootaux > > imx: bootaux: support i.MX8M > > imx: mx7: move get_boot_device to cpu.c > > imx: cpu: support get_boot_device for i.MX8M > > imx: mx7: move mmc env code to mmc_env.c > > imx: mx8m: add soc related settings and files > > imx: makefile: compile files for i.MX8M > > misc: ocotp: add i.MX8M support > > mmc: fsl_esdhc: support i.MX8M > > imx: lcdif: include i.MX8M > > gpio: mxc: add i.MX8M support > > net: fec: do not access reserved register for i.MX8M > > imx: imx8mq: add dtsi file > > power: pmic/regulator allow dm be omitted by SPL > > imx: mx8m: add ddr controller memory map > > imx: add i.MX8MQ EVK support > > > > Tom Rini (1): > > arm: imx: Rework i.MX specific commands to be excluded from SPL > > > > Ye Li (1): > > net: fec: fix build warnings for 64bits support > > > > I was able to run your patchset on my board. > > For the whole series: > > Tested-by: Diego D