summaryrefslogtreecommitdiff
path: root/packages/linux/linux-turbostation
diff options
context:
space:
mode:
Diffstat (limited to 'packages/linux/linux-turbostation')
-rw-r--r--packages/linux/linux-turbostation/.mtn2git_empty0
-rw-r--r--packages/linux/linux-turbostation/001_r1000.diff2334
-rw-r--r--packages/linux/linux-turbostation/002_qnap-pic.diff407
-rw-r--r--packages/linux/linux-turbostation/2.6.20.1/.mtn2git_empty0
-rw-r--r--packages/linux/linux-turbostation/defconfig1435
-rw-r--r--packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_platforms_Makefile13
-rw-r--r--packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_platforms_sandpoint.c293
-rw-r--r--packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_platforms_sandpoint.h52
-rw-r--r--packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_syslib_Makefile13
-rw-r--r--packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_syslib_mpc10x_common.c19
-rw-r--r--packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_syslib_open_pic.c14
-rw-r--r--packages/linux/linux-turbostation/linux-2.6.16_drivers_i2c_chips_Kconfig17
-rw-r--r--packages/linux/linux-turbostation/linux-2.6.16_drivers_i2c_chips_Makefile12
-rw-r--r--packages/linux/linux-turbostation/linux-2.6.16_drivers_mtd_maps_physmap.c59
-rw-r--r--packages/linux/linux-turbostation/linux-2.6.16_drivers_net_r8169.c13
-rw-r--r--packages/linux/linux-turbostation/linux-2.6.16_include_asm-ppc_mpc10x.h14
16 files changed, 4695 insertions, 0 deletions
diff --git a/packages/linux/linux-turbostation/.mtn2git_empty b/packages/linux/linux-turbostation/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/linux/linux-turbostation/.mtn2git_empty
diff --git a/packages/linux/linux-turbostation/001_r1000.diff b/packages/linux/linux-turbostation/001_r1000.diff
new file mode 100644
index 0000000000..0f94d685fa
--- /dev/null
+++ b/packages/linux/linux-turbostation/001_r1000.diff
@@ -0,0 +1,2334 @@
+Index: linux-2.6.20.1/drivers/net/Kconfig
+===================================================================
+--- linux-2.6.20.1.orig/drivers/net/Kconfig 2007-02-20 07:34:32.000000000 +0100
++++ linux-2.6.20.1/drivers/net/Kconfig 2007-02-28 20:29:04.000000000 +0100
+@@ -2085,6 +2085,16 @@
+
+ If in doubt, say Y.
+
++config R1000
++ tristate "Realtek 8169 gigabit ethernet support (R1000)"
++ depends on PCI
++ select CRC32
++ ---help---
++ Say Y here if you have a Realtek 8169 PCI Gigabit Ethernet adapter.
++
++ To compile this driver as a module, choose M here: the module
++ will be called r1000_n. This is recommended.
++
+ config SIS190
+ tristate "SiS190/SiS191 gigabit ethernet support"
+ depends on PCI
+Index: linux-2.6.20.1/drivers/net/Makefile
+===================================================================
+--- linux-2.6.20.1.orig/drivers/net/Makefile 2007-02-20 07:34:32.000000000 +0100
++++ linux-2.6.20.1/drivers/net/Makefile 2007-02-28 20:29:04.000000000 +0100
+@@ -188,6 +188,7 @@
+ obj-$(CONFIG_NET_NETX) += netx-eth.o
+ obj-$(CONFIG_DL2K) += dl2k.o
+ obj-$(CONFIG_R8169) += r8169.o
++obj-$(CONFIG_R1000) += r1000_n.o r1000_ioctl.o
+ obj-$(CONFIG_AMD8111_ETH) += amd8111e.o
+ obj-$(CONFIG_IBMVETH) += ibmveth.o
+ obj-$(CONFIG_S2IO) += s2io.o
+Index: linux-2.6.20.1/drivers/net/r1000.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.20.1/drivers/net/r1000.h 2007-02-28 20:29:04.000000000 +0100
+@@ -0,0 +1,390 @@
++#include <linux/module.h>
++#include <linux/pci.h>
++#include <linux/netdevice.h>
++#include <linux/etherdevice.h>
++#include <linux/delay.h>
++#include <linux/version.h>
++#include <linux/types.h>
++#include <linux/errno.h>
++
++#include <linux/timer.h>
++#include <linux/init.h>
++#include <linux/ethtool.h>
++#include <linux/mii.h>
++#include <asm/uaccess.h>
++#include <linux/interrupt.h>
++#include <linux/spinlock.h>
++
++#define R1000_VERSION "1.05"
++#define RELEASE_DATE "2006/10/25"
++#define MODULENAME "r1000"
++#define R1000_DRIVER_NAME MODULENAME R1000_VERSION ", the Linux device driver for Realtek Ethernet Controllers"
++#define PFX MODULENAME ": "
++
++
++#undef R1000_DEBUG
++#undef R1000_JUMBO_FRAME_SUPPORT
++//#undef R1000_HW_FLOW_CONTROL_SUPPORT
++#define R1000_HW_FLOW_CONTROL_SUPPORT
++
++
++#undef R1000_IOCTL_SUPPORT
++#define R1000_USE_IO
++
++#define R1000_BOTTOM_HALVES
++//#undef R1000_BOTTOM_HALVES
++
++#ifdef R1000_DEBUG
++ #define assert(expr) \
++ if(!(expr)) { printk( "Assertion failed! %s,%s,%s,line=%d\n", #expr,__FILE__,__FUNCTION__,__LINE__); }
++ #define DBG_PRINT( fmt, args...) printk("r1000: " fmt, ## args);
++#else
++ #define assert(expr) do {} while (0)
++ #define DBG_PRINT( fmt, args...) ;
++#endif // end of #ifdef R1000_DEBUG
++
++/* media options */
++#define MAX_UNITS 8
++
++#define OPTION_UNSET -1
++#define OPTION_DISABLED 0
++#define OPTION_ENABLED 1
++
++/* MAC address length*/
++#define MAC_ADDR_LEN 6
++
++#define RX_FIFO_THRESH 7 /* 7 means NO threshold, Rx buffer level before first PCI xfer. */
++#define RX_DMA_BURST 7 /* Maximum PCI burst, '6' is 1024 */
++#define TX_DMA_BURST 7 /* Maximum PCI burst, '6' is 1024 */
++#define ETTh 0x3F /* 0x3F means NO threshold */
++
++#define ETH_HDR_LEN 14
++#define DEFAULT_MTU 1500
++#define DEFAULT_RX_BUF_LEN 1536
++
++
++#ifdef R1000_JUMBO_FRAME_SUPPORT
++#define MAX_JUMBO_FRAME_MTU ( 10000 )
++#define MAX_RX_SKBDATA_SIZE ( MAX_JUMBO_FRAME_MTU + ETH_HDR_LEN )
++#else
++//#define MAX_RX_SKBDATA_SIZE 1600
++#define MAX_RX_SKBDATA_SIZE 1608
++#endif //end #ifdef R1000_JUMBO_FRAME_SUPPORT
++
++
++#define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */
++
++#define NUM_TX_DESC 1024 /* Number of Tx descriptor registers*/
++#define NUM_RX_DESC 1024 /* Number of Rx descriptor registers*/
++
++#define RTL_MIN_IO_SIZE 0x80
++#define TX_TIMEOUT (6*HZ)
++#define R1000_TIMER_EXPIRE_TIME 100 //100
++
++#ifdef R1000_USE_IO
++#define RTL_W8(reg, val8) outb ((val8), ioaddr + (reg))
++#define RTL_W16(reg, val16) outw ((val16), ioaddr + (reg))
++#define RTL_W32(reg, val32) outl ((val32), ioaddr + (reg))
++#define RTL_R8(reg) inb (ioaddr + (reg))
++#define RTL_R16(reg) inw (ioaddr + (reg))
++#define RTL_R32(reg) ((unsigned long) inl (ioaddr + (reg)))
++#else //R1000_USE_IO
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,6)
++/* write/read MMIO register for Linux kernel 2.4.x*/
++#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg))
++#define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg))
++#define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg))
++#define RTL_R8(reg) readb (ioaddr + (reg))
++#define RTL_R16(reg) readw (ioaddr + (reg))
++#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg)))
++#else
++/* write/read MMIO register for Linux kernel 2.6.x*/
++#define RTL_W8(reg, val8) iowrite8 ((val8), (void *)(ioaddr + (reg)))
++#define RTL_W16(reg, val16) iowrite16 ((val16), (void *)(ioaddr + (reg)))
++#define RTL_W32(reg, val32) iowrite32 ((val32), (void *)(ioaddr + (reg)))
++#define RTL_R8(reg) ioread8 ((void *)(ioaddr + (reg)))
++#define RTL_R16(reg) ioread16 ((void *)(ioaddr + (reg)))
++#define RTL_R32(reg) ((unsigned long) ioread32 ((void *)(ioaddr + (reg))))
++#endif
++#endif //R1000_USE_IO
++
++#define MCFG_METHOD_1 0x01
++#define MCFG_METHOD_2 0x02
++#define MCFG_METHOD_3 0x03
++#define MCFG_METHOD_4 0x04
++#define MCFG_METHOD_5 0x05
++#define MCFG_METHOD_11 0x0B
++#define MCFG_METHOD_12 0x0C
++#define MCFG_METHOD_13 0x0D
++#define MCFG_METHOD_14 0x0E
++#define MCFG_METHOD_15 0x0F
++
++#define PCFG_METHOD_1 0x01 //PHY Reg 0x03 bit0-3 == 0x0000
++#define PCFG_METHOD_2 0x02 //PHY Reg 0x03 bit0-3 == 0x0001
++#define PCFG_METHOD_3 0x03 //PHY Reg 0x03 bit0-3 == 0x0002
++
++enum pci_config_header_registers {
++ VID = 0x00,
++ DID = 0x02,
++ Command = 0x04,
++ Status = 0x06,
++ Rev_ID = 0x08,
++ Class_Code = 0x09,
++ Cache_Line_Size = 0x0C,
++ Latency_Timer = 0x0D,
++ Header_type = 0x0E,
++ BIST = 0x0F,
++ IOAR = 0x10,
++ MEMAR = 0x14,
++ CIS_Pointer = 0x28,
++ Sub_VID = 0x2C,
++ Sub_DID = 0x2E,
++ BMAR = 0x30,
++ Interrupt_Line = 0x3C,
++ Interrutp_Pin = 0x3D,
++ Min_Gnt = 0x3E,
++ Max_Lat = 0x3F,
++};
++
++enum r1000_registers {
++ MAC0 = 0x00,
++ MAR0 = 0x08,
++ TxDescStartAddr = 0x20,
++ TxHDescStartAddr = 0x28,
++ FLASH = 0x30,
++ ERSR = 0x36,
++ ChipCmd = 0x37,
++ TxPoll = 0x38,
++ IntrMask = 0x3C,
++ IntrStatus = 0x3E,
++ TxConfig = 0x40,
++ RxConfig = 0x44,
++ TCTR = 0x48,
++ RxMissed = 0x4C,
++ Cfg9346 = 0x50,
++ Config0 = 0x51,
++ Config1 = 0x52,
++ Config2 = 0x53,
++ Config3 = 0x54,
++ Config4 = 0x55,
++ Config5 = 0x56,
++ TimerInt = 0x58,
++ MultiIntr = 0x5C,
++ PHYAR = 0x60,
++ TBICSR = 0x64,
++ TBI_ANAR = 0x68,
++ TBI_LPAR = 0x6A,
++ PHYstatus = 0x6C,
++ Off7Ch = 0x7C,
++ RxMaxSize = 0xDA,
++ CPlusCmd = 0xE0,
++ RxDescStartAddr = 0xE4,
++ ETThReg = 0xEC,
++ FuncEvent = 0xF0,
++ FuncEventMask = 0xF4,
++ FuncPresetState = 0xF8,
++ FuncForceEvent = 0xFC,
++};
++
++enum r1000_register_content {
++ /*InterruptStatusBits*/
++ SYSErr = 0x8000,
++ PCSTimeout = 0x4000,
++ SWInt = 0x0100,
++ TxDescUnavail = 0x80,
++ RxFIFOOver = 0x40,
++ LinkChg = 0x20,
++ RxDescUnavail = 0x10,
++ TxErr = 0x08,
++ TxOK = 0x04,
++ RxErr = 0x02,
++ RxOK = 0x01,
++
++ //TCTR/TimerInt contetn
++ CLK_tick = 0x1770, //for PCI clock=33MHz 0x1770=200usec
++
++ /*RxStatusDesc*/
++ RxRES = 0x00200000,
++ RxCRC = 0x00080000,
++ RxRUNT = 0x00100000,
++ RxRWT = 0x00400000,
++
++ /*ChipCmdBits*/
++ CmdReset = 0x10,
++ CmdRxEnb = 0x08,
++ CmdTxEnb = 0x04,
++ RxBufEmpty = 0x01,
++
++ /*Cfg9346Bits*/
++ Cfg9346_Lock = 0x00,
++ Cfg9346_Unlock = 0xC0,
++
++ /*rx_mode_bits*/
++ AcceptErr = 0x20,
++ AcceptRunt = 0x10,
++ AcceptBroadcast = 0x08,
++ AcceptMulticast = 0x04,
++ AcceptMyPhys = 0x02,
++ AcceptAllPhys = 0x01,
++
++ /*RxConfigBits*/
++ RxCfgFIFOShift = 13,
++ RxCfgDMAShift = 8,
++
++ /*TxConfigBits*/
++ TxInterFrameGapShift = 24,
++ TxDMAShift = 8,
++
++ //C+ Command Register
++ CPCR_MulRW_Enable = 0x0008,
++
++ /*rtl8169_PHYstatus (MAC offset 0x6C)*/
++ TBI_Enable = 0x80,
++ TxFlowCtrl = 0x40,
++ RxFlowCtrl = 0x20,
++ _1000Mbps = 0x10,
++ _100Mbps = 0x08,
++ _10Mbps = 0x04,
++ LinkStatus = 0x02,
++ FullDup = 0x01,
++
++ /*GIGABIT_PHY_registers*/
++ PHY_CTRL_REG = 0,
++ PHY_STAT_REG = 1,
++ PHY_AUTO_NEGO_REG = 4,
++ PHY_1000_CTRL_REG = 9,
++
++ /*GIGABIT_PHY_REG_BIT*/
++ PHY_Restart_Auto_Nego = 0x0200,
++ PHY_Enable_Auto_Nego = 0x1000,
++
++ //PHY_STAT_REG = 1;
++ PHY_Auto_Neco_Comp = 0x0020,
++
++ //PHY_AUTO_NEGO_REG = 4;
++ PHY_Cap_10_Half = 0x0020,
++ PHY_Cap_10_Full = 0x0040,
++ PHY_Cap_100_Half = 0x0080,
++ PHY_Cap_100_Full = 0x0100,
++
++ //PHY_1000_CTRL_REG = 9;
++ PHY_Cap_1000_Full = 0x0200,
++ PHY_Cap_1000_Half = 0x0100,
++
++ PHY_Cap_PAUSE = 0x0400,
++ PHY_Cap_ASYM_PAUSE = 0x0800,
++
++ PHY_Cap_Null = 0x0,
++
++ /*_MediaType*/
++ _10_Half = 0x01,
++ _10_Full = 0x02,
++ _100_Half = 0x04,
++ _100_Full = 0x08,
++ _1000_Full = 0x10,
++
++ /*_TBICSRBit*/
++ TBILinkOK = 0x02000000,
++};
++
++
++
++enum _DescStatusBit {
++ OWNbit = 0x80000000,
++ EORbit = 0x40000000,
++ FSbit = 0x20000000,
++ LSbit = 0x10000000,
++};
++
++
++struct TxDesc {
++ u32 status;
++ u32 vlan_tag;
++ u32 buf_addr;
++ u32 buf_Haddr;
++};
++
++struct RxDesc {
++ u32 status;
++ u32 vlan_tag;
++ u32 buf_addr;
++ u32 buf_Haddr;
++};
++
++#define r1000_request_timer( timer, timer_expires, timer_func, timer_data ) \
++{ \
++ init_timer(timer); \
++ timer->expires = (unsigned long)(jiffies + timer_expires); \
++ timer->data = (unsigned long)(timer_data); \
++ timer->function = (void *)(timer_func); \
++ add_timer(timer); \
++ DBG_PRINT("request_timer at 0x%08lx\n", (unsigned long)timer); \
++}
++
++#define r1000_delete_timer( del_timer_t ) \
++{ \
++ del_timer(del_timer_t); \
++ DBG_PRINT("delete_timer at 0x%08lx\n", (unsigned long)del_timer_t); \
++}
++
++#define r1000_mod_timer( timer, timer_expires ) \
++{ \
++ mod_timer( timer, jiffies + timer_expires ); \
++}
++
++typedef struct timer_list rt_timer_t;
++
++struct r1000_private {
++ unsigned long ioaddr; /* memory map physical address*/
++ struct pci_dev *pci_dev; /* Index of PCI device */
++ struct net_device_stats stats; /* statistics of net device */
++ spinlock_t lock; /* spin lock flag */
++ spinlock_t tx_lock; /* tx spin lock flag */
++ spinlock_t rx_lock; /* rx spin lock flag */
++ int chipset;
++ int mcfg;
++ int pcfg;
++ rt_timer_t r1000_timer;
++ unsigned long expire_time;
++
++#ifdef R1000_BOTTOM_HALVES
++ struct tasklet_struct r1000_rx_tasklet;
++ struct tasklet_struct r1000_tx_tasklet;
++#endif //R1000_BOTTOM_HALVES
++
++ unsigned int tx_cnt;
++
++ unsigned long phy_link_down_cnt;
++ unsigned long cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */
++ unsigned long cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */
++ unsigned long dirty_tx;
++ struct TxDesc *TxDescArray; /* Index of 256-alignment Tx Descriptor buffer */
++ struct RxDesc *RxDescArray; /* Index of 256-alignment Rx Descriptor buffer */
++ struct sk_buff *Tx_skbuff[NUM_TX_DESC];/* Index of Transmit data buffer */
++ struct sk_buff *Rx_skbuff[NUM_RX_DESC];/* Receive data buffer */
++ unsigned char drvinit_fail;
++
++ dma_addr_t txdesc_array_dma_addr[NUM_TX_DESC];
++ dma_addr_t rxdesc_array_dma_addr[NUM_RX_DESC];
++ dma_addr_t rx_skbuff_dma_addr[NUM_RX_DESC];
++
++ void *txdesc_space;
++ dma_addr_t txdesc_phy_dma_addr;
++ int sizeof_txdesc_space;
++
++ void *rxdesc_space;
++ dma_addr_t rxdesc_phy_dma_addr;
++ int sizeof_rxdesc_space;
++
++ int curr_mtu_size;
++ int tx_pkt_len;
++ int rx_pkt_len;
++
++ int hw_rx_pkt_len;
++
++ u16 speed;
++ u8 duplex;
++ u8 autoneg;
++};
++
++
+Index: linux-2.6.20.1/drivers/net/r1000_ioctl.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.20.1/drivers/net/r1000_ioctl.c 2007-02-28 20:29:04.000000000 +0100
+@@ -0,0 +1,129 @@
++#include "r1000.h"
++
++extern int R1000_READ_GMII_REG(unsigned long ioaddr, int RegAddr);
++extern int R1000_WRITE_GMII_REG(unsigned long ioaddr, int RegAddr, int value);
++extern int r1000_set_medium(struct net_device *netdev,u16 speed,u8 duplex,u8 autoneg);
++
++static int ethtool_get_settings(struct net_device *netdev,struct ethtool_cmd *ecmd){
++ struct r1000_private *priv = (struct r1000_private *)(netdev->priv);
++ unsigned long ioaddr = priv->ioaddr;
++ unsigned int bmcr = R1000_READ_GMII_REG(ioaddr,PHY_STAT_REG);
++ unsigned int bmsr = R1000_READ_GMII_REG(ioaddr,PHY_AUTO_NEGO_REG);
++ unsigned int gbcr = R1000_READ_GMII_REG(ioaddr,PHY_1000_CTRL_REG);
++
++ ecmd->supported = (SUPPORTED_10baseT_Half|
++ SUPPORTED_10baseT_Full|
++ SUPPORTED_100baseT_Half|
++ SUPPORTED_100baseT_Full|
++ SUPPORTED_1000baseT_Full|
++ SUPPORTED_Autoneg|
++ SUPPORTED_TP);
++
++ ecmd->advertising = ADVERTISED_TP;
++
++ if(bmsr&ADVERTISE_10HALF)
++ ecmd->advertising |= ADVERTISED_10baseT_Half;
++ if(bmsr&ADVERTISE_10FULL)
++ ecmd->advertising |= ADVERTISED_10baseT_Full;
++ if(bmsr&ADVERTISE_100HALF)
++ ecmd->advertising |= ADVERTISED_100baseT_Half;
++ if(bmsr&ADVERTISE_100FULL)
++ ecmd->advertising |= ADVERTISED_100baseT_Full;
++ if(gbcr&PHY_Cap_1000_Full)
++ ecmd->advertising |= ADVERTISED_1000baseT_Full;
++ if(bmcr&PHY_Enable_Auto_Nego)
++ ecmd->advertising |= ADVERTISED_Autoneg;
++
++ ecmd->port = PORT_TP;
++
++ if(priv->mcfg == MCFG_METHOD_1)
++ ecmd->transceiver = XCVR_EXTERNAL;
++ else
++ ecmd->transceiver = XCVR_INTERNAL;
++
++ if(RTL_R8(PHYstatus)&LinkStatus){
++ if(RTL_R8(PHYstatus)&_1000Mbps)
++ ecmd->speed = SPEED_1000;
++ else if(RTL_R8(PHYstatus)&_100Mbps)
++ ecmd->speed = SPEED_100;
++ else if(RTL_R8(PHYstatus)&_10Mbps)
++ ecmd->speed = SPEED_10;
++
++ if(RTL_R8(PHYstatus)&FullDup)
++ ecmd->duplex = DUPLEX_FULL;
++ else
++ ecmd->duplex = DUPLEX_HALF;
++
++ }else{
++ ecmd->speed = -1;
++ ecmd->duplex = -1;
++ }
++ ecmd->autoneg = AUTONEG_ENABLE;
++ return 0;
++}
++
++static int ethtool_set_settings(struct net_device *netdev,struct ethtool_cmd *ecmd){
++ return r1000_set_medium(netdev,ecmd->speed,ecmd->duplex,ecmd->autoneg);
++}
++
++static void ethtool_get_drvinfo(struct net_device *netdev,struct ethtool_drvinfo *drvinfo){
++ struct r1000_private *priv = netdev_priv(netdev);
++
++ strncpy(drvinfo->driver, MODULENAME,32);
++ strncpy(drvinfo->version, R1000_VERSION,32);
++ strncpy(drvinfo->fw_version, "N/A", 32);
++ strncpy(drvinfo->bus_info, pci_name(priv->pci_dev), 32);
++}
++
++static int ethtool_nway_reset(struct net_device *netdev){
++// struct r1000_private *priv = netdev_priv(netdev);
++
++ if(netif_running(netdev)){
++ }
++
++ return 0;
++}
++
++uint32_t ethtool_get_link(struct net_device *netdev){
++ return netif_carrier_ok(netdev) ? 1 : 0;
++}
++
++int ethtool_ioctl(struct ifreq *ifr){
++ struct net_device *netdev=__dev_get_by_name(ifr->ifr_name);
++ void *useraddr=(void *)ifr->ifr_data;
++ uint32_t ethcmd;
++
++ if(!capable(CAP_NET_ADMIN))
++ return -EPERM;
++
++ if(!netdev || !netif_device_present(netdev))
++ return -ENODEV;
++ if(copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
++ return -EFAULT;
++
++ switch (ethcmd){
++ case ETHTOOL_GSET:
++ return ethtool_get_settings(netdev,useraddr);
++ case ETHTOOL_SSET:
++ return ethtool_set_settings(netdev,useraddr);
++ case ETHTOOL_GDRVINFO:
++ ethtool_get_drvinfo(netdev,useraddr);
++ case ETHTOOL_NWAY_RST:
++ return ethtool_nway_reset(netdev);
++ case ETHTOOL_GLINK:
++ return ethtool_get_link(netdev);
++ default:
++ return -EOPNOTSUPP;
++ }
++ return -EOPNOTSUPP;
++}
++
++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
++struct ethtool_ops r1000_ethtool_ops = {
++ .get_settings = ethtool_get_settings,
++ .set_settings = ethtool_set_settings,
++ .get_drvinfo = ethtool_get_drvinfo,
++ .nway_reset = ethtool_nway_reset,
++ .get_link = ethtool_get_link,
++};
++#endif
+Index: linux-2.6.20.1/drivers/net/r1000_n.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.20.1/drivers/net/r1000_n.c 2007-02-28 20:29:04.000000000 +0100
+@@ -0,0 +1,1767 @@
++//=========================================================================
++//Realtek Ethernet driver for Linux kernel 2.4.x. and 2.6.x
++//=========================================================================
++
++#include "r1000.h"
++
++#ifdef MODULE_PARM
++static int speed[MAX_UNITS] = {-1,-1,-1,-1,-1,-1,-1,-1};
++
++static int duplex[MAX_UNITS] = {-1,-1,-1,-1,-1,-1,-1,-1};
++
++static int autoneg[MAX_UNITS] = {-1,-1,-1,-1,-1,-1,-1,-1};
++#endif //MODULE_PARM
++
++/* Maximum events (Rx packets, etc.) to handle at each interrupt. */
++static int max_interrupt_work = 20;
++
++/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
++ The RTL chips use a 64 element hash table based on the Ethernet CRC. */
++static int multicast_filter_limit = 32;
++
++const static struct {
++ const char *name;
++ u8 mcfg; /* depend on documents of Realtek */
++ u32 RxConfigMask; /* should clear the bits supported by this chip */
++} rtl_chip_info[] = {
++ { "RTL8169", MCFG_METHOD_1, 0xff7e1880 },
++ { "RTL8169S/8110S", MCFG_METHOD_2, 0xff7e1880 },
++ { "RTL8169S/8110S", MCFG_METHOD_3, 0xff7e1880 },
++ { "RTL8169SB/8110SB", MCFG_METHOD_4, 0xff7e1880 },
++ { "RTL8110SC", MCFG_METHOD_5, 0xff7e1880 },
++ { "RTL8168B/8111B", MCFG_METHOD_11, 0xff7e1880 },
++ { "RTL8168B/8111B", MCFG_METHOD_12, 0xff7e1880 },
++ { "RTL8101E", MCFG_METHOD_13, 0xff7e1880 },
++ { "RTL8100E", MCFG_METHOD_14, 0xff7e1880 },
++ { "RTL8100E", MCFG_METHOD_15, 0xff7e1880 },
++ { 0 }
++};
++
++
++static struct pci_device_id r1000_pci_tbl[] __devinitdata = {
++ { 0x10ec, 0x8169, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
++ { 0x10ec, 0x8167, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
++ { 0x10ec, 0x8168, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
++ { 0x10ec, 0x8136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
++ {0,}
++};
++
++
++MODULE_DEVICE_TABLE (pci, r1000_pci_tbl);
++MODULE_AUTHOR ("Realtek");
++MODULE_DESCRIPTION ("Linux device driver for Realtek Ethernet Controllers");
++
++#ifdef MODULE_PARM
++MODULE_PARM (speed, "1-" __MODULE_STRING(MAX_UNITS) "i");
++MODULE_PARM_DESC(speed,"Link speed");
++MODULE_PARM (duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");
++MODULE_PARM_DESC(duplex,"Link duplex");
++MODULE_PARM (autoneg, "1-" __MODULE_STRING(MAX_UNITS) "i");
++MODULE_PARM_DESC(autoneg,"Autonegotiation");
++#else //MODULE_PARM
++/* Module Parameters are always initialized to -1, so that the driver
++ * can tell the difference between no user specified value or the
++ * user asking for the default value.
++ * The true default values are loaded in when e1000_check_options is called.
++ *
++ * This is a GCC extension to ANSI C.
++ * See the item "Labeled Elements in Initializers" in the section
++ * "Extensions to the C Language Family" of the GCC documentation.
++ */
++#define R1000_PARAM_INIT { [0 ... MAX_UNITS] = OPTION_UNSET }
++/* All parameters are treated the same, as an integer array of values.
++ * This macro just reduces the need to repeat the same declaration code
++ * over and over (plus this helps to avoid typo bugs).
++ */
++#define R1000_PARAM(X, S) \
++ static int __devinitdata X[MAX_UNITS+1] = R1000_PARAM_INIT; \
++ static int num_##X = 0; \
++ module_param_array(X, int, &num_##X, 0); \
++ MODULE_PARM_DESC(X, S);
++/* Link Speed
++ * Valid Values: 10Mbps, 100Mbps, and 1000Mbps
++ * Defaule value: 100Mbps
++ */
++R1000_PARAM(speed, "Link speed");
++/* Link duplex
++ * Valid Values: half duplex and full duplex
++ * Defaule value: full duplex
++ */
++R1000_PARAM(duplex, "Link duplex");
++/* Autonegotiation
++ * Valid Values: enable and disable
++ * Defaule value: enable
++ */
++R1000_PARAM(autoneg, "Autonegotiation");
++#endif //MODULE_PARM
++
++MODULE_LICENSE("GPL");
++
++
++static int r1000_open (struct net_device *netdev);
++static int r1000_start_xmit (struct sk_buff *skb, struct net_device *netdev);
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
++//typedef int irqreturn_t;
++#define IRQ_NONE 0
++#define IRQ_HANDLED 1
++static void r1000_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
++#else
++static irqreturn_t r1000_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
++#endif
++
++static void r1000_init_ring (struct net_device *netdev);
++static void r1000_hw_start (struct net_device *netdev);
++static int r1000_close (struct net_device *netdev);
++static inline u32 ether_crc (int length, unsigned char *data);
++static void r1000_set_rx_mode (struct net_device *netdev);
++static void r1000_tx_timeout (struct net_device *netdev);
++static struct net_device_stats *r1000_get_stats(struct net_device *netdev);
++
++#ifdef R1000_JUMBO_FRAME_SUPPORT
++static int r1000_change_mtu(struct net_device *netdev, int new_mtu);
++#endif //end #ifdef R1000_JUMBO_FRAME_SUPPORT
++
++static void r1000_hw_PHY_config (struct net_device *netdev);
++static void r1000_hw_PHY_reset(struct net_device *netdev);
++//static const u16 r1000_intr_mask=LinkChg|RxDescUnavail|RxFIFOOver|TxErr|TxOK|RxErr|RxOK;
++static const u16 r1000_intr_mask=LinkChg|RxDescUnavail|TxErr|TxOK|RxErr|RxOK;
++static const unsigned int r1000_rx_config=(RX_FIFO_THRESH<<RxCfgFIFOShift)|(RX_DMA_BURST<<RxCfgDMAShift)|0x0000000E;
++
++static int r1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd);
++extern int ethtool_ioctl(struct ifreq *ifr);
++extern struct ethtool_ops r1000_ethtool_ops;
++static int r1000_set_speed_duplex(unsigned long ioaddr, unsigned int anar, unsigned int gbcr, unsigned int bmcr);
++
++static void r1000_rx_action(struct net_device *netdev);
++static void r1000_tx_action(struct net_device *netdev);
++
++#ifdef R1000_BOTTOM_HALVES
++static void r1000_rx_interrupt(unsigned long ndev);
++static void r1000_tx_interrupt(unsigned long ndev);
++#else
++static void r1000_rx_interrupt(struct net_device *netdev, struct r1000_private *priv, unsigned long ioaddr);
++static void r1000_tx_interrupt (struct net_device *netdev, struct r1000_private *priv, unsigned long ioaddr);
++#endif //R1000_BOTTOM_HALVES
++
++
++
++#ifdef R1000_DEBUG
++unsigned alloc_rxskb_cnt = 0;
++#define R1000_ALLOC_RXSKB(bufsize) dev_alloc_skb(bufsize); alloc_rxskb_cnt ++ ;
++#define R1000_FREE_RXSKB(skb) kfree_skb(skb); alloc_rxskb_cnt -- ;
++#define R1000_NETIF_RX(skb) netif_rx(skb); alloc_rxskb_cnt -- ;
++#else
++#define R1000_ALLOC_RXSKB(bufsize) dev_alloc_skb(bufsize);
++#define R1000_FREE_RXSKB(skb) kfree_skb(skb);
++#define R1000_NETIF_RX(skb) netif_rx(skb);
++#endif //end #ifdef R1000_DEBUG
++
++
++//=================================================================
++// PHYAR
++// bit Symbol
++// 31 Flag
++// 30-21 reserved
++// 20-16 5-bit GMII/MII register address
++// 15-0 16-bit GMII/MII register data
++//=================================================================
++void R1000_WRITE_GMII_REG( unsigned long ioaddr, int RegAddr, int value )
++{
++ int i;
++
++ RTL_W32 ( PHYAR, 0x80000000 | (RegAddr&0xFF)<<16 | value);
++ udelay(1000);
++
++ for( i = 2000; i > 0 ; i -- ){
++ // Check if the RTL8169 has completed writing to the specified MII register
++ if( ! (RTL_R32(PHYAR)&0x80000000) ){
++ break;
++ }
++ else{
++ udelay(100);
++ }// end of if( ! (RTL_R32(PHYAR)&0x80000000) )
++ }// end of for() loop
++}
++//=================================================================
++int R1000_READ_GMII_REG( unsigned long ioaddr, int RegAddr )
++{
++ int i, value = -1;
++
++ RTL_W32 ( PHYAR, 0x0 | (RegAddr&0xFF)<<16 );
++ udelay(1000);
++
++ for( i = 2000; i > 0 ; i -- ){
++ // Check if the RTL8169 has completed retrieving data from the specified MII register
++ if( RTL_R32(PHYAR) & 0x80000000 ){
++ value = (int)( RTL_R32(PHYAR)&0xFFFF );
++ break;
++ }
++ else{
++ udelay(100);
++ }// end of if( RTL_R32(PHYAR) & 0x80000000 )
++ }// end of for() loop
++ return value;
++}
++
++void r1000_phy_timer_t_handler( void *timer_data )
++{
++ struct net_device *netdev = (struct net_device *)timer_data;
++ struct r1000_private *priv = (struct r1000_private *) (netdev->priv);
++ unsigned long ioaddr = priv->ioaddr;
++
++ assert( priv->mcfg > MCFG_METHOD_1 );
++ assert( priv->pcfg < PCFG_METHOD_3 );
++
++ if( RTL_R8(PHYstatus) & LinkStatus ){
++ priv->phy_link_down_cnt = 0 ;
++ }
++ else{
++ priv->phy_link_down_cnt ++ ;
++ if( priv->phy_link_down_cnt >= 12 ){
++ // If link on 1000, perform phy reset.
++ if( R1000_READ_GMII_REG( ioaddr, PHY_1000_CTRL_REG ) & PHY_Cap_1000_Full )
++ {
++ DBG_PRINT("r1000_hw_PHY_reset\n");
++ r1000_hw_PHY_reset(netdev);
++ }
++
++ priv->phy_link_down_cnt = 0 ;
++ }
++ }
++
++ //---------------------------------------------------------------------------
++ //mod_timer is a more efficient way to update the expire field of an active timer.
++ //---------------------------------------------------------------------------
++// r1000_mod_timer( (&priv->phy_timer_t), 100 );
++}
++
++void r1000_timer_handler( void *timer_data )
++{
++ struct net_device *netdev = (struct net_device *)timer_data;
++ struct r1000_private *priv = (struct r1000_private *) (netdev->priv);
++
++ if( (priv->mcfg > MCFG_METHOD_1) && (priv->pcfg < PCFG_METHOD_3) ){
++ DBG_PRINT("FIX PCS -> r1000_phy_timer_t_handler\n");
++ priv->phy_link_down_cnt = 0;
++ r1000_phy_timer_t_handler( timer_data );
++ }
++
++ r1000_mod_timer( (&priv->r1000_timer), priv->expire_time );
++}
++
++static int r1000_set_speed_duplex(unsigned long ioaddr, unsigned int anar, unsigned int gbcr, unsigned int bmcr){
++ unsigned int i = 0;
++ unsigned int bmsr;
++
++ R1000_WRITE_GMII_REG(ioaddr,PHY_AUTO_NEGO_REG,anar);
++ R1000_WRITE_GMII_REG(ioaddr,PHY_1000_CTRL_REG,gbcr);
++ R1000_WRITE_GMII_REG(ioaddr,PHY_CTRL_REG,bmcr);
++
++ for(i=0;i<10000;i++){
++ bmsr = R1000_READ_GMII_REG(ioaddr,PHY_STAT_REG);
++ if(bmsr&PHY_Auto_Neco_Comp)
++ return 0;
++ }
++ return -1;
++}
++
++static int __devinit r1000_init_board ( struct pci_dev *pdev, struct net_device **netdev_out, unsigned long *ioaddr_out)
++{
++ unsigned long ioaddr = 0;
++ struct net_device *netdev;
++ struct r1000_private *priv;
++ int rc, i;
++#ifndef R1000_USE_IO
++ unsigned long mmio_start, mmio_end, mmio_flags, mmio_len;
++#endif
++
++ assert (pdev != NULL);
++ assert (ioaddr_out != NULL);
++
++ *ioaddr_out = 0;
++ *netdev_out = NULL;
++
++ // dev zeroed in init_etherdev
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
++ netdev = init_etherdev (NULL, sizeof (*priv));
++#else
++ netdev = alloc_etherdev (sizeof (*priv));
++#endif
++
++ if (netdev == NULL) {
++ printk (KERN_ERR PFX "unable to alloc new ethernet\n");
++ return -ENOMEM;
++ }
++
++ SET_MODULE_OWNER(netdev);
++
++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
++ SET_NETDEV_DEV(netdev, &pdev->dev);
++#endif
++
++ priv = netdev->priv;
++
++ // enable device (incl. PCI PM wakeup and hotplug setup)
++ rc = pci_enable_device (pdev);
++ if (rc)
++ goto err_out;
++
++#ifndef R1000_USE_IO
++ mmio_start = pci_resource_start (pdev, 1);
++ mmio_end = pci_resource_end (pdev, 1);
++ mmio_flags = pci_resource_flags (pdev, 1);
++ mmio_len = pci_resource_len (pdev, 1);
++
++ // make sure PCI base addr 1 is MMIO
++ if (!(mmio_flags & IORESOURCE_MEM)) {
++ printk (KERN_ERR PFX "region #1 not an MMIO resource, aborting\n");
++ rc = -ENODEV;
++ goto err_out;
++ }
++
++ // check for weird/broken PCI region reporting
++ if ( mmio_len < RTL_MIN_IO_SIZE ) {
++ printk (KERN_ERR PFX "Invalid PCI region size(s), aborting\n");
++ rc = -ENODEV;
++ goto err_out;
++ }
++#endif
++
++ rc = pci_request_regions (pdev, netdev->name);
++ if (rc)
++ goto err_out;
++
++ // enable PCI bus-mastering
++ pci_set_master (pdev);
++
++#ifdef R1000_USE_IO
++ ioaddr = pci_resource_start(pdev, 0);
++#else
++ // ioremap MMIO region
++ ioaddr = (unsigned long)ioremap (mmio_start, mmio_len);
++ if (ioaddr == 0) {
++ printk (KERN_ERR PFX "cannot remap MMIO, aborting\n");
++ rc = -EIO;
++ goto err_out_free_res;
++ }
++#endif
++
++ // Soft reset the chip.
++ RTL_W8 ( ChipCmd, CmdReset);
++
++ // Check that the chip has finished the reset.
++ for (i = 1000; i > 0; i--){
++ if ( (RTL_R8(ChipCmd) & CmdReset) == 0){
++ break;
++ }
++ else{
++ udelay (10);
++ }
++ }
++
++ // identify config method
++ {
++ unsigned long val32 = (RTL_R32(TxConfig)&0x7c800000);
++
++ if( val32 == 0x38800000)
++ priv->mcfg = MCFG_METHOD_15;
++ else if( val32 == 0x30800000)
++ priv->mcfg = MCFG_METHOD_14;
++ else if( val32 == 0x34000000)
++ priv->mcfg = MCFG_METHOD_13;
++ else if( val32 == 0x38000000)
++ priv->mcfg = MCFG_METHOD_12;
++ else if( val32 == 0x30000000)
++ priv->mcfg = MCFG_METHOD_11;
++ else if( val32 == 0x18000000)
++ priv->mcfg = MCFG_METHOD_5;
++ else if( val32 == 0x10000000 )
++ priv->mcfg = MCFG_METHOD_4;
++ else if( val32 == 0x04000000 )
++ priv->mcfg = MCFG_METHOD_3;
++ else if( val32 == 0x00800000 )
++ priv->mcfg = MCFG_METHOD_2;
++ else if( val32 == 0x00000000 )
++ priv->mcfg = MCFG_METHOD_1;
++ else
++ priv->mcfg = MCFG_METHOD_1;
++ }
++ {
++ unsigned char val8 = (unsigned char)(R1000_READ_GMII_REG(ioaddr,3)&0x000f);
++ if( val8 == 0x00 ){
++ priv->pcfg = PCFG_METHOD_1;
++ }
++ else if( val8 == 0x01 ){
++ priv->pcfg = PCFG_METHOD_2;
++ }
++ else if( val8 == 0x02 ){
++ priv->pcfg = PCFG_METHOD_3;
++ }
++ else{
++ priv->pcfg = PCFG_METHOD_3;
++ }
++ }
++
++
++ for (i = ARRAY_SIZE (rtl_chip_info) - 1; i >= 0; i--){
++ if (priv->mcfg == rtl_chip_info[i].mcfg) {
++ priv->chipset = i;
++ goto match;
++ }
++ }
++
++ //if unknown chip, assume array element #0, original RTL-8169 in this case
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
++ printk (KERN_DEBUG PFX "PCI device %s: unknown chip version, assuming RTL-8169\n", pdev->slot_name);
++#endif
++ priv->chipset = 0;
++
++match:
++ *ioaddr_out = ioaddr;
++ *netdev_out = netdev;
++ return 0;
++
++#ifndef R1000_USE_IO
++err_out_free_res:
++ pci_release_regions (pdev);
++#endif
++
++err_out:
++ unregister_netdev(netdev);
++ kfree(netdev);
++ return rc;
++}
++
++int r1000_set_medium(struct net_device *netdev,u16 speed,u8 duplex,u8 autoneg){
++ struct r1000_private *priv = (struct r1000_private *)(netdev->priv);
++ unsigned long ioaddr = priv->ioaddr;
++ unsigned int anar=0,gbcr=0,bmcr=0,ret=0,val=0;
++
++ val = R1000_READ_GMII_REG( ioaddr, PHY_AUTO_NEGO_REG );
++#ifdef R1000_HW_FLOW_CONTROL_SUPPORT
++ val |= PHY_Cap_PAUSE | PHY_Cap_ASYM_PAUSE ;
++#endif //end #define R1000_HW_FLOW_CONTROL_SUPPORT
++
++ bmcr = PHY_Restart_Auto_Nego|PHY_Enable_Auto_Nego;
++
++ if(autoneg==AUTONEG_ENABLE){
++ priv->autoneg = AUTONEG_ENABLE;
++ anar = PHY_Cap_10_Half|PHY_Cap_10_Full|PHY_Cap_100_Half|PHY_Cap_100_Full;
++ gbcr = PHY_Cap_1000_Half|PHY_Cap_1000_Full;
++ }else{
++ priv->autoneg = AUTONEG_DISABLE;
++ if(speed==SPEED_1000){
++ priv->speed = SPEED_1000;
++ priv->duplex = DUPLEX_FULL;
++
++ anar = PHY_Cap_10_Half|PHY_Cap_10_Full|PHY_Cap_100_Half|PHY_Cap_100_Full;
++ if((priv->mcfg==MCFG_METHOD_13)||(priv->mcfg==MCFG_METHOD_14)||(priv->mcfg==MCFG_METHOD_15))
++ gbcr = PHY_Cap_Null;
++ else
++ gbcr = PHY_Cap_1000_Half|PHY_Cap_1000_Full;
++ }else if((speed==SPEED_100)&&(duplex==DUPLEX_FULL)){
++ priv->speed = SPEED_100;
++ priv->duplex = DUPLEX_FULL;
++
++ anar = PHY_Cap_10_Half|PHY_Cap_10_Full|PHY_Cap_100_Half|PHY_Cap_100_Full;
++ gbcr = PHY_Cap_Null;
++ }else if((speed==SPEED_100)&&(duplex==DUPLEX_HALF)){
++ priv->speed = SPEED_100;
++ priv->duplex = DUPLEX_HALF;
++
++ anar = PHY_Cap_10_Half|PHY_Cap_10_Full|PHY_Cap_100_Half;
++ gbcr = PHY_Cap_Null;
++ }else if((speed==SPEED_10)&&(duplex==DUPLEX_FULL)){
++ priv->speed = SPEED_10;
++ priv->duplex = DUPLEX_FULL;
++
++ anar = PHY_Cap_10_Half|PHY_Cap_10_Full;
++ gbcr = PHY_Cap_Null;
++ }else if((speed==SPEED_10)&&(duplex==DUPLEX_HALF)){
++ priv->speed = SPEED_10;
++ priv->duplex = DUPLEX_HALF;
++
++ anar = PHY_Cap_10_Half;
++ gbcr = PHY_Cap_Null;
++ }else{
++ priv->speed = SPEED_100;
++ priv->duplex = DUPLEX_FULL;
++
++ anar = PHY_Cap_10_Half|PHY_Cap_10_Full|PHY_Cap_100_Half|PHY_Cap_100_Full;
++ gbcr = PHY_Cap_Null;
++ }
++ }
++
++ //enable flow control
++ anar |= val&0xC1F;
++
++ ret = r1000_set_speed_duplex(ioaddr,anar,gbcr,bmcr);
++
++ return ret;
++}
++
++
++static int r1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd){
++
++ if(!netif_running(netdev))
++ return -EINVAL;
++
++ switch(cmd){
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
++ case SIOCETHTOOL:
++ return ethtool_ioctl(ifr);
++#endif
++ default:
++ return -EOPNOTSUPP;
++ }
++}
++
++
++
++
++
++//======================================================================================================
++static int __devinit r1000_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
++{
++ struct net_device *netdev = NULL;
++ struct r1000_private *priv = NULL;
++ unsigned long ioaddr = 0;
++ static int board_idx = -1;
++ int i,rc;
++// int val=0;
++ int speed_opt = SPEED_100;
++ int duplex_opt = DUPLEX_FULL;
++ int autoneg_opt = AUTONEG_ENABLE;
++
++
++ assert (pdev != NULL);
++ assert (ent != NULL);
++
++ board_idx++;
++
++
++ i = r1000_init_board (pdev, &netdev, &ioaddr);
++ if (i < 0) {
++ return i;
++ }
++
++ priv = netdev->priv;
++
++ assert (ioaddr != NULL);
++ assert (netdev != NULL);
++ assert (priv != NULL);
++
++ // Get MAC address //
++ for (i = 0; i < MAC_ADDR_LEN ; i++){
++ netdev->dev_addr[i] = RTL_R8( MAC0 + i );
++ }
++
++ netdev->open = r1000_open;
++ netdev->hard_start_xmit = r1000_start_xmit;
++ netdev->get_stats = r1000_get_stats;
++ netdev->stop = r1000_close;
++ netdev->tx_timeout = r1000_tx_timeout;
++ netdev->set_multicast_list = r1000_set_rx_mode;
++ netdev->watchdog_timeo = TX_TIMEOUT;
++ netdev->irq = pdev->irq;
++ netdev->base_addr = (unsigned long) ioaddr;
++
++#ifdef R1000_JUMBO_FRAME_SUPPORT
++ netdev->change_mtu = r1000_change_mtu;
++#endif //end #ifdef R1000_JUMBO_FRAME_SUPPORT
++
++ netdev->do_ioctl = r1000_ioctl;
++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
++ netdev->ethtool_ops = &r1000_ethtool_ops;
++#endif
++
++#ifdef R1000_BOTTOM_HALVES
++ tasklet_init(&priv->r1000_rx_tasklet,r1000_rx_interrupt,(unsigned long)netdev);
++ tasklet_init(&priv->r1000_tx_tasklet,r1000_tx_interrupt,(unsigned long)netdev);
++#endif //R1000_BOTTOM_HALVES
++
++
++ priv = netdev->priv; // private data //
++ priv->pci_dev = pdev;
++ priv->ioaddr = ioaddr;
++
++//#ifdef R1000_JUMBO_FRAME_SUPPORT
++ priv->curr_mtu_size = netdev->mtu;
++ priv->tx_pkt_len = netdev->mtu + ETH_HDR_LEN;
++ priv->rx_pkt_len = netdev->mtu + ETH_HDR_LEN;
++ priv->hw_rx_pkt_len = priv->rx_pkt_len + 8;
++//#endif //end #ifdef R1000_JUMBO_FRAME_SUPPORT
++
++ DBG_PRINT("-------------------------- \n");
++ DBG_PRINT("netdev->mtu = %d \n", netdev->mtu);
++ DBG_PRINT("priv->curr_mtu_size = %d \n", priv->curr_mtu_size);
++ DBG_PRINT("priv->tx_pkt_len = %d \n", priv->tx_pkt_len);
++ DBG_PRINT("priv->rx_pkt_len = %d \n", priv->rx_pkt_len);
++ DBG_PRINT("priv->hw_rx_pkt_len = %d \n", priv->hw_rx_pkt_len);
++ DBG_PRINT("-------------------------- \n");
++
++ spin_lock_init(&priv->lock);
++ spin_lock_init(&priv->tx_lock);
++ spin_lock_init(&priv->rx_lock);
++
++ rc = register_netdev(netdev);
++ if(rc){
++#ifndef R1000_USE_IO
++ iounmap ((void *)(netdev->base_addr));
++#endif
++ pci_release_regions(pdev);
++ pci_disable_device(pdev);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
++ kfree(netdev);
++#else
++ free_netdev(netdev);
++#endif
++ return rc;
++ }
++
++ pci_set_drvdata(pdev,netdev); // pdev->driver_data = data;
++
++
++ printk (KERN_DEBUG "%s: Identified chip type is '%s'.\n",netdev->name,rtl_chip_info[priv->chipset].name);
++ printk (KERN_INFO "%s: %s at 0x%lx, "
++ "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x, "
++ "IRQ %d\n",
++ netdev->name,
++ R1000_DRIVER_NAME,
++ netdev->base_addr,
++ netdev->dev_addr[0],netdev->dev_addr[1],
++ netdev->dev_addr[2],netdev->dev_addr[3],
++ netdev->dev_addr[4],netdev->dev_addr[5],
++ netdev->irq);
++
++
++ // Config PHY
++ r1000_hw_PHY_config(netdev);
++
++ DBG_PRINT("Set MAC Reg C+CR Offset 0x82h = 0x01h\n");
++ RTL_W8( 0x82, 0x01 );
++
++ if( priv->mcfg < MCFG_METHOD_3 ){
++ DBG_PRINT("Set PCI Latency=0x40\n");
++ pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40);
++ }
++
++ if( priv->mcfg == MCFG_METHOD_2 ){
++ DBG_PRINT("Set MAC Reg C+CR Offset 0x82h = 0x01h\n");
++ RTL_W8( 0x82, 0x01 );
++ DBG_PRINT("Set PHY Reg 0x0bh = 0x00h\n");
++ R1000_WRITE_GMII_REG( ioaddr, 0x0b, 0x0000 ); //w 0x0b 15 0 0
++ }
++
++ // if TBI is not endbled
++ if( !(RTL_R8(PHYstatus) & TBI_Enable) ){
++// val = R1000_READ_GMII_REG( ioaddr, PHY_AUTO_NEGO_REG );
++
++//#ifdef R1000_HW_FLOW_CONTROL_SUPPORT
++// val |= PHY_Cap_PAUSE | PHY_Cap_ASYM_PAUSE ;
++//#endif //end #define R1000_HW_FLOW_CONTROL_SUPPORT
++
++ if(speed[board_idx] == -1)
++ speed[board_idx] = SPEED_1000;
++
++ if((duplex[board_idx] == -1) || ((duplex[board_idx] == DUPLEX_HALF) && (speed[board_idx] == SPEED_1000)))
++ duplex[board_idx] = DUPLEX_FULL;
++
++ if(autoneg[board_idx] == -1)
++ autoneg[board_idx] = AUTONEG_ENABLE;
++
++ speed_opt = (board_idx >= MAX_UNITS) ? -1 : speed[board_idx];
++ duplex_opt = (board_idx >= MAX_UNITS) ? -1 : duplex[board_idx];
++ autoneg_opt = (board_idx >= MAX_UNITS) ? -1 : autoneg[board_idx];
++
++ r1000_set_medium(netdev,speed_opt,duplex_opt,autoneg_opt);
++ }// end of TBI is not enabled
++ else{
++ udelay(100);
++ DBG_PRINT("1000Mbps Full-duplex operation, TBI Link %s!\n",(RTL_R32(TBICSR) & TBILinkOK) ? "OK" : "Failed" );
++ }// end of TBI is not enabled
++
++ //show some information after the driver is inserted
++ if(( priv->mcfg == MCFG_METHOD_11 )||( priv->mcfg == MCFG_METHOD_12 ))
++ printk("Realtek RTL8168/8111 Family PCI-E Gigabit Ethernet Network Adapter\n");
++ else if((priv->mcfg==MCFG_METHOD_13)||(priv->mcfg==MCFG_METHOD_14)||(priv->mcfg==MCFG_METHOD_15))
++ printk("Realtek RTL8139/810x Family Fast Ethernet Network Adapter\n");
++ else
++ printk("Realtek RTL8169/8110 Family Gigabit Ethernet Network Adapter\n");
++
++ printk("Driver version:%s\n",R1000_VERSION);
++ printk("Released date:%s\n",RELEASE_DATE);
++ if(RTL_R8(PHYstatus) & LinkStatus){
++ printk("Link Status:%s\n","Linked");
++
++ if(RTL_R8(PHYstatus) & _1000Mbps)
++ printk("Link Speed:1000Mbps\n");
++ else if(RTL_R8(PHYstatus) & _100Mbps)
++ printk("Link Speed:100Mbps\n");
++ else if(RTL_R8(PHYstatus) & _10Mbps)
++ printk("Link Speed:10Mbps\n");
++
++ printk("Duplex mode:%s\n",RTL_R8(PHYstatus)&FullDup?"Full-Duplex":"Half-Duplex");
++ }else{
++ printk("Link Status:%s\n","Not Linked");
++ }
++#ifdef R1000_USE_IO
++ printk("I/O Base:0x%X(I/O port)\n",(unsigned int)(priv->ioaddr));
++#else
++ printk("I/O Base:0x%X(I/O memory)\n",(unsigned int)(priv->ioaddr));
++#endif //R1000_USE_IO
++ printk("IRQ:%d\n",netdev->irq);
++
++ return 0;
++}
++
++static void __devexit r1000_remove_one (struct pci_dev *pdev)
++{
++ struct net_device *netdev = pci_get_drvdata(pdev);
++
++ assert (netdev != NULL);
++ assert (priv != NULL);
++
++ unregister_netdev(netdev);
++
++#ifndef R1000_USE_IO
++ iounmap ((void *)(netdev->base_addr));
++#endif
++ pci_release_regions (pdev);
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
++ kfree(netdev);
++#else
++ free_netdev(netdev);
++#endif
++
++ pci_set_drvdata (pdev, NULL);
++}
++
++static int r1000_open (struct net_device *netdev)
++{
++ struct r1000_private *priv = netdev->priv;
++ struct pci_dev *pdev = priv->pci_dev;
++ int retval;
++// u8 diff;
++// u32 TxPhyAddr, RxPhyAddr;
++
++
++ if( priv->drvinit_fail == 1 ){
++ printk("%s: Gigabit driver open failed.\n", netdev->name );
++ return -ENOMEM;
++ }
++
++ retval = request_irq (netdev->irq, r1000_interrupt, SA_SHIRQ, netdev->name, netdev);
++ if (retval) {
++ return retval;
++ }
++
++ //2004-05-11
++ // Allocate tx/rx descriptor space
++ priv->sizeof_txdesc_space = NUM_TX_DESC * sizeof(struct TxDesc)+256;
++ priv->txdesc_space = pci_alloc_consistent( pdev, priv->sizeof_txdesc_space, &priv->txdesc_phy_dma_addr );
++ if( priv->txdesc_space == NULL ){
++ printk("%s: Gigabit driver alloc txdesc_space failed.\n", netdev->name );
++ return -ENOMEM;
++ }
++ priv->sizeof_rxdesc_space = NUM_RX_DESC * sizeof(struct RxDesc)+256;
++ priv->rxdesc_space = pci_alloc_consistent( pdev, priv->sizeof_rxdesc_space, &priv->rxdesc_phy_dma_addr );
++ if( priv->rxdesc_space == NULL ){
++ printk("%s: Gigabit driver alloc rxdesc_space failed.\n", netdev->name );
++ return -ENOMEM;
++ }
++
++ if(priv->txdesc_phy_dma_addr & 0xff){
++ printk("%s: Gigabit driver txdesc_phy_dma_addr is not 256-bytes-aligned.\n", netdev->name );
++ }
++ if(priv->rxdesc_phy_dma_addr & 0xff){
++ printk("%s: Gigabit driver rxdesc_phy_dma_addr is not 256-bytes-aligned.\n", netdev->name );
++ }
++ // Set tx/rx descriptor space
++ priv->TxDescArray = (struct TxDesc *)priv->txdesc_space;
++ priv->RxDescArray = (struct RxDesc *)priv->rxdesc_space;
++
++ {
++ int i;
++ struct sk_buff *skb = NULL;
++
++ for(i=0;i<NUM_RX_DESC;i++){
++ skb = R1000_ALLOC_RXSKB(MAX_RX_SKBDATA_SIZE);
++ if( skb != NULL ) {
++ skb_reserve (skb, 8); // 16 byte align the IP fields. //
++ priv->Rx_skbuff[i] = skb;
++ }
++ else{
++ printk("%s: Gigabit driver failed to allocate skbuff.\n", netdev->name);
++ priv->drvinit_fail = 1;
++ }
++ }
++ }
++
++
++ //////////////////////////////////////////////////////////////////////////////
++ r1000_init_ring(netdev);
++ r1000_hw_start(netdev);
++
++
++ // ------------------------------------------------------
++ DBG_PRINT("FIX PCS -> r1000_request_timer\n");
++ priv->expire_time = R1000_TIMER_EXPIRE_TIME;
++ r1000_request_timer( (&priv->r1000_timer), priv->expire_time, r1000_timer_handler, ((void *)netdev) ); //in open()
++
++
++ DBG_PRINT("%s: %s() alloc_rxskb_cnt = %d\n", netdev->name, __FUNCTION__, alloc_rxskb_cnt );
++
++ return 0;
++
++}//end of r1000_open (struct net_device *netdev)
++
++static void r1000_hw_PHY_reset(struct net_device *netdev)
++{
++ int val, phy_reset_expiretime = 50;
++ struct r1000_private *priv = netdev->priv;
++ unsigned long ioaddr = priv->ioaddr;
++
++ DBG_PRINT("%s: Reset RTL8169s PHY\n", netdev->name);
++
++ val = ( R1000_READ_GMII_REG( ioaddr, 0 ) | 0x8000 ) & 0xffff;
++ R1000_WRITE_GMII_REG( ioaddr, 0, val );
++
++ do //waiting for phy reset
++ {
++ if( R1000_READ_GMII_REG( ioaddr, 0 ) & 0x8000 ){
++ phy_reset_expiretime --;
++ udelay(100);
++ }
++ else{
++ break;
++ }
++ }while( phy_reset_expiretime >= 0 );
++
++ assert( phy_reset_expiretime > 0 );
++}
++
++static void r1000_hw_PHY_config (struct net_device *netdev)
++{
++ struct r1000_private *priv = netdev->priv;
++ void *ioaddr = (void*)priv->ioaddr;
++
++ DBG_PRINT("priv->mcfg=%d, priv->pcfg=%d\n",priv->mcfg,priv->pcfg);
++
++ if( priv->mcfg == MCFG_METHOD_4 ){
++#if 0
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x1F, 0x0001 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x1b, 0x841e );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x0e, 0x7bfb );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x09, 0x273a );
++#endif
++
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x1F, 0x0002 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0x90D0 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x1F, 0x0000 );
++ }else if((priv->mcfg == MCFG_METHOD_2)||(priv->mcfg == MCFG_METHOD_3)){
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x1f, 0x0001 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x06, 0x006e );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x08, 0x0708 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x15, 0x4000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x18, 0x65c7 );
++
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x1f, 0x0001 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0x00a1 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0x0008 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0x0120 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0x1000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x0800 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x0000 );
++
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0xff41 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0xdf60 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0x0140 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0x0077 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x7800 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x7000 );
++
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0x802f );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0x4f02 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0x0409 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0xf0f9 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x9800 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x9000 );
++
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0xdf01 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0xdf20 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0xff95 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0xba00 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xa800 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xa000 );
++
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0xff41 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0xdf20 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0x0140 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0x00bb );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xb800 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xb000 );
++
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0xdf41 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0xdc60 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0x6340 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0x007d );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xd800 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xd000 );
++
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0xdf01 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0xdf20 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0x100a );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0xa0ff );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xf800 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xf000 );
++
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x1f, 0x0000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x0b, 0x0000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0x9200 );
++#if 0
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x1F, 0x0001 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x15, 0x1000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x18, 0x65C7 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x0000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0x00A1 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0x0008 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0x1020 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0x1000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x0800 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x0000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x7000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0xFF41 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0xDE60 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0x0140 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0x0077 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x7800 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x7000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xA000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0xDF01 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0xDF20 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0xFF95 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0xFA00 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xA800 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xA000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xB000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0xFF41 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0xDE20 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0x0140 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0x00BB );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xB800 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xB000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xF000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x03, 0xDF01 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x02, 0xDF20 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x01, 0xFF95 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x00, 0xBF00 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xF800 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0xF000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x04, 0x0000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x1F, 0x0000 );
++ R1000_WRITE_GMII_REG( (unsigned long)ioaddr, 0x0B, 0x0000 );
++#endif
++ }
++ else{
++ DBG_PRINT("priv->mcfg=%d. Discard hw PHY config.\n",priv->mcfg);
++ }
++}
++
++static void r1000_hw_start (struct net_device *netdev)
++{
++ struct r1000_private *priv = netdev->priv;
++ struct pci_dev *pdev = priv->pci_dev;
++ unsigned long ioaddr = priv->ioaddr;
++ u32 i;
++ u8 i8;
++ u16 i16;
++
++ if((priv->mcfg!=MCFG_METHOD_5)&&(priv->mcfg!=MCFG_METHOD_11)&&
++ (priv->mcfg!=MCFG_METHOD_12)&&(priv->mcfg!=MCFG_METHOD_13)&&
++ (priv->mcfg!=MCFG_METHOD_14)&&(priv->mcfg!=MCFG_METHOD_15)){
++ /* Soft reset the chip. */
++ RTL_W8 ( ChipCmd, CmdReset);
++
++ /* Check that the chip has finished the reset. */
++ for (i = 1000; i > 0; i--){
++ if ((RTL_R8( ChipCmd ) & CmdReset) == 0) break;
++ else udelay (10);
++ }
++
++ RTL_W8 ( Cfg9346, Cfg9346_Unlock);
++ RTL_W8 ( ChipCmd, CmdTxEnb | CmdRxEnb);
++ RTL_W8 ( ETThReg, ETTh);
++
++ RTL_W16(CPlusCmd,RTL_R16(CPlusCmd)|CPCR_MulRW_Enable);
++ pci_write_config_byte(pdev,Cache_Line_Size,0x08);
++
++ // For gigabit rtl8169
++ RTL_W16 ( RxMaxSize, (unsigned short)priv->hw_rx_pkt_len );
++
++ // Set Rx Config register
++ i = r1000_rx_config | ( RTL_R32( RxConfig ) & rtl_chip_info[priv->chipset].RxConfigMask);
++ RTL_W32 ( RxConfig, i);
++
++
++ /* Set DMA burst size and Interframe Gap Time */
++ RTL_W32 ( TxConfig, (TX_DMA_BURST << TxDMAShift) | (InterFrameGap << TxInterFrameGapShift) );
++
++
++
++ RTL_W16( CPlusCmd, RTL_R16(CPlusCmd) );
++
++ if(priv->mcfg==MCFG_METHOD_2||priv->mcfg==MCFG_METHOD_3){
++ RTL_W16( CPlusCmd, (RTL_R16(CPlusCmd)|(1<<14)|(1<<3)) );
++ DBG_PRINT("Set MAC Reg C+CR Offset 0xE0: bit-3 and bit-14\n");
++ }else{
++ RTL_W16( CPlusCmd, (RTL_R16(CPlusCmd)|(1<<3)) );
++ DBG_PRINT("Set MAC Reg C+CR Offset 0xE0: bit-3.\n");
++ }
++
++ {
++ RTL_W16(0xE2,0x0000);
++ }
++
++ priv->cur_rx = 0;
++
++ RTL_W32 ( TxDescStartAddr, priv->txdesc_phy_dma_addr);
++ RTL_W32 ( TxDescStartAddr + 4, 0x00);
++ RTL_W32 ( RxDescStartAddr, priv->rxdesc_phy_dma_addr);
++ RTL_W32 ( RxDescStartAddr + 4, 0x00);
++
++ RTL_W8 ( Cfg9346, Cfg9346_Lock );
++ udelay (10);
++
++ RTL_W32 ( RxMissed, 0 );
++
++ r1000_set_rx_mode(netdev);
++
++ RTL_W16 ( MultiIntr, RTL_R16(MultiIntr) & 0xF000);
++
++ RTL_W16 ( IntrMask, r1000_intr_mask);
++ }else{
++ /* Soft reset the chip. */
++ RTL_W8 ( ChipCmd, CmdReset);
++
++ /* Check that the chip has finished the reset. */
++ for (i = 1000; i > 0; i--){
++ if ((RTL_R8( ChipCmd ) & CmdReset) == 0) break;
++ else udelay (10);
++ }
++
++ if(priv->mcfg==MCFG_METHOD_5){
++ RTL_W16(CPlusCmd,RTL_R16(CPlusCmd)|CPCR_MulRW_Enable);
++ pci_write_config_byte(pdev,Cache_Line_Size,0x08);
++ }
++
++ if( priv->mcfg == MCFG_METHOD_13 ){
++ pci_write_config_word(pdev,0x68,0x00);
++ pci_write_config_word(pdev,0x69,0x08);
++ }
++
++ if( priv->mcfg == MCFG_METHOD_5 ){
++ i8=RTL_R8(Config2);
++ i8=i8&0x07;
++ if(i8&&0x01)
++ RTL_W32(Off7Ch,0x0007FFFF);
++
++ i=0x0007FF00;
++ RTL_W32(Off7Ch, i);
++
++ pci_read_config_word(pdev,0x04,&i16);
++ i16=i16&0xEF;
++ pci_write_config_word(pdev,0x04,i16);
++ }
++
++ RTL_W8 ( Cfg9346, Cfg9346_Unlock);
++ RTL_W8 ( ETThReg, ETTh);
++
++ // For gigabit rtl8169
++ RTL_W16 ( RxMaxSize, (unsigned short)priv->hw_rx_pkt_len );
++
++ RTL_W16( CPlusCmd, RTL_R16(CPlusCmd) );
++
++ if(priv->mcfg==MCFG_METHOD_2||priv->mcfg==MCFG_METHOD_3){
++ RTL_W16( CPlusCmd, (RTL_R16(CPlusCmd)|(1<<14)|(1<<3)) );
++ DBG_PRINT("Set MAC Reg C+CR Offset 0xE0: bit-3 and bit-14\n");
++ }else{
++ RTL_W16( CPlusCmd, (RTL_R16(CPlusCmd)|(1<<3)) );
++ DBG_PRINT("Set MAC Reg C+CR Offset 0xE0: bit-3.\n");
++ }
++
++ {
++ RTL_W16(0xE2,0x0000);
++ }
++
++ priv->cur_rx = 0;
++
++ RTL_W32 ( TxDescStartAddr, priv->txdesc_phy_dma_addr);
++ RTL_W32 ( TxDescStartAddr + 4, 0x00);
++ RTL_W32 ( RxDescStartAddr, priv->rxdesc_phy_dma_addr);
++ RTL_W32 ( RxDescStartAddr + 4, 0x00);
++ RTL_W8 ( ChipCmd, CmdTxEnb | CmdRxEnb);
++ // Set Rx Config register
++ i = r1000_rx_config | ( RTL_R32( RxConfig ) & rtl_chip_info[priv->chipset].RxConfigMask);
++ RTL_W32 ( RxConfig, i);
++
++ /* Set DMA burst size and Interframe Gap Time */
++ RTL_W32 ( TxConfig, (TX_DMA_BURST << TxDMAShift) | (InterFrameGap << TxInterFrameGapShift) );
++
++ RTL_W8 ( Cfg9346, Cfg9346_Lock );
++ udelay (10);
++
++ RTL_W32 ( RxMissed, 0 );
++
++ r1000_set_rx_mode(netdev);
++
++ RTL_W16 ( MultiIntr, RTL_R16(MultiIntr) & 0xF000);
++
++ RTL_W16 ( IntrMask, r1000_intr_mask);
++ }
++
++ netif_start_queue(netdev);
++
++}//end of r1000_hw_start (struct net_device *netdev)
++
++static void r1000_init_ring (struct net_device *netdev)
++{
++ struct r1000_private *priv = netdev->priv;
++ struct pci_dev *pdev = priv->pci_dev;
++ int i;
++ struct sk_buff *skb;
++
++
++ priv->cur_rx = 0;
++ priv->cur_tx = 0;
++ priv->dirty_tx = 0;
++ memset(priv->TxDescArray, 0x0, NUM_TX_DESC*sizeof(struct TxDesc));
++ memset(priv->RxDescArray, 0x0, NUM_RX_DESC*sizeof(struct RxDesc));
++
++
++ for (i=0 ; i<NUM_TX_DESC ; i++){
++ priv->Tx_skbuff[i]=NULL;
++ priv->txdesc_array_dma_addr[i] = pci_map_single(pdev, &priv->TxDescArray[i], sizeof(struct TxDesc), PCI_DMA_TODEVICE);
++ }
++
++ for (i=0; i <NUM_RX_DESC; i++) {
++ if(i==(NUM_RX_DESC-1)){
++ priv->RxDescArray[i].status = cpu_to_le32((OWNbit | EORbit) | (unsigned long)priv->hw_rx_pkt_len);
++ }
++ else{
++ priv->RxDescArray[i].status = cpu_to_le32(OWNbit | (unsigned long)priv->hw_rx_pkt_len);
++ }
++
++ {//-----------------------------------------------------------------------
++ skb = priv->Rx_skbuff[i];
++ priv->rx_skbuff_dma_addr[i] = pci_map_single(pdev, skb->data, MAX_RX_SKBDATA_SIZE, PCI_DMA_FROMDEVICE);
++
++ if( skb != NULL ){
++ priv->RxDescArray[i].buf_addr = cpu_to_le32(priv->rx_skbuff_dma_addr[i]);
++ priv->RxDescArray[i].buf_Haddr = 0;
++ }
++ else{
++ DBG_PRINT("%s: %s() Rx_skbuff == NULL\n", netdev->name, __FUNCTION__);
++ priv->drvinit_fail = 1;
++ }
++ }//-----------------------------------------------------------------------
++ priv->rxdesc_array_dma_addr[i] = pci_map_single(pdev, &priv->RxDescArray[i], sizeof(struct RxDesc), PCI_DMA_TODEVICE);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
++ pci_dma_sync_single(pdev, priv->rxdesc_array_dma_addr[i], sizeof(struct RxDesc), PCI_DMA_TODEVICE);
++#endif
++ }
++}
++
++static void r1000_tx_clear (struct r1000_private *priv)
++{
++ int i;
++
++ priv->cur_tx = 0;
++ for ( i = 0 ; i < NUM_TX_DESC ; i++ ){
++ if ( priv->Tx_skbuff[i] != NULL ) {
++ dev_kfree_skb ( priv->Tx_skbuff[i] );
++ priv->Tx_skbuff[i] = NULL;
++ priv->stats.tx_dropped++;
++ }
++ }
++}
++
++static void r1000_tx_timeout (struct net_device *netdev)
++{
++ struct r1000_private *priv = netdev->priv;
++ unsigned long ioaddr = priv->ioaddr;
++ u8 tmp8;
++
++ /* disable Tx, if not already */
++ tmp8 = RTL_R8(ChipCmd);
++ if(tmp8&CmdTxEnb){
++ RTL_W8(ChipCmd,tmp8 & ~CmdTxEnb);
++ }
++
++ /* Disable interrupts by clearing the interrupt mask. */
++ RTL_W16(IntrMask,0x0000);
++
++ /* Stop a shared interrupt from scavenging while we are. */
++// spin_lock_irq(&priv->lock);
++ spin_lock_irq(&priv->tx_lock);
++ r1000_tx_clear(priv);
++// spin_unlock_irq(&priv->lock);
++ spin_unlock_irq(&priv->tx_lock);
++
++
++ r1000_hw_start(netdev);
++
++ netif_wake_queue(netdev);
++}
++
++static int r1000_start_xmit (struct sk_buff *skb, struct net_device *netdev)
++{
++ struct r1000_private *priv = netdev->priv;
++ unsigned long ioaddr = priv->ioaddr;
++ struct pci_dev *pdev = priv->pci_dev;
++ int entry = priv->cur_tx % NUM_TX_DESC;
++ int buf_len = 60;
++ dma_addr_t txbuf_dma_addr;
++
++// spin_lock_irq(&priv->lock);
++ spin_lock(&priv->tx_lock);
++ if( (le32_to_cpu(priv->TxDescArray[entry].status) & OWNbit)==0 ){
++ priv->Tx_skbuff[entry] = skb;
++ txbuf_dma_addr = pci_map_single(pdev, skb->data, skb->len, PCI_DMA_TODEVICE);
++
++ priv->TxDescArray[entry].buf_addr = cpu_to_le32(txbuf_dma_addr);
++ DBG_PRINT("%s: TX pkt_size = %d\n", __FUNCTION__, skb->len);
++ if( skb->len <= priv->tx_pkt_len ){
++ buf_len = skb->len;
++ }
++ else{
++ printk("%s: Error -- Tx packet size(%d) > mtu(%d)+14\n", netdev->name, skb->len, netdev->mtu);
++ buf_len = priv->tx_pkt_len;
++ }
++
++ if( entry != (NUM_TX_DESC-1) ){
++ priv->TxDescArray[entry].status = cpu_to_le32((OWNbit | FSbit | LSbit) | buf_len);
++ }
++ else{
++ priv->TxDescArray[entry].status = cpu_to_le32((OWNbit | EORbit | FSbit | LSbit) | buf_len);
++ }
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
++ pci_dma_sync_single(pdev, priv->txdesc_array_dma_addr[entry], sizeof(struct TxDesc), PCI_DMA_TODEVICE);
++#endif
++
++
++ RTL_W8(TxPoll,0x40); //set polling bit
++
++ netdev->trans_start = jiffies;
++
++ priv->stats.tx_bytes += ( (skb->len > ETH_ZLEN) ? skb->len : ETH_ZLEN);
++ priv->cur_tx++;
++ }//end of if( (priv->TxDescArray[entry].status & 0x80000000)==0 )
++
++// spin_unlock_irq(&priv->lock);
++
++ if ( (priv->cur_tx - NUM_TX_DESC) == priv->dirty_tx ){
++ netif_stop_queue(netdev);
++ }
++ else{
++ if (netif_queue_stopped(netdev)){
++ netif_wake_queue(netdev);
++ }
++ }
++
++ spin_unlock(&priv->tx_lock);
++
++ return 0;
++}
++
++#ifdef R1000_BOTTOM_HALVES
++static void r1000_tx_interrupt(unsigned long ndev){
++ struct net_device *netdev = (void *)ndev;
++ struct r1000_private *priv = netdev->priv;
++#else
++static void r1000_tx_interrupt(struct net_device *netdev, struct r1000_private *priv, unsigned long ioaddr){
++#endif //R1000_BOTTOM_HALVES
++
++ unsigned long flags;
++
++ spin_lock_irqsave(&priv->tx_lock,flags);
++ r1000_tx_action(netdev);
++ spin_unlock_irqrestore(&priv->tx_lock,flags);
++}
++
++static void FASTCALL (r1000_tx_action(struct net_device *netdev));
++static void fastcall r1000_tx_action(struct net_device *netdev){
++
++ struct r1000_private *priv = netdev->priv;
++ unsigned long dirty_tx, tx_left=0;
++ int entry = priv->cur_tx % NUM_TX_DESC;
++ int txloop_cnt = 0;
++
++ assert (netdev != NULL);
++ assert (priv != NULL);
++ assert (ioaddr != NULL);
++
++ dirty_tx = priv->dirty_tx;
++ tx_left = priv->cur_tx - dirty_tx;
++
++ while( (tx_left > 0) && (txloop_cnt < max_interrupt_work) ){
++ if( (le32_to_cpu(priv->TxDescArray[entry].status) & OWNbit) == 0 ){
++ dev_kfree_skb_irq( priv->Tx_skbuff[dirty_tx % NUM_TX_DESC] );
++ priv->Tx_skbuff[dirty_tx % NUM_TX_DESC] = NULL;
++ priv->stats.tx_packets++;
++ dirty_tx++;
++ tx_left--;
++ entry++;
++ }
++ txloop_cnt ++;
++ }
++
++ if (priv->dirty_tx != dirty_tx) {
++ priv->dirty_tx = dirty_tx;
++ if (netif_queue_stopped(netdev))
++ netif_wake_queue(netdev);
++ }
++}
++
++#ifdef R1000_BOTTOM_HALVES
++static void r1000_rx_interrupt(unsigned long ndev){
++ struct net_device *netdev = (void *)ndev;
++ struct r1000_private *priv = netdev->priv;
++#else
++static void r1000_rx_interrupt(struct net_device *netdev, struct r1000_private *priv, unsigned long ioaddr){
++#endif //R1000_BOTTOM_HALVES
++
++ unsigned long flags;
++
++ spin_lock_irqsave(&priv->rx_lock,flags);
++ r1000_rx_action(netdev);
++ spin_unlock_irqrestore(&priv->rx_lock,flags);
++}
++
++static void FASTCALL (r1000_rx_action(struct net_device *netdev));
++static void fastcall r1000_rx_action(struct net_device *netdev){
++
++ struct r1000_private *priv = netdev->priv;
++ struct pci_dev *pdev = priv->pci_dev;
++ int cur_rx;
++ int pkt_size = 0 ;
++ int rxdesc_cnt = 0;
++ int ret;
++ struct sk_buff *n_skb = NULL;
++ struct sk_buff *cur_skb;
++ struct sk_buff *rx_skb;
++ struct RxDesc *rxdesc;
++
++ assert(netdev != NULL);
++ assert (priv != NULL);
++ assert (ioaddr != NULL);
++
++ cur_rx = priv->cur_rx;
++
++ rxdesc = &priv->RxDescArray[cur_rx];
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
++ pci_dma_sync_single(pdev, priv->rxdesc_array_dma_addr[cur_rx], sizeof(struct RxDesc), PCI_DMA_FROMDEVICE);
++#endif
++
++ while (((le32_to_cpu(rxdesc->status) & OWNbit)== 0) && (rxdesc_cnt < max_interrupt_work)){
++
++ rxdesc_cnt++;
++
++ if( le32_to_cpu(rxdesc->status) & RxRES ){
++ printk(KERN_INFO "%s: Rx ERROR!!!\n", netdev->name);
++ priv->stats.rx_errors++;
++ if ( le32_to_cpu(rxdesc->status) & (RxRWT|RxRUNT) )
++ priv->stats.rx_length_errors++;
++ if ( le32_to_cpu(rxdesc->status) & RxCRC)
++ priv->stats.rx_crc_errors++;
++ }
++ else{
++ pkt_size=(int)(le32_to_cpu(rxdesc->status) & 0x00001FFF)-4;
++
++ if( pkt_size > priv->rx_pkt_len ){
++ printk("%s: Error -- Rx packet size(%d) > mtu(%d)+14\n", netdev->name, pkt_size, netdev->mtu);
++ pkt_size = priv->rx_pkt_len;
++ }
++
++ DBG_PRINT("%s: RX pkt_size = %d\n", __FUNCTION__, pkt_size);
++
++ {// -----------------------------------------------------
++ rx_skb = priv->Rx_skbuff[cur_rx];
++ n_skb = R1000_ALLOC_RXSKB(MAX_RX_SKBDATA_SIZE);
++ if( n_skb != NULL ) {
++ skb_reserve (n_skb, 8); // 16 byte align the IP fields. //
++
++ // Indicate rx_skb
++ if( rx_skb != NULL ){
++ rx_skb->dev = netdev;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
++ pci_dma_sync_single(pdev, priv->rx_skbuff_dma_addr[cur_rx], sizeof(struct RxDesc), PCI_DMA_FROMDEVICE);
++#endif
++
++ skb_put ( rx_skb, pkt_size );
++ rx_skb->protocol = eth_type_trans ( rx_skb, netdev );
++ ret = R1000_NETIF_RX (rx_skb);
++
++// netdev->last_rx = jiffies;
++ priv->stats.rx_bytes += pkt_size;
++ priv->stats.rx_packets++;
++
++ }//end if( rx_skb != NULL )
++
++ priv->Rx_skbuff[cur_rx] = n_skb;
++ }
++ else{
++ DBG_PRINT("%s: Allocate n_skb failed!\n",__FUNCTION__ );
++ priv->Rx_skbuff[cur_rx] = rx_skb;
++ }
++
++
++ // Update rx descriptor
++ if( cur_rx == (NUM_RX_DESC-1) ){
++ priv->RxDescArray[cur_rx].status = cpu_to_le32((OWNbit | EORbit) | (unsigned long)priv->hw_rx_pkt_len);
++ }
++ else{
++ priv->RxDescArray[cur_rx].status = cpu_to_le32(OWNbit | (unsigned long)priv->hw_rx_pkt_len);
++ }
++
++ cur_skb = priv->Rx_skbuff[cur_rx];
++
++ if( cur_skb != NULL ){
++ priv->rx_skbuff_dma_addr[cur_rx] = pci_map_single(pdev, cur_skb->data, MAX_RX_SKBDATA_SIZE, PCI_DMA_FROMDEVICE);
++ rxdesc->buf_addr = cpu_to_le32(priv->rx_skbuff_dma_addr[cur_rx]);
++ }
++ else{
++ DBG_PRINT("%s: %s() cur_skb == NULL\n", netdev->name, __FUNCTION__);
++ }
++
++ }//------------------------------------------------------------
++
++ }// end of if( priv->RxDescArray[cur_rx].status & RxRES )
++
++ cur_rx = (cur_rx +1) % NUM_RX_DESC;
++ rxdesc = &priv->RxDescArray[cur_rx];
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
++ pci_dma_sync_single(pdev, priv->rxdesc_array_dma_addr[cur_rx], sizeof(struct RxDesc), PCI_DMA_FROMDEVICE);
++#endif
++
++ }// end of while ( (priv->RxDescArray[cur_rx].status & 0x80000000)== 0)
++
++ if( rxdesc_cnt >= max_interrupt_work ){
++ DBG_PRINT("%s: Too much work at Rx interrupt.\n", netdev->name);
++ }
++
++ priv->cur_rx = cur_rx;
++}
++
++/* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
++static void r1000_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
++#else
++static irqreturn_t r1000_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
++#endif
++{
++ struct net_device *netdev = (struct net_device *) dev_instance;
++ struct r1000_private *priv = netdev->priv;
++ unsigned long ioaddr = priv->ioaddr;
++ unsigned int status = 0;
++
++ unsigned int phy_status = 0;
++
++ RTL_W16(IntrMask,0x0000);
++
++ status=RTL_R16(IntrStatus);
++
++ if(status==0xFFFF){
++ RTL_W16(IntrMask,r1000_intr_mask);
++ return IRQ_HANDLED;
++ }
++
++ if((status&r1000_intr_mask)==0)
++ return IRQ_NONE;
++
++#if 0
++ if(status&(RxOK|TxOK|TxErr)){
++#ifdef R1000_BOTTOM_HALVES
++ tasklet_schedule(&priv->r1000_rx_tasklet);
++ tasklet_schedule(&priv->r1000_tx_tasklet);
++#else
++ r1000_rx_interrupt(netdev,priv,ioaddr);
++ r1000_tx_interrupt(netdev,priv,ioaddr);
++#endif //R1000_BOTTOM_HALVES
++ RTL_W16(IntrStatus,RxOK|TxOK|TxErr);
++ }
++#endif
++
++ if(status&RxOK){
++#ifdef R1000_BOTTOM_HALVES
++ tasklet_schedule(&priv->r1000_rx_tasklet);
++#else
++ r1000_rx_interrupt(netdev,priv,ioaddr);
++#endif //R1000_BOTTOM_HALVES
++ RTL_W16(IntrStatus,RxOK);
++ }
++
++ if(status&(TxOK|TxErr)){
++#ifdef R1000_BOTTOM_HALVES
++ tasklet_schedule(&priv->r1000_tx_tasklet);
++#else
++ r1000_tx_interrupt(netdev,priv,ioaddr);
++#endif //R1000_BOTTOM_HALVES
++ RTL_W16(IntrStatus,TxOK|TxErr);
++ }
++
++ if(status&RxErr){
++ RTL_W16(IntrStatus,RxErr);
++ }
++
++ if((status&TxOK)&&(status&TxDescUnavail)){
++ RTL_W8(TxPoll,0x40);
++ RTL_W16(IntrStatus,TxOK|TxDescUnavail);
++ }
++
++ if(status & LinkChg){
++ if(((priv->mcfg==MCFG_METHOD_2)||(priv->mcfg==MCFG_METHOD_3))&&(phy_status&_100Mbps)){
++ phy_status = RTL_R8(PHYstatus);
++
++ if(phy_status & LinkStatus){
++ R1000_WRITE_GMII_REG((unsigned long)ioaddr,0x1f,0x0001);
++ R1000_WRITE_GMII_REG((unsigned long)ioaddr,0x10,0xf01b);
++ R1000_WRITE_GMII_REG((unsigned long)ioaddr,0x1f,0x0000);
++ }else{
++ R1000_WRITE_GMII_REG((unsigned long)ioaddr,0x1f,0x0001);
++ R1000_WRITE_GMII_REG((unsigned long)ioaddr,0x10,0xf41b);
++ R1000_WRITE_GMII_REG((unsigned long)ioaddr,0x1f,0x0000);
++ }
++
++ }
++ RTL_W16(IntrStatus,LinkChg);
++ }
++
++ RTL_W16 ( IntrMask, r1000_intr_mask);
++
++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
++ return IRQ_HANDLED;
++#endif
++
++}
++
++static int r1000_close(struct net_device *netdev)
++{
++ struct r1000_private *priv = netdev->priv;
++ unsigned long ioaddr = priv->ioaddr;
++ int i;
++
++ // -----------------------------------------
++ r1000_delete_timer( &(priv->r1000_timer) );
++
++ netif_stop_queue(netdev);
++
++#ifdef R1000_BOTTOM_HALVES
++ tasklet_kill(&priv->r1000_rx_tasklet);
++ tasklet_kill(&priv->r1000_tx_tasklet);
++#endif //R1000_BOTTOM_HALVES
++
++ spin_lock_irq(&priv->lock);
++
++ /* Stop the chip's Tx and Rx processes. */
++ RTL_W8(ChipCmd,0x00);
++
++ /* Disable interrupts by clearing the interrupt mask. */
++ RTL_W16(IntrMask,0x0000);
++
++ /* Update the error counts. */
++ priv->stats.rx_missed_errors += RTL_R32(RxMissed);
++ RTL_W32(RxMissed,0);
++
++ spin_unlock_irq(&priv->lock);
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
++ synchronize_irq ();
++#else
++ synchronize_irq(netdev->irq);
++#endif
++ free_irq (netdev->irq, netdev);
++
++ r1000_tx_clear (priv);
++
++ //2004-05-11
++ if(priv->txdesc_space != NULL){
++ pci_free_consistent(
++ priv->pci_dev,
++ priv->sizeof_txdesc_space,
++ priv->txdesc_space,
++ priv->txdesc_phy_dma_addr
++ );
++ priv->txdesc_space = NULL;
++ }
++
++ if(priv->rxdesc_space != NULL){
++ pci_free_consistent(
++ priv->pci_dev,
++ priv->sizeof_rxdesc_space,
++ priv->rxdesc_space,
++ priv->rxdesc_phy_dma_addr
++ );
++ priv->rxdesc_space = NULL;
++ }
++
++ priv->TxDescArray = NULL;
++ priv->RxDescArray = NULL;
++
++ {//-----------------------------------------------------------------------------
++ for(i=0;i<NUM_RX_DESC;i++){
++ if( priv->Rx_skbuff[i] != NULL ) {
++ R1000_FREE_RXSKB ( priv->Rx_skbuff[i] );
++ }
++ }
++ }//-----------------------------------------------------------------------------
++
++ DBG_PRINT("%s: %s() alloc_rxskb_cnt = %d\n", netdev->name, __FUNCTION__, alloc_rxskb_cnt );
++
++ return 0;
++}
++
++static unsigned const ethernet_polynomial = 0x04c11db7U;
++static inline u32 ether_crc (int length, unsigned char *data)
++{
++ int crc = -1;
++
++ while (--length >= 0) {
++ unsigned char current_octet = *data++;
++ int bit;
++ for (bit = 0; bit < 8; bit++, current_octet >>= 1)
++ crc = (crc << 1) ^ ((crc < 0) ^ (current_octet & 1) ? ethernet_polynomial : 0);
++ }
++
++ return crc;
++}
++
++static void r1000_set_rx_mode (struct net_device *netdev)
++{
++ struct r1000_private *priv = netdev->priv;
++ unsigned long ioaddr = priv->ioaddr;
++ unsigned long flags;
++ u32 mc_filter[2]; /* Multicast hash filter */
++ int i, rx_mode;
++ u32 tmp=0;
++
++
++ if (netdev->flags & IFF_PROMISC) {
++ /* Unconditionally log net taps. */
++ printk (KERN_NOTICE "%s: Promiscuous mode enabled.\n", netdev->name);
++ rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys | AcceptAllPhys;
++ mc_filter[1] = mc_filter[0] = 0xffffffff;
++ } else if ((netdev->mc_count > multicast_filter_limit) || (netdev->flags & IFF_ALLMULTI)) {
++ /* Too many to filter perfectly -- accept all multicasts. */
++ rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
++ mc_filter[1] = mc_filter[0] = 0xffffffff;
++ } else {
++ struct dev_mc_list *mclist;
++ rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
++ mc_filter[1] = mc_filter[0] = 0;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
++ for (i = 0, mclist = netdev->mc_list; mclist && i < netdev->mc_count; i++, mclist = mclist->next)
++ {
++ set_bit (ether_crc (ETH_ALEN, mclist->dmi_addr) >> 26, mc_filter);
++ }
++#else
++ for (i = 0, mclist = netdev->mc_list; mclist && i < netdev->mc_count; i++, mclist = mclist->next)
++ {
++ int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26;
++
++ mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
++ rx_mode |= AcceptMulticast;
++ }
++#endif
++ }
++
++// spin_lock_irqsave(&priv->lock,flags);
++ spin_lock_irqsave(&priv->rx_lock,flags);
++
++ tmp = r1000_rx_config | rx_mode | (RTL_R32(RxConfig) & rtl_chip_info[priv->chipset].RxConfigMask);
++
++ RTL_W32 ( RxConfig, tmp);
++ if((priv->mcfg==MCFG_METHOD_11)||(priv->mcfg==MCFG_METHOD_12)||
++ (priv->mcfg==MCFG_METHOD_13)||(priv->mcfg==MCFG_METHOD_14)||
++ (priv->mcfg==MCFG_METHOD_15)){
++ RTL_W32 ( MAR0 + 0, 0xFFFFFFFF);
++ RTL_W32 ( MAR0 + 4, 0xFFFFFFFF);
++ }else{
++ RTL_W32 ( MAR0 + 0, mc_filter[0]);
++ RTL_W32 ( MAR0 + 4, mc_filter[1]);
++ }
++
++// spin_unlock_irqrestore(&priv->lock,flags);
++ spin_unlock_irqrestore(&priv->rx_lock,flags);
++
++}//end of r1000_set_rx_mode (struct net_device *netdev)
++
++struct net_device_stats *r1000_get_stats(struct net_device *netdev)
++
++{
++ struct r1000_private *priv = netdev->priv;
++
++ return &priv->stats;
++}
++
++static struct pci_driver r1000_pci_driver = {
++ name: MODULENAME,
++ id_table: r1000_pci_tbl,
++ probe: r1000_init_one,
++ remove: __devexit_p(r1000_remove_one),
++ suspend: NULL,
++ resume: NULL,
++};
++
++static int __init r1000_init_module (void)
++{
++ return pci_module_init (&r1000_pci_driver); // pci_register_driver (drv)
++}
++
++static void __exit r1000_cleanup_module (void)
++{
++ pci_unregister_driver (&r1000_pci_driver);
++}
++
++#ifdef R1000_JUMBO_FRAME_SUPPORT
++static int r1000_change_mtu(struct net_device *netdev, int new_mtu)
++{
++ struct r1000_private *priv = netdev->priv;
++ unsigned long ioaddr = priv->ioaddr;
++
++ if( new_mtu > MAX_JUMBO_FRAME_MTU ){
++ printk("%s: Error -- new_mtu(%d) > MAX_JUMBO_FRAME_MTU(%d).\n", netdev->name, new_mtu, MAX_JUMBO_FRAME_MTU);
++ return -1;
++ }
++
++ netdev->mtu = new_mtu;
++
++ priv->curr_mtu_size = new_mtu;
++ priv->tx_pkt_len = new_mtu + ETH_HDR_LEN;
++ priv->rx_pkt_len = new_mtu + ETH_HDR_LEN;
++ priv->hw_rx_pkt_len = priv->rx_pkt_len + 8;
++
++ RTL_W8 ( Cfg9346, Cfg9346_Unlock);
++ RTL_W16 ( RxMaxSize, (unsigned short)priv->hw_rx_pkt_len );
++ RTL_W8 ( Cfg9346, Cfg9346_Lock);
++
++ DBG_PRINT("-------------------------- \n");
++ DBG_PRINT("netdev->mtu = %d \n", netdev->mtu);
++ DBG_PRINT("priv->curr_mtu_size = %d \n", priv->curr_mtu_size);
++ DBG_PRINT("priv->rx_pkt_len = %d \n", priv->rx_pkt_len);
++ DBG_PRINT("priv->tx_pkt_len = %d \n", priv->tx_pkt_len);
++ DBG_PRINT("RTL_W16( RxMaxSize, %d )\n", priv->hw_rx_pkt_len);
++ DBG_PRINT("-------------------------- \n");
++
++ r1000_close(netdev);
++ r1000_open(netdev);
++
++ return 0;
++}
++#endif //end #ifdef R1000_JUMBO_FRAME_SUPPORT
++
++module_init(r1000_init_module);
++module_exit(r1000_cleanup_module);
diff --git a/packages/linux/linux-turbostation/002_qnap-pic.diff b/packages/linux/linux-turbostation/002_qnap-pic.diff
new file mode 100644
index 0000000000..ce7324088a
--- /dev/null
+++ b/packages/linux/linux-turbostation/002_qnap-pic.diff
@@ -0,0 +1,407 @@
+Index: linux-2.6.19/arch/ppc/platforms/qnap_pic.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.19/arch/ppc/platforms/qnap_pic.c 2007-02-25 06:06:59.000000000 +0100
+@@ -0,0 +1,286 @@
++#include <linux/module.h>
++#include <linux/poll.h>
++#include <linux/miscdevice.h>
++#include <linux/serial_core.h>
++#include <linux/serial_reg.h>
++#include <asm/serial.h>
++#include <asm/io.h>
++
++#include "qnap_pic.h"
++#include "qnap_pic_user.h"
++
++static wait_queue_head_t pic_wait;
++static wait_queue_head_t queue_empty_wait;
++static int use_int = 0;
++static int tx_begin = 0, tx_end = 0, rx_begin = 0, rx_end = 0;
++static unsigned char *tx_buf = NULL;
++static unsigned char rx_buf[QUEUE_BUFSIZE];
++static int usage = 0;
++int usb_button_enabled = 1;
++
++static struct qnap_pic_event pic_event[QNAP_PIC_TOTAL_EVENT];
++
++static unsigned char qnap_pic_inb(unsigned long addr)
++{
++ return readb((void __iomem *)addr);
++}
++
++static void qnap_pic_outb(unsigned long addr, unsigned char val)
++{
++ writeb(val, (void __iomem *)addr);
++}
++
++static irqreturn_t qnap_pic_isr(int irq, void *dev_id, struct pt_regs *regs)
++{
++ unsigned char int_id;
++ unsigned char data;
++ int i, need_wakeup;
++
++ need_wakeup = 0;
++ for (i = 0 ; i < 10 ; i++) {
++ int_id = (qnap_pic_inb(SANDPOINT_SERIAL_1 + UART_IIR) & 0x0f);
++ if (int_id & 0x01)
++ break;
++ int_id >>= 1;
++ switch (int_id) {
++ case 3:
++ qnap_pic_inb(SANDPOINT_SERIAL_1 + UART_LSR);
++ break;
++
++ case 2:
++ case 6:
++ while (qnap_pic_inb(SANDPOINT_SERIAL_1 + UART_LSR) & UART_LSR_DR) {
++ data = qnap_pic_inb(SANDPOINT_SERIAL_1 + UART_RX);
++ if((data == 0x72) ||
++ (data == QNAP_PIC_USB_COPY_BUTTON && !usb_button_enabled))
++ continue; // Skip it
++
++ if (((rx_end + 1) % QUEUE_BUFSIZE) != rx_begin) {
++ rx_buf[rx_end] = data;
++ //printk("qnap pic: get byte 0x%x\n", rx_buf[rx_end]);
++ rx_end = ((rx_end + 1) % QUEUE_BUFSIZE);
++ }
++ need_wakeup = 1;
++ }
++ //need_wakeup = 1;
++ break;
++ }
++ }
++ if (i == 10)
++ printk("qnap pic: Reach maximal count of pending interrupts.\n");
++ if (need_wakeup)
++ wake_up_interruptible(&pic_wait);
++ return IRQ_HANDLED;
++}
++
++int send_message_to_app(unsigned char message)
++{
++ if (((rx_end + 1) % QUEUE_BUFSIZE) != rx_begin) {
++ rx_buf[rx_end] = message;
++ //printk("qnap pic: get byte 0x%x\n", rx_buf[rx_end]);
++ rx_end = ((rx_end + 1) % QUEUE_BUFSIZE);
++ }
++
++ wake_up_interruptible(&pic_wait);
++
++ return 0;
++}
++
++void __init qnap_pic_init(void)
++{
++ unsigned char dcr;
++
++ /* enable UART2 */
++ dcr = qnap_pic_inb(SANDPOINT_SERIAL_1 + UART_DCR);
++ dcr |= 0x01;
++ qnap_pic_outb(SANDPOINT_SERIAL_1 + UART_DCR, dcr);
++ /* Access baud rate */
++ qnap_pic_outb(SANDPOINT_SERIAL_1 + UART_LCR, UART_LCR_DLAB);
++ /* Input clock. */
++#ifdef CONFIG_QNAP_UART_CLK_100
++ qnap_pic_outb(SANDPOINT_SERIAL_1 + UART_DLL, (325/*(BASE_BAUD / SERIAL_BAUD)*/ & 0xFF));
++ qnap_pic_outb(SANDPOINT_SERIAL_1 + UART_DLM, (325/*(BASE_BAUD / SERIAL_BAUD)*/ >> 8));
++#else
++ qnap_pic_outb(SANDPOINT_SERIAL_1 + UART_DLL, (435/*(BASE_BAUD / SERIAL_BAUD)*/ & 0xFF));
++ qnap_pic_outb(SANDPOINT_SERIAL_1 + UART_DLM, (435/*(BASE_BAUD / SERIAL_BAUD)*/ >> 8));
++#endif
++ /* 8 data, 1 stop, no parity */
++ qnap_pic_outb(SANDPOINT_SERIAL_1 + UART_LCR, 0x03);
++}
++
++static int pic_open(struct inode *inode, struct file *fp)
++{
++ int result;
++
++ if (usage == 0) {
++ if ((result = request_irq(SANDPOINT_SERIAL_1_INT, qnap_pic_isr, SA_INTERRUPT, "qnap-pic", NULL)) < 0) {
++ printk("qnap pic - failed to attach interrupt\n");
++ return result;
++ }
++ tx_buf = (unsigned char*)kmalloc(QUEUE_BUFSIZE, GFP_KERNEL);
++ if (tx_buf == NULL) {
++ free_irq(SANDPOINT_SERIAL_1_INT, NULL);
++ return -ENOMEM;
++ }
++ use_int = 1;
++ qnap_pic_outb(SANDPOINT_SERIAL_1 + UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_XMIT | UART_FCR_CLEAR_RCVR | UART_FCR_TRIGGER_14);
++ qnap_pic_outb(SANDPOINT_SERIAL_1 + UART_IER, UART_IER_RDI);
++ }
++ usage++;
++ return 0;
++}
++
++static int pic_release(struct inode *inode, struct file *fp)
++{
++ usage--;
++ if (usage == 0) {
++ while (tx_begin != tx_end)
++ interruptible_sleep_on(&queue_empty_wait);
++ qnap_pic_outb(SANDPOINT_SERIAL_1 + UART_IER, 0);
++ qnap_pic_outb(SANDPOINT_SERIAL_1 + UART_FCR, 0);
++ free_irq(SANDPOINT_SERIAL_1_INT, NULL);
++ use_int = 0;
++ if (tx_buf)
++ kfree(tx_buf);
++ }
++ return 0;
++}
++
++static int pic_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
++{
++ int i, bytes;
++ spinlock_t lock = SPIN_LOCK_UNLOCKED;
++ unsigned long flags;
++ struct qnap_pic_ioctl qpi;
++
++ switch (cmd) {
++ case IOCTL_MSG_GET_MESSAGE:
++ memset(&qpi, 0, sizeof(struct qnap_pic_ioctl));
++ while (rx_begin == rx_end) {
++ //printk("PIC without any event\n");
++ interruptible_sleep_on(&pic_wait);
++ if (signal_pending(current))
++ {
++ printk("pic_ioctl: signal_pending current failed\n");
++ return -ERESTARTSYS;
++ }
++ }
++ spin_lock_irqsave(lock, flags);
++ // calculate how many bytes available
++ bytes = ((rx_end + QUEUE_BUFSIZE) - rx_begin) % QUEUE_BUFSIZE;
++ // read data as many as possible
++ for (i = 0 ; i < bytes ; i++) {
++ qpi.pic_data[i] = rx_buf[rx_begin];
++ qpi.count++;
++ rx_begin = (rx_begin + 1) % QUEUE_BUFSIZE;
++ }
++ spin_unlock_irqrestore(lock, flags);
++ return copy_to_user((void *)arg, &qpi, sizeof(struct qnap_pic_ioctl));
++
++ case IOCTL_MSG_SEND_MESSAGE:
++ memset(&qpi, 0, sizeof(struct qnap_pic_ioctl));
++ if (copy_from_user(&qpi, (struct qnap_pic_ioctl *)arg, sizeof(struct qnap_pic_ioctl)))
++ break;
++ for (i = 0; i < QUEUE_BUFSIZE && i < qpi.count; i += 2) {
++ if (qpi.pic_data[i] >= QNAP_PIC_TOTAL_EVENT || qpi.pic_data[i + 1] >= PIC_EVENT_COMMAND_TYPE)
++ continue;
++ switch(qpi.pic_data[i]) {
++ case QNAP_PIC_USB_COPY:
++ if(qpi.pic_data[i+1] == QNAP_PIC_EVENT_ON)
++ usb_button_enabled = 0;
++ else
++ usb_button_enabled = 1;
++ break;
++ }
++ qnap_pic_send_command(pic_event[qpi.pic_data[i]].command[qpi.pic_data[i + 1]], pic_event[qpi.pic_data[i]].count[qpi.pic_data[i + 1]]);
++ }
++ return 0;
++ case IOCTL_MSG_SEND_RAW_COMMAND:
++ memset(&qpi, 0, sizeof(struct qnap_pic_ioctl));
++ if (copy_from_user(&qpi, (struct qnap_pic_ioctl *)arg, sizeof(struct qnap_pic_ioctl)))
++ break;
++ qnap_pic_send_command(qpi.pic_data, qpi.count);
++ return 0;
++ }
++ return -EINVAL;
++}
++
++static struct file_operations pic_fops = {
++ .owner = THIS_MODULE,
++ .ioctl = pic_ioctl,
++ .open = pic_open,
++ .release = pic_release,
++};
++
++static struct miscdevice pic_device = {
++ PIC_MINOR, "pic", &pic_fops
++};
++
++static void __init qnap_pic_event_init(void)
++{
++ memset(pic_event, 0, sizeof(pic_event));
++ pic_event[QNAP_PIC_BOOT_COMPLETE].command[QNAP_PIC_EVENT_ON][0] = QNAP_PIC_STATUS_GREEN_ON;
++ pic_event[QNAP_PIC_BOOT_COMPLETE].command[QNAP_PIC_EVENT_ON][1] = QNAP_PIC_BUZZER_LONG;
++ pic_event[QNAP_PIC_BOOT_COMPLETE].count[QNAP_PIC_EVENT_ON] = 2;
++ pic_event[QNAP_PIC_WRONG_HD_FORMAT].command[QNAP_PIC_EVENT_ON][0] = QNAP_PIC_STATUS_RED_ON;
++ pic_event[QNAP_PIC_WRONG_HD_FORMAT].count[QNAP_PIC_EVENT_ON] = 1;
++ pic_event[QNAP_PIC_WRONG_HD_FORMAT].command[QNAP_PIC_EVENT_OFF][0] = QNAP_PIC_STATUS_GREEN_ON;
++ pic_event[QNAP_PIC_WRONG_HD_FORMAT].count[QNAP_PIC_EVENT_OFF] = 1;
++ pic_event[QNAP_PIC_POWER_OFF].command[QNAP_PIC_EVENT_ON][0] = QNAP_PIC_STATUS_OFF;
++ pic_event[QNAP_PIC_POWER_OFF].command[QNAP_PIC_EVENT_ON][1] = QNAP_PIC_POWER_LED_BLINK;
++ pic_event[QNAP_PIC_POWER_OFF].count[QNAP_PIC_EVENT_ON] = 2;
++ pic_event[QNAP_PIC_HD_STANDBY].command[QNAP_PIC_EVENT_ON][0] = QNAP_PIC_STATUS_GREEN_ON;
++ pic_event[QNAP_PIC_HD_STANDBY].command[QNAP_PIC_EVENT_ON][1] = QNAP_PIC_POWER_LED_BLINK;
++ pic_event[QNAP_PIC_HD_STANDBY].count[QNAP_PIC_EVENT_ON] = 2;
++ pic_event[QNAP_PIC_HD_STANDBY].command[QNAP_PIC_EVENT_OFF][0] = QNAP_PIC_STATUS_GREEN_ON;
++ pic_event[QNAP_PIC_HD_STANDBY].command[QNAP_PIC_EVENT_OFF][1] = QNAP_PIC_POWER_LED_ON;
++ pic_event[QNAP_PIC_HD_STANDBY].count[QNAP_PIC_EVENT_OFF] = 2;
++ pic_event[QNAP_PIC_USB_COPY].command[QNAP_PIC_EVENT_ON][0] = QNAP_PIC_USB_LED_BLINK;
++ pic_event[QNAP_PIC_USB_COPY].count[QNAP_PIC_EVENT_ON] = 1;
++ pic_event[QNAP_PIC_USB_COPY].command[QNAP_PIC_EVENT_OFF][0] = QNAP_PIC_USB_LED_OFF;
++ pic_event[QNAP_PIC_USB_COPY].count[QNAP_PIC_EVENT_OFF] = 1;
++ pic_event[QNAP_PIC_SET_DEFAULT].command[QNAP_PIC_EVENT_ON][0] = QNAP_PIC_BUZZER_SHORT;
++ pic_event[QNAP_PIC_SET_DEFAULT].count[QNAP_PIC_EVENT_ON] = 1;
++ pic_event[QNAP_PIC_POWER_RECOVERY].command[QNAP_PIC_EVENT_ON][0] = QNAP_PIC_ENABLE_POWER_RECOVERY;
++ pic_event[QNAP_PIC_POWER_RECOVERY].count[QNAP_PIC_EVENT_ON] = 1;
++ pic_event[QNAP_PIC_POWER_RECOVERY].command[QNAP_PIC_EVENT_OFF][0] = QNAP_PIC_DISABLE_POWER_RECOVERY;
++ pic_event[QNAP_PIC_POWER_RECOVERY].count[QNAP_PIC_EVENT_OFF] = 1;
++}
++
++static __init int qnap_pic_init2(void)
++{
++ int result;
++
++ result = misc_register(&pic_device);
++ if (result < 0)
++ printk("qnap pic: fail to register misc device\n");
++ else {
++ //printk("qnap pic: suceed to register misc device\n");
++ init_waitqueue_head(&pic_wait);
++ init_waitqueue_head(&queue_empty_wait);
++ qnap_pic_event_init();
++ }
++ return result;
++}
++
++__initcall(qnap_pic_init2);
++
++static void qnap_pic_putc(unsigned char c)
++{
++ while ((qnap_pic_inb(SANDPOINT_SERIAL_1 + UART_LSR) & UART_LSR_THRE) == 0)
++ ;
++ qnap_pic_outb(SANDPOINT_SERIAL_1 + UART_TX, c);
++}
++
++int qnap_pic_send_command(char *data, int count)
++{
++ int i;
++
++ if (data == NULL || count <= 0)
++ return -EINVAL;
++ for (i = 0; i < count; i++)
++ qnap_pic_putc(data[i]);
++ return count;
++}
++EXPORT_SYMBOL(qnap_pic_send_command);
++EXPORT_SYMBOL(send_message_to_app);
+--- linux-2.6.16.vanilla/arch/ppc/platforms/qnap_pic.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.16/arch/ppc/platforms/qnap_pic.h 2007-02-25 05:09:57.000000000 +0100
+@@ -0,0 +1,19 @@
++#ifndef __PPC_PLATFORMS_QNAP_PIC_H
++#define __PPC_PLATFORMS_QNAP_PIC_H
++
++extern void qnap_pic_init(void);
++extern int qnap_pic_send_command(char *data, int count);
++
++#define UART_DSR 0x10
++#define UART_DCR 0x11
++#define SERIAL_BAUD 19200
++
++#define PIC_EVENT_COMMAND_SIZE 8
++#define PIC_EVENT_COMMAND_TYPE 2
++
++struct qnap_pic_event {
++ unsigned char command[PIC_EVENT_COMMAND_TYPE][PIC_EVENT_COMMAND_SIZE];
++ int count[PIC_EVENT_COMMAND_TYPE];
++};
++
++#endif /* __PPC_PLATFORMS_QNAP_PIC_H */
+--- linux-2.6.16.vanilla/arch/ppc/platforms/qnap_pic_user.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.16/arch/ppc/platforms/qnap_pic_user.h 2007-02-25 05:09:57.000000000 +0100
+@@ -0,0 +1,91 @@
++#ifndef __PPC_PLATFORMS_QNAP_PIC_USER_H
++#define __PPC_PLATFORMS_QNAP_PIC_USER_H
++
++#define QUEUE_BUFSIZE 16
++#define PIC_MINOR 80
++#define PIC_DEV "/dev/pic"
++
++struct qnap_pic_ioctl {
++ unsigned char pic_data[QUEUE_BUFSIZE];
++ int count;
++};
++
++#define IOCTL_MSG_MAGIC 'Q'
++#define IOCTL_MSG_GET_MESSAGE _IOR(IOCTL_MSG_MAGIC, 1000, struct qnap_pic_ioctl)
++#define IOCTL_MSG_SEND_MESSAGE _IOW(IOCTL_MSG_MAGIC, 1001, struct qnap_pic_ioctl)
++#define IOCTL_MSG_SEND_RAW_COMMAND _IOW(IOCTL_MSG_MAGIC, 1002, struct qnap_pic_ioctl)
++
++#define QNAP_PIC_BOOT_COMPLETE 0
++#define QNAP_PIC_NO_HD 1
++#define QNAP_PIC_WRONG_HD_FORMAT 2
++#define QNAP_PIC_HD_BAD_BLOCK 3
++#define QNAP_PIC_HD_FULL 4
++#define QNAP_PIC_FIRMWARE_UPDATE 5
++#define QNAP_PIC_POWER_OFF 6
++#define QNAP_PIC_HD_STANDBY 7
++#define QNAP_PIC_USB_COPY 8
++#define QNAP_PIC_SET_DEFAULT 9
++#define QNAP_PIC_POWER_RECOVERY 10
++
++#define QNAP_PIC_TOTAL_EVENT 11
++#define QNAP_PIC_EVENT_OFF 0
++#define QNAP_PIC_EVENT_ON 1
++
++#define QNAP_PIC_POWER_BUTTON 0x40
++#define QNAP_PIC_USB_COPY_BUTTON 0x68
++#define QNAP_PIC_SET_DEFAULT_BUTTON 0x6A
++#define QNAP_PIC_FAN_ENABLE 0x71
++#define QNAP_PIC_FAN_DISABLE 0x72
++#define QNAP_PIC_FAN_ERROR 0x73
++#define QNAP_PIC_FAN_NORMAL 0x74
++#define QNAP_PIC_POWER_RECOVERY_ON 0x79
++#define QNAP_PIC_POWER_RECOVERY_OFF 0x7A
++#define QNAP_NET_NIC_UP 0x81
++#define QNAP_NET_NIC_DOWN 0x82
++
++/*add by KenChen for GIGA Lan up notification 20060329
++#define GIGA 1000
++#define QNAP_GIGA_LAN_UP 0x7C
++#define QNAP_NOT_GIGA_LAN_UP 0x7D
++end here*/
++
++//Ricky added some hotswap command
++#define QNAP_ESATA_UP 0x83
++#define QNAP_ESATA_DOWN 0x84
++#define QNAP_USB_FRONT_UP 0x85
++#define QNAP_USB_FRONT_DOWN 0x86
++#define QNAP_USB_B_UPPER_UP 0x87
++#define QNAP_USB_B_UPPER_DOWN 0x88
++#define QNAP_USB_B_LOWER_UP 0x89
++#define QNAP_USB_B_LOWER_DOWN 0x8A
++#define QNAP_USB_PRINTER_UP 0x8B
++#define QNAP_USB_PRINTER_DOWN 0x8C
++#define QNAP_SATA_UP 0x8D
++#define QNAP_SATA_DOWN 0x8E
++//End
++
++#define MD_REBUILDING 0x91
++#define MD_REBUILDING_DONE 0x92
++#define MD_REBUILDING_SKIP 0x93
++
++#define QNAP_PIC_SOFTWARE_SHUTDOWN 0x41
++#define QNAP_PIC_POWER_RECOVERY_STATUS 0x46
++#define QNAP_PIC_POWER_LED_OFF 0x4B
++#define QNAP_PIC_POWER_LED_BLINK 0x4C
++#define QNAP_PIC_POWER_LED_ON 0x4D
++#define QNAP_PIC_ENABLE_POWER_RECOVERY 0x48
++#define QNAP_PIC_DISABLE_POWER_RECOVERY 0x49
++#define QNAP_PIC_BUZZER_SHORT 0x50
++#define QNAP_PIC_BUZZER_LONG 0x51
++#define QNAP_PIC_STATUS_RED_BLINK 0x54
++#define QNAP_PIC_STATUS_GREEN_BLINK 0x55
++#define QNAP_PIC_STATUS_GREEN_ON 0x56
++#define QNAP_PIC_STATUS_RED_ON 0x57
++#define QNAP_PIC_STATUS_BOTH_BLINK 0x58
++#define QNAP_PIC_STATUS_OFF 0x59
++#define QNAP_PIC_USB_LED_ON 0x60
++#define QNAP_PIC_USB_LED_BLINK 0x61
++#define QNAP_PIC_USB_LED_OFF 0x62
++#define QNAP_PIC_SOFTWARE_REBOOT 0x66
++
++#endif /* __PPC_PLATFORMS_QNAP_PIC_USER_H */
diff --git a/packages/linux/linux-turbostation/2.6.20.1/.mtn2git_empty b/packages/linux/linux-turbostation/2.6.20.1/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/linux/linux-turbostation/2.6.20.1/.mtn2git_empty
diff --git a/packages/linux/linux-turbostation/defconfig b/packages/linux/linux-turbostation/defconfig
new file mode 100644
index 0000000000..f9d91125b3
--- /dev/null
+++ b/packages/linux/linux-turbostation/defconfig
@@ -0,0 +1,1435 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.20.1
+# Wed Feb 28 20:58:12 2007
+#
+CONFIG_MMU=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_ARCH_HAS_ILOG2_U32=y
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_PPC=y
+CONFIG_PPC32=y
+CONFIG_GENERIC_NVRAM=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_GENERIC_BUG=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+
+#
+# Code maturity level options
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+
+#
+# General setup
+#
+CONFIG_LOCALVERSION="-opents"
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+# CONFIG_IPC_NS is not set
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_UTS_NS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_IKCONFIG is not set
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_EMBEDDED=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SHMEM=y
+CONFIG_SLAB=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+# CONFIG_SLOB is not set
+
+#
+# Loadable module support
+#
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_KMOD=y
+
+#
+# Block layer
+#
+CONFIG_BLOCK=y
+CONFIG_LBD=y
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+CONFIG_DEFAULT_AS=y
+# CONFIG_DEFAULT_DEADLINE is not set
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="anticipatory"
+
+#
+# Processor
+#
+CONFIG_6xx=y
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_8xx is not set
+# CONFIG_E200 is not set
+# CONFIG_E500 is not set
+CONFIG_PPC_FPU=y
+# CONFIG_PPC_DCR_NATIVE is not set
+# CONFIG_ALTIVEC is not set
+# CONFIG_TAU is not set
+# CONFIG_KEXEC is not set
+# CONFIG_CPU_FREQ is not set
+# CONFIG_WANT_EARLY_SERIAL is not set
+CONFIG_PPC_GEN550=y
+CONFIG_PPC_STD_MMU=y
+
+#
+# Platform options
+#
+# CONFIG_PPC_PREP is not set
+# CONFIG_APUS is not set
+# CONFIG_KATANA is not set
+# CONFIG_WILLOW is not set
+# CONFIG_CPCI690 is not set
+# CONFIG_POWERPMC250 is not set
+# CONFIG_CHESTNUT is not set
+# CONFIG_SPRUCE is not set
+# CONFIG_HDPU is not set
+# CONFIG_EV64260 is not set
+# CONFIG_LOPEC is not set
+# CONFIG_MVME5100 is not set
+# CONFIG_PPLUS is not set
+# CONFIG_PRPMC750 is not set
+# CONFIG_PRPMC800 is not set
+CONFIG_SANDPOINT=y
+# CONFIG_RADSTONE_PPC7D is not set
+# CONFIG_PAL4 is not set
+# CONFIG_GEMINI is not set
+# CONFIG_EST8260 is not set
+# CONFIG_SBC82xx is not set
+# CONFIG_SBS8260 is not set
+# CONFIG_RPX8260 is not set
+# CONFIG_TQM8260 is not set
+# CONFIG_ADS8272 is not set
+# CONFIG_PQ2FADS is not set
+# CONFIG_LITE5200 is not set
+# CONFIG_MPC834x_SYS is not set
+# CONFIG_EV64360 is not set
+CONFIG_EPIC_SERIAL_MODE=y
+CONFIG_MPC10X_BRIDGE=y
+CONFIG_MPC10X_OPENPIC=y
+# CONFIG_MPC10X_STORE_GATHERING is not set
+# CONFIG_SANDPOINT_ENABLE_UART1 is not set
+# CONFIG_SMP is not set
+# CONFIG_HIGHMEM is not set
+CONFIG_ARCH_POPULATES_NODE_MAP=y
+# CONFIG_HZ_100 is not set
+CONFIG_HZ_250=y
+# CONFIG_HZ_300 is not set
+# CONFIG_HZ_1000 is not set
+CONFIG_HZ=250
+CONFIG_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+# CONFIG_SPARSEMEM_MANUAL is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+# CONFIG_SPARSEMEM_STATIC is not set
+CONFIG_SPLIT_PTLOCK_CPUS=4
+# CONFIG_RESOURCES_64BIT is not set
+CONFIG_BINFMT_ELF=y
+# CONFIG_BINFMT_MISC is not set
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="console=ttyS0,115200n8 root=/dev/ram rtc-rs5c372.probe=0,0x32"
+# CONFIG_PM is not set
+CONFIG_SECCOMP=y
+CONFIG_ISA_DMA_API=y
+
+#
+# Bus options
+#
+CONFIG_GENERIC_ISA_DMA=y
+CONFIG_PPC_I8259=y
+CONFIG_PPC_INDIRECT_PCI=y
+CONFIG_PCI=y
+CONFIG_PCI_DOMAINS=y
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# Advanced setup
+#
+# CONFIG_ADVANCED_OPTIONS is not set
+
+#
+# Default settings for advanced configuration options are used
+#
+CONFIG_HIGHMEM_START=0xfe000000
+CONFIG_LOWMEM_SIZE=0x30000000
+CONFIG_KERNEL_START=0xc0000000
+CONFIG_TASK_SIZE=0x80000000
+CONFIG_BOOT_LOAD=0x00800000
+
+#
+# Networking
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+# CONFIG_NETDEBUG is not set
+CONFIG_PACKET=y
+CONFIG_PACKET_MMAP=y
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_FIB_HASH=y
+# CONFIG_IP_PNP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+# CONFIG_INET_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+CONFIG_INET_DIAG=y
+CONFIG_INET_TCP_DIAG=y
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET6_TUNNEL is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+
+#
+# DCCP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_DCCP is not set
+
+#
+# SCTP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_SCTP is not set
+
+#
+# TIPC Configuration (EXPERIMENTAL)
+#
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+
+#
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_IEEE80211 is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
+# CONFIG_SYS_HYPERVISOR is not set
+
+#
+# Connector - unified userspace <-> kernelspace linker
+#
+# CONFIG_CONNECTOR is not set
+
+#
+# Memory Technology Devices (MTD)
+#
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_CONCAT is not set
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_REDBOOT_PARTS is not set
+CONFIG_MTD_CMDLINE_PARTS=y
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLKDEVS=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+# CONFIG_MTD_CFI_ADV_OPTIONS is not set
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+CONFIG_MTD_CFI_I2=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+# CONFIG_MTD_CFI_INTELEXT is not set
+CONFIG_MTD_CFI_AMDSTD=y
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# CONFIG_MTD_RAM is not set
+CONFIG_MTD_ROM=y
+# CONFIG_MTD_ABSENT is not set
+# CONFIG_MTD_OBSOLETE_CHIPS is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_PHYSMAP_START=0xFF000000
+CONFIG_MTD_PHYSMAP_LEN=0x01000000
+CONFIG_MTD_PHYSMAP_BANKWIDTH=1
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_PMC551 is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+
+#
+# NAND Flash Device Drivers
+#
+# CONFIG_MTD_NAND is not set
+# CONFIG_MTD_NAND_CAFE is not set
+
+#
+# OneNAND Flash Device Drivers
+#
+# CONFIG_MTD_ONENAND is not set
+
+#
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
+# Plug and Play support
+#
+
+#
+# Block devices
+#
+# CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_CPQ_DA is not set
+# CONFIG_BLK_CPQ_CISS_DA is not set
+# CONFIG_BLK_DEV_DAC960 is not set
+# CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=y
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_SX8 is not set
+# CONFIG_BLK_DEV_UB is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=40960
+CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
+CONFIG_BLK_DEV_INITRD=y
+# CONFIG_CDROM_PKTCDVD is not set
+CONFIG_ATA_OVER_ETH=m
+
+#
+# Misc devices
+#
+# CONFIG_SGI_IOC4 is not set
+# CONFIG_TIFM_CORE is not set
+
+#
+# ATA/ATAPI/MFM/RLL support
+#
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+CONFIG_SCSI=y
+# CONFIG_SCSI_TGT is not set
+# CONFIG_SCSI_NETLINK is not set
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=y
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+CONFIG_BLK_DEV_SR=m
+# CONFIG_BLK_DEV_SR_VENDOR is not set
+CONFIG_CHR_DEV_SG=y
+# CONFIG_CHR_DEV_SCH is not set
+
+#
+# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
+#
+CONFIG_SCSI_MULTI_LUN=y
+# CONFIG_SCSI_CONSTANTS is not set
+# CONFIG_SCSI_LOGGING is not set
+# CONFIG_SCSI_SCAN_ASYNC is not set
+
+#
+# SCSI Transports
+#
+# CONFIG_SCSI_SPI_ATTRS is not set
+# CONFIG_SCSI_FC_ATTRS is not set
+CONFIG_SCSI_ISCSI_ATTRS=m
+# CONFIG_SCSI_SAS_ATTRS is not set
+# CONFIG_SCSI_SAS_LIBSAS is not set
+
+#
+# SCSI low-level drivers
+#
+# CONFIG_ISCSI_TCP is not set
+# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_ACARD is not set
+# CONFIG_SCSI_AACRAID is not set
+# CONFIG_SCSI_AIC7XXX is not set
+# CONFIG_SCSI_AIC7XXX_OLD is not set
+# CONFIG_SCSI_AIC79XX is not set
+# CONFIG_SCSI_AIC94XX is not set
+# CONFIG_SCSI_DPT_I2O is not set
+# CONFIG_SCSI_ARCMSR is not set
+# CONFIG_MEGARAID_NEWGEN is not set
+# CONFIG_MEGARAID_LEGACY is not set
+# CONFIG_MEGARAID_SAS is not set
+# CONFIG_SCSI_HPTIOP is not set
+# CONFIG_SCSI_BUSLOGIC is not set
+# CONFIG_SCSI_DMX3191D is not set
+# CONFIG_SCSI_EATA is not set
+# CONFIG_SCSI_FUTURE_DOMAIN is not set
+# CONFIG_SCSI_GDTH is not set
+# CONFIG_SCSI_IPS is not set
+# CONFIG_SCSI_INITIO is not set
+# CONFIG_SCSI_INIA100 is not set
+# CONFIG_SCSI_STEX is not set
+# CONFIG_SCSI_SYM53C8XX_2 is not set
+# CONFIG_SCSI_IPR is not set
+# CONFIG_SCSI_QLOGIC_1280 is not set
+# CONFIG_SCSI_QLA_FC is not set
+# CONFIG_SCSI_QLA_ISCSI is not set
+# CONFIG_SCSI_LPFC is not set
+# CONFIG_SCSI_DC395x is not set
+# CONFIG_SCSI_DC390T is not set
+# CONFIG_SCSI_NSP32 is not set
+# CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_SRP is not set
+
+#
+# Serial ATA (prod) and Parallel ATA (experimental) drivers
+#
+CONFIG_ATA=y
+# CONFIG_ATA_NONSTANDARD is not set
+# CONFIG_SATA_AHCI is not set
+# CONFIG_SATA_SVW is not set
+# CONFIG_ATA_PIIX is not set
+# CONFIG_SATA_MV is not set
+# CONFIG_SATA_NV is not set
+# CONFIG_PDC_ADMA is not set
+# CONFIG_SATA_QSTOR is not set
+# CONFIG_SATA_PROMISE is not set
+# CONFIG_SATA_SX4 is not set
+CONFIG_SATA_SIL=y
+# CONFIG_SATA_SIL24 is not set
+# CONFIG_SATA_SIS is not set
+# CONFIG_SATA_ULI is not set
+# CONFIG_SATA_VIA is not set
+# CONFIG_SATA_VITESSE is not set
+# CONFIG_PATA_ALI is not set
+# CONFIG_PATA_AMD is not set
+# CONFIG_PATA_ARTOP is not set
+# CONFIG_PATA_ATIIXP is not set
+# CONFIG_PATA_CMD64X is not set
+# CONFIG_PATA_CS5520 is not set
+# CONFIG_PATA_CS5530 is not set
+# CONFIG_PATA_CYPRESS is not set
+# CONFIG_PATA_EFAR is not set
+# CONFIG_ATA_GENERIC is not set
+# CONFIG_PATA_HPT366 is not set
+# CONFIG_PATA_HPT37X is not set
+# CONFIG_PATA_HPT3X2N is not set
+# CONFIG_PATA_HPT3X3 is not set
+# CONFIG_PATA_IT821X is not set
+# CONFIG_PATA_JMICRON is not set
+# CONFIG_PATA_TRIFLEX is not set
+# CONFIG_PATA_MARVELL is not set
+# CONFIG_PATA_MPIIX is not set
+# CONFIG_PATA_OLDPIIX is not set
+# CONFIG_PATA_NETCELL is not set
+# CONFIG_PATA_NS87410 is not set
+# CONFIG_PATA_OPTI is not set
+# CONFIG_PATA_OPTIDMA is not set
+# CONFIG_PATA_PDC_OLD is not set
+# CONFIG_PATA_RADISYS is not set
+# CONFIG_PATA_RZ1000 is not set
+# CONFIG_PATA_SC1200 is not set
+# CONFIG_PATA_SERVERWORKS is not set
+# CONFIG_PATA_PDC2027X is not set
+# CONFIG_PATA_SIL680 is not set
+# CONFIG_PATA_SIS is not set
+# CONFIG_PATA_VIA is not set
+# CONFIG_PATA_WINBOND is not set
+# CONFIG_PATA_PLATFORM is not set
+
+#
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
+
+#
+# Fusion MPT device support
+#
+# CONFIG_FUSION is not set
+# CONFIG_FUSION_SPI is not set
+# CONFIG_FUSION_FC is not set
+# CONFIG_FUSION_SAS is not set
+
+#
+# IEEE 1394 (FireWire) support
+#
+# CONFIG_IEEE1394 is not set
+
+#
+# I2O device support
+#
+# CONFIG_I2O is not set
+
+#
+# Macintosh device drivers
+#
+# CONFIG_MAC_EMUMOUSEBTN is not set
+# CONFIG_WINDFARM is not set
+
+#
+# Network device support
+#
+CONFIG_NETDEVICES=y
+CONFIG_DUMMY=y
+# CONFIG_BONDING is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+
+#
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
+# PHY device support
+#
+
+#
+# Ethernet (10 or 100Mbit)
+#
+# CONFIG_NET_ETHERNET is not set
+
+#
+# Ethernet (1000 Mbit)
+#
+# CONFIG_ACENIC is not set
+# CONFIG_DL2K is not set
+CONFIG_E1000=y
+# CONFIG_E1000_NAPI is not set
+# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
+# CONFIG_NS83820 is not set
+# CONFIG_HAMACHI is not set
+# CONFIG_YELLOWFIN is not set
+# CONFIG_R8169 is not set
+CONFIG_R1000=y
+# CONFIG_SIS190 is not set
+# CONFIG_SKGE is not set
+# CONFIG_SKY2 is not set
+# CONFIG_SK98LIN is not set
+# CONFIG_TIGON3 is not set
+# CONFIG_BNX2 is not set
+# CONFIG_QLA3XXX is not set
+
+#
+# Ethernet (10000 Mbit)
+#
+# CONFIG_CHELSIO_T1 is not set
+# CONFIG_IXGB is not set
+# CONFIG_S2IO is not set
+# CONFIG_MYRI10GE is not set
+# CONFIG_NETXEN_NIC is not set
+
+#
+# Token Ring devices
+#
+# CONFIG_TR is not set
+
+#
+# Wireless LAN (non-hamradio)
+#
+# CONFIG_NET_RADIO is not set
+
+#
+# Wan interfaces
+#
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NET_FC is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+
+#
+# ISDN subsystem
+#
+# CONFIG_ISDN is not set
+
+#
+# Telephony Support
+#
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+
+#
+# Userland interfaces
+#
+# CONFIG_INPUT_MOUSEDEV is not set
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_TSDEV is not set
+# CONFIG_INPUT_EVDEV is not set
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+# CONFIG_SERIO_I8042 is not set
+CONFIG_SERIO_SERPORT=y
+# CONFIG_SERIO_PCIPS2 is not set
+# CONFIG_SERIO_LIBPS2 is not set
+# CONFIG_SERIO_RAW is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_PCI=y
+CONFIG_SERIAL_8250_NR_UARTS=1
+CONFIG_SERIAL_8250_RUNTIME_UARTS=1
+# CONFIG_SERIAL_8250_EXTENDED is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_UARTLITE is not set
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+# CONFIG_SERIAL_JSM is not set
+CONFIG_UNIX98_PTYS=y
+# CONFIG_LEGACY_PTYS is not set
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
+
+#
+# Watchdog Cards
+#
+# CONFIG_WATCHDOG is not set
+CONFIG_HW_RANDOM=y
+# CONFIG_NVRAM is not set
+# CONFIG_GEN_RTC is not set
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
+# CONFIG_APPLICOM is not set
+# CONFIG_AGP is not set
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
+
+#
+# TPM devices
+#
+# CONFIG_TCG_TPM is not set
+
+#
+# I2C support
+#
+CONFIG_I2C=y
+# CONFIG_I2C_CHARDEV is not set
+
+#
+# I2C Algorithms
+#
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
+
+#
+# I2C Hardware Bus support
+#
+# CONFIG_I2C_ALI1535 is not set
+# CONFIG_I2C_ALI1563 is not set
+# CONFIG_I2C_ALI15X3 is not set
+# CONFIG_I2C_AMD756 is not set
+# CONFIG_I2C_AMD8111 is not set
+# CONFIG_I2C_I801 is not set
+# CONFIG_I2C_I810 is not set
+# CONFIG_I2C_PIIX4 is not set
+CONFIG_I2C_MPC=y
+# CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_PROSAVAGE is not set
+# CONFIG_I2C_SAVAGE4 is not set
+# CONFIG_I2C_SIS5595 is not set
+# CONFIG_I2C_SIS630 is not set
+# CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_VIA is not set
+# CONFIG_I2C_VIAPRO is not set
+# CONFIG_I2C_VOODOO3 is not set
+# CONFIG_I2C_PCA_ISA is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_SENSORS_DS1337 is not set
+# CONFIG_SENSORS_DS1374 is not set
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCA9539 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_M41T00 is not set
+# CONFIG_SENSORS_MAX6875 is not set
+# CONFIG_SENSORS_S35390A is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
+
+#
+# SPI support
+#
+# CONFIG_SPI is not set
+# CONFIG_SPI_MASTER is not set
+
+#
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
+#
+# Hardware Monitoring support
+#
+CONFIG_HWMON=y
+# CONFIG_HWMON_VID is not set
+# CONFIG_SENSORS_ABITUGURU is not set
+# CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1031 is not set
+# CONFIG_SENSORS_ADM9240 is not set
+# CONFIG_SENSORS_ASB100 is not set
+# CONFIG_SENSORS_ATXP1 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_FSCHER is not set
+# CONFIG_SENSORS_FSCPOS is not set
+# CONFIG_SENSORS_GL518SM is not set
+# CONFIG_SENSORS_GL520SM is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM77 is not set
+# CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
+# CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
+# CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_LM92 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_PC87427 is not set
+# CONFIG_SENSORS_SIS5595 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_SMSC47M192 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_VIA686A is not set
+# CONFIG_SENSORS_VT1211 is not set
+# CONFIG_SENSORS_VT8231 is not set
+# CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83791D is not set
+# CONFIG_SENSORS_W83792D is not set
+# CONFIG_SENSORS_W83793 is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83627HF is not set
+# CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+
+#
+# Digital Video Broadcasting Devices
+#
+# CONFIG_DVB is not set
+# CONFIG_USB_DABUSB is not set
+
+#
+# Graphics support
+#
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB is not set
+# CONFIG_FB_IBM_GXT4500 is not set
+
+#
+# Console display driver support
+#
+CONFIG_VGA_CONSOLE=y
+# CONFIG_VGACON_SOFT_SCROLLBACK is not set
+CONFIG_DUMMY_CONSOLE=y
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# HID Devices
+#
+CONFIG_HID=y
+
+#
+# USB support
+#
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+CONFIG_USB_ARCH_HAS_EHCI=y
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+
+#
+# Miscellaneous USB options
+#
+CONFIG_USB_DEVICEFS=y
+# CONFIG_USB_BANDWIDTH is not set
+# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_OTG is not set
+
+#
+# USB Host Controller Drivers
+#
+CONFIG_USB_EHCI_HCD=y
+# CONFIG_USB_EHCI_SPLIT_ISO is not set
+# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
+# CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_USB_ISP116X_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_BIG_ENDIAN is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+# CONFIG_USB_UHCI_HCD is not set
+# CONFIG_USB_SL811_HCD is not set
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_ACM is not set
+CONFIG_USB_PRINTER=y
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+#
+
+#
+# may also be needed; see USB_STORAGE Help for more information
+#
+CONFIG_USB_STORAGE=y
+# CONFIG_USB_STORAGE_DEBUG is not set
+# CONFIG_USB_STORAGE_DATAFAB is not set
+# CONFIG_USB_STORAGE_FREECOM is not set
+# CONFIG_USB_STORAGE_DPCM is not set
+# CONFIG_USB_STORAGE_USBAT is not set
+# CONFIG_USB_STORAGE_SDDR09 is not set
+# CONFIG_USB_STORAGE_SDDR55 is not set
+# CONFIG_USB_STORAGE_JUMPSHOT is not set
+# CONFIG_USB_STORAGE_ALAUDA is not set
+# CONFIG_USB_STORAGE_KARMA is not set
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Input Devices
+#
+# CONFIG_USB_HID is not set
+
+#
+# USB HID Boot Protocol drivers
+#
+# CONFIG_USB_KBD is not set
+# CONFIG_USB_MOUSE is not set
+# CONFIG_USB_AIPTEK is not set
+# CONFIG_USB_WACOM is not set
+# CONFIG_USB_ACECAD is not set
+# CONFIG_USB_KBTAB is not set
+# CONFIG_USB_POWERMATE is not set
+# CONFIG_USB_TOUCHSCREEN is not set
+# CONFIG_USB_YEALINK is not set
+# CONFIG_USB_XPAD is not set
+# CONFIG_USB_ATI_REMOTE is not set
+# CONFIG_USB_ATI_REMOTE2 is not set
+# CONFIG_USB_KEYSPAN_REMOTE is not set
+# CONFIG_USB_APPLETOUCH is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MICROTEK is not set
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET_MII is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_USB_MON is not set
+
+#
+# USB port drivers
+#
+
+#
+# USB Serial Converter support
+#
+CONFIG_USB_SERIAL=m
+# CONFIG_USB_SERIAL_GENERIC is not set
+# CONFIG_USB_SERIAL_AIRCABLE is not set
+# CONFIG_USB_SERIAL_AIRPRIME is not set
+# CONFIG_USB_SERIAL_ARK3116 is not set
+# CONFIG_USB_SERIAL_BELKIN is not set
+# CONFIG_USB_SERIAL_WHITEHEAT is not set
+# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
+# CONFIG_USB_SERIAL_CP2101 is not set
+# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
+# CONFIG_USB_SERIAL_EMPEG is not set
+# CONFIG_USB_SERIAL_FTDI_SIO is not set
+# CONFIG_USB_SERIAL_FUNSOFT is not set
+CONFIG_USB_SERIAL_VISOR=m
+# CONFIG_USB_SERIAL_IPAQ is not set
+# CONFIG_USB_SERIAL_IR is not set
+# CONFIG_USB_SERIAL_EDGEPORT is not set
+# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
+# CONFIG_USB_SERIAL_GARMIN is not set
+# CONFIG_USB_SERIAL_IPW is not set
+# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
+# CONFIG_USB_SERIAL_KEYSPAN is not set
+# CONFIG_USB_SERIAL_KLSI is not set
+# CONFIG_USB_SERIAL_KOBIL_SCT is not set
+# CONFIG_USB_SERIAL_MCT_U232 is not set
+# CONFIG_USB_SERIAL_MOS7720 is not set
+# CONFIG_USB_SERIAL_MOS7840 is not set
+# CONFIG_USB_SERIAL_NAVMAN is not set
+# CONFIG_USB_SERIAL_PL2303 is not set
+# CONFIG_USB_SERIAL_HP4X is not set
+# CONFIG_USB_SERIAL_SAFE is not set
+# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
+# CONFIG_USB_SERIAL_TI is not set
+# CONFIG_USB_SERIAL_CYBERJACK is not set
+# CONFIG_USB_SERIAL_XIRCOM is not set
+# CONFIG_USB_SERIAL_OPTION is not set
+# CONFIG_USB_SERIAL_OMNINET is not set
+# CONFIG_USB_SERIAL_DEBUG is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_AUERSWALD is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_PHIDGET is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_SISUSBVGA is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_TEST is not set
+
+#
+# USB DSL modem support
+#
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# LED devices
+#
+# CONFIG_NEW_LEDS is not set
+
+#
+# LED drivers
+#
+
+#
+# LED Triggers
+#
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
+# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
+#
+
+#
+# Real Time Clock
+#
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
+
+#
+# RTC interfaces
+#
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+
+#
+# RTC drivers
+#
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_PCF8583 is not set
+CONFIG_RTC_DRV_RS5C372=y
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_TEST is not set
+# CONFIG_RTC_DRV_V3020 is not set
+
+#
+# DMA Engine support
+#
+# CONFIG_DMA_ENGINE is not set
+
+#
+# DMA Clients
+#
+
+#
+# DMA Devices
+#
+
+#
+# Virtualization
+#
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+CONFIG_EXT2_FS_XATTR=y
+CONFIG_EXT2_FS_POSIX_ACL=y
+# CONFIG_EXT2_FS_SECURITY is not set
+# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_FS_XATTR=y
+CONFIG_EXT3_FS_POSIX_ACL=y
+# CONFIG_EXT3_FS_SECURITY is not set
+# CONFIG_EXT4DEV_FS is not set
+CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+CONFIG_FS_POSIX_ACL=y
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_OCFS2_FS is not set
+# CONFIG_MINIX_FS is not set
+CONFIG_ROMFS_FS=y
+CONFIG_INOTIFY=y
+CONFIG_INOTIFY_USER=y
+CONFIG_QUOTA=y
+CONFIG_QFMT_V1=y
+CONFIG_QFMT_V2=y
+CONFIG_QUOTACTL=y
+CONFIG_DNOTIFY=y
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+CONFIG_ISO9660_FS=m
+CONFIG_JOLIET=y
+# CONFIG_ZISOFS is not set
+CONFIG_UDF_FS=m
+CONFIG_UDF_NLS=y
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=y
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+CONFIG_NTFS_FS=m
+# CONFIG_NTFS_DEBUG is not set
+CONFIG_NTFS_RW=y
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+CONFIG_CONFIGFS_FS=y
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+CONFIG_JFFS2_SUMMARY=y
+CONFIG_JFFS2_FS_XATTR=y
+CONFIG_JFFS2_FS_POSIX_ACL=y
+CONFIG_JFFS2_FS_SECURITY=y
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
+CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_RTIME=y
+# CONFIG_JFFS2_RUBIN is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+
+#
+# Network File Systems
+#
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+# CONFIG_NFS_V3_ACL is not set
+CONFIG_NFS_V4=y
+# CONFIG_NFS_DIRECTIO is not set
+CONFIG_NFSD=y
+CONFIG_NFSD_V3=y
+# CONFIG_NFSD_V3_ACL is not set
+CONFIG_NFSD_V4=y
+CONFIG_NFSD_TCP=y
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_EXPORTFS=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+CONFIG_SUNRPC_GSS=y
+CONFIG_RPCSEC_GSS_KRB5=y
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+CONFIG_SMB_FS=y
+# CONFIG_SMB_NLS_DEFAULT is not set
+CONFIG_CIFS=y
+CONFIG_CIFS_STATS=y
+# CONFIG_CIFS_STATS2 is not set
+# CONFIG_CIFS_WEAK_PW_HASH is not set
+# CONFIG_CIFS_XATTR is not set
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_EXPERIMENTAL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+# CONFIG_9P_FS is not set
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+
+#
+# Native Language Support
+#
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=y
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+# CONFIG_NLS_CODEPAGE_850 is not set
+# CONFIG_NLS_CODEPAGE_852 is not set
+# CONFIG_NLS_CODEPAGE_855 is not set
+# CONFIG_NLS_CODEPAGE_857 is not set
+# CONFIG_NLS_CODEPAGE_860 is not set
+# CONFIG_NLS_CODEPAGE_861 is not set
+# CONFIG_NLS_CODEPAGE_862 is not set
+# CONFIG_NLS_CODEPAGE_863 is not set
+# CONFIG_NLS_CODEPAGE_864 is not set
+# CONFIG_NLS_CODEPAGE_865 is not set
+# CONFIG_NLS_CODEPAGE_866 is not set
+# CONFIG_NLS_CODEPAGE_869 is not set
+CONFIG_NLS_CODEPAGE_936=m
+CONFIG_NLS_CODEPAGE_950=m
+CONFIG_NLS_CODEPAGE_932=m
+CONFIG_NLS_CODEPAGE_949=m
+CONFIG_NLS_CODEPAGE_874=m
+CONFIG_NLS_ISO8859_8=m
+# CONFIG_NLS_CODEPAGE_1250 is not set
+# CONFIG_NLS_CODEPAGE_1251 is not set
+# CONFIG_NLS_ASCII is not set
+CONFIG_NLS_ISO8859_1=y
+# CONFIG_NLS_ISO8859_2 is not set
+# CONFIG_NLS_ISO8859_3 is not set
+# CONFIG_NLS_ISO8859_4 is not set
+# CONFIG_NLS_ISO8859_5 is not set
+# CONFIG_NLS_ISO8859_6 is not set
+# CONFIG_NLS_ISO8859_7 is not set
+# CONFIG_NLS_ISO8859_9 is not set
+# CONFIG_NLS_ISO8859_13 is not set
+# CONFIG_NLS_ISO8859_14 is not set
+CONFIG_NLS_ISO8859_15=y
+CONFIG_NLS_KOI8_R=m
+CONFIG_NLS_KOI8_U=m
+CONFIG_NLS_UTF8=y
+
+#
+# Distributed Lock Manager
+#
+# CONFIG_DLM is not set
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_CRC_CCITT=m
+CONFIG_CRC16=m
+CONFIG_CRC32=y
+CONFIG_LIBCRC32C=m
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_PLIST=y
+CONFIG_IOMAP_COPY=y
+# CONFIG_PROFILING is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_MUST_CHECK=y
+# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_HEADERS_CHECK is not set
+# CONFIG_DEBUG_KERNEL is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_DEBUG_BUGVERBOSE is not set
+# CONFIG_SERIAL_TEXT_DEBUG is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+CONFIG_CRYPTO=y
+CONFIG_CRYPTO_ALGAPI=y
+CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_MANAGER=y
+# CONFIG_CRYPTO_HMAC is not set
+# CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_MD4 is not set
+CONFIG_CRYPTO_MD5=y
+# CONFIG_CRYPTO_SHA1 is not set
+# CONFIG_CRYPTO_SHA256 is not set
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_WP512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_GF128MUL is not set
+CONFIG_CRYPTO_ECB=m
+CONFIG_CRYPTO_CBC=y
+# CONFIG_CRYPTO_LRW is not set
+CONFIG_CRYPTO_DES=y
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_TWOFISH is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_AES is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+# CONFIG_CRYPTO_TEA is not set
+# CONFIG_CRYPTO_ARC4 is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_ANUBIS is not set
+# CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Hardware crypto devices
+#
diff --git a/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_platforms_Makefile b/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_platforms_Makefile
new file mode 100644
index 0000000000..b23155e813
--- /dev/null
+++ b/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_platforms_Makefile
@@ -0,0 +1,13 @@
+Index: linux-2.6.20.1/arch/ppc/platforms/Makefile
+===================================================================
+--- linux-2.6.20.1.orig/arch/ppc/platforms/Makefile 2007-02-20 07:34:32.000000000 +0100
++++ linux-2.6.20.1/arch/ppc/platforms/Makefile 2007-02-28 20:29:10.000000000 +0100
+@@ -24,7 +24,7 @@
+ obj-$(CONFIG_PRPMC750) += prpmc750.o
+ obj-$(CONFIG_PRPMC800) += prpmc800.o
+ obj-$(CONFIG_RADSTONE_PPC7D) += radstone_ppc7d.o
+-obj-$(CONFIG_SANDPOINT) += sandpoint.o
++obj-$(CONFIG_SANDPOINT) += sandpoint.o qnap_pic.o
+ obj-$(CONFIG_SBC82xx) += sbc82xx.o
+ obj-$(CONFIG_SPRUCE) += spruce.o
+ obj-$(CONFIG_LITE5200) += lite5200.o
diff --git a/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_platforms_sandpoint.c b/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_platforms_sandpoint.c
new file mode 100644
index 0000000000..85c270437c
--- /dev/null
+++ b/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_platforms_sandpoint.c
@@ -0,0 +1,293 @@
+Index: linux-2.6.21-rc1/arch/ppc/platforms/sandpoint.c
+===================================================================
+--- linux-2.6.21-rc1.orig/arch/ppc/platforms/sandpoint.c 2007-02-21 05:32:30.000000000 +0100
++++ linux-2.6.21-rc1/arch/ppc/platforms/sandpoint.c 2007-02-27 21:57:46.000000000 +0100
+@@ -91,7 +91,7 @@
+ #include <asm/vga.h>
+ #include <asm/open_pic.h>
+ #include <asm/i8259.h>
+-#include <asm/todc.h>
++//#include <asm/todc.h>
+ #include <asm/bootinfo.h>
+ #include <asm/mpc10x.h>
+ #include <asm/pci-bridge.h>
+@@ -99,6 +99,8 @@
+ #include <asm/ppc_sys.h>
+
+ #include "sandpoint.h"
++#include "qnap_pic.h"
++#include "qnap_pic_user.h"
+
+ /* Set non-zero if an X2 Sandpoint detected. */
+ static int sandpoint_is_x2;
+@@ -106,8 +108,7 @@
+ unsigned char __res[sizeof(bd_t)];
+
+ static void sandpoint_halt(void);
+-static void sandpoint_probe_type(void);
+-
++//static void sandpoint_probe_type(void);
+ /*
+ * Define all of the IRQ senses and polarities. Taken from the
+ * Sandpoint X3 User's manual.
+@@ -121,7 +122,6 @@
+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* 8: IDE (INT C) */
+ (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE) /* 9: IDE (INT D) */
+ };
+-
+ /*
+ * Motorola SPS Sandpoint interrupt routing.
+ */
+@@ -145,7 +145,7 @@
+ const long min_idsel = 11, max_idsel = 16, irqs_per_slot = 4;
+ return PCI_IRQ_TABLE_LOOKUP;
+ }
+-
++#if 0
+ static inline int
+ x2_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
+ {
+@@ -166,7 +166,37 @@
+ const long min_idsel = 11, max_idsel = 16, irqs_per_slot = 4;
+ return PCI_IRQ_TABLE_LOOKUP;
+ }
++#else
++static inline int
++x2_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
++{
++ static char pci_irq_table[][4] =
++ /*
++ * PCI IDSEL/INTPIN->INTLINE
++ * A B C D
++ */
++ {
++ { 0, 0, 0, 0 }, /* IDSEL 11 - unused */
++ { 0, 0, 0, 0 }, /* IDSEL 12 - unused */
++ { 16, 16, 16, 16 }, /* IDSEL 13 - PCI slot 1 */ // Sil3512 chip
++ { 17, 17, 17, 17 }, /* IDSEL 14 - PCI slot 2 */ // NEC USB chip
++ { 18, 18, 18, 18 }, /* IDSEL 15 - PCI slot 3 */ // Intel 82540 chip
++ { 19, 19, 19, 19 }, /* IDSEL 16 - PCI slot 4 */
++ { 0, 0, 0, 0 },
++ { 0, 0, 0, 0 },
++ { 0, 0, 0, 0 },
++ { 0, 0, 0, 0 },
++ { 0, 0, 0, 0 },
++ { 0, 0, 0, 0 },
++ { 0, 0, 0, 0 },
++ { 20, 20, 20, 20 }, /* IDSEL 24 - mini PCI */
++ };
+
++ const long min_idsel = 11, max_idsel = 24, irqs_per_slot = 4;
++ return PCI_IRQ_TABLE_LOOKUP;
++}
++#endif
++#if 0
+ static void __init
+ sandpoint_setup_winbond_83553(struct pci_controller *hose)
+ {
+@@ -226,7 +256,7 @@
+ 0x00ff0011);
+ return;
+ }
+-
++#endif
+ /* On the sandpoint X2, we must avoid sending configuration cycles to
+ * device #12 (IDSEL addr = AD12).
+ */
+@@ -258,7 +288,7 @@
+ MPC10X_MAPB_EUMB_BASE) == 0) {
+
+ /* Do early winbond init, then scan PCI bus */
+- sandpoint_setup_winbond_83553(hose);
++ //sandpoint_setup_winbond_83553(hose);
+ hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
+
+ ppc_md.pcibios_fixup = NULL;
+@@ -280,10 +310,21 @@
+ }
+
+ static void __init
++sandpoint_init2(void)
++{
++ char pic_command[2] = {QNAP_PIC_STATUS_GREEN_BLINK, QNAP_PIC_BUZZER_SHORT};
++
++ /* Setup serial port access */
++ qnap_pic_init();
++ qnap_pic_send_command(pic_command, 2);
++}
++
++static void __init
+ sandpoint_setup_arch(void)
+ {
+ /* Probe for Sandpoint model */
+- sandpoint_probe_type();
++ //sandpoint_probe_type();
++ sandpoint_is_x2 = 1;
+ if (sandpoint_is_x2)
+ epic_serial_mode = 0;
+
+@@ -348,8 +389,9 @@
+ _set_L3CR(0x8f032000);
+ }
+ #endif
++ sandpoint_init2();
+ }
+-
++#if 0
+ #define SANDPOINT_87308_CFG_ADDR 0x15c
+ #define SANDPOINT_87308_CFG_DATA 0x15d
+
+@@ -456,7 +498,7 @@
+ }
+
+ arch_initcall(sandpoint_setup_natl_87308);
+-
++#endif
+ static int __init
+ sandpoint_request_io(void)
+ {
+@@ -481,20 +523,20 @@
+ static void __init
+ sandpoint_init_IRQ(void)
+ {
+- int i;
++// int i;
+
+- OpenPIC_InitSenses = sandpoint_openpic_initsenses;
+- OpenPIC_NumInitSenses = sizeof(sandpoint_openpic_initsenses);
++// OpenPIC_InitSenses = sandpoint_openpic_initsenses;
++// OpenPIC_NumInitSenses = sizeof(sandpoint_openpic_initsenses);
+
+ mpc10x_set_openpic();
+- openpic_hookup_cascade(sandpoint_is_x2 ? 17 : NUM_8259_INTERRUPTS, "82c59 cascade",
+- i8259_irq);
++// openpic_hookup_cascade(sandpoint_is_x2 ? 17 : NUM_8259_INTERRUPTS, "82c59 cascade",
++// i8259_irq);
+
+ /*
+ * The EPIC allows for a read in the range of 0xFEF00000 ->
+ * 0xFEFFFFFF to generate a PCI interrupt-acknowledge transaction.
+ */
+- i8259_init(0xfef00000, 0);
++// i8259_init(0xfef00000, 0);
+ }
+
+ static unsigned long __init
+@@ -518,36 +560,60 @@
+ static void __init
+ sandpoint_map_io(void)
+ {
+- io_block_mapping(0xfe000000, 0xfe000000, 0x02000000, _PAGE_IO);
++ // 2005.08.02, JohnsonCheng
++ //io_block_mapping(0xfe000000, 0xfe000000, 0x02000000, _PAGE_IO);
++ io_block_mapping(0xfc000000, 0xfc000000, 0x04000000, _PAGE_IO);
+ }
+
+-static void
+-sandpoint_restart(char *cmd)
++// mode: 0 - reboot, 1 - poweroff & shutdown
++void sandpoint_real_reset(int mode)
+ {
+- local_irq_disable();
++ char pic_command = 0x0;
+
+- /* Set exception prefix high - to the firmware */
+- _nmask_and_or_msr(0, MSR_IP);
++ local_irq_disable();
++ /* disable and invalidate the L2 cache */
++ _set_L2CR(0);
++ _set_L2CR(0x200000);
++ /* flush and disable L1 I/D cache */
++ __asm__ __volatile__
++ ("\n\
++ mfspr 3,1008 \n\
++ ori 5,5,0xcc00 \n\
++ ori 4,3,0xc00 \n\
++ andc 5,3,5 \n\
++ sync \n\
++ mtspr 1008,4 \n\
++ isync \n\
++ sync \n\
++ mtspr 1008,5 \n\
++ isync \n\
++ sync \n\
++ ");
++ if (mode == 0)
++ pic_command = QNAP_PIC_SOFTWARE_REBOOT;
++ else
++ pic_command = QNAP_PIC_SOFTWARE_SHUTDOWN;
++// qnap_pic_send_command(&pic_command, 1);
++ while (1)
++ qnap_pic_send_command(&pic_command, 1);
++}
+
+- /* Reset system via Port 92 */
+- outb(0x00, 0x92);
+- outb(0x01, 0x92);
+- for(;;); /* Spin until reset happens */
++static void
++sandpoint_restart(char *cmd)
++{
++ sandpoint_real_reset(0);
+ }
+
+ static void
+ sandpoint_power_off(void)
+ {
+- local_irq_disable();
+- for(;;); /* No way to shut power off with software */
+- /* NOTREACHED */
++ sandpoint_real_reset(1);
+ }
+
+ static void
+ sandpoint_halt(void)
+ {
+- sandpoint_power_off();
+- /* NOTREACHED */
++ sandpoint_real_reset(1);
+ }
+
+ static int
+@@ -665,7 +731,18 @@
+ : "=r" (bat3u), "=r" (bat3l));
+ }
+
+-TODC_ALLOC();
++static void __init
++sandpoint_calibrate_decr(void)
++{
++ ulong freq = 33000000;
++
++ //printk("time_init: decrementer frequency = %lu.%.6lu MHz\n", freq/1000000, freq%1000000);
++ tb_ticks_per_jiffy = freq / HZ;
++ tb_to_us = mulhwu_scale_factor(freq, 1000000);
++ return;
++}
++
++//TODC_ALLOC();
+
+ void __init
+ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+@@ -721,14 +798,14 @@
+ ppc_md.find_end_of_memory = sandpoint_find_end_of_memory;
+ ppc_md.setup_io_mappings = sandpoint_map_io;
+
+- TODC_INIT(TODC_TYPE_PC97307, 0x70, 0x00, 0x71, 8);
+- ppc_md.time_init = todc_time_init;
+- ppc_md.set_rtc_time = todc_set_rtc_time;
+- ppc_md.get_rtc_time = todc_get_rtc_time;
+- ppc_md.calibrate_decr = todc_calibrate_decr;
++ //TODC_INIT(TODC_TYPE_PC97307, 0x70, 0x00, 0x71, 8);
++ //ppc_md.time_init = todc_time_init;
++ //ppc_md.set_rtc_time = todc_set_rtc_time;
++ //ppc_md.get_rtc_time = todc_get_rtc_time;
++ ppc_md.calibrate_decr = sandpoint_calibrate_decr;
+
+- ppc_md.nvram_read_val = todc_mc146818_read_val;
+- ppc_md.nvram_write_val = todc_mc146818_write_val;
++ //ppc_md.nvram_read_val = todc_mc146818_read_val;
++ //ppc_md.nvram_write_val = todc_mc146818_write_val;
+
+ #ifdef CONFIG_KGDB
+ ppc_md.kgdb_map_scc = gen550_kgdb_map_scc;
diff --git a/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_platforms_sandpoint.h b/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_platforms_sandpoint.h
new file mode 100644
index 0000000000..52a3fd1313
--- /dev/null
+++ b/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_platforms_sandpoint.h
@@ -0,0 +1,52 @@
+Index: linux-2.6.20.1/arch/ppc/platforms/sandpoint.h
+===================================================================
+--- linux-2.6.20.1.orig/arch/ppc/platforms/sandpoint.h 2007-02-20 07:34:32.000000000 +0100
++++ linux-2.6.20.1/arch/ppc/platforms/sandpoint.h 2007-02-26 03:15:15.000000000 +0100
+@@ -49,29 +49,37 @@
+ /*
+ * Serial defines.
+ */
+-#define SANDPOINT_SERIAL_0 0xfe0003f8
+-#define SANDPOINT_SERIAL_1 0xfe0002f8
++#define SANDPOINT_SERIAL_0 0xfdf04500
++#define SANDPOINT_SERIAL_1 0xfdf04600
+
+-#define RS_TABLE_SIZE 2
++#define RS_TABLE_SIZE 1
+
+ /* Rate for the 1.8432 Mhz clock for the onboard serial chip */
+-#define BASE_BAUD ( 1843200 / 16 )
+-#define UART_CLK 1843200
++#define BASE_BAUD ( 133000000 / 16 )
++#define UART_CLK 133000000
+
+ #ifdef CONFIG_SERIAL_DETECT_IRQ
+-#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ)
++#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ|ASYNC_SKIP_TEST)
+ #else
+-#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF)
++#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)
+ #endif
+
++#define SANDPOINT_SERIAL_0_INT 25 // 4 + EPIC_IRQ_BASE + NUM_8259_INTERRUPTS
++#define SANDPOINT_SERIAL_1_INT 24 // 3 + EPIC_IRQ_BASE + NUM_8259_INTERRUPTS
++#if 0
+ #define STD_SERIAL_PORT_DFNS \
+- { 0, BASE_BAUD, SANDPOINT_SERIAL_0, 4, STD_COM_FLAGS, /* ttyS0 */ \
++ { 0, BASE_BAUD, SANDPOINT_SERIAL_0, SANDPOINT_SERIAL_0_INT, STD_COM_FLAGS, /* ttyS0 */ \
+ iomem_base: (u8 *)SANDPOINT_SERIAL_0, \
+ io_type: SERIAL_IO_MEM }, \
+- { 0, BASE_BAUD, SANDPOINT_SERIAL_1, 3, STD_COM_FLAGS, /* ttyS1 */ \
++ { 0, BASE_BAUD, SANDPOINT_SERIAL_1, SANDPOINT_SERIAL_1_INT, STD_COM_FLAGS, /* ttyS1 */ \
+ iomem_base: (u8 *)SANDPOINT_SERIAL_1, \
+ io_type: SERIAL_IO_MEM },
+-
++#else
++#define STD_SERIAL_PORT_DFNS \
++ { 0, BASE_BAUD, SANDPOINT_SERIAL_0, SANDPOINT_SERIAL_0_INT, STD_COM_FLAGS, /* ttyS0 */ \
++ iomem_base: (u8 *)SANDPOINT_SERIAL_0, \
++ io_type: SERIAL_IO_MEM },
++#endif
+ #define SERIAL_PORT_DFNS \
+ STD_SERIAL_PORT_DFNS
+
diff --git a/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_syslib_Makefile b/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_syslib_Makefile
new file mode 100644
index 0000000000..c3a98b7700
--- /dev/null
+++ b/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_syslib_Makefile
@@ -0,0 +1,13 @@
+Index: linux-2.6.20.1/arch/ppc/syslib/Makefile
+===================================================================
+--- linux-2.6.20.1.orig/arch/ppc/syslib/Makefile 2007-02-20 07:34:32.000000000 +0100
++++ linux-2.6.20.1/arch/ppc/syslib/Makefile 2007-02-28 20:29:17.000000000 +0100
+@@ -66,7 +66,7 @@
+ obj-$(CONFIG_HARRIER) += harrier.o
+ obj-$(CONFIG_PRPMC800) += open_pic.o pci_auto.o
+ obj-$(CONFIG_RADSTONE_PPC7D) += pci_auto.o
+-obj-$(CONFIG_SANDPOINT) += pci_auto.o todc_time.o
++obj-$(CONFIG_SANDPOINT) += pci_auto.o
+ obj-$(CONFIG_SBC82xx) += todc_time.o
+ obj-$(CONFIG_SPRUCE) += cpc700_pic.o pci_auto.o \
+ todc_time.o
diff --git a/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_syslib_mpc10x_common.c b/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_syslib_mpc10x_common.c
new file mode 100644
index 0000000000..296395818e
--- /dev/null
+++ b/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_syslib_mpc10x_common.c
@@ -0,0 +1,19 @@
+Index: linux-2.6.20.1/arch/ppc/syslib/mpc10x_common.c
+===================================================================
+--- linux-2.6.20.1.orig/arch/ppc/syslib/mpc10x_common.c 2007-02-20 07:34:32.000000000 +0100
++++ linux-2.6.20.1/arch/ppc/syslib/mpc10x_common.c 2007-02-26 02:26:51.000000000 +0100
+@@ -645,9 +645,11 @@
+ /* Skip reserved space and map i2c and DMA Ch[01] */
+ openpic_set_sources(EPIC_IRQ_BASE, 3, OpenPIC_Addr + 0x11020);
+ /* Skip reserved space and map Message Unit Interrupt (I2O) */
+- openpic_set_sources(EPIC_IRQ_BASE + 3, 1, OpenPIC_Addr + 0x110C0);
+- /* Skip reserved space and map Serial Interupts */
+- openpic_set_sources(EPIC_IRQ_BASE + 4, 2, OpenPIC_Addr + 0x11120);
++ //openpic_set_sources(EPIC_IRQ_BASE + 3, 1, OpenPIC_Addr + 0x110C0);
++#ifdef CONFIG_SANDPOINT
++ openpic_set_sources(EPIC_IRQ_BASE + 3, 1, OpenPIC_Addr + 0x11140);
++ openpic_set_sources(EPIC_IRQ_BASE + 4, 1, OpenPIC_Addr + 0x11120);
++#endif
+
+ openpic_init(NUM_8259_INTERRUPTS);
+ }
diff --git a/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_syslib_open_pic.c b/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_syslib_open_pic.c
new file mode 100644
index 0000000000..05b2a41e7f
--- /dev/null
+++ b/packages/linux/linux-turbostation/linux-2.6.16_arch_ppc_syslib_open_pic.c
@@ -0,0 +1,14 @@
+Index: linux-2.6.20.1/arch/ppc/syslib/open_pic.c
+===================================================================
+--- linux-2.6.20.1.orig/arch/ppc/syslib/open_pic.c 2007-02-20 07:34:32.000000000 +0100
++++ linux-2.6.20.1/arch/ppc/syslib/open_pic.c 2007-02-26 02:26:56.000000000 +0100
+@@ -318,7 +318,8 @@
+ #ifdef CONFIG_EPIC_SERIAL_MODE
+ /* Have to start from ground zero.
+ */
+- openpic_reset();
++ // 2005.09.06, JohnsonCheng Fixed USB device Oops bug
++ //openpic_reset();
+ #endif
+
+ if (ppc_md.progress) ppc_md.progress("openpic: enter", 0x122);
diff --git a/packages/linux/linux-turbostation/linux-2.6.16_drivers_i2c_chips_Kconfig b/packages/linux/linux-turbostation/linux-2.6.16_drivers_i2c_chips_Kconfig
new file mode 100644
index 0000000000..6cd91368f4
--- /dev/null
+++ b/packages/linux/linux-turbostation/linux-2.6.16_drivers_i2c_chips_Kconfig
@@ -0,0 +1,17 @@
+Index: linux-2.6.20.1/drivers/i2c/chips/Kconfig
+===================================================================
+--- linux-2.6.20.1.orig/drivers/i2c/chips/Kconfig 2007-02-20 07:34:32.000000000 +0100
++++ linux-2.6.20.1/drivers/i2c/chips/Kconfig 2007-02-26 02:27:27.000000000 +0100
+@@ -125,4 +125,12 @@
+ This driver can also be built as a module. If so, the module
+ will be called max6875.
+
++config SENSORS_S35390A
++ tristate "S-35390A RTC chip"
++ depends on I2C && PPC32 && SANDPOINT
++ help
++ If you say yes here you get support for the S-35390A RTC chip/
++
++ This driver can also be built as a module. If so, the module
++ will be called i2c-s3531a
+ endmenu
diff --git a/packages/linux/linux-turbostation/linux-2.6.16_drivers_i2c_chips_Makefile b/packages/linux/linux-turbostation/linux-2.6.16_drivers_i2c_chips_Makefile
new file mode 100644
index 0000000000..3378609724
--- /dev/null
+++ b/packages/linux/linux-turbostation/linux-2.6.16_drivers_i2c_chips_Makefile
@@ -0,0 +1,12 @@
+Index: linux-2.6.20.1/drivers/i2c/chips/Makefile
+===================================================================
+--- linux-2.6.20.1.orig/drivers/i2c/chips/Makefile 2007-02-20 07:34:32.000000000 +0100
++++ linux-2.6.20.1/drivers/i2c/chips/Makefile 2007-02-26 02:27:43.000000000 +0100
+@@ -12,6 +12,7 @@
+ obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o
+ obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o
+ obj-$(CONFIG_TPS65010) += tps65010.o
++obj-$(CONFIG_SENSORS_S35390A) += i2c-s3531a.o
+
+ ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
+ EXTRA_CFLAGS += -DDEBUG
diff --git a/packages/linux/linux-turbostation/linux-2.6.16_drivers_mtd_maps_physmap.c b/packages/linux/linux-turbostation/linux-2.6.16_drivers_mtd_maps_physmap.c
new file mode 100644
index 0000000000..1e59cecc9d
--- /dev/null
+++ b/packages/linux/linux-turbostation/linux-2.6.16_drivers_mtd_maps_physmap.c
@@ -0,0 +1,59 @@
+Index: linux-2.6.20.1/drivers/mtd/maps/physmap.c
+===================================================================
+--- linux-2.6.20.1.orig/drivers/mtd/maps/physmap.c 2007-02-20 07:34:32.000000000 +0100
++++ linux-2.6.20.1/drivers/mtd/maps/physmap.c 2007-02-26 02:05:28.000000000 +0100
+@@ -134,13 +134,53 @@
+ }
+ info->mtd->owner = THIS_MODULE;
+
++static struct mtd_partition TS101_partitions[] = {
++ {
++ .name = "U-Boot",
++ .offset = 0x00F00000,
++ .size = 0x00040000,
++ .mask_flags = MTD_WRITEABLE, /* force read-only */
++ },
++ {
++ .name = "Kernel", /* default kernel image */
++ .offset = 0x00000000,
++ .size = 0x00200000,
++ },
++ {
++ .name = "RootFS1",
++ .offset = 0x00200000,
++ .size = 0x00900000,
++ },
++ {
++ .name = "RootFS2",
++ .offset = 0x00b00000,
++ .size = 0x00300000,
++ },
++ {
++ .name = "Vendor",
++ .offset = 0x00E00000,
++ .size = 0x00100000,
++ },
++ {
++ .name = "U-Boot Config",
++ .offset = 0x00F40000,
++ .size = 0x00020000,
++ },
++ {
++ .name = "NAS Config",
++ .offset = 0x00F60000,
++ .size = 0x000A0000,
++ }
++};
++
++
+ #ifdef CONFIG_MTD_PARTITIONS
+ err = parse_mtd_partitions(info->mtd, part_probe_types, &info->parts, 0);
+ if (err > 0) {
+ add_mtd_partitions(info->mtd, info->parts, err);
+ return 0;
+ }
+-
++ physmap_set_partitions(TS101_partitions, 7);
+ if (physmap_data->nr_parts) {
+ printk(KERN_NOTICE "Using physmap partition information\n");
+ add_mtd_partitions(info->mtd, physmap_data->parts,
diff --git a/packages/linux/linux-turbostation/linux-2.6.16_drivers_net_r8169.c b/packages/linux/linux-turbostation/linux-2.6.16_drivers_net_r8169.c
new file mode 100644
index 0000000000..8ba15e1a84
--- /dev/null
+++ b/packages/linux/linux-turbostation/linux-2.6.16_drivers_net_r8169.c
@@ -0,0 +1,13 @@
+Index: linux-2.6.20.1/drivers/net/r8169.c
+===================================================================
+--- linux-2.6.20.1.orig/drivers/net/r8169.c 2007-02-26 03:33:53.000000000 +0100
++++ linux-2.6.20.1/drivers/net/r8169.c 2007-02-26 03:34:21.000000000 +0100
+@@ -1522,7 +1522,7 @@
+ goto err_out_disable_2;
+
+ /* save power state before pci_enable_device overwrites it */
+- pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
++ pm_cap = 220; // pci_find_capability(pdev, PCI_CAP_ID_PM)
+ if (pm_cap) {
+ u16 pwr_command, acpi_idle_state;
+
diff --git a/packages/linux/linux-turbostation/linux-2.6.16_include_asm-ppc_mpc10x.h b/packages/linux/linux-turbostation/linux-2.6.16_include_asm-ppc_mpc10x.h
new file mode 100644
index 0000000000..0b482aee17
--- /dev/null
+++ b/packages/linux/linux-turbostation/linux-2.6.16_include_asm-ppc_mpc10x.h
@@ -0,0 +1,14 @@
+Index: linux-2.6.20.1/include/asm-ppc/mpc10x.h
+===================================================================
+--- linux-2.6.20.1.orig/include/asm-ppc/mpc10x.h 2007-02-20 07:34:32.000000000 +0100
++++ linux-2.6.20.1/include/asm-ppc/mpc10x.h 2007-02-26 02:28:21.000000000 +0100
+@@ -155,7 +155,8 @@
+ */
+ extern unsigned long ioremap_base;
+ #define MPC10X_MAPA_EUMB_BASE (ioremap_base - MPC10X_EUMB_SIZE)
+-#define MPC10X_MAPB_EUMB_BASE MPC10X_MAPA_EUMB_BASE
++//#define MPC10X_MAPB_EUMB_BASE MPC10X_MAPA_EUMB_BASE
++#define MPC10X_MAPB_EUMB_BASE 0xfdf00000 // 2005.08.02, JohnsonCheng
+
+ enum ppc_sys_devices {
+ MPC10X_IIC1,