bmips: enable the data Read Ahead Cache for BMIPS4350
[openwrt/staging/hauke.git] / target / linux / bmips / patches-5.15 / 204-mips-bmips-enable-RAC-on-BMIPS4350.patch
1 From 7f862eaedac56b67972393f0a9affcd2fe53479b Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= <dgcbueu@gmail.com>
3 Date: Sun, 18 Jun 2023 19:59:25 +0200
4 Subject: [PATCH] mips: bmips: enable RAC on BMIPS4350
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 The data RAC is left disabled by the bootloader in some SoCs, at least in
10 the core it boots from.
11 Enabling this feature increases the performance up to +30% depending on the
12 task.
13
14 Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
15 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
16 ---
17 arch/mips/kernel/smp-bmips.c | 14 ++++++++++++++
18 1 file changed, 14 insertions(+)
19
20 --- a/arch/mips/kernel/smp-bmips.c
21 +++ b/arch/mips/kernel/smp-bmips.c
22 @@ -614,6 +614,20 @@ void bmips_cpu_setup(void)
23 __raw_readl(cbr + BMIPS_RAC_ADDRESS_RANGE);
24 break;
25
26 + case CPU_BMIPS4350:
27 + /* Enable data RAC */
28 + if (!(read_c0_brcm_cmt_local() & (1 << 31))) {
29 + cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG);
30 + __raw_writel(cfg | 0xa, cbr + BMIPS_RAC_CONFIG);
31 + __raw_readl(cbr + BMIPS_RAC_CONFIG);
32 + } else {
33 + cbr = (void __iomem *)0xff400000;
34 + cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG_1);
35 + __raw_writel(cfg | 0xa, cbr + BMIPS_RAC_CONFIG_1);
36 + __raw_readl(cbr + BMIPS_RAC_CONFIG_1);
37 + }
38 + break;
39 +
40 case CPU_BMIPS4380:
41 /* CBG workaround for early BMIPS4380 CPUs */
42 switch (read_c0_prid()) {