Merge Lean's source
This commit is contained in:
commit
8ba2092ec3
@ -324,7 +324,7 @@ define KernelPackage/pmbus-zl6100
|
|||||||
$(call AddDepends/hwmon, +kmod-pmbus-core)
|
$(call AddDepends/hwmon, +kmod-pmbus-core)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define KernelPackage/hwmon-sht21/description
|
define KernelPackage/pmbus-zl6100/description
|
||||||
Kernel module for Intersil / Zilker Labs ZL6100 and
|
Kernel module for Intersil / Zilker Labs ZL6100 and
|
||||||
compatible digital DC-DC controllers
|
compatible digital DC-DC controllers
|
||||||
endef
|
endef
|
||||||
|
|||||||
@ -119,7 +119,7 @@ define KernelPackage/input-gpio-encoder
|
|||||||
AUTOLOAD:=$(call AutoProbe,rotary_encoder)
|
AUTOLOAD:=$(call AutoProbe,rotary_encoder)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define KernelPackage/gpio-encoder/description
|
define KernelPackage/input-gpio-encoder/description
|
||||||
Kernel module to use rotary encoders connected to GPIO pins
|
Kernel module to use rotary encoders connected to GPIO pins
|
||||||
endef
|
endef
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ define KernelPackage/input-matrixkmap
|
|||||||
AUTOLOAD:=$(call AutoProbe,matrix-keymap)
|
AUTOLOAD:=$(call AutoProbe,matrix-keymap)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define KernelPackage/input-matrix/description
|
define KernelPackage/input-matrixkmap/description
|
||||||
Kernel module support for input matrix devices
|
Kernel module support for input matrix devices
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|||||||
@ -279,7 +279,7 @@ define KernelPackage/switch-rtl8366-smi
|
|||||||
AUTOLOAD:=$(call AutoLoad,42,rtl8366_smi)
|
AUTOLOAD:=$(call AutoLoad,42,rtl8366_smi)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define KernelPackage/switch-rtl8366_smi/description
|
define KernelPackage/switch-rtl8366-smi/description
|
||||||
Realtek RTL8366 series SMI switch interface support
|
Realtek RTL8366 series SMI switch interface support
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|||||||
@ -301,7 +301,7 @@ define KernelPackage/sound-dummy
|
|||||||
AUTOLOAD:=$(call AutoLoad,32,snd-dummy)
|
AUTOLOAD:=$(call AutoLoad,32,snd-dummy)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define KernelPackage/sound_dummy/description
|
define KernelPackage/sound-dummy/description
|
||||||
Dummy sound device for Alsa when no hardware present
|
Dummy sound device for Alsa when no hardware present
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ local DL = SYS.exec("head -1 /tmp/adbyby/data/lazy.txt | awk -F' ' '{print $3,$4
|
|||||||
local DV = SYS.exec("head -1 /tmp/adbyby/data/video.txt | awk -F' ' '{print $3,$4}'") or ""
|
local DV = SYS.exec("head -1 /tmp/adbyby/data/video.txt | awk -F' ' '{print $3,$4}'") or ""
|
||||||
local NR = SYS.exec("grep -v '^!' /usr/share/adbyby/data/rules.txt | wc -l")
|
local NR = SYS.exec("grep -v '^!' /usr/share/adbyby/data/rules.txt | wc -l")
|
||||||
local NU = SYS.exec("cat /usr/share/adbyby/data/user.txt | wc -l")
|
local NU = SYS.exec("cat /usr/share/adbyby/data/user.txt | wc -l")
|
||||||
local UD = SYS.exec("cat /tmp/adbyby.updated") or " "
|
local UD = NXFS.readfile("/tmp/adbyby.updated") or "1970-01-01 00:00:00"
|
||||||
local ND = SYS.exec("cat /usr/share/adbyby/dnsmasq.adblock | wc -l")
|
local ND = SYS.exec("cat /usr/share/adbyby/dnsmasq.adblock | wc -l")
|
||||||
|
|
||||||
m = Map("adbyby")
|
m = Map("adbyby")
|
||||||
|
|||||||
@ -164,7 +164,7 @@ start()
|
|||||||
[ $enable -eq 0 ] && exit 0
|
[ $enable -eq 0 ] && exit 0
|
||||||
add_cron
|
add_cron
|
||||||
[ ! -d "/tmp/adbyby/data" ] && cp -a /usr/share/adbyby /tmp/ && rm -f /tmp/adbyby.updated
|
[ ! -d "/tmp/adbyby/data" ] && cp -a /usr/share/adbyby /tmp/ && rm -f /tmp/adbyby.updated
|
||||||
/usr/share/adbyby/admem.sh &
|
/usr/share/adbyby/admem.sh &>/dev/null &
|
||||||
add_rules
|
add_rules
|
||||||
/tmp/adbyby/adbyby &>/dev/null &
|
/tmp/adbyby/adbyby &>/dev/null &
|
||||||
add_dns
|
add_dns
|
||||||
|
|||||||
@ -2,7 +2,8 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=luci-app-ssr-plus
|
PKG_NAME:=luci-app-ssr-plus
|
||||||
PKG_VERSION:=150
|
PKG_VERSION:=150
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|||||||
@ -99,21 +99,25 @@ else
|
|||||||
retstring ="-1"
|
retstring ="-1"
|
||||||
end
|
end
|
||||||
elseif set == "ip_data" then
|
elseif set == "ip_data" then
|
||||||
refresh_cmd="wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' 2>/dev/null| awk -F\\| '/CN\\|ipv4/ { printf(\"%s/%d\\n\", $4, 32-log($5)/log(2)) }' > /tmp/china_ssr.txt"
|
if (luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'chnroute', '0') == '1') then
|
||||||
sret=luci.sys.call(refresh_cmd)
|
refresh_cmd="wget-ssl --no-check-certificate -O - " .. luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'chnroute_url', 'https://pexcn.me/daily/chnroute/chnroute.txt') .. ' > /tmp/china_ssr.txt 2>/dev/null'
|
||||||
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
|
|
||||||
if sret== 0 and tonumber(icount)>1000 then
|
|
||||||
oldcount=luci.sys.exec("cat /etc/china_ssr.txt | wc -l")
|
|
||||||
if tonumber(icount) ~= tonumber(oldcount) then
|
|
||||||
luci.sys.exec("cp -f /tmp/china_ssr.txt /etc/china_ssr.txt")
|
|
||||||
retstring=tostring(tonumber(icount))
|
|
||||||
else
|
else
|
||||||
retstring ="0"
|
refresh_cmd="wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' 2>/dev/null| awk -F\\| '/CN\\|ipv4/ { printf(\"%s/%d\\n\", $4, 32-log($5)/log(2)) }' > /tmp/china_ssr.txt"
|
||||||
end
|
end
|
||||||
else
|
sret=luci.sys.call(refresh_cmd)
|
||||||
retstring ="-1"
|
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
|
||||||
end
|
if sret== 0 and tonumber(icount)>1000 then
|
||||||
luci.sys.exec("rm -f /tmp/china_ssr.txt ")
|
oldcount=luci.sys.exec("cat /etc/china_ssr.txt | wc -l")
|
||||||
|
if tonumber(icount) ~= tonumber(oldcount) then
|
||||||
|
luci.sys.exec("cp -f /tmp/china_ssr.txt /etc/china_ssr.txt")
|
||||||
|
retstring=tostring(tonumber(icount))
|
||||||
|
else
|
||||||
|
retstring ="0"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
retstring ="-1"
|
||||||
|
end
|
||||||
|
luci.sys.exec("rm -f /tmp/china_ssr.txt ")
|
||||||
else
|
else
|
||||||
if nixio.fs.access("/usr/bin/wget-ssl") then
|
if nixio.fs.access("/usr/bin/wget-ssl") then
|
||||||
refresh_cmd="wget-ssl --no-check-certificate -O - ".. luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf"
|
refresh_cmd="wget-ssl --no-check-certificate -O - ".. luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf"
|
||||||
|
|||||||
@ -54,6 +54,16 @@ o.rmempty = false
|
|||||||
o = s:option(Value, "adblock_url", translate("adblock_url"))
|
o = s:option(Value, "adblock_url", translate("adblock_url"))
|
||||||
o.default = "https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt"
|
o.default = "https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt"
|
||||||
|
|
||||||
|
-- [[ chnroute ]]
|
||||||
|
s = m:section(TypedSection, "global", translate("Chnroute Setting"))
|
||||||
|
s.anonymous = true
|
||||||
|
|
||||||
|
o = s:option(Flag, "chnroute", translate("Enable custom chnroute"))
|
||||||
|
o.rmempty = false
|
||||||
|
|
||||||
|
o = s:option(Value, "chnroute_url", translate("Update url"))
|
||||||
|
o.default = "https://cdn.jsdelivr.net/gh/17mon/china_ip_list/china_ip_list.txt"
|
||||||
|
|
||||||
-- [[ SOCKS Proxy ]]--
|
-- [[ SOCKS Proxy ]]--
|
||||||
if nixio.fs.access("/usr/bin/srelay") then
|
if nixio.fs.access("/usr/bin/srelay") then
|
||||||
s = m:section(TypedSection, "socks5_proxy", translate("SOCKS Proxy"))
|
s = m:section(TypedSection, "socks5_proxy", translate("SOCKS Proxy"))
|
||||||
|
|||||||
@ -337,6 +337,15 @@ msgstr "启用进程自动守护"
|
|||||||
msgid "Advertising Data"
|
msgid "Advertising Data"
|
||||||
msgstr "【广告屏蔽】数据库"
|
msgstr "【广告屏蔽】数据库"
|
||||||
|
|
||||||
|
msgid "Chnroute Setting"
|
||||||
|
msgstr "国内IP段数据库更新设置"
|
||||||
|
|
||||||
|
msgid "Enable custom chnroute"
|
||||||
|
msgstr "启用自定义更新地址"
|
||||||
|
|
||||||
|
msgid "Update url"
|
||||||
|
msgstr "更新链接"
|
||||||
|
|
||||||
msgid "DNS Server IP and Port"
|
msgid "DNS Server IP and Port"
|
||||||
msgstr "DNS服务器地址和端口"
|
msgstr "DNS服务器地址和端口"
|
||||||
|
|
||||||
|
|||||||
@ -42,13 +42,17 @@ else
|
|||||||
end
|
end
|
||||||
|
|
||||||
log('正在更新【国内IP段】数据库')
|
log('正在更新【国内IP段】数据库')
|
||||||
refresh_cmd="wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' 2>/dev/null| awk -F\\| '/CN\\|ipv4/ { printf(\"%s/%d\\n\", $4, 32-log($5)/log(2)) }' > /tmp/china_ssr.txt"
|
if (ucic:get_first('shadowsocksr', 'global', 'chnroute','0') == '1' ) then
|
||||||
|
refresh_cmd="wget-ssl --no-check-certificate -O - ".. ucic:get_first('shadowsocksr', 'global', 'chnroute_url','https://cdn.jsdelivr.net/gh/17mon/china_ip_list/china_ip_list.txt') .." > /tmp/china_ssr.txt 2>/dev/null"
|
||||||
|
else
|
||||||
|
refresh_cmd="wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' 2>/dev/null| awk -F\\| '/CN\\|ipv4/ { printf(\"%s/%d\\n\", $4, 32-log($5)/log(2)) }' > /tmp/china_ssr.txt"
|
||||||
|
end
|
||||||
sret=luci.sys.call(refresh_cmd)
|
sret=luci.sys.call(refresh_cmd)
|
||||||
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
|
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
|
||||||
if sret== 0 then
|
if sret== 0 then
|
||||||
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
|
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
|
||||||
if tonumber(icount)>1000 then
|
if tonumber(icount)>1000 then
|
||||||
oldcount=luci.sys.exec("cat /etc/china_ssr.txt | wc -l")
|
oldcount=luci.sys.exec("cat /etc/china_ssr.txt | wc -l")
|
||||||
if tonumber(icount) ~= tonumber(oldcount) then
|
if tonumber(icount) ~= tonumber(oldcount) then
|
||||||
luci.sys.exec("cp -f /tmp/china_ssr.txt /etc/china_ssr.txt")
|
luci.sys.exec("cp -f /tmp/china_ssr.txt /etc/china_ssr.txt")
|
||||||
-- retstring=tostring(math.ceil(tonumber(icount)/2))
|
-- retstring=tostring(math.ceil(tonumber(icount)/2))
|
||||||
@ -57,7 +61,7 @@ icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
|
|||||||
log('你已经是最新数据,无需更新!')
|
log('你已经是最新数据,无需更新!')
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
log('更新失败!')
|
log('更新失败!')
|
||||||
end
|
end
|
||||||
luci.sys.exec("rm -f /tmp/china_ssr.txt")
|
luci.sys.exec("rm -f /tmp/china_ssr.txt")
|
||||||
else
|
else
|
||||||
|
|||||||
@ -32,17 +32,67 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
{
|
{
|
||||||
struct property *pp = of_find_property(np, name, NULL);
|
struct property *pp = of_find_property(np, name, NULL);
|
||||||
|
|
||||||
@@ -47,6 +48,79 @@ static const void *of_get_mac_addr(struc
|
@@ -47,6 +48,138 @@ static const void *of_get_mac_addr(struc
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+typedef int(*mtd_mac_address_read)(struct mtd_info *mtd, loff_t from, u_char *buf);
|
||||||
|
+
|
||||||
|
+static int read_mtd_mac_address(struct mtd_info *mtd, loff_t from, u_char *mac)
|
||||||
|
+{
|
||||||
|
+ size_t retlen;
|
||||||
|
+
|
||||||
|
+ return mtd_read(mtd, from, 6, &retlen, mac);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int read_mtd_mac_address_ascii(struct mtd_info *mtd, loff_t from, u_char *mac)
|
||||||
|
+{
|
||||||
|
+ size_t retlen;
|
||||||
|
+ char buf[17];
|
||||||
|
+
|
||||||
|
+ if (mtd_read(mtd, from, 12, &retlen, buf)) {
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ if (sscanf(buf, "%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",
|
||||||
|
+ &mac[0], &mac[1], &mac[2], &mac[3],
|
||||||
|
+ &mac[4], &mac[5]) == 6) {
|
||||||
|
+ if (mac[0] == '\0' && mac[1] == '\0') { /* First 2 bytes are zero, probably a bug. Trying to re-read */
|
||||||
|
+ buf[4] = '\0'; /* Make it null-terminated */
|
||||||
|
+ if (sscanf(buf, "%4hx", mac) == 1)
|
||||||
|
+ *(uint16_t*)mac = htons(*(uint16_t*)mac);
|
||||||
|
+ }
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ if (mtd_read(mtd, from+12, 5, &retlen, buf+12)) {
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ if (sscanf(buf, "%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx",
|
||||||
|
+ &mac[0], &mac[1], &mac[2], &mac[3],
|
||||||
|
+ &mac[4], &mac[5]) == 6) {
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ return -1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static struct mtd_mac_address_property {
|
||||||
|
+ char *name;
|
||||||
|
+ mtd_mac_address_read read;
|
||||||
|
+} mtd_mac_address_properties[] = {
|
||||||
|
+ {
|
||||||
|
+ .name = "mtd-mac-address",
|
||||||
|
+ .read = read_mtd_mac_address,
|
||||||
|
+ }, {
|
||||||
|
+ .name = "mtd-mac-address-ascii",
|
||||||
|
+ .read = read_mtd_mac_address_ascii,
|
||||||
|
+ },
|
||||||
|
+};
|
||||||
|
+
|
||||||
+static const void *of_get_mac_address_mtd(struct device_node *np)
|
+static const void *of_get_mac_address_mtd(struct device_node *np)
|
||||||
+{
|
+{
|
||||||
+#ifdef CONFIG_MTD
|
+#ifdef CONFIG_MTD
|
||||||
+ struct device_node *mtd_np = NULL;
|
+ struct device_node *mtd_np = NULL;
|
||||||
+ struct property *prop;
|
+ struct property *prop;
|
||||||
+ size_t retlen;
|
+ int size, ret = -1;
|
||||||
+ int size, ret;
|
|
||||||
+ struct mtd_info *mtd;
|
+ struct mtd_info *mtd;
|
||||||
+ const char *part;
|
+ const char *part;
|
||||||
+ const __be32 *list;
|
+ const __be32 *list;
|
||||||
@ -51,28 +101,37 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
+ u8 mac[ETH_ALEN];
|
+ u8 mac[ETH_ALEN];
|
||||||
+ void *addr;
|
+ void *addr;
|
||||||
+ u32 inc_idx;
|
+ u32 inc_idx;
|
||||||
|
+ int i;
|
||||||
+
|
+
|
||||||
+ list = of_get_property(np, "mtd-mac-address", &size);
|
+ for (i = 0; i < ARRAY_SIZE(mtd_mac_address_properties); i++) {
|
||||||
+ if (!list || (size != (2 * sizeof(*list))))
|
+ list = of_get_property(np, mtd_mac_address_properties[i].name, &size);
|
||||||
|
+ if (!list || (size != (2 * sizeof(*list))))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ phandle = be32_to_cpup(list++);
|
||||||
|
+ if (phandle)
|
||||||
|
+ mtd_np = of_find_node_by_phandle(phandle);
|
||||||
|
+
|
||||||
|
+ if (!mtd_np)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ part = of_get_property(mtd_np, "label", NULL);
|
||||||
|
+ if (!part)
|
||||||
|
+ part = mtd_np->name;
|
||||||
|
+
|
||||||
|
+ mtd = get_mtd_device_nm(part);
|
||||||
|
+ if (IS_ERR(mtd))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ ret = mtd_mac_address_properties[i].read(mtd, be32_to_cpup(list), mac);
|
||||||
|
+ put_mtd_device(mtd);
|
||||||
|
+ if (!ret) {
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if (ret) {
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+
|
+ }
|
||||||
+ phandle = be32_to_cpup(list++);
|
|
||||||
+ if (phandle)
|
|
||||||
+ mtd_np = of_find_node_by_phandle(phandle);
|
|
||||||
+
|
|
||||||
+ if (!mtd_np)
|
|
||||||
+ return NULL;
|
|
||||||
+
|
|
||||||
+ part = of_get_property(mtd_np, "label", NULL);
|
|
||||||
+ if (!part)
|
|
||||||
+ part = mtd_np->name;
|
|
||||||
+
|
|
||||||
+ mtd = get_mtd_device_nm(part);
|
|
||||||
+ if (IS_ERR(mtd))
|
|
||||||
+ return NULL;
|
|
||||||
+
|
|
||||||
+ ret = mtd_read(mtd, be32_to_cpup(list), 6, &retlen, mac);
|
|
||||||
+ put_mtd_device(mtd);
|
|
||||||
+
|
+
|
||||||
+ if (of_property_read_u32(np, "mtd-mac-address-increment-byte", &inc_idx))
|
+ if (of_property_read_u32(np, "mtd-mac-address-increment-byte", &inc_idx))
|
||||||
+ inc_idx = 5;
|
+ inc_idx = 5;
|
||||||
@ -112,7 +171,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
/**
|
/**
|
||||||
* Search the device tree for the best MAC address to use. 'mac-address' is
|
* Search the device tree for the best MAC address to use. 'mac-address' is
|
||||||
* checked first, because that is supposed to contain to "most recent" MAC
|
* checked first, because that is supposed to contain to "most recent" MAC
|
||||||
@@ -64,11 +138,18 @@ static const void *of_get_mac_addr(struc
|
@@ -64,11 +192,18 @@ static const void *of_get_mac_addr(struc
|
||||||
* addresses. Some older U-Boots only initialized 'local-mac-address'. In
|
* addresses. Some older U-Boots only initialized 'local-mac-address'. In
|
||||||
* this case, the real MAC is in 'local-mac-address', and 'mac-address' exists
|
* this case, the real MAC is in 'local-mac-address', and 'mac-address' exists
|
||||||
* but is all zeros.
|
* but is all zeros.
|
||||||
|
|||||||
@ -32,17 +32,67 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
{
|
{
|
||||||
struct property *pp = of_find_property(np, name, NULL);
|
struct property *pp = of_find_property(np, name, NULL);
|
||||||
|
|
||||||
@@ -48,6 +49,79 @@ static const void *of_get_mac_addr(struc
|
@@ -48,6 +49,138 @@ static const void *of_get_mac_addr(struc
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+typedef int(*mtd_mac_address_read)(struct mtd_info *mtd, loff_t from, u_char *buf);
|
||||||
|
+
|
||||||
|
+static int read_mtd_mac_address(struct mtd_info *mtd, loff_t from, u_char *mac)
|
||||||
|
+{
|
||||||
|
+ size_t retlen;
|
||||||
|
+
|
||||||
|
+ return mtd_read(mtd, from, 6, &retlen, mac);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int read_mtd_mac_address_ascii(struct mtd_info *mtd, loff_t from, u_char *mac)
|
||||||
|
+{
|
||||||
|
+ size_t retlen;
|
||||||
|
+ char buf[17];
|
||||||
|
+
|
||||||
|
+ if (mtd_read(mtd, from, 12, &retlen, buf)) {
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ if (sscanf(buf, "%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",
|
||||||
|
+ &mac[0], &mac[1], &mac[2], &mac[3],
|
||||||
|
+ &mac[4], &mac[5]) == 6) {
|
||||||
|
+ if (mac[0] == '\0' && mac[1] == '\0') { /* First 2 bytes are zero, probably a bug. Trying to re-read */
|
||||||
|
+ buf[4] = '\0'; /* Make it null-terminated */
|
||||||
|
+ if (sscanf(buf, "%4hx", mac) == 1)
|
||||||
|
+ *(uint16_t*)mac = htons(*(uint16_t*)mac);
|
||||||
|
+ }
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ if (mtd_read(mtd, from+12, 5, &retlen, buf+12)) {
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ if (sscanf(buf, "%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx",
|
||||||
|
+ &mac[0], &mac[1], &mac[2], &mac[3],
|
||||||
|
+ &mac[4], &mac[5]) == 6) {
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ return -1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static struct mtd_mac_address_property {
|
||||||
|
+ char *name;
|
||||||
|
+ mtd_mac_address_read read;
|
||||||
|
+} mtd_mac_address_properties[] = {
|
||||||
|
+ {
|
||||||
|
+ .name = "mtd-mac-address",
|
||||||
|
+ .read = read_mtd_mac_address,
|
||||||
|
+ }, {
|
||||||
|
+ .name = "mtd-mac-address-ascii",
|
||||||
|
+ .read = read_mtd_mac_address_ascii,
|
||||||
|
+ },
|
||||||
|
+};
|
||||||
|
+
|
||||||
+static const void *of_get_mac_address_mtd(struct device_node *np)
|
+static const void *of_get_mac_address_mtd(struct device_node *np)
|
||||||
+{
|
+{
|
||||||
+#ifdef CONFIG_MTD
|
+#ifdef CONFIG_MTD
|
||||||
+ struct device_node *mtd_np = NULL;
|
+ struct device_node *mtd_np = NULL;
|
||||||
+ struct property *prop;
|
+ struct property *prop;
|
||||||
+ size_t retlen;
|
+ int size, ret = -1;
|
||||||
+ int size, ret;
|
|
||||||
+ struct mtd_info *mtd;
|
+ struct mtd_info *mtd;
|
||||||
+ const char *part;
|
+ const char *part;
|
||||||
+ const __be32 *list;
|
+ const __be32 *list;
|
||||||
@ -51,28 +101,37 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
+ u8 mac[ETH_ALEN];
|
+ u8 mac[ETH_ALEN];
|
||||||
+ void *addr;
|
+ void *addr;
|
||||||
+ u32 inc_idx;
|
+ u32 inc_idx;
|
||||||
|
+ int i;
|
||||||
+
|
+
|
||||||
+ list = of_get_property(np, "mtd-mac-address", &size);
|
+ for (i = 0; i < ARRAY_SIZE(mtd_mac_address_properties); i++) {
|
||||||
+ if (!list || (size != (2 * sizeof(*list))))
|
+ list = of_get_property(np, mtd_mac_address_properties[i].name, &size);
|
||||||
|
+ if (!list || (size != (2 * sizeof(*list))))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ phandle = be32_to_cpup(list++);
|
||||||
|
+ if (phandle)
|
||||||
|
+ mtd_np = of_find_node_by_phandle(phandle);
|
||||||
|
+
|
||||||
|
+ if (!mtd_np)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ part = of_get_property(mtd_np, "label", NULL);
|
||||||
|
+ if (!part)
|
||||||
|
+ part = mtd_np->name;
|
||||||
|
+
|
||||||
|
+ mtd = get_mtd_device_nm(part);
|
||||||
|
+ if (IS_ERR(mtd))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ ret = mtd_mac_address_properties[i].read(mtd, be32_to_cpup(list), mac);
|
||||||
|
+ put_mtd_device(mtd);
|
||||||
|
+ if (!ret) {
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if (ret) {
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+
|
+ }
|
||||||
+ phandle = be32_to_cpup(list++);
|
|
||||||
+ if (phandle)
|
|
||||||
+ mtd_np = of_find_node_by_phandle(phandle);
|
|
||||||
+
|
|
||||||
+ if (!mtd_np)
|
|
||||||
+ return NULL;
|
|
||||||
+
|
|
||||||
+ part = of_get_property(mtd_np, "label", NULL);
|
|
||||||
+ if (!part)
|
|
||||||
+ part = mtd_np->name;
|
|
||||||
+
|
|
||||||
+ mtd = get_mtd_device_nm(part);
|
|
||||||
+ if (IS_ERR(mtd))
|
|
||||||
+ return NULL;
|
|
||||||
+
|
|
||||||
+ ret = mtd_read(mtd, be32_to_cpup(list), 6, &retlen, mac);
|
|
||||||
+ put_mtd_device(mtd);
|
|
||||||
+
|
+
|
||||||
+ if (of_property_read_u32(np, "mtd-mac-address-increment-byte", &inc_idx))
|
+ if (of_property_read_u32(np, "mtd-mac-address-increment-byte", &inc_idx))
|
||||||
+ inc_idx = 5;
|
+ inc_idx = 5;
|
||||||
@ -112,7 +171,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||||||
/**
|
/**
|
||||||
* Search the device tree for the best MAC address to use. 'mac-address' is
|
* Search the device tree for the best MAC address to use. 'mac-address' is
|
||||||
* checked first, because that is supposed to contain to "most recent" MAC
|
* checked first, because that is supposed to contain to "most recent" MAC
|
||||||
@@ -65,11 +139,18 @@ static const void *of_get_mac_addr(struc
|
@@ -65,11 +193,18 @@ static const void *of_get_mac_addr(struc
|
||||||
* addresses. Some older U-Boots only initialized 'local-mac-address'. In
|
* addresses. Some older U-Boots only initialized 'local-mac-address'. In
|
||||||
* this case, the real MAC is in 'local-mac-address', and 'mac-address' exists
|
* this case, the real MAC is in 'local-mac-address', and 'mac-address' exists
|
||||||
* but is all zeros.
|
* but is all zeros.
|
||||||
|
|||||||
@ -3,27 +3,54 @@
|
|||||||
# Copyright (C) 2013 OpenWrt.org
|
# Copyright (C) 2013 OpenWrt.org
|
||||||
#
|
#
|
||||||
|
|
||||||
ramips_set_preinit_iface() {
|
. /lib/functions.sh
|
||||||
RT3X5X=$(grep -E "(RT3.5|RT5350|MT7628|MT7688|MT7620|MT7621)" /proc/cpuinfo)
|
|
||||||
|
|
||||||
if [ -n "${RT3X5X}" ]; then
|
ramips_switchdev_from_soc() {
|
||||||
# The ethernet switch driver enables VLAN by default, but
|
# The ethernet switch driver enables VLAN by default, but
|
||||||
# failsafe uses eth0, making the device unreachable:
|
# failsafe uses eth0, making the device unreachable:
|
||||||
# https://dev.openwrt.org/ticket/18768
|
# https://dev.openwrt.org/ticket/18768
|
||||||
case "${RT3X5X}" in
|
|
||||||
*MT7620*)
|
local switchdev
|
||||||
ralink_switchdev=mt7620
|
local RT3X5X=$(grep -E "(RT3.5|RT5350|MT7628|MT7688|MT7620|MT7621)" /proc/cpuinfo)
|
||||||
;;
|
|
||||||
*MT7621*)
|
[ -n "$RT3X5X" ] || return 1
|
||||||
ralink_switchdev=mt7530
|
|
||||||
;;
|
case "$RT3X5X" in
|
||||||
*)
|
*MT7620*)
|
||||||
ralink_switchdev=rt305x
|
switchdev=mt7620
|
||||||
;;
|
;;
|
||||||
esac
|
*MT7621*)
|
||||||
swconfig dev $ralink_switchdev set reset 1
|
switchdev=mt7530
|
||||||
swconfig dev $ralink_switchdev set enable_vlan 0
|
;;
|
||||||
swconfig dev $ralink_switchdev set apply 1
|
*)
|
||||||
|
switchdev=rt305x
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "$switchdev"
|
||||||
|
}
|
||||||
|
|
||||||
|
ramips_switchdev_from_board() {
|
||||||
|
# For these devices, external ethernet switch should be used
|
||||||
|
# instead of the SoC internal switch.
|
||||||
|
|
||||||
|
local switchdev
|
||||||
|
local board=$(board_name)
|
||||||
|
|
||||||
|
case "$board" in
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "$switchdev"
|
||||||
|
}
|
||||||
|
|
||||||
|
ramips_set_preinit_iface() {
|
||||||
|
local switchdev=$(ramips_switchdev_from_board)
|
||||||
|
[ -n "$switchdev" ] || switchdev=$(ramips_switchdev_from_soc)
|
||||||
|
|
||||||
|
if [ -n "$switchdev" ]; then
|
||||||
|
swconfig dev $switchdev set reset 1
|
||||||
|
swconfig dev $switchdev set enable_vlan 0
|
||||||
|
swconfig dev $switchdev set apply 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ifname=eth0
|
ifname=eth0
|
||||||
|
|||||||
25
target/linux/ramips/dts/mt7621_iodata_wn-ax1167gr2.dts
Normal file
25
target/linux/ramips/dts/mt7621_iodata_wn-ax1167gr2.dts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||||
|
/dts-v1/;
|
||||||
|
|
||||||
|
#include "mt7621_iodata_wn-xx-xr.dtsi"
|
||||||
|
|
||||||
|
/ {
|
||||||
|
compatible = "iodata,wn-ax1167gr2", "mediatek,mt7621-soc";
|
||||||
|
model = "I-O DATA WN-AX1167GR2";
|
||||||
|
};
|
||||||
|
|
||||||
|
&partitions {
|
||||||
|
partition@6b00000 {
|
||||||
|
label = "Backup";
|
||||||
|
reg = <0x6b00000 0x1480000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&pcie1 {
|
||||||
|
wifi@0,0 {
|
||||||
|
compatible = "mediatek,mt76";
|
||||||
|
reg = <0x0000 0 0 0 0>;
|
||||||
|
mediatek,mtd-eeprom = <&factory 0x0>;
|
||||||
|
};
|
||||||
|
};
|
||||||
31
target/linux/ramips/dts/mt7621_iodata_wn-dx1167r.dts
Normal file
31
target/linux/ramips/dts/mt7621_iodata_wn-dx1167r.dts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||||
|
/dts-v1/;
|
||||||
|
|
||||||
|
#include "mt7621_iodata_wn-xx-xr.dtsi"
|
||||||
|
|
||||||
|
/ {
|
||||||
|
compatible = "iodata,wn-dx1167r", "mediatek,mt7621-soc";
|
||||||
|
model = "I-O DATA WN-DX1167R";
|
||||||
|
};
|
||||||
|
|
||||||
|
&partitions {
|
||||||
|
partition@6b00000 {
|
||||||
|
label = "idmkey";
|
||||||
|
reg = <0x6b00000 0x0100000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@6c00000 {
|
||||||
|
label = "Backup";
|
||||||
|
reg = <0x6c00000 0x1380000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&pcie1 {
|
||||||
|
wifi@0,0 {
|
||||||
|
compatible = "mediatek,mt76";
|
||||||
|
reg = <0x0000 0 0 0 0>;
|
||||||
|
mediatek,mtd-eeprom = <&factory 0x0>;
|
||||||
|
};
|
||||||
|
};
|
||||||
140
target/linux/ramips/dts/mt7621_iodata_wn-xx-xr.dtsi
Normal file
140
target/linux/ramips/dts/mt7621_iodata_wn-xx-xr.dtsi
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||||
|
|
||||||
|
#include "mt7621.dtsi"
|
||||||
|
|
||||||
|
#include <dt-bindings/gpio/gpio.h>
|
||||||
|
#include <dt-bindings/input/input.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
aliases {
|
||||||
|
led-boot = &led_power;
|
||||||
|
led-failsafe = &led_power;
|
||||||
|
led-running = &led_power;
|
||||||
|
led-upgrade = &led_power;
|
||||||
|
};
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
bootargs = "console=ttyS0,57600";
|
||||||
|
};
|
||||||
|
|
||||||
|
leds {
|
||||||
|
compatible = "gpio-leds";
|
||||||
|
|
||||||
|
wps {
|
||||||
|
label = "iodata:green:wps";
|
||||||
|
gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
|
||||||
|
};
|
||||||
|
|
||||||
|
led_power: power {
|
||||||
|
label = "iodata:green:power";
|
||||||
|
gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
keys {
|
||||||
|
compatible = "gpio-keys";
|
||||||
|
|
||||||
|
reset {
|
||||||
|
label = "reset";
|
||||||
|
gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
|
||||||
|
linux,code = <KEY_RESTART>;
|
||||||
|
};
|
||||||
|
|
||||||
|
repeater {
|
||||||
|
label = "repeater";
|
||||||
|
gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
|
||||||
|
linux,code = <BTN_0>;
|
||||||
|
linux,input-type = <EV_SW>;
|
||||||
|
};
|
||||||
|
|
||||||
|
wps {
|
||||||
|
label = "wps";
|
||||||
|
gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
|
||||||
|
linux,code = <KEY_WPS_BUTTON>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&nand {
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
partitions: partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
partition@0 {
|
||||||
|
label = "u-boot";
|
||||||
|
reg = <0x0 0x0100000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@100000 {
|
||||||
|
label = "u-boot-env";
|
||||||
|
reg = <0x0100000 0x0100000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
factory: partition@200000 {
|
||||||
|
label = "factory";
|
||||||
|
reg = <0x0200000 0x0100000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@300000 {
|
||||||
|
label = "SecondBoot";
|
||||||
|
reg = <0x0300000 0x0100000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@400000 {
|
||||||
|
label = "kernel";
|
||||||
|
reg = <0x0400000 0x0400000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@800000 {
|
||||||
|
label = "ubi";
|
||||||
|
reg = <0x0800000 0x2e00000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@3600000 {
|
||||||
|
label = "Config";
|
||||||
|
reg = <0x3600000 0x0100000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@3700000 {
|
||||||
|
label = "firmware_2";
|
||||||
|
reg = <0x3700000 0x3200000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@6900000 {
|
||||||
|
label = "Config_2";
|
||||||
|
reg = <0x6900000 0x0100000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@6a00000 {
|
||||||
|
label = "persist";
|
||||||
|
reg = <0x6a00000 0x0100000>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ðernet {
|
||||||
|
mtd-mac-address = <&factory 0xe000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&pcie {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&state_default {
|
||||||
|
gpio {
|
||||||
|
ralink,group = "uart2", "uart3", "wdt";
|
||||||
|
ralink,function = "gpio";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&xhci {
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
144
target/linux/ramips/dts/mt7621_jdcloud_re-sp-01b.dts
Normal file
144
target/linux/ramips/dts/mt7621_jdcloud_re-sp-01b.dts
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||||
|
/dts-v1/;
|
||||||
|
|
||||||
|
#include "mt7621.dtsi"
|
||||||
|
|
||||||
|
#include <dt-bindings/gpio/gpio.h>
|
||||||
|
#include <dt-bindings/input/input.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
compatible = "jdcloud,re-sp-01b", "mediatek,mt7621-soc";
|
||||||
|
model = "JDCloud RE-SP-01B";
|
||||||
|
|
||||||
|
aliases {
|
||||||
|
led-boot = &led_red;
|
||||||
|
led-failsafe = &led_red;
|
||||||
|
led-running = &led_green;
|
||||||
|
led-upgrade = &led_blue;
|
||||||
|
label-mac-device = ðernet;
|
||||||
|
};
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
bootargs = "console=ttyS0,115200";
|
||||||
|
};
|
||||||
|
|
||||||
|
keys {
|
||||||
|
compatible = "gpio-keys";
|
||||||
|
|
||||||
|
reset {
|
||||||
|
label = "reset";
|
||||||
|
gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
|
||||||
|
linux,code = <KEY_RESTART>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
leds {
|
||||||
|
compatible = "gpio-leds";
|
||||||
|
|
||||||
|
led_red: red {
|
||||||
|
label = "jdcloud:red:sys";
|
||||||
|
gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
|
||||||
|
panic-indicator;
|
||||||
|
};
|
||||||
|
|
||||||
|
led_green: green {
|
||||||
|
label = "jdcloud:green:sys";
|
||||||
|
gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
|
||||||
|
};
|
||||||
|
|
||||||
|
led_blue: blue {
|
||||||
|
label = "jdcloud:blue:sys";
|
||||||
|
gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&sdhci {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&spi0 {
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
flash@0 {
|
||||||
|
compatible = "jedec,spi-nor";
|
||||||
|
reg = <0>;
|
||||||
|
spi-max-frequency = <50000000>;
|
||||||
|
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
partition@0 {
|
||||||
|
label = "u-boot";
|
||||||
|
reg = <0x0 0x30000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
config: partition@30000 {
|
||||||
|
label = "config";
|
||||||
|
reg = <0x30000 0x10000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
factory: partition@40000 {
|
||||||
|
label = "factory";
|
||||||
|
reg = <0x40000 0x10000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@50000 {
|
||||||
|
compatible = "denx,uimage";
|
||||||
|
label = "firmware";
|
||||||
|
reg = <0x50000 0x1ab0000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@1b00000 {
|
||||||
|
label = "mini";
|
||||||
|
reg = <0x1b00000 0x400000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@1f00000 {
|
||||||
|
label = "oem";
|
||||||
|
reg = <0x1f00000 0x100000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ðernet {
|
||||||
|
mtd-mac-address-ascii = <&config 0x4429>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&pcie {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&pcie0 {
|
||||||
|
wifi@0,0 {
|
||||||
|
reg = <0x0000 0 0 0 0>;
|
||||||
|
mtd-mac-address-ascii = <&config 0x4429>;
|
||||||
|
mediatek,mtd-eeprom = <&factory 0x0>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&pcie1 {
|
||||||
|
wifi@0,0 {
|
||||||
|
reg = <0x0000 0 0 0 0>;
|
||||||
|
mtd-mac-address-ascii = <&config 0x4429>;
|
||||||
|
mtd-mac-address-increment = <0x80>;
|
||||||
|
mtd-mac-address-increment-byte = <3>;
|
||||||
|
mediatek,mtd-eeprom = <&factory 0x8000>;
|
||||||
|
ieee80211-freq-limit = <5000000 6000000>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&state_default {
|
||||||
|
gpio {
|
||||||
|
ralink,group = "uart2", "uart3", "wdt";
|
||||||
|
ralink,function = "gpio";
|
||||||
|
};
|
||||||
|
};
|
||||||
@ -32,11 +32,22 @@
|
|||||||
linux,default-trigger = "phy1tpt";
|
linux,default-trigger = "phy1tpt";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gpio_export {
|
||||||
|
compatible = "gpio-export";
|
||||||
|
#size-cells = <0>;
|
||||||
|
|
||||||
|
usb_power {
|
||||||
|
gpio-export,name = "usb_power";
|
||||||
|
gpio-export,output = <0>;
|
||||||
|
gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
&state_default {
|
&state_default {
|
||||||
gpio {
|
gpio {
|
||||||
ralink,group = "i2c", "refclk", "wdt", "p3led_an", "wled_an";
|
ralink,group = "i2c", "refclk", "wdt", "p2led_an", "p3led_an", "wled_an";
|
||||||
ralink,function = "gpio";
|
ralink,function = "gpio";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -98,15 +98,9 @@ static void mt7621_hw_init(struct mt7620_gsw *gsw, struct device_node *np)
|
|||||||
mt7530_mdio_w32(gsw, 0x7000, 0x3);
|
mt7530_mdio_w32(gsw, 0x7000, 0x3);
|
||||||
usleep_range(10, 20);
|
usleep_range(10, 20);
|
||||||
|
|
||||||
if ((rt_sysc_r32(SYSC_REG_CHIP_REV_ID) & 0xFFFF) == 0x0101) {
|
/* (GE1, Force 1000M/FD, FC OFF, MAX_RX_LENGTH 1536) */
|
||||||
/* (GE1, Force 1000M/FD, FC ON, MAX_RX_LENGTH 1536) */
|
mtk_switch_w32(gsw, 0x2305e30b, GSW_REG_MAC_P0_MCR);
|
||||||
mtk_switch_w32(gsw, 0x2305e30b, GSW_REG_MAC_P0_MCR);
|
mt7530_mdio_w32(gsw, 0x3600, 0x5e30b);
|
||||||
mt7530_mdio_w32(gsw, 0x3600, 0x5e30b);
|
|
||||||
} else {
|
|
||||||
/* (GE1, Force 1000M/FD, FC ON, MAX_RX_LENGTH 1536) */
|
|
||||||
mtk_switch_w32(gsw, 0x2305e33b, GSW_REG_MAC_P0_MCR);
|
|
||||||
mt7530_mdio_w32(gsw, 0x3600, 0x5e33b);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (GE2, Link down) */
|
/* (GE2, Link down) */
|
||||||
mtk_switch_w32(gsw, 0x8000, GSW_REG_MAC_P1_MCR);
|
mtk_switch_w32(gsw, 0x8000, GSW_REG_MAC_P1_MCR);
|
||||||
|
|||||||
@ -65,6 +65,28 @@ define Build/iodata-factory
|
|||||||
fi
|
fi
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Build/iodata-mstc-header
|
||||||
|
( \
|
||||||
|
data_size_crc="$$(dd if=$@ ibs=64 skip=1 2>/dev/null | \
|
||||||
|
gzip -c | tail -c 8 | od -An -tx8 --endian little | tr -d ' \n')"; \
|
||||||
|
echo -ne "$$(echo $$data_size_crc | sed 's/../\\x&/g')" | \
|
||||||
|
dd of=$@ bs=8 count=1 seek=7 conv=notrunc 2>/dev/null; \
|
||||||
|
)
|
||||||
|
dd if=/dev/zero of=$@ bs=4 count=1 seek=1 conv=notrunc 2>/dev/null
|
||||||
|
( \
|
||||||
|
header_crc="$$(dd if=$@ bs=64 count=1 2>/dev/null | \
|
||||||
|
gzip -c | tail -c 8 | od -An -N4 -tx4 --endian little | tr -d ' \n')"; \
|
||||||
|
echo -ne "$$(echo $$header_crc | sed 's/../\\x&/g')" | \
|
||||||
|
dd of=$@ bs=4 count=1 seek=1 conv=notrunc 2>/dev/null; \
|
||||||
|
)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/netis-tail
|
||||||
|
echo -n $(1) >> $@
|
||||||
|
echo -n $(UIMAGE_NAME)-yun | $(STAGING_DIR_HOST)/bin/mkhash md5 | \
|
||||||
|
sed 's/../\\\\x&/g' | xargs echo -ne >> $@
|
||||||
|
endef
|
||||||
|
|
||||||
define Build/ubnt-erx-factory-image
|
define Build/ubnt-erx-factory-image
|
||||||
if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(KERNEL_SIZE)" ]; then \
|
if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(KERNEL_SIZE)" ]; then \
|
||||||
echo '21001:6' > $(1).compat; \
|
echo '21001:6' > $(1).compat; \
|
||||||
@ -336,6 +358,38 @@ define Device/iodata_wn-ax1167gr
|
|||||||
endef
|
endef
|
||||||
TARGET_DEVICES += iodata_wn-ax1167gr
|
TARGET_DEVICES += iodata_wn-ax1167gr
|
||||||
|
|
||||||
|
define Device/iodata_wn-ax1167gr2
|
||||||
|
BLOCKSIZE := 128k
|
||||||
|
PAGESIZE := 2048
|
||||||
|
UBINIZE_OPTS := -E 5
|
||||||
|
UIMAGE_MAGIC := 0x434f4d42
|
||||||
|
KERNEL_SIZE := 4096k
|
||||||
|
IMAGE_SIZE := 51200k
|
||||||
|
DEVICE_VENDOR := I-O DATA
|
||||||
|
DEVICE_MODEL := WN-AX1167GR2
|
||||||
|
KERNEL_INITRAMFS := $(KERNEL_DTB) | custom-initramfs-uimage 3.10(XBC.1)b10 | \
|
||||||
|
iodata-mstc-header
|
||||||
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
||||||
|
DEVICE_PACKAGES := kmod-mt7615e wpad-openssl
|
||||||
|
endef
|
||||||
|
TARGET_DEVICES += iodata_wn-ax1167gr2
|
||||||
|
|
||||||
|
define Device/iodata_wn-dx1167r
|
||||||
|
BLOCKSIZE := 128k
|
||||||
|
PAGESIZE := 2048
|
||||||
|
UBINIZE_OPTS := -E 5
|
||||||
|
UIMAGE_MAGIC := 0x434f4d43
|
||||||
|
KERNEL_SIZE := 4096k
|
||||||
|
IMAGE_SIZE := 51200k
|
||||||
|
DEVICE_VENDOR := I-O DATA
|
||||||
|
DEVICE_MODEL := WN-DX1167R
|
||||||
|
KERNEL_INITRAMFS := $(KERNEL_DTB) | custom-initramfs-uimage 3.10(XIK.1)b10 | \
|
||||||
|
iodata-mstc-header
|
||||||
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
||||||
|
DEVICE_PACKAGES := kmod-mt7615e wpad-openssl
|
||||||
|
endef
|
||||||
|
TARGET_DEVICES += iodata_wn-dx1167r
|
||||||
|
|
||||||
define Device/iodata_wn-gx300gr
|
define Device/iodata_wn-gx300gr
|
||||||
IMAGE_SIZE := 7616k
|
IMAGE_SIZE := 7616k
|
||||||
DEVICE_VENDOR := I-O DATA
|
DEVICE_VENDOR := I-O DATA
|
||||||
@ -385,6 +439,14 @@ define Device/jcg_jhr-ac876m
|
|||||||
endef
|
endef
|
||||||
TARGET_DEVICES += jcg_jhr-ac876m
|
TARGET_DEVICES += jcg_jhr-ac876m
|
||||||
|
|
||||||
|
define Device/jdcloud_re-sp-01b
|
||||||
|
IMAGE_SIZE := 27328k
|
||||||
|
DEVICE_VENDOR := JDCloud
|
||||||
|
DEVICE_MODEL := RE-SP-01B
|
||||||
|
DEVICE_PACKAGES := kmod-fs-ext4 kmod-mt7603 kmod-mt7615e kmod-sdhci-mt7620 kmod-usb3 wpad-openssl
|
||||||
|
endef
|
||||||
|
TARGET_DEVICES += jdcloud_re-sp-01b
|
||||||
|
|
||||||
define Device/lenovo_newifi-d1
|
define Device/lenovo_newifi-d1
|
||||||
IMAGE_SIZE := 32448k
|
IMAGE_SIZE := 32448k
|
||||||
DEVICE_VENDOR := Newifi
|
DEVICE_VENDOR := Newifi
|
||||||
@ -594,8 +656,9 @@ define Device/netis_wf2881
|
|||||||
FILESYSTEMS := squashfs
|
FILESYSTEMS := squashfs
|
||||||
KERNEL_SIZE := 4096k
|
KERNEL_SIZE := 4096k
|
||||||
IMAGE_SIZE := 129280k
|
IMAGE_SIZE := 129280k
|
||||||
KERNEL := $(KERNEL_DTB) | pad-offset $$(BLOCKSIZE) 64 | uImage lzma
|
|
||||||
UBINIZE_OPTS := -E 5
|
UBINIZE_OPTS := -E 5
|
||||||
|
UIMAGE_NAME := WF2881_0.0.00
|
||||||
|
KERNEL_INITRAMFS := $(KERNEL_DTB) | netis-tail WF2881 | uImage lzma
|
||||||
IMAGES += factory.bin
|
IMAGES += factory.bin
|
||||||
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
||||||
IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
|
IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
|
||||||
@ -603,7 +666,6 @@ define Device/netis_wf2881
|
|||||||
DEVICE_VENDOR := NETIS
|
DEVICE_VENDOR := NETIS
|
||||||
DEVICE_MODEL := WF2881
|
DEVICE_MODEL := WF2881
|
||||||
DEVICE_PACKAGES := kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport wpad-openssl
|
DEVICE_PACKAGES := kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport wpad-openssl
|
||||||
SUPPORTED_DEVICES += wf-2881
|
|
||||||
endef
|
endef
|
||||||
TARGET_DEVICES += netis_wf2881
|
TARGET_DEVICES += netis_wf2881
|
||||||
|
|
||||||
@ -611,8 +673,6 @@ define Device/phicomm_k2p
|
|||||||
IMAGE_SIZE := 15744k
|
IMAGE_SIZE := 15744k
|
||||||
DEVICE_VENDOR := Phicomm
|
DEVICE_VENDOR := Phicomm
|
||||||
DEVICE_MODEL := K2P
|
DEVICE_MODEL := K2P
|
||||||
DEVICE_ALT0_VENDOR := Phicomm
|
|
||||||
DEVICE_ALT0_MODEL := KE 2P
|
|
||||||
SUPPORTED_DEVICES += k2p
|
SUPPORTED_DEVICES += k2p
|
||||||
DEVICE_PACKAGES := luci-app-mtwifi
|
DEVICE_PACKAGES := luci-app-mtwifi
|
||||||
endef
|
endef
|
||||||
|
|||||||
@ -20,7 +20,7 @@ define KernelPackage/pwm-mediatek-ramips
|
|||||||
AUTOLOAD:=$(call AutoProbe,pwm-mediatek-ramips)
|
AUTOLOAD:=$(call AutoProbe,pwm-mediatek-ramips)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define KernelPackage/pwm-mediatek/description
|
define KernelPackage/pwm-mediatek-ramips/description
|
||||||
Kernel modules for MediaTek Pulse Width Modulator
|
Kernel modules for MediaTek Pulse Width Modulator
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|||||||
@ -77,6 +77,8 @@ ramips_setup_interfaces()
|
|||||||
elecom,wrc-1900gst|\
|
elecom,wrc-1900gst|\
|
||||||
elecom,wrc-2533gst|\
|
elecom,wrc-2533gst|\
|
||||||
iodata,wn-ax1167gr|\
|
iodata,wn-ax1167gr|\
|
||||||
|
iodata,wn-ax1167gr2|\
|
||||||
|
iodata,wn-dx1167r|\
|
||||||
iodata,wn-gx300gr|\
|
iodata,wn-gx300gr|\
|
||||||
iodata,wnpr2600g|\
|
iodata,wnpr2600g|\
|
||||||
iptime,a8004t)
|
iptime,a8004t)
|
||||||
@ -124,6 +126,7 @@ ramips_setup_interfaces()
|
|||||||
ucidef_add_switch_attr "switch0" "enable" "false"
|
ucidef_add_switch_attr "switch0" "enable" "false"
|
||||||
ucidef_set_interface_lan "eth0"
|
ucidef_set_interface_lan "eth0"
|
||||||
;;
|
;;
|
||||||
|
jdcloud,re-sp-01b|\
|
||||||
mikrotik,rbm33g)
|
mikrotik,rbm33g)
|
||||||
ucidef_add_switch "switch0" \
|
ucidef_add_switch "switch0" \
|
||||||
"1:lan" "2:lan" "0:wan" "6@eth0"
|
"1:lan" "2:lan" "0:wan" "6@eth0"
|
||||||
@ -227,6 +230,12 @@ ramips_setup_macs()
|
|||||||
xiaoyu,xy-c5)
|
xiaoyu,xy-c5)
|
||||||
wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1)
|
wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1)
|
||||||
;;
|
;;
|
||||||
|
iodata,wn-ax1167gr2|\
|
||||||
|
iodata,wn-dx1167r|\
|
||||||
|
xiaomi,mir3g-v2)
|
||||||
|
wan_mac=$(mtd_get_mac_binary factory 0xe006)
|
||||||
|
label_mac=$wan_mac
|
||||||
|
;;
|
||||||
iodata,wnpr2600g)
|
iodata,wnpr2600g)
|
||||||
wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
|
wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
|
||||||
label_mac=$wan_mac
|
label_mac=$wan_mac
|
||||||
@ -272,10 +281,6 @@ ramips_setup_macs()
|
|||||||
lan_mac=$(mtd_get_mac_binary factory 0xe006)
|
lan_mac=$(mtd_get_mac_binary factory 0xe006)
|
||||||
label_mac=$lan_mac
|
label_mac=$lan_mac
|
||||||
;;
|
;;
|
||||||
xiaomi,mir3g-v2)
|
|
||||||
wan_mac=$(mtd_get_mac_binary factory 0xe006)
|
|
||||||
label_mac=$wan_mac
|
|
||||||
;;
|
|
||||||
zbtlink,zbt-we1326)
|
zbtlink,zbt-we1326)
|
||||||
wan_mac=$(mtd_get_mac_binary factory 0xe006)
|
wan_mac=$(mtd_get_mac_binary factory 0xe006)
|
||||||
label_mac=$(mtd_get_mac_binary factory 0x4)
|
label_mac=$(mtd_get_mac_binary factory 0x4)
|
||||||
|
|||||||
55
target/linux/ramips/mt7621/base-files/lib/upgrade/iodata.sh
Normal file
55
target/linux/ramips/mt7621/base-files/lib/upgrade/iodata.sh
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2019 OpenWrt.org
|
||||||
|
#
|
||||||
|
|
||||||
|
. /lib/functions.sh
|
||||||
|
|
||||||
|
iodata_mstc_prepare_fail() {
|
||||||
|
echo "failed to check and prepare the environment, rebooting..."
|
||||||
|
umount -a
|
||||||
|
reboot -f
|
||||||
|
}
|
||||||
|
|
||||||
|
# I-O DATA devices manufactured by MSTC (MitraStar Technology Corp.)
|
||||||
|
# have two important flags:
|
||||||
|
# - bootnum: switch between two os images
|
||||||
|
# use 1st image in OpenWrt
|
||||||
|
# - debugflag: enable/disable debug
|
||||||
|
# users can interrupt Z-Loader for recovering the device if enabled
|
||||||
|
iodata_mstc_upgrade_prepare() {
|
||||||
|
local persist_mtd="$(find_mtd_part persist)"
|
||||||
|
local factory_mtd="$(find_mtd_part factory)"
|
||||||
|
|
||||||
|
if [ -z "$persist_mtd" -o -z "$factory_mtd" ]; then
|
||||||
|
echo 'cannot find mtd partition(s), "factory" or "persist"'
|
||||||
|
iodata_mstc_prepare_fail
|
||||||
|
fi
|
||||||
|
|
||||||
|
local bootnum=$(hexdump -s 4 -n 1 -e '"%x"' ${persist_mtd})
|
||||||
|
local debugflag=$(hexdump -s 65141 -n 1 -e '"%x"' ${factory_mtd})
|
||||||
|
|
||||||
|
if [ "$bootnum" != "1" -a "$bootnum" != "2" ]; then
|
||||||
|
echo "failed to get bootnum, please check the value at 0x4 in ${persist_mtd}"
|
||||||
|
iodata_mstc_prepare_fail
|
||||||
|
fi
|
||||||
|
if [ "$debugflag" != "0" -a "$debugflag" != "1" ]; then
|
||||||
|
echo "failed to get debugflag, please check the value at 0xFE75 in ${factory_mtd}"
|
||||||
|
iodata_mstc_prepare_fail
|
||||||
|
fi
|
||||||
|
echo "current: bootnum => ${bootnum}, debugflag => ${debugflag}"
|
||||||
|
|
||||||
|
if [ "$bootnum" = "2" ]; then
|
||||||
|
if ! (echo -ne "\x01" | dd bs=1 count=1 seek=4 conv=notrunc of=${persist_mtd} 2>/dev/null); then
|
||||||
|
echo "failed to set bootnum"
|
||||||
|
iodata_mstc_prepare_fail
|
||||||
|
fi
|
||||||
|
echo "### switch to 1st os-image on next boot ###"
|
||||||
|
fi
|
||||||
|
if [ "$debugflag" = "0" ]; then
|
||||||
|
if ! (echo -ne "\x01" | dd bs=1 count=1 seek=65141 conv=notrunc of=${factory_mtd} 2>/dev/null); then
|
||||||
|
echo "failed to set debugflag"
|
||||||
|
iodata_mstc_prepare_fail
|
||||||
|
fi
|
||||||
|
echo "### enable debug ###"
|
||||||
|
fi
|
||||||
|
}
|
||||||
@ -55,6 +55,11 @@ platform_do_upgrade() {
|
|||||||
xiaomi,mir3p)
|
xiaomi,mir3p)
|
||||||
nand_do_upgrade "$1"
|
nand_do_upgrade "$1"
|
||||||
;;
|
;;
|
||||||
|
iodata,wn-ax1167gr2|\
|
||||||
|
iodata,wn-dx1167r)
|
||||||
|
iodata_mstc_upgrade_prepare
|
||||||
|
nand_do_upgrade "$1"
|
||||||
|
;;
|
||||||
ubiquiti,edgerouterx|\
|
ubiquiti,edgerouterx|\
|
||||||
ubiquiti,edgerouterx-sfp)
|
ubiquiti,edgerouterx-sfp)
|
||||||
platform_upgrade_ubnt_erx "$1"
|
platform_upgrade_ubnt_erx "$1"
|
||||||
|
|||||||
@ -60,7 +60,6 @@ ramips_setup_interfaces()
|
|||||||
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
|
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
|
||||||
;;
|
;;
|
||||||
hiwifi,hc5661a|\
|
hiwifi,hc5661a|\
|
||||||
hiwifi,hc5761a|\
|
|
||||||
mediatek,mt7628an-eval-board|\
|
mediatek,mt7628an-eval-board|\
|
||||||
mercury,mac1200r-v2|\
|
mercury,mac1200r-v2|\
|
||||||
totolink,lr1200|\
|
totolink,lr1200|\
|
||||||
@ -69,6 +68,10 @@ ramips_setup_interfaces()
|
|||||||
ucidef_add_switch "switch0" \
|
ucidef_add_switch "switch0" \
|
||||||
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
|
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
|
||||||
;;
|
;;
|
||||||
|
hiwifi,hc5761a)
|
||||||
|
ucidef_add_switch "switch0" \
|
||||||
|
"0:lan" "1:lan" "4:wan" "6@eth0"
|
||||||
|
;;
|
||||||
iptime,a3)
|
iptime,a3)
|
||||||
ucidef_add_switch "switch0" \
|
ucidef_add_switch "switch0" \
|
||||||
"2:lan:2" "3:lan:1" "0:wan" "6@eth0"
|
"2:lan:2" "3:lan:1" "0:wan" "6@eth0"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user