Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/macppc/dev adjust to dbcool_chipset.
details: https://anonhg.NetBSD.org/src/rev/7d2957597c86
branches: trunk
changeset: 748711:7d2957597c86
user: christos <christos%NetBSD.org@localhost>
date: Mon Nov 02 21:38:07 2009 +0000
description:
adjust to dbcool_chipset.
diffstat:
sys/arch/macppc/dev/dbcool_ki2c.c | 37 ++++++++++++++++++-------------------
1 files changed, 18 insertions(+), 19 deletions(-)
diffs (86 lines):
diff -r 0c17983e6501 -r 7d2957597c86 sys/arch/macppc/dev/dbcool_ki2c.c
--- a/sys/arch/macppc/dev/dbcool_ki2c.c Mon Nov 02 21:37:44 2009 +0000
+++ b/sys/arch/macppc/dev/dbcool_ki2c.c Mon Nov 02 21:38:07 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dbcool_ki2c.c,v 1.4 2009/01/14 03:16:57 ahoka Exp $ */
+/* $NetBSD: dbcool_ki2c.c,v 1.5 2009/11/02 21:38:07 christos Exp $ */
/*-
* Copyright (C) 2005 Michael Lorenz
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbcool_ki2c.c,v 1.4 2009/01/14 03:16:57 ahoka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbcool_ki2c.c,v 1.5 2009/11/02 21:38:07 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -50,8 +50,8 @@
static void dbcool_ki2c_attach(device_t, device_t, void *);
static int dbcool_ki2c_match(device_t, cfdata_t, void *);
-static uint8_t dbcool_ki2c_readreg(struct dbcool_softc *, uint8_t);
-static void dbcool_ki2c_writereg(struct dbcool_softc *, uint8_t, uint8_t);
+static uint8_t dbcool_ki2c_readreg(struct dbcool_chipset *, uint8_t);
+static void dbcool_ki2c_writereg(struct dbcool_chipset *, uint8_t, uint8_t);
CFATTACH_DECL_NEW(dbcool_ki2c, sizeof(struct dbcool_softc),
dbcool_ki2c_match, dbcool_ki2c_attach, NULL, NULL);
@@ -83,18 +83,18 @@
aprint_normal("\n");
aprint_naive("\n");
- sc->sc_tag = ka->ka_tag;
- sc->sc_addr = ka->ka_addr & 0xfe;
- sc->sc_readreg = dbcool_ki2c_readreg;
- sc->sc_writereg = dbcool_ki2c_writereg;
+ sc->sc_dc.dc_tag = ka->ka_tag;
+ sc->sc_dc.dc_addr = ka->ka_addr & 0xfe;
+ sc->sc_dc.dc_readreg = dbcool_ki2c_readreg;
+ sc->sc_dc.dc_writereg = dbcool_ki2c_writereg;
- if (dbcool_chip_ident(sc) < 0) {
+ if (dbcool_chip_ident(&sc->sc_dc) < 0) {
aprint_error_dev(self, "Unrecognized dbCool chip - "
"set-up aborted\n");
return;
}
- ver = sc->sc_readreg(sc, DBCOOL_REVISION_REG);
+ ver = sc->sc_dc.dc_readreg(&sc->sc_dc, DBCOOL_REVISION_REG);
if (sc->sc_chip->flags & DBCFLAG_4BIT_VER)
aprint_normal_dev(self, "%s dBCool(tm) Controller "
@@ -111,23 +111,22 @@
}
static uint8_t
-dbcool_ki2c_readreg(struct dbcool_softc *sc, uint8_t reg)
+dbcool_ki2c_readreg(struct dbcool_chipset *dc, uint8_t reg)
{
uint8_t data = 0;
- iic_acquire_bus(sc->sc_tag, 0);
- iic_exec(sc->sc_tag, I2C_OP_READ, sc->sc_addr, ®, 1,
- &data, 1, 0);
- iic_release_bus(sc->sc_tag, 0);
+ iic_acquire_bus(dc->dc_tag, 0);
+ iic_exec(dc->dc_tag, I2C_OP_READ, dc->dc_addr, ®, 1, &data, 1, 0);
+ iic_release_bus(dc->dc_tag, 0);
return data;
}
static void
-dbcool_ki2c_writereg(struct dbcool_softc *sc, uint8_t reg, uint8_t data)
+dbcool_ki2c_writereg(struct dbcool_chipset *dc, uint8_t reg, uint8_t data)
{
uint8_t mdata[2] = {reg, data};
- iic_acquire_bus(sc->sc_tag, 0);
- iic_exec(sc->sc_tag, I2C_OP_WRITE, sc->sc_addr, &mdata, 2, NULL, 0, 0);
- iic_release_bus(sc->sc_tag, 0);
+ iic_acquire_bus(dc->dc_tag, 0);
+ iic_exec(dc->dc_tag, I2C_OP_WRITE, dc->dc_addr, &mdata, 2, NULL, 0, 0);
+ iic_release_bus(dc->dc_tag, 0);
}
Home |
Main Index |
Thread Index |
Old Index