packages: clean up the package folder

Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 37007
This commit is contained in:
John Crispin
2013-06-21 16:54:37 +00:00
parent 44b1688e6c
commit 4ebf19b48f
603 changed files with 28 additions and 28 deletions

View File

@@ -0,0 +1,258 @@
#
# Copyright (C) 2007-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:=acx-mac80211
PKG_REV:=v2012-09-23-WIP
PKG_VERSION:=20121004
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=git://acx100.git.sourceforge.net/gitroot/acx100/acx-mac80211
PKG_SOURCE_PROTO:=git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_MIRROR_MD5SUM:=8d6bc84239059fd938ff4d989579f622
PKG_BUILD_DEPENDS:=mac80211
PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_MAC80211_DEBUGFS \
CONFIG_PACKAGE_MAC80211_MESH \
include $(INCLUDE_DIR)/package.mk
define KernelPackage/acx-mac80211
SUBMENU:=Wireless Drivers
TITLE:=ACX1xx mac80211 driver
DEPENDS:=@(PCI_SUPPORT||TARGET_ar7) @mipsel +kmod-mac80211
FILES:=$(PKG_BUILD_DIR)/acx-mac80211.ko
AUTOLOAD:=$(call AutoLoad,50,acx-mac80211)
MAINTAINER:=Florian Fainelli <florian@openwrt.org>
MENU:=1
endef
define KernelPackage/acx-mac80211/config
menu "Configuration"
depends on PACKAGE_kmod-acx-mac80211
config ACX_ID_0D
bool "ACX1xx Radio ID 0D firmware"
help
Download and install firmware for:
ACX1xx cards with Radio ID 0D into /lib/firmware.
config ACX_ID_11
bool "ACX1xx Radio ID 11 firmware"
help
Download and install firmware for:
ACX1xx cards with Radio ID 11 into /lib/firmware.
config ACX_ID_15
bool "ACX1xx Radio ID 15 firmware"
help
Download and install firmware for:
ACX1xx cards with Radio ID 15 into /lib/firmware.
config ACX_ID_16
bool "ACX1xx Radio ID 16 firmware"
default y
help
Download and install firmware for:
ACX1xx cards with Radio ID 16 into /lib/firmware.
choice
prompt "ACX111 firmware version"
depends on ACX_ID_16
default ACX_DEFAULT if !TARGET_adm5120
default ACX_1_2_1_34 if TARGET_adm5120
help
This option allows you to select the version of the acx firmware.
config ACX_DEFAULT
bool "Default"
help
Default firmware for ACX111 devices.
If unsure, select this.
config ACX_1_2_1_34
bool "1.2.1_34"
help
1.2.1_34 firmware for ACX111 devices. Works with Zyxel P-334WT.
If unsure, select the "default" firmware.
endchoice
config ACX_ID_17
bool "ACX1xx Radio ID 17 firmware"
help
Download and install firmware for:
ACX1xx cards with Radio ID 17 into /lib/firmware.
config ACX_ID_19
bool "ACX1xx Radio ID 19 firmware"
default y
help
Download and install firmware for:
ACX1xx cards with Radio ID 19 into /lib/firmware.
config ACX_ID_1B
bool "ACX1xx Radio ID 1B firmware"
help
Download and install firmware for:
ACX1xx cards with Radio ID 1b into /lib/firmware.
endmenu
endef
define KernelPackage/acx-mac80211/description
Driver for acx111 cards (mac80211 version)
endef
define Download/tiacx100
FILE:=tiacx100
URL:=http://acx100.erley.org/fw/acx100_1.9.8.b/
MD5SUM:=24a54fd30f7658fcbffc825b0dd7aa5b
endef
define Download/tiacx100r0d
FILE:=tiacx100r0D
URL:=http://acx100.erley.org/fw/acx100_1.9.8.b/
MD5SUM:=1c7413e7b0be4ef7d1e424a132e17fab
endef
define Download/tiacx100r11
FILE:=tiacx100r11
URL:=http://acx100.erley.org/fw/acx100_1.9.8.b/
MD5SUM:=a150750ad33c512edc4afee5270b37cb
endef
define Download/tiacx100r15
FILE:=tiacx100r15
URL:=http://acx100.erley.org/fw/acx100_1.9.8.b/
MD5SUM:=c99d01d4fcf0d6cc00441aff60690be4
endef
define Download/tiacx111c16
FILE:=tiacx111c16
URL:=http://acx100.erley.org/fw/acx111_2.3.1.31/
MD5SUM:=7026826460376f6b174f9225bd7781b9
endef
define Download/tiacx111c16_1
FILE:=tiacx111c16_1.2.1_34
URL:=http://sites.google.com/site/atorkhov/files/
MD5SUM:=fcd07de4b25e1d2aaf3b78b27c5b7ee9
endef
define Download/tiacx111c17
FILE:=tiacx111c17
URL:=http://acx100.erley.org/fw/acx111_2.3.1.31/
MD5SUM:=95552544ca6d2b4e8c6aeb80b8ae7fdf
endef
define Download/tiacx111c19
FILE:=tiacx111c19
URL:=http://acx100.erley.org/fw/acx111_2.3.1.31/
MD5SUM:=a1fa9681e297b4e36e257090fc12265a
endef
define Download/tiacx111usbc1b
FILE:=tiacx111usbc1B
URL:=http://acx100.erley.org/fw/acx111_2.4.0.70-USB/
MD5SUM:=c4edecd912b2417779d0b65e3a7dc86d
endef
PKG_EXTRA_KCONFIG:= \
CONFIG_ACX_MAC80211=m \
CONFIG_ACX_MAC80211_PCI=m \
PKG_EXTRA_CFLAGS:= \
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \
$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \
$(if $(CONFIG_LEDS_TRIGGERS), -DCONFIG_MAC80211_LEDS -DCONFIG_LEDS_TRIGGERS) \
$(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS), -DCONFIG_CFG80211_DEBUGFS -DCONFIG_MAC80211_DEBUGFS) \
$(if $(CONFIG_PACKAGE_MAC80211_MESH), -DCONFIG_MAC80211_MESH) \
-DBACKPORTED_KERNEL_NAME=\\\"$(PKG_SOURCE)\\\" \
-DBACKPORTED_KERNEL_VERSION=\\\"$(PKG_SOURCE_VERSION)\\\" \
-DBACKPORTS_VERSION=\\\"unknown\\\" \
define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" \
ARCH="$(LINUX_KARCH)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
SUBDIRS="$(PKG_BUILD_DIR)" \
$(PKG_EXTRA_KCONFIG) \
EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(3,10,0)\"" \
LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi -I$(STAGING_DIR)/usr/include/mac80211-backport \
-I$(STAGING_DIR)/usr/include/mac80211/uapi -I$(STAGING_DIR)/usr/include/mac80211 \
-I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/$(LINUX_UAPI_DIR) \
-I$(LINUX_DIR)/include/generated/uapi/ -Iarch/$(LINUX_KARCH)/include \
-Iarch/$(LINUX_KARCH)/include/$(LINUX_UAPI_DIR) \
-include generated/autoconf.h \
-include backport/backport.h " \
V="$(V)" \
modules
endef
define Build/Configure
endef
define KernelPackage/acx-mac80211/install
$(INSTALL_DIR) $(1)/lib/firmware
ifneq ($(CONFIG_ACX_ID_0D)$(CONFIG_ACX_ID_11)$(CONFIG_ACX_ID_15),)
$(INSTALL_DATA) $(DL_DIR)/tiacx100 $(1)/lib/firmware/
endif
ifneq ($(CONFIG_ACX_ID_0D),)
$(INSTALL_DATA) $(DL_DIR)/tiacx100r0D $(1)/lib/firmware/
endif
ifneq ($(CONFIG_ACX_ID_11),)
$(INSTALL_DATA) $(DL_DIR)/tiacx100r11 $(1)/lib/firmware/
endif
ifneq ($(CONFIG_ACX_ID_15),)
$(INSTALL_DATA) $(DL_DIR)/tiacx100r15 $(1)/lib/firmware/
endif
ifneq ($(CONFIG_ACX_DEFAULT),)
$(INSTALL_DATA) $(DL_DIR)/tiacx111c16 $(1)/lib/firmware/
endif
ifneq ($(CONFIG_ACX_1_2_1_34),)
$(INSTALL_DATA) $(DL_DIR)/tiacx111c16_1.2.1_34 $(1)/lib/firmware/tiacx111c16
endif
ifneq ($(CONFIG_ACX_ID_17),)
$(INSTALL_DATA) $(DL_DIR)/tiacx111c17 $(1)/lib/firmware/
endif
ifneq ($(CONFIG_ACX_ID_19),)
$(INSTALL_DATA) $(DL_DIR)/tiacx111c19 $(1)/lib/firmware/
endif
ifneq ($(CONFIG_ACX_ID_1B),)
$(INSTALL_DATA) $(DL_DIR)/tiacx111usbc1B $(1)/lib/firmware/
endif
endef
$(eval $(call KernelPackage,acx-mac80211))
$(eval $(call Download,tiacx100))
$(eval $(call Download,tiacx100r0d))
$(eval $(call Download,tiacx100r11))
$(eval $(call Download,tiacx100r15))
$(eval $(call Download,tiacx111c16))
$(eval $(call Download,tiacx111c16_1))
$(eval $(call Download,tiacx111c17))
$(eval $(call Download,tiacx111c19))
$(eval $(call Download,tiacx111usbc1b))

View File

