summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Kresin <dev@kresin.me>2017-10-15 12:29:22 +0200
committerMathias Kresin <dev@kresin.me>2017-10-25 08:45:05 +0200
commit1470c79cebdae83161a48a5e08c6002ecf090f42 (patch)
treecfd81b21e036ea69651028df67027bd79a5bd977
parentd456a888d07e97491ad2d57f470801bbbc4c06a6 (diff)
downloadmtk-20170518-1470c79cebdae83161a48a5e08c6002ecf090f42.zip
mtk-20170518-1470c79cebdae83161a48a5e08c6002ecf090f42.tar.gz
mtk-20170518-1470c79cebdae83161a48a5e08c6002ecf090f42.tar.bz2
ltq-adsl-app: use notification based ATM/PTM driver load
This patch removes the fixed atm/ptm driver loading and switches to notification based driver loading. Signed-off-by: Mathias Kresin <dev@kresin.me>
-rw-r--r--package/kernel/lantiq/ltq-atm/Makefile3
-rw-r--r--package/network/config/ltq-adsl-app/Makefile8
-rwxr-xr-xpackage/network/config/ltq-adsl-app/files/10_atm.sh31
-rwxr-xr-xpackage/network/config/ltq-adsl-app/files/10_ptm.sh29
4 files changed, 65 insertions, 6 deletions
diff --git a/package/kernel/lantiq/ltq-atm/Makefile b/package/kernel/lantiq/ltq-atm/Makefile
index 7f4c197..065ce17 100644
--- a/package/kernel/lantiq/ltq-atm/Makefile
+++ b/package/kernel/lantiq/ltq-atm/Makefile
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ltq-atm
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/ltq-atm-$(BUILD_VARIANT)
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
@@ -24,7 +24,6 @@ define KernelPackage/ltq-atm-template
VARIANT:=$(1)
DEPENDS:=@$(2) +kmod-atm +br2684ctl
FILES:=$(PKG_BUILD_DIR)/ltq_atm_$(1).ko
- AUTOLOAD:=$(call AutoProbe,ltq_atm_$(1))
endef
KernelPackage/ltq-atm-danube=$(call KernelPackage/ltq-atm-template,danube,(TARGET_lantiq_xway||TARGET_lantiq_xway_legacy))
diff --git a/package/network/config/ltq-adsl-app/Makefile b/package/network/config/ltq-adsl-app/Makefile
index 6e0b47f..db3deca 100644
--- a/package/network/config/ltq-adsl-app/Makefile
+++ b/package/network/config/ltq-adsl-app/Makefile
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=dsl_cpe_control_danube
PKG_VERSION:=3.24.4.4
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/dsl_cpe_control-$(PKG_VERSION)
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/
@@ -76,10 +76,10 @@ CONFIGURE_ARGS += \
TARGET_CFLAGS += -I$(LINUX_DIR)/include
define Package/ltq-adsl-app/install
- $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_DIR) $(1)/etc/init.d $(1)/sbin $(1)/etc/hotplug.d/dsl
$(INSTALL_BIN) ./files/dsl_control $(1)/etc/init.d/
-
- $(INSTALL_DIR) $(1)/sbin
+ $(INSTALL_BIN) ./files/10_atm.sh $(1)/etc/hotplug.d/dsl
+ $(INSTALL_BIN) ./files/10_ptm.sh $(1)/etc/hotplug.d/dsl
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dsl_cpe_control $(1)/sbin
endef
diff --git a/package/network/config/ltq-adsl-app/files/10_atm.sh b/package/network/config/ltq-adsl-app/files/10_atm.sh
new file mode 100755
index 0000000..898d8ec
--- /dev/null
+++ b/package/network/config/ltq-adsl-app/files/10_atm.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+[ "$DSL_NOTIFICATION_TYPE" = "DSL_STATUS" ] && \
+[ "$DSL_TC_LAYER_STATUS" = "ATM" ] && \
+! grep -q "ltq_atm_ar9\|ltq_atm_ase\|ltq_atm_danube" /proc/modules || exit 0
+
+logger -p daemon.notice -t "dsl-notify" "Switching to TC-Layer ATM"
+
+if grep -q "ltq_ptm_ar9\|ltq_ptm_ase\|ltq_ptm_danube" /proc/modules ; then
+ logger -p daemon.notice -t "dsl-notify" "Loading ATM driver while EFM/PTM driver is loaded is not possible. Reboot is needed."
+ exit
+fi
+
+case "$(strings /proc/device-tree/compatible)" in
+*lantiq,ar9*)
+ soc="ar9"
+ ;;
+*lantiq,ase*)
+ soc="ase"
+ ;;
+*lantiq,danube*)
+ soc="danube"
+ ;;
+*)
+ logger -p daemon.notice -t "dsl-notify" "Unsupported SoC"
+ exit
+esac
+
+modprobe ltq_atm_${soc}
+
+/etc/init.d/br2684ctl reload
diff --git a/package/network/config/ltq-adsl-app/files/10_ptm.sh b/package/network/config/ltq-adsl-app/files/10_ptm.sh
new file mode 100755
index 0000000..8a76b92
--- /dev/null
+++ b/package/network/config/ltq-adsl-app/files/10_ptm.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+[ "$DSL_NOTIFICATION_TYPE" = "DSL_STATUS" ] && \
+[ "$DSL_TC_LAYER_STATUS" = "EFM" ] && \
+! grep -q "ltq_ptm_ar9\|ltq_ptm_ase\|ltq_ptm_danube" /proc/modules || exit 0
+
+logger -p daemon.notice -t "dsl-notify" "Switching to TC-Layer EFM/PTM"
+
+if grep -q "ltq_atm_ar9\|ltq_atm_ase\|ltq_atm_danube" /proc/modules ; then
+ logger -p daemon.notice -t "dsl-notify" "Loading EFM/PTM driver while ATM driver is loaded is not possible. Reboot is needed."
+ exit
+fi
+
+case "$(strings /proc/device-tree/compatible)" in
+*lantiq,ar9*)
+ soc="ar9"
+ ;;
+*lantiq,ase*)
+ soc="ase"
+ ;;
+*lantiq,danube*)
+ soc="danube"
+ ;;
+*)
+ logger -p daemon.notice -t "dsl-notify" "Unsupported SoC"
+ exit
+esac
+
+modprobe ltq_ptm_${soc}