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