Skip to content

Commit 04f38d1

Browse files
danitooltsbogend
authored andcommitted
mips: bmips: enable RAC on BMIPS4350
The data RAC is left disabled by the bootloader in some SoCs, at least in the core it boots from. Enabling this feature increases the performance up to +30% depending on the task. Signed-off-by: Daniel González Cabanelas <[email protected]> Signed-off-by: Álvaro Fernández Rojas <[email protected]> [ rework code and reduce code duplication ] Acked-by: Florian Fainelli <[email protected]> Signed-off-by: Christian Marangi <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent b95b30e commit 04f38d1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

arch/mips/kernel/smp-bmips.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ asmlinkage void __weak plat_wired_tlb_setup(void)
592592
void bmips_cpu_setup(void)
593593
{
594594
void __iomem __maybe_unused *cbr = bmips_cbr_addr;
595+
u32 __maybe_unused rac_addr;
595596
u32 __maybe_unused cfg;
596597

597598
switch (current_cpu_type()) {
@@ -620,6 +621,23 @@ void bmips_cpu_setup(void)
620621
__raw_readl(cbr + BMIPS_RAC_ADDRESS_RANGE);
621622
break;
622623

624+
case CPU_BMIPS4350:
625+
rac_addr = BMIPS_RAC_CONFIG_1;
626+
627+
if (!(read_c0_brcm_cmt_local() & (1 << 31)))
628+
rac_addr = BMIPS_RAC_CONFIG;
629+
630+
/* Enable data RAC */
631+
cfg = __raw_readl(cbr + rac_addr);
632+
__raw_writel(cfg | 0xf, cbr + rac_addr);
633+
__raw_readl(cbr + rac_addr);
634+
635+
/* Flush stale data out of the readahead cache */
636+
cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG);
637+
__raw_writel(cfg | 0x100, cbr + BMIPS_RAC_CONFIG);
638+
__raw_readl(cbr + BMIPS_RAC_CONFIG);
639+
break;
640+
623641
case CPU_BMIPS4380:
624642
/* CBG workaround for early BMIPS4380 CPUs */
625643
switch (read_c0_prid()) {

0 commit comments

Comments
 (0)