1 diff -urN sangam_atm-07.02.01.00/cppi_cpaal5.c sangam_atm-07.02.01.00/cppi_cpaal5.c
2 --- sangam_atm-07.02.01.00/cppi_cpaal5.c 2007-08-06 18:15:52.000000000 +0200
3 +++ sangam_atm-07.02.01.00/cppi_cpaal5.c 2007-08-06 18:58:42.000000000 +0200
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 */
11 if(HalDev->NeedsCount < MAX_NEEDS) /* +MJH 030410 */
13 diff -urN sangam_atm-07.02.01.00/dsl_hal_api.c sangam_atm-07.02.01.00/dsl_hal_api.c
14 --- sangam_atm-07.02.01.00/dsl_hal_api.c 2007-08-06 18:15:52.000000000 +0200
15 +++ sangam_atm-07.02.01.00/dsl_hal_api.c 2007-08-06 18:58:42.000000000 +0200
17 * UR8_MERGE_START_END CQ11247_TR69_DS_LATN_SATN YW
18 * 12/18/06 Yan Wang CQ11247: TR069 range and precision changes for LATNds, SATNds
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"
28 -#include <dsl_hal_logtable.h>
29 +#include "dsl_hal_logtable.h"
32 -#include <dsl_hal_version.h>
33 +#include "dsl_hal_version.h"
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-07.02.01.00/dsl_hal_support.c sangam_atm-07.02.01.00/dsl_hal_support.c
38 --- sangam_atm-07.02.01.00/dsl_hal_support.c 2007-08-06 18:15:52.000000000 +0200
39 +++ sangam_atm-07.02.01.00/dsl_hal_support.c 2007-08-06 18:58:42.000000000 +0200
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"
51 #define NUM_READ_RETRIES 3
52 static unsigned int dslhal_support_adsl2ByteSwap32(unsigned int in32Bits);
53 diff -urN sangam_atm-07.02.01.00/dsl_hal_support.h sangam_atm-07.02.01.00/dsl_hal_support.h
54 --- sangam_atm-07.02.01.00/dsl_hal_support.h 2007-08-06 18:15:52.000000000 +0200
55 +++ sangam_atm-07.02.01.00/dsl_hal_support.h 2007-08-06 18:58:42.000000000 +0200
57 * 04Nov05 0.11.00 CPH Fixed T1413 mode got Zero DS/US rate when DSL_BIT_TMODE is set.
58 *******************************************************************************/
60 -#include <dsl_hal_api.h>
61 +#include "dsl_hal_api.h"
63 #define virtual2Physical(a) (((int)a)&~0xe0000000)
64 /* External Function Prototype Declarations */
65 diff -urN sangam_atm-07.02.01.00/Makefile sangam_atm-07.02.01.00/Makefile
66 --- sangam_atm-07.02.01.00/Makefile 2007-08-06 18:15:52.000000000 +0200
67 +++ sangam_atm-07.02.01.00/Makefile 2007-08-06 18:58:42.000000000 +0200
69 -# File: drivers/atm/ti_evm3/Makefile
71 -# Makefile for the Texas Instruments EVM3 ADSL/ATM driver.
72 +# Makefile for the TIATM device driver.
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)
80 -include $(TOPDIR)/Rules.make
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-07.02.01.00/tn7atm.c sangam_atm-07.02.01.00/tn7atm.c
94 --- sangam_atm-07.02.01.00/tn7atm.c 2007-08-06 18:15:52.000000000 +0200
95 +++ sangam_atm-07.02.01.00/tn7atm.c 2007-08-06 18:58:42.000000000 +0200
97 * UR8_MERGE_END CQ11057*
98 *********************************************************************************************/
100 -#include <linux/config.h>
101 #include <linux/kernel.h>
102 #include <linux/module.h>
103 #include <linux/init.h>
105 #include <linux/spinlock.h>
106 #include <linux/smp_lock.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>
114 #include "dsl_hal_register.h"
117 +MODULE_LICENSE("GPL");
118 MODULE_DESCRIPTION ("Tnetd73xx ATM Device Driver");
119 MODULE_AUTHOR ("Zhicheng Tang");
125 -#ifndef TI_STATIC_ALLOCATIONS
126 -#define TI_STATIC_ALLOCATIONS
128 +//#ifndef TI_STATIC_ALLOCATIONS
129 +//#define TI_STATIC_ALLOCATIONS
132 #define tn7atm_kfree_skb(x) dev_kfree_skb(x)
136 static int tn7atm_set_can_support_adsl2 (int can);
138 -static int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci);
139 +static int tn7atm_open (struct atm_vcc *vcc);
141 static void tn7atm_close (struct atm_vcc *vcc);
143 @@ -257,13 +257,12 @@
150 change_qos: tn7atm_change_qos,
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;
160 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162 - * Function: int tn7atm_walk_vccs(struct atm_dev *dev, short *vcc, int *vci)
164 - * Description: retrieve VPI/VCI for connection
166 - *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
167 -static int tn7atm_walk_vccs (struct atm_vcc *vcc, short *vpi, int *vci)
169 - struct atm_vcc *walk;
174 - if (*vpi == ATM_VPI_ANY)
177 - for (*vpi = 0, walk = vcc->dev->vccs; walk; walk = walk->next)
180 - if ((walk->vci == *vci) && (walk->vpi == *vpi))
183 - walk = vcc->dev->vccs;
191 - if (*vci == ATM_VCI_ANY)
194 - for (*vci = ATM_NOT_RSV_VCI, walk = vcc->dev->vccs; walk;
198 - if ((walk->vpi = *vpi) && (walk->vci == *vci))
200 - *vci = walk->vci + 1;
201 - walk = vcc->dev->vccs;
210 -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
212 * Function: int tn7atm_sar_irq(void)
214 * Description: tnetd73xx SAR interrupt.
217 def_sar_inter_pace = os_atoi (ptr);
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);*/
225 * Reigster Receive interrupt A
226 @@ -880,11 +829,15 @@
230 -int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci)
231 +int tn7atm_open (struct atm_vcc *vcc)
233 tn7atm_activate_vc_parm_t tn7atm_activate_vc_parm;
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;
241 dgprintf(1, "tn7atm_open()\n");
243 @@ -896,24 +849,18 @@
249 - /* find a free VPI/VCI */
250 - tn7atm_walk_vccs(vcc, &vpi, &vci);
251 +// MOD_INC_USE_COUNT;
256 - if ((vci == ATM_VCI_UNSPEC) || (vpi == ATM_VCI_UNSPEC))
257 + if ((vcc->vci == ATM_VCI_UNSPEC) || (vcc->vpi == ATM_VCI_UNSPEC))
260 +// MOD_DEC_USE_COUNT;
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;
269 - if ((vpi == CLEAR_EOC_VPI) && (vci == CLEAR_EOC_VCI))
270 + if ((vcc->vpi == CLEAR_EOC_VPI) && (vcc->vci == CLEAR_EOC_VCI))
272 /* always use (max_dma_chan+1) for clear eoc */
273 tn7atm_activate_vc_parm.chan = EOC_DMA_CHAN;
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)
279 +// MOD_DEC_USE_COUNT;
280 printk("tn7atm_open: Clear EOC channel (dmachan=%d) already in use.\n", tn7atm_activate_vc_parm.chan);
286 printk("tn7atm_open: failed to setup clear_eoc\n");
288 +// MOD_DEC_USE_COUNT;
291 tn7atm_set_lut(tn7atm_activate_vc_parm.priv,vcc, tn7atm_activate_vc_parm.chan);
292 @@ -939,17 +886,17 @@
294 else /* PVC channel setup */
296 - if ((vpi==REMOTE_MGMT_VPI) && (vci==REMOTE_MGMT_VCI))
297 + if ((vcc->vpi==REMOTE_MGMT_VPI) && (vcc->vci==REMOTE_MGMT_VCI))
299 tn7atm_activate_vc_parm.chan = 14; /* always use chan 14 for MII PVC-base romote mgmt */
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)
309 +// MOD_DEC_USE_COUNT;
310 printk("PVC already opened. dmachan = %d\n", rc);
314 tn7atm_activate_vc_parm.priority = 2;
318 case ATM_VBR: /* Variable Bit Rate-Non RealTime*/
319 tn7atm_activate_vc_parm.qos = 1;
320 tn7atm_activate_vc_parm.priority = 1;
322 tn7atm_activate_vc_parm.mbs = vcc->qos.txtp.max_pcr;
323 tn7atm_activate_vc_parm.cdvt = vcc->qos.txtp.max_cdv;
328 tn7atm_activate_vc_parm.qos = 2;
332 printk("failed to activate hw channel\n");
334 +// MOD_DEC_USE_COUNT;
335 tn7atm_lut_clear(vcc, tn7atm_activate_vc_parm.chan);
336 //spin_unlock_irqrestore(&chan_init_lock, flags);
338 @@ -1119,7 +1068,7 @@
339 tn7atm_lut_clear (vcc, dmachan);
340 //spin_unlock_irqrestore (&closeLock, closeFlag);
343 +// MOD_DEC_USE_COUNT;
345 dgprintf (1, "Leave tn7atm_close\n");
347 @@ -1533,8 +1482,7 @@
350 dgprintf (3, "pushing the skb...\n");
352 - skb->stamp = vcc->timestamp = xtime;
353 + __net_timestamp(skb);
355 xdump ((unsigned char *) skb->data, skb->len, 5);
357 @@ -1730,8 +1678,7 @@
359 kfree (dev->dev_data);
361 - // atm_dev_deregister (dev);
362 - shutdown_atm_dev (dev);
363 + atm_dev_deregister (dev);
366 * remove proc entries
367 @@ -1890,9 +1837,6 @@
369 * Set up proc entry for atm stats
371 - if (tn7atm_xlate_proc_name
372 - (drv_proc_root_folder, &root_proc_dir_entry, &residual))
374 printk ("Creating new root folder %s in the proc for the driver stats \n",
375 drv_proc_root_folder);
376 root_proc_dir_entry = proc_mkdir (drv_proc_root_folder, NULL);
377 @@ -1902,7 +1846,6 @@
380 proc_root_already_exists = FALSE;
384 * AV: Clean-up. Moved all the definitions to the data structure.
385 @@ -2484,7 +2427,5 @@
390 module_init (tn7atm_detect);
391 module_exit (tn7atm_exit);
393 diff -urN sangam_atm-07.02.01.00/tn7atm.h sangam_atm-07.02.01.00/tn7atm.h
394 --- sangam_atm-07.02.01.00/tn7atm.h 2007-08-06 18:15:52.000000000 +0200
395 +++ sangam_atm-07.02.01.00/tn7atm.h 2007-08-06 18:58:42.000000000 +0200
397 //#include "mips_support.h"
398 #include <linux/list.h>
400 -#include <linux/config.h>
401 +#define MIPS_EXCEPTION_OFFSET 8
402 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
404 #ifdef CONFIG_MODVERSIONS
405 #include <linux/modversions.h>
406 diff -urN sangam_atm-07.02.01.00/tn7dsl.c sangam_atm-07.02.01.00/tn7dsl.c
407 --- sangam_atm-07.02.01.00/tn7dsl.c 2007-08-06 18:15:52.000000000 +0200
408 +++ sangam_atm-07.02.01.00/tn7dsl.c 2007-08-06 18:58:42.000000000 +0200
410 * 1/02/07 JZ CQ11054: Data Precision and Range Changes for TR-069 Conformance
411 * UR8_MERGE_END CQ11054*
412 *********************************************************************************************/
413 -#include <linux/config.h>
414 #include <linux/kernel.h>
415 #include <linux/module.h>
416 #include <linux/init.h>
418 #include <linux/spinlock.h>
419 #include <linux/smp_lock.h>
421 -#include <asm/mips-boards/prom.h>
422 +#include <asm/ar7/ar7.h>
423 #include <linux/proc_fs.h>
424 #include <linux/string.h>
425 #include <linux/ctype.h>
427 #include <linux/timer.h>
428 #include <linux/vmalloc.h>
429 #include <linux/file.h>
430 +#include <linux/firmware.h>
432 /* Modules specific header files */
436 #define gDot1(a) ((a>0)?(a%10):((-a)%10))
437 // UR8_MERGE_END CQ11054*
439 +int avalanche_request_intr_pacing(int irq_nr, unsigned int blk_num,
440 + unsigned int pace_value)
442 + printk("avalanche_request_pacing(%d, %u, %u); // not implemented\n", irq_nr, blk_num, pace_value);
447 int os_atoi(const char *pStr)
449 int MulNeg = (*pStr == '-' ? -1 : 1);
454 -int strcmp(const char *s1, const char *s2)
457 - int size = strlen(s1);
459 - return(strncmp(s1, s2, size));
462 -int strncmp(const char *s1, const char *s2, size_t size)
465 - int max_size = (int)size;
467 - while((s1[i] != 0) && i < max_size)
487 // * UR8_MERGE_START CQ10640 Jack Zhang
488 int tn7dsl_dump_dsp_memory(char *input_str) //cph99
490 @@ -441,101 +417,74 @@
494 -int shim_osLoadFWImage(unsigned char *ptr)
495 +static void avsar_release(struct device *dev)
497 - unsigned int bytesRead;
498 - mm_segment_t oldfs;
499 - static struct file *filp;
500 - unsigned int imageLength=0x5ffff;
503 - dgprintf(4, "tn7dsl_read_dsp()\n");
505 - dgprintf(4,"open file %s\n", DSP_FIRMWARE_PATH);
507 - filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
510 - printk("Failed: Could not open DSP binary file\n");
514 - if (filp->f_dentry != NULL)
516 - if (filp->f_dentry->d_inode != NULL)
518 - printk ("DSP binary filesize = %d bytes\n",
519 - (int) filp->f_dentry->d_inode->i_size);
520 - imageLength = (unsigned int)filp->f_dentry->d_inode->i_size + 0x200;
524 - if (filp->f_op->read==NULL)
525 - return -1; /* File(system) doesn't allow reads */
528 - * Disable parameter checking
534 - * Now read bytes from postion "StartPos"
538 - bytesRead = filp->f_op->read(filp,ptr,imageLength,&filp->f_pos);
540 - dgprintf(4,"file length = %d\n", bytesRead);
550 + printk(KERN_DEBUG "avsar firmware released\n");
553 +static struct device avsar = {
555 + .release = avsar_release,
558 -unsigned int shim_read_overlay_page (void *ptr, unsigned int secOffset,
559 - unsigned int secLength)
560 +int shim_osLoadFWImage(unsigned char *ptr)
562 - unsigned int bytesRead;
563 - mm_segment_t oldfs;
566 - dgprintf(4,"shim_read_overlay_page\n");
567 - //dgprintf(4,"sec offset=%d, sec length =%d\n", secOffset, secLength);
569 - filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
572 - printk("Failed: Could not open DSP binary file\n");
576 - if (filp->f_op->read==NULL)
577 - return -1; /* File(system) doesn't allow reads */
580 - * Now read bytes from postion "StartPos"
583 - if(filp->f_op->llseek)
584 - filp->f_op->llseek(filp,secOffset, 0);
587 - filp->f_pos = secOffset;
588 - bytesRead = filp->f_op->read(filp,ptr,secLength,&filp->f_pos);
589 + const struct firmware *fw_entry;
598 + printk("requesting firmware image \"ar0700xx.bin\"\n");
599 + if(device_register(&avsar) < 0) {
601 + "avsar: device_register fails\n");
605 + if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
607 + "avsar: Firmware not available\n");
608 + device_unregister(&avsar);
611 + size = fw_entry->size;
612 + device_unregister(&avsar);
613 + if(size > 0x5ffff) {
615 + "avsar: Firmware too big (%d bytes)\n", size);
616 + release_firmware(fw_entry);
619 + memcpy(ptr, fw_entry->data, size);
620 + release_firmware(fw_entry);
624 +unsigned int shim_read_overlay_page(void *ptr, unsigned int secOffset, unsigned int secLength)
626 + const struct firmware *fw_entry;
628 + printk("requesting firmware image \"ar0700xx.bin\"\n");
629 + if(device_register(&avsar) < 0) {
631 + "avsar: device_register fails\n");
635 + if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
637 + "avsar: Firmware not available\n");
638 + device_unregister(&avsar);
641 + device_unregister(&avsar);
642 + if(fw_entry->size > secLength) {
644 + "avsar: Firmware too big (%d bytes)\n", fw_entry->size);
645 + release_firmware(fw_entry);
648 + memcpy(ptr + secOffset, fw_entry->data, secLength);
649 + release_firmware(fw_entry);
653 int shim_osLoadDebugFWImage(unsigned char *ptr)
654 @@ -3442,7 +3391,7 @@
658 - ret = proc_dostring(ctl, write, filp, buffer, lenp);
659 + ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
661 switch (ctl->ctl_name)
663 @@ -3528,7 +3477,7 @@
666 len += sprintf(info+len, mod_req);
667 - ret = proc_dostring(ctl, write, filp, buffer, lenp);
668 + ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
672 @@ -3558,8 +3507,7 @@
673 if (initialized == 1)
676 - dslmod_sysctl_header = register_sysctl_table(dslmod_root_table, 1);
677 - dslmod_root_table->child->de->owner = THIS_MODULE;
678 + dslmod_sysctl_header = register_sysctl_table(dslmod_root_table);
682 diff -urN sangam_atm-07.02.01.00/tn7sar.c sangam_atm-07.02.01.00/tn7sar.c
683 --- sangam_atm-07.02.01.00/tn7sar.c 2007-08-06 18:15:52.000000000 +0200
684 +++ sangam_atm-07.02.01.00/tn7sar.c 2007-08-06 18:58:42.000000000 +0200
686 * UR8_MERGE_END CQ10700
687 *******************************************************************************/
689 -#include <linux/config.h>
690 #include <linux/kernel.h>
691 #include <linux/module.h>
692 #include <linux/init.h>
694 #include <linux/spinlock.h>
695 #include <linux/smp_lock.h>
697 -#include <asm/mips-boards/prom.h>
698 +#include <asm/ar7/ar7.h>
699 #include <linux/proc_fs.h>
700 #include <linux/string.h>
701 #include <linux/ctype.h>