[AR7] updated DSL driver and firmware (closes #2532)
[10.03/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   2005-04-08 10:22:04.000000000 +0200
3 +++ sangam_atm-D7.03.01.00/cppi_cpaal5.c        2008-01-05 03:11:03.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   2007-03-07 04:13:06.000000000 +0100
15 +++ sangam_atm-D7.03.01.00/dsl_hal_api.c        2008-01-05 03:11:03.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       2007-05-18 09:47:33.000000000 +0200
39 +++ sangam_atm-D7.03.01.00/dsl_hal_support.c    2008-01-05 03:11:03.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       2005-11-11 09:07:04.000000000 +0100
55 +++ sangam_atm-D7.03.01.00/dsl_hal_support.h    2008-01-05 03:11:03.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        2005-06-01 05:46:28.000000000 +0200
67 +++ sangam_atm-D7.03.01.00/Makefile     2008-01-05 03:11:03.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        2007-05-18 09:45:50.000000000 +0200
95 +++ sangam_atm-D7.03.01.00/tn7atm.c     2008-01-05 03:11:03.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 @@ -704,8 +656,8 @@
224    {
225      def_sar_inter_pace = os_atoi (ptr);
226    }
227 -  avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
228 -                            def_sar_inter_pace);
229 +/*  avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
230 +                            def_sar_inter_pace);*/
231  
232    /*
233     * Reigster Receive interrupt A
234 @@ -875,11 +827,15 @@
235  #define ATM_VBR_RT     5
236  #endif
237  
238 -int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci)
239 +int tn7atm_open (struct atm_vcc *vcc)
240  {
241    tn7atm_activate_vc_parm_t tn7atm_activate_vc_parm;
242    int rc;
243    //int flags;
244 +  tn7atm_activate_vc_parm.pcr = 0x20000;
245 +  tn7atm_activate_vc_parm.scr = 0x20000;
246 +  tn7atm_activate_vc_parm.mbs = 0x20000;
247 +  tn7atm_activate_vc_parm.cdvt = 10000;
248  
249    dgprintf(1, "tn7atm_open()\n");
250  
251 @@ -891,24 +847,18 @@
252      return -1;
253    }
254  
255 -  MOD_INC_USE_COUNT;
256 +//  MOD_INC_USE_COUNT;
257  
258 -  /* find a free VPI/VCI */
259 -  tn7atm_walk_vccs(vcc, &vpi, &vci);
260 -
261 -  vcc->vpi = vpi;
262 -  vcc->vci = vci;
263 -
264 -  if ((vci == ATM_VCI_UNSPEC) || (vpi == ATM_VCI_UNSPEC))
265 +  if ((vcc->vci == ATM_VCI_UNSPEC) || (vcc->vpi == ATM_VCI_UNSPEC))
266    {
267 -    MOD_DEC_USE_COUNT;
268 +//    MOD_DEC_USE_COUNT;
269      return -EBUSY;
270    }
271  
272 -  tn7atm_activate_vc_parm.vpi = vpi;
273 -  tn7atm_activate_vc_parm.vci = vci;
274 +  tn7atm_activate_vc_parm.vpi = vcc->vpi;
275 +  tn7atm_activate_vc_parm.vci = vcc->vci;
276  
277 -  if ((vpi == CLEAR_EOC_VPI) && (vci == CLEAR_EOC_VCI))
278 +  if ((vcc->vpi == CLEAR_EOC_VPI) && (vcc->vci == CLEAR_EOC_VCI))
279    {
280      /* always use (max_dma_chan+1) for clear eoc */
281      tn7atm_activate_vc_parm.chan = EOC_DMA_CHAN;
282 @@ -916,7 +866,7 @@
283      /* check to see whether clear eoc is opened or not */
284      if (tn7atm_activate_vc_parm.priv->lut[tn7atm_activate_vc_parm.chan].inuse)
285      {
286 -      MOD_DEC_USE_COUNT;
287 +//      MOD_DEC_USE_COUNT;
288        printk("tn7atm_open: Clear EOC channel (dmachan=%d) already in use.\n", tn7atm_activate_vc_parm.chan);
289        return -EBUSY;
290      }
291 @@ -925,7 +875,7 @@
292      if (rc)
293      {
294        printk("tn7atm_open: failed to setup clear_eoc\n");
295 -      MOD_DEC_USE_COUNT;
296 +//      MOD_DEC_USE_COUNT;
297        return -EBUSY;
298      }
299      tn7atm_set_lut(tn7atm_activate_vc_parm.priv,vcc, tn7atm_activate_vc_parm.chan);
300 @@ -934,17 +884,17 @@
301    }
302    else  /* PVC channel setup */
303    {
304 -    if ((vpi==REMOTE_MGMT_VPI) && (vci==REMOTE_MGMT_VCI))
305 +    if ((vcc->vpi==REMOTE_MGMT_VPI) && (vcc->vci==REMOTE_MGMT_VCI))
306      {
307        tn7atm_activate_vc_parm.chan = 14;   /* always use chan 14 for MII PVC-base romote mgmt */
308      }
309      else
310      {
311 -       rc = tn7atm_lut_find(vpi, vci);
312 +       rc = tn7atm_lut_find(vcc->vpi, vcc->vci);
313        /* check to see whether PVC is opened or not */
314        if(ATM_NO_DMA_CHAN != rc)
315        {
316 -        MOD_DEC_USE_COUNT;
317 +//        MOD_DEC_USE_COUNT;
318          printk("PVC already opened. dmachan = %d\n", rc);
319          return -EBUSY;
320        }
321 @@ -976,6 +926,7 @@
322         tn7atm_activate_vc_parm.priority = 2;
323         break;
324  
325 +#if 0
326       case ATM_VBR: /* Variable Bit Rate-Non RealTime*/
327         tn7atm_activate_vc_parm.qos = 1;
328         tn7atm_activate_vc_parm.priority = 1;
329 @@ -997,6 +948,7 @@
330             tn7atm_activate_vc_parm.mbs = vcc->qos.txtp.max_pcr;
331         tn7atm_activate_vc_parm.cdvt = vcc->qos.txtp.max_cdv;
332         break;
333 +#endif
334  
335       default:
336           tn7atm_activate_vc_parm.qos = 2;
337 @@ -1024,7 +976,7 @@
338     if (rc < 0)
339     {
340        printk("failed to activate hw channel\n");
341 -      MOD_DEC_USE_COUNT;
342 +//      MOD_DEC_USE_COUNT;
343        tn7atm_lut_clear(vcc, tn7atm_activate_vc_parm.chan);
344        //spin_unlock_irqrestore(&chan_init_lock, flags);
345        return -EBUSY;
346 @@ -1114,7 +1066,7 @@
347    tn7atm_lut_clear (vcc, dmachan);
348    //spin_unlock_irqrestore (&closeLock, closeFlag);
349  
350 -  MOD_DEC_USE_COUNT;
351 +//  MOD_DEC_USE_COUNT;
352  
353    dgprintf (1, "Leave tn7atm_close\n");
354  }
355 @@ -1528,8 +1480,7 @@
356                                   * firewall is on */
357  
358    dgprintf (3, "pushing the skb...\n");
359 -
360 -  skb->stamp = vcc->timestamp = xtime;
361 +  __net_timestamp(skb);
362  
363    xdump ((unsigned char *) skb->data, skb->len, 5);
364  
365 @@ -1725,8 +1676,7 @@
366  
367    kfree (dev->dev_data);
368  
369 -  // atm_dev_deregister (dev);
370 -  shutdown_atm_dev (dev);
371 +  atm_dev_deregister (dev);
372  
373    /*
374     * remove proc entries
375 @@ -1885,9 +1835,6 @@
376    /*
377     * Set up proc entry for atm stats
378     */
379 -  if (tn7atm_xlate_proc_name
380 -      (drv_proc_root_folder, &root_proc_dir_entry, &residual))
381 -  {
382      printk ("Creating new root folder %s in the proc for the driver stats \n",
383              drv_proc_root_folder);
384      root_proc_dir_entry = proc_mkdir (drv_proc_root_folder, NULL);
385 @@ -1897,7 +1844,6 @@
386        return -ENOMEM;
387      }
388      proc_root_already_exists = FALSE;
389 -  }
390  
391    /*
392     * AV: Clean-up. Moved all the definitions to the data structure.
393 @@ -2479,7 +2425,5 @@
394      return count;
395  }
396  
397 -#ifdef MODULE
398  module_init (tn7atm_detect);
399  module_exit (tn7atm_exit);
400 -#endif /* MODULE */
401 diff -urN sangam_atm-D7.03.01.00.orig/tn7atm.h sangam_atm-D7.03.01.00/tn7atm.h
402 --- sangam_atm-D7.03.01.00.orig/tn7atm.h        2006-04-05 07:33:06.000000000 +0200
403 +++ sangam_atm-D7.03.01.00/tn7atm.h     2008-01-05 03:11:03.000000000 +0100
404 @@ -19,7 +19,8 @@
405  //#include  "mips_support.h"
406  #include  <linux/list.h>
407  
408 -#include <linux/config.h>
409 +#define MIPS_EXCEPTION_OFFSET 8
410 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
411  
412  #ifdef CONFIG_MODVERSIONS
413  #include <linux/modversions.h>
414 diff -urN sangam_atm-D7.03.01.00.orig/tn7dsl.c sangam_atm-D7.03.01.00/tn7dsl.c
415 --- sangam_atm-D7.03.01.00.orig/tn7dsl.c        2007-01-04 09:04:14.000000000 +0100
416 +++ sangam_atm-D7.03.01.00/tn7dsl.c     2008-01-05 03:11:03.000000000 +0100
417 @@ -94,7 +94,6 @@
418  *  1/02/07  JZ     CQ11054: Data Precision and Range Changes for TR-069 Conformance
419  *  UR8_MERGE_END   CQ11054*
420   *********************************************************************************************/
421 -#include <linux/config.h>
422  #include <linux/kernel.h>
423  #include <linux/module.h>
424  #include <linux/init.h>
425 @@ -102,8 +101,6 @@
426  #include <linux/delay.h>
427  #include <linux/spinlock.h>
428  #include <linux/smp_lock.h>
429 -#include <asm/io.h>
430 -#include <asm/mips-boards/prom.h>
431  #include <linux/proc_fs.h>
432  #include <linux/string.h>
433  #include <linux/ctype.h>
434 @@ -111,6 +108,12 @@
435  #include <linux/timer.h>
436  #include <linux/vmalloc.h>
437  #include <linux/file.h>
438 +#include <linux/firmware.h>
439 +
440 +#include <asm/io.h>
441 +#include <asm/ar7/ar7.h>
442 +#include <asm/ar7/prom.h>
443 +
444  /* Modules specific header files */
445  #include "tn7atm.h"
446  #include "tn7api.h"
447 @@ -323,6 +326,14 @@
448  #define gDot1(a) ((a>0)?(a%10):((-a)%10))
449  //  UR8_MERGE_END   CQ11054*
450  
451 +int avalanche_request_intr_pacing(int irq_nr, unsigned int blk_num,
452 +                            unsigned int pace_value)
453 +{
454 +       printk("avalanche_request_pacing(%d, %u, %u); // not implemented\n", irq_nr, blk_num, pace_value);
455 +       return 0;
456 +}
457 +
458 +
459  int os_atoi(const char *pStr)
460  {
461    int MulNeg = (*pStr == '-' ? -1 : 1);
462 @@ -359,39 +370,6 @@
463  #endif
464  }
465  
466 -int strcmp(const char *s1, const char *s2)
467 -{
468 -
469 -  int size = strlen(s1);
470 -
471 -  return(strncmp(s1, s2, size));
472 -}
473 -
474 -int strncmp(const char *s1, const char *s2, size_t size)
475 -{
476 -  int i = 0;
477 -  int max_size = (int)size;
478 -
479 -  while((s1[i] != 0) && i < max_size)
480 -  {
481 -    if(s2[i] == 0)
482 -    {
483 -      return -1;
484 -    }
485 -    if(s1[i] != s2[i])
486 -    {
487 -       return 1;
488 -    }
489 -    i++;
490 -  }
491 -  if(s2[i] != 0)
492 -  {
493 -    return 1;
494 -  }
495 -
496 -  return 0;
497 -}
498 -
499  // * UR8_MERGE_START CQ10640   Jack Zhang
500  int tn7dsl_dump_dsp_memory(char *input_str) //cph99
501    {
502 @@ -441,101 +419,74 @@
503    return CpuFrequency;
504  }
505  
506 -int shim_osLoadFWImage(unsigned char *ptr)
507 +static void avsar_release(struct device *dev)
508  {
509 -  unsigned int bytesRead;
510 -  mm_segment_t  oldfs;
511 -  static struct file *filp;
512 -  unsigned int imageLength=0x5ffff;
513 -
514 -
515 -  dgprintf(4, "tn7dsl_read_dsp()\n");
516 -
517 -  dgprintf(4,"open file %s\n", DSP_FIRMWARE_PATH);
518 -
519 -  filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
520 -  if(filp ==NULL)
521 -  {
522 -    printk("Failed: Could not open DSP binary file\n");
523 -          return -1;
524 -  }
525 -
526 -  if (filp->f_dentry != NULL)
527 -  {
528 -    if (filp->f_dentry->d_inode != NULL)
529 -    {
530 -      printk ("DSP binary filesize = %d bytes\n",
531 -              (int) filp->f_dentry->d_inode->i_size);
532 -      imageLength = (unsigned int)filp->f_dentry->d_inode->i_size + 0x200;
533 -    }
534 -  }
535 -
536 -  if (filp->f_op->read==NULL)
537 -          return -1;  /* File(system) doesn't allow reads */
538 -
539 -  /*
540 -   * Disable parameter checking
541 -   */
542 -  oldfs = get_fs();
543 -  set_fs(KERNEL_DS);
544 -
545 -  /*
546 -   * Now read bytes from postion "StartPos"
547 -   */
548 -  filp->f_pos = 0;
549 -
550 -  bytesRead = filp->f_op->read(filp,ptr,imageLength,&filp->f_pos);
551 -
552 -  dgprintf(4,"file length = %d\n", bytesRead);
553 -
554 -  set_fs(oldfs);
555 -
556 -  /*
557 -   * Close the file
558 -   */
559 -  fput(filp);
560 -
561 -  return bytesRead;
562 +       printk(KERN_DEBUG "avsar firmware released\n");
563  }
564  
565 +static struct device avsar = {
566 +       .bus_id    = "vlynq",
567 +       .release   = avsar_release,
568 +};
569  
570 -unsigned int shim_read_overlay_page (void *ptr, unsigned int secOffset,
571 -                                     unsigned int secLength)
572 +int shim_osLoadFWImage(unsigned char *ptr)
573  {
574 -  unsigned int bytesRead;
575 -  mm_segment_t  oldfs;
576 -  struct file *filp;
577 -
578 -  dgprintf(4,"shim_read_overlay_page\n");
579 -  //dgprintf(4,"sec offset=%d, sec length =%d\n", secOffset, secLength);
580 +       const struct firmware *fw_entry;
581 +       size_t size;
582  
583 -  filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
584 -  if(filp ==NULL)
585 -  {
586 -    printk("Failed: Could not open DSP binary file\n");
587 -          return -1;
588 -  }
589 -
590 -  if (filp->f_op->read==NULL)
591 -          return -1;  /* File(system) doesn't allow reads */
592 -
593 -  /*
594 -   * Now read bytes from postion "StartPos"
595 -   */
596 -
597 -  if(filp->f_op->llseek)
598 -    filp->f_op->llseek(filp,secOffset, 0);
599 -  oldfs = get_fs();
600 -  set_fs(KERNEL_DS);
601 -  filp->f_pos = secOffset;
602 -  bytesRead = filp->f_op->read(filp,ptr,secLength,&filp->f_pos);
603 -
604 -  set_fs(oldfs);
605 -  /*
606 -   * Close the file
607 -   */
608 -  fput(filp);
609 -  return bytesRead;
610 +       printk("requesting firmware image \"ar0700xx.bin\"\n");
611 +       if(device_register(&avsar) < 0) {
612 +               printk(KERN_ERR
613 +                       "avsar: device_register fails\n");
614 +               return -1;
615 +       }
616 +
617 +       if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
618 +               printk(KERN_ERR
619 +                       "avsar: Firmware not available\n");
620 +               device_unregister(&avsar);
621 +               return -1;
622 +       }
623 +       size = fw_entry->size;
624 +       device_unregister(&avsar);
625 +       if(size > 0x5ffff) {
626 +                       printk(KERN_ERR
627 +                       "avsar: Firmware too big (%d bytes)\n", size);
628 +                       release_firmware(fw_entry);
629 +                       return -1;
630 +               }
631 +       memcpy(ptr, fw_entry->data, size);
632 +       release_firmware(fw_entry);
633 +       return size;
634 +}
635 +
636 +unsigned int shim_read_overlay_page(void *ptr, unsigned int secOffset, unsigned int secLength)
637 +{
638 +       const struct firmware *fw_entry;
639 +
640 +       printk("requesting firmware image \"ar0700xx.bin\"\n");
641 +       if(device_register(&avsar) < 0) {
642 +               printk(KERN_ERR
643 +                       "avsar: device_register fails\n");
644 +               return -1;
645 +       }
646 +
647 +       if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
648 +               printk(KERN_ERR
649 +                       "avsar: Firmware not available\n");
650 +               device_unregister(&avsar);
651 +               return -1;
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  
665  int shim_osLoadDebugFWImage(unsigned char *ptr)
666 @@ -3442,7 +3393,7 @@
667     */
668    if(write)
669      {
670 -    ret = proc_dostring(ctl, write, filp, buffer, lenp);
671 +    ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
672  
673      switch (ctl->ctl_name)
674        {
675 @@ -3528,7 +3479,7 @@
676    else
677      {
678      len += sprintf(info+len, mod_req);
679 -    ret = proc_dostring(ctl, write, filp, buffer, lenp);
680 +    ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
681      }
682    return ret;
683  }
684 @@ -3558,8 +3509,7 @@
685    if (initialized == 1)
686      return;
687  
688 -  dslmod_sysctl_header = register_sysctl_table(dslmod_root_table, 1);
689 -  dslmod_root_table->child->de->owner = THIS_MODULE;
690 +  dslmod_sysctl_header = register_sysctl_table(dslmod_root_table);
691  
692    /*
693     * set the defaults
694 diff -urN sangam_atm-D7.03.01.00.orig/tn7sar.c sangam_atm-D7.03.01.00/tn7sar.c
695 --- sangam_atm-D7.03.01.00.orig/tn7sar.c        2007-05-18 09:46:30.000000000 +0200
696 +++ sangam_atm-D7.03.01.00/tn7sar.c     2008-01-05 03:11:03.000000000 +0100
697 @@ -42,7 +42,6 @@
698   * UR8_MERGE_END CQ10700
699   *******************************************************************************/
700  
701 -#include <linux/config.h>
702  #include <linux/kernel.h>
703  #include <linux/module.h>
704  #include <linux/init.h>
705 @@ -50,12 +49,13 @@
706  #include <linux/delay.h>
707  #include <linux/spinlock.h>
708  #include <linux/smp_lock.h>
709 -#include <asm/io.h>
710 -#include <asm/mips-boards/prom.h>
711  #include <linux/proc_fs.h>
712  #include <linux/string.h>
713  #include <linux/ctype.h>
714  
715 +#include <asm/io.h>
716 +#include <asm/ar7/ar7.h>
717 +#include <asm/ar7/prom.h>
718  
719  #define _CPHAL_AAL5
720  #define _CPHAL_SAR