public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: <haifeng.li@timesintelli.com>
To: <dinguyen@kernel.org>, <u-boot@lists.denx.de>
Cc: <haifeng.li@timesintelli.com>
Subject: cache: l2x0: Fix incorrect behavior if the latency is 1 cycle
Date: Fri, 18 Mar 2022 19:28:52 +0800	[thread overview]
Message-ID: <003001d83abb$586fd8d0$094f8a70$@timesintelli.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]

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@timesintelli.com>

drivers/cache/cache-l2x0.c | 6 ++++++
1 file changed, 6 insertions(+)

[-- Attachment #2: 0001-cache-l2x0-Fix-incorrect-behavior-if-the-latency-is-.patch --]
[-- Type: application/octet-stream, Size: 1878 bytes --]

From b1d3be4eb85bd38633c24f3363ea86730f667b2d Mon Sep 17 00:00:00 2001
From: Haifeng Li <haifeng.li@timesintelli.com>
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

Signed-off-by: Haifeng Li <haifeng.li@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


             reply	other threads:[~2022-03-18 12:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18 11:28 haifeng.li [this message]
2022-03-19 10:50 ` cache: l2x0: Fix incorrect behavior if the latency is 1 cycle Haifeng Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='003001d83abb$586fd8d0$094f8a70$@timesintelli.com' \
    --to=haifeng.li@timesintelli.com \
    --cc=dinguyen@kernel.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox