Compare commits

..

2 Commits

Author SHA1 Message Date
Fabian Bläse 28c691d47b fixup 2024-02-27 21:28:40 +01:00
Fabian Bläse acefb5a0ca wip: rb5009: include mtpoe for poe control 2024-02-27 00:06:45 +01:00
23 changed files with 158 additions and 74 deletions

View File

@ -4,7 +4,7 @@ clone:
settings:
tags: true
steps:
pipeline:
buildall-layer3:
image: openwrtorg/imagebuilder
commands:
@ -42,5 +42,4 @@ steps:
- echo "You can download the built firmware images here:"
- echo "https://ci.fff.community/artifacts/$(git describe --tags)"
when:
branch: [ master ]
branches: [ master ]

View File

@ -5,7 +5,7 @@ CONFIG_TARGET_mvebu=y
CONFIG_TARGET_mvebu_cortexa72=y
CONFIG_TARGET_MULTI_PROFILE=y
CONFIG_TARGET_DEVICE_mvebu_cortexa72_DEVICE_mikrotik_rb5009=y
CONFIG_TARGET_DEVICE_PACKAGES_mvebu_cortexa72_DEVICE_mikrotik_rb5009=""
CONFIG_TARGET_DEVICE_PACKAGES_mvebu_cortexa72_DEVICE_mikrotik_rb5009="mtpoe_ctrl"
CONFIG_BUSYBOX_CUSTOM=y
CONFIG_TARGET_PER_DEVICE_ROOTFS=y
# CONFIG_BUSYBOX_CONFIG_BRCTL is not set
@ -34,6 +34,7 @@ CONFIG_CLEAN_IPKG=y
CONFIG_PACKAGE_fff-extra=y
CONFIG_PACKAGE_libuclient=m
CONFIG_PACKAGE_libwolfssl=m
CONFIG_PACKAGE_mtpoe_ctrl=m
CONFIG_PACKAGE_opkg=m
CONFIG_PACKAGE_uclient-fetch=m
CONFIG_PACKAGE_wpad-basic=y

View File

@ -4,5 +4,4 @@ images=("openwrt-${chipset}-${subtarget}-tplink_archer-c50-v3-squashfs-*"
"openwrt-${chipset}-${subtarget}-tplink_archer-c50-v4-squashfs-*"
"openwrt-${chipset}-${subtarget}-tplink_tl-wr841n-v13-squashfs-*"
"openwrt-${chipset}-${subtarget}-xiaomi_mi-router-4a-100m-squashfs-*"
"openwrt-${chipset}-${subtarget}-xiaomi_mi-router-4a-100m-intl-squashfs-*"
)

View File

@ -12,8 +12,6 @@ CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-wr841n-v13=y
CONFIG_TARGET_DEVICE_PACKAGES_ramips_mt76x8_DEVICE_tplink_tl-wr841n-v13=""
CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_xiaomi_mi-router-4a-100m=y
CONFIG_TARGET_DEVICE_PACKAGES_ramips_mt76x8_DEVICE_xiaomi_mi-router-4a-100m=""
CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_xiaomi_mi-router-4a-100m-intl=y
CONFIG_TARGET_DEVICE_PACKAGES_ramips_mt76x8_DEVICE_xiaomi_mi-router-4a-100m-intl=""
CONFIG_BUSYBOX_CUSTOM=y
CONFIG_TARGET_PER_DEVICE_ROOTFS=y
# CONFIG_BUSYBOX_CONFIG_BRCTL is not set

View File

@ -0,0 +1,57 @@
From 1910773e7bc06f0aa659d05f88bb7655cd66b306 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= <fabian@blaese.de>
Date: Tue, 27 Feb 2024 00:02:36 +0100
Subject: [PATCH] rb5009 poe spi
---
.../boot/dts/marvell/armada-7040-rb5009.dts | 35 +++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-rb5009.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-rb5009.dts
index 0c9742d2d8..81c413dfb7 100644
--- a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-rb5009.dts
+++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-rb5009.dts
@@ -374,3 +381,40 @@
reg = <0x10 0x6>;
};
};
+
+&cp0_pinctrl {
+ cp0_spi1_pins: cp0-spi1-pins {
+ // Mikrotik defines SPI1 with mpp50 as CS0 and then additionally sets mpp8 as CS for the PoE driver via GPIO. We just want the hardware to handle CS0 on mpp8
+ marvell,pins = "mpp47", "mpp48", "mpp49", "mpp8";
+ //marvell,pins = "mpp47", "mpp48", "mpp49", "mpp50";
+ marvell,function = "spi1";
+ };
+
+ /*cp0_spi1_poe_cs_pins: cp0-spi1-poe-cs-pins {
+ marvell,pins = "mpp8";
+ marcell,function = "gpio";
+ };*/
+};
+
+&cp0_spi1 {
+ status = "okay";
+
+ pinctrl-0 = <&cp0_spi1_pins>;
+ pinctrl-names = "default";
+
+ spidev@0 {
+ compatible = "rohm,dh2228fv";
+ //compatible = "linux,spidev";
+ reg = <0>;
+ spi-max-frequency = <2000000>;
+ };
+};
+
+&cp0_gpio1 {
+ enable-poe-power {
+ gpio-hog;
+ gpios = <8 GPIO_ACTIVE_HIGH>;
+ output-high;
+ line-name = "enable PoE chip";
+ };
+};
--
2.43.2

