3 @@ -352,7 +352,7 @@ static int halRxReturn(HAL_RECEIVEINFO *
5 /* malloc failed, add this RCB to Needs Buffer List */
6 TempRcb->FragCount = 1; /*MJH+030417*/
7 - (HAL_RCB *)TempRcb->Eop = TempRcb; /* GSG +030430 */
8 + TempRcb->Eop = TempRcb; /* GSG +030430 */
10 if(HalDev->NeedsCount < MAX_NEEDS) /* +MJH 030410 */
15 * of phyEnableDisableWord & phyControlWord to avoid changing API struct
16 * which may cause change required to application data structure.
17 ******************************************************************************/
18 -#include <dev_host_interface.h>
19 -#include <dsl_hal_register.h>
20 -#include <dsl_hal_support.h>
21 +#include "dev_host_interface.h"
22 +#include "dsl_hal_register.h"
23 +#include "dsl_hal_support.h"
26 -#include <dsl_hal_logtable.h>
27 +#include "dsl_hal_logtable.h"
30 -#include <dsl_hal_version.h>
31 +#include "dsl_hal_version.h"
33 // UR8_MERGE_START CQ11054 Jack Zhang
34 static unsigned int highprecision_selected = 0; //By default we use low precision for backward compt.
35 --- a/dsl_hal_support.c
36 +++ b/dsl_hal_support.c
38 * oamFeature are overriden
39 // UR8_MERGE_END CQ10774 Ram
40 *******************************************************************************/
41 -#include <dev_host_interface.h>
42 -#include <dsl_hal_register.h>
43 -#include <dsl_hal_support.h>
44 +#include "dev_host_interface.h"
45 +#include "dsl_hal_register.h"
46 +#include "dsl_hal_support.h"
48 #define NUM_READ_RETRIES 3
49 static unsigned int dslhal_support_adsl2ByteSwap32(unsigned int in32Bits);
50 --- a/dsl_hal_support.h
51 +++ b/dsl_hal_support.h
53 * 04Nov05 0.11.00 CPH Fixed T1413 mode got Zero DS/US rate when DSL_BIT_TMODE is set.
54 *******************************************************************************/
56 -#include <dsl_hal_api.h>
57 +#include "dsl_hal_api.h"
59 #define virtual2Physical(a) (((int)a)&~0xe0000000)
60 /* External Function Prototype Declarations */
64 -# File: drivers/atm/ti_evm3/Makefile
66 -# Makefile for the Texas Instruments EVM3 ADSL/ATM driver.
67 +# Makefile for the TIATM device driver.
70 -# Copyright (c) 2000 Texas Instruments Incorporated.
71 -# Jeff Harrell (jharrell@telogy.com)
72 -# Viren Balar (vbalar@ti.com)
73 -# Victor Wells (vwells@telogy.com)
75 -include $(TOPDIR)/Rules.make
84 +#EXTRA_CFLAGS += -DEL -I. -DPOST_SILICON -DCOMMON_NSP -DCONFIG_LED_MODULE -DDEREGISTER_LED -DNO_ACT
85 +EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -DNO_ACT -D__NO__VOICE_PATCH__ -DEL
86 +obj-$(CONFIG_SANGAM_ATM) := tiatm.o
87 +tiatm-objs += cpsar.o aal5sar.o tn7sar.o tn7atm.o tn7dsl.o dsl_hal_api.o dsl_hal_support.o
91 * UR8_MERGE_END CQ11057*
92 *********************************************************************************************/
94 -#include <linux/config.h>
95 #include <linux/kernel.h>
96 #include <linux/module.h>
97 #include <linux/init.h>
99 #include <linux/delay.h>
100 #include <linux/spinlock.h>
101 #include <linux/smp_lock.h>
103 -#include <asm/mips-boards/prom.h>
104 #include <linux/proc_fs.h>
105 #include <linux/string.h>
106 #include <linux/ctype.h>
109 +#include <asm/ar7/ar7.h>
110 +#include <asm/ar7/prom.h>
112 #include "dsl_hal_api.h"
116 #include "dsl_hal_register.h"
119 +MODULE_LICENSE("GPL");
120 MODULE_DESCRIPTION ("Tnetd73xx ATM Device Driver");
121 MODULE_AUTHOR ("Zhicheng Tang");
123 @@ -100,9 +103,9 @@ MODULE_AUTHOR ("Zhicheng Tang");
127 -#ifndef TI_STATIC_ALLOCATIONS
128 -#define TI_STATIC_ALLOCATIONS
130 +//#ifndef TI_STATIC_ALLOCATIONS
131 +//#define TI_STATIC_ALLOCATIONS
134 #define tn7atm_kfree_skb(x) dev_kfree_skb(x)
136 @@ -114,7 +117,7 @@ static int EnableQoS = FALSE;
138 static int tn7atm_set_can_support_adsl2 (int can);
140 -static int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci);
141 +static int tn7atm_open (struct atm_vcc *vcc);
143 static void tn7atm_close (struct atm_vcc *vcc);
145 @@ -257,13 +260,12 @@ static const struct atmdev_ops tn7atm_op
152 change_qos: tn7atm_change_qos,
155 -const char drv_proc_root_folder[] = "avalanche/";
156 +const char drv_proc_root_folder[] = "avalanche";
157 static struct proc_dir_entry *root_proc_dir_entry = NULL;
158 #define DRV_PROC_MODE 0644
159 static int proc_root_already_exists = TRUE;
160 @@ -559,56 +561,6 @@ static int turbodsl_check_priority_type(
162 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
164 - * Function: int tn7atm_walk_vccs(struct atm_dev *dev, short *vcc, int *vci)
166 - * Description: retrieve VPI/VCI for connection
168 - *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
169 -static int tn7atm_walk_vccs (struct atm_vcc *vcc, short *vpi, int *vci)
171 - struct atm_vcc *walk;
176 - if (*vpi == ATM_VPI_ANY)
179 - for (*vpi = 0, walk = vcc->dev->vccs; walk; walk = walk->next)
182 - if ((walk->vci == *vci) && (walk->vpi == *vpi))
185 - walk = vcc->dev->vccs;
193 - if (*vci == ATM_VCI_ANY)
196 - for (*vci = ATM_NOT_RSV_VCI, walk = vcc->dev->vccs; walk;
200 - if ((walk->vpi = *vpi) && (walk->vci == *vci))
202 - *vci = walk->vci + 1;
203 - walk = vcc->dev->vccs;
212 -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
214 * Function: int tn7atm_sar_irq(void)
216 * Description: tnetd73xx SAR interrupt.
217 @@ -693,7 +645,7 @@ static int __init tn7atm_irq_request (st
218 * Register SAR interrupt
220 priv->sar_irq = LNXINTNUM (ATM_SAR_INT); /* Interrupt line # */
221 - if (request_irq (priv->sar_irq, tn7atm_sar_irq, SA_INTERRUPT, "SAR ", dev))
222 + if (request_irq (priv->sar_irq, tn7atm_sar_irq, IRQF_DISABLED, "SAR ", dev))
223 printk ("Could not register tn7atm_sar_irq\n");
226 @@ -704,14 +656,14 @@ static int __init tn7atm_irq_request (st
228 def_sar_inter_pace = os_atoi (ptr);
230 - avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
231 - def_sar_inter_pace);
232 +/* avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
233 + def_sar_inter_pace);*/
236 * Reigster Receive interrupt A
238 priv->dsl_irq = LNXINTNUM (ATM_DSL_INT); /* Interrupt line # */
239 - if (request_irq (priv->dsl_irq, tn7atm_dsl_irq, SA_INTERRUPT, "DSL ", dev))
240 + if (request_irq (priv->dsl_irq, tn7atm_dsl_irq, IRQF_DISABLED, "DSL ", dev))
241 printk ("Could not register tn7atm_dsl_irq\n");
243 /***** VRB Tasklet Mode ****/
244 @@ -875,11 +827,15 @@ static int __init tn7atm_get_ESI (struct
248 -int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci)
249 +int tn7atm_open (struct atm_vcc *vcc)
251 tn7atm_activate_vc_parm_t tn7atm_activate_vc_parm;
254 + tn7atm_activate_vc_parm.pcr = 0x20000;
255 + tn7atm_activate_vc_parm.scr = 0x20000;
256 + tn7atm_activate_vc_parm.mbs = 0x20000;
257 + tn7atm_activate_vc_parm.cdvt = 10000;
259 dgprintf(1, "tn7atm_open()\n");
261 @@ -891,24 +847,18 @@ int tn7atm_open (struct atm_vcc *vcc, sh
266 +// MOD_INC_USE_COUNT;
268 - /* find a free VPI/VCI */
269 - tn7atm_walk_vccs(vcc, &vpi, &vci);
274 - if ((vci == ATM_VCI_UNSPEC) || (vpi == ATM_VCI_UNSPEC))
275 + if ((vcc->vci == ATM_VCI_UNSPEC) || (vcc->vpi == ATM_VCI_UNSPEC))
278 +// MOD_DEC_USE_COUNT;
282 - tn7atm_activate_vc_parm.vpi = vpi;
283 - tn7atm_activate_vc_parm.vci = vci;
284 + tn7atm_activate_vc_parm.vpi = vcc->vpi;
285 + tn7atm_activate_vc_parm.vci = vcc->vci;
287 - if ((vpi == CLEAR_EOC_VPI) && (vci == CLEAR_EOC_VCI))
288 + if ((vcc->vpi == CLEAR_EOC_VPI) && (vcc->vci == CLEAR_EOC_VCI))
290 /* always use (max_dma_chan+1) for clear eoc */
291 tn7atm_activate_vc_parm.chan = EOC_DMA_CHAN;
292 @@ -916,7 +866,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
293 /* check to see whether clear eoc is opened or not */
294 if (tn7atm_activate_vc_parm.priv->lut[tn7atm_activate_vc_parm.chan].inuse)
297 +// MOD_DEC_USE_COUNT;
298 printk("tn7atm_open: Clear EOC channel (dmachan=%d) already in use.\n", tn7atm_activate_vc_parm.chan);
301 @@ -925,7 +875,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
304 printk("tn7atm_open: failed to setup clear_eoc\n");
306 +// MOD_DEC_USE_COUNT;
309 tn7atm_set_lut(tn7atm_activate_vc_parm.priv,vcc, tn7atm_activate_vc_parm.chan);
310 @@ -934,17 +884,17 @@ int tn7atm_open (struct atm_vcc *vcc, sh
312 else /* PVC channel setup */
314 - if ((vpi==REMOTE_MGMT_VPI) && (vci==REMOTE_MGMT_VCI))
315 + if ((vcc->vpi==REMOTE_MGMT_VPI) && (vcc->vci==REMOTE_MGMT_VCI))
317 tn7atm_activate_vc_parm.chan = 14; /* always use chan 14 for MII PVC-base romote mgmt */
321 - rc = tn7atm_lut_find(vpi, vci);
322 + rc = tn7atm_lut_find(vcc->vpi, vcc->vci);
323 /* check to see whether PVC is opened or not */
324 if(ATM_NO_DMA_CHAN != rc)
327 +// MOD_DEC_USE_COUNT;
328 printk("PVC already opened. dmachan = %d\n", rc);
331 @@ -976,6 +926,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
332 tn7atm_activate_vc_parm.priority = 2;
336 case ATM_VBR: /* Variable Bit Rate-Non RealTime*/
337 tn7atm_activate_vc_parm.qos = 1;
338 tn7atm_activate_vc_parm.priority = 1;
339 @@ -997,6 +948,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
340 tn7atm_activate_vc_parm.mbs = vcc->qos.txtp.max_pcr;
341 tn7atm_activate_vc_parm.cdvt = vcc->qos.txtp.max_cdv;
346 tn7atm_activate_vc_parm.qos = 2;
347 @@ -1024,7 +976,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
350 printk("failed to activate hw channel\n");
352 +// MOD_DEC_USE_COUNT;
353 tn7atm_lut_clear(vcc, tn7atm_activate_vc_parm.chan);
354 //spin_unlock_irqrestore(&chan_init_lock, flags);
356 @@ -1114,7 +1066,7 @@ void tn7atm_close (struct atm_vcc *vcc)
357 tn7atm_lut_clear (vcc, dmachan);
358 //spin_unlock_irqrestore (&closeLock, closeFlag);
361 +// MOD_DEC_USE_COUNT;
363 dgprintf (1, "Leave tn7atm_close\n");
365 @@ -1528,8 +1480,7 @@ int tn7atm_receive (void *os_dev, int ch
368 dgprintf (3, "pushing the skb...\n");
370 - skb->stamp = vcc->timestamp = xtime;
371 + __net_timestamp(skb);
373 xdump ((unsigned char *) skb->data, skb->len, 5);
375 @@ -1725,8 +1676,7 @@ static void tn7atm_exit (void)
377 kfree (dev->dev_data);
379 - // atm_dev_deregister (dev);
380 - shutdown_atm_dev (dev);
381 + atm_dev_deregister (dev);
384 * remove proc entries
385 @@ -1885,9 +1835,6 @@ static int __init tn7atm_detect (void)
387 * Set up proc entry for atm stats
389 - if (tn7atm_xlate_proc_name
390 - (drv_proc_root_folder, &root_proc_dir_entry, &residual))
392 printk ("Creating new root folder %s in the proc for the driver stats \n",
393 drv_proc_root_folder);
394 root_proc_dir_entry = proc_mkdir (drv_proc_root_folder, NULL);
395 @@ -1897,7 +1844,6 @@ static int __init tn7atm_detect (void)
398 proc_root_already_exists = FALSE;
402 * AV: Clean-up. Moved all the definitions to the data structure.
403 @@ -2479,7 +2425,5 @@ static int tn7atm_proc_qos_write(struct
408 module_init (tn7atm_detect);
409 module_exit (tn7atm_exit);
414 //#include "mips_support.h"
415 #include <linux/list.h>
417 -#include <linux/config.h>
418 +#define MIPS_EXCEPTION_OFFSET 8
419 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
421 #ifdef CONFIG_MODVERSIONS
422 #include <linux/modversions.h>
426 * 1/02/07 JZ CQ11054: Data Precision and Range Changes for TR-069 Conformance
427 * UR8_MERGE_END CQ11054*
428 *********************************************************************************************/
429 -#include <linux/config.h>
430 #include <linux/kernel.h>
431 #include <linux/module.h>
432 #include <linux/init.h>
434 #include <linux/delay.h>
435 #include <linux/spinlock.h>
436 #include <linux/smp_lock.h>
438 -#include <asm/mips-boards/prom.h>
439 #include <linux/proc_fs.h>
440 #include <linux/string.h>
441 #include <linux/ctype.h>
443 #include <linux/timer.h>
444 #include <linux/vmalloc.h>
445 #include <linux/file.h>
446 +#include <linux/firmware.h>
449 +#include <asm/ar7/ar7.h>
450 +#include <asm/ar7/prom.h>
452 /* Modules specific header files */
455 @@ -173,7 +176,7 @@ led_reg_t ledreg[2];
456 static struct led_funcs ledreg[2];
459 -#define DEV_DSLMOD 1
460 +#define DEV_DSLMOD CTL_UNNUMBERED
461 #define MAX_STR_SIZE 256
462 #define DSL_MOD_SIZE 256
464 @@ -299,7 +302,7 @@ static PITIDSLHW_T pIhw;
465 static volatile int bshutdown;
466 static char info[MAX_STR_SIZE];
467 /* Used for DSL Polling enable */
468 -static DECLARE_MUTEX_LOCKED (adsl_sem_overlay);
469 +static struct semaphore adsl_sem_overlay;
471 //kthread_t overlay_thread;
472 /* end of module wide declars */
473 @@ -323,6 +326,14 @@ static int tn7dsl_proc_snr_print (char *
474 #define gDot1(a) ((a>0)?(a%10):((-a)%10))
475 // UR8_MERGE_END CQ11054*
477 +int avalanche_request_intr_pacing(int irq_nr, unsigned int blk_num,
478 + unsigned int pace_value)
480 + printk("avalanche_request_pacing(%d, %u, %u); // not implemented\n", irq_nr, blk_num, pace_value);
485 int os_atoi(const char *pStr)
487 int MulNeg = (*pStr == '-' ? -1 : 1);
488 @@ -359,39 +370,6 @@ void dprintf (int uDbgLevel, char *szFmt
492 -int strcmp(const char *s1, const char *s2)
495 - int size = strlen(s1);
497 - return(strncmp(s1, s2, size));
500 -int strncmp(const char *s1, const char *s2, size_t size)
503 - int max_size = (int)size;
505 - while((s1[i] != 0) && i < max_size)
525 // * UR8_MERGE_START CQ10640 Jack Zhang
526 int tn7dsl_dump_dsp_memory(char *input_str) //cph99
528 @@ -441,101 +419,74 @@ unsigned int shim_osGetCpuFrequency(void
532 -int shim_osLoadFWImage(unsigned char *ptr)
533 +static void avsar_release(struct device *dev)
535 - unsigned int bytesRead;
536 - mm_segment_t oldfs;
537 - static struct file *filp;
538 - unsigned int imageLength=0x5ffff;
541 - dgprintf(4, "tn7dsl_read_dsp()\n");
543 - dgprintf(4,"open file %s\n", DSP_FIRMWARE_PATH);
545 - filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
548 - printk("Failed: Could not open DSP binary file\n");
552 - if (filp->f_dentry != NULL)
554 - if (filp->f_dentry->d_inode != NULL)
556 - printk ("DSP binary filesize = %d bytes\n",
557 - (int) filp->f_dentry->d_inode->i_size);
558 - imageLength = (unsigned int)filp->f_dentry->d_inode->i_size + 0x200;
562 - if (filp->f_op->read==NULL)
563 - return -1; /* File(system) doesn't allow reads */
566 - * Disable parameter checking
572 - * Now read bytes from postion "StartPos"
576 - bytesRead = filp->f_op->read(filp,ptr,imageLength,&filp->f_pos);
578 - dgprintf(4,"file length = %d\n", bytesRead);
588 + printk(KERN_DEBUG "avsar firmware released\n");
591 +static struct device avsar = {
593 + .release = avsar_release,
596 -unsigned int shim_read_overlay_page (void *ptr, unsigned int secOffset,
597 - unsigned int secLength)
598 +int shim_osLoadFWImage(unsigned char *ptr)
600 - unsigned int bytesRead;
601 - mm_segment_t oldfs;
604 - dgprintf(4,"shim_read_overlay_page\n");
605 - //dgprintf(4,"sec offset=%d, sec length =%d\n", secOffset, secLength);
606 + const struct firmware *fw_entry;
609 - filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
612 - printk("Failed: Could not open DSP binary file\n");
616 - if (filp->f_op->read==NULL)
617 - return -1; /* File(system) doesn't allow reads */
620 - * Now read bytes from postion "StartPos"
623 - if(filp->f_op->llseek)
624 - filp->f_op->llseek(filp,secOffset, 0);
627 - filp->f_pos = secOffset;
628 - bytesRead = filp->f_op->read(filp,ptr,secLength,&filp->f_pos);
636 + printk("requesting firmware image \"ar0700xx.bin\"\n");
637 + if(device_register(&avsar) < 0) {
639 + "avsar: device_register fails\n");
643 + if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
645 + "avsar: Firmware not available\n");
646 + device_unregister(&avsar);
649 + size = fw_entry->size;
650 + device_unregister(&avsar);
651 + if(size > 0x5ffff) {
653 + "avsar: Firmware too big (%d bytes)\n", size);
654 + release_firmware(fw_entry);
657 + memcpy(ptr, fw_entry->data, size);
658 + release_firmware(fw_entry);
662 +unsigned int shim_read_overlay_page(void *ptr, unsigned int secOffset, unsigned int secLength)
664 + const struct firmware *fw_entry;
666 + printk("requesting firmware image \"ar0700xx.bin\"\n");
667 + if(device_register(&avsar) < 0) {
669 + "avsar: device_register fails\n");
673 + if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
675 + "avsar: Firmware not available\n");
676 + device_unregister(&avsar);
679 + device_unregister(&avsar);
680 + if(fw_entry->size > secLength) {
682 + "avsar: Firmware too big (%d bytes)\n", fw_entry->size);
683 + release_firmware(fw_entry);
686 + memcpy(ptr + secOffset, fw_entry->data, secLength);
687 + release_firmware(fw_entry);
691 int shim_osLoadDebugFWImage(unsigned char *ptr)
692 @@ -3064,6 +3015,7 @@ int tn7dsl_init(void *priv)
693 int high_precision_selected = 0;
694 // UR8_MERGE_END CQ11054*
696 + sema_init(&adsl_sem_overlay, 0);
700 @@ -3442,7 +3394,7 @@ static int dslmod_sysctl(ctl_table *ctl,
704 - ret = proc_dostring(ctl, write, filp, buffer, lenp);
705 + ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
707 switch (ctl->ctl_name)
709 @@ -3528,14 +3480,14 @@ static int dslmod_sysctl(ctl_table *ctl,
712 len += sprintf(info+len, mod_req);
713 - ret = proc_dostring(ctl, write, filp, buffer, lenp);
714 + ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
720 ctl_table dslmod_table[] = {
721 - {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, &dslmod_sysctl}
722 + {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, NULL, &dslmod_sysctl, &sysctl_string}
726 @@ -3558,8 +3510,7 @@ void tn7dsl_dslmod_sysctl_register(void)
727 if (initialized == 1)
730 - dslmod_sysctl_header = register_sysctl_table(dslmod_root_table, 1);
731 - dslmod_root_table->child->de->owner = THIS_MODULE;
732 + dslmod_sysctl_header = register_sysctl_table(dslmod_root_table);
736 @@ -4821,4 +4772,4 @@ int tn7dsl_proc_PMDus(char* buf, char **
738 #endif //NO_ADV_STATS
740 -// * UR8_MERGE_END CQ11057 *
741 \ No newline at end of file
742 +// * UR8_MERGE_END CQ11057 *
746 * UR8_MERGE_END CQ10700
747 *******************************************************************************/
749 -#include <linux/config.h>
750 #include <linux/kernel.h>
751 #include <linux/module.h>
752 #include <linux/init.h>
754 #include <linux/delay.h>
755 #include <linux/spinlock.h>
756 #include <linux/smp_lock.h>
758 -#include <asm/mips-boards/prom.h>
759 #include <linux/proc_fs.h>
760 #include <linux/string.h>
761 #include <linux/ctype.h>
764 +#include <asm/ar7/ar7.h>
765 +#include <asm/ar7/prom.h>