Files
Blueberry/SF/ArmDebian/New/ARM64-dts-sun50i-h616-Blueberry.patch
T
2026-04-13 17:04:21 +08:00

449 lines
13 KiB
Diff

From: Aixiao <aixiao@aixiao.me>
Subject: [PATCH] Add Blueberry support
This patch adds the DTS and DTSI files for Blueberry and updates the Makefile.
---
arch/arm64/boot/dts/allwinner/Makefile | 1 +
arch/arm64/boot/dts/allwinner//sun50i-h616-blueberry-sd.dts | 35 ++
arch/arm64/boot/dts/allwinner/sun50i-h616-blueberry.dtsi | 377 +++++++++++++++++++++
diff --git a/arch/arm64/boot/dts/allwinner/Makefile b/arch/arm64/boot/dts/allwinner/Makefile
index 1234567..89abcdef 100644
--- a/arch/arm64/boot/dts/allwinner/Makefile
+++ b/arch/arm64/boot/dts/allwinner/Makefile
@@ -57,6 +57,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-bigtreetech-cb1-emmc.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-bigtreetech-cb1-manta.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-bigtreetech-cb1-sd.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-bigtreetech-pi.dtb
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-blueberry-sd.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-orangepi-zero2.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-x96-mate.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-bananapi-m4-berry.dtb
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616-blueberry-sd.dts b/arch/arm64/boot/dts/allwinner/sun50i-h616-blueberry-sd.dts
new file mode 100644
index 0000000..abcdefg
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h616-blueberry-sd.dts
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: (GPL-2.0+ or MIT)
+/*
+ * Copyright (C) 2023 Alan.Ma <tech@biqu3d.com>.
+ */
+
+/dts-v1/;
+
+#include "sun50i-h616-blueberry.dtsi"
+
+&ws2812 {
+ gpios = <&pio 2 14 GPIO_ACTIVE_LOW>; /* PC14 */
+};
+
+&i2c_gpio {
+ gpios = <&pio 2 12 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>, /* SDA PC12 */
+ <&pio 2 10 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; /* SCL PC10 */
+};
+
+&can0_pin_irq {
+ pins = "PC9";
+};
+
+&can {
+ interrupts = <2 9 0x08>; /* PC9 IRQ_TYPE_LEVEL_LOW */
+};
+
+&tft_35 {
+ dc-gpios = <&pio 2 14 GPIO_ACTIVE_HIGH>; /* PC14 */
+};
+
+&spi1 {
+ cs-gpios = <&pio 2 11 GPIO_ACTIVE_HIGH>, /* PC11 */
+ <&pio 2 7 GPIO_ACTIVE_HIGH>, /* PC7 */
+ <&pio 2 13 GPIO_ACTIVE_HIGH>; /* PC13 */
+};
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616-blueberry.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h616-blueberry.dtsi
new file mode 100644
index 0000000..abcdefg
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h616-blueberry.dtsi
@@ -0,0 +1,377 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (C) 2023 Martin Botka <martin.botka@somainline.org>.
+ * Copyright (C) 2023 Alan.Ma <tech@biqu3d.com>.
+ */
+
+/dts-v1/;
+
+#include "sun50i-h616.dtsi"
+#include "sun50i-h616-cpu-opp.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+ model = "Blueberry BLB";
+ compatible = "blueberry,blb", "allwinner,sun50i-h616";
+
+ aliases {
+ ethernet0 = &emac1;
+ serial0 = &uart0;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ connector {
+ compatible = "hdmi-connector";
+ type = "d";
+
+ port {
+ hdmi_con_in: endpoint {
+ remote-endpoint = <&hdmi_out_con>;
+ };
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ act_led: led-0 {
+ gpios = <&pio 7 5 GPIO_ACTIVE_LOW>; /* PH5 */
+ linux,default-trigger = "heartbeat";
+ };
+
+ gpio_1 {
+ function = "wifi_power";
+ gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
+ default-state = "on";
+ };
+
+ gpio_2 {
+ function = "wifi_wake";
+ gpios = <&pio 6 15 GPIO_ACTIVE_HIGH>; /* PG15 */
+ default-state = "on";
+ };
+ };
+
+ reg_vcc5v: regulator-vcc5v {
+ /* board wide 5V supply directly from the USB-C socket */
+ compatible = "regulator-fixed";
+ regulator-name = "vcc-5v";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ regulator-always-on;
+ };
+
+ reg_usb1_vbus: regulator-usb1-vbus {
+ compatible = "regulator-fixed";
+ regulator-name = "usb1-vbus";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ vin-supply = <&reg_vcc5v>;
+ enable-active-high;
+ };
+
+ reg_vcc33_wifi: vcc33-wifi {
+ /* Always on 3.3V regulator for WiFi and BT */
+ compatible = "regulator-fixed";
+ regulator-name = "vcc33-wifi";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-always-on;
+ vin-supply = <&reg_vcc5v>;
+ };
+
+ reg_vcc_wifi_io: vcc-wifi-io {
+ /* Always on 1.8V/300mA regulator for WiFi and BT IO */
+ compatible = "regulator-fixed";
+ regulator-name = "vcc-wifi-io";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ regulator-always-on;
+ vin-supply = <&reg_vcc33_wifi>;
+ };
+
+ wifi_pwrseq: wifi-pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ clocks = <&rtc 1>;
+ clock-names = "osc32k-out";
+ reset-gpios = <&pio 6 18 GPIO_ACTIVE_LOW>; /* PG18 */
+ post-power-on-delay-ms = <200>;
+ };
+
+ ws2812: ws2812 {
+ compatible = "rgb-ws2812";
+ pinctrl-names = "default";
+ rgb_cnt = <2>;
+ rgb_value = <0x000001 0x010000>;
+ status = "disabled";
+ };
+
+ i2c_gpio: i2c-gpio {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "i2c-gpio";
+ status = "disabled";
+
+ i2c-gpio,delay-us = <3>; /* 100 kHz */
+
+ tft_tp: ns2009@48 {
+ compatible = "ti,tsc2007";
+ reg = <0x48>;
+ status = "disabled";
+ ti,x-plate-ohms = <660>;
+ ti,y-plate-ohms = <660>;
+ ti,rt-thr = <3000>;
+ ti,fuzzx = <32>;
+ ti,fuzzy = <16>;
+ i2c,ignore-nak = <1>;
+ };
+
+ light: bh1750@5c {
+ compatible = "rohm,bh1750";
+ reg = <0x5c>;
+ status = "disabled";
+ };
+ };
+
+ mcp2515_clock: mcp2515_clock {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <12000000>;
+ };
+};
+
+&cpu0 {
+ cpu-supply = <&reg_dcdc2>;
+};
+
+&emac1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&rmii_pins>;
+ phy-mode = "rmii";
+ phy-handle = <&rmii_phy>;
+ phy-supply = <&reg_dldo1>;
+ allwinner,rx-delay-ps = <3100>;
+ allwinner,tx-delay-ps = <700>;
+ status = "okay";
+};
+
+&mdio1 {
+ rmii_phy: ethernet-phy@1 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ };
+};
+
+&mmc0 {
+ vmmc-supply = <&reg_dldo1>;
+ broken-cd;
+ bus-width = <4>;
+ max-frequency = <50000000>;
+ status = "okay";
+};
+
+&mmc1 {
+ vmmc-supply = <&reg_vcc33_wifi>;
+ vqmmc-supply = <&reg_vcc_wifi_io>;
+ mmc-pwrseq = <&wifi_pwrseq>;
+ bus-width = <4>;
+ max-frequency = <25000000>;
+ non-removable;
+ mmc-ddr-1_8v;
+ status = "okay";
+};
+
+&pio {
+ can0_pin_irq: can0_pin_irq {
+ function = "irq";
+ bias-pull-up;
+ };
+};
+
+&spi1 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi1_pins>;
+
+ can: mcp2515@0 {
+ status = "disabled";
+ compatible = "microchip,mcp2515";
+ reg = <0x0>;
+ clocks = <&mcp2515_clock>;
+ spi-max-frequency = <12500000>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&can0_pin_irq>;
+ interrupt-parent = <&pio>;
+ vdd-supply = <&reg_vcc33_wifi>;
+ xceiver-supply = <&reg_vcc33_wifi>;
+ };
+
+ tft_35: st7789v@1 {
+ status = "disabled";
+ compatible = "sitronix,st7796s";
+ reg = <1>;
+ spi-max-frequency =<12500000>;
+ fps =<60>;
+ buswidth = <8>;
+ rotate =<0>;
+ width = <480>;
+ height = <320>;
+ bpp = <24>;
+ bgr;
+ regwidth = <8>;
+ debug = <0x00>; //0x20 show fps
+ txbuflen = <307200>;
+ spi-cpol;
+ spi-cpha;
+ };
+};
+
+&r_i2c {
+ status = "okay";
+
+ axp313a: pmic@36 {
+ compatible = "x-powers,axp313a";
+ reg = <0x36>;
+ wakeup-source;
+
+ regulators {
+ reg_dcdc1: dcdc1 {
+ regulator-name = "vdd-gpu-sys";
+ regulator-min-microvolt = <500000>;
+ regulator-max-microvolt = <3400000>;
+ regulator-step-delay-us = <25>;
+ regulator-final-delay-us = <50>;
+ regulator-always-on;
+ };
+
+ reg_dcdc2: dcdc2 {
+ regulator-name = "vdd-cpu";
+ regulator-min-microvolt = <500000>;
+ regulator-max-microvolt = <1540000>;
+ regulator-step-delay-us = <25>;
+ regulator-final-delay-us = <50>;
+ regulator-ramp-delay = <200>;
+ regulator-always-on;
+ };
+
+ reg_dcdc3: dcdc3 {
+ regulator-name = "vcc-dram";
+ regulator-min-microvolt = <500000>;
+ regulator-max-microvolt = <1840000>;
+ regulator-step-delay-us = <25>;
+ regulator-final-delay-us = <50>;
+ regulator-always-on;
+ };
+
+ reg_aldo1: aldo1 {
+ regulator-name = "vcc-1v8-pll";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ regulator-step-delay-us = <25>;
+ regulator-final-delay-us = <50>;
+ regulator-always-on;
+ };
+
+ reg_dldo1: dldo1 {
+ regulator-name = "vcc-3v3-io";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-step-delay-us = <25>;
+ regulator-final-delay-us = <50>;
+ regulator-always-on;
+ };
+ };
+ };
+};
+
+&de {
+ status = "okay";
+};
+
+&hdmi {
+ hvcc-supply = <&reg_aldo1>;
+ status = "okay";
+};
+
+&hdmi_out {
+ hdmi_out_con: endpoint {
+ remote-endpoint = <&hdmi_con_in>;
+ };
+};
+
+&cpu0 {
+ cpu-supply = <&reg_dcdc2>;
+ status = "okay";
+};
+
+&gpu {
+ mali-supply = <&reg_dcdc3>;
+ status = "okay";
+};
+
+&uart0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart0_ph_pins>;
+ status = "okay";
+};
+
+&usbphy {
+ usb1_vbus-supply = <&reg_usb1_vbus>;
+ status = "okay";
+};
+
+&ehci0 {
+ status = "okay";
+};
+
+&ohci0 {
+ status = "okay";
+};
+
+&ehci1 {
+ status = "okay";
+};
+
+&ohci1 {
+ status = "okay";
+};
+
+&ehci2 {
+ status = "okay";
+};
+
+&ohci2 {
+ status = "okay";
+};
+
+&ehci3 {
+ status = "okay";
+};
+
+&ohci3 {
+ status = "okay";
+};
+
+&usbotg {
+ /*
+ * PHY0 pins are connected to a USB-C socket, but a role switch
+ * is not implemented: both CC pins are pulled to GND.
+ * The VBUS pins power the device, so a fixed peripheral mode
+ * is the best choice.
+ * The board can be powered via GPIOs, in this case port0 *can*
+ * act as a host (with a cable/adapter ignoring CC), as VBUS is
+ * then provided by the GPIOs. Any user of this setup would
+ * need to adjust the DT accordingly: dr_mode set to "host",
+ * enabling OHCI0 and EHCI0.
+ */
+ dr_mode = "peripheral";
+ status = "okay";
+};