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
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.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
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"
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 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
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.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
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.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
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.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
97 * UR8_MERGE_END CQ10979*
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 @@ -254,13 +254,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 @@ -865,11 +814,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 @@ -881,24 +834,18 @@
249 - /* find a free VPI/VCI */
250 - tn7atm_walk_vccs(vcc, &vpi, &vci);
254 +// 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 @@ -924,17 +871,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 @@ -1104,7 +1053,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 @@ -1518,8 +1467,11 @@
350 dgprintf (3, "pushing the skb...\n");
352 - skb->stamp = vcc->timestamp = xtime;
355 + do_gettimeofday(&tv);
356 + skb_set_timestamp(skb, &tv);
359 xdump ((unsigned char *) skb->data, skb->len, 5);
361 @@ -1715,8 +1667,7 @@
363 kfree (dev->dev_data);
365 - // atm_dev_deregister (dev);
366 - shutdown_atm_dev (dev);
367 + atm_dev_deregister (dev);
370 * remove proc entries
371 @@ -1875,9 +1826,6 @@
373 * Set up proc entry for atm stats
375 - if (tn7atm_xlate_proc_name
376 - (drv_proc_root_folder, &root_proc_dir_entry, &residual))
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 @@
384 proc_root_already_exists = FALSE;
388 * AV: Clean-up. Moved all the definitions to the data structure.
389 @@ -2469,7 +2416,5 @@
394 module_init (tn7atm_detect);
395 module_exit (tn7atm_exit);
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
401 //#include "mips_support.h"
402 #include <linux/list.h>
404 -#include <linux/config.h>
405 +#define MIPS_EXCEPTION_OFFSET 8
406 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
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
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>
422 #include <linux/spinlock.h>
423 #include <linux/smp_lock.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>
431 #include <linux/timer.h>
432 #include <linux/vmalloc.h>
433 #include <linux/file.h>
434 +#include <linux/firmware.h>
436 /* Modules specific header files */
440 static int tn7dsl_proc_snr_print (char *buf, int count, int *eof, int data);
441 /* end of internal functions */
443 +int avalanche_request_intr_pacing(int irq_nr, unsigned int blk_num,
444 + unsigned int pace_value)
446 + printk("avalanche_request_pacing(%d, %u, %u); // not implemented\n", irq_nr, blk_num, pace_value);
451 int os_atoi(const char *pStr)
453 int MulNeg = (*pStr == '-' ? -1 : 1);
458 -int strcmp(const char *s1, const char *s2)
461 - int size = strlen(s1);
463 - return(strncmp(s1, s2, size));
466 -int strncmp(const char *s1, const char *s2, size_t size)
469 - int max_size = (int)size;
471 - while((s1[i] != 0) && i < max_size)
491 // * UR8_MERGE_START CQ10640 Jack Zhang
492 int tn7dsl_dump_dsp_memory(char *input_str) //cph99
494 @@ -430,101 +406,72 @@
498 -int shim_osLoadFWImage(unsigned char *ptr)
499 +static void avsar_release(struct device *dev)
501 - unsigned int bytesRead;
502 - mm_segment_t oldfs;
503 - static struct file *filp;
504 - unsigned int imageLength=0x5ffff;
507 - dgprintf(4, "tn7dsl_read_dsp()\n");
509 - dgprintf(4,"open file %s\n", DSP_FIRMWARE_PATH);
511 - filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
514 - printk("Failed: Could not open DSP binary file\n");
518 - if (filp->f_dentry != NULL)
520 - if (filp->f_dentry->d_inode != NULL)
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;
528 - if (filp->f_op->read==NULL)
529 - return -1; /* File(system) doesn't allow reads */
532 - * Disable parameter checking
538 - * Now read bytes from postion "StartPos"
542 - bytesRead = filp->f_op->read(filp,ptr,imageLength,&filp->f_pos);
544 - dgprintf(4,"file length = %d\n", bytesRead);
554 + printk(KERN_DEBUG "avsar firmware released\n");
557 +static struct device avsar = {
559 + .release = avsar_release,
562 -unsigned int shim_read_overlay_page (void *ptr, unsigned int secOffset,
563 - unsigned int secLength)
564 +int shim_osLoadFWImage(unsigned char *ptr)
566 - unsigned int bytesRead;
567 - mm_segment_t oldfs;
570 - dgprintf(4,"shim_read_overlay_page\n");
571 - //dgprintf(4,"sec offset=%d, sec length =%d\n", secOffset, secLength);
573 - filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
576 - printk("Failed: Could not open DSP binary file\n");
580 - if (filp->f_op->read==NULL)
581 - return -1; /* File(system) doesn't allow reads */
584 - * Now read bytes from postion "StartPos"
587 - if(filp->f_op->llseek)
588 - filp->f_op->llseek(filp,secOffset, 0);
591 - filp->f_pos = secOffset;
592 - bytesRead = filp->f_op->read(filp,ptr,secLength,&filp->f_pos);
593 + const struct firmware *fw_entry;
601 + printk("requesting firmware image \"ar0700xx.bin\"\n");
602 + if(device_register(&avsar) < 0) {
604 + "avsar: device_register fails\n");
608 + if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
610 + "avsar: Firmware not available\n");
611 + device_unregister(&avsar);
614 + device_unregister(&avsar);
615 + if(fw_entry->size > 0x5ffff) {
617 + "avsar: Firmware too big (%d bytes)\n", fw_entry->size);
618 + release_firmware(fw_entry);
621 + memcpy(ptr, fw_entry->data, fw_entry->size);
622 + release_firmware(fw_entry);
623 + return fw_entry->size;
626 +unsigned int shim_read_overlay_page(void *ptr, unsigned int secOffset, unsigned int secLength)
628 + const struct firmware *fw_entry;
630 + printk("requesting firmware image \"ar0700xx.bin\"\n");
631 + if(device_register(&avsar) < 0) {
633 + "avsar: device_register fails\n");
637 + if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
639 + "avsar: Firmware not available\n");
640 + device_unregister(&avsar);
643 + device_unregister(&avsar);
644 + if(fw_entry->size > secLength) {
646 + "avsar: Firmware too big (%d bytes)\n", fw_entry->size);
647 + release_firmware(fw_entry);
650 + memcpy(ptr + secOffset, fw_entry->data, secLength);
651 + release_firmware(fw_entry);
652 + return fw_entry->size;
655 int shim_osLoadDebugFWImage(unsigned char *ptr)
656 @@ -3367,7 +3314,7 @@
660 - ret = proc_dostring(ctl, write, filp, buffer, lenp);
661 + ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
663 switch (ctl->ctl_name)
665 @@ -3453,7 +3400,7 @@
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);
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
678 * UR8_MERGE_END CQ10700
679 *******************************************************************************/
681 -#include <linux/config.h>
682 #include <linux/kernel.h>
683 #include <linux/module.h>
684 #include <linux/init.h>
686 #include <linux/spinlock.h>
687 #include <linux/smp_lock.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>
695 diff -ur atm.old/tn7dsl.c atm.dev/tn7dsl.c
696 --- atm.old/tn7dsl.c 2007-05-24 17:36:33.865636000 +0200
697 +++ atm.dev/tn7dsl.c 2007-05-24 17:41:32.094298496 +0200
698 @@ -3430,8 +3430,7 @@
699 if (initialized == 1)
702 - dslmod_sysctl_header = register_sysctl_table(dslmod_root_table, 1);
703 - dslmod_root_table->child->de->owner = THIS_MODULE;
704 + dslmod_sysctl_header = register_sysctl_table(dslmod_root_table);