* [PATCH 2/3] nvmem: ocotp: Ensure WAIT bits are preserved
@ 2019-06-11 6:50 Rouven Czerwinski
0 siblings, 0 replies; only message in thread
From: Rouven Czerwinski @ 2019-06-11 6:50 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
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>
---
drivers/nvmem/ocotp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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);
--
2.22.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-11 6:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-11 6:50 [PATCH 2/3] nvmem: ocotp: Ensure WAIT bits are preserved Rouven Czerwinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox