Skip to contentSkip to conversation

sunxi: Add NetCube Systems Kumquat support and fix nvmem MAC handling

PATCH Superseded Lukas Schmid 2 participants 4 messages Jun 7, 2025 – Jun 9, 2025 Arm/Allwinner sunXi SoC support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover sunxi: Add NetCube Systems Kumquat support and fix nvmem MAC handling

This series adds a defconfig for the NetCube Systems Kumquat and fixes and issue with setup_environment ignoring the mac-address loaded using nvmem-cells

Note: This series is based on U-Boot's next branch because it depends on the sun8i-v3s-netcube-kumquat.dts device tree, which was recently synced from upstream Linux and is not yet available in master.

---
Lukas Schmid (2):
sunxi: setup_environment: do not generate a MAC address when one is
set using nvmem-cells
configs: add support for NetCube Systems Kumquat

 board/sunxi/board.c                         | 15 +++++-
 configs/sun8i_v3s_netcube_kumquat_defconfig | 57 +++++++++++++++++++++
 2 files changed, 71 insertions(+), 1 deletion(-)
 create mode 100644 configs/sun8i_v3s_netcube_kumquat_defconfig
Signature · 1 line
2.39.5
#1 lore raw

PATCH 1/2 sunxi: setup_environment: do not generate a MAC address when one is set using nvmem-cells

Boards using MAC addresses stored in EEPROM via the device tree's nvmem-cells mechanism may already have a valid MAC loaded by the device model. However, setup_environment() currently ignores this and generates a fallback address from the SoC SID if no environment variable is set.

This leads to a mismatch warning during boot when the kernel or U-Boot detects the MAC from nvmem and compares it to the environment.

This patch checks whether the corresponding ethernet device node has a nvmem-cells property and skips generating a fallback MAC if it does, thus avoiding redundant or incorrect ethaddr setup.

This improves compatibility with nvmem-based MAC provisioning and aligns U-Boot behavior with Linux.

---
 board/sunxi/board.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
