Change the Device Tree Source in OpenWRT 22.03 for Omega2
-
In our company, we are using Omega2 chipsets in our IOT bridge solution.
we were running OpenWRT18, and we are looking to bring up to openwrt 22.03.I used the GitHub onion repo (https://github.com/OnionIoT/openwrt.git) to build openWRT 22.03.
I tried to change the Device Tree to fit our Board. so I used the following dts files:
OMEGA2.dts:
/dts-v1/; #include "OMEGA2.dtsi" / { compatible = "onion,omega2", "mediatek,mt7628an-soc"; model = "Onion Omega2"; memory@0 { device_type = "memory"; reg = <0x0 0x4000000>; }; gpio-leds { compatible = "gpio-leds"; ethernet { label = "ryse:blue:ethernet"; gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; }; internet { label = "ryse:blue:internet"; gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; }; }; }; &firmware { reg = <0x50000 0xf30000>; }; &flash { user: partition@f80000 { label = "user"; reg = <0xf80000 0x80000>; }; }; &system_led { label = "omega2:amber:system"; };
OMEGA2.dtsi:
#include "mt7628an.dtsi" #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/input/input.h> / { compatible = "onion,omega2", "mediatek,mt7628an-soc"; chosen { bootargs = "console=ttyS0,115200"; }; gpio-leds { compatible = "gpio-leds"; system_led: system { gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; }; }; gpio-keys-polled { compatible = "gpio-keys-polled"; #address-cells = <1>; #size-cells = <0>; poll-interval = <20>; reset { label = "reset"; gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; linux,code = <KEY_RESTART>; }; }; }; &pinctrl { state_default: pinctrl0 { gpio { ralink,group = "gpio"; ralink,function = "gpio"; }; perst { ralink,group = "perst"; ralink,function = "gpio"; }; refclk { ralink,group = "refclk"; ralink,function = "gpio"; }; i2s { ralink,group = "i2s"; ralink,function = "gpio"; }; spis { ralink,group = "spis"; ralink,function = "gpio"; }; wled_kn { ralink,group = "wled_kn"; ralink,function = "gpio"; }; wled_an { ralink,group = "wled_an"; ralink,function = "gpio"; }; wdt { ralink,group = "wdt"; ralink,function = "gpio"; }; pwm0 { ralink,group = "pwm0"; ralink,function = "gpio"; }; pwm1 { ralink,group = "pwm1"; ralink,function = "gpio"; }; }; }; &gpio1 { status = "okay"; }; &gpio2 { status = "okay"; }; &spi0 { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>; flash: m25p80@0 { #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <40000000>; m25p,chunked-io = <31>; partition@0 { label = "u-boot"; reg = <0x0 0x30000>; read-only; }; partition@30000 { label = "u-boot-env"; reg = <0x30000 0x10000>; read-only; }; factory: partition@40000 { label = "factory"; reg = <0x40000 0x10000>; }; firmware: partition@50000 { label = "firmware"; }; }; spidev@1 { #address-cells = <1>; #size-cells = <1>; compatible = "rohm,dh2228fv"; reg = <1>; spi-max-frequency = <40000000>; }; }; &i2c { status = "okay"; }; &uart1 { status = "okay"; }; &uart2 { status = "okay"; }; ðernet { mtd-mac-address = <&factory 0x28>; }; &sdhci { status = "okay"; mediatek,cd-low; }; &wmac { status = "okay"; }; &pwm { status = "okay"; };
I copied these 2 files from Openwrt SDK 18 from onion git repo (source): https://github.com/OnionIoT/source.git
I put these 2 files (OMEGA2.dst and OMEGA2.dtsi) under the directory "target/linux/ramips/dts/" in the new openwrt SDK 22.03 and then I build the openwrt and then upload the image to my board but the new Device Tree is not taken account.
What I am missing?
-
@mohamedkallel To confirm, when you say SDK, do you mean the build system? Meaning https://github.com/OnionIoT/source and/or https://github.com/openwrt/openwrt?
This is an important distinction because there is an OpenWRT SDK that's used for just building packages.
If you do mean build system, I believe you have to rebuild the kernel for the DTS changes to take effect. I can't 100% recall but I believe there's a
tmp
directory that needs to be deleted before recompiling.
EDIT: just saw this in your post:
@mohamedkallel said in Change the Device Tree Source in OpenWRT 22.03 for Omega2:
copied these 2 files from Openwrt SDK 18 from onion git repo (source): https://github.com/OnionIoT/source.git
I put these 2 files (OMEGA2.dst and OMEGA2.dtsi) under the directory "target/linux/ramips/dts/" in the new openwrt SDK 22.03The DTS files have changed quite a bit from OpenWRT 18.06 to OpenWRT 22.03 - so they can't just be copied over from 18 to 22.
You will need to modify the existing DTS files in OpenWRT 22.03 by hand.