diff -urN ixp425sar/ixp425sar.c ixp425sar.clean/ixp425sar.c --- ixp425sar/ixp425sar.c 2003-09-18 20:37:16.000000000 +0800 +++ ixp425sar.clean/ixp425sar.c 2003-12-12 15:12:18.000000000 +0800 @@ -21,6 +21,9 @@ *********************************************************************** * Notes: * +* Prashant Alves + - Added in support for CSR 1.3 +* *********************************************************************** */ @@ -50,7 +53,9 @@ #include /* for xtime */ #include #include +#ifndef CSR_1_3 #include +#endif /* CSR_1_3 */ #include #include #include @@ -67,6 +72,11 @@ #include #include +#ifdef CSR_1_3 +#include +#include +#endif /* CSR_1_3 */ + #ifdef ENABLE_FPATH # include #endif @@ -1757,7 +1767,7 @@ static int ixp425sar_proc_read(struct atm_dev *dev,loff_t *pos,char *page) { int left = (int) *pos; - + if (!left--) return sprintf(page, "line 1 of stats\n"); if (!left--) @@ -1802,6 +1812,81 @@ } #endif +#ifdef CSR_1_3 +#define PERIPHERAL_BUS_CLOCK (66) + +#define IX_EAA_ADSL_LINE_NUM 0 +#define IX_EAA_ADSL_LINE_TYPE 0 +#define IX_EAA_ADSL_PHY_TYPE_CPE 0 +#define TIMESTAMP_TICKS_PER_MSEC ((PERIPHERAL_BUS_CLOCK) * 1000) /*Time stamp*/ +#define MAX_TIME_LIMIT_IN_MSEC 120000 /* 120 sec */ + + +static struct completion init_exit; + +static int open_adsl_line() +{ + UINT32 startTime; + UINT32 stopTime; + UINT32 diffTime; + + IxAdslLineState adslLineState; + + /* Open ADSL Line */ + printk("Opening ADSL line..."); + if (IX_SUCCESS != ixAdslLineOpen(IX_EAA_ADSL_LINE_NUM, + IX_EAA_ADSL_LINE_TYPE, + IX_EAA_ADSL_PHY_TYPE_CPE)) { + printk("Fail to open ADSL line\n"); + return IX_FAIL; + } + printk("Successful\n"); + return IX_SUCCESS; +} + +static int adsl_thread(void *adsl_data) +{ + struct task_struct *tsk = current; + + daemonize(); + reparent_to_init(); + strcpy(tsk->comm, "adsl_detect_thread"); + tsk->tty = NULL; + + /* only want to receive SIGKILL */ + spin_lock_irq(&tsk->sigmask_lock); + siginitsetinv(&tsk->blocked, sigmask(SIGKILL)); + recalc_sigpending(tsk); + spin_unlock_irq(&tsk->sigmask_lock); + + complete(&init_exit); + + if ( IX_SUCCESS != open_adsl_line() ) { + printk("ADSL line open failed; ADSL detect thread exiting\n"); + return -EFAULT; + } + + printk("ADSL detect thread done\n"); + tsk = NULL; + complete_and_exit(&init_exit, 0); +} + +static int start_adsl_thread(void) +{ + int ret; + void *adsl_data; + + adsl_data = NULL; /* Dummy data for now */ + + printk("Starting kernel thread for ADSL line detection\n"); + init_completion(&init_exit); + ret = kernel_thread(adsl_thread, adsl_data, 0); + if (ret >= 0) { + wait_for_completion(&init_exit); + } + return IX_SUCCESS; +} +#endif /* CSR_1_3 */ /************************************************* * The init function. @@ -2063,7 +2148,13 @@ return -EFAULT; } #endif - +#ifdef CSR_1_3 + /* Redundant check, will always suceed */ + if ( IX_SUCCESS != start_adsl_thread() ) { + printk("ADSL line open failed\n"); + return -EFAULT; + } +#endif /* CSR_1_3 */ /* Console output */ printk(KERN_INFO KLOG_PREAMBLE "Initialised\n"); diff -urN ixp425sar/makefile ixp425sar.clean/makefile --- ixp425sar/makefile 1970-01-01 07:30:00.000000000 +0730 +++ ixp425sar.clean/makefile 2003-12-10 16:34:34.000000000 +0800 @@ -0,0 +1,28 @@ +# Makefile to build ixp425sar.o for CSR 1.3 +# Prashant Alves + +SRC_FILE = ixp425sar.c +O_TARGET = ixp425sar.o + +CROSS_COMPILER = arm-linux-gcc + +CFLAGS = -c -mbig-endian + +MODULE_DEFS = -DMODULE -D__KERNEL__ +ADD_DEFS = -DCSR_1_3 + +#KERNEL_HEADERS = /usr/src/coyote/linux-2.4.19.rmk7.ds3.mod.flash.exp.bus.csr.1.3/include/ +KERNEL_HEADERS = /usr/src/coyote/linux-2.4.19.rmk7.ds3/include/ + +CSR_SRC = /home/palves/data/code/ixp425_xscale_sw.mod + +INCLUDE_DIRS += -I$(KERNEL_HEADERS) +INCLUDE_DIRS += -I$(CSR_SRC)/src/include/ +INCLUDE_DIRS += -I$(CSR_SRC)/src/linux/ + +all: + $(CROSS_COMPILER) $(CFLAGS) $(MODULE_DEFS) $(ADD_DEFS) $(INCLUDE_DIRS) -o $(O_TARGET) $(SRC_FILE) + +clean: + rm $(O_TARGET) +