diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/sparc64/dev/pcfiic_ebus.c | 55 |
1 files changed, 48 insertions, 7 deletions
diff --git a/sys/arch/sparc64/dev/pcfiic_ebus.c b/sys/arch/sparc64/dev/pcfiic_ebus.c index 1a386fc1e12..91690708171 100644 --- a/sys/arch/sparc64/dev/pcfiic_ebus.c +++ b/sys/arch/sparc64/dev/pcfiic_ebus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcfiic_ebus.c,v 1.8 2007/10/20 18:54:42 kettenis Exp $ */ +/* $OpenBSD: pcfiic_ebus.c,v 1.9 2007/10/22 22:39:10 kettenis Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -54,6 +54,7 @@ struct cfattach pcfiic_ebus_ca = { sizeof(struct pcfiic_ebus_softc), pcfiic_ebus_match, pcfiic_ebus_attach }; +void envctrl_scan(struct device *, struct i2cbus_attach_args *, void *); void envctrltwo_scan(struct device *, struct i2cbus_attach_args *, void *); int @@ -62,7 +63,8 @@ pcfiic_ebus_match(struct device *parent, void *match, void *aux) struct ebus_attach_args *ea = aux; char compat[32]; - if (strcmp(ea->ea_name, "SUNW,envctrltwo") == 0) + if (strcmp(ea->ea_name, "SUNW,envctrl") == 0 || + strcmp(ea->ea_name, "SUNW,envctrltwo") == 0) return (1); if (strcmp(ea->ea_name, "i2c") != 0) @@ -94,10 +96,8 @@ pcfiic_ebus_attach(struct device *parent, struct device *self, void *aux) return; } - if (OF_getprop(ea->ea_node, "compatible", compat, sizeof(compat)) == -1) - return; - - if (strcmp(compat, "SUNW,bbc-i2c") == 0) { + if (OF_getprop(ea->ea_node, "compatible", compat, sizeof(compat)) > 0 && + strcmp(compat, "SUNW,bbc-i2c") == 0) { /* * On BBC-based machines, Sun swapped the order of * the registers on their clone pcf, plus they feed @@ -162,7 +162,10 @@ fail: if (esc->esc_ih == NULL) sc->sc_poll = 1; - if (strcmp(ea->ea_name, "SUNW,envctrltwo") == 0) + if (strcmp(ea->ea_name, "SUNW,envctrl") == 0) + pcfiic_attach(sc, 0x55, PCF_CLOCK_12 | PCF_FREQ_45, 0, + envctrl_scan, &ea->ea_node); + else if (strcmp(ea->ea_name, "SUNW,envctrltwo") == 0) pcfiic_attach(sc, 0x55, PCF_CLOCK_12 | PCF_FREQ_45, 0, envctrltwo_scan, &ea->ea_node); else @@ -171,6 +174,44 @@ fail: } void +envctrl_scan(struct device *self, struct i2cbus_attach_args *iba, void *aux) +{ + extern int iic_print(void *, const char *); + struct i2c_attach_args ia; + + memset(&ia, 0, sizeof(ia)); + ia.ia_tag = iba->iba_tag; + ia.ia_cookie = aux; + +#ifdef notyet + /* Power supply 1 temperature. */ + ia.ia_addr = 0x48; + ia.ia_name = "ecadc"; + config_found(self, &ia, iic_print); + + /* Power supply 2 termperature. */ + ia.ia_addr = 0x49; + ia.ia_name = "ecadc"; + config_found(self, &ia, iic_print); + + /* Power supply 3 tempterature. */ + ia.ia_addr = 0x4a; + ia.ia_name = "ecadc"; + config_found(self, &ia, iic_print); +#endif + + /* Ambient tempterature. */ + ia.ia_addr = 0x4d; + ia.ia_name = "lm75"; + config_found(self, &ia, iic_print); + + /* CPU temperatures. */ + ia.ia_addr = 0x4f; + ia.ia_name = "ecadc"; + config_found(self, &ia, iic_print); +} + +void envctrltwo_scan(struct device *self, struct i2cbus_attach_args *iba, void *aux) { extern int iic_print(void *, const char *); |