View File

@ -7,9 +7,9 @@ set -o pipefail
builddir=./build
# OpenWrt: package hashes correspond to core repo version
OPENWRTREV="v23.05.3"
PACKAGEREV="063b2393cbc3e5aab9d2b40b2911cab1c3967c59"
ROUTINGREV="648753932d5a7deff7f2bdb33c000018a709ad84"
OPENWRTREV="v23.05.2"
PACKAGEREV="8e3a1824645f5e73ec44c897ac0755c53fb4a1f8"
ROUTINGREV="83ef3784a9092cfd0a900cc28e2ed4e13671d667"
# Gluon packages: master from 2020-02-04
GLUONREV="12e41d0ff07ec54bbd67a31ab50d12ca04f2238c"

View File

@ -82,12 +82,12 @@ babel_reload() {
# switch implementation temporarily
case $implementation in
bird2)
[ -f /etc/init.d/babeld ] && /etc/init.d/babeld stop 2>/dev/null
[ -f /etc/init.d/fff-bird ] && /etc/init.d/fff-bird start
/etc/init.d/babeld stop 2>/dev/null
/etc/init.d/fff-bird start
;;
babeld)
[ -f /etc/init.d/fff-bird ] && /etc/init.d/fff-bird stop 2>/dev/null
[ -f /etc/init.d/babeld ] && /etc/init.d/babeld start
/etc/init.d/fff-bird stop 2>/dev/null
/etc/init.d/babeld start
;;
esac
@ -101,12 +101,12 @@ babel_apply() {
# switch implementation persistently
case $implementation in
bird2)
[ -f /etc/init.d/babeld ] && /etc/init.d/babeld disable
[ -f /etc/init.d/fff-bird ] && /etc/init.d/fff-bird enable
/etc/init.d/babeld disable
/etc/init.d/fff-bird enable
;;
babeld)
[ -f /etc/init.d/fff-bird ] && /etc/init.d/fff-bird disable
[ -f /etc/init.d/babeld ] && /etc/init.d/babeld enable
/etc/init.d/fff-bird disable
/etc/init.d/babeld enable
;;
esac

View File

@ -11,7 +11,6 @@ define Package/fff-extra
TITLE:=Freifunk-Franken gateway configuration
URL:=https://www.freifunk-franken.de
DEPENDS:=+bmon \
+ethtool \
+htop \
+procps-ng \
+procps-ng-vmstat \

View File

@ -10,8 +10,7 @@ define Package/$(PKG_NAME)
CATEGORY:=Freifunk
TITLE:=Freifunk-Franken firewall
URL:=https://www.freifunk-franken.de
DEPENDS:=+kmod-nft-bridge \
+nftables
DEPENDS:=+nftables
endef
define Package/$(PKG_NAME)/description

View File

@ -1 +0,0 @@
nft -f /etc/nftables-fff.conf

View File

@ -7,7 +7,7 @@
BOARD="$(uci get board.model.name)"
# only migrate appropriate config versions
[ "$(uci -q get gateway.meta.config_version)" = "1" ] || exit 0
[ "$(uci -q get gateway.meta.config_version)" = "1" ] || exit 1
translate_ports() {
local vlan="$1"
@ -77,5 +77,3 @@ esac
uci set gateway.meta.config_version='2'
uci commit gateway
exit 0

View File

@ -7,7 +7,7 @@
BOARD="$(uci get board.model.name)"
# only migrate appropriate config versions
[ "$(uci -q get gateway.meta.config_version)" = "2" ] || exit 0
[ "$(uci -q get gateway.meta.config_version)" = "2" ] || exit 1
translate_ports() {
local vlan="$1"
@ -74,5 +74,3 @@ esac
uci set gateway.meta.config_version='3'
uci commit gateway
exit 0

View File

@ -12,8 +12,7 @@ get_cpu_port() {
tplink,tl-wr1043nd-v2|\
tplink,tl-wr1043nd-v3|\
tplink,tl-wr841n-v13|\
xiaomi,mi-router-4a-100m|\
xiaomi,mi-router-4a-100m-intl)
xiaomi,mi-router-4a-100m)
CPUPORT="6t"
;;
avm,fritzbox-4040|\

View File

@ -36,8 +36,7 @@ get_port_order() {
tplink,cpe510-v1)
PORTORDER="5 4"
;;
xiaomi,mi-router-4a-100m|\
xiaomi,mi-router-4a-100m-intl)
xiaomi,mi-router-4a-100m)
PORTORDER="0 2 4"
;;
esac

