示例#1
0
文件: spec-i2c.c 项目: dcobas/svec
int spec_i2c_init(struct fmc_device *fmc)
{
	struct spec_dev *spec = fmc->carrier_data;
	void *buf;
	int i, found;

	found = mi2c_scan(fmc);
	if (!found) {
		fmc->flags |= FMC_DEVICE_NO_MEZZANINE;
		return 0;
	}

	buf = kmalloc(SPEC_I2C_EEPROM_SIZE, GFP_KERNEL);
	if (!buf)
		return -ENOMEM;

	i = spec_eeprom_read(fmc, SPEC_I2C_EEPROM_ADDR, 0, buf,
			     SPEC_I2C_EEPROM_SIZE);
	if (i != SPEC_I2C_EEPROM_SIZE) {
		dev_err(&spec->pdev->dev, "EEPROM read error: retval is %i\n",
			i);
		kfree(buf);
		return -EIO;
	}
	fmc->eeprom = buf;
	fmc->eeprom_len = SPEC_I2C_EEPROM_SIZE;

	if (spec_i2c_dump)
		dumpstruct("eeprom", buf, SPEC_I2C_EEPROM_SIZE);

	return 0;
}
示例#2
0
int fd_i2c_init(struct fd_dev *fd)
{
	mi2c_scan(fd);
	return 0;
}