Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1336207
| From | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCHv4 5/7] eeprom: at25: extend driver to plug into the NVMEM framework |
| Date | 2016-02-17 11:20 +0100 |
| Message-ID | <r37nc-4W3-25@gated-at.bofh.it> (permalink) |
| References | <r2Xxv-6pr-3@gated-at.bofh.it> <r2Xxw-6pr-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 16/02/16 23:41, Andrew Lunn wrote:
> Add a regmap for accessing the EEPROM, and then use that with the
> NVMEM framework. Enable backwards compatibility in the NVMEM config,
> so that the 'eeprom' file in sys is provided by the framework.
>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Minor Nit, once fixed feel free to add my Ack.
> ---
> drivers/misc/eeprom/Kconfig | 2 +
> drivers/misc/eeprom/at25.c | 124 ++++++++++++++++++++++++--------------------
> 2 files changed, 71 insertions(+), 55 deletions(-)
...
>
> static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)
> @@ -337,6 +349,7 @@ static int at25_probe(struct spi_device *spi)
> {
> struct at25_data *at25 = NULL;
> struct spi_eeprom chip;
> + struct regmap *regmap;
> int err;
> int sr;
> int addrlen;
> @@ -381,35 +394,35 @@ static int at25_probe(struct spi_device *spi)
> spi_set_drvdata(spi, at25);
> at25->addrlen = addrlen;
>
> - /* Export the EEPROM bytes through sysfs, since that's convenient.
> - * And maybe to other kernel code; it might hold a board's Ethernet
> - * address, or board-specific calibration data generated on the
> - * manufacturing floor.
> - *
> - * Default to root-only access to the data; EEPROMs often hold data
> - * that's sensitive for read and/or write, like ethernet addresses,
> - * security codes, board-specific manufacturing calibrations, etc.
> - */
> - sysfs_bin_attr_init(&at25->bin);
> - at25->bin.attr.name = "eeprom";
> - at25->bin.attr.mode = S_IRUSR;
> - at25->bin.read = at25_bin_read;
> -
> - at25->bin.size = at25->chip.byte_len;
> - if (!(chip.flags & EE_READONLY)) {
> - at25->bin.write = at25_bin_write;
> - at25->bin.attr.mode |= S_IWUSR;
> - }
Above check is totally unused, probably remove it.
> + at25->regmap_config.reg_bits = 32;
> + at25->regmap_config.val_bits = 8;
> + at25->regmap_config.reg_stride = 1;
> + at25->regmap_config.max_register = chip.byte_len - 1;
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCHv4 5/7] eeprom: at25: extend driver to plug into the NVMEM framework Andrew Lunn <andrew@lunn.ch> - 2016-02-17 00:50 +0100
Re: [PATCHv4 5/7] eeprom: at25: extend driver to plug into the NVMEM framework Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2016-02-17 11:20 +0100
Re: [PATCHv4 5/7] eeprom: at25: extend driver to plug into the NVMEM framework Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2016-02-17 14:50 +0100
Re: [PATCHv4 5/7] eeprom: at25: extend driver to plug into the NVMEM framework Andrew Lunn <andrew@lunn.ch> - 2016-02-17 14:50 +0100
csiph-web