View File

@ -48,12 +48,19 @@ for filename in $(grep 'up\|unknown' /sys/class/net/*/operstate); do
interface_data=$interface_data"<$iface><name>$iface</name>$addrs<traffic_rx>$traffic_rx</traffic_rx><traffic_tx>$traffic_tx</traffic_tx>"
interface_data=$interface_data$(iwconfig "${iface}" 2>/dev/null | awk -F':' '
/Mode/{ split($2, m, " "); printf "<wlan_mode>"m[1]"</wlan_mode>" }
/Cell/{ split($0, c, " "); printf "<wlan_bssid>"c[5]"</wlan_bssid>" }
/ESSID/ { split($0, e, "\""); printf "<wlan_essid>"e[2]"</wlan_essid>" }
/Freq/{ split($3, f, " "); printf "<wlan_frequency>"f[1]f[2]"</wlan_frequency>" }
/Tx-Power/{ split($0, p, "="); sub(/[[:space:]]*$/, "", p[2]); printf "<wlan_tx_power>"p[2]"</wlan_tx_power>" }
')
interface_data=$interface_data$(iw dev "${iface}" info 2>/dev/null | awk '
/ssid/{ split($0, s, " "); printf "<wlan_ssid>"s[2]"</wlan_ssid>" }
/type/ { split($0, t, " "); printf "<wlan_type>"t[2]"</wlan_type>" }
/channel/{ split($0, c, " "); printf "<wlan_channel>"c[2]"</wlan_channel>" }
/width/{ split($0, w, ": "); sub(/ .*/, "", w[2]); printf "<wlan_width>"w[2]"</wlan_width>" }
/txpower/{ sub(/\.../, "", $2); print "<wlan_tx_power>"$2" dBm</wlan_tx_power>" }
')
interface_data=$interface_data"</$iface>"

View File

@ -1,7 +0,0 @@
. /lib/functions/fff/network
WANDEV=eth0
SWITCHDEV=eth0
CLIENT_PORTS="6t 4"
WAN_PORTS="6t 0"
BATMAN_PORTS="6t 2"

View File

@ -4,7 +4,7 @@ table bridge filter {
# vom Gateway (also vom BATMAN) kommen darf.
chain IN_ONLY {
# -i ! bat0 --logical-in br-client -j DROP
iifname != "bat0" ibrname "br-client" counter drop
iifname != "bat0" counter drop
counter
}
@ -12,7 +12,7 @@ table bridge filter {
# in Richtung Gateway (also ins BATMAN) gesendet werden darf.
chain OUT_ONLY {
# --logical-out br-client -o ! bat0 -j DROP
oifname != "bat0" obrname "br-client" counter drop
oifname != "bat0" counter drop
counter
}
@ -24,21 +24,21 @@ table bridge filter {
type filter hook input priority filter; policy accept;
# -d Multicast -i ! bat0 --logical-in br-client -j ACCEPT
iifname != "bat0" ether daddr & 01:00:00:00:00:00 == 01:00:00:00:00:00 ibrname "br-client" counter packets 0 bytes 0 accept
iifname != "bat0" ether daddr & 01:00:00:00:00:00 == 01:00:00:00:00:00 counter packets 0 bytes 0 accept
}
chain FORWARD {
type filter hook forward priority filter; policy accept;
# -d Multicast --logical-out br-client -o bat0 -j MULTICAST_OUT
oifname "bat0" obrname "br-client" ether daddr & 01:00:00:00:00:00 == 01:00:00:00:00:00 counter packets 0 bytes 0 jump MULTICAST_OUT
oifname "bat0" ether daddr & 01:00:00:00:00:00 == 01:00:00:00:00:00 counter packets 0 bytes 0 jump MULTICAST_OUT
}
chain OUTPUT {
type filter hook output priority filter; policy accept;
# -d Multicast --logical-out br-client -o bat0 -j MULTICAST_OUT
oifname "bat0" obrname "br-client" ether daddr & 01:00:00:00:00:00 == 01:00:00:00:00:00 counter jump MULTICAST_OUT
oifname "bat0" ether daddr & 01:00:00:00:00:00 == 01:00:00:00:00:00 counter jump MULTICAST_OUT
}
}
__EOF

View File

@ -4,27 +4,27 @@ table bridge filter {
# No input from/to local node ip from batman
# -p IPv6 -i bat0 --logical-in br-client --ip6-src fdff::1 -j DROP
iifname "bat0" ibrname "br-client" ether type ip6 ip6 saddr fdff::1 counter drop
iifname "bat0" ether type ip6 ip6 saddr fdff::1 counter drop
# -p IPv6 -i bat0 --logical-in br-client --ip6-dst fdff::1 -j DROP
iifname "bat0" ibrname "br-client" ether type ip6 ip6 daddr fdff::1 counter drop
iifname "bat0" ether type ip6 ip6 daddr fdff::1 counter drop
}
chain FORWARD {
# Do not forward local node ip
# -p IPv6 --logical-out br-client -o bat0 --ip6-dst fdff::1 -j DROP
oifname "bat0" obrname "br-client" ether type ip6 ip6 daddr fdff::1 counter drop
oifname "bat0" ether type ip6 ip6 daddr fdff::1 counter drop
# -p IPv6 --logical-out br-client -o bat0 --ip6-src fdff::1 -j DROP
oifname "bat0" obrname "br-client" ether type ip6 ip6 saddr fdff::1 counter drop
oifname "bat0" ether type ip6 ip6 saddr fdff::1 counter drop
}
chain OUTPUT {
# Do not output local node ip to batman
# -p IPv6 --logical-out br-client -o bat0 --ip6-dst fdff::1 -j DROP
oifname "bat0" obrname "br-client" ether type ip6 ip6 daddr fdff::1 counter drop
oifname "bat0" ether type ip6 ip6 daddr fdff::1 counter drop
# -p IPv6 --logical-out br-client -o bat0 --ip6-src fdff::1 -j DROP
oifname "bat0" obrname "br-client" ether type ip6 ip6 saddr fdff::1 counter drop
oifname "bat0" ether type ip6 ip6 saddr fdff::1 counter drop
}
}
__EOF