@@ -0,0 +1,30 @@
--- a/main.h
+++ b/main.h
@@ -44,8 +44,11 @@ int acx_e_op_get_tx_stats(struct ieee802
#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(2, 6, 39)
int acx_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
-#else
+#elif CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(3, 7, 0)
void acx_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
+#else
+void acx_op_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
+ struct sk_buff *skb);
#endif
--- a/main.c
+++ b/main.c
@@ -1024,7 +1024,12 @@ int acx_e_op_get_tx_stats(struct ieee802
* acx_compat, and hiding this #if/else. OTOH, inclusion doesnt care
* about old kernels
*/
+#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(3, 7, 0)
OP_TX_RET_TYPE acx_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
+#else
+void acx_op_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
+ struct sk_buff *skb)
+#endif
{
acx_device_t *adev = ieee2adev(hw);

View File

@@ -0,0 +1,85 @@
--- a/mem.c
+++ b/mem.c
@@ -2002,7 +2002,7 @@ int acx100mem_ioctl_set_phy_amp_bias(str
* configuration
* id - ptr to the device id entry that matched this device
*/
-static int __devinit acxmem_probe(struct platform_device *pdev)
+static int acxmem_probe(struct platform_device *pdev)
{
acx_device_t *adev = NULL;
const char *chip_name;
@@ -2268,7 +2268,7 @@ done:
* pdev - ptr to PCI device structure containing info about pci
* configuration
*/
-static int __devexit acxmem_remove(struct platform_device *pdev)
+static int acxmem_remove(struct platform_device *pdev)
{
struct ieee80211_hw *hw = (struct ieee80211_hw *)
platform_get_drvdata(pdev);
@@ -2470,7 +2470,7 @@ static struct platform_driver acxmem_dri
.name = "acx-mem",
},
.probe = acxmem_probe,
- .remove = __devexit_p(acxmem_remove),
+ .remove = acxmem_remove,
#ifdef CONFIG_PM
.suspend = acxmem_e_suspend,
--- a/pci.c
+++ b/pci.c
@@ -982,7 +982,7 @@ int acx100pci_ioctl_set_phy_amp_bias(str
* id - ptr to the device id entry that matched this device
*/
#ifdef CONFIG_PCI
-static int __devinit acxpci_probe(struct pci_dev *pdev,
+static int acxpci_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
acx111_ie_configoption_t co;
@@ -1346,7 +1346,7 @@ done:
*
* pdev - ptr to PCI device structure containing info about pci configuration
*/
-static void __devexit acxpci_remove(struct pci_dev *pdev)
+static void acxpci_remove(struct pci_dev *pdev)
{
struct ieee80211_hw *hw
= (struct ieee80211_hw *) pci_get_drvdata(pdev);
@@ -1537,7 +1537,7 @@ static int acxpci_e_resume(struct pci_de
*/
#if 0 // use later ?
-static struct acxpci_device_info acxpci_info_tbl[] __devinitdata = {
+static struct acxpci_device_info acxpci_info_tbl[] = {
[0] = {
.part_name = "acx111",
.helper_image = "tiacx1111r16", // probly wrong !!
@@ -1564,7 +1564,7 @@ static struct pci_driver acxpci_driver =
.name = "acx_pci",
.id_table = acxpci_id_tbl,
.probe = acxpci_probe,
- .remove = __devexit_p(acxpci_remove),
+ .remove = acxpci_remove,
#ifdef CONFIG_PM
.suspend = acxpci_e_suspend,
.resume = acxpci_e_resume
@@ -1662,7 +1662,7 @@ static struct vlynq_device_id acx_vlynq_
};
-static __devinit int vlynq_probe(struct vlynq_device *vdev,
+static int vlynq_probe(struct vlynq_device *vdev,
struct vlynq_device_id *id)
{
int result = -EIO, i;
@@ -1971,7 +1971,7 @@ static struct vlynq_driver vlynq_acx = {
.name = "acx_vlynq",
.id_table = acx_vlynq_id,
.probe = vlynq_probe,
- .remove = __devexit_p(vlynq_remove),
+ .remove = vlynq_remove,
};
#endif /* CONFIG_VLYNQ */

View File

@@ -0,0 +1,27 @@
--- a/main.c
+++ b/main.c
@@ -681,6 +681,7 @@ int acx_op_config(struct ieee80211_hw *h
if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
changed_not_done &= ~IEEE80211_CONF_CHANGE_CHANNEL;
+#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(3, 10, 0)
logf1(L_DEBUG, "IEEE80211_CONF_CHANGE_CHANNEL, "
"channel->hw_value=%i\n", conf->channel->hw_value);
@@ -689,6 +690,16 @@ int acx_op_config(struct ieee80211_hw *h
acx_selectchannel(adev, conf->channel->hw_value,
conf->channel->center_freq);
+#else
+ logf1(L_DEBUG, "IEEE80211_CONF_CHANGE_CHANNEL, "
+ "channel->hw_value=%i\n", conf->chandef.chan->hw_value);
+
+ if (conf->chandef.chan->hw_value == adev->channel)
+ goto change_channel_done;
+
+ acx_selectchannel(adev, conf->chandef.chan->hw_value,
+ conf->chandef.chan->center_freq);
+#endif
}
change_channel_done:
if (changed_not_done)

View File

@@ -0,0 +1,42 @@
--- a/mem.c
+++ b/mem.c
@@ -2036,7 +2036,7 @@ static int acxmem_probe(struct platform_
*/
ieee->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION)
| BIT(NL80211_IFTYPE_ADHOC);
- ieee->queues = 1;
+ ieee->queues = 4;
/* OW TODO Check if RTS/CTS threshold can be included here */
/* TODO: although in the original driver the maximum value was
--- a/pci.c
+++ b/pci.c
@@ -1022,7 +1022,7 @@ static int acxpci_probe(struct pci_dev *
BIT(NL80211_IFTYPE_STATION) |
BIT(NL80211_IFTYPE_ADHOC) |
BIT(NL80211_IFTYPE_AP);
- ieee->queues = 1;
+ ieee->queues = 4;
/* OW TODO Check if RTS/CTS threshold can be included here */
/* TODO: although in the original driver the maximum value was
@@ -1691,7 +1691,7 @@ static int vlynq_probe(struct vlynq_devi
BIT(NL80211_IFTYPE_STATION) |
BIT(NL80211_IFTYPE_ADHOC) |
BIT(NL80211_IFTYPE_AP);
- ieee->queues = 1;
+ ieee->queues = 4;
/* We base signal quality on winlevel approach of previous driver
* TODO OW 20100615 This should into a common init code
--- a/usb.c
+++ b/usb.c
@@ -1624,7 +1624,7 @@ acxusb_probe(struct usb_interface *intf,
*/
ieee->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION)
| BIT(NL80211_IFTYPE_ADHOC);
- ieee->queues = 1;
+ ieee->queues = 4;
// OW TODO Check if RTS/CTS threshold can be included here
// We base signal quality on winlevel approach of previous driver

View File

@@ -0,0 +1,31 @@
--- a/cardsetting.c
+++ b/cardsetting.c
@@ -710,12 +710,27 @@ static int acx1xx_get_station_id(acx_dev
u8 stationID[4 + acx_ie_descs[ACX1xx_IE_DOT11_STATION_ID].len];
const u8 *paddr;
int i, res;
+ const char *prom_addr;
+ char *prom_getenv(const char *name);
res = acx_interrogate(adev, &stationID, ACX1xx_IE_DOT11_STATION_ID);
paddr = &stationID[4];
- for (i = 0; i < ETH_ALEN; i++) {
+ prom_addr = NULL;
+#ifdef CONFIG_VLYNQ
+ prom_addr = prom_getenv("macwlan");
+ if (prom_addr == NULL)
+ prom_addr = prom_getenv("mac_ap");
+#endif
+ if (prom_addr)
+ sscanf(prom_addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", adev->dev_addr,
+ adev->dev_addr + 1,
+ adev->dev_addr + 2,
+ adev->dev_addr + 3,
+ adev->dev_addr + 4,
+ adev->dev_addr + 5);
+ else for (i = 0; i < ETH_ALEN; i++) {
/* we copy the MAC address (reversed in the card) to
* the netdevice's MAC address, and on ifup it will be
* copied into iwadev->dev_addr */

View File

@@ -0,0 +1,22 @@
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

View File

@@ -0,0 +1,100 @@
#
# 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_generic +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))

View File

@@ -0,0 +1,768 @@
--- 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

View File

@@ -0,0 +1,37 @@
--- 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;
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -0,0 +1,11 @@
--- 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);

View File

@@ -0,0 +1,44 @@
--- 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");

View File

@@ -0,0 +1,16 @@
--- 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

View File

@@ -0,0 +1,11 @@
--- 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

View File

@@ -0,0 +1,589 @@
--- 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);
}

View File

@@ -0,0 +1,30 @@
--- 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

View File

@@ -0,0 +1,54 @@
--- 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

View File

@@ -0,0 +1,79 @@
--- 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}

View File

@@ -0,0 +1,36 @@
--- 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;
}

View File

@@ -0,0 +1,33 @@
--- 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>

View File

@@ -0,0 +1,808 @@
--- 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

View File

@@ -0,0 +1,37 @@
--- 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;
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -0,0 +1,11 @@
--- 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);

View File

@@ -0,0 +1,44 @@
--- 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");

View File

@@ -0,0 +1,16 @@
--- 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

View File

@@ -0,0 +1,11 @@
--- 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

View File

@@ -0,0 +1,675 @@
--- 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);
}

View File

@@ -0,0 +1,30 @@
--- 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

View File

@@ -0,0 +1,54 @@
--- 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

View File

@@ -0,0 +1,79 @@
--- 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}

View File

@@ -0,0 +1,36 @@
--- 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;
}

View File

@@ -0,0 +1,33 @@
--- 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>

View File

@@ -0,0 +1,40 @@
#
# 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))

View File

@@ -0,0 +1 @@
obj-m := avila-wdt.o

View File

@@ -0,0 +1,231 @@
/*
* 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);

View File

@@ -0,0 +1,44 @@
#
# 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:=d5b05be2147bf5dc0137798837af24b0bbbe398d
PKG_VERSION:=20130517
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_REV).tar.gz
PKG_SOURCE_URL:=https://github.com/Hexxeh/rpi-firmware/archive/
PKG_MD5SUM:=9b0ce0a530e237f4c6fe43a36ccf57c3
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/rpi-firmware-$(PKG_REV)
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)/* $(BUILD_DIR)/brcm2708-gpu-fw-boot
endef
$(eval $(call BuildPackage,brcm2708-gpu-fw))

View File

@@ -0,0 +1,37 @@
#
# Copyright (C) 2006-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:=broadcom-diag
PKG_RELEASE:=10
include $(INCLUDE_DIR)/package.mk
define KernelPackage/diag
SUBMENU:=Other modules
DEPENDS:=@TARGET_brcm47xx
TITLE:=Driver for router LEDs and Buttons
FILES:=$(PKG_BUILD_DIR)/diag.ko
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
SUBDIRS="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(BUILDFLAGS)" \
modules
endef
$(eval $(call KernelPackage,diag))

View File

@@ -0,0 +1,17 @@
#
# Makefile for diag driver
#
# Copyright (C) 2005 Felix Fietkau <nbd@openwrt.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version
# 2 of the License, or (at your option) any later version.
#
obj-m := diag.o
ifeq ($(MAKING_MODULES),1)
-include $(TOPDIR)/Rules.make
endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,135 @@
/*
* diag.h - GPIO interface driver for Broadcom boards
*
* Copyright (C) 2006 Mike Baker <mbm@openwrt.org>,
* Felix Fietkau <nbd@openwrt.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <linux/irq.h>
#define MODULE_NAME "diag"
#define MAX_GPIO 16
#define FLASH_TIME HZ/6
enum polarity_t {
REVERSE = 0,
NORMAL = 1,
INPUT = 2,
};
enum {
PROC_BUTTON,
PROC_LED,
PROC_MODEL,
PROC_GPIOMASK
};
struct prochandler_t {
int type;
void *ptr;
};
struct button_t {
struct prochandler_t proc;
char *name;
u32 gpio;
unsigned long seen;
u8 pressed;
};
struct led_t {
struct prochandler_t proc;
char *name;
u32 gpio;
u8 polarity;
u8 flash;
u8 state;
};
struct platform_t {
char *name;
struct button_t buttons[MAX_GPIO];
u32 button_mask;
u32 button_polarity;
void (*platform_init)(void);
struct led_t leds[MAX_GPIO];
};
struct event_t {
struct work_struct wq;
unsigned long seen;
char *name, *action;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
struct sk_buff *skb;
#else
char *scratch;
char *argv[4];
char *envp[7];
u8 enr, anr;
#endif
};
extern char *nvram_get(char *str);
static struct platform_t platform;
/* buttons */
static void register_buttons(struct button_t *b);
static void unregister_buttons(struct button_t *b);
static void hotplug_button(struct work_struct *work);
static irqreturn_t button_handler(int irq, void *dev_id);
/* leds */
static void register_leds(struct led_t *l);
static void unregister_leds(struct led_t *l);
static void set_led_extif(struct led_t *led);
static void set_led_shift(struct led_t *led);
static void led_flash(unsigned long dummy);
/* 2.4 compatibility */
#ifndef TIMER_INITIALIZER
#define TIMER_INITIALIZER(_function, _expires, _data) \
{ \
/* _expires and _data currently unused */ \
function: _function \
}
#endif
static struct timer_list led_timer = TIMER_INITIALIZER(&led_flash, 0, 0);
/* proc */
static struct proc_dir_entry *diag, *leds;
static ssize_t diag_proc_read(struct file *file, char *buf, size_t count, loff_t *ppos);
static ssize_t diag_proc_write(struct file *file, const char *buf, size_t count, loff_t *ppos);
static struct file_operations diag_proc_fops = {
read: diag_proc_read,
write: diag_proc_write
};
static struct prochandler_t proc_model = { .type = PROC_MODEL };
static struct prochandler_t proc_gpiomask = { .type = PROC_GPIOMASK };

View File

@@ -0,0 +1,22 @@
#ifndef __DIAG_GPIO_H
#define __DIAG_GPIO_H
#include <linux/interrupt.h>
#include <linux/ssb/ssb_embedded.h>
#include <linux/gpio.h>
#include <bcm47xx.h>
#define EXTIF_ADDR 0x1f000000
#define EXTIF_UART (EXTIF_ADDR + 0x00800000)
/* GPIO pins driving LEDs through a shift register */
#define SHIFTREG_DATA (1 << 6)
#define SHIFTREG_CLK (1 << 7)
#define SHIFTREG_MAX_BITS 8
#define GPIO_TYPE_NORMAL (0x0 << 24)
#define GPIO_TYPE_EXTIF (0x1 << 24)
#define GPIO_TYPE_SHIFT (0x2 << 24)
#define GPIO_TYPE_MASK (0xf << 24)
#endif /* __DIAG_GPIO_H */

View File

@@ -0,0 +1,175 @@
#
# Copyright (C) 2006-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:=broadcom-wl
PKG_VERSION:=5.10.56.27.3
PKG_RELEASE:=5
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(ARCH).tar.bz2
PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
PKG_MD5SUM.mipsel:=3363e3a6b3d9d73c49dea870c7834eac
PKG_MD5SUM.mips:=f8de63debc75333d6b4e28193eb051ff
PKG_MD5SUM:=$(PKG_MD5SUM.$(ARCH))
include $(INCLUDE_DIR)/package.mk
define Package/broadcom-wl/Default
SECTION:=kernel
CATEGORY:=Kernel modules
DEPENDS:=@PACKAGE_kmod-brcm-wl||PACKAGE_kmod-brcm-wl-mini
SUBMENU:=Proprietary BCM43xx WiFi driver
SUBMENUDEP:=@TARGET_brcm47xx||TARGET_brcm63xx
endef
define KernelPackage/brcm-wl/Default
$(call Package/broadcom-wl/Default)
SECTION:=kernel
DEPENDS:=@TARGET_brcm47xx||TARGET_brcm63xx +wireless-tools
TITLE:=Kernel driver for BCM43xx chipsets
FILES:=$(PKG_BUILD_DIR)/driver$(1)/wl.ko $(PKG_BUILD_DIR)/glue/wl_glue.ko
AUTOLOAD:=$(call AutoLoad,30,wl_glue wl)
endef
define KernelPackage/brcm-wl/Default/description
This package contains the proprietary wireless driver for the Broadcom
BCM43xx chipset.
endef
define KernelPackage/brcm-wl
$(call KernelPackage/brcm-wl/Default,)
TITLE+= (normal version)
endef
define KernelPackage/brcm-wl/description
$(call KernelPackage/brcm-wl/Default/description)
endef
define KernelPackage/brcm-wl-mini
$(call KernelPackage/brcm-wl/Default,-mini)
TITLE+= (Legacy version)
endef
define KernelPackage/brcm-wl-mini/description
$(call KernelPackage/brcm-wl/Default/description)
endef
define Package/wlc
$(call Package/broadcom-wl/Default)
TITLE:=wl driver setup utility
endef
define Package/wlc/description
This package contains an utility for initializing the proprietary Broadcom
wl driver.
endef
define Package/wl
$(call Package/broadcom-wl/Default)
TITLE:=Proprietary Broadcom wl driver config utility
endef
define Package/wl/description
This package contains the proprietary utility (wl) for configuring the
proprietary Broadcom wl driver.
endef
define Package/nas
$(call Package/broadcom-wl/Default)
TITLE:=Proprietary Broadcom WPA/WPA2 authenticator
endef
define Package/nas/description
This package contains the proprietary WPA/WPA2 authenticator (nas) for the
proprietary Broadcom wl driver.
endef
MAKE_KMOD := $(MAKE) -C "$(LINUX_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
PATH="$(TARGET_PATH)" \
SUBDIRS="$(PKG_BUILD_DIR)/kmod" \
define Build/Prepare
$(call Build/Prepare/Default)
$(CP) $(PKG_BUILD_DIR)/driver $(PKG_BUILD_DIR)/driver-mini
$(CP) ./src/glue $(PKG_BUILD_DIR)/glue
endef
define Build/Compile
# Compile the kernel part
$(MAKE_KMOD) \
SUBDIRS="$(PKG_BUILD_DIR)/driver" \
MODFLAGS="-DMODULE -mlong-calls" \
modules
$(MAKE_KMOD) \
SUBDIRS="$(PKG_BUILD_DIR)/driver-mini" \
MODFLAGS="-DMODULE -mlong-calls" \
BUILD_TYPE="wl_apsta_mini" \
modules
# Compile glue driver
$(MAKE_KMOD) -C "$(LINUX_DIR)" \
SUBDIRS="$(PKG_BUILD_DIR)/glue" \
modules
# Compile libshared
$(MAKE) -C $(PKG_BUILD_DIR)/shared \
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="$(TARGET_CFLAGS) -I. -I$(PKG_BUILD_DIR)/driver/include" \
all
$(TARGET_CC) -o $(PKG_BUILD_DIR)/wlc \
-I$(PKG_BUILD_DIR)/shared -I$(PKG_BUILD_DIR)/driver/include \
./src/wlc.c $(PKG_BUILD_DIR)/shared/libshared.a
$(TARGET_CC) -o $(PKG_BUILD_DIR)/nas \
$(PKG_BUILD_DIR)/nas_exe.o \
$(PKG_BUILD_DIR)/shared/libshared.a
$(TARGET_CC) -o $(PKG_BUILD_DIR)/wl \
$(PKG_BUILD_DIR)/wl_exe.o \
$(PKG_BUILD_DIR)/shared/libshared.a
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/shared/libshared.a $(1)/usr/lib/
endef
define Package/wlc/install
$(CP) ./files/* $(1)/
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wlc $(1)/sbin/
endef
define Package/wlc/postinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/wlunbind enable || true
endef
define Package/wl/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wl $(1)/usr/sbin/
endef
define Package/nas/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nas $(1)/usr/sbin/
ln -sf nas $(1)/usr/sbin/nas4not
ln -sf nas $(1)/usr/sbin/nas4wds
endef
$(eval $(call KernelPackage,brcm-wl))
$(eval $(call KernelPackage,brcm-wl-mini))
$(eval $(call BuildPackage,wlc))
$(eval $(call BuildPackage,wl))
$(eval $(call BuildPackage,nas))

View File

@@ -0,0 +1,61 @@
include /lib/wifi
setup_broadcom_wds() {
local iface="$1"
local remote="$(wlc ifname "$iface" wdsmac)"
[ -z "$remote" ] && return
config_cb() {
[ -z "$CONFIG_SECTION" ] && return
config_get type "$CONFIG_SECTION" TYPE
[ "$type" = "wifi-iface" ] || return
config_get network "$CONFIG_SECTION" network
[ -z "$network" ] && return
config_get addr "$CONFIG_SECTION" bssid
addr=$(echo "$addr" | tr 'A-F' 'a-f')
[ "$addr" = "$remote" ] && {
local cfg="$CONFIG_SECTION"
include /lib/network
scan_interfaces
for network in $network; do
setup_interface "$iface" "$network"
done
config_get encryption "$cfg" encryption
config_get key "$cfg" key
config_get ssid "$cfg" ssid
[ "$encryption" != "none" ] && {
sleep 5
case "$encryption" in
psk|PSK)
nas4not "$network" "$iface" up auto tkip psk "$key" "$ssid"
;;
psk2|PSK2)
nas4not "$network" "$iface" up auto aes psk "$key" "$ssid"
;;
psk+psk2|psk2+psk|PSK+PSK2|PSK2+PSK)
nas4not "$network" "$iface" up auto aes+tkip psk "$key" "$ssid"
;;
*)
nas4not lan "$iface" up auto aes "$encryption" "$key" "$ssid"
;;
esac
}
}
}
config_load wireless
}
case "$ACTION" in
add|register)
[ "${INTERFACE%%0.*}" = wds ] && setup_broadcom_wds "$INTERFACE"
;;
esac

View File

@@ -0,0 +1,29 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2010-2011 OpenWrt.org
START=09
unbind_driver() {
local driver="$1"
local sysfs="/sys/bus/pci/drivers/$driver"
if [ -d "$sysfs" ]; then
local lnk
for lnk in $sysfs/*; do
[ -h "$lnk" ] || continue
case "${lnk##*/}" in
*:*:*.*)
logger "Unbinding WL PCI device ${lnk##*/} from $driver"
echo -n "${lnk##*/}" > "$sysfs/unbind"
;;
esac
done
fi
}
boot() {
unbind_driver b43-pci-bridge
unbind_driver bcma-pci-bridge
}
start() { :; }
stop() { :; }

View File

@@ -0,0 +1,395 @@
append DRIVERS "broadcom"
scan_broadcom() {
local device="$1"
local wds
local adhoc sta apmode mon disabled
local adhoc_if sta_if ap_if mon_if
local _c=0
config_get vifs "$device" vifs
for vif in $vifs; do
config_get_bool disabled "$vif" disabled 0
[ $disabled -eq 0 ] || continue
config_get mode "$vif" mode
_c=$(($_c + 1))
case "$mode" in
adhoc)
adhoc=1
adhoc_if="$vif"
;;
sta)
sta=1
sta_if="$vif"
;;
ap)
apmode=1
ap_if="${ap_if:+$ap_if }$vif"
;;
wds)
config_get addr "$vif" bssid
[ -z "$addr" ] || {
addr=$(echo "$addr" | tr 'A-F' 'a-f')
append wds "$addr"
}
;;
monitor)
mon=1
mon_if="$vif"
;;
*) echo "$device($vif): Invalid mode";;
esac
done
config_set "$device" wds "$wds"
local _c=
for vif in ${adhoc_if:-$sta_if $ap_if $mon_if}; do
config_set "$vif" ifname "${device}${_c:+.$_c}"
_c=$((${_c:-0} + 1))
done
config_set "$device" vifs "${adhoc_if:-$sta_if $ap_if $mon_if}"
ifdown="down"
for vif in 0 1 2 3; do
append ifdown "vif $vif" "$N"
append ifdown "enabled 0" "$N"
done
ap=1
infra=1
if [ "$_c" -gt 1 ]; then
mssid=1
else
mssid=
fi
apsta=0
radio=1
monitor=0
case "$adhoc:$sta:$apmode:$mon" in
1*)
ap=0
mssid=
infra=0
;;
:1:1:)
apsta=1
wet=1
;;
:1::)
wet=1
ap=0
mssid=
;;
:::1)
wet=1
ap=0
mssid=
monitor=1
;;
::)
radio=0
;;
esac
}
disable_broadcom() {
local device="$1"
set_wifi_down "$device"
wlc ifname "$device" down
wlc ifname "$device" bssid `wlc ifname "$device" default_bssid`
(
include /lib/network
# make sure the interfaces are down and removed from all bridges
for dev in $device ${device}.1 ${device}.2 ${device}.3; do
ifconfig "$dev" down 2>/dev/null >/dev/null && {
unbridge "$dev"
}
done
)
true
}
enable_broadcom() {
local device="$1"
local _c
config_get channel "$device" channel
config_get country "$device" country
config_get maxassoc "$device" maxassoc
config_get wds "$device" wds
config_get vifs "$device" vifs
config_get distance "$device" distance
config_get slottime "$device" slottime
config_get rxantenna "$device" rxantenna
config_get txantenna "$device" txantenna
config_get_bool frameburst "$device" frameburst
config_get macfilter "$device" macfilter
config_get maclist "$device" maclist
config_get macaddr "$device" macaddr
config_get txpower "$device" txpower
config_get frag "$device" frag
config_get rts "$device" rts
config_get hwmode "$device" hwmode
local vif_pre_up vif_post_up vif_do_up vif_txpower
local doth=0
local wmm=1
_c=0
nas="$(which nas)"
nas_cmd=
if_up=
[ -z "$slottime" ] && {
[ -n "$distance" ] && {
# slottime = 9 + (distance / 150) + (distance % 150 ? 1 : 0)
slottime="$((9 + ($distance / 150) + 1 - (150 - ($distance % 150)) / 150 ))"
}
} || {
slottime="${slottime:--1}"
}
case "$macfilter" in
allow|2)
macfilter=2;
;;
deny|1)
macfilter=1;
;;
disable|none|0)
macfilter=0;
;;
esac
case "$hwmode" in
*b) hwmode=0;;
*bg) hwmode=1;;
*g) hwmode=2;;
*gst) hwmode=4;;
*lrs) hwmode=5;;
*) hwmode=1;;
esac
for vif in $vifs; do
config_get vif_txpower "$vif" txpower
config_get mode "$vif" mode
append vif_pre_up "vif $_c" "$N"
append vif_post_up "vif $_c" "$N"
append vif_do_up "vif $_c" "$N"
config_get_bool wmm "$vif" wmm "$wmm"
config_get_bool doth "$vif" doth "$doth"
[ "$mode" = "sta" ] || {
config_get_bool hidden "$vif" hidden 0
append vif_pre_up "closed $hidden" "$N"
config_get_bool isolate "$vif" isolate 0
append vif_pre_up "ap_isolate $isolate" "$N"
}
wsec_r=0
eap_r=0
wsec=0
auth=0
nasopts=
config_get enc "$vif" encryption
case "$enc" in
*wep*)
wsec_r=1
wsec=1
defkey=1
config_get key "$vif" key
case "$enc" in
*shared*) append vif_do_up "wepauth 1" "$N";;
*) append vif_do_up "wepauth 0" "$N";;
esac
case "$key" in
[1234])
defkey="$key"
for knr in 1 2 3 4; do
config_get k "$vif" key$knr
[ -n "$k" ] || continue
[ "$defkey" = "$knr" ] && def="=" || def=""
append vif_do_up "wepkey $def$knr,$k" "$N"
done
;;
"");;
*) append vif_do_up "wepkey =1,$key" "$N";;
esac
;;
*psk*)
wsec_r=1
config_get key "$vif" key
# psk version + default cipher
case "$enc" in
*mixed*|*psk+psk2*) auth=132; wsec=6;;
*psk2*) auth=128; wsec=4;;
*) auth=4; wsec=2;;
esac
# cipher override
case "$enc" in
*tkip+aes*|*tkip+ccmp*|*aes+tkip*|*ccmp+tkip*) wsec=6;;
*aes*|*ccmp*) wsec=4;;
*tkip*) wsec=2;;
esac
# group rekey interval
config_get rekey "$vif" wpa_group_rekey
eval "${vif}_key=\"\$key\""
nasopts="-k \"\$${vif}_key\"${rekey:+ -g $rekey}"
;;
*wpa*)
wsec_r=1
eap_r=1
config_get auth_server "$vif" auth_server
[ -z "$auth_server" ] && config_get auth_server "$vif" server
config_get auth_port "$vif" auth_port
[ -z "$auth_port" ] && config_get auth_port "$vif" port
config_get auth_secret "$vif" auth_secret
[ -z "$auth_secret" ] && config_get auth_secret "$vif" key
# wpa version + default cipher
case "$enc" in
*mixed*|*wpa+wpa2*) auth=66; wsec=6;;
*wpa2*) auth=64; wsec=4;;
*) auth=2; wsec=2;;
esac
# cipher override
case "$enc" in
*tkip+aes*|*tkip+ccmp*|*aes+tkip*|*ccmp+tkip*) wsec=6;;
*aes*|*ccmp*) wsec=4;;
*tkip*) wsec=2;;
esac
# group rekey interval
config_get rekey "$vif" wpa_group_rekey
eval "${vif}_key=\"\$auth_secret\""
nasopts="-r \"\$${vif}_key\" -h $auth_server -p ${auth_port:-1812}${rekey:+ -g $rekey}"
;;
esac
append vif_do_up "wsec $wsec" "$N"
append vif_do_up "wpa_auth $auth" "$N"
append vif_do_up "wsec_restrict $wsec_r" "$N"
append vif_do_up "eap_restrict $eap_r" "$N"
config_get ssid "$vif" ssid
append vif_post_up "vlan_mode 0" "$N"
append vif_post_up "ssid $ssid" "$N"
append vif_do_up "ssid $ssid" "$N"
[ "$mode" = "monitor" ] && {
append vif_post_up "monitor $monitor" "$N"
}
[ "$mode" = "adhoc" ] && {
config_get bssid "$vif" bssid
[ -n "$bssid" ] && {
append vif_pre_up "bssid $bssid" "$N"
append vif_pre_up "ibss_merge 0" "$N"
} || {
append vif_pre_up "ibss_merge 1" "$N"
}
}
append vif_post_up "enabled 1" "$N"
config_get ifname "$vif" ifname
#append if_up "ifconfig $ifname up" ";$N"
local net_cfg
net_cfg="$(find_net_config "$vif")"
[ -z "$net_cfg" ] || {
append if_up "set_wifi_up '$vif' '$ifname'" ";$N"
append if_up "start_net '$ifname' '$net_cfg'" ";$N"
}
[ -z "$nasopts" ] || {
eval "${vif}_ssid=\"\$ssid\""
nas_mode="-A"
[ "$mode" = "sta" ] && nas_mode="-S"
[ -z "$nas" ] || {
nas_cmd="${nas_cmd:+$nas_cmd$N}start-stop-daemon -S -b -p /var/run/nas.$ifname.pid -x $nas -- -P /var/run/nas.$ifname.pid -H 34954 -i $ifname $nas_mode -m $auth -w $wsec -s \"\$${vif}_ssid\" -g 3600 -F $nasopts"
}
}
_c=$(($_c + 1))
done
killall -KILL nas >&- 2>&-
wlc ifname "$device" stdin <<EOF
$ifdown
gmode ${hwmode:-1}
apsta $apsta
ap $ap
${mssid:+mssid $mssid}
infra $infra
${wet:+wet 1}
802.11d 0
802.11h ${doth:-0}
wme ${wmm:-1}
rxant ${rxantenna:-3}
txant ${txantenna:-3}
fragthresh ${frag:-2346}
rtsthresh ${rts:-2347}
monitor ${monitor:-0}
radio ${radio:-1}
macfilter ${macfilter:-0}
maclist ${maclist:-none}
wds none
${wds:+wds $wds}
country ${country:-US}
${channel:+channel $channel}
maxassoc ${maxassoc:-128}
slottime ${slottime:--1}
${frameburst:+frameburst $frameburst}
$vif_pre_up
up
$vif_post_up
EOF
eval "$if_up"
wlc ifname "$device" stdin <<EOF
$vif_do_up
EOF
# use vif_txpower (from last wifi-iface) instead of txpower (from
# wifi-device) if the latter does not exist
txpower=${txpower:-$vif_txpower}
[ -z "$txpower" ] || iwconfig $device txpower ${txpower}dBm
eval "$nas_cmd"
}
detect_broadcom() {
local i=-1
while grep -qs "^ *wl$((++i)):" /proc/net/dev; do
local channel
config_get type wl${i} type
[ "$type" = broadcom ] && continue
channel=`wlc ifname wl${i} channel`
cat <<EOF
config wifi-device wl${i}
option type broadcom
option channel ${channel:-11}
# REMOVE THIS LINE TO ENABLE WIFI:
option disabled 1
config wifi-iface
option device wl${i}
option network lan
option mode ap
option ssid OpenWrt${i#0}
option encryption none
EOF
done
}

View File

@@ -0,0 +1,39 @@
--- a/driver/wl_linux.c
+++ b/driver/wl_linux.c
@@ -2082,7 +2082,11 @@ static void
_wl_set_multicast_list(struct net_device *dev)
{
wl_info_t *wl;
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,34)
struct dev_mc_list *mclist;
+#else
+ struct netdev_hw_addr *ha;
+#endif
int i;
if (!dev)
@@ -2098,14 +2102,24 @@ _wl_set_multicast_list(struct net_device
wl->pub->allmulti = (dev->flags & IFF_ALLMULTI)? TRUE: FALSE;
/* copy the list of multicasts into our private table */
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,34)
for (i = 0, mclist = dev->mc_list; mclist && (i < dev->mc_count);
i++, mclist = mclist->next) {
+#else
+ i = 0;
+ netdev_for_each_mc_addr(ha, dev) {
+#endif
if (i >= MAXMULTILIST) {
wl->pub->allmulti = TRUE;
i = 0;
break;
}
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,34)
wl->pub->multicast[i] = *((struct ether_addr*) mclist->dmi_addr);
+#else
+ wl->pub->multicast[i] = *((struct ether_addr*) ha->addr);
+ i++;
+#endif
}
wl->pub->nmulticast = i;
wlc_set(wl->wlc, WLC_SET_PROMISC, (dev->flags & IFF_PROMISC));

View File

@@ -0,0 +1,22 @@
--- a/driver/include/linuxver.h
+++ b/driver/include/linuxver.h
@@ -111,7 +111,7 @@ typedef irqreturn_t(*FN_ISR) (int irq, v
#endif /* not SANDGATE2G */
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 67) */
-#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
+#if 0
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
--- a/driver/linux_osl.c
+++ b/driver/linux_osl.c
@@ -62,7 +62,7 @@ struct osl_info {
};
/* PCMCIA attribute space access macros */
-#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
+#if 0
struct pcmcia_dev {
dev_link_t link; /* PCMCIA device pointer */
dev_node_t node; /* PCMCIA node structure */

View File

@@ -0,0 +1,31 @@
From: George Kashperko <george@znau.edu.ua>
Release nvram variables buffer.
Prevent block reserved by alloc_etherdev from being freed.
Signed-off-by: George Kashperko <george@znau.edu.ua>
---
---
--- a/driver/siutils.c
+++ b/driver/siutils.c
@@ -647,7 +647,10 @@ si_detach(si_t *sih)
#if !defined(BCMBUSTYPE) || (BCMBUSTYPE == SI_BUS)
if (sii != &ksii)
#endif /* !BCMBUSTYPE || (BCMBUSTYPE == SI_BUS) */
- MFREE(sii->osh, sii, sizeof(si_info_t));
+ do {
+ MFREE(sii->osh, sii, sizeof(si_info_t));
+ nvram_exit((void *)&(sii->pub));
+ } while (0);
}
void *
--- a/driver/wl_linux.c
+++ b/driver/wl_linux.c
@@ -1477,7 +1477,6 @@ wl_free_if(wl_info_t *wl, wl_if_t *wlif)
free_netdev(wlif->dev);
#endif
}
- MFREE(wl->osh, wlif, sizeof(wl_if_t));
}
#ifdef AP

