ig4 - Stop I2C controller after checking that it's kind of functional. master
authorImre Vadász <imre@vdsz.com>
Sat, 18 Aug 2018 16:42:55 +0000 (18:42 +0200)
committerImre Vadász <imre@vdsz.com>
Sat, 18 Aug 2018 18:28:43 +0000 (20:28 +0200)
sys/bus/smbus/ichiic/ig4_iic.c

index 67ed273..531cc0a 100644 (file)
@@ -621,7 +621,7 @@ ig4iic_attach(ig4iic_softc_t *sc)
 #endif
 
        /*
-        * Interrupt on STOP detect or receive character ready
+        * Make sure that the I2C controller is at least somewhat functional.
         */
        if (set_controller(sc, 0)) {
                device_printf(sc->dev, "controller error during attach-1\n");
@@ -633,6 +633,11 @@ ig4iic_attach(ig4iic_softc_t *sc)
                error = ENXIO;
                goto done;
        }
+       if (set_controller(sc, 0)) {
+               device_printf(sc->dev, "controller error during attach-3\n");
+               error = ENXIO;
+               goto done;
+       }
 
        lwkt_serialize_enter(&sc->slz);
        error = bus_setup_intr(sc->dev, sc->intr_res, INTR_MPSAFE,