162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * AURORA shared L2 cache controller support
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2012 Marvell
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Yehuda Yitschak <yehuday@marvell.com>
862306a36Sopenharmony_ci * Gregory CLEMENT <gregory.clement@free-electrons.com>
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#ifndef __ASM_ARM_HARDWARE_AURORA_L2_H
1262306a36Sopenharmony_ci#define __ASM_ARM_HARDWARE_AURORA_L2_H
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#define AURORA_SYNC_REG		    0x700
1562306a36Sopenharmony_ci#define AURORA_RANGE_BASE_ADDR_REG  0x720
1662306a36Sopenharmony_ci#define AURORA_FLUSH_PHY_ADDR_REG   0x7f0
1762306a36Sopenharmony_ci#define AURORA_INVAL_RANGE_REG	    0x774
1862306a36Sopenharmony_ci#define AURORA_CLEAN_RANGE_REG	    0x7b4
1962306a36Sopenharmony_ci#define AURORA_FLUSH_RANGE_REG	    0x7f4
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci#define AURORA_ACR_REPLACEMENT_OFFSET	    27
2262306a36Sopenharmony_ci#define AURORA_ACR_REPLACEMENT_MASK	     \
2362306a36Sopenharmony_ci	(0x3 << AURORA_ACR_REPLACEMENT_OFFSET)
2462306a36Sopenharmony_ci#define AURORA_ACR_REPLACEMENT_TYPE_WAYRR    \
2562306a36Sopenharmony_ci	(0 << AURORA_ACR_REPLACEMENT_OFFSET)
2662306a36Sopenharmony_ci#define AURORA_ACR_REPLACEMENT_TYPE_LFSR     \
2762306a36Sopenharmony_ci	(1 << AURORA_ACR_REPLACEMENT_OFFSET)
2862306a36Sopenharmony_ci#define AURORA_ACR_REPLACEMENT_TYPE_SEMIPLRU \
2962306a36Sopenharmony_ci	(3 << AURORA_ACR_REPLACEMENT_OFFSET)
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#define AURORA_ACR_PARITY_EN	(1 << 21)
3262306a36Sopenharmony_ci#define AURORA_ACR_ECC_EN	(1 << 20)
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define AURORA_ACR_FORCE_WRITE_POLICY_OFFSET	0
3562306a36Sopenharmony_ci#define AURORA_ACR_FORCE_WRITE_POLICY_MASK	\
3662306a36Sopenharmony_ci	(0x3 << AURORA_ACR_FORCE_WRITE_POLICY_OFFSET)
3762306a36Sopenharmony_ci#define AURORA_ACR_FORCE_WRITE_POLICY_DIS	\
3862306a36Sopenharmony_ci	(0 << AURORA_ACR_FORCE_WRITE_POLICY_OFFSET)
3962306a36Sopenharmony_ci#define AURORA_ACR_FORCE_WRITE_BACK_POLICY	\
4062306a36Sopenharmony_ci	(1 << AURORA_ACR_FORCE_WRITE_POLICY_OFFSET)
4162306a36Sopenharmony_ci#define AURORA_ACR_FORCE_WRITE_THRO_POLICY	\
4262306a36Sopenharmony_ci	(2 << AURORA_ACR_FORCE_WRITE_POLICY_OFFSET)
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#define AURORA_ERR_CNT_REG          0x600
4562306a36Sopenharmony_ci#define AURORA_ERR_ATTR_CAP_REG     0x608
4662306a36Sopenharmony_ci#define AURORA_ERR_ADDR_CAP_REG     0x60c
4762306a36Sopenharmony_ci#define AURORA_ERR_WAY_CAP_REG      0x610
4862306a36Sopenharmony_ci#define AURORA_ERR_INJECT_CTL_REG   0x614
4962306a36Sopenharmony_ci#define AURORA_ERR_INJECT_MASK_REG  0x618
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci#define AURORA_ERR_CNT_CLR_OFFSET         31
5262306a36Sopenharmony_ci#define AURORA_ERR_CNT_CLR		   \
5362306a36Sopenharmony_ci	(0x1 << AURORA_ERR_CNT_CLR_OFFSET)
5462306a36Sopenharmony_ci#define AURORA_ERR_CNT_UE_OFFSET          16
5562306a36Sopenharmony_ci#define AURORA_ERR_CNT_UE_MASK             \
5662306a36Sopenharmony_ci	(0x7fff << AURORA_ERR_CNT_UE_OFFSET)
5762306a36Sopenharmony_ci#define AURORA_ERR_CNT_CE_OFFSET           0
5862306a36Sopenharmony_ci#define AURORA_ERR_CNT_CE_MASK             \
5962306a36Sopenharmony_ci	(0xffff << AURORA_ERR_CNT_CE_OFFSET)
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#define AURORA_ERR_ATTR_SRC_OFF           16
6262306a36Sopenharmony_ci#define AURORA_ERR_ATTR_SRC_MSK            \
6362306a36Sopenharmony_ci	(0x7 << AURORA_ERR_ATTR_SRC_OFF)
6462306a36Sopenharmony_ci#define AURORA_ERR_ATTR_TXN_OFF           12
6562306a36Sopenharmony_ci#define AURORA_ERR_ATTR_TXN_MSK            \
6662306a36Sopenharmony_ci	(0xf << AURORA_ERR_ATTR_TXN_OFF)
6762306a36Sopenharmony_ci#define AURORA_ERR_ATTR_ERR_OFF            8
6862306a36Sopenharmony_ci#define AURORA_ERR_ATTR_ERR_MSK            \
6962306a36Sopenharmony_ci	(0x3 << AURORA_ERR_ATTR_ERR_OFF)
7062306a36Sopenharmony_ci#define AURORA_ERR_ATTR_CAP_VALID_OFF      0
7162306a36Sopenharmony_ci#define AURORA_ERR_ATTR_CAP_VALID          \
7262306a36Sopenharmony_ci	(0x1 << AURORA_ERR_ATTR_CAP_VALID_OFF)
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci#define AURORA_ERR_ADDR_CAP_ADDR_MASK 0xffffffe0
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci#define AURORA_ERR_WAY_IDX_OFF             8
7762306a36Sopenharmony_ci#define AURORA_ERR_WAY_IDX_MSK             \
7862306a36Sopenharmony_ci	(0xfff << AURORA_ERR_WAY_IDX_OFF)
7962306a36Sopenharmony_ci#define AURORA_ERR_WAY_CAP_WAY_OFFSET      1
8062306a36Sopenharmony_ci#define AURORA_ERR_WAY_CAP_WAY_MASK        \
8162306a36Sopenharmony_ci	(0xf << AURORA_ERR_WAY_CAP_WAY_OFFSET)
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci#define AURORA_ERR_INJECT_CTL_ADDR_MASK 0xfffffff0
8462306a36Sopenharmony_ci#define AURORA_ERR_ATTR_TXN_OFF   12
8562306a36Sopenharmony_ci#define AURORA_ERR_INJECT_CTL_EN_MASK          0x3
8662306a36Sopenharmony_ci#define AURORA_ERR_INJECT_CTL_EN_PARITY        0x2
8762306a36Sopenharmony_ci#define AURORA_ERR_INJECT_CTL_EN_ECC           0x1
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci#define AURORA_MAX_RANGE_SIZE	1024
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci#define AURORA_WAY_SIZE_SHIFT	2
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci#define AURORA_CTRL_FW		0x100
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci/* chose a number outside L2X0_CACHE_ID_PART_MASK to be sure to make
9662306a36Sopenharmony_ci * the distinction between a number coming from hardware and a number
9762306a36Sopenharmony_ci * coming from the device tree */
9862306a36Sopenharmony_ci#define AURORA_CACHE_ID	       0x100
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci#endif /* __ASM_ARM_HARDWARE_AURORA_L2_H */
101