diff options
Diffstat (limited to 'sys/arch/macppc/dev')
-rw-r--r-- | sys/arch/macppc/dev/ki2c.c | 9 | ||||
-rw-r--r-- | sys/arch/macppc/dev/maci2c.c | 42 | ||||
-rw-r--r-- | sys/arch/macppc/dev/maci2cvar.h | 7 | ||||
-rw-r--r-- | sys/arch/macppc/dev/pi2c.c | 9 | ||||
-rw-r--r-- | sys/arch/macppc/dev/smu.c | 11 |
5 files changed, 27 insertions, 51 deletions
diff --git a/sys/arch/macppc/dev/ki2c.c b/sys/arch/macppc/dev/ki2c.c index a8a7e118b55..f42eac8cf15 100644 --- a/sys/arch/macppc/dev/ki2c.c +++ b/sys/arch/macppc/dev/ki2c.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ki2c.c,v 1.11 2005/12/13 19:21:45 kettenis Exp $ */ +/* $OpenBSD: ki2c.c,v 1.12 2006/01/01 20:52:25 deraadt Exp $ */ /* $NetBSD: ki2c.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */ /*- @@ -140,7 +140,7 @@ ki2c_attach(struct device *parent, struct device *self, void *aux) void ki2c_attach_bus(struct ki2c_softc *sc, struct ki2c_bus *bus, int node) { - struct maci2cbus_attach_args iba; + struct i2cbus_attach_args iba; u_int32_t reg; if (OF_getprop(node, "reg", ®, sizeof reg) != sizeof reg) @@ -153,8 +153,11 @@ ki2c_attach_bus(struct ki2c_softc *sc, struct ki2c_bus *bus, int node) bus->i2c_tag.ic_exec = ki2c_i2c_exec; bus->reg = reg; - iba.iba_node = node; + bzero(&iba, sizeof iba); + iba.iba_name = "iic"; iba.iba_tag = &bus->i2c_tag; + iba.iba_bus_scan = maciic_scan; + iba.iba_bus_scan_arg = &node; config_found(&sc->sc_dev, &iba, NULL); } diff --git a/sys/arch/macppc/dev/maci2c.c b/sys/arch/macppc/dev/maci2c.c index b3978bd87a8..d94ef65175b 100644 --- a/sys/arch/macppc/dev/maci2c.c +++ b/sys/arch/macppc/dev/maci2c.c @@ -1,4 +1,4 @@ -/* $OpenBSD: maci2c.c,v 1.4 2005/12/27 17:18:18 deraadt Exp $ */ +/* $OpenBSD: maci2c.c,v 1.5 2006/01/01 20:52:25 deraadt Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -25,36 +25,19 @@ #include <arch/macppc/dev/maci2cvar.h> -int maciic_match(struct device *, void *, void *); -void maciic_attach(struct device *, struct device *, void *); int maciic_print(void *, const char *); -struct cfattach maciic_ca = { - sizeof (struct device), maciic_match, maciic_attach -}; - -struct cfdriver maciic_cd = { - NULL, "maciic", DV_DULL -}; - -int -maciic_match(struct device *parent, void *cf, void *aux) -{ - return (1); -} - void -maciic_attach(struct device *parent, struct device *self, void *aux) +maciic_scan(struct device *self, struct i2cbus_attach_args *iba, void *aux) { - struct maci2cbus_attach_args *iba = aux; + int iba_node = *(int *)aux; + extern int iic_print(void *, const char *); struct i2c_attach_args ia; char name[32]; u_int32_t reg; int node; - printf("\n"); - - for (node = OF_child(iba->iba_node); node; node = OF_peer(node)) { + for (node = OF_child(iba_node); node; node = OF_peer(node)) { if (OF_getprop(node, "reg", ®, sizeof reg) != sizeof reg && OF_getprop(node, "i2c-address", ®, sizeof reg) != sizeof reg) continue; @@ -70,19 +53,6 @@ maciic_attach(struct device *parent, struct device *self, void *aux) sizeof name) && name[0]) ia.ia_name = name; if (ia.ia_name) - config_found(self, &ia, maciic_print); + config_found(self, &ia, iic_print); } } - -int -maciic_print(void *aux, const char *pnp) -{ - struct i2c_attach_args *ia = aux; - - if (pnp != NULL) { - printf("\"%s\" at %s", ia->ia_name, pnp); - } - printf(" addr 0x%x", ia->ia_addr); - - return (UNCONF); -} diff --git a/sys/arch/macppc/dev/maci2cvar.h b/sys/arch/macppc/dev/maci2cvar.h index 7dc43716b20..4575b37fa1b 100644 --- a/sys/arch/macppc/dev/maci2cvar.h +++ b/sys/arch/macppc/dev/maci2cvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: maci2cvar.h,v 1.2 2005/11/15 16:23:34 deraadt Exp $ */ +/* $OpenBSD: maci2cvar.h,v 1.3 2006/01/01 20:52:25 deraadt Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -18,7 +18,4 @@ #include <dev/i2c/i2cvar.h> -struct maci2cbus_attach_args { - i2c_tag_t iba_tag; - int iba_node; -}; +void maciic_scan(struct device *sc, struct i2cbus_attach_args *iba, void *aux); diff --git a/sys/arch/macppc/dev/pi2c.c b/sys/arch/macppc/dev/pi2c.c index 7c5c0bf85a4..ff2fa05e895 100644 --- a/sys/arch/macppc/dev/pi2c.c +++ b/sys/arch/macppc/dev/pi2c.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pi2c.c,v 1.4 2005/11/28 23:56:51 deraadt Exp $ */ +/* $OpenBSD: pi2c.c,v 1.5 2006/01/01 20:52:25 deraadt Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -63,7 +63,7 @@ pi2c_attach(struct device *parent, struct device *self, void *aux) { struct pi2c_softc *sc = (struct pi2c_softc *)self; struct confargs *ca = aux; - struct maci2cbus_attach_args iba; + struct i2cbus_attach_args iba; printf("\n"); @@ -74,8 +74,11 @@ pi2c_attach(struct device *parent, struct device *self, void *aux) sc->sc_i2c_tag.ic_release_bus = pi2c_i2c_release_bus; sc->sc_i2c_tag.ic_exec = pi2c_i2c_exec; - iba.iba_node = ca->ca_node; + bzero(&iba, sizeof iba); + iba.iba_name = "iic"; iba.iba_tag = &sc->sc_i2c_tag; + iba.iba_bus_scan = maciic_scan; + iba.iba_bus_scan_arg = &ca->ca_node; config_found(&sc->sc_dev, &iba, NULL); } diff --git a/sys/arch/macppc/dev/smu.c b/sys/arch/macppc/dev/smu.c index d9a0219ccd9..70e7edc67d9 100644 --- a/sys/arch/macppc/dev/smu.c +++ b/sys/arch/macppc/dev/smu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smu.c,v 1.9 2005/12/09 22:55:10 kettenis Exp $ */ +/* $OpenBSD: smu.c,v 1.10 2006/01/01 20:52:25 deraadt Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -175,7 +175,7 @@ smu_attach(struct device *parent, struct device *self, void *aux) { struct smu_softc *sc = (struct smu_softc *)self; struct confargs *ca = aux; - struct maci2cbus_attach_args iba; + struct i2cbus_attach_args iba; struct smu_fan *fan; struct smu_sensor *sensor; int nseg, node; @@ -347,10 +347,13 @@ smu_attach(struct device *parent, struct device *self, void *aux) sc->sc_i2c_tag.ic_exec = smu_i2c_exec; node = OF_getnodebyname(ca->ca_node, "smu-i2c-control"); + node = OF_child(node); - /* XXX */ - iba.iba_node = OF_child(node); + bzero(&iba, sizeof iba); + iba.iba_name = "iic"; iba.iba_tag = &sc->sc_i2c_tag; + iba.iba_bus_scan = maciic_scan; + iba.iba_bus_scan_arg = &node; config_found(&sc->sc_dev, &iba, NULL); } |