Added Support for NetCube Systems Kumquat

Signed-off-by: Lukas Schmid <cubecraft15@gmail.com>
This commit is contained in:
Lukas Schmid 2024-04-24 09:00:35 +02:00
parent 583ecdb8b4
commit 915fb21a77
10 changed files with 1027 additions and 0 deletions

View File

@ -0,0 +1,38 @@
flash "w25q64" {
pebsize = 65536
lebsize = 65408
numpebs = 128
minimum-io-unit-size = 1
sub-page-size = 1
vid-header-offset = 64
}
image nor-flash.img {
flash {}
flashtype = "w25q64"
partition u-boot {
image = "u-boot-sunxi-with-spl.bin"
size = 512K
}
partition u-boot-env1 {
image = "/dev/zero"
size = 256K
}
partition u-boot-env2 {
image = "/dev/zero"
size = 256K
}
}
image sdcard.img {
hdimage {}
partition rootfs {
partition-type = 0x83
bootable = "true"
image = "rootfs.ext4"
}
}

View File

@ -0,0 +1,273 @@
/dts-v1/;
#include "allwinner/sun8i-v3s.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/gpio/gpio.h>
/{
model = "NetCube Systems Kumquat";
compatible = "netcube,kumquat", "allwinner,sun8i-v3s";
aliases {
serial0 = &uart0;
ethernet0 = &emac;
rtc0 = &sysrtc;
};
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 = <LED_COLOR_ID_GREEN>;
};
mmc0_act_led {
gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
linux,default-trigger = "mmc0";
function = LED_FUNCTION_DISK;
color = <LED_COLOR_ID_GREEN>;
};
};
gpio-keys {
compatible = "gpio-keys";
autorepeat;
user {
label = "User Defined Switch";
linux,code = <148>;
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>;
};
reg_vcc3v3: vcc3v3 {
compatible = "regulator-fixed";
regulator-name = "vcc3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
vin-supply = <&reg_vcc5v0>;
};
reg_vcc3v0: vcc3v0 {
compatible = "regulator-fixed";
regulator-name = "vcc3v0";
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3000000>;
vin-supply = <&reg_vcc3v3>;
};
can0_osc: can0_osc {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <40000000>;
};
};
/* mmc0 (Boot) */
&mmc0 {
pinctrl-names = "default";
pinctrl-0 = <&mmc0_pins>;
vmmc-supply = <&reg_vcc3v3>;
bus-width = <4>;
broken-cd;
status = "okay";
};
/* mmc1 (SDIO) */
&mmc1 {
pinctrl-names = "default";
pinctrl-0 = <&mmc1_pins>;
vmmc-supply = <&reg_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 = <&reg_vcc3v0>;
status = "disabled";
};
/* Sound Card */
&codec {
allwinner,audio-routing =
"Headphone", "HP",
"Headphone", "HPCOM",
"MIC1", "Mic",
"Mic", "HBIAS";
status = "okay";
};
/* Main Serial */
&uart0 {
pinctrl-0 = <&uart0_pb_pins>;
pinctrl-names = "default";
status = "okay";
};
/* ESP Serial */
&uart1 {
pinctrl-0 = <&uart1_pins>;
pinctrl-names = "default";
status = "okay";
};
/* 1st I2C */
&i2c0 {
pinctrl-0 = <&i2c0_pins>;
pinctrl-names = "default";
status = "okay";
idrom: eeprom@50 {
compatible = "atmel,24c02"; /* actually it's a 24AA02E48 */
pagesize = <16>;
read-only;
reg = <0x50>;
vcc-supply = <&reg_vcc3v3>;
#address-cells = <1>;
#size-cells = <1>;
eth0_macaddress: eth0_macaddress@FA {
reg = <0xFA 0x06>;
};
};
usb0_extcon: tusb320@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 = <&eth0_macaddress>; /* custom nvmem reference */
nvmem-cell-names = "mac-address"; /* see ethernet-controller.yaml */
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 */
status = "okay";
flash@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "jedec,spi-nor";
reg = <0>;
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 = <&reg_vcc3v3>;
xceiver-supply = <&reg_vcc3v3>;
};
};
&rtc {
status = "disabled";
};
&pio {
vcc-pb-supply = <&reg_vcc3v3>;
vcc-pc-supply = <&reg_vcc3v3>;
vcc-pe-supply = <&reg_vcc3v3>;
vcc-pf-supply = <&reg_vcc3v3>;
vcc-pg-supply = <&reg_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
uart0_pins: uart0-pins {
pins = "PB8", "PB9";
function = "uart0";
};
uart1_pins: uart1-pins {
pins = "PE21", "PE22";
function = "uart1";
};
spi0_pins: spi0-pins {
pins = "PC0", "PC1", "PC2", "PC3";
function = "spi0";
};
can0_pins: can0-pins {
pins = "PB1";
function = "gpio_in";
};
};

