aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/config/ltq-vdsl-app/patches/200-autoboot.patch
blob: cc6feb94aa9f9abcb652b391c94131e3d80b9034 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
This enables automatic connection after the control daemon is started,
and also stops the connection on termination.

Using the autoboot restart command is necessary because the stop command
doesn't actually stop the connection, and would also leave the driver in
a state where an explicit start command is necessary to connect again.

--- a/src/dsl_cpe_init_cfg.c
+++ b/src/dsl_cpe_init_cfg.c
@@ -27,7 +27,7 @@ DSL_InitData_t gInitCfgData =
    DSL_CPE_FW2_SET(DSL_NULL, 0x0),
    DSL_CPE_XTU_SET(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7),
    DSL_CPE_LINE_INV_NE_SET(DSL_NULL),
-   DSL_CPE_AUTOBOOT_CTRL_SET(DSL_AUTOBOOT_CTRL_STOP),
+   DSL_CPE_AUTOBOOT_CTRL_SET(DSL_AUTOBOOT_CTRL_START),
    DSL_CPE_AUTOBOOT_CFG_SET(DSL_FALSE, DSL_FALSE, DSL_FALSE),
    DSL_CPE_TEST_MODE_CTRL_SET(DSL_TESTMODE_DISABLE),
    DSL_CPE_LINE_ACTIVATE_CTRL_SET(DSL_G997_INHIBIT_LDSF, DSL_G997_INHIBIT_ACSF, DSL_G997_NORMAL_STARTUP),
--- a/src/dsl_cpe_control.c
+++ b/src/dsl_cpe_control.c
@@ -6515,10 +6515,13 @@ DSL_CPE_STATIC  void DSL_CPE_Termination
 DSL_CPE_STATIC  DSL_void_t DSL_CPE_Termination (void)
 {
 #ifdef INCLUDE_DSL_CPE_CLI_SUPPORT
-   DSL_int_t nDevice = 0;
    DSL_char_t buf[32] = "quit";
 #endif
 
+   DSL_Error_t nRet = DSL_SUCCESS;
+   DSL_int_t nDevice = 0;
+   DSL_AutobootConfig_t sAutobootCfg;
+   DSL_AutobootControl_t sAutobootCtl;
    DSL_CPE_Control_Context_t *pCtrlCtx;
 
    pCtrlCtx = DSL_CPE_GetGlobalContext();
@@ -6527,6 +6530,50 @@ DSL_CPE_STATIC  DSL_void_t DSL_CPE_Termi
       pCtrlCtx->bRun = DSL_FALSE;
    }
 
+   for (nDevice = 0; nDevice < DSL_CPE_MAX_DSL_ENTITIES; ++nDevice)
+   {
+      g_bWaitBeforeConfigWrite[nDevice]    = DSL_TRUE;
+      g_bWaitBeforeLinkActivation[nDevice] = DSL_TRUE;
+      g_bWaitBeforeRestart[nDevice]        = DSL_TRUE;
+
+      g_bAutoContinueWaitBeforeConfigWrite[nDevice]    = DSL_FALSE;
+      g_bAutoContinueWaitBeforeLinkActivation[nDevice] = DSL_FALSE;
+      g_bAutoContinueWaitBeforeRestart[nDevice]        = DSL_FALSE;
+
+      memset(&sAutobootCfg, 0x0, sizeof(DSL_AutobootConfig_t));
+      sAutobootCfg.data.nStateMachineOptions.bWaitBeforeConfigWrite    = DSL_TRUE;
+      sAutobootCfg.data.nStateMachineOptions.bWaitBeforeLinkActivation = DSL_TRUE;
+      sAutobootCfg.data.nStateMachineOptions.bWaitBeforeRestart        = DSL_TRUE;
+
+      nRet = (DSL_Error_t)DSL_CPE_Ioctl(
+         DSL_CPE_GetGlobalContext()->fd[nDevice],
+         DSL_FIO_AUTOBOOT_CONFIG_SET, (DSL_int_t)&sAutobootCfg);
+
+      if (nRet < DSL_SUCCESS)
+      {
+         DSL_CCA_DEBUG(DSL_CCA_DBG_ERR, (DSL_CPE_PREFIX
+            "Autoboot configuration for device (%d) failed!, nRet = %d!"
+            DSL_CPE_CRLF, nDevice, sAutobootCtl.accessCtl.nReturn));
+      }
+
+      memset(&sAutobootCtl, 0, sizeof(DSL_AutobootControl_t));
+      sAutobootCtl.data.nCommand = DSL_AUTOBOOT_CTRL_RESTART;
+
+      nRet = (DSL_Error_t)DSL_CPE_Ioctl(
+         DSL_CPE_GetGlobalContext()->fd[nDevice],
+         DSL_FIO_AUTOBOOT_CONTROL_SET, (DSL_int_t)&sAutobootCtl);
+
+      if (nRet < DSL_SUCCESS)
+      {
+         DSL_CCA_DEBUG(DSL_CCA_DBG_ERR, (DSL_CPE_PREFIX
+            "Autoboot restart for device (%d) failed!, nRet = %d!"
+            DSL_CPE_CRLF, nDevice, sAutobootCtl.accessCtl.nReturn));
+      }
+   }
+
+   DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX
+      "Autoboot restart executed" DSL_CPE_CRLF));
+
 #ifdef INCLUDE_DSL_CPE_CLI_SUPPORT
    for (nDevice = 0; nDevice < DSL_CPE_MAX_DSL_ENTITIES; nDevice++)
    {