meson: add support for Thunder OneCloud

The device tree file is from armbian/build/tree/master/patch/kernel/archive/
meson-5.18 (Author: hzyitc). Swipe into the sd card or u disk to boot.
This commit is contained in:
AmadeusGhost 2022-09-23 23:16:18 +08:00
parent 947b99eeb7
commit 2b5dd9ff0f
4 changed files with 309 additions and 0 deletions

View File

@ -0,0 +1,276 @@
// SPDX-License-Identifier: GPL-2.0 OR MIT
/dts-v1/;
#include "meson8b.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
model = "Thunder OneCloud";
compatible = "thunder,onecloud", "amlogic,meson8b";
aliases {
serial0 = &uart_AO;
mmc0 = &sd_card_slot;
mmc1 = &sdhc;
};
chosen {
stdout-path = "serial0:115200n8";
};
memory {
device_type = "memory";
reg = <0x40000000 0x40000000>;
};
emmc_pwrseq: emmc-pwrseq {
compatible = "mmc-pwrseq-emmc";
reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
};
gpio-keys {
compatible = "gpio-keys";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";
led_status_red: status-red {
label = "red:status";
gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
};
led_status_green: status-green {
label = "green:status";
gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
};
led_status_blue: status-blue {
label = "blue:status";
gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>;
};
};
p12v0: regulator-p12v0 {
compatible = "regulator-fixed";
regulator-name = "P12V0";
regulator-min-microvolt = <12000000>;
regulator-max-microvolt = <12000000>;
};
vcc_1v8: regulator-vcc-1v8 {
compatible = "regulator-fixed";
regulator-always-on;
regulator-name = "VCC1V8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
vin-supply = <&p12v0>;
};
vcc_3v3: regulator-vcc-3v3 {
compatible = "regulator-fixed";
regulator-always-on;
regulator-name = "VCC3V3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
vin-supply = <&p12v0>;
};
vcc_5v0: regulator-vcc5v0 {
compatible = "regulator-fixed";
regulator-always-on;
regulator-name = "VCC5V0";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
vin-supply = <&p12v0>;
};
vcck: regulator-vcck {
compatible = "pwm-regulator";
regulator-always-on;
regulator-boot-on;
regulator-name = "VCCK";
regulator-min-microvolt = <860000>;
regulator-max-microvolt = <1140000>;
pwm-supply = <&p12v0>;
pwms = <&pwm_cd 1 12001 0>;
pwm-dutycycle-range = <10 0>;
};
vddc_ddr: regulator-vddc-ddr {
compatible = "regulator-fixed";
regulator-always-on;
regulator-name = "DDR_VDDC";
regulator-min-microvolt = <1500000>;
regulator-max-microvolt = <1500000>;
vin-supply = <&p12v0>;
};
};
&cpu0 {
cpu-supply = <&vcck>;
};
&ethmac {
status = "okay";
pinctrl-0 = <&eth_rgmii_pins>;
pinctrl-names = "default";
phy-handle = <&eth_phy>;
phy-mode = "rgmii-id";
mdio {
compatible = "snps,dwmac-mdio";
#address-cells = <1>;
#size-cells = <0>;
eth_phy: ethernet-phy@0 {
reg = <0>;
reset-assert-us = <10000>;
reset-deassert-us = <80000>;
reset-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_LOW>;
interrupt-parent = <&gpio_intc>;
interrupts = <17 IRQ_TYPE_LEVEL_LOW>;
};
};
};
&gpio {
gpio-line-names =
/* Bank GPIODV */
"VCCK_PWM (PWM_C)", "I2CA_SDA", "I2CA_SCL",
"I2CB_SDA", "I2CB_SCL", "VDDEE_PWM (PWM_D)",
"",
/* Bank GPIOH */
"HDMI_HPD", "HDMI_I2C_SDA", "HDMI_I2C_SCL",
"ETH_PHY_INTR", "ETH_PHY_NRST", "ETH_TXD1",
"ETH_TXD0", "ETH_TXD3", "ETH_TXD2",
"ETH_RGMII_TX_CLK",
/* Bank CARD */
"SD_D1", "SD_D0", "SD_CLK", "SD_CMD",
"SD_D3", "SD_D2", "SD_CD",
/* Bank BOOT */
"EMMC_D0", "EMMC_D1", "EMMC_D2", "EMMC_D3",
"EMMC_D4", "EMMC_D5", "EMMC_D6", "EMMC_D7",
"EMMC_CLK", "EMMC_RSTn", "EMMC_CMD",
"BOOT_SEL", "", "", "", "", "", "", "",
/* Bank DIF */
"ETH_RXD1", "ETH_RXD0", "ETH_RX_DV",
"RGMII_RX_CLK", "ETH_RXD3", "ETH_RXD2",
"ETH_TXEN", "ETH_PHY_REF_CLK_25MOUT",
"ETH_MDC", "ETH_MDIO";
};
&gpio_ao {
gpio-line-names = "UART TX", "UART RX",
"RED_LED", "GREEN_LED",
"BLUE_LED", "BUTTON", "",
"IR_IN", "", "", "",
"", "", "", "", "";
};
&ir_receiver {
status = "okay";
pinctrl-0 = <&ir_recv_pins>;
pinctrl-names = "default";
};
&saradc {
status = "okay";
vref-supply = <&vcc_1v8>;
};
&sdhc {
status = "okay";
pinctrl-0 = <&sdxc_c_pins>;
pinctrl-names = "default";
bus-width = <8>;
max-frequency = <100000000>;
disable-wp;
cap-mmc-highspeed;
mmc-hs200-1_8v;
no-sdio;
mmc-pwrseq = <&emmc_pwrseq>;
vmmc-supply = <&vcc_3v3>;
};
&sdio {
status = "okay";
pinctrl-0 = <&sd_b_pins>;
pinctrl-names = "default";
/* SD card */
sd_card_slot: slot@1 {
compatible = "mmc-slot";
reg = <1>;
status = "okay";
bus-width = <4>;
no-sdio;
cap-mmc-highspeed;
cap-sd-highspeed;
disable-wp;
cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
vmmc-supply = <&vcc_3v3>;
};
};
&pwm_cd {
status = "okay";
pinctrl-0 = <&pwm_c1_pins>, <&pwm_d_pins>;
pinctrl-names = "default";
clocks = <&xtal>, <&xtal>;
clock-names = "clkin0", "clkin1";
};
&uart_AO {
status = "okay";
pinctrl-0 = <&uart_ao_a_pins>;
pinctrl-names = "default";
};
&usb0_phy {
status = "okay";
};
&usb1_phy {
status = "okay";
};
&usb0 {
status = "okay";
};
&usb1 {
status = "okay";
};