View File

@ -0,0 +1,155 @@
CONFIG_NO_HZ_IDLE=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_CGROUPS=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_PERF_EVENTS=y
CONFIG_ARCH_SUNXI=y
CONFIG_SMP=y
CONFIG_NR_CPUS=8
CONFIG_HIGHMEM=y
CONFIG_ARM_APPENDED_DTB=y
CONFIG_ARM_ATAG_DTB_COMPAT=y
CONFIG_CPU_FREQ=y
CONFIG_CPUFREQ_DT=y
CONFIG_VFP=y
CONFIG_NEON=y
# CONFIG_GCC_PLUGINS is not set
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_CMA=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
# CONFIG_INET_DIAG is not set
# CONFIG_IPV6 is not set
CONFIG_CAN=y
CONFIG_BT=y
CONFIG_BT_LEDS=y
CONFIG_CFG80211=y
CONFIG_MAC80211=y
CONFIG_MAC80211_LEDS=y
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_MTD=y
CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_MTD_SPI_NOR=y
CONFIG_EEPROM_AT24=y
CONFIG_NETDEVICES=y
CONFIG_SUN4I_EMAC=y
# CONFIG_NET_VENDOR_ARC is not set
# CONFIG_NET_VENDOR_BROADCOM is not set
# CONFIG_NET_VENDOR_CIRRUS is not set
# CONFIG_NET_VENDOR_FARADAY is not set
# CONFIG_NET_VENDOR_INTEL is not set
# CONFIG_NET_VENDOR_MARVELL is not set
# CONFIG_NET_VENDOR_MICREL is not set
# CONFIG_NET_VENDOR_MICROCHIP is not set
# CONFIG_NET_VENDOR_NATSEMI is not set
# CONFIG_NET_VENDOR_SAMSUNG is not set
# CONFIG_NET_VENDOR_SEEQ is not set
# CONFIG_NET_VENDOR_SMSC is not set
CONFIG_STMMAC_ETH=y
# CONFIG_NET_VENDOR_VIA is not set
# CONFIG_NET_VENDOR_WIZNET is not set
CONFIG_CAN_MCP251XFD=y
# CONFIG_WLAN is not set
CONFIG_INPUT_EVDEV=y
CONFIG_KEYBOARD_GPIO=y
CONFIG_KEYBOARD_SUN4I_LRADC=y
# CONFIG_INPUT_MOUSE is not set
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_NR_UARTS=8
CONFIG_SERIAL_8250_RUNTIME_UARTS=8
CONFIG_SERIAL_8250_DW=y
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MV64XXX=y
CONFIG_SPI=y
CONFIG_SPI_SUN6I=y
CONFIG_POWER_SUPPLY=y
CONFIG_THERMAL=y
CONFIG_CPU_THERMAL=y
CONFIG_SUN8I_THERMAL=y
CONFIG_WATCHDOG=y
CONFIG_SUNXI_WATCHDOG=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_REGULATOR_GPIO=y
CONFIG_MEDIA_SUPPORT=y
CONFIG_MEDIA_PLATFORM_SUPPORT=y
CONFIG_V4L_PLATFORM_DRIVERS=y
CONFIG_V4L_MEM2MEM_DRIVERS=y
CONFIG_VIDEO_SUN6I_CSI=y
CONFIG_VIDEO_SUN8I_DEINTERLACE=y
CONFIG_VIDEO_SUN8I_ROTATE=y
CONFIG_DRM=y
CONFIG_DRM_PANEL_SIMPLE=y
CONFIG_DRM_SIMPLE_BRIDGE=y
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_BACKLIGHT_PWM=y
CONFIG_SOUND=y
CONFIG_SND=y
CONFIG_SND_SOC=y
CONFIG_SND_SUN4I_CODEC=y
CONFIG_SND_SUN8I_CODEC=y
CONFIG_SND_SUN8I_CODEC_ANALOG=y
CONFIG_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_HCD_PLATFORM=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_PLATFORM=y
CONFIG_USB_MUSB_HDRC=y
CONFIG_USB_MUSB_SUNXI=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_GADGET=y
CONFIG_TYPEC=y
CONFIG_MMC=y
CONFIG_MMC_SUNXI=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
CONFIG_RTC_CLASS=y
# CONFIG_RTC_INTF_SYSFS is not set
# CONFIG_RTC_INTF_PROC is not set
CONFIG_RTC_DRV_DS3232=y
CONFIG_RTC_DRV_SUNXI=y
CONFIG_DMADEVICES=y
CONFIG_DMA_SUN6I=y
CONFIG_STAGING=y
CONFIG_STAGING_MEDIA=y
CONFIG_VIDEO_SUNXI=y
CONFIG_MAILBOX=y
# CONFIG_IOMMU_SUPPORT is not set
CONFIG_EXTCON_USB_GPIO=y
CONFIG_EXTCON_USBC_TUSB320=y
CONFIG_PWM=y
CONFIG_PWM_SUN4I=y
CONFIG_PHY_SUN4I_USB=y
CONFIG_NVMEM_SUNXI_SID=y
CONFIG_EXT4_FS=y
CONFIG_VFAT_FS=y
CONFIG_EXFAT_FS=y
CONFIG_TMPFS=y
CONFIG_NFS_FS=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=y
CONFIG_ROOT_NFS=y
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_CRYPTO_DEV_SUN4I_SS=y
CONFIG_CRYPTO_DEV_SUN4I_SS_PRNG=y
CONFIG_CRYPTO_DEV_SUN8I_CE=y
CONFIG_CRYPTO_DEV_SUN8I_CE_PRNG=y
CONFIG_CRYPTO_DEV_SUN8I_CE_TRNG=y
CONFIG_CRYPTO_DEV_SUN8I_SS=y
CONFIG_CRYPTO_DEV_SUN8I_SS_PRNG=y
CONFIG_DMA_CMA=y
CONFIG_PRINTK_TIME=y
CONFIG_DEBUG_FS=y

