[PATCH 1/1] cache: l2x0: Fix incorrect behavior if the latency is 1 cycle

Haifeng Li haifeng.li at timesintelli.com
Sat Mar 19 11:48:18 CET 2022


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

Signed-off-by: Haifeng Li <haifeng.li at timesintelli.com>
---
 drivers/cache/cache-l2x0.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/cache/cache-l2x0.c b/drivers/cache/cache-l2x0.c
index a1556fbf17..49f16519ba 100644
--- a/drivers/cache/cache-l2x0.c
+++ b/drivers/cache/cache-l2x0.c
@@ -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);
-- 
2.17.1



More information about the U-Boot mailing list