Use the mvals array to hold differing values used for
IXGBE_I2C_* symbols.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu at intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h | 63 ++++++++++++++++++++++++++++---------
 1 file changed, 49 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h 
b/drivers/net/ixgbe/base/ixgbe_type.h
index 12ca04b..f1c1645 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -188,20 +188,48 @@ POSSIBILITY OF SUCH DAMAGE.
 #define IXGBE_VPDDIAG1 0x10208

 /* I2CCTL Bit Masks */
-#define IXGBE_I2C_CLK_IN_BY_MAC(_hw)(((_hw)->mac.type) >= ixgbe_mac_X550 ? \
-                                       0x00004000 : 0x00000001)
-#define IXGBE_I2C_CLK_OUT_BY_MAC(_hw)(((_hw)->mac.type) >= ixgbe_mac_X550 ? \
-                                       0x00000200 : 0x00000002)
-#define IXGBE_I2C_DATA_IN_BY_MAC(_hw)(((_hw)->mac.type) >= ixgbe_mac_X550 ? \
-                                       0x00001000 : 0x00000004)
-#define IXGBE_I2C_DATA_OUT_BY_MAC(_hw)(((_hw)->mac.type) >= ixgbe_mac_X550 ? \
-                                       0x00000400 : 0x00000008)
-#define IXGBE_I2C_BB_EN_BY_MAC(hw) ((hw)->mac.type >= ixgbe_mac_X550 ? \
-                                   0x00000100 : 0)
-#define IXGBE_I2C_DATA_OE_N_EN_BY_MAC(hw) ((hw)->mac.type >= ixgbe_mac_X550 ? \
-                                          0x00000800 : 0)
-#define IXGBE_I2C_CLK_OE_N_EN_BY_MAC(hw) ((hw)->mac.type >= ixgbe_mac_X550 ? \
-                                         0x00002000 : 0)
+#define IXGBE_I2C_CLK_IN               0x00000001
+#define IXGBE_I2C_CLK_IN_X540          IXGBE_I2C_CLK_IN
+#define IXGBE_I2C_CLK_IN_X550          0x00004000
+#define IXGBE_I2C_CLK_IN_X550EM_x      IXGBE_I2C_CLK_IN_X550
+#define IXGBE_I2C_CLK_IN_BY_MAC(_hw)   IXGBE_BY_MAC((_hw), I2C_CLK_IN)
+
+#define IXGBE_I2C_CLK_OUT              0x00000002
+#define IXGBE_I2C_CLK_OUT_X540         IXGBE_I2C_CLK_OUT
+#define IXGBE_I2C_CLK_OUT_X550         0x00000200
+#define IXGBE_I2C_CLK_OUT_X550EM_x     IXGBE_I2C_CLK_OUT_X550
+#define IXGBE_I2C_CLK_OUT_BY_MAC(_hw)  IXGBE_BY_MAC((_hw), I2C_CLK_OUT)
+
+#define IXGBE_I2C_DATA_IN              0x00000004
+#define IXGBE_I2C_DATA_IN_X540         IXGBE_I2C_DATA_IN
+#define IXGBE_I2C_DATA_IN_X550         0x00001000
+#define IXGBE_I2C_DATA_IN_X550EM_x     IXGBE_I2C_DATA_IN_X550
+#define IXGBE_I2C_DATA_IN_BY_MAC(_hw)  IXGBE_BY_MAC((_hw), I2C_DATA_IN)
+
+#define IXGBE_I2C_DATA_OUT             0x00000008
+#define IXGBE_I2C_DATA_OUT_X540                IXGBE_I2C_DATA_OUT
+#define IXGBE_I2C_DATA_OUT_X550                0x00000400
+#define IXGBE_I2C_DATA_OUT_X550EM_x    IXGBE_I2C_DATA_OUT_X550
+#define IXGBE_I2C_DATA_OUT_BY_MAC(_hw) IXGBE_BY_MAC((_hw), I2C_DATA_OUT)
+
+#define IXGBE_I2C_DATA_OE_N_EN         0
+#define IXGBE_I2C_DATA_OE_N_EN_X540    IXGBE_I2C_DATA_OE_N_EN
+#define IXGBE_I2C_DATA_OE_N_EN_X550    0x00000800
+#define IXGBE_I2C_DATA_OE_N_EN_X550EM_x        IXGBE_I2C_DATA_OE_N_EN_X550
+#define IXGBE_I2C_DATA_OE_N_EN_BY_MAC(_hw) IXGBE_BY_MAC((_hw), 
I2C_DATA_OE_N_EN)
+
+#define IXGBE_I2C_BB_EN                        0
+#define IXGBE_I2C_BB_EN_X540           IXGBE_I2C_BB_EN
+#define IXGBE_I2C_BB_EN_X550           0x00000100
+#define IXGBE_I2C_BB_EN_X550EM_x       IXGBE_I2C_BB_EN_X550
+
+#define IXGBE_I2C_BB_EN_BY_MAC(_hw)    IXGBE_BY_MAC((_hw), I2C_BB_EN)
+
+#define IXGBE_I2C_CLK_OE_N_EN          0
+#define IXGBE_I2C_CLK_OE_N_EN_X540     IXGBE_I2C_CLK_OE_N_EN
+#define IXGBE_I2C_CLK_OE_N_EN_X550     0x00002000
+#define IXGBE_I2C_CLK_OE_N_EN_X550EM_x IXGBE_I2C_CLK_OE_N_EN_X550
+#define IXGBE_I2C_CLK_OE_N_EN_BY_MAC(_hw) IXGBE_BY_MAC((_hw), I2C_CLK_OE_N_EN)
 #define IXGBE_I2C_CLOCK_STRETCHING_TIMEOUT     500

 #define IXGBE_I2C_THERMAL_SENSOR_ADDR  0xF8
@@ -3255,6 +3283,13 @@ union ixgbe_atr_hash_dword {
 };

 #define IXGBE_MVALS_INIT(m)    \
+       IXGBE_CAT(I2C_CLK_IN, m),       \
+       IXGBE_CAT(I2C_CLK_OUT, m),      \
+       IXGBE_CAT(I2C_DATA_IN, m),      \
+       IXGBE_CAT(I2C_DATA_OUT, m),     \
+       IXGBE_CAT(I2C_DATA_OE_N_EN, m), \
+       IXGBE_CAT(I2C_BB_EN, m),        \
+       IXGBE_CAT(I2C_CLK_OE_N_EN, m),  \
        IXGBE_CAT(I2CCTL, m)

 enum ixgbe_mvals {
-- 
1.9.3

Reply via email to