160-module-params.patch 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  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. #ifndef TRUE
  149. @@ -728,9 +868,9 @@ static int __init tn7atm_irq_request (st
  150. * interrupt pacing
  151. */
  152. ptr = prom_getenv ("sar_ipacemax");
  153. - if (ptr)
  154. + if (ptr || mp_sar_ipacemax != -1)
  155. {
  156. - def_sar_inter_pace = os_atoi (ptr);
  157. + def_sar_inter_pace = mp_sar_ipacemax == -1 ? os_atoi (ptr) : mp_sar_ipacemax;
  158. }
  159. /* avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
  160. def_sar_inter_pace); */
  161. @@ -878,9 +1018,18 @@ static int __init tn7atm_get_ESI (struct
  162. {
  163. int i;
  164. char esi_addr[ESI_LEN] = { 0x00, 0x00, 0x11, 0x22, 0x33, 0x44 };
  165. - char *esiaddr_str = NULL;
  166. + char *esiaddr_str = mp_macc;
  167. - esiaddr_str = prom_getenv ("macc");
  168. + if (esiaddr_str == NULL)
  169. + esiaddr_str = prom_getenv ("macdsl");
  170. + if (esiaddr_str == NULL)
  171. + esiaddr_str = prom_getenv ("macc");
  172. + if (esiaddr_str == NULL)
  173. + esiaddr_str = prom_getenv ("HWA_1");
  174. + if (esiaddr_str == NULL)
  175. + esiaddr_str = prom_getenv ("macb");
  176. + if (esiaddr_str == NULL)
  177. + esiaddr_str = prom_getenv ("maca");
  178. if (!esiaddr_str)
  179. {
  180. @@ -2139,15 +2288,15 @@ static int tn7atm_autoDetectDspBoost (vo
  181. //UR8_MERGE_END CQ10450*
  182. cp = prom_getenv ("dsp_noboost");
  183. - if (cp)
  184. + if (cp || mp_dsp_noboost != -1)
  185. {
  186. - dsp_noboost = os_atoi (cp);
  187. + dsp_noboost = mp_dsp_noboost == -1 ? os_atoi (cp) : mp_dsp_noboost;
  188. }
  189. cp = (char *) prom_getenv ("dsp_freq");
  190. - if (cp)
  191. + if (cp || mp_dsp_freq != -1)
  192. {
  193. - dspfreq = os_atoi (cp);
  194. + dspfreq = mp_dsp_freq == -1 ? os_atoi (cp) : mp_dsp_freq;
  195. if (dspfreq == 250)
  196. {
  197. boostDsp = 1;
  198. @@ -2396,15 +2545,17 @@ static int __init tn7atm_init (struct at
  199. // Inter-Op DSL phy Control
  200. // Note the setting of _dsl_Feature_0 and _dsl_Feature_1 must before
  201. // dslhal_api_dslStartup (in tn7dsl_init()).
  202. - if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_0")) != NULL)
  203. + if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_0")) != NULL || mp_featctl0 != NULL)
  204. {
  205. - _dsl_Feature_0 = os_atoih (ptr);
  206. + if (mp_featctl0 != NULL) ptr = mp_featctl0;
  207. + _dsl_Feature_0 = os_atoh (ptr);
  208. _dsl_Feature_0_defined = 1;
  209. }
  210. - if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_1")) != NULL)
  211. + if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_1")) != NULL || mp_featctl1 != NULL)
  212. {
  213. - _dsl_Feature_1 = os_atoih (ptr);
  214. + if (mp_featctl1 != NULL) ptr = mp_featctl1;
  215. + _dsl_Feature_1 = os_atoh (ptr);
  216. _dsl_Feature_1_defined = 1;
  217. }
  218. @@ -2412,15 +2563,17 @@ static int __init tn7atm_init (struct at
  219. // DSL phy Feature Control
  220. // Note the setting of _dsl_PhyControl_0 and _dsl_PhyControl_1 must before
  221. // dslhal_api_dslStartup (in tn7dsl_init()).
  222. - if ((ptr = prom_getenv ("DSL_PHY_CNTL_0")) != NULL)
  223. + if ((ptr = prom_getenv ("DSL_PHY_CNTL_0")) != NULL || mp_phyctl0 != NULL)
  224. {
  225. - _dsl_PhyControl_0 = os_atoih (ptr);
  226. + if (mp_phyctl0 != NULL) ptr = mp_phyctl0;
  227. + _dsl_PhyControl_0 = os_atoh (ptr);
  228. _dsl_PhyControl_0_defined = 1;
  229. }
  230. - if ((ptr = prom_getenv ("DSL_PHY_CNTL_1")) != NULL)
  231. + if ((ptr = prom_getenv ("DSL_PHY_CNTL_1")) != NULL || mp_phyctl1 != NULL)
  232. {
  233. - _dsl_PhyControl_1 = os_atoih (ptr);
  234. + if (mp_phyctl1 != NULL) ptr = mp_phyctl1;
  235. + _dsl_PhyControl_1 = os_atoh (ptr);
  236. _dsl_PhyControl_1_defined = 1;
  237. }
  238. @@ -2440,12 +2593,12 @@ static int __init tn7atm_init (struct at
  239. // read config for turbo dsl
  240. ptr = prom_getenv ("TurboDSL");
  241. - if (ptr)
  242. + if (ptr || mp_turbodsl != -1)
  243. {
  244. #if 1 //[KT]
  245. bTurboDsl = os_atoi (ptr);
  246. #else
  247. - priv->bTurboDsl = os_atoi (ptr);
  248. + priv->bTurboDsl = mp_turbodsl == -1 ? os_atoi (ptr) : mp_turbodsl;
  249. #endif
  250. }
  251. else
  252. @@ -2459,33 +2612,33 @@ static int __init tn7atm_init (struct at
  253. priv->sarRxBuf = RX_BUFFER_NUM;
  254. ptr = NULL;
  255. ptr = prom_getenv ("SarRxBuf");
  256. - if (ptr)
  257. + if (ptr || mp_sar_rxbuf != -1)
  258. {
  259. - priv->sarRxBuf = os_atoi (ptr);
  260. + priv->sarRxBuf = mp_sar_rxbuf == -1 ? os_atoi (ptr) : mp_sar_rxbuf;
  261. }
  262. priv->sarRxMax = RX_SERVICE_MAX;
  263. ptr = NULL;
  264. ptr = prom_getenv ("SarRxMax");
  265. - if (ptr)
  266. + if (ptr || mp_sar_rxmax != -1)
  267. {
  268. - priv->sarRxMax = os_atoi (ptr);
  269. + priv->sarRxMax = mp_sar_rxmax == -1 ? os_atoi (ptr) : mp_sar_rxmax;
  270. }
  271. priv->sarTxBuf = TX_BUFFER_NUM;
  272. ptr = NULL;
  273. ptr = prom_getenv ("SarTxBuf");
  274. - if (ptr)
  275. + if (ptr || mp_sar_txbuf != -1)
  276. {
  277. - priv->sarTxBuf = os_atoi (ptr);
  278. + priv->sarTxBuf = mp_sar_txbuf == -1 ? os_atoi (ptr) : mp_sar_txbuf;
  279. }
  280. priv->sarTxMax = TX_SERVICE_MAX;
  281. ptr = NULL;
  282. ptr = prom_getenv ("SarTxMax");
  283. - if (ptr)
  284. + if (ptr || mp_sar_txmax != -1)
  285. {
  286. - priv->sarTxMax = os_atoi (ptr);
  287. + priv->sarTxMax = mp_sar_txmax == -1 ? os_atoi (ptr) : mp_sar_txmax;
  288. }
  289. #ifdef AR7_EFM
  290. --- a/tn7dsl.c
  291. +++ b/tn7dsl.c
  292. @@ -148,6 +148,27 @@
  293. #define NEW_TRAINING_VAL_T1413 128
  294. #define NEW_TRAINING_VAL_MMODE 255
  295. +extern char *mp_modulation;
  296. +extern int mp_fine_gain_control;
  297. +extern int mp_fine_gain_value;
  298. +extern int mp_enable_margin_retrain;
  299. +extern int mp_margin_threshold;
  300. +extern int mp_enable_rate_adapt;
  301. +extern int mp_powercutback;
  302. +extern int mp_trellis;
  303. +extern int mp_bitswap;
  304. +extern int mp_maximum_bits_per_carrier;
  305. +extern int mp_maximum_interleave_depth;
  306. +extern int mp_pair_selection;
  307. +extern int mp_dgas_polarity;
  308. +extern int mp_los_alarm;
  309. +extern char *mp_eoc_vendor_id;
  310. +extern int mp_eoc_vendor_revision;
  311. +extern char *mp_eoc_vendor_serialnum;
  312. +extern char *mp_invntry_vernum;
  313. +extern int mp_dsl_bit_tmode;
  314. +extern int mp_high_precision;
  315. +
  316. int testflag1 = 0;
  317. extern int __guDbgLevel;
  318. extern sar_stat_t sarStat;
  319. @@ -2933,24 +2954,24 @@ static int tn7dsl_set_dsl(void)
  320. (unsigned char *) &oamFeature, 4);
  321. ptr = prom_getenv("DSL_FEATURE_CNTL_0");
  322. - if(!ptr)
  323. - prom_setenv("DSL_FEATURE_CNTL_0", "0x00004000");
  324. + //if(!ptr)
  325. + //prom_setenv("DSL_FEATURE_CNTL_0", "0x00004000");
  326. ptr = prom_getenv("DSL_FEATURE_CNTL_1");
  327. - if(!ptr)
  328. - prom_setenv("DSL_FEATURE_CNTL_1", "0x00000000");
  329. + //if(!ptr)
  330. + //prom_setenv("DSL_FEATURE_CNTL_1", "0x00000000");
  331. ptr = prom_getenv("DSL_PHY_CNTL_0");
  332. - if(!ptr)
  333. - prom_setenv("DSL_PHY_CNTL_0", "0x00000400");
  334. + //if(!ptr)
  335. + //prom_setenv("DSL_PHY_CNTL_0", "0x00000400");
  336. ptr = prom_getenv("enable_margin_retrain");
  337. - if(!ptr)
  338. - prom_setenv("enable_margin_retrain", "0");
  339. + //if(!ptr)
  340. + //prom_setenv("enable_margin_retrain", "0");
  341. ptr = prom_getenv("modulation");
  342. - if(!ptr)
  343. - prom_setenv("modulation", "0xbf");
  344. + //if(!ptr)
  345. + //prom_setenv("modulation", "0xbf");
  346. #define EOC_VENDOR_ID "4200534153000000"
  347. #define EOC_VENDOR_REVISION "FW370090708b1_55"
  348. @@ -2959,25 +2980,25 @@ static int tn7dsl_set_dsl(void)
  349. ptr = prom_getenv("eoc_vendor_id");
  350. if(!ptr || strcmp(ptr,EOC_VENDOR_ID) != 0 || strlen(ptr) != strlen(EOC_VENDOR_ID))
  351. {
  352. - if(ptr)
  353. - prom_unsetenv("eoc_vendor_id");
  354. - prom_setenv("eoc_vendor_id",EOC_VENDOR_ID);
  355. + //if(ptr)
  356. + //prom_unsetenv("eoc_vendor_id");
  357. + //prom_setenv("eoc_vendor_id",EOC_VENDOR_ID);
  358. }
  359. ptr = prom_getenv("eoc_vendor_revision");
  360. if(!ptr || strcmp(ptr,EOC_VENDOR_REVISION) != 0 || strlen(ptr) != strlen(EOC_VENDOR_REVISION))
  361. {
  362. - if(ptr)
  363. - prom_unsetenv("eoc_vendor_revision");
  364. - prom_setenv("eoc_vendor_revision",EOC_VENDOR_REVISION);
  365. + //if(ptr)
  366. + //prom_unsetenv("eoc_vendor_revision");
  367. + //prom_setenv("eoc_vendor_revision",EOC_VENDOR_REVISION);
  368. }
  369. ptr = prom_getenv("eoc_vendor_serialnum");
  370. if(!ptr || strcmp(ptr,EOC_VENDOR_SERIALNUM) != 0 || strlen(ptr) != strlen(EOC_VENDOR_SERIALNUM))
  371. {
  372. - if(ptr)
  373. - prom_unsetenv("eoc_vendor_serialnum");
  374. - prom_setenv("eoc_vendor_serialnum",EOC_VENDOR_SERIALNUM);
  375. + //if(ptr)
  376. + // prom_unsetenv("eoc_vendor_serialnum");
  377. + //prom_setenv("eoc_vendor_serialnum",EOC_VENDOR_SERIALNUM);
  378. }
  379. /* Do only if we are in the new Base PSP 7.4.*/
  380. @@ -2994,92 +3015,88 @@ static int tn7dsl_set_dsl(void)
  381. we clear the modulation environment variable, as this could potentially
  382. not have the same meaning in the new mode.
  383. */
  384. - prom_unsetenv("modulation");
  385. - prom_setenv("DSL_UPG_DONE", "1");
  386. + //prom_unsetenv("modulation");
  387. + //prom_setenv("DSL_UPG_DONE", "1");
  388. }
  389. }
  390. #endif
  391. // modulation
  392. ptr = prom_getenv("modulation");
  393. - if (ptr)
  394. + if (ptr || mp_modulation != NULL)
  395. {
  396. - tn7dsl_set_modulation(ptr, FALSE);
  397. + tn7dsl_set_modulation(mp_modulation == NULL ? ptr : mp_modulation, FALSE);
  398. }
  399. // Fine Gains
  400. ptr = prom_getenv("fine_gain_control");
  401. - if (ptr)
  402. + if (ptr || mp_fine_gain_control != -1)
  403. {
  404. - value = os_atoi(ptr);
  405. + value = mp_fine_gain_control == -1 ? os_atoi(ptr) : mp_fine_gain_control;
  406. tn7dsl_ctrl_fineGain(value);
  407. }
  408. ptr = NULL;
  409. ptr = prom_getenv("fine_gain_value");
  410. - if(ptr)
  411. - tn7dsl_set_fineGainValue(os_atoh(ptr));
  412. + if(ptr || mp_fine_gain_value != -1)
  413. + tn7dsl_set_fineGainValue(mp_fine_gain_value == -1 ? os_atoh(ptr) : mp_fine_gain_value);
  414. // margin retrain
  415. ptr = NULL;
  416. ptr = prom_getenv("enable_margin_retrain");
  417. - if(ptr)
  418. + value = mp_enable_margin_retrain == -1 ? (ptr ? os_atoi(ptr) : 0) : mp_enable_margin_retrain;
  419. +
  420. + if (value == 1)
  421. {
  422. - value = os_atoi(ptr);
  423. - if(value == 1)
  424. + dslhal_api_setMarginMonitorFlags(pIhw, 0, 1);
  425. + bMarginRetrainEnable = 1;
  426. + //printk("enable showtime margin monitor.\n");
  427. +
  428. + ptr = NULL;
  429. + ptr = prom_getenv("margin_threshold");
  430. + value = mp_margin_threshold == -1 ? (ptr ? os_atoi(ptr) : 0) : mp_margin_threshold;
  431. +
  432. + if(value >= 0)
  433. {
  434. - dslhal_api_setMarginMonitorFlags(pIhw, 0, 1);
  435. - bMarginRetrainEnable = 1;
  436. - //printk("enable showtime margin monitor.\n");
  437. - ptr = NULL;
  438. - ptr = prom_getenv("margin_threshold");
  439. - if(ptr)
  440. - {
  441. - value = os_atoi(ptr);
  442. - //printk("Set margin threshold to %d x 0.5 db\n",value);
  443. - if(value >= 0)
  444. - {
  445. - dslhal_api_setMarginThreshold(pIhw, value);
  446. - bMarginThConfig=1;
  447. - }
  448. - }
  449. + dslhal_api_setMarginThreshold(pIhw, value);
  450. + bMarginThConfig=1;
  451. }
  452. }
  453. // rate adapt
  454. ptr = NULL;
  455. ptr = prom_getenv("enable_rate_adapt");
  456. - if(ptr)
  457. + if(ptr || mp_enable_rate_adapt != -1)
  458. {
  459. - dslhal_api_setRateAdaptFlag(pIhw, os_atoi(ptr));
  460. + dslhal_api_setRateAdaptFlag(pIhw, mp_enable_rate_adapt == -1 ? os_atoi(ptr) : mp_enable_rate_adapt);
  461. }
  462. // set powercutback
  463. ptr = NULL;
  464. ptr = prom_getenv("powercutback");
  465. - if(ptr)
  466. + if(ptr || mp_powercutback != -1)
  467. {
  468. - dslhal_advcfg_onOffPcb(pIhw, os_atoi(ptr));
  469. + dslhal_advcfg_onOffPcb(pIhw, mp_powercutback == -1 ? os_atoi(ptr) : mp_powercutback);
  470. }
  471. // trellis
  472. ptr = NULL;
  473. ptr = prom_getenv("trellis");
  474. - if(ptr)
  475. + if(ptr || mp_trellis != -1)
  476. {
  477. - dslhal_api_setTrellisFlag(pIhw, os_atoi(ptr));
  478. - trellis = os_atoi(ptr);
  479. + trellis = mp_trellis == -1 ? os_atoi(ptr) : mp_trellis;
  480. + dslhal_api_setTrellisFlag(pIhw, trellis);
  481. //printk("trellis=%d\n");
  482. }
  483. // bitswap
  484. ptr = NULL;
  485. ptr = prom_getenv("bitswap");
  486. - if(ptr)
  487. + if(ptr || mp_bitswap != -1)
  488. {
  489. int offset[2] = {33, 0};
  490. unsigned int bitswap;
  491. - bitswap = os_atoi(ptr);
  492. + bitswap = mp_bitswap == -1 ? os_atoi(ptr) : mp_bitswap;
  493. tn7dsl_generic_read(2, offset);
  494. dslReg &= dslhal_support_byteSwap32(0xFFFFFF00);
  495. @@ -3097,46 +3114,47 @@ static int tn7dsl_set_dsl(void)
  496. // maximum bits per carrier
  497. ptr = NULL;
  498. ptr = prom_getenv("maximum_bits_per_carrier");
  499. - if(ptr)
  500. + if(ptr || mp_maximum_bits_per_carrier != -1)
  501. {
  502. - dslhal_api_setMaxBitsPerCarrierUpstream(pIhw, os_atoi(ptr));
  503. + dslhal_api_setMaxBitsPerCarrierUpstream(pIhw, mp_maximum_bits_per_carrier == -1 ? os_atoi(ptr) : mp_maximum_bits_per_carrier);
  504. }
  505. // maximum interleave depth
  506. ptr = NULL;
  507. ptr = prom_getenv("maximum_interleave_depth");
  508. - if(ptr)
  509. + if(ptr || mp_maximum_interleave_depth != -1)
  510. {
  511. - dslhal_api_setMaxInterleaverDepth(pIhw, os_atoi(ptr));
  512. + dslhal_api_setMaxInterleaverDepth(pIhw, mp_maximum_interleave_depth == -1 ? os_atoi(ptr) : mp_maximum_interleave_depth);
  513. }
  514. // inner and outer pairs
  515. ptr = NULL;
  516. ptr = prom_getenv("pair_selection");
  517. - if(ptr)
  518. + if(ptr || mp_pair_selection != -1)
  519. {
  520. - dslhal_api_selectInnerOuterPair(pIhw, os_atoi(ptr));
  521. + dslhal_api_selectInnerOuterPair(pIhw, mp_pair_selection == -1 ? os_atoi(ptr) : mp_pair_selection);
  522. }
  523. ptr = NULL;
  524. ptr = prom_getenv("dgas_polarity");
  525. - if(ptr)
  526. + if(ptr || mp_dgas_polarity != -1)
  527. {
  528. dslhal_api_configureDgaspLpr(pIhw, 1, 1);
  529. - dslhal_api_configureDgaspLpr(pIhw, 0, os_atoi(ptr));
  530. + dslhal_api_configureDgaspLpr(pIhw, 0, mp_dgas_polarity == -1 ? os_atoi(ptr) : mp_dgas_polarity);
  531. }
  532. ptr = NULL;
  533. ptr = prom_getenv("los_alarm");
  534. - if(ptr)
  535. + if(ptr || mp_los_alarm != -1)
  536. {
  537. - dslhal_api_disableLosAlarm(pIhw, os_atoi(ptr));
  538. + dslhal_api_disableLosAlarm(pIhw, mp_los_alarm == -1 ? os_atoi(ptr) : mp_los_alarm);
  539. }
  540. ptr = NULL;
  541. ptr = prom_getenv("eoc_vendor_id");
  542. - if(ptr)
  543. + if(ptr || mp_eoc_vendor_id != NULL)
  544. {
  545. + ptr = mp_eoc_vendor_id == NULL ? ptr : mp_eoc_vendor_id;
  546. for(i=0;i<8;i++)
  547. {
  548. tmp[0]=ptr[i*2];
  549. @@ -3161,26 +3179,26 @@ static int tn7dsl_set_dsl(void)
  550. }
  551. ptr = NULL;
  552. ptr = prom_getenv("eoc_vendor_revision");
  553. - if(ptr)
  554. + if(ptr || mp_eoc_vendor_revision != -1)
  555. {
  556. - value = os_atoi(ptr);
  557. + value = mp_eoc_vendor_revision == -1 ? os_atoi(ptr) : mp_eoc_vendor_revision;
  558. //printk("eoc rev=%d\n", os_atoi(ptr));
  559. dslhal_api_setEocRevisionNumber(pIhw, (char *)&value);
  560. }
  561. ptr = NULL;
  562. ptr = prom_getenv("eoc_vendor_serialnum");
  563. - if(ptr)
  564. + if(ptr || mp_eoc_vendor_serialnum != NULL)
  565. {
  566. - dslhal_api_setEocSerialNumber(pIhw, ptr);
  567. + dslhal_api_setEocSerialNumber(pIhw, mp_eoc_vendor_serialnum == NULL ? ptr : mp_eoc_vendor_serialnum);
  568. }
  569. // CQ10037 Added invntry_vernum environment variable to be able to set version number in ADSL2, ADSL2+ modes.
  570. ptr = NULL;
  571. ptr = prom_getenv("invntry_vernum");
  572. - if(ptr)
  573. + if(ptr || mp_invntry_vernum != NULL)
  574. {
  575. - dslhal_api_setEocRevisionNumber(pIhw, ptr);
  576. + dslhal_api_setEocRevisionNumber(pIhw, mp_invntry_vernum == NULL ? ptr : mp_invntry_vernum);
  577. }
  578. return 0;
  579. @@ -3225,7 +3243,7 @@ int tn7dsl_init(void *priv)
  580. * backward compatibility.
  581. */
  582. cp = prom_getenv("DSL_BIT_TMODE");
  583. - if (cp)
  584. + if (cp || mp_dsl_bit_tmode != -1)
  585. {
  586. printk("%s : env var DSL_BIT_TMODE is set\n", __FUNCTION__);
  587. /*
  588. @@ -3254,9 +3272,9 @@ int tn7dsl_init(void *priv)
  589. // UR8_MERGE_START CQ11054 Jack Zhang
  590. cp = prom_getenv("high_precision");
  591. - if (cp)
  592. + if (cp || mp_high_precision != -1)
  593. {
  594. - high_precision_selected = os_atoi(cp);
  595. + high_precision_selected = mp_high_precision == -1 ? os_atoi(cp) : mp_high_precision;
  596. }
  597. if ( high_precision_selected)
  598. {
  599. --- a/tn7sar.c
  600. +++ b/tn7sar.c
  601. @@ -76,6 +76,8 @@ typedef void OS_SETUP;
  602. #include "tn7atm.h"
  603. #include "tn7api.h"
  604. +extern int mp_oam_lb_timeout;
  605. +extern int mp_autopvc_enable;
  606. /* PDSP Firmware files */
  607. #include "tnetd7300_sar_firm.h"
  608. @@ -932,9 +934,9 @@ int tn7sar_setup_oam_channel(Tn7AtmPriva
  609. pHalDev = (HAL_DEVICE *)priv->pSarHalDev;
  610. pauto_pvc = prom_getenv("autopvc_enable");
  611. - if(pauto_pvc) //CQ10273
  612. + if(pauto_pvc || mp_autopvc_enable != -1) //CQ10273
  613. {
  614. - auto_pvc =tn7sar_strtoul(pauto_pvc, NULL, 10);
  615. + auto_pvc = mp_autopvc_enable == -1 ? tn7sar_strtoul(pauto_pvc, NULL, 10) : mp_autopvc_enable;
  616. }
  617. memset(&chInfo, 0xff, sizeof(chInfo));
  618. @@ -1133,9 +1135,9 @@ int tn7sar_init(struct atm_dev *dev, Tn7
  619. /* read in oam lb timeout value */
  620. pLbTimeout = prom_getenv("oam_lb_timeout");
  621. - if(pLbTimeout)
  622. + if(pLbTimeout || mp_oam_lb_timeout != -1)
  623. {
  624. - lbTimeout =tn7sar_strtoul(pLbTimeout, NULL, 10);
  625. + lbTimeout = mp_oam_lb_timeout == -1 ? tn7sar_strtoul(pLbTimeout, NULL, 10) : mp_oam_lb_timeout;
  626. oamLbTimeout = lbTimeout;
  627. pHalFunc->Control(pHalDev,"OamLbTimeout", "Set", &lbTimeout);
  628. }