Skip to contentSkip to conversation

cache: l2x0: Fix incorrect behavior if the latency is 1 cycle

PATCH [email protected] 1 participant 2 messages Mar 18, 2022 – Mar 19, 2022 Standalone cache controller drivers

lore
Share & tools
lore
#0 lore raw

According to the PL310 TRM, 0 in the latency fields(setup/read/write) indicates 1 cycle of latency for Tag and Data RAM latency control registers. If we want to set 1 cycle of latency, we need to clear the field actually. The TRM is as below:
https://developer.arm.com/documentation/ddi0246/h/programmers-model/register
-descriptions/tag-and-data-ram-latency-control-registers

drivers/cache/cache-l2x0.c | 6 ++++++

1 file changed, 6 insertions(+)

From b1d3be4eb85bd38633c24f3363ea86730f667b2d Mon Sep 17 00:00:00 2001
From: Haifeng Li <[email protected]>
Date: Fri, 18 Mar 2022 19:09:53 +0800
Subject: [PATCH 1/1] cache: l2x0: Fix incorrect behavior if the latency is 1
cycle

According to the PL310 TRM, 0 in the latency fields(setup/read/write) indicates 1 cycle of latency for Tag and Data RAM latency control registers. If we want to set 1 cycle of latency, we need to clear the field actually. The TRM is as below:
https://developer.arm.com/documentation/ddi0246/h/programmers-model/register-descriptions/tag-and-data-ram-latency-control-registers

---
 drivers/cache/cache-l2x0.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/cache/cache-l2x0.c +6 -0
index a1556fbf17..49f16519ba 100644
@@ -40,6 +40,9 @@ static void l2c310_of_parse_and_init(struct udevice *dev)
 
 	saved_reg = readl(&regs->pl310_tag_latency_ctrl);
 	if (!dev_read_u32_array(dev, "arm,tag-latency", tag, 3))
+		clrbits_le32(&saved_reg, L310_LATENCY_CTRL_WR(7) |
+				L310_LATENCY_CTRL_RD(7) |
+				L310_LATENCY_CTRL_SETUP(7));
 		saved_reg |= L310_LATENCY_CTRL_RD(tag[0] - 1) |
 			     L310_LATENCY_CTRL_WR(tag[1] - 1) |
 			     L310_LATENCY_CTRL_SETUP(tag[2] - 1);
@@ -47,6 +50,9 @@ static void l2c310_of_parse_and_init(struct udevice *dev)
 
 	saved_reg = readl(&regs->pl310_data_latency_ctrl);
 	if (!dev_read_u32_array(dev, "arm,data-latency", tag, 3))
+		clrbits_le32(&saved_reg, L310_LATENCY_CTRL_WR(7) |
+				L310_LATENCY_CTRL_RD(7) |
+				L310_LATENCY_CTRL_SETUP(7));
 		saved_reg |= L310_LATENCY_CTRL_RD(tag[0] - 1) |
 			     L310_LATENCY_CTRL_WR(tag[1] - 1) |
 			     L310_LATENCY_CTRL_SETUP(tag[2] - 1);
Signature · 1 line
2.17.1
author
#1 lore raw

please ignore this email. I will re-send it with patch inline.

Thanks,
Haifeng.
------------------------------------------------------------------
From:Haifeng Li <[email protected]>
Sent At:2022 Mar. 18 (Fri.) 19:28
To:dinguyen <[email protected]>; u-boot <[email protected]> Cc:Haifeng Li <[email protected]>
Subject:cache: l2x0: Fix incorrect behavior if the latency is 1 cycle

According to the PL310 TRM, 0 in the latency fields(setup/read/write) indicates 1 cycle of latency for Tag and Data RAM latency control registers. If we want to set 1 cycle of latency, we need to clear the field actually. The TRM is as below:
https://developer.arm.com/documentation/ddi0246/h/programmers-model/register
-descriptions/tag-and-data-ram-latency-control-registers

drivers/cache/cache-l2x0.c | 6 ++++++

1 file changed, 6 insertions(+)