Skip to content

Instantly share code, notes, and snippets.

@BrokenR3C0RD
Created January 14, 2025 00:21
Show Gist options
  • Save BrokenR3C0RD/3dc97a0adff8120dd8a07f99c9d404ee to your computer and use it in GitHub Desktop.
Save BrokenR3C0RD/3dc97a0adff8120dd8a07f99c9d404ee to your computer and use it in GitHub Desktop.
Creality Sonic Pad - Mainline DTS WIP
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Copyright (c) 2025 Cody Eksal <[email protected]>
*/
/dts-v1/;
#include "sun50i-a100.dtsi"
#include "sun50i-a100-cpu-opp.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
/ {
model = "Creality Sonic Pad";
compatible = "creality,sonic-pad",
"allwinner,sun50i-a100";
chassis-type = "tablet";
/* TODO: Remove later */
aliases {
serial0 = &uart0;
mmc1 = &mmc1;
mmc2 = &mmc2;
};
chosen {
stdout-path = "serial0: 115200n8";
};
reg_usb0_vbus: usb0-vbus {
compatible = "regulator-fixed";
regulator-name = "usb0-vbus";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
gpio = <&pio 7 12 GPIO_ACTIVE_HIGH>; /* PH12 */
enable-active-high;
};
reg_usb1_vbus: usb1-vbus {
compatible = "regulator-fixed";
regulator-name = "usb1-vbus";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
gpio = <&pio 5 4 GPIO_ACTIVE_HIGH>; /* PF4 */
enable-active-high;
};
reg_vcc5v: vcc5v {
compatible = "regulator-fixed";
regulator-name = "vcc-5v";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-always-on;
};
wifi_pwrseq: pwrseq-wifi {
compatible = "mmc-pwrseq-simple";
clocks = <&rtc CLK_OSC32K_FANOUT>;
clock-names = "ext_clock";
reset-gpios = <&r_pio 0 5 GPIO_ACTIVE_LOW>;
post-power-on-delay-ms = <100>;
};
leds {
compatible = "gpio-leds";
status = "okay";
sys_led {
label = "sys-led";
gpios = <&pio 7 19 GPIO_ACTIVE_HIGH>;
};
};
};
&pio {
vcc-pb-supply = <&reg_dcdce>;
vcc-pc-supply = <&reg_aldo1>;
// vcc-pd-supply
vcc-pe-supply = <&reg_cldo2>;
vcc-pf-supply = <&reg_dcdce>;
vcc-pg-supply = <&reg_dcdcb>;
vcc-ph-supply = <&reg_dcdce>;
usb_vbus0_pin: usb-vbus0-pin {
pins = "PH12";
function = "gpio_out";
drive-strength = <30>;
bias-disable;
};
usb_vbus1_pin: usb-vbus1-pin {
pins = "PF4";
function = "gpio_out";
drive-strength = <30>;
bias-disable;
};
gpio-led {
pins = "PH19";
function = "gpio_out";
};
};
&r_pio {
wifi_wake: wifi_wake {
pins = "PL6";
function = "gpio_in";
};
};
&r_i2c0 {
status = "okay";
clock-frequency = <200000>;
pmu0: pmu@36 {
compatible = "x-powers,axp806";
interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
interrupt-parent = <&r_intc>;
interrupt-controller;
#interrupt-cells = <1>;
reg = <0x36>;
x-powers,self-working-mode;
vina-supply = <&reg_vcc5v>;
vinb-supply = <&reg_vcc5v>;
vinc-supply = <&reg_vcc5v>;
vind-supply = <&reg_vcc5v>;
vine-supply = <&reg_vcc5v>;
aldoin-supply = <&reg_vcc5v>;
bldoin-supply = <&reg_vcc5v>;
cldoin-supply = <&reg_vcc5v>;
regulators {
/* Known from DTS */
reg_dcdca: dcdca {
regulator-name = "vdd-cpu";
regulator-min-microvolt = <600000>;
regulator-max-microvolt = <1520000>;
regulator-always-on;
regulator-boot-on;
system-critical-regulator;
};
/* Effect: none that are obvious */
/* Maybe AVCC? */
reg_dcdcb: dcdcb {
regulator-name = "vdd-wifi";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
};
/* Effect: board shutdown */
/* Possibly VDD_CPUS? VDD_SYS? */
reg_dcdcc: dcdcc {
regulator-name = "dcdcc";
regulator-min-microvolt = <900000>;
regulator-max-microvolt = <900000>;
regulator-always-on;
regulator-boot-on;
system-critical-regulator;
};
/* Known from boot0 */
reg_dcdcd: dcdcd {
regulator-name = "vcc-dram";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1200000>;
regulator-always-on;
regulator-boot-on;
system-critical-regulator;
};
reg_dcdce: dcdce {
regulator-name = "vcc-io-emmc-wlan-emac";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
regulator-boot-on;
system-critical-regulator;
};
/* Effect: PMIC inaccessible, Ethernet LED off */
/* Appears to be VCC_PC | VCC_PL */
reg_aldo1: aldo1 {
regulator-name = "vdd-pc-pl-mmc-pmic";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
regulator-boot-on;
system-critical-regulator;
};
reg_aldo2: aldo2 {
regulator-name = "vcc-phy-wlan";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-enable-ramp-delay = <100000>;
};
reg_aldo3: aldo3 {
regulator-name = "aldo3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
/* Effect: System lockup */
/* Possibly VCC-PLL/AVCC? */
reg_bldo1: bldo1 {
regulator-name = "vcc-pll-avcc";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
regulator-boot-on;
system-critical-regulator;
};
/* Effect: DRAM inaccessible */
/* VDD_CPUS? */
reg_bldo2: bldo2 {
regulator-name = "bldo2";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1900000>;
regulator-always-on;
regulator-boot-on;
system-critical-regulator;
};
/* CPVIN? */
reg_bldo3: bldo3 {
regulator-name = "cpvin";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1900000>;
};
/* Unused? */
reg_bldo4: bldo4 {
regulator-name = "bldo4";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1900000>;
};
/* effect: eventual DRAM hang */
/* Assumed to be DRAM 1v8 for that reason */
reg_cldo1: cldo1 {
regulator-name = "vdd-dram-1v8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
regulator-boot-on;
system-critical-regulator;
};
/* VCC_PE? */
reg_cldo2: cldo2 {
regulator-name = "vcc-pe";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <700000>;
};
/* Unused? */
reg_cldo3: cldo3 {
regulator-name = "cldo3";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <3300000>;
};
reg_sw: sw {
regulator-name = "sw-screen";
};
};
};
};
&cpu0 {
cpu-supply = <&reg_dcdca>;
};
&mmc1 {
bus-width = <4>;
cap-sd-highspeed;
cap-sdio-irq;
no-sd;
no-mmc;
keep-power-in-suspend;
max-frequency = <150000000>;
vmmc-supply = <&reg_aldo2>;
vqmmc-supply = <&reg_dcdcb>;
wakeup-source;
non-removable;
mmc-pwrseq = <&wifi_pwrseq>;
status = "okay";
xr819wifi: xr819wifi@1 {
reg = <1>;
compatible = "xradio,xr819";
pinctrl-0 = <&wifi_wake>;
pinctrl-names = "default";
interrupt-parent = <&r_pio>;
interrupts = <0 6 IRQ_TYPE_EDGE_RISING>;
interrupt-names = "host-wake";
};
};
&mmc2 {
non-removable;
bus-width = <8>;
cap-mmc-highspeed;
cap-mmc-hw-reset;
no-sdio;
no-sd;
mmc-ddr-1_8v;
mmc-hs200-1_8v;
max-frequency = <150000000>;
vmmc-supply = <&reg_dcdce>;
vqmmc-supply = <&reg_aldo1>;
status = "okay";
};
&usbphy {
usb0_vbus-supply = <&reg_usb0_vbus>;
usb1_vbus-supply = <&reg_usb1_vbus>;
status = "okay";
};
&ehci1 {
status = "okay";
};
&ohci1 {
status = "okay";
};
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pb_pins>;
status = "okay";
};
&usb_otg {
dr_mode = "peripheral";
status = "okay";
};
&emac {
pinctrl-names = "default";
pinctrl-0 = <&rgmii_pins>;
phy-mode = "rgmii-id";
phy-handle = <&ext_rgmii_phy>;
phy-supply = <&reg_aldo2>;
allwinner,tx-delay-ps = <700>;
allwinner,rx-delay-ps = <0>;
status = "okay";
};
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins>;
status = "okay";
spidev@0 {
compatible = "rohm,dh2228fv";
reg = <0>;
spi-max-frequency = <4000000>;
};
};
&spi1 {
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins>;
status = "okay";
spidev@0 {
compatible = "rohm,dh2228fv";
reg = <0>;
spi-max-frequency = <4000000>;
};
};
&spi2 {
pinctrl-names = "default";
pinctrl-0 = <&spi2_pins>;
status = "okay";
spidev@0 {
compatible = "rohm,dh2228fv";
reg = <0>;
spi-max-frequency = <4000000>;
};
};
&mdio {
status = "okay";
ext_rgmii_phy: ethernet-phy@0 {
/* RTL8211F */
reg = <0>;
compatible = "ethernet-phy-id001c.c916";
max-speed = <1000>;
reset-assert-us = <15000>;
reset-deassert-us = <55000>;
realtek,clkout-disable;
clocks = <&ccu CLK_EMAC_25M>;
reset-gpios = <&pio 7 11 GPIO_ACTIVE_LOW> /* PH11 */;
leds {
#address-cells = <1>;
#size-cells = <0>;
led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_WAN;
linux,default-trigger = "netdev";
};
led@1 {
reg = <1>;
color = <LED_COLOR_ID_YELLOW>;
function = LED_FUNCTION_WAN;
linux,default-trigger = "netdev";
};
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment