From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Andrew Lunn <andrew@lunn.ch>, GregKH <greg@kroah.com>
Cc: maxime.ripard@free-electrons.com, wsa@the-dreams.de,
broonie@kernel.org, vz@mleia.com, fd@ti.com,
linux-kernel@vger.kernel.org, pantelis.antoniou@konsulko.com,
bgolaszewski@baylibre.com
Subject: Re: [PATCHv4 5/7] eeprom: at25: extend driver to plug into the NVMEM framework
Date: Wed, 17 Feb 2016 10:17:51 +0000 [thread overview]
Message-ID: <56C448CF.4070208@linaro.org> (raw)
In-Reply-To: <1455666097-9115-6-git-send-email-andrew@lunn.ch>
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;
>
next prev parent reply other threads:[~2016-02-17 10:18 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 23:41 [PATCHv4 0/7] Convert exiting EEPROM drivers to NVMEM Andrew Lunn
2016-02-16 23:41 ` [PATCHv4 1/7] nvmem: Add flag to export NVMEM to root only Andrew Lunn
2016-02-17 10:17 ` Srinivas Kandagatla
2016-02-17 13:32 ` Andrew Lunn
2016-02-16 23:41 ` [PATCHv4 2/7] nvmem: Add backwards compatibility support for older EEPROM drivers Andrew Lunn
2016-02-17 10:17 ` Srinivas Kandagatla
2016-02-17 13:27 ` Andrew Lunn
2016-02-16 23:41 ` [PATCHv4 3/7] eeprom: at24: extend driver to plug into the NVMEM framework Andrew Lunn
2016-02-17 10:17 ` Srinivas Kandagatla
2016-02-17 10:21 ` Wolfram Sang
2016-02-17 11:00 ` Srinivas Kandagatla
2016-02-17 11:00 ` Srinivas Kandagatla
2016-02-16 23:41 ` [PATCHv4 4/7] eeprom: at25: Remove in kernel API for accessing the EEPROM Andrew Lunn
2016-02-17 10:17 ` Srinivas Kandagatla
2016-02-16 23:41 ` [PATCHv4 5/7] eeprom: at25: extend driver to plug into the NVMEM framework Andrew Lunn
2016-02-17 10:17 ` Srinivas Kandagatla [this message]
2016-02-17 13:42 ` Andrew Lunn
2016-02-17 13:45 ` Srinivas Kandagatla
2016-02-16 23:41 ` [PATCHv4 6/7] eeprom: 93xx46: " Andrew Lunn
2016-02-17 10:17 ` Srinivas Kandagatla
2016-02-17 13:46 ` Srinivas Kandagatla
2016-02-16 23:41 ` [PATCHv4 7/7] misc: at24: replace memory_accessor with nvmem_device_read Andrew Lunn
2016-02-17 10:18 ` Srinivas Kandagatla
2016-02-17 10:17 ` [PATCHv4 0/7] Convert exiting EEPROM drivers to NVMEM Srinivas Kandagatla
2016-02-17 13:39 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56C448CF.4070208@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=andrew@lunn.ch \
--cc=bgolaszewski@baylibre.com \
--cc=broonie@kernel.org \
--cc=fd@ti.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.ripard@free-electrons.com \
--cc=pantelis.antoniou@konsulko.com \
--cc=vz@mleia.com \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).