board/sunxi/board.c +14 -1
index ac9cefc6..41b85c66 100644
@@ -774,10 +774,23 @@ static void setup_environment(const void *fdt)
 		return;
 
 	for (i = 0; i < 4; i++) {
+		const char *alias;
+		int nodeoffset;
+		int len;
+		const fdt32_t *prop;
+
 		sprintf(ethaddr, "ethernet%d", i);
-		if (!fdt_get_alias(fdt, ethaddr))
+		alias = fdt_get_alias(fdt, ethaddr);
+		if (!alias)
 			continue;
 
+		nodeoffset = fdt_path_offset(fdt, alias);
+		if (nodeoffset >= 0) {
+			prop = fdt_getprop(fdt, nodeoffset, "nvmem-cells", &len);
+			if (prop && len > 0)
+				continue;
+		}
+
 		if (i == 0)
 			strcpy(ethaddr, "ethaddr");
 		else
Signature · 1 line
2.39.5
#2 lore raw

PATCH 2/2 configs: add support for NetCube Systems Kumquat

In reply to Lukas Schmid

NetCube Systems Kumquat is a board based on the Allwinner V3s SoC, including:

- 64MB DDR2 included in SoC
- 10/100 Mbps Ethernet
- USB-C DRD
- Audio Codec
- Isolated CAN-FD
- ESP32 over SDIO
- 8MB SPI-NOR Flash for bootloader
- I2C EEPROM for MAC addresses
- SDIO Connector for eMMC or SD-Card
- 8x 12/24V IOs, 4x normally open relays
- DS3232 RTC with Battery Backup
- QWIIC connectors for external I2C devices

---
 configs/sun8i_v3s_netcube_kumquat_defconfig | 57 +++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 configs/sun8i_v3s_netcube_kumquat_defconfig
configs/sun8i_v3s_netcube_kumquat_defconfig new file +57 -0
new file mode 100644
index 00000000..7a03de16
@@ -0,0 +1,57 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_SF_DEFAULT_SPEED=40000000
+CONFIG_ENV_SIZE=0x80000
+CONFIG_ENV_OFFSET=0x100000
+CONFIG_DEFAULT_DEVICE_TREE="sun8i-v3s-netcube-kumquat"
+CONFIG_SPL=y
+CONFIG_ENV_OFFSET_REDUND=0x180000
+CONFIG_MACH_SUN8I_V3S=y
+CONFIG_DRAM_CLK=360
+CONFIG_SPL_SPI_SUNXI=y
+# CONFIG_HAS_ARMV7_SECURE_BASE is not set
+# CONFIG_TIMESTAMP is not set
+CONFIG_SPI_BOOT=y
+CONFIG_BOOTDELAY=1
+CONFIG_PREBOOT=""
+# CONFIG_SYS_DEVICE_NULLDEV is not set
+CONFIG_SPL_MTD=y
+CONFIG_SYS_PROMPT="Kumquat> "
+CONFIG_CMD_EEPROM=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_RTC=y
+CONFIG_MTDIDS_DEFAULT="nor0=firmware"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=firmware:1M(u-boot)ro,512k(u-boot-env1),512k(u-boot-env2),-(user)"
+CONFIG_CMD_DIAG=y
+# CONFIG_ENV_IS_IN_FAT is not set
+CONFIG_ENV_SPI_MAX_HZ=1000000
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_USE_HOSTNAME=y
+CONFIG_HOSTNAME="kumquat"
+CONFIG_VERSION_VARIABLE=y
+# CONFIG_USB_FUNCTION_FASTBOOT is not set
+CONFIG_SYS_I2C_MVTWSI=y
+CONFIG_MISC=y
+CONFIG_NVMEM=y
+CONFIG_I2C_EEPROM=y
+CONFIG_SYS_I2C_EEPROM_ADDR=0x50
+CONFIG_MTD=y
+CONFIG_SPI_FLASH_BAR=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_SUN8I_EMAC=y
+CONFIG_PHY_SUN4I_USB=y
+CONFIG_DM_RTC=y
+CONFIG_RTC_DS3232=y
+CONFIG_SPI=y
+CONFIG_USB_MUSB_HOST=y
+CONFIG_USB_MUSB_GADGET=y
+CONFIG_USB_HOST_ETHER=y
+CONFIG_USB_ETHER_ASIX=y
+CONFIG_USB_ETHER_ASIX88179=y
+CONFIG_USB_ETHER_MCS7830=y
+CONFIG_USB_ETHER_RTL8152=y
+CONFIG_USB_ETHER_SMSC95XX=y
+# CONFIG_USB_ETHER is not set
Signature · 1 line
2.39.5
#3 lore raw

Re: [PATCH 2/2] configs: add support for NetCube Systems Kumquat

On Sat, 7 Jun 2025 11:11:40 +0200
Lukas Schmid <[email protected]> wrote:

Hi Lukas,

thanks for taking care and sending a patch!

(CC:ing Paul, please mind his recent V3x U-Boot series here:
https://lore.kernel.org/linux-sunxi/[email protected]/T/#t)

configs/sun8i_v3s_netcube_kumquat_defconfig

Quoted 27 lines

NetCube Systems Kumquat is a board based on the Allwinner V3s SoC, including:

- 64MB DDR2 included in SoC
- 10/100 Mbps Ethernet
- USB-C DRD
- Audio Codec
- Isolated CAN-FD
- ESP32 over SDIO
- 8MB SPI-NOR Flash for bootloader
- I2C EEPROM for MAC addresses
- SDIO Connector for eMMC or SD-Card
- 8x 12/24V IOs, 4x normally open relays
- DS3232 RTC with Battery Backup
- QWIIC connectors for external I2C devices

---
 configs/sun8i_v3s_netcube_kumquat_defconfig | 57 +++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 configs/sun8i_v3s_netcube_kumquat_defconfig
configs/sun8i_v3s_netcube_kumquat_defconfig new file +0 -0
new file mode 100644
index 00000000..7a03de16

The defconfig names are just maker-model style, we do not use any sunxi prefixes. So just name it "netcube_kumquat_defconfig".

configs/sun8i_v3s_netcube_kumquat_defconfig line 5

Quoted 6 lines
configs/sun8i_v3s_netcube_kumquat_defconfig new file +5 -0
@@ -0,0 +1,57 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_SF_DEFAULT_SPEED=40000000
+CONFIG_ENV_SIZE=0x80000
+CONFIG_ENV_OFFSET=0x100000

What are the reasons for the non-default environment size and location? Isn't 64K just under 1MB enough? 512K sounds like a lot, what do you store in there?

configs/sun8i_v3s_netcube_kumquat_defconfig line 14

Quoted 9 lines
configs/sun8i_v3s_netcube_kumquat_defconfig new file +9 -0
+CONFIG_DEFAULT_DEVICE_TREE="sun8i-v3s-netcube-kumquat"
+CONFIG_SPL=y
+CONFIG_ENV_OFFSET_REDUND=0x180000
+CONFIG_MACH_SUN8I_V3S=y
+CONFIG_DRAM_CLK=360
+CONFIG_SPL_SPI_SUNXI=y
+# CONFIG_HAS_ARMV7_SECURE_BASE is not set
+# CONFIG_TIMESTAMP is not set
+CONFIG_SPI_BOOT=y

That symbol is admittedly somewhat misnamed, and is only needed on one Atmel SoC, apparently. So please remove it.

configs/sun8i_v3s_netcube_kumquat_defconfig line 23

Quoted 9 lines
configs/sun8i_v3s_netcube_kumquat_defconfig new file +9 -0
+CONFIG_BOOTDELAY=1
+CONFIG_PREBOOT=""
+# CONFIG_SYS_DEVICE_NULLDEV is not set
+CONFIG_SPL_MTD=y
+CONFIG_SYS_PROMPT="Kumquat> "  
+CONFIG_CMD_EEPROM=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_RTC=y

Just curious, what is the RTC command used for? Do you really read or set the time, or are there are configuration values you store in NVRAM? And also, given all the commands, are there any custom boot scripts you are using?

configs/sun8i_v3s_netcube_kumquat_defconfig line 25

Quoted 2 lines
configs/sun8i_v3s_netcube_kumquat_defconfig new file +2 -0
+CONFIG_MTDIDS_DEFAULT="nor0=firmware"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=firmware:1M(u-boot)ro,512k(u-boot-env1),512k(u-boot-env2),-(user)"

That does not match what's described in the Kumquat readthedocs documentation, is there any particular reason for that?

Quoted 6 lines
configs/sun8i_v3s_netcube_kumquat_defconfig new file +6 -0
+CONFIG_CMD_DIAG=y
+# CONFIG_ENV_IS_IN_FAT is not set
+CONFIG_ENV_SPI_MAX_HZ=1000000
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_USE_HOSTNAME=y

configs/sun8i_v3s_netcube_kumquat_defconfig line 41

Quoted 10 lines
configs/sun8i_v3s_netcube_kumquat_defconfig new file +10 -0
+CONFIG_HOSTNAME="kumquat"
+CONFIG_VERSION_VARIABLE=y
+# CONFIG_USB_FUNCTION_FASTBOOT is not set
+CONFIG_SYS_I2C_MVTWSI=y
+CONFIG_MISC=y
+CONFIG_NVMEM=y
+CONFIG_I2C_EEPROM=y
+CONFIG_SYS_I2C_EEPROM_ADDR=0x50
+CONFIG_MTD=y
+CONFIG_SPI_FLASH_BAR=y

Do you really need this? It looks like the SPI flash is only 8MB in size, and judging by the doc this is only needed for SPI flash chips larger than 16MB.

Quoted 5 lines
configs/sun8i_v3s_netcube_kumquat_defconfig new file +5 -0
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_SUN8I_EMAC=y
+CONFIG_PHY_SUN4I_USB=y
+CONFIG_DM_RTC=y

configs/sun8i_v3s_netcube_kumquat_defconfig line 56

Quoted 10 lines
configs/sun8i_v3s_netcube_kumquat_defconfig new file +10 -0
+CONFIG_RTC_DS3232=y
+CONFIG_SPI=y
+CONFIG_USB_MUSB_HOST=y
+CONFIG_USB_MUSB_GADGET=y
+CONFIG_USB_HOST_ETHER=y
+CONFIG_USB_ETHER_ASIX=y
+CONFIG_USB_ETHER_ASIX88179=y
+CONFIG_USB_ETHER_MCS7830=y
+CONFIG_USB_ETHER_RTL8152=y
+CONFIG_USB_ETHER_SMSC95XX=y

Why do you need all those Ethernet USB drivers? The board seems to have the SoC EMAC connected, no?
Please note that the defconfig is not meant to reflect some useful debug or bring-up configuration, but more a common setup. In the case of this board I doubt that many people connect USB Ethernet adapters to the only USB port to use in U-Boot?

Cheers,
Andre

Quoted 1 line
configs/sun8i_v3s_netcube_kumquat_defconfig new file +1 -0
+# CONFIG_USB_ETHER is not set