45ac1b19f121e68101f1abd3b5d122f66e790993
[openwrt.git] / package / ar7-atm / patches / 100-compile_fix.patch
1 diff -urN sangam_atm-07.01.00.10/cppi_cpaal5.c sangam-atm-0.3/cppi_cpaal5.c
2 --- sangam_atm-07.01.00.10/cppi_cpaal5.c        2005-04-08 14:22:04.000000000 +0200
3 +++ sangam-atm-0.3/cppi_cpaal5.c        2007-04-17 13:45:11.000000000 +0200
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-07.01.00.10/dsl_hal_api.c sangam-atm-0.3/dsl_hal_api.c
14 --- sangam_atm-07.01.00.10/dsl_hal_api.c        2006-10-26 16:46:54.000000000 +0200
15 +++ sangam-atm-0.3/dsl_hal_api.c        2007-04-19 01:12:40.000000000 +0200
16 @@ -229,15 +229,15 @@
17  *  10/4/06  JZ     CQ10979: Request for TR-069 Support for RP7.1
18  *  UR8_MERGE_END   CQ10979*
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  static unsigned int hybrid_selected;
36  static unsigned int showtimeFlag = FALSE;
37 diff -urN sangam_atm-07.01.00.10/dsl_hal_support.c sangam-atm-0.3/dsl_hal_support.c
38 --- sangam_atm-07.01.00.10/dsl_hal_support.c    2006-08-11 21:17:38.000000000 +0200
39 +++ sangam-atm-0.3/dsl_hal_support.c    2007-04-19 01:13:30.000000000 +0200
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-07.01.00.10/dsl_hal_support.h sangam-atm-0.3/dsl_hal_support.h
54 --- sangam_atm-07.01.00.10/dsl_hal_support.h    2005-11-11 13:07:04.000000000 +0100
55 +++ sangam-atm-0.3/dsl_hal_support.h    2007-04-19 01:12:01.000000000 +0200
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-07.01.00.10/Makefile sangam-atm-0.3/Makefile
66 --- sangam_atm-07.01.00.10/Makefile     2005-06-01 09:46:28.000000000 +0200
67 +++ sangam-atm-0.3/Makefile     2007-04-19 01:09:02.000000000 +0200
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 += tn7atm.o tn7dsl.o tn7sar.o dsl_hal_api.o dsl_hal_support.o cpsar.o aal5sar.o
93 diff -urN sangam_atm-07.01.00.10/tn7atm.c sangam-atm-0.3/tn7atm.c
94 --- sangam_atm-07.01.00.10/tn7atm.c     2006-10-26 16:48:52.000000000 +0200
95 +++ sangam-atm-0.3/tn7atm.c     2007-04-18 15:34:05.000000000 +0200
96 @@ -58,7 +58,6 @@
97   *    UR8_MERGE_END   CQ10979*
98  *********************************************************************************************/
99  
100 -#include <linux/config.h>
101  #include <linux/kernel.h>
102  #include <linux/module.h>
103  #include <linux/init.h>
104 @@ -67,7 +66,7 @@
105  #include <linux/spinlock.h>
106  #include <linux/smp_lock.h>
107  #include <asm/io.h>
108 -#include <asm/mips-boards/prom.h>
109 +#include <asm/ar7/ar7.h>
110  #include <linux/proc_fs.h>
111  #include <linux/string.h>
112  #include <linux/ctype.h>
113 @@ -79,6 +78,7 @@
114  #include "dsl_hal_register.h"
115  
116  #ifdef MODULE
117 +MODULE_LICENSE("GPL");
118  MODULE_DESCRIPTION ("Tnetd73xx ATM Device Driver");
119  MODULE_AUTHOR ("Zhicheng Tang");
120  #endif
121 @@ -97,9 +97,9 @@
122  
123  /*end of externs */
124  
125 -#ifndef TI_STATIC_ALLOCATIONS
126 -#define TI_STATIC_ALLOCATIONS
127 -#endif
128 +//#ifndef TI_STATIC_ALLOCATIONS
129 +//#define TI_STATIC_ALLOCATIONS
130 +//#endif
131  
132  #define tn7atm_kfree_skb(x)     dev_kfree_skb(x)
133  
134 @@ -111,7 +111,7 @@
135  /* prototypes */
136  static int tn7atm_set_can_support_adsl2 (int can);
137  
138 -static int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci);
139 +static int tn7atm_open (struct atm_vcc *vcc);
140  
141  static void tn7atm_close (struct atm_vcc *vcc);
142  
143 @@ -254,13 +254,12 @@
144          getsockopt:     NULL,
145          setsockopt:     NULL,
146          send:           tn7atm_send,
147 -        sg_send:        NULL,
148          phy_put:        NULL,
149          phy_get:        NULL,
150          change_qos:     tn7atm_change_qos,
151  };
152  
153 -const char drv_proc_root_folder[] = "avalanche/";
154 +const char drv_proc_root_folder[] = "avalanche";
155  static struct proc_dir_entry *root_proc_dir_entry = NULL;
156  #define DRV_PROC_MODE 0644
157  static int proc_root_already_exists = TRUE;
158 @@ -549,56 +548,6 @@
159  
160  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
161   *
162 - *  Function: int tn7atm_walk_vccs(struct atm_dev *dev, short *vcc, int *vci)
163 - *
164 - *  Description: retrieve VPI/VCI for connection
165 - *
166 - *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
167 -static int tn7atm_walk_vccs (struct atm_vcc *vcc, short *vpi, int *vci)
168 -{
169 -  struct atm_vcc *walk;
170 -
171 -  /*
172 -   * find a free VPI
173 -   */
174 -  if (*vpi == ATM_VPI_ANY)
175 -  {
176 -
177 -    for (*vpi = 0, walk = vcc->dev->vccs; walk; walk = walk->next)
178 -    {
179 -
180 -      if ((walk->vci == *vci) && (walk->vpi == *vpi))
181 -      {
182 -        (*vpi)++;
183 -        walk = vcc->dev->vccs;
184 -      }
185 -    }
186 -  }
187 -
188 -  /*
189 -   * find a free VCI
190 -   */
191 -  if (*vci == ATM_VCI_ANY)
192 -  {
193 -
194 -    for (*vci = ATM_NOT_RSV_VCI, walk = vcc->dev->vccs; walk;
195 -         walk = walk->next)
196 -    {
197 -
198 -      if ((walk->vpi = *vpi) && (walk->vci == *vci))
199 -      {
200 -        *vci = walk->vci + 1;
201 -        walk = vcc->dev->vccs;
202 -      }
203 -    }
204 -  }
205 -
206 -  return 0;
207 -}
208 -
209 -
210 -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
211 - *
212   *  Function: int tn7atm_sar_irq(void)
213   *
214   *  Description: tnetd73xx SAR interrupt.
215 @@ -694,8 +643,8 @@
216    {
217      def_sar_inter_pace = os_atoi (ptr);
218    }
219 -  avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
220 -                            def_sar_inter_pace);
221 +/*  avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
222 +                            def_sar_inter_pace);*/
223  
224    /*
225     * Reigster Receive interrupt A
226 @@ -865,11 +814,15 @@
227  #define ATM_VBR_RT     5
228  #endif
229  
230 -int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci)
231 +int tn7atm_open (struct atm_vcc *vcc)
232  {
233    tn7atm_activate_vc_parm_t tn7atm_activate_vc_parm;
234    int rc;
235    //int flags;
236 +  tn7atm_activate_vc_parm.pcr = 0x20000;
237 +  tn7atm_activate_vc_parm.scr = 0x20000;
238 +  tn7atm_activate_vc_parm.mbs = 0x20000;
239 +  tn7atm_activate_vc_parm.cdvt = 10000;
240  
241    dgprintf(1, "tn7atm_open()\n");
242  
243 @@ -881,24 +834,18 @@
244      return -1;
245    }
246  
247 -  MOD_INC_USE_COUNT;
248 -
249 -  /* find a free VPI/VCI */
250 -  tn7atm_walk_vccs(vcc, &vpi, &vci);
251 -
252 -  vcc->vpi = vpi;
253 -  vcc->vci = vci;
254 +//  MOD_INC_USE_COUNT;
255  
256 -  if ((vci == ATM_VCI_UNSPEC) || (vpi == ATM_VCI_UNSPEC))
257 +  if ((vcc->vci == ATM_VCI_UNSPEC) || (vcc->vpi == ATM_VCI_UNSPEC))
258    {
259 -    MOD_DEC_USE_COUNT;
260 +//    MOD_DEC_USE_COUNT;
261      return -EBUSY;
262    }
263  
264 -  tn7atm_activate_vc_parm.vpi = vpi;
265 -  tn7atm_activate_vc_parm.vci = vci;
266 +  tn7atm_activate_vc_parm.vpi = vcc->vpi;
267 +  tn7atm_activate_vc_parm.vci = vcc->vci;
268  
269 -  if ((vpi == CLEAR_EOC_VPI) && (vci == CLEAR_EOC_VCI))
270 +  if ((vcc->vpi == CLEAR_EOC_VPI) && (vcc->vci == CLEAR_EOC_VCI))
271    {
272      /* always use (max_dma_chan+1) for clear eoc */
273      tn7atm_activate_vc_parm.chan = EOC_DMA_CHAN;
274 @@ -906,7 +853,7 @@
275      /* check to see whether clear eoc is opened or not */
276      if (tn7atm_activate_vc_parm.priv->lut[tn7atm_activate_vc_parm.chan].inuse)
277      {
278 -      MOD_DEC_USE_COUNT;
279 +//      MOD_DEC_USE_COUNT;
280        printk("tn7atm_open: Clear EOC channel (dmachan=%d) already in use.\n", tn7atm_activate_vc_parm.chan);
281        return -EBUSY;
282      }
283 @@ -915,7 +862,7 @@
284      if (rc)
285      {
286        printk("tn7atm_open: failed to setup clear_eoc\n");
287 -      MOD_DEC_USE_COUNT;
288 +//      MOD_DEC_USE_COUNT;
289        return -EBUSY;
290      }
291      tn7atm_set_lut(tn7atm_activate_vc_parm.priv,vcc, tn7atm_activate_vc_parm.chan);
292 @@ -924,17 +871,17 @@
293    }
294    else  /* PVC channel setup */
295    {
296 -    if ((vpi==REMOTE_MGMT_VPI) && (vci==REMOTE_MGMT_VCI))
297 +    if ((vcc->vpi==REMOTE_MGMT_VPI) && (vcc->vci==REMOTE_MGMT_VCI))
298      {
299        tn7atm_activate_vc_parm.chan = 14;   /* always use chan 14 for MII PVC-base romote mgmt */
300      }
301      else
302      {
303 -       rc = tn7atm_lut_find(vpi, vci);
304 +       rc = tn7atm_lut_find(vcc->vpi, vcc->vci);
305        /* check to see whether PVC is opened or not */
306        if(ATM_NO_DMA_CHAN != rc)
307        {
308 -        MOD_DEC_USE_COUNT;
309 +//        MOD_DEC_USE_COUNT;
310          printk("PVC already opened. dmachan = %d\n", rc);
311          return -EBUSY;
312        }
313 @@ -966,6 +913,7 @@
314         tn7atm_activate_vc_parm.priority = 2;
315         break;
316  
317 +#if 0
318       case ATM_VBR: /* Variable Bit Rate-Non RealTime*/
319         tn7atm_activate_vc_parm.qos = 1;
320         tn7atm_activate_vc_parm.priority = 1;
321 @@ -987,6 +935,7 @@
322             tn7atm_activate_vc_parm.mbs = vcc->qos.txtp.max_pcr;
323         tn7atm_activate_vc_parm.cdvt = vcc->qos.txtp.max_cdv;
324         break;
325 +#endif
326  
327       default:
328           tn7atm_activate_vc_parm.qos = 2;
329 @@ -1014,7 +963,7 @@
330     if (rc < 0)
331     {
332        printk("failed to activate hw channel\n");
333 -      MOD_DEC_USE_COUNT;
334 +//      MOD_DEC_USE_COUNT;
335        tn7atm_lut_clear(vcc, tn7atm_activate_vc_parm.chan);
336        //spin_unlock_irqrestore(&chan_init_lock, flags);
337        return -EBUSY;
338 @@ -1104,7 +1053,7 @@
339    tn7atm_lut_clear (vcc, dmachan);
340    //spin_unlock_irqrestore (&closeLock, closeFlag);
341  
342 -  MOD_DEC_USE_COUNT;
343 +//  MOD_DEC_USE_COUNT;
344  
345    dgprintf (1, "Leave tn7atm_close\n");
346  }
347 @@ -1518,8 +1467,11 @@
348                                   * firewall is on */
349  
350    dgprintf (3, "pushing the skb...\n");
351 -
352 -  skb->stamp = vcc->timestamp = xtime;
353 +  {
354 +    struct timeval tv;
355 +    do_gettimeofday(&tv);
356 +    skb_set_timestamp(skb, &tv);
357 +  }
358  
359    xdump ((unsigned char *) skb->data, skb->len, 5);
360  
361 @@ -1715,8 +1667,7 @@
362  
363    kfree (dev->dev_data);
364  
365 -  // atm_dev_deregister (dev);
366 -  shutdown_atm_dev (dev);
367 +  atm_dev_deregister (dev);
368  
369    /*
370     * remove proc entries
371 @@ -1875,9 +1826,6 @@
372    /*
373     * Set up proc entry for atm stats
374     */
375 -  if (tn7atm_xlate_proc_name
376 -      (drv_proc_root_folder, &root_proc_dir_entry, &residual))
377 -  {
378      printk ("Creating new root folder %s in the proc for the driver stats \n",
379              drv_proc_root_folder);
380      root_proc_dir_entry = proc_mkdir (drv_proc_root_folder, NULL);
381 @@ -1887,7 +1835,6 @@
382        return -ENOMEM;
383      }
384      proc_root_already_exists = FALSE;
385 -  }
386  
387    /*
388     * AV: Clean-up. Moved all the definitions to the data structure.
389 @@ -2469,7 +2416,5 @@
390      return count;
391  }
392  
393 -#ifdef MODULE
394  module_init (tn7atm_detect);
395  module_exit (tn7atm_exit);
396 -#endif /* MODULE */
397 diff -urN sangam_atm-07.01.00.10/tn7atm.h sangam-atm-0.3/tn7atm.h
398 --- sangam_atm-07.01.00.10/tn7atm.h     2006-04-05 11:33:06.000000000 +0200
399 +++ sangam-atm-0.3/tn7atm.h     2007-04-18 03:45:08.000000000 +0200
400 @@ -19,7 +19,8 @@
401  //#include  "mips_support.h"
402  #include  <linux/list.h>
403  
404 -#include <linux/config.h>
405 +#define MIPS_EXCEPTION_OFFSET 8
406 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
407  
408  #ifdef CONFIG_MODVERSIONS
409  #include <linux/modversions.h>
410 diff -urN sangam_atm-07.01.00.10/tn7dsl.c sangam-atm-0.3/tn7dsl.c
411 --- sangam_atm-07.01.00.10/tn7dsl.c     2006-10-26 16:48:44.000000000 +0200
412 +++ sangam-atm-0.3/tn7dsl.c     2007-04-18 15:45:58.000000000 +0200
413 @@ -88,7 +88,6 @@
414  *  10/4/06  JZ     CQ10979: Request for TR-069 Support for RP7.1
415  *  UR8_MERGE_END   CQ10979*
416   *********************************************************************************************/
417 -#include <linux/config.h>
418  #include <linux/kernel.h>
419  #include <linux/module.h>
420  #include <linux/init.h>
421 @@ -97,7 +96,7 @@
422  #include <linux/spinlock.h>
423  #include <linux/smp_lock.h>
424  #include <asm/io.h>
425 -#include <asm/mips-boards/prom.h>
426 +#include <asm/ar7/ar7.h>
427  #include <linux/proc_fs.h>
428  #include <linux/string.h>
429  #include <linux/ctype.h>
430 @@ -105,6 +104,8 @@
431  #include <linux/timer.h>
432  #include <linux/vmalloc.h>
433  #include <linux/file.h>
434 +#include <linux/firmware.h>
435 +
436  /* Modules specific header files */
437  #include "tn7atm.h"
438  #include "tn7api.h"
439 @@ -312,6 +313,14 @@
440  static int tn7dsl_proc_snr_print (char *buf, int count, int *eof, int data);
441  /* end of internal functions */
442  
443 +int avalanche_request_intr_pacing(int irq_nr, unsigned int blk_num,
444 +                            unsigned int pace_value)
445 +{
446 +       printk("avalanche_request_pacing(%d, %u, %u); // not implemented\n", irq_nr, blk_num, pace_value);
447 +       return 0;
448 +}
449 +
450 +
451  int os_atoi(const char *pStr)
452  {
453    int MulNeg = (*pStr == '-' ? -1 : 1);
454 @@ -348,39 +357,6 @@
455  #endif
456  }
457  
458 -int strcmp(const char *s1, const char *s2)
459 -{
460 -
461 -  int size = strlen(s1);
462 -
463 -  return(strncmp(s1, s2, size));
464 -}
465 -
466 -int strncmp(const char *s1, const char *s2, size_t size)
467 -{
468 -  int i = 0;
469 -  int max_size = (int)size;
470 -
471 -  while((s1[i] != 0) && i < max_size)
472 -  {
473 -    if(s2[i] == 0)
474 -    {
475 -      return -1;
476 -    }
477 -    if(s1[i] != s2[i])
478 -    {
479 -       return 1;
480 -    }
481 -    i++;
482 -  }
483 -  if(s2[i] != 0)
484 -  {
485 -    return 1;
486 -  }
487 -
488 -  return 0;
489 -}
490 -
491  // * UR8_MERGE_START CQ10640   Jack Zhang
492  int tn7dsl_dump_dsp_memory(char *input_str) //cph99
493    {
494 @@ -430,101 +406,72 @@
495    return CpuFrequency;
496  }
497  
498 -int shim_osLoadFWImage(unsigned char *ptr)
499 +static void avsar_release(struct device *dev)
500  {
501 -  unsigned int bytesRead;
502 -  mm_segment_t  oldfs;
503 -  static struct file *filp;
504 -  unsigned int imageLength=0x5ffff;
505 -
506 -
507 -  dgprintf(4, "tn7dsl_read_dsp()\n");
508 -
509 -  dgprintf(4,"open file %s\n", DSP_FIRMWARE_PATH);
510 -
511 -  filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
512 -  if(filp ==NULL)
513 -  {
514 -    printk("Failed: Could not open DSP binary file\n");
515 -          return -1;
516 -  }
517 -
518 -  if (filp->f_dentry != NULL)
519 -  {
520 -    if (filp->f_dentry->d_inode != NULL)
521 -    {
522 -      printk ("DSP binary filesize = %d bytes\n",
523 -              (int) filp->f_dentry->d_inode->i_size);
524 -      imageLength = (unsigned int)filp->f_dentry->d_inode->i_size + 0x200;
525 -    }
526 -  }
527 -
528 -  if (filp->f_op->read==NULL)
529 -          return -1;  /* File(system) doesn't allow reads */
530 -
531 -  /*
532 -   * Disable parameter checking
533 -   */
534 -  oldfs = get_fs();
535 -  set_fs(KERNEL_DS);
536 -
537 -  /*
538 -   * Now read bytes from postion "StartPos"
539 -   */
540 -  filp->f_pos = 0;
541 -
542 -  bytesRead = filp->f_op->read(filp,ptr,imageLength,&filp->f_pos);
543 -
544 -  dgprintf(4,"file length = %d\n", bytesRead);
545 -
546 -  set_fs(oldfs);
547 -
548 -  /*
549 -   * Close the file
550 -   */
551 -  fput(filp);
552 -
553 -  return bytesRead;
554 +       printk(KERN_DEBUG "avsar firmware released\n");
555  }
556  
557 +static struct device avsar = {
558 +       .bus_id    = "vlynq",
559 +       .release   = avsar_release,
560 +};
561  
562 -unsigned int shim_read_overlay_page (void *ptr, unsigned int secOffset,
563 -                                     unsigned int secLength)
564 +int shim_osLoadFWImage(unsigned char *ptr)
565  {
566 -  unsigned int bytesRead;
567 -  mm_segment_t  oldfs;
568 -  struct file *filp;
569 -
570 -  dgprintf(4,"shim_read_overlay_page\n");
571 -  //dgprintf(4,"sec offset=%d, sec length =%d\n", secOffset, secLength);
572 -
573 -  filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
574 -  if(filp ==NULL)
575 -  {
576 -    printk("Failed: Could not open DSP binary file\n");
577 -          return -1;
578 -  }
579 -
580 -  if (filp->f_op->read==NULL)
581 -          return -1;  /* File(system) doesn't allow reads */
582 -
583 -  /*
584 -   * Now read bytes from postion "StartPos"
585 -   */
586 -
587 -  if(filp->f_op->llseek)
588 -    filp->f_op->llseek(filp,secOffset, 0);
589 -  oldfs = get_fs();
590 -  set_fs(KERNEL_DS);
591 -  filp->f_pos = secOffset;
592 -  bytesRead = filp->f_op->read(filp,ptr,secLength,&filp->f_pos);
593 +       const struct firmware *fw_entry;
594  
595 -  set_fs(oldfs);
596 -  /*
597 -   * Close the file
598 -   */
599 -  fput(filp);
600 -  return bytesRead;
601 +       printk("requesting firmware image \"ar0700xx.bin\"\n");
602 +       if(device_register(&avsar) < 0) {
603 +               printk(KERN_ERR
604 +                       "avsar: device_register fails\n");
605 +               return -1;
606 +       }
607 +
608 +       if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
609 +               printk(KERN_ERR
610 +                       "avsar: Firmware not available\n");
611 +               device_unregister(&avsar);
612 +               return -1;
613 +       }
614 +       device_unregister(&avsar);
615 +       if(fw_entry->size > 0x5ffff) {
616 +                       printk(KERN_ERR
617 +                       "avsar: Firmware too big (%d bytes)\n", fw_entry->size);
618 +                       release_firmware(fw_entry);
619 +                       return -1;
620 +               }
621 +       memcpy(ptr, fw_entry->data, fw_entry->size);
622 +       release_firmware(fw_entry);
623 +       return fw_entry->size;
624 +}
625 +
626 +unsigned int shim_read_overlay_page(void *ptr, unsigned int secOffset, unsigned int secLength)
627 +{
628 +       const struct firmware *fw_entry;
629 +
630 +       printk("requesting firmware image \"ar0700xx.bin\"\n");
631 +       if(device_register(&avsar) < 0) {
632 +               printk(KERN_ERR
633 +                       "avsar: device_register fails\n");
634 +               return -1;
635 +       }
636 +
637 +       if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
638 +               printk(KERN_ERR
639 +                       "avsar: Firmware not available\n");
640 +               device_unregister(&avsar);
641 +               return -1;
642 +       }
643 +       device_unregister(&avsar);
644 +       if(fw_entry->size > secLength) {
645 +               printk(KERN_ERR
646 +                       "avsar: Firmware too big (%d bytes)\n", fw_entry->size);
647 +               release_firmware(fw_entry);
648 +               return -1;
649 +       }
650 +       memcpy(ptr + secOffset, fw_entry->data, secLength);
651 +       release_firmware(fw_entry);
652 +       return fw_entry->size;
653  }
654  
655  int shim_osLoadDebugFWImage(unsigned char *ptr)
656 @@ -3367,7 +3314,7 @@
657     */
658    if(write)
659      {
660 -    ret = proc_dostring(ctl, write, filp, buffer, lenp);
661 +    ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
662  
663      switch (ctl->ctl_name)
664        {
665 @@ -3453,7 +3400,7 @@
666    else
667      {
668      len += sprintf(info+len, mod_req);
669 -    ret = proc_dostring(ctl, write, filp, buffer, lenp);
670 +    ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
671      }
672    return ret;
673  }
674 diff -urN sangam_atm-07.01.00.10/tn7sar.c sangam-atm-0.3/tn7sar.c
675 --- sangam_atm-07.01.00.10/tn7sar.c     2006-07-27 10:34:42.000000000 +0200
676 +++ sangam-atm-0.3/tn7sar.c     2007-04-18 03:47:39.000000000 +0200
677 @@ -42,7 +42,6 @@
678   * UR8_MERGE_END CQ10700
679   *******************************************************************************/
680  
681 -#include <linux/config.h>
682  #include <linux/kernel.h>
683  #include <linux/module.h>
684  #include <linux/init.h>
685 @@ -51,7 +50,7 @@
686  #include <linux/spinlock.h>
687  #include <linux/smp_lock.h>
688  #include <asm/io.h>
689 -#include <asm/mips-boards/prom.h>
690 +#include <asm/ar7/ar7.h>
691  #include <linux/proc_fs.h>
692  #include <linux/string.h>
693  #include <linux/ctype.h>