18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * 440SPe's XOR engines support header file
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * 2006-2009 (C) DENX Software Engineering.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Author: Yuri Tikhonov <yur@emcraft.com>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * This file is licensed under the term of  the GNU General Public License
98c2ecf20Sopenharmony_ci * version 2. The program licensed "as is" without any warranty of any
108c2ecf20Sopenharmony_ci * kind, whether express or implied.
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#ifndef _PPC440SPE_XOR_H
148c2ecf20Sopenharmony_ci#define _PPC440SPE_XOR_H
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include <linux/types.h>
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* Number of XOR engines available on the contoller */
198c2ecf20Sopenharmony_ci#define XOR_ENGINES_NUM		1
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* Number of operands supported in the h/w */
228c2ecf20Sopenharmony_ci#define XOR_MAX_OPS		16
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci/*
258c2ecf20Sopenharmony_ci * XOR Command Block Control Register bits
268c2ecf20Sopenharmony_ci */
278c2ecf20Sopenharmony_ci#define XOR_CBCR_LNK_BIT        (1<<31) /* link present */
288c2ecf20Sopenharmony_ci#define XOR_CBCR_TGT_BIT        (1<<30) /* target present */
298c2ecf20Sopenharmony_ci#define XOR_CBCR_CBCE_BIT       (1<<29) /* command block compete enable */
308c2ecf20Sopenharmony_ci#define XOR_CBCR_RNZE_BIT       (1<<28) /* result not zero enable */
318c2ecf20Sopenharmony_ci#define XOR_CBCR_XNOR_BIT       (1<<15) /* XOR/XNOR */
328c2ecf20Sopenharmony_ci#define XOR_CDCR_OAC_MSK        (0x7F)  /* operand address count */
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/*
358c2ecf20Sopenharmony_ci * XORCore Status Register bits
368c2ecf20Sopenharmony_ci */
378c2ecf20Sopenharmony_ci#define XOR_SR_XCP_BIT		(1<<31)	/* core processing */
388c2ecf20Sopenharmony_ci#define XOR_SR_ICB_BIT		(1<<17)	/* invalid CB */
398c2ecf20Sopenharmony_ci#define XOR_SR_IC_BIT		(1<<16)	/* invalid command */
408c2ecf20Sopenharmony_ci#define XOR_SR_IPE_BIT		(1<<15)	/* internal parity error */
418c2ecf20Sopenharmony_ci#define XOR_SR_RNZ_BIT		(1<<2)	/* result not Zero */
428c2ecf20Sopenharmony_ci#define XOR_SR_CBC_BIT		(1<<1)	/* CB complete */
438c2ecf20Sopenharmony_ci#define XOR_SR_CBLC_BIT		(1<<0)	/* CB list complete */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/*
468c2ecf20Sopenharmony_ci * XORCore Control Set and Reset Register bits
478c2ecf20Sopenharmony_ci */
488c2ecf20Sopenharmony_ci#define XOR_CRSR_XASR_BIT	(1<<31)	/* soft reset */
498c2ecf20Sopenharmony_ci#define XOR_CRSR_XAE_BIT	(1<<30)	/* enable */
508c2ecf20Sopenharmony_ci#define XOR_CRSR_RCBE_BIT	(1<<29)	/* refetch CB enable */
518c2ecf20Sopenharmony_ci#define XOR_CRSR_PAUS_BIT	(1<<28)	/* pause */
528c2ecf20Sopenharmony_ci#define XOR_CRSR_64BA_BIT	(1<<27) /* 64/32 CB format */
538c2ecf20Sopenharmony_ci#define XOR_CRSR_CLP_BIT	(1<<25)	/* continue list processing */
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci/*
568c2ecf20Sopenharmony_ci * XORCore Interrupt Enable Register
578c2ecf20Sopenharmony_ci */
588c2ecf20Sopenharmony_ci#define XOR_IE_ICBIE_BIT	(1<<17)	/* Invalid Command Block IRQ Enable */
598c2ecf20Sopenharmony_ci#define XOR_IE_ICIE_BIT		(1<<16)	/* Invalid Command IRQ Enable */
608c2ecf20Sopenharmony_ci#define XOR_IE_RPTIE_BIT	(1<<14)	/* Read PLB Timeout Error IRQ Enable */
618c2ecf20Sopenharmony_ci#define XOR_IE_CBCIE_BIT	(1<<1)	/* CB complete interrupt enable */
628c2ecf20Sopenharmony_ci#define XOR_IE_CBLCI_BIT	(1<<0)	/* CB list complete interrupt enable */
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci/*
658c2ecf20Sopenharmony_ci * XOR Accelerator engine Command Block Type
668c2ecf20Sopenharmony_ci */
678c2ecf20Sopenharmony_cistruct xor_cb {
688c2ecf20Sopenharmony_ci	/*
698c2ecf20Sopenharmony_ci	 * Basic 64-bit format XOR CB (Table 19-1, p.463, 440spe_um_1_22.pdf)
708c2ecf20Sopenharmony_ci	 */
718c2ecf20Sopenharmony_ci	u32	cbc;		/* control */
728c2ecf20Sopenharmony_ci	u32	cbbc;		/* byte count */
738c2ecf20Sopenharmony_ci	u32	cbs;		/* status */
748c2ecf20Sopenharmony_ci	u8	pad0[4];	/* reserved */
758c2ecf20Sopenharmony_ci	u32	cbtah;		/* target address high */
768c2ecf20Sopenharmony_ci	u32	cbtal;		/* target address low */
778c2ecf20Sopenharmony_ci	u32	cblah;		/* link address high */
788c2ecf20Sopenharmony_ci	u32	cblal;		/* link address low */
798c2ecf20Sopenharmony_ci	struct {
808c2ecf20Sopenharmony_ci		u32 h;
818c2ecf20Sopenharmony_ci		u32 l;
828c2ecf20Sopenharmony_ci	} __attribute__ ((packed)) ops[16];
838c2ecf20Sopenharmony_ci} __attribute__ ((packed));
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci/*
868c2ecf20Sopenharmony_ci * XOR hardware registers Table 19-3, UM 1.22
878c2ecf20Sopenharmony_ci */
888c2ecf20Sopenharmony_cistruct xor_regs {
898c2ecf20Sopenharmony_ci	u32	op_ar[16][2];	/* operand address[0]-high,[1]-low registers */
908c2ecf20Sopenharmony_ci	u8	pad0[352];	/* reserved */
918c2ecf20Sopenharmony_ci	u32	cbcr;		/* CB control register */
928c2ecf20Sopenharmony_ci	u32	cbbcr;		/* CB byte count register */
938c2ecf20Sopenharmony_ci	u32	cbsr;		/* CB status register */
948c2ecf20Sopenharmony_ci	u8	pad1[4];	/* reserved */
958c2ecf20Sopenharmony_ci	u32	cbtahr;		/* operand target address high register */
968c2ecf20Sopenharmony_ci	u32	cbtalr;		/* operand target address low register */
978c2ecf20Sopenharmony_ci	u32	cblahr;		/* CB link address high register */
988c2ecf20Sopenharmony_ci	u32	cblalr;		/* CB link address low register */
998c2ecf20Sopenharmony_ci	u32	crsr;		/* control set register */
1008c2ecf20Sopenharmony_ci	u32	crrr;		/* control reset register */
1018c2ecf20Sopenharmony_ci	u32	ccbahr;		/* current CB address high register */
1028c2ecf20Sopenharmony_ci	u32	ccbalr;		/* current CB address low register */
1038c2ecf20Sopenharmony_ci	u32	plbr;		/* PLB configuration register */
1048c2ecf20Sopenharmony_ci	u32	ier;		/* interrupt enable register */
1058c2ecf20Sopenharmony_ci	u32	pecr;		/* parity error count register */
1068c2ecf20Sopenharmony_ci	u32	sr;		/* status register */
1078c2ecf20Sopenharmony_ci	u32	revidr;		/* revision ID register */
1088c2ecf20Sopenharmony_ci};
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci#endif /* _PPC440SPE_XOR_H */
111