xref: /rk3399_ARM-atf/include/drivers/marvell/cache_llc.h (revision 772aa5ba75f38930e8e9c3f370a4e2aa9f5f417c)
1152b0e47SKonstantin Porotchkin /*
2152b0e47SKonstantin Porotchkin  * Copyright (C) 2018 Marvell International Ltd.
3152b0e47SKonstantin Porotchkin  *
4152b0e47SKonstantin Porotchkin  * SPDX-License-Identifier:     BSD-3-Clause
5152b0e47SKonstantin Porotchkin  * https://spdx.org/licenses
6152b0e47SKonstantin Porotchkin  */
7152b0e47SKonstantin Porotchkin 
8152b0e47SKonstantin Porotchkin /* LLC driver is the Last Level Cache (L3C) driver
9152b0e47SKonstantin Porotchkin  * for Marvell SoCs in AP806, AP807, and AP810
10152b0e47SKonstantin Porotchkin  */
11152b0e47SKonstantin Porotchkin 
12c3cf06f1SAntonio Nino Diaz #ifndef CACHE_LLC_H
13c3cf06f1SAntonio Nino Diaz #define CACHE_LLC_H
14152b0e47SKonstantin Porotchkin 
15152b0e47SKonstantin Porotchkin #define LLC_CTRL(ap)			(MVEBU_LLC_BASE(ap) + 0x100)
16152b0e47SKonstantin Porotchkin #define LLC_SYNC(ap)			(MVEBU_LLC_BASE(ap) + 0x700)
17*772aa5baSKonstantin Porotchkin #define LLC_BANKED_MNT_AHR(ap)		(MVEBU_LLC_BASE(ap) + 0x724)
18*772aa5baSKonstantin Porotchkin #define LLC_INV_WAY(ap)			(MVEBU_LLC_BASE(ap) + 0x77C)
19*772aa5baSKonstantin Porotchkin #define LLC_BLK_ALOC(ap)		(MVEBU_LLC_BASE(ap) + 0x78c)
20*772aa5baSKonstantin Porotchkin #define LLC_CLEAN_WAY(ap)		(MVEBU_LLC_BASE(ap) + 0x7BC)
21*772aa5baSKonstantin Porotchkin #define LLC_CLEAN_INV_WAY(ap)		(MVEBU_LLC_BASE(ap) + 0x7FC)
22152b0e47SKonstantin Porotchkin #define LLC_TC0_LOCK(ap)		(MVEBU_LLC_BASE(ap) + 0x920)
23152b0e47SKonstantin Porotchkin 
24152b0e47SKonstantin Porotchkin #define MASTER_LLC_CTRL			LLC_CTRL(MVEBU_AP0)
25*772aa5baSKonstantin Porotchkin #define MASTER_LLC_INV_WAY		LLC_INV_WAY(MVEBU_AP0)
26152b0e47SKonstantin Porotchkin #define MASTER_LLC_TC0_LOCK		LLC_TC0_LOCK(MVEBU_AP0)
27152b0e47SKonstantin Porotchkin 
28152b0e47SKonstantin Porotchkin #define LLC_CTRL_EN			1
29152b0e47SKonstantin Porotchkin #define LLC_EXCLUSIVE_EN		0x100
30*772aa5baSKonstantin Porotchkin #define LLC_ALL_WAYS_MASK		0xFFFFFFFF
31*772aa5baSKonstantin Porotchkin 
32*772aa5baSKonstantin Porotchkin /* AP806/AP807 - 1MB 8-ways LLC */
33*772aa5baSKonstantin Porotchkin #define LLC_WAYS			8
34*772aa5baSKonstantin Porotchkin #define LLC_WAY_MASK			((1 << LLC_WAYS) - 1)
35*772aa5baSKonstantin Porotchkin #define LLC_SIZE			(1024 * 1024)
36*772aa5baSKonstantin Porotchkin #define LLC_WAY_SIZE			(LLC_SIZE / LLC_WAYS)
37*772aa5baSKonstantin Porotchkin 
38152b0e47SKonstantin Porotchkin 
39d5dfdeb6SJulius Werner #ifndef __ASSEMBLER__
40152b0e47SKonstantin Porotchkin void llc_cache_sync(int ap_index);
41152b0e47SKonstantin Porotchkin void llc_flush_all(int ap_index);
42152b0e47SKonstantin Porotchkin void llc_clean_all(int ap_index);
43152b0e47SKonstantin Porotchkin void llc_inv_all(int ap_index);
44152b0e47SKonstantin Porotchkin void llc_disable(int ap_index);
45152b0e47SKonstantin Porotchkin void llc_enable(int ap_index, int excl_mode);
46152b0e47SKonstantin Porotchkin int llc_is_exclusive(int ap_index);
47152b0e47SKonstantin Porotchkin void llc_runtime_enable(int ap_index);
48152b0e47SKonstantin Porotchkin #endif
49152b0e47SKonstantin Porotchkin 
50c3cf06f1SAntonio Nino Diaz #endif /* CACHE_LLC_H */
51