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