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