100-compile_fix.patch 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  1. --- a/cppi_cpaal5.c
  2. +++ b/cppi_cpaal5.c
  3. @@ -360,7 +360,7 @@ static int halRxReturn(HAL_RECEIVEINFO *
  4. {
  5. /* malloc failed, add this RCB to Needs Buffer List */
  6. TempRcb->FragCount = 1; /*MJH+030417*/
  7. - (HAL_RCB *)TempRcb->Eop = TempRcb; /* GSG +030430 */
  8. + TempRcb->Eop = TempRcb; /* GSG +030430 */
  9. if(HalDev->NeedsCount < MAX_NEEDS) /* +MJH 030410 */
  10. { /* +MJH 030410 */
  11. --- a/dsl_hal_api.c
  12. +++ b/dsl_hal_api.c
  13. @@ -273,15 +273,15 @@
  14. * 09/15/07 CPH CQ11466 Added EFM support
  15. * 09/27/07 EYin CQ11929: Added NFEC/INP/Lp/Rp reporting for only ADSL2/2+ mode.
  16. ******************************************************************************/
  17. -#include <dev_host_interface.h>
  18. -#include <dsl_hal_register.h>
  19. -#include <dsl_hal_support.h>
  20. +#include "dev_host_interface.h"
  21. +#include "dsl_hal_register.h"
  22. +#include "dsl_hal_support.h"
  23. #ifndef NO_ADV_STATS
  24. -#include <dsl_hal_logtable.h>
  25. +#include "dsl_hal_logtable.h"
  26. #endif
  27. -#include <dsl_hal_version.h>
  28. +#include "dsl_hal_version.h"
  29. // UR8_MERGE_START CQ11054 Jack Zhang
  30. static unsigned int highprecision_selected = 0; //By default we use low precision for backward compt.
  31. --- a/dsl_hal_support.c
  32. +++ b/dsl_hal_support.c
  33. @@ -142,9 +142,9 @@
  34. * UR8_MERGE_START_END CQ11922 Tim
  35. * 04Sep07 0.14.00 Tim CQ11922: Added support for new scratchram for INP NDR tables
  36. *******************************************************************************/
  37. -#include <dev_host_interface.h>
  38. -#include <dsl_hal_register.h>
  39. -#include <dsl_hal_support.h>
  40. +#include "dev_host_interface.h"
  41. +#include "dsl_hal_register.h"
  42. +#include "dsl_hal_support.h"
  43. #define NUM_READ_RETRIES 3
  44. static unsigned int dslhal_support_adsl2ByteSwap32(unsigned int in32Bits);
  45. --- a/dsl_hal_support.h
  46. +++ b/dsl_hal_support.h
  47. @@ -49,7 +49,7 @@
  48. * 04Nov05 0.11.00 CPH Fixed T1413 mode got Zero DS/US rate when DSL_BIT_TMODE is set.
  49. *******************************************************************************/
  50. -#include <dsl_hal_api.h>
  51. +#include "dsl_hal_api.h"
  52. #define virtual2Physical(a) (((int)a)&~0xe0000000)
  53. /* External Function Prototype Declarations */
  54. --- a/Makefile
  55. +++ b/Makefile
  56. @@ -1,18 +1,9 @@
  57. -# File: drivers/atm/ti_evm3/Makefile
  58. #
  59. -# Makefile for the Texas Instruments EVM3 ADSL/ATM driver.
  60. +# Makefile for the TIATM device driver.
  61. #
  62. -#
  63. -# Copyright (c) 2000 Texas Instruments Incorporated.
  64. -# Jeff Harrell (jharrell@telogy.com)
  65. -# Viren Balar (vbalar@ti.com)
  66. -# Victor Wells (vwells@telogy.com)
  67. -#
  68. -include $(TOPDIR)/Rules.make
  69. -
  70. -
  71. -
  72. -
  73. -
  74. -
  75. +CONFIG_SANGAM_ATM=m
  76. +#EXTRA_CFLAGS += -DEL -I. -DPOST_SILICON -DCOMMON_NSP -DCONFIG_LED_MODULE -DDEREGISTER_LED -DNO_ACT
  77. +EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -DNO_ACT -D__NO__VOICE_PATCH__ -DEL
  78. +obj-$(CONFIG_SANGAM_ATM) := tiatm.o
  79. +tiatm-objs += cpsar.o aal5sar.o tn7sar.o tn7atm.o tn7dsl.o dsl_hal_api.o dsl_hal_support.o
  80. --- a/tn7atm.c
  81. +++ b/tn7atm.c
  82. @@ -66,7 +66,6 @@
  83. * 09/18/07 CPH CQ11466 Added EFM Support
  84. *********************************************************************************************/
  85. -#include <linux/config.h>
  86. #include <linux/kernel.h>
  87. #include <linux/module.h>
  88. #include <linux/init.h>
  89. @@ -74,11 +73,14 @@
  90. #include <linux/delay.h>
  91. #include <linux/spinlock.h>
  92. #include <linux/smp_lock.h>
  93. -#include <asm/io.h>
  94. -#include <asm/mips-boards/prom.h>
  95. #include <linux/proc_fs.h>
  96. #include <linux/string.h>
  97. #include <linux/ctype.h>
  98. +
  99. +#include <asm/io.h>
  100. +#include <asm/ar7/ar7.h>
  101. +#include <asm/ar7/prom.h>
  102. +
  103. #include "dsl_hal_api.h"
  104. #ifdef AR7_EFM
  105. #include "tn7efm.h"
  106. @@ -90,6 +92,7 @@
  107. #include "dsl_hal_register.h"
  108. #ifdef MODULE
  109. +MODULE_LICENSE("GPL");
  110. MODULE_DESCRIPTION ("Tnetd73xx ATM Device Driver");
  111. MODULE_AUTHOR ("Zhicheng Tang");
  112. #endif
  113. @@ -108,9 +111,9 @@ MODULE_AUTHOR ("Zhicheng Tang");
  114. /*end of externs */
  115. -#ifndef TI_STATIC_ALLOCATIONS
  116. -#define TI_STATIC_ALLOCATIONS
  117. -#endif
  118. +//#ifndef TI_STATIC_ALLOCATIONS
  119. +//#define TI_STATIC_ALLOCATIONS
  120. +//#endif
  121. #define tn7atm_kfree_skb(x) dev_kfree_skb(x)
  122. @@ -135,7 +138,7 @@ static int EnableQoS = FALSE;
  123. /* prototypes */
  124. static int tn7atm_set_can_support_adsl2 (int can);
  125. -static int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci);
  126. +static int tn7atm_open (struct atm_vcc *vcc);
  127. void tn7atm_close (struct atm_vcc *vcc);
  128. @@ -298,13 +301,12 @@ static const struct atmdev_ops tn7atm_op
  129. getsockopt: NULL,
  130. setsockopt: NULL,
  131. send: tn7atm_send,
  132. - sg_send: NULL,
  133. phy_put: NULL,
  134. phy_get: NULL,
  135. change_qos: tn7atm_change_qos,
  136. };
  137. -const char drv_proc_root_folder[] = "avalanche/";
  138. +const char drv_proc_root_folder[] = "avalanche";
  139. static struct proc_dir_entry *root_proc_dir_entry = NULL;
  140. #define DRV_PROC_MODE 0644
  141. static int proc_root_already_exists = TRUE;
  142. @@ -626,56 +628,6 @@ static int turbodsl_check_priority_type(
  143. /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  144. *
  145. - * Function: int tn7atm_walk_vccs(struct atm_dev *dev, short *vcc, int *vci)
  146. - *
  147. - * Description: retrieve VPI/VCI for connection
  148. - *
  149. - *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
  150. -static int tn7atm_walk_vccs (struct atm_vcc *vcc, short *vpi, int *vci)
  151. -{
  152. - struct atm_vcc *walk;
  153. -
  154. - /*
  155. - * find a free VPI
  156. - */
  157. - if (*vpi == ATM_VPI_ANY)
  158. - {
  159. -
  160. - for (*vpi = 0, walk = vcc->dev->vccs; walk; walk = walk->next)
  161. - {
  162. -
  163. - if ((walk->vci == *vci) && (walk->vpi == *vpi))
  164. - {
  165. - (*vpi)++;
  166. - walk = vcc->dev->vccs;
  167. - }
  168. - }
  169. - }
  170. -
  171. - /*
  172. - * find a free VCI
  173. - */
  174. - if (*vci == ATM_VCI_ANY)
  175. - {
  176. -
  177. - for (*vci = ATM_NOT_RSV_VCI, walk = vcc->dev->vccs; walk;
  178. - walk = walk->next)
  179. - {
  180. -
  181. - if ((walk->vpi = *vpi) && (walk->vci == *vci))
  182. - {
  183. - *vci = walk->vci + 1;
  184. - walk = vcc->dev->vccs;
  185. - }
  186. - }
  187. - }
  188. -
  189. - return 0;
  190. -}
  191. -
  192. -
  193. -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  194. - *
  195. * Function: int tn7atm_sar_irq(void)
  196. *
  197. * Description: tnetd73xx SAR interrupt.
  198. @@ -766,7 +718,7 @@ static int __init tn7atm_irq_request (st
  199. priv->sar_irq = LNXINTNUM (ATM_SAR_INT); /* Interrupt line # */
  200. - if (request_irq (priv->sar_irq, tn7atm_sar_irq, SA_INTERRUPT, "SAR ", dev))
  201. + if (request_irq (priv->sar_irq, tn7atm_sar_irq, IRQF_DISABLED, "SAR ", dev))
  202. printk ("Could not register tn7atm_sar_irq\n");
  203. /*
  204. @@ -777,8 +729,8 @@ static int __init tn7atm_irq_request (st
  205. {
  206. def_sar_inter_pace = os_atoi (ptr);
  207. }
  208. - avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
  209. - def_sar_inter_pace);
  210. + /* avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
  211. + def_sar_inter_pace); */
  212. #ifdef AR7_EFM
  213. @@ -790,7 +742,7 @@ static int __init tn7atm_irq_request (st
  214. * Reigster Receive interrupt A
  215. */
  216. priv->dsl_irq = LNXINTNUM (ATM_DSL_INT); /* Interrupt line # */
  217. - if (request_irq (priv->dsl_irq, tn7atm_dsl_irq, SA_INTERRUPT, "DSL ", dev))
  218. + if (request_irq (priv->dsl_irq, tn7atm_dsl_irq, IRQF_DISABLED, "DSL ", dev))
  219. printk ("Could not register tn7atm_dsl_irq\n");
  220. /***** VRB Tasklet Mode ****/
  221. @@ -958,11 +910,15 @@ static int __init tn7atm_get_ESI (struct
  222. #define ATM_VBR_RT 5
  223. #endif
  224. -int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci)
  225. +int tn7atm_open (struct atm_vcc *vcc)
  226. {
  227. tn7atm_activate_vc_parm_t tn7atm_activate_vc_parm;
  228. int rc;
  229. //int flags;
  230. + tn7atm_activate_vc_parm.pcr = 0x20000;
  231. + tn7atm_activate_vc_parm.scr = 0x20000;
  232. + tn7atm_activate_vc_parm.mbs = 0x20000;
  233. + tn7atm_activate_vc_parm.cdvt = 10000;
  234. dgprintf(1, "tn7atm_open()\n");
  235. @@ -974,24 +930,18 @@ int tn7atm_open (struct atm_vcc *vcc, sh
  236. return -1;
  237. }
  238. - MOD_INC_USE_COUNT;
  239. +// MOD_INC_USE_COUNT;
  240. - /* find a free VPI/VCI */
  241. - tn7atm_walk_vccs(vcc, &vpi, &vci);
  242. -
  243. - vcc->vpi = vpi;
  244. - vcc->vci = vci;
  245. -
  246. - if ((vci == ATM_VCI_UNSPEC) || (vpi == ATM_VCI_UNSPEC))
  247. + if ((vcc->vci == ATM_VCI_UNSPEC) || (vcc->vpi == ATM_VCI_UNSPEC))
  248. {
  249. - MOD_DEC_USE_COUNT;
  250. +// MOD_DEC_USE_COUNT;
  251. return -EBUSY;
  252. }
  253. - tn7atm_activate_vc_parm.vpi = vpi;
  254. - tn7atm_activate_vc_parm.vci = vci;
  255. + tn7atm_activate_vc_parm.vpi = vcc->vpi;
  256. + tn7atm_activate_vc_parm.vci = vcc->vci;
  257. - if ((vpi == CLEAR_EOC_VPI) && (vci == CLEAR_EOC_VCI))
  258. + if ((vcc->vpi == CLEAR_EOC_VPI) && (vcc->vci == CLEAR_EOC_VCI))
  259. {
  260. /* always use (max_dma_chan+1) for clear eoc */
  261. tn7atm_activate_vc_parm.chan = EOC_DMA_CHAN;
  262. @@ -999,7 +949,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
  263. /* check to see whether clear eoc is opened or not */
  264. if (tn7atm_activate_vc_parm.priv->lut[tn7atm_activate_vc_parm.chan].inuse)
  265. {
  266. - MOD_DEC_USE_COUNT;
  267. +// MOD_DEC_USE_COUNT;
  268. printk("tn7atm_open: Clear EOC channel (dmachan=%d) already in use.\n", tn7atm_activate_vc_parm.chan);
  269. return -EBUSY;
  270. }
  271. @@ -1008,7 +958,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
  272. if (rc)
  273. {
  274. printk("tn7atm_open: failed to setup clear_eoc\n");
  275. - MOD_DEC_USE_COUNT;
  276. +// MOD_DEC_USE_COUNT;
  277. return -EBUSY;
  278. }
  279. tn7atm_set_lut(tn7atm_activate_vc_parm.priv,vcc, tn7atm_activate_vc_parm.chan);
  280. @@ -1017,17 +967,17 @@ int tn7atm_open (struct atm_vcc *vcc, sh
  281. }
  282. else /* PVC channel setup */
  283. {
  284. - if ((vpi==REMOTE_MGMT_VPI) && (vci==REMOTE_MGMT_VCI))
  285. + if ((vcc->vpi==REMOTE_MGMT_VPI) && (vcc->vci==REMOTE_MGMT_VCI))
  286. {
  287. tn7atm_activate_vc_parm.chan = 14; /* always use chan 14 for MII PVC-base romote mgmt */
  288. }
  289. else
  290. {
  291. - rc = tn7atm_lut_find(vpi, vci);
  292. + rc = tn7atm_lut_find(vcc->vpi, vcc->vci);
  293. /* check to see whether PVC is opened or not */
  294. if(ATM_NO_DMA_CHAN != rc)
  295. {
  296. - MOD_DEC_USE_COUNT;
  297. +// MOD_DEC_USE_COUNT;
  298. printk("PVC already opened. dmachan = %d\n", rc);
  299. return -EBUSY;
  300. }
  301. @@ -1059,6 +1009,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
  302. tn7atm_activate_vc_parm.priority = 2;
  303. break;
  304. +#if 0
  305. case ATM_VBR: /* Variable Bit Rate-Non RealTime*/
  306. tn7atm_activate_vc_parm.qos = 1;
  307. tn7atm_activate_vc_parm.priority = 1;
  308. @@ -1080,6 +1031,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
  309. tn7atm_activate_vc_parm.mbs = vcc->qos.txtp.max_pcr;
  310. tn7atm_activate_vc_parm.cdvt = vcc->qos.txtp.max_cdv;
  311. break;
  312. +#endif
  313. default:
  314. tn7atm_activate_vc_parm.qos = 2;
  315. @@ -1107,7 +1059,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
  316. if (rc < 0)
  317. {
  318. printk("failed to activate hw channel\n");
  319. - MOD_DEC_USE_COUNT;
  320. +// MOD_DEC_USE_COUNT;
  321. tn7atm_lut_clear(vcc, tn7atm_activate_vc_parm.chan);
  322. //spin_unlock_irqrestore(&chan_init_lock, flags);
  323. return -EBUSY;
  324. @@ -1197,7 +1149,7 @@ void tn7atm_close (struct atm_vcc *vcc)
  325. tn7atm_lut_clear (vcc, dmachan);
  326. //spin_unlock_irqrestore (&closeLock, closeFlag);
  327. - MOD_DEC_USE_COUNT;
  328. +// MOD_DEC_USE_COUNT;
  329. dgprintf (1, "Leave tn7atm_close\n");
  330. }
  331. @@ -1630,8 +1582,7 @@ int tn7atm_receive (void *os_dev, int ch
  332. * firewall is on */
  333. dgprintf (3, "pushing the skb...\n");
  334. -
  335. - skb->stamp = vcc->timestamp = xtime;
  336. + __net_timestamp(skb);
  337. xdump ((unsigned char *) skb->data, skb->len, 5);
  338. @@ -1854,8 +1805,7 @@ printk("!!!free atm irq: tn7atm_exit\n")
  339. kfree (dev->dev_data);
  340. - // atm_dev_deregister (dev);
  341. - shutdown_atm_dev (dev);
  342. + atm_dev_deregister (dev);
  343. /*
  344. * remove proc entries
  345. @@ -2086,9 +2036,6 @@ static int __init tn7atm_detect (void)
  346. * Set up proc entry for atm stats
  347. */
  348. - if (tn7atm_xlate_proc_name
  349. - (drv_proc_root_folder, &root_proc_dir_entry, &residual))
  350. - {
  351. printk ("Creating new root folder %s in the proc for the driver stats \n",
  352. drv_proc_root_folder);
  353. root_proc_dir_entry = proc_mkdir (drv_proc_root_folder, NULL);
  354. @@ -2098,7 +2045,6 @@ static int __init tn7atm_detect (void)
  355. return -ENOMEM;
  356. }
  357. proc_root_already_exists = FALSE;
  358. - }
  359. /*
  360. @@ -2731,7 +2677,5 @@ int tn7atm_proc_turbodsl_write(struct fi
  361. return count;
  362. }
  363. -#ifdef MODULE
  364. module_init (tn7atm_detect);
  365. module_exit (tn7atm_exit);
  366. -#endif /* MODULE */
  367. --- a/tn7atm.h
  368. +++ b/tn7atm.h
  369. @@ -20,7 +20,8 @@
  370. //#include "mips_support.h"
  371. #include <linux/list.h>
  372. -#include <linux/config.h>
  373. +#define MIPS_EXCEPTION_OFFSET 8
  374. +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
  375. #ifdef CONFIG_MODVERSIONS
  376. #include <linux/modversions.h>
  377. --- a/tn7dsl.c
  378. +++ b/tn7dsl.c
  379. @@ -102,7 +102,6 @@
  380. * UR8_MERGE_END CQ11813
  381. * 09/18/07 CPH CQ11466: Added EFM support.
  382. *********************************************************************************************/
  383. -#include <linux/config.h>
  384. #include <linux/kernel.h>
  385. #include <linux/module.h>
  386. #include <linux/init.h>
  387. @@ -110,8 +109,6 @@
  388. #include <linux/delay.h>
  389. #include <linux/spinlock.h>
  390. #include <linux/smp_lock.h>
  391. -#include <asm/io.h>
  392. -#include <asm/mips-boards/prom.h>
  393. #include <linux/proc_fs.h>
  394. #include <linux/string.h>
  395. #include <linux/ctype.h>
  396. @@ -119,6 +116,12 @@
  397. #include <linux/timer.h>
  398. #include <linux/vmalloc.h>
  399. #include <linux/file.h>
  400. +#include <linux/firmware.h>
  401. +
  402. +#include <asm/io.h>
  403. +#include <asm/ar7/ar7.h>
  404. +#include <asm/ar7/prom.h>
  405. +
  406. /* Modules specific header files */
  407. #ifdef AR7_EFM
  408. #include "tn7efm.h"
  409. @@ -185,7 +188,7 @@ led_reg_t ledreg[2];
  410. static struct led_funcs ledreg[2];
  411. #endif
  412. -#define DEV_DSLMOD 1
  413. +#define DEV_DSLMOD CTL_UNNUMBERED
  414. #define MAX_STR_SIZE 256
  415. #define DSL_MOD_SIZE 256
  416. @@ -316,7 +319,7 @@ static PITIDSLHW_T pIhw;
  417. static volatile int bshutdown;
  418. static char info[MAX_STR_SIZE];
  419. /* Used for DSL Polling enable */
  420. -static DECLARE_MUTEX_LOCKED (adsl_sem_overlay);
  421. +static struct semaphore adsl_sem_overlay;
  422. //kthread_t overlay_thread;
  423. /* end of module wide declars */
  424. @@ -369,6 +372,14 @@ int os_atoih (const char *pstr)
  425. return val;
  426. }
  427. +int avalanche_request_intr_pacing(int irq_nr, unsigned int blk_num,
  428. + unsigned int pace_value)
  429. +{
  430. + printk("avalanche_request_pacing(%d, %u, %u); // not implemented\n", irq_nr, blk_num, pace_value);
  431. + return 0;
  432. +}
  433. +
  434. +
  435. int os_atoi(const char *pStr)
  436. {
  437. int MulNeg = (*pStr == '-' ? -1 : 1);
  438. @@ -405,39 +416,6 @@ void dprintf (int uDbgLevel, char *szFmt
  439. #endif
  440. }
  441. -int strcmp(const char *s1, const char *s2)
  442. -{
  443. -
  444. - int size = strlen(s1);
  445. -
  446. - return(strncmp(s1, s2, size));
  447. -}
  448. -
  449. -int strncmp(const char *s1, const char *s2, size_t size)
  450. -{
  451. - int i = 0;
  452. - int max_size = (int)size;
  453. -
  454. - while((s1[i] != 0) && i < max_size)
  455. - {
  456. - if(s2[i] == 0)
  457. - {
  458. - return -1;
  459. - }
  460. - if(s1[i] != s2[i])
  461. - {
  462. - return 1;
  463. - }
  464. - i++;
  465. - }
  466. - if(s2[i] != 0)
  467. - {
  468. - return 1;
  469. - }
  470. -
  471. - return 0;
  472. -}
  473. -
  474. // * UR8_MERGE_START CQ10640 Jack Zhang
  475. int tn7dsl_dump_dsp_memory(char *input_str) //cph99
  476. {
  477. @@ -487,144 +465,78 @@ unsigned int shim_osGetCpuFrequency(void
  478. return CpuFrequency;
  479. }
  480. -int shim_osLoadFWImage(unsigned char *ptr)
  481. +static void avsar_release(struct device *dev)
  482. {
  483. - unsigned int bytesRead;
  484. - mm_segment_t oldfs;
  485. - static struct file *filp;
  486. - unsigned int imageLength=0x5ffff;
  487. -
  488. -#ifdef AR7_EFM
  489. - int dp_alt=0;
  490. - char *ptr1=NULL;
  491. -#ifdef EFM_DEBUG
  492. - char *ptr2=NULL;
  493. - char *ptr3=NULL;
  494. -#endif
  495. -
  496. - if ((ptr1 = prom_getenv("DSL_DP_ALT")) != NULL)
  497. - {
  498. - dp_alt=os_atoi(ptr1);
  499. - if (dp_alt==1)
  500. - {
  501. - filp = filp_open(DSP_DEBUG_FIRMWARE_PATH,00,O_RDONLY);
  502. - if (!IS_ERR(filp))
  503. - {
  504. - strcpy (DSP_FIRMWARE_PATH, DSP_DEBUG_FIRMWARE_PATH);
  505. - }
  506. - }
  507. -#ifdef EFM_DEBUG
  508. - else if (dp_alt==2)
  509. - {
  510. - if ((ptr2 = prom_getenv("DSL_DP")) != NULL)
  511. - {
  512. - if (!strncmp(ptr2, "DSL_DP", 6))
  513. - { // indirect naming
  514. - if ((ptr3 = prom_getenv(ptr2)) != NULL)
  515. - filp = filp_open(ptr3,00,O_RDONLY);
  516. - ptr2 = ptr3; // redirect ptr2 to ptr3
  517. - }
  518. -
  519. - filp = filp_open(ptr2,00,O_RDONLY);
  520. - if (!IS_ERR(filp))
  521. - {
  522. - strcpy (DSP_FIRMWARE_PATH, ptr2);
  523. - }
  524. - }
  525. - }
  526. - printk("dp_path=%s\n", DSP_FIRMWARE_PATH);
  527. -#endif
  528. - }
  529. -#endif
  530. -
  531. - dgprintf(4, "tn7dsl_read_dsp()\n");
  532. -
  533. - dgprintf(4,"open file %s\n", DSP_FIRMWARE_PATH);
  534. -
  535. - filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
  536. - if(IS_ERR(filp))
  537. - {
  538. - printk("Failed: Could not open DSP binary file\n");
  539. - return -1;
  540. - }
  541. -
  542. - if (filp->f_dentry != NULL)
  543. - {
  544. - if (filp->f_dentry->d_inode != NULL)
  545. - {
  546. - printk ("DSP binary filesize = %d bytes\n",
  547. - (int) filp->f_dentry->d_inode->i_size);
  548. - imageLength = (unsigned int)filp->f_dentry->d_inode->i_size + 0x200;
  549. - }
  550. - }
  551. -
  552. - if (filp->f_op->read==NULL)
  553. - return -1; /* File(system) doesn't allow reads */
  554. -
  555. - /*
  556. - * Disable parameter checking
  557. - */
  558. - oldfs = get_fs();
  559. - set_fs(KERNEL_DS);
  560. -
  561. - /*
  562. - * Now read bytes from postion "StartPos"
  563. - */
  564. - filp->f_pos = 0;
  565. -
  566. - bytesRead = filp->f_op->read(filp,ptr,imageLength,&filp->f_pos);
  567. -
  568. - dgprintf(4,"file length = %d\n", bytesRead);
  569. -
  570. - set_fs(oldfs);
  571. -
  572. - /*
  573. - * Close the file
  574. - */
  575. - fput(filp);
  576. -
  577. - return bytesRead;
  578. + printk(KERN_DEBUG "avsar firmware released\n");
  579. }
  580. +static struct device avsar = {
  581. + .bus_id = "vlynq",
  582. + .release = avsar_release,
  583. +};
  584. -unsigned int shim_read_overlay_page (void *ptr, unsigned int secOffset,
  585. - unsigned int secLength)
  586. +int shim_osLoadFWImage(unsigned char *ptr)
  587. {
  588. - unsigned int bytesRead;
  589. - mm_segment_t oldfs;
  590. - struct file *filp;
  591. -
  592. - dgprintf(4,"shim_read_overlay_page\n");
  593. - //dgprintf(4,"sec offset=%d, sec length =%d\n", secOffset, secLength);
  594. + const struct firmware *fw_entry;
  595. + size_t size;
  596. - filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
  597. - if(filp ==NULL)
  598. - {
  599. - printk("Failed: Could not open DSP binary file\n");
  600. - return -1;
  601. - }
  602. -
  603. - if (filp->f_op->read==NULL)
  604. - return -1; /* File(system) doesn't allow reads */
  605. -
  606. - /*
  607. - * Now read bytes from postion "StartPos"
  608. - */
  609. + printk("requesting firmware image \"ar0700xx.bin\"\n");
  610. + if(device_register(&avsar) < 0) {
  611. + printk(KERN_ERR
  612. + "avsar: device_register fails\n");
  613. + return -1;
  614. + }
  615. +
  616. + if (request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
  617. + printk(KERN_ERR
  618. + "avsar: Firmware not available\n");
  619. + device_unregister(&avsar);
  620. + return -1;
  621. + }
  622. + size = fw_entry->size;
  623. + device_unregister(&avsar);
  624. + if (size > 0x6ffff) {
  625. + printk(KERN_ERR
  626. + "avsar: Firmware too big (%d bytes)\n", size);
  627. + release_firmware(fw_entry);
  628. + return -1;
  629. + }
  630. + memcpy(ptr, fw_entry->data, size);
  631. + release_firmware(fw_entry);
  632. + return size;
  633. +}
  634. +
  635. +unsigned int shim_read_overlay_page(void *ptr, unsigned int secOffset, unsigned int secLength)
  636. +{
  637. + const struct firmware *fw_entry;
  638. +
  639. + printk("requesting firmware image \"ar0700xx.bin\"\n");
  640. + if (device_register(&avsar) < 0) {
  641. + printk(KERN_ERR
  642. + "avsar: device_register fails\n");
  643. + return -1;
  644. + }
  645. +
  646. + if (request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
  647. + printk(KERN_ERR
  648. + "avsar: Firmware not available\n");
  649. + device_unregister(&avsar);
  650. + return -1;
  651. + }
  652. +
  653. + device_unregister(&avsar);
  654. + if (fw_entry->size > secLength) {
  655. + printk(KERN_ERR
  656. + "avsar: Firmware too big (%d bytes)\n", fw_entry->size);
  657. + release_firmware(fw_entry);
  658. + return -1;
  659. + }
  660. + memcpy(ptr + secOffset, fw_entry->data, secLength);
  661. + release_firmware(fw_entry);
  662. + return secLength;
  663. +}
  664. - if(filp->f_op->llseek)
  665. - filp->f_op->llseek(filp,secOffset, 0);
  666. - oldfs = get_fs();
  667. - set_fs(KERNEL_DS);
  668. - filp->f_pos = secOffset;
  669. - bytesRead = filp->f_op->read(filp,ptr,secLength,&filp->f_pos);
  670. - set_fs(oldfs);
  671. - /*
  672. - * Close the file
  673. - */
  674. - fput(filp);
  675. - return bytesRead;
  676. -}
  677. int shim_osLoadDebugFWImage(unsigned char *ptr)
  678. {
  679. @@ -3287,6 +3199,7 @@ int tn7dsl_init(void *priv)
  680. int high_precision_selected = 0;
  681. // UR8_MERGE_END CQ11054*
  682. + sema_init(&adsl_sem_overlay, 0);
  683. /*
  684. * start dsl
  685. */
  686. @@ -3665,7 +3578,7 @@ static int dslmod_sysctl(ctl_table *ctl,
  687. */
  688. if(write)
  689. {
  690. - ret = proc_dostring(ctl, write, filp, buffer, lenp);
  691. + ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
  692. switch (ctl->ctl_name)
  693. {
  694. @@ -3751,14 +3664,14 @@ static int dslmod_sysctl(ctl_table *ctl,
  695. else
  696. {
  697. len += sprintf(info+len, mod_req);
  698. - ret = proc_dostring(ctl, write, filp, buffer, lenp);
  699. + ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
  700. }
  701. return ret;
  702. }
  703. ctl_table dslmod_table[] = {
  704. - {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, &dslmod_sysctl}
  705. + {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, NULL, &dslmod_sysctl, &sysctl_string}
  706. ,
  707. {0}
  708. };
  709. @@ -3781,8 +3694,7 @@ void tn7dsl_dslmod_sysctl_register(void)
  710. if (initialized == 1)
  711. return;
  712. - dslmod_sysctl_header = register_sysctl_table(dslmod_root_table, 1);
  713. - dslmod_root_table->child->de->owner = THIS_MODULE;
  714. + dslmod_sysctl_header = register_sysctl_table(dslmod_root_table);
  715. /*
  716. * set the defaults
  717. --- a/tn7sar.c
  718. +++ b/tn7sar.c
  719. @@ -43,7 +43,6 @@
  720. * 09/18/07 CPH CQ11466: Added EFM support.
  721. *******************************************************************************/
  722. -#include <linux/config.h>
  723. #include <linux/kernel.h>
  724. #include <linux/module.h>
  725. #include <linux/init.h>
  726. @@ -51,12 +50,13 @@
  727. #include <linux/delay.h>
  728. #include <linux/spinlock.h>
  729. #include <linux/smp_lock.h>
  730. -#include <asm/io.h>
  731. -#include <asm/mips-boards/prom.h>
  732. #include <linux/proc_fs.h>
  733. #include <linux/string.h>
  734. #include <linux/ctype.h>
  735. +#include <asm/io.h>
  736. +#include <asm/ar7/ar7.h>
  737. +#include <asm/ar7/prom.h>
  738. #define _CPHAL_AAL5
  739. #define _CPHAL_SAR