ODROID-COMMON: arm64/dts: Support device tree overlay.

- Support device tree overlay to modify peripherals states. By using
  this feature, we can select the peripheral state like on/off.

-To use this feature, you should change a "overlays" value of env.ini files.

Change-Id: Ibf9e7bf676a4d470f991350508dc7b84b2ea80fa
Signed-off-by: Luke Go <sangch.go@gmail.com>
This commit is contained in:
Luke Go
2020-04-27 14:43:55 +09:00
parent 900da3cb7f
commit bad84ba08f
28 changed files with 581 additions and 120 deletions

View File

@@ -159,7 +159,7 @@ PHONY += dtbs dtbs_install
dtbs: prepare scripts
$(Q)$(MAKE) $(build)=$(boot)/dts
dtbs_install: prepare scripts
dtbs_install:
$(Q)$(MAKE) $(dtbinst)=$(boot)/dts
Image-dtb Image.gz-dtb: vmlinux scripts dtbs

View File

@@ -1 +1,2 @@
*.dtb
*.dtbo

View File

@@ -1,12 +1,15 @@
ifndef CONFIG_ARCH_MESON64_ODROID_COMMON
dtb-y += g12a_s905d2_skt.dtb
dtb-y += g12a_s905d2_skt_buildroot.dtb
dtb-y += g12a_s905d2_u200_buildroot.dtb
dtb-y += g12a_s905d2_u200_drm_buildroot.dtb
dtb-y += g12b_a311d_w400.dtb
dtb-y += g12b_a311d_w400_buildroot.dtb
dtb-$(CONFIG_ARCH_MESON64_ODROIDC3) += meson64_odroidc3.dtb
dtb-$(CONFIG_ARCH_MESON64_ODROIDC3) += meson64_odroidc3_android.dtb
endif
dtb-$(CONFIG_ARCH_MESON64_ODROIDC4) += meson64_odroidc4.dtb
dtb-$(CONFIG_ARCH_MESON64_ODROIDC4) += meson64_odroidc4_android.dtb
dtb-$(CONFIG_ARCH_MESON64_ODROIDN2) += meson64_odroidn2.dtb
dtb-$(CONFIG_ARCH_MESON64_ODROIDN2) += meson64_odroidn2_android.dtb
subdir-$(CONFIG_ARCH_MESON64_ODROIDC4) := overlays/odroidc4
subdir-$(CONFIG_ARCH_MESON64_ODROIDN2) := overlays/odroidn2

View File

