diff options
| author | Keith Packard <keithp@keithp.com> | 2012-06-02 16:56:41 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2012-06-02 16:56:41 -0700 | 
| commit | 97317d332f21c42860747c4ecde633bd0228ef52 (patch) | |
| tree | 61f1c205cefbae0262cfa9fa72b098c67336c112 | |
| parent | 64e2e66a5239541b15f43172655cfb3560bec79b (diff) | |
altos: Reset i2c controller at boot time
In case it's wedged.
Signed-off-by: Keith Packard <keithp@keithp.com>
| -rw-r--r-- | src/stm/ao_i2c_stm.c | 4 | 
1 files changed, 4 insertions, 0 deletions
diff --git a/src/stm/ao_i2c_stm.c b/src/stm/ao_i2c_stm.c index d82342db..c205706d 100644 --- a/src/stm/ao_i2c_stm.c +++ b/src/stm/ao_i2c_stm.c @@ -362,8 +362,12 @@ void  ao_i2c_channel_init(uint8_t index)  {  	struct stm_i2c	*stm_i2c = ao_i2c_stm_info[index].stm_i2c; +	int i;  	/* Turn I2C off while configuring */ +	stm_i2c->cr1 = (1 << STM_I2C_CR1_SWRST); +	for (i = 0; i < 100; i++) +		asm("nop");  	stm_i2c->cr1 = 0;  	stm_i2c->cr2 = AO_STM_I2C_CR2;  | 