View File

@@ -0,0 +1,88 @@
From: George Kashperko <george@znau.edu.ua>
broadcom-wl driver bound to ssb device with ssb driver probe
have osh handle struct pdev pointer value initialized with
ssb_device pointer. Later on pdev is used with legacy pci
dma api as pci_dev thus causing oops sometimes.
The patch replaces legacy pci dma api and pass relevant
device struct pointer to avoid crashes.
Signed-off-by: George Kashperko <george@znau.edu.ua>
---
driver/linux_osl.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
--- a/driver/linux_osl.c
+++ b/driver/linux_osl.c
@@ -25,6 +25,9 @@
#include <asm/paccess.h>
#endif /* mips */
#include <pcicfg.h>
+#ifdef CONFIG_SSB
+#include <linux/ssb/ssb.h>
+#endif
#define PCI_CFG_RETRY 10
@@ -364,12 +367,27 @@ osl_dma_consistent_align(void)
return (PAGE_SIZE);
}
+static struct device *
+osl_get_dmadev(osl_t *osh)
+{
+#ifdef CONFIG_SSB
+ if (osh->bustype == SI_BUS) {
+ /* This can be SiliconBackplane emulated as pci with Broadcom or
+ * ssb device. Less harmful is to check for pci_bus_type and if
+ * no match then assume we got ssb */
+ if (((struct pci_dev *)osh->pdev)->dev.bus != &pci_bus_type)
+ return ((struct ssb_device *)osh->pdev)->dma_dev;
+ }
+#endif
+ return &((struct pci_dev *)osh->pdev)->dev;
+}
+
void*
osl_dma_alloc_consistent(osl_t *osh, uint size, ulong *pap)
{
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
- return (pci_alloc_consistent(osh->pdev, size, (dma_addr_t*)pap));
+ return (dma_alloc_coherent(osl_get_dmadev(osh), size, (dma_addr_t*)pap, GFP_ATOMIC));
}
void
@@ -377,7 +395,7 @@ osl_dma_free_consistent(osl_t *osh, void
{
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
- pci_free_consistent(osh->pdev, size, va, (dma_addr_t)pa);
+ dma_free_coherent(osl_get_dmadev(osh), size, va, (dma_addr_t)pa);
}
uint BCMFASTPATH
@@ -386,13 +404,13 @@ osl_dma_map(osl_t *osh, void *va, uint s
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
if (direction == DMA_TX)
- return (pci_map_single(osh->pdev, va, size, PCI_DMA_TODEVICE));
+ return (dma_map_single(osl_get_dmadev(osh), va, size, PCI_DMA_TODEVICE));
else {
#ifdef mips
dma_cache_inv((uint)va, size);
return (virt_to_phys(va));
#else /* mips */
- return (pci_map_single(osh->pdev, va, size, PCI_DMA_FROMDEVICE));
+ return (dma_map_single(osl_get_dmadev(osh), va, size, PCI_DMA_FROMDEVICE));
#endif /* mips */
}
}
@@ -404,7 +422,7 @@ osl_dma_unmap(osl_t *osh, uint pa, uint
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
- pci_unmap_single(osh->pdev, (uint32)pa, size, dir);
+ dma_unmap_single(osl_get_dmadev(osh), (uint32)pa, size, dir);
}

View File

@@ -0,0 +1,184 @@
--- a/driver/wl_linux.c
+++ b/driver/wl_linux.c
@@ -85,10 +85,9 @@ typedef void wlc_hw_info_t;
#include <bcmjtag.h>
#endif /* BCMJTAG */
-
-#ifdef CONFIG_SSB
-#include <linux/ssb/ssb.h>
-#endif
+#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
+#include <wl_glue.h>
+#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
/* Linux wireless extension support */
#ifdef CONFIG_WIRELESS_EXT
@@ -997,62 +996,32 @@ static struct pci_driver wl_pci_driver =
#endif /* CONFIG_PCI */
#endif
+#ifdef BCMJTAG
+static bcmjtag_driver_t wl_jtag_driver = {
+ wl_jtag_probe,
+ wl_jtag_detach,
+ wl_jtag_poll,
+ };
+#endif /* BCMJTAG */
-static int wl_ssb_probe(struct ssb_device *dev, const struct ssb_device_id *id)
+#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
+static void * glue_attach_cb(u16 vendor, u16 device,
+ ulong mmio, void *dev, u32 irq)
{
- wl_info_t *wl;
- void *mmio;
-
- if (dev->bus->bustype != SSB_BUSTYPE_SSB) {
- printk("Attaching to SSB behind PCI is not supported. Please remove the b43 ssb bridge\n");
- return -EINVAL;
- }
-
- mmio = (void *) 0x18000000 + dev->core_index * 0x1000;
- wl = wl_attach(id->vendor, id->coreid, (ulong) mmio, SI_BUS, dev, dev->irq);
- if (!wl) {
- printk("wl_attach failed\n");
- return -ENODEV;
- }
-
- ssb_set_drvdata(dev, wl);
-
- return 0;
+ return wl_attach(vendor, device, mmio, SI_BUS, dev, irq);
}
-static void wl_ssb_remove(struct ssb_device *dev)
+static void glue_remove_cb(void *wldev)
{
- wl_info_t *wl = (wl_info_t *) ssb_get_drvdata(dev);
+ wl_info_t *wl = (wl_info_t *)wldev;
WL_LOCK(wl);
WL_APSTA_UPDN(("wl%d (%s): wl_remove() -> wl_down()\n", wl->pub->unit, wl->dev->name));
wl_down(wl);
WL_UNLOCK(wl);
wl_free(wl);
- ssb_set_drvdata(dev, NULL);
}
-
-static const struct ssb_device_id wl_ssb_tbl[] = {
- SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, SSB_ANY_REV),
- SSB_DEVTABLE_END
-};
-
-#ifdef CONFIG_SSB
-static struct ssb_driver wl_ssb_driver = {
- .name = KBUILD_MODNAME,
- .id_table = wl_ssb_tbl,
- .probe = wl_ssb_probe,
- .remove = wl_ssb_remove,
-};
-#endif
-
-#ifdef BCMJTAG
-static bcmjtag_driver_t wl_jtag_driver = {
- wl_jtag_probe,
- wl_jtag_detach,
- wl_jtag_poll,
- };
-#endif /* BCMJTAG */
+#endif/* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
/**
@@ -1067,11 +1036,13 @@ wl_module_init(void)
{
int error = -ENODEV;
-#ifdef CONFIG_SSB
- error = ssb_driver_register(&wl_ssb_driver);
+#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
+ wl_glue_set_attach_callback(&glue_attach_cb);
+ wl_glue_set_remove_callback(&glue_remove_cb);
+ error = wl_glue_register();
if (error)
return error;
-#endif /* CONFIG_SSB */
+#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
#ifdef CONFIG_PCI
error = pci_register_driver(&wl_pci_driver);
@@ -1082,7 +1053,9 @@ wl_module_init(void)
return 0;
error_pci:
- ssb_driver_unregister(&wl_ssb_driver);
+#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
+ wl_glue_unregister();
+#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
return error;
}
@@ -1099,9 +1072,9 @@ wl_module_exit(void)
#ifdef CONFIG_PCI
pci_unregister_driver(&wl_pci_driver);
#endif /* CONFIG_PCI */
-#ifdef CONFIG_SSB
- ssb_driver_unregister(&wl_ssb_driver);
-#endif /* CONFIG_SSB */
+#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
+ wl_glue_unregister();
+#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
}
module_init(wl_module_init);
--- a/driver/linux_osl.c
+++ b/driver/linux_osl.c
@@ -25,9 +25,9 @@
#include <asm/paccess.h>
#endif /* mips */
#include <pcicfg.h>
-#ifdef CONFIG_SSB
-#include <linux/ssb/ssb.h>
-#endif
+#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
+#include <wl_glue.h>
+#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
#define PCI_CFG_RETRY 10
@@ -370,15 +370,17 @@ osl_dma_consistent_align(void)
static struct device *
osl_get_dmadev(osl_t *osh)
{
-#ifdef CONFIG_SSB
+#if defined(CONFIG_SSB) || defined(CONFIG_BCMA)
if (osh->bustype == SI_BUS) {
- /* This can be SiliconBackplane emulated as pci with Broadcom or
- * ssb device. Less harmful is to check for pci_bus_type and if
- * no match then assume we got ssb */
+ /* This can be SiliconBackplane emulated as pci with Broadcom,
+ * ssb or bcma device. Less harmful is to check for pci_bus_type and if
+ * no match then assume we got either ssb or bcma */
if (((struct pci_dev *)osh->pdev)->dev.bus != &pci_bus_type)
- return ((struct ssb_device *)osh->pdev)->dma_dev;
+ {
+ return wl_glue_get_dmadev(osh->pdev);
+ }
}
-#endif
+#endif /* defined(CONFIG_SSB) || defined(CONFIG_BCMA) */
return &((struct pci_dev *)osh->pdev)->dev;
}
--- a/driver/Makefile
+++ b/driver/Makefile
@@ -1,7 +1,7 @@
BUILD_TYPE=wl_apsta
include $(src)/$(BUILD_TYPE)/buildflags.mk
-EXTRA_CFLAGS += -I$(src)/include -I$(src) -DBCMDRIVER $(WLFLAGS)
+EXTRA_CFLAGS += -I$(src)/include -I$(src) -I$(realpath $(src)/../glue) -DBCMDRIVER $(WLFLAGS)
wl-objs := $(BUILD_TYPE)/wl_prebuilt.o wl_iw.o wl_linux.o linux_osl.o siutils.o aiutils.o hndpmu.o bcmutils.o sbutils.o nicpci.o hnddma.o bcmsrom.o nvram_stub.o

View File

@@ -0,0 +1,11 @@
--- a/driver/wl_linux.c
+++ b/driver/wl_linux.c
@@ -1541,6 +1541,8 @@ wl_add_if(wl_info_t *wl, struct wlc_if*
return NULL;
}
+ wl_if_setup(wlif->dev);
+
sprintf(wlif->dev->name, "%s%d.%d", devname, wl->pub->unit, wlif->subunit);
if (remote)
bcopy(remote, &wlif->remote, ETHER_ADDR_LEN);

View File

