408 lines
9.2 KiB
Diff
408 lines
9.2 KiB
Diff
From 6c977d4b0ef9d4cbbb28157b3843b9cbda468ad9 Mon Sep 17 00:00:00 2001
|
|
From: Patrick Yavitz <pyavitz@armbian.com>
|
|
Date: Tue, 7 Jan 2025 07:32:05 -0500
|
|
Subject: [PATCH] Add board BananaPi BPI-M4-Zero
|
|
|
|
Signed-off-by: Patrick Yavitz <pyavitz@armbian.com>
|
|
---
|
|
arch/arm/dts/Makefile | 1 +
|
|
arch/arm/dts/sun50i-h616.dtsi | 25 ++-
|
|
arch/arm/dts/sun50i-h618-bananapi-m4-zero.dts | 77 +++++++
|
|
arch/arm/dts/sun50i-h618-bananapi-m4.dtsi | 208 ++++++++++++++++++
|
|
configs/bananapi_m4zero_defconfig | 29 +++
|
|
5 files changed, 339 insertions(+), 1 deletion(-)
|
|
create mode 100644 arch/arm/dts/sun50i-h618-bananapi-m4-zero.dts
|
|
create mode 100644 arch/arm/dts/sun50i-h618-bananapi-m4.dtsi
|
|
create mode 100644 configs/bananapi_m4zero_defconfig
|
|
|
|
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
|
|
index b102ffb5f68..57f94860fd5 100644
|
|
--- a/arch/arm/dts/Makefile
|
|
+++ b/arch/arm/dts/Makefile
|
|
@@ -839,6 +839,7 @@ dtb-$(CONFIG_MACH_SUN50I_H6) += \
|
|
sun50i-h6-tanix-tx6-mini.dtb
|
|
dtb-$(CONFIG_MACH_SUN50I_H616) += \
|
|
sun50i-h616-orangepi-zero2.dtb \
|
|
+ sun50i-h618-bananapi-m4-zero.dtb \
|
|
sun50i-h618-orangepi-zero2w.dtb \
|
|
sun50i-h618-orangepi-zero3.dtb \
|
|
sun50i-h618-transpeed-8k618-t.dtb \
|
|
diff --git a/arch/arm/dts/sun50i-h616.dtsi b/arch/arm/dts/sun50i-h616.dtsi
|
|
index d549d277d97..ccd83ba1b9c 100644
|
|
--- a/arch/arm/dts/sun50i-h616.dtsi
|
|
+++ b/arch/arm/dts/sun50i-h616.dtsi
|
|
@@ -176,7 +176,7 @@
|
|
};
|
|
|
|
i2c0_pins: i2c0-pins {
|
|
- pins = "PI6", "PI7";
|
|
+ pins = "PI5", "PI6";
|
|
function = "i2c0";
|
|
};
|
|
|
|
@@ -256,6 +256,29 @@
|
|
pins = "PG8", "PG9";
|
|
function = "uart1";
|
|
};
|
|
+
|
|
+ /omit-if-no-ref/
|
|
+ uart4_pi_pins: uart4-pi-pins {
|
|
+ pins = "PI13", "PI14";
|
|
+ function = "uart4";
|
|
+ };
|
|
+
|
|
+ /omit-if-no-ref/
|
|
+ uart4_pi_rts_cts_pins: uart4-pi-rts-cts-pins {
|
|
+ pins = "PI15", "PI16";
|
|
+ function = "uart4";
|
|
+ };
|
|
+
|
|
+ /omit-if-no-ref/
|
|
+ uart5_pins: uart5-pins {
|
|
+ pins = "PH2", "PH3";
|
|
+ function = "uart5";
|
|
+ };
|
|
+
|
|
+ x32clk_fanout_pin: x32clk-fanout-pin {
|
|
+ pins = "PG10";
|
|
+ function = "clock";
|
|
+ };
|
|
};
|
|
|
|
gic: interrupt-controller@3021000 {
|
|
diff --git a/arch/arm/dts/sun50i-h618-bananapi-m4-zero.dts b/arch/arm/dts/sun50i-h618-bananapi-m4-zero.dts
|
|
new file mode 100644
|
|
index 00000000000..dde03092cf0
|
|
--- /dev/null
|
|
+++ b/arch/arm/dts/sun50i-h618-bananapi-m4-zero.dts
|
|
@@ -0,0 +1,77 @@
|
|
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
|
+/*
|
|
+ * Copyright (c) 2024 Patrick Yavitz <pyavitz@armbian.com>
|
|
+ */
|
|
+
|
|
+/dts-v1/;
|
|
+
|
|
+#include "sun50i-h618-bananapi-m4.dtsi"
|
|
+
|
|
+/ {
|
|
+ model = "BananaPi BPI-M4-Zero";
|
|
+ compatible = "sinovoip,bpi-m4-zero", "allwinner,sun50i-h618";
|
|
+
|
|
+ aliases {
|
|
+ serial5 = &uart5;
|
|
+ };
|
|
+
|
|
+ leds {
|
|
+ compatible = "gpio-leds";
|
|
+
|
|
+ led-0 {
|
|
+ color = <LED_COLOR_ID_RED>;
|
|
+ function = LED_FUNCTION_STATUS;
|
|
+ gpios = <&pio 2 12 GPIO_ACTIVE_HIGH>; /* PC12 */
|
|
+ linux,default-trigger = "heartbeat";
|
|
+ };
|
|
+ };
|
|
+};
|
|
+
|
|
+/* Connected to an on-board RTL8821CU USB WiFi chip. */
|
|
+&ehci1 {
|
|
+ status = "disabled";
|
|
+};
|
|
+
|
|
+&ehci3 {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&emac0 {
|
|
+ status = "disabled";
|
|
+};
|
|
+
|
|
+/* SDIO */
|
|
+&mmc1 {
|
|
+ status = "disabled";
|
|
+ bus-width = <4>;
|
|
+ max-frequency = <100000000>;
|
|
+
|
|
+ non-removable;
|
|
+ disable-wp;
|
|
+
|
|
+ /* WiFi firmware requires power to be kept while in suspend */
|
|
+ keep-power-in-suspend;
|
|
+
|
|
+ mmc-pwrseq = <&wifi_pwrseq>;
|
|
+
|
|
+ cd-gpios = <&pio 6 15 GPIO_ACTIVE_HIGH>; /* PG15 */
|
|
+ vmmc-supply = <®_vcc3v3>;
|
|
+
|
|
+ sdio: wifi@1 {
|
|
+ reg = <1>;
|
|
+ compatible = "brcm,bcm4329-fmac";
|
|
+ };
|
|
+};
|
|
+
|
|
+&ohci3 {
|
|
+ status = "okay";
|
|
+};
|
|
+
|
|
+&usbotg {
|
|
+ status = "okay";
|
|
+ dr_mode = "peripheral";
|
|
+};
|
|
+
|
|
+&usbphy {
|
|
+ status = "okay";
|
|
+};
|
|
diff --git a/arch/arm/dts/sun50i-h618-bananapi-m4.dtsi b/arch/arm/dts/sun50i-h618-bananapi-m4.dtsi
|
|
new file mode 100644
|
|
index 00000000000..650f533e8b4
|
|
--- /dev/null
|
|
+++ b/arch/arm/dts/sun50i-h618-bananapi-m4.dtsi
|
|
@@ -0,0 +1,208 @@
|
|
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
|
+/*
|
|
+ * Copyright (c) 2024 Patrick Yavitz <pyavitz@armbian.com>
|
|
+ */
|
|
+
|
|
+/dts-v1/;
|
|
+
|
|
+#include "sun50i-h616.dtsi"
|
|
+
|
|
+#include <dt-bindings/gpio/gpio.h>
|
|
+#include <dt-bindings/input/linux-event-codes.h>
|
|
+#include <dt-bindings/interrupt-controller/arm-gic.h>
|
|
+#include <dt-bindings/leds/common.h>
|
|
+
|
|
+/ {
|
|
+ aliases {
|
|
+ serial0 = &uart0;
|
|
+ };
|
|
+
|
|
+ chosen {
|
|
+ stdout-path = "serial0:115200n8";
|
|
+ };
|
|
+
|
|
+ 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";
|
|
+ };
|
|
+
|
|
+ reg_vcc3v3: regulator-vcc3v3 {
|
|
+ compatible = "regulator-fixed";
|
|
+ regulator-always-on;
|
|
+ regulator-min-microvolt = <3300000>;
|
|
+ regulator-max-microvolt = <3300000>;
|
|
+ regulator-name = "vcc-3v3";
|
|
+ vin-supply = <®_vcc5v>;
|
|
+ };
|
|
+
|
|
+ reg_vcc1v8: regulator-vcc1v8 {
|
|
+ compatible = "regulator-fixed";
|
|
+ regulator-always-on;
|
|
+ regulator-min-microvolt = <1800000>;
|
|
+ regulator-max-microvolt = <1800000>;
|
|
+ regulator-name = "vcc-1v8";
|
|
+ vin-supply = <®_vcc3v3>;
|
|
+ };
|
|
+
|
|
+ wifi_pwrseq: wifi-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 = <200>;
|
|
+ reset-gpios = <&pio 6 18 GPIO_ACTIVE_LOW>; /* PG18 */
|
|
+ };
|
|
+};
|
|
+
|
|
+&cpu0 {
|
|
+ cpu-supply = <®_dcdc2>;
|
|
+};
|
|
+
|
|
+&emac0 {
|
|
+ status = "okay";
|
|
+ pinctrl-0 = <&ext_rgmii_pins>;
|
|
+ pinctrl-names = "default";
|
|
+ phy-mode = "rgmii";
|
|
+ phy-handle = <&ext_rgmii_phy>;
|
|
+ phy-supply = <®_dldo1>;
|
|
+ allwinner,rx-delay-ps = <3100>;
|
|
+ allwinner,tx-delay-ps = <700>;
|
|
+};
|
|
+
|
|
+&ir {
|
|
+ status = "disabled";
|
|
+ pinctrl-0 = <&ir_rx_pin>;
|
|
+ pinctrl-names = "default";
|
|
+};
|
|
+
|
|
+&mdio0 {
|
|
+ ext_rgmii_phy: ethernet-phy@1 {
|
|
+ compatible = "ethernet-phy-ieee802.3-c22";
|
|
+ reg = <1>;
|
|
+ };
|
|
+};
|
|
+
|
|
+/* SD card */
|
|
+&mmc0 {
|
|
+ status = "okay";
|
|
+ bus-width = <4>;
|
|
+ max-frequency = <50000000>;
|
|
+
|
|
+ disable-wp;
|
|
+
|
|
+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
|
|
+ vmmc-supply = <®_vcc3v3>;
|
|
+};
|
|
+
|
|
+/* eMMC */
|
|
+&mmc2 {
|
|
+ status = "okay";
|
|
+ bus-width = <8>;
|
|
+ cap-mmc-hw-reset;
|
|
+ mmc-hs200-1_8v;
|
|
+
|
|
+ non-removable;
|
|
+ disable-wp;
|
|
+
|
|
+ vmmc-supply = <®_vcc3v3>;
|
|
+ vqmmc-supply = <®_vcc1v8>;
|
|
+};
|
|
+
|
|
+&pio {
|
|
+ vcc-pc-supply = <®_aldo1>;
|
|
+ vcc-pf-supply = <®_dldo1>;
|
|
+ vcc-pg-supply = <®_dldo1>;
|
|
+ vcc-ph-supply = <®_dldo1>;
|
|
+ vcc-pi-supply = <®_dldo1>;
|
|
+};
|
|
+
|
|
+&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 = <1100000>;
|
|
+ regulator-name = "vdd-dram";
|
|
+ };
|
|
+ };
|
|
+ };
|
|
+};
|
|
+
|
|
+&uart0 {
|
|
+ status = "okay";
|
|
+ pinctrl-0 = <&uart0_ph_pins>;
|
|
+ pinctrl-names = "default";
|
|
+};
|
|
+
|
|
+&uart1 {
|
|
+ status = "disabled";
|
|
+ pinctrl-0 = <&uart1_pins>;
|
|
+ pinctrl-names = "default";
|
|
+};
|
|
+
|
|
+&uart4 {
|
|
+ status = "disabled";
|
|
+ pinctrl-0 = <&uart4_pi_pins>;
|
|
+ pinctrl-names = "default";
|
|
+};
|
|
+
|
|
+&uart5 {
|
|
+ status = "okay";
|
|
+ pinctrl-0 = <&uart5_pins>;
|
|
+ pinctrl-names = "default";
|
|
+};
|
|
diff --git a/configs/bananapi_m4zero_defconfig b/configs/bananapi_m4zero_defconfig
|
|
new file mode 100644
|
|
index 00000000000..3442bd0c77b
|
|
--- /dev/null
|
|
+++ b/configs/bananapi_m4zero_defconfig
|
|
@@ -0,0 +1,29 @@
|
|
+CONFIG_ARM=y
|
|
+CONFIG_ARCH_SUNXI=y
|
|
+CONFIG_DEFAULT_DEVICE_TREE="sun50i-h618-bananapi-m4-zero"
|
|
+CONFIG_SPL=y
|
|
+CONFIG_DRAM_SUN50I_H616_DX_ODT=0x07070707
|
|
+CONFIG_DRAM_SUN50I_H616_DX_DRI=0x0e0e0e0e
|
|
+CONFIG_DRAM_SUN50I_H616_CA_DRI=0x0e0e
|
|
+CONFIG_DRAM_SUN50I_H616_ODT_EN=0xaaaaeeee
|
|
+CONFIG_DRAM_SUN50I_H616_TPR6=0x48808080
|
|
+CONFIG_DRAM_SUN50I_H616_TPR10=0x402f6663
|
|
+CONFIG_DRAM_SUN50I_H616_TPR11=0x26262524
|
|
+CONFIG_DRAM_SUN50I_H616_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_AXP313_POWER=y
|
|
+CONFIG_USB_EHCI_HCD=y
|
|
+CONFIG_USB_OHCI_HCD=y
|
|
+CONFIG_USB_MUSB_GADGET=y
|
|
--
|
|
2.39.5
|
|
|