OSDN Git Service

Merge tag 'v4.4.214' into 10
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / drivers / net / ethernet / natsemi / sonic.h
index 07091dd..7dcf913 100644 (file)
 #define SONIC_CR_TXP            0x0002
 #define SONIC_CR_HTX            0x0001
 
+#define SONIC_CR_ALL (SONIC_CR_LCAM | SONIC_CR_RRRA | \
+                     SONIC_CR_RXEN | SONIC_CR_TXP)
+
 /*
  * SONIC data configuration bits
  */
 #define SONIC_NUM_RDS   SONIC_NUM_RRS /* number of receive descriptors */
 #define SONIC_NUM_TDS   16            /* number of transmit descriptors */
 
-#define SONIC_RDS_MASK  (SONIC_NUM_RDS-1)
-#define SONIC_TDS_MASK  (SONIC_NUM_TDS-1)
+#define SONIC_RRS_MASK  (SONIC_NUM_RRS - 1)
+#define SONIC_RDS_MASK  (SONIC_NUM_RDS - 1)
+#define SONIC_TDS_MASK  (SONIC_NUM_TDS - 1)
 
 #define SONIC_RBSIZE   1520          /* size of one resource buffer */
 
@@ -320,6 +324,7 @@ struct sonic_local {
        unsigned int next_tx;          /* next free TD */
        struct device *device;         /* generic device */
        struct net_device_stats stats;
+       spinlock_t lock;
 };
 
 #define TX_TIMEOUT (3 * HZ)
@@ -341,30 +346,30 @@ static void sonic_tx_timeout(struct net_device *dev);
    as far as we can tell. */
 /* OpenBSD calls this "SWO".  I'd like to think that sonic_buf_put()
    is a much better name. */
-static inline void sonic_buf_put(void* base, int bitmode,
+static inline void sonic_buf_put(u16 *base, int bitmode,
                                 int offset, __u16 val)
 {
        if (bitmode)
 #ifdef __BIG_ENDIAN
-               ((__u16 *) base + (offset*2))[1] = val;
+               __raw_writew(val, base + (offset * 2) + 1);
 #else
-               ((__u16 *) base + (offset*2))[0] = val;
+               __raw_writew(val, base + (offset * 2) + 0);
 #endif
        else
-               ((__u16 *) base)[offset] = val;
+               __raw_writew(val, base + (offset * 1) + 0);
 }
 
-static inline __u16 sonic_buf_get(void* base, int bitmode,
+static inline __u16 sonic_buf_get(u16 *base, int bitmode,
                                  int offset)
 {
        if (bitmode)
 #ifdef __BIG_ENDIAN
-               return ((volatile __u16 *) base + (offset*2))[1];
+               return __raw_readw(base + (offset * 2) + 1);
 #else
-               return ((volatile __u16 *) base + (offset*2))[0];
+               return __raw_readw(base + (offset * 2) + 0);
 #endif
        else
-               return ((volatile __u16 *) base)[offset];
+               return __raw_readw(base + (offset * 1) + 0);
 }
 
 /* Inlines that you should actually use for reading/writing DMA buffers */