Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jun 2010 14:28:57 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r209302 - head/sys/powerpc/powermac
Message-ID:  <201006181428.o5IESvDT083121@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Fri Jun 18 14:28:57 2010
New Revision: 209302
URL: http://svn.freebsd.org/changeset/base/209302

Log:
  Add support for the Keywest I2C controller in Apple uninorth northbridges.
  Although the Keywest registers have only 1 byte of content, they are
  secretly 4-byte registers, which became apparent from them moving on the
  big-endian Uninorth version of the controller.

Modified:
  head/sys/powerpc/powermac/kiic.c

Modified: head/sys/powerpc/powermac/kiic.c
==============================================================================
--- head/sys/powerpc/powermac/kiic.c	Fri Jun 18 14:20:54 2010	(r209301)
+++ head/sys/powerpc/powermac/kiic.c	Fri Jun 18 14:28:57 2010	(r209302)
@@ -57,6 +57,7 @@
 #define ADDR	5
 #define SUBADDR	6
 #define DATA	7
+#define REV	8
 
 /* MODE */
 #define I2C_SPEED	0x03	/* Speed mask */
@@ -146,6 +147,7 @@ static driver_t kiic_driver = {
 static devclass_t kiic_devclass;
 
 DRIVER_MODULE(kiic, macio, kiic_driver, kiic_devclass, 0, 0);
+DRIVER_MODULE(kiic, unin, kiic_driver, kiic_devclass, 0, 0);
 
 static int
 kiic_probe(device_t self)
@@ -235,6 +237,9 @@ kiic_attach(device_t self)
 	
 	kiic_writereg(sc, IER, I2C_INT_DATA | I2C_INT_ADDR | I2C_INT_STOP);
 
+	if (bootverbose)
+		device_printf(self, "Revision: %02X\n", kiic_readreg(sc, REV));
+
 	/* Add the IIC bus layer */
 	sc->sc_iicbus = device_add_child(self, "iicbus", -1);
 
@@ -244,14 +249,14 @@ kiic_attach(device_t self)
 static void
 kiic_writereg(struct kiic_softc *sc, u_int reg, u_int val)
 {
-	bus_write_1(sc->sc_reg, sc->sc_regstep * reg, val);
+	bus_write_4(sc->sc_reg, sc->sc_regstep * reg, val);
 	DELAY(10); /* register access delay */
 }
 
 static u_int
 kiic_readreg(struct kiic_softc *sc, u_int reg)
 {
-	return bus_read_1(sc->sc_reg, sc->sc_regstep * reg);
+	return bus_read_4(sc->sc_reg, sc->sc_regstep * reg) & 0xff;
 }
 
 static void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006181428.o5IESvDT083121>