From ee8ce3840aec25cf38b3059fc43cfa7ca6003f55 Mon Sep 17 00:00:00 2001 From: Sven Auhagen Date: Sun, 12 Sep 2021 09:25:44 +0200 Subject: cmd: tlv_eeprom The function show_eeprom is missing int i if debug is enabled. Signed-off-by: Sven Auhagen Reviewed-by: Stefan Roese --- cmd/tlv_eeprom.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c index 2b643f9587..bf8d453dc5 100644 --- a/cmd/tlv_eeprom.c +++ b/cmd/tlv_eeprom.c @@ -169,6 +169,9 @@ static void show_eeprom(u8 *eeprom) { int tlv_end; int curr_tlv; +#ifdef DEBUG + int i; +#endif struct tlvinfo_header *eeprom_hdr = to_header(eeprom); struct tlvinfo_tlv *eeprom_tlv; -- cgit v1.2.3 From a46877eeb2de77d8d1daf1ea362423b6d2fc4f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Wed, 6 Oct 2021 14:30:25 +0200 Subject: tools: termios_linux.h: Fix tcsendbreak() implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are two Linux ioctls which implements tcsendbreak() functionality: TCSBRK and TCSBRKP TCSBRK with non-zero parameter implements tcdrain() and with zero parameter implements tcsendbreak() for duration of 0.25s. TCSBRKP with zero parameter is same as TCSBRK and with non-zero parameter implements tcsendbreak() for duration in deciseconds specified by parameter. TCSBRKP does not have to be provided by older toolchain versions. So tcsendbreak() has to either use TCSBRK with zero parameter or TCSBRKP with any parameter. Fix code to use TCSBRKP and fallback to TCSBRK with 0. Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese --- tools/termios_linux.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/termios_linux.h b/tools/termios_linux.h index d73989b625..e100c8e4eb 100644 --- a/tools/termios_linux.h +++ b/tools/termios_linux.h @@ -90,7 +90,11 @@ static inline int tcflush(int fd, int q) static inline int tcsendbreak(int fd, int d) { - return ioctl(fd, TCSBRK, d); +#ifdef TCSBRKP + return ioctl(fd, TCSBRKP, d); +#else + return ioctl(fd, TCSBRK, 0); +#endif } static inline int tcflow(int fd, int a) -- cgit v1.2.3 From 3c36d745a8a20a1121da4c239d4eaf52a928fa59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Sat, 9 Oct 2021 19:33:36 +0200 Subject: arm: mvebu: turris_mox: Move options to defconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move config options CONFIG_LAST_STAGE_INIT and CONFIG_DISPLAY_BOARDINFO_LATE to turris_mox_defconfig. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- configs/turris_mox_defconfig | 2 ++ include/configs/turris_mox.h | 7 ------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/configs/turris_mox_defconfig b/configs/turris_mox_defconfig index 6ff551e477..e494aebecc 100644 --- a/configs/turris_mox_defconfig +++ b/configs/turris_mox_defconfig @@ -24,7 +24,9 @@ CONFIG_USE_PREBOOT=y CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set +CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_ARCH_EARLY_INIT_R=y +CONFIG_LAST_STAGE_INIT=y CONFIG_MISC_INIT_R=y CONFIG_CMD_SHA1SUM=y CONFIG_CMD_CLK=y diff --git a/include/configs/turris_mox.h b/include/configs/turris_mox.h index 0bbc984753..0fcf216eb1 100644 --- a/include/configs/turris_mox.h +++ b/include/configs/turris_mox.h @@ -10,13 +10,6 @@ #define CONFIG_SYS_BOOTM_LEN (64 << 20) -#define CONFIG_LAST_STAGE_INIT - -/* - * High Level Configuration Options (easy to change) - */ -#define CONFIG_DISPLAY_BOARDINFO_LATE - /* additions for new ARM relocation support */ #define CONFIG_SYS_SDRAM_BASE 0x00000000 -- cgit v1.2.3 From 999ac22b59045d643028d7e66c17504143127628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Sat, 9 Oct 2021 19:33:37 +0200 Subject: arm: mvebu: a3720: Create Kconfig option for I2C_MV MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the config option CONFIG_I2C_MV to a Kconfig option CONFIG_SYS_I2C_MV and move the default definition from config header files into defconfigs. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- configs/mvebu_db-88f3720_defconfig | 1 + configs/mvebu_espressobin-88f3720_defconfig | 1 + configs/turris_mox_defconfig | 1 + configs/uDPU_defconfig | 1 + drivers/i2c/Kconfig | 6 ++++++ drivers/i2c/Makefile | 2 +- include/configs/mvebu_armada-37xx.h | 5 ----- include/configs/turris_mox.h | 5 ----- scripts/config_whitelist.txt | 1 - 9 files changed, 11 insertions(+), 12 deletions(-) diff --git a/configs/mvebu_db-88f3720_defconfig b/configs/mvebu_db-88f3720_defconfig index ba7ee9211e..931ca9c2fc 100644 --- a/configs/mvebu_db-88f3720_defconfig +++ b/configs/mvebu_db-88f3720_defconfig @@ -45,6 +45,7 @@ CONFIG_CLK=y CONFIG_CLK_MVEBU=y # CONFIG_MVEBU_GPIO is not set CONFIG_DM_I2C=y +CONFIG_SYS_I2C_MV=y CONFIG_MISC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_SDMA=y diff --git a/configs/mvebu_espressobin-88f3720_defconfig b/configs/mvebu_espressobin-88f3720_defconfig index bf3f080422..3a69954fcd 100644 --- a/configs/mvebu_espressobin-88f3720_defconfig +++ b/configs/mvebu_espressobin-88f3720_defconfig @@ -54,6 +54,7 @@ CONFIG_AHCI_MVEBU=y CONFIG_CLK=y CONFIG_CLK_MVEBU=y CONFIG_DM_I2C=y +CONFIG_SYS_I2C_MV=y CONFIG_MISC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_SDMA=y diff --git a/configs/turris_mox_defconfig b/configs/turris_mox_defconfig index e494aebecc..3cae32f69b 100644 --- a/configs/turris_mox_defconfig +++ b/configs/turris_mox_defconfig @@ -61,6 +61,7 @@ CONFIG_CLK=y CONFIG_CLK_MVEBU=y # CONFIG_MVEBU_GPIO is not set CONFIG_DM_I2C=y +CONFIG_SYS_I2C_MV=y CONFIG_LED=y CONFIG_LED_GPIO=y CONFIG_MISC=y diff --git a/configs/uDPU_defconfig b/configs/uDPU_defconfig index 17278ae4cc..fa2293bd3e 100644 --- a/configs/uDPU_defconfig +++ b/configs/uDPU_defconfig @@ -54,6 +54,7 @@ CONFIG_CLK=y CONFIG_CLK_MVEBU=y CONFIG_DM_I2C=y CONFIG_DM_I2C_GPIO=y +CONFIG_SYS_I2C_MV=y CONFIG_MISC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_SDMA=y diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 66bd6fe2f3..7c447a8aa0 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -627,6 +627,12 @@ config SYS_I2C_VERSATILE Add support for the Arm Ltd Versatile Express I2C driver. The I2C host controller is present in the development boards manufactured by Arm Ltd. +config SYS_I2C_MV + bool "Marvell PXA (Armada 3720) I2C driver" + help + Support for PXA based I2C controller used on Armada 3720 SoC. + In Linux, this driver is called i2c-pxa. + config SYS_I2C_MVTWSI bool "Marvell I2C driver" help diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index 916427452a..fca6b157f8 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile @@ -10,7 +10,6 @@ obj-$(CONFIG_$(SPL_)DM_I2C_GPIO) += i2c-gpio.o obj-$(CONFIG_$(SPL_)I2C_CROS_EC_TUNNEL) += cros_ec_tunnel.o obj-$(CONFIG_$(SPL_)I2C_CROS_EC_LDO) += cros_ec_ldo.o -obj-$(CONFIG_I2C_MV) += mv_i2c.o obj-$(CONFIG_$(SPL_)SYS_I2C_LEGACY) += i2c_core.o obj-$(CONFIG_SYS_I2C_ASPEED) += ast_i2c.o obj-$(CONFIG_SYS_I2C_AT91) += at91_i2c.o @@ -29,6 +28,7 @@ obj-$(CONFIG_SYS_I2C_IPROC) += iproc_i2c.o obj-$(CONFIG_SYS_I2C_KONA) += kona_i2c.o obj-$(CONFIG_SYS_I2C_LPC32XX) += lpc32xx_i2c.o obj-$(CONFIG_SYS_I2C_MESON) += meson_i2c.o +obj-$(CONFIG_SYS_I2C_MV) += mv_i2c.o obj-$(CONFIG_SYS_I2C_MVTWSI) += mvtwsi.o obj-$(CONFIG_SYS_I2C_MXC) += mxc_i2c.o obj-$(CONFIG_SYS_I2C_NEXELL) += nx_i2c.o diff --git a/include/configs/mvebu_armada-37xx.h b/include/configs/mvebu_armada-37xx.h index 755f59eee9..8c315eb563 100644 --- a/include/configs/mvebu_armada-37xx.h +++ b/include/configs/mvebu_armada-37xx.h @@ -36,11 +36,6 @@ /* End of 16M scrubbed by training in bootrom */ #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + 0xFF0000) -/* - * I2C - */ -#define CONFIG_I2C_MV - /* * Environment */ diff --git a/include/configs/turris_mox.h b/include/configs/turris_mox.h index 0fcf216eb1..ab7931d35b 100644 --- a/include/configs/turris_mox.h +++ b/include/configs/turris_mox.h @@ -34,11 +34,6 @@ /* End of 16M scrubbed by training in bootrom */ #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + 0xFF0000) -/* - * I2C - */ -#define CONFIG_I2C_MV - /* Environment in SPI NOR flash */ /* diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index cd94b5777a..022a27288c 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -593,7 +593,6 @@ CONFIG_I2C_ENV_EEPROM_BUS CONFIG_I2C_GSC CONFIG_I2C_MBB_TIMEOUT CONFIG_I2C_MULTI_BUS -CONFIG_I2C_MV CONFIG_I2C_MVTWSI CONFIG_I2C_MVTWSI_BASE CONFIG_I2C_MVTWSI_BASE0 -- cgit v1.2.3 From a3b055fc700eecdfbb922d39b017ad6499657787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Sat, 9 Oct 2021 19:33:38 +0200 Subject: arm: kirkwood, mvebu: Remove CONFIG_SYS_RESET_ADDRESS option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This option is not used anywhere. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- include/configs/SBx81LIFKW.h | 5 ----- include/configs/SBx81LIFXCAT.h | 5 ----- include/configs/edminiv2.h | 6 ------ include/configs/mv-common.h | 1 - include/configs/mvebu_armada-37xx.h | 1 - include/configs/mvebu_armada-8k.h | 1 - include/configs/turris_mox.h | 1 - include/configs/x530.h | 5 ----- 8 files changed, 25 deletions(-) diff --git a/include/configs/SBx81LIFKW.h b/include/configs/SBx81LIFKW.h index fc6167cf96..462619ff69 100644 --- a/include/configs/SBx81LIFKW.h +++ b/include/configs/SBx81LIFKW.h @@ -59,11 +59,6 @@ /* There is no PHY directly connected so don't ask it for link status */ #undef CONFIG_SYS_FAULT_ECHO_LINK_DOWN -/* - * Other required minimal configurations - */ -#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */ - /* * Ethernet Driver configuration */ diff --git a/include/configs/SBx81LIFXCAT.h b/include/configs/SBx81LIFXCAT.h index 06be63e242..a271567f85 100644 --- a/include/configs/SBx81LIFXCAT.h +++ b/include/configs/SBx81LIFXCAT.h @@ -64,11 +64,6 @@ /* There is no PHY directly connected so don't ask it for link status */ #undef CONFIG_SYS_FAULT_ECHO_LINK_DOWN -/* - * Other required minimal configurations - */ -#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */ - /* * Ethernet Driver configuration */ diff --git a/include/configs/edminiv2.h b/include/configs/edminiv2.h index fbe468010b..664d6d1f34 100644 --- a/include/configs/edminiv2.h +++ b/include/configs/edminiv2.h @@ -151,12 +151,6 @@ * Environment variables configurations */ -/* - * Other required minimal configurations - */ - -#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 - /* Enable command line editing */ /* provide extensive help */ diff --git a/include/configs/mv-common.h b/include/configs/mv-common.h index e460f69a08..cc3b597f28 100644 --- a/include/configs/mv-common.h +++ b/include/configs/mv-common.h @@ -55,7 +55,6 @@ /* * Other required minimal configurations */ -#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */ #define CONFIG_SYS_MAXARGS 32 /* max number of command args */ /* ====> Include platform Common Definitions */ diff --git a/include/configs/mvebu_armada-37xx.h b/include/configs/mvebu_armada-37xx.h index 8c315eb563..e7f7e772fc 100644 --- a/include/configs/mvebu_armada-37xx.h +++ b/include/configs/mvebu_armada-37xx.h @@ -30,7 +30,6 @@ /* * Other required minimal configurations */ -#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */ #define CONFIG_SYS_MAXARGS 32 /* max number of command args */ /* End of 16M scrubbed by training in bootrom */ diff --git a/include/configs/mvebu_armada-8k.h b/include/configs/mvebu_armada-8k.h index 2f8be2ee49..886f44c903 100644 --- a/include/configs/mvebu_armada-8k.h +++ b/include/configs/mvebu_armada-8k.h @@ -24,7 +24,6 @@ /* * Other required minimal configurations */ -#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */ #define CONFIG_SYS_MAXARGS 32 /* max number of command args */ /* End of 16M scrubbed by training in bootrom */ diff --git a/include/configs/turris_mox.h b/include/configs/turris_mox.h index ab7931d35b..070abe38db 100644 --- a/include/configs/turris_mox.h +++ b/include/configs/turris_mox.h @@ -28,7 +28,6 @@ /* * Other required minimal configurations */ -#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */ #define CONFIG_SYS_MAXARGS 32 /* max number of command args */ /* End of 16M scrubbed by training in bootrom */ diff --git a/include/configs/x530.h b/include/configs/x530.h index f8b808ec7c..f4d64495ff 100644 --- a/include/configs/x530.h +++ b/include/configs/x530.h @@ -58,11 +58,6 @@ #include -/* - * Other required minimal configurations - */ -#define CONFIG_SYS_RESET_ADDRESS 0xffff0000 /* Rst Vector Adr */ - /* Keep device tree and initrd in low memory so the kernel can access them */ #define CONFIG_EXTRA_ENV_SETTINGS \ "fdt_high=0x10000000\0" \ -- cgit v1.2.3 From ba89abd028cb4e0c248c1a11ca2c8b34a407bff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Sat, 9 Oct 2021 19:33:39 +0200 Subject: arm: mvebu: turris_mox: Cosmetic update for board config header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reorder the definitions in Turris MOX' board config header, drop the comment relics from when this file was copied, fix indentation. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- include/configs/turris_mox.h | 61 ++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 39 deletions(-) diff --git a/include/configs/turris_mox.h b/include/configs/turris_mox.h index 070abe38db..3cfad7cca9 100644 --- a/include/configs/turris_mox.h +++ b/include/configs/turris_mox.h @@ -8,13 +8,11 @@ #ifndef _CONFIG_TURRIS_MOX_H #define _CONFIG_TURRIS_MOX_H -#define CONFIG_SYS_BOOTM_LEN (64 << 20) - -/* additions for new ARM relocation support */ -#define CONFIG_SYS_SDRAM_BASE 0x00000000 - -/* auto boot */ - +#define CONFIG_SYS_BOOTM_LEN (64 << 20) +#define CONFIG_SYS_SDRAM_BASE 0x00000000 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + 0xFF0000) +#define CONFIG_SYS_CBSIZE 1024 +#define CONFIG_SYS_MAXARGS 32 #define CONFIG_SYS_BAUDRATE_TABLE { 300, 600, 1200, 1800, 2400, 4800, \ 9600, 19200, 38400, 57600, 115200, \ 230400, 460800, 500000, 576000, \ @@ -23,25 +21,10 @@ 4000000, 4500000, 5000000, 5500000, \ 6000000 } -#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buff Size */ - -/* - * Other required minimal configurations - */ -#define CONFIG_SYS_MAXARGS 32 /* max number of command args */ - -/* End of 16M scrubbed by training in bootrom */ -#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + 0xFF0000) - -/* Environment in SPI NOR flash */ - -/* - * Ethernet Driver configuration - */ -#define CONFIG_ARP_TIMEOUT 200 -#define CONFIG_NET_RETRY_COUNT 50 +#define CONFIG_ARP_TIMEOUT 200 +#define CONFIG_NET_RETRY_COUNT 50 -#define CONFIG_USB_MAX_CONTROLLER_COUNT (3 + 3) +#define CONFIG_USB_MAX_CONTROLLER_COUNT 6 #define BOOT_TARGET_DEVICES(func) \ func(MMC, mmc, 0) \ @@ -51,22 +34,22 @@ #include -#define TURRIS_MOX_BOOTCMD_RESCUE \ - "setenv bootargs \"console=ttyMV0,115200 " \ - "earlycon=ar3700_uart,0xd0012000\" && " \ - "sf probe && " \ - "sf read 0x5000000 0x190000 && " \ - "lzmadec 0x5000000 0x5800000 && " \ +#define TURRIS_MOX_BOOTCMD_RESCUE \ + "setenv bootargs \"console=ttyMV0,115200 " \ + "earlycon=ar3700_uart,0xd0012000\" && " \ + "sf probe && " \ + "sf read 0x5000000 0x190000 && " \ + "lzmadec 0x5000000 0x5800000 && " \ "bootm 0x5800000" -#define CONFIG_EXTRA_ENV_SETTINGS \ - "scriptaddr=0x4d00000\0" \ - "pxefile_addr_r=0x4e00000\0" \ - "fdt_addr_r=0x4f00000\0" \ - "kernel_addr_r=0x5000000\0" \ - "ramdisk_addr_r=0x8000000\0" \ - "fdtfile=marvell/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ - "bootcmd_rescue=" TURRIS_MOX_BOOTCMD_RESCUE "\0" \ +#define CONFIG_EXTRA_ENV_SETTINGS \ + "scriptaddr=0x4d00000\0" \ + "pxefile_addr_r=0x4e00000\0" \ + "fdt_addr_r=0x4f00000\0" \ + "kernel_addr_r=0x5000000\0" \ + "ramdisk_addr_r=0x8000000\0" \ + "fdtfile=marvell/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ + "bootcmd_rescue=" TURRIS_MOX_BOOTCMD_RESCUE "\0" \ BOOTENV #endif /* _CONFIG_TURRIS_MOX_H */ -- cgit v1.2.3 From d3159c6b18115cb395ec3c8eb539d9471d2bf862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Sat, 9 Oct 2021 19:33:40 +0200 Subject: arm: mvebu: turris_mox: Use show_board_info() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are printing board information in last_stage_init(), but U-Boot has dedicated function, show_board_info(), for this. Move code which prints board information (board version, serial number, module topology, ...) to show_board_info(). Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- board/CZ.NIC/turris_mox/turris_mox.c | 67 ++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c index 428cd23a19..ff0ed28045 100644 --- a/board/CZ.NIC/turris_mox/turris_mox.c +++ b/board/CZ.NIC/turris_mox/turris_mox.c @@ -485,44 +485,34 @@ static void handle_reset_button(void) } } -static void mox_print_info(void) +int show_board_info(void) { - int ret, board_version, ram_size; - u64 serial_number; + int i, ret, board_version, ram_size, is_sd; const char *pub_key; + const u8 *topology; + u64 serial_number; + + printf("Model: CZ.NIC Turris Mox Board\n"); ret = mbox_sp_get_board_info(&serial_number, NULL, NULL, &board_version, &ram_size); - if (ret < 0) - return; - - printf("Turris Mox:\n"); - printf(" Board version: %i\n", board_version); - printf(" RAM size: %i MiB\n", ram_size); - printf(" Serial Number: %016llX\n", serial_number); + if (ret < 0) { + printf(" Cannot read board info: %i\n", ret); + } else { + printf(" Board version: %i\n", board_version); + printf(" RAM size: %i MiB\n", ram_size); + printf(" Serial Number: %016llX\n", serial_number); + } pub_key = mox_sp_get_ecdsa_public_key(); if (pub_key) printf(" ECDSA Public Key: %s\n", pub_key); else - printf("Cannot read ECDSA Public Key\n"); -} - -int last_stage_init(void) -{ - int ret, i; - const u8 *topology; - int is_sd; - struct mii_dev *bus; - struct gpio_desc reset_gpio = {}; - - mox_print_info(); + printf(" Cannot read ECDSA Public Key\n"); ret = mox_get_topology(&topology, &module_count, &is_sd); - if (ret) { + if (ret) printf("Cannot read module topology!\n"); - return 0; - } printf(" SD/eMMC version: %s\n", is_sd ? "SD" : "eMMC"); @@ -554,8 +544,7 @@ int last_stage_init(void) } } - /* now check if modules are connected in supported mode */ - + /* check if modules are connected in supported mode */ for (i = 0; i < module_count; ++i) { switch (topology[i]) { case MOX_MODULE_SFP: @@ -616,8 +605,17 @@ int last_stage_init(void) } } - /* now configure modules */ + if (module_count) + printf("\n"); + + return 0; +} + +int last_stage_init(void) +{ + struct gpio_desc reset_gpio = {}; + /* configure modules */ if (get_reset_gpio(&reset_gpio) < 0) return 0; @@ -633,16 +631,19 @@ int last_stage_init(void) mdelay(50); } + /* + * check if the addresses are set by reading Scratch & Misc register + * 0x70 of Peridot (and potentially Topaz) modules + */ if (peridot || topaz) { - /* - * now check if the addresses are set by reading Scratch & Misc - * register 0x70 of Peridot (and potentially Topaz) modules - */ + struct mii_dev *bus; bus = miiphy_get_dev_by_name("neta@30000"); if (!bus) { printf("Cannot get MDIO bus device!\n"); } else { + int i; + for (i = 0; i < peridot; ++i) check_switch_address(bus, 0x10 + i); @@ -653,8 +654,6 @@ int last_stage_init(void) } } - printf("\n"); - handle_reset_button(); return 0; -- cgit v1.2.3 From f3c71e75b08b7cbe35acc29d89e90c05edd70d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Sat, 9 Oct 2021 19:33:41 +0200 Subject: arm: mvebu: turris_mox: Always handle reset button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Handle reset button even if we can't configure modules. This happens if we fail retrieving reset GPIO with which we can reset the modules. (Note that this GPIO is different from reset button GPIO.) Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- board/CZ.NIC/turris_mox/turris_mox.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c index ff0ed28045..7c5acfd1d9 100644 --- a/board/CZ.NIC/turris_mox/turris_mox.c +++ b/board/CZ.NIC/turris_mox/turris_mox.c @@ -617,7 +617,7 @@ int last_stage_init(void) /* configure modules */ if (get_reset_gpio(&reset_gpio) < 0) - return 0; + goto handle_reset_btn; if (peridot > 0) { if (configure_peridots(&reset_gpio) < 0) { @@ -654,6 +654,7 @@ int last_stage_init(void) } } +handle_reset_btn: handle_reset_button(); return 0; -- cgit v1.2.3 From 0034d84a66eaa51263a4881274b75de5b1c4f800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Sat, 9 Oct 2021 19:33:42 +0200 Subject: arm: mvebu: turris_mox: Better check for valid ethernet addresses in env MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently we overwrite ethaddr and eth1addr only if these variables don't exist. Better overwrite them even if the env variable exists, but is invalid - eth_env_get_enetaddr_by_index() checks for validity. Refactor the code to use a for cycle. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- board/CZ.NIC/turris_mox/turris_mox.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c index 7c5acfd1d9..2202eb8cfb 100644 --- a/board/CZ.NIC/turris_mox/turris_mox.c +++ b/board/CZ.NIC/turris_mox/turris_mox.c @@ -359,20 +359,22 @@ static int get_reset_gpio(struct gpio_desc *reset_gpio) int misc_init_r(void) { - int ret; - u8 mac1[6], mac2[6]; + u8 mac[2][6]; + int i, ret; - ret = mbox_sp_get_board_info(NULL, mac1, mac2, NULL, NULL); + ret = mbox_sp_get_board_info(NULL, mac[0], mac[1], NULL, NULL); if (ret < 0) { printf("Cannot read data from OTP!\n"); return 0; } - if (is_valid_ethaddr(mac1) && !env_get("ethaddr")) - eth_env_set_enetaddr("ethaddr", mac1); + for (i = 0; i < 2; ++i) { + u8 oldmac[6]; - if (is_valid_ethaddr(mac2) && !env_get("eth1addr")) - eth_env_set_enetaddr("eth1addr", mac2); + if (is_valid_ethaddr(mac[i]) && + !eth_env_get_enetaddr_by_index("eth", i, oldmac)) + eth_env_set_enetaddr_by_index("eth", i, mac[i]); + } return 0; } -- cgit v1.2.3 From 1335e31ecc2cd7e4e51b730499198c7548ac0a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Sat, 9 Oct 2021 19:33:43 +0200 Subject: arm: mvebu: turris_omnia: Overwrite ethaddr only if invalid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently we always overwrite ethaddrs with those from EEPROM. In order to allow user to use a cloned MAC address in U-Boot, change the code so that it sets ethaddr variables only if they aren't set or are invalid. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- board/CZ.NIC/turris_omnia/turris_omnia.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index a48e1f5c30..7a86111890 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -518,6 +518,15 @@ static void increment_mac(u8 *mac) } } +static void set_mac_if_invalid(int i, u8 *mac) +{ + u8 oldmac[6]; + + if (is_valid_ethaddr(mac) && + !eth_env_get_enetaddr_by_index("eth", i, oldmac)) + eth_env_set_enetaddr_by_index("eth", i, mac); +} + int misc_init_r(void) { int err; @@ -550,18 +559,11 @@ int misc_init_r(void) mac[4] = mac1[2]; mac[5] = mac1[3]; - if (is_valid_ethaddr(mac)) - eth_env_set_enetaddr("eth1addr", mac); - + set_mac_if_invalid(1, mac); increment_mac(mac); - - if (is_valid_ethaddr(mac)) - eth_env_set_enetaddr("eth2addr", mac); - + set_mac_if_invalid(2, mac); increment_mac(mac); - - if (is_valid_ethaddr(mac)) - eth_env_set_enetaddr("ethaddr", mac); + set_mac_if_invalid(0, mac); out: return 0; -- cgit v1.2.3 From dc096a5e905b1ccd53d8337ec16414ec076602ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Sat, 9 Oct 2021 19:33:44 +0200 Subject: arm: mvebu: turris_omnia: Use show_board_info() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are printing board information in checkboard() function, which is called from the default weak implementation of show_board_info(). Rename checkboard() to show_board_info(). This throws away the weak implementation of show_board_info(). Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- board/CZ.NIC/turris_omnia/turris_omnia.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index 7a86111890..39051a803a 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -468,7 +468,7 @@ static struct udevice *get_atsha204a_dev(void) return dev; } -int checkboard(void) +int show_board_info(void) { u32 version_num, serial_num; int err = 1; @@ -496,7 +496,7 @@ int checkboard(void) } out: - printf("Turris Omnia:\n"); + printf("Model: Turris Omnia\n"); printf(" RAM size: %i MiB\n", omnia_get_ram_size_gb() * 1024); if (err) printf(" Serial Number: unknown\n"); -- cgit v1.2.3 From 2c8a4e4d7613bb053342e67edf19dc46c21e20fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Sat, 9 Oct 2021 19:33:45 +0200 Subject: arm: mvebu: turris_omnia: Move SPL's SYS_MALLOC_SIMPLE to Kconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of declaring CONFIG_SYS_MALLOC_SIMPLE dependant on CONFIG_SPL_BUILD in board config header, select CONFIG_SPL_SYS_MALLOC_SIMPLE in Kconfig. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- arch/arm/mach-mvebu/Kconfig | 1 + include/configs/turris_omnia.h | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 54dff9986b..8365305733 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -128,6 +128,7 @@ config TARGET_TURRIS_OMNIA select I2C_MUX select I2C_MUX_PCA954x select SPL_I2C_MUX + select SPL_SYS_MALLOC_SIMPLE select SYS_I2C_MVTWSI select ATSHA204A diff --git a/include/configs/turris_omnia.h b/include/configs/turris_omnia.h index 8d7d5c2bfc..273ff85ff3 100644 --- a/include/configs/turris_omnia.h +++ b/include/configs/turris_omnia.h @@ -33,10 +33,6 @@ #define CONFIG_SPL_BSS_START_ADDR (0x40000000 + CONFIG_SPL_SIZE) #define CONFIG_SPL_BSS_MAX_SIZE (16 << 10) -#ifdef CONFIG_SPL_BUILD -#define CONFIG_SYS_MALLOC_SIMPLE -#endif - #define CONFIG_SPL_STACK (0x40000000 + ((192 - 16) << 10)) #define CONFIG_SPL_BOOTROM_SAVE (CONFIG_SPL_STACK + 4) #define CONFIG_SPL_DRIVERS_MISC -- cgit v1.2.3 From 6d7bfb658e6dccbf2c82981558239685cb664b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Sat, 9 Oct 2021 19:33:46 +0200 Subject: arm: mvebu: turris_omnia: Move CONFIG_SPL_DRIVERS_MISC to Kconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of declaring CONFIG_SPL_DRIVERS_MISC in board config header, select it in Kconfig. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- arch/arm/mach-mvebu/Kconfig | 1 + include/configs/turris_omnia.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 8365305733..c66dab6012 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -127,6 +127,7 @@ config TARGET_TURRIS_OMNIA select DM_I2C select I2C_MUX select I2C_MUX_PCA954x + select SPL_DRIVERS_MISC select SPL_I2C_MUX select SPL_SYS_MALLOC_SIMPLE select SYS_I2C_MVTWSI diff --git a/include/configs/turris_omnia.h b/include/configs/turris_omnia.h index 273ff85ff3..9436a623d6 100644 --- a/include/configs/turris_omnia.h +++ b/include/configs/turris_omnia.h @@ -35,7 +35,6 @@ #define CONFIG_SPL_STACK (0x40000000 + ((192 - 16) << 10)) #define CONFIG_SPL_BOOTROM_SAVE (CONFIG_SPL_STACK + 4) -#define CONFIG_SPL_DRIVERS_MISC #ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC /* SPL related MMC defines */ -- cgit v1.2.3 From aaddce0d35f5ec3f9dc021401c56081a3bd05ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Tue, 12 Oct 2021 13:19:19 +0200 Subject: arm: a37xx: pci: Do not allow setting bars on PCI Bridge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PCI Bridge which represents Aardvark PCIe Root Port does not have configurable bars. So ensure that write operation to bars registers on PCI Bridge is noop and bars registers always contain zero address which indicates that bars are unsupported. After this change U-Boot 'pci bar 0.0.0' command does not show any allocated bars for PCI Bridge device. Signed-off-by: Pali Rohár Fixes: cb056005dc67 ("arm: a37xx: pci: Add support for accessing PCI Bridge on root bus") Reviewed-by: Stefan Roese --- drivers/pci/pci-aardvark.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/pci/pci-aardvark.c b/drivers/pci/pci-aardvark.c index 38eff495ab..ade5ab056f 100644 --- a/drivers/pci/pci-aardvark.c +++ b/drivers/pci/pci-aardvark.c @@ -581,6 +581,10 @@ static int pcie_advk_write_config(struct udevice *bus, pci_dev_t bdf, if (offset >= 0x10 && offset < 0x34) { data = pcie->cfgcache[(offset - 0x10) / 4]; data = pci_conv_size_to_32(data, value, offset, size); + /* This PCI bridge does not have configurable bars */ + if ((offset & ~3) == PCI_BASE_ADDRESS_0 || + (offset & ~3) == PCI_BASE_ADDRESS_1) + data = 0x0; pcie->cfgcache[(offset - 0x10) / 4] = data; } else if ((offset & ~3) == PCI_ROM_ADDRESS1) { data = advk_readl(pcie, PCIE_CORE_EXP_ROM_BAR_REG); -- cgit v1.2.3 From 7609e02a25c4d5347146912380cf287a1dd5b300 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Fri, 15 Oct 2021 10:54:41 -0400 Subject: arm: mvebu: Add missing "if SPL" We can only select SPL_SKIP_LOWLEVEL_INIT if SPL is enabled, otherwise we get a warning about unmet dependencies on platforms that don't use SPL. Fixes: cf47a8cf8f7e ("arm: mvebu: Select SPL_SKIP_LOWLEVEL_INIT on ARMADA_32BIT") Cc: Stefan Roese Signed-off-by: Tom Rini Reviewed-by: Stefan Roese --- arch/arm/mach-mvebu/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index c66dab6012..d23cc0c760 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -11,7 +11,7 @@ config ARMADA_32BIT select SPL_DM if SPL select SPL_DM_SEQ_ALIAS if SPL select SPL_OF_CONTROL if SPL - select SPL_SKIP_LOWLEVEL_INIT + select SPL_SKIP_LOWLEVEL_INIT if SPL select SPL_SIMPLE_BUS if SPL select SUPPORT_SPL select TRANSLATION_OFFSET -- cgit v1.2.3 From bd4064ff8a82460d6a497faf66ac5830ffe452b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Tue, 19 Oct 2021 11:05:01 +0200 Subject: arm: a37xx: pci: Fix condition for CRS response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As stated in comment above the code, CRS response can be returned to OS only for 4-byte PCI_VENDOR_ID config read request. So fix the code. Fixes: 1d7ad68559e2 ("arm: a37xx: pci: Handle propagation of CRSSVE bit from PCIe Root Port") Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese --- drivers/pci/pci-aardvark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pci-aardvark.c b/drivers/pci/pci-aardvark.c index ade5ab056f..9e623b6e61 100644 --- a/drivers/pci/pci-aardvark.c +++ b/drivers/pci/pci-aardvark.c @@ -445,7 +445,7 @@ static int pcie_advk_read_config(const struct udevice *bus, pci_dev_t bdf, * for returning CRS, so that if U-Boot does support CRS in the future, * it will work for Aardvark. */ - allow_crs = pcie->cfgcrssve; + allow_crs = (offset == PCI_VENDOR_ID) && (size == PCI_SIZE_32) && pcie->cfgcrssve; if (advk_readl(pcie, PIO_START)) { dev_err(pcie->dev, -- cgit v1.2.3