1 diff -urN sangam_atm-07.02.01.00/tn7atm.c sangam_atm-07.02.01.00.mod/tn7atm.c
2 --- sangam_atm-07.02.01.00/tn7atm.c 2007-09-19 04:12:20.000000000 +0200
3 +++ sangam_atm-07.02.01.00.mod/tn7atm.c 2007-09-20 14:45:19.280250000 +0200
6 MODULE_DESCRIPTION ("Tnetd73xx ATM Device Driver");
7 MODULE_AUTHOR ("Zhicheng Tang");
9 +int mp_sar_ipacemax = -1;
10 +module_param_named(ipacemax, mp_sar_ipacemax, int, 0);
11 +MODULE_PARM_DESC(ipacemax, "Interrupt pacing");
13 +char *mp_macc = NULL;
14 +module_param_named(macc, mp_macc, charp, 0);
15 +MODULE_PARM_DESC(macc, "MAC address");
17 +int mp_dsp_noboost = -1;
18 +module_param_named(dsp_noboost, mp_dsp_noboost, int, 0);
19 +MODULE_PARM_DESC(dsp_noboost, "Suppress DSP frequency boost");
21 +int mp_dsp_freq = -1;
22 +module_param_named(dsp_freq, mp_dsp_freq, int, 0);
23 +MODULE_PARM_DESC(dsp_freq, "Frequency to boost the DSP to");
25 +char *mp_featctl0 = NULL;
26 +module_param_named(featctl0, mp_featctl0, charp, 0);
27 +MODULE_PARM_DESC(featctl0, "DSL feature control 0");
29 +char *mp_featctl1 = NULL;
30 +module_param_named(featctl1, mp_featctl1, charp, 0);
31 +MODULE_PARM_DESC(featctl1, "DSL feature control 1");
33 +char *mp_phyctl0 = NULL;
34 +module_param_named(phyctl0, mp_phyctl0, charp, 0);
35 +MODULE_PARM_DESC(phyctl0, "DSL PHY control 0");
37 +char *mp_phyctl1 = NULL;
38 +module_param_named(phyctl1, mp_phyctl1, charp, 0);
39 +MODULE_PARM_DESC(phyctl1, "DSL PHY control 1");
41 +int mp_turbodsl = -1;
42 +module_param_named(turbodsl, mp_turbodsl, int, 0);
43 +MODULE_PARM_DESC(turbodsl, "Enable TurboDSL");
45 +int mp_sar_rxbuf = -1;
46 +module_param_named(sar_rxbuf, mp_sar_rxbuf, int, 0);
47 +MODULE_PARM_DESC(sar_rxbuf, "SAR RxBuf size");
49 +int mp_sar_rxmax = -1;
50 +module_param_named(sar_rxmax, mp_sar_rxmax, int, 0);
51 +MODULE_PARM_DESC(sar_rxmax, "SAR RxMax size");
53 +int mp_sar_txbuf = -1;
54 +module_param_named(sar_txbuf, mp_sar_txbuf, int, 0);
55 +MODULE_PARM_DESC(sar_txbuf, "SAR TxBuf size");
57 +int mp_sar_txmax = -1;
58 +module_param_named(sar_txmax, mp_sar_txmax, int, 0);
59 +MODULE_PARM_DESC(sar_txmax, "SAR TxMax size");
61 +char *mp_modulation = NULL;
62 +module_param_named(modulation, mp_modulation, charp, 0);
63 +MODULE_PARM_DESC(modulation, "Modulation");
65 +int mp_fine_gain_control = -1;
66 +module_param_named(fine_gain_control, mp_fine_gain_control, int, 0);
67 +MODULE_PARM_DESC(fine_gain_control, "Fine gain control");
69 +int mp_fine_gain_value = -1;
70 +module_param_named(fine_gain_value, mp_fine_gain_value, int, 0);
71 +MODULE_PARM_DESC(fine_gain_value, "Fine gain value");
73 +int mp_enable_margin_retrain = -1;
74 +module_param_named(enable_margin_retrain, mp_enable_margin_retrain, int, 0);
75 +MODULE_PARM_DESC(enable_margin_retrain, "Enable margin retrain");
77 +int mp_margin_threshold = -1;
78 +module_param_named(margin_threshold, mp_margin_threshold, int, 0);
79 +MODULE_PARM_DESC(margin_threshold, "Margin retrain treshold");
81 +int mp_enable_rate_adapt = -1;
82 +module_param_named(enable_rate_adapt, mp_enable_rate_adapt, int, 0);
83 +MODULE_PARM_DESC(enable_rate_adapt, "Enable rate adaption");
85 +int mp_powercutback = -1;
86 +module_param_named(powercutback, mp_powercutback, int, 0);
87 +MODULE_PARM_DESC(powercutback, "Enable / disable powercutback");
90 +module_param_named(trellis, mp_trellis, int, 0);
91 +MODULE_PARM_DESC(trellis, "Enable / disable trellis coding");
94 +module_param_named(bitswap, mp_bitswap, int, 0);
95 +MODULE_PARM_DESC(bitswap, "Enable / disable bitswap");
97 +int mp_maximum_bits_per_carrier = -1;
98 +module_param_named(maximum_bits_per_carrier, mp_maximum_bits_per_carrier, int, 0);
99 +MODULE_PARM_DESC(maximum_bits_per_carrier, "Maximum bits per carrier");
101 +int mp_maximum_interleave_depth = -1;
102 +module_param_named(maximum_interleave_depth, mp_maximum_interleave_depth, int, 0);
103 +MODULE_PARM_DESC(maximum_interleave_depth, "Maximum interleave depth");
105 +int mp_pair_selection = -1;
106 +module_param_named(pair_selection, mp_pair_selection, int, 0);
107 +MODULE_PARM_DESC(pair_selection, "Pair selection");
109 +int mp_dgas_polarity = -1;
110 +module_param_named(dgas_polarity, mp_dgas_polarity, int, 0);
111 +MODULE_PARM_DESC(dgas_polarity, "DGAS polarity");
113 +int mp_los_alarm = -1;
114 +module_param_named(los_alarm, mp_los_alarm, int, 0);
115 +MODULE_PARM_DESC(los_alarm, "LOS alarm");
117 +char *mp_eoc_vendor_id = NULL;
118 +module_param_named(eoc_vendor_id, mp_eoc_vendor_id, charp, 0);
119 +MODULE_PARM_DESC(eoc_vendor_id, "EOC vendor id");
121 +int mp_eoc_vendor_revision = -1;
122 +module_param_named(eoc_vendor_revision, mp_eoc_vendor_revision, int, 0);
123 +MODULE_PARM_DESC(eoc_vendor_revision, "EOC vendor revision");
125 +char *mp_eoc_vendor_serialnum = NULL;
126 +module_param_named(eoc_vendor_serialnum, mp_eoc_vendor_serialnum, charp, 0);
127 +MODULE_PARM_DESC(eoc_vendor_serialnum, "EOC vendor serial number");
129 +char *mp_invntry_vernum = NULL;
130 +module_param_named(invntry_vernum, mp_invntry_vernum, charp, 0);
131 +MODULE_PARM_DESC(invntry_vernum, "Inventory revision number");
133 +int mp_dsl_bit_tmode = -1;
134 +module_param_named(dsl_bit_tmode, mp_dsl_bit_tmode, int, 0);
135 +MODULE_PARM_DESC(dsl_bit_tmode, "DSL bit training mode");
137 +int mp_high_precision = -1;
138 +module_param_named(high_precision, mp_high_precision, int, 0);
139 +MODULE_PARM_DESC(high_precision, "High precision");
141 +int mp_autopvc_enable = -1;
142 +module_param_named(autopvc_enable, mp_autopvc_enable, int, 0);
143 +MODULE_PARM_DESC(autopvc_enable, "Enable / disable automatic PVC");
145 +int mp_oam_lb_timeout = -1;
146 +module_param_named(oam_lb_timeout, mp_oam_lb_timeout, int, 0);
147 +MODULE_PARM_DESC(oam_lb_timeout, "OAM LB timeout");
154 ptr = prom_getenv ("sar_ipacemax");
156 + if (ptr || mp_sar_ipacemax != -1)
158 - def_sar_inter_pace = os_atoi (ptr);
159 + def_sar_inter_pace = mp_sar_ipacemax == -1 ? os_atoi (ptr) : mp_sar_ipacemax;
161 /* avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
162 def_sar_inter_pace);*/
164 char esi_addr[ESI_LEN] = { 0x00, 0x00, 0x11, 0x22, 0x33, 0x44 };
165 char *esiaddr_str = NULL;
167 - esiaddr_str = prom_getenv ("maca");
168 + esiaddr_str = mp_macc ? mp_macc : prom_getenv ("maca");
172 @@ -1932,15 +2072,15 @@
173 //UR8_MERGE_END CQ10450*
175 cp = prom_getenv ("dsp_noboost");
177 + if (cp || mp_dsp_noboost != -1)
179 - dsp_noboost = os_atoi (cp);
180 + dsp_noboost = mp_dsp_noboost == -1 ? os_atoi (cp) : mp_dsp_noboost;
183 cp = (char *) prom_getenv ("dsp_freq");
185 + if (cp || mp_dsp_freq != -1)
187 - dspfreq = os_atoi (cp);
188 + dspfreq = mp_dsp_freq == -1 ? os_atoi (cp) : mp_dsp_freq;
192 @@ -2189,8 +2329,9 @@
193 // Inter-Op DSL phy Control
194 // Note the setting of _dsl_Feature_0 and _dsl_Feature_1 must before
195 // dslhal_api_dslStartup (in tn7dsl_init()).
196 - if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_0")) != NULL)
197 + if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_0")) != NULL || mp_featctl0 != NULL)
199 + if (mp_featctl0 != NULL) ptr = mp_featctl0;
200 if ((ptr[0] == '0') && (ptr[1] == 'x')) // skip 0x before pass to
203 @@ -2198,8 +2339,9 @@
204 _dsl_Feature_0_defined = 1;
207 - if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_1")) != NULL)
208 + if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_1")) != NULL || mp_featctl1 != NULL)
210 + if (mp_featctl1 != NULL) ptr = mp_featctl1;
211 if ((ptr[0] == '0') && (ptr[1] == 'x')) // skip 0x before pass to
214 @@ -2211,8 +2353,9 @@
215 // DSL phy Feature Control
216 // Note the setting of _dsl_PhyControl_0 and _dsl_PhyControl_1 must before
217 // dslhal_api_dslStartup (in tn7dsl_init()).
218 - if ((ptr = prom_getenv ("DSL_PHY_CNTL_0")) != NULL)
219 + if ((ptr = prom_getenv ("DSL_PHY_CNTL_0")) != NULL || mp_phyctl0 != NULL)
221 + if (mp_phyctl0 != NULL) ptr = mp_phyctl0;
222 if ((ptr[0] == '0') && (ptr[1] == 'x')) // skip 0x before pass to
225 @@ -2220,8 +2363,9 @@
226 _dsl_PhyControl_0_defined = 1;
229 - if ((ptr = prom_getenv ("DSL_PHY_CNTL_1")) != NULL)
230 + if ((ptr = prom_getenv ("DSL_PHY_CNTL_1")) != NULL || mp_phyctl1 != NULL)
232 + if (mp_phyctl1 != NULL) ptr = mp_phyctl1;
233 if ((ptr[0] == '0') && (ptr[1] == 'x')) // skip 0x before pass to
236 @@ -2249,9 +2393,9 @@
238 // read config for turbo dsl
239 ptr = prom_getenv ("TurboDSL");
241 + if (ptr || mp_turbodsl != -1)
243 - priv->bTurboDsl = os_atoi (ptr);
244 + priv->bTurboDsl = mp_turbodsl == -1 ? os_atoi (ptr) : mp_turbodsl;
247 // @Added to make Rx buffer number & Service max configurable through
248 @@ -2259,30 +2403,30 @@
249 priv->sarRxBuf = RX_BUFFER_NUM;
251 ptr = prom_getenv ("SarRxBuf");
253 + if (ptr || mp_sar_rxbuf != -1)
255 - priv->sarRxBuf = os_atoi (ptr);
256 + priv->sarRxBuf = mp_sar_rxbuf == -1 ? os_atoi (ptr) : mp_sar_rxbuf;
258 priv->sarRxMax = RX_SERVICE_MAX;
260 ptr = prom_getenv ("SarRxMax");
262 + if (ptr || mp_sar_rxmax != -1)
264 - priv->sarRxMax = os_atoi (ptr);
265 + priv->sarRxMax = mp_sar_rxmax == -1 ? os_atoi (ptr) : mp_sar_rxmax;
267 priv->sarTxBuf = TX_BUFFER_NUM;
269 ptr = prom_getenv ("SarTxBuf");
271 + if (ptr || mp_sar_txbuf != -1)
273 - priv->sarTxBuf = os_atoi (ptr);
274 + priv->sarTxBuf = mp_sar_txbuf == -1 ? os_atoi (ptr) : mp_sar_txbuf;
276 priv->sarTxMax = TX_SERVICE_MAX;
278 ptr = prom_getenv ("SarTxMax");
280 + if (ptr || mp_sar_txmax != -1)
282 - priv->sarTxMax = os_atoi (ptr);
283 + priv->sarTxMax = mp_sar_txmax == -1 ? os_atoi (ptr) : mp_sar_txmax;
287 diff -urN sangam_atm-07.02.01.00/tn7dsl.c sangam_atm-07.02.01.00.mod/tn7dsl.c
288 --- sangam_atm-07.02.01.00/tn7dsl.c 2007-09-19 04:12:20.000000000 +0200
289 +++ sangam_atm-07.02.01.00.mod/tn7dsl.c 2007-09-20 14:55:46.608375000 +0200
291 #define NEW_TRAINING_VAL_T1413 128
292 #define NEW_TRAINING_VAL_MMODE 255
294 +extern char *mp_modulation;
295 +extern int mp_fine_gain_control;
296 +extern int mp_fine_gain_value;
297 +extern int mp_enable_margin_retrain;
298 +extern int mp_margin_threshold;
299 +extern int mp_enable_rate_adapt;
300 +extern int mp_powercutback;
301 +extern int mp_trellis;
302 +extern int mp_bitswap;
303 +extern int mp_maximum_bits_per_carrier;
304 +extern int mp_maximum_interleave_depth;
305 +extern int mp_pair_selection;
306 +extern int mp_dgas_polarity;
307 +extern int mp_los_alarm;
308 +extern char *mp_eoc_vendor_id;
309 +extern int mp_eoc_vendor_revision;
310 +extern char *mp_eoc_vendor_serialnum;
311 +extern char *mp_invntry_vernum;
312 +extern int mp_dsl_bit_tmode;
313 +extern int mp_high_precision;
316 extern int __guDbgLevel;
317 extern sar_stat_t sarStat;
318 @@ -2816,84 +2837,80 @@
321 ptr = prom_getenv("modulation");
323 + if (ptr || mp_modulation != NULL)
325 - tn7dsl_set_modulation(ptr, FALSE);
326 + tn7dsl_set_modulation(mp_modulation == NULL ? ptr : mp_modulation, FALSE);
330 ptr = prom_getenv("fine_gain_control");
332 + if (ptr || mp_fine_gain_control != -1)
334 - value = os_atoi(ptr);
335 + value = mp_fine_gain_control == -1 ? os_atoi(ptr) : mp_fine_gain_control;
336 tn7dsl_ctrl_fineGain(value);
339 ptr = prom_getenv("fine_gain_value");
341 - tn7dsl_set_fineGainValue(os_atoh(ptr));
342 + if(ptr || mp_fine_gain_value != -1)
343 + tn7dsl_set_fineGainValue(mp_fine_gain_value == -1 ? os_atoh(ptr) : mp_fine_gain_value);
347 ptr = prom_getenv("enable_margin_retrain");
349 + value = mp_enable_margin_retrain == -1 ? (ptr ? os_atoi(ptr) : 0) : mp_enable_margin_retrain;
353 - value = os_atoi(ptr);
355 + dslhal_api_setMarginMonitorFlags(pIhw, 0, 1);
356 + bMarginRetrainEnable = 1;
357 + //printk("enable showtime margin monitor.\n");
360 + ptr = prom_getenv("margin_threshold");
361 + value = mp_margin_threshold == -1 ? (ptr ? os_atoi(ptr) : 0) : mp_margin_threshold;
365 - dslhal_api_setMarginMonitorFlags(pIhw, 0, 1);
366 - bMarginRetrainEnable = 1;
367 - //printk("enable showtime margin monitor.\n");
369 - ptr = prom_getenv("margin_threshold");
372 - value = os_atoi(ptr);
373 - //printk("Set margin threshold to %d x 0.5 db\n",value);
376 - dslhal_api_setMarginThreshold(pIhw, value);
380 + dslhal_api_setMarginThreshold(pIhw, value);
387 ptr = prom_getenv("enable_rate_adapt");
389 + if(ptr || mp_enable_rate_adapt != -1)
391 - dslhal_api_setRateAdaptFlag(pIhw, os_atoi(ptr));
392 + dslhal_api_setRateAdaptFlag(pIhw, mp_enable_rate_adapt == -1 ? os_atoi(ptr) : mp_enable_rate_adapt);
397 ptr = prom_getenv("powercutback");
399 + if(ptr || mp_powercutback != -1)
401 - dslhal_advcfg_onOffPcb(pIhw, os_atoi(ptr));
402 + dslhal_advcfg_onOffPcb(pIhw, mp_powercutback == -1 ? os_atoi(ptr) : mp_powercutback);
407 ptr = prom_getenv("trellis");
409 + if(ptr || mp_trellis != -1)
411 - dslhal_api_setTrellisFlag(pIhw, os_atoi(ptr));
412 - trellis = os_atoi(ptr);
413 + trellis = mp_trellis == -1 ? os_atoi(ptr) : mp_trellis;
414 + dslhal_api_setTrellisFlag(pIhw, trellis);
415 //printk("trellis=%d\n");
420 ptr = prom_getenv("bitswap");
422 + if(ptr || mp_bitswap != -1)
424 int offset[2] = {33, 0};
425 unsigned int bitswap;
427 - bitswap = os_atoi(ptr);
428 + bitswap = mp_bitswap == -1 ? os_atoi(ptr) : mp_bitswap;
430 tn7dsl_generic_read(2, offset);
431 dslReg &= dslhal_support_byteSwap32(0xFFFFFF00);
432 @@ -2911,46 +2928,47 @@
433 // maximum bits per carrier
435 ptr = prom_getenv("maximum_bits_per_carrier");
437 + if(ptr || mp_maximum_bits_per_carrier != -1)
439 - dslhal_api_setMaxBitsPerCarrierUpstream(pIhw, os_atoi(ptr));
440 + dslhal_api_setMaxBitsPerCarrierUpstream(pIhw, mp_maximum_bits_per_carrier == -1 ? os_atoi(ptr) : mp_maximum_bits_per_carrier);
443 // maximum interleave depth
445 ptr = prom_getenv("maximum_interleave_depth");
447 + if(ptr || mp_maximum_interleave_depth != -1)
449 - dslhal_api_setMaxInterleaverDepth(pIhw, os_atoi(ptr));
450 + dslhal_api_setMaxInterleaverDepth(pIhw, mp_maximum_interleave_depth == -1 ? os_atoi(ptr) : mp_maximum_interleave_depth);
453 // inner and outer pairs
455 ptr = prom_getenv("pair_selection");
457 + if(ptr || mp_pair_selection != -1)
459 - dslhal_api_selectInnerOuterPair(pIhw, os_atoi(ptr));
460 + dslhal_api_selectInnerOuterPair(pIhw, mp_pair_selection == -1 ? os_atoi(ptr) : mp_pair_selection);
464 ptr = prom_getenv("dgas_polarity");
466 + if(ptr || mp_dgas_polarity != -1)
468 dslhal_api_configureDgaspLpr(pIhw, 1, 1);
469 - dslhal_api_configureDgaspLpr(pIhw, 0, os_atoi(ptr));
470 + dslhal_api_configureDgaspLpr(pIhw, 0, mp_dgas_polarity == -1 ? os_atoi(ptr) : mp_dgas_polarity);
474 ptr = prom_getenv("los_alarm");
476 + if(ptr || mp_los_alarm != -1)
478 - dslhal_api_disableLosAlarm(pIhw, os_atoi(ptr));
479 + dslhal_api_disableLosAlarm(pIhw, mp_los_alarm == -1 ? os_atoi(ptr) : mp_los_alarm);
483 ptr = prom_getenv("eoc_vendor_id");
485 + if(ptr || mp_eoc_vendor_id != NULL)
487 + ptr = mp_eoc_vendor_id == NULL ? ptr : mp_eoc_vendor_id;
491 @@ -2975,26 +2993,26 @@
494 ptr = prom_getenv("eoc_vendor_revision");
496 + if(ptr || mp_eoc_vendor_revision != -1)
498 - value = os_atoi(ptr);
499 + value = mp_eoc_vendor_revision == -1 ? os_atoi(ptr) : mp_eoc_vendor_revision;
500 //printk("eoc rev=%d\n", os_atoi(ptr));
501 dslhal_api_setEocRevisionNumber(pIhw, (char *)&value);
505 ptr = prom_getenv("eoc_vendor_serialnum");
507 + if(ptr || mp_eoc_vendor_serialnum != NULL)
509 - dslhal_api_setEocSerialNumber(pIhw, ptr);
510 + dslhal_api_setEocSerialNumber(pIhw, mp_eoc_vendor_serialnum == NULL ? ptr : mp_eoc_vendor_serialnum);
513 // CQ10037 Added invntry_vernum environment variable to be able to set version number in ADSL2, ADSL2+ modes.
515 ptr = prom_getenv("invntry_vernum");
517 + if(ptr || mp_invntry_vernum != NULL)
519 - dslhal_api_setEocRevisionNumber(pIhw, ptr);
520 + dslhal_api_setEocRevisionNumber(pIhw, mp_invntry_vernum == NULL ? ptr : mp_invntry_vernum);
524 @@ -3038,7 +3056,7 @@
525 * backward compatibility.
527 cp = prom_getenv("DSL_BIT_TMODE");
529 + if (cp || mp_dsl_bit_tmode != -1)
531 printk("%s : env var DSL_BIT_TMODE is set\n", __FUNCTION__);
533 @@ -3067,9 +3085,9 @@
535 // UR8_MERGE_START CQ11054 Jack Zhang
536 cp = prom_getenv("high_precision");
538 + if (cp || mp_high_precision != -1)
540 - high_precision_selected = os_atoi(cp);
541 + high_precision_selected = mp_high_precision == -1 ? os_atoi(cp) : mp_high_precision;
543 if ( high_precision_selected)
545 diff -urN sangam_atm-07.02.01.00/tn7sar.c sangam_atm-07.02.01.00.mod/tn7sar.c
546 --- sangam_atm-07.02.01.00/tn7sar.c 2007-09-19 04:12:20.000000000 +0200
547 +++ sangam_atm-07.02.01.00.mod/tn7sar.c 2007-09-20 14:23:50.436500000 +0200
549 /* PDSP Firmware files */
550 #include "tnetd7300_sar_firm.h"
552 +extern int mp_oam_lb_timeout;
553 +extern int mp_autopvc_enable;
558 pHalDev = (HAL_DEVICE *)priv->pSarHalDev;
560 pauto_pvc = prom_getenv("autopvc_enable");
561 - if(pauto_pvc) //CQ10273
562 + if(pauto_pvc || mp_autopvc_enable != -1) //CQ10273
564 - auto_pvc =tn7sar_strtoul(pauto_pvc, NULL, 10);
565 + auto_pvc = mp_autopvc_enable == -1 ? tn7sar_strtoul(pauto_pvc, NULL, 10) : mp_autopvc_enable;
568 memset(&chInfo, 0xff, sizeof(chInfo));
571 /* read in oam lb timeout value */
572 pLbTimeout = prom_getenv("oam_lb_timeout");
574 + if(pLbTimeout || mp_oam_lb_timeout != -1)
576 - lbTimeout =tn7sar_strtoul(pLbTimeout, NULL, 10);
577 + lbTimeout = mp_oam_lb_timeout == -1 ? tn7sar_strtoul(pLbTimeout, NULL, 10) : mp_oam_lb_timeout;
578 oamLbTimeout = lbTimeout;
579 pHalFunc->Control(pHalDev,"OamLbTimeout", "Set", &lbTimeout);