diff --git a/board/netcube/kumquat/linux-dts/sun8i-v3s-netcube-kumquat.dts b/board/netcube/kumquat/linux-dts/sun8i-v3s-netcube-kumquat.dts index 9efcb7d199..4d54634b57 100644 --- a/board/netcube/kumquat/linux-dts/sun8i-v3s-netcube-kumquat.dts +++ b/board/netcube/kumquat/linux-dts/sun8i-v3s-netcube-kumquat.dts @@ -1,6 +1,11 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (C) 2025 Lukas Schmid + */ /dts-v1/; #include "allwinner/sun8i-v3s.dtsi" + #include #include #include @@ -12,56 +17,52 @@ aliases { serial0 = &uart0; ethernet0 = &emac; - rtc0 = &sysrtc; + rtc0 = &ds3232; + rtc1 = &rtc; /* not battery backed */ }; chosen { stdout-path = "serial0:115200n8"; }; - cpus { - cpu0: cpu@0 { - clock-frequency = <1200000000>; - }; - }; - - leds { - compatible = "gpio-leds"; - - heartbeat_led { - gpios = <&pio 4 4 GPIO_ACTIVE_HIGH>; /* PE4 */ - linux,default-trigger = "heartbeat"; - function = LED_FUNCTION_HEARTBEAT; - color = ; - }; - - mmc0_act_led { - gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */ - linux,default-trigger = "mmc0"; - function = LED_FUNCTION_DISK; - color = ; - }; + /* 40 MHz Crystal Oscillator on PCB */ + clk_can0: clock-can0 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <40000000>; }; gpio-keys { compatible = "gpio-keys"; autorepeat; - user { - label = "User Defined Switch"; - linux,code = <148>; + key-user { + label = "GPIO Key User"; + linux,code = ; gpios = <&pio 1 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PB2 */ }; }; - reg_vcc5v0: vcc5v0 { - compatible = "regulator-fixed"; - regulator-name = "vcc5v0"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; + leds { + compatible = "gpio-leds"; + + led-heartbeat { + gpios = <&pio 4 4 GPIO_ACTIVE_HIGH>; /* PE4 */ + linux,default-trigger = "heartbeat"; + color = ; + function = LED_FUNCTION_HEARTBEAT; + }; + + led-mmc0-act { + gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */ + linux,default-trigger = "mmc0"; + color = ; + function = LED_FUNCTION_DISK; + }; }; - reg_vcc3v3: vcc3v3 { + /* EA3036C Switching 3 Channel Regulator - Channel 2 */ + reg_vcc3v3: regulator-3v3 { compatible = "regulator-fixed"; regulator-name = "vcc3v3"; regulator-min-microvolt = <3300000>; @@ -69,72 +70,15 @@ vin-supply = <®_vcc5v0>; }; - reg_vcc3v0: vcc3v0 { + /* K7805-1000R3 Switching Regulator supplied from main 12/24V terminal block */ + reg_vcc5v0: regulator-5v0 { compatible = "regulator-fixed"; - regulator-name = "vcc3v0"; - regulator-min-microvolt = <3000000>; - regulator-max-microvolt = <3000000>; - vin-supply = <®_vcc3v3>; - }; - - can0_osc: can0_osc { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <40000000>; + regulator-name = "vcc5v0"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; }; }; -/* mmc0 (Boot) */ -&mmc0 { - pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins>; - vmmc-supply = <®_vcc3v3>; - bus-width = <4>; - broken-cd; - status = "okay"; -}; - -/* mmc1 (SDIO) */ -&mmc1 { - pinctrl-names = "default"; - pinctrl-0 = <&mmc1_pins>; - vmmc-supply = <®_vcc3v3>; - bus-width = <4>; - broken-cd; - status = "okay"; -}; - -/* USB */ -&usb_otg { - extcon = <&usb0_extcon 0>; - dr_mode = "otg"; - status = "okay"; -}; - -&usbphy { - usb0_id_det-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */ - status = "okay"; -}; - -&ehci { - /delete-property/ phys; - /delete-property/ phy-names; - status = "okay"; -}; - -&ohci { - /delete-property/ phys; - /delete-property/ phy-names; - status = "okay"; -}; - -/* ADC */ -&lradc { - vref-supply = <®_vcc3v0>; - status = "disabled"; -}; - -/* Sound Card */ &codec { allwinner,audio-routing = "Headphone", "HP", @@ -144,96 +88,66 @@ status = "okay"; }; -/* Main Serial */ -&uart0 { - pinctrl-0 = <&uart0_pb_pins>; - pinctrl-names = "default"; +&ehci { status = "okay"; }; -/* ESP Serial */ -&uart1 { - pinctrl-0 = <&uart1_pins>; - pinctrl-names = "default"; +&emac { + allwinner,leds-active-low; + nvmem-cells = <ð0_macaddress>; + nvmem-cell-names = "mac-address"; status = "okay"; }; -/* 1st I2C */ &i2c0 { - pinctrl-0 = <&i2c0_pins>; - pinctrl-names = "default"; status = "okay"; - idrom: eeprom@50 { + ds3232: rtc@68 { + compatible = "dallas,ds3232"; + reg = <0x68>; + }; + + eeprom0: eeprom@50 { compatible = "atmel,24c02"; /* actually it's a 24AA02E48 */ + reg = <0x50>; pagesize = <16>; read-only; - reg = <0x50>; vcc-supply = <®_vcc3v3>; - + #address-cells = <1>; #size-cells = <1>; - eth0_macaddress: eth0_macaddress@FA { - reg = <0xFA 0x06>; + eth0_macaddress: macaddress@fa { + reg = <0xfa 0x06>; }; }; - usb0_extcon: tusb320@60 { + tusb320: typec@60 { compatible = "ti,tusb320"; reg = <0x60>; interrupt-parent = <&pio>; interrupts = <1 5 IRQ_TYPE_EDGE_FALLING>; }; - - sysrtc: rtc@68 { - compatible = "dallas,ds3232"; - reg = <0x68>; - }; }; -/* Ethernet */ -&emac { - allwinner,leds-active-low; - nvmem-cells = <ð0_macaddress>; /* custom nvmem reference */ - nvmem-cell-names = "mac-address"; /* see ethernet-controller.yaml */ +/* Exposed as the Flash/SD Header on the board */ +&mmc0 { + vmmc-supply = <®_vcc3v3>; + bus-width = <4>; + broken-cd; status = "okay"; }; -/* SPI */ -&spi0 { - #address-cells = <1>; - #size-cells = <0>; - pinctrl-names = "default"; - pinctrl-0 = <&spi0_pins>; - cs-gpios = <0>, <&pio 1 0 GPIO_ACTIVE_LOW>; /* PB0 */ +/* Connected to the on-board ESP32 */ +&mmc1 { + vmmc-supply = <®_vcc3v3>; + bus-width = <4>; + broken-cd; status = "okay"; - - flash@0 { - #address-cells = <1>; - #size-cells = <1>; - reg = <0>; - compatible = "jedec,spi-nor"; - label = "firmware"; - spi-max-frequency = <40000000>; - }; - - can@1 { - compatible = "microchip,mcp2518fd"; - reg = <1>; - clocks = <&can0_osc>; - pinctrl-names = "default"; - pinctrl-0 = <&can0_pins>; - spi-max-frequency = <20000000>; - interrupt-parent = <&pio>; - interrupts = <1 1 IRQ_TYPE_LEVEL_LOW>; - vdd-supply = <®_vcc3v3>; - xceiver-supply = <®_vcc3v3>; - }; }; -&rtc { - status = "disabled"; +&ohci { + status = "okay"; }; &pio { @@ -243,32 +157,117 @@ vcc-pf-supply = <®_vcc3v3>; vcc-pg-supply = <®_vcc3v3>; - gpio-reserved-ranges = <0 32>, <42 22>, <68 28>, <96 32>, <153 7>, <167 25>, <198 26>; - gpio-line-names = "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", //PA - "CAN_nCS", "CAN_nINT", "USER_SW", "PB3", "USB_ID", "USBC_nINT", "I2C0_SCL", "I2C0_SDA", "UART0_TX", "UART0_RX", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", //PB - "SPI_MISO", "SPI_SCK", "FLASH_nCS", "SPI_MOSI", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", //PC - "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", //PD - "Q12", "Q11", "Q10", "Q9", "LED_SYS0", "I1", "Q1", "Q2", "I2", "I3", "Q3", "Q4", "I4", "I5", "Q5", "Q6", "I6", "I7", "Q7", "Q8", "I8", "UART1_TXD", "UART1_RXD", "ESP_nRST", "ESP_nBOOT", "", "", "", "", "", "", "", //PE - "SD_D1", "SD_D0", "SD_CLK", "SD_CMD", "SD_D3", "SD_D2", "LED_SYS1", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", //PF - "ESP_CLK", "ESP_CMD", "ESP_D0", "ESP_D1", "ESP_D2", "ESP_D3", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""; //PG + gpio-line-names = "", "", "", "", // PA + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "CAN_nCS", "CAN_nINT", "USER_SW", "PB3", // PB + "USB_ID", "USBC_nINT", "I2C0_SCL", "I2C0_SDA", + "UART0_TX", "UART0_RX", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "SPI_MISO", "SPI_SCK", "FLASH_nCS", "SPI_MOSI", // PC + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", // PD + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "Q12", "Q11", "Q10", "Q9", // PE + "LED_SYS0", "I1", "Q1", "Q2", + "I2", "I3", "Q3", "Q4", + "I4", "I5", "Q5", "Q6", + "I6", "I7", "Q7", "Q8", + "I8", "UART1_TXD", "UART1_RXD", "ESP_nRST", + "ESP_nBOOT", "", "", "", + "", "", "", "", + "SD_D1", "SD_D0", "SD_CLK", "SD_CMD", // PF + "SD_D3", "SD_D2", "LED_SYS1", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "ESP_CLK", "ESP_CMD", "ESP_D0", "ESP_D1", // PG + "ESP_D2", "ESP_D3", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", ""; - uart0_pins: uart0-pins { - pins = "PB8", "PB9"; - function = "uart0"; - }; - - uart1_pins: uart1-pins { + uart1_pe_pins: uart1-pe-pins { pins = "PE21", "PE22"; function = "uart1"; }; +}; - spi0_pins: spi0-pins { - pins = "PC0", "PC1", "PC2", "PC3"; - function = "spi0"; +/* Exposed as a USB-C connector with USB-Serial converter */ +&uart0 { + pinctrl-0 = <&uart0_pb_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +/* Connected to the Bootloader/Console of the ESP32 */ +&uart1 { + pinctrl-0 = <&uart1_pe_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&usb_otg { + extcon = <&tusb320 0>; + dr_mode = "otg"; + status = "okay"; +}; + +&usbphy { + usb0_id_det-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */ + status = "okay"; +}; + +&spi0 { + #address-cells = <1>; + #size-cells = <0>; + cs-gpios = <0>, <&pio 1 0 GPIO_ACTIVE_LOW>; /* PB0 */ + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + label = "firmware"; + spi-max-frequency = <40000000>; }; - can0_pins: can0-pins { - pins = "PB1"; - function = "gpio_in"; + can@1 { + compatible = "microchip,mcp2518fd"; + reg = <1>; + clocks = <&clk_can0>; + interrupt-parent = <&pio>; + interrupts = <1 1 IRQ_TYPE_LEVEL_LOW>; /* PB1 */ + spi-max-frequency = <20000000>; + vdd-supply = <®_vcc3v3>; + xceiver-supply = <®_vcc3v3>; }; }; diff --git a/board/netcube/kumquat/linux_defconfig b/board/netcube/kumquat/linux_defconfig index 5c9c89d25c..e9104df49c 100644 --- a/board/netcube/kumquat/linux_defconfig +++ b/board/netcube/kumquat/linux_defconfig @@ -38,6 +38,8 @@ CONFIG_MTD=y CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_SPI_NOR=y CONFIG_EEPROM_AT24=y +CONFIG_SCSI=y +CONFIG_BLK_DEV_SD=y CONFIG_NETDEVICES=y CONFIG_SUN4I_EMAC=y # CONFIG_NET_VENDOR_ARC is not set @@ -71,6 +73,7 @@ CONFIG_I2C_CHARDEV=y CONFIG_I2C_MV64XXX=y CONFIG_SPI=y CONFIG_SPI_SUN6I=y +CONFIG_SPI_SPIDEV=m CONFIG_POWER_SUPPLY=y CONFIG_THERMAL=y CONFIG_CPU_THERMAL=y @@ -103,6 +106,8 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_HCD_PLATFORM=y CONFIG_USB_OHCI_HCD=y CONFIG_USB_OHCI_HCD_PLATFORM=y +CONFIG_USB_STORAGE=y +CONFIG_USB_UAS=y CONFIG_USB_MUSB_HDRC=y CONFIG_USB_MUSB_SUNXI=y CONFIG_NOP_USB_XCEIV=y diff --git a/board/netcube/kumquat/uboot-dts/sun8i-v3s-netcube-kumquat.dts b/board/netcube/kumquat/uboot-dts/sun8i-v3s-netcube-kumquat.dts index ea342ef84d..449b4e8a39 100644 --- a/board/netcube/kumquat/uboot-dts/sun8i-v3s-netcube-kumquat.dts +++ b/board/netcube/kumquat/uboot-dts/sun8i-v3s-netcube-kumquat.dts @@ -1,6 +1,11 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (C) 2025 Lukas Schmid + */ /dts-v1/; #include "sun8i-v3s.dtsi" + #include #include #include @@ -12,56 +17,52 @@ aliases { serial0 = &uart0; ethernet0 = &emac; - rtc0 = &sysrtc; + rtc0 = &ds3232; + rtc1 = &rtc; /* not battery backed */ }; chosen { stdout-path = "serial0:115200n8"; }; - cpus { - cpu0: cpu@0 { - clock-frequency = <1200000000>; - }; - }; - - leds { - compatible = "gpio-leds"; - - heartbeat_led { - gpios = <&pio 4 4 GPIO_ACTIVE_HIGH>; /* PE4 */ - linux,default-trigger = "heartbeat"; - function = LED_FUNCTION_HEARTBEAT; - color = ; - }; - - mmc0_act_led { - gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */ - linux,default-trigger = "mmc0"; - function = LED_FUNCTION_DISK; - color = ; - }; + /* 40 MHz Crystal Oscillator on PCB */ + clk_can0: clock-can0 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <40000000>; }; gpio-keys { compatible = "gpio-keys"; autorepeat; - user { - label = "User Defined Switch"; - linux,code = <148>; + key-user { + label = "GPIO Key User"; + linux,code = ; gpios = <&pio 1 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PB2 */ }; }; - reg_vcc5v0: vcc5v0 { - compatible = "regulator-fixed"; - regulator-name = "vcc5v0"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; + leds { + compatible = "gpio-leds"; + + led-heartbeat { + gpios = <&pio 4 4 GPIO_ACTIVE_HIGH>; /* PE4 */ + linux,default-trigger = "heartbeat"; + color = ; + function = LED_FUNCTION_HEARTBEAT; + }; + + led-mmc0-act { + gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */ + linux,default-trigger = "mmc0"; + color = ; + function = LED_FUNCTION_DISK; + }; }; - reg_vcc3v3: vcc3v3 { + /* EA3036C Switching 3 Channel Regulator - Channel 2 */ + reg_vcc3v3: regulator-3v3 { compatible = "regulator-fixed"; regulator-name = "vcc3v3"; regulator-min-microvolt = <3300000>; @@ -69,72 +70,15 @@ vin-supply = <®_vcc5v0>; }; - reg_vcc3v0: vcc3v0 { + /* K7805-1000R3 Switching Regulator supplied from main 12/24V terminal block */ + reg_vcc5v0: regulator-5v0 { compatible = "regulator-fixed"; - regulator-name = "vcc3v0"; - regulator-min-microvolt = <3000000>; - regulator-max-microvolt = <3000000>; - vin-supply = <®_vcc3v3>; - }; - - can0_osc: can0_osc { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <40000000>; + regulator-name = "vcc5v0"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; }; }; -/* mmc0 (Boot) */ -&mmc0 { - pinctrl-names = "default"; - pinctrl-0 = <&mmc0_pins>; - vmmc-supply = <®_vcc3v3>; - bus-width = <4>; - broken-cd; - status = "okay"; -}; - -/* mmc1 (SDIO) */ -&mmc1 { - pinctrl-names = "default"; - pinctrl-0 = <&mmc1_pins>; - vmmc-supply = <®_vcc3v3>; - bus-width = <4>; - broken-cd; - status = "okay"; -}; - -/* USB */ -&usb_otg { - extcon = <&usb0_extcon 0>; - dr_mode = "otg"; - status = "okay"; -}; - -&usbphy { - usb0_id_det-gpios = <&pio 1 4 GPIO_ACTIVE_LOW>; /* PB4 */ - status = "okay"; -}; - -&ehci { - /delete-property/ phys; - /delete-property/ phy-names; - status = "okay"; -}; - -&ohci { - /delete-property/ phys; - /delete-property/ phy-names; - status = "okay"; -}; - -/* ADC */ -&lradc { - vref-supply = <®_vcc3v0>; - status = "disabled"; -}; - -/* Sound Card */ &codec { allwinner,audio-routing = "Headphone", "HP", @@ -144,96 +88,66 @@ status = "okay"; }; -/* Main Serial */ -&uart0 { - pinctrl-0 = <&uart0_pb_pins>; - pinctrl-names = "default"; +&ehci { status = "okay"; }; -/* ESP Serial */ -&uart1 { - pinctrl-0 = <&uart1_pins>; - pinctrl-names = "default"; +&emac { + allwinner,leds-active-low; + nvmem-cells = <ð0_macaddress>; + nvmem-cell-names = "mac-address"; status = "okay"; }; -/* 1st I2C */ &i2c0 { - pinctrl-0 = <&i2c0_pins>; - pinctrl-names = "default"; status = "okay"; - idrom: eeprom@50 { + ds3232: rtc@68 { + compatible = "dallas,ds3232"; + reg = <0x68>; + }; + + eeprom0: eeprom@50 { compatible = "atmel,24c02"; /* actually it's a 24AA02E48 */ + reg = <0x50>; pagesize = <16>; read-only; - reg = <0x50>; vcc-supply = <®_vcc3v3>; - + #address-cells = <1>; #size-cells = <1>; - eth0_macaddress: eth0_macaddress@FA { - reg = <0xFA 0x06>; + eth0_macaddress: macaddress@fa { + reg = <0xfa 0x06>; }; }; - usb0_extcon: tusb320@60 { + tusb320: typec@60 { compatible = "ti,tusb320"; reg = <0x60>; interrupt-parent = <&pio>; interrupts = <1 5 IRQ_TYPE_EDGE_FALLING>; }; - - sysrtc: rtc@68 { - compatible = "dallas,ds3232"; - reg = <0x68>; - }; }; -/* Ethernet */ -&emac { - allwinner,leds-active-low; - nvmem-cells = <ð0_macaddress>; /* custom nvmem reference */ - nvmem-cell-names = "mac-address"; /* see ethernet-controller.yaml */ +/* Exposed as the Flash/SD Header on the board */ +&mmc0 { + vmmc-supply = <®_vcc3v3>; + bus-width = <4>; + broken-cd; status = "okay"; }; -/* SPI */ -&spi0 { - #address-cells = <1>; - #size-cells = <0>; - pinctrl-names = "default"; - pinctrl-0 = <&spi0_pins>; - cs-gpios = <0>, <&pio 1 0 GPIO_ACTIVE_LOW>; /* PB0 */ +/* Connected to the on-board ESP32 */ +&mmc1 { + vmmc-supply = <®_vcc3v3>; + bus-width = <4>; + broken-cd; status = "okay"; - - flash@0 { - #address-cells = <1>; - #size-cells = <1>; - reg = <0>; - compatible = "jedec,spi-nor"; - label = "firmware"; - spi-max-frequency = <40000000>; - }; - - can@1 { - compatible = "microchip,mcp2518fd"; - reg = <1>; - clocks = <&can0_osc>; - pinctrl-names = "default"; - pinctrl-0 = <&can0_pins>; - spi-max-frequency = <20000000>; - interrupt-parent = <&pio>; - interrupts = <1 1 IRQ_TYPE_LEVEL_LOW>; - vdd-supply = <®_vcc3v3>; - xceiver-supply = <®_vcc3v3>; - }; }; -&rtc { - status = "disabled"; +&ohci { + status = "okay"; }; &pio { @@ -243,32 +157,117 @@ vcc-pf-supply = <®_vcc3v3>; vcc-pg-supply = <®_vcc3v3>; - gpio-reserved-ranges = <0 32>, <42 22>, <68 28>, <96 32>, <153 7>, <167 25>, <198 26>; - gpio-line-names = "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", //PA - "CAN_nCS", "CAN_nINT", "USER_SW", "PB3", "USB_ID", "USBC_nINT", "I2C0_SCL", "I2C0_SDA", "UART0_TX", "UART0_RX", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", //PB - "SPI_MISO", "SPI_SCK", "FLASH_nCS", "SPI_MOSI", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", //PC - "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", //PD - "Q12", "Q11", "Q10", "Q9", "LED_SYS0", "I1", "Q1", "Q2", "I2", "I3", "Q3", "Q4", "I4", "I5", "Q5", "Q6", "I6", "I7", "Q7", "Q8", "I8", "UART1_TXD", "UART1_RXD", "ESP_nRST", "ESP_nBOOT", "", "", "", "", "", "", "", //PE - "SD_D1", "SD_D0", "SD_CLK", "SD_CMD", "SD_D3", "SD_D2", "LED_SYS1", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", //PF - "ESP_CLK", "ESP_CMD", "ESP_D0", "ESP_D1", "ESP_D2", "ESP_D3", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""; //PG + gpio-line-names = "", "", "", "", // PA + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "CAN_nCS", "CAN_nINT", "USER_SW", "PB3", // PB + "USB_ID", "USBC_nINT", "I2C0_SCL", "I2C0_SDA", + "UART0_TX", "UART0_RX", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "SPI_MISO", "SPI_SCK", "FLASH_nCS", "SPI_MOSI", // PC + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", // PD + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "Q12", "Q11", "Q10", "Q9", // PE + "LED_SYS0", "I1", "Q1", "Q2", + "I2", "I3", "Q3", "Q4", + "I4", "I5", "Q5", "Q6", + "I6", "I7", "Q7", "Q8", + "I8", "UART1_TXD", "UART1_RXD", "ESP_nRST", + "ESP_nBOOT", "", "", "", + "", "", "", "", + "SD_D1", "SD_D0", "SD_CLK", "SD_CMD", // PF + "SD_D3", "SD_D2", "LED_SYS1", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "ESP_CLK", "ESP_CMD", "ESP_D0", "ESP_D1", // PG + "ESP_D2", "ESP_D3", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", ""; - uart0_pins: uart0-pins { - pins = "PB8", "PB9"; - function = "uart0"; - }; - - uart1_pins: uart1-pins { + uart1_pe_pins: uart1-pe-pins { pins = "PE21", "PE22"; function = "uart1"; }; +}; - spi0_pins: spi0-pins { - pins = "PC0", "PC1", "PC2", "PC3"; - function = "spi0"; +/* Exposed as a USB-C connector with USB-Serial converter */ +&uart0 { + pinctrl-0 = <&uart0_pb_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +/* Connected to the Bootloader/Console of the ESP32 */ +&uart1 { + pinctrl-0 = <&uart1_pe_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&usb_otg { + extcon = <&tusb320 0>; + dr_mode = "otg"; + status = "okay"; +}; + +&usbphy { + usb0_id_det-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */ + status = "okay"; +}; + +&spi0 { + #address-cells = <1>; + #size-cells = <0>; + cs-gpios = <0>, <&pio 1 0 GPIO_ACTIVE_LOW>; /* PB0 */ + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + label = "firmware"; + spi-max-frequency = <40000000>; }; - can0_pins: can0-pins { - pins = "PB1"; - function = "gpio_in"; + can@1 { + compatible = "microchip,mcp2518fd"; + reg = <1>; + clocks = <&clk_can0>; + interrupt-parent = <&pio>; + interrupts = <1 1 IRQ_TYPE_LEVEL_LOW>; /* PB1 */ + spi-max-frequency = <20000000>; + vdd-supply = <®_vcc3v3>; + xceiver-supply = <®_vcc3v3>; }; }; diff --git a/board/netcube/kumquat/uboot-patches/0001-Remove-ethaddr-init-from-sunxi-board.c-as-it-conflic.patch b/board/netcube/kumquat/uboot-patches/0001-Remove-ethaddr-init-from-sunxi-board.c-as-it-conflic.patch new file mode 100644 index 0000000000..3ac0a4233b --- /dev/null +++ b/board/netcube/kumquat/uboot-patches/0001-Remove-ethaddr-init-from-sunxi-board.c-as-it-conflic.patch @@ -0,0 +1,55 @@ +From 6630de878d64b23f9c49001af38755b35bc80d4a Mon Sep 17 00:00:00 2001 +From: Lukas Schmid +Date: Tue, 21 Jan 2025 21:42:42 +0100 +Subject: [PATCH] Remove ethaddr init from sunxi/board.c as it conflicts with + nvmem-cells + +--- + board/sunxi/board.c | 26 -------------------------- + 1 file changed, 26 deletions(-) + +diff --git a/board/sunxi/board.c b/board/sunxi/board.c +index 961cdcde..4e5b4d13 100644 +--- a/board/sunxi/board.c ++++ b/board/sunxi/board.c +@@ -760,37 +760,11 @@ static void setup_environment(const void *fdt) + { + char serial_string[17] = { 0 }; + unsigned int sid[4]; +- uint8_t mac_addr[6]; +- char ethaddr[16]; + int i; + + if (!get_unique_sid(sid)) + return; + +- for (i = 0; i < 4; i++) { +- sprintf(ethaddr, "ethernet%d", i); +- if (!fdt_get_alias(fdt, ethaddr)) +- continue; +- +- if (i == 0) +- strcpy(ethaddr, "ethaddr"); +- else +- sprintf(ethaddr, "eth%daddr", i); +- +- if (env_get(ethaddr)) +- continue; +- +- /* Non OUI / registered MAC address */ +- mac_addr[0] = (i << 4) | 0x02; +- mac_addr[1] = (sid[0] >> 0) & 0xff; +- mac_addr[2] = (sid[3] >> 24) & 0xff; +- mac_addr[3] = (sid[3] >> 16) & 0xff; +- mac_addr[4] = (sid[3] >> 8) & 0xff; +- mac_addr[5] = (sid[3] >> 0) & 0xff; +- +- eth_env_set_enetaddr(ethaddr, mac_addr); +- } +- + if (!env_get("serial#")) { + snprintf(serial_string, sizeof(serial_string), + "%08x%08x", sid[0], sid[3]); +-- +2.47.1 + diff --git a/board/netcube/kumquat/uboot-patches/0001-eth-sunxi-board-init-Try-to-load-macaddr-from-eeprom.patch b/board/netcube/kumquat/uboot-patches/0001-eth-sunxi-board-init-Try-to-load-macaddr-from-eeprom.patch deleted file mode 100644 index 94dabf0f24..0000000000 --- a/board/netcube/kumquat/uboot-patches/0001-eth-sunxi-board-init-Try-to-load-macaddr-from-eeprom.patch +++ /dev/null @@ -1,114 +0,0 @@ -From b651bd630e8514714fcf145980bd41ef974fe670 Mon Sep 17 00:00:00 2001 -From: Lukas Schmid -Date: Wed, 1 Jan 2025 20:51:08 +0100 -Subject: [PATCH] eth: sunxi: board-init: Try to load macaddr from eeprom - -Upstream: N/A - -Signed-off-by: Lukas Schmid - ---- - board/sunxi/board.c | 77 ++++++++++++++++++++++++++++++++++----------- - 1 file changed, 59 insertions(+), 18 deletions(-) - -diff --git a/board/sunxi/board.c b/board/sunxi/board.c -index 961cdcd..5f20324 100644 ---- a/board/sunxi/board.c -+++ b/board/sunxi/board.c -@@ -185,6 +185,43 @@ enum env_location env_get_location(enum env_operation op, int prio) - return ENVL_UNKNOWN; - } - -+#define EEPROM_BUS_ADDR 0 -+#define EEPROM_ADDR 0x50 -+ -+static int eth_addr_init(void) -+{ -+ int rc; -+ u8 mac[6]; -+ char mstr[20]; -+ -+ struct udevice *dev; -+ struct udevice *bus; -+ -+ rc = uclass_get_device_by_seq(UCLASS_I2C, EEPROM_BUS_ADDR, &bus); -+ if (rc) { -+ printf("Couldn't get i2c bus.\n"); -+ return rc; -+ } -+ -+ rc = dm_i2c_probe(bus, EEPROM_ADDR, 0, &dev); -+ if (rc) { -+ printf("Couldn't get i2c eeprom.\n"); -+ return rc; -+ } -+ -+ rc = dm_i2c_read(dev, 0xFA, mac, 6); -+ if (rc) { -+ printf("i2c_read failed\n"); -+ return rc; -+ } -+ -+ sprintf(mstr, "%0X:%0X:%0X:%0X:%0X:%0X",mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); -+ printf("ethaddr set to: %s\n", mstr); -+ eth_env_set_enetaddr("ethaddr", mac); -+ -+ return 0; -+} -+ - /* called only from U-Boot proper */ - int board_init(void) - { -@@ -767,28 +804,32 @@ static void setup_environment(const void *fdt) - if (!get_unique_sid(sid)) - return; - -- for (i = 0; i < 4; i++) { -- sprintf(ethaddr, "ethernet%d", i); -- if (!fdt_get_alias(fdt, ethaddr)) -- continue; -+ /* Try to load the macaddr from eeprom, but fallback to sid based macaddr if failed */ -+ if (eth_addr_init() != 0) { - -- if (i == 0) -- strcpy(ethaddr, "ethaddr"); -- else -- sprintf(ethaddr, "eth%daddr", i); -+ for (i = 0; i < 4; i++) { -+ sprintf(ethaddr, "ethernet%d", i); -+ if (!fdt_get_alias(fdt, ethaddr)) -+ continue; - -- if (env_get(ethaddr)) -- continue; -+ if (i == 0) -+ strcpy(ethaddr, "ethaddr"); -+ else -+ sprintf(ethaddr, "eth%daddr", i); - -- /* Non OUI / registered MAC address */ -- mac_addr[0] = (i << 4) | 0x02; -- mac_addr[1] = (sid[0] >> 0) & 0xff; -- mac_addr[2] = (sid[3] >> 24) & 0xff; -- mac_addr[3] = (sid[3] >> 16) & 0xff; -- mac_addr[4] = (sid[3] >> 8) & 0xff; -- mac_addr[5] = (sid[3] >> 0) & 0xff; -+ if (env_get(ethaddr)) -+ continue; - -- eth_env_set_enetaddr(ethaddr, mac_addr); -+ /* Non OUI / registered MAC address */ -+ mac_addr[0] = (i << 4) | 0x02; -+ mac_addr[1] = (sid[0] >> 0) & 0xff; -+ mac_addr[2] = (sid[3] >> 24) & 0xff; -+ mac_addr[3] = (sid[3] >> 16) & 0xff; -+ mac_addr[4] = (sid[3] >> 8) & 0xff; -+ mac_addr[5] = (sid[3] >> 0) & 0xff; -+ -+ eth_env_set_enetaddr(ethaddr, mac_addr); -+ } - } - - if (!env_get("serial#")) { --- -2.46.1 diff --git a/board/netcube/kumquat/uboot_defconfig b/board/netcube/kumquat/uboot_defconfig index ede244f54c..7a03de16e3 100644 --- a/board/netcube/kumquat/uboot_defconfig +++ b/board/netcube/kumquat/uboot_defconfig @@ -25,10 +25,11 @@ 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_IS_IN_MMC=y 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