1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2012 OpenWrt.org
7 extra_command
"dslstat" "Get DSL status information"
8 extra_command
"lucistat" "Get status information in lua friendly format"
10 .
/lib
/functions
/lantiq_dsl.sh
13 # ITU-T G.997.1 (06/2012) - Section 7.3.1.1.1 (xTU transmission system enabling (XTSE))
14 # ITU-T G.997.1 Amendment 2 (04/2013) - Section 2.1 - (Vectoring mode enable (VECTORMODE_ENABLE))
18 # G.992.3 Annex A / L-US1 / L_US-2 / M
22 xtse_xdsl_a
="05_01_04_00_4C_01_04_07"
29 xtse_xdsl_b
="10_00_10_00_00_04_00_07"
38 xtse_xdsl_j
="10_00_10_40_00_04_01_07"
41 xtse_xdsl_bdmt
="10_00_00_00_00_00_00_00"
44 xtse_xdsl_b2
="00_00_10_00_00_00_00_00"
47 xtse_xdsl_b2p
="00_00_00_00_00_04_00_00"
50 xtse_xdsl_at1
="01_00_00_00_00_00_00_00"
53 xtse_xdsl_alite
="00_01_00_00_00_00_00_00"
56 xtse_xdsl_admt
="04_00_00_00_00_00_00_00"
59 xtse_xdsl_a2
="00_00_04_00_00_00_00_00"
62 xtse_xdsl_a2p
="00_00_00_00_00_01_00_00"
65 xtse_xdsl_l
="00_00_00_00_0C_00_00_00"
69 xtse_xdsl_m
="00_00_00_00_40_00_04_00"
72 xtse_xdsl_m2
="00_00_00_00_40_00_00_00"
75 xtse_xdsl_m2p
="00_00_00_00_00_00_04_00"
78 # ITU-T G.994.1 (06/2012) - Table 2 (Mandatory carrier sets)
82 tone_adsl_a
="0x142" # A43C + J43 + A43
83 tone_vdsl_a
="0x142" # A43C + J43 + A43
86 tone_adsl_av
="0x142" # A43C + J43 + A43
87 tone_vdsl_av
="0x146" # A43C + J43 + A43 + V43
90 tone_adsl_b
="0x81" # B43 + B43c
91 tone_vdsl_b
="0x1" # B43
94 tone_adsl_bv
="0x81" # B43 + B43c
95 tone_vdsl_bv
="0x5" # B43 + V43
97 # create ADSL autoboot script. Used for SNR margin tweak
99 echo "[WaitForConfiguration]={
103 [WaitForLinkActivate]={
114 echo "# VRX Low Level Configuration File
116 # Parameters must be separated by tabs or spaces.
117 # Empty lines and comments will be ignored.
132 # nHsToneGroupMode nHsToneGroup_A nHsToneGroup_V nHsToneGroup_AV
134 # NA = -1 NA = -1 see see
135 # AUTO = 0 VDSL2_B43 = 0x0001 nHsToneGroup_A nHsToneGroup_A
136 # MANUAL = 1 VDSL2_A43 = 0x0002
138 # VDSL1_V43P = 0x0008
139 # VDSL1_V43I = 0x0010
142 # ADSL2_B43C = 0x0080
143 # ADSL2_A43C = 0x0100
145 # (dec) (hex) (hex) (hex)
153 # nUtopiaPhyAdr nUtopiaBusWidth nPosPhyParity
154 # default(16b) = 0 NA = -1
165 0" > /tmp
/lowlevel.cfg
169 procd_add_reload_trigger network
187 config_get tone dsl tone
188 config_get annex dsl annex
189 config_get firmware dsl firmware
190 config_get xfer_mode dsl xfer_mode
191 config_get line_mode dsl line_mode
192 config_get snr dsl ds_snr_offset
194 eval "xtse=\"\${xtse_xdsl_$annex}\""
196 case "${xfer_mode}" in
198 tc_layer
="-T1:0x1:0x1_1:0x1:0x1"
201 tc_layer
="-T2:0x1:0x1_2:0x1:0x1"
205 case "${line_mode}" in
209 # mask out VDSL bits when ADSL is requested
215 # mask out ADSL bits when VDSL is requested
216 xtse
="00_00_00_00_00_00_00_${xtse##*_}"
220 local annexgpio
="/sys/class/gpio/annex"
221 if [ -d "${annexgpio}a" ] && [ -d "${annexgpio}b" ]; then
224 echo 1 > "${annexgpio}a/value"
225 echo 0 > "${annexgpio}b/value"
228 echo 0 > "${annexgpio}a/value"
229 echo 1 > "${annexgpio}b/value"
234 if [ -z "${firmware}" ]; then
235 # search for the firmware provided by dsl-vrx200-firmware-xdsl-*
236 if grep -qE "system type.*: (VR9|xRX200)" /proc
/cpuinfo
; then
239 if [ -f "/lib/firmware/lantiq-vrx200-a.bin" ]; then
240 firmware
="/lib/firmware/lantiq-vrx200-a.bin"
241 elif [ -f "/tmp/lantiq-vrx200-a.bin" ]; then
242 firmware
="/tmp/lantiq-vrx200-a.bin"
243 elif [ -f "/lib/firmware/lantiq-vrx200-b.bin" ] && [ -f "/lib/firmware/lantiq-vrx200-b-to-a.bspatch" ]; then
244 bspatch
/lib
/firmware
/lantiq-vrx200-b.bin \
245 /tmp
/lantiq-vrx200-a.bin \
246 /lib
/firmware
/lantiq-vrx200-b-to-a.bspatch
247 firmware
="/tmp/lantiq-vrx200-a.bin"
249 echo "firmware for annex a not found"
254 if [ -f "/lib/firmware/vr9_dsl_fw_annex_b.bin" ]; then
255 firmware
="/lib/firmware/vr9_dsl_fw_annex_b.bin"
256 elif [ -f "/lib/firmware/lantiq-vrx200-b.bin" ]; then
257 firmware
="/lib/firmware/lantiq-vrx200-b.bin"
258 elif [ -f "/tmp/lantiq-vrx200-b.bin" ]; then
259 firmware
="/tmp/lantiq-vrx200-b.bin"
260 elif [ -f "/lib/firmware/lantiq-vrx200-a.bin" ] && [ -f "/lib/firmware/lantiq-vrx200-a-to-b.bspatch" ]; then
261 bspatch
/lib
/firmware
/lantiq-vrx200-a.bin \
262 /tmp
/lantiq-vrx200-b.bin \
263 /lib
/firmware
/lantiq-vrx200-a-to-b.bspatch
264 firmware
="/tmp/lantiq-vrx200-b.bin"
266 echo "firmware for annex b not found"
271 echo "annex type not supported use a or b"
278 [ -z "${firmware}" ] && firmware
=/lib
/firmware
/vdsl.bin
279 [ -f "${firmware}" ] ||
{
280 echo failed to
find $firmware
284 eval "tone_adsl=\"\${tone_adsl_$tone}\""
285 eval "tone_vdsl=\"\${tone_vdsl_$tone}\""
286 [ -n "${tone_adsl}" ] && [ -n "${tone_vdsl}" ] && {
287 lowlevel_cfg
"${tone_adsl}" "${tone_vdsl}"
288 lowlevel
="-l /tmp/lowlevel.cfg"
292 # for SNR offset setting
293 autoboot_script
"$snr"
294 autoboot
="-a /tmp/dsl.scr -A /tmp/dsl.scr"
298 procd_set_param
command /sbin
/vdsl_cpe_control \
300 -n /sbin
/dsl_notify.sh \
310 DSL_NOTIFICATION_TYPE
="DSL_INTERFACE_STATUS" \
311 DSL_INTERFACE_STATUS
="DOWN" \