diff options
author | Rouven Czerwinski <r.czerwinski@pengutronix.de> | 2019-06-11 08:50:52 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-06-11 10:30:12 +0200 |
commit | 18ac9ebab9cb5146ea2b0d93719c89834c95ad55 (patch) | |
tree | 65363b09db4a0621924537c7c9f5c5ab7f68a116 /drivers/nvmem | |
parent | 10c77cfca8ea25f2d2237ec383b03c69b75e712c (diff) | |
download | barebox-18ac9ebab9cb5146ea2b0d93719c89834c95ad55.tar.gz barebox-18ac9ebab9cb5146ea2b0d93719c89834c95ad55.tar.xz |
nvmem: ocotp: Ensure WAIT bits are preserved
Port of patch from linux-arm-kernel:
| From Bryan O'Donoghue <pure.logic@nexus-software.ie>
|
| nvmem: imx-ocotp: Ensure WAIT bits are preserved when setting timing
|
| The i.MX6 and i.MX8 both have a bit-field spanning bits 27:22 called the
| WAIT field.
|
| The WAIT field according to the documentation for both parts "specifies
| time interval between auto read and write access in one time program. It is
| given in number of ipg_clk periods."
|
| This patch ensures that the relevant field is read and written back to the
| timing register.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/nvmem')
-rw-r--r-- | drivers/nvmem/ocotp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/nvmem/ocotp.c b/drivers/nvmem/ocotp.c index ab543b475f..c21327805b 100644 --- a/drivers/nvmem/ocotp.c +++ b/drivers/nvmem/ocotp.c @@ -59,6 +59,7 @@ #define OCOTP_TIMING_STROBE_READ_MASK 0x003F0000 #define OCOTP_TIMING_RELAX_MASK 0x0000F000 #define OCOTP_TIMING_STROBE_PROG_MASK 0x00000FFF +#define OCOTP_TIMING_WAIT_MASK 0x0FC00000 #define OCOTP_READ_CTRL_READ_FUSE 0x00000001 @@ -124,7 +125,8 @@ static int imx6_ocotp_set_timing(struct ocotp_priv *priv) strobe_prog = clk_rate / (1000000000 / 10000) + 2 * (DEF_RELAX + 1) - 1; strobe_read = clk_rate / (1000000000 / 40) + 2 * (DEF_RELAX + 1) - 1; - timing = BF(relax, OCOTP_TIMING_RELAX); + timing = readl(priv->base + OCOTP_TIMING) & OCOTP_TIMING_WAIT_MASK; + timing |= BF(relax, OCOTP_TIMING_RELAX); timing |= BF(strobe_read, OCOTP_TIMING_STROBE_READ); timing |= BF(strobe_prog, OCOTP_TIMING_STROBE_PROG); |