+++ /dev/null
-menu "Configuration"
- depends on (PACKAGE_kmod-sangam-atm-annex-a || PACKAGE_kmod-sangam-atm-annex-b)
-
-choice
- prompt "Firmware version"
- default AR7_ATM_FW_VERSION_704
- help
- This option allows you to switch between firmware/driver versions which
- might improve the DSL line speed.
-
-config AR7_ATM_FW_VERSION_705
- bool "D7.05.01.00"
-
-config AR7_ATM_FW_VERSION_704
- bool "D7.04.03.00"
-
-config AR7_ATM_FW_VERSION_703
- bool "D7.03.01.00"
-
-endchoice
-
-endmenu
+++ /dev/null
-#
-# Copyright (C) 2006-2009 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=sangam_atm
-
-ifeq ($(CONFIG_AR7_ATM_FW_VERSION_705),y)
-PKG_VERSION:=D7.05.01.00
-PKG_MD5SUM:=42ee465be5cfbe9476fc25deb260d450
-PKG_RELEASE:=R1
-PATCH_DIR:=patches-$(PKG_VERSION)
-endif
-
-ifeq ($(CONFIG_AR7_ATM_FW_VERSION_704),y)
-PKG_VERSION:=D7.04.03.00
-PKG_MD5SUM:=3d76004e46f09e88931f91670cb420ad
-PKG_RELEASE:=R1
-PATCH_DIR:=patches-$(PKG_VERSION)
-endif
-
-ifeq ($(CONFIG_AR7_ATM_FW_VERSION_703),y)
-PKG_VERSION:=D7.03.01.00
-PKG_MD5SUM:=bc6e9c6adb1be25820c7ee661de8ca7d
-PKG_RELEASE:=R2
-PATCH_DIR:=patches-D7.04.03.00
-endif
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE).tar.bz2
-PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
-
-include $(INCLUDE_DIR)/package.mk
-
-define KernelPackage/sangam-atm/Default
- SUBMENU:=Network Devices
- DEPENDS:=@TARGET_ar7 +kmod-atm
- TITLE:=AR7 ADSL driver
- FILES:=$(PKG_BUILD_DIR)/tiatm.ko
- AUTOLOAD:=$(call AutoLoad,50,tiatm)
- MAINTAINER:=Florian Fainelli <florian@openwrt.org>
- MENU:=1
-endef
-
-define KernelPackage/sangam-atm/config
- source "$(SOURCE)/Config.in"
-endef
-
-define KernelPackage/sangam-atm-annex-a
-$(call KernelPackage/sangam-atm/Default)
- TITLE+= (Annex A, ADSL over POTS)
-endef
-
-define KernelPackage/sangam-atm-annex-a/description
- The AR7 ADSL driver for Annex A (ADSL over POTS).
-endef
-
-define KernelPackage/sangam-atm-annex-a/config
-$(call KernelPackage/sangam-atm/config)
-endef
-
-define KernelPackage/sangam-atm-annex-b
-$(call KernelPackage/sangam-atm/Default)
- TITLE+= (Annex B, ADSL over ISDN)
-endef
-
-define KernelPackage/sangam-atm-annex-b/description
- The AR7 ADSL driver for Annex B (ADSL over ISDN).
-endef
-
-define KernelPackage/sangam-atm-annex-a/config
-$(call KernelPackage/sangam-atm/config)
-endef
-
-define Build/Compile
- $(MAKE) -C "$(LINUX_DIR)" \
- CROSS_COMPILE="$(TARGET_CROSS)" \
- ARCH="$(LINUX_KARCH)" \
- SUBDIRS="$(PKG_BUILD_DIR)" \
- modules
-endef
-
-define KernelPackage/sangam-atm-annex-a/install
- mkdir -p $(1)/lib/firmware
- $(INSTALL_DATA) $(PKG_BUILD_DIR)/ar0700mp.bin $(1)/lib/firmware/
- ln -sf ar0700mp.bin $(1)/lib/firmware/ar0700xx.bin
-endef
-
-define KernelPackage/sangam-atm-annex-b/install
- mkdir -p $(1)/lib/firmware
- $(INSTALL_DATA) $(PKG_BUILD_DIR)/ar0700db.bin $(1)/lib/firmware/
- ln -sf ar0700db.bin $(1)/lib/firmware/ar0700xx.bin
-endef
-
-$(eval $(call KernelPackage,sangam-atm-annex-a))
-$(eval $(call KernelPackage,sangam-atm-annex-b))
+++ /dev/null
---- a/cppi_cpaal5.c
-+++ b/cppi_cpaal5.c
-@@ -352,7 +352,7 @@ static int halRxReturn(HAL_RECEIVEINFO *
- {
- /* 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 */
---- a/dsl_hal_api.c
-+++ b/dsl_hal_api.c
-@@ -254,15 +254,15 @@
- * of phyEnableDisableWord & phyControlWord to avoid changing API struct
- * which may cause change required to application data structure.
- ******************************************************************************/
--#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"
-
- // UR8_MERGE_START CQ11054 Jack Zhang
- static unsigned int highprecision_selected = 0; //By default we use low precision for backward compt.
---- a/dsl_hal_support.c
-+++ b/dsl_hal_support.c
-@@ -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);
---- a/dsl_hal_support.h
-+++ b/dsl_hal_support.h
-@@ -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 */
---- a/Makefile
-+++ b/Makefile
-@@ -1,18 +1,9 @@
--# File: drivers/atm/ti_evm3/Makefile
- #
--# 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 += cpsar.o aal5sar.o tn7sar.o tn7atm.o tn7dsl.o dsl_hal_api.o dsl_hal_support.o
---- a/tn7atm.c
-+++ b/tn7atm.c
-@@ -61,7 +61,6 @@
- * UR8_MERGE_END CQ11057*
- *********************************************************************************************/
-
--#include <linux/config.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/init.h>
-@@ -69,11 +68,14 @@
- #include <linux/delay.h>
- #include <linux/spinlock.h>
- #include <linux/smp_lock.h>
--#include <asm/io.h>
--#include <asm/mips-boards/prom.h>
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
-+
-+#include <asm/io.h>
-+#include <asm/ar7/ar7.h>
-+#include <asm/ar7/prom.h>
-+
- #include "dsl_hal_api.h"
- #include "tn7atm.h"
- #include "tn7api.h"
-@@ -82,6 +84,7 @@
- #include "dsl_hal_register.h"
-
- #ifdef MODULE
-+MODULE_LICENSE("GPL");
- MODULE_DESCRIPTION ("Tnetd73xx ATM Device Driver");
- MODULE_AUTHOR ("Zhicheng Tang");
- #endif
-@@ -100,9 +103,9 @@ MODULE_AUTHOR ("Zhicheng Tang");
-
- /*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)
-
-@@ -114,7 +117,7 @@ static int EnableQoS = FALSE;
- /* 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);
-
-@@ -257,13 +260,12 @@ static const struct atmdev_ops tn7atm_op
- 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;
-@@ -559,56 +561,6 @@ static int turbodsl_check_priority_type(
-
- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
-- * 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.
-@@ -693,7 +645,7 @@ static int __init tn7atm_irq_request (st
- * Register SAR interrupt
- */
- priv->sar_irq = LNXINTNUM (ATM_SAR_INT); /* Interrupt line # */
-- if (request_irq (priv->sar_irq, tn7atm_sar_irq, SA_INTERRUPT, "SAR ", dev))
-+ if (request_irq (priv->sar_irq, tn7atm_sar_irq, IRQF_DISABLED, "SAR ", dev))
- printk ("Could not register tn7atm_sar_irq\n");
-
- /*
-@@ -704,14 +656,14 @@ static int __init tn7atm_irq_request (st
- {
- 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
- */
- priv->dsl_irq = LNXINTNUM (ATM_DSL_INT); /* Interrupt line # */
-- if (request_irq (priv->dsl_irq, tn7atm_dsl_irq, SA_INTERRUPT, "DSL ", dev))
-+ if (request_irq (priv->dsl_irq, tn7atm_dsl_irq, IRQF_DISABLED, "DSL ", dev))
- printk ("Could not register tn7atm_dsl_irq\n");
-
- /***** VRB Tasklet Mode ****/
-@@ -875,11 +827,15 @@ static int __init tn7atm_get_ESI (struct
- #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");
-
-@@ -891,24 +847,18 @@ int tn7atm_open (struct atm_vcc *vcc, sh
- return -1;
- }
-
-- MOD_INC_USE_COUNT;
-+// MOD_INC_USE_COUNT;
-
-- /* find a free VPI/VCI */
-- tn7atm_walk_vccs(vcc, &vpi, &vci);
--
-- vcc->vpi = vpi;
-- vcc->vci = vci;
--
-- 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;
-@@ -916,7 +866,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
- /* 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;
- }
-@@ -925,7 +875,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
- 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);
-@@ -934,17 +884,17 @@ int tn7atm_open (struct atm_vcc *vcc, sh
- }
- 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;
- }
-@@ -976,6 +926,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
- 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;
-@@ -997,6 +948,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
- 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;
-@@ -1024,7 +976,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
- 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;
-@@ -1114,7 +1066,7 @@ void tn7atm_close (struct atm_vcc *vcc)
- tn7atm_lut_clear (vcc, dmachan);
- //spin_unlock_irqrestore (&closeLock, closeFlag);
-
-- MOD_DEC_USE_COUNT;
-+// MOD_DEC_USE_COUNT;
-
- dgprintf (1, "Leave tn7atm_close\n");
- }
-@@ -1528,8 +1480,7 @@ int tn7atm_receive (void *os_dev, int ch
- * firewall is on */
-
- dgprintf (3, "pushing the skb...\n");
--
-- skb->stamp = vcc->timestamp = xtime;
-+ __net_timestamp(skb);
-
- xdump ((unsigned char *) skb->data, skb->len, 5);
-
-@@ -1725,8 +1676,7 @@ static void tn7atm_exit (void)
-
- kfree (dev->dev_data);
-
-- // atm_dev_deregister (dev);
-- shutdown_atm_dev (dev);
-+ atm_dev_deregister (dev);
-
- /*
- * remove proc entries
-@@ -1885,9 +1835,6 @@ static int __init tn7atm_detect (void)
- /*
- * 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);
-@@ -1897,7 +1844,6 @@ static int __init tn7atm_detect (void)
- return -ENOMEM;
- }
- proc_root_already_exists = FALSE;
-- }
-
- /*
- * AV: Clean-up. Moved all the definitions to the data structure.
-@@ -2479,7 +2425,5 @@ static int tn7atm_proc_qos_write(struct
- return count;
- }
-
--#ifdef MODULE
- module_init (tn7atm_detect);
- module_exit (tn7atm_exit);
--#endif /* MODULE */
---- a/tn7atm.h
-+++ b/tn7atm.h
-@@ -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>
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -94,7 +94,6 @@
- * 1/02/07 JZ CQ11054: Data Precision and Range Changes for TR-069 Conformance
- * UR8_MERGE_END CQ11054*
- *********************************************************************************************/
--#include <linux/config.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/init.h>
-@@ -102,8 +101,6 @@
- #include <linux/delay.h>
- #include <linux/spinlock.h>
- #include <linux/smp_lock.h>
--#include <asm/io.h>
--#include <asm/mips-boards/prom.h>
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
-@@ -111,6 +108,12 @@
- #include <linux/timer.h>
- #include <linux/vmalloc.h>
- #include <linux/file.h>
-+#include <linux/firmware.h>
-+
-+#include <asm/io.h>
-+#include <asm/ar7/ar7.h>
-+#include <asm/ar7/prom.h>
-+
- /* Modules specific header files */
- #include "tn7atm.h"
- #include "tn7api.h"
-@@ -173,7 +176,7 @@ led_reg_t ledreg[2];
- static struct led_funcs ledreg[2];
- #endif
-
--#define DEV_DSLMOD 1
-+#define DEV_DSLMOD CTL_UNNUMBERED
- #define MAX_STR_SIZE 256
- #define DSL_MOD_SIZE 256
-
-@@ -299,7 +302,7 @@ static PITIDSLHW_T pIhw;
- static volatile int bshutdown;
- static char info[MAX_STR_SIZE];
- /* Used for DSL Polling enable */
--static DECLARE_MUTEX_LOCKED (adsl_sem_overlay);
-+static struct semaphore adsl_sem_overlay;
-
- //kthread_t overlay_thread;
- /* end of module wide declars */
-@@ -323,6 +326,14 @@ static int tn7dsl_proc_snr_print (char *
- #define gDot1(a) ((a>0)?(a%10):((-a)%10))
- // UR8_MERGE_END CQ11054*
-
-+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);
-@@ -359,39 +370,6 @@ void dprintf (int uDbgLevel, char *szFmt
- #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
- {
-@@ -441,101 +419,74 @@ unsigned int shim_osGetCpuFrequency(void
- 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);
-+ const struct firmware *fw_entry;
-+ size_t size;
-
-- 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);
--
-- 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;
-+ }
-+ size = fw_entry->size;
-+ device_unregister(&avsar);
-+ if(size > 0x5ffff) {
-+ printk(KERN_ERR
-+ "avsar: Firmware too big (%d bytes)\n", size);
-+ release_firmware(fw_entry);
-+ return -1;
-+ }
-+ memcpy(ptr, fw_entry->data, size);
-+ release_firmware(fw_entry);
-+ return 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 secLength;
- }
-
- int shim_osLoadDebugFWImage(unsigned char *ptr)
-@@ -3064,6 +3015,7 @@ int tn7dsl_init(void *priv)
- int high_precision_selected = 0;
- // UR8_MERGE_END CQ11054*
-
-+ sema_init(&adsl_sem_overlay, 0);
- /*
- * start dsl
- */
-@@ -3442,7 +3394,7 @@ static int dslmod_sysctl(ctl_table *ctl,
- */
- if(write)
- {
-- ret = proc_dostring(ctl, write, filp, buffer, lenp);
-+ ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
-
- switch (ctl->ctl_name)
- {
-@@ -3528,14 +3480,14 @@ static int dslmod_sysctl(ctl_table *ctl,
- 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;
- }
-
-
- ctl_table dslmod_table[] = {
-- {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, &dslmod_sysctl}
-+ {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, NULL, &dslmod_sysctl, &sysctl_string}
- ,
- {0}
- };
-@@ -3558,8 +3510,7 @@ void tn7dsl_dslmod_sysctl_register(void)
- if (initialized == 1)
- return;
-
-- dslmod_sysctl_header = register_sysctl_table(dslmod_root_table, 1);
-- dslmod_root_table->child->de->owner = THIS_MODULE;
-+ dslmod_sysctl_header = register_sysctl_table(dslmod_root_table);
-
- /*
- * set the defaults
-@@ -4821,4 +4772,4 @@ int tn7dsl_proc_PMDus(char* buf, char **
- }
- #endif //NO_ADV_STATS
- #endif //TR69_PMD_IN
--// * UR8_MERGE_END CQ11057 *
-\ No newline at end of file
-+// * UR8_MERGE_END CQ11057 *
---- a/tn7sar.c
-+++ b/tn7sar.c
-@@ -42,7 +42,6 @@
- * UR8_MERGE_END CQ10700
- *******************************************************************************/
-
--#include <linux/config.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/init.h>
-@@ -50,12 +49,13 @@
- #include <linux/delay.h>
- #include <linux/spinlock.h>
- #include <linux/smp_lock.h>
--#include <asm/io.h>
--#include <asm/mips-boards/prom.h>
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
-
-+#include <asm/io.h>
-+#include <asm/ar7/ar7.h>
-+#include <asm/ar7/prom.h>
-
- #define _CPHAL_AAL5
- #define _CPHAL_SAR
+++ /dev/null
---- a/tn7atm.c
-+++ b/tn7atm.c
-@@ -566,7 +566,7 @@ static int turbodsl_check_priority_type(
- * 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;
-@@ -593,6 +593,7 @@ static void tn7atm_sar_irq (int irq, voi
- #ifdef TIATM_INST_SUPP
- psp_trace_par (ATM_DRV_SAR_ISR_EXIT, retval);
- #endif
-+ return IRQ_HANDLED;
- }
-
- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-@@ -602,7 +603,7 @@ static void tn7atm_sar_irq (int irq, voi
- * 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;
-@@ -624,6 +625,8 @@ static void tn7atm_dsl_irq (int irq, voi
- #ifdef TIATM_INST_SUPP
- psp_trace_par (ATM_DRV_DSL_ISR_EXIT, retval);
- #endif
-+
-+ return IRQ_HANDLED;
- }
-
- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+++ /dev/null
---- a/tn7api.h
-+++ b/tn7api.h
-@@ -107,7 +107,7 @@ int tn7dsl_proc_dbg_rmsgs4(char* buf, ch
-
- int tn7dsl_proc_write_stats(struct file *fp, const char * buf, unsigned long count, void * data);
- int tn7dsl_proc_modem(char* buf, char **start, off_t offset, int count,int *eof, void *data);
--inline int tn7dsl_handle_interrupt(void);
-+int tn7dsl_handle_interrupt(void);
-
- void tn7dsl_dslmod_sysctl_register(void);
- void tn7dsl_dslmod_sysctl_unregister(void);
+++ /dev/null
---- a/dsl_hal_advcfg.c
-+++ b/dsl_hal_advcfg.c
-@@ -36,9 +36,9 @@
- * 05Jul05 0.00.09 CPH CQ9775: Change dslhal_advcfg_configDsTones input parameters & support for ADSL2+
- * 24Jul05 0.00.10 CPH Fixed comments in dslhal_advcfg_configDsTones function header
- *******************************************************************************/
--#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"
-
- /*****************************************************************************/
- /* ACT API functions -- To be moved into their own independent module --RamP */
---- a/Makefile
-+++ b/Makefile
-@@ -4,6 +4,7 @@
-
- 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
-+#EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -DNO_ACT -D__NO__VOICE_PATCH__ -DEL
-+EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -D__NO__VOICE_PATCH__ -DEL
- obj-$(CONFIG_SANGAM_ATM) := tiatm.o
--tiatm-objs += cpsar.o aal5sar.o tn7sar.o tn7atm.o tn7dsl.o dsl_hal_api.o dsl_hal_support.o
-+tiatm-objs += cpsar.o aal5sar.o tn7sar.o tn7atm.o tn7dsl.o dsl_hal_api.o dsl_hal_support.o dsl_hal_advcfg.o
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -2869,6 +2869,14 @@ static int tn7dsl_set_dsl(void)
- dslhal_api_setRateAdaptFlag(pIhw, os_atoi(ptr));
- }
-
-+ // set powercutback
-+ ptr = NULL;
-+ ptr = prom_getenv("powercutback");
-+ if(ptr)
-+ {
-+ dslhal_advcfg_onOffPcb(pIhw, os_atoi(ptr));
-+ }
-+
- // trellis
- ptr = NULL;
- ptr = prom_getenv("trellis");
+++ /dev/null
---- a/tn7sar.c
-+++ b/tn7sar.c
-@@ -103,10 +103,10 @@ enum
-
- #define RESERVED_OAM_CHANNEL 15
-
--#define AAL5_PARM "id=aal5, base = 0x03000000, offset = 0, int_line=15, ch0=[RxBufSize=1522; RxNumBuffers = 32; RxServiceMax = 50; TxServiceMax=50; TxNumBuffers=32; CpcsUU=0x5aa5; TxVc_CellRate=0x3000; TxVc_AtmHeader=0x00000640]"
--#define SAR_PARM "id=sar,base = 0x03000000, reset_bit = 9, offset = 0; UniNni = 0, PdspEnable = 1"
-+#define CH0_PARM "RxBufSize=1522, RxNumBuffers=32, RxServiceMax=50, TxServiceMax=50, TxNumBuffers=32, CpcsUU=0x5aa5, TxVc_CellRate=0x3000, TxVc_AtmHeader=0x00000640"
-+#define AAL5_PARM "id=aal5, base=0x03000000, offset=0, int_line=15, ch0=[" CH0_PARM "]"
-+#define SAR_PARM "id=sar, base=0x03000000, reset_bit=9, offset=0; UniNni=0, PdspEnable=1, Debug=0xFFFFFFFF"
- #define RESET_PARM "id=ResetControl, base=0xA8611600"
--#define CH0_PARM "RxBufSize=1522, RxNumBuffers = 32, RxServiceMax = 50, TxServiceMax=50, TxNumBuffers=32, CpcsUU=0x5aa5, TxVc_CellRate=0x3000, TxVc_AtmHeader=0x00000640"
-
- #define MAX_PVC_TABLE_ENTRY 16
-
+++ /dev/null
---- a/Makefile
-+++ b/Makefile
-@@ -5,6 +5,7 @@
- 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
--EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -D__NO__VOICE_PATCH__ -DEL
-+#EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -D__NO__VOICE_PATCH__ -DEL
-+EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -D__NO__VOICE_PATCH__ -DEL -DCPATM_TASKLET_MODE
- obj-$(CONFIG_SANGAM_ATM) := tiatm.o
- tiatm-objs += cpsar.o aal5sar.o tn7sar.o tn7atm.o tn7dsl.o dsl_hal_api.o dsl_hal_support.o dsl_hal_advcfg.o
+++ /dev/null
---- a/tn7atm.c
-+++ b/tn7atm.c
-@@ -87,6 +87,146 @@
- MODULE_LICENSE("GPL");
- MODULE_DESCRIPTION ("Tnetd73xx ATM Device Driver");
- MODULE_AUTHOR ("Zhicheng Tang");
-+
-+int mp_sar_ipacemax = -1;
-+module_param_named(ipacemax, mp_sar_ipacemax, int, 0);
-+MODULE_PARM_DESC(ipacemax, "Interrupt pacing");
-+
-+char *mp_macc = NULL;
-+module_param_named(macc, mp_macc, charp, 0);
-+MODULE_PARM_DESC(macc, "MAC address");
-+
-+int mp_dsp_noboost = -1;
-+module_param_named(dsp_noboost, mp_dsp_noboost, int, 0);
-+MODULE_PARM_DESC(dsp_noboost, "Suppress DSP frequency boost");
-+
-+int mp_dsp_freq = -1;
-+module_param_named(dsp_freq, mp_dsp_freq, int, 0);
-+MODULE_PARM_DESC(dsp_freq, "Frequency to boost the DSP to");
-+
-+char *mp_featctl0 = NULL;
-+module_param_named(featctl0, mp_featctl0, charp, 0);
-+MODULE_PARM_DESC(featctl0, "DSL feature control 0");
-+
-+char *mp_featctl1 = NULL;
-+module_param_named(featctl1, mp_featctl1, charp, 0);
-+MODULE_PARM_DESC(featctl1, "DSL feature control 1");
-+
-+char *mp_phyctl0 = NULL;
-+module_param_named(phyctl0, mp_phyctl0, charp, 0);
-+MODULE_PARM_DESC(phyctl0, "DSL PHY control 0");
-+
-+char *mp_phyctl1 = NULL;
-+module_param_named(phyctl1, mp_phyctl1, charp, 0);
-+MODULE_PARM_DESC(phyctl1, "DSL PHY control 1");
-+
-+int mp_turbodsl = -1;
-+module_param_named(turbodsl, mp_turbodsl, int, 0);
-+MODULE_PARM_DESC(turbodsl, "Enable TurboDSL");
-+
-+int mp_sar_rxbuf = -1;
-+module_param_named(sar_rxbuf, mp_sar_rxbuf, int, 0);
-+MODULE_PARM_DESC(sar_rxbuf, "SAR RxBuf size");
-+
-+int mp_sar_rxmax = -1;
-+module_param_named(sar_rxmax, mp_sar_rxmax, int, 0);
-+MODULE_PARM_DESC(sar_rxmax, "SAR RxMax size");
-+
-+int mp_sar_txbuf = -1;
-+module_param_named(sar_txbuf, mp_sar_txbuf, int, 0);
-+MODULE_PARM_DESC(sar_txbuf, "SAR TxBuf size");
-+
-+int mp_sar_txmax = -1;
-+module_param_named(sar_txmax, mp_sar_txmax, int, 0);
-+MODULE_PARM_DESC(sar_txmax, "SAR TxMax size");
-+
-+char *mp_modulation = NULL;
-+module_param_named(modulation, mp_modulation, charp, 0);
-+MODULE_PARM_DESC(modulation, "Modulation");
-+
-+int mp_fine_gain_control = -1;
-+module_param_named(fine_gain_control, mp_fine_gain_control, int, 0);
-+MODULE_PARM_DESC(fine_gain_control, "Fine gain control");
-+
-+int mp_fine_gain_value = -1;
-+module_param_named(fine_gain_value, mp_fine_gain_value, int, 0);
-+MODULE_PARM_DESC(fine_gain_value, "Fine gain value");
-+
-+int mp_enable_margin_retrain = -1;
-+module_param_named(enable_margin_retrain, mp_enable_margin_retrain, int, 0);
-+MODULE_PARM_DESC(enable_margin_retrain, "Enable margin retrain");
-+
-+int mp_margin_threshold = -1;
-+module_param_named(margin_threshold, mp_margin_threshold, int, 0);
-+MODULE_PARM_DESC(margin_threshold, "Margin retrain treshold");
-+
-+int mp_enable_rate_adapt = -1;
-+module_param_named(enable_rate_adapt, mp_enable_rate_adapt, int, 0);
-+MODULE_PARM_DESC(enable_rate_adapt, "Enable rate adaption");
-+
-+int mp_powercutback = -1;
-+module_param_named(powercutback, mp_powercutback, int, 0);
-+MODULE_PARM_DESC(powercutback, "Enable / disable powercutback");
-+
-+int mp_trellis = -1;
-+module_param_named(trellis, mp_trellis, int, 0);
-+MODULE_PARM_DESC(trellis, "Enable / disable trellis coding");
-+
-+int mp_bitswap = -1;
-+module_param_named(bitswap, mp_bitswap, int, 0);
-+MODULE_PARM_DESC(bitswap, "Enable / disable bitswap");
-+
-+int mp_maximum_bits_per_carrier = -1;
-+module_param_named(maximum_bits_per_carrier, mp_maximum_bits_per_carrier, int, 0);
-+MODULE_PARM_DESC(maximum_bits_per_carrier, "Maximum bits per carrier");
-+
-+int mp_maximum_interleave_depth = -1;
-+module_param_named(maximum_interleave_depth, mp_maximum_interleave_depth, int, 0);
-+MODULE_PARM_DESC(maximum_interleave_depth, "Maximum interleave depth");
-+
-+int mp_pair_selection = -1;
-+module_param_named(pair_selection, mp_pair_selection, int, 0);
-+MODULE_PARM_DESC(pair_selection, "Pair selection");
-+
-+int mp_dgas_polarity = -1;
-+module_param_named(dgas_polarity, mp_dgas_polarity, int, 0);
-+MODULE_PARM_DESC(dgas_polarity, "DGAS polarity");
-+
-+int mp_los_alarm = -1;
-+module_param_named(los_alarm, mp_los_alarm, int, 0);
-+MODULE_PARM_DESC(los_alarm, "LOS alarm");
-+
-+char *mp_eoc_vendor_id = NULL;
-+module_param_named(eoc_vendor_id, mp_eoc_vendor_id, charp, 0);
-+MODULE_PARM_DESC(eoc_vendor_id, "EOC vendor id");
-+
-+int mp_eoc_vendor_revision = -1;
-+module_param_named(eoc_vendor_revision, mp_eoc_vendor_revision, int, 0);
-+MODULE_PARM_DESC(eoc_vendor_revision, "EOC vendor revision");
-+
-+char *mp_eoc_vendor_serialnum = NULL;
-+module_param_named(eoc_vendor_serialnum, mp_eoc_vendor_serialnum, charp, 0);
-+MODULE_PARM_DESC(eoc_vendor_serialnum, "EOC vendor serial number");
-+
-+char *mp_invntry_vernum = NULL;
-+module_param_named(invntry_vernum, mp_invntry_vernum, charp, 0);
-+MODULE_PARM_DESC(invntry_vernum, "Inventory revision number");
-+
-+int mp_dsl_bit_tmode = -1;
-+module_param_named(dsl_bit_tmode, mp_dsl_bit_tmode, int, 0);
-+MODULE_PARM_DESC(dsl_bit_tmode, "DSL bit training mode");
-+
-+int mp_high_precision = -1;
-+module_param_named(high_precision, mp_high_precision, int, 0);
-+MODULE_PARM_DESC(high_precision, "High precision");
-+
-+int mp_autopvc_enable = -1;
-+module_param_named(autopvc_enable, mp_autopvc_enable, int, 0);
-+MODULE_PARM_DESC(autopvc_enable, "Enable / disable automatic PVC");
-+
-+int mp_oam_lb_timeout = -1;
-+module_param_named(oam_lb_timeout, mp_oam_lb_timeout, int, 0);
-+MODULE_PARM_DESC(oam_lb_timeout, "OAM LB timeout");
- #endif
-
- #ifndef TRUE
-@@ -655,9 +795,9 @@
- * interrupt pacing
- */
- ptr = prom_getenv ("sar_ipacemax");
-- if (ptr)
-+ if (ptr || mp_sar_ipacemax != -1)
- {
-- def_sar_inter_pace = os_atoi (ptr);
-+ def_sar_inter_pace = mp_sar_ipacemax == -1 ? os_atoi (ptr) : mp_sar_ipacemax;
- }
- /* avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
- def_sar_inter_pace);*/
-@@ -795,9 +935,18 @@
- {
- int i;
- char esi_addr[ESI_LEN] = { 0x00, 0x00, 0x11, 0x22, 0x33, 0x44 };
-- char *esiaddr_str = NULL;
-+ char *esiaddr_str = mp_macc;
-
-- esiaddr_str = prom_getenv ("maca");
-+ if (esiaddr_str == NULL)
-+ esiaddr_str = prom_getenv ("macdsl");
-+ if (esiaddr_str == NULL)
-+ esiaddr_str = prom_getenv ("macc");
-+ if (esiaddr_str == NULL)
-+ esiaddr_str = prom_getenv ("HWA_1");
-+ if (esiaddr_str == NULL)
-+ esiaddr_str = prom_getenv ("macb");
-+ if (esiaddr_str == NULL)
-+ esiaddr_str = prom_getenv ("maca");
-
- if (!esiaddr_str)
- {
-@@ -1930,15 +2079,15 @@
- //UR8_MERGE_END CQ10450*
-
- cp = prom_getenv ("dsp_noboost");
-- if (cp)
-+ if (cp || mp_dsp_noboost != -1)
- {
-- dsp_noboost = os_atoi (cp);
-+ dsp_noboost = mp_dsp_noboost == -1 ? os_atoi (cp) : mp_dsp_noboost;
- }
-
- cp = (char *) prom_getenv ("dsp_freq");
-- if (cp)
-+ if (cp || mp_dsp_freq != -1)
- {
-- dspfreq = os_atoi (cp);
-+ dspfreq = mp_dsp_freq == -1 ? os_atoi (cp) : mp_dsp_freq;
- if (dspfreq == 250)
- {
- boostDsp = 1;
-@@ -2187,8 +2336,9 @@
- // Inter-Op DSL phy Control
- // Note the setting of _dsl_Feature_0 and _dsl_Feature_1 must before
- // dslhal_api_dslStartup (in tn7dsl_init()).
-- if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_0")) != NULL)
-+ if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_0")) != NULL || mp_featctl0 != NULL)
- {
-+ if (mp_featctl0 != NULL) ptr = mp_featctl0;
- if ((ptr[0] == '0') && (ptr[1] == 'x')) // skip 0x before pass to
- // os_atoh
- ptr += 2;
-@@ -2196,8 +2346,9 @@
- _dsl_Feature_0_defined = 1;
- }
-
-- if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_1")) != NULL)
-+ if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_1")) != NULL || mp_featctl1 != NULL)
- {
-+ if (mp_featctl1 != NULL) ptr = mp_featctl1;
- if ((ptr[0] == '0') && (ptr[1] == 'x')) // skip 0x before pass to
- // os_atoh
- ptr += 2;
-@@ -2209,8 +2360,9 @@
- // DSL phy Feature Control
- // Note the setting of _dsl_PhyControl_0 and _dsl_PhyControl_1 must before
- // dslhal_api_dslStartup (in tn7dsl_init()).
-- if ((ptr = prom_getenv ("DSL_PHY_CNTL_0")) != NULL)
-+ if ((ptr = prom_getenv ("DSL_PHY_CNTL_0")) != NULL || mp_phyctl0 != NULL)
- {
-+ if (mp_phyctl0 != NULL) ptr = mp_phyctl0;
- if ((ptr[0] == '0') && (ptr[1] == 'x')) // skip 0x before pass to
- // os_atoh
- ptr += 2;
-@@ -2218,8 +2370,9 @@
- _dsl_PhyControl_0_defined = 1;
- }
-
-- if ((ptr = prom_getenv ("DSL_PHY_CNTL_1")) != NULL)
-+ if ((ptr = prom_getenv ("DSL_PHY_CNTL_1")) != NULL || mp_phyctl1 != NULL)
- {
-+ if (mp_phyctl1 != NULL) ptr = mp_phyctl1;
- if ((ptr[0] == '0') && (ptr[1] == 'x')) // skip 0x before pass to
- // os_atoh
- ptr += 2;
-@@ -2247,9 +2400,9 @@
- priv->bTurboDsl = 1;
- // read config for turbo dsl
- ptr = prom_getenv ("TurboDSL");
-- if (ptr)
-+ if (ptr || mp_turbodsl != -1)
- {
-- priv->bTurboDsl = os_atoi (ptr);
-+ priv->bTurboDsl = mp_turbodsl == -1 ? os_atoi (ptr) : mp_turbodsl;
- }
-
- // @Added to make Rx buffer number & Service max configurable through
-@@ -2257,30 +2410,30 @@
- priv->sarRxBuf = RX_BUFFER_NUM;
- ptr = NULL;
- ptr = prom_getenv ("SarRxBuf");
-- if (ptr)
-+ if (ptr || mp_sar_rxbuf != -1)
- {
-- priv->sarRxBuf = os_atoi (ptr);
-+ priv->sarRxBuf = mp_sar_rxbuf == -1 ? os_atoi (ptr) : mp_sar_rxbuf;
- }
- priv->sarRxMax = RX_SERVICE_MAX;
- ptr = NULL;
- ptr = prom_getenv ("SarRxMax");
-- if (ptr)
-+ if (ptr || mp_sar_rxmax != -1)
- {
-- priv->sarRxMax = os_atoi (ptr);
-+ priv->sarRxMax = mp_sar_rxmax == -1 ? os_atoi (ptr) : mp_sar_rxmax;
- }
- priv->sarTxBuf = TX_BUFFER_NUM;
- ptr = NULL;
- ptr = prom_getenv ("SarTxBuf");
-- if (ptr)
-+ if (ptr || mp_sar_txbuf != -1)
- {
-- priv->sarTxBuf = os_atoi (ptr);
-+ priv->sarTxBuf = mp_sar_txbuf == -1 ? os_atoi (ptr) : mp_sar_txbuf;
- }
- priv->sarTxMax = TX_SERVICE_MAX;
- ptr = NULL;
- ptr = prom_getenv ("SarTxMax");
-- if (ptr)
-+ if (ptr || mp_sar_txmax != -1)
- {
-- priv->sarTxMax = os_atoi (ptr);
-+ priv->sarTxMax = mp_sar_txmax == -1 ? os_atoi (ptr) : mp_sar_txmax;
- }
-
- return 0;
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -136,6 +136,27 @@
- #define NEW_TRAINING_VAL_T1413 128
- #define NEW_TRAINING_VAL_MMODE 255
-
-+extern char *mp_modulation;
-+extern int mp_fine_gain_control;
-+extern int mp_fine_gain_value;
-+extern int mp_enable_margin_retrain;
-+extern int mp_margin_threshold;
-+extern int mp_enable_rate_adapt;
-+extern int mp_powercutback;
-+extern int mp_trellis;
-+extern int mp_bitswap;
-+extern int mp_maximum_bits_per_carrier;
-+extern int mp_maximum_interleave_depth;
-+extern int mp_pair_selection;
-+extern int mp_dgas_polarity;
-+extern int mp_los_alarm;
-+extern char *mp_eoc_vendor_id;
-+extern int mp_eoc_vendor_revision;
-+extern char *mp_eoc_vendor_serialnum;
-+extern char *mp_invntry_vernum;
-+extern int mp_dsl_bit_tmode;
-+extern int mp_high_precision;
-+
- int testflag1 = 0;
- extern int __guDbgLevel;
- extern sar_stat_t sarStat;
-@@ -2818,84 +2839,80 @@ static int tn7dsl_set_dsl(void)
-
- // modulation
- ptr = prom_getenv("modulation");
-- if (ptr)
-+ if (ptr || mp_modulation != NULL)
- {
-- tn7dsl_set_modulation(ptr, FALSE);
-+ tn7dsl_set_modulation(mp_modulation == NULL ? ptr : mp_modulation, FALSE);
- }
-
- // Fine Gains
- ptr = prom_getenv("fine_gain_control");
-- if (ptr)
-+ if (ptr || mp_fine_gain_control != -1)
- {
-- value = os_atoi(ptr);
-+ value = mp_fine_gain_control == -1 ? os_atoi(ptr) : mp_fine_gain_control;
- tn7dsl_ctrl_fineGain(value);
- }
- ptr = NULL;
- ptr = prom_getenv("fine_gain_value");
-- if(ptr)
-- tn7dsl_set_fineGainValue(os_atoh(ptr));
-+ if(ptr || mp_fine_gain_value != -1)
-+ tn7dsl_set_fineGainValue(mp_fine_gain_value == -1 ? os_atoh(ptr) : mp_fine_gain_value);
-
- // margin retrain
- ptr = NULL;
- ptr = prom_getenv("enable_margin_retrain");
-- if(ptr)
-+ value = mp_enable_margin_retrain == -1 ? (ptr ? os_atoi(ptr) : 0) : mp_enable_margin_retrain;
-+
-+ if (value == 1)
- {
-- value = os_atoi(ptr);
-- if(value == 1)
-+ dslhal_api_setMarginMonitorFlags(pIhw, 0, 1);
-+ bMarginRetrainEnable = 1;
-+ //printk("enable showtime margin monitor.\n");
-+
-+ ptr = NULL;
-+ ptr = prom_getenv("margin_threshold");
-+ value = mp_margin_threshold == -1 ? (ptr ? os_atoi(ptr) : 0) : mp_margin_threshold;
-+
-+ if(value >= 0)
- {
-- dslhal_api_setMarginMonitorFlags(pIhw, 0, 1);
-- bMarginRetrainEnable = 1;
-- //printk("enable showtime margin monitor.\n");
-- ptr = NULL;
-- ptr = prom_getenv("margin_threshold");
-- if(ptr)
-- {
-- value = os_atoi(ptr);
-- //printk("Set margin threshold to %d x 0.5 db\n",value);
-- if(value >= 0)
-- {
-- dslhal_api_setMarginThreshold(pIhw, value);
-- bMarginThConfig=1;
-- }
-- }
-+ dslhal_api_setMarginThreshold(pIhw, value);
-+ bMarginThConfig=1;
- }
- }
-
- // rate adapt
- ptr = NULL;
- ptr = prom_getenv("enable_rate_adapt");
-- if(ptr)
-+ if(ptr || mp_enable_rate_adapt != -1)
- {
-- dslhal_api_setRateAdaptFlag(pIhw, os_atoi(ptr));
-+ dslhal_api_setRateAdaptFlag(pIhw, mp_enable_rate_adapt == -1 ? os_atoi(ptr) : mp_enable_rate_adapt);
- }
-
- // set powercutback
- ptr = NULL;
- ptr = prom_getenv("powercutback");
-- if(ptr)
-+ if(ptr || mp_powercutback != -1)
- {
-- dslhal_advcfg_onOffPcb(pIhw, os_atoi(ptr));
-+ dslhal_advcfg_onOffPcb(pIhw, mp_powercutback == -1 ? os_atoi(ptr) : mp_powercutback);
- }
-
- // trellis
- ptr = NULL;
- ptr = prom_getenv("trellis");
-- if(ptr)
-+ if(ptr || mp_trellis != -1)
- {
-- dslhal_api_setTrellisFlag(pIhw, os_atoi(ptr));
-- trellis = os_atoi(ptr);
-+ trellis = mp_trellis == -1 ? os_atoi(ptr) : mp_trellis;
-+ dslhal_api_setTrellisFlag(pIhw, trellis);
- //printk("trellis=%d\n");
- }
-
- // bitswap
- ptr = NULL;
- ptr = prom_getenv("bitswap");
-- if(ptr)
-+ if(ptr || mp_bitswap != -1)
- {
- int offset[2] = {33, 0};
- unsigned int bitswap;
-
-- bitswap = os_atoi(ptr);
-+ bitswap = mp_bitswap == -1 ? os_atoi(ptr) : mp_bitswap;
-
- tn7dsl_generic_read(2, offset);
- dslReg &= dslhal_support_byteSwap32(0xFFFFFF00);
-@@ -2913,46 +2930,47 @@ static int tn7dsl_set_dsl(void)
- // maximum bits per carrier
- ptr = NULL;
- ptr = prom_getenv("maximum_bits_per_carrier");
-- if(ptr)
-+ if(ptr || mp_maximum_bits_per_carrier != -1)
- {
-- dslhal_api_setMaxBitsPerCarrierUpstream(pIhw, os_atoi(ptr));
-+ dslhal_api_setMaxBitsPerCarrierUpstream(pIhw, mp_maximum_bits_per_carrier == -1 ? os_atoi(ptr) : mp_maximum_bits_per_carrier);
- }
-
- // maximum interleave depth
- ptr = NULL;
- ptr = prom_getenv("maximum_interleave_depth");
-- if(ptr)
-+ if(ptr || mp_maximum_interleave_depth != -1)
- {
-- dslhal_api_setMaxInterleaverDepth(pIhw, os_atoi(ptr));
-+ dslhal_api_setMaxInterleaverDepth(pIhw, mp_maximum_interleave_depth == -1 ? os_atoi(ptr) : mp_maximum_interleave_depth);
- }
-
- // inner and outer pairs
- ptr = NULL;
- ptr = prom_getenv("pair_selection");
-- if(ptr)
-+ if(ptr || mp_pair_selection != -1)
- {
-- dslhal_api_selectInnerOuterPair(pIhw, os_atoi(ptr));
-+ dslhal_api_selectInnerOuterPair(pIhw, mp_pair_selection == -1 ? os_atoi(ptr) : mp_pair_selection);
- }
-
- ptr = NULL;
- ptr = prom_getenv("dgas_polarity");
-- if(ptr)
-+ if(ptr || mp_dgas_polarity != -1)
- {
- dslhal_api_configureDgaspLpr(pIhw, 1, 1);
-- dslhal_api_configureDgaspLpr(pIhw, 0, os_atoi(ptr));
-+ dslhal_api_configureDgaspLpr(pIhw, 0, mp_dgas_polarity == -1 ? os_atoi(ptr) : mp_dgas_polarity);
- }
-
- ptr = NULL;
- ptr = prom_getenv("los_alarm");
-- if(ptr)
-+ if(ptr || mp_los_alarm != -1)
- {
-- dslhal_api_disableLosAlarm(pIhw, os_atoi(ptr));
-+ dslhal_api_disableLosAlarm(pIhw, mp_los_alarm == -1 ? os_atoi(ptr) : mp_los_alarm);
- }
-
- ptr = NULL;
- ptr = prom_getenv("eoc_vendor_id");
-- if(ptr)
-+ if(ptr || mp_eoc_vendor_id != NULL)
- {
-+ ptr = mp_eoc_vendor_id == NULL ? ptr : mp_eoc_vendor_id;
- for(i=0;i<8;i++)
- {
- tmp[0]=ptr[i*2];
-@@ -2977,26 +2995,26 @@ static int tn7dsl_set_dsl(void)
- }
- ptr = NULL;
- ptr = prom_getenv("eoc_vendor_revision");
-- if(ptr)
-+ if(ptr || mp_eoc_vendor_revision != -1)
- {
-- value = os_atoi(ptr);
-+ value = mp_eoc_vendor_revision == -1 ? os_atoi(ptr) : mp_eoc_vendor_revision;
- //printk("eoc rev=%d\n", os_atoi(ptr));
- dslhal_api_setEocRevisionNumber(pIhw, (char *)&value);
-
- }
- ptr = NULL;
- ptr = prom_getenv("eoc_vendor_serialnum");
-- if(ptr)
-+ if(ptr || mp_eoc_vendor_serialnum != NULL)
- {
-- dslhal_api_setEocSerialNumber(pIhw, ptr);
-+ dslhal_api_setEocSerialNumber(pIhw, mp_eoc_vendor_serialnum == NULL ? ptr : mp_eoc_vendor_serialnum);
- }
-
- // CQ10037 Added invntry_vernum environment variable to be able to set version number in ADSL2, ADSL2+ modes.
- ptr = NULL;
- ptr = prom_getenv("invntry_vernum");
-- if(ptr)
-+ if(ptr || mp_invntry_vernum != NULL)
- {
-- dslhal_api_setEocRevisionNumber(pIhw, ptr);
-+ dslhal_api_setEocRevisionNumber(pIhw, mp_invntry_vernum == NULL ? ptr : mp_invntry_vernum);
- }
-
- return 0;
-@@ -3041,7 +3059,7 @@ int tn7dsl_init(void *priv)
- * backward compatibility.
- */
- cp = prom_getenv("DSL_BIT_TMODE");
-- if (cp)
-+ if (cp || mp_dsl_bit_tmode != -1)
- {
- printk("%s : env var DSL_BIT_TMODE is set\n", __FUNCTION__);
- /*
-@@ -3070,9 +3088,9 @@ int tn7dsl_init(void *priv)
-
- // UR8_MERGE_START CQ11054 Jack Zhang
- cp = prom_getenv("high_precision");
-- if (cp)
-+ if (cp || mp_high_precision != -1)
- {
-- high_precision_selected = os_atoi(cp);
-+ high_precision_selected = mp_high_precision == -1 ? os_atoi(cp) : mp_high_precision;
- }
- if ( high_precision_selected)
- {
---- a/tn7sar.c
-+++ b/tn7sar.c
-@@ -74,6 +74,8 @@ typedef void OS_SETUP;
- /* PDSP Firmware files */
- #include "tnetd7300_sar_firm.h"
-
-+extern int mp_oam_lb_timeout;
-+extern int mp_autopvc_enable;
-
- enum
- {
-@@ -817,9 +819,9 @@ int tn7sar_setup_oam_channel(Tn7AtmPriva
- pHalDev = (HAL_DEVICE *)priv->pSarHalDev;
-
- pauto_pvc = prom_getenv("autopvc_enable");
-- if(pauto_pvc) //CQ10273
-+ if(pauto_pvc || mp_autopvc_enable != -1) //CQ10273
- {
-- auto_pvc =tn7sar_strtoul(pauto_pvc, NULL, 10);
-+ auto_pvc = mp_autopvc_enable == -1 ? tn7sar_strtoul(pauto_pvc, NULL, 10) : mp_autopvc_enable;
- }
-
- memset(&chInfo, 0xff, sizeof(chInfo));
-@@ -985,9 +987,9 @@ int tn7sar_init(struct atm_dev *dev, Tn7
-
- /* read in oam lb timeout value */
- pLbTimeout = prom_getenv("oam_lb_timeout");
-- if(pLbTimeout)
-+ if(pLbTimeout || mp_oam_lb_timeout != -1)
- {
-- lbTimeout =tn7sar_strtoul(pLbTimeout, NULL, 10);
-+ lbTimeout = mp_oam_lb_timeout == -1 ? tn7sar_strtoul(pLbTimeout, NULL, 10) : mp_oam_lb_timeout;
- oamLbTimeout = lbTimeout;
- pHalFunc->Control(pHalDev,"OamLbTimeout", "Set", &lbTimeout);
- }
+++ /dev/null
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -109,6 +109,7 @@
- #include <linux/vmalloc.h>
- #include <linux/file.h>
- #include <linux/firmware.h>
-+#include <linux/version.h>
-
- #include <asm/io.h>
- #include <asm/ar7/ar7.h>
-@@ -446,7 +447,9 @@ static void avsar_release(struct device
- }
-
- static struct device avsar = {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
- .bus_id = "vlynq",
-+#endif
- .release = avsar_release,
- };
-
-@@ -455,6 +458,9 @@ int shim_osLoadFWImage(unsigned char *pt
- const struct firmware *fw_entry;
- size_t size;
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
-+ dev_set_name(&avsar, "avsar");
-+#endif
- printk("requesting firmware image \"ar0700xx.bin\"\n");
- if(device_register(&avsar) < 0) {
- printk(KERN_ERR
+++ /dev/null
---- a/tn7atm.c
-+++ b/tn7atm.c
-@@ -71,10 +71,16 @@
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
-+#include <linux/version.h>
-
- #include <asm/io.h>
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
- #include <asm/ar7/ar7.h>
- #include <asm/ar7/prom.h>
-+#else
-+#include <asm/mach-ar7/ar7.h>
-+#include <asm/mach-ar7/prom.h>
-+#endif
-
- #include "dsl_hal_api.h"
- #include "tn7atm.h"
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -112,8 +112,13 @@
- #include <linux/version.h>
-
- #include <asm/io.h>
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
- #include <asm/ar7/ar7.h>
- #include <asm/ar7/prom.h>
-+#else
-+#include <asm/mach-ar7/ar7.h>
-+#include <asm/mach-ar7/prom.h>
-+#endif
-
- /* Modules specific header files */
- #include "tn7atm.h"
---- a/tn7sar.c
-+++ b/tn7sar.c
-@@ -52,10 +52,16 @@
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
-+#include <linux/version.h>
-
- #include <asm/io.h>
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
- #include <asm/ar7/ar7.h>
- #include <asm/ar7/prom.h>
-+#else
-+#include <asm/mach-ar7/ar7.h>
-+#include <asm/mach-ar7/prom.h>
-+#endif
-
- #define _CPHAL_AAL5
- #define _CPHAL_SAR
+++ /dev/null
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -203,7 +203,11 @@ led_reg_t ledreg[2];
- static struct led_funcs ledreg[2];
- #endif
-
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
- #define DEV_DSLMOD CTL_UNNUMBERED
-+#else
-+#define DEV_DSLMOD 0
-+#endif
- #define MAX_STR_SIZE 256
- #define DSL_MOD_SIZE 256
-
-@@ -3431,9 +3435,16 @@ static int dslmod_sysctl(ctl_table *ctl,
- */
- if(write)
- {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
- ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
--
-+#else
-+ ret = proc_dostring(ctl, write, buffer, lenp, 0);
-+#endif
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
- switch (ctl->ctl_name)
-+#else
-+ switch ((long)ctl->extra2)
-+#endif
- {
- case DEV_DSLMOD:
- ptr = strpbrk(info, " \t");
-@@ -3517,14 +3528,29 @@ static int dslmod_sysctl(ctl_table *ctl,
- else
- {
- len += sprintf(info+len, mod_req);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
- ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
-+#else
-+ ret = proc_dostring(ctl, write, buffer, lenp, 0);
-+#endif
- }
- return ret;
- }
-
-
- ctl_table dslmod_table[] = {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
- {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, NULL, &dslmod_sysctl, &sysctl_string}
-+#else
-+ {
-+ .procname = "dslmod",
-+ .data = info,
-+ .maxlen = DSL_MOD_SIZE,
-+ .mode = 0644,
-+ .proc_handler = &dslmod_sysctl,
-+ .extra2 = (void *)DEV_DSLMOD,
-+ }
-+#endif
- ,
- {0}
- };
-@@ -3532,7 +3558,16 @@ ctl_table dslmod_table[] = {
- /* Make sure that /proc/sys/dev is there */
- ctl_table dslmod_root_table[] = {
- #ifdef CONFIG_PROC_FS
-+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
- {CTL_DEV, "dev", NULL, 0, 0555, dslmod_table}
-+ #else
-+ {
-+ .procname = "dev",
-+ .maxlen = 0,
-+ .mode = 0555,
-+ .child = dslmod_table,
-+ }
-+ #endif
- ,
- #endif /* CONFIG_PROC_FS */
- {0}
+++ /dev/null
---- a/tn7atm.c
-+++ b/tn7atm.c
-@@ -1867,7 +1867,11 @@ static int __init tn7atm_register (Tn7At
-
- dgprintf (4, "device %s being registered\n", priv->name);
-
-+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
- mydev = atm_dev_register (priv->proc_name, &tn7atm_ops, -1, NULL);
-+ #else
-+ mydev = atm_dev_register (priv->proc_name, NULL, &tn7atm_ops, -1, NULL);
-+ #endif
-
- if (mydev == NULL)
- {
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -466,14 +466,17 @@ int shim_osLoadFWImage(unsigned char *pt
- {
- const struct firmware *fw_entry;
- size_t size;
-+ int ret;
-
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
- dev_set_name(&avsar, "avsar");
- #endif
- printk("requesting firmware image \"ar0700xx.bin\"\n");
-- if(device_register(&avsar) < 0) {
-+ dev_set_name(&avsar, "avsar");
-+ ret = device_register(&avsar);
-+ if (ret < 0) {
- printk(KERN_ERR
-- "avsar: device_register fails\n");
-+ "avsar: device_register fails, error%i\n", ret);
- return -1;
- }
-
+++ /dev/null
---- a/tn7atm.c
-+++ b/tn7atm.c
-@@ -67,7 +67,7 @@
- #include <linux/atmdev.h>
- #include <linux/delay.h>
- #include <linux/spinlock.h>
--#include <linux/smp_lock.h>
-+#include <linux/interrupt.h>
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
---- a/tn7sar.c
-+++ b/tn7sar.c
-@@ -48,7 +48,7 @@
- #include <linux/atmdev.h>
- #include <linux/delay.h>
- #include <linux/spinlock.h>
--#include <linux/smp_lock.h>
-+#include <linux/interrupt.h>
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -100,7 +100,7 @@
- #include <linux/atmdev.h>
- #include <linux/delay.h>
- #include <linux/spinlock.h>
--#include <linux/smp_lock.h>
-+#include <linux/interrupt.h>
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
+++ /dev/null
---- a/cppi_cpaal5.c
-+++ b/cppi_cpaal5.c
-@@ -360,7 +360,7 @@ static int halRxReturn(HAL_RECEIVEINFO *
- {
- /* 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 */
---- a/dsl_hal_api.c
-+++ b/dsl_hal_api.c
-@@ -273,15 +273,15 @@
- * 09/15/07 CPH CQ11466 Added EFM support
- * 09/27/07 EYin CQ11929: Added NFEC/INP/Lp/Rp reporting for only ADSL2/2+ mode.
- ******************************************************************************/
--#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"
-
- // UR8_MERGE_START CQ11054 Jack Zhang
- static unsigned int highprecision_selected = 0; //By default we use low precision for backward compt.
---- a/dsl_hal_support.c
-+++ b/dsl_hal_support.c
-@@ -142,9 +142,9 @@
- * UR8_MERGE_START_END CQ11922 Tim
- * 04Sep07 0.14.00 Tim CQ11922: Added support for new scratchram for INP NDR tables
- *******************************************************************************/
--#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);
---- a/dsl_hal_support.h
-+++ b/dsl_hal_support.h
-@@ -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 */
---- a/Makefile
-+++ b/Makefile
-@@ -1,18 +1,9 @@
--# File: drivers/atm/ti_evm3/Makefile
- #
--# 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 += cpsar.o aal5sar.o tn7sar.o tn7atm.o tn7dsl.o dsl_hal_api.o dsl_hal_support.o
---- a/tn7atm.c
-+++ b/tn7atm.c
-@@ -66,7 +66,6 @@
- * 09/18/07 CPH CQ11466 Added EFM Support
- *********************************************************************************************/
-
--#include <linux/config.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/init.h>
-@@ -74,11 +73,14 @@
- #include <linux/delay.h>
- #include <linux/spinlock.h>
- #include <linux/smp_lock.h>
--#include <asm/io.h>
--#include <asm/mips-boards/prom.h>
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
-+
-+#include <asm/io.h>
-+#include <asm/ar7/ar7.h>
-+#include <asm/ar7/prom.h>
-+
- #include "dsl_hal_api.h"
- #ifdef AR7_EFM
- #include "tn7efm.h"
-@@ -90,6 +92,7 @@
- #include "dsl_hal_register.h"
-
- #ifdef MODULE
-+MODULE_LICENSE("GPL");
- MODULE_DESCRIPTION ("Tnetd73xx ATM Device Driver");
- MODULE_AUTHOR ("Zhicheng Tang");
- #endif
-@@ -108,9 +111,9 @@ MODULE_AUTHOR ("Zhicheng Tang");
-
- /*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)
-
-@@ -135,7 +138,7 @@ static int EnableQoS = FALSE;
- /* 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);
-
- void tn7atm_close (struct atm_vcc *vcc);
-
-@@ -298,13 +301,12 @@ static const struct atmdev_ops tn7atm_op
- 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;
-@@ -626,56 +628,6 @@ static int turbodsl_check_priority_type(
-
- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
-- * 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.
-@@ -766,7 +718,7 @@ static int __init tn7atm_irq_request (st
-
- priv->sar_irq = LNXINTNUM (ATM_SAR_INT); /* Interrupt line # */
-
-- if (request_irq (priv->sar_irq, tn7atm_sar_irq, SA_INTERRUPT, "SAR ", dev))
-+ if (request_irq (priv->sar_irq, tn7atm_sar_irq, IRQF_DISABLED, "SAR ", dev))
- printk ("Could not register tn7atm_sar_irq\n");
-
- /*
-@@ -777,8 +729,8 @@ static int __init tn7atm_irq_request (st
- {
- 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); */
-
-
- #ifdef AR7_EFM
-@@ -790,7 +742,7 @@ static int __init tn7atm_irq_request (st
- * Reigster Receive interrupt A
- */
- priv->dsl_irq = LNXINTNUM (ATM_DSL_INT); /* Interrupt line # */
-- if (request_irq (priv->dsl_irq, tn7atm_dsl_irq, SA_INTERRUPT, "DSL ", dev))
-+ if (request_irq (priv->dsl_irq, tn7atm_dsl_irq, IRQF_DISABLED, "DSL ", dev))
- printk ("Could not register tn7atm_dsl_irq\n");
-
- /***** VRB Tasklet Mode ****/
-@@ -958,11 +910,15 @@ static int __init tn7atm_get_ESI (struct
- #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");
-
-@@ -974,24 +930,18 @@ int tn7atm_open (struct atm_vcc *vcc, sh
- return -1;
- }
-
-- MOD_INC_USE_COUNT;
-+// MOD_INC_USE_COUNT;
-
-- /* find a free VPI/VCI */
-- tn7atm_walk_vccs(vcc, &vpi, &vci);
--
-- vcc->vpi = vpi;
-- vcc->vci = vci;
--
-- 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;
-@@ -999,7 +949,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
- /* 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;
- }
-@@ -1008,7 +958,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
- 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);
-@@ -1017,17 +967,17 @@ int tn7atm_open (struct atm_vcc *vcc, sh
- }
- 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;
- }
-@@ -1059,6 +1009,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
- 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;
-@@ -1080,6 +1031,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
- 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;
-@@ -1107,7 +1059,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
- 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;
-@@ -1197,7 +1149,7 @@ void tn7atm_close (struct atm_vcc *vcc)
- tn7atm_lut_clear (vcc, dmachan);
- //spin_unlock_irqrestore (&closeLock, closeFlag);
-
-- MOD_DEC_USE_COUNT;
-+// MOD_DEC_USE_COUNT;
-
- dgprintf (1, "Leave tn7atm_close\n");
- }
-@@ -1630,8 +1582,7 @@ int tn7atm_receive (void *os_dev, int ch
- * firewall is on */
-
- dgprintf (3, "pushing the skb...\n");
--
-- skb->stamp = vcc->timestamp = xtime;
-+ __net_timestamp(skb);
-
- xdump ((unsigned char *) skb->data, skb->len, 5);
-
-@@ -1854,8 +1805,7 @@ printk("!!!free atm irq: tn7atm_exit\n")
-
- kfree (dev->dev_data);
-
-- // atm_dev_deregister (dev);
-- shutdown_atm_dev (dev);
-+ atm_dev_deregister (dev);
-
- /*
- * remove proc entries
-@@ -2086,9 +2036,6 @@ static int __init tn7atm_detect (void)
- * 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);
-@@ -2098,7 +2045,6 @@ static int __init tn7atm_detect (void)
- return -ENOMEM;
- }
- proc_root_already_exists = FALSE;
-- }
-
-
- /*
-@@ -2731,7 +2677,5 @@ int tn7atm_proc_turbodsl_write(struct fi
- return count;
- }
-
--#ifdef MODULE
- module_init (tn7atm_detect);
- module_exit (tn7atm_exit);
--#endif /* MODULE */
---- a/tn7atm.h
-+++ b/tn7atm.h
-@@ -20,7 +20,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>
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -102,7 +102,6 @@
- * UR8_MERGE_END CQ11813
- * 09/18/07 CPH CQ11466: Added EFM support.
- *********************************************************************************************/
--#include <linux/config.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/init.h>
-@@ -110,8 +109,6 @@
- #include <linux/delay.h>
- #include <linux/spinlock.h>
- #include <linux/smp_lock.h>
--#include <asm/io.h>
--#include <asm/mips-boards/prom.h>
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
-@@ -119,6 +116,12 @@
- #include <linux/timer.h>
- #include <linux/vmalloc.h>
- #include <linux/file.h>
-+#include <linux/firmware.h>
-+
-+#include <asm/io.h>
-+#include <asm/ar7/ar7.h>
-+#include <asm/ar7/prom.h>
-+
- /* Modules specific header files */
- #ifdef AR7_EFM
- #include "tn7efm.h"
-@@ -185,7 +188,7 @@ led_reg_t ledreg[2];
- static struct led_funcs ledreg[2];
- #endif
-
--#define DEV_DSLMOD 1
-+#define DEV_DSLMOD CTL_UNNUMBERED
- #define MAX_STR_SIZE 256
- #define DSL_MOD_SIZE 256
-
-@@ -316,7 +319,7 @@ static PITIDSLHW_T pIhw;
- static volatile int bshutdown;
- static char info[MAX_STR_SIZE];
- /* Used for DSL Polling enable */
--static DECLARE_MUTEX_LOCKED (adsl_sem_overlay);
-+static struct semaphore adsl_sem_overlay;
-
- //kthread_t overlay_thread;
- /* end of module wide declars */
-@@ -369,6 +372,14 @@ int os_atoih (const char *pstr)
- return val;
- }
-
-+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);
-@@ -405,39 +416,6 @@ void dprintf (int uDbgLevel, char *szFmt
- #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
- {
-@@ -487,144 +465,78 @@ unsigned int shim_osGetCpuFrequency(void
- 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;
--
--#ifdef AR7_EFM
-- int dp_alt=0;
-- char *ptr1=NULL;
--#ifdef EFM_DEBUG
-- char *ptr2=NULL;
-- char *ptr3=NULL;
--#endif
--
-- if ((ptr1 = prom_getenv("DSL_DP_ALT")) != NULL)
-- {
-- dp_alt=os_atoi(ptr1);
-- if (dp_alt==1)
-- {
-- filp = filp_open(DSP_DEBUG_FIRMWARE_PATH,00,O_RDONLY);
-- if (!IS_ERR(filp))
-- {
-- strcpy (DSP_FIRMWARE_PATH, DSP_DEBUG_FIRMWARE_PATH);
-- }
-- }
--#ifdef EFM_DEBUG
-- else if (dp_alt==2)
-- {
-- if ((ptr2 = prom_getenv("DSL_DP")) != NULL)
-- {
-- if (!strncmp(ptr2, "DSL_DP", 6))
-- { // indirect naming
-- if ((ptr3 = prom_getenv(ptr2)) != NULL)
-- filp = filp_open(ptr3,00,O_RDONLY);
-- ptr2 = ptr3; // redirect ptr2 to ptr3
-- }
--
-- filp = filp_open(ptr2,00,O_RDONLY);
-- if (!IS_ERR(filp))
-- {
-- strcpy (DSP_FIRMWARE_PATH, ptr2);
-- }
-- }
-- }
-- printk("dp_path=%s\n", DSP_FIRMWARE_PATH);
--#endif
-- }
--#endif
--
-- 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(IS_ERR(filp))
-- {
-- 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);
-+ const struct firmware *fw_entry;
-+ size_t size;
-
-- 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"
-- */
-+ 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;
-+ }
-+ size = fw_entry->size;
-+ device_unregister(&avsar);
-+ if (size > 0x6ffff) {
-+ printk(KERN_ERR
-+ "avsar: Firmware too big (%d bytes)\n", size);
-+ release_firmware(fw_entry);
-+ return -1;
-+ }
-+ memcpy(ptr, fw_entry->data, size);
-+ release_firmware(fw_entry);
-+ return 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 secLength;
-+}
-
-- 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);
-
-- set_fs(oldfs);
-- /*
-- * Close the file
-- */
-- fput(filp);
-- return bytesRead;
--}
-
- int shim_osLoadDebugFWImage(unsigned char *ptr)
- {
-@@ -3287,6 +3199,7 @@ int tn7dsl_init(void *priv)
- int high_precision_selected = 0;
- // UR8_MERGE_END CQ11054*
-
-+ sema_init(&adsl_sem_overlay, 0);
- /*
- * start dsl
- */
-@@ -3665,7 +3578,7 @@ static int dslmod_sysctl(ctl_table *ctl,
- */
- if(write)
- {
-- ret = proc_dostring(ctl, write, filp, buffer, lenp);
-+ ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
-
- switch (ctl->ctl_name)
- {
-@@ -3751,14 +3664,14 @@ static int dslmod_sysctl(ctl_table *ctl,
- 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;
- }
-
-
- ctl_table dslmod_table[] = {
-- {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, &dslmod_sysctl}
-+ {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, NULL, &dslmod_sysctl, &sysctl_string}
- ,
- {0}
- };
-@@ -3781,8 +3694,7 @@ void tn7dsl_dslmod_sysctl_register(void)
- if (initialized == 1)
- return;
-
-- dslmod_sysctl_header = register_sysctl_table(dslmod_root_table, 1);
-- dslmod_root_table->child->de->owner = THIS_MODULE;
-+ dslmod_sysctl_header = register_sysctl_table(dslmod_root_table);
-
- /*
- * set the defaults
---- a/tn7sar.c
-+++ b/tn7sar.c
-@@ -43,7 +43,6 @@
- * 09/18/07 CPH CQ11466: Added EFM support.
- *******************************************************************************/
-
--#include <linux/config.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/init.h>
-@@ -51,12 +50,13 @@
- #include <linux/delay.h>
- #include <linux/spinlock.h>
- #include <linux/smp_lock.h>
--#include <asm/io.h>
--#include <asm/mips-boards/prom.h>
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
-
-+#include <asm/io.h>
-+#include <asm/ar7/ar7.h>
-+#include <asm/ar7/prom.h>
-
- #define _CPHAL_AAL5
- #define _CPHAL_SAR
+++ /dev/null
---- a/tn7atm.c
-+++ b/tn7atm.c
-@@ -633,7 +633,7 @@ static int turbodsl_check_priority_type(
- * 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;
-@@ -660,6 +660,7 @@ static void tn7atm_sar_irq (int irq, voi
- #ifdef TIATM_INST_SUPP
- psp_trace_par (ATM_DRV_SAR_ISR_EXIT, retval);
- #endif
-+ return IRQ_HANDLED;
- }
-
- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-@@ -669,7 +670,7 @@ static void tn7atm_sar_irq (int irq, voi
- * 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;
-@@ -691,6 +692,8 @@ static void tn7atm_dsl_irq (int irq, voi
- #ifdef TIATM_INST_SUPP
- psp_trace_par (ATM_DRV_DSL_ISR_EXIT, retval);
- #endif
-+
-+ return IRQ_HANDLED;
- }
-
- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+++ /dev/null
---- a/tn7api.h
-+++ b/tn7api.h
-@@ -118,7 +118,7 @@ int tn7dsl_proc_dbgmsg_write(struct file
- int tn7dsl_proc_dbgmsg_read(char* buf, char **start, off_t offset, int count,int *eof, void *data);
- #endif
- //UR8_MERGE_END CQ11813
--inline int tn7dsl_handle_interrupt(void);
-+int tn7dsl_handle_interrupt(void);
-
- void tn7dsl_dslmod_sysctl_register(void);
- void tn7dsl_dslmod_sysctl_unregister(void);
+++ /dev/null
---- a/dsl_hal_advcfg.c
-+++ b/dsl_hal_advcfg.c
-@@ -36,9 +36,9 @@
- * 05Jul05 0.00.09 CPH CQ9775: Change dslhal_advcfg_configDsTones input parameters & support for ADSL2+
- * 24Jul05 0.00.10 CPH Fixed comments in dslhal_advcfg_configDsTones function header
- *******************************************************************************/
--#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"
-
- /*****************************************************************************/
- /* ACT API functions -- To be moved into their own independent module --RamP */
---- a/Makefile
-+++ b/Makefile
-@@ -4,6 +4,7 @@
-
- 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
-+#EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -DNO_ACT -D__NO__VOICE_PATCH__ -DEL
-+EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -D__NO__VOICE_PATCH__ -DEL
- obj-$(CONFIG_SANGAM_ATM) := tiatm.o
--tiatm-objs += cpsar.o aal5sar.o tn7sar.o tn7atm.o tn7dsl.o dsl_hal_api.o dsl_hal_support.o
-+tiatm-objs += cpsar.o aal5sar.o tn7sar.o tn7atm.o tn7dsl.o dsl_hal_api.o dsl_hal_support.o dsl_hal_advcfg.o
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -3053,6 +3053,14 @@ static int tn7dsl_set_dsl(void)
- dslhal_api_setRateAdaptFlag(pIhw, os_atoi(ptr));
- }
-
-+ // set powercutback
-+ ptr = NULL;
-+ ptr = prom_getenv("powercutback");
-+ if(ptr)
-+ {
-+ dslhal_advcfg_onOffPcb(pIhw, os_atoi(ptr));
-+ }
-+
- // trellis
- ptr = NULL;
- ptr = prom_getenv("trellis");
+++ /dev/null
---- a/tn7sar.c
-+++ b/tn7sar.c
-@@ -125,10 +125,10 @@ enum
- //09/05/07: cph, move to tn7atm.h
- // #define RESERVED_OAM_CHANNEL 15
-
--#define AAL5_PARM "id=aal5, base = 0x03000000, offset = 0, int_line=15, ch0=[RxBufSize=1522; RxNumBuffers = 32; RxServiceMax = 50; TxServiceMax=50; TxNumBuffers=32; CpcsUU=0x5aa5; TxVc_CellRate=0x3000; TxVc_AtmHeader=0x00000640]"
--#define SAR_PARM "id=sar,base = 0x03000000, reset_bit = 9, offset = 0; UniNni = 0, PdspEnable = 1"
-+#define CH0_PARM "RxBufSize=1522, RxNumBuffers=32, RxServiceMax=50, TxServiceMax=50, TxNumBuffers=32, CpcsUU=0x5aa5, TxVc_CellRate=0x3000, TxVc_AtmHeader=0x00000640"
-+#define AAL5_PARM "id=aal5, base=0x03000000, offset=0, int_line=15, ch0=[" CH0_PARM "]"
-+#define SAR_PARM "id=sar, base=0x03000000, reset_bit=9, offset=0; UniNni=0, PdspEnable=1, Debug=0xFFFFFFFF"
- #define RESET_PARM "id=ResetControl, base=0xA8611600"
--#define CH0_PARM "RxBufSize=1522, RxNumBuffers = 32, RxServiceMax = 50, TxServiceMax=50, TxNumBuffers=32, CpcsUU=0x5aa5, TxVc_CellRate=0x3000, TxVc_AtmHeader=0x00000640"
-
- #define MAX_PVC_TABLE_ENTRY 16
-
+++ /dev/null
---- a/Makefile
-+++ b/Makefile
-@@ -5,6 +5,7 @@
- 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
--EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -D__NO__VOICE_PATCH__ -DEL
-+#EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -D__NO__VOICE_PATCH__ -DEL
-+EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -D__NO__VOICE_PATCH__ -DEL -DCPATM_TASKLET_MODE
- obj-$(CONFIG_SANGAM_ATM) := tiatm.o
- tiatm-objs += cpsar.o aal5sar.o tn7sar.o tn7atm.o tn7dsl.o dsl_hal_api.o dsl_hal_support.o dsl_hal_advcfg.o
+++ /dev/null
---- a/tn7atm.c
-+++ b/tn7atm.c
-@@ -95,6 +95,146 @@
- MODULE_LICENSE("GPL");
- MODULE_DESCRIPTION ("Tnetd73xx ATM Device Driver");
- MODULE_AUTHOR ("Zhicheng Tang");
-+
-+int mp_sar_ipacemax = -1;
-+module_param_named(ipacemax, mp_sar_ipacemax, int, 0);
-+MODULE_PARM_DESC(ipacemax, "Interrupt pacing");
-+
-+char *mp_macc = NULL;
-+module_param_named(macc, mp_macc, charp, 0);
-+MODULE_PARM_DESC(macc, "MAC address");
-+
-+int mp_dsp_noboost = -1;
-+module_param_named(dsp_noboost, mp_dsp_noboost, int, 0);
-+MODULE_PARM_DESC(dsp_noboost, "Suppress DSP frequency boost");
-+
-+int mp_dsp_freq = -1;
-+module_param_named(dsp_freq, mp_dsp_freq, int, 0);
-+MODULE_PARM_DESC(dsp_freq, "Frequency to boost the DSP to");
-+
-+char *mp_featctl0 = NULL;
-+module_param_named(featctl0, mp_featctl0, charp, 0);
-+MODULE_PARM_DESC(featctl0, "DSL feature control 0");
-+
-+char *mp_featctl1 = NULL;
-+module_param_named(featctl1, mp_featctl1, charp, 0);
-+MODULE_PARM_DESC(featctl1, "DSL feature control 1");
-+
-+char *mp_phyctl0 = NULL;
-+module_param_named(phyctl0, mp_phyctl0, charp, 0);
-+MODULE_PARM_DESC(phyctl0, "DSL PHY control 0");
-+
-+char *mp_phyctl1 = NULL;
-+module_param_named(phyctl1, mp_phyctl1, charp, 0);
-+MODULE_PARM_DESC(phyctl1, "DSL PHY control 1");
-+
-+int mp_turbodsl = -1;
-+module_param_named(turbodsl, mp_turbodsl, int, 0);
-+MODULE_PARM_DESC(turbodsl, "Enable TurboDSL");
-+
-+int mp_sar_rxbuf = -1;
-+module_param_named(sar_rxbuf, mp_sar_rxbuf, int, 0);
-+MODULE_PARM_DESC(sar_rxbuf, "SAR RxBuf size");
-+
-+int mp_sar_rxmax = -1;
-+module_param_named(sar_rxmax, mp_sar_rxmax, int, 0);
-+MODULE_PARM_DESC(sar_rxmax, "SAR RxMax size");
-+
-+int mp_sar_txbuf = -1;
-+module_param_named(sar_txbuf, mp_sar_txbuf, int, 0);
-+MODULE_PARM_DESC(sar_txbuf, "SAR TxBuf size");
-+
-+int mp_sar_txmax = -1;
-+module_param_named(sar_txmax, mp_sar_txmax, int, 0);
-+MODULE_PARM_DESC(sar_txmax, "SAR TxMax size");
-+
-+char *mp_modulation = NULL;
-+module_param_named(modulation, mp_modulation, charp, 0);
-+MODULE_PARM_DESC(modulation, "Modulation");
-+
-+int mp_fine_gain_control = -1;
-+module_param_named(fine_gain_control, mp_fine_gain_control, int, 0);
-+MODULE_PARM_DESC(fine_gain_control, "Fine gain control");
-+
-+int mp_fine_gain_value = -1;
-+module_param_named(fine_gain_value, mp_fine_gain_value, int, 0);
-+MODULE_PARM_DESC(fine_gain_value, "Fine gain value");
-+
-+int mp_enable_margin_retrain = -1;
-+module_param_named(enable_margin_retrain, mp_enable_margin_retrain, int, 0);
-+MODULE_PARM_DESC(enable_margin_retrain, "Enable margin retrain");
-+
-+int mp_margin_threshold = -1;
-+module_param_named(margin_threshold, mp_margin_threshold, int, 0);
-+MODULE_PARM_DESC(margin_threshold, "Margin retrain treshold");
-+
-+int mp_enable_rate_adapt = -1;
-+module_param_named(enable_rate_adapt, mp_enable_rate_adapt, int, 0);
-+MODULE_PARM_DESC(enable_rate_adapt, "Enable rate adaption");
-+
-+int mp_powercutback = -1;
-+module_param_named(powercutback, mp_powercutback, int, 0);
-+MODULE_PARM_DESC(powercutback, "Enable / disable powercutback");
-+
-+int mp_trellis = -1;
-+module_param_named(trellis, mp_trellis, int, 0);
-+MODULE_PARM_DESC(trellis, "Enable / disable trellis coding");
-+
-+int mp_bitswap = -1;
-+module_param_named(bitswap, mp_bitswap, int, 0);
-+MODULE_PARM_DESC(bitswap, "Enable / disable bitswap");
-+
-+int mp_maximum_bits_per_carrier = -1;
-+module_param_named(maximum_bits_per_carrier, mp_maximum_bits_per_carrier, int, 0);
-+MODULE_PARM_DESC(maximum_bits_per_carrier, "Maximum bits per carrier");
-+
-+int mp_maximum_interleave_depth = -1;
-+module_param_named(maximum_interleave_depth, mp_maximum_interleave_depth, int, 0);
-+MODULE_PARM_DESC(maximum_interleave_depth, "Maximum interleave depth");
-+
-+int mp_pair_selection = -1;
-+module_param_named(pair_selection, mp_pair_selection, int, 0);
-+MODULE_PARM_DESC(pair_selection, "Pair selection");
-+
-+int mp_dgas_polarity = -1;
-+module_param_named(dgas_polarity, mp_dgas_polarity, int, 0);
-+MODULE_PARM_DESC(dgas_polarity, "DGAS polarity");
-+
-+int mp_los_alarm = -1;
-+module_param_named(los_alarm, mp_los_alarm, int, 0);
-+MODULE_PARM_DESC(los_alarm, "LOS alarm");
-+
-+char *mp_eoc_vendor_id = NULL;
-+module_param_named(eoc_vendor_id, mp_eoc_vendor_id, charp, 0);
-+MODULE_PARM_DESC(eoc_vendor_id, "EOC vendor id");
-+
-+int mp_eoc_vendor_revision = -1;
-+module_param_named(eoc_vendor_revision, mp_eoc_vendor_revision, int, 0);
-+MODULE_PARM_DESC(eoc_vendor_revision, "EOC vendor revision");
-+
-+char *mp_eoc_vendor_serialnum = NULL;
-+module_param_named(eoc_vendor_serialnum, mp_eoc_vendor_serialnum, charp, 0);
-+MODULE_PARM_DESC(eoc_vendor_serialnum, "EOC vendor serial number");
-+
-+char *mp_invntry_vernum = NULL;
-+module_param_named(invntry_vernum, mp_invntry_vernum, charp, 0);
-+MODULE_PARM_DESC(invntry_vernum, "Inventory revision number");
-+
-+int mp_dsl_bit_tmode = -1;
-+module_param_named(dsl_bit_tmode, mp_dsl_bit_tmode, int, 0);
-+MODULE_PARM_DESC(dsl_bit_tmode, "DSL bit training mode");
-+
-+int mp_high_precision = -1;
-+module_param_named(high_precision, mp_high_precision, int, 0);
-+MODULE_PARM_DESC(high_precision, "High precision");
-+
-+int mp_autopvc_enable = -1;
-+module_param_named(autopvc_enable, mp_autopvc_enable, int, 0);
-+MODULE_PARM_DESC(autopvc_enable, "Enable / disable automatic PVC");
-+
-+int mp_oam_lb_timeout = -1;
-+module_param_named(oam_lb_timeout, mp_oam_lb_timeout, int, 0);
-+MODULE_PARM_DESC(oam_lb_timeout, "OAM LB timeout");
- #endif
-
- #ifndef TRUE
-@@ -728,9 +868,9 @@
- * interrupt pacing
- */
- ptr = prom_getenv ("sar_ipacemax");
-- if (ptr)
-+ if (ptr || mp_sar_ipacemax != -1)
- {
-- def_sar_inter_pace = os_atoi (ptr);
-+ def_sar_inter_pace = mp_sar_ipacemax == -1 ? os_atoi (ptr) : mp_sar_ipacemax;
- }
- /* avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
- def_sar_inter_pace); */
-@@ -878,9 +1018,18 @@
- {
- int i;
- char esi_addr[ESI_LEN] = { 0x00, 0x00, 0x11, 0x22, 0x33, 0x44 };
-- char *esiaddr_str = NULL;
-+ char *esiaddr_str = mp_macc;
-
-- esiaddr_str = prom_getenv ("macc");
-+ if (esiaddr_str == NULL)
-+ esiaddr_str = prom_getenv ("macdsl");
-+ if (esiaddr_str == NULL)
-+ esiaddr_str = prom_getenv ("macc");
-+ if (esiaddr_str == NULL)
-+ esiaddr_str = prom_getenv ("HWA_1");
-+ if (esiaddr_str == NULL)
-+ esiaddr_str = prom_getenv ("macb");
-+ if (esiaddr_str == NULL)
-+ esiaddr_str = prom_getenv ("maca");
-
- if (!esiaddr_str)
- {
-@@ -2139,15 +2288,15 @@
- //UR8_MERGE_END CQ10450*
-
- cp = prom_getenv ("dsp_noboost");
-- if (cp)
-+ if (cp || mp_dsp_noboost != -1)
- {
-- dsp_noboost = os_atoi (cp);
-+ dsp_noboost = mp_dsp_noboost == -1 ? os_atoi (cp) : mp_dsp_noboost;
- }
-
- cp = (char *) prom_getenv ("dsp_freq");
-- if (cp)
-+ if (cp || mp_dsp_freq != -1)
- {
-- dspfreq = os_atoi (cp);
-+ dspfreq = mp_dsp_freq == -1 ? os_atoi (cp) : mp_dsp_freq;
- if (dspfreq == 250)
- {
- boostDsp = 1;
-@@ -2396,15 +2545,17 @@
- // Inter-Op DSL phy Control
- // Note the setting of _dsl_Feature_0 and _dsl_Feature_1 must before
- // dslhal_api_dslStartup (in tn7dsl_init()).
-- if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_0")) != NULL)
-+ if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_0")) != NULL || mp_featctl0 != NULL)
- {
-- _dsl_Feature_0 = os_atoih (ptr);
-+ if (mp_featctl0 != NULL) ptr = mp_featctl0;
-+ _dsl_Feature_0 = os_atoh (ptr);
- _dsl_Feature_0_defined = 1;
- }
-
-- if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_1")) != NULL)
-+ if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_1")) != NULL || mp_featctl1 != NULL)
- {
-- _dsl_Feature_1 = os_atoih (ptr);
-+ if (mp_featctl1 != NULL) ptr = mp_featctl1;
-+ _dsl_Feature_1 = os_atoh (ptr);
- _dsl_Feature_1_defined = 1;
- }
-
-@@ -2412,15 +2563,17 @@
- // DSL phy Feature Control
- // Note the setting of _dsl_PhyControl_0 and _dsl_PhyControl_1 must before
- // dslhal_api_dslStartup (in tn7dsl_init()).
-- if ((ptr = prom_getenv ("DSL_PHY_CNTL_0")) != NULL)
-+ if ((ptr = prom_getenv ("DSL_PHY_CNTL_0")) != NULL || mp_phyctl0 != NULL)
- {
-- _dsl_PhyControl_0 = os_atoih (ptr);
-+ if (mp_phyctl0 != NULL) ptr = mp_phyctl0;
-+ _dsl_PhyControl_0 = os_atoh (ptr);
- _dsl_PhyControl_0_defined = 1;
- }
-
-- if ((ptr = prom_getenv ("DSL_PHY_CNTL_1")) != NULL)
-+ if ((ptr = prom_getenv ("DSL_PHY_CNTL_1")) != NULL || mp_phyctl1 != NULL)
- {
-- _dsl_PhyControl_1 = os_atoih (ptr);
-+ if (mp_phyctl1 != NULL) ptr = mp_phyctl1;
-+ _dsl_PhyControl_1 = os_atoh (ptr);
- _dsl_PhyControl_1_defined = 1;
- }
-
-@@ -2440,12 +2593,12 @@
- // read config for turbo dsl
-
- ptr = prom_getenv ("TurboDSL");
-- if (ptr)
-+ if (ptr || mp_turbodsl != -1)
- {
- #if 1 //[KT]
- bTurboDsl = os_atoi (ptr);
- #else
-- priv->bTurboDsl = os_atoi (ptr);
-+ priv->bTurboDsl = mp_turbodsl == -1 ? os_atoi (ptr) : mp_turbodsl;
- #endif
- }
- else
-@@ -2459,33 +2612,33 @@
- priv->sarRxBuf = RX_BUFFER_NUM;
- ptr = NULL;
- ptr = prom_getenv ("SarRxBuf");
-- if (ptr)
-+ if (ptr || mp_sar_rxbuf != -1)
- {
-- priv->sarRxBuf = os_atoi (ptr);
-+ priv->sarRxBuf = mp_sar_rxbuf == -1 ? os_atoi (ptr) : mp_sar_rxbuf;
- }
-
- priv->sarRxMax = RX_SERVICE_MAX;
- ptr = NULL;
- ptr = prom_getenv ("SarRxMax");
-- if (ptr)
-+ if (ptr || mp_sar_rxmax != -1)
- {
-- priv->sarRxMax = os_atoi (ptr);
-+ priv->sarRxMax = mp_sar_rxmax == -1 ? os_atoi (ptr) : mp_sar_rxmax;
- }
-
- priv->sarTxBuf = TX_BUFFER_NUM;
- ptr = NULL;
- ptr = prom_getenv ("SarTxBuf");
-- if (ptr)
-+ if (ptr || mp_sar_txbuf != -1)
- {
-- priv->sarTxBuf = os_atoi (ptr);
-+ priv->sarTxBuf = mp_sar_txbuf == -1 ? os_atoi (ptr) : mp_sar_txbuf;
- }
-
- priv->sarTxMax = TX_SERVICE_MAX;
- ptr = NULL;
- ptr = prom_getenv ("SarTxMax");
-- if (ptr)
-+ if (ptr || mp_sar_txmax != -1)
- {
-- priv->sarTxMax = os_atoi (ptr);
-+ priv->sarTxMax = mp_sar_txmax == -1 ? os_atoi (ptr) : mp_sar_txmax;
- }
-
- #ifdef AR7_EFM
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -148,6 +148,27 @@
- #define NEW_TRAINING_VAL_T1413 128
- #define NEW_TRAINING_VAL_MMODE 255
-
-+extern char *mp_modulation;
-+extern int mp_fine_gain_control;
-+extern int mp_fine_gain_value;
-+extern int mp_enable_margin_retrain;
-+extern int mp_margin_threshold;
-+extern int mp_enable_rate_adapt;
-+extern int mp_powercutback;
-+extern int mp_trellis;
-+extern int mp_bitswap;
-+extern int mp_maximum_bits_per_carrier;
-+extern int mp_maximum_interleave_depth;
-+extern int mp_pair_selection;
-+extern int mp_dgas_polarity;
-+extern int mp_los_alarm;
-+extern char *mp_eoc_vendor_id;
-+extern int mp_eoc_vendor_revision;
-+extern char *mp_eoc_vendor_serialnum;
-+extern char *mp_invntry_vernum;
-+extern int mp_dsl_bit_tmode;
-+extern int mp_high_precision;
-+
- int testflag1 = 0;
- extern int __guDbgLevel;
- extern sar_stat_t sarStat;
-@@ -2933,24 +2954,24 @@ static int tn7dsl_set_dsl(void)
- (unsigned char *) &oamFeature, 4);
-
- ptr = prom_getenv("DSL_FEATURE_CNTL_0");
-- if(!ptr)
-- prom_setenv("DSL_FEATURE_CNTL_0", "0x00004000");
-+ //if(!ptr)
-+ //prom_setenv("DSL_FEATURE_CNTL_0", "0x00004000");
-
- ptr = prom_getenv("DSL_FEATURE_CNTL_1");
-- if(!ptr)
-- prom_setenv("DSL_FEATURE_CNTL_1", "0x00000000");
-+ //if(!ptr)
-+ //prom_setenv("DSL_FEATURE_CNTL_1", "0x00000000");
-
- ptr = prom_getenv("DSL_PHY_CNTL_0");
-- if(!ptr)
-- prom_setenv("DSL_PHY_CNTL_0", "0x00000400");
-+ //if(!ptr)
-+ //prom_setenv("DSL_PHY_CNTL_0", "0x00000400");
-
- ptr = prom_getenv("enable_margin_retrain");
-- if(!ptr)
-- prom_setenv("enable_margin_retrain", "0");
-+ //if(!ptr)
-+ //prom_setenv("enable_margin_retrain", "0");
-
- ptr = prom_getenv("modulation");
-- if(!ptr)
-- prom_setenv("modulation", "0xbf");
-+ //if(!ptr)
-+ //prom_setenv("modulation", "0xbf");
-
- #define EOC_VENDOR_ID "4200534153000000"
- #define EOC_VENDOR_REVISION "FW370090708b1_55"
-@@ -2959,25 +2980,25 @@ static int tn7dsl_set_dsl(void)
- ptr = prom_getenv("eoc_vendor_id");
- if(!ptr || strcmp(ptr,EOC_VENDOR_ID) != 0 || strlen(ptr) != strlen(EOC_VENDOR_ID))
- {
-- if(ptr)
-- prom_unsetenv("eoc_vendor_id");
-- prom_setenv("eoc_vendor_id",EOC_VENDOR_ID);
-+ //if(ptr)
-+ //prom_unsetenv("eoc_vendor_id");
-+ //prom_setenv("eoc_vendor_id",EOC_VENDOR_ID);
- }
-
- ptr = prom_getenv("eoc_vendor_revision");
- if(!ptr || strcmp(ptr,EOC_VENDOR_REVISION) != 0 || strlen(ptr) != strlen(EOC_VENDOR_REVISION))
- {
-- if(ptr)
-- prom_unsetenv("eoc_vendor_revision");
-- prom_setenv("eoc_vendor_revision",EOC_VENDOR_REVISION);
-+ //if(ptr)
-+ //prom_unsetenv("eoc_vendor_revision");
-+ //prom_setenv("eoc_vendor_revision",EOC_VENDOR_REVISION);
- }
-
- ptr = prom_getenv("eoc_vendor_serialnum");
- if(!ptr || strcmp(ptr,EOC_VENDOR_SERIALNUM) != 0 || strlen(ptr) != strlen(EOC_VENDOR_SERIALNUM))
- {
-- if(ptr)
-- prom_unsetenv("eoc_vendor_serialnum");
-- prom_setenv("eoc_vendor_serialnum",EOC_VENDOR_SERIALNUM);
-+ //if(ptr)
-+ // prom_unsetenv("eoc_vendor_serialnum");
-+ //prom_setenv("eoc_vendor_serialnum",EOC_VENDOR_SERIALNUM);
- }
-
- /* Do only if we are in the new Base PSP 7.4.*/
-@@ -2994,92 +3015,88 @@ static int tn7dsl_set_dsl(void)
- we clear the modulation environment variable, as this could potentially
- not have the same meaning in the new mode.
- */
-- prom_unsetenv("modulation");
-- prom_setenv("DSL_UPG_DONE", "1");
-+ //prom_unsetenv("modulation");
-+ //prom_setenv("DSL_UPG_DONE", "1");
- }
- }
- #endif
-
- // modulation
- ptr = prom_getenv("modulation");
-- if (ptr)
-+ if (ptr || mp_modulation != NULL)
- {
-- tn7dsl_set_modulation(ptr, FALSE);
-+ tn7dsl_set_modulation(mp_modulation == NULL ? ptr : mp_modulation, FALSE);
- }
-
- // Fine Gains
- ptr = prom_getenv("fine_gain_control");
-- if (ptr)
-+ if (ptr || mp_fine_gain_control != -1)
- {
-- value = os_atoi(ptr);
-+ value = mp_fine_gain_control == -1 ? os_atoi(ptr) : mp_fine_gain_control;
- tn7dsl_ctrl_fineGain(value);
- }
- ptr = NULL;
- ptr = prom_getenv("fine_gain_value");
-- if(ptr)
-- tn7dsl_set_fineGainValue(os_atoh(ptr));
-+ if(ptr || mp_fine_gain_value != -1)
-+ tn7dsl_set_fineGainValue(mp_fine_gain_value == -1 ? os_atoh(ptr) : mp_fine_gain_value);
-
- // margin retrain
- ptr = NULL;
- ptr = prom_getenv("enable_margin_retrain");
-- if(ptr)
-+ value = mp_enable_margin_retrain == -1 ? (ptr ? os_atoi(ptr) : 0) : mp_enable_margin_retrain;
-+
-+ if (value == 1)
- {
-- value = os_atoi(ptr);
-- if(value == 1)
-+ dslhal_api_setMarginMonitorFlags(pIhw, 0, 1);
-+ bMarginRetrainEnable = 1;
-+ //printk("enable showtime margin monitor.\n");
-+
-+ ptr = NULL;
-+ ptr = prom_getenv("margin_threshold");
-+ value = mp_margin_threshold == -1 ? (ptr ? os_atoi(ptr) : 0) : mp_margin_threshold;
-+
-+ if(value >= 0)
- {
-- dslhal_api_setMarginMonitorFlags(pIhw, 0, 1);
-- bMarginRetrainEnable = 1;
-- //printk("enable showtime margin monitor.\n");
-- ptr = NULL;
-- ptr = prom_getenv("margin_threshold");
-- if(ptr)
-- {
-- value = os_atoi(ptr);
-- //printk("Set margin threshold to %d x 0.5 db\n",value);
-- if(value >= 0)
-- {
-- dslhal_api_setMarginThreshold(pIhw, value);
-- bMarginThConfig=1;
-- }
-- }
-+ dslhal_api_setMarginThreshold(pIhw, value);
-+ bMarginThConfig=1;
- }
- }
-
- // rate adapt
- ptr = NULL;
- ptr = prom_getenv("enable_rate_adapt");
-- if(ptr)
-+ if(ptr || mp_enable_rate_adapt != -1)
- {
-- dslhal_api_setRateAdaptFlag(pIhw, os_atoi(ptr));
-+ dslhal_api_setRateAdaptFlag(pIhw, mp_enable_rate_adapt == -1 ? os_atoi(ptr) : mp_enable_rate_adapt);
- }
-
- // set powercutback
- ptr = NULL;
- ptr = prom_getenv("powercutback");
-- if(ptr)
-+ if(ptr || mp_powercutback != -1)
- {
-- dslhal_advcfg_onOffPcb(pIhw, os_atoi(ptr));
-+ dslhal_advcfg_onOffPcb(pIhw, mp_powercutback == -1 ? os_atoi(ptr) : mp_powercutback);
- }
-
- // trellis
- ptr = NULL;
- ptr = prom_getenv("trellis");
-- if(ptr)
-+ if(ptr || mp_trellis != -1)
- {
-- dslhal_api_setTrellisFlag(pIhw, os_atoi(ptr));
-- trellis = os_atoi(ptr);
-+ trellis = mp_trellis == -1 ? os_atoi(ptr) : mp_trellis;
-+ dslhal_api_setTrellisFlag(pIhw, trellis);
- //printk("trellis=%d\n");
- }
-
- // bitswap
- ptr = NULL;
- ptr = prom_getenv("bitswap");
-- if(ptr)
-+ if(ptr || mp_bitswap != -1)
- {
- int offset[2] = {33, 0};
- unsigned int bitswap;
-
-- bitswap = os_atoi(ptr);
-+ bitswap = mp_bitswap == -1 ? os_atoi(ptr) : mp_bitswap;
-
- tn7dsl_generic_read(2, offset);
- dslReg &= dslhal_support_byteSwap32(0xFFFFFF00);
-@@ -3097,46 +3114,47 @@ static int tn7dsl_set_dsl(void)
- // maximum bits per carrier
- ptr = NULL;
- ptr = prom_getenv("maximum_bits_per_carrier");
-- if(ptr)
-+ if(ptr || mp_maximum_bits_per_carrier != -1)
- {
-- dslhal_api_setMaxBitsPerCarrierUpstream(pIhw, os_atoi(ptr));
-+ dslhal_api_setMaxBitsPerCarrierUpstream(pIhw, mp_maximum_bits_per_carrier == -1 ? os_atoi(ptr) : mp_maximum_bits_per_carrier);
- }
-
- // maximum interleave depth
- ptr = NULL;
- ptr = prom_getenv("maximum_interleave_depth");
-- if(ptr)
-+ if(ptr || mp_maximum_interleave_depth != -1)
- {
-- dslhal_api_setMaxInterleaverDepth(pIhw, os_atoi(ptr));
-+ dslhal_api_setMaxInterleaverDepth(pIhw, mp_maximum_interleave_depth == -1 ? os_atoi(ptr) : mp_maximum_interleave_depth);
- }
-
- // inner and outer pairs
- ptr = NULL;
- ptr = prom_getenv("pair_selection");
-- if(ptr)
-+ if(ptr || mp_pair_selection != -1)
- {
-- dslhal_api_selectInnerOuterPair(pIhw, os_atoi(ptr));
-+ dslhal_api_selectInnerOuterPair(pIhw, mp_pair_selection == -1 ? os_atoi(ptr) : mp_pair_selection);
- }
-
- ptr = NULL;
- ptr = prom_getenv("dgas_polarity");
-- if(ptr)
-+ if(ptr || mp_dgas_polarity != -1)
- {
- dslhal_api_configureDgaspLpr(pIhw, 1, 1);
-- dslhal_api_configureDgaspLpr(pIhw, 0, os_atoi(ptr));
-+ dslhal_api_configureDgaspLpr(pIhw, 0, mp_dgas_polarity == -1 ? os_atoi(ptr) : mp_dgas_polarity);
- }
-
- ptr = NULL;
- ptr = prom_getenv("los_alarm");
-- if(ptr)
-+ if(ptr || mp_los_alarm != -1)
- {
-- dslhal_api_disableLosAlarm(pIhw, os_atoi(ptr));
-+ dslhal_api_disableLosAlarm(pIhw, mp_los_alarm == -1 ? os_atoi(ptr) : mp_los_alarm);
- }
-
- ptr = NULL;
- ptr = prom_getenv("eoc_vendor_id");
-- if(ptr)
-+ if(ptr || mp_eoc_vendor_id != NULL)
- {
-+ ptr = mp_eoc_vendor_id == NULL ? ptr : mp_eoc_vendor_id;
- for(i=0;i<8;i++)
- {
- tmp[0]=ptr[i*2];
-@@ -3161,26 +3179,26 @@ static int tn7dsl_set_dsl(void)
- }
- ptr = NULL;
- ptr = prom_getenv("eoc_vendor_revision");
-- if(ptr)
-+ if(ptr || mp_eoc_vendor_revision != -1)
- {
-- value = os_atoi(ptr);
-+ value = mp_eoc_vendor_revision == -1 ? os_atoi(ptr) : mp_eoc_vendor_revision;
- //printk("eoc rev=%d\n", os_atoi(ptr));
- dslhal_api_setEocRevisionNumber(pIhw, (char *)&value);
-
- }
- ptr = NULL;
- ptr = prom_getenv("eoc_vendor_serialnum");
-- if(ptr)
-+ if(ptr || mp_eoc_vendor_serialnum != NULL)
- {
-- dslhal_api_setEocSerialNumber(pIhw, ptr);
-+ dslhal_api_setEocSerialNumber(pIhw, mp_eoc_vendor_serialnum == NULL ? ptr : mp_eoc_vendor_serialnum);
- }
-
- // CQ10037 Added invntry_vernum environment variable to be able to set version number in ADSL2, ADSL2+ modes.
- ptr = NULL;
- ptr = prom_getenv("invntry_vernum");
-- if(ptr)
-+ if(ptr || mp_invntry_vernum != NULL)
- {
-- dslhal_api_setEocRevisionNumber(pIhw, ptr);
-+ dslhal_api_setEocRevisionNumber(pIhw, mp_invntry_vernum == NULL ? ptr : mp_invntry_vernum);
- }
-
- return 0;
-@@ -3225,7 +3243,7 @@ int tn7dsl_init(void *priv)
- * backward compatibility.
- */
- cp = prom_getenv("DSL_BIT_TMODE");
-- if (cp)
-+ if (cp || mp_dsl_bit_tmode != -1)
- {
- printk("%s : env var DSL_BIT_TMODE is set\n", __FUNCTION__);
- /*
-@@ -3254,9 +3272,9 @@ int tn7dsl_init(void *priv)
-
- // UR8_MERGE_START CQ11054 Jack Zhang
- cp = prom_getenv("high_precision");
-- if (cp)
-+ if (cp || mp_high_precision != -1)
- {
-- high_precision_selected = os_atoi(cp);
-+ high_precision_selected = mp_high_precision == -1 ? os_atoi(cp) : mp_high_precision;
- }
- if ( high_precision_selected)
- {
---- a/tn7sar.c
-+++ b/tn7sar.c
-@@ -76,6 +76,8 @@ typedef void OS_SETUP;
- #include "tn7atm.h"
- #include "tn7api.h"
-
-+extern int mp_oam_lb_timeout;
-+extern int mp_autopvc_enable;
-
- /* PDSP Firmware files */
- #include "tnetd7300_sar_firm.h"
-@@ -932,9 +934,9 @@ int tn7sar_setup_oam_channel(Tn7AtmPriva
- pHalDev = (HAL_DEVICE *)priv->pSarHalDev;
-
- pauto_pvc = prom_getenv("autopvc_enable");
-- if(pauto_pvc) //CQ10273
-+ if(pauto_pvc || mp_autopvc_enable != -1) //CQ10273
- {
-- auto_pvc =tn7sar_strtoul(pauto_pvc, NULL, 10);
-+ auto_pvc = mp_autopvc_enable == -1 ? tn7sar_strtoul(pauto_pvc, NULL, 10) : mp_autopvc_enable;
- }
-
- memset(&chInfo, 0xff, sizeof(chInfo));
-@@ -1133,9 +1135,9 @@ int tn7sar_init(struct atm_dev *dev, Tn7
-
- /* read in oam lb timeout value */
- pLbTimeout = prom_getenv("oam_lb_timeout");
-- if(pLbTimeout)
-+ if(pLbTimeout || mp_oam_lb_timeout != -1)
- {
-- lbTimeout =tn7sar_strtoul(pLbTimeout, NULL, 10);
-+ lbTimeout = mp_oam_lb_timeout == -1 ? tn7sar_strtoul(pLbTimeout, NULL, 10) : mp_oam_lb_timeout;
- oamLbTimeout = lbTimeout;
- pHalFunc->Control(pHalDev,"OamLbTimeout", "Set", &lbTimeout);
- }
+++ /dev/null
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -117,6 +117,7 @@
- #include <linux/vmalloc.h>
- #include <linux/file.h>
- #include <linux/firmware.h>
-+#include <linux/version.h>
-
- #include <asm/io.h>
- #include <asm/ar7/ar7.h>
-@@ -492,7 +493,9 @@ static void avsar_release(struct device
- }
-
- static struct device avsar = {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
- .bus_id = "vlynq",
-+#endif
- .release = avsar_release,
- };
-
-@@ -501,6 +504,9 @@ int shim_osLoadFWImage(unsigned char *pt
- const struct firmware *fw_entry;
- size_t size;
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
-+ dev_set_name(&avsar, "avsar");
-+#endif
- printk("requesting firmware image \"ar0700xx.bin\"\n");
- if(device_register(&avsar) < 0) {
- printk(KERN_ERR
+++ /dev/null
---- a/tn7atm.c
-+++ b/tn7atm.c
-@@ -76,10 +76,16 @@
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
-+#include <linux/version.h>
-
- #include <asm/io.h>
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
- #include <asm/ar7/ar7.h>
- #include <asm/ar7/prom.h>
-+#else
-+#include <asm/mach-ar7/ar7.h>
-+#include <asm/mach-ar7/prom.h>
-+#endif
-
- #include "dsl_hal_api.h"
- #ifdef AR7_EFM
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -120,8 +120,13 @@
- #include <linux/version.h>
-
- #include <asm/io.h>
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
- #include <asm/ar7/ar7.h>
- #include <asm/ar7/prom.h>
-+#else
-+#include <asm/mach-ar7/ar7.h>
-+#include <asm/mach-ar7/prom.h>
-+#endif
-
- /* Modules specific header files */
- #ifdef AR7_EFM
---- a/tn7sar.c
-+++ b/tn7sar.c
-@@ -53,10 +53,16 @@
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
-+#include <linux/version.h>
-
- #include <asm/io.h>
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
- #include <asm/ar7/ar7.h>
- #include <asm/ar7/prom.h>
-+#else
-+#include <asm/mach-ar7/ar7.h>
-+#include <asm/mach-ar7/prom.h>
-+#endif
-
- #define _CPHAL_AAL5
- #define _CPHAL_SAR
+++ /dev/null
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -215,7 +215,11 @@ led_reg_t ledreg[2];
- static struct led_funcs ledreg[2];
- #endif
-
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
- #define DEV_DSLMOD CTL_UNNUMBERED
-+#else
-+#define DEV_DSLMOD 0
-+#endif
- #define MAX_STR_SIZE 256
- #define DSL_MOD_SIZE 256
-
-@@ -3615,9 +3619,16 @@ static int dslmod_sysctl(ctl_table *ctl,
- */
- if(write)
- {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
- ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
--
-+#else
-+ ret = proc_dostring(ctl, write, buffer, lenp, 0);
-+#endif
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
- switch (ctl->ctl_name)
-+#else
-+ switch ((long)ctl->extra2)
-+#endif
- {
- case DEV_DSLMOD:
- ptr = strpbrk(info, " \t");
-@@ -3701,14 +3712,29 @@ static int dslmod_sysctl(ctl_table *ctl,
- else
- {
- len += sprintf(info+len, mod_req);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
- ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
-+#else
-+ ret = proc_dostring(ctl, write, buffer, lenp, 0);
-+#endif
- }
- return ret;
- }
-
-
- ctl_table dslmod_table[] = {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
- {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, NULL, &dslmod_sysctl, &sysctl_string}
-+#else
-+ {
-+ .procname = "dslmod",
-+ .data = info,
-+ .maxlen = DSL_MOD_SIZE,
-+ .mode = 0644,
-+ .proc_handler = &dslmod_sysctl,
-+ .extra2 = (void *)DEV_DSLMOD,
-+ }
-+#endif
- ,
- {0}
- };
-@@ -3716,7 +3742,16 @@ ctl_table dslmod_table[] = {
- /* Make sure that /proc/sys/dev is there */
- ctl_table dslmod_root_table[] = {
- #ifdef CONFIG_PROC_FS
-+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
- {CTL_DEV, "dev", NULL, 0, 0555, dslmod_table}
-+ #else
-+ {
-+ .procname = "dev",
-+ .maxlen = 0,
-+ .mode = 0555,
-+ .child = dslmod_table,
-+ }
-+ #endif
- ,
- #endif /* CONFIG_PROC_FS */
- {0}
+++ /dev/null
---- a/tn7atm.c
-+++ b/tn7atm.c
-@@ -2000,7 +2000,11 @@ static int __init tn7atm_register (Tn7At
-
- dgprintf (4, "device %s being registered\n", priv->name);
-
-+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
- mydev = atm_dev_register (priv->proc_name, &tn7atm_ops, -1, NULL);
-+ #else
-+ mydev = atm_dev_register (priv->proc_name, NULL, &tn7atm_ops, -1, NULL);
-+ #endif
-
- if (mydev == NULL)
- {
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -512,14 +512,17 @@ int shim_osLoadFWImage(unsigned char *pt
- {
- const struct firmware *fw_entry;
- size_t size;
-+ int ret;
-
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
- dev_set_name(&avsar, "avsar");
- #endif
- printk("requesting firmware image \"ar0700xx.bin\"\n");
-- if(device_register(&avsar) < 0) {
-+ dev_set_name(&avsar, "avsar");
-+ ret = device_register(&avsar);
-+ if (ret < 0) {
- printk(KERN_ERR
-- "avsar: device_register fails\n");
-+ "avsar: device_register fails, error%i\n", ret);
- return -1;
- }
-
+++ /dev/null
---- a/tn7atm.c
-+++ b/tn7atm.c
-@@ -72,7 +72,7 @@
- #include <linux/atmdev.h>
- #include <linux/delay.h>
- #include <linux/spinlock.h>
--#include <linux/smp_lock.h>
-+#include <linux/interrupt.h>
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
---- a/tn7sar.c
-+++ b/tn7sar.c
-@@ -49,7 +49,7 @@
- #include <linux/atmdev.h>
- #include <linux/delay.h>
- #include <linux/spinlock.h>
--#include <linux/smp_lock.h>
-+#include <linux/interrupt.h>
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
---- a/tn7dsl.c
-+++ b/tn7dsl.c
-@@ -108,7 +108,7 @@
- #include <linux/atmdev.h>
- #include <linux/delay.h>
- #include <linux/spinlock.h>
--#include <linux/smp_lock.h>
-+#include <linux/interrupt.h>
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
+++ /dev/null
-#
-# Copyright (C) 2008 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=avila-wdt
-PKG_RELEASE:=1
-
-include $(INCLUDE_DIR)/package.mk
-
-define KernelPackage/avila-wdt
- SUBMENU:=Other modules
- TITLE:=GPIO hardware watchdog driver for modified Avila boards
- DEPENDS:=@GPIO_SUPPORT @TARGET_ixp4xx
- FILES:=$(PKG_BUILD_DIR)/avila-wdt.ko
- AUTOLOAD:=$(call AutoLoad,10,avila-wdt)
-endef
-
-MAKE_OPTS:= \
- ARCH="$(LINUX_KARCH)" \
- CROSS_COMPILE="$(TARGET_CROSS)" \
- SUBDIRS="$(PKG_BUILD_DIR)"
-
-define Build/Prepare
- mkdir -p $(PKG_BUILD_DIR)
- $(CP) ./src/* $(PKG_BUILD_DIR)/
-endef
-
-define Build/Compile
- $(MAKE) -C "$(LINUX_DIR)" \
- $(MAKE_OPTS) \
- modules
-endef
-
-$(eval $(call KernelPackage,avila-wdt))
+++ /dev/null
-obj-m := avila-wdt.o
+++ /dev/null
-/*
- * avila-wdt.c
- * Copyright (C) 2009 Felix Fietkau <nbd@openwrt.org>
- *
- * based on:
- * drivers/char/watchdog/ixp4xx_wdt.c
- *
- * Watchdog driver for Intel IXP4xx network processors
- *
- * Author: Deepak Saxena <dsaxena@plexity.net>
- *
- * Copyright 2004 (c) MontaVista, Software, Inc.
- * Based on sa1100 driver, Copyright (C) 2000 Oleg Drokin <green@crimea.edu>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/jiffies.h>
-#include <linux/timer.h>
-#include <linux/fs.h>
-#include <linux/miscdevice.h>
-#include <linux/watchdog.h>
-#include <linux/init.h>
-#include <linux/bitops.h>
-#include <linux/uaccess.h>
-#include <mach/hardware.h>
-
-static int nowayout = WATCHDOG_NOWAYOUT;
-static int heartbeat = 20; /* (secs) Default is 20 seconds */
-static unsigned long wdt_status;
-static atomic_t wdt_counter;
-struct timer_list wdt_timer;
-
-#define WDT_IN_USE 0
-#define WDT_OK_TO_CLOSE 1
-#define WDT_RUNNING 2
-
-static void wdt_refresh(unsigned long data)
-{
- if (test_bit(WDT_RUNNING, &wdt_status)) {
- if (atomic_dec_and_test(&wdt_counter)) {
- printk(KERN_WARNING "Avila watchdog expired, expect a reboot soon!\n");
- clear_bit(WDT_RUNNING, &wdt_status);
- return;
- }
- }
-
- /* strobe to the watchdog */
- gpio_line_set(14, IXP4XX_GPIO_HIGH);
- gpio_line_set(14, IXP4XX_GPIO_LOW);
-
- mod_timer(&wdt_timer, jiffies + msecs_to_jiffies(500));
-}
-
-static void wdt_enable(void)
-{
- atomic_set(&wdt_counter, heartbeat * 2);
-
- /* Disable clock generator output on GPIO 14/15 */
- *IXP4XX_GPIO_GPCLKR &= ~(1 << 8);
-
- /* activate GPIO 14 out */
- gpio_line_config(14, IXP4XX_GPIO_OUT);
- gpio_line_set(14, IXP4XX_GPIO_LOW);
-
- if (!test_bit(WDT_RUNNING, &wdt_status))
- wdt_refresh(0);
- set_bit(WDT_RUNNING, &wdt_status);
-}
-
-static void wdt_disable(void)
-{
- /* Re-enable clock generator output on GPIO 14/15 */
- *IXP4XX_GPIO_GPCLKR |= (1 << 8);
-}
-
-static int avila_wdt_open(struct inode *inode, struct file *file)
-{
- if (test_and_set_bit(WDT_IN_USE, &wdt_status))
- return -EBUSY;
-
- clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
- wdt_enable();
- return nonseekable_open(inode, file);
-}
-
-static ssize_t
-avila_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
-{
- if (len) {
- if (!nowayout) {
- size_t i;
-
- clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
-
- for (i = 0; i != len; i++) {
- char c;
-
- if (get_user(c, data + i))
- return -EFAULT;
- if (c == 'V')
- set_bit(WDT_OK_TO_CLOSE, &wdt_status);
- }
- }
- wdt_enable();
- }
- return len;
-}
-
-static struct watchdog_info ident = {
- .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE |
- WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
- .identity = "Avila Watchdog",
-};
-
-
-static long avila_wdt_ioctl(struct file *file, unsigned int cmd,
- unsigned long arg)
-{
- int ret = -ENOTTY;
- int time;
-
- switch (cmd) {
- case WDIOC_GETSUPPORT:
- ret = copy_to_user((struct watchdog_info *)arg, &ident,
- sizeof(ident)) ? -EFAULT : 0;
- break;
-
- case WDIOC_GETSTATUS:
- ret = put_user(0, (int *)arg);
- break;
-
- case WDIOC_KEEPALIVE:
- wdt_enable();
- ret = 0;
- break;
-
- case WDIOC_SETTIMEOUT:
- ret = get_user(time, (int *)arg);
- if (ret)
- break;
-
- if (time <= 0 || time > 60) {
- ret = -EINVAL;
- break;
- }
-
- heartbeat = time;
- wdt_enable();
- /* Fall through */
-
- case WDIOC_GETTIMEOUT:
- ret = put_user(heartbeat, (int *)arg);
- break;
- }
- return ret;
-}
-
-static int avila_wdt_release(struct inode *inode, struct file *file)
-{
- if (test_bit(WDT_OK_TO_CLOSE, &wdt_status))
- wdt_disable();
- else
- printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - "
- "timer will not stop\n");
- clear_bit(WDT_IN_USE, &wdt_status);
- clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
-
- return 0;
-}
-
-
-static const struct file_operations avila_wdt_fops = {
- .owner = THIS_MODULE,
- .llseek = no_llseek,
- .write = avila_wdt_write,
- .unlocked_ioctl = avila_wdt_ioctl,
- .open = avila_wdt_open,
- .release = avila_wdt_release,
-};
-
-static struct miscdevice avila_wdt_miscdev = {
- .minor = WATCHDOG_MINOR + 1,
- .name = "avila_watchdog",
- .fops = &avila_wdt_fops,
-};
-
-static int __init avila_wdt_init(void)
-{
- int ret;
-
- init_timer(&wdt_timer);
- wdt_timer.expires = 0;
- wdt_timer.data = 0;
- wdt_timer.function = wdt_refresh;
- ret = misc_register(&avila_wdt_miscdev);
- if (ret == 0)
- printk(KERN_INFO "Avila Watchdog Timer: heartbeat %d sec\n",
- heartbeat);
- return ret;
-}
-
-static void __exit avila_wdt_exit(void)
-{
- misc_deregister(&avila_wdt_miscdev);
- del_timer(&wdt_timer);
- wdt_disable();
-}
-
-
-module_init(avila_wdt_init);
-module_exit(avila_wdt_exit);
-
-MODULE_AUTHOR("Felix Fietkau <nbd@openwrt.org>");
-MODULE_DESCRIPTION("Gateworks Avila Hardware Watchdog");
-
-module_param(heartbeat, int, 0);
-MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds (default 20s)");
-
-module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started");
-
-MODULE_LICENSE("GPL");
-MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
-
+++ /dev/null
-#
-# Copyright (C) 2012 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=brcm2708-gpu-fw
-PKG_REV:=29ce6bcf278e7e79cd8a2b84c6aa9db9864ca91d
-PKG_VERSION:=20120529
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_SOURCE_URL:=git://github.com/raspberrypi/firmware.git
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=$(PKG_REV)
-
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/brcm2708-gpu-fw
- SECTION:=boot
- CATEGORY:=Boot Loaders
- DEPENDS:=@TARGET_brcm2708
- TITLE:=brcm2708-gpu-fw
- DEFAULT:=y if (TARGET_brcm2708)
-endef
-
-define Package/brcm2708-gpu-fw/description
- GPU and kernel boot firmware for brcm2708.
-endef
-
-define Build/Compile
-endef
-
-define Build/InstallDev
- $(INSTALL_DIR) $(BUILD_DIR)/brcm2708-gpu-fw-boot
- $(CP) $(PKG_BUILD_DIR)/boot/* $(BUILD_DIR)/brcm2708-gpu-fw-boot
-endef
-
-$(eval $(call BuildPackage,brcm2708-gpu-fw))
-
+++ /dev/null
-#
-# Copyright (C) 2008-2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=button-hotplug
-PKG_RELEASE:=3
-
-include $(INCLUDE_DIR)/package.mk
-
-define KernelPackage/button-hotplug
- SUBMENU:=Other modules
- TITLE:=Button Hotplug driver
- FILES:=$(PKG_BUILD_DIR)/button-hotplug.ko
- AUTOLOAD:=$(call AutoLoad,30,button-hotplug)
- KCONFIG:=
-endef
-
-define KernelPackage/button-hotplug/description
- Kernel module to generate button hotplug events
-endef
-
-EXTRA_KCONFIG:= \
- CONFIG_BUTTON_HOTPLUG=m
-
-EXTRA_CFLAGS:= \
- $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(EXTRA_KCONFIG)))) \
- $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(EXTRA_KCONFIG)))) \
-
-MAKE_OPTS:= \
- ARCH="$(LINUX_KARCH)" \
- CROSS_COMPILE="$(TARGET_CROSS)" \
- SUBDIRS="$(PKG_BUILD_DIR)" \
- EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
- $(EXTRA_KCONFIG)
-
-define Build/Prepare
- mkdir -p $(PKG_BUILD_DIR)
- $(CP) ./src/* $(PKG_BUILD_DIR)/
-endef
-
-define Build/Compile
- $(MAKE) -C "$(LINUX_DIR)" \
- $(MAKE_OPTS) \
- modules
-endef
-
-$(eval $(call KernelPackage,button-hotplug))
+++ /dev/null
-config BUTTON_HOTPLUG
- tristate "Button Hotplug driver"
+++ /dev/null
-obj-${CONFIG_BUTTON_HOTPLUG} += button-hotplug.o
\ No newline at end of file
+++ /dev/null
-/*
- * Button Hotplug driver
- *
- * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
- *
- * Based on the diag.c - GPIO interface driver for Broadcom boards
- * Copyright (C) 2006 Mike Baker <mbm@openwrt.org>,
- * Copyright (C) 2006-2007 Felix Fietkau <nbd@openwrt.org>
- * Copyright (C) 2008 Andy Boyett <agb@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- */
-
-#include <linux/module.h>
-#include <linux/version.h>
-#include <linux/kmod.h>
-#include <linux/input.h>
-
-#include <linux/workqueue.h>
-#include <linux/skbuff.h>
-#include <linux/netlink.h>
-#include <linux/kobject.h>
-
-#define DRV_NAME "button-hotplug"
-#define DRV_VERSION "0.4.1"
-#define DRV_DESC "Button Hotplug driver"
-
-#define BH_SKB_SIZE 2048
-
-#define PFX DRV_NAME ": "
-
-#undef BH_DEBUG
-
-#ifdef BH_DEBUG
-#define BH_DBG(fmt, args...) printk(KERN_DEBUG "%s: " fmt, DRV_NAME, ##args )
-#else
-#define BH_DBG(fmt, args...) do {} while (0)
-#endif
-
-#define BH_ERR(fmt, args...) printk(KERN_ERR "%s: " fmt, DRV_NAME, ##args )
-
-#ifndef BIT_MASK
-#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
-#endif
-
-struct bh_priv {
- unsigned long *seen;
- struct input_handle handle;
-};
-
-struct bh_event {
- const char *name;
- char *action;
- unsigned long seen;
-
- struct sk_buff *skb;
- struct work_struct work;
-};
-
-struct bh_map {
- unsigned int code;
- const char *name;
-};
-
-extern u64 uevent_next_seqnum(void);
-
-#define BH_MAP(_code, _name) \
- { \
- .code = (_code), \
- .name = (_name), \
- }
-
-static struct bh_map button_map[] = {
- BH_MAP(BTN_0, "BTN_0"),
- BH_MAP(BTN_1, "BTN_1"),
- BH_MAP(BTN_2, "BTN_2"),
- BH_MAP(BTN_3, "BTN_3"),
- BH_MAP(BTN_4, "BTN_4"),
- BH_MAP(BTN_5, "BTN_5"),
- BH_MAP(BTN_6, "BTN_6"),
- BH_MAP(BTN_7, "BTN_7"),
- BH_MAP(BTN_8, "BTN_8"),
- BH_MAP(BTN_9, "BTN_9"),
- BH_MAP(KEY_RESTART, "reset"),
-#ifdef KEY_WPS_BUTTON
- BH_MAP(KEY_WPS_BUTTON, "wps"),
-#endif /* KEY_WPS_BUTTON */
-};
-
-/* -------------------------------------------------------------------------*/
-
-static int bh_event_add_var(struct bh_event *event, int argv,
- const char *format, ...)
-{
- static char buf[128];
- char *s;
- va_list args;
- int len;
-
- if (argv)
- return 0;
-
- va_start(args, format);
- len = vsnprintf(buf, sizeof(buf), format, args);
- va_end(args);
-
- if (len >= sizeof(buf)) {
- BH_ERR("buffer size too small\n");
- WARN_ON(1);
- return -ENOMEM;
- }
-
- s = skb_put(event->skb, len + 1);
- strcpy(s, buf);
-
- BH_DBG("added variable '%s'\n", s);
-
- return 0;
-}
-
-static int button_hotplug_fill_event(struct bh_event *event)
-{
- int ret;
-
- ret = bh_event_add_var(event, 0, "HOME=%s", "/");
- if (ret)
- return ret;
-
- ret = bh_event_add_var(event, 0, "PATH=%s",
- "/sbin:/bin:/usr/sbin:/usr/bin");
- if (ret)
- return ret;
-
- ret = bh_event_add_var(event, 0, "SUBSYSTEM=%s", "button");
- if (ret)
- return ret;
-
- ret = bh_event_add_var(event, 0, "ACTION=%s", event->action);
- if (ret)
- return ret;
-
- ret = bh_event_add_var(event, 0, "BUTTON=%s", event->name);
- if (ret)
- return ret;
-
- ret = bh_event_add_var(event, 0, "SEEN=%ld", event->seen);
- if (ret)
- return ret;
-
- ret = bh_event_add_var(event, 0, "SEQNUM=%llu", uevent_next_seqnum());
-
- return ret;
-}
-
-static void button_hotplug_work(struct work_struct *work)
-{
- struct bh_event *event = container_of(work, struct bh_event, work);
- int ret = 0;
-
- event->skb = alloc_skb(BH_SKB_SIZE, GFP_KERNEL);
- if (!event->skb)
- goto out_free_event;
-
- ret = bh_event_add_var(event, 0, "%s@", event->action);
- if (ret)
- goto out_free_skb;
-
- ret = button_hotplug_fill_event(event);
- if (ret)
- goto out_free_skb;
-
- NETLINK_CB(event->skb).dst_group = 1;
- broadcast_uevent(event->skb, 0, 1, GFP_KERNEL);
-
- out_free_skb:
- if (ret) {
- BH_ERR("work error %d\n", ret);
- kfree_skb(event->skb);
- }
- out_free_event:
- kfree(event);
-}
-
-static int button_hotplug_create_event(const char *name, unsigned long seen,
- int pressed)
-{
- struct bh_event *event;
-
- BH_DBG("create event, name=%s, seen=%lu, pressed=%d\n",
- name, seen, pressed);
-
- event = kzalloc(sizeof(*event), GFP_KERNEL);
- if (!event)
- return -ENOMEM;
-
- event->name = name;
- event->seen = seen;
- event->action = pressed ? "pressed" : "released";
-
- INIT_WORK(&event->work, (void *)(void *)button_hotplug_work);
- schedule_work(&event->work);
-
- return 0;
-}
-
-/* -------------------------------------------------------------------------*/
-
-#ifdef CONFIG_HOTPLUG
-static int button_get_index(unsigned int code)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(button_map); i++)
- if (button_map[i].code == code)
- return i;
-
- return -1;
-}
-static void button_hotplug_event(struct input_handle *handle,
- unsigned int type, unsigned int code, int value)
-{
- struct bh_priv *priv = handle->private;
- unsigned long seen = jiffies;
- int btn;
-
- BH_DBG("event type=%u, code=%u, value=%d\n", type, code, value);
-
- if (type != EV_KEY)
- return;
-
- btn = button_get_index(code);
- if (btn < 0)
- return;
-
- button_hotplug_create_event(button_map[btn].name,
- (seen - priv->seen[btn]) / HZ, value);
- priv->seen[btn] = seen;
-}
-#else
-static void button_hotplug_event(struct input_handle *handle,
- unsigned int type, unsigned int code, int value)
-{
-}
-#endif /* CONFIG_HOTPLUG */
-
-static int button_hotplug_connect(struct input_handler *handler,
- struct input_dev *dev, const struct input_device_id *id)
-{
- struct bh_priv *priv;
- int ret;
- int i;
-
- for (i = 0; i < ARRAY_SIZE(button_map); i++)
- if (test_bit(button_map[i].code, dev->keybit))
- break;
-
- if (i == ARRAY_SIZE(button_map))
- return -ENODEV;
-
- priv = kzalloc(sizeof(*priv) +
- (sizeof(unsigned long) * ARRAY_SIZE(button_map)),
- GFP_KERNEL);
- if (!priv)
- return -ENOMEM;
-
- priv->seen = (unsigned long *) &priv[1];
- priv->handle.private = priv;
- priv->handle.dev = dev;
- priv->handle.handler = handler;
- priv->handle.name = DRV_NAME;
-
- ret = input_register_handle(&priv->handle);
- if (ret)
- goto err_free_priv;
-
- ret = input_open_device(&priv->handle);
- if (ret)
- goto err_unregister_handle;
-
- BH_DBG("connected to %s\n", dev->name);
-
- return 0;
-
- err_unregister_handle:
- input_unregister_handle(&priv->handle);
-
- err_free_priv:
- kfree(priv);
- return ret;
-}
-
-static void button_hotplug_disconnect(struct input_handle *handle)
-{
- struct bh_priv *priv = handle->private;
-
- input_close_device(handle);
- input_unregister_handle(handle);
-
- kfree(priv);
-}
-
-static const struct input_device_id button_hotplug_ids[] = {
- {
- .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
- .evbit = { BIT_MASK(EV_KEY) },
- },
- {
- /* Terminating entry */
- },
-};
-
-MODULE_DEVICE_TABLE(input, button_hotplug_ids);
-
-static struct input_handler button_hotplug_handler = {
- .event = button_hotplug_event,
- .connect = button_hotplug_connect,
- .disconnect = button_hotplug_disconnect,
- .name = DRV_NAME,
- .id_table = button_hotplug_ids,
-};
-
-/* -------------------------------------------------------------------------*/
-
-static int __init button_hotplug_init(void)
-{
- int ret;
-
- printk(KERN_INFO DRV_DESC " version " DRV_VERSION "\n");
- ret = input_register_handler(&button_hotplug_handler);
- if (ret)
- BH_ERR("unable to register input handler\n");
-
- return ret;
-}
-module_init(button_hotplug_init);
-
-static void __exit button_hotplug_exit(void)
-{
- input_unregister_handler(&button_hotplug_handler);
-}
-module_exit(button_hotplug_exit);
-
-MODULE_DESCRIPTION(DRV_DESC);
-MODULE_VERSION(DRV_VERSION);
-MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
-MODULE_LICENSE("GPL v2");
-
+++ /dev/null
-#
-# Copyright (C) 2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=ep80579-drivers
-PKG_VERSION:=1.0.34
-PKG_RELEASE:=1
-
-PKG_SOURCE:=Embedded.L.1.0.34.ADI.R100.tar.gz
-PKG_SOURCE_URL:=ftp://ftp.adiengineering.com/Archive/OcracokeIsland/Drivers/Linux/1.0.34/
-PKG_MD5SUM:=61df9778f8c1f919257d2f48a0bcb000
-
-PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
-
-include $(INCLUDE_DIR)/package.mk
-
-define KernelPackage/ep80579-drivers/Default
- DEPENDS:=@TARGET_x86_ep80579
-endef
-
-define KernelPackage/ep80579-eth
-$(call KernelPackage/ep80579-drivers/Default)
- SUBMENU:=Network Devices
- TITLE:=Intel EP80579 ethernet driver
- FILES:= \
- $(PKG_BUILD_DIR)/Embedded/src/GbE/gcu.ko \
- $(PKG_BUILD_DIR)/Embedded/src/GbE/iegbe.ko
- AUTOLOAD:=$(call AutoLoad,40,gcu iegbe)
-endef
-
-define KernelPackage/ep80579-misc
-$(call KernelPackage/ep80579-drivers/Default)
- SUBMENU:=Other modules
- TITLE:=Misc. Intel EP80579 drivers (DMA,, gpio)
- FILES:= \
- $(PKG_BUILD_DIR)/Embedded/src/EDMA/dma.ko \
- $(PKG_BUILD_DIR)/Embedded/src/GPIO/gpio.ko
- AUTOLOAD:=$(call AutoLoad,40,gpio dma)
-endef
-
-define KernelPackage/ep80579-can
-$(call KernelPackage/ep80579-drivers/Default)
- SUBMENU:=Other modules
- TITLE:=Intel EP80579 CAN driver
- FILES:= \
- $(PKG_BUILD_DIR)/Embedded/src/1588/timesync.ko \
- $(PKG_BUILD_DIR)/Embedded/src/CAN/can.ko
- AUTOLOAD:=$(call AutoLoad,40,timesync can)
-endef
-
-define Build/Prepare
- rm -rf $(PKG_BUILD_DIR)
- mkdir -p $(PKG_BUILD_DIR)
- tar xzvf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR)/
- $(Build/Patch)
-endef
-
-define Build/Compile/Subdir
- $(MAKE) -C "$(LINUX_DIR)" \
- KSRC="$(LINUX_DIR)" \
- KOBJ="$(LINUX_DIR)" \
- ENV_DIR=$(PKG_BUILD_DIR)/Embedded \
- SUBDIRS="$(PKG_BUILD_DIR)/Embedded/src/$(1)" \
- CROSS_COMPILE="$(TARGET_CROSS)" \
- ARCHIVER="$(TARGET_CROSS)ar" \
- COMPILER="$(TARGET_CC)" \
- LINKER="$(TARGET_CROSS)ld" \
- ARCH="$(LINUX_KARCH)"
-endef
-
-define Build/Compile
- $(call Build/Compile/Subdir,GbE)
- $(call Build/Compile/Subdir,CAN)
- $(call Build/Compile/Subdir,EDMA)
- $(call Build/Compile/Subdir,GPIO)
- $(call Build/Compile/Subdir,WDT)
- $(call Build/Compile/Subdir,1588)
-endef
-
-define KernelPackage/ep80579-eth/install
-endef
-
-$(eval $(call KernelPackage,ep80579-can))
-$(eval $(call KernelPackage,ep80579-eth))
-$(eval $(call KernelPackage,ep80579-misc))
-
+++ /dev/null
---- a/Embedded/src/GbE/gcu.h
-+++ b/Embedded/src/GbE/gcu.h
-@@ -2,7 +2,7 @@
-
- GPL LICENSE SUMMARY
-
-- Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
-+ Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of version 2 of the GNU General Public License as
-@@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
- Contact Information:
- Intel Corporation
-
-- version: Embedded.L.1.0.34
-+ version: Embedded.Release.Patch.L.1.0.7-5
-
- Contact Information:
-
---- a/Embedded/src/GbE/gcu_if.c
-+++ b/Embedded/src/GbE/gcu_if.c
-@@ -2,7 +2,7 @@
-
- GPL LICENSE SUMMARY
-
-- Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
-+ Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of version 2 of the GNU General Public License as
-@@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
- Contact Information:
- Intel Corporation
-
-- version: Embedded.L.1.0.34
-+ version: Embedded.Release.Patch.L.1.0.7-5
-
- Contact Information:
-
-@@ -330,10 +330,17 @@ gcu_write_verify(uint32_t phy_num, uint3
- */
- void gcu_iegbe_resume(struct pci_dev *pdev)
- {
-+#if ( ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,6) ) && \
-+ ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) ) )
-+ struct net_device *netdev = pci_get_drvdata(pdev);
-+ struct gcu_adapter *adapter = netdev_priv(netdev);
-+#endif
-+
- GCU_DBG("%s\n", __func__);
-
- pci_restore_state(pdev);
-- pci_enable_device(pdev);
-+ if(!pci_enable_device(pdev))
-+ GCU_DBG("pci_enable_device failed!\n",);
-
- return;
- }
-@@ -348,6 +355,12 @@ EXPORT_SYMBOL(gcu_iegbe_resume);
- */
- int gcu_iegbe_suspend(struct pci_dev *pdev, uint32_t state)
- {
-+#if ( ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,6) ) && \
-+ ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) ) )
-+ struct net_device *netdev = pci_get_drvdata(pdev);
-+ struct gcu_adapter *adapter = netdev_priv(netdev);
-+#endif
-+
- GCU_DBG("%s\n", __func__);
-
- pci_save_state(pdev);
---- a/Embedded/src/GbE/gcu_if.h
-+++ b/Embedded/src/GbE/gcu_if.h
-@@ -2,7 +2,7 @@
-
- GPL LICENSE SUMMARY
-
-- Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
-+ Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of version 2 of the GNU General Public License as
-@@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
- Contact Information:
- Intel Corporation
-
-- version: Embedded.L.1.0.34
-+ version: Embedded.Release.Patch.L.1.0.7-5
-
- Contact Information:
-
---- a/Embedded/src/GbE/gcu_main.c
-+++ b/Embedded/src/GbE/gcu_main.c
-@@ -2,7 +2,7 @@
-
- GPL LICENSE SUMMARY
-
-- Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
-+ Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of version 2 of the GNU General Public License as
-@@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
- Contact Information:
- Intel Corporation
-
-- version: Embedded.L.1.0.34
-+ version: Embedded.Release.Patch.L.1.0.7-5
-
- Contact Information:
-
-@@ -94,6 +94,7 @@ static struct pci_driver gcu_driver = {
-
- static struct gcu_adapter *global_adapter = 0;
- static spinlock_t global_adapter_spinlock = SPIN_LOCK_UNLOCKED;
-+static unsigned long g_intflags = 0;
-
- MODULE_AUTHOR("Intel(R) Corporation");
- MODULE_DESCRIPTION("Global Configuration Unit Driver");
-@@ -124,7 +125,7 @@ gcu_init_module(void)
-
- printk(KERN_INFO "%s\n", gcu_copyright);
-
-- ret = pci_module_init(&gcu_driver);
-+ ret = pci_register_driver(&gcu_driver);
- if(ret >= 0) {
- register_reboot_notifier(&gcu_notifier_reboot);
- }
-@@ -199,8 +200,6 @@ gcu_probe(struct pci_dev *pdev,
- return -ENOMEM;
- }
-
-- SET_MODULE_OWNER(adapter);
--
- pci_set_drvdata(pdev, adapter);
-
- adapter->pdev = pdev;
-@@ -238,7 +237,6 @@ gcu_probe(struct pci_dev *pdev,
- return 0;
- }
-
--
- /**
- * gcu_probe_err - gcu_probe error handler
- * @err: gcu_err_type
-@@ -295,7 +293,7 @@ gcu_notify_reboot(struct notifier_block
- case SYS_DOWN:
- case SYS_HALT:
- case SYS_POWER_OFF:
-- while((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
-+ while((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
- if(pci_dev_driver(pdev) == &gcu_driver){
- gcu_suspend(pdev, 0x3);
- }
-@@ -318,6 +316,11 @@ static int
- gcu_suspend(struct pci_dev *pdev, uint32_t state)
- {
- /*struct gcu_adapter *adapter = pci_get_drvdata(pdev); */
-+#if ( ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,6) ) && \
-+ ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) ) )
-+ struct net_device *netdev = pci_get_drvdata(pdev);
-+ struct gcu_adapter *adapter = netdev_priv(netdev);
-+#endif
-
- GCU_DBG("%s\n", __func__);
-
-@@ -338,7 +341,6 @@ gcu_suspend(struct pci_dev *pdev, uint32
- return state;
- }
-
--
- /**
- * alloc_gcu_adapter
- *
-@@ -412,7 +414,7 @@ gcu_get_adapter(void)
- return NULL;
- }
-
-- spin_lock(&global_adapter_spinlock);
-+ spin_lock_irqsave(&global_adapter_spinlock, g_intflags);
-
- return global_adapter;
- }
-@@ -437,7 +439,7 @@ gcu_release_adapter(const struct gcu_ada
- *adapter = 0;
- }
-
-- spin_unlock(&global_adapter_spinlock);
-+ spin_unlock_irqrestore(&global_adapter_spinlock, g_intflags);
-
- return;
- }
---- a/Embedded/src/GbE/gcu_reg.h
-+++ b/Embedded/src/GbE/gcu_reg.h
-@@ -2,7 +2,7 @@
-
- GPL LICENSE SUMMARY
-
-- Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
-+ Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of version 2 of the GNU General Public License as
-@@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
- Contact Information:
- Intel Corporation
-
-- version: Embedded.L.1.0.34
-+ version: Embedded.Release.Patch.L.1.0.7-5
-
- Contact Information:
-
---- a/Embedded/src/GbE/iegbe.7
-+++ b/Embedded/src/GbE/iegbe.7
-@@ -1,7 +1,7 @@
-
- .\" GPL LICENSE SUMMARY
- .\"
--.\" Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
-+.\" Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
- .\"
- .\" This program is free software; you can redistribute it and/or modify
- .\" it under the terms of version 2 of the GNU General Public License as
-@@ -21,7 +21,7 @@
- .\" Contact Information:
- .\" Intel Corporation
- .\"
--.\" version: Embedded.L.1.0.34
-+.\" version: Embedded.Release.Patch.L.1.0.7-5
-
- .\" LICENSE
- .\"
---- a/Embedded/src/GbE/iegbe_ethtool.c
-+++ b/Embedded/src/GbE/iegbe_ethtool.c
-@@ -2,7 +2,7 @@
-
- GPL LICENSE SUMMARY
-
-- Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
-+ Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of version 2 of the GNU General Public License as
-@@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
- Contact Information:
- Intel Corporation
-
-- version: Embedded.L.1.0.34
-+ version: Embedded.Release.Patch.L.1.0.7-5
-
- Contact Information:
-
-@@ -132,22 +132,6 @@ static const struct iegbe_stats iegbe_gs
- { "cpp_master", E1000_STAT(icr_cpp_master) },
- { "stat", E1000_STAT(icr_stat) },
- #endif
--#ifdef IEGBE_GBE_WORKAROUND
-- { "txqec", E1000_STAT(stats.txqec) },
-- { "tx_next_to_clean", E1000_STAT(stats.tx_next_to_clean) },
-- { "tx_next_to_use", E1000_STAT(stats.tx_next_to_use) },
-- { "num_tx_queues", E1000_STAT(stats.num_tx_queues) },
--
-- { "num_rx_buf_alloc", E1000_STAT(stats.num_rx_buf_alloc) },
-- { "rx_next_to_clean", E1000_STAT(stats.rx_next_to_clean) },
-- { "rx_next_to_use", E1000_STAT(stats.rx_next_to_use) },
-- { "cc_gt_num_rx", E1000_STAT(stats.cc_gt_num_rx) },
-- { "tx_hnet", E1000_STAT(stats.tx_hnet) },
-- { "tx_hnentu", E1000_STAT(stats.tx_hnentu) },
-- { "RUC", E1000_STAT(stats.ruc) },
-- { "RFC", E1000_STAT(stats.rfc) },
--
--#endif
- };
- #define E1000_STATS_LEN \
- sizeof(iegbe_gstrings_stats) / sizeof(struct iegbe_stats)
-@@ -158,7 +142,7 @@ static const char iegbe_gstrings_test[][
- "Interrupt test (offline)", "Loopback test (offline)",
- "Link test (on/offline)"
- };
--#define E1000_TEST_LEN (sizeof(iegbe_gstrings_test) / (ETH_GSTRING_LEN))
-+#define E1000_TEST_LEN (sizeof(iegbe_gstrings_test) / ETH_GSTRING_LEN)
- #endif /* ETHTOOL_TEST */
-
- #define E1000_REGS_LEN 0x20
-@@ -176,9 +160,7 @@ iegbe_get_settings(struct net_device *ne
- SUPPORTED_10baseT_Full |
- SUPPORTED_100baseT_Half |
- SUPPORTED_100baseT_Full |
--#ifndef IEGBE_10_100_ONLY
- SUPPORTED_1000baseT_Full|
--#endif
- SUPPORTED_Autoneg |
- SUPPORTED_TP);
-
-@@ -259,21 +241,13 @@ iegbe_set_settings(struct net_device *ne
- ADVERTISED_10baseT_Full |
- ADVERTISED_100baseT_Half |
- ADVERTISED_100baseT_Full |
--#ifndef IEGBE_10_100_ONLY
- ADVERTISED_1000baseT_Full|
--#endif
--
- ADVERTISED_Autoneg |
- ADVERTISED_TP;
- ecmd->advertising = hw->autoneg_advertised;
- }
-- } else {
-- uint16_t duplex;
--
-- // ethtool uses DUPLEX_FULL/DUPLEX_HALF
-- // the driver needs FULL_DUPLEX/HALF_DUPLEX
-- duplex = (ecmd->duplex == DUPLEX_FULL) ? FULL_DUPLEX : HALF_DUPLEX;
-- if(iegbe_set_spd_dplx(adapter, ecmd->speed + duplex))
-+ } else
-+ if(iegbe_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)){
- return -EINVAL;
- }
- /* reset the link */
-@@ -728,8 +702,8 @@ iegbe_set_ringparam(struct net_device *n
- struct iegbe_rx_ring *rxdr, *rx_old, *rx_new;
- int i, err, tx_ring_size, rx_ring_size;
-
-- tx_ring_size = sizeof(struct iegbe_tx_ring) * adapter->num_queues;
-- rx_ring_size = sizeof(struct iegbe_rx_ring) * adapter->num_queues;
-+ tx_ring_size = sizeof(struct iegbe_tx_ring) * adapter->num_tx_queues;
-+ rx_ring_size = sizeof(struct iegbe_rx_ring) * adapter->num_rx_queues;
-
- if (netif_running(adapter->netdev)){
- iegbe_down(adapter);
-@@ -768,10 +742,10 @@ iegbe_set_ringparam(struct net_device *n
- E1000_MAX_TXD : E1000_MAX_82544_TXD));
- E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE);
-
-- for (i = 0; i < adapter->num_queues; i++) {
-- txdr[i].count = txdr->count;
-- rxdr[i].count = rxdr->count;
-- }
-+ for (i = 0; i < adapter->num_tx_queues; i++)
-+ txdr[i].count = txdr->count;
-+ for (i = 0; i < adapter->num_rx_queues; i++)
-+ rxdr[i].count = rxdr->count;
-
- if(netif_running(adapter->netdev)) {
- /* Try to get new resources before deleting old */
-@@ -950,8 +924,7 @@ iegbe_eeprom_test(struct iegbe_adapter *
-
- static irqreturn_t
- iegbe_test_intr(int irq,
-- void *data,
-- struct pt_regs *regs)
-+ void *data)
- {
- struct net_device *netdev = (struct net_device *) data;
- struct iegbe_adapter *adapter = netdev_priv(netdev);
-@@ -973,7 +946,7 @@ iegbe_intr_test(struct iegbe_adapter *ad
- /* Hook up test interrupt handler just for this test */
- if(!request_irq(irq, &iegbe_test_intr, 0, netdev->name, netdev)) {
- shared_int = FALSE;
-- } else if(request_irq(irq, &iegbe_test_intr, SA_SHIRQ,
-+ } else if(request_irq(irq, &iegbe_test_intr, IRQF_SHARED,
- netdev->name, netdev)){
- *data = 1;
- return -1;
-@@ -1393,7 +1366,7 @@ iegbe_set_phy_loopback(struct iegbe_adap
- * attempt this 10 times.
- */
- while(iegbe_nonintegrated_phy_loopback(adapter) &&
-- count++ < 0xa) { };
-+ count++ < 0xa);
- if(count < 0xb) {
- return 0;
- }
---- a/Embedded/src/GbE/iegbe.h
-+++ b/Embedded/src/GbE/iegbe.h
-@@ -1,7 +1,7 @@
- /*******************************************************************************
- GPL LICENSE SUMMARY
-
-- Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
-+ Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of version 2 of the GNU General Public License as
-@@ -21,7 +21,7 @@ GPL LICENSE SUMMARY
- Contact Information:
- Intel Corporation
-
-- version: Embedded.L.1.0.34
-+ version: Embedded.Release.Patch.L.1.0.7-5
-
- Contact Information:
-
-@@ -127,9 +127,12 @@ struct iegbe_adapter;
- #define E1000_MIN_RXD 80
- #define E1000_MAX_82544_RXD 4096
-
-+#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
- /* Supported Rx Buffer Sizes */
- #define E1000_RXBUFFER_128 128 /* Used for packet split */
- #define E1000_RXBUFFER_256 256 /* Used for packet split */
-+#define E1000_RXBUFFER_512 512
-+#define E1000_RXBUFFER_1024 1024
- #define E1000_RXBUFFER_2048 2048
- #define E1000_RXBUFFER_4096 4096
- #define E1000_RXBUFFER_8192 8192
-@@ -164,11 +167,9 @@ struct iegbe_adapter;
- #define E1000_MASTER_SLAVE iegbe_ms_hw_default
- #endif
-
--#ifdef NETIF_F_HW_VLAN_TX
--#define E1000_MNG_VLAN_NONE -1
--#endif
-+#define E1000_MNG_VLAN_NONE (-1)
- /* Number of packet split data buffers (not including the header buffer) */
--#define PS_PAGE_BUFFERS MAX_PS_BUFFERS-1
-+#define PS_PAGE_BUFFERS (MAX_PS_BUFFERS - 1)
-
- /* only works for sizes that are powers of 2 */
- #define E1000_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1)))
-@@ -206,6 +207,7 @@ struct iegbe_tx_ring {
- spinlock_t tx_lock;
- uint16_t tdh;
- uint16_t tdt;
-+ boolean_t last_tx_tso;
- uint64_t pkt;
- };
-
-@@ -228,6 +230,9 @@ struct iegbe_rx_ring {
- struct iegbe_ps_page *ps_page;
- struct iegbe_ps_page_dma *ps_page_dma;
-
-+ /* cpu for rx queue */
-+ int cpu;
-+
- uint16_t rdh;
- uint16_t rdt;
- uint64_t pkt;
-@@ -252,10 +257,8 @@ struct iegbe_adapter {
- struct timer_list tx_fifo_stall_timer;
- struct timer_list watchdog_timer;
- struct timer_list phy_info_timer;
--#ifdef NETIF_F_HW_VLAN_TX
- struct vlan_group *vlgrp;
- uint16_t mng_vlan_id;
--#endif
- uint32_t bd_number;
- uint32_t rx_buffer_len;
- uint32_t part_num;
-@@ -265,8 +268,18 @@ struct iegbe_adapter {
- uint16_t link_speed;
- uint16_t link_duplex;
- spinlock_t stats_lock;
-- atomic_t irq_sem;
-- struct work_struct tx_timeout_task;
-+ spinlock_t tx_queue_lock;
-+ unsigned int total_tx_bytes;
-+ unsigned int total_tx_packets;
-+ unsigned int total_rx_bytes;
-+ unsigned int total_rx_packets;
-+ /* Interrupt Throttle Rate */
-+ uint32_t itr;
-+ uint32_t itr_setting;
-+ uint16_t tx_itr;
-+ uint16_t rx_itr;
-+
-+ struct work_struct reset_task;
- uint8_t fc_autoneg;
-
- #ifdef ETHTOOL_PHYS_ID
-@@ -276,9 +289,8 @@ struct iegbe_adapter {
-
- /* TX */
- struct iegbe_tx_ring *tx_ring; /* One per active queue */
--#ifdef CONFIG_E1000_MQ
-- struct iegbe_tx_ring **cpu_tx_ring; /* per-cpu */
--#endif
-+ unsigned int restart_queue;
-+ unsigned long tx_queue_len;
- uint32_t txd_cmd;
- uint32_t tx_int_delay;
- uint32_t tx_abs_int_delay;
-@@ -286,46 +298,33 @@ struct iegbe_adapter {
- uint64_t gotcl_old;
- uint64_t tpt_old;
- uint64_t colc_old;
-+ uint32_t tx_timeout_count;
- uint32_t tx_fifo_head;
- uint32_t tx_head_addr;
- uint32_t tx_fifo_size;
-+ uint8_t tx_timeout_factor;
- atomic_t tx_fifo_stall;
- boolean_t pcix_82544;
- boolean_t detect_tx_hung;
-
- /* RX */
--#ifdef CONFIG_E1000_NAPI
-- boolean_t (*clean_rx) (struct iegbe_adapter *adapter,
-+ bool (*clean_rx)(struct iegbe_adapter *adapter,
- struct iegbe_rx_ring *rx_ring,
- int *work_done, int work_to_do);
--#else
-- boolean_t (*clean_rx) (struct iegbe_adapter *adapter,
-- struct iegbe_rx_ring *rx_ring);
--#endif
--
--#ifdef IEGBE_GBE_WORKAROUND
- void (*alloc_rx_buf) (struct iegbe_adapter *adapter,
-- struct iegbe_rx_ring *rx_ring,
-- int cleaned_count);
--#else
-- void (*alloc_rx_buf) (struct iegbe_adapter *adapter,
-- struct iegbe_rx_ring *rx_ring);
--#endif
--
-+ struct iegbe_rx_ring *rx_ring,
-+ int cleaned_count);
- struct iegbe_rx_ring *rx_ring; /* One per active queue */
--#ifdef CONFIG_E1000_NAPI
-+ struct napi_struct napi;
- struct net_device *polling_netdev; /* One per active queue */
--#endif
--#ifdef CONFIG_E1000_MQ
-- struct net_device **cpu_netdev; /* per-cpu */
-- struct call_async_data_struct rx_sched_call_data;
-- int cpu_for_queue[4];
--#endif
-- int num_queues;
-+
-+ int num_tx_queues;
-+ int num_rx_queues;
-
- uint64_t hw_csum_err;
- uint64_t hw_csum_good;
- uint64_t rx_hdr_split;
-+ uint32_t alloc_rx_buff_failed;
- uint32_t rx_int_delay;
- uint32_t rx_abs_int_delay;
- boolean_t rx_csum;
-@@ -334,8 +333,6 @@ struct iegbe_adapter {
- uint64_t gorcl_old;
- uint16_t rx_ps_bsize0;
-
-- /* Interrupt Throttle Rate */
-- uint32_t itr;
-
- /* OS defined structs */
- struct net_device *netdev;
-@@ -378,7 +375,21 @@ struct iegbe_adapter {
- #ifdef CONFIG_PCI_MSI
- boolean_t have_msi;
- #endif
--#define IEGBE_INTD_DISABLE 0x0400
-+ /* to not mess up cache alignment, always add to the bottom */
-+ boolean_t tso_force;
-+ boolean_t smart_power_down; /* phy smart power down */
-+ boolean_t quad_port_a;
-+ unsigned long flags;
-+ uint32_t eeprom_wol;
-+ int bars;
-+ int need_ioport;
- };
-+
-+enum iegbe_state_t {
-+ __E1000_TESTING,
-+ __E1000_RESETTING,
-+ __E1000_DOWN
-+};
-+#define IEGBE_INTD_DISABLE 0x0400
- #endif /* _IEGBE_H_ */
-
---- a/Embedded/src/GbE/iegbe_hw.c
-+++ b/Embedded/src/GbE/iegbe_hw.c
-@@ -2,7 +2,7 @@
-
- GPL LICENSE SUMMARY
-
-- Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
-+ Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of version 2 of the GNU General Public License as
-@@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
- Contact Information:
- Intel Corporation
-
-- version: Embedded.L.1.0.34
-+ version: Embedded.Release.Patch.L.1.0.7-5
-
- Contact Information:
-
-@@ -2115,7 +2115,7 @@ iegbe_config_mac_to_phy(struct iegbe_hw
-
- ret_val = iegbe_oem_set_trans_gasket(hw);
- if(ret_val){
-- return ret_val;
-+ return ret_val;
- }
- ret_val = iegbe_oem_phy_is_full_duplex(
- hw, (int *) &is_FullDuplex);
-@@ -2164,7 +2164,7 @@ iegbe_config_mac_to_phy(struct iegbe_hw
- }
- /* Write the configured values back to the Device Control Reg. */
- E1000_WRITE_REG(hw, CTRL, ctrl);
-- return E1000_SUCCESS;
-+ return ret_val;
- }
-
- /*****************************************************************************
-@@ -2684,7 +2684,7 @@ iegbe_check_for_link(struct iegbe_hw *hw
-
- if(hw->autoneg_failed == 0) {
- hw->autoneg_failed = 1;
-- return 0;
-+ return E1000_SUCCESS;
- }
- DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\r\n");
-
-@@ -5875,7 +5875,7 @@ iegbe_get_cable_length(struct iegbe_hw *
- max_agc = cur_agc;
- }
- }
--
-+
- /* This is to fix a Klockwork defect, that the array index might
- * be out of bounds. 113 is table size */
- if (cur_agc < 0x71){
---- a/Embedded/src/GbE/iegbe_hw.h
-+++ b/Embedded/src/GbE/iegbe_hw.h
-@@ -2,7 +2,7 @@
-
- GPL LICENSE SUMMARY
-
-- Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
-+ Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of version 2 of the GNU General Public License as
-@@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
- Contact Information:
- Intel Corporation
-
-- version: Embedded.L.1.0.34
-+ version: Embedded.Release.Patch.L.1.0.7-5
-
- Contact Information:
-
-@@ -299,7 +299,7 @@ void iegbe_set_media_type(struct iegbe_h
- /* Link Configuration */
- int32_t iegbe_setup_link(struct iegbe_hw *hw);
- int32_t iegbe_phy_setup_autoneg(struct iegbe_hw *hw);
--void iegbe_config_collision_dist(struct iegbe_hw *hw);
-+void iegbe_config_collision_dist(struct iegbe_hw *hw);
- int32_t iegbe_config_fc_after_link_up(struct iegbe_hw *hw);
- int32_t iegbe_check_for_link(struct iegbe_hw *hw);
- int32_t iegbe_get_speed_and_duplex(struct iegbe_hw *hw, uint16_t * speed, uint16_t * duplex);
-@@ -588,14 +588,6 @@ uint8_t iegbe_arc_subsystem_valid(struct
- * o LSC = Link Status Change
- */
-
--#ifdef IEGBE_GBE_WORKAROUND
--#define IMS_ENABLE_MASK ( \
-- E1000_IMS_RXT0 | \
-- E1000_IMS_TXQE | \
-- E1000_IMS_RXDMT0 | \
-- E1000_IMS_RXSEQ | \
-- E1000_IMS_LSC)
--#else
- #define IMS_ENABLE_MASK ( \
- E1000_IMS_RXT0 | \
- E1000_IMS_TXDW | \
-@@ -606,8 +598,7 @@ uint8_t iegbe_arc_subsystem_valid(struct
- E1000_ICR_PB | \
- E1000_ICR_CPP_TARGET | \
- E1000_ICR_CPP_MASTER | \
-- E1000_IMS_LSC)
--#endif
-+ E1000_ICR_LSC)
-
- /* Number of high/low register pairs in the RAR. The RAR (Receive Address
- * Registers) holds the directed and multicast addresses that we monitor. We
-@@ -923,10 +914,15 @@ struct iegbe_ffvt_entry {
- #define E1000_ICS 0x000C8 /* Interrupt Cause Set - WO */
- #define E1000_IMS 0x000D0 /* Interrupt Mask Set - RW */
- #define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */
--// Register conflict, does not exist for ICP_xxxx hardware
--// #define E1000_IAM 0x000E0 /* Interrupt Acknowledge Auto Mask */
- #define E1000_CTRL_AUX 0x000E0 /* Aux Control -RW */
-+#define E1000_IAM 0x000E0 /* Interrupt Acknowledge Auto Mask */
- #define E1000_RCTL 0x00100 /* RX Control - RW */
-+#define E1000_RDTR1 0x02820 /* RX Delay Timer (1) - RW */
-+#define E1000_RDBAL1 0x02900 /* RX Descriptor Base Address Low (1) - RW */
-+#define E1000_RDBAH1 0x02904 /* RX Descriptor Base Address High (1) - RW */
-+#define E1000_RDLEN1 0x02908 /* RX Descriptor Length (1) - RW */
-+#define E1000_RDH1 0x02910 /* RX Descriptor Head (1) - RW */
-+#define E1000_RDT1 0x02918 /* RX Descriptor Tail (1) - RW */
- #define E1000_FCTTV 0x00170 /* Flow Control Transmit Timer Value - RW */
- #define E1000_TXCW 0x00178 /* TX Configuration Word - RW */
- #define E1000_RXCW 0x00180 /* RX Configuration Word - RO */
-@@ -1282,8 +1278,6 @@ struct iegbe_ffvt_entry {
- #define E1000_82542_FFMT E1000_FFMT
- #define E1000_82542_FFVT E1000_FFVT
- #define E1000_82542_HOST_IF E1000_HOST_IF
--// Register conflict with ICP_xxxx hardware, no IAM
--// #define E1000_82542_IAM E1000_IAM
- #define E1000_82542_EEMNGCTL E1000_EEMNGCTL
- #define E1000_82542_PSRCTL E1000_PSRCTL
- #define E1000_82542_RAID E1000_RAID
-@@ -1329,6 +1323,7 @@ struct iegbe_hw_stats {
- uint64_t algnerrc;
- uint64_t symerrs;
- uint64_t rxerrc;
-+ uint64_t txerrc;
- uint64_t mpc;
- uint64_t scc;
- uint64_t ecol;
-@@ -1363,6 +1358,7 @@ struct iegbe_hw_stats {
- uint64_t ruc;
- uint64_t rfc;
- uint64_t roc;
-+ uint64_t rlerrc;
- uint64_t rjc;
- uint64_t mgprc;
- uint64_t mgpdc;
-@@ -1392,19 +1388,6 @@ struct iegbe_hw_stats {
- uint64_t ictxqmtc;
- uint64_t icrxdmtc;
- uint64_t icrxoc;
--#ifdef IEGBE_GBE_WORKAROUND
-- u64 txqec;
-- u64 tx_next_to_clean;
-- u64 tx_next_to_use;
-- u64 cc_gt_num_rx;
-- u64 tx_hnet;
-- u64 tx_hnentu;
-- u64 num_tx_queues;
--
-- u64 num_rx_buf_alloc;
-- u64 rx_next_to_clean;
-- u64 rx_next_to_use;
--#endif
- };
-
- /* Structure containing variables used by the shared code (iegbe_hw.c) */
-@@ -1484,6 +1467,7 @@ struct iegbe_hw {
- boolean_t ifs_params_forced;
- boolean_t in_ifs_mode;
- boolean_t mng_reg_access_disabled;
-+ boolean_t rx_needs_kicking;
- boolean_t icp_xxxx_is_link_up;
- };
-
-@@ -2358,17 +2342,23 @@ struct iegbe_host_command_info {
- #define E1000_EXTCNF_SIZE_EXT_PHY_LENGTH 0x000000FF
- #define E1000_EXTCNF_SIZE_EXT_DOCK_LENGTH 0x0000FF00
- #define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH 0x00FF0000
-+#define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE 0x00000001
-+#define E1000_EXTCNF_CTRL_SWFLAG 0x00000020
-
- /* PBA constants */
-+#define E1000_PBA_8K 0x0008 /* 8KB, default Rx allocation */
- #define E1000_PBA_12K 0x000C /* 12KB, default Rx allocation */
- #define E1000_PBA_16K 0x0010 /* 16KB, default TX allocation */
-+#define E1000_PBA_20K 0x0014
- #define E1000_PBA_22K 0x0016
- #define E1000_PBA_24K 0x0018
- #define E1000_PBA_30K 0x001E
- #define E1000_PBA_32K 0x0020
-+#define E1000_PBA_34K 0x0022
- #define E1000_PBA_38K 0x0026
- #define E1000_PBA_40K 0x0028
- #define E1000_PBA_48K 0x0030 /* 48KB, default RX allocation */
-+#define E1000_PBS_16K E1000_PBA_16K
-
- /* Flow Control Constants */
- #define FLOW_CONTROL_ADDRESS_LOW 0x00C28001
-@@ -2899,7 +2889,7 @@ struct iegbe_host_command_info {
- #define M88E1000_14_PHY_ID M88E1000_E_PHY_ID
- #define M88E1011_I_REV_4 0x04
- #define M88E1111_I_PHY_ID 0x01410CC2
--#define M88E1141_E_PHY_ID 0x01410CD4
-+#define M88E1141_E_PHY_ID 0x01410CD0
- #define L1LXT971A_PHY_ID 0x001378E0
-
- /* Miscellaneous PHY bit definitions. */
---- a/Embedded/src/GbE/iegbe_main.c
-+++ b/Embedded/src/GbE/iegbe_main.c
-@@ -2,7 +2,7 @@
-
- GPL LICENSE SUMMARY
-
-- Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
-+ Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of version 2 of the GNU General Public License as
-@@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
- Contact Information:
- Intel Corporation
-
-- version: Embedded.L.1.0.34
-+ version: Embedded.Release.Patch.L.1.0.7-5
-
- Contact Information:
-
-@@ -42,103 +42,15 @@ GPL LICENSE SUMMARY
-
- #include "iegbe.h"
- #include "gcu_if.h"
--
--/* Change Log
-- * 6.0.58 4/20/05
-- * o iegbe_set_spd_dplx tests for compatible speed/duplex specification
-- * for fiber adapters
-- * 6.0.57 4/19/05
-- * o Added code to fix register test failure for devices >= 82571
-- *
-- * 6.0.52 3/15/05
-- * o Added stats_lock around iegbe_read_phy_reg commands to avoid concurrent
-- * calls, one from mii_ioctl and other from within update_stats while
-- * processing MIIREG ioctl.
-- *
-- * 6.1.2 4/13/05
-- * o Fixed ethtool diagnostics
-- * o Enabled flow control to take default eeprom settings
-- * o Added stats_lock around iegbe_read_phy_reg commands to avoid concurrent
-- * calls, one from mii_ioctl and other from within update_stats while processing
-- * MIIREG ioctl.
-- * 6.0.55 3/23/05
-- * o Support for MODULE_VERSION
-- * o Fix APM setting for 82544 based adapters
-- * 6.0.54 3/26/05
-- * o Added a timer to expire packets that were deferred for cleanup
-- * 6.0.52 3/15/05
-- * o Added stats_lock around iegbe_read_phy_reg commands to avoid concurrent
-- * calls, one from mii_ioctl and other from within update_stats while
-- * processing MIIREG ioctl.
-- * 6.0.47 3/2/05
-- * o Added enhanced functionality to the loopback diags to wrap the
-- * descriptor rings
-- * o Added manageability vlan filtering workaround.
-- *
-- * 6.0.44+ 2/15/05
-- * o Added code to handle raw packet based DHCP packets
-- * o Added code to fix the errata 10 buffer overflow issue
-- * o Sync up with WR01-05
-- * o applied Anton's patch to resolve tx hang in hardware
-- * o iegbe timeouts with early writeback patch
-- * o Removed Queensport IDs
-- * o fixed driver panic if MAC receives a bad large packets when packet
-- * split is enabled
-- * o Applied Andrew Mortons patch - iegbe stops working after resume
-- * 5.2.29 12/24/03
-- * o Bug fix: Endianess issue causing ethtool diags to fail on ppc.
-- * o Bug fix: Use pdev->irq instead of netdev->irq for MSI support.
-- * o Report driver message on user override of InterruptThrottleRate module
-- * parameter.
-- * o Bug fix: Change I/O address storage from uint32_t to unsigned long.
-- * o Feature: Added ethtool RINGPARAM support.
-- * o Feature: Added netpoll support.
-- * o Bug fix: Race between Tx queue and Tx clean fixed with a spin lock.
-- * o Bug fix: Allow 1000/Full setting for autoneg param for fiber connections.
-- * Jon D Mason [jonmason@us.ibm.com].
-- *
-- * 5.2.22 10/15/03
-- * o Bug fix: SERDES devices might be connected to a back-plane switch that
-- * doesn't support auto-neg, so add the capability to force 1000/Full.
-- * Also, since forcing 1000/Full, sample RxSynchronize bit to detect link
-- * state.
-- * o Bug fix: Flow control settings for hi/lo watermark didn't consider
-- * changes in the RX FIFO size, which could occur with Jumbo Frames or with
-- * the reduced FIFO in 82547.
-- * o Bug fix: Better propagation of error codes.
-- * [Janice Girouard (janiceg -a-t- us.ibm.com)]
-- * o Bug fix: hang under heavy Tx stress when running out of Tx descriptors;
-- * wasn't clearing context descriptor when backing out of send because of
-- * no-resource condition.
-- * o Bug fix: check netif_running in dev->poll so we don't have to hang in
-- * dev->close until all polls are finished. [Rober Olsson
-- * (robert.olsson@data.slu.se)].
-- * o Revert TxDescriptor ring size back to 256 since change to 1024 wasn't
-- * accepted into the kernel.
-- *
-- * 5.2.16 8/8/03
-- */
--
--#ifdef IEGBE_GBE_WORKAROUND
--#define IEGBE_GBE_WORKAROUND_NUM_RX_DESCRIPTORS 1
--#endif
-+#include <linux/ipv6.h>
-+#include <net/ip6_checksum.h>
-
- char iegbe_driver_name[] = "iegbe";
- char iegbe_driver_string[] = "Gigabit Ethernet Controller Driver";
--#ifndef CONFIG_E1000_NAPI
--#define DRIVERNAPI
--#else
--#define DRIVERNAPI "-NAPI"
--#endif
--#define DRV_VERSION "0.8.0"DRIVERNAPI
-+#define DRV_VERSION "1.0.0-K28-NAPI"
- char iegbe_driver_version[] = DRV_VERSION;
--char iegbe_copyright[] = "Copyright (c) 1999-2007 Intel Corporation.";
-+char iegbe_copyright[] = "Copyright (c) 1999-2009 Intel Corporation.";
-
--#define E1000_FIFO_HDR 0x10
--#define E1000_82547_PAD_LEN 0x3E0
--#define MINIMUM_DHCP_PACKET_SIZE 282
--#define TXD_USE_COUNT(S, X) (((S) >> (X)) + 1 )
--#define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000
-
- /* iegbe_pci_tbl - PCI Device ID Table
- *
-@@ -148,95 +60,48 @@ char iegbe_copyright[] = "Copyright (c)
- * {PCI_DEVICE(PCI_VENDOR_ID_INTEL, device_id)}
- */
- static struct pci_device_id iegbe_pci_tbl[] = {
--/* INTEL_E1000_ETHERNET_DEVICE(0x1000), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1001), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1004), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1008), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1009), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x100C), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x100D), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x100E), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x100F), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1010), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1011), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1012), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1013), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1014), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1015), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1016), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1017), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1018), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1019), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x101A), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x101D), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x101E), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1026), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1027), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1028), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x105E), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x105F), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1060), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1075), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1076), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1077), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1078), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x1079), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x107A), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x107B), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x107C), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x107D), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x107E), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x107F), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x108A), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x108B), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x108C), */
--/* INTEL_E1000_ETHERNET_DEVICE(0x109A), */
-- INTEL_E1000_ETHERNET_DEVICE(0x5040),
-- INTEL_E1000_ETHERNET_DEVICE(0x5041),
-- INTEL_E1000_ETHERNET_DEVICE(0x5042),
-- INTEL_E1000_ETHERNET_DEVICE(0x5043),
-- INTEL_E1000_ETHERNET_DEVICE(0x5044),
-- INTEL_E1000_ETHERNET_DEVICE(0x5045),
-- INTEL_E1000_ETHERNET_DEVICE(0x5046),
-- INTEL_E1000_ETHERNET_DEVICE(0x5047),
-- INTEL_E1000_ETHERNET_DEVICE(0x5048),
-- INTEL_E1000_ETHERNET_DEVICE(0x5049),
-- INTEL_E1000_ETHERNET_DEVICE(0x504A),
-- INTEL_E1000_ETHERNET_DEVICE(0x504B),
-- /* required last entry */
-+ INTEL_E1000_ETHERNET_DEVICE(0x5040),
-+ INTEL_E1000_ETHERNET_DEVICE(0x5041),
-+ INTEL_E1000_ETHERNET_DEVICE(0x5042),
-+ INTEL_E1000_ETHERNET_DEVICE(0x5043),
-+ INTEL_E1000_ETHERNET_DEVICE(0x5044),
-+ INTEL_E1000_ETHERNET_DEVICE(0x5045),
-+ INTEL_E1000_ETHERNET_DEVICE(0x5046),
-+ INTEL_E1000_ETHERNET_DEVICE(0x5047),
-+ INTEL_E1000_ETHERNET_DEVICE(0x5048),
-+ INTEL_E1000_ETHERNET_DEVICE(0x5049),
-+ INTEL_E1000_ETHERNET_DEVICE(0x504A),
-+ INTEL_E1000_ETHERNET_DEVICE(0x504B),
-+ /* required last entry */
- {0,}
- };
-
- MODULE_DEVICE_TABLE(pci, iegbe_pci_tbl);
-
--DEFINE_SPINLOCK(print_lock);
-
- int iegbe_up(struct iegbe_adapter *adapter);
- void iegbe_down(struct iegbe_adapter *adapter);
-+void iegbe_reinit_locked(struct iegbe_adapter *adapter);
- void iegbe_reset(struct iegbe_adapter *adapter);
- int iegbe_set_spd_dplx(struct iegbe_adapter *adapter, uint16_t spddplx);
- int iegbe_setup_all_tx_resources(struct iegbe_adapter *adapter);
- int iegbe_setup_all_rx_resources(struct iegbe_adapter *adapter);
- void iegbe_free_all_tx_resources(struct iegbe_adapter *adapter);
- void iegbe_free_all_rx_resources(struct iegbe_adapter *adapter);
--int iegbe_setup_tx_resources(struct iegbe_adapter *adapter,
-+static int iegbe_setup_tx_resources(struct iegbe_adapter *adapter,
- struct iegbe_tx_ring *txdr);
--int iegbe_setup_rx_resources(struct iegbe_adapter *adapter,
-+static int iegbe_setup_rx_resources(struct iegbe_adapter *adapter,
- struct iegbe_rx_ring *rxdr);
--void iegbe_free_tx_resources(struct iegbe_adapter *adapter,
-+static void iegbe_free_tx_resources(struct iegbe_adapter *adapter,
- struct iegbe_tx_ring *tx_ring);
--void iegbe_free_rx_resources(struct iegbe_adapter *adapter,
-+static void iegbe_free_rx_resources(struct iegbe_adapter *adapter,
- struct iegbe_rx_ring *rx_ring);
- void iegbe_update_stats(struct iegbe_adapter *adapter);
--
- static int iegbe_init_module(void);
- static void iegbe_exit_module(void);
- static int iegbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
- static void __devexit iegbe_remove(struct pci_dev *pdev);
- static int iegbe_alloc_queues(struct iegbe_adapter *adapter);
--#ifdef CONFIG_E1000_MQ
--static void iegbe_setup_queue_mapping(struct iegbe_adapter *adapter);
--#endif
- static int iegbe_sw_init(struct iegbe_adapter *adapter);
- static int iegbe_open(struct net_device *netdev);
- static int iegbe_close(struct net_device *netdev);
-@@ -249,7 +114,8 @@ static void iegbe_clean_tx_ring(struct i
- struct iegbe_tx_ring *tx_ring);
- static void iegbe_clean_rx_ring(struct iegbe_adapter *adapter,
- struct iegbe_rx_ring *rx_ring);
--static void iegbe_set_multi(struct net_device *netdev);
-+
-+static void iegbe_set_rx_mode(struct net_device *netdev);
- static void iegbe_update_phy_info(unsigned long data);
- static void iegbe_watchdog(unsigned long data);
- static void iegbe_82547_tx_fifo_stall(unsigned long data);
-@@ -257,66 +123,46 @@ static int iegbe_xmit_frame(struct sk_bu
- static struct net_device_stats * iegbe_get_stats(struct net_device *netdev);
- static int iegbe_change_mtu(struct net_device *netdev, int new_mtu);
- static int iegbe_set_mac(struct net_device *netdev, void *p);
--static irqreturn_t iegbe_intr(int irq, void *data, struct pt_regs *regs);
-+static irqreturn_t iegbe_intr(int irq, void *data);
-
--void iegbe_tasklet(unsigned long);
-+static irqreturn_t iegbe_intr_msi(int irq, void *data);
-
--#ifndef IEGBE_GBE_WORKAROUND
--static boolean_t iegbe_clean_tx_irq(struct iegbe_adapter *adapter,
-+static bool iegbe_clean_tx_irq(struct iegbe_adapter *adapter,
- struct iegbe_tx_ring *tx_ring);
--#endif
--
--#ifdef CONFIG_E1000_NAPI
--static int iegbe_clean(struct net_device *poll_dev, int *budget);
--static boolean_t iegbe_clean_rx_irq(struct iegbe_adapter *adapter,
-+static int iegbe_clean(struct napi_struct *napi, int budget);
-+static bool iegbe_clean_rx_irq(struct iegbe_adapter *adapter,
- struct iegbe_rx_ring *rx_ring,
- int *work_done, int work_to_do);
--static boolean_t iegbe_clean_rx_irq_ps(struct iegbe_adapter *adapter,
-+static bool iegbe_clean_rx_irq_ps(struct iegbe_adapter *adapter,
- struct iegbe_rx_ring *rx_ring,
- int *work_done, int work_to_do);
--#else
--static boolean_t iegbe_clean_rx_irq(struct iegbe_adapter *adapter,
-- struct iegbe_rx_ring *rx_ring);
--static boolean_t iegbe_clean_rx_irq_ps(struct iegbe_adapter *adapter,
-- struct iegbe_rx_ring *rx_ring);
--#endif
-
--#ifdef IEGBE_GBE_WORKAROUND
-+
- static void iegbe_alloc_rx_buffers(struct iegbe_adapter *adapter,
- struct iegbe_rx_ring *rx_ring,
- int cleaned_count);
- static void iegbe_alloc_rx_buffers_ps(struct iegbe_adapter *adapter,
- struct iegbe_rx_ring *rx_ring,
- int cleaned_count);
--#else
--static void iegbe_alloc_rx_buffers(struct iegbe_adapter *adapter,
-- struct iegbe_rx_ring *rx_ring);
--static void iegbe_alloc_rx_buffers_ps(struct iegbe_adapter *adapter,
-- struct iegbe_rx_ring *rx_ring);
--#endif
-+
-
- static int iegbe_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd);
--#ifdef SIOCGMIIPHY
- static int iegbe_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
-- int cmd);
--#endif
-+ int cmd);
- void set_ethtool_ops(struct net_device *netdev);
- extern int ethtool_ioctl(struct ifreq *ifr);
- static void iegbe_enter_82542_rst(struct iegbe_adapter *adapter);
- static void iegbe_leave_82542_rst(struct iegbe_adapter *adapter);
- static void iegbe_tx_timeout(struct net_device *dev);
--static void iegbe_tx_timeout_task(struct net_device *dev);
-+static void iegbe_reset_task(struct work_struct *work);
- static void iegbe_smartspeed(struct iegbe_adapter *adapter);
- static inline int iegbe_82547_fifo_workaround(struct iegbe_adapter *adapter,
-- struct sk_buff *skb);
-+ struct sk_buff *skb);
-
--#ifdef NETIF_F_HW_VLAN_TX
--static void iegbe_vlan_rx_register(struct net_device *netdev,
-- struct vlan_group *grp);
-+static void iegbe_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp);
- static void iegbe_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
- static void iegbe_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
- static void iegbe_restore_vlan(struct iegbe_adapter *adapter);
--#endif
-
- static int iegbe_notify_reboot(struct notifier_block *,
- unsigned long event,
-@@ -331,15 +177,17 @@ static int iegbe_resume(struct pci_dev *
- static void iegbe_netpoll (struct net_device *netdev);
- #endif
-
--#ifdef CONFIG_E1000_MQ
--/* for multiple Rx queues */
-+#define COPYBREAK_DEFAULT 256
-+static unsigned int copybreak __read_mostly = COPYBREAK_DEFAULT;
-+module_param(copybreak, uint, 0644);
-+MODULE_PARM_DESC(copybreak,
-+ "Maximum size of packet that is copied to a new buffer on receive");
- void iegbe_rx_schedule(void *data);
--#endif
-
- struct notifier_block iegbe_notifier_reboot = {
-- .notifier_call = iegbe_notify_reboot,
-- .next = NULL,
-- .priority = 0
-+ .notifier_call = iegbe_notify_reboot,
-+ .next = NULL,
-+ .priority = 0
- };
-
- /* Exported from other modules */
-@@ -347,14 +195,14 @@ struct notifier_block iegbe_notifier_reb
- extern void iegbe_check_options(struct iegbe_adapter *adapter);
-
- static struct pci_driver iegbe_driver = {
-- .name = iegbe_driver_name,
-- .id_table = iegbe_pci_tbl,
-- .probe = iegbe_probe,
-- .remove = __devexit_p(iegbe_remove),
-- /* Power Managment Hooks */
-+ .name = iegbe_driver_name,
-+ .id_table = iegbe_pci_tbl,
-+ .probe = iegbe_probe,
-+ .remove = __devexit_p(iegbe_remove),
-+ /* Power Managment Hooks */
- #ifdef CONFIG_PM
-- .suspend = iegbe_suspend,
-- .resume = iegbe_resume
-+ .suspend = iegbe_suspend,
-+ .resume = iegbe_resume
- #endif
- };
-
-@@ -364,46 +212,17 @@ MODULE_LICENSE("GPL");
- MODULE_VERSION(DRV_VERSION);
-
- static int debug = NETIF_MSG_DRV | NETIF_MSG_PROBE;
--module_param(debug, int, 0);
-+module_param(debug, int, 0x0);
- MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
-
--static uint8_t gcu_suspend = 0;
--static uint8_t gcu_resume = 0;
-+static uint8_t gcu_suspend = 0x0;
-+static uint8_t gcu_resume = 0x0;
- struct pci_dev *gcu = NULL;
-
--unsigned long tasklet_data;
--DECLARE_TASKLET(iegbe_reset_tasklet, iegbe_tasklet, (unsigned long) &tasklet_data);
-
- /**
- * iegbe_iegbe_tasklet -*
- **/
--void iegbe_tasklet(unsigned long data)
--{
-- char* err_msg = "TEST";
-- uint32_t *icr = (uint32_t*) data;
-- uint32_t gbe = *icr & 0x000000FF;
-- if( *icr & E1000_ICR_RX_DESC_FIFO_PAR) { /* 21 */
-- err_msg = "DMA Transmit Descriptor 2-bit ECC Error!";
-- }
-- if( *icr & E1000_ICR_TX_DESC_FIFO_PAR) { /* 20 */
-- err_msg = "DMA Receive Descriptor 2-bit ECC Error!";
-- }
-- if( *icr & E1000_ICR_PB) { /* 23 */
-- err_msg = "DMA Packet Buffer 2-bit ECC Error!";
-- }
-- if( *icr & E1000_ICR_CPP_TARGET) { /* 27 */
-- err_msg = "Statistic Register ECC Error!";
-- }
-- if( *icr & E1000_ICR_CPP_MASTER) {
-- err_msg = "CPP Error!";
-- }
-- spin_lock(&print_lock);
-- printk("IEGBE%d: System Reset due to: %s\n", gbe, err_msg);
-- dump_stack();
-- spin_unlock(&print_lock);
-- panic(err_msg);
-- return;
--}
- /**
- * iegbe_init_module - Driver Registration Routine
- *
-@@ -411,21 +230,24 @@ void iegbe_tasklet(unsigned long data)
- * loaded. All it does is register with the PCI subsystem.
- **/
-
--static int __init
--iegbe_init_module(void)
-+static int __init iegbe_init_module(void)
- {
-- int ret;
-+ int ret;
-
- printk(KERN_INFO "%s - version %s\n",
-- iegbe_driver_string, iegbe_driver_version);
-+ iegbe_driver_string, iegbe_driver_version);
-
-- printk(KERN_INFO "%s\n", iegbe_copyright);
-+ printk(KERN_INFO "%s\n", iegbe_copyright);
-
-- ret = pci_module_init(&iegbe_driver);
-- if(ret >= 0) {
-- register_reboot_notifier(&iegbe_notifier_reboot);
-- }
-- return ret;
-+ ret = pci_register_driver(&iegbe_driver);
-+ if (copybreak != COPYBREAK_DEFAULT) {
-+ if (copybreak == 0)
-+ printk(KERN_INFO "iegbe: copybreak disabled\n");
-+ else
-+ printk(KERN_INFO "iegbe: copybreak enabled for "
-+ "packets <= %u bytes\n", copybreak);
-+ }
-+ return ret;
- }
-
- module_init(iegbe_init_module);
-@@ -437,29 +259,51 @@ module_init(iegbe_init_module);
- * from memory.
- **/
-
--static void __exit
--iegbe_exit_module(void)
-+static void __exit iegbe_exit_module(void)
- {
--
-- unregister_reboot_notifier(&iegbe_notifier_reboot);
-- pci_unregister_driver(&iegbe_driver);
-+ pci_unregister_driver(&iegbe_driver);
- }
-
- module_exit(iegbe_exit_module);
-
-+static int iegbe_request_irq(struct iegbe_adapter *adapter)
-+{
-+ struct net_device *netdev = adapter->netdev;
-+ irq_handler_t handler = iegbe_intr;
-+ int irq_flags = IRQF_SHARED;
-+ int err;
-+ adapter->have_msi = !pci_enable_msi(adapter->pdev);
-+ if (adapter->have_msi) {
-+ handler = iegbe_intr_msi;
-+ irq_flags = 0;
-+ }
-+ err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name,
-+ netdev);
-+ if (err) {
-+ if (adapter->have_msi)
-+ pci_disable_msi(adapter->pdev);
-+ DPRINTK(PROBE, ERR,
-+ "Unable to allocate interrupt Error: %d\n", err);
-+ }
-+ return err;
-+}
-+static void iegbe_free_irq(struct iegbe_adapter *adapter)
-+{
-+ struct net_device *netdev = adapter->netdev;
-+ free_irq(adapter->pdev->irq, netdev);
-+ if (adapter->have_msi)
-+ pci_disable_msi(adapter->pdev);
-+}
- /**
- * iegbe_irq_disable - Mask off interrupt generation on the NIC
- * @adapter: board private structure
- **/
-
--static inline void
--iegbe_irq_disable(struct iegbe_adapter *adapter)
-+static void iegbe_irq_disable(struct iegbe_adapter *adapter)
- {
--
-- atomic_inc(&adapter->irq_sem);
-- E1000_WRITE_REG(&adapter->hw, IMC, ~0);
-- E1000_WRITE_FLUSH(&adapter->hw);
-- synchronize_irq(adapter->pdev->irq);
-+ E1000_WRITE_REG(&adapter->hw, IMC, ~0);
-+ E1000_WRITE_FLUSH(&adapter->hw);
-+ synchronize_irq(adapter->pdev->irq);
- }
-
- /**
-@@ -470,244 +314,414 @@ iegbe_irq_disable(struct iegbe_adapter *
- static inline void
- iegbe_irq_enable(struct iegbe_adapter *adapter)
- {
--
-- if(likely(atomic_dec_and_test(&adapter->irq_sem))) {
-- E1000_WRITE_REG(&adapter->hw, IMS, IMS_ENABLE_MASK);
-- E1000_WRITE_FLUSH(&adapter->hw);
-- }
-+ E1000_WRITE_REG(&adapter->hw, IMS, IMS_ENABLE_MASK);
-+ E1000_WRITE_FLUSH(&adapter->hw);
- }
--#ifdef NETIF_F_HW_VLAN_TX
--void
--iegbe_update_mng_vlan(struct iegbe_adapter *adapter)
--{
-- struct net_device *netdev = adapter->netdev;
-- uint16_t vid = adapter->hw.mng_cookie.vlan_id;
-- uint16_t old_vid = adapter->mng_vlan_id;
-
-- if(adapter->vlgrp) {
-- if(!adapter->vlgrp->vlan_devices[vid]) {
-- if(adapter->hw.mng_cookie.status &
-- E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) {
-- iegbe_vlan_rx_add_vid(netdev, vid);
-- adapter->mng_vlan_id = vid;
-- } else {
-- adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
-- }
-- if((old_vid != (uint16_t)E1000_MNG_VLAN_NONE) &&
-- (vid != old_vid) &&
-- !adapter->vlgrp->vlan_devices[old_vid]) {
-- iegbe_vlan_rx_kill_vid(netdev, old_vid);
-- }
-- }
--}
-+static void iegbe_update_mng_vlan(struct iegbe_adapter *adapter)
-+{
-+ struct iegbe_hw *hw = &adapter->hw;
-+ struct net_device *netdev = adapter->netdev;
-+ u16 vid = hw->mng_cookie.vlan_id;
-+ u16 old_vid = adapter->mng_vlan_id;
-+ if (adapter->vlgrp) {
-+ if (!vlan_group_get_device(adapter->vlgrp, vid)) {
-+ if (hw->mng_cookie.status &
-+ E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) {
-+ iegbe_vlan_rx_add_vid(netdev, vid);
-+ adapter->mng_vlan_id = vid;
-+ } else
-+ adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
-+
-+ if ((old_vid != (u16)E1000_MNG_VLAN_NONE) &&
-+ (vid != old_vid) &&
-+ !vlan_group_get_device(adapter->vlgrp, old_vid))
-+ iegbe_vlan_rx_kill_vid(netdev, old_vid);
-+ } else
-+ adapter->mng_vlan_id = vid;
-+ }
- }
--#endif
-
--int
--iegbe_up(struct iegbe_adapter *adapter)
-+/**
-+ * iegbe_configure - configure the hardware for RX and TX
-+ * @adapter = private board structure
-+ **/
-+static void iegbe_configure(struct iegbe_adapter *adapter)
- {
- struct net_device *netdev = adapter->netdev;
-- int i, err;
-- uint16_t pci_cmd;
--
-- /* hardware has been reset, we need to reload some things */
--
-- /* Reset the PHY if it was previously powered down */
-- if(adapter->hw.media_type == iegbe_media_type_copper
-- || (adapter->hw.media_type == iegbe_media_type_oem
-- && iegbe_oem_phy_is_copper(&adapter->hw))) {
-- uint16_t mii_reg;
-- iegbe_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg);
-- if(mii_reg & MII_CR_POWER_DOWN){
-- iegbe_phy_reset(&adapter->hw);
-- }
-- }
-+ int i;
-
-- iegbe_set_multi(netdev);
-+ iegbe_set_rx_mode(netdev);
-
--#ifdef NETIF_F_HW_VLAN_TX
- iegbe_restore_vlan(adapter);
--#endif
-
- iegbe_configure_tx(adapter);
- iegbe_setup_rctl(adapter);
- iegbe_configure_rx(adapter);
-+ /* call E1000_DESC_UNUSED which always leaves
-+ * at least 1 descriptor unused to make sure
-+ * next_to_use != next_to_clean */
-+ for (i = 0; i < adapter->num_rx_queues; i++) {
-+ struct iegbe_rx_ring *ring = &adapter->rx_ring[i];
-+ adapter->alloc_rx_buf(adapter, ring,
-+ E1000_DESC_UNUSED(ring));
-+ }
-
--#ifdef IEGBE_GBE_WORKAROUND
-- for (i = 0; i < adapter->num_queues; i++)
-- adapter->alloc_rx_buf(adapter, &adapter->rx_ring[i],
-- IEGBE_GBE_WORKAROUND_NUM_RX_DESCRIPTORS + 1);
--#else
-- for (i = 0; i < adapter->num_queues; i++)
-- adapter->alloc_rx_buf(adapter, &adapter->rx_ring[i]);
--#endif
-+ adapter->tx_queue_len = netdev->tx_queue_len;
-+}
-
--#ifdef CONFIG_PCI_MSI
-- if(adapter->hw.mac_type > iegbe_82547_rev_2
-- || adapter->hw.mac_type == iegbe_icp_xxxx) {
-- adapter->have_msi = TRUE;
-- if((err = pci_enable_msi(adapter->pdev))) {
-- DPRINTK(PROBE, ERR,
-- "Unable to allocate MSI interrupt Error: %d\n", err);
-- adapter->have_msi = FALSE;
-- }
-- }
-- pci_read_config_word(adapter->pdev, PCI_COMMAND, &pci_cmd);
-- pci_write_config_word(adapter->pdev, PCI_COMMAND, pci_cmd | IEGBE_INTD_DISABLE);
-+int iegbe_up(struct iegbe_adapter *adapter)
-+{
-+ /* hardware has been reset, we need to reload some things */
-+ iegbe_configure(adapter);
-
--#endif
-- if((err = request_irq(adapter->pdev->irq, &iegbe_intr,
-- SA_SHIRQ | SA_SAMPLE_RANDOM,
-- netdev->name, netdev))) {
-- DPRINTK(PROBE, ERR,
-- "Unable to allocate interrupt Error: %d\n", err);
-- return err;
-- }
-+ clear_bit(__E1000_DOWN, &adapter->flags);
-
-- mod_timer(&adapter->watchdog_timer, jiffies);
-+ napi_enable(&adapter->napi);
-
--#ifdef CONFIG_E1000_NAPI
-- netif_poll_enable(netdev);
--#endif
- iegbe_irq_enable(adapter);
-
-+ adapter->hw.get_link_status = 0x1;
- return 0;
- }
-
--void
--iegbe_down(struct iegbe_adapter *adapter)
--{
-- struct net_device *netdev = adapter->netdev;
--
-- iegbe_irq_disable(adapter);
--#ifdef CONFIG_E1000_MQ
-- while (atomic_read(&adapter->rx_sched_call_data.count) != 0) { };
--#endif
-- free_irq(adapter->pdev->irq, netdev);
--#ifdef CONFIG_PCI_MSI
-- if((adapter->hw.mac_type > iegbe_82547_rev_2
-- || adapter->hw.mac_type == iegbe_icp_xxxx)
-- && adapter->have_msi == TRUE) {
-- pci_disable_msi(adapter->pdev);
-- }
--#endif
-- del_timer_sync(&adapter->tx_fifo_stall_timer);
-- del_timer_sync(&adapter->watchdog_timer);
-- del_timer_sync(&adapter->phy_info_timer);
-+/**
-+ * iegbe_power_up_phy - restore link in case the phy was powered down
-+ * @adapter: address of board private structure
-+ *
-+ * The phy may be powered down to save power and turn off link when the
-+ * driver is unloaded and wake on lan is not enabled (among others)
-+ * *** this routine MUST be followed by a call to iegbe_reset ***
-+ *
-+ **/
-
--#ifdef CONFIG_E1000_NAPI
-- netif_poll_disable(netdev);
--#endif
-- adapter->link_speed = 0;
-- adapter->link_duplex = 0;
-- netif_carrier_off(netdev);
-- netif_stop_queue(netdev);
-+void iegbe_power_up_phy(struct iegbe_adapter *adapter)
-+{
-+ struct iegbe_hw *hw = &adapter->hw;
-+ u16 mii_reg = 0;
-
-- iegbe_reset(adapter);
-- iegbe_clean_all_tx_rings(adapter);
-- iegbe_clean_all_rx_rings(adapter);
-+ /* Just clear the power down bit to wake the phy back up */
-+ if (hw->media_type == iegbe_media_type_copper) {
-+ /* according to the manual, the phy will retain its
-+ * settings across a power-down/up cycle */
-+ iegbe_read_phy_reg(hw, PHY_CTRL, &mii_reg);
-+ mii_reg &= ~MII_CR_POWER_DOWN;
-+ iegbe_write_phy_reg(hw, PHY_CTRL, mii_reg);
-+ }
-+}
-
-- /* If WoL is not enabled and management mode is not IAMT
-- * or if WoL is not enabled and OEM PHY is copper based,
-- * power down the PHY so no link is implied when interface is down */
-- if(!adapter->wol
-- && ((adapter->hw.mac_type >= iegbe_82540
-- && adapter->hw.media_type == iegbe_media_type_copper
-- && !iegbe_check_mng_mode(&adapter->hw)
-- && !(E1000_READ_REG(&adapter->hw, MANC) & E1000_MANC_SMBUS_EN))
-- || (adapter->hw.media_type == iegbe_media_type_oem
-- && iegbe_oem_phy_is_copper(&adapter->hw)))){
-+static void iegbe_power_down_phy(struct iegbe_adapter *adapter)
-+{
-+ struct iegbe_hw *hw = &adapter->hw;
-
-- uint16_t mii_reg;
-- iegbe_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg);
-+ /* Power down the PHY so no link is implied when interface is down *
-+ * The PHY cannot be powered down if any of the following is true *
-+ * (a) WoL is enabled
-+ * (b) AMT is active
-+ * (c) SoL/IDER session is active */
-+ if (!adapter->wol && hw->mac_type >= iegbe_82540 &&
-+ hw->media_type == iegbe_media_type_copper) {
-+ u16 mii_reg = 0;
-+
-+ switch (hw->mac_type) {
-+ case iegbe_82540:
-+ case iegbe_82545:
-+ case iegbe_82545_rev_3:
-+ case iegbe_82546:
-+ case iegbe_82546_rev_3:
-+ case iegbe_82541:
-+ case iegbe_82541_rev_2:
-+ case iegbe_82547:
-+ case iegbe_82547_rev_2:
-+ if (E1000_READ_REG(&adapter->hw, MANC) & E1000_MANC_SMBUS_EN)
-+ goto out;
-+ break;
-+ case iegbe_82571:
-+ case iegbe_82572:
-+ case iegbe_82573:
-+ if (iegbe_check_mng_mode(hw) ||
-+ iegbe_check_phy_reset_block(hw))
-+ goto out;
-+ break;
-+ default:
-+ goto out;
-+ }
-+ iegbe_read_phy_reg(hw, PHY_CTRL, &mii_reg);
- mii_reg |= MII_CR_POWER_DOWN;
-- iegbe_write_phy_reg(&adapter->hw, PHY_CTRL, mii_reg);
-+ iegbe_write_phy_reg(hw, PHY_CTRL, mii_reg);
- mdelay(1);
- }
-+out:
-+ return;
- }
-
--void
--iegbe_reset(struct iegbe_adapter *adapter)
-+void iegbe_down(struct iegbe_adapter *adapter)
- {
-- struct net_device *netdev = adapter->netdev;
-- uint32_t pba, manc;
-- uint16_t fc_high_water_mark = E1000_FC_HIGH_DIFF;
-- uint16_t fc_low_water_mark = E1000_FC_LOW_DIFF;
-+ struct net_device *netdev = adapter->netdev;
-
-+ /* signal that we're down so the interrupt handler does not
-+ * reschedule our watchdog timer */
-+ set_bit(__E1000_DOWN, &adapter->flags);
-
-- /* Repartition Pba for greater than 9k mtu
-- * To take effect CTRL.RST is required.
-- */
-+ napi_disable(&adapter->napi);
-
-- switch (adapter->hw.mac_type) {
-- case iegbe_82547:
-- case iegbe_82547_rev_2:
-- pba = E1000_PBA_30K;
-- break;
-- case iegbe_82571:
-- case iegbe_82572:
-- pba = E1000_PBA_38K;
-- break;
-- case iegbe_82573:
-- pba = E1000_PBA_12K;
-+ iegbe_irq_disable(adapter);
-+
-+ del_timer_sync(&adapter->tx_fifo_stall_timer);
-+ del_timer_sync(&adapter->watchdog_timer);
-+ del_timer_sync(&adapter->phy_info_timer);
-+
-+ netdev->tx_queue_len = adapter->tx_queue_len;
-+ adapter->link_speed = 0;
-+ adapter->link_duplex = 0;
-+ netif_carrier_off(netdev);
-+ netif_stop_queue(netdev);
-+
-+ iegbe_reset(adapter);
-+ iegbe_clean_all_tx_rings(adapter);
-+ iegbe_clean_all_rx_rings(adapter);
-+}
-+void iegbe_reinit_locked(struct iegbe_adapter *adapter)
-+{
-+ WARN_ON(in_interrupt());
-+ while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
-+ msleep(1);
-+ iegbe_down(adapter);
-+ iegbe_up(adapter);
-+ clear_bit(__E1000_RESETTING, &adapter->flags);
-+}
-+
-+void iegbe_reset(struct iegbe_adapter *adapter)
-+{
-+ struct iegbe_hw *hw = &adapter->hw;
-+ u32 pba = 0, tx_space, min_tx_space, min_rx_space;
-+ u16 fc_high_water_mark = E1000_FC_HIGH_DIFF;
-+ bool legacy_pba_adjust = false;
-+
-+ /* Repartition Pba for greater than 9k mtu
-+ * To take effect CTRL.RST is required.
-+ */
-+
-+ switch (hw->mac_type) {
-+ case iegbe_82542_rev2_0:
-+ case iegbe_82542_rev2_1:
-+ case iegbe_82543:
-+ case iegbe_82544:
-+ case iegbe_82540:
-+ case iegbe_82541:
-+ case iegbe_82541_rev_2:
-+ case iegbe_icp_xxxx:
-+ legacy_pba_adjust = true;
-+ pba = E1000_PBA_48K;
- break;
-- default:
-+ case iegbe_82545:
-+ case iegbe_82545_rev_3:
-+ case iegbe_82546:
-+ case iegbe_82546_rev_3:
- pba = E1000_PBA_48K;
- break;
-- }
-+ case iegbe_82547:
-+ case iegbe_82573:
-+ case iegbe_82547_rev_2:
-+ legacy_pba_adjust = true;
-+ pba = E1000_PBA_30K;
-+ break;
-+ case iegbe_82571:
-+ case iegbe_82572:
-+ case iegbe_undefined:
-+ case iegbe_num_macs:
-+ break;
-+ }
-+
-+ if (legacy_pba_adjust) {
-+ if (adapter->netdev->mtu > E1000_RXBUFFER_8192)
-+ pba -= 8; /* allocate more FIFO for Tx */
-+ /* send an XOFF when there is enough space in the
-+ * Rx FIFO to hold one extra full size Rx packet
-+ */
-
-- if((adapter->hw.mac_type != iegbe_82573) &&
-- (adapter->rx_buffer_len > E1000_RXBUFFER_8192)) {
-- pba -= 0x8; /* allocate more FIFO for Tx */
-- /* send an XOFF when there is enough space in the
-- * Rx FIFO to hold one extra full size Rx packet
-- */
-- fc_high_water_mark = netdev->mtu + ENET_HEADER_SIZE +
-- ETHERNET_FCS_SIZE + 0x1;
-- fc_low_water_mark = fc_high_water_mark + 0x8;
-- }
-
-+ if (hw->mac_type == iegbe_82547) {
-+ adapter->tx_fifo_head = 0;
-+ adapter->tx_head_addr = pba << E1000_TX_HEAD_ADDR_SHIFT;
-+ adapter->tx_fifo_size =
-+ (E1000_PBA_40K - pba) << E1000_PBA_BYTES_SHIFT;
-+ atomic_set(&adapter->tx_fifo_stall, 0);
-+ }
-+ } else if (hw->max_frame_size > MAXIMUM_ETHERNET_FRAME_SIZE) {
-+ E1000_WRITE_REG(&adapter->hw, PBA, pba);
-+
-+ /* To maintain wire speed transmits, the Tx FIFO should be
-+ * large enough to accomodate two full transmit packets,
-+ * rounded up to the next 1KB and expressed in KB. Likewise,
-+ * the Rx FIFO should be large enough to accomodate at least
-+ * one full receive packet and is similarly rounded up and
-+ * expressed in KB. */
-+ pba = E1000_READ_REG(&adapter->hw, PBA);
-+ /* upper 16 bits has Tx packet buffer allocation size in KB */
-+ tx_space = pba >> 16;
-+ /* lower 16 bits has Rx packet buffer allocation size in KB */
-+ pba &= 0xffff;
-+ /* don't include ethernet FCS because hardware appends/strips */
-+ min_rx_space = adapter->netdev->mtu + ENET_HEADER_SIZE +
-+ VLAN_TAG_SIZE;
-+ min_tx_space = min_rx_space;
-+ min_tx_space *= 2;
-+ min_tx_space = ALIGN(min_tx_space, 1024);
-+ min_tx_space >>= 10;
-+ min_rx_space = ALIGN(min_rx_space, 1024);
-+ min_rx_space >>= 10;
-+
-+ /* If current Tx allocation is less than the min Tx FIFO size,
-+ * and the min Tx FIFO size is less than the current Rx FIFO
-+ * allocation, take space away from current Rx allocation */
-+ if (tx_space < min_tx_space &&
-+ ((min_tx_space - tx_space) < pba)) {
-+ pba = pba - (min_tx_space - tx_space);
-+
-+ /* PCI/PCIx hardware has PBA alignment constraints */
-+ switch (hw->mac_type) {
-+ case iegbe_82545 ... iegbe_82546_rev_3:
-+ pba &= ~(E1000_PBA_8K - 1);
-+ break;
-+ default:
-+ break;
-+ }
-
-- if(adapter->hw.mac_type == iegbe_82547) {
-- adapter->tx_fifo_head = 0;
-- adapter->tx_head_addr = pba << E1000_TX_HEAD_ADDR_SHIFT;
-- adapter->tx_fifo_size =
-- (E1000_PBA_40K - pba) << E1000_PBA_BYTES_SHIFT;
-- atomic_set(&adapter->tx_fifo_stall, 0);
-+ /* if short on rx space, rx wins and must trump tx
-+ * adjustment or use Early Receive if available */
-+ if (pba < min_rx_space) {
-+ switch (hw->mac_type) {
-+ case iegbe_82573:
-+ /* ERT enabled in iegbe_configure_rx */
-+ break;
-+ default:
-+ pba = min_rx_space;
-+ break;
-+ }
-+ }
-+ }
- }
-
- E1000_WRITE_REG(&adapter->hw, PBA, pba);
-
- /* flow control settings */
-- adapter->hw.fc_high_water = (pba << E1000_PBA_BYTES_SHIFT) -
-- fc_high_water_mark;
-- adapter->hw.fc_low_water = (pba << E1000_PBA_BYTES_SHIFT) -
-- fc_low_water_mark;
-- adapter->hw.fc_pause_time = E1000_FC_PAUSE_TIME;
-- adapter->hw.fc_send_xon = 1;
-- adapter->hw.fc = adapter->hw.original_fc;
-+ /* Set the FC high water mark to 90% of the FIFO size.
-+ * Required to clear last 3 LSB */
-+ fc_high_water_mark = ((pba * 9216)/10) & 0xFFF8;
-+ /* We can't use 90% on small FIFOs because the remainder
-+ * would be less than 1 full frame. In this case, we size
-+ * it to allow at least a full frame above the high water
-+ * mark. */
-+ if (pba < E1000_PBA_16K)
-+ fc_high_water_mark = (pba * 1024) - 1600;
-+
-+ hw->fc_high_water = fc_high_water_mark;
-+ hw->fc_low_water = fc_high_water_mark - 8;
-+ hw->fc_pause_time = E1000_FC_PAUSE_TIME;
-+ hw->fc_send_xon = 1;
-+ hw->fc = hw->original_fc;
-
- /* Allow time for pending master requests to run */
-- iegbe_reset_hw(&adapter->hw);
-- if(adapter->hw.mac_type >= iegbe_82544){
-+ iegbe_reset_hw(hw);
-+ if (hw->mac_type >= iegbe_82544)
- E1000_WRITE_REG(&adapter->hw, WUC, 0);
-- }
-- if(iegbe_init_hw(&adapter->hw)) {
-+
-+ if (iegbe_init_hw(hw))
- DPRINTK(PROBE, ERR, "Hardware Error\n");
-- }
--#ifdef NETIF_F_HW_VLAN_TX
- iegbe_update_mng_vlan(adapter);
--#endif
-+
-+ /* if (adapter->hwflags & HWFLAGS_PHY_PWR_BIT) { */
-+ if (hw->mac_type >= iegbe_82544 &&
-+ hw->mac_type <= iegbe_82547_rev_2 &&
-+ hw->autoneg == 1 &&
-+ hw->autoneg_advertised == ADVERTISE_1000_FULL) {
-+ u32 ctrl = E1000_READ_REG(&adapter->hw, CTRL);
-+ /* clear phy power management bit if we are in gig only mode,
-+ * which if enabled will attempt negotiation to 100Mb, which
-+ * can cause a loss of link at power off or driver unload */
-+ ctrl &= ~E1000_CTRL_SWDPIN3;
-+ E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
-+ }
-+
- /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
- E1000_WRITE_REG(&adapter->hw, VET, ETHERNET_IEEE_VLAN_TYPE);
-
-- iegbe_reset_adaptive(&adapter->hw);
-- iegbe_phy_get_info(&adapter->hw, &adapter->phy_info);
-- if(adapter->en_mng_pt) {
-- manc = E1000_READ_REG(&adapter->hw, MANC);
-- manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST);
-- E1000_WRITE_REG(&adapter->hw, MANC, manc);
-+ iegbe_reset_adaptive(hw);
-+ iegbe_phy_get_info(hw, &adapter->phy_info);
-+
-+ if (!adapter->smart_power_down &&
-+ (hw->mac_type == iegbe_82571 ||
-+ hw->mac_type == iegbe_82572)) {
-+ u16 phy_data = 0;
-+ /* speed up time to link by disabling smart power down, ignore
-+ * the return value of this function because there is nothing
-+ * different we would do if it failed */
-+ iegbe_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT,
-+ &phy_data);
-+ phy_data &= ~IGP02E1000_PM_SPD;
-+ iegbe_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT,
-+ phy_data);
-+ }
-+
-+}
-+
-+/**
-+ * Dump the eeprom for users having checksum issues
-+ **/
-+static void iegbe_dump_eeprom(struct iegbe_adapter *adapter)
-+{
-+ struct net_device *netdev = adapter->netdev;
-+ struct ethtool_eeprom eeprom;
-+ const struct ethtool_ops *ops = netdev->ethtool_ops;
-+ u8 *data;
-+ int i;
-+ u16 csum_old, csum_new = 0;
-+
-+ eeprom.len = ops->get_eeprom_len(netdev);
-+ eeprom.offset = 0;
-+
-+ data = kmalloc(eeprom.len, GFP_KERNEL);
-+ if (!data) {
-+ printk(KERN_ERR "Unable to allocate memory to dump EEPROM"
-+ " data\n");
-+ return;
- }
-+
-+ ops->get_eeprom(netdev, &eeprom, data);
-+
-+ csum_old = (data[EEPROM_CHECKSUM_REG * 2]) +
-+ (data[EEPROM_CHECKSUM_REG * 2 + 1] << 8);
-+ for (i = 0; i < EEPROM_CHECKSUM_REG * 2; i += 2)
-+ csum_new += data[i] + (data[i + 1] << 8);
-+ csum_new = EEPROM_SUM - csum_new;
-+
-+ printk(KERN_ERR "/*********************/\n");
-+ printk(KERN_ERR "Current EEPROM Checksum : 0x%04x\n", csum_old);
-+ printk(KERN_ERR "Calculated : 0x%04x\n", csum_new);
-+
-+ printk(KERN_ERR "Offset Values\n");
-+ printk(KERN_ERR "======== ======\n");
-+ print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 16, 1, data, 128, 0);
-+
-+ printk(KERN_ERR "Include this output when contacting your support "
-+ "provider.\n");
-+ printk(KERN_ERR "This is not a software error! Something bad "
-+ "happened to your hardware or\n");
-+ printk(KERN_ERR "EEPROM image. Ignoring this "
-+ "problem could result in further problems,\n");
-+ printk(KERN_ERR "possibly loss of data, corruption or system hangs!\n");
-+ printk(KERN_ERR "The MAC Address will be reset to 00:00:00:00:00:00, "
-+ "which is invalid\n");
-+ printk(KERN_ERR "and requires you to set the proper MAC "
-+ "address manually before continuing\n");
-+ printk(KERN_ERR "to enable this network device.\n");
-+ printk(KERN_ERR "Please inspect the EEPROM dump and report the issue "
-+ "to your hardware vendor\n");
-+ printk(KERN_ERR "or Intel Customer Support.\n");
-+ printk(KERN_ERR "/*********************/\n");
-+
-+ kfree(data);
- }
-
- /**
-@@ -721,184 +735,166 @@ iegbe_reset(struct iegbe_adapter *adapte
- * The OS initialization, configuring of the adapter private structure,
- * and a hardware reset occur.
- **/
--
--static int __devinit
--iegbe_probe(struct pci_dev *pdev,
-+static int __devinit iegbe_probe(struct pci_dev *pdev,
- const struct pci_device_id *ent)
- {
-- struct net_device *netdev;
-- struct iegbe_adapter *adapter;
-- unsigned long mmio_start, mmio_len;
-- uint32_t ctrl_ext;
-- uint32_t swsm;
-+ struct net_device *netdev;
-+ struct iegbe_adapter *adapter;
-+ struct iegbe_hw *hw;
-
- static int cards_found = 0;
-+ int i, err, pci_using_dac;
-+ u16 eeprom_data = 0;
-+ u16 eeprom_apme_mask = E1000_EEPROM_APME;
-+ int bars;
-+ DECLARE_MAC_BUF(mac);
-
-- int i, err, pci_using_dac;
-- uint16_t eeprom_data = 0;
-- uint16_t eeprom_apme_mask = E1000_EEPROM_APME;
-+ bars = pci_select_bars(pdev, IORESOURCE_MEM);
-+ err = pci_enable_device(pdev);
-
-+ if (err)
-+ return err;
-
-- if((err = pci_enable_device(pdev))) {
-- return err;
-- }
-- if(!(err = pci_set_dma_mask(pdev, PCI_DMA_64BIT))) {
-+ if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK) &&
-+ !pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) {
- pci_using_dac = 1;
-- } else {
-- if((err = pci_set_dma_mask(pdev, PCI_DMA_32BIT))) {
-- E1000_ERR("No usable DMA configuration, aborting\n");
-- return err;
-- }
-+ } else {
-+ err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
-+ if (err) {
-+ err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
-+ if (err) {
-+ E1000_ERR("No usable DMA configuration, "
-+ "aborting\n");
-+ goto err_dma;
-+ }
-+ }
- pci_using_dac = 0;
-- }
--
-- if((err = pci_request_regions(pdev, iegbe_driver_name))) {
-- return err;
- }
-- pci_set_master(pdev);
-
-- netdev = alloc_etherdev(sizeof(struct iegbe_adapter));
-- if(!netdev) {
-- err = -ENOMEM;
-- goto err_alloc_etherdev;
-- }
-+ err = pci_request_selected_regions(pdev, bars, iegbe_driver_name);
-+ if (err)
-+ goto err_pci_reg;
-+
-+ pci_set_master(pdev);
-+
-+ err = -ENOMEM;
-+ netdev = alloc_etherdev(sizeof(struct iegbe_adapter));
-+ if (!netdev)
-+ goto err_alloc_etherdev;
-
-- SET_MODULE_OWNER(netdev);
- SET_NETDEV_DEV(netdev, &pdev->dev);
-
-- pci_set_drvdata(pdev, netdev);
-- adapter = netdev_priv(netdev);
-- adapter->netdev = netdev;
-- adapter->pdev = pdev;
-- adapter->hw.back = adapter;
-- adapter->msg_enable = (0x1 << debug) - 0x1;
--
-- mmio_start = pci_resource_start(pdev, BAR_0);
-- mmio_len = pci_resource_len(pdev, BAR_0);
--
-- adapter->hw.hw_addr = ioremap(mmio_start, mmio_len);
-- if(!adapter->hw.hw_addr) {
-- err = -EIO;
-- goto err_ioremap;
-- }
--
-- for(i = BAR_1; i <= BAR_5; i++) {
-- if(pci_resource_len(pdev, i) == 0) {
-- continue;
-- }
-- if(pci_resource_flags(pdev, i) & IORESOURCE_IO) {
-- adapter->hw.io_base = pci_resource_start(pdev, i);
-- break;
-- }
-- }
--
-- netdev->open = &iegbe_open;
-- netdev->stop = &iegbe_close;
-- netdev->hard_start_xmit = &iegbe_xmit_frame;
-- netdev->get_stats = &iegbe_get_stats;
-- netdev->set_multicast_list = &iegbe_set_multi;
-+ pci_set_drvdata(pdev, netdev);
-+ adapter = netdev_priv(netdev);
-+ adapter->netdev = netdev;
-+ adapter->pdev = pdev;
-+ adapter->msg_enable = (1 << debug) - 1;
-+ adapter->bars = bars;
-+
-+ hw = &adapter->hw;
-+ hw->back = adapter;
-+
-+ err = -EIO;
-+ hw->hw_addr = ioremap(pci_resource_start(pdev, BAR_0),
-+ pci_resource_len(pdev, BAR_0));
-+ if (!hw->hw_addr)
-+ goto err_ioremap;
-+
-+ netdev->open = &iegbe_open;
-+ netdev->stop = &iegbe_close;
-+ netdev->hard_start_xmit = &iegbe_xmit_frame;
-+ netdev->get_stats = &iegbe_get_stats;
-+ netdev->set_rx_mode = &iegbe_set_rx_mode;
- netdev->set_mac_address = &iegbe_set_mac;
-- netdev->change_mtu = &iegbe_change_mtu;
-- netdev->do_ioctl = &iegbe_ioctl;
-+ netdev->change_mtu = &iegbe_change_mtu;
-+ netdev->do_ioctl = &iegbe_ioctl;
- set_ethtool_ops(netdev);
--#ifdef HAVE_TX_TIMEOUT
-- netdev->tx_timeout = &iegbe_tx_timeout;
-- netdev->watchdog_timeo = 0x5 * HZ;
--#endif
--#ifdef CONFIG_E1000_NAPI
-- netdev->poll = &iegbe_clean;
-- netdev->weight = 0x40;
--#endif
--#ifdef NETIF_F_HW_VLAN_TX
-- netdev->vlan_rx_register = iegbe_vlan_rx_register;
-- netdev->vlan_rx_add_vid = iegbe_vlan_rx_add_vid;
-- netdev->vlan_rx_kill_vid = iegbe_vlan_rx_kill_vid;
--#endif
-+ netdev->tx_timeout = &iegbe_tx_timeout;
-+ netdev->watchdog_timeo = 5 * HZ;
-+ netif_napi_add(netdev, &adapter->napi, iegbe_clean, 64);
-+ netdev->vlan_rx_register = iegbe_vlan_rx_register;
-+ netdev->vlan_rx_add_vid = iegbe_vlan_rx_add_vid;
-+ netdev->vlan_rx_kill_vid = iegbe_vlan_rx_kill_vid;
- #ifdef CONFIG_NET_POLL_CONTROLLER
-- netdev->poll_controller = iegbe_netpoll;
-+ netdev->poll_controller = iegbe_netpoll;
- #endif
-- strcpy(netdev->name, pci_name(pdev));
-+ strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
-
-- netdev->mem_start = mmio_start;
-- netdev->mem_end = mmio_start + mmio_len;
-- netdev->base_addr = adapter->hw.io_base;
-
-- adapter->bd_number = cards_found;
-+ adapter->bd_number = cards_found;
-
-- /* setup the private structure */
-+ /* setup the private structure */
-
-- if((err = iegbe_sw_init(adapter))) {
-- goto err_sw_init;
-- }
-- if((err = iegbe_check_phy_reset_block(&adapter->hw))) {
-- DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n");
-- }
--#ifdef MAX_SKB_FRAGS
-- if(adapter->hw.mac_type >= iegbe_82543) {
--#ifdef NETIF_F_HW_VLAN_TX
-- netdev->features = NETIF_F_SG |
-- NETIF_F_HW_CSUM |
-- NETIF_F_HW_VLAN_TX |
-- NETIF_F_HW_VLAN_RX |
-- NETIF_F_HW_VLAN_FILTER;
--#else
-- netdev->features = NETIF_F_SG | NETIF_F_HW_CSUM;
--#endif
-- }
-+ err = iegbe_sw_init(adapter);
-+ if (err)
-+ goto err_sw_init;
-+ err = -EIO;
-+ if (iegbe_check_phy_reset_block(hw))
-+ DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n");
-
--#ifdef NETIF_F_TSO
-- if((adapter->hw.mac_type >= iegbe_82544) &&
-- (adapter->hw.mac_type != iegbe_82547)) {
-- netdev->features |= NETIF_F_TSO;
-- }
--#ifdef NETIF_F_TSO_IPV6
-- if(adapter->hw.mac_type > iegbe_82547_rev_2) {
-- netdev->features |= NETIF_F_TSO_IPV6;
-- }
--#endif
--#endif
-- if(pci_using_dac) {
-- netdev->features |= NETIF_F_HIGHDMA;
-+ if (hw->mac_type >= iegbe_82543) {
-+ netdev->features = NETIF_F_SG |
-+ NETIF_F_HW_CSUM |
-+ NETIF_F_HW_VLAN_TX |
-+ NETIF_F_HW_VLAN_RX |
-+ NETIF_F_HW_VLAN_FILTER;
- }
--#endif
--#ifdef NETIF_F_LLTX
-- netdev->features |= NETIF_F_LLTX;
--#endif
-
-- adapter->en_mng_pt = iegbe_enable_mng_pass_thru(&adapter->hw);
-+ if ((hw->mac_type >= iegbe_82544) &&
-+ (hw->mac_type != iegbe_82547))
-+ netdev->features |= NETIF_F_TSO;
-
-- /* before reading the EEPROM, reset the controller to
-- * put the device in a known good starting state */
-+ if (hw->mac_type > iegbe_82547_rev_2)
-+ netdev->features |= NETIF_F_TSO6;
-+ if (pci_using_dac)
-+ netdev->features |= NETIF_F_HIGHDMA;
-+
-+ netdev->features |= NETIF_F_LLTX;
-
-- iegbe_reset_hw(&adapter->hw);
-+ adapter->en_mng_pt = iegbe_enable_mng_pass_thru(hw);
-
-- /* make sure the EEPROM is good */
-- if(iegbe_validate_eeprom_checksum(&adapter->hw) < 0) {
-- DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n");
-- err = -EIO;
-+ /* initialize eeprom parameters */
-+
-+ if (iegbe_init_eeprom_params(hw)) {
-+ E1000_ERR("EEPROM initialization failed\n");
- goto err_eeprom;
- }
-
-- /* copy the MAC address out of the EEPROM */
-+ /* before reading the EEPROM, reset the controller to
-+ * put the device in a known good starting state */
-
-- if(iegbe_read_mac_addr(&adapter->hw)) {
-- DPRINTK(PROBE, ERR, "EEPROM Read Error\n");
-- }
-- memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
-+ iegbe_reset_hw(hw);
-
-- if(!is_valid_ether_addr(netdev->dev_addr)) {
-- DPRINTK(PROBE, ERR, "Invalid MAC Address\n");
-- err = -EIO;
-- goto err_eeprom;
-- }
-+ /* make sure the EEPROM is good */
-+ if (iegbe_validate_eeprom_checksum(hw) < 0) {
-+ DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n");
-+ iegbe_dump_eeprom(adapter);
-+ /*
-+ * set MAC address to all zeroes to invalidate and temporary
-+ * disable this device for the user. This blocks regular
-+ * traffic while still permitting ethtool ioctls from reaching
-+ * the hardware as well as allowing the user to run the
-+ * interface after manually setting a hw addr using
-+ * `ip set address`
-+ */
-+ memset(hw->mac_addr, 0, netdev->addr_len);
-+ } else {
-+ /* copy the MAC address out of the EEPROM */
-+ if (iegbe_read_mac_addr(hw))
-+ DPRINTK(PROBE, ERR, "EEPROM Read Error\n");
-+ }
-+ /* don't block initalization here due to bad MAC address */
-+ memcpy(netdev->dev_addr, hw->mac_addr, netdev->addr_len);
-+ memcpy(netdev->perm_addr, hw->mac_addr, netdev->addr_len);
-
-- iegbe_read_part_num(&adapter->hw, &(adapter->part_num));
-+ if (!is_valid_ether_addr(netdev->perm_addr))
-+ DPRINTK(PROBE, ERR, "Invalid MAC Address\n");
-
-- iegbe_get_bus_info(&adapter->hw);
-+ iegbe_get_bus_info(hw);
-
- init_timer(&adapter->tx_fifo_stall_timer);
- adapter->tx_fifo_stall_timer.function = &iegbe_82547_tx_fifo_stall;
-- adapter->tx_fifo_stall_timer.data = (unsigned long) adapter;
-+ adapter->tx_fifo_stall_timer.data = (unsigned long)adapter;
-
- init_timer(&adapter->watchdog_timer);
- adapter->watchdog_timer.function = &iegbe_watchdog;
-@@ -906,75 +902,50 @@ iegbe_probe(struct pci_dev *pdev,
-
- init_timer(&adapter->phy_info_timer);
- adapter->phy_info_timer.function = &iegbe_update_phy_info;
-- adapter->phy_info_timer.data = (unsigned long) adapter;
--
-- INIT_WORK(&adapter->tx_timeout_task,
-- (void (*)(void *))iegbe_tx_timeout_task, netdev);
-+ adapter->phy_info_timer.data = (unsigned long)adapter;
-
-- /* we're going to reset, so assume we have no link for now */
--
-- netif_carrier_off(netdev);
-- netif_stop_queue(netdev);
-+ INIT_WORK(&adapter->reset_task, iegbe_reset_task);
-
-- iegbe_check_options(adapter);
-+ iegbe_check_options(adapter);
-
-- /* Initial Wake on LAN setting
-- * If APM wake is enabled in the EEPROM,
-- * enable the ACPI Magic Packet filter
-- */
-+ /* Initial Wake on LAN setting
-+ * If APM wake is enabled in the EEPROM,
-+ * enable the ACPI Magic Packet filter
-+ */
-
-- switch(adapter->hw.mac_type) {
-- case iegbe_82542_rev2_0:
-- case iegbe_82542_rev2_1:
-- case iegbe_82543:
-- break;
-- case iegbe_82544:
-- iegbe_read_eeprom(&adapter->hw,
-- EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data);
-- eeprom_apme_mask = E1000_EEPROM_82544_APM;
-- break;
-+ switch(adapter->hw.mac_type) {
-+ case iegbe_82542_rev2_0:
-+ case iegbe_82542_rev2_1:
-+ case iegbe_82543:
-+ break;
-+ case iegbe_82544:
-+ iegbe_read_eeprom(&adapter->hw,
-+ EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data);
-+ eeprom_apme_mask = E1000_EEPROM_82544_APM;
-+ break;
- case iegbe_icp_xxxx:
-- iegbe_read_eeprom(&adapter->hw,
-- EEPROM_INIT_CONTROL3_ICP_xxxx(adapter->bd_number),
-- 1, &eeprom_data);
-- eeprom_apme_mask = EEPROM_CTRL3_APME_ICP_xxxx;
-- break;
-- case iegbe_82546:
-- case iegbe_82546_rev_3:
-- if((E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_FUNC_1)
-- && (adapter->hw.media_type == iegbe_media_type_copper)) {
-- iegbe_read_eeprom(&adapter->hw,
-- EEPROM_INIT_CONTROL3_PORT_B, 1, &eeprom_data);
-- break;
-- }
-- /* Fall Through */
-- default:
-- iegbe_read_eeprom(&adapter->hw,
-- EEPROM_INIT_CONTROL3_PORT_A, 1, &eeprom_data);
-- break;
-- }
-+ iegbe_read_eeprom(&adapter->hw,
-+ EEPROM_INIT_CONTROL3_ICP_xxxx(adapter->bd_number),
-+ 1, &eeprom_data);
-+ eeprom_apme_mask = EEPROM_CTRL3_APME_ICP_xxxx;
-+ break;
-+ case iegbe_82546:
-+ case iegbe_82546_rev_3:
-+ if((E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_FUNC_1)
-+ && (adapter->hw.media_type == iegbe_media_type_copper)) {
-+ iegbe_read_eeprom(&adapter->hw,
-+ EEPROM_INIT_CONTROL3_PORT_B, 1, &eeprom_data);
-+ break;
-+ }
-+ /* Fall Through */
-+ default:
-+ iegbe_read_eeprom(&adapter->hw,
-+ EEPROM_INIT_CONTROL3_PORT_A, 1, &eeprom_data);
-+ break;
-+ }
- if(eeprom_data & eeprom_apme_mask) {
-- adapter->wol |= E1000_WUFC_MAG;
-+ adapter->wol |= E1000_WUFC_MAG;
- }
-- /* reset the hardware with the new settings */
-- iegbe_reset(adapter);
--
-- /* Let firmware know the driver has taken over */
-- switch(adapter->hw.mac_type) {
-- case iegbe_82571:
-- case iegbe_82572:
-- ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
-- E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
-- ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
-- break;
-- case iegbe_82573:
-- swsm = E1000_READ_REG(&adapter->hw, SWSM);
-- E1000_WRITE_REG(&adapter->hw, SWSM,
-- swsm | E1000_SWSM_DRV_LOAD);
-- break;
-- default:
-- break;
-- }
-
- /* The ICP_xxxx device has multiple, duplicate interrupt
- * registers, so disable all but the first one
-@@ -987,24 +958,40 @@ iegbe_probe(struct pci_dev *pdev,
- E1000_WRITE_REG(&adapter->hw, IMC2, ~0UL);
- }
-
-- strcpy(netdev->name, "eth%d");
-- if((err = register_netdev(netdev))) {
-- goto err_register;
-- }
-+ iegbe_reset(adapter);
-+ netif_carrier_off(netdev);
-+ netif_stop_queue(netdev);
-+ strcpy(netdev->name, "eth%d");
-+ err = register_netdev(netdev);
-+ if (err)
-+ goto err_register;
-+
- DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n");
-
-- cards_found++;
-- return 0;
-+ cards_found++;
-+ return 0;
-
- err_register:
--err_sw_init:
- err_eeprom:
-- iounmap(adapter->hw.hw_addr);
-+ if (!iegbe_check_phy_reset_block(hw))
-+ iegbe_phy_hw_reset(hw);
-+ if (hw->flash_address)
-+ iounmap(hw->flash_address);
-+ for (i = 0; i < adapter->num_rx_queues; i++)
-+ dev_put(&adapter->polling_netdev[i]);
-+ kfree(adapter->tx_ring);
-+ kfree(adapter->rx_ring);
-+ kfree(adapter->polling_netdev);
-+err_sw_init:
-+ iounmap(hw->hw_addr);
- err_ioremap:
-- free_netdev(netdev);
-+ free_netdev(netdev);
- err_alloc_etherdev:
-- pci_release_regions(pdev);
-- return err;
-+ pci_release_selected_regions(pdev, bars);
-+err_pci_reg:
-+err_dma:
-+ pci_disable_device(pdev);
-+ return err;
- }
-
- /**
-@@ -1020,64 +1007,36 @@ err_alloc_etherdev:
- static void __devexit
- iegbe_remove(struct pci_dev *pdev)
- {
-- struct net_device *netdev = pci_get_drvdata(pdev);
-- struct iegbe_adapter *adapter = netdev_priv(netdev);
-- uint32_t ctrl_ext;
-- uint32_t manc, swsm;
--#ifdef CONFIG_E1000_NAPI
-- int i;
--#endif
--
-- if(adapter->hw.mac_type >= iegbe_82540
-- && adapter->hw.mac_type != iegbe_icp_xxxx
-- && adapter->hw.media_type == iegbe_media_type_copper) {
-- manc = E1000_READ_REG(&adapter->hw, MANC);
-- if(manc & E1000_MANC_SMBUS_EN) {
-- manc |= E1000_MANC_ARP_EN;
-- E1000_WRITE_REG(&adapter->hw, MANC, manc);
-- }
-- }
--
-- switch(adapter->hw.mac_type) {
-- case iegbe_82571:
-- case iegbe_82572:
-- ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
-- E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
-- ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
-- break;
-- case iegbe_82573:
-- swsm = E1000_READ_REG(&adapter->hw, SWSM);
-- E1000_WRITE_REG(&adapter->hw, SWSM,
-- swsm & ~E1000_SWSM_DRV_LOAD);
-- break;
--
-- default:
-- break;
-- }
-+ struct net_device *netdev = pci_get_drvdata(pdev);
-+ struct iegbe_adapter *adapter = netdev_priv(netdev);
-+ uint32_t manc;
-+ int i;
-+
-+ if(adapter->hw.mac_type >= iegbe_82540
-+ && adapter->hw.mac_type != iegbe_icp_xxxx
-+ && adapter->hw.media_type == iegbe_media_type_copper) {
-+ manc = E1000_READ_REG(&adapter->hw, MANC);
-+ if(manc & E1000_MANC_SMBUS_EN) {
-+ manc |= E1000_MANC_ARP_EN;
-+ E1000_WRITE_REG(&adapter->hw, MANC, manc);
-+ }
-+ }
-
-- unregister_netdev(netdev);
--#ifdef CONFIG_E1000_NAPI
-- for (i = 0; i < adapter->num_queues; i++)
-+ unregister_netdev(netdev);
-+ for (i = 0x0; i < adapter->num_rx_queues; i++)
- dev_put(&adapter->polling_netdev[i]);
--#endif
-
- if(!iegbe_check_phy_reset_block(&adapter->hw)) {
-- iegbe_phy_hw_reset(&adapter->hw);
-+ iegbe_phy_hw_reset(&adapter->hw);
- }
-- kfree(adapter->tx_ring);
-- kfree(adapter->rx_ring);
--#ifdef CONFIG_E1000_NAPI
-- kfree(adapter->polling_netdev);
--#endif
-+ kfree(adapter->tx_ring);
-+ kfree(adapter->rx_ring);
-+ kfree(adapter->polling_netdev);
-
-- iounmap(adapter->hw.hw_addr);
-- pci_release_regions(pdev);
-+ iounmap(adapter->hw.hw_addr);
-+ pci_release_regions(pdev);
-
--#ifdef CONFIG_E1000_MQ
-- free_percpu(adapter->cpu_netdev);
-- free_percpu(adapter->cpu_tx_ring);
--#endif
-- free_netdev(netdev);
-+ free_netdev(netdev);
- }
-
- /**
-@@ -1092,118 +1051,78 @@ iegbe_remove(struct pci_dev *pdev)
- static int __devinit
- iegbe_sw_init(struct iegbe_adapter *adapter)
- {
-- struct iegbe_hw *hw = &adapter->hw;
-- struct net_device *netdev = adapter->netdev;
-- struct pci_dev *pdev = adapter->pdev;
--#ifdef CONFIG_E1000_NAPI
-- int i;
--#endif
-+ struct iegbe_hw *hw = &adapter->hw;
-+ struct net_device *netdev = adapter->netdev;
-+ struct pci_dev *pdev = adapter->pdev;
-+ int i;
-
-- /* PCI config space info */
-+ /* PCI config space info */
-
-- hw->vendor_id = pdev->vendor;
-- hw->device_id = pdev->device;
-- hw->subsystem_vendor_id = pdev->subsystem_vendor;
-- hw->subsystem_id = pdev->subsystem_device;
-+ hw->vendor_id = pdev->vendor;
-+ hw->device_id = pdev->device;
-+ hw->subsystem_vendor_id = pdev->subsystem_vendor;
-+ hw->subsystem_id = pdev->subsystem_device;
-
-- pci_read_config_byte(pdev, PCI_REVISION_ID, &hw->revision_id);
-+ pci_read_config_byte(pdev, PCI_REVISION_ID, &hw->revision_id);
-
-- pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word);
-+ pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word);
-
-- adapter->rx_buffer_len = E1000_RXBUFFER_2048;
-- adapter->rx_ps_bsize0 = E1000_RXBUFFER_256;
-- hw->max_frame_size = netdev->mtu +
-- ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
-- hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE;
-+ adapter->rx_buffer_len = E1000_RXBUFFER_2048;
-+ adapter->rx_ps_bsize0 = E1000_RXBUFFER_256;
-+ hw->max_frame_size = netdev->mtu +
-+ ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
-+ hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE;
-
-- /* identify the MAC */
-+ /* identify the MAC */
-
-- if(iegbe_set_mac_type(hw)) {
-+ if (iegbe_set_mac_type(hw)) {
- DPRINTK(PROBE, ERR, "Unknown MAC Type\n");
- return -EIO;
- }
-
-- /* initialize eeprom parameters */
--
-- if(iegbe_init_eeprom_params(hw)) {
-- E1000_ERR("EEPROM initialization failed\n");
-- return -EIO;
-- }
--
-- switch(hw->mac_type) {
-- default:
-- break;
-- case iegbe_82541:
-- case iegbe_82547:
-- case iegbe_82541_rev_2:
-- case iegbe_82547_rev_2:
-- hw->phy_init_script = 0x1;
-- break;
-- }
--
-- iegbe_set_media_type(hw);
-+ iegbe_set_media_type(hw);
-
-- hw->wait_autoneg_complete = FALSE;
-- hw->tbi_compatibility_en = TRUE;
-- hw->adaptive_ifs = TRUE;
-+ hw->wait_autoneg_complete = FALSE;
-+ hw->tbi_compatibility_en = TRUE;
-+ hw->adaptive_ifs = TRUE;
-
-- /* Copper options */
-+ /* Copper options */
-
-- if(hw->media_type == iegbe_media_type_copper
-+ if(hw->media_type == iegbe_media_type_copper
- || (hw->media_type == iegbe_media_type_oem
- && iegbe_oem_phy_is_copper(&adapter->hw))) {
-- hw->mdix = AUTO_ALL_MODES;
-- hw->disable_polarity_correction = FALSE;
-- hw->master_slave = E1000_MASTER_SLAVE;
-- }
-+ hw->mdix = AUTO_ALL_MODES;
-+ hw->disable_polarity_correction = FALSE;
-+ hw->master_slave = E1000_MASTER_SLAVE;
-+ }
-
--#ifdef CONFIG_E1000_MQ
-- /* Number of supported queues */
-- switch (hw->mac_type) {
-- case iegbe_82571:
-- case iegbe_82572:
-- adapter->num_queues = 0x2;
-- break;
-- default:
-- adapter->num_queues = 0x1;
-- break;
-- }
-- adapter->num_queues = min(adapter->num_queues, num_online_cpus());
--#else
-- adapter->num_queues = 0x1;
--#endif
-+ adapter->num_tx_queues = 0x1;
-+ adapter->num_rx_queues = 0x1;
-
- if (iegbe_alloc_queues(adapter)) {
- DPRINTK(PROBE, ERR, "Unable to allocate memory for queues\n");
- return -ENOMEM;
- }
-
--#ifdef CONFIG_E1000_NAPI
-- for (i = 0; i < adapter->num_queues; i++) {
-+ for (i = 0; i < adapter->num_rx_queues; i++) {
- adapter->polling_netdev[i].priv = adapter;
-- adapter->polling_netdev[i].poll = &iegbe_clean;
-- adapter->polling_netdev[i].weight = 0x40;
- dev_hold(&adapter->polling_netdev[i]);
- set_bit(__LINK_STATE_START, &adapter->polling_netdev[i].state);
- }
--#endif
--
--#ifdef CONFIG_E1000_MQ
-- iegbe_setup_queue_mapping(adapter);
--#endif
-+ spin_lock_init(&adapter->tx_queue_lock);
-
- /*
-- * for ICP_XXXX style controllers, it is necessary to keep
-- * track of the last known state of the link to determine if
-- * the link experienced a change in state when iegbe_watchdog
-- * fires
-- */
-- adapter->hw.icp_xxxx_is_link_up = FALSE;
-+ * for ICP_XXXX style controllers, it is necessary to keep
-+ * track of the last known state of the link to determine if
-+ * the link experienced a change in state when iegbe_watchdog
-+ * fires
-+ */
-+ adapter->hw.icp_xxxx_is_link_up = FALSE;
-
-- atomic_set(&adapter->irq_sem, 1);
-- spin_lock_init(&adapter->stats_lock);
-+ spin_lock_init(&adapter->stats_lock);
-
-- return 0;
-+ set_bit(__E1000_DOWN, &adapter->flags);
-+ return 0x0;
- }
-
- /**
-@@ -1218,71 +1137,31 @@ iegbe_sw_init(struct iegbe_adapter *adap
- static int __devinit
- iegbe_alloc_queues(struct iegbe_adapter *adapter)
- {
-- int size;
-
-- size = sizeof(struct iegbe_tx_ring) * adapter->num_queues;
-- adapter->tx_ring = kmalloc(size, GFP_KERNEL);
-- if (!adapter->tx_ring){
-+
-+ adapter->tx_ring = kcalloc(adapter->num_tx_queues,
-+ sizeof(struct iegbe_tx_ring), GFP_KERNEL);
-+ if (!adapter->tx_ring)
- return -ENOMEM;
-- }
-- memset(adapter->tx_ring, 0, size);
-
-- size = sizeof(struct iegbe_rx_ring) * adapter->num_queues;
-- adapter->rx_ring = kmalloc(size, GFP_KERNEL);
-+ adapter->rx_ring = kcalloc(adapter->num_rx_queues,
-+ sizeof(struct iegbe_rx_ring), GFP_KERNEL);
- if (!adapter->rx_ring) {
- kfree(adapter->tx_ring);
- return -ENOMEM;
- }
-- memset(adapter->rx_ring, 0, size);
-
--#ifdef CONFIG_E1000_NAPI
-- size = sizeof(struct net_device) * adapter->num_queues;
-- adapter->polling_netdev = kmalloc(size, GFP_KERNEL);
-+ adapter->polling_netdev = kcalloc(adapter->num_rx_queues,
-+ sizeof(struct net_device),
-+ GFP_KERNEL);
- if (!adapter->polling_netdev) {
- kfree(adapter->tx_ring);
- kfree(adapter->rx_ring);
- return -ENOMEM;
- }
-- memset(adapter->polling_netdev, 0, size);
--#endif
--
-- return E1000_SUCCESS;
--}
-
--#ifdef CONFIG_E1000_MQ
--static void __devinit
--iegbe_setup_queue_mapping(struct iegbe_adapter *adapter)
--{
-- int i, cpu;
--
-- adapter->rx_sched_call_data.func = iegbe_rx_schedule;
-- adapter->rx_sched_call_data.info = adapter->netdev;
-- cpus_clear(adapter->rx_sched_call_data.cpumask);
--
-- adapter->cpu_netdev = alloc_percpu(struct net_device *);
-- adapter->cpu_tx_ring = alloc_percpu(struct iegbe_tx_ring *);
--
-- lock_cpu_hotplug();
-- i = 0;
-- for_each_online_cpu(cpu) {
-- *per_cpu_ptr(adapter->cpu_tx_ring, cpu) =
-- &adapter->tx_ring[i % adapter->num_queues];
-- /* This is incomplete because we'd like to assign separate
-- * physical cpus to these netdev polling structures and
-- * avoid saturating a subset of cpus.
-- */
-- if (i < adapter->num_queues) {
-- *per_cpu_ptr(adapter->cpu_netdev, cpu) =
-- &adapter->polling_netdev[i];
-- adapter->cpu_for_queue[i] = cpu;
-- } else {
-- *per_cpu_ptr(adapter->cpu_netdev, cpu) = NULL;
-- }
-- i++;
-- }
-- unlock_cpu_hotplug();
-+ return E1000_SUCCESS;
- }
--#endif
-
- /**
- * iegbe_open - Called when a network interface is made active
-@@ -1300,40 +1179,62 @@ iegbe_setup_queue_mapping(struct iegbe_a
- static int
- iegbe_open(struct net_device *netdev)
- {
-- struct iegbe_adapter *adapter = netdev_priv(netdev);
-- int err;
-+ struct iegbe_adapter *adapter = netdev_priv(netdev);
-+ struct iegbe_hw *hw = &adapter->hw;
-+ int err;
-+
-
-+ /* allocate receive descriptors */
-+ if (test_bit(__E1000_TESTING, &adapter->flags))
-+ return -EBUSY;
-
-- /* allocate receive descriptors */
-+ /* allocate transmit descriptors */
-+ err = iegbe_setup_all_tx_resources(adapter);
-+ if (err)
-+ goto err_setup_tx;
-
-- if ((err = iegbe_setup_all_rx_resources(adapter))) {
-+ err = iegbe_setup_all_rx_resources(adapter);
-+ if (err)
- goto err_setup_rx;
-- }
-- /* allocate transmit descriptors */
-- if ((err = iegbe_setup_all_tx_resources(adapter))) {
-- goto err_setup_tx;
-- }
-- if ((err = iegbe_up(adapter))) {
-- goto err_up;
-- }
--#ifdef NETIF_F_HW_VLAN_TX
-- adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
-- if ((adapter->hw.mng_cookie.status &
-- E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) {
-- iegbe_update_mng_vlan(adapter);
-- }
--#endif
-
-- return E1000_SUCCESS;
-+ iegbe_power_up_phy(adapter);
-+ adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
-+ if ((hw->mng_cookie.status &
-+ E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) {
-+ iegbe_update_mng_vlan(adapter);
-+ }
-+
-+ /* before we allocate an interrupt, we must be ready to handle it.
-+ * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt
-+ * as soon as we call pci_request_irq, so we have to setup our
-+ * clean_rx handler before we do so. */
-+ iegbe_configure(adapter);
-+ err = iegbe_request_irq(adapter);
-+ if (err)
-+ goto err_req_irq;
-
--err_up:
-- iegbe_free_all_tx_resources(adapter);
--err_setup_tx:
-- iegbe_free_all_rx_resources(adapter);
-+ /* From here on the code is the same as iegbe_up() */
-+ clear_bit(__E1000_DOWN, &adapter->flags);
-+
-+ napi_enable(&adapter->napi);
-+
-+ iegbe_irq_enable(adapter);
-+
-+ netif_start_queue(netdev);
-+
-+ /* fire a link status change interrupt to start the watchdog */
-+
-+ return E1000_SUCCESS;
-+
-+err_req_irq:
-+ iegbe_power_down_phy(adapter);
-+ iegbe_free_all_rx_resources(adapter);
- err_setup_rx:
-- iegbe_reset(adapter);
-+ iegbe_free_all_tx_resources(adapter);
-+err_setup_tx:
-+ iegbe_reset(adapter);
-
-- return err;
-+ return err;
- }
-
- /**
-@@ -1348,22 +1249,25 @@ err_setup_rx:
- * hardware, and all transmit and receive resources are freed.
- **/
-
--static int
--iegbe_close(struct net_device *netdev)
-+static int iegbe_close(struct net_device *netdev)
- {
-- struct iegbe_adapter *adapter = netdev_priv(netdev);
--
-- iegbe_down(adapter);
--
-- iegbe_free_all_tx_resources(adapter);
-- iegbe_free_all_rx_resources(adapter);
-+ struct iegbe_adapter *adapter = netdev_priv(netdev);
-+ struct iegbe_hw *hw = &adapter->hw;
-
--#ifdef NETIF_F_HW_VLAN_TX
-- if((adapter->hw.mng_cookie.status &
-- E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) {
-+ WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags));
-+ iegbe_down(adapter);
-+ iegbe_power_down_phy(adapter);
-+ iegbe_free_irq(adapter);
-+
-+ iegbe_free_all_tx_resources(adapter);
-+ iegbe_free_all_rx_resources(adapter);
-+
-+ if ((hw->mng_cookie.status &
-+ E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
-+ !(adapter->vlgrp &&
-+ vlan_group_get_device(adapter->vlgrp, adapter->mng_vlan_id))) {
- iegbe_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
- }
--#endif
- return 0;
- }
-
-@@ -1375,19 +1279,19 @@ iegbe_close(struct net_device *netdev)
- **/
- static inline boolean_t
- iegbe_check_64k_bound(struct iegbe_adapter *adapter,
-- void *start, unsigned long len)
-+ void *start, unsigned long len)
- {
-- unsigned long begin = (unsigned long) start;
-- unsigned long end = begin + len;
-+ unsigned long begin = (unsigned long) start;
-+ unsigned long end = begin + len;
-
-- /* First rev 82545 and 82546 need to not allow any memory
-- * write location to cross 64k boundary due to errata 23 */
-- if(adapter->hw.mac_type == iegbe_82545 ||
-- adapter->hw.mac_type == iegbe_82546) {
-- return ((begin ^ (end - 1)) >> 0x10) != 0 ? FALSE : TRUE;
-- }
-+ /* First rev 82545 and 82546 need to not allow any memory
-+ * write location to cross 64k boundary due to errata 23 */
-+ if(adapter->hw.mac_type == iegbe_82545 ||
-+ adapter->hw.mac_type == iegbe_82546) {
-+ return ((begin ^ (end - 1)) >> 0x10) != 0x0 ? FALSE : TRUE;
-+ }
-
-- return TRUE;
-+ return TRUE;
- }
-
- /**
-@@ -1398,102 +1302,98 @@ iegbe_check_64k_bound(struct iegbe_adapt
- * Return 0 on success, negative on failure
- **/
-
--int
--iegbe_setup_tx_resources(struct iegbe_adapter *adapter,
-+static int iegbe_setup_tx_resources(struct iegbe_adapter *adapter,
- struct iegbe_tx_ring *txdr)
- {
-- struct pci_dev *pdev = adapter->pdev;
-- int size;
-+ struct pci_dev *pdev = adapter->pdev;
-+ int size;
-
-- size = sizeof(struct iegbe_buffer) * txdr->count;
-- txdr->buffer_info = vmalloc(size);
-- if (!txdr->buffer_info) {
-- DPRINTK(PROBE, ERR,
-- "Unable to allocate memory for the transmit descriptor ring\n");
-- return -ENOMEM;
-- }
-+ size = sizeof(struct iegbe_buffer) * txdr->count;
-+ txdr->buffer_info = vmalloc(size);
-+ if (!txdr->buffer_info) {
-+ DPRINTK(PROBE, ERR,
-+ "Unable to allocate memory for the transmit descriptor ring\n");
-+ return -ENOMEM;
-+ }
- memset(txdr->buffer_info, 0, size);
-- memset(&txdr->previous_buffer_info, 0, sizeof(struct iegbe_buffer));
-
-- /* round up to nearest 4K */
-+ /* round up to nearest 4K */
-
-- txdr->size = txdr->count * sizeof(struct iegbe_tx_desc);
-- E1000_ROUNDUP(txdr->size, 0x1000);
-+ txdr->size = txdr->count * sizeof(struct iegbe_tx_desc);
-+ txdr->size = ALIGN(txdr->size, 4096);
-
-- txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
-- if (!txdr->desc) {
-+ txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
-+ if (!txdr->desc) {
- setup_tx_desc_die:
-- vfree(txdr->buffer_info);
-- DPRINTK(PROBE, ERR,
-- "Unable to allocate memory for the transmit descriptor ring\n");
-- return -ENOMEM;
-- }
--
-- /* Fix for errata 23, can't cross 64kB boundary */
-- if (!iegbe_check_64k_bound(adapter, txdr->desc, txdr->size)) {
-- void *olddesc = txdr->desc;
-- dma_addr_t olddma = txdr->dma;
-- DPRINTK(TX_ERR, ERR, "txdr align check failed: %u bytes "
-- "at %p\n", txdr->size, txdr->desc);
-- /* Try again, without freeing the previous */
-- txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
-- /* Failed allocation, critical failure */
-- if (!txdr->desc) {
-- pci_free_consistent(pdev, txdr->size, olddesc, olddma);
-- goto setup_tx_desc_die;
-- }
-+ vfree(txdr->buffer_info);
-+ DPRINTK(PROBE, ERR,
-+ "Unable to allocate memory for the transmit descriptor ring\n");
-+ return -ENOMEM;
-+ }
-+
-+ /* Fix for errata 23, can't cross 64kB boundary */
-+ if (!iegbe_check_64k_bound(adapter, txdr->desc, txdr->size)) {
-+ void *olddesc = txdr->desc;
-+ dma_addr_t olddma = txdr->dma;
-+ DPRINTK(TX_ERR, ERR, "txdr align check failed: %u bytes "
-+ "at %p\n", txdr->size, txdr->desc);
-+ /* Try again, without freeing the previous */
-+ txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
-+ /* Failed allocation, critical failure */
-+ if (!txdr->desc) {
-+ pci_free_consistent(pdev, txdr->size, olddesc, olddma);
-+ goto setup_tx_desc_die;
-+ }
-
-- if (!iegbe_check_64k_bound(adapter, txdr->desc, txdr->size)) {
-- /* give up */
-- pci_free_consistent(pdev, txdr->size, txdr->desc,
-- txdr->dma);
-- pci_free_consistent(pdev, txdr->size, olddesc, olddma);
-- DPRINTK(PROBE, ERR,
-- "Unable to allocate aligned memory "
-- "for the transmit descriptor ring\n");
-- vfree(txdr->buffer_info);
-- return -ENOMEM;
-- } else {
-- /* Free old allocation, new allocation was successful */
-- pci_free_consistent(pdev, txdr->size, olddesc, olddma);
-- }
-- }
-+ if (!iegbe_check_64k_bound(adapter, txdr->desc, txdr->size)) {
-+ /* give up */
-+ pci_free_consistent(pdev, txdr->size, txdr->desc,
-+ txdr->dma);
-+ pci_free_consistent(pdev, txdr->size, olddesc, olddma);
-+ DPRINTK(PROBE, ERR,
-+ "Unable to allocate aligned memory "
-+ "for the transmit descriptor ring\n");
-+ vfree(txdr->buffer_info);
-+ return -ENOMEM;
-+ } else {
-+ /* Free old allocation, new allocation was successful */
-+ pci_free_consistent(pdev, txdr->size, olddesc, olddma);
-+ }
-+ }
- memset(txdr->desc, 0, txdr->size);
-
- txdr->next_to_use = 0;
- txdr->next_to_clean = 0;
-- spin_lock_init(&txdr->tx_lock);
-+ spin_lock_init(&txdr->tx_lock);
-
- return 0;
- }
-
- /**
- * iegbe_setup_all_tx_resources - wrapper to allocate Tx resources
-- * (Descriptors) for all queues
-+ * (Descriptors) for all queues
- * @adapter: board private structure
- *
-- * If this function returns with an error, then it's possible one or
-- * more of the rings is populated (while the rest are not). It is the
-- * callers duty to clean those orphaned rings.
-- *
- * Return 0 on success, negative on failure
- **/
-
--int
--iegbe_setup_all_tx_resources(struct iegbe_adapter *adapter)
-+int iegbe_setup_all_tx_resources(struct iegbe_adapter *adapter)
- {
- int i, err = 0;
-
-- for (i = 0; i < adapter->num_queues; i++) {
-+ for (i = 0; i < adapter->num_tx_queues; i++) {
- err = iegbe_setup_tx_resources(adapter, &adapter->tx_ring[i]);
- if (err) {
- DPRINTK(PROBE, ERR,
- "Allocation for Tx Queue %u failed\n", i);
-+ for (i-- ; i >= 0; i--)
-+ iegbe_free_tx_resources(adapter,
-+ &adapter->tx_ring[i]);
- break;
- }
- }
-
-- return err;
-+ return err;
- }
-
- /**
-@@ -1512,113 +1412,108 @@ iegbe_configure_tx(struct iegbe_adapter
-
- /* Setup the HW Tx Head and Tail descriptor pointers */
-
-- switch (adapter->num_queues) {
-+ switch (adapter->num_tx_queues) {
- case 0x2:
- tdba = adapter->tx_ring[0x1].dma;
- tdlen = adapter->tx_ring[0x1].count *
-- sizeof(struct iegbe_tx_desc);
-- E1000_WRITE_REG(hw, TDBAL1, (tdba & 0x00000000ffffffffULL));
-+ sizeof(struct iegbe_tx_desc);
-+ E1000_WRITE_REG(hw, TDBAL1, (tdba & 0x00000000ffffffffULL));
- E1000_WRITE_REG(hw, TDBAH1, (tdba >> 0x20));
-- E1000_WRITE_REG(hw, TDLEN1, tdlen);
-- E1000_WRITE_REG(hw, TDH1, 0);
-- E1000_WRITE_REG(hw, TDT1, 0);
-+ E1000_WRITE_REG(hw, TDLEN1, tdlen);
-+ E1000_WRITE_REG(hw, TDH1, 0x0);
-+ E1000_WRITE_REG(hw, TDT1, 0x0);
- adapter->tx_ring[0x1].tdh = E1000_TDH1;
- adapter->tx_ring[0x1].tdt = E1000_TDT1;
-- /* Fall Through */
-+ /* Fall Through */
- case 0x1:
-- default:
-- tdba = adapter->tx_ring[0].dma;
-- tdlen = adapter->tx_ring[0].count *
-- sizeof(struct iegbe_tx_desc);
-- E1000_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL));
-+ default:
-+ tdba = adapter->tx_ring[0x0].dma;
-+ tdlen = adapter->tx_ring[0x0].count *
-+ sizeof(struct iegbe_tx_desc);
-+ E1000_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL));
- E1000_WRITE_REG(hw, TDBAH, (tdba >> 0x20));
-- E1000_WRITE_REG(hw, TDLEN, tdlen);
-- E1000_WRITE_REG(hw, TDH, 0);
-- E1000_WRITE_REG(hw, TDT, 0);
-- adapter->tx_ring[0].tdh = E1000_TDH;
-- adapter->tx_ring[0].tdt = E1000_TDT;
-- break;
-- }
--
-- /* Set the default values for the Tx Inter Packet Gap timer */
--
-- switch (hw->mac_type) {
-- case iegbe_82542_rev2_0:
-- case iegbe_82542_rev2_1:
-- tipg = DEFAULT_82542_TIPG_IPGT;
-- tipg |= DEFAULT_82542_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT;
-- tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT;
-- break;
-- default:
-- switch(hw->media_type) {
-- case iegbe_media_type_fiber:
-- case iegbe_media_type_internal_serdes:
-- tipg = DEFAULT_82543_TIPG_IPGT_FIBER;
-- break;
-- case iegbe_media_type_copper:
-- tipg = DEFAULT_82543_TIPG_IPGT_COPPER;
-- break;
-- case iegbe_media_type_oem:
-- default:
-+ E1000_WRITE_REG(hw, TDLEN, tdlen);
-+ E1000_WRITE_REG(hw, TDH, 0x0);
-+ E1000_WRITE_REG(hw, TDT, 0x0);
-+ adapter->tx_ring[0x0].tdh = E1000_TDH;
-+ adapter->tx_ring[0x0].tdt = E1000_TDT;
-+ break;
-+ }
-+
-+ /* Set the default values for the Tx Inter Packet Gap timer */
-+
-+ switch (hw->mac_type) {
-+ case iegbe_82542_rev2_0:
-+ case iegbe_82542_rev2_1:
-+ tipg = DEFAULT_82542_TIPG_IPGT;
-+ tipg |= DEFAULT_82542_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT;
-+ tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT;
-+ break;
-+ default:
-+ switch(hw->media_type) {
-+ case iegbe_media_type_fiber:
-+ case iegbe_media_type_internal_serdes:
-+ tipg = DEFAULT_82543_TIPG_IPGT_FIBER;
-+ break;
-+ case iegbe_media_type_copper:
-+ tipg = DEFAULT_82543_TIPG_IPGT_COPPER;
-+ break;
-+ case iegbe_media_type_oem:
-+ default:
- tipg = (0xFFFFFFFFUL >> (sizeof(tipg)*0x8 -
- E1000_TIPG_IPGR1_SHIFT))
-- & iegbe_oem_get_tipg(&adapter->hw);
-- break;
-- }
-- tipg |= DEFAULT_82543_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT;
-- tipg |= DEFAULT_82543_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT;
-- }
-- E1000_WRITE_REG(hw, TIPG, tipg);
-+ & iegbe_oem_get_tipg(&adapter->hw);
-+ break;
-+ }
-+ tipg |= DEFAULT_82543_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT;
-+ tipg |= DEFAULT_82543_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT;
-+ }
-+ E1000_WRITE_REG(hw, TIPG, tipg);
-
-- /* Set the Tx Interrupt Delay register */
-+ /* Set the Tx Interrupt Delay register */
-
-- E1000_WRITE_REG(hw, TIDV, adapter->tx_int_delay);
-+ E1000_WRITE_REG(hw, TIDV, adapter->tx_int_delay);
- if (hw->mac_type >= iegbe_82540) {
-- E1000_WRITE_REG(hw, TADV, adapter->tx_abs_int_delay);
-+ E1000_WRITE_REG(hw, TADV, adapter->tx_abs_int_delay);
- }
-- /* Program the Transmit Control Register */
-+ /* Program the Transmit Control Register */
-
-- tctl = E1000_READ_REG(hw, TCTL);
-+ tctl = E1000_READ_REG(hw, TCTL);
-
-- tctl &= ~E1000_TCTL_CT;
-- tctl |= E1000