Andrew Davis | 5eb8d57 | 2024-02-01 18:24:44 -0600 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * K3: R5 Common Architecture initialization |
| 4 | * |
| 5 | * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/ |
| 6 | */ |
| 7 | |
| 8 | #include <linux/types.h> |
| 9 | #include <asm/hardware.h> |
| 10 | #include <asm/io.h> |
| 11 | |
| 12 | #include "../common.h" |
| 13 | |
| 14 | void disable_linefill_optimization(void) |
| 15 | { |
| 16 | u32 actlr; |
| 17 | |
| 18 | /* |
| 19 | * On K3 devices there are 2 conditions where R5F can deadlock: |
| 20 | * 1.When software is performing series of store operations to |
| 21 | * cacheable write back/write allocate memory region and later |
| 22 | * on software execute barrier operation (DSB or DMB). R5F may |
| 23 | * hang at the barrier instruction. |
| 24 | * 2.When software is performing a mix of load and store operations |
| 25 | * within a tight loop and store operations are all writing to |
| 26 | * cacheable write back/write allocates memory regions, R5F may |
| 27 | * hang at one of the load instruction. |
| 28 | * |
| 29 | * To avoid the above two conditions disable linefill optimization |
| 30 | * inside Cortex R5F. |
| 31 | */ |
| 32 | asm("mrc p15, 0, %0, c1, c0, 1" : "=r" (actlr)); |
| 33 | actlr |= (1 << 13); /* Set DLFO bit */ |
| 34 | asm("mcr p15, 0, %0, c1, c0, 1" : : "r" (actlr)); |
| 35 | } |