xref: /linux/drivers/gpu/drm/mxsfb/mxsfb_regs.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1c942fddfSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
245d59d70SMarek Vasut /*
345d59d70SMarek Vasut  * Copyright (C) 2010 Juergen Beisert, Pengutronix
445d59d70SMarek Vasut  * Copyright (C) 2016 Marek Vasut <marex@denx.de>
545d59d70SMarek Vasut  *
645d59d70SMarek Vasut  * i.MX23/i.MX28/i.MX6SX MXSFB LCD controller driver.
745d59d70SMarek Vasut  */
845d59d70SMarek Vasut 
945d59d70SMarek Vasut #ifndef __MXSFB_REGS_H__
1045d59d70SMarek Vasut #define __MXSFB_REGS_H__
1145d59d70SMarek Vasut 
1245d59d70SMarek Vasut #define REG_SET	4
1345d59d70SMarek Vasut #define REG_CLR	8
1445d59d70SMarek Vasut 
1545d59d70SMarek Vasut #define LCDC_CTRL			0x00
1645d59d70SMarek Vasut #define LCDC_CTRL1			0x10
1745d59d70SMarek Vasut #define LCDC_V3_TRANSFER_COUNT		0x20
189891cb54SMarek Vasut #define LCDC_V4_CTRL2			0x20
1945d59d70SMarek Vasut #define LCDC_V4_TRANSFER_COUNT		0x30
2045d59d70SMarek Vasut #define LCDC_V4_CUR_BUF			0x40
2145d59d70SMarek Vasut #define LCDC_V4_NEXT_BUF		0x50
2245d59d70SMarek Vasut #define LCDC_V3_CUR_BUF			0x30
2345d59d70SMarek Vasut #define LCDC_V3_NEXT_BUF		0x40
2445d59d70SMarek Vasut #define LCDC_VDCTRL0			0x70
2545d59d70SMarek Vasut #define LCDC_VDCTRL1			0x80
2645d59d70SMarek Vasut #define LCDC_VDCTRL2			0x90
2745d59d70SMarek Vasut #define LCDC_VDCTRL3			0xa0
2845d59d70SMarek Vasut #define LCDC_VDCTRL4			0xb0
29*05ecc678SMarek Vasut #define LCDC_V4_CRC_STAT		0x1a0
3045d59d70SMarek Vasut #define LCDC_V4_DEBUG0			0x1d0
3145d59d70SMarek Vasut #define LCDC_V3_DEBUG0			0x1f0
3263aa581cSLaurent Pinchart #define LCDC_AS_CTRL			0x210
3363aa581cSLaurent Pinchart #define LCDC_AS_BUF			0x220
3463aa581cSLaurent Pinchart #define LCDC_AS_NEXT_BUF		0x230
3563aa581cSLaurent Pinchart #define LCDC_AS_CLRKEYLOW		0x240
3663aa581cSLaurent Pinchart #define LCDC_AS_CLRKEYHIGH		0x250
3745d59d70SMarek Vasut 
388c6619ffSLaurent Pinchart #define CTRL_SFTRST			BIT(31)
398c6619ffSLaurent Pinchart #define CTRL_CLKGATE			BIT(30)
408c6619ffSLaurent Pinchart #define CTRL_BYPASS_COUNT		BIT(19)
418c6619ffSLaurent Pinchart #define CTRL_VSYNC_MODE			BIT(18)
428c6619ffSLaurent Pinchart #define CTRL_DOTCLK_MODE		BIT(17)
438c6619ffSLaurent Pinchart #define CTRL_DATA_SELECT		BIT(16)
448a460068SLaurent Pinchart #define CTRL_BUS_WIDTH_16		(0 << 10)
458a460068SLaurent Pinchart #define CTRL_BUS_WIDTH_8		(1 << 10)
468a460068SLaurent Pinchart #define CTRL_BUS_WIDTH_18		(2 << 10)
478a460068SLaurent Pinchart #define CTRL_BUS_WIDTH_24		(3 << 10)
4810f2889bSStefan Agner #define CTRL_BUS_WIDTH_MASK		(0x3 << 10)
498a460068SLaurent Pinchart #define CTRL_WORD_LENGTH_16		(0 << 8)
508a460068SLaurent Pinchart #define CTRL_WORD_LENGTH_8		(1 << 8)
518a460068SLaurent Pinchart #define CTRL_WORD_LENGTH_18		(2 << 8)
528a460068SLaurent Pinchart #define CTRL_WORD_LENGTH_24		(3 << 8)
538c6619ffSLaurent Pinchart #define CTRL_MASTER			BIT(5)
548c6619ffSLaurent Pinchart #define CTRL_DF16			BIT(3)
558c6619ffSLaurent Pinchart #define CTRL_DF18			BIT(2)
568c6619ffSLaurent Pinchart #define CTRL_DF24			BIT(1)
578c6619ffSLaurent Pinchart #define CTRL_RUN			BIT(0)
5845d59d70SMarek Vasut 
590c9856e4SMarek Vasut #define CTRL1_RECOVER_ON_UNDERFLOW	BIT(24)
608c6619ffSLaurent Pinchart #define CTRL1_FIFO_CLEAR		BIT(21)
6145d59d70SMarek Vasut #define CTRL1_SET_BYTE_PACKAGING(x)	(((x) & 0xf) << 16)
6245d59d70SMarek Vasut #define CTRL1_GET_BYTE_PACKAGING(x)	(((x) >> 16) & 0xf)
638c6619ffSLaurent Pinchart #define CTRL1_CUR_FRAME_DONE_IRQ_EN	BIT(13)
648c6619ffSLaurent Pinchart #define CTRL1_CUR_FRAME_DONE_IRQ	BIT(9)
6545d59d70SMarek Vasut 
669891cb54SMarek Vasut #define CTRL2_SET_OUTSTANDING_REQS_1	0
679891cb54SMarek Vasut #define CTRL2_SET_OUTSTANDING_REQS_2	(0x1 << 21)
689891cb54SMarek Vasut #define CTRL2_SET_OUTSTANDING_REQS_4	(0x2 << 21)
699891cb54SMarek Vasut #define CTRL2_SET_OUTSTANDING_REQS_8	(0x3 << 21)
709891cb54SMarek Vasut #define CTRL2_SET_OUTSTANDING_REQS_16	(0x4 << 21)
719891cb54SMarek Vasut #define CTRL2_SET_OUTSTANDING_REQS_MASK	(0x7 << 21)
729891cb54SMarek Vasut 
7345d59d70SMarek Vasut #define TRANSFER_COUNT_SET_VCOUNT(x)	(((x) & 0xffff) << 16)
7445d59d70SMarek Vasut #define TRANSFER_COUNT_GET_VCOUNT(x)	(((x) >> 16) & 0xffff)
7545d59d70SMarek Vasut #define TRANSFER_COUNT_SET_HCOUNT(x)	((x) & 0xffff)
7645d59d70SMarek Vasut #define TRANSFER_COUNT_GET_HCOUNT(x)	((x) & 0xffff)
7745d59d70SMarek Vasut 
788c6619ffSLaurent Pinchart #define VDCTRL0_ENABLE_PRESENT		BIT(28)
798c6619ffSLaurent Pinchart #define VDCTRL0_VSYNC_ACT_HIGH		BIT(27)
808c6619ffSLaurent Pinchart #define VDCTRL0_HSYNC_ACT_HIGH		BIT(26)
818c6619ffSLaurent Pinchart #define VDCTRL0_DOTCLK_ACT_FALLING	BIT(25)
828c6619ffSLaurent Pinchart #define VDCTRL0_ENABLE_ACT_HIGH		BIT(24)
838c6619ffSLaurent Pinchart #define VDCTRL0_VSYNC_PERIOD_UNIT	BIT(21)
848c6619ffSLaurent Pinchart #define VDCTRL0_VSYNC_PULSE_WIDTH_UNIT	BIT(20)
858c6619ffSLaurent Pinchart #define VDCTRL0_HALF_LINE		BIT(19)
868c6619ffSLaurent Pinchart #define VDCTRL0_HALF_LINE_MODE		BIT(18)
8745d59d70SMarek Vasut #define VDCTRL0_SET_VSYNC_PULSE_WIDTH(x) ((x) & 0x3ffff)
8845d59d70SMarek Vasut #define VDCTRL0_GET_VSYNC_PULSE_WIDTH(x) ((x) & 0x3ffff)
8945d59d70SMarek Vasut 
9045d59d70SMarek Vasut #define VDCTRL2_SET_HSYNC_PERIOD(x)	((x) & 0x3ffff)
9145d59d70SMarek Vasut #define VDCTRL2_GET_HSYNC_PERIOD(x)	((x) & 0x3ffff)
9245d59d70SMarek Vasut 
938c6619ffSLaurent Pinchart #define VDCTRL3_MUX_SYNC_SIGNALS	BIT(29)
948c6619ffSLaurent Pinchart #define VDCTRL3_VSYNC_ONLY		BIT(28)
9545d59d70SMarek Vasut #define SET_HOR_WAIT_CNT(x)		(((x) & 0xfff) << 16)
9645d59d70SMarek Vasut #define GET_HOR_WAIT_CNT(x)		(((x) >> 16) & 0xfff)
9745d59d70SMarek Vasut #define SET_VERT_WAIT_CNT(x)		((x) & 0xffff)
9845d59d70SMarek Vasut #define GET_VERT_WAIT_CNT(x)		((x) & 0xffff)
9945d59d70SMarek Vasut 
10045d59d70SMarek Vasut #define VDCTRL4_SET_DOTCLK_DLY(x)	(((x) & 0x7) << 29) /* v4 only */
10145d59d70SMarek Vasut #define VDCTRL4_GET_DOTCLK_DLY(x)	(((x) >> 29) & 0x7) /* v4 only */
1028c6619ffSLaurent Pinchart #define VDCTRL4_SYNC_SIGNALS_ON		BIT(18)
10345d59d70SMarek Vasut #define SET_DOTCLK_H_VALID_DATA_CNT(x)	((x) & 0x3ffff)
10445d59d70SMarek Vasut 
1058c6619ffSLaurent Pinchart #define DEBUG0_HSYNC			BIT(26)
1068c6619ffSLaurent Pinchart #define DEBUG0_VSYNC			BIT(25)
10745d59d70SMarek Vasut 
10863aa581cSLaurent Pinchart #define AS_CTRL_PS_DISABLE		BIT(23)
10963aa581cSLaurent Pinchart #define AS_CTRL_ALPHA_INVERT		BIT(20)
11063aa581cSLaurent Pinchart #define AS_CTRL_ALPHA(a)		(((a) & 0xff) << 8)
11163aa581cSLaurent Pinchart #define AS_CTRL_FORMAT_RGB565		(0xe << 4)
11263aa581cSLaurent Pinchart #define AS_CTRL_FORMAT_RGB444		(0xd << 4)
11363aa581cSLaurent Pinchart #define AS_CTRL_FORMAT_RGB555		(0xc << 4)
11463aa581cSLaurent Pinchart #define AS_CTRL_FORMAT_ARGB4444		(0x9 << 4)
11563aa581cSLaurent Pinchart #define AS_CTRL_FORMAT_ARGB1555		(0x8 << 4)
11663aa581cSLaurent Pinchart #define AS_CTRL_FORMAT_RGB888		(0x4 << 4)
11763aa581cSLaurent Pinchart #define AS_CTRL_FORMAT_ARGB8888		(0x0 << 4)
11863aa581cSLaurent Pinchart #define AS_CTRL_ENABLE_COLORKEY		BIT(3)
11963aa581cSLaurent Pinchart #define AS_CTRL_ALPHA_CTRL_ROP		(3 << 1)
12063aa581cSLaurent Pinchart #define AS_CTRL_ALPHA_CTRL_MULTIPLY	(2 << 1)
12163aa581cSLaurent Pinchart #define AS_CTRL_ALPHA_CTRL_OVERRIDE	(1 << 1)
12263aa581cSLaurent Pinchart #define AS_CTRL_ALPHA_CTRL_EMBEDDED	(0 << 1)
12363aa581cSLaurent Pinchart #define AS_CTRL_AS_ENABLE		BIT(0)
12463aa581cSLaurent Pinchart 
12545d59d70SMarek Vasut #define MXSFB_MIN_XRES			120
12645d59d70SMarek Vasut #define MXSFB_MIN_YRES			120
12745d59d70SMarek Vasut #define MXSFB_MAX_XRES			0xffff
12845d59d70SMarek Vasut #define MXSFB_MAX_YRES			0xffff
12945d59d70SMarek Vasut 
13045d59d70SMarek Vasut #endif /* __MXSFB_REGS_H__ */
131