diff options
| author | Alessandro Rubini <rubini@gnudd.com> | 2014-02-22 03:11:12 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-28 18:12:08 -0500 |
| commit | 5c9a87367daf292244bd9bb3e67516dfa0027516 (patch) | |
| tree | c62996f9f46349aa3dfb86330ae7ec45ae2e0ad9 /drivers/fmc | |
| parent | dd97b2410e70d881a362e5b31b702f59c21e0da6 (diff) | |
FMC: make eeprom attribute writable
This allows easier modification to the eeprom than loading the
fmc-write-eeprom module. The carrier driver will refuse writing if
the FPGA is not running the golden gateware image, so writing in
practice is only available at manufacture/development time.
Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Acked-by: Juan David Gonzalez Cobas <dcobas@cern.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/fmc')
| -rw-r--r-- | drivers/fmc/fmc-core.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/fmc/fmc-core.c b/drivers/fmc/fmc-core.c index 5a5e616c6324..353fc546fb08 100644 --- a/drivers/fmc/fmc-core.c +++ b/drivers/fmc/fmc-core.c | |||
| @@ -99,10 +99,23 @@ static ssize_t fmc_read_eeprom(struct file *file, struct kobject *kobj, | |||
| 99 | return count; | 99 | return count; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | static ssize_t fmc_write_eeprom(struct file *file, struct kobject *kobj, | ||
| 103 | struct bin_attribute *bin_attr, | ||
| 104 | char *buf, loff_t off, size_t count) | ||
| 105 | { | ||
| 106 | struct device *dev; | ||
| 107 | struct fmc_device *fmc; | ||
| 108 | |||
| 109 | dev = container_of(kobj, struct device, kobj); | ||
| 110 | fmc = container_of(dev, struct fmc_device, dev); | ||
| 111 | return fmc->op->write_ee(fmc, off, buf, count); | ||
| 112 | } | ||
| 113 | |||
| 102 | static struct bin_attribute fmc_eeprom_attr = { | 114 | static struct bin_attribute fmc_eeprom_attr = { |
| 103 | .attr = { .name = "eeprom", .mode = S_IRUGO, }, | 115 | .attr = { .name = "eeprom", .mode = S_IRUGO | S_IWUSR, }, |
| 104 | .size = 8192, /* more or less standard */ | 116 | .size = 8192, /* more or less standard */ |
| 105 | .read = fmc_read_eeprom, | 117 | .read = fmc_read_eeprom, |
| 118 | .write = fmc_write_eeprom, | ||
| 106 | }; | 119 | }; |
| 107 | 120 | ||
| 108 | /* | 121 | /* |
