svn commit: r208106 - projects/ppc64/sys/powerpc/powermac

Nathan Whitehorn nwhitehorn at FreeBSD.org
Fri May 14 22:44:47 UTC 2010


Author: nwhitehorn
Date: Fri May 14 22:44:47 2010
New Revision: 208106
URL: http://svn.freebsd.org/changeset/base/208106

Log:
  Make kiic(4) work on big-endian versions of itself, like the one in the
  U3/U4 northbridge. This uses 4-byte read/writes instead of adding 3 to the
  base address like Linux and OS X do. Hooray bus space!

Modified:
  projects/ppc64/sys/powerpc/powermac/kiic.c

Modified: projects/ppc64/sys/powerpc/powermac/kiic.c
==============================================================================
--- projects/ppc64/sys/powerpc/powermac/kiic.c	Fri May 14 22:39:51 2010	(r208105)
+++ projects/ppc64/sys/powerpc/powermac/kiic.c	Fri May 14 22:44:47 2010	(r208106)
@@ -57,6 +57,7 @@
 #define ADDR	5
 #define SUBADDR	6
 #define DATA	7
+#define REV	8
 
 /* MODE */
 #define I2C_SPEED	0x03	/* Speed mask */
@@ -221,6 +222,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);
 
@@ -230,14 +234,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


More information about the svn-src-projects mailing list