summaryrefslogtreecommitdiff
path: root/sys/arch/loongson
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-04-19 23:44:35 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-04-19 23:44:35 +0000
commitcf090c594cfaaa6d5a7cbca9608197d67edfe222 (patch)
tree99081af0aa71626fbff2005ecab653926b1e6942 /sys/arch/loongson
parent73440fee321f2e0927e1a1d32ffb96c850cd7887 (diff)
In {gpio,gdium}iic_bb_read_bits(), report the state of the SCL bit in addition
to the state of the SDA bit; the MI i2c code is about to depend upon this.
Diffstat (limited to 'sys/arch/loongson')
-rw-r--r--sys/arch/loongson/dev/gdiumiic.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/arch/loongson/dev/gdiumiic.c b/sys/arch/loongson/dev/gdiumiic.c
index 68f1a11a790..eca4599b8f8 100644
--- a/sys/arch/loongson/dev/gdiumiic.c
+++ b/sys/arch/loongson/dev/gdiumiic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gdiumiic.c,v 1.5 2012/10/03 21:44:51 miod Exp $ */
+/* $OpenBSD: gdiumiic.c,v 1.6 2013/04/19 23:44:34 miod Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -330,9 +330,16 @@ u_int32_t
gdiumiic_bb_read_bits(void *cookie)
{
struct gdiumiic_softc *sc = cookie;
+ u_int32_t bits = 0;
- return (gpio_pin_read(sc->sc_gpio, &sc->sc_map,
- GPIOIIC_PIN_SDA) == GPIO_PIN_HIGH ? GPIOIIC_SDA : 0);
+ if (gpio_pin_read(sc->sc_gpio, &sc->sc_map, GPIOIIC_PIN_SDA) ==
+ GPIO_PIN_HIGH)
+ bits |= GPIOIIC_SDA;
+ if (gpio_pin_read(sc->sc_gpio, &sc->sc_map, GPIOIIC_PIN_SCL) ==
+ GPIO_PIN_HIGH)
+ bits |= GPIOIIC_SCL;
+
+ return bits;
}
/*