Add Onion Omega2/2+ board support
Subsystems (3)
v5 cover Add Onion Omega2/2+ board support
Add support for the MediaTek based boards by Onion. Commit one to three are rather generic, whereas the last commit adds the actual board support.
Changes in v5:
- Reimplement the Makefile size check
Changes in v4:
- Rebase board support to v2025.07
- Add new commit to silence warning in arch/mips/
Changes in v3:
- Simplify image size check
Changes in v2:
- I forgot to run checkpatch in v1. Fix some style issues in v2.
Philip Oberfichtner (4):
Makefile: Simplify size check
Makefile: Add size check for u-boot-with-spl.bin
mips: serial: Silence "unused variable" warning
mips: mt7628: Add Onion Omega2/2+ board support
Makefile | 45 ++------ arch/mips/dts/Makefile | 1 + arch/mips/dts/onion-omega2p.dts | 58 ++++++++++ arch/mips/mach-mtmips/mt7620/serial.c | 2 +- arch/mips/mach-mtmips/mt7621/spl/serial.c | 2 +- arch/mips/mach-mtmips/mt7628/Kconfig | 7 ++ arch/mips/mach-mtmips/mt7628/serial.c | 2 +- board/onion/omega2p/Kconfig | 12 ++ board/onion/omega2p/MAINTAINERS | 10 ++ board/onion/omega2p/Makefile | 3 + board/onion/omega2p/board.c | 134 ++++++++++++++++++++++ board/onion/omega2p/omega2p.env | 32 ++++++ common/spl/Kconfig | 7 ++ configs/onion-omega2p_defconfig | 82 +++++++++++++ include/configs/onion-omega2p.h | 15 +++ tools/spl_size_limit.c | 2 +- 16 files changed, 376 insertions(+), 38 deletions(-) create mode 100644 arch/mips/dts/onion-omega2p.dts create mode 100644 board/onion/omega2p/Kconfig create mode 100644 board/onion/omega2p/MAINTAINERS create mode 100644 board/onion/omega2p/Makefile create mode 100644 board/onion/omega2p/board.c create mode 100644 board/onion/omega2p/omega2p.env create mode 100644 configs/onion-omega2p_defconfig create mode 100644 include/configs/onion-omega2p.h
Signature · 1 line
2.39.5
PATCH v5 1/4 Makefile: Simplify size check
Deduplicate some redundancies within the SIZE_CHECK code in the toplevel Makefile. No functional changes.
---
Notes:
Changes in v5:
- Fix for broken boards reported in v4
- See https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Makefile | 44 ++++++++++-------------------------------- tools/spl_size_limit.c | 2 +- 2 files changed, 11 insertions(+), 35 deletions(-)
Makefile +10 -34
@@ -432,7 +432,7 @@ KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) define size_check actual=$$( wc -c $1 | awk '{print $$1}'); \ limit=$$( printf "%d" $2 ); \ - if test $$actual -gt $$limit; then \ + if test $$limit -gt 0 && test $$actual -gt $$limit; then \ echo "$1 exceeds file size limit:" >&2; \ echo " limit: $$(printf %#x $$limit) bytes" >&2; \ echo " actual: $$(printf %#x $$actual) bytes" >&2; \
@@ -1103,30 +1103,6 @@ LDPPFLAGS += \ ######################################################################### ######################################################################### -ifneq ($(CONFIG_BOARD_SIZE_LIMIT),) -BOARD_SIZE_CHECK= @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT)) -else -BOARD_SIZE_CHECK = -endif - -ifneq ($(CONFIG_SPL_SIZE_LIMIT),0x0) -SPL_SIZE_CHECK = @$(call size_check,$@,$$(tools/spl_size_limit)) -else -SPL_SIZE_CHECK = -endif - -ifneq ($(CONFIG_TPL_SIZE_LIMIT),0x0) -TPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT)) -else -TPL_SIZE_CHECK = -endif - -ifneq ($(CONFIG_VPL_SIZE_LIMIT),0x0) -VPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_VPL_SIZE_LIMIT)) -else -VPL_SIZE_CHECK = -endif - # Statically apply RELA-style relocations (currently arm64 only) # This is useful for arm64 where static relocation needs to be performed on # the raw binary, but certain simulators only accept an ELF file (but don't
@@ -1470,7 +1446,7 @@ endif %.imx: $(IMX_DEPS) %.bin $(Q)$(MAKE) $(build)=arch/arm/mach-imx $@ - $(BOARD_SIZE_CHECK) + @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT)) %.vyb: %.imx $(Q)$(MAKE) $(build)=arch/arm/cpu/armv7/vf610 $@
@@ -1571,12 +1547,12 @@ endif u-boot-nodtb.bin: u-boot FORCE $(call if_changed,objcopy_uboot) - $(BOARD_SIZE_CHECK) + @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT)) u-boot.ldr: u-boot $(CREATE_LDR_ENV) $(LDR) -T $(CONFIG_LDR_CPU) -c $@ $< $(LDR_FLAGS) - $(BOARD_SIZE_CHECK) + @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT)) # binman # ---------------------------------------------------------------------------
@@ -1703,7 +1679,7 @@ u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \ $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX),dts/dt.dtb) \ ,$(UBOOT_BIN)) FORCE $(call if_changed,mkimage) - $(BOARD_SIZE_CHECK) + @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT)) ifeq ($(CONFIG_SPL_LOAD_FIT_FULL),y) MKIMAGEFLAGS_u-boot.itb =
@@ -1718,12 +1694,12 @@ u-boot.itb: u-boot-nodtb.bin \ $(if $(CONFIG_MULTI_DTB_FIT),$(FINAL_DTB_CONTAINER)) \ $(U_BOOT_ITS) FORCE $(call if_changed,mkfitimage) - $(BOARD_SIZE_CHECK) + @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT)) endif u-boot-with-spl.kwb: u-boot.bin spl/u-boot-spl.bin FORCE $(call if_changed,mkimage) - $(BOARD_SIZE_CHECK) + @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT)) u-boot.dis: u-boot $(OBJDUMP) -d $< > $@
@@ -2342,7 +2318,7 @@ u-boot.lds: $(LDSCRIPT) prepare FORCE spl/u-boot-spl.bin: spl/u-boot-spl @: - $(SPL_SIZE_CHECK) + @$(call size_check,$@,$$(tools/spl_size_limit)) spl/u-boot-spl-dtb.bin: spl/u-boot-spl @:
@@ -2367,14 +2343,14 @@ spl/boot.bin: spl/u-boot-spl tpl/u-boot-tpl.bin: tpl/u-boot-tpl @: - $(TPL_SIZE_CHECK) + @$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT)) tpl/u-boot-tpl: tools prepare $(if $(CONFIG_TPL_OF_CONTROL),dts/dt.dtb) $(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.xpl all vpl/u-boot-vpl.bin: vpl/u-boot-vpl @: - $(VPL_SIZE_CHECK) + @$(call size_check,$@,$(CONFIG_VPL_SIZE_LIMIT)) vpl/u-boot-vpl: tools prepare $(if $(CONFIG_TPL_OF_CONTROL),dts/dt.dtb) $(Q)$(MAKE) obj=vpl -f $(srctree)/scripts/Makefile.xpl all
tools/spl_size_limit.c +1 -1
@@ -28,6 +28,6 @@ int main(int argc, char *argv[])#endif #endif -printf ("%d" , spl_size_limit); +printf ("%d" , spl_size_limit >0 ? spl_size_limit :0 );return 0 ; }
Signature · 1 line
2.39.5
Re: [PATCH v5 1/4] Makefile: Simplify size check
Quoted 4 lines · Philip Oberfichtner
Deduplicate some redundancies within the
SIZE_CHECKcode in the toplevelMakefile. No functional changes.Signed-off-by Philip Oberfichtner <[email protected]>
Signature · 1 line
Tom
PATCH v5 2/4 Makefile: Add size check for u-boot-with-spl.bin
In reply to Philip OberfichtnerIntroduce another SIZE_CHECK macro for u-boot-with-spl.bin.
Note that we cannot reuse BOARD_SIZE_LIMIT here, as this also applies to intermediate u-boot*bin images, which, before being compressed, may be larger than the final combined image.
Also SPL_SIZE_LIMIT has to be a separate option, as some boards might just want to restrict SPL size while still allowing u-boot-with-spl.bin to be bigger.
---
Notes:
Changes in v5:
- Fix for broken boards reported in v4
- See https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Changes in v4: none
Changes in v3:
Reuse existing SPL_SIZE_LIMIT instead of implementing a new option
Changes in v2: none
Makefile | 1 + common/spl/Kconfig | 7 +++++++ 2 files changed, 8 insertions(+)
Makefile +1 -0
@@ -1716,6 +1716,7 @@ OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \ --pad-to=$(CONFIG_SPL_PAD_TO) u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE $(call if_changed,pad_cat) + @$(call size_check,$@,$(CONFIG_UBOOT_WITH_SPL_SIZE_LIMIT)) ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy) MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE)
common/spl/Kconfig +7 -0
@@ -36,6 +36,13 @@ config SPL_FRAMEWORK_BOARD_INIT_F - initialize the serial (preloader_console_init) Unless you want to provide your own board_init_f, you should say Y. +config UBOOT_WITH_SPL_SIZE_LIMIT + hex "Maximum size of u-boot-with-spl.bin" + default 0x0 + help + Specifies the maximum length of the u-boot-with-spl.bin image. + If this value is zero, it is ignored. + config SPL_SIZE_LIMIT hex "Maximum size of SPL image" default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
Signature · 1 line
2.39.5
Re: [PATCH v5 2/4] Makefile: Add size check for u-boot-with-spl.bin
Quoted 11 lines · Philip Oberfichtner
Introduce another
SIZE_CHECKmacro for u-boot-with-spl.bin.Note that we cannot reuse
BOARD_SIZE_LIMIThere, as this also applies to intermediate u-boot*bin images, which, before being compressed, may be larger than the final combined image.Also
SPL_SIZE_LIMIThas to be a separate option, as some boards might just want to restrict SPL size while still allowing u-boot-with-spl.bin to be bigger.Signed-off-by Philip Oberfichtner <[email protected]>
Signature · 1 line
Tom
PATCH v5 3/4 mips: serial: Silence "unused variable" warning
In reply to Philip OberfichtnerBefore this commit, mtmips_spl_serial_init() caused the following warning:
arch/mips/mach-mtmips/mt7628/serial.c:14:23: warning: unused variable ‘base’ [-Wunused-variable]
14 | void __iomem *base = ioremap_nocache(SYSCTL_BASE, SYSCTL_SIZE);
| ^~~~This happens whenever CONFIG_SPECIFY_CONSOLE_INDEX is unset, which leads to an effectively empty function:
void mtmips_spl_serial_init(void)
{
void __iomem *base = ioremap_nocache(SYSCTL_BASE, SYSCTL_SIZE);}
Add the __maybe_unused attribute to silence this warning.
---
Notes:
Changes in v5: none
Changes in v4: new
arch/mips/mach-mtmips/mt7620/serial.c | 2 +- arch/mips/mach-mtmips/mt7621/spl/serial.c | 2 +- arch/mips/mach-mtmips/mt7628/serial.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/mips/mach-mtmips/mt7620/serial.c +1 -1
@@ -24,7 +24,7 @@ void board_debug_uart_init(void)void mtmips_spl_serial_init (void ) {#ifdef CONFIG_SPL_SERIAL -void __iomem *base =ioremap_nocache (SYSCTL_BASE ,SYSCTL_SIZE ); +void __iomem __maybe_unused *base =ioremap_nocache (SYSCTL_BASE ,SYSCTL_SIZE );#if CONFIG_CONS_INDEX ==1 clrbits_32 (base +SYSCTL_GPIOMODE_REG ,UARTL_GPIO_MODE );
arch/mips/mach-mtmips/mt7621/spl/serial.c +1 -1
@@ -11,7 +11,7 @@void mtmips_spl_serial_init (void ) {#ifdef CONFIG_SPL_SERIAL -void __iomem *base =ioremap_nocache (SYSCTL_BASE ,SYSCTL_SIZE ); +void __iomem __maybe_unused *base =ioremap_nocache (SYSCTL_BASE ,SYSCTL_SIZE );#if CONFIG_CONS_INDEX ==1 clrbits_32 (base +SYSCTL_GPIOMODE_REG ,UART1_MODE );
arch/mips/mach-mtmips/mt7628/serial.c +1 -1
@@ -11,7 +11,7 @@void mtmips_spl_serial_init (void ) {#ifdef CONFIG_SPL_SERIAL -void __iomem *base =ioremap_nocache (SYSCTL_BASE ,SYSCTL_SIZE ); +void __iomem __maybe_unused *base =ioremap_nocache (SYSCTL_BASE ,SYSCTL_SIZE );#if CONFIG_CONS_INDEX ==1 clrbits_32 (base +SYSCTL_GPIO_MODE1_REG ,UART0_MODE_M );
Signature · 1 line
2.39.5
PATCH v5 4/4 mips: mt7628: Add Onion Omega2/2+ board support
In reply to Philip OberfichtnerThe Omega2 / Omega2+ are based on the MediaTek MT7688 SoC with the following features:
- 64 / 128MB of DDR2 memory
- 16 / 32MB of SPI NOR flash
- USB, WiFi and many more peripherals
---
Notes:
Changes in v5: none
Changes in v4:
- Adapt bootcmd
- Rebase defconfig
Changes in v3:
- Adapt defconfig to [PATCH 1/2] (SPL_SIZE_LIMIT)
Changes in v2:
- Fix style issues as reported by checkpatch
- Add MAINTAINERS file
arch/mips/dts/Makefile | 1 + arch/mips/dts/onion-omega2p.dts | 58 ++++++++++++ arch/mips/mach-mtmips/mt7628/Kconfig | 7 ++ board/onion/omega2p/Kconfig | 12 +++ board/onion/omega2p/MAINTAINERS | 10 ++ board/onion/omega2p/Makefile | 3 + board/onion/omega2p/board.c | 134 +++++++++++++++++++++++++++ board/onion/omega2p/omega2p.env | 32 +++++++ configs/onion-omega2p_defconfig | 82 ++++++++++++++++ include/configs/onion-omega2p.h | 15 +++ 10 files changed, 354 insertions(+) create mode 100644 arch/mips/dts/onion-omega2p.dts create mode 100644 board/onion/omega2p/Kconfig create mode 100644 board/onion/omega2p/MAINTAINERS create mode 100644 board/onion/omega2p/Makefile create mode 100644 board/onion/omega2p/board.c create mode 100644 board/onion/omega2p/omega2p.env create mode 100644 configs/onion-omega2p_defconfig create mode 100644 include/configs/onion-omega2p.h
arch/mips/dts/Makefile +1 -0
@@ -21,6 +21,7 @@ dtb-$(CONFIG_BOARD_MT7621_NAND_RFB) += mediatek,mt7621-nand-rfb.dtb dtb-$(CONFIG_BOARD_MT7628_RFB) += mediatek,mt7628-rfb.dtb dtb-$(CONFIG_BOARD_GARDENA_SMART_GATEWAY_MT7688) += gardena-smart-gateway-mt7688.dtb dtb-$(CONFIG_BOARD_LINKIT_SMART_7688) += linkit-smart-7688.dtb +dtb-$(CONFIG_BOARD_ONION_OMEGA2) += onion-omega2p.dtb dtb-$(CONFIG_TARGET_OCTEON_EBB7304) += mrvl,octeon-ebb7304.dtb dtb-$(CONFIG_TARGET_OCTEON_NIC23) += mrvl,octeon-nic23.dtb dtb-$(CONFIG_BOARD_NETGEAR_CG3100D) += netgear,cg3100d.dtb
arch/mips/dts/onion-omega2p.dts new file +58 -0
58 lines not on this page · raw message
arch/mips/mach-mtmips/mt7628/Kconfig +7 -0
@@ -27,6 +27,12 @@ config BOARD_MT7628_RFB SPI-NOR flash, 1 built-in switch with 5 ports, 1 UART, 1 USB host, 1 SDXC, 1 PCIe socket and JTAG pins. +config BOARD_ONION_OMEGA2 + bool "Onion Omega2/2+" + help + Onion Omega2/2+ IoT computer. Has a MT7688 SoC with 64/128 MiB of DDR2 + RAM and 16/32 MiB of SPI flash. + config BOARD_VOCORE2 bool "VoCore2" select SPL_SERIAL
@@ -52,6 +58,7 @@ config SYS_CONFIG_NAME default "mt7628" if BOARD_MT7628_RFB source "board/gardena/smart-gateway-mt7688/Kconfig" +source "board/onion/omega2p/Kconfig" source "board/seeed/linkit-smart-7688/Kconfig" source "board/vocore/vocore2/Kconfig"
board/onion/omega2p/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +if BOARD_ONION_OMEGA2 + +config SYS_BOARD + default "omega2p" + +config SYS_VENDOR + default "onion" + +config SYS_CONFIG_NAME + default "onion-omega2p" + +endif
board/onion/omega2p/MAINTAINERS new file +10 -0
@@ -0,0 +1,10 @@ +ONION OMEGA2/2+ +M: Philip Oberfichtner <[email protected]> +S: Maintained +F: arch/mips/dts/onion-omega2p.dts +F: board/onion/omega2p/Kconfig +F: board/onion/omega2p/Makefile +F: board/onion/omega2p/board.c +F: board/onion/omega2p/omega2p.env +F: configs/onion-omega2p_defconfig +F: include/configs/onion-omega2p.h
board/onion/omega2p/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-y += board.o
board/onion/omega2p/board.c new file +134 -0
134 lines not on this page · raw message
board/onion/omega2p/omega2p.env new file +32 -0
@@ -0,0 +1,32 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (C) 2025 DENX Software Engineering GmbH, Philip Oberfichtner <[email protected]> + +# Boot options +bootargs=console=ttyS0,115200 rootfstype=squashfs,jffs2 +bootfile=firmware.bin +boot_linux=sf probe && mtd read firmware 81800000 0 400000 && bootm 81800000 + +# unset temporary variable and make the environment persist if necessary. +env_check= \ + env set reset_pressed; \ + if env info -p -d -q; then \ + echo "No valid environment found on flash. Write out the defaults."; \ + env save; \ + fi + +bootcmd= \ + if test -z "${reset_pressed}"; then \ + run env_check; \ + run boot_linux; \ + else \ + run env_check; \ + fi + +# Network configuration +serverip=192.168.8.100 +ipaddr=192.168.8.8 +loadaddr=0x81800000 + +# MTD settings +mtdids=nor0=spi0.0 +# mtdparts will be set at runtime, according to the specific board variant.
configs/onion-omega2p_defconfig new file +82 -0
82 lines not on this page · raw message
include/configs/onion-omega2p.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2024 Zheng Han <[email protected]>, Lazar Demin <[email protected]> +*/ +#ifndef __CONFIG_ONION_OMEGA2P_H +#define __CONFIG_ONION_OMEGA2P_H + +/* RAM */ +#define CFG_SYS_SDRAM_BASE 0x80000000 +#define CFG_SYS_INIT_SP_OFFSET 0x400000 + +/* Dummy value */ +#define CFG_SYS_UBOOT_BASE 0 + +#endif /* __CONFIG_ONION_OMEGA2P_H */
Signature · 1 line
2.39.5
Re: [PATCH v5 4/4] mips: mt7628: Add Onion Omega2/2+ board support
Hi Philip,
sorry for the long delay
Quoted 235 lines · Philip Oberfichtner
The Omega2 / Omega2+ are based on the MediaTek MT7688 SoC with the following features:
- 64 / 128MB of DDR2 memory
- 16 / 32MB of SPI NOR flash
- USB, WiFi and many more peripheralsSigned-off-by Philip Oberfichtner <[email protected]>---
Notes:
Changes in v5: noneChanges in v4:
- Adapt bootcmd
- Rebase defconfigChanges in v3:
- Adapt defconfig to [PATCH 1/2] (SPL_SIZE_LIMIT)Changes in v2:
- Fix style issues as reported by checkpatch
- AddMAINTAINERSfilearch/mips/dts/Makefile | 1 + arch/mips/dts/onion-omega2p.dts | 58 ++++++++++++ arch/mips/mach-mtmips/mt7628/Kconfig | 7 ++ board/onion/omega2p/Kconfig | 12 +++ board/onion/omega2p/MAINTAINERS | 10 ++ board/onion/omega2p/Makefile | 3 + board/onion/omega2p/board.c | 134 +++++++++++++++++++++++++++ board/onion/omega2p/omega2p.env | 32 +++++++ configs/onion-omega2p_defconfig | 82 ++++++++++++++++ include/configs/onion-omega2p.h | 15 +++ 10 files changed, 354 insertions(+)create mode 100644
arch/mips/dts/onion-omega2p.dtscreate mode 100644 board/onion/omega2p/Kconfig create mode 100644 board/onion/omega2p/MAINTAINERS create mode 100644 board/onion/omega2p/Makefile create mode 100644board/onion/omega2p/board.ccreate mode 100644 board/onion/omega2p/omega2p.env create mode 100644 configs/onion-omega2p_defconfig create mode 100644include/configs/onion-omega2p.harch/mips/dts/Makefile +1
-0@@ -21,6 +21,7 @@ dtb-$(CONFIG_BOARD_MT7621_NAND_RFB) += mediatek,mt7621-nand-rfb.dtb dtb-$(CONFIG_BOARD_MT7628_RFB) += mediatek,mt7628-rfb.dtb dtb-$(CONFIG_BOARD_GARDENA_SMART_GATEWAY_MT7688) += gardena-smart-gateway-mt7688.dtb dtb-$(CONFIG_BOARD_LINKIT_SMART_7688) += linkit-smart-7688.dtb +dtb-$(CONFIG_BOARD_ONION_OMEGA2) += onion-omega2p.dtb dtb-$(CONFIG_TARGET_OCTEON_EBB7304) += mrvl,octeon-ebb7304.dtb dtb-$(CONFIG_TARGET_OCTEON_NIC23) += mrvl,octeon-nic23.dtb dtb-$(CONFIG_BOARD_NETGEAR_CG3100D) += netgear,cg3100d.dtbarch/mips/dts/onion-omega2p.dts new file +58
-0@@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2024 Zheng Han <[email protected]>, Lazar Demin <[email protected]> + */ + +/dts-v1/; + +#include "mt7628a.dtsi" +#include <dt-bindings/gpio/gpio.h> + +/ { + compatible = "onion,omega2", "onion,omega2p", "ralink,mt7628a-soc"; + model = "Onion Omega2/Omega2+"; + + aliases { + serial0 = &uart0; + spi0 = &spi0; + }; + + chosen { + stdout-path = &uart0; + }; +}; + +&pinctrl { + state_default: pin_state { + p0led { + groups = "p0led_a"; + function = "led"; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + num-cs = <2>; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_dual_pins>; + + spi-flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <40000000>; + reg = <0>; + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_iot_mode>; + mediatek,poll-link-phy = <0>; +};arch/mips/mach-mtmips/mt7628/Kconfig +7
-0@@ -27,6 +27,12 @@ config BOARD_MT7628_RFB SPI-NOR flash, 1 built-in switch with 5 ports, 1 UART, 1 USB host, 1 SDXC, 1 PCIe socket and JTAG pins. +config BOARD_ONION_OMEGA2 + bool "Onion Omega2/2+" + help + Onion Omega2/2+ IoT computer. Has a MT7688 SoC with 64/128 MiB of DDR2 + RAM and 16/32 MiB of SPI flash. + config BOARD_VOCORE2 bool "VoCore2" select SPL_SERIAL@@ -52,6 +58,7 @@ config SYS_CONFIG_NAME default "mt7628" if BOARD_MT7628_RFB source "board/gardena/smart-gateway-mt7688/Kconfig" +source "board/onion/omega2p/Kconfig" source "board/seeed/linkit-smart-7688/Kconfig" source "board/vocore/vocore2/Kconfig"board/onion/omega2p/Kconfig new file +12
-0@@ -0,0 +1,12 @@ +if BOARD_ONION_OMEGA2 + +config SYS_BOARD + default "omega2p" + +config SYS_VENDOR + default "onion" + +config SYS_CONFIG_NAME + default "onion-omega2p" + +endifboard/onion/omega2p/MAINTAINERS new file +10
-0@@ -0,0 +1,10 @@ +ONION OMEGA2/2+ +M: Philip Oberfichtner <[email protected]> +S: Maintained +F: arch/mips/dts/onion-omega2p.dts +F: board/onion/omega2p/Kconfig +F: board/onion/omega2p/Makefile +F: board/onion/omega2p/board.c +F: board/onion/omega2p/omega2p.env +F: configs/onion-omega2p_defconfig +F: include/configs/onion-omega2p.hboard/onion/omega2p/Makefile new file +3
-0@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-y += board.oboard/onion/omega2p/board.c new file +42
-0@@ -0,0 +1,134 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2024 Zheng Han <[email protected]>, Lazar Demin <[email protected]> +* Copyright (C) 2025 DENX Software Engineering GmbH, Philip Oberfichtner <[email protected]> +*/ + +#include <asm/io.h> +#include <env.h> +#include <init.h> +#include <mtd.h> + +#define OMEGA2_REG (x) (*((u32 *)(x))) +#define OMEGA2_SYSCTL_BASE 0xB0000000 +#define OMEGA2_SYS_CNTL_BASE (OMEGA2_SYSCTL_BASE) +#define OMEGA2_REG_PIODIR (OMEGA2_SYSCTL_BASE + 0x600) + +static int detect_rst (void ) +{ +u32 val =OMEGA2_REG (0xb0000624 );// Read GPIO 44 (reset button) + +return (val &1 <<6 ) ?1 :0 ; +} + +static void gpio_init (void ) +{ +u32 val; + +printf ("Initializing MT7688 GPIO system.\n" ); + +//set gpio2_mode - setting wled, and p0,p1,p2,p3,p4 LED pins to GPIO mode + val =0x555 ; +OMEGA2_REG (OMEGA2_SYS_CNTL_BASE +0x64 ) = val;// GPIO2_MODE register +// GINT_FEDGE_1: setting "Enable falling edge triggered" for GPIOs 39-42 +OMEGA2_REG (0xb0000644 ) =0x0f <<7 ; + +// set gpio_ctrl_1 register: set GPIO44 to output +//gpio44 output gpio_ctrl_1 bit3=1 + val =OMEGA2_REG (OMEGA2_REG_PIODIR +0x04 ); + val |=1 <<12 ; +OMEGA2_REG (OMEGA2_REG_PIODIR +0x04 ) = val; + +// set gpio1_mode register: set WDT_MODE to GPIO mode
board/onion/omega2p/board.c line 52
Quoted 10 lines
board/onion/omega2p/board.c new file +10
-0+//set gpio1_mode 14=1b1 + val =OMEGA2_REG (OMEGA2_SYS_CNTL_BASE +0x60 ); + val |=1 <<14 ; +OMEGA2_REG (OMEGA2_SYS_CNTL_BASE +0x60 ) = val; + +// set gpio_ctrl_1 resgister: set GPIO38 to input +//gpio38 input gpio_ctrl_1 bit5=0 + val =OMEGA2_REG (OMEGA2_REG_PIODIR +0x04 ); + val &= ~1 <<6 ; +OMEGA2_REG (OMEGA2_REG_PIODIR +0x04 ) = val;
MT7628 has a pinctrl driver. As you are using "mt7628a.dtsi", you could try to configure those pin configs via device-tree
Quoted 45 lines
board/onion/omega2p/board.c new file +45
-0+} + +enum onion_board_variant { +OMEGA2 , +OMEGA2P , +UNKNOWN , +}; + +static enum onion_board_variant board_variant (void ) +{ +struct mtd_info *mtd; + +mtd_probe_devices (); + +mtd_for_each_device (mtd) { +if (mtd->type !=MTD_NORFLASH ) +continue ; + +switch (mtd->size) { +case 16 *1024 *1024 :// 16 MB +return OMEGA2 ; + +case 32 *1024 *1024 :// 32 MB +return OMEGA2P ; + +default : +break ; + } + } + +return UNKNOWN ; +} + +#define ONION_MTDPARTS_BASE "spi0.0:192k(u-boot),64k(u-boot-env),64k(factory)" + +static void set_mtdparts (void ) +{ +switch (board_variant ()) { +case OMEGA2P : +printf ("Detected board variant OMEGA2+: " ); +env_set ("mtdparts" ,ONION_MTDPARTS_BASE ",32448k(firmware)" ); +break ; + +case OMEGA2 : +printf ("Detected board variant OMEGA2: " );
board/onion/omega2p/board.c line 107
Quoted 10 lines
board/onion/omega2p/board.c new file +10
-0+env_set ("mtdparts" ,ONION_MTDPARTS_BASE ",16064k(firmware)" ); +break ; + +default : +printf ("Unable to detect board variant! Using default value: " ); +env_set ("mtdparts" ,ONION_MTDPARTS_BASE ); + } + +printf ("mtdparts=\"%s\"\n" ,env_get ("mtdparts" )); +}
you should just configure the basic MTD layout needed to boot U-Boot in your defconfig file. All further partitions should be set by the user or downstream sources. All that custom runtime code is not necessary and should be removed.
BTW: the part "...,32448k(firmware)" could be replaced with ",-(firmware)" to auto-fill the remaining space.
For example:
CONFIG_MTDIDS_DEFAULT="nor0=spi0.0" CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:192k(u-boot),64k(u-boot-env),64k(factory)"
board/onion/omega2p/board.c line 117
Quoted 10 lines
board/onion/omega2p/board.c new file +10
-0+ +#define WELCOME_MESSAGE \ + "\n\n" \ + " *************************************************************\n"\ + " * For more info on using U-Boot, visit *\n"\ + " * https://documentation.onioniot.com/bootloader/overview *\n"\ + " * *\n"\ + " * Hold the reset button to enter the U-Boot commandline. *\n"\ + " *************************************************************\n"\ + "\n"
custom message is not necessary, mainline code should just use the default U-Boot console prompt
Quoted 4 lines
board/onion/omega2p/board.c new file +4
-0+ +int board_late_init (void ) +{ +gpio_init ();
board/onion/omega2p/board.c line 131
Quoted 10 lines
board/onion/omega2p/board.c new file +10
-0+ +printf (WELCOME_MESSAGE ); + +set_mtdparts (); + +if (detect_rst ()) { +printf ("Reset button pressed - entering shell ...\n" ); +env_set ("reset_pressed" ,"1" ); +// This env variable is evaluated by our bootcmd. + }
mainline code should always stop at console prompt without any magic. Custom MTD partitions and boot methods should be configured by the user or in downstream sources.
Quoted 9 lines
board/onion/omega2p/board.c new file +3
-0+ +return 0 ; +}board/onion/omega2p/omega2p.env new file +0
-0
board/onion/omega2p/omega2p.env line 5
Quoted 5 lines
board/onion/omega2p/omega2p.env new file +5
-0@@ -0,0 +1,32 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (C) 2025 DENX Software Engineering GmbH, Philip Oberfichtner <[email protected]> + +# Boot options +bootargs=console=ttyS0,115200 rootfstype=squashfs,jffs2
should be reduced and set via defconfig, e.g.: CONFIG_BOOTARGS="console=ttyS0,115200"
Quoted 17 lines
board/onion/omega2p/omega2p.env new file +17
-0+bootfile=firmware.bin +boot_linux=sf probe && mtd read firmware 81800000 0 400000 && bootm 81800000 + +# unset temporary variable and make the environment persist if necessary. +env_check= \ + env set reset_pressed; \ + if env info -p -d -q; then \ + echo "No valid environment found on flash. Write out the defaults."; \ + env save; \ + fi + +bootcmd= \ + if test -z "${reset_pressed}"; then \ + run env_check; \ + run boot_linux; \ + else \ + run env_check; \
board/onion/omega2p/omega2p.env line 32
Quoted 10 lines
board/onion/omega2p/omega2p.env new file +10
-0+ fi + +# Network configuration +serverip=192.168.8.100 +ipaddr=192.168.8.8 +loadaddr=0x81800000 + +# MTD settings +mtdids=nor0=spi0.0 +# mtdparts will be set at runtime, according to the specific board variant.
with the suggestions above this custom env file as well as board.c are not really needed and can be dropped from this patch.
Quoted 28 lines
configs/onion-omega2p_defconfig new file +22
-0@@ -0,0 +1,82 @@ +CONFIG_MIPS=y +CONFIG_SKIP_LOWLEVEL_INIT=y +CONFIG_SYS_MALLOC_LEN=0x1000000 +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_ENV_SIZE=0x4000 +CONFIG_ENV_OFFSET=0x30000 +CONFIG_ENV_SECT_SIZE=0x10000 +CONFIG_DEFAULT_DEVICE_TREE="onion-omega2p" +CONFIG_SPL_SERIAL=y +CONFIG_SPL_SYS_MALLOC_F_LEN=0x80000 +CONFIG_SPL_BSS_START_ADDR=0x80010000 +CONFIG_SPL_BSS_MAX_SIZE=0x10000 +CONFIG_SYS_LOAD_ADDR=0x81800000 +CONFIG_SPL=y +CONFIG_ARCH_MTMIPS=y +CONFIG_SOC_MT7628=y +CONFIG_BOARD_ONION_OMEGA2=y +CONFIG_SYS_MIPS_TIMER_FREQ=290000000 +CONFIG_MIPS_CACHE_SETUP=y +CONFIG_MIPS_CACHE_DISABLE=y
configs/onion-omega2p_defconfig line 32
Quoted 10 lines
configs/onion-omega2p_defconfig new file +10
-0+CONFIG_RESTORE_EXCEPTION_VECTOR_BASE=y +# CONFIG_MIPS_BOOT_ENV_LEGACY is not set +CONFIG_MIPS_BOOT_FDT=y +CONFIG_ENV_VARS_UBOOT_CONFIG=y +CONFIG_FIT=y +CONFIG_FIT_SIGNATURE=y +CONFIG_LEGACY_IMAGE_FORMAT=y +CONFIG_BOOTDELAY=0 +CONFIG_AUTOBOOT_KEYED=y +CONFIG_AUTOBOOT_KEYED_CTRLC=y
autoboot shouldn't be enabled if there is no generic boot method available (e.g. like distro boot or EFI)
Quoted 20 lines
configs/onion-omega2p_defconfig new file +20
-0+CONFIG_OF_STDOUT_VIA_ALIAS=y +CONFIG_BOARD_LATE_INIT=y +CONFIG_SYS_MALLOC_BOOTPARAMS=y +CONFIG_UBOOT_WITH_SPL_SIZE_LIMIT=0x30000 +CONFIG_SPL_MAX_SIZE=0x10000 +CONFIG_SPL_SYS_MALLOC_SIMPLE=y +CONFIG_SPL_NOR_SUPPORT=y +CONFIG_HUSH_PARSER=y +# CONFIG_CMD_ELF is not set +CONFIG_CMD_ERASEENV=y +CONFIG_CMD_NVEDIT_INFO=y +CONFIG_CMD_MEMINFO=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_MTD=y +CONFIG_CMD_PART=y +CONFIG_CMD_SPI=y +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y +CONFIG_CMD_TIME=y
configs/onion-omega2p_defconfig line 62
Quoted 10 lines
configs/onion-omega2p_defconfig new file +10
-0+CONFIG_CMD_FS_GENERIC=y +CONFIG_CMD_MTDPARTS=y +CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_ENV_USE_DEFAULT_ENV_TEXT_FILE=y +CONFIG_ENV_DEFAULT_ENV_TEXT_FILE="board/onion/omega2p/omega2p.env" +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +CONFIG_USE_IPADDR=y +CONFIG_IPADDR="192.168.8.8" +CONFIG_USE_SERVERIP=y +CONFIG_SERVERIP="192.168.8.100"
mainline code should not have any specific network config
configs/onion-omega2p_defconfig line 74
Quoted 12 lines
configs/onion-omega2p_defconfig new file +12
-0+CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_SPL_DM=y +CONFIG_LED=y +CONFIG_LED_BLINK=y +CONFIG_LED_GPIO=y +CONFIG_DM_MTD=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_WINBOND=y
does the board vendor really use all SPI flash chips? If not you can drop the unneeded drivers to reduce code size
Quoted 29 lines
configs/onion-omega2p_defconfig new file +8
-0+CONFIG_SPI_FLASH_MTD=y +CONFIG_MT7628_ETH=y +CONFIG_PHY=y +CONFIG_SPI=y +CONFIG_MT7621_SPI=y +CONFIG_LZMA=y +# CONFIG_GZIP is not set +CONFIG_SPL_LZMA=yinclude/configs/onion-omega2p.h new file +15
-0@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2024 Zheng Han <[email protected]>, Lazar Demin <[email protected]> +*/ +#ifndef __CONFIG_ONION_OMEGA2P_H +#define __CONFIG_ONION_OMEGA2P_H + +/* RAM */ +#define CFG_SYS_SDRAM_BASE 0x80000000 +#define CFG_SYS_INIT_SP_OFFSET 0x400000 + +/* Dummy value */ +#define CFG_SYS_UBOOT_BASE 0 + +#endif /* __CONFIG_ONION_OMEGA2P_H */
Signature · 1 line
- Daniel
Re: [PATCH v5 4/4] mips: mt7628: Add Onion Omega2/2+ board support
Hi Daniel,
Thank you for the detailed review. I think I have properly addressed all the mentioned points in V6.
Best regards,
Philip
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Johanna Denk, Tabea Lutz HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany =====================================================================
Hi Daniel,
Gentle Ping on this patch series. Do you think we can still get it merged for the October release? Is there anything I can do to facilitate the process?
Best regards,
Philip
Quoted 51 lines · Philip Oberfichtner
Add support for the MediaTek based boards by Onion. Commit one to three are rather generic, whereas the last commit adds the actual board support.
Changes in v5:
- Reimplement theMakefilesize checkChanges in v4:
- Rebase board support to v2025.07
- Add new commit to silence warning inarch/mips/Changes in v3:
- Simplify image size checkChanges in v2:
- I forgot to run checkpatch in v1. Fix some style issues in v2.Philip Oberfichtner (4):
Makefile: Simplify size check
Makefile: Add size check for u-boot-with-spl.bin
mips: serial: Silence "unused variable" warning
mips: mt7628: Add Onion Omega2/2+ board supportMakefile | 45 ++------ arch/mips/dts/Makefile | 1 + arch/mips/dts/onion-omega2p.dts | 58 ++++++++++ arch/mips/mach-mtmips/mt7620/serial.c | 2 +- arch/mips/mach-mtmips/mt7621/spl/serial.c | 2 +- arch/mips/mach-mtmips/mt7628/Kconfig | 7 ++ arch/mips/mach-mtmips/mt7628/serial.c | 2 +- board/onion/omega2p/Kconfig | 12 ++ board/onion/omega2p/MAINTAINERS | 10 ++ board/onion/omega2p/Makefile | 3 + board/onion/omega2p/board.c | 134 ++++++++++++++++++++++ board/onion/omega2p/omega2p.env | 32 ++++++ common/spl/Kconfig | 7 ++ configs/onion-omega2p_defconfig | 82 +++++++++++++ include/configs/onion-omega2p.h | 15 +++ tools/spl_size_limit.c | 2 +- 16 files changed, 376 insertions(+), 38 deletions(-) create mode 100644 arch/mips/dts/onion-omega2p.dts create mode 100644 board/onion/omega2p/Kconfig create mode 100644 board/onion/omega2p/MAINTAINERS create mode 100644 board/onion/omega2p/Makefile create mode 100644 board/onion/omega2p/board.c create mode 100644 board/onion/omega2p/omega2p.env create mode 100644 configs/onion-omega2p_defconfig create mode 100644 include/configs/onion-omega2p.hSignature · 1 line
2.39.5
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Johanna Denk, Tabea Lutz HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany =====================================================================