From e641795b86a819da24603ddeda6080b7959b4100 Mon Sep 17 00:00:00 2001 From: christos Date: Mon, 2 Nov 2009 21:38:07 +0000 Subject: [PATCH] adjust to dbcool_chipset. --- sys/arch/macppc/dev/dbcool_ki2c.c | 37 +++++++++++++++---------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/sys/arch/macppc/dev/dbcool_ki2c.c b/sys/arch/macppc/dev/dbcool_ki2c.c index 3b17d52ca154..5fc96bd75661 100644 --- a/sys/arch/macppc/dev/dbcool_ki2c.c +++ b/sys/arch/macppc/dev/dbcool_ki2c.c @@ -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 -__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 #include @@ -50,8 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: dbcool_ki2c.c,v 1.4 2009/01/14 03:16:57 ahoka Exp $" 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 @@ dbcool_ki2c_attach(device_t parent, device_t self, void *aux) 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 @@ dbcool_ki2c_attach(device_t parent, device_t self, void *aux) } 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); }