public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: stefan.wahren@i2se•com (Stefan Wahren)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v2 2/4] nvmem: NXP LPC18xx EEPROM memory NVMEM driver
Date: Tue, 3 Nov 2015 09:20:00 +0100	[thread overview]
Message-ID: <56386E30.4060905@i2se.com> (raw)
In-Reply-To: <1445275946-32653-3-git-send-email-ariel@vanguardiasur.com.ar>

Hi Ariel,

Am 19.10.2015 um 19:32 schrieb Ariel D'Alessandro:
> This commit adds support for NXP LPC18xx EEPROM memory found in NXP
> LPC185x/3x and LPC435x/3x/2x/1x devices.
>
> EEPROM size is 16384 bytes and it can be entirely read and
> written/erased with 1 word (4 bytes) granularity. The last page
> (128 bytes) contains the EEPROM initialization data and is not writable.
>
> Erase/program time is less than 3ms. The EEPROM device requires a
> ~1500 kHz clock (min 800 kHz, max 1600 kHz) that is generated dividing
> the system bus clock by the division factor, contained in the divider
> register (minus 1 encoded).
>
> Signed-off-by: Ariel D'Alessandro <ariel@vanguardiasur•com.ar>
> ---
>  drivers/nvmem/Kconfig          |   9 ++
>  drivers/nvmem/Makefile         |   2 +
>  drivers/nvmem/lpc18xx_eeprom.c | 266 +++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 277 insertions(+)
>  create mode 100644 drivers/nvmem/lpc18xx_eeprom.c
> [...]
> +
> +static int lpc18xx_eeprom_gather_write(void *context, const void *reg,
> +				       size_t reg_size, const void *val,
> +				       size_t val_size)
> +{
> +	struct lpc18xx_eeprom_dev *eeprom = context;
> +	unsigned int offset = *(u32 *)reg;
> +
> +	/* 3 ms of erase/program time between each writing */
> +	while (val_size) {
> +		writel(*(u32 *)val, eeprom->mem_base + offset);
> +		usleep_range(3000, 4000);

i think it would be good to verify that the EEPROM write operation has
really finished.

Best regards
Stefan

> +		val_size -= eeprom->val_bytes;
> +		val += eeprom->val_bytes;
> +		offset += eeprom->val_bytes;
> +	}
> +
> +	return 0;
> +}

  parent reply	other threads:[~2015-11-03  8:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-19 17:32 [PATCH v2 0/4] Add support for NXP LPC18xx EEPROM using nvmem Ariel D'Alessandro
2015-10-19 17:32 ` [PATCH v2 1/4] DT: nvmem: Add NXP LPC18xx EEPROM memory binding documentation Ariel D'Alessandro
2015-10-24 21:44   ` Joachim Eastwood
2015-10-30 12:45     ` Ariel D'Alessandro
2015-10-27  7:49   ` Rob Herring
2015-10-19 17:32 ` [PATCH v2 2/4] nvmem: NXP LPC18xx EEPROM memory NVMEM driver Ariel D'Alessandro
2015-10-24 22:04   ` Joachim Eastwood
2015-10-26 13:37     ` Srinivas Kandagatla
2015-10-30 14:58       ` Ariel D'Alessandro
2015-11-16 15:33         ` Ariel D'Alessandro
2015-11-16 15:37           ` Srinivas Kandagatla
2015-12-03 18:39             ` Ezequiel Garcia
2015-10-30 14:55     ` Ariel D'Alessandro
2015-11-16 15:24       ` Ariel D'Alessandro
2015-10-26 14:23   ` Srinivas Kandagatla
2015-10-30 15:42     ` Ariel D'Alessandro
2015-10-30 16:00       ` Ezequiel Garcia
2015-11-03  8:20   ` Stefan Wahren [this message]
2015-11-16 15:29     ` Ariel D'Alessandro
2015-11-17 10:01       ` Stefan Wahren
2015-11-17 19:53         ` Ariel D'Alessandro
2015-10-19 17:32 ` [PATCH v2 3/4] ARM: dts: lpc18xx: add EEPROM memory node Ariel D'Alessandro
2015-10-24 21:42   ` Joachim Eastwood
2015-10-19 17:32 ` [PATCH v2 4/4] ARM: configs: lpc18xx: enable EEPROM NVMEM driver Ariel D'Alessandro
2015-10-24 21:41   ` Joachim Eastwood

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=56386E30.4060905@i2se.com \
    --to=stefan.wahren@i2se$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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