Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[safe/jmp/linux-2.6] / drivers / net / gianfar.h
index 1ebf7ac..2cd9433 100644 (file)
@@ -45,8 +45,6 @@
 #include <linux/crc32.h>
 #include <linux/workqueue.h>
 #include <linux/ethtool.h>
-#include <linux/fsl_devices.h>
-#include "gianfar_mii.h"
 
 /* The maximum number of packets to be handled in one call of gfar_poll */
 #define GFAR_DEV_WEIGHT 64
@@ -126,9 +124,12 @@ extern const char gfar_driver_version[];
 #define DEFAULT_RX_COALESCE 0
 #define DEFAULT_RXCOUNT        0
 
-#define MIIMCFG_INIT_VALUE     0x00000007
-#define MIIMCFG_RESET           0x80000000
-#define MIIMIND_BUSY            0x00000001
+#define GFAR_SUPPORTED (SUPPORTED_10baseT_Half \
+               | SUPPORTED_10baseT_Full \
+               | SUPPORTED_100baseT_Half \
+               | SUPPORTED_100baseT_Full \
+               | SUPPORTED_Autoneg \
+               | SUPPORTED_MII)
 
 /* TBI register addresses */
 #define MII_TBICON             0x11
@@ -251,14 +252,14 @@ extern const char gfar_driver_version[];
 #define IEVENT_FIQ             0x00000004
 #define IEVENT_DPE             0x00000002
 #define IEVENT_PERR            0x00000001
-#define IEVENT_RX_MASK          (IEVENT_RXB0 | IEVENT_RXF0)
+#define IEVENT_RX_MASK          (IEVENT_RXB0 | IEVENT_RXF0 | IEVENT_BSY)
 #define IEVENT_TX_MASK          (IEVENT_TXB | IEVENT_TXF)
 #define IEVENT_RTX_MASK         (IEVENT_RX_MASK | IEVENT_TX_MASK)
 #define IEVENT_ERR_MASK         \
 (IEVENT_RXC | IEVENT_BSY | IEVENT_EBERR | IEVENT_MSRO | \
  IEVENT_BABT | IEVENT_TXC | IEVENT_TXE | IEVENT_LC \
  | IEVENT_CRL | IEVENT_XFUN | IEVENT_DPE | IEVENT_PERR \
- | IEVENT_MAG)
+ | IEVENT_MAG | IEVENT_BABR)
 
 #define IMASK_INIT_CLEAR       0x00000000
 #define IMASK_BABR              0x80000000
@@ -311,6 +312,8 @@ extern const char gfar_driver_version[];
 #define ATTRELI_EI_MASK                0x00003fff
 #define ATTRELI_EI(x) (x)
 
+#define BD_LFLAG(flags) ((flags) << 16)
+#define BD_LENGTH_MASK         0x0000ffff
 
 /* TxBD status field bits */
 #define TXBD_READY             0x8000
@@ -372,10 +375,17 @@ extern const char gfar_driver_version[];
 #define RXFCB_PERR_MASK                0x000c
 #define RXFCB_PERR_BADL3       0x0008
 
+#define GFAR_INT_NAME_MAX      IFNAMSIZ + 4
+
 struct txbd8
 {
-       u16     status; /* Status Fields */
-       u16     length; /* Buffer length */
+       union {
+               struct {
+                       u16     status; /* Status Fields */
+                       u16     length; /* Buffer length */
+               };
+               u32 lstatus;
+       };
        u32     bufPtr; /* Buffer Pointer */
 };
 
@@ -390,8 +400,13 @@ struct txfcb {
 
 struct rxbd8
 {
-       u16     status; /* Status Fields */
-       u16     length; /* Buffer Length */
+       union {
+               struct {
+                       u16     status; /* Status Fields */
+                       u16     length; /* Buffer Length */
+               };
+               u32 lstatus;
+       };
        u32     bufPtr; /* Buffer Pointer */
 };
 
@@ -716,12 +731,14 @@ struct gfar_private {
        struct txbd8 *dirty_tx;         /* First buffer in line
                                           to be transmitted */
        unsigned int tx_ring_size;
+       unsigned int num_txbdfree;      /* number of TxBDs free */
 
        /* RX Locked fields */
        spinlock_t rxlock;
 
        struct device_node *node;
-       struct net_device *dev;
+       struct net_device *ndev;
+       struct of_device *ofdev;
        struct napi_struct napi;
 
        /* skb array and index */
@@ -741,6 +758,8 @@ struct gfar_private {
        unsigned int rx_stash_size;
        unsigned int rx_stash_index;
 
+       struct sk_buff_head rx_recycle;
+
        struct vlan_group *vlgrp;
 
        /* Unprotected fields */
@@ -760,7 +779,8 @@ struct gfar_private {
        spinlock_t bflock;
 
        phy_interface_t interface;
-       char    phy_bus_id[BUS_ID_SIZE];
+       struct device_node *phy_node;
+       struct device_node *tbi_node;
        u32 device_flags;
        unsigned char rx_csum_enable:1,
                extended_hash:1,
@@ -774,7 +794,6 @@ struct gfar_private {
 
        /* PHY stuff */
        struct phy_device *phydev;
-       struct phy_device *tbiphy;
        struct mii_bus *mii_bus;
        int oldspeed;
        int oldduplex;
@@ -783,6 +802,11 @@ struct gfar_private {
        uint32_t msg_enable;
 
        struct work_struct reset_task;
+
+       char int_name_tx[GFAR_INT_NAME_MAX];
+       char int_name_rx[GFAR_INT_NAME_MAX];
+       char int_name_er[GFAR_INT_NAME_MAX];
+
        /* Network Statistics */
        struct gfar_extra_stats extra_stats;
 };
@@ -806,8 +830,7 @@ extern void gfar_halt(struct net_device *dev);
 extern void gfar_phy_test(struct mii_bus *bus, struct phy_device *phydev,
                int enable, u32 regnum, u32 read);
 void gfar_init_sysfs(struct net_device *dev);
-int gfar_local_mdio_write(struct gfar_mii __iomem *regs, int mii_id,
-                         int regnum, u16 value);
-int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum);
+
+extern const struct ethtool_ops gfar_ethtool_ops;
 
 #endif /* __GIANFAR_H */