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