@@ -0,0 +1,27 @@
--- a/driver/wl_linux.c
+++ b/driver/wl_linux.c
@@ -462,6 +462,16 @@ wl_schedule_fn(wl_info_t *wl, void (*fn)
}
#endif /* DSLCPE_DELAY */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
+#define WL_DEFAULT_OPS \
+ .ndo_open = wl_open, \
+ .ndo_stop = wl_close, \
+ .ndo_start_xmit = wl_start, \
+ .ndo_get_stats = wl_get_stats, \
+ .ndo_set_mac_address = wl_set_mac_address, \
+ .ndo_set_rx_mode = wl_set_multicast_list, \
+ .ndo_do_ioctl = wl_ioctl
+#else
#define WL_DEFAULT_OPS \
.ndo_open = wl_open, \
.ndo_stop = wl_close, \
@@ -470,6 +480,7 @@ wl_schedule_fn(wl_info_t *wl, void (*fn)
.ndo_set_mac_address = wl_set_mac_address, \
.ndo_set_multicast_list = wl_set_multicast_list, \
.ndo_do_ioctl = wl_ioctl
+#endif
static const struct net_device_ops wl_ops = {
WL_DEFAULT_OPS,

View File

@@ -0,0 +1,11 @@
--- a/driver/wl_linux.c 2012-09-26 20:51:48.099454971 -0400
+++ b/driver/wl_linux.c 2012-09-26 20:53:24.115453441 -0400
@@ -691,7 +691,7 @@
if (wl->bustype != JTAG_BUS)
#endif /* BCMJTAG */
{
- if (request_irq(irq, wl_isr, IRQF_SHARED|IRQF_SAMPLE_RANDOM, dev->name, wl)) {
+ if (request_irq(irq, wl_isr, IRQF_SHARED, dev->name, wl)) {
WL_ERROR(("wl%d: request_irq() failed\n", unit));
goto fail;
}

View File

@@ -0,0 +1,12 @@
--- a/driver/wl_linux.c
+++ b/driver/wl_linux.c
@@ -49,7 +49,9 @@
#include <linux/ieee80211.h>
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
#include <asm/system.h>
+#endif
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/pgtable.h>

View File

@@ -0,0 +1,32 @@
--- a/driver/nvram_stub.c
+++ b/driver/nvram_stub.c
@@ -22,6 +22,7 @@ typedef struct _vars {
#define VARS_T_OH sizeof(vars_t)
static vars_t *vars = NULL;
+static int nvram_init_done = 0;
extern char *nvram_buf[];
int
@@ -33,6 +34,10 @@ BCMATTACHFN(nvram_init)(void *si)
uint nvs, bufsz;
vars_t *new;
+ nvram_init_done++;
+ if (nvram_init_done != 1)
+ return 0;
+
osh = si_osh(sih);
nvs = R_REG(osh, &nvh->len) - sizeof(struct nvram_header);
@@ -79,6 +84,10 @@ BCMATTACHFN(nvram_exit)(void *si)
vars_t *this, *next;
si_t *sih;
+ nvram_init_done--;
+ if (nvram_init_done != 0)
+ return 0;
+
sih = (si_t *)si;
this = vars;
while (this) {

View File

@@ -0,0 +1,11 @@
--- a/driver/wl_linux.c
+++ b/driver/wl_linux.c
@@ -1412,7 +1412,7 @@ wl_alloc_if(wl_info_t *wl, int iftype, u
dev = alloc_etherdev(sizeof(wl_if_t));
wlif = netdev_priv(dev);
bzero(wlif, sizeof(wl_if_t));
- strncpy(dev->name, name, IFNAMSIZ);
+ snprintf(dev->name, IFNAMSIZ, name, subunit);
wlif->type = iftype;
wlif->dev = dev;

View File

@@ -0,0 +1,84 @@
--- a/driver/bcmsrom.c
+++ b/driver/bcmsrom.c
@@ -39,6 +39,11 @@
#include <sbsdpcmdev.h>
#endif
+#if defined(CONFIG_SSB_PCIHOST) && defined(CONFIG_BOARD_BCM963XX)
+#include <linux/ssb/ssb.h>
+extern struct ssb_sprom bcm63xx_sprom;
+#endif
+
#ifdef WLTEST
#include <sbsprom.h>
#endif /* WLTEST */
@@ -2058,6 +2063,10 @@ BCMATTACHFN(initvars_srom_pci)(si_t *sih
bool flash = FALSE;
int err = 0;
+#if defined(CONFIG_SSB_PCIHOST) && defined(CONFIG_BOARD_BCM963XX)
+ char eabuf[18];
+#endif
+
/*
* Apply CRC over SROM content regardless SROM is present or not,
* and use variable <devpath>sromrev's existance in flash to decide
@@ -2120,6 +2129,58 @@ BCMATTACHFN(initvars_srom_pci)(si_t *sih
goto varscont;
}
+#if defined(CONFIG_SSB_PCIHOST) && defined(CONFIG_BOARD_BCM963XX)
+ base = vp = MALLOC(osh, MAXSZ_NVRAM_VARS);
+
+ if( base != NULL )
+ {
+ varbuf_init(&b, base, MAXSZ_NVRAM_VARS);
+
+ printk("Got version %i SPROM from SSB\n", bcm63xx_sprom.revision);
+
+ varbuf_append(&b, vstr_sromrev, bcm63xx_sprom.revision);
+ varbuf_append(&b, vstr_boardrev, bcm63xx_sprom.board_rev);
+
+ /* ToDo: map bcm63xx_sprom.country_code */
+ varbuf_append(&b, vstr_noccode);
+
+ varbuf_append(&b, vstr_aa2g, bcm63xx_sprom.ant_available_bg);
+
+ varbuf_append(&b, vstr_pa0b[0], bcm63xx_sprom.pa0b0);
+ varbuf_append(&b, vstr_pa1b[0], bcm63xx_sprom.pa1b0);
+ varbuf_append(&b, vstr_pa0b[1], bcm63xx_sprom.pa0b1);
+ varbuf_append(&b, vstr_pa1b[1], bcm63xx_sprom.pa1b1);
+ varbuf_append(&b, vstr_pa0b[2], bcm63xx_sprom.pa0b2);
+ varbuf_append(&b, vstr_pa1b[2], bcm63xx_sprom.pa1b2);
+
+ varbuf_append(&b, vstr_pa0maxpwr, bcm63xx_sprom.maxpwr_bg);
+ varbuf_append(&b, vstr_pa0itssit, bcm63xx_sprom.itssi_bg);
+
+ varbuf_append(&b, vstr_boardflags, (bcm63xx_sprom.boardflags_hi << 16) | bcm63xx_sprom.boardflags_lo);
+ varbuf_append(&b, vstr_boardflags2, (bcm63xx_sprom.boardflags2_hi << 16) | bcm63xx_sprom.boardflags2_lo);
+
+ snprintf(eabuf, sizeof(eabuf), "%02x:%02x:%02x:%02x:%02x:%02x",
+ bcm63xx_sprom.il0mac[0], bcm63xx_sprom.il0mac[1], bcm63xx_sprom.il0mac[2],
+ bcm63xx_sprom.il0mac[3], bcm63xx_sprom.il0mac[4], bcm63xx_sprom.il0mac[5]
+ );
+
+ varbuf_append(&b, vstr_macaddr, eabuf);
+
+ /* final nullbyte terminator */
+ ASSERT(b.size >= 1);
+ vp = b.buf;
+ *vp++ = '\0';
+
+ ASSERT((vp - base) <= MAXSZ_NVRAM_VARS);
+ goto varsdone;
+ }
+ else
+ {
+ err = -2;
+ goto errout;
+ }
+#endif
+
BS_ERROR(("SROM CRC Error\n"));
#if defined(WLTEST)

View File

@@ -0,0 +1,11 @@
--- a/driver/siutils.c
+++ b/driver/siutils.c
@@ -1859,7 +1859,7 @@ BCMINITFN(si_devpath)(si_t *sih, char *p
case PCI_BUS:
ASSERT((SI_INFO(sih))->osh != NULL);
slen = snprintf(path, (size_t)size, "pci/%u/%u/",
- OSL_PCI_BUS((SI_INFO(sih))->osh),
+ OSL_PCI_BUS((SI_INFO(sih))->osh) + 1,
OSL_PCI_SLOT((SI_INFO(sih))->osh));
break;
case PCMCIA_BUS:

View File

@@ -0,0 +1,12 @@
--- a/driver/linux_osl.c
+++ b/driver/linux_osl.c
@@ -723,6 +723,9 @@ osl_readl(volatile uint32 *r)
uint16
osl_readw(volatile uint16 *r)
{
+ uint32 addr = (uintptr)r & 0xffff3fff;
+ if (addr == 0xa8000688) /* ifs_ctl */
+ readl(r);
return (readw(r));
}

View File

@@ -0,0 +1,17 @@
#
# Makefile for wl_glue driver
#
# Copyright (C) 2011 Jo-Philipp Wich <jow@openwrt.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version
# 2 of the License, or (at your option) any later version.
#
obj-m := wl_glue.o
ifeq ($(MAKING_MODULES),1)
-include $(TOPDIR)/Rules.make
endif

View File

@@ -0,0 +1,315 @@
/*
* wl_glue.c: Broadcom WL support module providing a unified SSB/BCMA handling.
* Copyright (C) 2011 Jo-Philipp Wich <jow@openwrt.org>
*/
#include "wl_glue.h"
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#ifdef CONFIG_BCM47XX
#include <bcm47xx.h>
#endif
#ifdef CONFIG_SSB
#include <linux/ssb/ssb.h>
#endif
#ifdef CONFIG_BCMA
#include <linux/bcma/bcma.h>
#endif
MODULE_AUTHOR("Jo-Philipp Wich (jow@openwrt.org)");
MODULE_DESCRIPTION("Broadcom WL SSB/BCMA compatibility layer");
MODULE_LICENSE("GPL");
static wl_glue_attach_cb_t attach_cb = NULL;
static wl_glue_remove_cb_t remove_cb = NULL;
static enum wl_glue_bus_type active_bus_type = WL_GLUE_BUS_TYPE_UNSPEC;
static int wl_glue_attached = 0;
#ifdef CONFIG_SSB
static int wl_glue_ssb_probe(struct ssb_device *dev, const struct ssb_device_id *id)
{
void *mmio;
void *wldev;
if (!attach_cb)
{
pr_err("No attach callback registered\n");
return -ENOSYS;
}
if (dev->bus->bustype != SSB_BUSTYPE_SSB)
{
pr_err("Attaching to SSB behind PCI is not supported. Please remove the b43 ssb bridge\n");
return -EINVAL;
}
mmio = (void *) 0x18000000 + dev->core_index * 0x1000;
wldev = attach_cb(id->vendor, id->coreid, (ulong)mmio, dev, dev->irq);
if (!wldev)
{
pr_err("The attach callback failed, SSB probe aborted\n");
return -ENODEV;
}
ssb_set_drvdata(dev, wldev);
return 0;
}
static void wl_glue_ssb_remove(struct ssb_device *dev)
{
void *wldev = ssb_get_drvdata(dev);
if (remove_cb)
remove_cb(wldev);
ssb_set_drvdata(dev, NULL);
}
static const struct ssb_device_id wl_glue_ssb_tbl[] = {
SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, SSB_ANY_REV),
SSB_DEVTABLE_END
};
static struct ssb_driver wl_glue_ssb_driver = {
.name = KBUILD_MODNAME,
.id_table = wl_glue_ssb_tbl,
.probe = wl_glue_ssb_probe,
.remove = wl_glue_ssb_remove,
};
#endif /* CONFIG_SSB */
#ifdef CONFIG_BCMA
static int wl_glue_bcma_probe(struct bcma_device *dev)
{
void *wldev;
if (!attach_cb)
{
pr_err("No attach callback registered\n");
return -ENOSYS;
}
if (dev->bus->hosttype != BCMA_HOSTTYPE_SOC)
{
pr_err("Unsupported BCMA bus type %d\n", dev->bus->hosttype);
return -EINVAL;
}
/*
* NB:
* 0x18000000 = BCMA_ADDR_BASE
* 0x1000 = BCMA_CORE_SIZE
*/
wldev = attach_cb(dev->id.manuf, dev->id.id, (ulong)dev->addr, dev, dev->irq);
if (!wldev)
{
pr_err("The attach callback failed, BCMA probe aborted\n");
return -ENODEV;
}
bcma_set_drvdata(dev, wldev);
return 0;
}
static void wl_glue_bcma_remove(struct bcma_device *dev)
{
void *wldev = bcma_get_drvdata(dev);
if (remove_cb)
remove_cb(wldev);
bcma_set_drvdata(dev, NULL);
}
static const struct bcma_device_id wl_glue_bcma_tbl[] = {
BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, BCMA_ANY_REV, BCMA_ANY_CLASS),
BCMA_CORETABLE_END
};
static struct bcma_driver wl_glue_bcma_driver = {
.name = KBUILD_MODNAME,
.id_table = wl_glue_bcma_tbl,
.probe = wl_glue_bcma_probe,
.remove = wl_glue_bcma_remove,
};
#endif /* CONFIG_BCMA */
void wl_glue_set_attach_callback(wl_glue_attach_cb_t cb)
{
attach_cb = cb;
}
EXPORT_SYMBOL(wl_glue_set_attach_callback);
void wl_glue_set_remove_callback(wl_glue_remove_cb_t cb)
{
remove_cb = cb;
}
EXPORT_SYMBOL(wl_glue_set_remove_callback);
int wl_glue_register(void)
{
int err;
switch(active_bus_type)
{
#ifdef CONFIG_SSB
case WL_GLUE_BUS_TYPE_SSB:
err = ssb_driver_register(&wl_glue_ssb_driver);
break;
#endif /* CONFIG_SSB */
#ifdef CONFIG_BCMA
case WL_GLUE_BUS_TYPE_BCMA:
err = bcma_driver_register(&wl_glue_bcma_driver);
break;
#endif /* CONFIG_BCMA */
default:
pr_err("Not attaching through glue driver due to unsupported bus\n");
err = -ENOSYS;
break;
}
if (!err)
{
pr_info("SSB/BCMA glue driver successfully attached\n");
wl_glue_attached = 1;
}
return err;
}
EXPORT_SYMBOL(wl_glue_register);
int wl_glue_unregister(void)
{
int err;
if (!wl_glue_attached)
return -ENOSYS;
switch (active_bus_type)
{
#ifdef CONFIG_SSB
case WL_GLUE_BUS_TYPE_SSB:
ssb_driver_unregister(&wl_glue_ssb_driver);
err = 0;
break;
#endif /* CONFIG_SSB */
#ifdef CONFIG_BCMA
case WL_GLUE_BUS_TYPE_BCMA:
bcma_driver_unregister(&wl_glue_bcma_driver);
err = 0;
break;
#endif /* CONFIG_BCMA */
default:
pr_err("Not removing glue driver due to unsupported bus\n");
err = -ENOSYS;
break;
}
if (!err)
{
pr_info("SSB/BCMA glue driver successfully detached\n");
wl_glue_attached = 0;
}
return err;
}
EXPORT_SYMBOL(wl_glue_unregister);
struct device * wl_glue_get_dmadev(void *dev)
{
struct device *dma_dev;
switch (active_bus_type)
{
#ifdef CONFIG_SSB
case WL_GLUE_BUS_TYPE_SSB:
dma_dev = ((struct ssb_device *)dev)->dma_dev;
break;
#endif /* CONFIG_SSB */
#ifdef CONFIG_BCMA
case WL_GLUE_BUS_TYPE_BCMA:
dma_dev = ((struct bcma_device *)dev)->dma_dev;
break;
#endif /* CONFIG_BCMA */
default:
BUG();
dma_dev = NULL;
break;
}
return dma_dev;
}
EXPORT_SYMBOL(wl_glue_get_dmadev);
static int __init wl_glue_init(void)
{
#ifdef CONFIG_BCM47XX
/*
* BCM47xx currently supports either SSB or BCMA bus,
* determine the used one from the info set by the
* platform setup code.
*/
switch (bcm47xx_bus_type)
{
#ifdef CONFIG_SSB
case BCM47XX_BUS_TYPE_SSB:
active_bus_type = WL_GLUE_BUS_TYPE_SSB;
break;
#endif /* CONFIG_SSB */
#ifdef CONFIG_BCMA
case BCM47XX_BUS_TYPE_BCMA:
active_bus_type = WL_GLUE_BUS_TYPE_BCMA;
break;
#endif /* CONFIG_BCMA */
}
#endif /* CONFIG_BCM47XX */
#ifdef CONFIG_BCM63XX
#ifdef CONFIG_SSB
/*
* BCM63xx currently only uses SSB, so assume that.
*/
active_bus_type = WL_GLUE_BUS_TYPE_SSB;
#endif /* CONFIG_SSB */
#endif /* CONFIG_BCM63XX */
/* do not fail here, let wl_glue_register() return -ENOSYS later */
if (active_bus_type == WL_GLUE_BUS_TYPE_UNSPEC)
pr_err("Unable to determine used system bus type\n");
return 0;
}
static void __exit wl_glue_exit(void)
{
if (wl_glue_attached)
{
if (wl_glue_unregister())
pr_err("Failed to unregister glue driver\n");
wl_glue_attached = 0;
}
return;
}
module_init(wl_glue_init);
module_exit(wl_glue_exit);

View File

@@ -0,0 +1,22 @@
/*
* wl_glue.h: Broadcom WL support module providing a unified SSB/BCMA handling.
* Copyright (C) 2011 Jo-Philipp Wich <jow@openwrt.org>
*/
#include <linux/types.h>
typedef void * (*wl_glue_attach_cb_t)(u16, u16, ulong, void *, u32);
typedef void (*wl_glue_remove_cb_t)(void *);
enum wl_glue_bus_type {
WL_GLUE_BUS_TYPE_UNSPEC,
WL_GLUE_BUS_TYPE_SSB,
WL_GLUE_BUS_TYPE_BCMA
};
extern void wl_glue_set_attach_callback(wl_glue_attach_cb_t cb);
extern void wl_glue_set_remove_callback(wl_glue_remove_cb_t cb);
extern int wl_glue_register(void);
extern int wl_glue_unregister(void);
extern struct device * wl_glue_get_dmadev(void *);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,53 @@
#
# 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,1)
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))

View File

@@ -0,0 +1,2 @@
config BUTTON_HOTPLUG
tristate "Button Hotplug driver"

View File

@@ -0,0 +1 @@
obj-${CONFIG_BUTTON_HOTPLUG} += button-hotplug.o

View File

@@ -0,0 +1,349 @@
/*
* 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");

View File

@@ -0,0 +1,92 @@
#
# 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))

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
--- a/build_system/build_files/common.mk
+++ b/build_system/build_files/common.mk
@@ -122,7 +122,7 @@ CC=$(COMPILER)
LD=$(LINKER)
AR=$(ARCHIVER)
-CFLAGS+=-O2
+#CFLAGS+=-O2
PWD= $(shell pwd)
--- a/build_system/build_files/OS/linux_2.6.mk
+++ b/build_system/build_files/OS/linux_2.6.mk
@@ -80,7 +80,7 @@ endif
ifeq ($(OS_LEVEL), kernel_space)
-CFLAGS+=
+#CFLAGS+=
endif

View File

@@ -0,0 +1,53 @@
--- a/Embedded/src/1588/1588.c
+++ b/Embedded/src/1588/1588.c
@@ -291,7 +291,7 @@ int pci_probe(struct pci_dev *dev, const
}
- if ( request_irq(dev->irq, &timesync_isr, SA_SHIRQ, DRIVERNAME,
+ if ( request_irq(dev->irq, &timesync_isr, IRQF_SHARED, DRIVERNAME,
&g_drvr_data) )
{
printk("%s-pci_probe: irq\n", DRIVERNAME);
--- a/Embedded/src/CAN/can_main.c
+++ b/Embedded/src/CAN/can_main.c
@@ -424,7 +424,7 @@ int can_open(struct inode *inode, struct
err = request_irq(
can_os->irq,
can_irq_handler,
- SA_SHIRQ,
+ IRQF_SHARED,
iminor(can_os->inode) ? CAN_PROC_1 : CAN_PROC_0,
&(g_can_os[iminor(can_os->inode)])
);
--- a/Embedded/src/EDMA/dma_linux.c
+++ b/Embedded/src/EDMA/dma_linux.c
@@ -367,7 +367,7 @@ int32_t edma_resume(struct pci_dev *dev)
return -ENODEV;
}
- if (request_irq(dev->irq, &edma_irq_handler, SA_SHIRQ,
+ if (request_irq(dev->irq, &edma_irq_handler, IRQF_SHARED,
g_char_drvr_name, dev) )
{
@@ -829,7 +829,7 @@ int32_t edma_probe(struct pci_dev * dev,
/*
* Obtain a (shared) Interrupt Request (IRQ) Line from the OS.
*/
- if (request_irq(dev->irq, &edma_irq_handler, SA_SHIRQ,
+ if (request_irq(dev->irq, &edma_irq_handler, IRQF_SHARED,
g_char_drvr_name, dev) )
{
--- a/Embedded/src/WDT/iwdt.c
+++ b/Embedded/src/WDT/iwdt.c
@@ -1461,7 +1461,7 @@ static int __init wdt_init_one(struct pc
/* Request irq only if wdt_irq is other than 0 */
if (wdt_irq) {
- if (request_irq(wdt_irq, wdt_isr, SA_INTERRUPT | SA_SHIRQ,
+ if (request_irq(wdt_irq, wdt_isr, IRQF_DISABLED | IRQF_SHARED,
"iwdt", &wdt_miscdev)) {
printk("IRQ %d is not free.\n", wdt_irq);
return -EIO;

View File

@@ -0,0 +1,56 @@
--- a/Embedded/src/GbE/iegbe_main.c
+++ b/Embedded/src/GbE/iegbe_main.c
@@ -724,6 +724,26 @@ static void iegbe_dump_eeprom(struct ieg
kfree(data);
}
+static const struct net_device_ops iegbe_netdev_ops = {
+ .ndo_open = iegbe_open,
+ .ndo_stop = iegbe_close,
+ .ndo_start_xmit = iegbe_xmit_frame,
+ .ndo_get_stats = iegbe_get_stats,
+ .ndo_set_rx_mode = iegbe_set_rx_mode,
+ .ndo_set_mac_address = iegbe_set_mac,
+ .ndo_tx_timeout = iegbe_tx_timeout,
+ .ndo_change_mtu = iegbe_change_mtu,
+ .ndo_do_ioctl = iegbe_ioctl,
+ .ndo_validate_addr = eth_validate_addr,
+
+ .ndo_vlan_rx_register = iegbe_vlan_rx_register,
+ .ndo_vlan_rx_add_vid = iegbe_vlan_rx_add_vid,
+ .ndo_vlan_rx_kill_vid = iegbe_vlan_rx_kill_vid,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = iegbe_netpoll,
+#endif
+};
+
/**
* iegbe_probe - Device Initialization Routine
* @pdev: PCI device information struct
@@ -800,24 +820,11 @@ static int __devinit iegbe_probe(struct
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->netdev_ops = &iegbe_netdev_ops;
set_ethtool_ops(netdev);
- 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;
-#endif
+
strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);

View File

@@ -0,0 +1,41 @@
--- a/Embedded/src/GbE/iegbe_main.c
+++ b/Embedded/src/GbE/iegbe_main.c
@@ -3465,12 +3465,12 @@ static irqreturn_t iegbe_intr_msi(int ir
printk("Critical error! ICR = 0x%x\n", icr);
return IRQ_HANDLED;
}
- if (likely(netif_rx_schedule_prep(netdev, &adapter->napi))) {
+ if (likely(napi_schedule_prep(&adapter->napi))) {
adapter->total_tx_bytes = 0;
adapter->total_tx_packets = 0;
adapter->total_rx_bytes = 0;
adapter->total_rx_packets = 0;
- __netif_rx_schedule(netdev, &adapter->napi);
+ __napi_schedule(&adapter->napi);
} else
iegbe_irq_enable(adapter);
@@ -3527,12 +3527,12 @@ iegbe_intr(int irq, void *data)
E1000_WRITE_REG(&adapter->hw, IMC, ~0);
E1000_WRITE_FLUSH(&adapter->hw);
}
- if (likely(netif_rx_schedule_prep(netdev, &adapter->napi))) {
+ if (likely(napi_schedule_prep(&adapter->napi))) {
adapter->total_tx_bytes = 0;
adapter->total_tx_packets = 0;
adapter->total_rx_bytes = 0;
adapter->total_rx_packets = 0;
- __netif_rx_schedule(netdev, &adapter->napi);
+ __napi_schedule(&adapter->napi);
} else
/* this really should not happen! if it does it is basically a
* bug, but not a hard error, so enable ints and continue */
@@ -3574,7 +3574,7 @@ static int iegbe_clean(struct napi_struc
if (work_done < budget) {
if (likely(adapter->itr_setting & 3))
iegbe_set_itr(adapter);
- netif_rx_complete(poll_dev, napi);
+ napi_complete(napi);
iegbe_irq_enable(adapter);
}

View File

@@ -0,0 +1,103 @@
--- a/Embedded/src/GbE/iegbe.h
+++ b/Embedded/src/GbE/iegbe.h
@@ -316,7 +316,6 @@ struct iegbe_adapter {
int cleaned_count);
struct iegbe_rx_ring *rx_ring; /* One per active queue */
struct napi_struct napi;
- struct net_device *polling_netdev; /* One per active queue */
int num_tx_queues;
int num_rx_queues;
--- a/Embedded/src/GbE/iegbe_main.c
+++ b/Embedded/src/GbE/iegbe_main.c
@@ -763,7 +763,7 @@ static int __devinit iegbe_probe(struct
struct iegbe_hw *hw;
static int cards_found = 0;
- int i, err, pci_using_dac;
+ int err, pci_using_dac;
u16 eeprom_data = 0;
u16 eeprom_apme_mask = E1000_EEPROM_APME;
int bars;
@@ -984,11 +984,8 @@ err_eeprom:
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:
@@ -1017,7 +1014,6 @@ iegbe_remove(struct pci_dev *pdev)
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
@@ -1030,15 +1026,11 @@ iegbe_remove(struct pci_dev *pdev)
}
unregister_netdev(netdev);
- for (i = 0x0; i < adapter->num_rx_queues; i++)
- dev_put(&adapter->polling_netdev[i]);
-
if(!iegbe_check_phy_reset_block(&adapter->hw)) {
iegbe_phy_hw_reset(&adapter->hw);
}
kfree(adapter->tx_ring);
kfree(adapter->rx_ring);
- kfree(adapter->polling_netdev);
iounmap(adapter->hw.hw_addr);
pci_release_regions(pdev);
@@ -1061,7 +1053,6 @@ iegbe_sw_init(struct iegbe_adapter *adap
struct iegbe_hw *hw = &adapter->hw;
struct net_device *netdev = adapter->netdev;
struct pci_dev *pdev = adapter->pdev;
- int i;
/* PCI config space info */
@@ -1111,11 +1102,6 @@ iegbe_sw_init(struct iegbe_adapter *adap
return -ENOMEM;
}
- for (i = 0; i < adapter->num_rx_queues; i++) {
- adapter->polling_netdev[i].priv = adapter;
- dev_hold(&adapter->polling_netdev[i]);
- set_bit(__LINK_STATE_START, &adapter->polling_netdev[i].state);
- }
spin_lock_init(&adapter->tx_queue_lock);
/*
@@ -1137,8 +1123,7 @@ iegbe_sw_init(struct iegbe_adapter *adap
* @adapter: board private structure to initialize
*
* We allocate one ring per queue at run-time since we don't know the
- * number of queues at compile-time. The polling_netdev array is
- * intended for Multiqueue, but should work fine with a single queue.
+ * number of queues at compile-time.
**/
static int __devinit
@@ -1158,15 +1143,6 @@ iegbe_alloc_queues(struct iegbe_adapter
return -ENOMEM;
}
- 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;
- }
-
return E1000_SUCCESS;
}

View File

@@ -0,0 +1,60 @@
--- a/Embedded/src/GbE/iegbe_main.c
+++ b/Embedded/src/GbE/iegbe_main.c
@@ -2161,7 +2161,8 @@ static void iegbe_set_rx_mode(struct net
{
struct iegbe_adapter *adapter = netdev_priv(netdev);
struct iegbe_hw *hw = &adapter->hw;
- struct dev_addr_list *uc_ptr;
+ struct netdev_hw_addr *ha;
+ bool use_uc = false;
struct dev_addr_list *mc_ptr;
u32 rctl;
u32 hash_value;
@@ -2187,12 +2188,11 @@ int mta_reg_count = E1000_NUM_MTA_REGIST
}
}
- uc_ptr = NULL;
if (netdev->uc_count > rar_entries - 1) {
rctl |= E1000_RCTL_UPE;
} else if (!(netdev->flags & IFF_PROMISC)) {
rctl &= ~E1000_RCTL_UPE;
- uc_ptr = netdev->uc_list;
+ use_uc = true;
}
E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
@@ -2210,13 +2210,20 @@ int mta_reg_count = E1000_NUM_MTA_REGIST
* if there are not 14 addresses, go ahead and clear the filters
* -- with 82571 controllers only 0-13 entries are filled here
*/
+ i = 1;
+ if (use_uc)
+ list_for_each_entry(ha, &netdev->uc_list, list) {
+ if (i == rar_entries)
+ break;
+ iegbe_rar_set(hw, ha->addr, i++);
+ }
+
+ WARN_ON(i == rar_entries);
+
mc_ptr = netdev->mc_list;
- for (i = 1; i < rar_entries; i++) {
- if (uc_ptr) {
- iegbe_rar_set(hw, uc_ptr->da_addr, i);
- uc_ptr = uc_ptr->next;
- } else if (mc_ptr) {
+ for (; i < rar_entries; i++) {
+ if (mc_ptr) {
iegbe_rar_set(hw, mc_ptr->da_addr, i);
mc_ptr = mc_ptr->next;
} else {
@@ -2226,7 +2233,6 @@ int mta_reg_count = E1000_NUM_MTA_REGIST
E1000_WRITE_FLUSH(&adapter->hw);
}
}
- WARN_ON(uc_ptr != NULL);
/* clear the old settings from the multicast hash table */

View File

@@ -0,0 +1,20 @@
--- a/Embedded/src/GbE/iegbe_main.c
+++ b/Embedded/src/GbE/iegbe_main.c
@@ -2188,7 +2188,7 @@ int mta_reg_count = E1000_NUM_MTA_REGIST
}
}
- if (netdev->uc_count > rar_entries - 1) {
+ if (netdev->uc.count > rar_entries - 1) {
rctl |= E1000_RCTL_UPE;
} else if (!(netdev->flags & IFF_PROMISC)) {
rctl &= ~E1000_RCTL_UPE;
@@ -2212,7 +2212,7 @@ int mta_reg_count = E1000_NUM_MTA_REGIST
*/
i = 1;
if (use_uc)
- list_for_each_entry(ha, &netdev->uc_list, list) {
+ list_for_each_entry(ha, &netdev->uc.list, list) {
if (i == rar_entries)
break;
iegbe_rar_set(hw, ha->addr, i++);

View File

@@ -0,0 +1,20 @@
--- a/Embedded/src/GbE/iegbe_main.c
+++ b/Embedded/src/GbE/iegbe_main.c
@@ -775,13 +775,13 @@ static int __devinit iegbe_probe(struct
if (err)
return err;
- if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK) &&
- !pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) {
+ if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
+ !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
pci_using_dac = 1;
} else {
- err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
+ err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
if (err) {
- err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
+ err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
if (err) {
E1000_ERR("No usable DMA configuration, "
"aborting\n");

View File

@@ -0,0 +1,12 @@
--- a/Embedded/src/GbE/iegbe_ethtool.c
+++ b/Embedded/src/GbE/iegbe_ethtool.c
@@ -944,7 +944,8 @@ iegbe_intr_test(struct iegbe_adapter *ad
*data = 0;
/* Hook up test interrupt handler just for this test */
- if(!request_irq(irq, &iegbe_test_intr, 0, netdev->name, netdev)) {
+ if(!request_irq(irq, &iegbe_test_intr, IRQF_PROBE_SHARED, netdev->name,
+ netdev)) {
shared_int = FALSE;
} else if(request_irq(irq, &iegbe_test_intr, IRQF_SHARED,
netdev->name, netdev)){

View File

@@ -0,0 +1,747 @@
--- a/Embedded/src/GbE/iegbe_oem_phy.c
+++ b/Embedded/src/GbE/iegbe_oem_phy.c
@@ -65,6 +65,10 @@ static int32_t iegbe_oem_link_m88_setup(
static int32_t iegbe_oem_set_phy_mode(struct iegbe_hw *hw);
static int32_t iegbe_oem_detect_phy(struct iegbe_hw *hw);
+static int32_t iegbe_oem_link_bcm5481_setup(struct iegbe_hw *hw);
+static int32_t bcm5481_read_18sv (struct iegbe_hw *hw, int sv, uint16_t *data);
+static int32_t oi_phy_setup (struct iegbe_hw *hw);
+
/**
* iegbe_oem_setup_link
* @hw: iegbe_hw struct containing device specific information
@@ -114,6 +118,10 @@ iegbe_oem_setup_link(struct iegbe_hw *hw
}
switch (hw->phy_id) {
+ case BCM5395S_PHY_ID:
+ return E1000_SUCCESS;
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
ret_val = iegbe_oem_link_m88_setup(hw);
@@ -121,6 +129,12 @@ iegbe_oem_setup_link(struct iegbe_hw *hw
return ret_val;
}
break;
+ case BCM5481_PHY_ID:
+ ret_val = iegbe_oem_link_bcm5481_setup(hw);
+ if(ret_val) {
+ return ret_val;
+ }
+ break;
default:
DEBUGOUT("Invalid PHY ID\n");
return -E1000_ERR_PHY_TYPE;
@@ -179,6 +193,51 @@ iegbe_oem_setup_link(struct iegbe_hw *hw
#endif /* ifdef EXTERNAL_MDIO */
}
+/**
+ * iegbe_oem_link_bcm5481_setup
+ * @hw: iegbe_hw struct containing device specific information
+ *
+ * Returns E1000_SUCCESS, negative E1000 error code on failure
+ *
+ * copied verbatim from iegbe_oem_link_m88_setup
+ **/
+static int32_t
+iegbe_oem_link_bcm5481_setup(struct iegbe_hw *hw)
+{
+ int32_t ret_val;
+ uint16_t phy_data;
+
+ //DEBUGFUNC(__func__);
+
+ if(!hw)
+ return -1;
+
+ /* phy_reset_disable is set in iegbe_oem_set_phy_mode */
+ if(hw->phy_reset_disable)
+ return E1000_SUCCESS;
+
+ // Enable MDIX in extended control reg.
+ ret_val = iegbe_oem_read_phy_reg_ex(hw, BCM5481_ECTRL, &phy_data);
+ if(ret_val)
+ {
+ DEBUGOUT("Unable to read BCM5481_ECTRL register\n");
+ return ret_val;
+ }
+
+ phy_data &= ~BCM5481_ECTRL_DISMDIX;
+ ret_val = iegbe_oem_write_phy_reg_ex(hw, BCM5481_ECTRL, phy_data);
+ if(ret_val)
+ {
+ DEBUGOUT("Unable to write BCM5481_ECTRL register\n");
+ return ret_val;
+ }
+
+ ret_val = oi_phy_setup (hw);
+ if (ret_val)
+ return ret_val;
+
+ return E1000_SUCCESS;
+}
/**
* iegbe_oem_link_m88_setup
@@ -340,6 +399,11 @@ iegbe_oem_force_mdi(struct iegbe_hw *hw,
* see iegbe_phy_force_speed_duplex, which does the following for M88
*/
switch (hw->phy_id) {
+ case BCM5395S_PHY_ID:
+ case BCM5481_PHY_ID:
+ DEBUGOUT("WARNING: An empty iegbe_oem_force_mdi() has been called!\n");
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
ret_val = iegbe_oem_read_phy_reg_ex(hw,
@@ -415,6 +479,8 @@ iegbe_oem_phy_reset_dsp(struct iegbe_hw
switch (hw->phy_id) {
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
+ case BCM5481_PHY_ID:
+ case BCM5395S_PHY_ID:
DEBUGOUT("No DSP to reset on OEM PHY\n");
break;
default:
@@ -460,6 +526,11 @@ iegbe_oem_cleanup_after_phy_reset(struct
* see iegbe_phy_force_speed_duplex, which does the following for M88
*/
switch (hw->phy_id) {
+ case BCM5395S_PHY_ID:
+ case BCM5481_PHY_ID:
+ DEBUGOUT("WARNING: An empty iegbe_oem_cleanup_after_phy_reset() has been called!\n");
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
/*
@@ -573,6 +644,11 @@ iegbe_oem_set_phy_mode(struct iegbe_hw *
* use iegbe_set_phy_mode as example
*/
switch (hw->phy_id) {
+ case BCM5395S_PHY_ID:
+ case BCM5481_PHY_ID:
+ DEBUGOUT("WARNING: An empty iegbe_oem_set_phy_mode() has been called!\n");
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
ret_val = iegbe_read_eeprom(hw,
@@ -641,6 +717,19 @@ iegbe_oem_detect_phy(struct iegbe_hw *hw
}
hw->phy_type = iegbe_phy_oem;
+{
+ // If MAC2 (BCM5395 switch), manually detect the phy
+ struct iegbe_adapter *adapter;
+ uint32_t device_number;
+ adapter = (struct iegbe_adapter *) hw->back;
+ device_number = PCI_SLOT(adapter->pdev->devfn);
+ if (device_number == ICP_XXXX_MAC_2) {
+ hw->phy_id = BCM5395S_PHY_ID;
+ hw->phy_revision = 0;
+ return E1000_SUCCESS;
+ }
+}
+
ret_val = iegbe_oem_read_phy_reg_ex(hw, PHY_ID1, &phy_id_high);
if(ret_val) {
DEBUGOUT("Unable to read PHY register PHY_ID1\n");
@@ -690,6 +779,8 @@ iegbe_oem_get_tipg(struct iegbe_hw *hw)
switch (hw->phy_id) {
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
+ case BCM5481_PHY_ID:
+ case BCM5395S_PHY_ID:
phy_num = DEFAULT_ICP_XXXX_TIPG_IPGT;
break;
default:
@@ -738,6 +829,8 @@ iegbe_oem_phy_is_copper(struct iegbe_hw
switch (hw->phy_id) {
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
+ case BCM5481_PHY_ID:
+ case BCM5395S_PHY_ID:
isCopper = TRUE;
break;
default:
@@ -796,13 +889,13 @@ iegbe_oem_get_phy_dev_number(struct iegb
switch(device_number)
{
case ICP_XXXX_MAC_0:
- hw->phy_addr = 0x00;
+ hw->phy_addr = 0x01;
break;
case ICP_XXXX_MAC_1:
- hw->phy_addr = 0x01;
+ hw->phy_addr = 0x02;
break;
case ICP_XXXX_MAC_2:
- hw->phy_addr = 0x02;
+ hw->phy_addr = 0x00;
break;
default: hw->phy_addr = 0x00;
}
@@ -851,6 +944,12 @@ iegbe_oem_mii_ioctl(struct iegbe_adapter
if(!adapter || !ifr) {
return -1;
}
+
+ // If MAC2 (BCM5395 switch) then leave now
+ if ((PCI_SLOT(adapter->pdev->devfn)) == ICP_XXXX_MAC_2) {
+ return -1;
+ }
+
switch (data->reg_num) {
case PHY_CTRL:
if(mii_reg & MII_CR_POWER_DOWN) {
@@ -987,6 +1086,11 @@ void iegbe_oem_get_phy_regs(struct iegbe
* [10] = mdix mode
*/
switch (adapter->hw.phy_id) {
+ case BCM5395S_PHY_ID:
+ case BCM5481_PHY_ID:
+ DEBUGOUT("WARNING: An empty iegbe_oem_get_phy_regs() has been called!\n");
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
if(corrected_len > 0) {
@@ -1068,8 +1172,13 @@ iegbe_oem_phy_loopback(struct iegbe_adap
* Loopback configuration is the same for each of the supported PHYs.
*/
switch (adapter->hw.phy_id) {
+ case BCM5395S_PHY_ID:
+ DEBUGOUT("WARNING: An empty iegbe_oem_phy_loopback() has been called!\n");
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
+ case BCM5481_PHY_ID:
adapter->hw.autoneg = FALSE;
@@ -1182,8 +1291,14 @@ iegbe_oem_loopback_cleanup(struct iegbe_
}
switch (adapter->hw.phy_id) {
+ case BCM5395S_PHY_ID:
+ DEBUGOUT("WARNING: An empty iegbe_oem_loopback_cleanup() has been called!\n");
+ return;
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
+ case BCM5481_PHY_ID:
default:
adapter->hw.autoneg = TRUE;
@@ -1243,6 +1358,11 @@ iegbe_oem_phy_speed_downgraded(struct ie
*/
switch (hw->phy_id) {
+ case BCM5395S_PHY_ID:
+ case BCM5481_PHY_ID:
+ *isDowngraded = 0;
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS,
@@ -1305,6 +1425,11 @@ iegbe_oem_check_polarity(struct iegbe_hw
*/
switch (hw->phy_id) {
+ case BCM5395S_PHY_ID:
+ case BCM5481_PHY_ID:
+ *polarity = 0;
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
/* return the Polarity bit in the Status register. */
@@ -1367,6 +1492,25 @@ iegbe_oem_phy_is_full_duplex(struct iegb
*/
switch (hw->phy_id) {
+ case BCM5395S_PHY_ID:
+ /* Always full duplex */
+ *isFD = 1;
+ break;
+
+ case BCM5481_PHY_ID:
+ ret_val = iegbe_read_phy_reg(hw, BCM5481_ASTAT, &phy_data);
+ if(ret_val) return ret_val;
+
+ switch (BCM5481_ASTAT_HCD(phy_data)) {
+ case BCM5481_ASTAT_1KBTFD:
+ case BCM5481_ASTAT_100BTXFD:
+ *isFD = 1;
+ break;
+ default:
+ *isFD = 0;
+ }
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS,
@@ -1423,6 +1567,25 @@ iegbe_oem_phy_is_speed_1000(struct iegbe
*/
switch (hw->phy_id) {
+ case BCM5395S_PHY_ID:
+ /* Always 1000mb */
+ *is1000 = 1;
+ break;
+
+ case BCM5481_PHY_ID:
+ ret_val = iegbe_read_phy_reg(hw, BCM5481_ASTAT, &phy_data);
+ if(ret_val) return ret_val;
+
+ switch (BCM5481_ASTAT_HCD(phy_data)) {
+ case BCM5481_ASTAT_1KBTFD:
+ case BCM5481_ASTAT_1KBTHD:
+ *is1000 = 1;
+ break;
+ default:
+ *is1000 = 0;
+ }
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS,
@@ -1478,6 +1641,25 @@ iegbe_oem_phy_is_speed_100(struct iegbe_
* see iegbe_config_mac_to_phy
*/
switch (hw->phy_id) {
+ case BCM5395S_PHY_ID:
+ /* Always 1000Mb, never 100mb */
+ *is100 = 0;
+ break;
+
+ case BCM5481_PHY_ID:
+ ret_val = iegbe_read_phy_reg(hw, BCM5481_ASTAT, &phy_data);
+ if(ret_val) return ret_val;
+
+ switch (BCM5481_ASTAT_HCD(phy_data)) {
+ case BCM5481_ASTAT_100BTXFD:
+ case BCM5481_ASTAT_100BTXHD:
+ *is100 = 1;
+ break;
+ default:
+ *is100 = 0;
+ }
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
ret_val = iegbe_oem_read_phy_reg_ex(hw,
@@ -1535,6 +1717,11 @@ iegbe_oem_phy_get_info(struct iegbe_hw *
* see iegbe_phy_m88_get_info
*/
switch (hw->phy_id) {
+ case BCM5395S_PHY_ID:
+ case BCM5481_PHY_ID:
+ DEBUGOUT("WARNING: An empty iegbe_oem_phy_get_info() has been called!\n");
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
/* The downshift status is checked only once, after link is
@@ -1636,8 +1823,13 @@ iegbe_oem_phy_hw_reset(struct iegbe_hw *
* the M88 used in truxton.
*/
switch (hw->phy_id) {
+ case BCM5395S_PHY_ID:
+ DEBUGOUT("WARNING: An empty iegbe_oem_phy_hw_reset() has been called!\n");
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
+ case BCM5481_PHY_ID:
ret_val = iegbe_oem_read_phy_reg_ex(hw, PHY_CTRL, &phy_data);
if(ret_val) {
DEBUGOUT("Unable to read register PHY_CTRL\n");
@@ -1699,6 +1891,8 @@ iegbe_oem_phy_init_script(struct iegbe_h
switch (hw->phy_id) {
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
+ case BCM5481_PHY_ID:
+ case BCM5395S_PHY_ID:
DEBUGOUT("Nothing to do for OEM PHY Init");
break;
default:
@@ -1735,6 +1929,11 @@ iegbe_oem_read_phy_reg_ex(struct iegbe_h
return -1;
}
+ if (hw->phy_id == BCM5395S_PHY_ID) {
+ DEBUGOUT("WARNING: iegbe_oem_read_phy_reg_ex() has been unexpectedly called!\n");
+ return -1;
+ }
+
/* call the GCU func that will read the phy
*
* Make note that the M88 phy is what'll be used on Truxton.
@@ -1782,6 +1981,11 @@ iegbe_oem_set_trans_gasket(struct iegbe_
}
switch (hw->phy_id) {
+ case BCM5395S_PHY_ID:
+ case BCM5481_PHY_ID:
+ DEBUGOUT("WARNING: An empty iegbe_oem_set_trans_gasket() has been called!\n");
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
/* Gasket set correctly for Marvell Phys, so nothing to do */
@@ -1886,6 +2090,8 @@ iegbe_oem_phy_needs_reset_with_mac(struc
switch (hw->phy_id) {
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
+ case BCM5481_PHY_ID:
+ case BCM5395S_PHY_ID:
ret_val = FALSE;
break;
default:
@@ -1935,6 +2141,8 @@ iegbe_oem_config_dsp_after_link_change(s
switch (hw->phy_id) {
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
+ case BCM5481_PHY_ID:
+ case BCM5395S_PHY_ID:
DEBUGOUT("No DSP to configure on OEM PHY");
break;
default:
@@ -1978,6 +2186,12 @@ iegbe_oem_get_cable_length(struct iegbe_
}
switch (hw->phy_id) {
+ case BCM5395S_PHY_ID:
+ case BCM5481_PHY_ID:
+ *min_length = 0;
+ *max_length = iegbe_igp_cable_length_150;
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
ret_val = iegbe_oem_read_phy_reg_ex(hw,
@@ -2061,6 +2275,23 @@ iegbe_oem_phy_is_link_up(struct iegbe_hw
*/
switch (hw->phy_id) {
+ case BCM5395S_PHY_ID:
+ /* Link always up */
+ *isUp = TRUE;
+ return E1000_SUCCESS;
+ break;
+
+ case BCM5481_PHY_ID:
+ iegbe_oem_read_phy_reg_ex(hw, BCM5481_ESTAT, &phy_data);
+ ret_val = iegbe_oem_read_phy_reg_ex(hw, BCM5481_ESTAT, &phy_data);
+ if(ret_val)
+ {
+ DEBUGOUT("Unable to read PHY register BCM5481_ESTAT\n");
+ return ret_val;
+ }
+ statusMask = BCM5481_ESTAT_LINK;
+ break;
+
case M88E1000_I_PHY_ID:
case M88E1141_E_PHY_ID:
iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
@@ -2092,3 +2323,210 @@ iegbe_oem_phy_is_link_up(struct iegbe_hw
#endif /* ifdef EXTERNAL_MDIO */
}
+
+
+//-----
+// Read BCM5481 expansion register
+//
+int32_t
+bcm5481_read_ex (struct iegbe_hw *hw, uint16_t reg, uint16_t *data)
+{
+ int ret;
+ uint16_t selector;
+ uint16_t reg_data;
+
+ // Get the current value of bits 15:12
+ ret = iegbe_oem_read_phy_reg_ex (hw, 0x15, &selector);
+ if (ret)
+ return ret;
+
+ // Select the expansion register
+ selector &= 0xf000;
+ selector |= (0xf << 8) | (reg);
+ iegbe_oem_write_phy_reg_ex (hw, 0x17, selector);
+
+ // Read the expansion register
+ ret = iegbe_oem_read_phy_reg_ex (hw, 0x15, &reg_data);
+
+ // De-select the expansion registers.
+ selector &= 0xf000;
+ iegbe_oem_write_phy_reg_ex (hw, 0x17, selector);
+
+ if (ret)
+ return ret;
+
+ *data = reg_data;
+ return ret;
+}
+
+//-----
+// Read reg 0x18 sub-register
+//
+static int32_t
+bcm5481_read_18sv (struct iegbe_hw *hw, int sv, uint16_t *data)
+{
+ int ret;
+ uint16_t tmp_data;
+
+ // Select reg 0x18, sv
+ tmp_data = ((sv & BCM5481_R18H_SV_MASK) << 12) | BCM5481_R18H_SV_MCTRL;
+ ret = iegbe_oem_write_phy_reg_ex (hw, BCM5481_R18H, tmp_data);
+ if(ret)
+ return ret;
+
+ // Read reg 0x18, sv
+ ret = iegbe_oem_read_phy_reg_ex (hw, BCM5481_R18H, &tmp_data);
+ if(ret)
+ return ret;
+
+ *data = tmp_data;
+ return ret;
+}
+
+//-----
+// Read reg 0x1C sub-register
+//
+int32_t
+bcm5481_read_1csv (struct iegbe_hw *hw, int sv, uint16_t *data)
+{
+ int ret;
+ uint16_t tmp_data;
+
+ // Select reg 0x1c, sv
+ tmp_data = ((sv & BCM5481_R1CH_SV_MASK) << BCM5481_R1CH_SV_SHIFT);
+
+ ret = iegbe_oem_write_phy_reg_ex (hw, BCM5481_R1CH, tmp_data);
+ if(ret)
+ return ret;
+
+ // Read reg 0x1c, sv
+ ret = iegbe_oem_read_phy_reg_ex (hw, BCM5481_R1CH, &tmp_data);
+ if(ret)
+ return ret;
+
+ *data = tmp_data;
+ return ret;
+}
+
+//-----
+// Read-modify-write a 0x1C register.
+//
+// hw - hardware access info.
+// reg - 0x1C register to modify.
+// data - bits which should be set.
+// mask - the '1' bits in this argument will be cleared in the data
+// read from 'reg' then 'data' will be or'd in and the result
+// will be written to 'reg'.
+
+int32_t
+bcm5481_rmw_1csv (struct iegbe_hw *hw, uint16_t reg, uint16_t data, uint16_t mask)
+{
+ int32_t ret;
+ uint16_t reg_data;
+
+ ret = 0;
+
+ ret = bcm5481_read_1csv (hw, reg, &reg_data);
+ if (ret)
+ {
+ DEBUGOUT("Unable to read BCM5481 1CH register\n");
+ printk (KERN_ERR "Unable to read BCM5481 1CH register [0x%x]\n", reg);
+ return ret;
+ }
+
+ reg_data &= ~mask;
+ reg_data |= (BCM5481_R1CH_WE | data);
+
+ ret = iegbe_oem_write_phy_reg_ex (hw, BCM5481_R1CH, reg_data);
+ if(ret)
+ {
+ DEBUGOUT("Unable to write BCM5481 1CH register\n");
+ printk (KERN_ERR "Unable to write BCM5481 1CH register\n");
+ return ret;
+ }
+
+ return ret;
+}
+
+int32_t
+oi_phy_setup (struct iegbe_hw *hw)
+{
+ int ret;
+ uint16_t pmii_data;
+ uint16_t mctrl_data;
+ uint16_t cacr_data;
+
+ ret = 0;
+
+ // Set low power mode via reg 0x18, sv010, bit 6
+ // Do a read-modify-write on reg 0x18, sv010 register to preserve existing bits.
+ ret = bcm5481_read_18sv (hw, BCM5481_R18H_SV_PMII, &pmii_data);
+ if (ret)
+ {
+ DEBUGOUT("Unable to read BCM5481_R18H_SV_PMII register\n");
+ printk (KERN_ERR "Unable to read BCM5481_R18H_SV_PMII register\n");
+ return ret;
+ }
+
+ // Set the LPM bit in the data just read and write back to sv010
+ // The shadow register select bits [2:0] are set by reading the sv010
+ // register.
+ pmii_data |= BCM5481_R18H_SV010_LPM;
+ ret = iegbe_oem_write_phy_reg_ex (hw, BCM5481_R18H, pmii_data);
+ if(ret)
+ {
+ DEBUGOUT("Unable to write BCM5481_R18H register\n");
+ printk (KERN_ERR "Unable to write BCM5481_R18H register\n");
+ return ret;
+ }
+
+
+ // Set the RGMII RXD to RXC skew bit in reg 0x18, sv111
+
+ if (bcm5481_read_18sv (hw, BCM5481_R18H_SV_MCTRL, &mctrl_data))
+ {
+ DEBUGOUT("Unable to read BCM5481_R18H_SV_MCTRL register\n");
+ printk (KERN_ERR "Unable to read BCM5481_R18H_SV_MCTRL register\n");
+ return ret;
+ }
+ mctrl_data |= (BCM5481_R18H_WE | BCM5481_R18H_SV111_SKEW);
+
+ ret = iegbe_oem_write_phy_reg_ex (hw, BCM5481_R18H, mctrl_data);
+ if(ret)
+ {
+ DEBUGOUT("Unable to write BCM5481_R18H register\n");
+ printk (KERN_ERR "Unable to write BCM5481_R18H register\n");
+ return ret;
+ }
+
+ // Enable RGMII transmit clock delay in reg 0x1c, sv00011
+ ret = bcm5481_read_1csv (hw, BCM5481_R1CH_CACR, &cacr_data);
+ if (ret)
+ {
+ DEBUGOUT("Unable to read BCM5481_R1CH_CACR register\n");
+ printk (KERN_ERR "Unable to read BCM5481_R1CH_CACR register\n");
+ return ret;
+ }
+
+ cacr_data |= (BCM5481_R1CH_WE | BCM5481_R1CH_CACR_TCD);
+
+ ret = iegbe_oem_write_phy_reg_ex (hw, BCM5481_R1CH, cacr_data);
+ if(ret)
+ {
+ DEBUGOUT("Unable to write BCM5481_R1CH register\n");
+ printk (KERN_ERR "Unable to write BCM5481_R1CH register\n");
+ return ret;
+ }
+
+ // Enable dual link speed indication (0x1c, sv 00010, bit 2)
+ ret = bcm5481_rmw_1csv (hw, BCM5481_R1CH_SC1, BCM5481_R1CH_SC1_LINK, BCM5481_R1CH_SC1_LINK);
+ if (ret)
+ return ret;
+
+ // Enable link and activity on ACTIVITY LED (0x1c, sv 01001, bit 4=1, bit 3=0)
+ ret = bcm5481_rmw_1csv (hw, BCM5481_R1CH_LCTRL, BCM5481_R1CH_LCTRL_ALEN, BCM5481_R1CH_LCTRL_ALEN | BCM5481_R1CH_LCTRL_AEN);
+ if (ret)
+ return ret;
+
+ return ret;
+}
--- a/Embedded/src/GbE/iegbe_oem_phy.h
+++ b/Embedded/src/GbE/iegbe_oem_phy.h
@@ -95,6 +95,8 @@ int32_t iegbe_oem_phy_is_link_up(struct
#define DEFAULT_ICP_XXXX_TIPG_IPGT 8 /* Inter Packet Gap Transmit Time */
#define ICP_XXXX_TIPG_IPGT_MASK 0x000003FFUL
+#define BCM5481_PHY_ID 0x0143BCA0
+#define BCM5395S_PHY_ID 0x0143BCF0
/* Miscellaneous defines */
#ifdef IEGBE_10_100_ONLY
@@ -103,5 +105,65 @@ int32_t iegbe_oem_phy_is_link_up(struct
#define ICP_XXXX_AUTONEG_ADV_DEFAULT 0x2F
#endif
+/* BCM5481 specifics */
+
+#define BCM5481_ECTRL (0x10)
+#define BCM5481_ESTAT (0x11)
+#define BCM5481_RXERR (0x12)
+#define BCM5481_EXPRW (0x15)
+#define BCM5481_EXPACC (0x17)
+#define BCM5481_ASTAT (0x19)
+#define BCM5481_R18H (0x18)
+#define BCM5481_R1CH (0x1c)
+
+/* indirect register access via register 18h */
+
+#define BCM5481_R18H_SV_MASK (7) // Mask for SV bits.
+#define BCM5481_R18H_SV_ACTRL (0) // SV000 Aux. control
+#define BCM5481_R18H_SV_10BT (1) // SV001 10Base-T
+#define BCM5481_R18H_SV_PMII (2) // SV010 Power/MII control
+#define BCM5481_R18H_SV_MTEST (4) // SV100 Misc. test
+#define BCM5481_R18H_SV_MCTRL (7) // SV111 Misc. control
+
+#define BCM5481_R18H_SV001_POL (1 << 13) // Polarity
+#define BCM5481_R18H_SV010_LPM (1 << 6)
+#define BCM5481_R18H_SV111_SKEW (1 << 8)
+#define BCM5481_R18H_WE (1 << 15) // Write enable
+
+// 0x1c registers
+#define BCM5481_R1CH_SV_SHIFT (10)
+#define BCM5481_R1CH_SV_MASK (0x1f)
+#define BCM5481_R1CH_SC1 (0x02) // sv00010 Spare control 1
+#define BCM5481_R1CH_CACR (0x03) // sv00011 Clock alignment control
+#define BCM5481_R1CH_LCTRL (0x09) // sv01001 LED control
+#define BCM5481_R1CH_LEDS1 (0x0d) // sv01101 LED selector 1
+
+// 0x1c common
+#define BCM5481_R1CH_WE (1 << 15) // Write enable
+
+// 0x1c, sv 00010
+#define BCM5481_R1CH_SC1_LINK (1 << 2) // sv00010 Linkspeed
+
+// 0x1c, sv 00011
+#define BCM5481_R1CH_CACR_TCD (1 << 9) // sv00011 RGMII tx clock delay
+
+// 0x1c, sv 01001
+#define BCM5481_R1CH_LCTRL_ALEN (1 << 4) // Activity/Link enable on ACTIVITY LED
+#define BCM5481_R1CH_LCTRL_AEN (1 << 3) // Activity enable on ACTIVITY LED
+
+#define BCM5481_ECTRL_DISMDIX (1 <<14)
+
+#define BCM5481_MCTRL_AUTOMDIX (1 <<9)
+
+#define BCM5481_ESTAT_LINK (1 << 8)
+
+#define BCM5481_ASTAT_ANC (1 << 15)
+#define BCM5481_ASTAT_ANHCD (7 << 8)
+#define BCM5481_ASTAT_HCD(x) ((x >> 8) & 7)
+#define BCM5481_ASTAT_1KBTFD (0x7)
+#define BCM5481_ASTAT_1KBTHD (0x6)
+#define BCM5481_ASTAT_100BTXFD (0x5)
+#define BCM5481_ASTAT_100BTXHD (0x3)
+
#endif /* ifndef _IEGBE_OEM_PHY_H_ */

View File

@@ -0,0 +1,11 @@
--- a/Embedded/src/CAN/icp_can_user.h
+++ b/Embedded/src/CAN/icp_can_user.h
@@ -63,6 +63,8 @@
#ifndef __ICP_CAN_USER_H__
#define __ICP_CAN_USER_H__
+#include <linux/ioctl.h>
+
/*****************************************************************************
* Device IO control codes.
*****************************************************************************/

View File

@@ -0,0 +1,11 @@
--- a/Embedded/src/CAN/can_main.c
+++ b/Embedded/src/CAN/can_main.c
@@ -70,6 +70,8 @@
#include "can_main.h"
#include "can_ioctl.h"
+#include <linux/fs.h>
+
MODULE_AUTHOR("Intel(R) Corporation");
MODULE_DESCRIPTION("Controller Area Network Driver");

View File

@@ -0,0 +1,23 @@
--- a/Embedded/src/CAN/can_main.c
+++ b/Embedded/src/CAN/can_main.c
@@ -654,7 +654,7 @@ int can_dev_io(struct inode *inode, stru
/*****************************************************************************
* Interrupt handler.
*****************************************************************************/
-irqreturn_t can_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
+irqreturn_t can_irq_handler(int irq, void *dev_id)
{
can_os_t *can_os = (can_os_t *) dev_id;
unsigned int int_status;
--- a/Embedded/src/CAN/can_main.h
+++ b/Embedded/src/CAN/can_main.h
@@ -165,8 +165,7 @@ int can_dev_io(
irqreturn_t can_irq_handler(
int irq,
- void *dev_id,
- struct pt_regs *regs);
+ void *dev_id);
void can_tasklet(
unsigned long arg

View File

@@ -0,0 +1,40 @@
--- a/Embedded/src/CAN/can_main.c
+++ b/Embedded/src/CAN/can_main.c
@@ -214,8 +214,8 @@ int can_pci_probe(struct pci_dev *dev, c
spin_lock_init(&(g_can_os[can_num].int_spinlock));
spin_lock_init(&(g_can_os[can_num].open_spinlock));
- dev->dev.driver_data = (void *) &(g_can_os[can_num]);
- if (!dev->dev.driver_data)
+ dev_set_drvdata(&dev->dev, (void *) &(g_can_os[can_num]));
+ if (!dev_get_drvdata(&dev->dev))
{
printk("Couldn't create CAN device %d. Exiting.\n",
dev->device);
@@ -237,7 +237,7 @@ int can_pci_probe(struct pci_dev *dev, c
*****************************************************************************/
void can_pci_remove(struct pci_dev *dev)
{
- can_os_t *can_os = dev->dev.driver_data;
+ can_os_t *can_os = dev_get_drvdata(&dev->dev);
iounmap(can_os->pci_remap);
icp_can_destroy(can_os->can);
@@ -251,7 +251,7 @@ int can_pci_suspend(struct pci_dev *dev,
{
unsigned int i;
unsigned int int_status;
- can_os_t *can_os = dev->dev.driver_data;
+ can_os_t *can_os = dev_get_drvdata(&dev->dev);
int err;
/* Indicate that we are suspending */
@@ -322,7 +322,7 @@ int can_pci_suspend(struct pci_dev *dev,
int can_pci_resume(struct pci_dev *dev)
{
unsigned int i;
- can_os_t *can_os = dev->dev.driver_data;
+ can_os_t *can_os = dev_get_drvdata(&dev->dev);
/* Restore PCI CFG space */
pci_restore_state(dev);

View File

@@ -0,0 +1,59 @@
--- a/Embedded/src/WDT/iwdt.c
+++ b/Embedded/src/WDT/iwdt.c
@@ -180,19 +180,19 @@ MODULE_PARM_DESC(wdt_scale, "Intel WDT s
module_param(wdt_intr_type, byte, WDT_INT_TYPE_IRQ);
MODULE_PARM_DESC(wdt_intr_type, "Intel WDT interrupt type (default SERIRQ).");
-module_param(wdt_margin1, uint, TIMER_MARGIN);
+module_param(wdt_margin1, uint, 0);
MODULE_PARM_DESC(wdt_margin1, "First stage Intel WDT timeout in steps of 1 ms by default.");
-module_param(wdt_margin2, uint, TIMER_MARGIN);
+module_param(wdt_margin2, uint, 0);
MODULE_PARM_DESC(wdt_margin2, "Second stage Intel WDT timeout in steps of 1 ms by default.");
module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Intel WDT can't be stopped once started (default=0)");
-module_param(wdt_index_port, int, 0x4E);
+module_param(wdt_index_port, int, 0);
MODULE_PARM_DESC(wdt_index_port, "WDT Index Port (default 0x4e)");
-module_param(wdt_data_port, int, 0x4E);
+module_param(wdt_data_port, int, 0);
MODULE_PARM_DESC(wdt_data_port, "WDT Data Port (default 0x4f)");
static int wdt_get_iobase(struct pci_dev *dev, u16 *iobase, int *irq);
@@ -218,7 +218,7 @@ static ssize_t wdt_write(struct file *fi
size_t count, loff_t * pos);
static int wdt_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
-static irqreturn_t wdt_isr(int irq, void *dev_id, struct pt_regs *regs);
+static irqreturn_t wdt_isr(int irq, void *dev_id);
static void __exit wdt_cleanup(void);
static int __init wdt_init(void);
static int __init wdt_init_one(struct pci_dev *dev,
@@ -255,7 +255,7 @@ static struct pci_driver wdt_driver = {
name: "iwdt",
id_table: lpc_pci_tbl,
probe: wdt_init_one,
- remove: __devexit(wdt_remove_one),
+ remove: __devexit_p(wdt_remove_one),
suspend: wdt_pci_suspend,
resume: wdt_pci_resume,
};
@@ -1393,12 +1393,12 @@ static int wdt_ioctl(struct inode *inode
/*
* Function Name: wdt_isr()
- * Parameter: int irq - irq number, void *dev_id, struct pt_regs *regs
+ * Parameter: int irq - irq number, void *dev_id
* Return Value:: IRQ_NONE - if the interrupt is not for wdt.
* IRQ_HANDLED - if it is for wdt.
* Description: This is the interrupt service routine of the WDT.
*/
-static irqreturn_t wdt_isr(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t wdt_isr(int irq, void *dev_id)
{
u8 val;

View File

@@ -0,0 +1,22 @@
--- a/Embedded/src/EDMA/dma_linux.c
+++ b/Embedded/src/EDMA/dma_linux.c
@@ -149,8 +149,7 @@ int32_t edma_suspend (struct pci_dev *de
int32_t edma_resume(struct pci_dev *dev);
int32_t initialize_edma_device(struct edma_device *device);
-static irqreturn_t edma_irq_handler(int32_t irq, void * dev_id,
- struct pt_regs * regs);
+static irqreturn_t edma_irq_handler(int32_t irq, void * dev_id);
/* Prototypes - Misc. */
@@ -429,8 +428,7 @@ int32_t edma_release(struct inode * inod
* Return Values: HANDLED = 1, NOT_HANDLED = 0
*****************************************************************************/
-static irqreturn_t edma_irq_handler(int32_t irq, void * dev_id,
- struct pt_regs * regs)
+static irqreturn_t edma_irq_handler(int32_t irq, void * dev_id)
{
uint32_t clear_bits;

View File

@@ -0,0 +1,22 @@
--- a/Embedded/src/1588/1588.c
+++ b/Embedded/src/1588/1588.c
@@ -631,7 +631,7 @@ int restore_interrupts(void)
IRQ_NONE => this device did not interrupt
******************************************************************************/
-irqreturn_t timesync_isr(int irq, void *dev_id, struct pt_regs *regs)
+irqreturn_t timesync_isr(int irq, void *dev_id)
{
if ( !ixTimeSyncAccEventAmmsFlagGet() && !ixTimeSyncAccEventAsmsFlagGet()&&
!ixTimeSyncAccEventAtmFlagGet() && !ixTimeSyncAccEventPpsmFlagGet()&&
--- a/Embedded/src/1588/1588.h
+++ b/Embedded/src/1588/1588.h
@@ -128,7 +128,7 @@ int pci_suspend(struct pci_dev *dev, pm_
int pci_resume(struct pci_dev *dev);
int pci_probe(struct pci_dev *dev, const struct pci_device_id *id);
void pci_remove(struct pci_dev *dev);
-irqreturn_t timesync_isr(int irq, void *dev_id, struct pt_regs *regs);
+irqreturn_t timesync_isr(int irq, void *dev_id);
// private functions
int save_reg_state(void);

View File

@@ -0,0 +1,22 @@
--- a/Embedded/src/CAN/can_main.h
+++ b/Embedded/src/CAN/can_main.h
@@ -65,7 +65,7 @@
#include <linux/interrupt.h>
#include <linux/pci.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
#include <linux/spinlock.h>
#include <linux/cdev.h>
#include <asm/uaccess.h>
--- a/Embedded/src/EDMA/dma_linux.c
+++ b/Embedded/src/EDMA/dma_linux.c
@@ -87,7 +87,7 @@
#include <linux/fcntl.h> /* O_ACCMODE */
#include <asm/system.h> /* cli, *_flags */
#include <asm/uaccess.h> /* copy_to_user */
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
#include <asm/io.h> /* inb(), outb() */
#include <linux/kmod.h>
#include <linux/ioport.h> /* request_region */

View File

@@ -0,0 +1,30 @@
--- a/Embedded/src/1588/1588.c
+++ b/Embedded/src/1588/1588.c
@@ -72,6 +72,7 @@
*
****************************************************************************/
+#include <linux/sched.h>
#include "1588.h"
MODULE_AUTHOR("Intel(R) Corporation");
--- a/Embedded/src/CAN/can_main.c
+++ b/Embedded/src/CAN/can_main.c
@@ -68,6 +68,7 @@
*
**************************************************************************/
+#include <linux/sched.h>
#include "can_main.h"
#include "can_ioctl.h"
#include <linux/fs.h>
--- a/Embedded/src/WDT/iwdt.c
+++ b/Embedded/src/WDT/iwdt.c
@@ -137,6 +137,7 @@
#include <linux/watchdog.h>
#include <linux/miscdevice.h>
#include <linux/interrupt.h>
+#include <linux/sched.h>
#include "iwdt.h"
MODULE_AUTHOR("Intel(R) Corporation");

View File

@@ -0,0 +1,31 @@
--- a/Embedded/src/GbE/kcompat.h
+++ b/Embedded/src/GbE/kcompat.h
@@ -46,12 +46,6 @@ GPL LICENSE SUMMARY
#include <linux/sched.h>
#include <asm/io.h>
-#ifndef IRQ_HANDLED
-#define irqreturn_t void
-#define IRQ_HANDLED
-#define IRQ_NONE
-#endif
-
#ifndef SET_NETDEV_DEV
#define SET_NETDEV_DEV(net, pdev)
#endif
@@ -748,6 +742,15 @@ extern void dump_stack(void);
#endif /* 2.4.24 */
+/*****************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) )
+#ifndef IRQ_HANDLED
+#define irqreturn_t void
+#define IRQ_HANDLED
+#define IRQ_NONE
+#endif
+#endif /* < 2.6.30 */
+
#endif /* _KCOMPAT_H_ */

View File

@@ -0,0 +1,11 @@
--- a/Embedded/src/GbE/iegbe_main.c
+++ b/Embedded/src/GbE/iegbe_main.c
@@ -3534,7 +3534,7 @@ static int iegbe_clean(struct napi_struc
int tx_cleaned = 0, work_done = 0;
/* Must NOT use netdev_priv macro here. */
- adapter = poll_dev->priv;
+ adapter = netdev_priv(poll_dev);
/* iegbe_clean is called per-cpu. This lock protects
* tx_ring[0] from being cleaned by multiple cpus

View File

@@ -0,0 +1,91 @@
--- a/Embedded/src/GbE/Makefile
+++ b/Embedded/src/GbE/Makefile
@@ -60,19 +60,19 @@ GBE_NAME = iegbe
GCU_NAME = gcu
VERSION_FILE := $(KSRC)/include/linux/version.h
-UTS_REL_FILE := $(KSRC)/include/linux/utsrelease.h
-CONFIG_FILE := $(KSRC)/include/linux/autoconf.h
+UTS_REL_FILE := $(KSRC)/include/generated/utsrelease.h
+CONFIG_FILE := $(KSRC)/include/generated/autoconf.h
ifeq (,$(wildcard $(VERSION_FILE)))
$(error Linux kernel source not configured - missing version.h)
endif
ifeq (,$(wildcard $(CONFIG_FILE)))
- $(error Linux kernel source not configured - missing autoconf.h)
+ $(error Linux kernel source not configured - missing autoconf.h)
endif
ifeq (,$(wildcard $(UTS_REL_FILE)))
- $(error Linux kernel source not configured - missing utsrelease.h)
+ $(error Linux kernel source not configured - missing utsrelease.h)
endif
# set the install path
--- a/Embedded/src/1588/Makefile
+++ b/Embedded/src/1588/Makefile
@@ -97,8 +97,8 @@ OUTPUT_PATH ?= /
EXTRA_LDFLAGS += -whole-archive
VERSION_FILE := $(KOBJ)/include/linux/version.h
-UTS_REL_FILE := $(KSRC)/include/linux/utsrelease.h
-CONFIG_FILE := $(KOBJ)/include/linux/autoconf.h
+UTS_REL_FILE := $(KSRC)/include/generated/utsrelease.h
+CONFIG_FILE := $(KOBJ)/include/generated/autoconf.h
# as of 2.6.16, kernel define UTS_RELEASE has been moved to utsrelease.h
--- a/Embedded/src/CAN/Makefile
+++ b/Embedded/src/CAN/Makefile
@@ -100,8 +100,8 @@ OUTPUT_PATH ?= /
EXTRA_LDFLAGS += -whole-archive
VERSION_FILE := $(KOBJ)/include/linux/version.h
-UTS_REL_FILE := $(KSRC)/include/linux/utsrelease.h
-CONFIG_FILE := $(KOBJ)/include/linux/autoconf.h
+UTS_REL_FILE := $(KSRC)/include/generated/utsrelease.h
+CONFIG_FILE := $(KOBJ)/include/generated/autoconf.h
# as of 2.6.16, kernel define UTS_RELEASE has been moved to utsrelease.h
--- a/Embedded/src/EDMA/Makefile
+++ b/Embedded/src/EDMA/Makefile
@@ -114,8 +114,8 @@ OUTPUT_PATH ?= /
EXTRA_LDFLAGS += -whole-archive
VERSION_FILE := $(KOBJ)/include/linux/version.h
-UTS_REL_FILE := $(KSRC)/include/linux/utsrelease.h
-CONFIG_FILE := $(KOBJ)/include/linux/autoconf.h
+UTS_REL_FILE := $(KSRC)/include/generated/utsrelease.h
+CONFIG_FILE := $(KOBJ)/include/generated/autoconf.h
# as of 2.6.16, kernel define UTS_RELEASE has been moved to utsrelease.h
--- a/Embedded/src/GPIO/Makefile
+++ b/Embedded/src/GPIO/Makefile
@@ -97,8 +97,8 @@ OUTPUT_PATH ?= /
EXTRA_LDFLAGS += -whole-archive
VERSION_FILE := $(KOBJ)/include/linux/version.h
-UTS_REL_FILE := $(KSRC)/include/linux/utsrelease.h
-CONFIG_FILE := $(KOBJ)/include/linux/autoconf.h
+UTS_REL_FILE := $(KSRC)/include/generated/utsrelease.h
+CONFIG_FILE := $(KOBJ)/include/generated/autoconf.h
# as of 2.6.16, kernel define UTS_RELEASE has been moved to utsrelease.h
--- a/Embedded/src/WDT/Makefile
+++ b/Embedded/src/WDT/Makefile
@@ -99,8 +99,8 @@ OUTPUT_PATH ?= /
EXTRA_LDFLAGS += -whole-archive
VERSION_FILE := $(KOBJ)/include/linux/version.h
-UTS_REL_FILE := $(KSRC)/include/linux/utsrelease.h
-CONFIG_FILE := $(KOBJ)/include/linux/autoconf.h
+UTS_REL_FILE := $(KSRC)/include/generated/utsrelease.h
+CONFIG_FILE := $(KOBJ)/include/generated/autoconf.h
# as of 2.6.16, kernel define UTS_RELEASE has been moved to utsrelease.h

View File

@@ -0,0 +1,392 @@
--- a/Embedded/src/GbE/kcompat.h
+++ b/Embedded/src/GbE/kcompat.h
@@ -590,6 +590,10 @@ static inline void _kc_synchronize_irq()
#define ETHTOOL_OPS_COMPAT
#endif
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+#define HAVE_NETIF_MSG 1
+#endif
+
#ifndef HAVE_NETIF_MSG
#define HAVE_NETIF_MSG 1
enum {
--- a/Embedded/src/GbE/iegbe_main.c
+++ b/Embedded/src/GbE/iegbe_main.c
@@ -159,9 +159,9 @@ static void iegbe_smartspeed(struct iegb
static inline int iegbe_82547_fifo_workaround(struct iegbe_adapter *adapter,
struct sk_buff *skb);
-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 bool iegbe_vlan_used(struct iegbe_adapter *adapter);
+static int iegbe_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
+static int iegbe_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
static void iegbe_restore_vlan(struct iegbe_adapter *adapter);
static int iegbe_notify_reboot(struct notifier_block *,
@@ -324,8 +324,8 @@ static void iegbe_update_mng_vlan(struct
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 (iegbe_vlan_used(adapter)) {
+ if (!test_bit(old_vid, adapter->active_vlans)) {
if (hw->mng_cookie.status &
E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) {
iegbe_vlan_rx_add_vid(netdev, vid);
@@ -335,7 +335,7 @@ static void iegbe_update_mng_vlan(struct
if ((old_vid != (u16)E1000_MNG_VLAN_NONE) &&
(vid != old_vid) &&
- !vlan_group_get_device(adapter->vlgrp, old_vid))
+ !test_bit(old_vid, adapter->active_vlans))
iegbe_vlan_rx_kill_vid(netdev, old_vid);
} else
adapter->mng_vlan_id = vid;
@@ -736,7 +736,6 @@ static const struct net_device_ops iegbe
.ndo_do_ioctl = iegbe_ioctl,
.ndo_validate_addr = eth_validate_addr,
- .ndo_vlan_rx_register = iegbe_vlan_rx_register,
.ndo_vlan_rx_add_vid = iegbe_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = iegbe_vlan_rx_kill_vid,
#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -767,7 +766,6 @@ static int __devinit iegbe_probe(struct
u16 eeprom_data = 0;
u16 eeprom_apme_mask = E1000_EEPROM_APME;
int bars;
- DECLARE_MAC_BUF(mac);
bars = pci_select_bars(pdev, IORESOURCE_MEM);
err = pci_enable_device(pdev);
@@ -1247,8 +1245,7 @@ static int iegbe_close(struct net_device
if ((hw->mng_cookie.status &
E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
- !(adapter->vlgrp &&
- vlan_group_get_device(adapter->vlgrp, adapter->mng_vlan_id))) {
+ !test_bit(adapter->mng_vlan_id, adapter->active_vlans)) {
iegbe_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
}
return 0;
@@ -2163,11 +2160,13 @@ static void iegbe_set_rx_mode(struct net
struct iegbe_hw *hw = &adapter->hw;
struct netdev_hw_addr *ha;
bool use_uc = false;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
struct dev_addr_list *mc_ptr;
- u32 rctl;
u32 hash_value;
- int i, rar_entries = E1000_RAR_ENTRIES;
int mta_reg_count = E1000_NUM_MTA_REGISTERS;
+#endif
+ u32 rctl;
+ int i, rar_entries = E1000_RAR_ENTRIES;
/* reserve RAR[14] for LAA over-write work-around */
if (hw->mac_type == iegbe_82571)
@@ -2220,6 +2219,7 @@ int mta_reg_count = E1000_NUM_MTA_REGIST
WARN_ON(i == rar_entries);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
mc_ptr = netdev->mc_list;
for (; i < rar_entries; i++) {
@@ -2247,6 +2247,7 @@ int mta_reg_count = E1000_NUM_MTA_REGIST
hash_value = iegbe_hash_mc_addr(hw, mc_ptr->da_addr);
iegbe_mta_set(hw, hash_value);
}
+#endif
if (hw->mac_type == iegbe_82542_rev2_0)
iegbe_leave_82542_rst(adapter);
@@ -2821,14 +2822,14 @@ static int iegbe_tx_map(struct iegbe_ada
* Avoid terminating buffers within evenly-aligned
* dwords. */
if(unlikely(adapter->pcix_82544 &&
- !((unsigned long)(frag->page+offset+size-1) & 4) &&
+ !((unsigned long)(frag->page.p+offset+size-1) & 4) &&
size > 4))
size -= 4;
buffer_info->length = size;
buffer_info->dma =
pci_map_page(adapter->pdev,
- frag->page,
+ frag->page.p,
offset,
size,
PCI_DMA_TODEVICE);
@@ -3131,7 +3132,7 @@ static int iegbe_xmit_frame(struct sk_bu
}
}
- if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) {
+ if (unlikely(iegbe_vlan_used(adapter) && vlan_tx_tag_present(skb))) {
tx_flags |= E1000_TX_FLAGS_VLAN;
tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT);
}
@@ -3832,10 +3833,12 @@ static bool iegbe_clean_rx_irq(struct ie
skb->protocol = eth_type_trans(skb, netdev);
- if (unlikely(adapter->vlgrp &&
+ if (unlikely(iegbe_vlan_used(adapter) &&
(status & E1000_RXD_STAT_VP))) {
- vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
- le16_to_cpu(rx_desc->special));
+ u16 vid;
+
+ vid = le16_to_cpu(rx_desc->special);
+ __vlan_hwaccel_put_tag(skb, vid);
} else {
netif_receive_skb(skb);
}
@@ -3986,9 +3989,10 @@ copydone:
cpu_to_le16(E1000_RXDPS_HDRSTAT_HDRSP)))
adapter->rx_hdr_split++;
- if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
- vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
- le16_to_cpu(rx_desc->wb.middle.vlan));
+ if(unlikely(iegbe_vlan_used(adapter) && (staterr & E1000_RXD_STAT_VP))) {
+ u16 vid;
+ vid = le16_to_cpu(rx_desc->wb.middle.vlan);
+ __vlan_hwaccel_put_tag(skb, vid);
} else {
netif_receive_skb(skb);
}
@@ -4496,17 +4500,25 @@ iegbe_io_write(struct iegbe_hw *hw, unsi
outl(value, port);
}
-static void iegbe_vlan_rx_register(struct net_device *netdev,
- struct vlan_group *grp)
+static bool iegbe_vlan_used(struct iegbe_adapter *adapter)
+{
+ u16 vid;
+
+ for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
+ return true;
+
+ return false;
+}
+
+static void iegbe_vlan_mode(struct net_device *netdev, bool vlan_on)
{
struct iegbe_adapter *adapter = netdev_priv(netdev);
uint32_t ctrl, rctl;
if (!test_bit(__E1000_DOWN, &adapter->flags))
iegbe_irq_disable(adapter);
- adapter->vlgrp = grp;
- if(grp) {
+ if(vlan_on) {
/* enable VLAN tag insert/strip */
ctrl = E1000_READ_REG(&adapter->hw, CTRL);
ctrl |= E1000_CTRL_VME;
@@ -4538,30 +4550,37 @@ static void iegbe_vlan_rx_register(struc
iegbe_irq_enable(adapter);
}
-static void iegbe_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
+static int iegbe_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
{
struct iegbe_adapter *adapter = netdev_priv(netdev);
uint32_t vfta, index;
if((adapter->hw.mng_cookie.status &
E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
(vid == adapter->mng_vlan_id)) {
- return;
+ return 0;
}
+
+ if (!iegbe_vlan_used(adapter))
+ iegbe_vlan_mode(netdev, true);
+
/* add VID to filter table */
index = (vid >> 0x5) & 0x7F;
vfta = E1000_READ_REG_ARRAY(&adapter->hw, VFTA, index);
vfta |= (0x1 << (vid & 0x1F));
iegbe_write_vfta(&adapter->hw, index, vfta);
+
+ set_bit(vid, adapter->active_vlans);
+
+ return 0;
}
-static void iegbe_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
+static int iegbe_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
{
struct iegbe_adapter *adapter = netdev_priv(netdev);
u32 vfta, index;
if (!test_bit(__E1000_DOWN, &adapter->flags))
iegbe_irq_disable(adapter);
- vlan_group_set_device(adapter->vlgrp, vid, NULL);
if (!test_bit(__E1000_DOWN, &adapter->flags))
iegbe_irq_enable(adapter);
@@ -4570,21 +4589,26 @@ static void iegbe_vlan_rx_kill_vid(struc
vfta = E1000_READ_REG_ARRAY(&adapter->hw, VFTA, index);
vfta &= ~(0x1 << (vid & 0x1F));
iegbe_write_vfta(&adapter->hw, index, vfta);
+
+ clear_bit(vid, adapter->active_vlans);
+
+ if (!iegbe_vlan_used(adapter))
+ iegbe_vlan_mode(netdev, false);
+
+ return 0;
}
static void iegbe_restore_vlan(struct iegbe_adapter *adapter)
{
- iegbe_vlan_rx_register(adapter->netdev, adapter->vlgrp);
-
- if (adapter->vlgrp) {
u16 vid;
- for (vid = 0x0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
- if (!vlan_group_get_device(adapter->vlgrp, vid))
- continue;
+
+ if (!iegbe_vlan_used(adapter))
+ return;
+
+ iegbe_vlan_mode(adapter->netdev, true);
+ for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
iegbe_vlan_rx_add_vid(adapter->netdev, vid);
}
- }
-}
int iegbe_set_spd_dplx(struct iegbe_adapter *adapter, u16 spddplx)
@@ -4864,10 +4888,11 @@ iegbe_resume(struct pci_dev *pdev)
default:
break;
}
-#endif
return 0x0;
}
+#endif
+
#ifdef CONFIG_NET_POLL_CONTROLLER
/*
--- a/Embedded/src/GbE/iegbe_ethtool.c
+++ b/Embedded/src/GbE/iegbe_ethtool.c
@@ -327,6 +327,7 @@ iegbe_set_pauseparam(struct net_device *
return 0;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
static uint32_t
iegbe_get_rx_csum(struct net_device *netdev)
{
@@ -392,6 +393,7 @@ iegbe_set_tso(struct net_device *netdev,
return 0;
}
#endif /* NETIF_F_TSO */
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) */
static uint32_t
iegbe_get_msglevel(struct net_device *netdev)
@@ -807,6 +809,7 @@ err_setup_rx:
E1000_82542_##R : E1000_##R; \
return 1; } }
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
static int
iegbe_reg_test(struct iegbe_adapter *adapter, uint64_t *data)
{
@@ -1710,6 +1713,7 @@ iegbe_diag_test(struct net_device *netde
}
msleep_interruptible(0xfa0);
}
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) */
static void
iegbe_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
@@ -1812,6 +1816,7 @@ iegbe_set_wol(struct net_device *netdev,
/* bit defines for adapter->led_status */
#define E1000_LED_ON 0
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
static void
iegbe_led_blink_callback(unsigned long data)
{
@@ -1864,6 +1869,7 @@ iegbe_phys_id(struct net_device *netdev,
return 0;
}
+#endif
static int
iegbe_nway_reset(struct net_device *netdev)
@@ -1876,11 +1882,13 @@ iegbe_nway_reset(struct net_device *netd
return 0;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
static int
iegbe_get_stats_count(struct net_device *netdev)
{
return E1000_STATS_LEN;
}
+#endif
static void
iegbe_get_ethtool_stats(struct net_device *netdev,
@@ -1936,6 +1944,8 @@ struct ethtool_ops iegbe_ethtool_ops = {
.set_ringparam = iegbe_set_ringparam,
.get_pauseparam = iegbe_get_pauseparam,
.set_pauseparam = iegbe_set_pauseparam,
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
.get_rx_csum = iegbe_get_rx_csum,
.set_rx_csum = iegbe_set_rx_csum,
.get_tx_csum = iegbe_get_tx_csum,
@@ -1946,11 +1956,13 @@ struct ethtool_ops iegbe_ethtool_ops = {
.get_tso = ethtool_op_get_tso,
.set_tso = iegbe_set_tso,
#endif
+
.self_test_count = iegbe_diag_test_count,
.self_test = iegbe_diag_test,
- .get_strings = iegbe_get_strings,
.phys_id = iegbe_phys_id,
.get_stats_count = iegbe_get_stats_count,
+#endif
+ .get_strings = iegbe_get_strings,
.get_ethtool_stats = iegbe_get_ethtool_stats,
};
--- a/Embedded/src/GbE/gcu_main.c
+++ b/Embedded/src/GbE/gcu_main.c
@@ -93,7 +93,7 @@ static struct pci_driver gcu_driver = {
};
static struct gcu_adapter *global_adapter = 0;
-static spinlock_t global_adapter_spinlock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(global_adapter_spinlock);
static unsigned long g_intflags = 0;
MODULE_AUTHOR("Intel(R) Corporation");
--- a/Embedded/src/GbE/iegbe.h
+++ b/Embedded/src/GbE/iegbe.h
@@ -257,7 +257,7 @@ struct iegbe_adapter {
struct timer_list tx_fifo_stall_timer;
struct timer_list watchdog_timer;
struct timer_list phy_info_timer;
- struct vlan_group *vlgrp;
+ unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
uint16_t mng_vlan_id;
uint32_t bd_number;
uint32_t rx_buffer_len;

View File

@@ -0,0 +1,41 @@
--- a/Embedded/src/CAN/can_main.c
+++ b/Embedded/src/CAN/can_main.c
@@ -72,6 +72,7 @@
#include "can_main.h"
#include "can_ioctl.h"
#include <linux/fs.h>
+#include <linux/module.h>
MODULE_AUTHOR("Intel(R) Corporation");
@@ -110,7 +111,7 @@ struct file_operations file_ops = {
.owner = THIS_MODULE,
.read = can_read,
.write = can_write,
- .ioctl = can_dev_io,
+ .unlocked_ioctl = can_dev_io,
.open = can_open,
.release = can_release
};
@@ -594,8 +595,7 @@ int icp_can_reset(can_os_t *can_os)
/*****************************************************************************
* Device IO control function. Used by user apps to configure CAN device.
*****************************************************************************/
-int can_dev_io(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
+long can_dev_io(struct file *filp, unsigned int cmd, unsigned long arg)
{
can_os_t *can_os;
unsigned int err=0;
--- a/Embedded/src/CAN/can_main.h
+++ b/Embedded/src/CAN/can_main.h
@@ -157,8 +157,7 @@ ssize_t can_write(
int icp_can_reset(
can_os_t *can_os);
-int can_dev_io(
- struct inode *inode,
+long can_dev_io(
struct file *filp,
unsigned int cmd,
unsigned long arg);

View File

@@ -0,0 +1,33 @@
--- a/Embedded/src/GPIO/gpio.h
+++ b/Embedded/src/GPIO/gpio.h
@@ -121,8 +121,7 @@ int gpio_init(void);
void gpio_close(void);
int gpio_open(struct inode *inode, struct file *filp);
int gpio_release(struct inode *inode, struct file *filp);
-int gpio_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
+long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
// private driver functions
int gpio_getpininfo(int Signal, char *pBuff);
@@ -134,7 +133,7 @@ struct file_operations file_ops =
.owner = THIS_MODULE,
.open = gpio_open,
.release = gpio_release,
- .ioctl = gpio_ioctl,
+ .unlocked_ioctl = gpio_ioctl,
};
#endif
--- a/Embedded/src/GPIO/gpio_ref.c
+++ b/Embedded/src/GPIO/gpio_ref.c
@@ -251,8 +251,7 @@ int gpio_release(struct inode *inode, st
0 => success
< 0 => error
******************************************************************************/
-int gpio_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
+long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
gpio_ioctl_t Info;
u_int bitstr = 0;

View File

@@ -0,0 +1,31 @@
--- a/Embedded/src/WDT/iwdt.c
+++ b/Embedded/src/WDT/iwdt.c
@@ -217,8 +217,7 @@ static int wdt_open(struct inode *inode,
static int wdt_release(struct inode *inode, struct file *file);
static ssize_t wdt_write(struct file *file, const char *data,
size_t count, loff_t * pos);
-static int wdt_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg);
+static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
static irqreturn_t wdt_isr(int irq, void *dev_id);
static void __exit wdt_cleanup(void);
static int __init wdt_init(void);
@@ -243,7 +242,7 @@ static struct pci_device_id lpc_pci_tbl[
static struct file_operations wdt_fops = {
owner: THIS_MODULE,
write: wdt_write,
- ioctl: wdt_ioctl,
+ unlocked_ioctl: wdt_ioctl,
open: wdt_open,
release: wdt_release,
};
@@ -1201,8 +1200,7 @@ char *wdt_get_ioctl_string(unsigned int
* Return Value: 0 - successful, negative value - failed.
* Description: This function is used to provide IO interface.
*/
-static int wdt_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg)
+static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
u8 mode=0, scale=0, int_type=0;
u32 u_margin=0, dcount=0;

View File

@@ -0,0 +1,33 @@
--- a/Embedded/src/1588/1588.c
+++ b/Embedded/src/1588/1588.c
@@ -664,8 +664,7 @@ irqreturn_t timesync_isr(int irq, void *
0 => success
< 0 => error
******************************************************************************/
-int timesync_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
+long timesync_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
wait_queue_head_t *event = NULL;
unsigned int bytes_ret = 0;
--- a/Embedded/src/1588/1588.h
+++ b/Embedded/src/1588/1588.h
@@ -121,8 +121,7 @@ MODULE_DEVICE_TABLE(pci, pci_ids);
// Linux functions
int timesync_open(struct inode *inode, struct file *filp);
int timesync_release(struct inode *inode, struct file *filp);
-int timesync_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
+long timesync_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
void timesync_close(void);
int pci_suspend(struct pci_dev *dev, pm_message_t state);
int pci_resume(struct pci_dev *dev);
@@ -142,7 +141,7 @@ struct file_operations file_ops =
.owner = THIS_MODULE,
.open = timesync_open,
.release = timesync_release,
- .ioctl = timesync_ioctl,
+ .unlocked_ioctl = timesync_ioctl,
};
// Linux pci operations

View File

@@ -0,0 +1,44 @@
#
# Copyright (C) 2008-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:=gpio-button-hotplug
PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk
define KernelPackage/gpio-button-hotplug
SUBMENU:=Other modules
TITLE:=Simple GPIO Button Hotplug driver
FILES:=$(PKG_BUILD_DIR)/gpio-button-hotplug.ko
AUTOLOAD:=$(call AutoLoad,30,gpio-button-hotplug,1)
KCONFIG:=
endef
define KernelPackage/button-hotplug/description
Kernel module to generate GPIO button hotplug events
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,gpio-button-hotplug))

View File

@@ -0,0 +1 @@
obj-m += gpio-button-hotplug.o

View File

@@ -0,0 +1,564 @@
/*
* GPIO Button Hotplug driver
*
* Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
* 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/workqueue.h>
#include <linux/skbuff.h>
#include <linux/netlink.h>
#include <linux/kobject.h>
#include <linux/input.h>
#include <linux/platform_device.h>
#include <linux/of_gpio.h>
#include <linux/gpio_keys.h>
#define DRV_NAME "gpio-keys-polled"
#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 )
struct bh_priv {
unsigned long seen;
};
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;
};
struct gpio_keys_button_data {
struct delayed_work work;
struct bh_priv bh;
int last_state;
int count;
int threshold;
int can_sleep;
};
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"),
BH_MAP(KEY_RFKILL, "rfkill"),
#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 gpio_keys_button_data *data,
unsigned int type, unsigned int code, int value)
{
struct bh_priv *priv = &data->bh;
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) / HZ, value);
priv->seen = seen;
}
#else
static void button_hotplug_event(struct gpio_keys_button_data *data,
unsigned int type, unsigned int code, int value)
{
}
#endif /* CONFIG_HOTPLUG */
struct gpio_keys_polled_dev {
struct delayed_work work;
struct device *dev;
struct gpio_keys_platform_data *pdata;
struct gpio_keys_button_data data[0];
};
static void gpio_keys_polled_check_state(struct gpio_keys_button *button,
struct gpio_keys_button_data *bdata)
{
int state;
if (bdata->can_sleep)
state = !!gpio_get_value_cansleep(button->gpio);
else
state = !!gpio_get_value(button->gpio);
state = !!(state ^ button->active_low);
if (state != bdata->last_state) {
unsigned int type = button->type ?: EV_KEY;
button_hotplug_event(bdata, type, button->code, state);
bdata->count = 0;
bdata->last_state = state;
}
}
static void gpio_keys_polled_queue_work(struct gpio_keys_polled_dev *bdev)
{
struct gpio_keys_platform_data *pdata = bdev->pdata;
unsigned long delay = msecs_to_jiffies(pdata->poll_interval);
if (delay >= HZ)
delay = round_jiffies_relative(delay);
schedule_delayed_work(&bdev->work, delay);
}
static void gpio_keys_polled_poll(struct work_struct *work)
{
struct gpio_keys_polled_dev *bdev =
container_of(work, struct gpio_keys_polled_dev, work.work);
struct gpio_keys_platform_data *pdata = bdev->pdata;
int i;
for (i = 0; i < bdev->pdata->nbuttons; i++) {
struct gpio_keys_button_data *bdata = &bdev->data[i];
if (bdata->count < bdata->threshold)
bdata->count++;
else
gpio_keys_polled_check_state(&pdata->buttons[i], bdata);
}
gpio_keys_polled_queue_work(bdev);
}
static void gpio_keys_polled_open(struct gpio_keys_polled_dev *bdev)
{
struct gpio_keys_platform_data *pdata = bdev->pdata;
int i;
if (pdata->enable)
pdata->enable(bdev->dev);
/* report initial state of the buttons */
for (i = 0; i < pdata->nbuttons; i++)
gpio_keys_polled_check_state(&pdata->buttons[i], &bdev->data[i]);
gpio_keys_polled_queue_work(bdev);
}
#ifdef CONFIG_OF
static struct gpio_keys_platform_data *
gpio_keys_polled_get_devtree_pdata(struct device *dev)
{
struct device_node *node, *pp;
struct gpio_keys_platform_data *pdata;
struct gpio_keys_button *button;
int error;
int nbuttons;
int i;
node = dev->of_node;
if (!node)
return NULL;
nbuttons = of_get_child_count(node);
if (nbuttons == 0)
return NULL;
pdata = kzalloc(sizeof(*pdata) + nbuttons * (sizeof *button),
GFP_KERNEL);
if (!pdata) {
error = -ENOMEM;
goto err_out;
}
pdata->buttons = (struct gpio_keys_button *)(pdata + 1);
pdata->nbuttons = nbuttons;
pdata->rep = !!of_get_property(node, "autorepeat", NULL);
of_property_read_u32(node, "poll-interval", &pdata->poll_interval);
i = 0;
for_each_child_of_node(node, pp) {
enum of_gpio_flags flags;
if (!of_find_property(pp, "gpios", NULL)) {
pdata->nbuttons--;
dev_warn(dev, "Found button without gpios\n");
continue;
}
button = &pdata->buttons[i++];
button->gpio = of_get_gpio_flags(pp, 0, &flags);
button->active_low = flags & OF_GPIO_ACTIVE_LOW;
if (of_property_read_u32(pp, "linux,code", &button->code)) {
dev_err(dev, "Button without keycode: 0x%x\n",
button->gpio);
error = -EINVAL;
goto err_free_pdata;
}
button->desc = of_get_property(pp, "label", NULL);
if (of_property_read_u32(pp, "linux,input-type", &button->type))
button->type = EV_KEY;
button->wakeup = !!of_get_property(pp, "gpio-key,wakeup", NULL);
if (of_property_read_u32(pp, "debounce-interval",
&button->debounce_interval))
button->debounce_interval = 5;
}
if (pdata->nbuttons == 0) {
error = -EINVAL;
goto err_free_pdata;
}
return pdata;
err_free_pdata:
kfree(pdata);
err_out:
return ERR_PTR(error);
}
static struct of_device_id gpio_keys_polled_of_match[] = {
{ .compatible = "gpio-keys-polled", },
{ },
};
MODULE_DEVICE_TABLE(of, gpio_keys_polled_of_match);
#else
static inline struct gpio_keys_platform_data *
gpio_keys_polled_get_devtree_pdata(struct device *dev)
{
return NULL;
}
#endif
static void gpio_keys_polled_close(struct gpio_keys_polled_dev *bdev)
{
struct gpio_keys_platform_data *pdata = bdev->pdata;
cancel_delayed_work_sync(&bdev->work);
if (pdata->disable)
pdata->disable(bdev->dev);
}
static int gpio_keys_polled_probe(struct platform_device *pdev)
{
struct gpio_keys_platform_data *pdata = pdev->dev.platform_data;
struct device *dev = &pdev->dev;
struct gpio_keys_polled_dev *bdev;
int error;
int i;
if (!pdata) {
pdata = gpio_keys_polled_get_devtree_pdata(dev);
if (IS_ERR(pdata))
return PTR_ERR(pdata);
if (!pdata) {
dev_err(dev, "missing platform data\n");
return -EINVAL;
}
}
if (!pdata->poll_interval) {
dev_err(dev, "missing poll_interval value\n");
error = -EINVAL;
goto err_free_pdata;
}
bdev = kzalloc(sizeof(struct gpio_keys_polled_dev) +
pdata->nbuttons * sizeof(struct gpio_keys_button_data),
GFP_KERNEL);
if (!bdev) {
dev_err(dev, "no memory for private data\n");
return -ENOMEM;
}
for (i = 0; i < pdata->nbuttons; i++) {
struct gpio_keys_button *button = &pdata->buttons[i];
struct gpio_keys_button_data *bdata = &bdev->data[i];
unsigned int gpio = button->gpio;
if (button->wakeup) {
dev_err(dev, DRV_NAME " does not support wakeup\n");
error = -EINVAL;
goto err_free_gpio;
}
error = gpio_request(gpio,
button->desc ? button->desc : DRV_NAME);
if (error) {
dev_err(dev, "unable to claim gpio %u, err=%d\n",
gpio, error);
goto err_free_gpio;
}
error = gpio_direction_input(gpio);
if (error) {
dev_err(dev,
"unable to set direction on gpio %u, err=%d\n",
gpio, error);
goto err_free_gpio;
}
bdata->can_sleep = gpio_cansleep(gpio);
bdata->last_state = 0;
bdata->threshold = DIV_ROUND_UP(button->debounce_interval,
pdata->poll_interval);
}
bdev->dev = &pdev->dev;
bdev->pdata = pdata;
platform_set_drvdata(pdev, bdev);
INIT_DELAYED_WORK(&bdev->work, gpio_keys_polled_poll);
gpio_keys_polled_open(bdev);
return 0;
err_free_gpio:
while (--i >= 0)
gpio_free(pdata->buttons[i].gpio);
kfree(bdev);
platform_set_drvdata(pdev, NULL);
err_free_pdata:
/* If we have no platform_data, we allocated pdata dynamically. */
if (!dev_get_platdata(&pdev->dev))
kfree(pdata);
return error;
}
static int gpio_keys_polled_remove(struct platform_device *pdev)
{
struct gpio_keys_polled_dev *bdev = platform_get_drvdata(pdev);
struct gpio_keys_platform_data *pdata = bdev->pdata;
int i = pdata->nbuttons;
gpio_keys_polled_close(bdev);
while (--i >= 0)
gpio_free(pdata->buttons[i].gpio);
kfree(bdev);
platform_set_drvdata(pdev, NULL);
return 0;
}
static struct platform_driver gpio_keys_polled_driver = {
.probe = gpio_keys_polled_probe,
.remove = gpio_keys_polled_remove,
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(gpio_keys_polled_of_match),
},
};
static int __init gpio_keys_polled_init(void)
{
return platform_driver_register(&gpio_keys_polled_driver);
}
static void __exit gpio_keys_polled_exit(void)
{
platform_driver_unregister(&gpio_keys_polled_driver);
}
module_init(gpio_keys_polled_init);
module_exit(gpio_keys_polled_exit);
MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
MODULE_AUTHOR("Felix Fietkau <nbd@openwrt.org>");
MODULE_DESCRIPTION("Polled GPIO Buttons hotplug driver");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:" DRV_NAME);

View File

@@ -0,0 +1,117 @@
#
# Copyright (C) 2006-2011 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:=hostap-driver
PKG_VERSION:=0.4.9
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://hostap.epitest.fi/releases/
PKG_MD5SUM:=c7534dc040ab90218257a78488ecd378
include $(INCLUDE_DIR)/package.mk
define KernelPackage/hostap/Default
VERSION:=$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE)
SUBMENU:=Wireless Drivers
URL:=http://hostap.epitest.fi/
endef
define KernelPackage/hostap/Default/description
Host AP is a driver for 802.11b wireless cards based on Intersil
Prism2/2.5/3 chipset. It supports so called Host AP mode that allows the
card to act as an IEEE 802.11 access point.
endef
define KernelPackage/hostap
$(call KernelPackage/hostap/Default)
TITLE:=Host AP support for Prism2/2.5/3
DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +kmod-lib80211 +wireless-tools
KCONFIG:=CONFIG_HOSTAP CONFIG_HOSTAP_FIRMWARE=y CONFIG_HOSTAP_FIRMWARE_NVRAM=y
FILES:=$(LINUX_DIR)/drivers/net/wireless/hostap/hostap.ko
AUTOLOAD:=$(call AutoLoad,60,hostap)
endef
define KernelPackage/hostap/description
$(call KernelPackage/hostap/Default/description)
This package contains the base Host AP driver code that is shared by
different hardware models. You will also need to enable support for
PLX/PCI/CS version of the driver to actually use the driver.
endef
define KernelPackage/hostap-cs
$(call KernelPackage/hostap/Default)
TITLE:=Host AP driver for PCMCIA adaptors
DEPENDS:=@PCMCIA_SUPPORT +kmod-hostap +kmod-pcmcia-core
KCONFIG:=CONFIG_HOSTAP_CS
FILES:=$(LINUX_DIR)/drivers/net/wireless/hostap/hostap_cs.ko
AUTOLOAD:=$(call AutoLoad,60,hostap_cs)
endef
define KernelPackage/hostap-cs/description
$(call KernelPackage/hostap/Default/description)
This package contains the Host AP driver for Prism2/2.5/3 PC cards.
endef
define KernelPackage/hostap-pci
$(call KernelPackage/hostap/Default)
TITLE:=Host AP driver for PCI adaptors
DEPENDS:=@PCI_SUPPORT +kmod-hostap
KCONFIG:=CONFIG_HOSTAP_PCI
FILES:=$(LINUX_DIR)/drivers/net/wireless/hostap/hostap_pci.ko
AUTOLOAD:=$(call AutoLoad,60,hostap_pci)
endef
define KernelPackage/hostap-pci/description
$(call KernelPackage/hostap/Default/description)
This package contains the Host AP driver for Prism2.5 PCI adaptors.
endef
define KernelPackage/hostap-plx
$(call KernelPackage/hostap/Default)
TITLE:=Host AP driver for PLX9052 based PCI adaptors
DEPENDS:=@PCI_SUPPORT +kmod-hostap
KCONFIG:=CONFIG_HOSTAP_PLX
FILES:=$(LINUX_DIR)/drivers/net/wireless/hostap/hostap_plx.ko
AUTOLOAD:=$(call AutoLoad,60,hostap_plx)
endef
define KernelPackage/hostap-plx/description
$(call KernelPackage/hostap/Default/description)
This package contains the Host AP driver for Prism2/2.5/3 in PLX9052
based PCI adaptors.
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define KernelPackage/hostap/install
$(INSTALL_DIR) $(1)/lib/wifi
$(INSTALL_DATA) ./files/lib/wifi/hostap.sh $(1)/lib/wifi
endef
$(eval $(call KernelPackage,hostap))
$(eval $(call KernelPackage,hostap-cs))
$(eval $(call KernelPackage,hostap-pci))
$(eval $(call KernelPackage,hostap-plx))

Some files were not shown because too many files have changed in this diff Show More