@@ -753,7 +753,7 @@
status = "ok";
};
hktft35 {
hktft35: hktft35 {
status = "disabled";
compatible = "odroid,hktft35";
pinctrl-names = "hktft35";
@@ -850,7 +850,7 @@
}; /* end of audiobus */
&uart_A {
status = "okay";
status = "disabled";
};
&usb3_phy_v2 {
@@ -935,7 +935,7 @@
}; /* end of pinctrl_aobus */
&spicc0 {
status = "okay";
status = "disabled";
/*
40 Pin Header : MOSI(GPIOX.8->19 Pin), MISO(GPIOX.9->21 Pin),
@@ -958,8 +958,8 @@
gpio-irq = <&gpio GPIOX_3 GPIO_ACTIVE_LOW>;
};
spidev@0 {
status = "okay";
spidev: spidev@0 {
status = "disabled";
compatible = "linux,spidev";
/* spi default max clock 100Mhz */
@@ -968,7 +968,7 @@
};
/* SPI 3.2" Touch Screen Define */
ads7846@1 {
ads7846: ads7846@1 {
status = "disabled";
spi-max-frequency = <1000000>;
@@ -991,7 +991,7 @@
linux,wakeup;
};
hktft32@0 {
hktft32: hktft32@0 {
status = "disabled";
compatible = "odroid,hktft32";
reg = <0>;
@@ -1021,6 +1021,8 @@
};
&i2c2 {
status = "disabled";
pcf8563: rtc@51 {
status = "disabled";
compatible = "nxp,pcf8563";
@@ -1029,6 +1031,8 @@
};
&i2c3 {
status = "disabled";
/* Hardkernel I2C 3.5" Touchscreen */
/* drivers/input/sx8650.c */
sx865x: sx865x@49 {

View File

@@ -356,113 +356,11 @@
cpu_opp_table0: cpu_opp_table0 {
compatible = "operating-points-v2";
opp-shared;
opp00 {
opp-hz = /bits/ 64 <100000000>;
opp-microvolt = <730000>;
};
opp01 {
opp-hz = /bits/ 64 <250000000>;
opp-microvolt = <730000>;
};
opp02 {
opp-hz = /bits/ 64 <500000000>;
opp-microvolt = <730000>;
};
opp03 {
opp-hz = /bits/ 64 <667000000>;
opp-microvolt = <730000>;
};
opp04 {
opp-hz = /bits/ 64 <1000000000>;
opp-microvolt = <730000>;
};
opp05 {
opp-hz = /bits/ 64 <1200000000>;
opp-microvolt = <730000>;
};
opp06 {
opp-hz = /bits/ 64 <1398000000>;
opp-microvolt = <760000>;
};
opp07 {
opp-hz = /bits/ 64 <1512000000>;
opp-microvolt = <790000>;
};
opp08 {
opp-hz = /bits/ 64 <1608000000>;
opp-microvolt = <830000>;
};
opp09 {
opp-hz = /bits/ 64 <1704000000>;
opp-microvolt = <860000>;
};
opp10 {
opp-hz = /bits/ 64 <1896000000>;
opp-microvolt = <980000>;
};
opp11 {
opp-hz = /bits/ 64 <1992000000>;
opp-microvolt = <1000000>;
};
};
cpu_opp_table1: cpu_opp_table1 {
compatible = "operating-points-v2";
opp-shared;
opp00 {
opp-hz = /bits/ 64 <100000000>;
opp-microvolt = <750000>;
};
opp01 {
opp-hz = /bits/ 64 <250000000>;
opp-microvolt = <750000>;
};
opp02 {
opp-hz = /bits/ 64 <500000000>;
opp-microvolt = <750000>;
};
opp03 {
opp-hz = /bits/ 64 <667000000>;
opp-microvolt = <750000>;
};
opp04 {
opp-hz = /bits/ 64 <1000000000>;
opp-microvolt = <770000>;
};
opp05 {
opp-hz = /bits/ 64 <1200000000>;
opp-microvolt = <770000>;
};
opp06 {
opp-hz = /bits/ 64 <1398000000>;
opp-microvolt = <790000>;
};
opp07 {
opp-hz = /bits/ 64 <1512000000>;
opp-microvolt = <820000>;
};
opp08 {
opp-hz = /bits/ 64 <1608000000>;
opp-microvolt = <860000>;
};
opp09 {
opp-hz = /bits/ 64 <1704000000>;
opp-microvolt = <890000>;
};
opp10 {
opp-hz = /bits/ 64 <1800000000>;
opp-microvolt = <980000>;
};
opp11 {
opp-hz = /bits/ 64 <1908000000>;
opp-microvolt = <1020000>;
};
opp12 {
opp-hz = /bits/ 64 <2004000000>;
opp-microvolt = <1020000>;
};
};
cpufreq-meson {
@@ -487,6 +385,53 @@
reg = <0x0 0xff808040 0x0 0x44>;
status = "ok";
};
hktft35: hktft35 {
status = "disabled";
compatible = "odroid,hktft35";
pinctrl-name = "hktft35";
pinctrl-0 = <&hktft35_pins>;
rotate = <270>;
bgr;
fps = <20>;
bpp = <16>;
reset-gpios = <&gpio GPIOX_3 GPIO_ACTIVE_LOW>;
dc-gpios = <&gpio GPIOX_14 GPIO_ACTIVE_LOW>;
wr-gpios = <&gpio GPIOX_10 GPIO_ACTIVE_LOW>;
cs-gpios = <&gpio GPIOX_16 GPIO_ACTIVE_LOW>;
led-gpios = <&gpio GPIOX_5 GPIO_ACTIVE_LOW>;
db-gpios = <&gpio GPIOX_1 GPIO_ACTIVE_LOW>,
<&gpio GPIOX_2 GPIO_ACTIVE_LOW>,
<&gpio GPIOX_0 GPIO_ACTIVE_LOW>,
<&gpio GPIOX_11 GPIO_ACTIVE_LOW>,
<&gpio GPIOX_9 GPIO_ACTIVE_LOW>,
<&gpio GPIOX_8 GPIO_ACTIVE_LOW>,
<&gpio GPIOX_7 GPIO_ACTIVE_LOW>,
<&gpio GPIOX_4 GPIO_ACTIVE_LOW>;
debug = <0>;
hktft35_pins: hktft35_pins {
mux {
groups = "GPIOX_0",
"GPIOX_1",
"GPIOX_2",
"GPIOX_3",
"GPIOX_4",
"GPIOX_5",
"GPIOX_7",
"GPIOX_8",
"GPIOX_9",
"GPIOX_10",
"GPIOX_11",
"GPIOX_14",
"GPIOX_16";
function = "gpio_periphs";
output-high;
drive-strength = <3>;
};
};
};
}; /* end of / */
&meson_fb {
@@ -552,11 +497,11 @@
};
&saradc {
status = "okay";
status = "disabled";
};
&i2c2 {
status = "okay";
status = "disabled";
pinctrl-names = "default","gpio_periphs";
/* 40 Pin Header : SDA(GPIOX.17->3 Pin), SCL(GPIOX.18->5 Pin) */
pinctrl-0 = <&i2c2_master_pins1>;
@@ -567,7 +512,7 @@
&i2c3 {
/* default i2c clock-frequency is 100Khz */
status = "okay";
status = "disabled";
/* Hardkernel I2C 3.5" Touchscreen */
/* drivers/input/sx8650.c */
@@ -590,7 +535,7 @@
};
&spicc0 {
status = "okay";
status = "disabled";
/*
40 Pin Header : MOSI(GPIOX.8->19 Pin), MISO(GPIOX.9->21 Pin),
@@ -613,8 +558,8 @@
gpio-irq = <&gpio GPIOX_3 GPIO_ACTIVE_LOW>;
};
spidev@0 {
status = "okay";
spidev: spidev@0 {
status = "disabled";
compatible = "linux,spidev";
/* spi default max clock 100Mhz */
@@ -645,4 +590,32 @@
linux,wakeup;
};
hktft32: hktft32@0 {
status = "disabled";
compatible = "odroid,hktft32";
reg = <0>;
pinctrl-names = "hktft32";
pinctrl-0 = <&hktft32_pins>;
spi-max-frequency = <40000000>;
rotate = <90>;
bgr;
backlight;
fps = <20>;
bpp = <16>;
reset-gpios = <&gpio GPIOX_4 GPIO_ACTIVE_LOW>;
dc-gpio = <&gpio GPIOX_7 GPIO_ACTIVE_LOW>;
debug = <0>;
hktft32_pins: hktft32_pins {
mux {
groups = "GPIOX_4",
"GPIOX_7";
function = "gpio_periphs";
output-high;
drive-strength = <3>;
};
};
};
};

View File

@@ -0,0 +1,15 @@
# Overlays for the Odroid platform
dtbo-$(CONFIG_ARCH_MESON64_ODROIDC4) += spi0.dtbo \
i2c2.dtbo \
i2c3.dtbo \
uarta.dtbo \
uartb.dtbo \
uartc.dtbo \
hktft32.dtbo \
hktft35.dtbo \
pcf8563.dtbo \
pcm5242.dtbo
targets += $(dtbo-y)
always := $(dtbo-y)

View File

@@ -0,0 +1,28 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&spicc0>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&hktft32>;
__overlay__ {
status = "okay";
};
};
fragment@2 {
target = <&ads7846>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,28 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&i2c3>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&sx865x>;
__overlay__ {
status = "okay";
};
};
fragment@2 {
target = <&hktft35>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,12 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&i2c2>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,12 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&i2c3>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&i2c2>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&pcf8563>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&i2c2>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&pcm5242>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&spicc0>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&spidev>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,12 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&uart_A>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,12 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&uart_B>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,12 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&uart_C>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,15 @@
# Overlays for the Odroid platform
dtbo-$(CONFIG_ARCH_MESON64_ODROIDN2) += spi0.dtbo \
i2c0.dtbo \
i2c1.dtbo \
uarta.dtbo \
uartb.dtbo \
hktft32.dtbo \
hktft35.dtbo \
saradc.dtbo \
irblaster.dtbo \
odroidn2-opp.dtbo
targets += $(dtbo-y)
always := $(dtbo-y)

View File

@@ -0,0 +1,28 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&spicc0>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&hktft32>;
__overlay__ {
status = "okay";
};
};
fragment@2 {
target = <&ads7846>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,28 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&i2c3>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&sx865x>;
__overlay__ {
status = "okay";
};
};
fragment@2 {
target = <&hktft35>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,14 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
// i2c2 aliased with i2c0.
// This activates i2c2 but it will be named as i2c0 on the userspace.
target = <&i2c2>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,14 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
// i2c3 aliased with i2c1.
// This activates i2c3 but it will be named as i2c1 on the userspace.
target = <&i2c3>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,12 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&irblaster>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,118 @@
// cpu opp table
/dts-v1/;
/plugin/;
/{
fragment@0 {
target= <&cpu_opp_table0>;
__overlay__ {
opp00 {
opp-hz = /bits/ 64 <100000000>;
opp-microvolt = <730000>;
};
opp01 {
opp-hz = /bits/ 64 <250000000>;
opp-microvolt = <730000>;
};
opp02 {
opp-hz = /bits/ 64 <500000000>;
opp-microvolt = <730000>;
};
opp03 {
opp-hz = /bits/ 64 <667000000>;
opp-microvolt = <730000>;
};
opp04 {
opp-hz = /bits/ 64 <1000000000>;
opp-microvolt = <730000>;
};
opp05 {
opp-hz = /bits/ 64 <1200000000>;
opp-microvolt = <730000>;
};
opp06 {
opp-hz = /bits/ 64 <1398000000>;
opp-microvolt = <760000>;
};
opp07 {
opp-hz = /bits/ 64 <1512000000>;
opp-microvolt = <790000>;
};
opp08 {
opp-hz = /bits/ 64 <1608000000>;
opp-microvolt = <830000>;
};
opp09 {
opp-hz = /bits/ 64 <1704000000>;
opp-microvolt = <860000>;
};
opp10 {
opp-hz = /bits/ 64 <1896000000>;
opp-microvolt = <980000>;
};
opp11 {
opp-hz = /bits/ 64 <1992000000>;
opp-microvolt = <1000000>;
};
};
};
fragment@1 {
target= <&cpu_opp_table1>;
__overlay__ {
opp00 {
opp-hz = /bits/ 64 <100000000>;
opp-microvolt = <750000>;
};
opp01 {
opp-hz = /bits/ 64 <250000000>;
opp-microvolt = <750000>;
};
opp02 {
opp-hz = /bits/ 64 <500000000>;
opp-microvolt = <750000>;
};
opp03 {
opp-hz = /bits/ 64 <667000000>;
opp-microvolt = <750000>;
};
opp04 {
opp-hz = /bits/ 64 <1000000000>;
opp-microvolt = <770000>;
};
opp05 {
opp-hz = /bits/ 64 <1200000000>;
opp-microvolt = <770000>;
};
opp06 {
opp-hz = /bits/ 64 <1398000000>;
opp-microvolt = <790000>;
};
opp07 {
opp-hz = /bits/ 64 <1512000000>;
opp-microvolt = <820000>;
};
opp08 {
opp-hz = /bits/ 64 <1608000000>;
opp-microvolt = <860000>;
};
opp09 {
opp-hz = /bits/ 64 <1704000000>;
opp-microvolt = <890000>;
};
opp10 {
opp-hz = /bits/ 64 <1800000000>;
opp-microvolt = <980000>;
};
opp11 {
opp-hz = /bits/ 64 <1908000000>;
opp-microvolt = <1020000>;
};
opp12 {
opp-hz = /bits/ 64 <2004000000>;
opp-microvolt = <1020000>;
};
};
};
};

View File

@@ -0,0 +1,12 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&saradc>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&spicc0>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&spidev>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,12 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&uart_A>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -0,0 +1,12 @@
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&uart_B>;
__overlay__ {
status = "okay";
};
};
};

View File

@@ -21,6 +21,7 @@ include scripts/Kbuild.include
include $(src)/Makefile
dtbinst-files := $(sort $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS), $(dtb-)))
dtboinst-files := $(sort $(dtbo-y) $(if $(CONFIG_OF_ALL_DTBS), $(dtbo-)))
dtbinst-dirs := $(subdir-y) $(subdir-m)
# Helper targets for Installing DTBs into the boot directory
@@ -32,10 +33,13 @@ install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj))
$(dtbinst-files): %.dtb: $(obj)/%.dtb
$(call cmd,dtb_install,$(install-dir))
$(dtboinst-files): %.dtbo: $(obj)/%.dtbo
$(call cmd,dtb_install,$(install-dir))
$(dtbinst-dirs):
$(Q)$(MAKE) $(dtbinst)=$(obj)/$@
PHONY += $(dtbinst-files) $(dtbinst-dirs)
__dtbs_install: $(dtbinst-files) $(dtbinst-dirs)
PHONY += $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs)
__dtbs_install: $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs)
.PHONY: $(PHONY)