Module Name: src
Committed By: macallan
Date: Tue Sep 6 06:26:14 UTC 2011
Modified Files:
src/sys/dev/pci: voyager.c voyagervar.h
Log Message:
add a function to mess with gpios which locks against the i2c stuff
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/voyager.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/voyagervar.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/voyager.c
diff -u src/sys/dev/pci/voyager.c:1.3 src/sys/dev/pci/voyager.c:1.4
--- src/sys/dev/pci/voyager.c:1.3 Thu Sep 1 14:04:55 2011
+++ src/sys/dev/pci/voyager.c Tue Sep 6 06:26:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: voyager.c,v 1.3 2011/09/01 14:04:55 macallan Exp $ */
+/* $NetBSD: voyager.c,v 1.4 2011/09/06 06:26:13 macallan Exp $ */
/*
* Copyright (c) 2009, 2011 Michael Lorenz
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: voyager.c,v 1.3 2011/09/01 14:04:55 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voyager.c,v 1.4 2011/09/06 06:26:13 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -162,7 +162,7 @@
reg = bus_space_read_4(sc->sc_memt, sc->sc_regh, SM502_GPIO_DIR0);
reg |= GPIO_I2C_BITS;
bus_space_write_4(sc->sc_memt, sc->sc_regh, SM502_GPIO_DIR0, reg);
-
+
/* Fill in the i2c tag */
sc->sc_i2c.ic_cookie = sc;
sc->sc_i2c.ic_acquire_bus = voyager_i2c_acquire_bus;
@@ -287,3 +287,18 @@
return ret;
}
+/* gpio stuff */
+void
+voyager_write_gpio(void *cookie, uint32_t mask, uint32_t bits)
+{
+ struct voyager_softc *sc = cookie;
+ uint32_t reg;
+
+ /* don't interfere with i2c ops */
+ mutex_enter(&sc->sc_i2c_lock);
+ reg = bus_space_read_4(sc->sc_memt, sc->sc_regh, SM502_GPIO_DATA0);
+ reg &= mask;
+ reg |= bits;
+ bus_space_write_4(sc->sc_memt, sc->sc_regh, SM502_GPIO_DATA0, reg);
+ mutex_exit(&sc->sc_i2c_lock);
+}
Index: src/sys/dev/pci/voyagervar.h
diff -u src/sys/dev/pci/voyagervar.h:1.1 src/sys/dev/pci/voyagervar.h:1.2
--- src/sys/dev/pci/voyagervar.h:1.1 Wed Aug 31 16:47:31 2011
+++ src/sys/dev/pci/voyagervar.h Tue Sep 6 06:26:13 2011
@@ -1,7 +1,7 @@
-/* $NetBSD: voyagervar.h,v 1.1 2011/08/31 16:47:31 macallan Exp $ */
+/* $NetBSD: voyagervar.h,v 1.2 2011/09/06 06:26:13 macallan Exp $ */
/*
- * Copyright (c) 2009 Michael Lorenz
+ * Copyright (c) 2011 Michael Lorenz
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: voyagervar.h,v 1.1 2011/08/31 16:47:31 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voyagervar.h,v 1.2 2011/09/06 06:26:13 macallan Exp $");
#ifndef VOYAGERVAR_H
#define VOYAGERVAR_H
@@ -42,4 +42,6 @@
char vaa_name[32];
};
+void voyager_write_gpio(void *, uint32_t, uint32_t);
+
#endif
\ No newline at end of file