Skip to content
Snippets Groups Projects
Commit bca8e532 authored by Alessandro Rubini's avatar Alessandro Rubini
Browse files

spec-i2c.c: renamed constants, moved to header

parent 7c47276e
Branches
Tags
No related merge requests found
......@@ -23,10 +23,6 @@
static int spec_i2c_dump;
module_param_named(i2c_dump, spec_i2c_dump, int, 0444);
/* The eeprom is at address 0x50 */
#define I2C_ADDR 0x50
#define I2C_SIZE (8 * 1024)
/* Stupid dumping tool */
static void dumpstruct(char *name, void *ptr, int size)
{
......@@ -206,22 +202,23 @@ int spec_i2c_init(struct fmc_device *fmc)
mi2c_scan(fmc);
buf = kmalloc(I2C_SIZE, GFP_KERNEL);
buf = kmalloc(SPEC_I2C_EEPROM_SIZE, GFP_KERNEL);
if (!buf)
return -ENOMEM;
i = spec_eeprom_read(fmc, I2C_ADDR, 0, buf, I2C_SIZE);
if (i != I2C_SIZE) {
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 = I2C_SIZE;
fmc->eeprom_len = SPEC_I2C_EEPROM_SIZE;
if (spec_i2c_dump)
dumpstruct("eeprom", buf, I2C_SIZE);
dumpstruct("eeprom", buf, SPEC_I2C_EEPROM_SIZE);
return 0;
}
......
......@@ -123,6 +123,14 @@ extern void spec_fmc_destroy(struct spec_dev *spec);
/* Functions in spec-i2c.c, used by spec-fmc.c */
extern int spec_i2c_init(struct fmc_device *fmc);
extern void spec_i2c_exit(struct fmc_device *fmc);
extern int spec_eeprom_read(struct fmc_device *fmc, int i2c_addr,
uint32_t offset, void *buf, size_t size);
extern int spec_eeprom_write(struct fmc_device *fmc, int i2c_addr,
uint32_t offset, void *buf, size_t size);
/* The eeprom is at address 0x50 */
#define SPEC_I2C_EEPROM_ADDR 0x50
#define SPEC_I2C_EEPROM_SIZE (8 * 1024)
/* Functions in spec-gpio.c */
extern int spec_gpio_init(struct fmc_device *fmc);
......
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