Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2c On Allwinner A31 you need to set the CONTROL_IFL...
details: https://anonhg.NetBSD.org/src/rev/d80b431dda2c
branches: trunk
changeset: 333951:d80b431dda2c
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Nov 23 13:37:27 2014 +0000
description:
On Allwinner A31 you need to set the CONTROL_IFLG bit to clear it. Add
a "iflg-rwc" property to enable this behaviour.
diffstat:
sys/dev/i2c/gttwsi_core.c | 15 ++++++++++++---
sys/dev/i2c/gttwsivar.h | 4 +++-
2 files changed, 15 insertions(+), 4 deletions(-)
diffs (79 lines):
diff -r f5014e2858cc -r d80b431dda2c sys/dev/i2c/gttwsi_core.c
--- a/sys/dev/i2c/gttwsi_core.c Sun Nov 23 12:23:25 2014 +0000
+++ b/sys/dev/i2c/gttwsi_core.c Sun Nov 23 13:37:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gttwsi_core.c,v 1.1 2013/09/06 00:56:12 matt Exp $ */
+/* $NetBSD: gttwsi_core.c,v 1.2 2014/11/23 13:37:27 jmcneill Exp $ */
/*
* Copyright (c) 2008 Eiji Kawauchi.
* All rights reserved.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gttwsi_core.c,v 1.1 2013/09/06 00:56:12 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gttwsi_core.c,v 1.2 2014/11/23 13:37:27 jmcneill Exp $");
#include "locators.h"
#include <sys/param.h>
@@ -124,6 +124,7 @@
gttwsi_attach_subr(device_t self, bus_space_tag_t iot, bus_space_handle_t ioh)
{
struct gttwsi_softc * const sc = device_private(self);
+ prop_dictionary_t cfg = device_properties(self);
aprint_naive("\n");
aprint_normal(": Marvell TWSI controller\n");
@@ -136,6 +137,8 @@
mutex_init(&sc->sc_mtx, MUTEX_DEFAULT, IPL_BIO);
cv_init(&sc->sc_cv, device_xname(self));
+ prop_dictionary_get_bool(cfg, "iflg-rwc", &sc->sc_iflg_rwc);
+
sc->sc_started = false;
sc->sc_i2c.ic_cookie = sc;
sc->sc_i2c.ic_acquire_bus = gttwsi_acquire_bus;
@@ -223,11 +226,15 @@
{
struct gttwsi_softc *sc = v;
int retry = TWSI_RETRY_COUNT;
+ uint32_t control;
sc->sc_started = false;
/* Interrupt is not generated for STAT_NRS. */
- gttwsi_write_4(sc, TWSI_CONTROL, CONTROL_STOP | CONTROL_TWSIEN);
+ control = CONTROL_STOP | CONTROL_TWSIEN;
+ if (sc->sc_iflg_rwc)
+ control |= CONTROL_IFLG;
+ gttwsi_write_4(sc, TWSI_CONTROL, control);
while (retry > 0) {
if (gttwsi_read_4(sc, TWSI_STATUS) == STAT_NRS)
return 0;
@@ -324,6 +331,8 @@
DELAY(5);
if (!(flags & I2C_F_POLL))
control |= CONTROL_INTEN;
+ if (sc->sc_iflg_rwc)
+ control |= CONTROL_IFLG;
gttwsi_write_4(sc, TWSI_CONTROL, control | CONTROL_TWSIEN);
timo = 0;
diff -r f5014e2858cc -r d80b431dda2c sys/dev/i2c/gttwsivar.h
--- a/sys/dev/i2c/gttwsivar.h Sun Nov 23 12:23:25 2014 +0000
+++ b/sys/dev/i2c/gttwsivar.h Sun Nov 23 13:37:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gttwsivar.h,v 1.1 2013/09/06 00:56:12 matt Exp $ */
+/* $NetBSD: gttwsivar.h,v 1.2 2014/11/23 13:37:27 jmcneill Exp $ */
/*
* Copyright (c) 2008 Eiji Kawauchi.
* All rights reserved.
@@ -87,6 +87,8 @@
kmutex_t sc_buslock;
kmutex_t sc_mtx;
kcondvar_t sc_cv;
+
+ bool sc_iflg_rwc;
};
void gttwsi_attach_subr(device_t, bus_space_tag_t, bus_space_handle_t);
Home |
Main Index |
Thread Index |
Old Index