From a665cb13dc03209cbee2e8135e94248d11554622 Mon Sep 17 00:00:00 2001 From: Praneeth Bajjuri Date: Thu, 7 May 2020 22:35:56 -0500 Subject: [PATCH 1/5] ddr: k3-am654: EMIF Tool update to 2.02 for IO optimizations and fixes EMIF tool for AM65x [1] is now updated from rev 1.98 to 2.02 This update includes * Optimizations in IO configuration. * Fix for byte enablement in GCR registers. * Fixes for PG2.0 including ZQ control. [1]: http://www.ti.com/lit/zip/sprcah7 Acked-by: James Doublesin Signed-off-by: Praneeth Bajjuri --- .../dts/k3-am654-base-board-ddr4-1600MTs.dtsi | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/arch/arm/dts/k3-am654-base-board-ddr4-1600MTs.dtsi b/arch/arm/dts/k3-am654-base-board-ddr4-1600MTs.dtsi index d07aaea93f5..5638321903a 100644 --- a/arch/arm/dts/k3-am654-base-board-ddr4-1600MTs.dtsi +++ b/arch/arm/dts/k3-am654-base-board-ddr4-1600MTs.dtsi @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ - * This file was generated by AM65x_DRA80xM_EMIF_Tool_1.98.xlsm + * Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/ + * This file was generated by AM65x_DRA80xM_EMIF_Tool_2.02.xlsm * http://www.ti.com/lit/pdf/spracj0 * Configuration Parameters * Memory Type: DDR4 @@ -24,7 +24,7 @@ #define DDRCTL_INIT4 0x00000020 #define DDRCTL_INIT5 0x00100000 #define DDRCTL_INIT6 0x00000480 -#define DDRCTL_INIT7 0x000004E8 +#define DDRCTL_INIT7 0x00000497 #define DDRCTL_DRAMTMG0 0x0C0A1B0D #define DDRCTL_DRAMTMG1 0x00030313 #define DDRCTL_DRAMTMG2 0x0506050A @@ -33,10 +33,10 @@ #define DDRCTL_DRAMTMG5 0x04040302 #define DDRCTL_DRAMTMG6 0x00000004 #define DDRCTL_DRAMTMG7 0x00000404 -#define DDRCTL_DRAMTMG8 0x03030A05 +#define DDRCTL_DRAMTMG8 0x03030C05 #define DDRCTL_DRAMTMG9 0x00020208 #define DDRCTL_DRAMTMG10 0x001C180A -#define DDRCTL_DRAMTMG11 0x0E06010E +#define DDRCTL_DRAMTMG11 0x1106010E #define DDRCTL_DRAMTMG12 0x00020008 #define DDRCTL_DRAMTMG13 0x0B100002 #define DDRCTL_DRAMTMG14 0x00000000 @@ -84,33 +84,33 @@ #define DDRPHY_DCR 0x0000040C #define DDRPHY_DTPR0 0x041A0B06 #define DDRPHY_DTPR1 0x28140000 -#define DDRPHY_DTPR2 0x0034E255 -#define DDRPHY_DTPR3 0x01D50800 +#define DDRPHY_DTPR2 0x0034E300 +#define DDRPHY_DTPR3 0x02800800 #define DDRPHY_DTPR4 0x31180805 #define DDRPHY_DTPR5 0x00250B06 #define DDRPHY_DTPR6 0x00000505 #define DDRPHY_ZQCR 0x008A2A58 #define DDRPHY_ZQ0PR0 0x000077DD -#define DDRPHY_ZQ1PR0 0x000077DD +#define DDRPHY_ZQ1PR0 0x00007799 #define DDRPHY_MR0 0x00000214 #define DDRPHY_MR1 0x00000501 #define DDRPHY_MR2 0x00000000 #define DDRPHY_MR3 0x00000020 #define DDRPHY_MR4 0x00000000 #define DDRPHY_MR5 0x00000480 -#define DDRPHY_MR6 0x000004E8 +#define DDRPHY_MR6 0x00000497 #define DDRPHY_MR11 0x00000000 #define DDRPHY_MR12 0x00000000 #define DDRPHY_MR13 0x00000000 #define DDRPHY_MR14 0x00000000 #define DDRPHY_MR22 0x00000000 -#define DDRPHY_VTCR0 0xF3C32028 +#define DDRPHY_VTCR0 0xF3C32017 #define DDRPHY_DX8SL0PLLCR0 0x021c4000 #define DDRPHY_DX8SL1PLLCR0 0x021c4000 #define DDRPHY_DX8SL2PLLCR0 0x021c4000 #define DDRPHY_DTCR0 0x8000B1C7 #define DDRPHY_DTCR1 0x00010236 -#define DDRPHY_ACIOCR0 0x30070000 +#define DDRPHY_ACIOCR0 0xF0070000 #define DDRPHY_ACIOCR3 0x00000001 #define DDRPHY_ACIOCR5 0x04800000 #define DDRPHY_IOVCR0 0x0F0C0C0C @@ -157,6 +157,6 @@ #define DDRPHY_DX8SL0DXCTL2 0x00141830 #define DDRPHY_DX8SL1DXCTL2 0x00141830 #define DDRPHY_DX8SL2DXCTL2 0x00141830 -#define DDRPHY_DX8SL0DQSCTL 0x01264000 -#define DDRPHY_DX8SL1DQSCTL 0x01264000 -#define DDRPHY_DX8SL2DQSCTL 0x01264000 +#define DDRPHY_DX8SL0DQSCTL 0x01264300 +#define DDRPHY_DX8SL1DQSCTL 0x01264300 +#define DDRPHY_DX8SL2DQSCTL 0x01264300 From 62ca4aa16fcfaaa15e40ed26fe6826878d55ac59 Mon Sep 17 00:00:00 2001 From: Adam Ford Date: Sat, 9 May 2020 05:48:06 -0500 Subject: [PATCH 2/5] ARM: omap3_logic boards: Convert to DM_ETH With the converstion of SMC911x to DM, this can facilitate the omap3 boards from LogicPD (now called Beacon EmbeddedWorks) to be converted. There isn't a clean solution to doing this in phases, so the boards are all being done together to avoid breaking functionality. Because the GPMC bus hasn't been converted, the -u-boot.dtsi node needs to show the address of the ethernet controller for each board. The board file, which is common betwen the OMAP35 and DM37 SOM LV and Torpedo boards, can remove the manual ethernet initialization, but it still needs to register the address and GPMC configuration for the Ethernet controller which is now being moved around to board_late_init(). Lastly, this patch updates the various config files to add the reference for DM_ETH and remove the SMC address, which is now fetched from the newly created device tree nodes. Signed-off-by: Adam Ford --- .../logicpd-som-lv-35xx-devkit-u-boot.dtsi | 10 +++++ .../logicpd-som-lv-37xx-devkit-u-boot.dtsi | 10 +++++ .../logicpd-torpedo-35xx-devkit-u-boot.dtsi | 10 +++++ .../logicpd-torpedo-37xx-devkit-u-boot.dtsi | 12 ++++++ board/logicpd/omap3som/omap3logic.c | 40 +++++++++---------- configs/omap35_logic_defconfig | 2 +- configs/omap35_logic_somlv_defconfig | 2 +- configs/omap3_logic_defconfig | 2 +- configs/omap3_logic_somlv_defconfig | 2 +- 9 files changed, 65 insertions(+), 25 deletions(-) diff --git a/arch/arm/dts/logicpd-som-lv-35xx-devkit-u-boot.dtsi b/arch/arm/dts/logicpd-som-lv-35xx-devkit-u-boot.dtsi index 173b492cd99..7832c9ab530 100644 --- a/arch/arm/dts/logicpd-som-lv-35xx-devkit-u-boot.dtsi +++ b/arch/arm/dts/logicpd-som-lv-35xx-devkit-u-boot.dtsi @@ -15,6 +15,16 @@ /delete-property/ serial1; /delete-property/ serial2; }; + + ethernet@08000000 { + compatible = "smsc,lan9221","smsc,lan9115"; + reg = <0x08000000 0xff>; + bank-width = <2>; + vddvario-supply = <&vddvario>; + vdd33a-supply = <&vdd33a>; + reg-io-width = <4>; + smsc,save-mac-address; + }; }; &gpio1 { diff --git a/arch/arm/dts/logicpd-som-lv-37xx-devkit-u-boot.dtsi b/arch/arm/dts/logicpd-som-lv-37xx-devkit-u-boot.dtsi index 173b492cd99..7832c9ab530 100644 --- a/arch/arm/dts/logicpd-som-lv-37xx-devkit-u-boot.dtsi +++ b/arch/arm/dts/logicpd-som-lv-37xx-devkit-u-boot.dtsi @@ -15,6 +15,16 @@ /delete-property/ serial1; /delete-property/ serial2; }; + + ethernet@08000000 { + compatible = "smsc,lan9221","smsc,lan9115"; + reg = <0x08000000 0xff>; + bank-width = <2>; + vddvario-supply = <&vddvario>; + vdd33a-supply = <&vdd33a>; + reg-io-width = <4>; + smsc,save-mac-address; + }; }; &gpio1 { diff --git a/arch/arm/dts/logicpd-torpedo-35xx-devkit-u-boot.dtsi b/arch/arm/dts/logicpd-torpedo-35xx-devkit-u-boot.dtsi index 581247def08..89b20be38c1 100644 --- a/arch/arm/dts/logicpd-torpedo-35xx-devkit-u-boot.dtsi +++ b/arch/arm/dts/logicpd-torpedo-35xx-devkit-u-boot.dtsi @@ -15,6 +15,16 @@ /delete-property/ serial1; /delete-property/ serial2; }; + + ethernet@08000000 { + compatible = "smsc,lan9221","smsc,lan9115"; + reg = <0x08000000 0xff>; + bank-width = <2>; + vddvario-supply = <&vddvario>; + vdd33a-supply = <&vdd33a>; + reg-io-width = <4>; + smsc,save-mac-address; + }; }; &gpio1 { diff --git a/arch/arm/dts/logicpd-torpedo-37xx-devkit-u-boot.dtsi b/arch/arm/dts/logicpd-torpedo-37xx-devkit-u-boot.dtsi index 9b709c147c8..e56666e4bc3 100644 --- a/arch/arm/dts/logicpd-torpedo-37xx-devkit-u-boot.dtsi +++ b/arch/arm/dts/logicpd-torpedo-37xx-devkit-u-boot.dtsi @@ -11,6 +11,18 @@ /delete-property/ serial1; /delete-property/ serial2; }; + + ethernet@08000000 { + compatible = "smsc,lan9221","smsc,lan9115"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x08000000 0xff>; + bank-width = <2>; + vddvario-supply = <&vddvario>; + vdd33a-supply = <&vdd33a>; + reg-io-width = <4>; + smsc,save-mac-address; + }; }; &i2c1 { diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c index 21d8a21010e..50572c6a71d 100644 --- a/board/logicpd/omap3som/omap3logic.c +++ b/board/logicpd/omap3som/omap3logic.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -58,6 +57,8 @@ DECLARE_GLOBAL_DATA_PTR; #define LOGIC_MT28_OMAP35_ASYNC_GPMC_CONFIG6 0x09030000 #define LOGIC_MT28_OMAP35_ASYNC_GPMC_CONFIG7 0x00000C50 +#define CONFIG_SMC911X_BASE 0x08000000 + #ifdef CONFIG_SPL_OS_BOOT int spl_start_uboot(void) { @@ -204,11 +205,28 @@ static void unlock_nand(void) nand_unlock(mtd, 0, mtd->size, 0); } +#ifdef CONFIG_SMC911X +/* GPMC CS1 settings for Logic SOM LV/Torpedo LAN92xx Ethernet chip */ +static const u32 gpmc_lan92xx_config[] = { + NET_LAN92XX_GPMC_CONFIG1, + NET_LAN92XX_GPMC_CONFIG2, + NET_LAN92XX_GPMC_CONFIG3, + NET_LAN92XX_GPMC_CONFIG4, + NET_LAN92XX_GPMC_CONFIG5, + NET_LAN92XX_GPMC_CONFIG6, +}; +#endif + int board_late_init(void) { #ifdef CONFIG_CMD_NAND_LOCK_UNLOCK unlock_nand(); #endif + +#ifdef CONFIG_SMC911X + enable_gpmc_cs_config(gpmc_lan92xx_config, &gpmc_cfg->cs[1], + CONFIG_SMC911X_BASE, GPMC_SIZE_16M); +#endif return 0; } #endif @@ -219,23 +237,3 @@ void board_mmc_power_init(void) twl4030_power_mmc_init(0); } #endif - -#ifdef CONFIG_SMC911X -/* GPMC CS1 settings for Logic SOM LV/Torpedo LAN92xx Ethernet chip */ -static const u32 gpmc_lan92xx_config[] = { - NET_LAN92XX_GPMC_CONFIG1, - NET_LAN92XX_GPMC_CONFIG2, - NET_LAN92XX_GPMC_CONFIG3, - NET_LAN92XX_GPMC_CONFIG4, - NET_LAN92XX_GPMC_CONFIG5, - NET_LAN92XX_GPMC_CONFIG6, -}; - -int board_eth_init(bd_t *bis) -{ - enable_gpmc_cs_config(gpmc_lan92xx_config, &gpmc_cfg->cs[1], - CONFIG_SMC911X_BASE, GPMC_SIZE_16M); - - return smc911x_initialize(0, CONFIG_SMC911X_BASE); -} -#endif diff --git a/configs/omap35_logic_defconfig b/configs/omap35_logic_defconfig index bcf4efc621a..a460ed559e8 100644 --- a/configs/omap35_logic_defconfig +++ b/configs/omap35_logic_defconfig @@ -56,8 +56,8 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y CONFIG_SYS_NAND_U_BOOT_OFFS=0x80000 CONFIG_SPL_NAND_SIMPLE=y +CONFIG_DM_ETH=y CONFIG_SMC911X=y -CONFIG_SMC911X_BASE=0x08000000 CONFIG_SMC911X_32_BIT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_SINGLE=y diff --git a/configs/omap35_logic_somlv_defconfig b/configs/omap35_logic_somlv_defconfig index 51c5d449e09..f6db27f02ee 100644 --- a/configs/omap35_logic_somlv_defconfig +++ b/configs/omap35_logic_somlv_defconfig @@ -60,8 +60,8 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y CONFIG_SYS_NAND_U_BOOT_OFFS=0x80000 CONFIG_SPL_NAND_SIMPLE=y +CONFIG_DM_ETH=y CONFIG_SMC911X=y -CONFIG_SMC911X_BASE=0x08000000 CONFIG_SMC911X_32_BIT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_SINGLE=y diff --git a/configs/omap3_logic_defconfig b/configs/omap3_logic_defconfig index 15925fb7dbb..918532a66c3 100644 --- a/configs/omap3_logic_defconfig +++ b/configs/omap3_logic_defconfig @@ -55,8 +55,8 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y CONFIG_SYS_NAND_U_BOOT_OFFS=0x80000 CONFIG_SPL_NAND_SIMPLE=y +CONFIG_DM_ETH=y CONFIG_SMC911X=y -CONFIG_SMC911X_BASE=0x08000000 CONFIG_SMC911X_32_BIT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_SINGLE=y diff --git a/configs/omap3_logic_somlv_defconfig b/configs/omap3_logic_somlv_defconfig index ea8fc37f122..4a634376534 100644 --- a/configs/omap3_logic_somlv_defconfig +++ b/configs/omap3_logic_somlv_defconfig @@ -62,8 +62,8 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y CONFIG_SYS_NAND_U_BOOT_OFFS=0x80000 CONFIG_SPL_NAND_SIMPLE=y +CONFIG_DM_ETH=y CONFIG_SMC911X=y -CONFIG_SMC911X_BASE=0x08000000 CONFIG_SMC911X_32_BIT=y CONFIG_PINCTRL=y CONFIG_PINCTRL_SINGLE=y From 7bf82cc1f8ac4c85f6eb1b7e37e302792fa954aa Mon Sep 17 00:00:00 2001 From: Andreas Dannenberg Date: Sat, 16 May 2020 21:05:01 +0530 Subject: [PATCH 3/5] arm: mach-k3: j721e_init: Add support for backup boot modes When the boot of J721E devices using the primary bootmode (configured via device pins) fails a boot using the configured backup bootmode is attempted. To take advantage of the backup boot mode feature go ahead and add support to the J721E init code to determine whether the ROM code performed the boot using the primary or backup boot mode, and if booted from the backup boot mode, decode the bootmode settings into the appropriate U-Boot mode accordingly so that the boot can proceed. Signed-off-by: Andreas Dannenberg Signed-off-by: Faiz Abbas --- .../arm/mach-k3/include/mach/j721e_hardware.h | 2 ++ arch/arm/mach-k3/include/mach/j721e_spl.h | 12 +++++++ arch/arm/mach-k3/j721e_init.c | 35 +++++++++++++++++-- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-k3/include/mach/j721e_hardware.h b/arch/arm/mach-k3/include/mach/j721e_hardware.h index ead136ed638..2efa911a9a9 100644 --- a/arch/arm/mach-k3/include/mach/j721e_hardware.h +++ b/arch/arm/mach-k3/include/mach/j721e_hardware.h @@ -18,6 +18,8 @@ #define MAIN_DEVSTAT_BKUP_BOOTMODE_SHIFT 1 #define MAIN_DEVSTAT_PRIM_BOOTMODE_MMC_PORT_MASK BIT(6) #define MAIN_DEVSTAT_PRIM_BOOTMODE_PORT_SHIFT 6 +#define MAIN_DEVSTAT_BKUP_MMC_PORT_MASK BIT(7) +#define MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT 7 #define WKUP_CTRL_MMR0_BASE 0x43000000 #define MCU_CTRL_MMR0_BASE 0x40f00000 diff --git a/arch/arm/mach-k3/include/mach/j721e_spl.h b/arch/arm/mach-k3/include/mach/j721e_spl.h index 475278bd041..1cabc01dc49 100644 --- a/arch/arm/mach-k3/include/mach/j721e_spl.h +++ b/arch/arm/mach-k3/include/mach/j721e_spl.h @@ -25,7 +25,19 @@ #define BOOT_DEVICE_MMC2_2 0x16 #define BOOT_DEVICE_RAM 0x17 +/* Backup boot modes with MCU Only = 0 */ +#define BACKUP_BOOT_DEVICE_RAM 0x0 +#define BACKUP_BOOT_DEVICE_USB 0x1 +#define BACKUP_BOOT_DEVICE_UART 0x3 +#define BACKUP_BOOT_DEVICE_ETHERNET 0x4 +#define BACKUP_BOOT_DEVICE_MMC2 0x5 +#define BACKUP_BOOT_DEVICE_SPI 0x6 +#define BACKUP_BOOT_DEVICE_I2C 0x7 + #define BOOT_MODE_B_SHIFT 4 #define BOOT_MODE_B_MASK BIT(4) +#define K3_PRIMARY_BOOTMODE 0x0 +#define K3_BACKUP_BOOTMODE 0x1 + #endif diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c index 71fc20c30bf..18a3c1c0524 100644 --- a/arch/arm/mach-k3/j721e_init.c +++ b/arch/arm/mach-k3/j721e_init.c @@ -235,6 +235,35 @@ u32 spl_mmc_boot_mode(const u32 boot_device) } } +static u32 __get_backup_bootmedia(u32 main_devstat) +{ + u32 bkup_boot = (main_devstat & MAIN_DEVSTAT_BKUP_BOOTMODE_MASK) >> + MAIN_DEVSTAT_BKUP_BOOTMODE_SHIFT; + + switch (bkup_boot) { + case BACKUP_BOOT_DEVICE_USB: + return BOOT_DEVICE_DFU; + case BACKUP_BOOT_DEVICE_UART: + return BOOT_DEVICE_UART; + case BACKUP_BOOT_DEVICE_ETHERNET: + return BOOT_DEVICE_ETHERNET; + case BACKUP_BOOT_DEVICE_MMC2: + { + u32 port = (main_devstat & MAIN_DEVSTAT_BKUP_MMC_PORT_MASK) >> + MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT; + if (port == 0x0) + return BOOT_DEVICE_MMC1; + return BOOT_DEVICE_MMC2; + } + case BACKUP_BOOT_DEVICE_SPI: + return BOOT_DEVICE_SPI; + case BACKUP_BOOT_DEVICE_I2C: + return BOOT_DEVICE_I2C; + } + + return BOOT_DEVICE_RAM; +} + static u32 __get_primary_bootmedia(u32 main_devstat, u32 wkup_devstat) { @@ -271,8 +300,10 @@ u32 spl_boot_device(void) /* MAIN CTRL MMR can only be read if MCU ONLY is 0 */ main_devstat = readl(CTRLMMR_MAIN_DEVSTAT); - /* ToDo: Add support for backup boot media */ - return __get_primary_bootmedia(main_devstat, wkup_devstat); + if (bootindex == K3_PRIMARY_BOOTMODE) + return __get_primary_bootmedia(main_devstat, wkup_devstat); + else + return __get_backup_bootmedia(main_devstat); } #endif From 6cfd09d4ed43ee401cc16f1dffabe7911b603380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Sun, 17 May 2020 14:38:22 +0200 Subject: [PATCH 4/5] Nokia RX-51: Add automated test for running RX-51 build in qemu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch contains test/nokia_rx51_test.sh script which automatically download and compile all needed tools in local temporary directory to generate a simple MTD images for booting Maemo kernel image by U-Boot from RAM, eMMC and OneNAND. MTD images are then run in virtual n900 machine provided by qemu-linaro project. This script does not need any special privileges, so it can be run as non-root nobody user. It can be used to check that U-Boot for Nokia N900 is not broken and can be successfully booted in emulator. Script is registered to .azure-pipelines.yml, .gitlab-ci.yml and .travis.yml so it would be automatically run on those CI services. Signed-off-by: Pali Rohár --- .azure-pipelines.yml | 13 ++ .gitlab-ci.yml | 8 ++ .travis.yml | 7 + board/nokia/rx51/MAINTAINERS | 1 + test/nokia_rx51_test.sh | 262 +++++++++++++++++++++++++++++++++++ 5 files changed, 291 insertions(+) create mode 100755 test/nokia_rx51_test.sh diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 5d9645451d4..88438e77a1f 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -151,6 +151,19 @@ jobs: # seems to hang forever with pre-configured "container" environment docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh + - job: nokia_rx51_test + displayName: 'Run tests for Nokia RX-51 (aka N900)' + pool: + vmImage: $(ubuntu_vm) + container: + image: $(ci_runner_image) + options: $(container_option) + steps: + - script: | + ./tools/buildman/buildman --fetch-arch arm + export PATH=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/:$PATH + test/nokia_rx51_test.sh + - job: test_py displayName: 'test.py' pool: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index beaf9b9042a..badfcb4254e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -170,6 +170,14 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites: ./tools/patman/patman --test; make testconfig +Run tests for Nokia RX-51 (aka N900): + tags: [ 'all' ] + stage: testsuites + script: + - ./tools/buildman/buildman --fetch-arch arm; + export PATH=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/:$PATH; + test/nokia_rx51_test.sh + # Test sandbox with test.py sandbox test.py: tags: [ 'all' ] diff --git a/.travis.yml b/.travis.yml index fbfaaaff25d..bb02b6d816c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,6 +50,8 @@ addons: - mtools - openssl - sbsigntool + - fakeroot + - mtd-utils install: # Clone uboot-test-hooks @@ -492,6 +494,11 @@ matrix: script: - make tools-only_config envtools -j$(nproc) + - name: "Run tests for Nokia RX-51 (aka N900)" + script: + - export PATH=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/:$PATH + - test/nokia_rx51_test.sh + # test/py - name: "test/py sandbox" env: diff --git a/board/nokia/rx51/MAINTAINERS b/board/nokia/rx51/MAINTAINERS index f2a712620b7..58b16bf9a95 100644 --- a/board/nokia/rx51/MAINTAINERS +++ b/board/nokia/rx51/MAINTAINERS @@ -5,3 +5,4 @@ F: board/nokia/rx51/ F: include/configs/nokia_rx51.h F: configs/nokia_rx51_defconfig F: doc/README.nokia_rx51 +F: test/nokia_rx51_test.sh diff --git a/test/nokia_rx51_test.sh b/test/nokia_rx51_test.sh new file mode 100755 index 00000000000..b17542b8c1f --- /dev/null +++ b/test/nokia_rx51_test.sh @@ -0,0 +1,262 @@ +#!/bin/sh -e +# SPDX-License-Identifier: GPL-2.0+ +# (C) 2020 Pali Rohár + +# External tools needed for this test: +echo ' + wget + git + truncate + tar + dpkg + dd + make + gcc + arm-linux-gnueabi-gcc + fakeroot (homepage http://fakeroot-ng.lingnu.com/) + mcopy (from mtools, homepage http://www.gnu.org/software/mtools/) + mformat (from mtools, homepage http://www.gnu.org/software/mtools/) + /usr/sbin/mkfs.ubifs (from mtd-utils, homepage http://www.linux-mtd.infradead.org/) + /usr/sbin/ubinize (from mtd-utils, homepage http://www.linux-mtd.infradead.org/) +' | while read tool info; do + if test -z "$tool"; then continue; fi + if ! which $tool 1>/dev/null 2>&1; then + echo "Tool $tool was not found and is required to run this test" + echo "First install $tool $info" + exit 1 + fi +done || exit 1 + +echo +echo "============================================================" +echo "========== Compiling U-Boot for Nokia RX-51 board ==========" +echo "============================================================" +echo + +# First compile u-boot.bin binary for Nokia RX-51 board +make nokia_rx51_config +make -j4 u-boot.bin ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- + +# And then do all stuff in temporary directory +mkdir -p nokia_rx51_tmp +cd nokia_rx51_tmp + +test -f mkimage || ln -s ../tools/mkimage . +test -f u-boot.bin || ln -s ../u-boot.bin . + +echo +echo "==========================================================================" +echo "========== Downloading and compiling qemu from qemu-linaro fork ==========" +echo "==========================================================================" +echo + +# Download and compile linaro version qemu which has support for n900 machine +# Last working commit is 8f8d8e0796efe1a6f34cdd83fb798f3c41217ec1 +if ! test -f qemu-system-arm; then + test -d qemu-linaro || git clone https://git.linaro.org/qemu/qemu-linaro.git + cd qemu-linaro + git checkout 8f8d8e0796efe1a6f34cdd83fb798f3c41217ec1 + ./configure --enable-system --target-list=arm-softmmu --disable-sdl --disable-gtk --disable-curses --audio-drv-list= --audio-card-list= --disable-werror --disable-xen --disable-xen-pci-passthrough --disable-brlapi --disable-vnc --disable-curl --disable-slirp --disable-kvm --disable-user --disable-linux-user --disable-bsd-user --disable-guest-base --disable-uuid --disable-vde --disable-linux-aio --disable-cap-ng --disable-attr --disable-blobs --disable-docs --disable-spice --disable-libiscsi --disable-smartcard-nss --disable-usb-redir --disable-guest-agent --disable-seccomp --disable-glusterfs --disable-nptl --disable-fdt + make -j4 + cd .. + ln -s qemu-linaro/arm-softmmu/qemu-system-arm . +fi + +echo +echo "===================================================" +echo "========== Downloading external binaries ==========" +echo "===================================================" +echo + +# Download qflasher and nolo images +# This is proprietary qemu flasher tool with first stage images, but license allows non-commercial redistribution +wget -c http://repository.maemo.org/qemu-n900/qemu-n900.tar.gz +tar -xf qemu-n900.tar.gz + +# Download Maemo script u-boot-gen-combined +if ! test -f u-boot-gen-combined; then + test -d u-boot-maemo || git clone https://github.com/pali/u-boot-maemo.git + chmod +x u-boot-maemo/debian/u-boot-gen-combined + ln -s u-boot-maemo/debian/u-boot-gen-combined . +fi + +# Download Maemo fiasco kernel +wget -c http://repository.maemo.org/pool/maemo5.0/free/k/kernel/kernel_2.6.28-20103103+0m5_armel.deb +dpkg -x kernel_2.6.28-20103103+0m5_armel.deb kernel_2.6.28 + +# Download Maemo libc +wget -c http://repository.maemo.org/pool/maemo5.0/free/g/glibc/libc6_2.5.1-1eglibc27+0m5_armel.deb +dpkg -x libc6_2.5.1-1eglibc27+0m5_armel.deb libc6_2.5.1 + +# Download Maemo busybox +wget -c http://repository.maemo.org/pool/maemo5.0/free/b/busybox/busybox_1.10.2.legal-1osso30+0m5_armel.deb +dpkg -x busybox_1.10.2.legal-1osso30+0m5_armel.deb busybox_1.10.2 + +echo +echo "=======================================" +echo "========== Generating images ==========" +echo "=======================================" +echo + +# Generate rootfs directory +mkdir -p rootfs +mkdir -p rootfs/dev/ +mkdir -p rootfs/bin/ +mkdir -p rootfs/sbin/ +mkdir -p rootfs/lib/ +cp -a busybox_1.10.2/bin/busybox rootfs/bin/ +cp -a libc6_2.5.1/lib/ld-linux.so.3 rootfs/lib/ +cp -a libc6_2.5.1/lib/ld-2.5.so rootfs/lib/ +cp -a libc6_2.5.1/lib/libc.so.6 rootfs/lib/ +cp -a libc6_2.5.1/lib/libc-2.5.so rootfs/lib/ +cp -a libc6_2.5.1/lib/libcrypt.so.1 rootfs/lib/ +cp -a libc6_2.5.1/lib/libcrypt-2.5.so rootfs/lib/ +test -f rootfs/bin/sh || ln -sf busybox rootfs/bin/sh +test -f rootfs/sbin/poweroff || ln -sf ../bin/busybox rootfs/sbin/poweroff +cat > rootfs/sbin/preinit << EOF +#!/bin/sh +echo +echo "Successfully booted" +echo +/sbin/poweroff -f +EOF +chmod +x rootfs/sbin/preinit + +# Generate ubi config file for ubi rootfs image +cat > ubi.ini << EOF +[rootfs] +mode=ubi +image=ubifs.img +vol_id=0 +vol_size=160MiB +vol_type=dynamic +vol_name=rootfs +vol_alignment=1 +vol_flags=autoresize +EOF + +# Generate ubi rootfs image from rootfs directory +# NOTE: Character device on host filesystem can be created only by root +# But we do not need it on host filesystem, just in ubifs image +# So run mknod and mkfs.ubifs commands under fakeroot program +# which via LD_PRELOAD simulate mknod() and stat() functions +# so mkfs.ubifs will see dev/console as character device and +# put it correctly as character device into final ubifs image +# Therefore we can run whole script as non-root nobody user +fakeroot sh -c ' + rm -f rootfs/dev/console; + mknod rootfs/dev/console c 5 1; + /usr/sbin/mkfs.ubifs -m 2048 -e 129024 -c 2047 -r rootfs ubifs.img; +' +/usr/sbin/ubinize -o ubi.img -p 128KiB -m 2048 -s 512 ubi.ini + +# Generate bootmenu for eMMC booting +cat > bootmenu_emmc << EOF +setenv bootmenu_0 'uImage-2.6.28-omap1 from eMMC=setenv mmcnum 1; setenv mmcpart 1; setenv mmctype fat; setenv bootargs; setenv setup_omap_atag 1; setenv mmckernfile uImage-2.6.28-omap1; run trymmckernboot'; +setenv bootmenu_1; +setenv bootmenu_delay 1; +setenv bootdelay 1; +EOF +./mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n bootmenu -d bootmenu_emmc bootmenu_emmc.scr + +# Generate bootmenu for OneNAND booting +cat > bootmenu_nand << EOF +setenv bootmenu_0 'uImage-2.6.28-omap1 from OneNAND=mtd read initfs \${kernaddr}; setenv bootargs; setenv setup_omap_atag 1; bootm \${kernaddr}'; +setenv bootmenu_1; +setenv bootmenu_delay 1; +setenv bootdelay 1; +EOF +./mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n bootmenu -d bootmenu_nand bootmenu_nand.scr + +# Generate combined image from u-boot and Maemo fiasco kernel +dd if=kernel_2.6.28/boot/zImage-2.6.28-20103103+0m5.fiasco of=zImage-2.6.28-omap1 skip=95 bs=1 +./mkimage -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n zImage-2.6.28-omap1 -d zImage-2.6.28-omap1 uImage-2.6.28-omap1 +./u-boot-gen-combined u-boot.bin uImage-2.6.28-omap1 combined.bin + +# Generate combined hack image from u-boot and Maemo fiasco kernel (kernel starts at 2MB offset and qflasher puts 2kB header before supplied image) +cp u-boot.bin combined_hack.bin +dd if=uImage-2.6.28-omap1 of=combined_hack.bin bs=1024 seek=$((2048-2)) + +# Generate FAT32 eMMC image for eMMC booting +truncate -s 50MiB emmc_emmc.img +mformat -m 0xf8 -F -h 4 -s 16 -c 1 -t $((50*1024*1024/(4*16*512))) :: -i emmc_emmc.img +mcopy uImage-2.6.28-omap1 ::/uImage-2.6.28-omap1 -i emmc_emmc.img +mcopy bootmenu_emmc.scr ::/bootmenu.scr -i emmc_emmc.img + +# Generate FAT32 eMMC image for OneNAND booting +truncate -s 50MiB emmc_nand.img +mformat -m 0xf8 -F -h 4 -s 16 -c 1 -t $((50*1024*1024/(4*16*512))) :: -i emmc_nand.img +mcopy bootmenu_nand.scr ::/bootmenu.scr -i emmc_nand.img + +# Generate MTD image for RAM booting from bootloader nolo images, compiled image and rootfs image +rm -f mtd_ram.img +./qflasher -v -x xloader-qemu.bin -s secondary-qemu.bin -k combined.bin -r ubi.img -m rx51 -o mtd_ram.img + +# Generate MTD image for eMMC booting from bootloader nolo images, u-boot image and rootfs image +rm -f mtd_emmc.img +./qflasher -v -x xloader-qemu.bin -s secondary-qemu.bin -k u-boot.bin -r ubi.img -m rx51 -o mtd_emmc.img + +# Generate MTD image for OneNAND booting from bootloader nolo images, combined hacked image and rootfs image +# Kernel image is put into initfs area, but qflasher reject to copy kernel image into initfs area because it does not have initfs signature +# This is hack to workaround this problem, tell qflasher that kernel area for u-boot is bigger and put big combined hacked image (u-boot + kernel with correct offset) +rm -f mtd_nand.img +./qflasher -v -x xloader-qemu.bin -s secondary-qemu.bin -k combined_hack.bin -r ubi.img -m rx51 -p k=4094,i=2 -o mtd_nand.img + +echo +echo "======================================================" +echo "========== Running test images in n900 qemu ==========" +echo "======================================================" +echo + +# Run MTD image in qemu and wait for 300s if kernel from RAM is correctly booted +rm -f qemu_ram.log +./qemu-system-arm -M n900 -mtdblock mtd_ram.img -serial /dev/stdout -display none > qemu_ram.log & +qemu_pid=$! +tail -F qemu_ram.log & +tail_pid=$! +{ sleep 300 || true; kill -9 $qemu_pid $tail_pid 2>/dev/null || true; } & +sleep_pid=$! +wait $qemu_pid || true +kill -9 $tail_pid $sleep_pid 2>/dev/null || true + +# Run MTD image in qemu and wait for 300s if kernel from eMMC is correctly booted +rm -f qemu_emmc.log +./qemu-system-arm -M n900 -mtdblock mtd_emmc.img -sd emmc_emmc.img -serial /dev/stdout -display none > qemu_emmc.log & +qemu_pid=$! +tail -F qemu_emmc.log & +tail_pid=$! +{ sleep 300 || true; kill -9 $qemu_pid $tail_pid 2>/dev/null || true; } & +sleep_pid=$! +wait $qemu_pid || true +kill -9 $tail_pid $sleep_pid 2>/dev/null || true + +# Run MTD image in qemu and wait for 300s if kernel from OneNAND is correctly booted +rm -f qemu_nand.log +./qemu-system-arm -M n900 -mtdblock mtd_nand.img -sd emmc_nand.img -serial /dev/stdout -display none > qemu_nand.log & +qemu_pid=$! +tail -F qemu_nand.log & +tail_pid=$! +{ sleep 300 || true; kill -9 $qemu_pid $tail_pid 2>/dev/null || true; } & +sleep_pid=$! +wait $qemu_pid || true +kill -9 $tail_pid $sleep_pid 2>/dev/null || true + +echo +echo "=============================" +echo "========== Results ==========" +echo "=============================" +echo + +if grep -q 'Successfully booted' qemu_ram.log; then echo "Kernel was successfully booted from RAM"; else echo "Failed to boot kernel from RAM"; fi +if grep -q 'Successfully booted' qemu_emmc.log; then echo "Kernel was successfully booted from eMMC"; else echo "Failed to boot kernel from eMMC"; fi +if grep -q 'Successfully booted' qemu_nand.log; then echo "Kernel was successfully booted from OneNAND"; else echo "Failed to boot kernel from OneNAND"; fi + +echo + +if grep -q 'Successfully booted' qemu_ram.log && grep -q 'Successfully booted' qemu_emmc.log && grep -q 'Successfully booted' qemu_nand.log; then + echo "All tests passed" + exit 0 +else + echo "Some tests failed" + exit 1 +fi From c02712a7484918648e5dd09c092035c7eeb7794a Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Mon, 18 May 2020 07:57:22 +0200 Subject: [PATCH 5/5] arm: mach-k3: Enable dcache in SPL Add support for enabling dcache already in SPL. It accelerates the boot and resolves the risk to run into unaligned 64-bit accesses. Based on original patch by Lokesh Vulta. Signed-off-by: Jan Kiszka Acked-by: Lokesh Vutla --- arch/arm/mach-k3/am6_init.c | 1 + arch/arm/mach-k3/common.c | 35 +++++++++++++++++++++++++++++++++++ arch/arm/mach-k3/common.h | 1 + arch/arm/mach-k3/j721e_init.c | 1 + board/ti/am65x/evm.c | 2 ++ 5 files changed, 40 insertions(+) diff --git a/arch/arm/mach-k3/am6_init.c b/arch/arm/mach-k3/am6_init.c index b692806352c..586f5c022eb 100644 --- a/arch/arm/mach-k3/am6_init.c +++ b/arch/arm/mach-k3/am6_init.c @@ -197,6 +197,7 @@ void board_init_f(ulong dummy) if (ret) panic("DRAM init failed: %d\n", ret); #endif + spl_enable_dcache(); } u32 spl_mmc_boot_mode(const u32 boot_device) diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c index 80dfa5f0fd6..a94e054491a 100644 --- a/arch/arm/mach-k3/common.c +++ b/arch/arm/mach-k3/common.c @@ -406,3 +406,38 @@ void remove_fwl_configs(struct fwl_data *fwl_data, size_t fwl_data_size) } } } + +void spl_enable_dcache(void) +{ +#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF)) + phys_addr_t ram_top = CONFIG_SYS_SDRAM_BASE; + + dram_init_banksize(); + + /* reserve TLB table */ + gd->arch.tlb_size = PGTABLE_SIZE; + + ram_top += get_effective_memsize(); + /* keep ram_top in the 32-bit address space */ + if (ram_top >= 0x100000000) + ram_top = (phys_addr_t) 0x100000000; + + gd->arch.tlb_addr = ram_top - gd->arch.tlb_size; + debug("TLB table from %08lx to %08lx\n", gd->arch.tlb_addr, + gd->arch.tlb_addr + gd->arch.tlb_size); + + dcache_enable(); +#endif +} + +#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF)) +void spl_board_prepare_for_boot(void) +{ + dcache_disable(); +} + +void spl_board_prepare_for_boot_linux(void) +{ + dcache_disable(); +} +#endif diff --git a/arch/arm/mach-k3/common.h b/arch/arm/mach-k3/common.h index 57682e19733..94cdcb56ade 100644 --- a/arch/arm/mach-k3/common.h +++ b/arch/arm/mach-k3/common.h @@ -27,3 +27,4 @@ void remove_fwl_configs(struct fwl_data *fwl_data, size_t fwl_data_size); void start_non_linux_remote_cores(void); int load_firmware(char *name_fw, char *name_loadaddr, u32 *loadaddr); void k3_sysfw_print_ver(void); +void spl_enable_dcache(void); diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c index 18a3c1c0524..031279bc5b3 100644 --- a/arch/arm/mach-k3/j721e_init.c +++ b/arch/arm/mach-k3/j721e_init.c @@ -221,6 +221,7 @@ void board_init_f(ulong dummy) if (ret) panic("DRAM init failed: %d\n", ret); #endif + spl_enable_dcache(); } u32 spl_mmc_boot_mode(const u32 boot_device) diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c index a6108794243..2da7db9f096 100644 --- a/board/ti/am65x/evm.c +++ b/board/ti/am65x/evm.c @@ -69,11 +69,13 @@ int dram_init_banksize(void) /* Bank 0 declares the memory available in the DDR low region */ gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; gd->bd->bi_dram[0].size = 0x80000000; + gd->ram_size = 0x80000000; #ifdef CONFIG_PHYS_64BIT /* Bank 1 declares the memory available in the DDR high region */ gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE1; gd->bd->bi_dram[1].size = 0x80000000; + gd->ram_size = 0x100000000; #endif return 0;