162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef __ATMEL_AES_REGS_H__
362306a36Sopenharmony_ci#define __ATMEL_AES_REGS_H__
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#define AES_CR			0x00
662306a36Sopenharmony_ci#define AES_CR_START		(1 << 0)
762306a36Sopenharmony_ci#define AES_CR_SWRST		(1 << 8)
862306a36Sopenharmony_ci#define AES_CR_LOADSEED		(1 << 16)
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#define	AES_MR			0x04
1162306a36Sopenharmony_ci#define AES_MR_CYPHER_DEC		(0 << 0)
1262306a36Sopenharmony_ci#define AES_MR_CYPHER_ENC		(1 << 0)
1362306a36Sopenharmony_ci#define AES_MR_GTAGEN			(1 << 1)
1462306a36Sopenharmony_ci#define	AES_MR_DUALBUFF			(1 << 3)
1562306a36Sopenharmony_ci#define AES_MR_PROCDLY_MASK		(0xF << 4)
1662306a36Sopenharmony_ci#define AES_MR_PROCDLY_OFFSET	4
1762306a36Sopenharmony_ci#define AES_MR_SMOD_MASK		(0x3 << 8)
1862306a36Sopenharmony_ci#define AES_MR_SMOD_MANUAL		(0x0 << 8)
1962306a36Sopenharmony_ci#define AES_MR_SMOD_AUTO		(0x1 << 8)
2062306a36Sopenharmony_ci#define AES_MR_SMOD_IDATAR0		(0x2 << 8)
2162306a36Sopenharmony_ci#define	AES_MR_KEYSIZE_MASK		(0x3 << 10)
2262306a36Sopenharmony_ci#define	AES_MR_KEYSIZE_128		(0x0 << 10)
2362306a36Sopenharmony_ci#define	AES_MR_KEYSIZE_192		(0x1 << 10)
2462306a36Sopenharmony_ci#define	AES_MR_KEYSIZE_256		(0x2 << 10)
2562306a36Sopenharmony_ci#define AES_MR_OPMOD_MASK		(0x7 << 12)
2662306a36Sopenharmony_ci#define AES_MR_OPMOD_ECB		(0x0 << 12)
2762306a36Sopenharmony_ci#define AES_MR_OPMOD_CBC		(0x1 << 12)
2862306a36Sopenharmony_ci#define AES_MR_OPMOD_OFB		(0x2 << 12)
2962306a36Sopenharmony_ci#define AES_MR_OPMOD_CFB		(0x3 << 12)
3062306a36Sopenharmony_ci#define AES_MR_OPMOD_CTR		(0x4 << 12)
3162306a36Sopenharmony_ci#define AES_MR_OPMOD_GCM		(0x5 << 12)
3262306a36Sopenharmony_ci#define AES_MR_OPMOD_XTS		(0x6 << 12)
3362306a36Sopenharmony_ci#define AES_MR_LOD				(0x1 << 15)
3462306a36Sopenharmony_ci#define AES_MR_CFBS_MASK		(0x7 << 16)
3562306a36Sopenharmony_ci#define AES_MR_CFBS_128b		(0x0 << 16)
3662306a36Sopenharmony_ci#define AES_MR_CFBS_64b			(0x1 << 16)
3762306a36Sopenharmony_ci#define AES_MR_CFBS_32b			(0x2 << 16)
3862306a36Sopenharmony_ci#define AES_MR_CFBS_16b			(0x3 << 16)
3962306a36Sopenharmony_ci#define AES_MR_CFBS_8b			(0x4 << 16)
4062306a36Sopenharmony_ci#define AES_MR_CKEY_MASK		(0xF << 20)
4162306a36Sopenharmony_ci#define AES_MR_CKEY_OFFSET		20
4262306a36Sopenharmony_ci#define AES_MR_CMTYP_MASK		(0x1F << 24)
4362306a36Sopenharmony_ci#define AES_MR_CMTYP_OFFSET		24
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#define	AES_IER		0x10
4662306a36Sopenharmony_ci#define	AES_IDR		0x14
4762306a36Sopenharmony_ci#define	AES_IMR		0x18
4862306a36Sopenharmony_ci#define	AES_ISR		0x1C
4962306a36Sopenharmony_ci#define AES_INT_DATARDY		(1 << 0)
5062306a36Sopenharmony_ci#define AES_INT_URAD		(1 << 8)
5162306a36Sopenharmony_ci#define AES_INT_TAGRDY		(1 << 16)
5262306a36Sopenharmony_ci#define AES_ISR_URAT_MASK	(0xF << 12)
5362306a36Sopenharmony_ci#define AES_ISR_URAT_IDR_WR_PROC	(0x0 << 12)
5462306a36Sopenharmony_ci#define AES_ISR_URAT_ODR_RD_PROC	(0x1 << 12)
5562306a36Sopenharmony_ci#define AES_ISR_URAT_MR_WR_PROC		(0x2 << 12)
5662306a36Sopenharmony_ci#define AES_ISR_URAT_ODR_RD_SUBK	(0x3 << 12)
5762306a36Sopenharmony_ci#define AES_ISR_URAT_MR_WR_SUBK		(0x4 << 12)
5862306a36Sopenharmony_ci#define AES_ISR_URAT_WOR_RD			(0x5 << 12)
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci#define AES_KEYWR(x)	(0x20 + ((x) * 0x04))
6162306a36Sopenharmony_ci#define AES_IDATAR(x)	(0x40 + ((x) * 0x04))
6262306a36Sopenharmony_ci#define AES_ODATAR(x)	(0x50 + ((x) * 0x04))
6362306a36Sopenharmony_ci#define AES_IVR(x)		(0x60 + ((x) * 0x04))
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci#define AES_AADLENR	0x70
6662306a36Sopenharmony_ci#define AES_CLENR	0x74
6762306a36Sopenharmony_ci#define AES_GHASHR(x)	(0x78 + ((x) * 0x04))
6862306a36Sopenharmony_ci#define AES_TAGR(x)	(0x88 + ((x) * 0x04))
6962306a36Sopenharmony_ci#define AES_CTRR	0x98
7062306a36Sopenharmony_ci#define AES_GCMHR(x)	(0x9c + ((x) * 0x04))
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci#define AES_EMR		0xb0
7362306a36Sopenharmony_ci#define AES_EMR_APEN		BIT(0)	/* Auto Padding Enable */
7462306a36Sopenharmony_ci#define AES_EMR_APM		BIT(1)	/* Auto Padding Mode */
7562306a36Sopenharmony_ci#define AES_EMR_APM_IPSEC	0x0
7662306a36Sopenharmony_ci#define AES_EMR_APM_SSL		BIT(1)
7762306a36Sopenharmony_ci#define AES_EMR_PLIPEN		BIT(4)	/* PLIP Enable */
7862306a36Sopenharmony_ci#define AES_EMR_PLIPD		BIT(5)	/* PLIP Decipher */
7962306a36Sopenharmony_ci#define AES_EMR_PADLEN_MASK	(0xFu << 8)
8062306a36Sopenharmony_ci#define AES_EMR_PADLEN_OFFSET	8
8162306a36Sopenharmony_ci#define AES_EMR_PADLEN(padlen)	(((padlen) << AES_EMR_PADLEN_OFFSET) &\
8262306a36Sopenharmony_ci				 AES_EMR_PADLEN_MASK)
8362306a36Sopenharmony_ci#define AES_EMR_NHEAD_MASK	(0xFu << 16)
8462306a36Sopenharmony_ci#define AES_EMR_NHEAD_OFFSET	16
8562306a36Sopenharmony_ci#define AES_EMR_NHEAD(nhead)	(((nhead) << AES_EMR_NHEAD_OFFSET) &\
8662306a36Sopenharmony_ci				 AES_EMR_NHEAD_MASK)
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci#define AES_TWR(x)	(0xc0 + ((x) * 0x04))
8962306a36Sopenharmony_ci#define AES_ALPHAR(x)	(0xd0 + ((x) * 0x04))
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci#define AES_HW_VERSION	0xFC
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci#endif /* __ATMEL_AES_REGS_H__ */
94