xref: /linux/drivers/dma/ppc4xx/xor.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1*ce3f3cccSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
212458ea0SAnatolij Gustschin /*
312458ea0SAnatolij Gustschin  * 440SPe's XOR engines support header file
412458ea0SAnatolij Gustschin  *
512458ea0SAnatolij Gustschin  * 2006-2009 (C) DENX Software Engineering.
612458ea0SAnatolij Gustschin  *
712458ea0SAnatolij Gustschin  * Author: Yuri Tikhonov <yur@emcraft.com>
812458ea0SAnatolij Gustschin  */
912458ea0SAnatolij Gustschin 
1012458ea0SAnatolij Gustschin #ifndef _PPC440SPE_XOR_H
1112458ea0SAnatolij Gustschin #define _PPC440SPE_XOR_H
1212458ea0SAnatolij Gustschin 
1312458ea0SAnatolij Gustschin #include <linux/types.h>
1412458ea0SAnatolij Gustschin 
1512458ea0SAnatolij Gustschin /* Number of XOR engines available on the contoller */
1612458ea0SAnatolij Gustschin #define XOR_ENGINES_NUM		1
1712458ea0SAnatolij Gustschin 
1812458ea0SAnatolij Gustschin /* Number of operands supported in the h/w */
1912458ea0SAnatolij Gustschin #define XOR_MAX_OPS		16
2012458ea0SAnatolij Gustschin 
2112458ea0SAnatolij Gustschin /*
2212458ea0SAnatolij Gustschin  * XOR Command Block Control Register bits
2312458ea0SAnatolij Gustschin  */
2412458ea0SAnatolij Gustschin #define XOR_CBCR_LNK_BIT        (1<<31) /* link present */
2512458ea0SAnatolij Gustschin #define XOR_CBCR_TGT_BIT        (1<<30) /* target present */
2612458ea0SAnatolij Gustschin #define XOR_CBCR_CBCE_BIT       (1<<29) /* command block compete enable */
2712458ea0SAnatolij Gustschin #define XOR_CBCR_RNZE_BIT       (1<<28) /* result not zero enable */
2812458ea0SAnatolij Gustschin #define XOR_CBCR_XNOR_BIT       (1<<15) /* XOR/XNOR */
2912458ea0SAnatolij Gustschin #define XOR_CDCR_OAC_MSK        (0x7F)  /* operand address count */
3012458ea0SAnatolij Gustschin 
3112458ea0SAnatolij Gustschin /*
3212458ea0SAnatolij Gustschin  * XORCore Status Register bits
3312458ea0SAnatolij Gustschin  */
3412458ea0SAnatolij Gustschin #define XOR_SR_XCP_BIT		(1<<31)	/* core processing */
3512458ea0SAnatolij Gustschin #define XOR_SR_ICB_BIT		(1<<17)	/* invalid CB */
3612458ea0SAnatolij Gustschin #define XOR_SR_IC_BIT		(1<<16)	/* invalid command */
3712458ea0SAnatolij Gustschin #define XOR_SR_IPE_BIT		(1<<15)	/* internal parity error */
3812458ea0SAnatolij Gustschin #define XOR_SR_RNZ_BIT		(1<<2)	/* result not Zero */
3912458ea0SAnatolij Gustschin #define XOR_SR_CBC_BIT		(1<<1)	/* CB complete */
4012458ea0SAnatolij Gustschin #define XOR_SR_CBLC_BIT		(1<<0)	/* CB list complete */
4112458ea0SAnatolij Gustschin 
4212458ea0SAnatolij Gustschin /*
4312458ea0SAnatolij Gustschin  * XORCore Control Set and Reset Register bits
4412458ea0SAnatolij Gustschin  */
4512458ea0SAnatolij Gustschin #define XOR_CRSR_XASR_BIT	(1<<31)	/* soft reset */
4612458ea0SAnatolij Gustschin #define XOR_CRSR_XAE_BIT	(1<<30)	/* enable */
4712458ea0SAnatolij Gustschin #define XOR_CRSR_RCBE_BIT	(1<<29)	/* refetch CB enable */
4812458ea0SAnatolij Gustschin #define XOR_CRSR_PAUS_BIT	(1<<28)	/* pause */
4912458ea0SAnatolij Gustschin #define XOR_CRSR_64BA_BIT	(1<<27) /* 64/32 CB format */
5012458ea0SAnatolij Gustschin #define XOR_CRSR_CLP_BIT	(1<<25)	/* continue list processing */
5112458ea0SAnatolij Gustschin 
5212458ea0SAnatolij Gustschin /*
5312458ea0SAnatolij Gustschin  * XORCore Interrupt Enable Register
5412458ea0SAnatolij Gustschin  */
5512458ea0SAnatolij Gustschin #define XOR_IE_ICBIE_BIT	(1<<17)	/* Invalid Command Block IRQ Enable */
5612458ea0SAnatolij Gustschin #define XOR_IE_ICIE_BIT		(1<<16)	/* Invalid Command IRQ Enable */
5712458ea0SAnatolij Gustschin #define XOR_IE_RPTIE_BIT	(1<<14)	/* Read PLB Timeout Error IRQ Enable */
5812458ea0SAnatolij Gustschin #define XOR_IE_CBCIE_BIT	(1<<1)	/* CB complete interrupt enable */
5912458ea0SAnatolij Gustschin #define XOR_IE_CBLCI_BIT	(1<<0)	/* CB list complete interrupt enable */
6012458ea0SAnatolij Gustschin 
6112458ea0SAnatolij Gustschin /*
6212458ea0SAnatolij Gustschin  * XOR Accelerator engine Command Block Type
6312458ea0SAnatolij Gustschin  */
6412458ea0SAnatolij Gustschin struct xor_cb {
6512458ea0SAnatolij Gustschin 	/*
6612458ea0SAnatolij Gustschin 	 * Basic 64-bit format XOR CB (Table 19-1, p.463, 440spe_um_1_22.pdf)
6712458ea0SAnatolij Gustschin 	 */
6812458ea0SAnatolij Gustschin 	u32	cbc;		/* control */
6912458ea0SAnatolij Gustschin 	u32	cbbc;		/* byte count */
7012458ea0SAnatolij Gustschin 	u32	cbs;		/* status */
7112458ea0SAnatolij Gustschin 	u8	pad0[4];	/* reserved */
7212458ea0SAnatolij Gustschin 	u32	cbtah;		/* target address high */
7312458ea0SAnatolij Gustschin 	u32	cbtal;		/* target address low */
7412458ea0SAnatolij Gustschin 	u32	cblah;		/* link address high */
7512458ea0SAnatolij Gustschin 	u32	cblal;		/* link address low */
7612458ea0SAnatolij Gustschin 	struct {
7712458ea0SAnatolij Gustschin 		u32 h;
7812458ea0SAnatolij Gustschin 		u32 l;
7912458ea0SAnatolij Gustschin 	} __attribute__ ((packed)) ops[16];
8012458ea0SAnatolij Gustschin } __attribute__ ((packed));
8112458ea0SAnatolij Gustschin 
8212458ea0SAnatolij Gustschin /*
8312458ea0SAnatolij Gustschin  * XOR hardware registers Table 19-3, UM 1.22
8412458ea0SAnatolij Gustschin  */
8512458ea0SAnatolij Gustschin struct xor_regs {
8612458ea0SAnatolij Gustschin 	u32	op_ar[16][2];	/* operand address[0]-high,[1]-low registers */
8712458ea0SAnatolij Gustschin 	u8	pad0[352];	/* reserved */
8812458ea0SAnatolij Gustschin 	u32	cbcr;		/* CB control register */
8912458ea0SAnatolij Gustschin 	u32	cbbcr;		/* CB byte count register */
9012458ea0SAnatolij Gustschin 	u32	cbsr;		/* CB status register */
9112458ea0SAnatolij Gustschin 	u8	pad1[4];	/* reserved */
9212458ea0SAnatolij Gustschin 	u32	cbtahr;		/* operand target address high register */
9312458ea0SAnatolij Gustschin 	u32	cbtalr;		/* operand target address low register */
9412458ea0SAnatolij Gustschin 	u32	cblahr;		/* CB link address high register */
9512458ea0SAnatolij Gustschin 	u32	cblalr;		/* CB link address low register */
9612458ea0SAnatolij Gustschin 	u32	crsr;		/* control set register */
9712458ea0SAnatolij Gustschin 	u32	crrr;		/* control reset register */
9812458ea0SAnatolij Gustschin 	u32	ccbahr;		/* current CB address high register */
9912458ea0SAnatolij Gustschin 	u32	ccbalr;		/* current CB address low register */
10012458ea0SAnatolij Gustschin 	u32	plbr;		/* PLB configuration register */
10112458ea0SAnatolij Gustschin 	u32	ier;		/* interrupt enable register */
10212458ea0SAnatolij Gustschin 	u32	pecr;		/* parity error count register */
10312458ea0SAnatolij Gustschin 	u32	sr;		/* status register */
10412458ea0SAnatolij Gustschin 	u32	revidr;		/* revision ID register */
10512458ea0SAnatolij Gustschin };
10612458ea0SAnatolij Gustschin 
10712458ea0SAnatolij Gustschin #endif /* _PPC440SPE_XOR_H */
108