aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/rockchip/armv8
diff options
context:
space:
mode:
authorDavid Bauer <mail@david-bauer.net>2020-07-16 10:08:57 +0200
committerDavid Bauer <mail@david-bauer.net>2020-07-28 15:52:44 +0200
commitb7a9a183fb44f77d9f95c20bcec1db0edea9e206 (patch)
treec09ed017d25e760ad1f0f6cb56498e8060528362 /target/linux/rockchip/armv8
parentb72f7c64a4eb4aa14f3b632dd4ff77a4802c0311 (diff)
downloadupstream-b7a9a183fb44f77d9f95c20bcec1db0edea9e206.tar.gz
upstream-b7a9a183fb44f77d9f95c20bcec1db0edea9e206.tar.bz2
upstream-b7a9a183fb44f77d9f95c20bcec1db0edea9e206.zip
rockchip: add NanoPi R2S support
Hardware -------- RockChip RK3328 ARM64 (4 cores) 1GB DDR4 RAM 2x 1000 Base-T 3 LEDs (LAN / WAN / SYS) 1 Button (Reset) Micro-SD slot USB 2.0 Port Installation ------------ Uncompress the OpenWrt sysupgrade and write it to a micro SD card using dd. MAC-address ----------- The vendor code supports reading a MAC address from an EEPROM connected via i2c0 of the SoC. The EEPROM (address 0x51) should contain the MAC address in binary at offset 0xfa. However, my two units didn't come with such an EEPROM soldered on. The EEPROM should be placed between the SoC and the GPIO pins on the board. (U10) Generating rendom MAC addresses works around this issue. Otherwise, all boards running the same image have identical MAC addresses. Signed-off-by: David Bauer <mail@david-bauer.net>
Diffstat (limited to 'target/linux/rockchip/armv8')
-rwxr-xr-xtarget/linux/rockchip/armv8/base-files/etc/board.d/01_leds20
-rwxr-xr-xtarget/linux/rockchip/armv8/base-files/etc/board.d/02_network42
-rw-r--r--target/linux/rockchip/armv8/config-5.42
3 files changed, 58 insertions, 6 deletions
diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds b/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds
new file mode 100755
index 0000000000..bba3e2aa56
--- /dev/null
+++ b/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+. /lib/functions/leds.sh
+. /lib/functions/uci-defaults.sh
+
+board=$(board_name)
+boardname="${board##*,}"
+
+board_config_update
+
+case $board in
+friendlyarm,nanopi-r2s)
+ ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth0"
+ ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth1"
+ ;;
+esac
+
+board_config_flush
+
+exit 0
diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network
index c5adda1706..e129fd6a67 100755
--- a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network
+++ b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network
@@ -1,15 +1,45 @@
#!/bin/sh
. /lib/functions/uci-defaults.sh
+. /lib/functions/system.sh
-board_config_update
+rockchip_setup_interfaces()
+{
+ local board="$1"
+
+ case "$board" in
+ friendlyarm,nanopi-r2s)
+ ucidef_set_interfaces_lan_wan 'eth1' 'eth0'
+ ;;
+ *)
+ ucidef_set_interface_lan 'eth0'
+ ;;
+ esac
+}
+
+rockchip_setup_macs()
+{
+ local board="$1"
+ local lan_mac=""
+ local wan_mac=""
+ local label_mac=""
-case "$(board_name)" in
-*)
- ucidef_set_interface_lan 'eth0'
- ;;
-esac
+ case "$board" in
+ friendlyarm,nanopi-r2s)
+ wan_mac=$(macaddr_random)
+ lan_mac=$(macaddr_add "$wan_mac" +1)
+ ;;
+ esac
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
+ [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
+}
+
+board_config_update
+board=$(board_name)
+rockchip_setup_interfaces $board
+rockchip_setup_macs $board
board_config_flush
exit 0
diff --git a/target/linux/rockchip/armv8/config-5.4 b/target/linux/rockchip/armv8/config-5.4
index 4f29204dd2..2615684fed 100644
--- a/target/linux/rockchip/armv8/config-5.4
+++ b/target/linux/rockchip/armv8/config-5.4
@@ -375,6 +375,7 @@ CONFIG_REGMAP_MMIO=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FAN53555=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
+CONFIG_REGULATOR_GPIO=y
CONFIG_REGULATOR_PWM=y
CONFIG_REGULATOR_RK808=y
CONFIG_RELOCATABLE=y
@@ -482,6 +483,7 @@ CONFIG_UNINLINE_SPIN_UNLOCK=y
CONFIG_USB=y
CONFIG_USB_COMMON=y
CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_DUAL_ROLE=y
CONFIG_USB_DWC3_HOST=y
CONFIG_USB_DWC3_OF_SIMPLE=y
CONFIG_USB_EHCI_HCD=y