Commit 04100bfb authored by Alessandro Rubini's avatar Alessandro Rubini

i2c: accept a card with no mezzanine

parent 704e7b60
......@@ -126,16 +126,19 @@ void mi2c_init(struct fmc_device *fmc)
set_sda(fmc, 1);
}
void mi2c_scan(struct fmc_device *fmc)
int mi2c_scan(struct fmc_device *fmc)
{
int i;
int i, found = 0;
for(i = 0; i < 256; i += 2) {
mi2c_start(fmc);
if(!mi2c_put_byte(fmc, i))
if(!mi2c_put_byte(fmc, i)) {
pr_info("%s: Found i2c device at 0x%x\n",
KBUILD_MODNAME, i >> 1);
found++;
}
mi2c_stop(fmc);
}
return found;
}
/* FIXME: this is very inefficient: read several bytes in a row instead */
......@@ -198,9 +201,13 @@ int spec_i2c_init(struct fmc_device *fmc)
{
struct spec_dev *spec = fmc->carrier_data;
void *buf;
int i;
int i, found;
mi2c_scan(fmc);
found = mi2c_scan(fmc);
if (!found) {
dev_err(&spec->pdev->dev, "Empty mezzanine?\n");
return 0;
}
buf = kmalloc(SPEC_I2C_EEPROM_SIZE, GFP_KERNEL);
if (!buf)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment