18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ATMEL_AES_REGS_H__
38c2ecf20Sopenharmony_ci#define __ATMEL_AES_REGS_H__
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#define AES_CR			0x00
68c2ecf20Sopenharmony_ci#define AES_CR_START		(1 << 0)
78c2ecf20Sopenharmony_ci#define AES_CR_SWRST		(1 << 8)
88c2ecf20Sopenharmony_ci#define AES_CR_LOADSEED		(1 << 16)
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#define	AES_MR			0x04
118c2ecf20Sopenharmony_ci#define AES_MR_CYPHER_DEC		(0 << 0)
128c2ecf20Sopenharmony_ci#define AES_MR_CYPHER_ENC		(1 << 0)
138c2ecf20Sopenharmony_ci#define AES_MR_GTAGEN			(1 << 1)
148c2ecf20Sopenharmony_ci#define	AES_MR_DUALBUFF			(1 << 3)
158c2ecf20Sopenharmony_ci#define AES_MR_PROCDLY_MASK		(0xF << 4)
168c2ecf20Sopenharmony_ci#define AES_MR_PROCDLY_OFFSET	4
178c2ecf20Sopenharmony_ci#define AES_MR_SMOD_MASK		(0x3 << 8)
188c2ecf20Sopenharmony_ci#define AES_MR_SMOD_MANUAL		(0x0 << 8)
198c2ecf20Sopenharmony_ci#define AES_MR_SMOD_AUTO		(0x1 << 8)
208c2ecf20Sopenharmony_ci#define AES_MR_SMOD_IDATAR0		(0x2 << 8)
218c2ecf20Sopenharmony_ci#define	AES_MR_KEYSIZE_MASK		(0x3 << 10)
228c2ecf20Sopenharmony_ci#define	AES_MR_KEYSIZE_128		(0x0 << 10)
238c2ecf20Sopenharmony_ci#define	AES_MR_KEYSIZE_192		(0x1 << 10)
248c2ecf20Sopenharmony_ci#define	AES_MR_KEYSIZE_256		(0x2 << 10)
258c2ecf20Sopenharmony_ci#define AES_MR_OPMOD_MASK		(0x7 << 12)
268c2ecf20Sopenharmony_ci#define AES_MR_OPMOD_ECB		(0x0 << 12)
278c2ecf20Sopenharmony_ci#define AES_MR_OPMOD_CBC		(0x1 << 12)
288c2ecf20Sopenharmony_ci#define AES_MR_OPMOD_OFB		(0x2 << 12)
298c2ecf20Sopenharmony_ci#define AES_MR_OPMOD_CFB		(0x3 << 12)
308c2ecf20Sopenharmony_ci#define AES_MR_OPMOD_CTR		(0x4 << 12)
318c2ecf20Sopenharmony_ci#define AES_MR_OPMOD_GCM		(0x5 << 12)
328c2ecf20Sopenharmony_ci#define AES_MR_OPMOD_XTS		(0x6 << 12)
338c2ecf20Sopenharmony_ci#define AES_MR_LOD				(0x1 << 15)
348c2ecf20Sopenharmony_ci#define AES_MR_CFBS_MASK		(0x7 << 16)
358c2ecf20Sopenharmony_ci#define AES_MR_CFBS_128b		(0x0 << 16)
368c2ecf20Sopenharmony_ci#define AES_MR_CFBS_64b			(0x1 << 16)
378c2ecf20Sopenharmony_ci#define AES_MR_CFBS_32b			(0x2 << 16)
388c2ecf20Sopenharmony_ci#define AES_MR_CFBS_16b			(0x3 << 16)
398c2ecf20Sopenharmony_ci#define AES_MR_CFBS_8b			(0x4 << 16)
408c2ecf20Sopenharmony_ci#define AES_MR_CKEY_MASK		(0xF << 20)
418c2ecf20Sopenharmony_ci#define AES_MR_CKEY_OFFSET		20
428c2ecf20Sopenharmony_ci#define AES_MR_CMTYP_MASK		(0x1F << 24)
438c2ecf20Sopenharmony_ci#define AES_MR_CMTYP_OFFSET		24
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define	AES_IER		0x10
468c2ecf20Sopenharmony_ci#define	AES_IDR		0x14
478c2ecf20Sopenharmony_ci#define	AES_IMR		0x18
488c2ecf20Sopenharmony_ci#define	AES_ISR		0x1C
498c2ecf20Sopenharmony_ci#define AES_INT_DATARDY		(1 << 0)
508c2ecf20Sopenharmony_ci#define AES_INT_URAD		(1 << 8)
518c2ecf20Sopenharmony_ci#define AES_INT_TAGRDY		(1 << 16)
528c2ecf20Sopenharmony_ci#define AES_ISR_URAT_MASK	(0xF << 12)
538c2ecf20Sopenharmony_ci#define AES_ISR_URAT_IDR_WR_PROC	(0x0 << 12)
548c2ecf20Sopenharmony_ci#define AES_ISR_URAT_ODR_RD_PROC	(0x1 << 12)
558c2ecf20Sopenharmony_ci#define AES_ISR_URAT_MR_WR_PROC		(0x2 << 12)
568c2ecf20Sopenharmony_ci#define AES_ISR_URAT_ODR_RD_SUBK	(0x3 << 12)
578c2ecf20Sopenharmony_ci#define AES_ISR_URAT_MR_WR_SUBK		(0x4 << 12)
588c2ecf20Sopenharmony_ci#define AES_ISR_URAT_WOR_RD			(0x5 << 12)
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#define AES_KEYWR(x)	(0x20 + ((x) * 0x04))
618c2ecf20Sopenharmony_ci#define AES_IDATAR(x)	(0x40 + ((x) * 0x04))
628c2ecf20Sopenharmony_ci#define AES_ODATAR(x)	(0x50 + ((x) * 0x04))
638c2ecf20Sopenharmony_ci#define AES_IVR(x)		(0x60 + ((x) * 0x04))
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#define AES_AADLENR	0x70
668c2ecf20Sopenharmony_ci#define AES_CLENR	0x74
678c2ecf20Sopenharmony_ci#define AES_GHASHR(x)	(0x78 + ((x) * 0x04))
688c2ecf20Sopenharmony_ci#define AES_TAGR(x)	(0x88 + ((x) * 0x04))
698c2ecf20Sopenharmony_ci#define AES_CTRR	0x98
708c2ecf20Sopenharmony_ci#define AES_GCMHR(x)	(0x9c + ((x) * 0x04))
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#define AES_EMR		0xb0
738c2ecf20Sopenharmony_ci#define AES_EMR_APEN		BIT(0)	/* Auto Padding Enable */
748c2ecf20Sopenharmony_ci#define AES_EMR_APM		BIT(1)	/* Auto Padding Mode */
758c2ecf20Sopenharmony_ci#define AES_EMR_APM_IPSEC	0x0
768c2ecf20Sopenharmony_ci#define AES_EMR_APM_SSL		BIT(1)
778c2ecf20Sopenharmony_ci#define AES_EMR_PLIPEN		BIT(4)	/* PLIP Enable */
788c2ecf20Sopenharmony_ci#define AES_EMR_PLIPD		BIT(5)	/* PLIP Decipher */
798c2ecf20Sopenharmony_ci#define AES_EMR_PADLEN_MASK	(0xFu << 8)
808c2ecf20Sopenharmony_ci#define AES_EMR_PADLEN_OFFSET	8
818c2ecf20Sopenharmony_ci#define AES_EMR_PADLEN(padlen)	(((padlen) << AES_EMR_PADLEN_OFFSET) &\
828c2ecf20Sopenharmony_ci				 AES_EMR_PADLEN_MASK)
838c2ecf20Sopenharmony_ci#define AES_EMR_NHEAD_MASK	(0xFu << 16)
848c2ecf20Sopenharmony_ci#define AES_EMR_NHEAD_OFFSET	16
858c2ecf20Sopenharmony_ci#define AES_EMR_NHEAD(nhead)	(((nhead) << AES_EMR_NHEAD_OFFSET) &\
868c2ecf20Sopenharmony_ci				 AES_EMR_NHEAD_MASK)
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci#define AES_TWR(x)	(0xc0 + ((x) * 0x04))
898c2ecf20Sopenharmony_ci#define AES_ALPHAR(x)	(0xd0 + ((x) * 0x04))
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#define AES_HW_VERSION	0xFC
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#endif /* __ATMEL_AES_REGS_H__ */
94