Skip to content

Commit

Permalink
rockchip: add MangoPi M28C support
Browse files Browse the repository at this point in the history
  • Loading branch information
aiamadeus committed Jan 28, 2025
1 parent 171cb58 commit 424c43c
Show file tree
Hide file tree
Showing 9 changed files with 455 additions and 327 deletions.
4 changes: 4 additions & 0 deletions target/linux/rockchip/armv8/base-files/etc/board.d/01_leds
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ radxa,e20c)
ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0"
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1"
;;
widora,mangopi-m28c)
ucidef_set_led_netdev "modem" "MODEM" "blue:modem" "usb0"
ucidef_set_led_netdev "wifi" "WIFI" "yellow:wifi" "wlan0"
;;
widora,mangopi-m28k|\
widora,mangopi-m28k-pro)
ucidef_set_led_netdev "lan" "LAN" "white:lan" "eth0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,9 @@ friendlyarm,nanopi-r6s)
set_interface_core 4 "eth1"
set_interface_core 8 "eth2"
;;
widora,mangopi-m28c)
set_interface_core 4 "eth0"
set_interface_core 8 "xhci-hcd:usb1"
;;
esac

Original file line number Diff line number Diff line change
@@ -0,0 +1,328 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (c) 2024 AY <amadeus@jmu.edu.cn>

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/pinctrl/rockchip.h>

#include "rk3528.dtsi"

/ {
aliases {
mmc0 = &sdhci;
mmc1 = &sdmmc;
mmc2 = &sdio0;
ethernet0 = &gmac1;
};

chosen {
stdout-path = "serial0:1500000n8";
};

ir-receiver {
compatible = "gpio-ir-receiver";
gpios = <&gpio4 RK_PC6 GPIO_ACTIVE_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&ir_int_pin>;
};

sdio_pwrseq: sdio-pwrseq {
compatible = "mmc-pwrseq-simple";
pinctrl-names = "default";
pinctrl-0 = <&wifi_reg_on_h>;
post-power-on-delay-ms = <100>;
power-off-delay-us = <5000000>;
reset-gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>;
};

vcc_1v8: vcc-1v8 {
compatible = "regulator-fixed";
regulator-name = "vcc_1v8";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
vin-supply = <&vcc_3v3>;
};

vcc_3v3: vcc-3v3 {
compatible = "regulator-fixed";
regulator-name = "vcc_3v3";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
vin-supply = <&vcc_sys>;
};

vcc3v3_sd: vcc3v3-sd {
compatible = "regulator-fixed";
gpio = <&gpio4 RK_PA1 GPIO_ACTIVE_LOW>;
regulator-name = "vcc3v3_sd";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
vin-supply = <&vcc_3v3>;
};

vccio_sd: vccio-sd {
compatible = "regulator-gpio";
gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>;
regulator-name = "vccio_sd";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <3300000>;
states = <1800000 0x0>, <3300000 0x1>;
vin-supply = <&vcc_sys>;
};

vcc_ddr: vcc-ddr {
compatible = "regulator-fixed";
regulator-name = "vcc_ddr";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1200000>;
vin-supply = <&vcc_sys>;
};

vcc_sys: vcc5v0-sys {
compatible = "regulator-fixed";
regulator-name = "vcc_sys";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
};

vdd_0v9: vdd-0v9 {
compatible = "regulator-fixed";
regulator-name = "vdd_0v9";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <900000>;
regulator-max-microvolt = <900000>;
vin-supply = <&vcc_sys>;
};

vdd_arm: vdd-arm {
compatible = "pwm-regulator";
pwms = <&pwm1 0 5000 1>;
pwm-supply = <&vcc_sys>;
regulator-name = "vdd_arm";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <746000>;
regulator-max-microvolt = <1201000>;
regulator-settling-time-up-us = <250>;
};

vdd_logic: vdd-logic {
compatible = "pwm-regulator";
pwms = <&pwm2 0 5000 1>;
pwm-supply = <&vcc_sys>;
regulator-name = "vdd_logic";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <705000>;
regulator-max-microvolt = <1006000>;
regulator-settling-time-up-us = <250>;
};
};

