18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Support for MediaTek cryptographic accelerator.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2016 MediaTek Inc.
68c2ecf20Sopenharmony_ci * Author: Ryder Lee <ryder.lee@mediatek.com>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef __MTK_REGS_H__
108c2ecf20Sopenharmony_ci#define __MTK_REGS_H__
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/* HIA, Command Descriptor Ring Manager */
138c2ecf20Sopenharmony_ci#define CDR_BASE_ADDR_LO(x)		(0x0 + ((x) << 12))
148c2ecf20Sopenharmony_ci#define CDR_BASE_ADDR_HI(x)		(0x4 + ((x) << 12))
158c2ecf20Sopenharmony_ci#define CDR_DATA_BASE_ADDR_LO(x)	(0x8 + ((x) << 12))
168c2ecf20Sopenharmony_ci#define CDR_DATA_BASE_ADDR_HI(x)	(0xC + ((x) << 12))
178c2ecf20Sopenharmony_ci#define CDR_ACD_BASE_ADDR_LO(x)		(0x10 + ((x) << 12))
188c2ecf20Sopenharmony_ci#define CDR_ACD_BASE_ADDR_HI(x)		(0x14 + ((x) << 12))
198c2ecf20Sopenharmony_ci#define CDR_RING_SIZE(x)		(0x18 + ((x) << 12))
208c2ecf20Sopenharmony_ci#define CDR_DESC_SIZE(x)		(0x1C + ((x) << 12))
218c2ecf20Sopenharmony_ci#define CDR_CFG(x)			(0x20 + ((x) << 12))
228c2ecf20Sopenharmony_ci#define CDR_DMA_CFG(x)			(0x24 + ((x) << 12))
238c2ecf20Sopenharmony_ci#define CDR_THRESH(x)			(0x28 + ((x) << 12))
248c2ecf20Sopenharmony_ci#define CDR_PREP_COUNT(x)		(0x2C + ((x) << 12))
258c2ecf20Sopenharmony_ci#define CDR_PROC_COUNT(x)		(0x30 + ((x) << 12))
268c2ecf20Sopenharmony_ci#define CDR_PREP_PNTR(x)		(0x34 + ((x) << 12))
278c2ecf20Sopenharmony_ci#define CDR_PROC_PNTR(x)		(0x38 + ((x) << 12))
288c2ecf20Sopenharmony_ci#define CDR_STAT(x)			(0x3C + ((x) << 12))
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/* HIA, Result Descriptor Ring Manager */
318c2ecf20Sopenharmony_ci#define RDR_BASE_ADDR_LO(x)		(0x800 + ((x) << 12))
328c2ecf20Sopenharmony_ci#define RDR_BASE_ADDR_HI(x)		(0x804 + ((x) << 12))
338c2ecf20Sopenharmony_ci#define RDR_DATA_BASE_ADDR_LO(x)	(0x808 + ((x) << 12))
348c2ecf20Sopenharmony_ci#define RDR_DATA_BASE_ADDR_HI(x)	(0x80C + ((x) << 12))
358c2ecf20Sopenharmony_ci#define RDR_ACD_BASE_ADDR_LO(x)		(0x810 + ((x) << 12))
368c2ecf20Sopenharmony_ci#define RDR_ACD_BASE_ADDR_HI(x)		(0x814 + ((x) << 12))
378c2ecf20Sopenharmony_ci#define RDR_RING_SIZE(x)		(0x818 + ((x) << 12))
388c2ecf20Sopenharmony_ci#define RDR_DESC_SIZE(x)		(0x81C + ((x) << 12))
398c2ecf20Sopenharmony_ci#define RDR_CFG(x)			(0x820 + ((x) << 12))
408c2ecf20Sopenharmony_ci#define RDR_DMA_CFG(x)			(0x824 + ((x) << 12))
418c2ecf20Sopenharmony_ci#define RDR_THRESH(x)			(0x828 + ((x) << 12))
428c2ecf20Sopenharmony_ci#define RDR_PREP_COUNT(x)		(0x82C + ((x) << 12))
438c2ecf20Sopenharmony_ci#define RDR_PROC_COUNT(x)		(0x830 + ((x) << 12))
448c2ecf20Sopenharmony_ci#define RDR_PREP_PNTR(x)		(0x834 + ((x) << 12))
458c2ecf20Sopenharmony_ci#define RDR_PROC_PNTR(x)		(0x838 + ((x) << 12))
468c2ecf20Sopenharmony_ci#define RDR_STAT(x)			(0x83C + ((x) << 12))
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/* HIA, Ring AIC */
498c2ecf20Sopenharmony_ci#define AIC_POL_CTRL(x)			(0xE000 - ((x) << 12))
508c2ecf20Sopenharmony_ci#define	AIC_TYPE_CTRL(x)		(0xE004 - ((x) << 12))
518c2ecf20Sopenharmony_ci#define	AIC_ENABLE_CTRL(x)		(0xE008 - ((x) << 12))
528c2ecf20Sopenharmony_ci#define	AIC_RAW_STAL(x)			(0xE00C - ((x) << 12))
538c2ecf20Sopenharmony_ci#define	AIC_ENABLE_SET(x)		(0xE00C - ((x) << 12))
548c2ecf20Sopenharmony_ci#define	AIC_ENABLED_STAT(x)		(0xE010 - ((x) << 12))
558c2ecf20Sopenharmony_ci#define	AIC_ACK(x)			(0xE010 - ((x) << 12))
568c2ecf20Sopenharmony_ci#define	AIC_ENABLE_CLR(x)		(0xE014 - ((x) << 12))
578c2ecf20Sopenharmony_ci#define	AIC_OPTIONS(x)			(0xE018 - ((x) << 12))
588c2ecf20Sopenharmony_ci#define	AIC_VERSION(x)			(0xE01C - ((x) << 12))
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci/* HIA, Global AIC */
618c2ecf20Sopenharmony_ci#define AIC_G_POL_CTRL			0xF800
628c2ecf20Sopenharmony_ci#define AIC_G_TYPE_CTRL			0xF804
638c2ecf20Sopenharmony_ci#define AIC_G_ENABLE_CTRL		0xF808
648c2ecf20Sopenharmony_ci#define AIC_G_RAW_STAT			0xF80C
658c2ecf20Sopenharmony_ci#define AIC_G_ENABLE_SET		0xF80C
668c2ecf20Sopenharmony_ci#define AIC_G_ENABLED_STAT		0xF810
678c2ecf20Sopenharmony_ci#define AIC_G_ACK			0xF810
688c2ecf20Sopenharmony_ci#define AIC_G_ENABLE_CLR		0xF814
698c2ecf20Sopenharmony_ci#define AIC_G_OPTIONS			0xF818
708c2ecf20Sopenharmony_ci#define AIC_G_VERSION			0xF81C
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci/* HIA, Data Fetch Engine */
738c2ecf20Sopenharmony_ci#define DFE_CFG				0xF000
748c2ecf20Sopenharmony_ci#define DFE_PRIO_0			0xF010
758c2ecf20Sopenharmony_ci#define DFE_PRIO_1			0xF014
768c2ecf20Sopenharmony_ci#define DFE_PRIO_2			0xF018
778c2ecf20Sopenharmony_ci#define DFE_PRIO_3			0xF01C
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/* HIA, Data Fetch Engine access monitoring for CDR */
808c2ecf20Sopenharmony_ci#define DFE_RING_REGION_LO(x)		(0xF080 + ((x) << 3))
818c2ecf20Sopenharmony_ci#define DFE_RING_REGION_HI(x)		(0xF084 + ((x) << 3))
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci/* HIA, Data Fetch Engine thread control and status for thread */
848c2ecf20Sopenharmony_ci#define DFE_THR_CTRL			0xF200
858c2ecf20Sopenharmony_ci#define DFE_THR_STAT			0xF204
868c2ecf20Sopenharmony_ci#define DFE_THR_DESC_CTRL		0xF208
878c2ecf20Sopenharmony_ci#define DFE_THR_DESC_DPTR_LO		0xF210
888c2ecf20Sopenharmony_ci#define DFE_THR_DESC_DPTR_HI		0xF214
898c2ecf20Sopenharmony_ci#define DFE_THR_DESC_ACDPTR_LO		0xF218
908c2ecf20Sopenharmony_ci#define DFE_THR_DESC_ACDPTR_HI		0xF21C
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci/* HIA, Data Store Engine */
938c2ecf20Sopenharmony_ci#define DSE_CFG				0xF400
948c2ecf20Sopenharmony_ci#define DSE_PRIO_0			0xF410
958c2ecf20Sopenharmony_ci#define DSE_PRIO_1			0xF414
968c2ecf20Sopenharmony_ci#define DSE_PRIO_2			0xF418
978c2ecf20Sopenharmony_ci#define DSE_PRIO_3			0xF41C
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci/* HIA, Data Store Engine access monitoring for RDR */
1008c2ecf20Sopenharmony_ci#define DSE_RING_REGION_LO(x)		(0xF480 + ((x) << 3))
1018c2ecf20Sopenharmony_ci#define DSE_RING_REGION_HI(x)		(0xF484 + ((x) << 3))
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci/* HIA, Data Store Engine thread control and status for thread */
1048c2ecf20Sopenharmony_ci#define DSE_THR_CTRL			0xF600
1058c2ecf20Sopenharmony_ci#define DSE_THR_STAT			0xF604
1068c2ecf20Sopenharmony_ci#define DSE_THR_DESC_CTRL		0xF608
1078c2ecf20Sopenharmony_ci#define DSE_THR_DESC_DPTR_LO		0xF610
1088c2ecf20Sopenharmony_ci#define DSE_THR_DESC_DPTR_HI		0xF614
1098c2ecf20Sopenharmony_ci#define DSE_THR_DESC_S_DPTR_LO		0xF618
1108c2ecf20Sopenharmony_ci#define DSE_THR_DESC_S_DPTR_HI		0xF61C
1118c2ecf20Sopenharmony_ci#define DSE_THR_ERROR_STAT		0xF620
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci/* HIA Global */
1148c2ecf20Sopenharmony_ci#define HIA_MST_CTRL			0xFFF4
1158c2ecf20Sopenharmony_ci#define HIA_OPTIONS			0xFFF8
1168c2ecf20Sopenharmony_ci#define HIA_VERSION			0xFFFC
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci/* Processing Engine Input Side, Processing Engine */
1198c2ecf20Sopenharmony_ci#define PE_IN_DBUF_THRESH		0x10000
1208c2ecf20Sopenharmony_ci#define PE_IN_TBUF_THRESH		0x10100
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci/* Packet Engine Configuration / Status Registers */
1238c2ecf20Sopenharmony_ci#define PE_TOKEN_CTRL_STAT		0x11000
1248c2ecf20Sopenharmony_ci#define PE_FUNCTION_EN			0x11004
1258c2ecf20Sopenharmony_ci#define PE_CONTEXT_CTRL			0x11008
1268c2ecf20Sopenharmony_ci#define PE_INTERRUPT_CTRL_STAT		0x11010
1278c2ecf20Sopenharmony_ci#define PE_CONTEXT_STAT			0x1100C
1288c2ecf20Sopenharmony_ci#define PE_OUT_TRANS_CTRL_STAT		0x11018
1298c2ecf20Sopenharmony_ci#define PE_OUT_BUF_CTRL			0x1101C
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci/* Packet Engine PRNG Registers */
1328c2ecf20Sopenharmony_ci#define PE_PRNG_STAT			0x11040
1338c2ecf20Sopenharmony_ci#define PE_PRNG_CTRL			0x11044
1348c2ecf20Sopenharmony_ci#define PE_PRNG_SEED_L			0x11048
1358c2ecf20Sopenharmony_ci#define PE_PRNG_SEED_H			0x1104C
1368c2ecf20Sopenharmony_ci#define PE_PRNG_KEY_0_L			0x11050
1378c2ecf20Sopenharmony_ci#define PE_PRNG_KEY_0_H			0x11054
1388c2ecf20Sopenharmony_ci#define PE_PRNG_KEY_1_L			0x11058
1398c2ecf20Sopenharmony_ci#define PE_PRNG_KEY_1_H			0x1105C
1408c2ecf20Sopenharmony_ci#define PE_PRNG_RES_0			0x11060
1418c2ecf20Sopenharmony_ci#define PE_PRNG_RES_1			0x11064
1428c2ecf20Sopenharmony_ci#define PE_PRNG_RES_2			0x11068
1438c2ecf20Sopenharmony_ci#define PE_PRNG_RES_3			0x1106C
1448c2ecf20Sopenharmony_ci#define PE_PRNG_LFSR_L			0x11070
1458c2ecf20Sopenharmony_ci#define PE_PRNG_LFSR_H			0x11074
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci/* Packet Engine AIC */
1488c2ecf20Sopenharmony_ci#define PE_EIP96_AIC_POL_CTRL		0x113C0
1498c2ecf20Sopenharmony_ci#define PE_EIP96_AIC_TYPE_CTRL		0x113C4
1508c2ecf20Sopenharmony_ci#define PE_EIP96_AIC_ENABLE_CTRL	0x113C8
1518c2ecf20Sopenharmony_ci#define PE_EIP96_AIC_RAW_STAT		0x113CC
1528c2ecf20Sopenharmony_ci#define PE_EIP96_AIC_ENABLE_SET		0x113CC
1538c2ecf20Sopenharmony_ci#define PE_EIP96_AIC_ENABLED_STAT	0x113D0
1548c2ecf20Sopenharmony_ci#define PE_EIP96_AIC_ACK		0x113D0
1558c2ecf20Sopenharmony_ci#define PE_EIP96_AIC_ENABLE_CLR		0x113D4
1568c2ecf20Sopenharmony_ci#define PE_EIP96_AIC_OPTIONS		0x113D8
1578c2ecf20Sopenharmony_ci#define PE_EIP96_AIC_VERSION		0x113DC
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci/* Packet Engine Options & Version Registers */
1608c2ecf20Sopenharmony_ci#define PE_EIP96_OPTIONS		0x113F8
1618c2ecf20Sopenharmony_ci#define PE_EIP96_VERSION		0x113FC
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci/* Processing Engine Output Side */
1648c2ecf20Sopenharmony_ci#define PE_OUT_DBUF_THRESH		0x11C00
1658c2ecf20Sopenharmony_ci#define PE_OUT_TBUF_THRESH		0x11D00
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci/* Processing Engine Local AIC */
1688c2ecf20Sopenharmony_ci#define PE_AIC_POL_CTRL			0x11F00
1698c2ecf20Sopenharmony_ci#define PE_AIC_TYPE_CTRL		0x11F04
1708c2ecf20Sopenharmony_ci#define PE_AIC_ENABLE_CTRL		0x11F08
1718c2ecf20Sopenharmony_ci#define PE_AIC_RAW_STAT			0x11F0C
1728c2ecf20Sopenharmony_ci#define PE_AIC_ENABLE_SET		0x11F0C
1738c2ecf20Sopenharmony_ci#define PE_AIC_ENABLED_STAT		0x11F10
1748c2ecf20Sopenharmony_ci#define PE_AIC_ENABLE_CLR		0x11F14
1758c2ecf20Sopenharmony_ci#define PE_AIC_OPTIONS			0x11F18
1768c2ecf20Sopenharmony_ci#define PE_AIC_VERSION			0x11F1C
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci/* Processing Engine General Configuration and Version */
1798c2ecf20Sopenharmony_ci#define PE_IN_FLIGHT			0x11FF0
1808c2ecf20Sopenharmony_ci#define PE_OPTIONS			0x11FF8
1818c2ecf20Sopenharmony_ci#define PE_VERSION			0x11FFC
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci/* EIP-97 - Global */
1848c2ecf20Sopenharmony_ci#define EIP97_CLOCK_STATE		0x1FFE4
1858c2ecf20Sopenharmony_ci#define EIP97_FORCE_CLOCK_ON		0x1FFE8
1868c2ecf20Sopenharmony_ci#define EIP97_FORCE_CLOCK_OFF		0x1FFEC
1878c2ecf20Sopenharmony_ci#define EIP97_MST_CTRL			0x1FFF4
1888c2ecf20Sopenharmony_ci#define EIP97_OPTIONS			0x1FFF8
1898c2ecf20Sopenharmony_ci#define EIP97_VERSION			0x1FFFC
1908c2ecf20Sopenharmony_ci#endif /* __MTK_REGS_H__ */
191