diff --git a/kernel/spec-i2c.c b/kernel/spec-i2c.c index 0303352df5fb179213007386eaea069f896ddaa1..f5667beb0de82be459f00beb83ae42e99e2eecf2 100644 --- a/kernel/spec-i2c.c +++ b/kernel/spec-i2c.c @@ -131,13 +131,17 @@ void mi2c_init(struct fmc_device *fmc) int mi2c_scan(struct fmc_device *fmc) { - int i, found = 0; - for(i = 0; i < 256; i += 2) { - mi2c_start(fmc); - if(!mi2c_put_byte(fmc, i)) - found++; - mi2c_stop(fmc); - } + int found = 0; + + /* ensure the bus is reset */ + mi2c_start(fmc); + mi2c_stop(fmc); + + /* only look for our own device */ + mi2c_start(fmc); + if(mi2c_put_byte(fmc, fmc->eeprom_addr << 1) == 0) + found++; + mi2c_stop(fmc); return found; }