From 23dc815c50e73272502a9e1406c2019b59b043b7 Mon Sep 17 00:00:00 2001 From: Neil Armstrong Date: Tue, 16 Aug 2022 11:58:08 +0200 Subject: [PATCH 01/12] MAINTAINERS: Update email of Neil Armstrong My professional e-mail will change and the BayLibre one will bounce after mid-september of 2022. This updates the MAINTAINERS files and adds an entry in the .mailmap file. Signed-off-by: Neil Armstrong --- .mailmap | 1 + MAINTAINERS | 2 +- board/amlogic/odroid-n2/MAINTAINERS | 2 +- board/amlogic/p200/MAINTAINERS | 2 +- board/amlogic/p201/MAINTAINERS | 2 +- board/amlogic/p212/MAINTAINERS | 2 +- board/amlogic/q200/MAINTAINERS | 2 +- board/amlogic/s400/MAINTAINERS | 2 +- board/amlogic/sei510/MAINTAINERS | 2 +- board/amlogic/sei610/MAINTAINERS | 2 +- board/amlogic/u200/MAINTAINERS | 2 +- board/amlogic/vim3/MAINTAINERS | 2 +- board/amlogic/w400/MAINTAINERS | 2 +- 13 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.mailmap b/.mailmap index f27f366bcb..8acce4b2bf 100644 --- a/.mailmap +++ b/.mailmap @@ -49,6 +49,7 @@ Michal Simek Michal Simek Michal Simek Michal Simek +Neil Armstrong Nicolas Saenz Julienne Patrice Chotard Patrick Delaunay diff --git a/MAINTAINERS b/MAINTAINERS index 5857fbf398..36a2b69fcb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -143,7 +143,7 @@ F: arch/arm/mach-socfpga/ F: drivers/sysreset/sysreset_socfpga* ARM AMLOGIC SOC SUPPORT -M: Neil Armstrong +M: Neil Armstrong S: Maintained L: u-boot-amlogic@groups.io T: git https://source.denx.de/u-boot/custodians/u-boot-amlogic.git diff --git a/board/amlogic/odroid-n2/MAINTAINERS b/board/amlogic/odroid-n2/MAINTAINERS index 43724e6fdd..23cc8e73b1 100644 --- a/board/amlogic/odroid-n2/MAINTAINERS +++ b/board/amlogic/odroid-n2/MAINTAINERS @@ -1,5 +1,5 @@ ODROID-N2 -M: Neil Armstrong +M: Neil Armstrong S: Maintained L: u-boot-amlogic@groups.io F: board/amlogic/odroid-n2/ diff --git a/board/amlogic/p200/MAINTAINERS b/board/amlogic/p200/MAINTAINERS index 1df9b8b24b..33ca3df5c6 100644 --- a/board/amlogic/p200/MAINTAINERS +++ b/board/amlogic/p200/MAINTAINERS @@ -1,6 +1,6 @@ P200 M: Beniamino Galvani -M: Neil Armstrong +M: Neil Armstrong S: Maintained L: u-boot-amlogic@groups.io F: board/amlogic/p200/ diff --git a/board/amlogic/p201/MAINTAINERS b/board/amlogic/p201/MAINTAINERS index 1501b6280d..4549d01cad 100644 --- a/board/amlogic/p201/MAINTAINERS +++ b/board/amlogic/p201/MAINTAINERS @@ -1,5 +1,5 @@ P201 -M: Neil Armstrong +M: Neil Armstrong S: Maintained L: u-boot-amlogic@groups.io F: board/amlogic/p201/ diff --git a/board/amlogic/p212/MAINTAINERS b/board/amlogic/p212/MAINTAINERS index 3d622af29b..b2e3205fdf 100644 --- a/board/amlogic/p212/MAINTAINERS +++ b/board/amlogic/p212/MAINTAINERS @@ -1,5 +1,5 @@ P212 -M: Neil Armstrong +M: Neil Armstrong S: Maintained L: u-boot-amlogic@groups.io F: board/amlogic/p212/ diff --git a/board/amlogic/q200/MAINTAINERS b/board/amlogic/q200/MAINTAINERS index ba7c12b2c1..9c84cca27e 100644 --- a/board/amlogic/q200/MAINTAINERS +++ b/board/amlogic/q200/MAINTAINERS @@ -1,5 +1,5 @@ Q200 -M: Neil Armstrong +M: Neil Armstrong S: Maintained L: u-boot-amlogic@groups.io F: board/amlogic/q200/ diff --git a/board/amlogic/s400/MAINTAINERS b/board/amlogic/s400/MAINTAINERS index fb46b1bbbf..ca51bb6b3b 100644 --- a/board/amlogic/s400/MAINTAINERS +++ b/board/amlogic/s400/MAINTAINERS @@ -1,5 +1,5 @@ S400 -M: Neil Armstrong +M: Neil Armstrong S: Maintained L: u-boot-amlogic@groups.io F: board/amlogic/s400/ diff --git a/board/amlogic/sei510/MAINTAINERS b/board/amlogic/sei510/MAINTAINERS index c01c1d60df..c6039bc82e 100644 --- a/board/amlogic/sei510/MAINTAINERS +++ b/board/amlogic/sei510/MAINTAINERS @@ -1,5 +1,5 @@ SEI510 -M: Neil Armstrong +M: Neil Armstrong S: Maintained L: u-boot-amlogic@groups.io F: board/amlogic/sei510/ diff --git a/board/amlogic/sei610/MAINTAINERS b/board/amlogic/sei610/MAINTAINERS index 092178b2c8..799ad687f0 100644 --- a/board/amlogic/sei610/MAINTAINERS +++ b/board/amlogic/sei610/MAINTAINERS @@ -1,5 +1,5 @@ SEI610 -M: Neil Armstrong +M: Neil Armstrong S: Maintained L: u-boot-amlogic@groups.io F: board/amlogic/sei610/ diff --git a/board/amlogic/u200/MAINTAINERS b/board/amlogic/u200/MAINTAINERS index a259d12886..47cec234a1 100644 --- a/board/amlogic/u200/MAINTAINERS +++ b/board/amlogic/u200/MAINTAINERS @@ -1,5 +1,5 @@ U200 -M: Neil Armstrong +M: Neil Armstrong S: Maintained L: u-boot-amlogic@groups.io F: board/amlogic/u200/ diff --git a/board/amlogic/vim3/MAINTAINERS b/board/amlogic/vim3/MAINTAINERS index d8848495c7..c5f8d9cc5c 100644 --- a/board/amlogic/vim3/MAINTAINERS +++ b/board/amlogic/vim3/MAINTAINERS @@ -1,5 +1,5 @@ VIM3 -M: Neil Armstrong +M: Neil Armstrong S: Maintained L: u-boot-amlogic@groups.io F: board/amlogic/vim3/ diff --git a/board/amlogic/w400/MAINTAINERS b/board/amlogic/w400/MAINTAINERS index 991590d9f2..96ccda2001 100644 --- a/board/amlogic/w400/MAINTAINERS +++ b/board/amlogic/w400/MAINTAINERS @@ -1,5 +1,5 @@ W400 -M: Neil Armstrong +M: Neil Armstrong S: Maintained L: u-boot-amlogic@groups.io F: board/amlogic/w400/ From 012d4be439a888b96681ed2443aeac398adca15d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 11 Aug 2022 22:29:03 +0200 Subject: [PATCH 02/12] arm: Set default MACH_TYPE in Kconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For boards which requires correct MACH_TYPE, set their correct default values directly in Kconfig. Signed-off-by: Pali Rohár --- arch/arm/Kconfig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 949ebb46ba..0b72e4f650 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -2126,6 +2126,7 @@ config SERIAL_TAG config STATIC_MACH_TYPE bool "Statically define the Machine ID number" + default y if TARGET_DS109 || TARGET_NOKIA_RX51 || TARGET_DS414 || DEFAULT_DEVICE_TREE = "sun7i-a20-icnova-swac" help When booting via ATAGs, enable this option if we know the correct machine ID number to use at compile time. Some systems will be @@ -2134,6 +2135,10 @@ config STATIC_MACH_TYPE config MACH_TYPE int "Machine ID number" depends on STATIC_MACH_TYPE + default 527 if TARGET_DS109 + default 1955 if TARGET_NOKIA_RX51 + default 3036 if TARGET_DS414 + default 4283 if DEFAULT_DEVICE_TREE = "sun7i-a20-icnova-swac" help When booting via ATAGs, the machine type must be passed as a number. For the full list see https://www.arm.linux.org.uk/developer/machines From 7c4ad9821758f98db127e9d6864671c906c02d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 11 Aug 2022 22:27:21 +0200 Subject: [PATCH 03/12] Nokia RX-51: Fix invalidating zImage kernel format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prior starting copy of kernel image to target location, invalidate also zImage magic header. This ensures that on target location would be image with valid header only in the case valid header was also in the source location and copy from source to target finished successfully. Copy is always skipped when kernel image in source location is invalid. Add also comment to the code which explain what is the code doing. Fixes: cc434fccba4c ("Nokia RX-51: Add support for booting kernel in zImage format") Signed-off-by: Pali Rohár --- board/nokia/rx51/lowlevel_init.S | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S index 11c2cbef89..632595f837 100644 --- a/board/nokia/rx51/lowlevel_init.S +++ b/board/nokia/rx51/lowlevel_init.S @@ -72,7 +72,8 @@ copy_kernel_start: /* remove header in target kernel */ mov r5, #0 - str r5, [r3] + str r5, [r3] /* remove 4 bytes header of kernel uImage */ + str r5, [r3, #36] /* remove 4 bytes header of kernel zImage */ /* check for valid kernel uImage */ ldr r4, [r0] /* r4 - 4 bytes header of kernel */ @@ -93,6 +94,8 @@ copy_kernel_loop: bhi copy_kernel_loop copy_kernel_end: + + /* remove header in source kernel image */ mov r5, #0 str r5, [r0] /* remove 4 bytes header of kernel uImage */ str r5, [r0, #36] /* remove 4 bytes header of kernel zImage */ From c5be5f6f54893bce9b5f3e8e4b35e38c923fc069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 11 Aug 2022 22:27:22 +0200 Subject: [PATCH 04/12] Nokia RX-51: Use U-Boot generic position independent code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switch from custom board specific fixup/copy code to U-Boot generic position independent code provided by config option POSITION_INDEPENDENT. This also slightly decrease size of u-boot.bin binary (by 52 bytes). Note that option POSITION_INDEPENDENT increase size but not more than custom board fixup/copy code which is being deleted (as it is not needed anymore). Signed-off-by: Pali Rohár --- arch/arm/mach-omap2/omap3/Kconfig | 1 + board/nokia/rx51/lowlevel_init.S | 127 ++++-------------------------- configs/nokia_rx51_defconfig | 1 - 3 files changed, 16 insertions(+), 113 deletions(-) diff --git a/arch/arm/mach-omap2/omap3/Kconfig b/arch/arm/mach-omap2/omap3/Kconfig index 81c898b66e..18574ab2b2 100644 --- a/arch/arm/mach-omap2/omap3/Kconfig +++ b/arch/arm/mach-omap2/omap3/Kconfig @@ -107,6 +107,7 @@ config TARGET_OMAP3_LOGIC config TARGET_NOKIA_RX51 bool "Nokia RX51" + select POSITION_INDEPENDENT config TARGET_TAO3530 bool "TAO3530" diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S index 632595f837..dd3c830cc2 100644 --- a/board/nokia/rx51/lowlevel_init.S +++ b/board/nokia/rx51/lowlevel_init.S @@ -33,16 +33,24 @@ z_magic: /* LINUX_ARM_ZIMAGE_MAGIC */ /* * Routine: save_boot_params (called after reset from start.S) * Description: Copy attached kernel to address KERNEL_ADDRESS - * Copy u-boot to address CONFIG_SYS_TEXT_BASE - * Return to copied u-boot address */ .global save_boot_params save_boot_params: - /* Get return address */ - ldr lr, =save_boot_params_ret -/* Copy valid attached kernel to address KERNEL_ADDRESS */ +/* + * Copy valid attached kernel to absolute address KERNEL_ADDRESS + * + * Nokia X-Loader is loading secondary image to address 0x80400000. + * NOLO is loading boot image to random place, so it doesn't really + * matter what is set in CONFIG_SYS_TEXT_BASE. We have to detect + * KERNEL_OFFSET from the current execution address and copy it to + * absolute address KERNEL_ADDRESS. + * + * Note that U-Boot has to be compiled with CONFIG_POSITION_INDEPENDENT + * because it is loaded at random address and not to the fixed address + * (CONFIG_SYS_TEXT_BASE). + */ copy_kernel_start: adr r0, relocaddr /* r0 - address of section relocaddr */ @@ -100,110 +108,5 @@ copy_kernel_end: str r5, [r0] /* remove 4 bytes header of kernel uImage */ str r5, [r0, #36] /* remove 4 bytes header of kernel zImage */ - -/* Fix u-boot code */ - -fix_start: - adr r0, relocaddr /* r0 - address of section relocaddr */ - ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ - cmp r0, r1 - - beq copy_uboot_end /* skip if u-boot is on correct address */ - - /* r5 - calculated offset */ - subhi r5, r0, r1 - sublo r5, r1, r0 - - /* r6 - maximal u-boot size */ - ldr r6, imagesize - - /* r1 - start of u-boot after */ - ldr r1, startaddr - - /* r0 - start of u-boot before */ - addhi r0, r1, r5 - sublo r0, r1, r5 - - /* check if we need to move uboot copy code before calling it */ - cmp r5, r6 - bhi copy_uboot_start /* now coping u-boot code directly is safe */ - - -copy_code_start: - /* r0 - start of u-boot before */ - /* r1 - start of u-boot after */ - /* r6 - maximal u-boot size */ - - /* r7 - maximal kernel size */ - ldr r7, kernsize - - /* r4 - end of kernel before */ - add r4, r0, r6 - add r4, r4, r7 - - /* r5 - end of u-boot after */ - ldr r5, startaddr - add r5, r5, r6 - - /* r2 - start of loop code after */ - cmp r4, r5 /* higher address (r4 or r5) */ - movhs r2, r4 - movlo r2, r5 - - /* r3 - end of loop code before */ - adr r3, end - - /* r4 - end of loop code after */ - adr r4, copy_uboot_start - sub r4, r3, r4 - add r4, r2, r4 - -copy_code_loop: - ldmdb r3!, {r7 - r10} - stmdb r4!, {r7 - r10} - cmp r4, r2 - bhi copy_code_loop - -copy_code_end: - mov pc, r2 - - -/* - * Copy u-boot to address CONFIG_SYS_TEXT_BASE - * - * Nokia X-Loader loading secondary image to address 0x80400000 - * NOLO loading boot image to random place, so it doesn't really - * matter what is set in CONFIG_SYS_TEXT_BASE. We have to copy - * u-boot to CONFIG_SYS_TEXT_BASE address. - */ - -copy_uboot_start: - /* r0 - start of u-boot before */ - /* r1 - start of u-boot after */ - /* r6 - maximal u-boot size */ - - /* r2 - end of u-boot after */ - add r2, r1, r6 - - /* condition for copying from left to right */ - cmp r0, r1 - addlo r1, r0, r6 /* r1 - end of u-boot before */ - blo copy_uboot_loop_right - -copy_uboot_loop_left: - ldmia r0!, {r3 - r10} - stmia r1!, {r3 - r10} - cmp r1, r2 - blo copy_uboot_loop_left - b copy_uboot_end - -copy_uboot_loop_right: - ldmdb r1!, {r3 - r10} - stmdb r2!, {r3 - r10} - cmp r1, r0 - bhi copy_uboot_loop_right - -copy_uboot_end: - bx lr - -end: + /* Returns */ + b save_boot_params_ret diff --git a/configs/nokia_rx51_defconfig b/configs/nokia_rx51_defconfig index 3b559abf23..1306c1fc26 100644 --- a/configs/nokia_rx51_defconfig +++ b/configs/nokia_rx51_defconfig @@ -9,7 +9,6 @@ CONFIG_INITRD_TAG=y CONFIG_REVISION_TAG=y CONFIG_STATIC_MACH_TYPE=y CONFIG_MACH_TYPE=1955 -CONFIG_SYS_TEXT_BASE=0x80008000 CONFIG_SYS_MALLOC_LEN=0xc0000 CONFIG_NR_DRAM_BANKS=2 CONFIG_TARGET_NOKIA_RX51=y From 04bd87c24c31bbd8f27f6d1f7484c9a17f622c9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 11 Aug 2022 22:27:23 +0200 Subject: [PATCH 05/12] Nokia RX-51: Simplify copy kernel code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Expression (r + (r0 - r1)) produce same result as (r - (r1 - r0)). So it does not matter which one is called. Always call the first option and remove second one. Signed-off-by: Pali Rohár --- board/nokia/rx51/lowlevel_init.S | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S index dd3c830cc2..4f76e80b20 100644 --- a/board/nokia/rx51/lowlevel_init.S +++ b/board/nokia/rx51/lowlevel_init.S @@ -55,16 +55,13 @@ save_boot_params: copy_kernel_start: adr r0, relocaddr /* r0 - address of section relocaddr */ ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ - cmp r0, r1 /* r4 - calculated offset */ - subhi r4, r0, r1 - sublo r4, r1, r0 + sub r4, r0, r1 /* r0 - start of kernel before */ ldr r0, startaddr - addhi r0, r0, r4 - sublo r0, r0, r4 + add r0, r0, r4 ldr r1, kernoffs add r0, r0, r1 From 0ba6ce4b7889dc74a646cf54ea97a9d48428bcfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 11 Aug 2022 22:27:24 +0200 Subject: [PATCH 06/12] Nokia RX-51: Simplify calculation of attached kernel image address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now when board starup code does not copy image to CONFIG_SYS_TEXT_BASE address there is no need to calculate all addresses from base address at runtime. The only address which needs to be calculated is attached kernel image address which can be simplified at compile time without need to know CONFIG_SYS_TEXT_BASE address or relocation address at the runtime. Signed-off-by: Pali Rohár --- board/nokia/rx51/lowlevel_init.S | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S index 4f76e80b20..c1785bc3f7 100644 --- a/board/nokia/rx51/lowlevel_init.S +++ b/board/nokia/rx51/lowlevel_init.S @@ -6,11 +6,8 @@ #include -relocaddr: /* address of this relocaddr section after coping */ - .word . /* address of section (calculated at compile time) */ - -startaddr: /* address of u-boot after copying */ - .word CONFIG_SYS_TEXT_BASE +kernoffs: /* offset of kernel image from this address */ + .word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE) kernaddr: /* address of kernel after copying */ .word KERNEL_ADDRESS @@ -18,9 +15,6 @@ kernaddr: /* address of kernel after copying */ kernsize: /* maximal size of kernel image */ .word KERNEL_MAXSIZE -kernoffs: /* offset of kernel image in loaded u-boot */ - .word KERNEL_OFFSET - imagesize: /* maximal size of image */ .word IMAGE_MAXSIZE @@ -53,16 +47,9 @@ save_boot_params: */ copy_kernel_start: - adr r0, relocaddr /* r0 - address of section relocaddr */ - ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ - - /* r4 - calculated offset */ - sub r4, r0, r1 - /* r0 - start of kernel before */ - ldr r0, startaddr - add r0, r0, r4 - ldr r1, kernoffs + adr r0, kernoffs /* r0 - current address of kernoffs section */ + ldr r1, kernoffs /* r1 - offset of kernel image from kernoffs section */ add r0, r0, r1 /* r3 - start of kernel after */ From 9ca6c91732533c4d8e809dac9f602c28ae4923cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 11 Aug 2022 22:27:25 +0200 Subject: [PATCH 07/12] Nokia RX-51: Move board required options from defconfig to Kconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of config options are board specific and should be set in into their default values automatically. So move them from defconfig file to Kconfig definitions to ensure that possible user custom defconfig files would have these required options also enabled. Signed-off-by: Pali Rohár --- arch/arm/mach-omap2/omap3/Kconfig | 5 +++++ board/nokia/rx51/Kconfig | 6 ++++++ configs/nokia_rx51_defconfig | 7 ------- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-omap2/omap3/Kconfig b/arch/arm/mach-omap2/omap3/Kconfig index 18574ab2b2..3e97ec2629 100644 --- a/arch/arm/mach-omap2/omap3/Kconfig +++ b/arch/arm/mach-omap2/omap3/Kconfig @@ -108,6 +108,11 @@ config TARGET_OMAP3_LOGIC config TARGET_NOKIA_RX51 bool "Nokia RX51" select POSITION_INDEPENDENT + select SKIP_LOWLEVEL_INIT + select SUPPORT_PASSING_ATAGS + select CMDLINE_TAG + select INITRD_TAG + select REVISION_TAG config TARGET_TAO3530 bool "TAO3530" diff --git a/board/nokia/rx51/Kconfig b/board/nokia/rx51/Kconfig index ec6a571a22..7cf05077da 100644 --- a/board/nokia/rx51/Kconfig +++ b/board/nokia/rx51/Kconfig @@ -1,5 +1,8 @@ if TARGET_NOKIA_RX51 +config NR_DRAM_BANKS + default 2 + config SYS_BOARD default "rx51" @@ -9,4 +12,7 @@ config SYS_VENDOR config SYS_CONFIG_NAME default "nokia_rx51" +config SYS_PROMPT + default "Nokia RX-51 # " + endif diff --git a/configs/nokia_rx51_defconfig b/configs/nokia_rx51_defconfig index 1306c1fc26..b25e33ea87 100644 --- a/configs/nokia_rx51_defconfig +++ b/configs/nokia_rx51_defconfig @@ -1,16 +1,10 @@ CONFIG_ARM=y -CONFIG_SKIP_LOWLEVEL_INIT=y # CONFIG_SYS_THUMB_BUILD is not set CONFIG_SYS_L2CACHE_OFF=y CONFIG_ARCH_OMAP2PLUS=y -CONFIG_SUPPORT_PASSING_ATAGS=y -CONFIG_CMDLINE_TAG=y -CONFIG_INITRD_TAG=y -CONFIG_REVISION_TAG=y CONFIG_STATIC_MACH_TYPE=y CONFIG_MACH_TYPE=1955 CONFIG_SYS_MALLOC_LEN=0xc0000 -CONFIG_NR_DRAM_BANKS=2 CONFIG_TARGET_NOKIA_RX51=y CONFIG_SYS_LOAD_ADDR=0x80000000 CONFIG_OPTIMIZE_INLINING=y @@ -25,7 +19,6 @@ CONFIG_BOOTCOMMAND="run sdboot;run emmcboot;run attachboot;echo" CONFIG_USE_PREBOOT=y # CONFIG_SYS_DEVICE_NULLDEV is not set CONFIG_HUSH_PARSER=y -CONFIG_SYS_PROMPT="Nokia RX-51 # " CONFIG_SYS_CBSIZE=256 CONFIG_SYS_PBSIZE=287 # CONFIG_CMD_BDI is not set From 297c439b37b158911718c47d7027c354e4988174 Mon Sep 17 00:00:00 2001 From: "Matwey V. Kornilov" Date: Thu, 11 Aug 2022 17:18:12 +0300 Subject: [PATCH 08/12] Restore pcm051_rev3_defconfig config pcm051_rev3_defconfig config (Phytec Wega board) has been dropped in 64efd11d ("arm: Remove pcm051 board") due to expired migration deadlines. Here, pcm051_rev3_defconfig support is reintroduced. Signed-off-by: Matwey V. Kornilov Reviewed-by: Tom Rini --- arch/arm/dts/am335x-wega-rdk-u-boot.dtsi | 12 ++++ board/phytec/phycore_am335x_r2/Kconfig | 2 +- board/phytec/phycore_am335x_r2/MAINTAINERS | 5 ++ board/phytec/phycore_am335x_r2/board.c | 26 ++++++++ configs/pcm051_rev3_defconfig | 69 ++++++++++++++++++++++ 5 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 configs/pcm051_rev3_defconfig diff --git a/arch/arm/dts/am335x-wega-rdk-u-boot.dtsi b/arch/arm/dts/am335x-wega-rdk-u-boot.dtsi index 28fd62e231..b3f21e7f52 100644 --- a/arch/arm/dts/am335x-wega-rdk-u-boot.dtsi +++ b/arch/arm/dts/am335x-wega-rdk-u-boot.dtsi @@ -16,6 +16,18 @@ ocp { u-boot,dm-pre-reloc; + + l4_wkup@44c00000 { + u-boot,dm-pre-reloc; + + segment@200000 { + u-boot,dm-pre-reloc; + + target-module@9000 { + u-boot,dm-pre-reloc; + }; + }; + }; }; }; diff --git a/board/phytec/phycore_am335x_r2/Kconfig b/board/phytec/phycore_am335x_r2/Kconfig index 77055e043c..4183c2410e 100644 --- a/board/phytec/phycore_am335x_r2/Kconfig +++ b/board/phytec/phycore_am335x_r2/Kconfig @@ -1,4 +1,4 @@ -if TARGET_PHYCORE_AM335X_R2 +if TARGET_PCM051 || TARGET_PHYCORE_AM335X_R2 config SYS_BOARD default "phycore_am335x_r2" diff --git a/board/phytec/phycore_am335x_r2/MAINTAINERS b/board/phytec/phycore_am335x_r2/MAINTAINERS index 8d02b0e198..28c69cb1a8 100644 --- a/board/phytec/phycore_am335x_r2/MAINTAINERS +++ b/board/phytec/phycore_am335x_r2/MAINTAINERS @@ -9,3 +9,8 @@ F: board/phytec/phycore_am335x_r2 F: include/configs/phycore_am335x_r2.h F: configs/phycore-am335x-r2-regor_defconfig F: configs/phycore-am335x-r2-wega_defconfig + +phyCORE AM335x R3 WEGA BOARD +M: Matwey V. Kornilov +S: Maintained +F: configs/pcm051_rev3_defconfig diff --git a/board/phytec/phycore_am335x_r2/board.c b/board/phytec/phycore_am335x_r2/board.c index 5ca9415204..d97ebd0151 100644 --- a/board/phytec/phycore_am335x_r2/board.c +++ b/board/phytec/phycore_am335x_r2/board.c @@ -31,7 +31,11 @@ DECLARE_GLOBAL_DATA_PTR; static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE; /* DDR RAM defines */ +#if defined(CONFIG_TARGET_PCM051) +#define DDR_CLK_MHZ 303 /* DDR_DPLL_MULT value */ +#else #define DDR_CLK_MHZ 400 /* DDR_DPLL_MULT value */ +#endif #define OSC (V_OSCK / 1000000) const struct dpll_params dpll_ddr = { @@ -65,6 +69,7 @@ enum { PHYCORE_R2_MT41K128M16JT_256MB, PHYCORE_R2_MT41K256M16TW107IT_512MB, PHYCORE_R2_MT41K512M16HA125IT_1024MB, + PHYCORE_R13_MT41K256M16HA125E_256MB, }; struct am335x_sdram_timings { @@ -127,10 +132,30 @@ static struct am335x_sdram_timings physom_timings[] = { .datawrsratio0 = 0x82, }, }, + [PHYCORE_R13_MT41K256M16HA125E_256MB] = { + .ddr3_emif_reg_data = { + .sdram_config = MT41K256M16HA125E_EMIF_SDCFG, + .ref_ctrl = MT41K256M16HA125E_EMIF_SDREF, + .sdram_tim1 = MT41K256M16HA125E_EMIF_TIM1, + .sdram_tim2 = MT41K256M16HA125E_EMIF_TIM2, + .sdram_tim3 = MT41K256M16HA125E_EMIF_TIM3, + .zq_config = MT41K256M16HA125E_ZQ_CFG, + .emif_ddr_phy_ctlr_1 = MT41K256M16HA125E_EMIF_READ_LATENCY | PHY_EN_DYN_PWRDN, + }, + .ddr3_data = { + .datardsratio0 = MT41K256M16HA125E_RD_DQS, + .datawdsratio0 = MT41K256M16HA125E_WR_DQS, + .datafwsratio0 = MT41K256M16HA125E_PHY_FIFO_WE, + .datawrsratio0 = MT41K256M16HA125E_PHY_WR_DATA, + }, + }, }; void sdram_init(void) { +#if defined(CONFIG_TARGET_PCM051) + int ram_type_index = PHYCORE_R13_MT41K256M16HA125E_256MB; +#else /* Configure memory to maximum supported size for detection */ int ram_type_index = PHYCORE_R2_MT41K512M16HA125IT_1024MB; @@ -157,6 +182,7 @@ void sdram_init(void) ram_type_index = PHYCORE_R2_MT41K128M16JT_256MB; break; } +#endif config_ddr(DDR_CLK_MHZ, &ioregs, &physom_timings[ram_type_index].ddr3_data, &ddr3_cmd_ctrl_data, diff --git a/configs/pcm051_rev3_defconfig b/configs/pcm051_rev3_defconfig new file mode 100644 index 0000000000..624113d61a --- /dev/null +++ b/configs/pcm051_rev3_defconfig @@ -0,0 +1,69 @@ +CONFIG_ARM=y +CONFIG_ARCH_CPU_INIT=y +CONFIG_ARCH_OMAP2PLUS=y +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_DEFAULT_DEVICE_TREE="am335x-wega-rdk" +CONFIG_AM33XX=y +CONFIG_TARGET_PCM051=y +CONFIG_SPL_MMC=y +CONFIG_SPL_SERIAL=y +CONFIG_SPL=y +CONFIG_SPL_FS_FAT=y +CONFIG_SPL_LIBDISK_SUPPORT=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4030ff00 +CONFIG_OF_BOARD_SETUP=y +CONFIG_DEFAULT_FDT_FILE="am335x-wega-rdk.dtb" +CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_ARCH_MISC_INIT=y +CONFIG_SPL_ENV_SUPPORT=y +CONFIG_SPL_FS_EXT4=y +CONFIG_SPL_I2C=y +# CONFIG_SPL_NAND_SUPPORT is not set +CONFIG_SPL_POWER=y +CONFIG_SPL_YMODEM_SUPPORT=y +CONFIG_CMD_SPL=y +CONFIG_CMD_ASKENV=y +CONFIG_CMD_EEPROM=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_I2C=y +CONFIG_CMD_MMC=y +CONFIG_CMD_SPI=y +CONFIG_CMD_USB=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_CMD_EXT4_WRITE=y +CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clocks clock-names interrupt-parent interrupt-controller interrupt-cells dma-names dmas " +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +CONFIG_VERSION_VARIABLE=y +CONFIG_SPL_DM=y +CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_REGMAP=y +CONFIG_SPL_OF_TRANSLATE=y +CONFIG_CLK=y +CONFIG_CLK_TI_CTRL=y +CONFIG_DM_I2C=y +CONFIG_MISC=y +CONFIG_MMC_OMAP_HS=y +CONFIG_DM_MTD=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SF_DEFAULT_SPEED=24000000 +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_PHY_SMSC=y +CONFIG_DM_ETH=y +CONFIG_MII=y +CONFIG_DRIVER_TI_CPSW=y +CONFIG_SPI=y +CONFIG_DM_SPI=y +CONFIG_OMAP3_SPI=y +CONFIG_USB=y +CONFIG_DM_USB_GADGET=y +CONFIG_USB_MUSB_HOST=y +CONFIG_USB_MUSB_GADGET=y +CONFIG_USB_MUSB_TI=y +CONFIG_USB_GADGET=y +CONFIG_USB_ETHER=y From 4b053019792d5c71f8b2e988c34c6352816c5aac Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Mon, 8 Aug 2022 16:12:30 +0200 Subject: [PATCH 09/12] arm64: explicitly disable pointer authentication instructions The Yocto project builds their aarch64 cross-compiler with the configure knob --enable-standard-branch-protection, which means that their gcc behaves as if -mbranch-protection=standard is passed; the default (lacking that configure knob) is -mbranch-protection=none. This means that when building U-Boot using the Yocto toolchain, most functions end up containing paciasp/autiasp/bti instructions. However, since U-Boot is not an ordinary userspace application, there's no OS kernel which has set up the required authentication keys, so these instructions do nothing at all (even on arm64 hardware that does have the pointer authentication capability). They do however make the image larger. It is theoretically possible for U-Boot to make use of the pointer authentication protection - cf. the linux kernel's CONFIG_ARM64_PTR_AUTH_KERNEL - but it is far from trivial, and it's hard to see just what threat model it would protect against in a bootloader context. Regardless, we certainly have none of the required infrastructure now, so explicitly pass -mbranch-protection=none to ensure those useless instructions do not get emitted. For a toolchain not configured with --enable-standard-branch-protection, this changes nothing. For the Yocto toolchain, this reduces the size of both SPL and U-Boot proper by about 3% for my imx8mp target. If you don't have a Yocto toolchain, the effect can easily be reproduced by applying this patch and changing =none to =standard. Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- arch/arm/cpu/armv8/config.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/cpu/armv8/config.mk b/arch/arm/cpu/armv8/config.mk index 6f9093109f..ca06ed3d4f 100644 --- a/arch/arm/cpu/armv8/config.mk +++ b/arch/arm/cpu/armv8/config.mk @@ -3,6 +3,7 @@ # (C) Copyright 2002 # Gary Jennejohn, DENX Software Engineering, PLATFORM_RELFLAGS += -fno-common -ffixed-x18 +PLATFORM_RELFLAGS += $(call cc-option,-mbranch-protection=none) PF_NO_UNALIGNED := $(call cc-option, -mstrict-align) PLATFORM_CPPFLAGS += $(PF_NO_UNALIGNED) From cc0b36536b8ffe89293930934439c8148afa075c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 7 Aug 2022 07:12:19 -0600 Subject: [PATCH 10/12] arm: k3: Correct an awk warning The k3_gen_x509_cert.sh script produced this warning on gitlab and also on my machine, e.g. with j7200_evm_r5: awk: cmd. line:1: warning: regexp escape sequence `\ ' is not a known regexp operator There is no need to escape spaces, so drop the backslashes. Also split the line so it is a more reasonable length. This script should really be deleted and binman used instead. Signed-off-by: Simon Glass --- tools/k3_gen_x509_cert.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/k3_gen_x509_cert.sh b/tools/k3_gen_x509_cert.sh index 24cfc4e5fb..029247c105 100755 --- a/tools/k3_gen_x509_cert.sh +++ b/tools/k3_gen_x509_cert.sh @@ -88,7 +88,10 @@ EOF } parse_key() { - sed '/\ \ \ \ /s/://g' key.txt | awk '!/\ \ \ \ / {printf("\n%s\n", $0)}; /\ \ \ \ / {printf("%s", $0)}' | sed 's/\ \ \ \ //g' | awk "/$1:/{getline; print}" + sed '/ /s/://g' key.txt | \ + awk '!/ / {printf("\n%s\n", $0)}; / / {printf("%s", $0)}' | \ + sed 's/ //g' | \ + awk "/$1:/{getline; print}" } gen_degen_key() { From a871af2d5a59c26d4ff7e60530a7afce0742e6f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Sun, 7 Aug 2022 21:06:04 +0200 Subject: [PATCH 11/12] hwconfig: Allow to use restricted env MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During early boot phase GD_FLG_ENV_READY is not set but env_get() may work when env is ready in restricted mode. Do not fail with error message "WARNING: Calling __hwconfig without a buffer and before environment is ready" when env is already working by checking for ENV_VALID flag. Signed-off-by: Pali Rohár --- common/hwconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/hwconfig.c b/common/hwconfig.c index 43566b81bd..cac0b6348f 100644 --- a/common/hwconfig.c +++ b/common/hwconfig.c @@ -78,7 +78,7 @@ static const char *__hwconfig(const char *opt, size_t *arglen, /* if we are passed a buffer use it, otherwise try the environment */ if (!env_hwconfig) { - if (!(gd->flags & GD_FLG_ENV_READY)) { + if (!(gd->flags & GD_FLG_ENV_READY) && gd->env_valid != ENV_VALID) { printf("WARNING: Calling __hwconfig without a buffer " "and before environment is ready\n"); return NULL; From 65523d28b99d24f93eada00fa097e1d104e8e72d Mon Sep 17 00:00:00 2001 From: Dhananjay Phadke Date: Thu, 4 Aug 2022 08:58:54 -0700 Subject: [PATCH 12/12] gpio: aspeed: port Linux dt-bindings header file Makes it easier to add readable GPIO definitions in DTS files for Aspeed SOC based boards. Ported with small edits to add IBM copyright statement and fix for checkpatch warning. Signed-off-by: Dhananjay Phadke Reviewed-by: Billy Tsai Acked-by: Chia-Wei Wang --- include/dt-bindings/gpio/aspeed-gpio.h | 51 ++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 include/dt-bindings/gpio/aspeed-gpio.h diff --git a/include/dt-bindings/gpio/aspeed-gpio.h b/include/dt-bindings/gpio/aspeed-gpio.h new file mode 100644 index 0000000000..a49f5d5b5a --- /dev/null +++ b/include/dt-bindings/gpio/aspeed-gpio.h @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2022 IBM Corp. + * + * This header provides constants for binding aspeed,*-gpio. + * + * The first cell in Aspeed's GPIO specifier is the GPIO ID. The macros below + * provide names for this. + * + * The second cell contains standard flag values specified in gpio.h. + */ + +#ifndef _DT_BINDINGS_GPIO_ASPEED_GPIO_H +#define _DT_BINDINGS_GPIO_ASPEED_GPIO_H + +#include + +#define ASPEED_GPIO_PORT_A 0 +#define ASPEED_GPIO_PORT_B 1 +#define ASPEED_GPIO_PORT_C 2 +#define ASPEED_GPIO_PORT_D 3 +#define ASPEED_GPIO_PORT_E 4 +#define ASPEED_GPIO_PORT_F 5 +#define ASPEED_GPIO_PORT_G 6 +#define ASPEED_GPIO_PORT_H 7 +#define ASPEED_GPIO_PORT_I 8 +#define ASPEED_GPIO_PORT_J 9 +#define ASPEED_GPIO_PORT_K 10 +#define ASPEED_GPIO_PORT_L 11 +#define ASPEED_GPIO_PORT_M 12 +#define ASPEED_GPIO_PORT_N 13 +#define ASPEED_GPIO_PORT_O 14 +#define ASPEED_GPIO_PORT_P 15 +#define ASPEED_GPIO_PORT_Q 16 +#define ASPEED_GPIO_PORT_R 17 +#define ASPEED_GPIO_PORT_S 18 +#define ASPEED_GPIO_PORT_T 19 +#define ASPEED_GPIO_PORT_U 20 +#define ASPEED_GPIO_PORT_V 21 +#define ASPEED_GPIO_PORT_W 22 +#define ASPEED_GPIO_PORT_X 23 +#define ASPEED_GPIO_PORT_Y 24 +#define ASPEED_GPIO_PORT_Z 25 +#define ASPEED_GPIO_PORT_AA 26 +#define ASPEED_GPIO_PORT_AB 27 +#define ASPEED_GPIO_PORT_AC 28 + +#define ASPEED_GPIO(port, offset) \ + ((ASPEED_GPIO_PORT_##port * 8) + (offset)) + +#endif