summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2007-04-20 23:48:26 +0000
committerFelix Fietkau <nbd@openwrt.org>2007-04-20 23:48:26 +0000
commite11dc153f3e5009c5b9fd1f1c2e0cf87e60fed9c (patch)
tree31cdb6c17f9213b7a3d79d1b75b65a2d3764f248
parent665cebde37b455c12c74aea06aba200faf252539 (diff)
downloadmtk-20170518-e11dc153f3e5009c5b9fd1f1c2e0cf87e60fed9c.zip
mtk-20170518-e11dc153f3e5009c5b9fd1f1c2e0cf87e60fed9c.tar.gz
mtk-20170518-e11dc153f3e5009c5b9fd1f1c2e0cf87e60fed9c.tar.bz2
add new ar7 dsl driver (thanks, matteo), mark ar7-2.4 as broken and enable ar7-2.6
SVN-Revision: 7020
-rw-r--r--package/ar7-atm/Makefile14
-rw-r--r--package/ar7-atm/patches/100-compile_fix.patch705
-rw-r--r--package/ar7-atm/patches/110-interrupt_fix.patch38
-rw-r--r--target/linux/ar7-2.4/Makefile2
-rw-r--r--target/linux/ar7-2.6/Makefile2
5 files changed, 733 insertions, 28 deletions
diff --git a/package/ar7-atm/Makefile b/package/ar7-atm/Makefile
index 1ff2186..1f41d3b 100644
--- a/package/ar7-atm/Makefile
+++ b/package/ar7-atm/Makefile
@@ -9,19 +9,19 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
-PKG_NAME:=sangam-atm
-PKG_VERSION:=0.1
+PKG_NAME:=sangam_atm
+PKG_VERSION:=07.01.00.10
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
-PKG_MD5SUM:=90c10702c9c3129e2ad1c01ce3975bf5
+PKG_MD5SUM:=d35e8889ada0f79b3f562bb12dcef0d4
include $(INCLUDE_DIR)/package.mk
define KernelPackage/sangam-atm-annex-a
SUBMENU:=Network Devices
- DEPENDS:=@LINUX_2_4_AR7 +kmod-atm
+ DEPENDS:=+kmod-atm
TITLE:=AR7 ADSL driver (Annex A)
DESCRIPTION:=The AR7 ADSL driver for Annex A
VERSION:=$(PKG_VERSION)+$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE)
@@ -44,11 +44,13 @@ define Build/Compile
endef
define KernelPackage/sangam-atm-annex-a/install
- $(INSTALL_DATA) $(PKG_BUILD_DIR)/ar0700xx_a.bin $(1)/lib/modules/ar0700xx.bin
+ mkdir -p $(1)/lib/firmware
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/ar0700mp.bin $(1)/lib/firmware/ar0700xx.bin
endef
define KernelPackage/sangam-atm-annex-b/install
- $(INSTALL_DATA) $(PKG_BUILD_DIR)/ar0700xx_b.bin $(1)/lib/modules/ar0700xx.bin
+ mkdir -p $(1)/lib/firmware
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/ar0700db.bin $(1)/lib/firmware/ar0700xx.bin
endef
$(eval $(call KernelPackage,sangam-atm-annex-a))
diff --git a/package/ar7-atm/patches/100-compile_fix.patch b/package/ar7-atm/patches/100-compile_fix.patch
index 46b0b0c..45ac1b1 100644
--- a/package/ar7-atm/patches/100-compile_fix.patch
+++ b/package/ar7-atm/patches/100-compile_fix.patch
@@ -1,28 +1,693 @@
-diff -ur sangam.old/Makefile sangam.dev/Makefile
---- sangam.old/Makefile 2006-10-17 16:43:09.000000000 +0200
-+++ sangam.dev/Makefile 2006-10-24 15:34:14.000000000 +0200
-@@ -1,17 +1,15 @@
--# File: drivers/net/avalanche_cpmac/Makefile
+diff -urN sangam_atm-07.01.00.10/cppi_cpaal5.c sangam-atm-0.3/cppi_cpaal5.c
+--- sangam_atm-07.01.00.10/cppi_cpaal5.c 2005-04-08 14:22:04.000000000 +0200
++++ sangam-atm-0.3/cppi_cpaal5.c 2007-04-17 13:45:11.000000000 +0200
+@@ -352,7 +352,7 @@
+ {
+ /* malloc failed, add this RCB to Needs Buffer List */
+ TempRcb->FragCount = 1; /*MJH+030417*/
+- (HAL_RCB *)TempRcb->Eop = TempRcb; /* GSG +030430 */
++ TempRcb->Eop = TempRcb; /* GSG +030430 */
+
+ if(HalDev->NeedsCount < MAX_NEEDS) /* +MJH 030410 */
+ { /* +MJH 030410 */
+diff -urN sangam_atm-07.01.00.10/dsl_hal_api.c sangam-atm-0.3/dsl_hal_api.c
+--- sangam_atm-07.01.00.10/dsl_hal_api.c 2006-10-26 16:46:54.000000000 +0200
++++ sangam-atm-0.3/dsl_hal_api.c 2007-04-19 01:12:40.000000000 +0200
+@@ -229,15 +229,15 @@
+ * 10/4/06 JZ CQ10979: Request for TR-069 Support for RP7.1
+ * UR8_MERGE_END CQ10979*
+ ******************************************************************************/
+-#include <dev_host_interface.h>
+-#include <dsl_hal_register.h>
+-#include <dsl_hal_support.h>
++#include "dev_host_interface.h"
++#include "dsl_hal_register.h"
++#include "dsl_hal_support.h"
+
+ #ifndef NO_ADV_STATS
+-#include <dsl_hal_logtable.h>
++#include "dsl_hal_logtable.h"
+ #endif
+
+-#include <dsl_hal_version.h>
++#include "dsl_hal_version.h"
+
+ static unsigned int hybrid_selected;
+ static unsigned int showtimeFlag = FALSE;
+diff -urN sangam_atm-07.01.00.10/dsl_hal_support.c sangam-atm-0.3/dsl_hal_support.c
+--- sangam_atm-07.01.00.10/dsl_hal_support.c 2006-08-11 21:17:38.000000000 +0200
++++ sangam-atm-0.3/dsl_hal_support.c 2007-04-19 01:13:30.000000000 +0200
+@@ -140,9 +140,9 @@
+ * oamFeature are overriden
+ // UR8_MERGE_END CQ10774 Ram
+ *******************************************************************************/
+-#include <dev_host_interface.h>
+-#include <dsl_hal_register.h>
+-#include <dsl_hal_support.h>
++#include "dev_host_interface.h"
++#include "dsl_hal_register.h"
++#include "dsl_hal_support.h"
+
+ #define NUM_READ_RETRIES 3
+ static unsigned int dslhal_support_adsl2ByteSwap32(unsigned int in32Bits);
+diff -urN sangam_atm-07.01.00.10/dsl_hal_support.h sangam-atm-0.3/dsl_hal_support.h
+--- sangam_atm-07.01.00.10/dsl_hal_support.h 2005-11-11 13:07:04.000000000 +0100
++++ sangam-atm-0.3/dsl_hal_support.h 2007-04-19 01:12:01.000000000 +0200
+@@ -49,7 +49,7 @@
+ * 04Nov05 0.11.00 CPH Fixed T1413 mode got Zero DS/US rate when DSL_BIT_TMODE is set.
+ *******************************************************************************/
+
+-#include <dsl_hal_api.h>
++#include "dsl_hal_api.h"
+
+ #define virtual2Physical(a) (((int)a)&~0xe0000000)
+ /* External Function Prototype Declarations */
+diff -urN sangam_atm-07.01.00.10/Makefile sangam-atm-0.3/Makefile
+--- sangam_atm-07.01.00.10/Makefile 2005-06-01 09:46:28.000000000 +0200
++++ sangam-atm-0.3/Makefile 2007-04-19 01:09:02.000000000 +0200
+@@ -1,18 +1,9 @@
+-# File: drivers/atm/ti_evm3/Makefile
#
--# Makefile for the Linux network (CPMAC) device drivers.
-+# Makefile for the TIATM device drivers.
+-# Makefile for the Texas Instruments EVM3 ADSL/ATM driver.
++# Makefile for the TIATM device driver.
#
+-#
+-# Copyright (c) 2000 Texas Instruments Incorporated.
+-# Jeff Harrell (jharrell@telogy.com)
+-# Viren Balar (vbalar@ti.com)
+-# Victor Wells (vwells@telogy.com)
+-#
+-include $(TOPDIR)/Rules.make
+-
+-
+-
+-
+-
+-
+
++CONFIG_SANGAM_ATM=m
++#EXTRA_CFLAGS += -DEL -I. -DPOST_SILICON -DCOMMON_NSP -DCONFIG_LED_MODULE -DDEREGISTER_LED -DNO_ACT
++EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -DNO_ACT -D__NO__VOICE_PATCH__ -DEL
++obj-$(CONFIG_SANGAM_ATM) := tiatm.o
++tiatm-objs += tn7atm.o tn7dsl.o tn7sar.o dsl_hal_api.o dsl_hal_support.o cpsar.o aal5sar.o
+diff -urN sangam_atm-07.01.00.10/tn7atm.c sangam-atm-0.3/tn7atm.c
+--- sangam_atm-07.01.00.10/tn7atm.c 2006-10-26 16:48:52.000000000 +0200
++++ sangam-atm-0.3/tn7atm.c 2007-04-18 15:34:05.000000000 +0200
+@@ -58,7 +58,6 @@
+ * UR8_MERGE_END CQ10979*
+ *********************************************************************************************/
+
+-#include <linux/config.h>
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/init.h>
+@@ -67,7 +66,7 @@
+ #include <linux/spinlock.h>
+ #include <linux/smp_lock.h>
+ #include <asm/io.h>
+-#include <asm/mips-boards/prom.h>
++#include <asm/ar7/ar7.h>
+ #include <linux/proc_fs.h>
+ #include <linux/string.h>
+ #include <linux/ctype.h>
+@@ -79,6 +78,7 @@
+ #include "dsl_hal_register.h"
+
+ #ifdef MODULE
++MODULE_LICENSE("GPL");
+ MODULE_DESCRIPTION ("Tnetd73xx ATM Device Driver");
+ MODULE_AUTHOR ("Zhicheng Tang");
+ #endif
+@@ -97,9 +97,9 @@
+
+ /*end of externs */
+
+-#ifndef TI_STATIC_ALLOCATIONS
+-#define TI_STATIC_ALLOCATIONS
+-#endif
++//#ifndef TI_STATIC_ALLOCATIONS
++//#define TI_STATIC_ALLOCATIONS
++//#endif
+
+ #define tn7atm_kfree_skb(x) dev_kfree_skb(x)
+
+@@ -111,7 +111,7 @@
+ /* prototypes */
+ static int tn7atm_set_can_support_adsl2 (int can);
+
+-static int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci);
++static int tn7atm_open (struct atm_vcc *vcc);
+
+ static void tn7atm_close (struct atm_vcc *vcc);
+
+@@ -254,13 +254,12 @@
+ getsockopt: NULL,
+ setsockopt: NULL,
+ send: tn7atm_send,
+- sg_send: NULL,
+ phy_put: NULL,
+ phy_get: NULL,
+ change_qos: tn7atm_change_qos,
+ };
+-const char drv_proc_root_folder[] = "avalanche/";
++const char drv_proc_root_folder[] = "avalanche";
+ static struct proc_dir_entry *root_proc_dir_entry = NULL;
+ #define DRV_PROC_MODE 0644
+ static int proc_root_already_exists = TRUE;
+@@ -549,56 +548,6 @@
+
+ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+- * Function: int tn7atm_walk_vccs(struct atm_dev *dev, short *vcc, int *vci)
+- *
+- * Description: retrieve VPI/VCI for connection
+- *
+- *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+-static int tn7atm_walk_vccs (struct atm_vcc *vcc, short *vpi, int *vci)
+-{
+- struct atm_vcc *walk;
+-
+- /*
+- * find a free VPI
+- */
+- if (*vpi == ATM_VPI_ANY)
+- {
+-
+- for (*vpi = 0, walk = vcc->dev->vccs; walk; walk = walk->next)
+- {
+-
+- if ((walk->vci == *vci) && (walk->vpi == *vpi))
+- {
+- (*vpi)++;
+- walk = vcc->dev->vccs;
+- }
+- }
+- }
+-
+- /*
+- * find a free VCI
+- */
+- if (*vci == ATM_VCI_ANY)
+- {
+-
+- for (*vci = ATM_NOT_RSV_VCI, walk = vcc->dev->vccs; walk;
+- walk = walk->next)
+- {
+-
+- if ((walk->vpi = *vpi) && (walk->vci == *vci))
+- {
+- *vci = walk->vci + 1;
+- walk = vcc->dev->vccs;
+- }
+- }
+- }
+-
+- return 0;
+-}
+-
+-
+-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+- *
+ * Function: int tn7atm_sar_irq(void)
+ *
+ * Description: tnetd73xx SAR interrupt.
+@@ -694,8 +643,8 @@
+ {
+ def_sar_inter_pace = os_atoi (ptr);
+ }
+- avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
+- def_sar_inter_pace);
++/* avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
++ def_sar_inter_pace);*/
+
+ /*
+ * Reigster Receive interrupt A
+@@ -865,11 +814,15 @@
+ #define ATM_VBR_RT 5
+ #endif
+
+-int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci)
++int tn7atm_open (struct atm_vcc *vcc)
+ {
+ tn7atm_activate_vc_parm_t tn7atm_activate_vc_parm;
+ int rc;
+ //int flags;
++ tn7atm_activate_vc_parm.pcr = 0x20000;
++ tn7atm_activate_vc_parm.scr = 0x20000;
++ tn7atm_activate_vc_parm.mbs = 0x20000;
++ tn7atm_activate_vc_parm.cdvt = 10000;
+
+ dgprintf(1, "tn7atm_open()\n");
+
+@@ -881,24 +834,18 @@
+ return -1;
+ }
+
+- MOD_INC_USE_COUNT;
-
- O_TARGET := tiatm.o
-+obj-m := tiatm.o
+- /* find a free VPI/VCI */
+- tn7atm_walk_vccs(vcc, &vpi, &vci);
+-
+- vcc->vpi = vpi;
+- vcc->vci = vci;
++// MOD_INC_USE_COUNT;
+
+- if ((vci == ATM_VCI_UNSPEC) || (vpi == ATM_VCI_UNSPEC))
++ if ((vcc->vci == ATM_VCI_UNSPEC) || (vcc->vpi == ATM_VCI_UNSPEC))
+ {
+- MOD_DEC_USE_COUNT;
++// MOD_DEC_USE_COUNT;
+ return -EBUSY;
+ }
+
+- tn7atm_activate_vc_parm.vpi = vpi;
+- tn7atm_activate_vc_parm.vci = vci;
++ tn7atm_activate_vc_parm.vpi = vcc->vpi;
++ tn7atm_activate_vc_parm.vci = vcc->vci;
+
+- if ((vpi == CLEAR_EOC_VPI) && (vci == CLEAR_EOC_VCI))
++ if ((vcc->vpi == CLEAR_EOC_VPI) && (vcc->vci == CLEAR_EOC_VCI))
+ {
+ /* always use (max_dma_chan+1) for clear eoc */
+ tn7atm_activate_vc_parm.chan = EOC_DMA_CHAN;
+@@ -906,7 +853,7 @@
+ /* check to see whether clear eoc is opened or not */
+ if (tn7atm_activate_vc_parm.priv->lut[tn7atm_activate_vc_parm.chan].inuse)
+ {
+- MOD_DEC_USE_COUNT;
++// MOD_DEC_USE_COUNT;
+ printk("tn7atm_open: Clear EOC channel (dmachan=%d) already in use.\n", tn7atm_activate_vc_parm.chan);
+ return -EBUSY;
+ }
+@@ -915,7 +862,7 @@
+ if (rc)
+ {
+ printk("tn7atm_open: failed to setup clear_eoc\n");
+- MOD_DEC_USE_COUNT;
++// MOD_DEC_USE_COUNT;
+ return -EBUSY;
+ }
+ tn7atm_set_lut(tn7atm_activate_vc_parm.priv,vcc, tn7atm_activate_vc_parm.chan);
+@@ -924,17 +871,17 @@
+ }
+ else /* PVC channel setup */
+ {
+- if ((vpi==REMOTE_MGMT_VPI) && (vci==REMOTE_MGMT_VCI))
++ if ((vcc->vpi==REMOTE_MGMT_VPI) && (vcc->vci==REMOTE_MGMT_VCI))
+ {
+ tn7atm_activate_vc_parm.chan = 14; /* always use chan 14 for MII PVC-base romote mgmt */
+ }
+ else
+ {
+- rc = tn7atm_lut_find(vpi, vci);
++ rc = tn7atm_lut_find(vcc->vpi, vcc->vci);
+ /* check to see whether PVC is opened or not */
+ if(ATM_NO_DMA_CHAN != rc)
+ {
+- MOD_DEC_USE_COUNT;
++// MOD_DEC_USE_COUNT;
+ printk("PVC already opened. dmachan = %d\n", rc);
+ return -EBUSY;
+ }
+@@ -966,6 +913,7 @@
+ tn7atm_activate_vc_parm.priority = 2;
+ break;
+
++#if 0
+ case ATM_VBR: /* Variable Bit Rate-Non RealTime*/
+ tn7atm_activate_vc_parm.qos = 1;
+ tn7atm_activate_vc_parm.priority = 1;
+@@ -987,6 +935,7 @@
+ tn7atm_activate_vc_parm.mbs = vcc->qos.txtp.max_pcr;
+ tn7atm_activate_vc_parm.cdvt = vcc->qos.txtp.max_cdv;
+ break;
++#endif
+
+ default:
+ tn7atm_activate_vc_parm.qos = 2;
+@@ -1014,7 +963,7 @@
+ if (rc < 0)
+ {
+ printk("failed to activate hw channel\n");
+- MOD_DEC_USE_COUNT;
++// MOD_DEC_USE_COUNT;
+ tn7atm_lut_clear(vcc, tn7atm_activate_vc_parm.chan);
+ //spin_unlock_irqrestore(&chan_init_lock, flags);
+ return -EBUSY;
+@@ -1104,7 +1053,7 @@
+ tn7atm_lut_clear (vcc, dmachan);
+ //spin_unlock_irqrestore (&closeLock, closeFlag);
+
+- MOD_DEC_USE_COUNT;
++// MOD_DEC_USE_COUNT;
+
+ dgprintf (1, "Leave tn7atm_close\n");
+ }
+@@ -1518,8 +1467,11 @@
+ * firewall is on */
+
+ dgprintf (3, "pushing the skb...\n");
+-
+- skb->stamp = vcc->timestamp = xtime;
++ {
++ struct timeval tv;
++ do_gettimeofday(&tv);
++ skb_set_timestamp(skb, &tv);
++ }
+
+ xdump ((unsigned char *) skb->data, skb->len, 5);
+
+@@ -1715,8 +1667,7 @@
+
+ kfree (dev->dev_data);
+
+- // atm_dev_deregister (dev);
+- shutdown_atm_dev (dev);
++ atm_dev_deregister (dev);
+
+ /*
+ * remove proc entries
+@@ -1875,9 +1826,6 @@
+ /*
+ * Set up proc entry for atm stats
+ */
+- if (tn7atm_xlate_proc_name
+- (drv_proc_root_folder, &root_proc_dir_entry, &residual))
+- {
+ printk ("Creating new root folder %s in the proc for the driver stats \n",
+ drv_proc_root_folder);
+ root_proc_dir_entry = proc_mkdir (drv_proc_root_folder, NULL);
+@@ -1887,7 +1835,6 @@
+ return -ENOMEM;
+ }
+ proc_root_already_exists = FALSE;
+- }
+
+ /*
+ * AV: Clean-up. Moved all the definitions to the data structure.
+@@ -2469,7 +2416,5 @@
+ return count;
+ }
+
+-#ifdef MODULE
+ module_init (tn7atm_detect);
+ module_exit (tn7atm_exit);
+-#endif /* MODULE */
+diff -urN sangam_atm-07.01.00.10/tn7atm.h sangam-atm-0.3/tn7atm.h
+--- sangam_atm-07.01.00.10/tn7atm.h 2006-04-05 11:33:06.000000000 +0200
++++ sangam-atm-0.3/tn7atm.h 2007-04-18 03:45:08.000000000 +0200
+@@ -19,7 +19,8 @@
+ //#include "mips_support.h"
+ #include <linux/list.h>
+
+-#include <linux/config.h>
++#define MIPS_EXCEPTION_OFFSET 8
++#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
+
+ #ifdef CONFIG_MODVERSIONS
+ #include <linux/modversions.h>
+diff -urN sangam_atm-07.01.00.10/tn7dsl.c sangam-atm-0.3/tn7dsl.c
+--- sangam_atm-07.01.00.10/tn7dsl.c 2006-10-26 16:48:44.000000000 +0200
++++ sangam-atm-0.3/tn7dsl.c 2007-04-18 15:45:58.000000000 +0200
+@@ -88,7 +88,6 @@
+ * 10/4/06 JZ CQ10979: Request for TR-069 Support for RP7.1
+ * UR8_MERGE_END CQ10979*
+ *********************************************************************************************/
+-#include <linux/config.h>
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/init.h>
+@@ -97,7 +96,7 @@
+ #include <linux/spinlock.h>
+ #include <linux/smp_lock.h>
+ #include <asm/io.h>
+-#include <asm/mips-boards/prom.h>
++#include <asm/ar7/ar7.h>
+ #include <linux/proc_fs.h>
+ #include <linux/string.h>
+ #include <linux/ctype.h>
+@@ -105,6 +104,8 @@
+ #include <linux/timer.h>
+ #include <linux/vmalloc.h>
+ #include <linux/file.h>
++#include <linux/firmware.h>
+
-+tiatm-objs += tn7atm.o tn7dsl.o tn7sar.o dsl_hal_api.o dsl_hal_support.o cpsar.o aal5sar.o
-+EXTRA_CFLAGS += -DEL -I. -DPOST_SILICON -DCOMMON_NSP -DCONFIG_LED_MODULE -DDEREGISTER_LED -DNO_ACT
+ /* Modules specific header files */
+ #include "tn7atm.h"
+ #include "tn7api.h"
+@@ -312,6 +313,14 @@
+ static int tn7dsl_proc_snr_print (char *buf, int count, int *eof, int data);
+ /* end of internal functions */
+
++int avalanche_request_intr_pacing(int irq_nr, unsigned int blk_num,
++ unsigned int pace_value)
++{
++ printk("avalanche_request_pacing(%d, %u, %u); // not implemented\n", irq_nr, blk_num, pace_value);
++ return 0;
++}
++
++
+ int os_atoi(const char *pStr)
+ {
+ int MulNeg = (*pStr == '-' ? -1 : 1);
+@@ -348,39 +357,6 @@
+ #endif
+ }
+
+-int strcmp(const char *s1, const char *s2)
+-{
+-
+- int size = strlen(s1);
+-
+- return(strncmp(s1, s2, size));
+-}
+-
+-int strncmp(const char *s1, const char *s2, size_t size)
+-{
+- int i = 0;
+- int max_size = (int)size;
+-
+- while((s1[i] != 0) && i < max_size)
+- {
+- if(s2[i] == 0)
+- {
+- return -1;
+- }
+- if(s1[i] != s2[i])
+- {
+- return 1;
+- }
+- i++;
+- }
+- if(s2[i] != 0)
+- {
+- return 1;
+- }
+-
+- return 0;
+-}
+-
+ // * UR8_MERGE_START CQ10640 Jack Zhang
+ int tn7dsl_dump_dsp_memory(char *input_str) //cph99
+ {
+@@ -430,101 +406,72 @@
+ return CpuFrequency;
+ }
+
+-int shim_osLoadFWImage(unsigned char *ptr)
++static void avsar_release(struct device *dev)
+ {
+- unsigned int bytesRead;
+- mm_segment_t oldfs;
+- static struct file *filp;
+- unsigned int imageLength=0x5ffff;
+-
+-
+- dgprintf(4, "tn7dsl_read_dsp()\n");
+-
+- dgprintf(4,"open file %s\n", DSP_FIRMWARE_PATH);
+-
+- filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
+- if(filp ==NULL)
+- {
+- printk("Failed: Could not open DSP binary file\n");
+- return -1;
+- }
+-
+- if (filp->f_dentry != NULL)
+- {
+- if (filp->f_dentry->d_inode != NULL)
+- {
+- printk ("DSP binary filesize = %d bytes\n",
+- (int) filp->f_dentry->d_inode->i_size);
+- imageLength = (unsigned int)filp->f_dentry->d_inode->i_size + 0x200;
+- }
+- }
+-
+- if (filp->f_op->read==NULL)
+- return -1; /* File(system) doesn't allow reads */
+-
+- /*
+- * Disable parameter checking
+- */
+- oldfs = get_fs();
+- set_fs(KERNEL_DS);
+-
+- /*
+- * Now read bytes from postion "StartPos"
+- */
+- filp->f_pos = 0;
+-
+- bytesRead = filp->f_op->read(filp,ptr,imageLength,&filp->f_pos);
+-
+- dgprintf(4,"file length = %d\n", bytesRead);
+-
+- set_fs(oldfs);
+-
+- /*
+- * Close the file
+- */
+- fput(filp);
+-
+- return bytesRead;
++ printk(KERN_DEBUG "avsar firmware released\n");
+ }
+
++static struct device avsar = {
++ .bus_id = "vlynq",
++ .release = avsar_release,
++};
+
+-unsigned int shim_read_overlay_page (void *ptr, unsigned int secOffset,
+- unsigned int secLength)
++int shim_osLoadFWImage(unsigned char *ptr)
+ {
+- unsigned int bytesRead;
+- mm_segment_t oldfs;
+- struct file *filp;
+-
+- dgprintf(4,"shim_read_overlay_page\n");
+- //dgprintf(4,"sec offset=%d, sec length =%d\n", secOffset, secLength);
+-
+- filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
+- if(filp ==NULL)
+- {
+- printk("Failed: Could not open DSP binary file\n");
+- return -1;
+- }
+-
+- if (filp->f_op->read==NULL)
+- return -1; /* File(system) doesn't allow reads */
+-
+- /*
+- * Now read bytes from postion "StartPos"
+- */
+-
+- if(filp->f_op->llseek)
+- filp->f_op->llseek(filp,secOffset, 0);
+- oldfs = get_fs();
+- set_fs(KERNEL_DS);
+- filp->f_pos = secOffset;
+- bytesRead = filp->f_op->read(filp,ptr,secLength,&filp->f_pos);
++ const struct firmware *fw_entry;
+
+- set_fs(oldfs);
+- /*
+- * Close the file
+- */
+- fput(filp);
+- return bytesRead;
++ printk("requesting firmware image \"ar0700xx.bin\"\n");
++ if(device_register(&avsar) < 0) {
++ printk(KERN_ERR
++ "avsar: device_register fails\n");
++ return -1;
++ }
++
++ if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
++ printk(KERN_ERR
++ "avsar: Firmware not available\n");
++ device_unregister(&avsar);
++ return -1;
++ }
++ device_unregister(&avsar);
++ if(fw_entry->size > 0x5ffff) {
++ printk(KERN_ERR
++ "avsar: Firmware too big (%d bytes)\n", fw_entry->size);
++ release_firmware(fw_entry);
++ return -1;
++ }
++ memcpy(ptr, fw_entry->data, fw_entry->size);
++ release_firmware(fw_entry);
++ return fw_entry->size;
++}
++
++unsigned int shim_read_overlay_page(void *ptr, unsigned int secOffset, unsigned int secLength)
++{
++ const struct firmware *fw_entry;
++
++ printk("requesting firmware image \"ar0700xx.bin\"\n");
++ if(device_register(&avsar) < 0) {
++ printk(KERN_ERR
++ "avsar: device_register fails\n");
++ return -1;
++ }
++
++ if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
++ printk(KERN_ERR
++ "avsar: Firmware not available\n");
++ device_unregister(&avsar);
++ return -1;
++ }
++ device_unregister(&avsar);
++ if(fw_entry->size > secLength) {
++ printk(KERN_ERR
++ "avsar: Firmware too big (%d bytes)\n", fw_entry->size);
++ release_firmware(fw_entry);
++ return -1;
++ }
++ memcpy(ptr + secOffset, fw_entry->data, secLength);
++ release_firmware(fw_entry);
++ return fw_entry->size;
+ }
--obj-m += tiatm.o
--tiatm-objs := tn7atm.o tn7dsl.o tn7sar.o dsl_hal_api.o dsl_hal_support.o cpsar.o aal5sar.o
-+include $(TOPDIR)/Rules.make
+ int shim_osLoadDebugFWImage(unsigned char *ptr)
+@@ -3367,7 +3314,7 @@
+ */
+ if(write)
+ {
+- ret = proc_dostring(ctl, write, filp, buffer, lenp);
++ ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
- tiatm.o: $(tiatm-objs)
-- $(LD) $(LDOPTS) -o wlan.$(KMODSUF) -r $(tiatm-objs)
--
--EXTRA_CFLAGS += -DEL -I. -DPOST_SILICON -DCOMMON_NSP -DCONFIG_LED_MODULE -DDEREGISTER_LED -DNO_ACT
-+ $(LD) -r $(LDOPTS) -o $@ $(tiatm-objs)
+ switch (ctl->ctl_name)
+ {
+@@ -3453,7 +3400,7 @@
+ else
+ {
+ len += sprintf(info+len, mod_req);
+- ret = proc_dostring(ctl, write, filp, buffer, lenp);
++ ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
+ }
+ return ret;
+ }
+diff -urN sangam_atm-07.01.00.10/tn7sar.c sangam-atm-0.3/tn7sar.c
+--- sangam_atm-07.01.00.10/tn7sar.c 2006-07-27 10:34:42.000000000 +0200
++++ sangam-atm-0.3/tn7sar.c 2007-04-18 03:47:39.000000000 +0200
+@@ -42,7 +42,6 @@
+ * UR8_MERGE_END CQ10700
+ *******************************************************************************/
---include $(TOPDIR)/Rules.make
+-#include <linux/config.h>
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/init.h>
+@@ -51,7 +50,7 @@
+ #include <linux/spinlock.h>
+ #include <linux/smp_lock.h>
+ #include <asm/io.h>
+-#include <asm/mips-boards/prom.h>
++#include <asm/ar7/ar7.h>
+ #include <linux/proc_fs.h>
+ #include <linux/string.h>
+ #include <linux/ctype.h>
diff --git a/package/ar7-atm/patches/110-interrupt_fix.patch b/package/ar7-atm/patches/110-interrupt_fix.patch
new file mode 100644
index 0000000..3883847
--- /dev/null
+++ b/package/ar7-atm/patches/110-interrupt_fix.patch
@@ -0,0 +1,38 @@
+diff -ur atm.old/tn7atm.c atm.dev/tn7atm.c
+--- atm.old/tn7atm.c 2007-04-20 21:04:28.479287240 +0200
++++ atm.dev/tn7atm.c 2007-04-20 21:09:05.288205888 +0200
+@@ -553,7 +553,7 @@
+ * Description: tnetd73xx SAR interrupt.
+ *
+ *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+-static void tn7atm_sar_irq (int irq, void *voiddev, struct pt_regs *regs)
++static irqreturn_t tn7atm_sar_irq (int irq, void *voiddev)
+ {
+ struct atm_dev *atmdev;
+ Tn7AtmPrivate *priv;
+@@ -580,6 +580,7 @@
+ #ifdef TIATM_INST_SUPP
+ psp_trace_par (ATM_DRV_SAR_ISR_EXIT, retval);
+ #endif
++ return IRQ_HANDLED;
+ }
+
+ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+@@ -589,7 +590,7 @@
+ * Description: tnetd73xx DSL interrupt.
+ *
+ *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+-static void tn7atm_dsl_irq (int irq, void *voiddev, struct pt_regs *regs)
++static irqreturn_t tn7atm_dsl_irq (int irq, void *voiddev)
+ {
+ struct atm_dev *atmdev;
+ Tn7AtmPrivate *priv;
+@@ -611,6 +612,8 @@
+ #ifdef TIATM_INST_SUPP
+ psp_trace_par (ATM_DRV_DSL_ISR_EXIT, retval);
+ #endif
++
++ return IRQ_HANDLED;
+ }
+
+ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/target/linux/ar7-2.4/Makefile b/target/linux/ar7-2.4/Makefile
index 87c2470..6f70532 100644
--- a/target/linux/ar7-2.4/Makefile
+++ b/target/linux/ar7-2.4/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
ARCH:=mipsel
BOARD:=ar7
BOARDNAME:=TI AR7
-FEATURES:=squashfs jffs2
+FEATURES:=squashfs jffs2 broken
define Target/Description
Build firmware images for TI AR7 based routers (w.g. Linksys WAG54G v2)
diff --git a/target/linux/ar7-2.6/Makefile b/target/linux/ar7-2.6/Makefile
index e1394eb..b20cb11 100644
--- a/target/linux/ar7-2.6/Makefile
+++ b/target/linux/ar7-2.6/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
ARCH:=mipsel
BOARD:=ar7
BOARDNAME:=TI AR7
-FEATURES:=squashfs jffs2 broken
+FEATURES:=squashfs jffs2
define Target/Description
Build firmware images for TI AR7 based routers