Merge source from official

This commit is contained in:
CN_SZTL 2019-11-08 11:39:25 +08:00
commit 0d15ad37b1
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
28 changed files with 82 additions and 109 deletions

View File

@ -260,11 +260,6 @@ generate_static_system() {
uci -q set "system.@system[-1].hostname=$hostname"
fi
local label_macaddr
if json_get_var label_macaddr label_macaddr; then
uci -q set "system.@system[-1].label_macaddr=$label_macaddr"
fi
if json_is_a ntpserver array; then
local keys key
json_get_keys keys ntpserver

View File

@ -1,5 +1,7 @@
# Copyright (C) 2006-2013 OpenWrt.org
. /usr/share/libubox/jshn.sh
get_mac_binary() {
local path="$1"
local offset="$2"
@ -12,14 +14,41 @@ get_mac_binary() {
hexdump -v -n 6 -s $offset -e '5/1 "%02x:" 1/1 "%02x"' $path 2>/dev/null
}
get_mac_label() {
get_mac_label_dt() {
local basepath="/proc/device-tree"
local macdevice="$(cat "$basepath/aliases/label-mac-device" 2>/dev/null)"
local macaddr
[ -n "$macdevice" ] && macaddr=$(get_mac_binary "$basepath/$macdevice/mac-address" 0 2>/dev/null)
[ -n "$macdevice" ] || return
macaddr=$(get_mac_binary "$basepath/$macdevice/mac-address" 0 2>/dev/null)
[ -n "$macaddr" ] || macaddr=$(get_mac_binary "$basepath/$macdevice/local-mac-address" 0 2>/dev/null)
[ -n "$macaddr" ] || macaddr=$(uci -q get system.@system[0].label_macaddr)
echo $macaddr
}
get_mac_label_json() {
local cfg="/etc/board.json"
local macaddr
[ -s "$cfg" ] || return
json_init
json_load "$(cat $cfg)"
if json_is_a system object; then
json_select system
json_get_var macaddr label_macaddr
json_select ..
fi
echo $macaddr
}
get_mac_label() {
local macaddr=$(get_mac_label_dt)
[ -n "$macaddr" ] || macaddr=$(get_mac_label_json)
echo $macaddr
}
@ -115,6 +144,13 @@ macaddr_add() {
echo $oui:$nic
}
macaddr_geteui() {
local mac=$1
local sep=$2
echo ${mac:9:2}$sep${mac:12:2}$sep${mac:15:2}
}
macaddr_setbit_la() {
local mac=$1

View File

@ -60,7 +60,7 @@ config BUSYBOX_DEFAULT_INSTALL_NO_USR
default n
config BUSYBOX_DEFAULT_FEATURE_SUID
bool
default y
default n
config BUSYBOX_DEFAULT_FEATURE_SUID_CONFIG
bool
default n

View File

@ -113,6 +113,9 @@ endif
ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_NTPD),)
$(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
$(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
endif
ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_FEATURE_SUID),)
$(INSTALL_SUID) $(PKG_INSTALL_DIR)/bin/busybox $(1)/bin/busybox
endif
-rm -rf $(1)/lib64
endef

View File

@ -32,7 +32,7 @@
debounce-interval = <60>;
};
button_usb {
usb {
label = "usb";
linux,code = <BTN_2>;
gpios = <&gpio 7 GPIO_ACTIVE_LOW>;

View File

@ -27,14 +27,14 @@
keys {
compatible = "gpio-keys";
button0 {
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
button1 {
qss {
label = "qss";
linux,code = <KEY_WPS_BUTTON>;
gpios = <&gpio 7 GPIO_ACTIVE_LOW>;

View File

@ -21,14 +21,14 @@
keys {
compatible = "gpio-keys";
button0 {
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
button1 {
qss {
label = "qss";
linux,code = <KEY_WPS_BUTTON>;
gpios = <&gpio 7 GPIO_ACTIVE_LOW>;

View File

@ -49,14 +49,14 @@
keys {
compatible = "gpio-keys";
button0 {
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
debounce-interval = <60>;
};
button1 {
sw1 {
label = "sw1";
linux,input-type = <EV_SW>;
linux,code = <BTN_0>;
@ -64,7 +64,7 @@
debounce-interval = <60>;
};
button2 {
sw2 {
label = "sw2";
linux,input-type = <EV_SW>;
linux,code = <BTN_1>;

View File

@ -17,7 +17,7 @@
keys {
compatible = "gpio-keys";
button0 {
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;

View File

@ -20,19 +20,19 @@
pinctrl-names = "default";
pinctrl-0 = <&jtag_disable_pins>;
button0 {
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
};
button1 {
right {
label = "button right";
linux,code = <BTN_0>;
gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
};
button3 {
left {
label = "button left";
linux,code = <BTN_1>;
gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;

View File

@ -16,7 +16,7 @@
pinctrl-names = "default";
pinctrl-0 = <&jtag_disable_pins>;
button0 {
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;

View File

@ -46,7 +46,7 @@
keys {
compatible = "gpio-keys";
reset_button {
reset {
label = "Reset button";
linux,code = <KEY_RESTART>;
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;

View File

@ -14,7 +14,7 @@
keys {
compatible = "gpio-keys";
button0 {
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 19 GPIO_ACTIVE_LOW>;

View File

@ -42,7 +42,7 @@
};
};
button {
keys {
compatible = "gpio-keys";
reset {

View File

@ -44,7 +44,7 @@
keys {
compatible = "gpio-keys";
button0 {
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;

View File

@ -76,7 +76,7 @@
debounce-interval = <60>;
};
wifi_button {
wifi {
label = "WiFi button";
linux,code = <KEY_RFKILL>;
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;

View File

@ -86,13 +86,13 @@
keys {
compatible = "gpio-keys";
wps_button {
wps {
label = "WPS button";
linux,code = <KEY_WPS_BUTTON>;
gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
};
wlan_button {
wlan {
label = "WLAN button";
linux,code = <KEY_RFKILL>;
gpios = <&gpio 21 GPIO_ACTIVE_LOW>;

View File

@ -45,13 +45,13 @@
keys {
compatible = "gpio-keys";
wifi_button {
wifi {
label = "WiFi button";
linux,code = <KEY_RFKILL>;
gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
};
reset_button {
reset {
label = "Reset button";
linux,code = <KEY_RESTART>;
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;

View File

@ -85,19 +85,19 @@
keys {
compatible = "gpio-keys";
wps_button {
wps {
label = "WPS button";
linux,code = <KEY_WPS_BUTTON>;
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
};
wifi_button {
wifi {
label = "WiFi button";
linux,code = <KEY_RFKILL>;
gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
};
reset_button {
reset {
label = "Reset button";
linux,code = <KEY_RESTART>;
gpios = <&gpio 21 GPIO_ACTIVE_LOW>;

View File

@ -22,13 +22,13 @@
keys {
compatible = "gpio-keys";
wifi_button {
wifi {
label = "WiFi button";
linux,code = <KEY_RFKILL>;
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
};
reset_button {
reset {
label = "Reset button";
linux,code = <KEY_RESTART>;
gpios = <&gpio 21 GPIO_ACTIVE_LOW>;

View File

@ -37,7 +37,7 @@
debounce-interval = <60>;
};
button_wps {
wps {
label = "wps";
gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;

View File

@ -18,13 +18,13 @@
keys {
compatible = "gpio-keys";
wifi_button {
wifi {
label = "WiFi button";
linux,code = <KEY_RFKILL>;
gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
};
reset_button {
reset {
label = "Reset button";
linux,code = <KEY_RESTART>;
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;

View File

@ -17,7 +17,8 @@
status = "okay";
pinctrl-0 = <&mdio_pins>;
pinctrl-names = "default";
phy-reset-gpio = <&tlmm 47 0>;
reset-gpios = <&tlmm 47 GPIO_ACTIVE_LOW>;
reset-delay-us = <2000>;
};
ess-psgmii@98000 {

View File

@ -236,9 +236,10 @@
mdio@90000 {
status = "okay";
phy-reset-gpio = <&tlmm 47 0>;
pinctrl-0 = <&mdio_pins>;
pinctrl-names = "default";
reset-gpios = <&tlmm 47 GPIO_ACTIVE_LOW>;
reset-delay-us = <5000>;
};
ess-psgmii@98000 {

View File

@ -1,15 +1,3 @@
From 234d6f40fb4b771b396b45a9492aab463771bd0b Mon Sep 17 00:00:00 2001
From: Kristian Evensen <kristian.evensen@gmail.com>
Date: Tue, 6 Aug 2019 11:42:57 +0200
Subject: [PATCH] phy: Add ipq40xx mdio driver
---
drivers/net/phy/Kconfig | 7 +
drivers/net/phy/Makefile | 1 +
drivers/net/phy/mdio-ipq40xx.c | 247 +++++++++++++++++++++++++++++++++
3 files changed, 255 insertions(+)
create mode 100644 drivers/net/phy/mdio-ipq40xx.c
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -519,6 +519,13 @@ config XILINX_GMII2RGMII
@ -38,7 +26,7 @@ Subject: [PATCH] phy: Add ipq40xx mdio driver
obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o
--- /dev/null
+++ b/drivers/net/phy/mdio-ipq40xx.c
@@ -0,0 +1,247 @@
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+ *
@ -61,10 +49,8 @@ Subject: [PATCH] phy: Add ipq40xx mdio driver
+#include <linux/io.h>
+#include <linux/of_address.h>
+#include <linux/of_mdio.h>
+#include <linux/of_gpio.h>
+#include <linux/phy.h>
+#include <linux/platform_device.h>
+#include <linux/gpio.h>
+
+#define MDIO_CTRL_0_REG 0x40
+#define MDIO_CTRL_1_REG 0x44
@ -164,60 +150,11 @@ Subject: [PATCH] phy: Add ipq40xx mdio driver
+ return 0;
+}
+
+static int ipq40xx_phy_reset(struct platform_device *pdev)
+{
+ struct device_node *mdio_node;
+ int phy_reset_gpio_number;
+ int ret;
+
+ mdio_node = of_find_node_by_name(NULL, "mdio");
+ if (!mdio_node) {
+ dev_err(&pdev->dev, "Could not find mdio node\n");
+ return 0;
+ }
+
+ ret = of_get_named_gpio(mdio_node, "phy-reset-gpio", 0);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "Could not find phy-reset-gpio\n");
+ return 0;
+ }
+
+ phy_reset_gpio_number = ret;
+
+ ret = gpio_request(phy_reset_gpio_number, "phy-reset-gpio");
+ if (ret) {
+ dev_err(&pdev->dev, "Can't get phy-reset-gpio %d\n", ret);
+ return ret;
+ }
+
+ ret = gpio_direction_output(phy_reset_gpio_number, 0x0);
+ if (ret) {
+ dev_err(&pdev->dev,
+ "Can't set direction for phy-reset-gpio %d\n", ret);
+ goto phy_reset_out;
+ }
+
+ usleep_range(1000, 10005);
+
+ gpio_set_value(phy_reset_gpio_number, 0x01);
+
+phy_reset_out:
+ gpio_free(phy_reset_gpio_number);
+
+ return ret;
+}
+
+static int ipq40xx_mdio_probe(struct platform_device *pdev)
+{
+ struct ipq40xx_mdio_data *am;
+ struct resource *res;
+ int i, ret;
+
+ ret = ipq40xx_phy_reset(pdev);
+ if (ret) {
+ dev_err(&pdev->dev, "Could not find qca8075 reset gpio\n");
+ return -ENODEV;
+ }
+ int i;
+
+ am = devm_kzalloc(&pdev->dev, sizeof(*am), GFP_KERNEL);
+ if (!am)

View File

@ -35,7 +35,7 @@
};
};
button {
keys {
compatible = "gpio-keys";
reset {

View File

@ -54,7 +54,7 @@
};
};
button {
keys {
compatible = "gpio-keys";
reset {

View File

@ -60,7 +60,7 @@
};
};
button {
keys {
compatible = "gpio-keys";
reset {