Jim Liu | 4359b33 | 2022-04-19 13:32:19 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (c) 2021 Nuvoton Technology Corp. |
| 4 | */ |
| 5 | |
Tom Rini | abb9a04 | 2024-05-18 20:20:43 -0600 | [diff] [blame] | 6 | #include <common.h> |
Jim Liu | 4359b33 | 2022-04-19 13:32:19 +0800 | [diff] [blame] | 7 | #include <asm/io.h> |
| 8 | #include <asm/pl310.h> |
| 9 | |
| 10 | void l2_pl310_init(void); |
| 11 | |
| 12 | void set_pl310_ctrl(u32 enable) |
| 13 | { |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 14 | struct pl310_regs *const pl310 = (struct pl310_regs *)CFG_SYS_PL310_BASE; |
Jim Liu | 4359b33 | 2022-04-19 13:32:19 +0800 | [diff] [blame] | 15 | |
| 16 | writel(enable, &pl310->pl310_ctrl); |
| 17 | } |
| 18 | |
| 19 | void v7_outer_cache_enable(void) |
| 20 | { |
| 21 | l2_pl310_init(); |
| 22 | |
| 23 | set_pl310_ctrl(1); |
| 24 | } |
| 25 | |
| 26 | void v7_outer_cache_disable(void) |
| 27 | { |
| 28 | set_pl310_ctrl(0); |
| 29 | } |