参考
https://mirror.tuna.tsinghua.edu.cn/help/openwrt/
https://github.com/mhycy/openwrt-r300a
https://gitee.com/openwrt-mirror
dts
#include "mt7620a.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
compatible = "oray,r300a", "ralink,mt7620a-soc";
model = "Oray R300A";
aliases {
label-mac-device = &wmac;
};
chosen {
bootargs = "console=ttyS0,115200";
};
leds {
compatible = "gpio-leds";
red_sys {
label = "red:sys";
default-state = "on";
gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
};
blue_wifi {
label = "blue:wifi";
gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
};
blue_sys {
label = "blue:sys";
gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
};
green_sys {
label = "green:sys";
gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
};
blue_link1 {
label = "blue:link1";
gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
};
blue_siginal1 {
label = "blue:siginal1";
gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
};
blue_siginal2 {
label = "blue:siginal2";
gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
};
blue_siginal3 {
label = "blue:siginal3";
gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
};
blue_link2 {
label = "blue:link2";
gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
};
};
keys {
compatible = "gpio-keys";
wps {
label = "wps";
gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>;
linux,code = <KEY_WPS_BUTTON>;
};
reset {
label = "reset";
gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
linux,code = <KEY_RESTART>;
};
};
gpio_export {
compatible = "gpio-export";
#size-cells = <0>;
cpe_pwr {
gpio-export,name = "gpio13";
gpio-export,output = <1>;
gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
};
usb_pwr {
gpio-export,name = "gpio14";
gpio-export,output = <1>;
gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
};
sim_sel {
gpio-export,name = "gpio39";
gpio-export,output = <1>;
gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
};
};
};
&gpio1 {
status = "okay";
};
&gpio2 {
status = "okay";
};
&spi0 {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <10000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x0 0x30000>;
};
partition@30000 {
label = "kpanic";
reg = <0x30000 0x10000>;
read-only;
};
factory: partition@40000 {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
};
partition@50000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0x50000 0xf90000>;
};
bdinfo: partition@fe0000 {
label = "bdinfo";
reg = <0xfe0000 0x10000>;
read-only;
};
partition@ff0000 {
label = "reserve";
reg = <0xff0000 0x10000>;
read-only;
};
};
};
};
&sdhci {
status = "okay";
};
&ehci {
status = "okay";
};
&ohci {
status = "okay";
};
ðernet {
mtd-mac-address = <&bdinfo 0x9>;
mediatek,portmap = "wllll";
};
&wmac {
ralink,mtd-eeprom = <&factory 0x0>;
};
&state_default {
gpio {
groups = "ephy", "uartf", "spi refclk";
function = "gpio";
};
};
/etc/config/wireless
config wifi-device 'radio1'
option type 'mac80211'
option path 'platform/10180000.wmac'
option channel 'auto'
option band '2g'
option htmode 'HT20'
option cell_density '0'
option txpower '20'
option country 'CN'
config wifi-iface 'wlan0'
option device 'radio1'
option network 'lan'
option mode 'ap'
option ssid 'EH-LTE'
option encryption 'openwrt'
option key '1234567890'
/etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'lan'
option ifname 'eth0.1'
option type 'bridge'
option proto 'static'
option ipaddr '172.17.2.1'
option netmask '255.255.255.0'
option ip6assign '60'
config interface 'wan'
option ifname 'eth0.2'
option proto 'dhcp'