lantiq: Tune the XWAY subtarget cflags
[openwrt.git] / package / system / ar7-atm / patches-D7.05.01.00 / 160-module-params.patch
1 --- a/tn7atm.c
2 +++ b/tn7atm.c
3 @@ -95,6 +95,146 @@
4  MODULE_LICENSE("GPL");
5  MODULE_DESCRIPTION ("Tnetd73xx ATM Device Driver");
6  MODULE_AUTHOR ("Zhicheng Tang");
7 +
8 +int mp_sar_ipacemax = -1;
9 +module_param_named(ipacemax, mp_sar_ipacemax, int, 0);
10 +MODULE_PARM_DESC(ipacemax, "Interrupt pacing");
11 +
12 +char *mp_macc = NULL;
13 +module_param_named(macc, mp_macc, charp, 0);
14 +MODULE_PARM_DESC(macc, "MAC address");
15 +
16 +int mp_dsp_noboost = -1;
17 +module_param_named(dsp_noboost, mp_dsp_noboost, int, 0);
18 +MODULE_PARM_DESC(dsp_noboost, "Suppress DSP frequency boost");
19 +
20 +int mp_dsp_freq = -1;
21 +module_param_named(dsp_freq, mp_dsp_freq, int, 0);
22 +MODULE_PARM_DESC(dsp_freq, "Frequency to boost the DSP to");
23 +
24 +char *mp_featctl0 = NULL;
25 +module_param_named(featctl0, mp_featctl0, charp, 0);
26 +MODULE_PARM_DESC(featctl0, "DSL feature control 0");
27 +
28 +char *mp_featctl1 = NULL;
29 +module_param_named(featctl1, mp_featctl1, charp, 0);
30 +MODULE_PARM_DESC(featctl1, "DSL feature control 1");
31 +
32 +char *mp_phyctl0 = NULL;
33 +module_param_named(phyctl0, mp_phyctl0, charp, 0);
34 +MODULE_PARM_DESC(phyctl0, "DSL PHY control 0");
35 +
36 +char *mp_phyctl1 = NULL;
37 +module_param_named(phyctl1, mp_phyctl1, charp, 0);
38 +MODULE_PARM_DESC(phyctl1, "DSL PHY control 1");
39 +
40 +int mp_turbodsl = -1;
41 +module_param_named(turbodsl, mp_turbodsl, int, 0);
42 +MODULE_PARM_DESC(turbodsl, "Enable TurboDSL");
43 +
44 +int mp_sar_rxbuf = -1;
45 +module_param_named(sar_rxbuf, mp_sar_rxbuf, int, 0);
46 +MODULE_PARM_DESC(sar_rxbuf, "SAR RxBuf size");
47 +
48 +int mp_sar_rxmax = -1;
49 +module_param_named(sar_rxmax, mp_sar_rxmax, int, 0);
50 +MODULE_PARM_DESC(sar_rxmax, "SAR RxMax size");
51 +
52 +int mp_sar_txbuf = -1;
53 +module_param_named(sar_txbuf, mp_sar_txbuf, int, 0);
54 +MODULE_PARM_DESC(sar_txbuf, "SAR TxBuf size");
55 +
56 +int mp_sar_txmax = -1;
57 +module_param_named(sar_txmax, mp_sar_txmax, int, 0);
58 +MODULE_PARM_DESC(sar_txmax, "SAR TxMax size");
59 +
60 +char *mp_modulation = NULL;
61 +module_param_named(modulation, mp_modulation, charp, 0);
62 +MODULE_PARM_DESC(modulation, "Modulation");
63 +
64 +int mp_fine_gain_control = -1;
65 +module_param_named(fine_gain_control, mp_fine_gain_control, int, 0);
66 +MODULE_PARM_DESC(fine_gain_control, "Fine gain control");
67 +
68 +int mp_fine_gain_value = -1;
69 +module_param_named(fine_gain_value, mp_fine_gain_value, int, 0);
70 +MODULE_PARM_DESC(fine_gain_value, "Fine gain value");
71 +
72 +int mp_enable_margin_retrain = -1;
73 +module_param_named(enable_margin_retrain, mp_enable_margin_retrain, int, 0);
74 +MODULE_PARM_DESC(enable_margin_retrain, "Enable margin retrain");
75 +
76 +int mp_margin_threshold = -1;
77 +module_param_named(margin_threshold, mp_margin_threshold, int, 0);
78 +MODULE_PARM_DESC(margin_threshold, "Margin retrain treshold");
79 +
80 +int mp_enable_rate_adapt = -1;
81 +module_param_named(enable_rate_adapt, mp_enable_rate_adapt, int, 0);
82 +MODULE_PARM_DESC(enable_rate_adapt, "Enable rate adaption");
83 +
84 +int mp_powercutback = -1;
85 +module_param_named(powercutback, mp_powercutback, int, 0);
86 +MODULE_PARM_DESC(powercutback, "Enable / disable powercutback");
87 +
88 +int mp_trellis = -1;
89 +module_param_named(trellis, mp_trellis, int, 0);
90 +MODULE_PARM_DESC(trellis, "Enable / disable trellis coding");
91 +
92 +int mp_bitswap = -1;
93 +module_param_named(bitswap, mp_bitswap, int, 0);
94 +MODULE_PARM_DESC(bitswap, "Enable / disable bitswap");
95 +
96 +int mp_maximum_bits_per_carrier = -1;
97 +module_param_named(maximum_bits_per_carrier, mp_maximum_bits_per_carrier, int, 0);
98 +MODULE_PARM_DESC(maximum_bits_per_carrier, "Maximum bits per carrier");
99 +
100 +int mp_maximum_interleave_depth = -1;
101 +module_param_named(maximum_interleave_depth, mp_maximum_interleave_depth, int, 0);
102 +MODULE_PARM_DESC(maximum_interleave_depth, "Maximum interleave depth");
103 +
104 +int mp_pair_selection = -1;
105 +module_param_named(pair_selection, mp_pair_selection, int, 0);
106 +MODULE_PARM_DESC(pair_selection, "Pair selection");
107 +
108 +int mp_dgas_polarity = -1;
109 +module_param_named(dgas_polarity, mp_dgas_polarity, int, 0);
110 +MODULE_PARM_DESC(dgas_polarity, "DGAS polarity");
111 +
112 +int mp_los_alarm = -1;
113 +module_param_named(los_alarm, mp_los_alarm, int, 0);
114 +MODULE_PARM_DESC(los_alarm, "LOS alarm");
115 +
116 +char *mp_eoc_vendor_id = NULL;
117 +module_param_named(eoc_vendor_id, mp_eoc_vendor_id, charp, 0);
118 +MODULE_PARM_DESC(eoc_vendor_id, "EOC vendor id");
119 +
120 +int mp_eoc_vendor_revision = -1;
121 +module_param_named(eoc_vendor_revision, mp_eoc_vendor_revision, int, 0);
122 +MODULE_PARM_DESC(eoc_vendor_revision, "EOC vendor revision");
123 +
124 +char *mp_eoc_vendor_serialnum = NULL;
125 +module_param_named(eoc_vendor_serialnum, mp_eoc_vendor_serialnum, charp, 0);
126 +MODULE_PARM_DESC(eoc_vendor_serialnum, "EOC vendor serial number");
127 +
128 +char *mp_invntry_vernum = NULL;
129 +module_param_named(invntry_vernum, mp_invntry_vernum, charp, 0);
130 +MODULE_PARM_DESC(invntry_vernum, "Inventory revision number");
131 +
132 +int mp_dsl_bit_tmode = -1;
133 +module_param_named(dsl_bit_tmode, mp_dsl_bit_tmode, int, 0);
134 +MODULE_PARM_DESC(dsl_bit_tmode, "DSL bit training mode");
135 +
136 +int mp_high_precision = -1;
137 +module_param_named(high_precision, mp_high_precision, int, 0);
138 +MODULE_PARM_DESC(high_precision, "High precision");
139 +
140 +int mp_autopvc_enable = -1;
141 +module_param_named(autopvc_enable, mp_autopvc_enable, int, 0);
142 +MODULE_PARM_DESC(autopvc_enable, "Enable / disable automatic PVC");
143 +
144 +int mp_oam_lb_timeout = -1;
145 +module_param_named(oam_lb_timeout, mp_oam_lb_timeout, int, 0);
146 +MODULE_PARM_DESC(oam_lb_timeout, "OAM LB timeout");
147  #endif
148  
149  #ifndef TRUE
150 @@ -728,9 +868,9 @@
151     * interrupt pacing
152     */
153    ptr = prom_getenv ("sar_ipacemax");
154 -  if (ptr)
155 +  if (ptr || mp_sar_ipacemax != -1)
156    {
157 -    def_sar_inter_pace = os_atoi (ptr);
158 +    def_sar_inter_pace = mp_sar_ipacemax == -1 ? os_atoi (ptr) : mp_sar_ipacemax;
159    }
160    /* avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
161                              def_sar_inter_pace); */
162 @@ -878,9 +1018,18 @@
163  {
164    int i;
165    char esi_addr[ESI_LEN] = { 0x00, 0x00, 0x11, 0x22, 0x33, 0x44 };
166 -  char *esiaddr_str = NULL;
167 +  char *esiaddr_str = mp_macc;
168  
169 -  esiaddr_str = prom_getenv ("macc");
170 +  if (esiaddr_str == NULL)
171 +    esiaddr_str = prom_getenv ("macdsl");
172 +  if (esiaddr_str == NULL)
173 +    esiaddr_str = prom_getenv ("macc");
174 +  if (esiaddr_str == NULL)
175 +    esiaddr_str = prom_getenv ("HWA_1");
176 +  if (esiaddr_str == NULL)
177 +    esiaddr_str = prom_getenv ("macb");
178 +  if (esiaddr_str == NULL)
179 +    esiaddr_str = prom_getenv ("maca");
180  
181    if (!esiaddr_str)
182    {
183 @@ -2139,15 +2288,15 @@
184  //UR8_MERGE_END   CQ10450*
185  
186    cp = prom_getenv ("dsp_noboost");
187 -  if (cp)
188 +  if (cp || mp_dsp_noboost != -1)
189    {
190 -    dsp_noboost = os_atoi (cp);
191 +    dsp_noboost = mp_dsp_noboost == -1 ? os_atoi (cp) : mp_dsp_noboost;
192    }
193  
194    cp = (char *) prom_getenv ("dsp_freq");
195 -  if (cp)
196 +  if (cp || mp_dsp_freq != -1)
197    {
198 -    dspfreq = os_atoi (cp);
199 +    dspfreq = mp_dsp_freq == -1 ? os_atoi (cp) : mp_dsp_freq;
200      if (dspfreq == 250)
201      {
202        boostDsp = 1;
203 @@ -2396,15 +2545,17 @@
204    // Inter-Op DSL phy Control
205    // Note the setting of _dsl_Feature_0 and _dsl_Feature_1 must before
206    // dslhal_api_dslStartup (in tn7dsl_init()).
207 -  if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_0")) != NULL)
208 +  if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_0")) != NULL || mp_featctl0 != NULL)
209    {
210 -    _dsl_Feature_0 = os_atoih (ptr);
211 +    if (mp_featctl0 != NULL) ptr = mp_featctl0;
212 +    _dsl_Feature_0 = os_atoh (ptr);
213      _dsl_Feature_0_defined = 1;
214    }
215  
216 -  if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_1")) != NULL)
217 +  if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_1")) != NULL || mp_featctl1 != NULL)
218    {
219 -    _dsl_Feature_1 = os_atoih (ptr);
220 +    if (mp_featctl1 != NULL) ptr = mp_featctl1;
221 +    _dsl_Feature_1 = os_atoh (ptr);
222      _dsl_Feature_1_defined = 1;
223    }
224  
225 @@ -2412,15 +2563,17 @@
226    // DSL phy Feature Control
227    // Note the setting of _dsl_PhyControl_0 and _dsl_PhyControl_1 must before
228    // dslhal_api_dslStartup (in tn7dsl_init()).
229 -  if ((ptr = prom_getenv ("DSL_PHY_CNTL_0")) != NULL)
230 +  if ((ptr = prom_getenv ("DSL_PHY_CNTL_0")) != NULL || mp_phyctl0 != NULL)
231    {
232 -    _dsl_PhyControl_0 = os_atoih (ptr);
233 +    if (mp_phyctl0 != NULL) ptr = mp_phyctl0;
234 +    _dsl_PhyControl_0 = os_atoh (ptr);
235      _dsl_PhyControl_0_defined = 1;
236    }
237  
238 -  if ((ptr = prom_getenv ("DSL_PHY_CNTL_1")) != NULL)
239 +  if ((ptr = prom_getenv ("DSL_PHY_CNTL_1")) != NULL || mp_phyctl1 != NULL)
240    {
241 -    _dsl_PhyControl_1 = os_atoih (ptr);
242 +    if (mp_phyctl1 != NULL) ptr = mp_phyctl1;
243 +    _dsl_PhyControl_1 = os_atoh (ptr);
244      _dsl_PhyControl_1_defined = 1;
245    }
246  
247 @@ -2440,12 +2593,12 @@
248    // read config for turbo dsl
249     
250    ptr = prom_getenv ("TurboDSL");
251 -  if (ptr)
252 +  if (ptr || mp_turbodsl != -1)
253    {
254      #if 1 //[KT]
255      bTurboDsl = os_atoi (ptr);
256      #else
257 -    priv->bTurboDsl = os_atoi (ptr);
258 +    priv->bTurboDsl = mp_turbodsl == -1 ? os_atoi (ptr) : mp_turbodsl;
259      #endif
260    }
261     else
262 @@ -2459,33 +2612,33 @@
263    priv->sarRxBuf = RX_BUFFER_NUM;
264    ptr = NULL;
265    ptr = prom_getenv ("SarRxBuf");
266 -  if (ptr)
267 +  if (ptr || mp_sar_rxbuf != -1)
268    {
269 -    priv->sarRxBuf = os_atoi (ptr);
270 +    priv->sarRxBuf = mp_sar_rxbuf == -1 ? os_atoi (ptr) : mp_sar_rxbuf;
271    }
272  
273    priv->sarRxMax = RX_SERVICE_MAX;
274    ptr = NULL;
275    ptr = prom_getenv ("SarRxMax");
276 -  if (ptr)
277 +  if (ptr || mp_sar_rxmax != -1)
278    {
279 -    priv->sarRxMax = os_atoi (ptr);
280 +    priv->sarRxMax = mp_sar_rxmax == -1 ? os_atoi (ptr) : mp_sar_rxmax;
281    }
282  
283    priv->sarTxBuf = TX_BUFFER_NUM;
284    ptr = NULL;
285    ptr = prom_getenv ("SarTxBuf");
286 -  if (ptr)
287 +  if (ptr || mp_sar_txbuf != -1)
288    {
289 -    priv->sarTxBuf = os_atoi (ptr);
290 +    priv->sarTxBuf = mp_sar_txbuf == -1 ? os_atoi (ptr) : mp_sar_txbuf;
291    }
292  
293    priv->sarTxMax = TX_SERVICE_MAX;
294    ptr = NULL;
295    ptr = prom_getenv ("SarTxMax");
296 -  if (ptr)
297 +  if (ptr || mp_sar_txmax != -1)
298    {
299 -    priv->sarTxMax = os_atoi (ptr);
300 +    priv->sarTxMax = mp_sar_txmax == -1 ? os_atoi (ptr) : mp_sar_txmax;
301    }
302  
303  #ifdef AR7_EFM
304 --- a/tn7dsl.c
305 +++ b/tn7dsl.c
306 @@ -148,6 +148,27 @@
307  #define NEW_TRAINING_VAL_T1413  128
308  #define NEW_TRAINING_VAL_MMODE  255
309  
310 +extern char *mp_modulation;
311 +extern int mp_fine_gain_control;
312 +extern int mp_fine_gain_value;
313 +extern int mp_enable_margin_retrain;
314 +extern int mp_margin_threshold;
315 +extern int mp_enable_rate_adapt;
316 +extern int mp_powercutback;
317 +extern int mp_trellis;
318 +extern int mp_bitswap;
319 +extern int mp_maximum_bits_per_carrier;
320 +extern int mp_maximum_interleave_depth;
321 +extern int mp_pair_selection;
322 +extern int mp_dgas_polarity;
323 +extern int mp_los_alarm;
324 +extern char *mp_eoc_vendor_id;
325 +extern int mp_eoc_vendor_revision;
326 +extern char *mp_eoc_vendor_serialnum;
327 +extern char *mp_invntry_vernum;
328 +extern int mp_dsl_bit_tmode;
329 +extern int mp_high_precision;
330 +
331  int testflag1 = 0;
332  extern int  __guDbgLevel;
333  extern sar_stat_t sarStat;
334 @@ -2933,24 +2954,24 @@ static int tn7dsl_set_dsl(void)
335                                  (unsigned char *) &oamFeature, 4);
336         
337    ptr = prom_getenv("DSL_FEATURE_CNTL_0"); 
338 -  if(!ptr)
339 -    prom_setenv("DSL_FEATURE_CNTL_0", "0x00004000");
340 +  //if(!ptr)
341 +    //prom_setenv("DSL_FEATURE_CNTL_0", "0x00004000");
342  
343    ptr = prom_getenv("DSL_FEATURE_CNTL_1"); 
344 -  if(!ptr)   
345 -       prom_setenv("DSL_FEATURE_CNTL_1", "0x00000000");
346 +  //if(!ptr)   
347 +       //prom_setenv("DSL_FEATURE_CNTL_1", "0x00000000");
348  
349    ptr = prom_getenv("DSL_PHY_CNTL_0"); 
350 -  if(!ptr)   
351 -       prom_setenv("DSL_PHY_CNTL_0", "0x00000400");
352 +  //if(!ptr)   
353 +       //prom_setenv("DSL_PHY_CNTL_0", "0x00000400");
354         
355    ptr = prom_getenv("enable_margin_retrain"); 
356 -  if(!ptr)   
357 -       prom_setenv("enable_margin_retrain", "0");
358 +  //if(!ptr)   
359 +       //prom_setenv("enable_margin_retrain", "0");
360         
361    ptr = prom_getenv("modulation");
362 -  if(!ptr)
363 -    prom_setenv("modulation", "0xbf");
364 +  //if(!ptr)
365 +    //prom_setenv("modulation", "0xbf");
366    
367  #define EOC_VENDOR_ID "4200534153000000"
368  #define EOC_VENDOR_REVISION "FW370090708b1_55"
369 @@ -2959,25 +2980,25 @@ static int tn7dsl_set_dsl(void)
370    ptr = prom_getenv("eoc_vendor_id");
371    if(!ptr || strcmp(ptr,EOC_VENDOR_ID) != 0 || strlen(ptr) != strlen(EOC_VENDOR_ID))
372    {
373 -      if(ptr)          
374 -         prom_unsetenv("eoc_vendor_id");
375 -      prom_setenv("eoc_vendor_id",EOC_VENDOR_ID);
376 +      //if(ptr)        
377 +         //prom_unsetenv("eoc_vendor_id");
378 +      //prom_setenv("eoc_vendor_id",EOC_VENDOR_ID);
379    }
380        
381    ptr = prom_getenv("eoc_vendor_revision");
382    if(!ptr || strcmp(ptr,EOC_VENDOR_REVISION) != 0 || strlen(ptr) != strlen(EOC_VENDOR_REVISION))
383    {  
384 -      if(ptr)          
385 -         prom_unsetenv("eoc_vendor_revision");
386 -      prom_setenv("eoc_vendor_revision",EOC_VENDOR_REVISION);
387 +      //if(ptr)        
388 +         //prom_unsetenv("eoc_vendor_revision");
389 +      //prom_setenv("eoc_vendor_revision",EOC_VENDOR_REVISION);
390    }
391        
392    ptr = prom_getenv("eoc_vendor_serialnum");
393    if(!ptr || strcmp(ptr,EOC_VENDOR_SERIALNUM) != 0 || strlen(ptr) != strlen(EOC_VENDOR_SERIALNUM))
394    {
395 -      if(ptr)          
396 -         prom_unsetenv("eoc_vendor_serialnum");
397 -      prom_setenv("eoc_vendor_serialnum",EOC_VENDOR_SERIALNUM);
398 +      //if(ptr)        
399 +        // prom_unsetenv("eoc_vendor_serialnum");
400 +      //prom_setenv("eoc_vendor_serialnum",EOC_VENDOR_SERIALNUM);
401    }
402  
403    /* Do only if we are in the new Base PSP 7.4.*/
404 @@ -2994,92 +3015,88 @@ static int tn7dsl_set_dsl(void)
405               we clear the modulation environment variable, as this could potentially
406               not have the same meaning in the new mode.
407            */
408 -         prom_unsetenv("modulation");
409 -         prom_setenv("DSL_UPG_DONE", "1");
410 +         //prom_unsetenv("modulation");
411 +         //prom_setenv("DSL_UPG_DONE", "1");
412        }
413    }
414    #endif
415  
416    // modulation
417    ptr = prom_getenv("modulation");
418 -  if (ptr)
419 +  if (ptr || mp_modulation != NULL)
420    {
421 -    tn7dsl_set_modulation(ptr, FALSE);
422 +    tn7dsl_set_modulation(mp_modulation == NULL ? ptr : mp_modulation, FALSE);
423    }
424  
425    // Fine Gains
426    ptr = prom_getenv("fine_gain_control");
427 -  if (ptr)
428 +  if (ptr || mp_fine_gain_control != -1)
429    {
430 -    value = os_atoi(ptr);
431 +    value = mp_fine_gain_control == -1 ? os_atoi(ptr) : mp_fine_gain_control;
432      tn7dsl_ctrl_fineGain(value);
433    }
434    ptr = NULL;
435    ptr = prom_getenv("fine_gain_value");
436 -  if(ptr)
437 -    tn7dsl_set_fineGainValue(os_atoh(ptr));
438 +  if(ptr || mp_fine_gain_value != -1)
439 +    tn7dsl_set_fineGainValue(mp_fine_gain_value == -1 ? os_atoh(ptr) : mp_fine_gain_value);
440  
441    // margin retrain
442    ptr = NULL;
443    ptr = prom_getenv("enable_margin_retrain");
444 -  if(ptr)
445 +  value = mp_enable_margin_retrain == -1 ? (ptr ? os_atoi(ptr) : 0) : mp_enable_margin_retrain;
446 +
447 +  if (value == 1)
448    {
449 -    value = os_atoi(ptr);
450 -    if(value == 1)
451 +    dslhal_api_setMarginMonitorFlags(pIhw, 0, 1);
452 +    bMarginRetrainEnable = 1;
453 +    //printk("enable showtime margin monitor.\n");
454 +
455 +    ptr = NULL;
456 +    ptr = prom_getenv("margin_threshold");
457 +    value = mp_margin_threshold == -1 ? (ptr ? os_atoi(ptr) : 0) : mp_margin_threshold;
458 +
459 +    if(value >= 0)
460      {
461 -      dslhal_api_setMarginMonitorFlags(pIhw, 0, 1);
462 -      bMarginRetrainEnable = 1;
463 -      //printk("enable showtime margin monitor.\n");
464 -      ptr = NULL;
465 -      ptr = prom_getenv("margin_threshold");
466 -      if(ptr)
467 -      {
468 -        value = os_atoi(ptr);
469 -        //printk("Set margin threshold to %d x 0.5 db\n",value);
470 -        if(value >= 0)
471 -        {
472 -          dslhal_api_setMarginThreshold(pIhw, value);
473 -          bMarginThConfig=1;
474 -        }
475 -      }
476 +      dslhal_api_setMarginThreshold(pIhw, value);
477 +      bMarginThConfig=1;
478      }
479    }
480  
481    // rate adapt
482    ptr = NULL;
483    ptr = prom_getenv("enable_rate_adapt");
484 -  if(ptr)
485 +  if(ptr || mp_enable_rate_adapt != -1)
486    {
487 -    dslhal_api_setRateAdaptFlag(pIhw, os_atoi(ptr));
488 +    dslhal_api_setRateAdaptFlag(pIhw, mp_enable_rate_adapt == -1 ? os_atoi(ptr) : mp_enable_rate_adapt);
489    }
490  
491    // set powercutback
492    ptr = NULL;
493    ptr = prom_getenv("powercutback");
494 -  if(ptr)
495 +  if(ptr || mp_powercutback != -1)
496    {
497 -    dslhal_advcfg_onOffPcb(pIhw, os_atoi(ptr));
498 +    dslhal_advcfg_onOffPcb(pIhw, mp_powercutback == -1 ? os_atoi(ptr) : mp_powercutback);
499    }
500  
501    // trellis
502    ptr = NULL;
503    ptr = prom_getenv("trellis");
504 -  if(ptr)
505 +  if(ptr || mp_trellis != -1)
506    {
507 -    dslhal_api_setTrellisFlag(pIhw, os_atoi(ptr));
508 -    trellis = os_atoi(ptr);
509 +    trellis = mp_trellis == -1 ? os_atoi(ptr) : mp_trellis;
510 +    dslhal_api_setTrellisFlag(pIhw, trellis);
511      //printk("trellis=%d\n");
512    }
513  
514    // bitswap
515    ptr = NULL;
516    ptr = prom_getenv("bitswap");
517 -  if(ptr)
518 +  if(ptr || mp_bitswap != -1)
519    {
520      int offset[2] = {33, 0};
521      unsigned int bitswap;
522  
523 -    bitswap = os_atoi(ptr);
524 +    bitswap = mp_bitswap == -1 ? os_atoi(ptr) : mp_bitswap;
525  
526      tn7dsl_generic_read(2, offset);
527      dslReg &= dslhal_support_byteSwap32(0xFFFFFF00);
528 @@ -3097,46 +3114,47 @@ static int tn7dsl_set_dsl(void)
529    // maximum bits per carrier
530    ptr = NULL;
531    ptr = prom_getenv("maximum_bits_per_carrier");
532 -  if(ptr)
533 +  if(ptr || mp_maximum_bits_per_carrier != -1)
534    {
535 -    dslhal_api_setMaxBitsPerCarrierUpstream(pIhw, os_atoi(ptr));
536 +    dslhal_api_setMaxBitsPerCarrierUpstream(pIhw, mp_maximum_bits_per_carrier == -1 ? os_atoi(ptr) : mp_maximum_bits_per_carrier);
537    }
538  
539    // maximum interleave depth
540    ptr = NULL;
541    ptr = prom_getenv("maximum_interleave_depth");
542 -  if(ptr)
543 +  if(ptr || mp_maximum_interleave_depth != -1)
544    {
545 -    dslhal_api_setMaxInterleaverDepth(pIhw, os_atoi(ptr));
546 +    dslhal_api_setMaxInterleaverDepth(pIhw, mp_maximum_interleave_depth == -1 ? os_atoi(ptr) : mp_maximum_interleave_depth);
547    }
548  
549    // inner and outer pairs
550    ptr = NULL;
551    ptr = prom_getenv("pair_selection");
552 -  if(ptr)
553 +  if(ptr || mp_pair_selection != -1)
554    {
555 -    dslhal_api_selectInnerOuterPair(pIhw, os_atoi(ptr));
556 +    dslhal_api_selectInnerOuterPair(pIhw, mp_pair_selection == -1 ? os_atoi(ptr) : mp_pair_selection);
557    }
558  
559    ptr = NULL;
560    ptr = prom_getenv("dgas_polarity");
561 -  if(ptr)
562 +  if(ptr || mp_dgas_polarity != -1)
563    {
564      dslhal_api_configureDgaspLpr(pIhw, 1, 1);
565 -    dslhal_api_configureDgaspLpr(pIhw, 0, os_atoi(ptr));
566 +    dslhal_api_configureDgaspLpr(pIhw, 0, mp_dgas_polarity == -1 ? os_atoi(ptr) : mp_dgas_polarity);
567    }
568  
569    ptr = NULL;
570    ptr = prom_getenv("los_alarm");
571 -  if(ptr)
572 +  if(ptr || mp_los_alarm != -1)
573    {
574 -    dslhal_api_disableLosAlarm(pIhw, os_atoi(ptr));
575 +    dslhal_api_disableLosAlarm(pIhw, mp_los_alarm == -1 ? os_atoi(ptr) : mp_los_alarm);
576    }
577  
578    ptr = NULL;
579    ptr = prom_getenv("eoc_vendor_id");
580 -  if(ptr)
581 +  if(ptr || mp_eoc_vendor_id != NULL)
582    {
583 +    ptr = mp_eoc_vendor_id == NULL ? ptr : mp_eoc_vendor_id;
584      for(i=0;i<8;i++)
585      {
586        tmp[0]=ptr[i*2];
587 @@ -3161,26 +3179,26 @@ static int tn7dsl_set_dsl(void)
588    }
589    ptr = NULL;
590    ptr = prom_getenv("eoc_vendor_revision");
591 -  if(ptr)
592 +  if(ptr || mp_eoc_vendor_revision != -1)
593    {
594 -    value = os_atoi(ptr);
595 +    value = mp_eoc_vendor_revision == -1 ? os_atoi(ptr) : mp_eoc_vendor_revision;
596      //printk("eoc rev=%d\n", os_atoi(ptr));
597      dslhal_api_setEocRevisionNumber(pIhw, (char *)&value);
598  
599    }
600    ptr = NULL;
601    ptr = prom_getenv("eoc_vendor_serialnum");
602 -  if(ptr)
603 +  if(ptr || mp_eoc_vendor_serialnum != NULL)
604    {
605 -    dslhal_api_setEocSerialNumber(pIhw, ptr);
606 +    dslhal_api_setEocSerialNumber(pIhw, mp_eoc_vendor_serialnum == NULL ? ptr : mp_eoc_vendor_serialnum);
607    }
608  
609    // CQ10037 Added invntry_vernum environment variable to be able to set version number in ADSL2, ADSL2+ modes.
610    ptr = NULL;
611    ptr = prom_getenv("invntry_vernum");
612 -  if(ptr)
613 +  if(ptr || mp_invntry_vernum != NULL)
614    {
615 -    dslhal_api_setEocRevisionNumber(pIhw, ptr);
616 +    dslhal_api_setEocRevisionNumber(pIhw, mp_invntry_vernum == NULL ? ptr : mp_invntry_vernum);
617    }
618  
619    return 0;
620 @@ -3225,7 +3243,7 @@ int tn7dsl_init(void *priv)
621     * backward compatibility.
622     */
623    cp = prom_getenv("DSL_BIT_TMODE");
624 -  if (cp)
625 +  if (cp || mp_dsl_bit_tmode != -1)
626    {
627      printk("%s : env var DSL_BIT_TMODE is set\n", __FUNCTION__);
628      /*
629 @@ -3254,9 +3272,9 @@ int tn7dsl_init(void *priv)
630  
631  //  UR8_MERGE_START CQ11054   Jack Zhang
632    cp = prom_getenv("high_precision");
633 -  if (cp)
634 +  if (cp || mp_high_precision != -1)
635    {
636 -    high_precision_selected = os_atoi(cp);
637 +    high_precision_selected = mp_high_precision == -1 ? os_atoi(cp) : mp_high_precision;
638    }
639    if ( high_precision_selected)
640    {
641 --- a/tn7sar.c
642 +++ b/tn7sar.c
643 @@ -76,6 +76,8 @@ typedef void OS_SETUP;
644  #include "tn7atm.h"
645  #include "tn7api.h"
646  
647 +extern int mp_oam_lb_timeout;
648 +extern int mp_autopvc_enable;
649  
650  /* PDSP Firmware files */
651  #include "tnetd7300_sar_firm.h"
652 @@ -932,9 +934,9 @@ int tn7sar_setup_oam_channel(Tn7AtmPriva
653    pHalDev  = (HAL_DEVICE *)priv->pSarHalDev;
654  
655    pauto_pvc = prom_getenv("autopvc_enable");
656 -  if(pauto_pvc)  //CQ10273
657 +  if(pauto_pvc || mp_autopvc_enable != -1)  //CQ10273
658    {
659 -    auto_pvc =tn7sar_strtoul(pauto_pvc, NULL, 10);
660 +    auto_pvc = mp_autopvc_enable == -1 ? tn7sar_strtoul(pauto_pvc, NULL, 10) : mp_autopvc_enable;
661    }
662  
663    memset(&chInfo, 0xff, sizeof(chInfo));
664 @@ -1133,9 +1135,9 @@ int tn7sar_init(struct atm_dev *dev, Tn7
665  
666    /* read in oam lb timeout value */
667    pLbTimeout = prom_getenv("oam_lb_timeout");
668 -  if(pLbTimeout)
669 +  if(pLbTimeout || mp_oam_lb_timeout != -1)
670    {
671 -    lbTimeout =tn7sar_strtoul(pLbTimeout, NULL, 10);
672 +    lbTimeout = mp_oam_lb_timeout == -1 ? tn7sar_strtoul(pLbTimeout, NULL, 10) : mp_oam_lb_timeout;
673      oamLbTimeout = lbTimeout;
674      pHalFunc->Control(pHalDev,"OamLbTimeout", "Set", &lbTimeout);
675    }