From 7e3cbdf04b745a635838e95c7ce99e39de6c422b Mon Sep 17 00:00:00 2001 From: Patrick Yavitz Date: Wed, 30 Jul 2025 07:32:57 -0400 Subject: [PATCH] Add board KickPi K2B Signed-off-by: Patrick Yavitz --- configs/kickpi_k2b_defconfig | 34 ++ .../allwinner/sun50i-h618-kickpi-k2b.dts | 315 ++++++++++++++++++ 2 files changed, 349 insertions(+) create mode 100644 configs/kickpi_k2b_defconfig create mode 100644 dts/upstream/src/arm64/allwinner/sun50i-h618-kickpi-k2b.dts diff --git a/configs/kickpi_k2b_defconfig b/configs/kickpi_k2b_defconfig new file mode 100644 index 00000000000..912b4633dd1 --- /dev/null +++ b/configs/kickpi_k2b_defconfig @@ -0,0 +1,34 @@ +CONFIG_OF_UPSTREAM=y +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y +CONFIG_DEFAULT_DEVICE_TREE="allwinner/sun50i-h618-kickpi-k2b" +CONFIG_SPL=y +CONFIG_DRAM_SUNXI_DX_ODT=0x07070707 +CONFIG_DRAM_SUNXI_DX_DRI=0x0e0e0e0e +CONFIG_DRAM_SUNXI_CA_DRI=0x0e0e +CONFIG_DRAM_SUNXI_ODT_EN=0xaaaaeeee +CONFIG_DRAM_SUNXI_TPR6=0x48808080 +CONFIG_DRAM_SUNXI_TPR10=0x402f6663 +CONFIG_DRAM_SUNXI_TPR11=0x26262524 +CONFIG_DRAM_SUNXI_TPR12=0x100f100f +CONFIG_MACH_SUN50I_H616=y +CONFIG_SUNXI_DRAM_H616_LPDDR4=y +CONFIG_DRAM_CLK=792 +CONFIG_MMC_SUNXI_SLOT_EXTRA=2 +CONFIG_R_I2C_ENABLE=y +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_SPL_I2C=y +CONFIG_SPL_SYS_I2C_LEGACY=y +CONFIG_SYS_I2C_MVTWSI=y +CONFIG_SYS_I2C_SLAVE=0x7f +CONFIG_SYS_I2C_SPEED=400000 +CONFIG_SUN8I_EMAC=y +CONFIG_SUPPORT_EMMC_BOOT=y +CONFIG_PHY_REALTEK=y +CONFIG_RTL8211F_PHY_FORCE_EEE_RXC_ON=y +CONFIG_RGMII=y +CONFIG_RMII=y +CONFIG_AXP313_POWER=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_MUSB_GADGET=y diff --git a/dts/upstream/src/arm64/allwinner/sun50i-h618-kickpi-k2b.dts b/dts/upstream/src/arm64/allwinner/sun50i-h618-kickpi-k2b.dts new file mode 100644 index 00000000000..95659012770 --- /dev/null +++ b/dts/upstream/src/arm64/allwinner/sun50i-h618-kickpi-k2b.dts @@ -0,0 +1,315 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (C) 2025 Patrick Yavitz + */ + +/dts-v1/; + +#include "sun50i-h616.dtsi" +#include "sun50i-h616-cpu-opp.dtsi" + +#include +#include +#include +#include + +/ { + model = "KickPi K2B"; + compatible = "kickpi,k2b", "allwinner,sun50i-h618"; + + aliases { + ethernet0 = &emac0; + serial0 = &uart0; + serial5 = &uart5; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + button-power { + label = "power"; + linux,code = ; + gpios = <&pio 2 2 GPIO_ACTIVE_LOW>; /* PC2 */ + }; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 8 16 GPIO_ACTIVE_HIGH>; /* PI6 */ + linux,default-trigger = "heartbeat"; + }; + }; + + reg_usb_vbus: regulator-usb-vbus { + /* Separate discrete regulator for the USB ports */ + compatible = "regulator-fixed"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-name = "usb-vbus"; + vin-supply = <®_vcc5v>; + }; + + reg_vcc5v: regulator-vcc5v { + /* Board wide 5V supply directly from the USB-C socket */ + compatible = "regulator-fixed"; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-name = "vcc-5v"; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rtc CLK_OSC32K_FANOUT>; + clock-names = "ext_clock"; + pinctrl-0 = <&x32clk_fanout_pin>; + pinctrl-names = "default"; + post-power-on-delay-ms = <100>; + power-off-delay-us = <5000000>; + reset-gpios = <&pio 6 18 GPIO_ACTIVE_LOW>, /* PG18 */ + <&pio 6 19 GPIO_ACTIVE_LOW>; /* PG19 */ + }; +}; + +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + +&emac0 { + status = "okay"; + pinctrl-0 = <&ext_rgmii_pins>; + pinctrl-names = "default"; + phy-mode = "rgmii"; + phy-handle = <&ext_rgmii_phy>; + allwinner,tx-delay-ps = <700>; + allwinner,rx-delay-ps = <1700>; +}; + +&ehci0 { + status = "okay"; +}; + +&ehci1 { + status = "okay"; +}; + +&ehci2 { + status = "okay"; +}; + +&ehci3 { + status = "disabled"; +}; + +&ir { + status = "okay"; + pinctrl-0 = <&ir_rx_pin>; + pinctrl-names = "default"; +}; + +&mdio0 { + ext_rgmii_phy: ethernet-phy@1 { + compatible = "ethernet-phy-id001c.c916"; + reg = <1>; + reset-assert-us = <20000>; + reset-deassert-us = <100000>; + reset-gpios = <&pio 8 6 GPIO_ACTIVE_LOW>; /* PI6 */ + }; +}; + +/* SD card */ +&mmc0 { + status = "okay"; + bus-width = <4>; + cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */ + cd-inverted; + disable-wp; + max-frequency = <50000000>; + vmmc-supply = <®_dldo1>; +}; + +/* SDIO */ +&mmc1 { + status = "okay"; + bus-width = <4>; + keep-power-in-suspend; + max-frequency = <100000000>; + mmc-pwrseq = <&sdio_pwrseq>; + no-mmc; + no-sd; + non-removable; + vmmc-supply = <®_dldo1>; + vqmmc-supply = <®_aldo1>; + + sdio: wifi@1 { + reg = <1>; + }; +}; + +/* eMMC */ +&mmc2 { + status = "okay"; + bus-width = <8>; + cap-mmc-hw-reset; + mmc-hs200-1_8v; + non-removable; + vmmc-supply = <®_dldo1>; + vqmmc-supply = <®_aldo1>; +}; + +&ohci0 { + status = "okay"; +}; + +&ohci1 { + status = "okay"; +}; + +&ohci2 { + status = "okay"; +}; + +&ohci3 { + status = "disabled"; +}; + +&pio { + vcc-pc-supply = <®_dldo1>; + vcc-pf-supply = <®_dldo1>; + vcc-pg-supply = <®_aldo1>; + vcc-ph-supply = <®_dldo1>; + vcc-pi-supply = <®_dldo1>; + vcc-pl-supply = <®_aldo1>; + + /* PI16 required for sys_led */ + ext_rgmii_pins: rgmii-pins { + pins = "PI0", "PI1", "PI2", "PI3", "PI4", + "PI5", "PI7", "PI8", "PI9", "PI10", + "PI11", "PI12", "PI13", "PI14", "PI15"; + function = "emac0"; + drive-strength = <40>; + }; + + /* Add I2C PH Pins */ + i2c1_ph_pins: i2c1-ph-pins { + pins = "PH0", "PH1"; + function = "i2c1"; + }; + + i2c2_ph_pins: i2c2-ph-pins { + pins = "PH2", "PH3"; + function = "i2c2"; + }; + + i2c4_ph_pins: i2c4-ph-pins { + pins = "PH6", "PH7"; + function = "i2c4"; + }; + + /* PC0 required for spi0 */ + mmc2_pins: mmc2-pins { + pins = "PC1", "PC5", "PC6", + "PC8", "PC9", "PC10", "PC11", + "PC13", "PC14", "PC15", "PC16"; + function = "mmc2"; + drive-strength = <30>; + bias-pull-up; + }; + + /* Add UART Pins */ + uart5_ph_pins: uart5-ph-pins { + pins = "PH2", "PH3"; + function = "uart5"; + }; +}; + +&r_i2c { + status = "okay"; + axp313: pmic@36 { + compatible = "x-powers,axp313a"; + reg = <0x36>; + #interrupt-cells = <1>; + interrupt-controller; + interrupt-parent = <&pio>; + + vin1-supply = <®_vcc5v>; + vin2-supply = <®_vcc5v>; + vin3-supply = <®_vcc5v>; + + regulators { + reg_aldo1: aldo1 { + regulator-always-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc-1v8-pll"; + }; + + reg_dldo1: dldo1 { + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-3v3-io"; + }; + + reg_dcdc1: dcdc1 { + regulator-always-on; + regulator-min-microvolt = <810000>; + regulator-max-microvolt = <990000>; + regulator-name = "vdd-gpu-sys"; + }; + + reg_dcdc2: dcdc2 { + regulator-always-on; + regulator-min-microvolt = <810000>; + regulator-max-microvolt = <1100000>; + regulator-name = "vdd-cpu"; + }; + + reg_dcdc3: dcdc3 { + regulator-always-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1500000>; + regulator-name = "vdd-dram"; + }; + }; + }; +}; + +&uart0 { + status = "okay"; + pinctrl-0 = <&uart0_ph_pins>; + pinctrl-names = "default"; +}; + +/* Bluetooth */ +&uart1 { + status = "okay"; + pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>; + pinctrl-names = "default"; + uart-has-rtscts; +}; + +&uart5 { + status = "disabled"; + pinctrl-0 = <&uart5_ph_pins>; + pinctrl-names = "default"; +}; + +&usbotg { + status = "okay"; + dr_mode = "peripheral"; +}; + +&usbphy { + status = "okay"; + usb1_vbus-supply = <®_usb_vbus>; +}; -- 2.43.0 From 99cf1c27b0e94fee704f683ba0f338b239de6bdf Mon Sep 17 00:00:00 2001 From: Patrick Yavitz Date: Sun, 3 Aug 2025 09:13:29 -0400 Subject: [PATCH] Enable KASLR Signed-off-by: Patrick Yavitz --- configs/kickpi_k2b_defconfig | 2 ++ 1 files changed, 2 insertions(+) diff --git a/configs/kickpi_k2b_defconfig b/configs/kickpi_k2b_defconfig index 912b4633dd1..578b5a799c9 100644 --- a/configs/kickpi_k2b_defconfig +++ b/configs/kickpi_k2b_defconfig @@ -17,6 +17,7 @@ CONFIG_DRAM_CLK=792 CONFIG_MMC_SUNXI_SLOT_EXTRA=2 CONFIG_R_I2C_ENABLE=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_CMD_KASLRSEED=y CONFIG_SPL_I2C=y CONFIG_SPL_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_MVTWSI=y @@ -29,6 +30,7 @@ CONFIG_RTL8211F_PHY_FORCE_EEE_RXC_ON=y CONFIG_RGMII=y CONFIG_RMII=y CONFIG_AXP313_POWER=y +CONFIG_DM_RNG=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_OHCI_HCD=y CONFIG_USB_MUSB_GADGET=y -- 2.43.0