Devicetree

A working Devicetree for Linux on Surface RT

Please be careful with random device trees. They could contain wrong power managment settings which could destroy your board.

The device tree bellow is out-dated. Visit grate-driver/linux for a more recent device tree. The device tree from there changese aliases of the mmc's, so your existing scripts will not be compatible.

A device tree is a standardized way on ARM to tell the kernel which hardware is present and how it is connected.

Devicetree for Surface RT

Currently supported Hardware in the devicetree below

  • Screen (LVDS encoder, backlight)

  • Touchscreen

  • USB

  • SD Card (+UHS-I mode)

  • UART_A

  • 1GB DDR3 RAM

  • eMMC

  • HDMI

  • Vol+/-, PWR, Windows Buttons

tegra30-microsoft-surfaceRT.dts
// SPDX-License-Identifier: GPL-2.0
/dts-v1/;
#include <dt-bindings/input/input.h>
#include "tegra30.dtsi"
/**
* Devicetree for surfaceRT
*/
/ {
model = "Surface RT";
compatible = "nvidia,cardhu", "nvidia,tegra30";
aliases {
serial0 = &uarta;
serial1 = &uartc;
rtc1 = "/[email protected]";
i2c0 = "/[email protected]";
i2c1 = "/[email protected]";
i2c2 = "/[email protected]";
i2c3 = "/[email protected]";
i2c4 = "/[email protected]";
};
chosen {
stdout-path = "serial0:115200n8";
};
/* 2GB DDR3 Memory */
reg = <0x80000000 0x40000000>; // <base> <size>; wrong size but 2GB doesnt work atm
};
/* Boot flash - OTP read only */
status = "okay";
spi-max-frequency = <25000000>;
compatible = "winbond,w25q32", "jedec,spi-nor";
reg = <1>;
spi-max-frequency = <20000000>;
};
};
/* UART-A */
status = "okay";
};
/* Tegra30 internal PowerManagmentController */
status = "okay";
nvidia,invert-interrupt;
nvidia,suspend-mode = <1>;
nvidia,cpu-pwr-good-time = <2000>;
nvidia,cpu-pwr-off-time = <200>;
nvidia,core-pwr-good-time = <3845 3845>;
nvidia,core-pwr-off-time = <0>;
nvidia,core-power-req-active-high;
nvidia,sys-clock-req-active-high;
};
/* SD CARD - SDMMC-1 */
status = "okay";
vqmmc-supply = <&ldo5_reg>;
bus-width = <4>;
power-gpios = <&gpio TEGRA_GPIO(D, 7) GPIO_ACTIVE_HIGH>;
};
/* internal 32/64GB eMMC - SDMMC-4 */
status = "okay";
bus-width = <8>;
non-removable;
};
/* clock from PMIC */
clk32k_in: [email protected] {
compatible = "fixed-clock";
clock-frequency = <32768>;
#clock-cells = <0>;
};
/* USB1 controller */
status = "okay";
};
/* USB1 controller-phy */
status = "okay";
};
/* DaughterBoard - Atmel MXT*/
status = "okay";
clock-frequency = <400000>;
/* Atmel Maxtouch HID over I2C */
compatible = "hid-over-i2c";
reg = <0x5b>;
hid-descr-addr = <0x0000>;
interrupt-parent = <&gpio>;
interrupts = <TEGRA_GPIO(K, 2) IRQ_TYPE_LEVEL_LOW>;
};
};
/* Nothing */
status = "okay";
clock-frequency = <100000>;
};
/* only HDMI DDC */
hdmi_ddc: [email protected] {
status = "okay";
clock-frequency = <100000>;
};
/* Mainboard - PMIC */
status = "okay";
clock-frequency = <400000>;
compatible = "ti,tps65911";
reg = <0x2d>;
interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
#interrupt-cells = <2>;
interrupt-controller;
ti,system-power-controller;
#gpio-cells = <2>;
gpio-controller;
regulators {
ldo5_reg: ldo5 {
// allow SD to switch from 3V3 to 1V8 for UHS-I
regulator-name = "vddio_sdmmc";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
};
};
};
/* Graphics controller */
// HDMI can only mirror interal LCD atm
nvidia,ddc-i2c-bus = <&hdmi_ddc>;
nvidia,hpd-gpio = <&gpio TEGRA_GPIO(N, 7) GPIO_ACTIVE_HIGH>;
status = "okay";
};
rgb {
status = "okay";
nvidia,panel = <&panel>;
lcd_output: endpoint {
remote-endpoint = <&lvds_encoder_input>;
bus-width = <24>;
};
};
};
};
};
lvds-encoder {
compatible = "idt,v103", "lvds-encoder";
powerdown-gpios = <&gpio TEGRA_GPIO(B, 2) GPIO_ACTIVE_HIGH>;
ports {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
lvds_encoder_input: endpoint {
remote-endpoint = <&lcd_output>;
};
};
reg = <1>;
lvds_encoder_output: endpoint {
remote-endpoint = <&panel_input>;
};
};
};
};
panel: display-panel {
compatible = "samsung,ltn140at29-301", "simple-panel";
power-supply = <&vdd_pnl>;
backlight = <&backlight>;
port {
panel_input: endpoint {
remote-endpoint = <&lvds_encoder_output>;
};
};
};
status = "okay";
};
backlight: backlight {
compatible = "pwm-backlight";
enable-gpios = <&gpio TEGRA_GPIO(DD, 0) GPIO_ACTIVE_HIGH>;
pwms = <&pwm 0 50000>;
brightness-levels = <1 255>;
num-interpolated-steps = <254>;
default-brightness-level = <128>;
};
pinctrl-names = "default";
pinctrl-0 = <&state_default>;
state_default: pinmux {
/* HDMI HOTPLUG_DETECT */
hdmi-int-pn7 {
nvidia,pins = "hdmi_int_pn7";
nvidia,function = "hdmi";
nvidia,pull = <TEGRA_PIN_PULL_NONE>;
nvidia,tristate = <TEGRA_PIN_ENABLE>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
};
volKeys {
nvidia,pins = "kb_row14_ps6", //down
"kb_row15_ps7"; //up
nvidia,pull = <TEGRA_PIN_PULL_NONE>;
nvidia,tristate = <TEGRA_PIN_ENABLE>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
};
/* Backlight PWM*/
gmi-ad8-ph0 {
nvidia,pins = "gmi_ad8_ph0";
nvidia,function = "pwm0";
nvidia,pull = <TEGRA_PIN_PULL_NONE>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_DISABLE>;
};
};
};
gpio-keys {
compatible = "gpio-keys";
power {
label = "Power Button";
gpios = <&gpio TEGRA_GPIO(V, 0) GPIO_ACTIVE_LOW>;
linux,code = <KEY_SLEEP>;
debounce-interval = <10>;
wakeup-source;
};
windows-button {
label = "Windows Button";
gpios = <&gpio TEGRA_GPIO(S, 5) GPIO_ACTIVE_LOW>;
linux,code = <KEY_LEFTMETA>;
debounce-interval = <10>;
};
volume-down {
label = "Volume Down";
gpios = <&gpio TEGRA_GPIO(S, 6) GPIO_ACTIVE_LOW>;
linux,code = <KEY_VOLUMEDOWN>;
debounce-interval = <10>;
};
volume-up {
label = "Volume Up";
gpios = <&gpio TEGRA_GPIO(S, 7) GPIO_ACTIVE_LOW>;
linux,code = <KEY_VOLUMEUP>;
debounce-interval = <10>;
};
};
vdd_pnl: [email protected] {
compatible = "regulator-fixed";
regulator-name = "vdd_panel";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
regulator-boot-on;
enable-active-high;
gpio = <&gpio TEGRA_GPIO(DD, 2) GPIO_ACTIVE_HIGH>;
};
};