Skip to contentSkip to conversation

arm: mvebu: update RTC values for PCIe memory wrappers

PATCH Superseded Chris Packham 3 participants 4 messages Feb 26, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: mvebu: update RTC values for PCIe memory wrappers

From: Chris Packham <[email protected]>

Update the RTC (Read Timing Control) values for PCIe memory wrappers following an ERRATA (ERRATA# TDB). This means the PCIe accesses will used slower memory Read Timing, to allow more efficient energy consumption, in order to lower the minimum VDD of the memory. Will lead to more robust memory when voltage drop occurs (VDDSEG)

The code is based on changes from Marvell's U-Boot, specifically:

https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/20cd2704072512de176e048970f2883db901674b
https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/eb608a7c8dd0d42b87601a61b9c0cc5615ab94b2
https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/c4af19ae2bf08cf6e450e741ce4f04d402a5cb6b
https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/c4af19ae2bf08cf6e450e741ce4f04d402a5cb6b

---
I've signed-off using both my email addresses. I normally do u-boot stuff via gmail for convenience but this is definitely a work thing.

 arch/arm/mach-mvebu/include/mach/cpu.h        |  2 ++
 arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c | 17 +++++++++++++++++
 arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h | 13 +++++++++++++
 arch/arm/mach-mvebu/spl.c                     |  3 +++
 4 files changed, 35 insertions(+)
arch/arm/mach-mvebu/include/mach/cpu.h +2 -0
index 2e2d72aac892..fa7c81754b8f 100644
@@ -166,8 +166,10 @@ int ddr3_init(void);
 /* Auto Voltage Scaling */
 #if defined(CONFIG_ARMADA_38X) || defined(CONFIG_ARMADA_39X)
 void mv_avs_init(void);
+void mv_rtc_config(void);
 #else
 static inline void mv_avs_init(void) {}
+static inline void mv_rtc_config(void) {}
 #endif
 
 /*
arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c +17 -0
index e9dd096ad0f5..3c4c7e01a1cd 100644
@@ -257,6 +257,23 @@ u8 sys_env_device_rev_get(void)
 	return (value & (REVISON_ID_MASK)) >> REVISON_ID_OFFS;
 }
 
+void mv_rtc_config(void)
+{
+	u32 i, val;
+
+	if (!(IS_ENABLED(CONFIG_ARMADA_38X) || IS_ENABLED(CONFIG_ARMADA_39X)))
+		return;
+
+	/* Activate pipe0 for read/write transaction, and set XBAR client number #1 */
+	val = 0x1 << DFX_PIPE_SELECT_PIPE0_ACTIVE_OFFS |
+	      0x1 << DFX_PIPE_SELECT_XBAR_CLIENT_SEL_OFFS;
+	writel(val, MVEBU_DFX_BASE);
+
+	/* Set new RTC value for all memory wrappers */
+	for (i = 0; i < RTC_MEMORY_WRAPPER_COUNT; i++)
+		reg_write(RTC_MEMORY_WRAPPER_REG(i), RTC_MEMORY_WRAPPER_CTRL_VAL);
+}
+
 void mv_avs_init(void)
 {
 	u32 sar_freq;
arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h +13 -0
index 1774a5b780ca..17cd811331d2 100644
@@ -150,6 +150,19 @@
 #define MPP_UART1_SET_MASK		(~(0xff000))
 #define MPP_UART1_SET_DATA		(0x66000)
 
+#define DFX_PIPE_SELECT_PIPE0_ACTIVE_OFFS	0
+/* DFX_PIPE_SELECT_XBAR_CLIENT_SEL_OFFS: Since address completion in 14bit
+ * address mode, and given that [14:8] => [19:13], the 2 lower bits [9:8] =>
+ * [14:13] are dismissed. hence field offset is also shifted to 10
+ */
+#define DFX_PIPE_SELECT_XBAR_CLIENT_SEL_OFFS	10
+
+#define RTC_MEMORY_CTRL_REG_BASE	0xE6000
+#define RTC_MEMORY_WRAPPER_COUNT	8
+#define RTC_MEMORY_WRAPPER_REG(i)	(RTC_MEMORY_CTRL_REG_BASE + ((i) * 0x40))
+#define RTC_MEMORY_CTRL_PDLVMC_FIELD_OFFS	6
+#define RTC_MEMORY_WRAPPER_CTRL_VAL	(0x1 << RTC_MEMORY_CTRL_PDLVMC_FIELD_OFFS)
+
 #define AVS_DEBUG_CNTR_REG		0xe4124
 #define AVS_DEBUG_CNTR_DEFAULT_VALUE	0x08008073
 
arch/arm/mach-mvebu/spl.c +3 -0
index a99bf166fd85..70fef3b573d9 100644
@@ -130,6 +130,9 @@ void board_init_f(ulong dummy)
 	/* Initialize Auto Voltage Scaling */
 	mv_avs_init();
 
+	/* Update read timing control for PCIe */
+	mv_rtc_config();
+
 	/*
 	 * Return to the BootROM to continue the Marvell xmodem
 	 * UART boot protocol. As initiated by the kwboot tool.
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 arm: mvebu: update RTC values for PCIe memory wrappers

Hi Chris,

Quoted 7 lines · Chris Packham

From: Chris Packham <[email protected]>

Update the RTC (Read Timing Control) values for PCIe memory wrappers following an ERRATA (ERRATA# TDB). This means the PCIe accesses will used slower memory Read Timing, to allow more efficient energy consumption, in order to lower the minimum VDD of the memory. Will lead to more robust memory when voltage drop occurs (VDDSEG)

Have you seen memory access reliability problems because of this issue?

Quoted 6 lines

The code is based on changes from Marvell's U-Boot, specifically:

https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/20cd2704072512de176e048970f2883db901674b
https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/eb608a7c8dd0d42b87601a61b9c0cc5615ab94b2
https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/c4af19ae2bf08cf6e450e741ce4f04d402a5cb6b
https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/c4af19ae2bf08cf6e450e741ce4f04d402a5cb6b

The last link looks duplicated.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#2 lore raw

PATCH 1/1 arm: mvebu: update RTC values for PCIe memory wrappers

Hi Baruch,

Quoted 14 lines · Baruch Siach

Hi Chris,

Quoted 10 lines · Chris Packham

From: Chris Packham <[email protected]>

Update the RTC (Read Timing Control) values for PCIe memory wrappers
following an ERRATA (ERRATA# TDB). This means the PCIe accesses will
used slower memory Read Timing, to allow more efficient energy consumption, in order to lower the minimum VDD of the memory. Will lead
to more robust memory when voltage drop occurs (VDDSEG)

Quoted 3 lines

Have you seen memory access reliability problems because of this issue?

We're seeing a few different symptoms but they all consist of a PCIe transfer failing in some way (as far as we can tell in the TX direction from the CPU).

Quoted 3 lines
Quoted 3 lines

The code is based on changes from Marvell's U-Boot, specifically:

https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/20cd2704072512de176e048970f2883db901674b

Quoted 1 line
Quoted 1 line

https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/eb608a7c8dd0d42b87601a61b9c0cc5615ab94b2

Quoted 1 line
Quoted 1 line

https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/c4af19ae2bf08cf6e450e741ce4f04d402a5cb6b

Quoted 1 line
Quoted 1 line

https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/c4af19ae2bf08cf6e450e741ce4f04d402a5cb6b

Quoted 2 lines

The last link looks duplicated.

Hmm I was pretty sure there were 4 commits. I'll double check and either fix or remove the link.

Quoted 3 lines

baruch

#3 lore raw

PATCH 1/1 arm: mvebu: update RTC values for PCIe memory wrappers

Quoted 18 lines · Chris Packham

Hi Baruch,

Quoted 15 lines · Baruch Siach

Hi Chris,

Quoted 11 lines · Chris Packham

From: Chris Packham <[email protected]>

Update the RTC (Read Timing Control) values for PCIe memory wrappers
following an ERRATA (ERRATA# TDB). This means the PCIe accesses will
used slower memory Read Timing, to allow more efficient energy consumption, in order to lower the minimum VDD of the memory. Will
lead
to more robust memory when voltage drop occurs (VDDSEG)

Quoted 14 lines
Quoted 3 lines

Have you seen memory access reliability problems because of this issue?

We're seeing a few different symptoms but they all consist of a PCIe transfer failing in some way (as far as we can tell in the TX direction
from the CPU).

Quoted 3 lines
Quoted 3 lines

The code is based on changes from Marvell's U-Boot, specifically:

https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/20cd2704072512de176e048970f2883db901674b

Quoted 3 lines
Quoted 1 line
Quoted 1 line

https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/eb608a7c8dd0d42b87601a61b9c0cc5615ab94b2

Quoted 3 lines
Quoted 1 line
Quoted 1 line

https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/c4af19ae2bf08cf6e450e741ce4f04d402a5cb6b

Quoted 3 lines
Quoted 1 line
Quoted 1 line

https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/c4af19ae2bf08cf6e450e741ce4f04d402a5cb6b

Quoted 5 lines
Quoted 2 lines

The last link looks duplicated.

Hmm I was pretty sure there were 4 commits. I'll double check and either fix or remove the link.

Ah. There are 4 patches, but the last one isn't in the github repo for some reason. I'll drop the link.

Quoted 4 lines
Quoted 4 lines

baruch