| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: gpiic_opb.c,v 1.6 2008/07/12 02:04:07 tsutsui Exp $ */ | | 1 | /* $NetBSD: gpiic_opb.c,v 1.7 2011/06/12 07:19:49 kiyohara Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright 2002, 2003 Wasabi Systems, Inc. | | 4 | * Copyright 2002, 2003 Wasabi Systems, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Written by Steve C. Woodford for Wasabi Systems, Inc. | | 7 | * Written by Steve C. Woodford for Wasabi Systems, Inc. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -125,26 +125,27 @@ gpiic_attach(struct device *parent, stru | | | @@ -125,26 +125,27 @@ gpiic_attach(struct device *parent, stru |
125 | sc->sc_bops.ibo_bits[I2C_BIT_OUTPUT] = 1; | | 125 | sc->sc_bops.ibo_bits[I2C_BIT_OUTPUT] = 1; |
126 | sc->sc_bops.ibo_bits[I2C_BIT_INPUT] = 0; | | 126 | sc->sc_bops.ibo_bits[I2C_BIT_INPUT] = 0; |
127 | | | 127 | |
128 | /* | | 128 | /* |
129 | * Put the controller into Soft Reset. This allows us to | | 129 | * Put the controller into Soft Reset. This allows us to |
130 | * manually bit-bang the I2C clock/data lines. | | 130 | * manually bit-bang the I2C clock/data lines. |
131 | */ | | 131 | */ |
132 | bus_space_write_1(sc->sc_bust, sc->sc_bush, IIC_XTCNTLSS, | | 132 | bus_space_write_1(sc->sc_bust, sc->sc_bush, IIC_XTCNTLSS, |
133 | IIC_XTCNTLSS_SRST); | | 133 | IIC_XTCNTLSS_SRST); |
134 | delay(10); | | 134 | delay(10); |
135 | bus_space_write_1(sc->sc_bust, sc->sc_bush, IIC_DIRECTCNTL, | | 135 | bus_space_write_1(sc->sc_bust, sc->sc_bush, IIC_DIRECTCNTL, |
136 | IIC_DIRECTCNTL_SCC | IIC_DIRECTCNTL_SDAC); | | 136 | IIC_DIRECTCNTL_SCC | IIC_DIRECTCNTL_SDAC); |
137 | | | 137 | |
| | | 138 | memset(&iba, 0, sizeof(iba)); |
138 | iba.iba_tag = &sc->sc_i2c; | | 139 | iba.iba_tag = &sc->sc_i2c; |
139 | (void) config_found_ia(&sc->sc_dev, "i2cbus", &iba, iicbus_print); | | 140 | (void) config_found_ia(&sc->sc_dev, "i2cbus", &iba, iicbus_print); |
140 | } | | 141 | } |
141 | | | 142 | |
142 | static int | | 143 | static int |
143 | gpiic_acquire_bus(void *arg, int flags) | | 144 | gpiic_acquire_bus(void *arg, int flags) |
144 | { | | 145 | { |
145 | struct gpiic_softc *sc = arg; | | 146 | struct gpiic_softc *sc = arg; |
146 | | | 147 | |
147 | if (flags & I2C_F_POLL) | | 148 | if (flags & I2C_F_POLL) |
148 | return (0); | | 149 | return (0); |
149 | | | 150 | |
150 | mutex_enter(&sc->sc_buslock); | | 151 | mutex_enter(&sc->sc_buslock); |