This patch adds the i2cbb kernel module parameter, which allows to
expose bit-bagned i2c buses to the operating system. This is necessary
for custom board designs based on igb-supported chips that wish to
make use of the available i2c pins.

Signed-off-by: Jean-Hugues Deschenes <jean-hugues.desche...@octasic.com>
Index: igb-5.2.9.4/src/igb.h
===================================================================
--- igb-5.2.9.4.orig/src/igb.h  2014-11-26 13:50:30.366579837 -0500
+++ igb-5.2.9.4/src/igb.h       2014-11-27 15:03:35.677158956 -0500
@@ -601,6 +601,8 @@
        unsigned int vfs_allocated_count;
        /* Malicious Driver Detection flag. Valid only when SR-IOV is enabled */
        bool mdd;
+       /* Bit-bagned i2c flag. */
+       uint i2cbb;
        int int_mode;
        u32 rss_queues;
        u32 tss_queues;
Index: igb-5.2.9.4/src/igb_main.c
===================================================================
--- igb-5.2.9.4.orig/src/igb_main.c     2014-11-26 13:54:14.167766275 -0500
+++ igb-5.2.9.4/src/igb_main.c  2014-11-27 15:03:28.837158861 -0500
@@ -1725,8 +1725,8 @@
 {
        s32 status = E1000_SUCCESS;
 
-       /* I2C interface supported on i350 devices */
-       if (adapter->hw.mac.type != e1000_i350)
+       /* I2C interface supported on i350 devices (unless forced) */
+       if (adapter->hw.mac.type != e1000_i350 && !adapter->i2cbb)
                return E1000_SUCCESS;
 
        /* Initialize the i2c bus which is controlled by the registers.
@@ -2032,7 +2032,9 @@
 
        igb_init_dmac(adapter, pba);
        /* Re-initialize the thermal sensor on i350 devices. */
-       if (mac->type == e1000_i350 && hw->bus.func == 0) {
+       if (adapter->i2cbb)
+               e1000_set_i2c_bb(hw);
+       else if (mac->type == e1000_i350 && hw->bus.func == 0) {
                /*
                 * If present, re-initialize the external thermal sensor
                 * interface.
Index: igb-5.2.9.4/src/igb_param.c
===================================================================
--- igb-5.2.9.4.orig/src/igb_param.c    2014-11-26 13:50:30.354579988 -0500
+++ igb-5.2.9.4/src/igb_param.c 2014-11-27 15:02:32.545158082 -0500
@@ -178,6 +178,19 @@
 IGB_PARAM(MDD,
        "Malicious Driver Detection (0/1), default 1 = enabled. Only available 
when max_vfs is greater than 0");
 
+#ifdef HAVE_I2C_SUPPORT
+/* I2CBB (Enable bit-bagned i2c bus)
+ *
+ * Always enabled on i350.
+ *
+ * Valid Range: 0, 1
+ *
+ * Default Value:  0
+ */
+IGB_PARAM(I2CBB,
+       "Bit-bagned i2c busses (0/1), default 0 = disabled. Always enabled on 
i350.");
+#endif /* HAVE_I2C_SUPPORT */
+
 #ifdef DEBUG
 
 /* Disable Hardware Reset on Tx Hang
@@ -868,5 +881,29 @@
                }
 #endif
        }
+#ifdef HAVE_I2C_SUPPORT
+       { /* I2CBB - Enable bit-bagned i2c bus support. */
+               struct igb_option opt = {
+                       .type = enable_option,
+                       .name = "Bit-bagned i2c",
+                       .err  = "defaulting to 0",
+                       .def  = OPTION_DISABLED,
+                       .arg  = { .r = { .min = OPTION_DISABLED,
+                                        .max = OPTION_ENABLED } }
+               };
+
+#ifdef module_param_array
+               if (num_I2CBB > bd) {
+#endif
+                       adapter->i2cbb = I2CBB[bd];
+                       igb_validate_option((uint *)&adapter->i2cbb, &opt,
+                                           adapter);
+#ifdef module_param_array
+               } else {
+                       adapter->i2cbb = opt.def;
+               }
+#endif
+       }
+#endif /* HAVE_I2C_SUPPORT */
 }
 


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit 
http://communities.intel.com/community/wired

Reply via email to