View File

@ -0,0 +1,4 @@
LABEL default
kernel /boot/zImage
fdt /boot/sun8i-v3s-netcube-kumquat.dtb
append root=/dev/mmcblk0p1 rootwait console=${console} rootfstype=ext4 panic=3

View File

@ -0,0 +1,68 @@
#!/bin/sh
DAEMON="esphosted"
ESPHOSTED_ARGS=""
# shellcheck source=/dev/null
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
esp32_set_bootmode_flash() {
# Set mode as Flash
gpioset $(gpiofind ESP_nBOOT)=1
# Reset ESP32
gpioset $(gpiofind ESP_nRST)=0
gpioset $(gpiofind ESP_nRST)=1
}
start() {
grep -e "esp32_sdio" /proc/modules && return 0
printf 'Starting %s: ' "$DAEMON"
esp32_set_bootmode_flash
modprobe esp32_sdio $ESPHOSTED_ARGS
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
stop() {
grep -e "esp32_sdio" /proc/modules || return 0
printf 'Stopping %s: ' "$DAEMON"
modprobe -r esp32_sdio
status=$?
if [ "$status" -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
restart() {
stop
sleep 1
start
}
case "$1" in
start|stop|restart)
"$1";;
reload)
# Restart, since there is no true "reload" feature.
restart;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac

View File

@ -0,0 +1,273 @@
/dts-v1/;
#include "sun8i-v3s.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/gpio/gpio.h>
/{
model = "NetCube Systems Kumquat";
compatible = "netcube,kumquat", "allwinner,sun8i-v3s";
aliases {
serial0 = &uart0;
ethernet0 = &emac;
rtc0 = &sysrtc;
};
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 = <LED_COLOR_ID_GREEN>;
};
mmc0_act_led {
gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
linux,default-trigger = "mmc0";
function = LED_FUNCTION_DISK;
color = <LED_COLOR_ID_GREEN>;
};
};
gpio-keys {
compatible = "gpio-keys";
autorepeat;
user {
label = "User Defined Switch";
linux,code = <148>;
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>;
};
reg_vcc3v3: vcc3v3 {
compatible = "regulator-fixed";
regulator-name = "vcc3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
vin-supply = <&reg_vcc5v0>;
};
reg_vcc3v0: vcc3v0 {
compatible = "regulator-fixed";
regulator-name = "vcc3v0";
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3000000>;
vin-supply = <&reg_vcc3v3>;
};
can0_osc: can0_osc {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <40000000>;
};
};
/* mmc0 (Boot) */
&mmc0 {
pinctrl-names = "default";
pinctrl-0 = <&mmc0_pins>;
vmmc-supply = <&reg_vcc3v3>;
bus-width = <4>;
broken-cd;
status = "okay";
};
/* mmc1 (SDIO) */
&mmc1 {
pinctrl-names = "default";
pinctrl-0 = <&mmc1_pins>;
vmmc-supply = <&reg_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 = <&reg_vcc3v0>;
status = "disabled";
};
/* Sound Card */
&codec {
allwinner,audio-routing =
"Headphone", "HP",
"Headphone", "HPCOM",
"MIC1", "Mic",
"Mic", "HBIAS";
status = "okay";
};
/* Main Serial */
&uart0 {
pinctrl-0 = <&uart0_pb_pins>;
pinctrl-names = "default";
status = "okay";
};
/* ESP Serial */
&uart1 {
pinctrl-0 = <&uart1_pins>;
pinctrl-names = "default";
status = "okay";
};
/* 1st I2C */
&i2c0 {
pinctrl-0 = <&i2c0_pins>;
pinctrl-names = "default";
status = "okay";
idrom: eeprom@50 {
compatible = "atmel,24c02"; /* actually it's a 24AA02E48 */
pagesize = <16>;
read-only;
reg = <0x50>;
vcc-supply = <&reg_vcc3v3>;
#address-cells = <1>;
#size-cells = <1>;
eth0_macaddress: eth0_macaddress@FA {
reg = <0xFA 0x06>;
};
};
usb0_extcon: tusb320@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 = <&eth0_macaddress>; /* custom nvmem reference */
nvmem-cell-names = "mac-address"; /* see ethernet-controller.yaml */
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 */
status = "okay";
flash@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "jedec,spi-nor";
reg = <0>;
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 = <&reg_vcc3v3>;
xceiver-supply = <&reg_vcc3v3>;
};
};
&rtc {
status = "disabled";
};
&pio {
vcc-pb-supply = <&reg_vcc3v3>;
vcc-pc-supply = <&reg_vcc3v3>;
vcc-pe-supply = <&reg_vcc3v3>;
vcc-pf-supply = <&reg_vcc3v3>;
vcc-pg-supply = <&reg_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
uart0_pins: uart0-pins {
pins = "PB8", "PB9";
function = "uart0";
};
uart1_pins: uart1-pins {
pins = "PE21", "PE22";
function = "uart1";
};
spi0_pins: spi0-pins {
pins = "PC0", "PC1", "PC2", "PC3";
function = "spi0";
};
can0_pins: can0-pins {
pins = "PB1";
function = "gpio_in";
};
};

