xref: /openbmc/linux/drivers/media/platform/st/stm32/dma2d/dma2d-regs.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1*e7b8153eSMauro Carvalho Chehab /* SPDX-License-Identifier: GPL-2.0-or-later */
2*e7b8153eSMauro Carvalho Chehab /*
3*e7b8153eSMauro Carvalho Chehab  * ST stm32 Chrom-Art - 2D Graphics Accelerator Driver
4*e7b8153eSMauro Carvalho Chehab  *
5*e7b8153eSMauro Carvalho Chehab  * Copyright (c) 2021 Dillon Min
6*e7b8153eSMauro Carvalho Chehab  * Dillon Min, <dillon.minfei@gmail.com>
7*e7b8153eSMauro Carvalho Chehab  *
8*e7b8153eSMauro Carvalho Chehab  * based on s5p-g2d
9*e7b8153eSMauro Carvalho Chehab  *
10*e7b8153eSMauro Carvalho Chehab  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
11*e7b8153eSMauro Carvalho Chehab  * Kamil Debski, <k.debski@samsung.com>
12*e7b8153eSMauro Carvalho Chehab  */
13*e7b8153eSMauro Carvalho Chehab 
14*e7b8153eSMauro Carvalho Chehab #ifndef __DMA2D_REGS_H__
15*e7b8153eSMauro Carvalho Chehab #define __DMA2D_REGS_H__
16*e7b8153eSMauro Carvalho Chehab 
17*e7b8153eSMauro Carvalho Chehab #define DMA2D_CR_REG		0x0000
18*e7b8153eSMauro Carvalho Chehab #define CR_MODE_MASK		GENMASK(17, 16)
19*e7b8153eSMauro Carvalho Chehab #define CR_MODE_SHIFT		16
20*e7b8153eSMauro Carvalho Chehab #define CR_M2M			0x0000
21*e7b8153eSMauro Carvalho Chehab #define CR_M2M_PFC		BIT(16)
22*e7b8153eSMauro Carvalho Chehab #define CR_M2M_BLEND		BIT(17)
23*e7b8153eSMauro Carvalho Chehab #define CR_R2M			(BIT(17) | BIT(16))
24*e7b8153eSMauro Carvalho Chehab #define CR_CEIE			BIT(13)
25*e7b8153eSMauro Carvalho Chehab #define CR_CTCIE		BIT(12)
26*e7b8153eSMauro Carvalho Chehab #define CR_CAEIE		BIT(11)
27*e7b8153eSMauro Carvalho Chehab #define CR_TWIE			BIT(10)
28*e7b8153eSMauro Carvalho Chehab #define CR_TCIE			BIT(9)
29*e7b8153eSMauro Carvalho Chehab #define CR_TEIE			BIT(8)
30*e7b8153eSMauro Carvalho Chehab #define CR_ABORT		BIT(2)
31*e7b8153eSMauro Carvalho Chehab #define CR_SUSP			BIT(1)
32*e7b8153eSMauro Carvalho Chehab #define CR_START		BIT(0)
33*e7b8153eSMauro Carvalho Chehab 
34*e7b8153eSMauro Carvalho Chehab #define DMA2D_ISR_REG		0x0004
35*e7b8153eSMauro Carvalho Chehab #define ISR_CEIF		BIT(5)
36*e7b8153eSMauro Carvalho Chehab #define ISR_CTCIF		BIT(4)
37*e7b8153eSMauro Carvalho Chehab #define ISR_CAEIF		BIT(3)
38*e7b8153eSMauro Carvalho Chehab #define ISR_TWIF		BIT(2)
39*e7b8153eSMauro Carvalho Chehab #define ISR_TCIF		BIT(1)
40*e7b8153eSMauro Carvalho Chehab #define ISR_TEIF		BIT(0)
41*e7b8153eSMauro Carvalho Chehab 
42*e7b8153eSMauro Carvalho Chehab #define DMA2D_IFCR_REG		0x0008
43*e7b8153eSMauro Carvalho Chehab #define IFCR_CCEIF		BIT(5)
44*e7b8153eSMauro Carvalho Chehab #define IFCR_CCTCIF		BIT(4)
45*e7b8153eSMauro Carvalho Chehab #define IFCR_CAECIF		BIT(3)
46*e7b8153eSMauro Carvalho Chehab #define IFCR_CTWIF		BIT(2)
47*e7b8153eSMauro Carvalho Chehab #define IFCR_CTCIF		BIT(1)
48*e7b8153eSMauro Carvalho Chehab #define IFCR_CTEIF		BIT(0)
49*e7b8153eSMauro Carvalho Chehab 
50*e7b8153eSMauro Carvalho Chehab #define DMA2D_FGMAR_REG		0x000c
51*e7b8153eSMauro Carvalho Chehab #define DMA2D_FGOR_REG		0x0010
52*e7b8153eSMauro Carvalho Chehab #define FGOR_LO_MASK		GENMASK(13, 0)
53*e7b8153eSMauro Carvalho Chehab 
54*e7b8153eSMauro Carvalho Chehab #define DMA2D_BGMAR_REG		0x0014
55*e7b8153eSMauro Carvalho Chehab #define DMA2D_BGOR_REG		0x0018
56*e7b8153eSMauro Carvalho Chehab #define BGOR_LO_MASK		GENMASK(13, 0)
57*e7b8153eSMauro Carvalho Chehab 
58*e7b8153eSMauro Carvalho Chehab #define DMA2D_FGPFCCR_REG	0x001c
59*e7b8153eSMauro Carvalho Chehab #define FGPFCCR_ALPHA_MASK	GENMASK(31, 24)
60*e7b8153eSMauro Carvalho Chehab #define FGPFCCR_AM_MASK		GENMASK(17, 16)
61*e7b8153eSMauro Carvalho Chehab #define FGPFCCR_CS_MASK		GENMASK(15, 8)
62*e7b8153eSMauro Carvalho Chehab #define FGPFCCR_START		BIT(5)
63*e7b8153eSMauro Carvalho Chehab #define FGPFCCR_CCM_RGB888	BIT(4)
64*e7b8153eSMauro Carvalho Chehab #define FGPFCCR_CM_MASK		GENMASK(3, 0)
65*e7b8153eSMauro Carvalho Chehab 
66*e7b8153eSMauro Carvalho Chehab #define DMA2D_FGCOLR_REG	0x0020
67*e7b8153eSMauro Carvalho Chehab #define FGCOLR_REG_MASK		GENMASK(23, 16)
68*e7b8153eSMauro Carvalho Chehab #define FGCOLR_GREEN_MASK	GENMASK(15, 8)
69*e7b8153eSMauro Carvalho Chehab #define FGCOLR_BLUE_MASK	GENMASK(7, 0)
70*e7b8153eSMauro Carvalho Chehab 
71*e7b8153eSMauro Carvalho Chehab #define DMA2D_BGPFCCR_REG	0x0024
72*e7b8153eSMauro Carvalho Chehab #define BGPFCCR_ALPHA_MASK	GENMASK(31, 24)
73*e7b8153eSMauro Carvalho Chehab #define BGPFCCR_AM_MASK		GENMASK(17, 16)
74*e7b8153eSMauro Carvalho Chehab #define BGPFCCR_CS_MASK		GENMASK(15, 8)
75*e7b8153eSMauro Carvalho Chehab #define BGPFCCR_START		BIT(5)
76*e7b8153eSMauro Carvalho Chehab #define BGPFCCR_CCM_RGB888	BIT(4)
77*e7b8153eSMauro Carvalho Chehab #define BGPFCCR_CM_MASK		GENMASK(3, 0)
78*e7b8153eSMauro Carvalho Chehab 
79*e7b8153eSMauro Carvalho Chehab #define DMA2D_BGCOLR_REG	0x0028
80*e7b8153eSMauro Carvalho Chehab #define BGCOLR_REG_MASK		GENMASK(23, 16)
81*e7b8153eSMauro Carvalho Chehab #define BGCOLR_GREEN_MASK	GENMASK(15, 8)
82*e7b8153eSMauro Carvalho Chehab #define BGCOLR_BLUE_MASK	GENMASK(7, 0)
83*e7b8153eSMauro Carvalho Chehab 
84*e7b8153eSMauro Carvalho Chehab #define DMA2D_OPFCCR_REG	0x0034
85*e7b8153eSMauro Carvalho Chehab #define OPFCCR_CM_MASK		GENMASK(2, 0)
86*e7b8153eSMauro Carvalho Chehab 
87*e7b8153eSMauro Carvalho Chehab #define DMA2D_OCOLR_REG		0x0038
88*e7b8153eSMauro Carvalho Chehab #define OCOLR_ALPHA_MASK	GENMASK(31, 24)
89*e7b8153eSMauro Carvalho Chehab #define OCOLR_RED_MASK		GENMASK(23, 16)
90*e7b8153eSMauro Carvalho Chehab #define OCOLR_GREEN_MASK	GENMASK(15, 8)
91*e7b8153eSMauro Carvalho Chehab #define OCOLR_BLUE_MASK		GENMASK(7, 0)
92*e7b8153eSMauro Carvalho Chehab 
93*e7b8153eSMauro Carvalho Chehab #define DMA2D_OMAR_REG		0x003c
94*e7b8153eSMauro Carvalho Chehab 
95*e7b8153eSMauro Carvalho Chehab #define DMA2D_OOR_REG		0x0040
96*e7b8153eSMauro Carvalho Chehab #define OOR_LO_MASK		GENMASK(13, 0)
97*e7b8153eSMauro Carvalho Chehab 
98*e7b8153eSMauro Carvalho Chehab #define DMA2D_NLR_REG		0x0044
99*e7b8153eSMauro Carvalho Chehab #define NLR_PL_MASK		GENMASK(29, 16)
100*e7b8153eSMauro Carvalho Chehab #define NLR_NL_MASK		GENMASK(15, 0)
101*e7b8153eSMauro Carvalho Chehab 
102*e7b8153eSMauro Carvalho Chehab /* Hardware limits */
103*e7b8153eSMauro Carvalho Chehab #define MAX_WIDTH		2592
104*e7b8153eSMauro Carvalho Chehab #define MAX_HEIGHT		2592
105*e7b8153eSMauro Carvalho Chehab 
106*e7b8153eSMauro Carvalho Chehab #define DEFAULT_WIDTH		240
107*e7b8153eSMauro Carvalho Chehab #define DEFAULT_HEIGHT		320
108*e7b8153eSMauro Carvalho Chehab #define DEFAULT_SIZE		307200
109*e7b8153eSMauro Carvalho Chehab 
110*e7b8153eSMauro Carvalho Chehab #define CM_MODE_ARGB8888	0x00
111*e7b8153eSMauro Carvalho Chehab #define CM_MODE_ARGB4444	0x04
112*e7b8153eSMauro Carvalho Chehab #define CM_MODE_A4		0x0a
113*e7b8153eSMauro Carvalho Chehab #endif /* __DMA2D_REGS_H__ */
114