View File

@ -110,4 +110,13 @@ ifeq ($(SUBTARGET),mesongx)
TARGET_DEVICES += khadas-vim1
endif
define Device/thunder-onecloud
DEVICE_DTS := meson8b-onecloud
DEVICE_TITLE := Thunder OneCloud
KERNEL_LOADADDR := 0x00208000
endef
ifeq ($(SUBTARGET),meson8b)
TARGET_DEVICES += thunder-onecloud
endif
$(eval $(call BuildImage))

View File

@ -0,0 +1,10 @@
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -348,6 +348,7 @@ dtb-$(CONFIG_MACH_MESON8) += \
meson8b-ec100.dtb \
meson8b-mxq.dtb \
meson8b-odroidc1.dtb \
+ meson8b-onecloud.dtb \
meson8m2-mxiii-plus.dtb
dtb-$(CONFIG_ARCH_MMP) += \
pxa168-aspenite.dtb \

View File

@ -0,0 +1,14 @@
--- a/arch/arm/boot/dts/meson8b-onecloud.dts
+++ b/arch/arm/boot/dts/meson8b-onecloud.dts
@@ -13,6 +13,11 @@
serial0 = &uart_AO;
mmc0 = &sd_card_slot;
mmc1 = &sdhc;
+
+ led-boot = &led_status_red;
+ led-failsafe = &led_status_red;
+ led-running = &led_status_blue;
+ led-upgrade = &led_status_green;
};
chosen {