View File

@ -0,0 +1,25 @@
From c0f338391533a5c29f84defe6433c7303cae3d40 Mon Sep 17 00:00:00 2001
From: Lukas Schmid <cubecraft15@gmail.com>
Date: Thu, 18 Apr 2024 12:29:56 +0200
Subject: [PATCH] spi: sunxi: v3s: Make SPL_SPI_SUNXI also available for SUN8I_V3S
---
arch/arm/mach-sunxi/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index fe89aec6..dd32128f 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -1078,7 +1078,7 @@ config SPL_STACK_R_ADDR
config SPL_SPI_SUNXI
bool "Support for SPI Flash on Allwinner SoCs in SPL"
- depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNXI_H3_H5 || MACH_SUN50I || MACH_SUN8I_R40 || SUN50I_GEN_H6 || MACH_SUNIV
+ depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNXI_H3_H5 || MACH_SUN50I || MACH_SUN8I_R40 || SUN50I_GEN_H6 || MACH_SUNIV || MACH_SUN8I_V3S
help
Enable support for SPI Flash. This option allows SPL to read from
sunxi SPI Flash. It uses the same method as the boot ROM, so does
--
2.25.1

View File

@ -0,0 +1,111 @@
From db24b593e45ff3af3859fc1e6a7da634fea77bc6 Mon Sep 17 00:00:00 2001
From: Lukas Schmid <cubecraft15@gmail.com>
Date: Tue, 23 Apr 2024 11:08:40 +0200
Subject: [PATCH] eth: sunxi: board-init: Try to load macaddr from eeprom
---
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 8c12c8de..050b8f75 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -186,6 +186,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;
+}
+
/* add board specific code here */
int board_init(void)
{
@@ -775,28 +812,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) {
+
+ 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 (i == 0)
+ strcpy(ethaddr, "ethaddr");
+ else
+ sprintf(ethaddr, "eth%daddr", i);
- if (env_get(ethaddr))
- continue;
+ 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;
+ /* 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);
+ eth_env_set_enetaddr(ethaddr, mac_addr);
+ }
}
if (!env_get("serial#")) {
--
2.25.1

View File

@ -0,0 +1,43 @@
CONFIG_ARM=y
CONFIG_ARCH_SUNXI=y
CONFIG_SF_DEFAULT_SPEED=40000000
CONFIG_ENV_SIZE=0x40000
CONFIG_ENV_OFFSET=0x80000
CONFIG_DEFAULT_DEVICE_TREE="sun8i-v3s-netcube-kumquat"
CONFIG_SPL=y
CONFIG_ENV_OFFSET_REDUND=0xc0000
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_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=flash"
CONFIG_MTDPARTS_DEFAULT="mtdparts=flash:512k(u-boot)ro,256k(u-boot-env1),256k(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_VERSION_VARIABLE=y
# CONFIG_NET 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_DM_RTC=y
CONFIG_RTC_DS3232=y
CONFIG_SPI=y

View File

@ -0,0 +1,37 @@
BR2_arm=y
BR2_cortex_a7=y
BR2_ARM_FPU_NEON_VFPV4=y
BR2_KERNEL_HEADERS_6_8=y
BR2_SYSTEM_DHCP="eth0"
BR2_ROOTFS_OVERLAY="board/netcube/kumquat/rootfs"
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/netcube/kumquat/genimage.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.8.7"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/netcube/kumquat/linux_defconfig"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="sun8i-v3s-netcube-kumquat"
BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="board/netcube/kumquat/linux-dts/*"
BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT=y
BR2_LINUX_KERNEL_INSTALL_TARGET=y
BR2_PACKAGE_ESP_HOSTED=y
BR2_PACKAGE_UBOOT_TOOLS=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="60M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2024.04"
BR2_TARGET_UBOOT_PATCH="board/netcube/kumquat/uboot-patches"
BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG=y
BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE="board/netcube/kumquat/uboot_defconfig"
# BR2_TARGET_UBOOT_FORMAT_BIN is not set
BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-sunxi-with-spl.bin"
BR2_TARGET_UBOOT_CUSTOM_DTS_PATH="board/netcube/kumquat/uboot-dts/*"
BR2_PACKAGE_HOST_ENVIRONMENT_SETUP=y
BR2_PACKAGE_HOST_GENIMAGE=y