From 45923ad8dcc1575cd5409dcbae1eaa9af4dcb692 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Wed, 14 Jun 2006 01:15:20 +0000 Subject: support the iic busses on the ultrasparc III machines (something is still wrong, likely clocking); tested to not break older machines by dlg & djm --- sys/arch/sparc64/dev/pcfiic_ebus.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'sys/arch/sparc64/dev/pcfiic_ebus.c') diff --git a/sys/arch/sparc64/dev/pcfiic_ebus.c b/sys/arch/sparc64/dev/pcfiic_ebus.c index 126ac46a9bc..6084b6dec9e 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.3 2006/02/09 12:16:25 dlg Exp $ */ +/* $OpenBSD: pcfiic_ebus.c,v 1.4 2006/06/14 01:15:19 deraadt Exp $ */ /* * Copyright (c) 2006 David Gwynne @@ -64,10 +64,11 @@ pcfiic_ebus_match(struct device *parent, void *match, void *aux) if (OF_getprop(ea->ea_node, "compatible", compat, sizeof(compat)) == -1) return (0); - if (strcmp(compat, "i2cpcf,8584") != 0) - return (0); + if (strcmp(compat, "i2cpcf,8584") || + strcmp(compat, "SUNW,bbc-i2c")) + return (1); - return (1); + return (0); } void @@ -80,17 +81,15 @@ pcfiic_ebus_attach(struct device *parent, struct device *self, void *aux) sc->sc_iot = ea->ea_memtag; - if (ea->ea_nregs != 1) { - printf(": expected 1 register, got %d\n", ea->ea_nregs); + if (ea->ea_nregs < 1 || ea->ea_nregs > 2) { + printf(": expected 1 or 2 registers, got %d\n", ea->ea_nregs); return; } if (OF_getprop(ea->ea_node, "own-address", &addr, sizeof(addr)) == -1) { - printf(": unable to get own address\n"); - return; - } - if (addr == 0x00 || addr > 0xff) { - printf(": invalid address on I2C bus\n"); + addr = 0xaa; + } else if (addr == 0x00 || addr > 0xff) { + printf(": invalid address on I2C bus"); return; } @@ -100,6 +99,15 @@ pcfiic_ebus_attach(struct device *parent, struct device *self, void *aux) return; } + if (ea->ea_nregs == 2) { + if (ebus_bus_map(sc->sc_iot, 0, EBUS_PADDR_FROM_REG(&ea->ea_regs[1]), + ea->ea_regs[1].size, 0, 0, &sc->sc_ioh2) != 0) { + printf(": can't map 2nd register space\n"); + return; + } + sc->sc_master = 1; + } + if (ea->ea_nintrs >= 1) esc->esc_ih = bus_intr_establish(sc->sc_iot, ea->ea_intrs[0], IPL_BIO, 0, pcfiic_intr, sc, self->dv_xname); -- cgit v1.2.3