Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/gpio i2c_acquire_bus() should return 0 on success.



details:   https://anonhg.NetBSD.org/src/rev/e78fb5fe855d
branches:  trunk
changeset: 810509:e78fb5fe855d
user:      phx <phx%NetBSD.org@localhost>
date:      Tue Sep 01 19:25:32 2015 +0000

description:
i2c_acquire_bus() should return 0 on success.
Fixed bug in gpioiic_bb_set_bits(), which was introduced with the SDA/SCL-
reverse feature.
Now the driver is confirmed to work. Tested with Raspberry Pi GPIO.

diffstat:

 sys/dev/gpio/gpioiic.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (42 lines):

diff -r f4f3cc719854 -r e78fb5fe855d sys/dev/gpio/gpioiic.c
--- a/sys/dev/gpio/gpioiic.c    Tue Sep 01 16:04:04 2015 +0000
+++ b/sys/dev/gpio/gpioiic.c    Tue Sep 01 19:25:32 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpioiic.c,v 1.6 2012/10/27 17:18:16 chs Exp $ */
+/* $NetBSD: gpioiic.c,v 1.7 2015/09/01 19:25:32 phx Exp $ */
 /*     $OpenBSD: gpioiic.c,v 1.8 2008/11/24 12:12:12 mbalmer Exp $     */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gpioiic.c,v 1.6 2012/10/27 17:18:16 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpioiic.c,v 1.7 2015/09/01 19:25:32 phx Exp $");
 
 /*
  * I2C bus bit-banging through GPIO pins.
@@ -232,10 +232,10 @@
        struct gpioiic_softc *sc = cookie;
 
        if (flags & I2C_F_POLL)
-               return 0;
+               return 1;
 
        rw_enter(&sc->sc_i2c_lock, RW_WRITER);
-       return 1;
+       return 0;
 }
 
 void
@@ -286,8 +286,8 @@
 
        gpio_pin_write(sc->sc_gpio, &sc->sc_map, sc->sc_pin_sda,
            bits & GPIOIIC_SDA ? GPIO_PIN_HIGH : GPIO_PIN_LOW);
-       gpio_pin_write(sc->sc_gpio, &sc->sc_map, GPIOIIC_PIN_SCL,
-           bits & GPIOIIC_SCL ? GPIO_PIN_HIGH : sc->sc_pin_scl);
+       gpio_pin_write(sc->sc_gpio, &sc->sc_map, sc->sc_pin_scl,
+           bits & GPIOIIC_SCL ? GPIO_PIN_HIGH : GPIO_PIN_LOW);
 }
 
 void



Home | Main Index | Thread Index | Old Index