1 diff -u 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 09:22:04.000000000 +0100
3 +++ sangam_atm-D7.03.01.00/cppi_cpaal5.c 2008-02-08 19:15:02.000000000 +0100
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 -u 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-02-08 19:15:02.000000000 +0100
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"
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 -u 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 08:47:33.000000000 +0100
39 +++ sangam_atm-D7.03.01.00/dsl_hal_support.c 2008-02-08 19:15:02.000000000 +0100
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 -u 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-02-08 19:15:02.000000000 +0100
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 -u 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 04:46:28.000000000 +0100
67 +++ sangam_atm-D7.03.01.00/Makefile 2008-02-08 19:15:02.000000000 +0100
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 -u 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 08:45:50.000000000 +0100
95 +++ sangam_atm-D7.03.01.00/tn7atm.c 2008-02-08 19:15:30.000000000 +0100
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/delay.h>
106 #include <linux/spinlock.h>
107 #include <linux/smp_lock.h>
109 -#include <asm/mips-boards/prom.h>
110 #include <linux/proc_fs.h>
111 #include <linux/string.h>
112 #include <linux/ctype.h>
115 +#include <asm/ar7/ar7.h>
116 +#include <asm/ar7/prom.h>
118 #include "dsl_hal_api.h"
122 #include "dsl_hal_register.h"
125 +MODULE_LICENSE("GPL");
126 MODULE_DESCRIPTION ("Tnetd73xx ATM Device Driver");
127 MODULE_AUTHOR ("Zhicheng Tang");
133 -#ifndef TI_STATIC_ALLOCATIONS
134 -#define TI_STATIC_ALLOCATIONS
136 +//#ifndef TI_STATIC_ALLOCATIONS
137 +//#define TI_STATIC_ALLOCATIONS
140 #define tn7atm_kfree_skb(x) dev_kfree_skb(x)
144 static int tn7atm_set_can_support_adsl2 (int can);
146 -static int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci);
147 +static int tn7atm_open (struct atm_vcc *vcc);
149 static void tn7atm_close (struct atm_vcc *vcc);
151 @@ -257,13 +260,12 @@
158 change_qos: tn7atm_change_qos,
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;
168 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
170 - * Function: int tn7atm_walk_vccs(struct atm_dev *dev, short *vcc, int *vci)
172 - * Description: retrieve VPI/VCI for connection
174 - *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
175 -static int tn7atm_walk_vccs (struct atm_vcc *vcc, short *vpi, int *vci)
177 - struct atm_vcc *walk;
182 - if (*vpi == ATM_VPI_ANY)
185 - for (*vpi = 0, walk = vcc->dev->vccs; walk; walk = walk->next)
188 - if ((walk->vci == *vci) && (walk->vpi == *vpi))
191 - walk = vcc->dev->vccs;
199 - if (*vci == ATM_VCI_ANY)
202 - for (*vci = ATM_NOT_RSV_VCI, walk = vcc->dev->vccs; walk;
206 - if ((walk->vpi = *vpi) && (walk->vci == *vci))
208 - *vci = walk->vci + 1;
209 - walk = vcc->dev->vccs;
218 -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
220 * Function: int tn7atm_sar_irq(void)
222 * Description: tnetd73xx SAR interrupt.
224 * Register SAR interrupt
226 priv->sar_irq = LNXINTNUM (ATM_SAR_INT); /* Interrupt line # */
227 - if (request_irq (priv->sar_irq, tn7atm_sar_irq, SA_INTERRUPT, "SAR ", dev))
228 + if (request_irq (priv->sar_irq, tn7atm_sar_irq, IRQF_DISABLED, "SAR ", dev))
229 printk ("Could not register tn7atm_sar_irq\n");
232 @@ -704,14 +656,14 @@
234 def_sar_inter_pace = os_atoi (ptr);
236 - avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
237 - def_sar_inter_pace);
238 +/* avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
239 + def_sar_inter_pace);*/
242 * Reigster Receive interrupt A
244 priv->dsl_irq = LNXINTNUM (ATM_DSL_INT); /* Interrupt line # */
245 - if (request_irq (priv->dsl_irq, tn7atm_dsl_irq, SA_INTERRUPT, "DSL ", dev))
246 + if (request_irq (priv->dsl_irq, tn7atm_dsl_irq, IRQF_DISABLED, "DSL ", dev))
247 printk ("Could not register tn7atm_dsl_irq\n");
249 /***** VRB Tasklet Mode ****/
250 @@ -875,11 +827,15 @@
254 -int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci)
255 +int tn7atm_open (struct atm_vcc *vcc)
257 tn7atm_activate_vc_parm_t tn7atm_activate_vc_parm;
260 + tn7atm_activate_vc_parm.pcr = 0x20000;
261 + tn7atm_activate_vc_parm.scr = 0x20000;
262 + tn7atm_activate_vc_parm.mbs = 0x20000;
263 + tn7atm_activate_vc_parm.cdvt = 10000;
265 dgprintf(1, "tn7atm_open()\n");
267 @@ -891,24 +847,18 @@
272 +// MOD_INC_USE_COUNT;
274 - /* find a free VPI/VCI */
275 - tn7atm_walk_vccs(vcc, &vpi, &vci);
280 - if ((vci == ATM_VCI_UNSPEC) || (vpi == ATM_VCI_UNSPEC))
281 + if ((vcc->vci == ATM_VCI_UNSPEC) || (vcc->vpi == ATM_VCI_UNSPEC))
284 +// MOD_DEC_USE_COUNT;
288 - tn7atm_activate_vc_parm.vpi = vpi;
289 - tn7atm_activate_vc_parm.vci = vci;
290 + tn7atm_activate_vc_parm.vpi = vcc->vpi;
291 + tn7atm_activate_vc_parm.vci = vcc->vci;
293 - if ((vpi == CLEAR_EOC_VPI) && (vci == CLEAR_EOC_VCI))
294 + if ((vcc->vpi == CLEAR_EOC_VPI) && (vcc->vci == CLEAR_EOC_VCI))
296 /* always use (max_dma_chan+1) for clear eoc */
297 tn7atm_activate_vc_parm.chan = EOC_DMA_CHAN;
299 /* check to see whether clear eoc is opened or not */
300 if (tn7atm_activate_vc_parm.priv->lut[tn7atm_activate_vc_parm.chan].inuse)
303 +// MOD_DEC_USE_COUNT;
304 printk("tn7atm_open: Clear EOC channel (dmachan=%d) already in use.\n", tn7atm_activate_vc_parm.chan);
310 printk("tn7atm_open: failed to setup clear_eoc\n");
312 +// MOD_DEC_USE_COUNT;
315 tn7atm_set_lut(tn7atm_activate_vc_parm.priv,vcc, tn7atm_activate_vc_parm.chan);
316 @@ -934,17 +884,17 @@
318 else /* PVC channel setup */
320 - if ((vpi==REMOTE_MGMT_VPI) && (vci==REMOTE_MGMT_VCI))
321 + if ((vcc->vpi==REMOTE_MGMT_VPI) && (vcc->vci==REMOTE_MGMT_VCI))
323 tn7atm_activate_vc_parm.chan = 14; /* always use chan 14 for MII PVC-base romote mgmt */
327 - rc = tn7atm_lut_find(vpi, vci);
328 + rc = tn7atm_lut_find(vcc->vpi, vcc->vci);
329 /* check to see whether PVC is opened or not */
330 if(ATM_NO_DMA_CHAN != rc)
333 +// MOD_DEC_USE_COUNT;
334 printk("PVC already opened. dmachan = %d\n", rc);
338 tn7atm_activate_vc_parm.priority = 2;
342 case ATM_VBR: /* Variable Bit Rate-Non RealTime*/
343 tn7atm_activate_vc_parm.qos = 1;
344 tn7atm_activate_vc_parm.priority = 1;
346 tn7atm_activate_vc_parm.mbs = vcc->qos.txtp.max_pcr;
347 tn7atm_activate_vc_parm.cdvt = vcc->qos.txtp.max_cdv;
352 tn7atm_activate_vc_parm.qos = 2;
356 printk("failed to activate hw channel\n");
358 +// MOD_DEC_USE_COUNT;
359 tn7atm_lut_clear(vcc, tn7atm_activate_vc_parm.chan);
360 //spin_unlock_irqrestore(&chan_init_lock, flags);
362 @@ -1114,7 +1066,7 @@
363 tn7atm_lut_clear (vcc, dmachan);
364 //spin_unlock_irqrestore (&closeLock, closeFlag);
367 +// MOD_DEC_USE_COUNT;
369 dgprintf (1, "Leave tn7atm_close\n");
371 @@ -1528,8 +1480,7 @@
374 dgprintf (3, "pushing the skb...\n");
376 - skb->stamp = vcc->timestamp = xtime;
377 + __net_timestamp(skb);
379 xdump ((unsigned char *) skb->data, skb->len, 5);
381 @@ -1725,8 +1676,7 @@
383 kfree (dev->dev_data);
385 - // atm_dev_deregister (dev);
386 - shutdown_atm_dev (dev);
387 + atm_dev_deregister (dev);
390 * remove proc entries
391 @@ -1885,9 +1835,6 @@
393 * Set up proc entry for atm stats
395 - if (tn7atm_xlate_proc_name
396 - (drv_proc_root_folder, &root_proc_dir_entry, &residual))
398 printk ("Creating new root folder %s in the proc for the driver stats \n",
399 drv_proc_root_folder);
400 root_proc_dir_entry = proc_mkdir (drv_proc_root_folder, NULL);
401 @@ -1897,7 +1844,6 @@
404 proc_root_already_exists = FALSE;
408 * AV: Clean-up. Moved all the definitions to the data structure.
409 @@ -2479,7 +2425,5 @@
414 module_init (tn7atm_detect);
415 module_exit (tn7atm_exit);
417 diff -u sangam_atm-D7.03.01.00.orig/tn7atm.h sangam_atm-D7.03.01.00/tn7atm.h
418 --- sangam_atm-D7.03.01.00.orig/tn7atm.h 2006-04-05 06:33:06.000000000 +0100
419 +++ sangam_atm-D7.03.01.00/tn7atm.h 2008-02-08 19:15:02.000000000 +0100
421 //#include "mips_support.h"
422 #include <linux/list.h>
424 -#include <linux/config.h>
425 +#define MIPS_EXCEPTION_OFFSET 8
426 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
428 #ifdef CONFIG_MODVERSIONS
429 #include <linux/modversions.h>
430 diff -u sangam_atm-D7.03.01.00.orig/tn7dsl.c sangam_atm-D7.03.01.00/tn7dsl.c
431 --- sangam_atm-D7.03.01.00.orig/tn7dsl.c 2007-01-04 09:04:14.000000000 +0100
432 +++ sangam_atm-D7.03.01.00/tn7dsl.c 2008-02-08 19:16:46.000000000 +0100
434 * 1/02/07 JZ CQ11054: Data Precision and Range Changes for TR-069 Conformance
435 * UR8_MERGE_END CQ11054*
436 *********************************************************************************************/
437 -#include <linux/config.h>
438 #include <linux/kernel.h>
439 #include <linux/module.h>
440 #include <linux/init.h>
442 #include <linux/delay.h>
443 #include <linux/spinlock.h>
444 #include <linux/smp_lock.h>
446 -#include <asm/mips-boards/prom.h>
447 #include <linux/proc_fs.h>
448 #include <linux/string.h>
449 #include <linux/ctype.h>
451 #include <linux/timer.h>
452 #include <linux/vmalloc.h>
453 #include <linux/file.h>
454 +#include <linux/firmware.h>
457 +#include <asm/ar7/ar7.h>
458 +#include <asm/ar7/prom.h>
460 /* Modules specific header files */
464 static volatile int bshutdown;
465 static char info[MAX_STR_SIZE];
466 /* Used for DSL Polling enable */
467 -static DECLARE_MUTEX_LOCKED (adsl_sem_overlay);
468 +static struct semaphore adsl_sem_overlay;
470 //kthread_t overlay_thread;
471 /* end of module wide declars */
473 #define gDot1(a) ((a>0)?(a%10):((-a)%10))
474 // UR8_MERGE_END CQ11054*
476 +int avalanche_request_intr_pacing(int irq_nr, unsigned int blk_num,
477 + unsigned int pace_value)
479 + printk("avalanche_request_pacing(%d, %u, %u); // not implemented\n", irq_nr, blk_num, pace_value);
484 int os_atoi(const char *pStr)
486 int MulNeg = (*pStr == '-' ? -1 : 1);
491 -int strcmp(const char *s1, const char *s2)
494 - int size = strlen(s1);
496 - return(strncmp(s1, s2, size));
499 -int strncmp(const char *s1, const char *s2, size_t size)
502 - int max_size = (int)size;
504 - while((s1[i] != 0) && i < max_size)
524 // * UR8_MERGE_START CQ10640 Jack Zhang
525 int tn7dsl_dump_dsp_memory(char *input_str) //cph99
527 @@ -441,101 +419,74 @@
531 -int shim_osLoadFWImage(unsigned char *ptr)
532 +static void avsar_release(struct device *dev)
534 - unsigned int bytesRead;
535 - mm_segment_t oldfs;
536 - static struct file *filp;
537 - unsigned int imageLength=0x5ffff;
540 - dgprintf(4, "tn7dsl_read_dsp()\n");
542 - dgprintf(4,"open file %s\n", DSP_FIRMWARE_PATH);
544 - filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
547 - printk("Failed: Could not open DSP binary file\n");
551 - if (filp->f_dentry != NULL)
553 - if (filp->f_dentry->d_inode != NULL)
555 - printk ("DSP binary filesize = %d bytes\n",
556 - (int) filp->f_dentry->d_inode->i_size);
557 - imageLength = (unsigned int)filp->f_dentry->d_inode->i_size + 0x200;
561 - if (filp->f_op->read==NULL)
562 - return -1; /* File(system) doesn't allow reads */
565 - * Disable parameter checking
571 - * Now read bytes from postion "StartPos"
575 - bytesRead = filp->f_op->read(filp,ptr,imageLength,&filp->f_pos);
577 - dgprintf(4,"file length = %d\n", bytesRead);
587 + printk(KERN_DEBUG "avsar firmware released\n");
590 +static struct device avsar = {
592 + .release = avsar_release,
595 -unsigned int shim_read_overlay_page (void *ptr, unsigned int secOffset,
596 - unsigned int secLength)
597 +int shim_osLoadFWImage(unsigned char *ptr)
599 - unsigned int bytesRead;
600 - mm_segment_t oldfs;
603 - dgprintf(4,"shim_read_overlay_page\n");
604 - //dgprintf(4,"sec offset=%d, sec length =%d\n", secOffset, secLength);
605 + const struct firmware *fw_entry;
608 - filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
611 - printk("Failed: Could not open DSP binary file\n");
615 - if (filp->f_op->read==NULL)
616 - return -1; /* File(system) doesn't allow reads */
619 - * Now read bytes from postion "StartPos"
622 - if(filp->f_op->llseek)
623 - filp->f_op->llseek(filp,secOffset, 0);
626 - filp->f_pos = secOffset;
627 - bytesRead = filp->f_op->read(filp,ptr,secLength,&filp->f_pos);
635 + printk("requesting firmware image \"ar0700xx.bin\"\n");
636 + if(device_register(&avsar) < 0) {
638 + "avsar: device_register fails\n");
642 + if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
644 + "avsar: Firmware not available\n");
645 + device_unregister(&avsar);
648 + size = fw_entry->size;
649 + device_unregister(&avsar);
650 + if(size > 0x5ffff) {
652 + "avsar: Firmware too big (%d bytes)\n", size);
653 + release_firmware(fw_entry);
656 + memcpy(ptr, fw_entry->data, size);
657 + release_firmware(fw_entry);
661 +unsigned int shim_read_overlay_page(void *ptr, unsigned int secOffset, unsigned int secLength)
663 + const struct firmware *fw_entry;
665 + printk("requesting firmware image \"ar0700xx.bin\"\n");
666 + if(device_register(&avsar) < 0) {
668 + "avsar: device_register fails\n");
672 + if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
674 + "avsar: Firmware not available\n");
675 + device_unregister(&avsar);
678 + device_unregister(&avsar);
679 + if(fw_entry->size > secLength) {
681 + "avsar: Firmware too big (%d bytes)\n", fw_entry->size);
682 + release_firmware(fw_entry);
685 + memcpy(ptr + secOffset, fw_entry->data, secLength);
686 + release_firmware(fw_entry);
690 int shim_osLoadDebugFWImage(unsigned char *ptr)
691 @@ -3064,6 +3015,7 @@
692 int high_precision_selected = 0;
693 // UR8_MERGE_END CQ11054*
695 + sema_init(&adsl_sem_overlay, 0);
699 @@ -3442,7 +3394,7 @@
703 - ret = proc_dostring(ctl, write, filp, buffer, lenp);
704 + ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
706 switch (ctl->ctl_name)
708 @@ -3528,7 +3480,7 @@
711 len += sprintf(info+len, mod_req);
712 - ret = proc_dostring(ctl, write, filp, buffer, lenp);
713 + ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
717 @@ -3558,8 +3510,7 @@
718 if (initialized == 1)
721 - dslmod_sysctl_header = register_sysctl_table(dslmod_root_table, 1);
722 - dslmod_root_table->child->de->owner = THIS_MODULE;
723 + dslmod_sysctl_header = register_sysctl_table(dslmod_root_table);
727 diff -u sangam_atm-D7.03.01.00.orig/tn7sar.c sangam_atm-D7.03.01.00/tn7sar.c
728 --- sangam_atm-D7.03.01.00.orig/tn7sar.c 2007-05-18 08:46:30.000000000 +0100
729 +++ sangam_atm-D7.03.01.00/tn7sar.c 2008-02-08 19:15:02.000000000 +0100
731 * UR8_MERGE_END CQ10700
732 *******************************************************************************/
734 -#include <linux/config.h>
735 #include <linux/kernel.h>
736 #include <linux/module.h>
737 #include <linux/init.h>
739 #include <linux/delay.h>
740 #include <linux/spinlock.h>
741 #include <linux/smp_lock.h>
743 -#include <asm/mips-boards/prom.h>
744 #include <linux/proc_fs.h>
745 #include <linux/string.h>
746 #include <linux/ctype.h>
749 +#include <asm/ar7/ar7.h>
750 +#include <asm/ar7/prom.h>