View File

@ -4,6 +4,8 @@
START=96
boot() {
LOCALCONFIGSCRIPT="/etc/rc.local.fff_userconfig"
#add LOCALCONFIGSCRIPT to sysupgrade regardless if it already exists or not to prevent data loss
grep -q ^"${LOCALCONFIGSCRIPT}"$ /etc/sysupgrade.conf || echo "$LOCALCONFIGSCRIPT" >> /etc/sysupgrade.conf
# process user commands
[ -f "${LOCALCONFIGSCRIPT}" ] && {

View File

@ -12,8 +12,6 @@ cat > /etc/sysupgrade.conf <<-__EOF__
/etc/config/fff
/etc/config/gateway
/etc/hoodfile
/etc/nftables-fff.conf
/etc/rc.local.fff_userconfig
__EOF__
exit 0

View File

@ -1,21 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
boot() {
# first we disable the init.d
/etc/init.d/fff-wireless-update disable
# we must delete the symlink manually
rm -f /etc/rc.d/S99fff-wireless-update
# Starting with OpenWrt 23.05, reload_config does not
# properly start the wifi access point on some devices.
# This seems to be an issue with the reloading of hostapd,
# which throws errors, but does not restart hostapd.
# see https://git.freifunk-franken.de/freifunk-franken/firmware/issues/319
#
# workaround: manually restart wifi completely
# after any automatic post-update configuration (fff-layer3-config, ...)
sleep 20
wifi
}

View File

@ -0,0 +1,42 @@
#
# Copyright (C) 2018 adron@yapic.net
#
include $(TOPDIR)/rules.mk
PKG_NAME:=mtpoe_ctrl
PKG_SOURCE_VERSION:=d4dfc54f4fe8c6565d585b6a27730e4980b3103d
PKG_MIRROR_HASH:=898d93a7917b5462a2b4e00aee34f610c65e798cff82e81a77a2221140697411
PKG_VERSION:=1.15.2
PKG_RELEASE:=21
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/fblaese/mtpoe_ctrl.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_MAINTAINER:=Sergey Sergeev <adron@yapic.net>
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
define Package/mtpoe_ctrl
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=+libuci +kmod-spi-dev
TITLE:=Management utility for Mikrotiks PoE V2/V3/V4
URL:=https://github.com/adron-s/mtpoe_ctrl.git
endef
define Package/mtpoe_ctrl/description
Management utility for Mikrotiks PoE V2/V3/V4
endef
define Package/mtpoe_ctrl/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bins/mtpoe_ctrl $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/99-mtpoe_ctrl $(1)/etc/init.d/
endef
$(eval $(call BuildPackage,mtpoe_ctrl))

View File

@ -0,0 +1,18 @@
#!/bin/sh /etc/rc.common
START=11
USE_PROCD=1
start_service() {
procd_open_instance
procd_set_param command /usr/bin/mtpoe_ctrl --action=load_poe_from_uci
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}
service_triggers()
{
procd_add_reload_trigger system
}