&combphy {
status = "okay";
};

&cpu0 {
cpu-supply = <&vdd_arm>;
};

&cpu1 {
cpu-supply = <&vdd_arm>;
};

&cpu2 {
cpu-supply = <&vdd_arm>;
};

&cpu3 {
cpu-supply = <&vdd_arm>;
};

&gmac1 {
clock_in_out = "output";
pinctrl-names = "default";
pinctrl-0 = <&rgmii_miim
&rgmii_tx_bus2
&rgmii_rx_bus2
&rgmii_rgmii_clk
&rgmii_rgmii_bus>;
phy-handle = <&rgmii_phy>;
phy-mode = "rgmii-id";
phy-supply = <&vcc_3v3>;
snps,reset-active-low;
snps,reset-delays-us = <0 20000 100000>;
snps,reset-gpio = <&gpio4 RK_PC2 GPIO_ACTIVE_LOW>;
status = "okay";
};

&gpu {
mali-supply = <&vdd_logic>;
status = "okay";
};

&mdio1 {
rgmii_phy: phy@1 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0x1>;
realtek,led-data = <0x6d60>;
};
};

&pinctrl {
ir {
ir_int_pin: ir-int-pin {
rockchip,pins = <4 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>;
};
};

leds {
lan_led_en: lan-led-en {
rockchip,pins = <4 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
};

wan_led_en: wan-led-en {
rockchip,pins = <4 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>;
};

work_led_en: work-led-en {
rockchip,pins = <4 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
};
};

wifi {
wifi_reg_on_h: wifi-reg-on-h {
rockchip,pins = <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
};

wifi_wake_host_h: wifi-wake-host-h {
rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_down>;
};
};

bluetooth {
bt_reg_on_h: bt-reg-on-h {
rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
};
};
};

&pwm1 {
status = "okay";
};

&pwm2 {
status = "okay";
};

&rng {
status = "okay";
};

&sdhci {
bus-width = <8>;
mmc-hs200-1_8v;
max-frequency = <200000000>;
non-removable;
pinctrl-names = "default";
pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_strb>;
vmmc-supply = <&vcc_3v3>;
vqmmc-supply = <&vcc_1v8>;
status = "okay";
};

&sdio0 {
#address-cells = <1>;
#size-cells = <0>;
bus-width = <4>;
cap-sd-highspeed;
cap-sdio-irq;
keep-power-in-suspend;
max-frequency = <200000000>;
mmc-pwrseq = <&sdio_pwrseq>;
pinctrl-names = "default";
pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
non-removable;
sd-uhs-sdr104;
status = "okay";

wifi@1 {
reg = <1>;
interrupt-parent = <&gpio1>;
interrupts = <RK_PA7 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "host-wake";
pinctrl-names = "default";
pinctrl-0 = <&wifi_wake_host_h>;
};
};

&sdmmc {
bus-width = <4>;
cap-sd-highspeed;
disable-wp;
max-frequency = <150000000>;
pinctrl-names = "default";
pinctrl-0 = <&sdmmc_bus4 &sdmmc_clk &sdmmc_cmd &sdmmc_det>;
rockchip,default-sample-phase = <90>;
sd-uhs-sdr12;
sd-uhs-sdr25;
sd-uhs-sdr50;
sd-uhs-sdr104;
vmmc-supply = <&vcc3v3_sd>;
vqmmc-supply = <&vccio_sd>;
status = "okay";
};

&tsadc {
status = "okay";
};

&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0m0_xfer>;
status = "okay";
};

&uart2 {
pinctrl-names = "default";
pinctrl-0 = <&uart2m1_xfer &uart2m1_ctsn>;
status = "okay";
};

&usb2phy {
status = "okay";
};

&usb2phy0_host {
phy-supply = <&vcc_sys>;
status = "okay";
};

&usb2phy0_otg {
phy-supply = <&vcc_sys>;
status = "okay";
};

&usb_host0_ehci {
status = "okay";
};

&usb_host0_ohci {
status = "okay";
};

&usb_host0_xhci {
dr_mode = "host";
status = "okay";
};
Loading

0 comments on commit 424c43c

Please sign in to comment.