forked from freifunk-franken/firmware
wip: rb5009: include mtpoe for poe control
This commit is contained in:
parent
7c0a24a80c
commit
acefb5a0ca
|
@ -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
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
From 6a7095d0873f9a836fe65746c4df46f83644c2e5 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 | 28 +++++++++++++++++++
|
||||
1 file changed, 28 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..cd11facc25 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 +374,31 @@
|
||||
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>;
|
||||
+ };
|
||||
+};
|
||||
--
|
||||
2.43.2
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
#
|
||||
# Copyright (C) 2018 adron@yapic.net
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mtpoe_ctrl
|
||||
PKG_SOURCE_VERSION:=7dc4c48c7840031ed319b6d94d21606f1fbec046
|
||||
#PKG_MIRROR_HASH:=fedc3f0fa11d7f7b21e33f28d88cd607ad951877aab55d964b1653d45f04b5d7
|
||||
PKG_VERSION:=1.15.1
|
||||
PKG_RELEASE:=20
|
||||
|
||||
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/
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/mtpoe_ctrl.defaults $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,mtpoe_ctrl))
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2018 Sergey Sergeev adron@yapic.net
|
||||
|
||||
START=11
|
||||
|
||||
start() {
|
||||
/usr/bin/mtpoe_ctrl --action=load_poe_from_uci >/dev/null 2>&1
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
|
||||
uci -q get network.@poe[0] || {
|
||||
num=0
|
||||
board=$(cat /tmp/sysinfo/board_name)
|
||||
case "$board" in
|
||||
rb-750p-pbr2|\
|
||||
mikrotik,routerboard-960pgs)
|
||||
num=4
|
||||
;;
|
||||
mikrotik,rb5009upr)
|
||||
num=8
|
||||
;;
|
||||
*)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
if [ "$num" -gt 0 ]; then
|
||||
uci add network poe
|
||||
n=0
|
||||
while [ "$n" -lt "$num" ]; do
|
||||
uci set network.@poe[0].port$n='0'
|
||||
n=$((n + 1))
|
||||
done
|
||||
uci commit network.@poe[0]
|
||||
fi
|
||||
}
|
Loading…
Reference in New Issue