1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * Copyright (C) 2010 Juergen Beisert, Pengutronix 4 * Copyright (C) 2016 Marek Vasut <marex@denx.de> 5 * 6 * i.MX23/i.MX28/i.MX6SX MXSFB LCD controller driver. 7 */ 8 9 #ifndef __MXSFB_REGS_H__ 10 #define __MXSFB_REGS_H__ 11 12 #define REG_SET 4 13 #define REG_CLR 8 14 15 #define LCDC_CTRL 0x00 16 #define LCDC_CTRL1 0x10 17 #define LCDC_V3_TRANSFER_COUNT 0x20 18 #define LCDC_V4_TRANSFER_COUNT 0x30 19 #define LCDC_V4_CUR_BUF 0x40 20 #define LCDC_V4_NEXT_BUF 0x50 21 #define LCDC_V3_CUR_BUF 0x30 22 #define LCDC_V3_NEXT_BUF 0x40 23 #define LCDC_VDCTRL0 0x70 24 #define LCDC_VDCTRL1 0x80 25 #define LCDC_VDCTRL2 0x90 26 #define LCDC_VDCTRL3 0xa0 27 #define LCDC_VDCTRL4 0xb0 28 #define LCDC_V4_DEBUG0 0x1d0 29 #define LCDC_V3_DEBUG0 0x1f0 30 #define LCDC_AS_CTRL 0x210 31 #define LCDC_AS_BUF 0x220 32 #define LCDC_AS_NEXT_BUF 0x230 33 #define LCDC_AS_CLRKEYLOW 0x240 34 #define LCDC_AS_CLRKEYHIGH 0x250 35 36 #define CTRL_SFTRST BIT(31) 37 #define CTRL_CLKGATE BIT(30) 38 #define CTRL_BYPASS_COUNT BIT(19) 39 #define CTRL_VSYNC_MODE BIT(18) 40 #define CTRL_DOTCLK_MODE BIT(17) 41 #define CTRL_DATA_SELECT BIT(16) 42 #define CTRL_BUS_WIDTH_16 (0 << 10) 43 #define CTRL_BUS_WIDTH_8 (1 << 10) 44 #define CTRL_BUS_WIDTH_18 (2 << 10) 45 #define CTRL_BUS_WIDTH_24 (3 << 10) 46 #define CTRL_BUS_WIDTH_MASK (0x3 << 10) 47 #define CTRL_WORD_LENGTH_16 (0 << 8) 48 #define CTRL_WORD_LENGTH_8 (1 << 8) 49 #define CTRL_WORD_LENGTH_18 (2 << 8) 50 #define CTRL_WORD_LENGTH_24 (3 << 8) 51 #define CTRL_MASTER BIT(5) 52 #define CTRL_DF16 BIT(3) 53 #define CTRL_DF18 BIT(2) 54 #define CTRL_DF24 BIT(1) 55 #define CTRL_RUN BIT(0) 56 57 #define CTRL1_FIFO_CLEAR BIT(21) 58 #define CTRL1_SET_BYTE_PACKAGING(x) (((x) & 0xf) << 16) 59 #define CTRL1_GET_BYTE_PACKAGING(x) (((x) >> 16) & 0xf) 60 #define CTRL1_CUR_FRAME_DONE_IRQ_EN BIT(13) 61 #define CTRL1_CUR_FRAME_DONE_IRQ BIT(9) 62 63 #define TRANSFER_COUNT_SET_VCOUNT(x) (((x) & 0xffff) << 16) 64 #define TRANSFER_COUNT_GET_VCOUNT(x) (((x) >> 16) & 0xffff) 65 #define TRANSFER_COUNT_SET_HCOUNT(x) ((x) & 0xffff) 66 #define TRANSFER_COUNT_GET_HCOUNT(x) ((x) & 0xffff) 67 68 #define VDCTRL0_ENABLE_PRESENT BIT(28) 69 #define VDCTRL0_VSYNC_ACT_HIGH BIT(27) 70 #define VDCTRL0_HSYNC_ACT_HIGH BIT(26) 71 #define VDCTRL0_DOTCLK_ACT_FALLING BIT(25) 72 #define VDCTRL0_ENABLE_ACT_HIGH BIT(24) 73 #define VDCTRL0_VSYNC_PERIOD_UNIT BIT(21) 74 #define VDCTRL0_VSYNC_PULSE_WIDTH_UNIT BIT(20) 75 #define VDCTRL0_HALF_LINE BIT(19) 76 #define VDCTRL0_HALF_LINE_MODE BIT(18) 77 #define VDCTRL0_SET_VSYNC_PULSE_WIDTH(x) ((x) & 0x3ffff) 78 #define VDCTRL0_GET_VSYNC_PULSE_WIDTH(x) ((x) & 0x3ffff) 79 80 #define VDCTRL2_SET_HSYNC_PERIOD(x) ((x) & 0x3ffff) 81 #define VDCTRL2_GET_HSYNC_PERIOD(x) ((x) & 0x3ffff) 82 83 #define VDCTRL3_MUX_SYNC_SIGNALS BIT(29) 84 #define VDCTRL3_VSYNC_ONLY BIT(28) 85 #define SET_HOR_WAIT_CNT(x) (((x) & 0xfff) << 16) 86 #define GET_HOR_WAIT_CNT(x) (((x) >> 16) & 0xfff) 87 #define SET_VERT_WAIT_CNT(x) ((x) & 0xffff) 88 #define GET_VERT_WAIT_CNT(x) ((x) & 0xffff) 89 90 #define VDCTRL4_SET_DOTCLK_DLY(x) (((x) & 0x7) << 29) /* v4 only */ 91 #define VDCTRL4_GET_DOTCLK_DLY(x) (((x) >> 29) & 0x7) /* v4 only */ 92 #define VDCTRL4_SYNC_SIGNALS_ON BIT(18) 93 #define SET_DOTCLK_H_VALID_DATA_CNT(x) ((x) & 0x3ffff) 94 95 #define DEBUG0_HSYNC BIT(26) 96 #define DEBUG0_VSYNC BIT(25) 97 98 #define AS_CTRL_PS_DISABLE BIT(23) 99 #define AS_CTRL_ALPHA_INVERT BIT(20) 100 #define AS_CTRL_ALPHA(a) (((a) & 0xff) << 8) 101 #define AS_CTRL_FORMAT_RGB565 (0xe << 4) 102 #define AS_CTRL_FORMAT_RGB444 (0xd << 4) 103 #define AS_CTRL_FORMAT_RGB555 (0xc << 4) 104 #define AS_CTRL_FORMAT_ARGB4444 (0x9 << 4) 105 #define AS_CTRL_FORMAT_ARGB1555 (0x8 << 4) 106 #define AS_CTRL_FORMAT_RGB888 (0x4 << 4) 107 #define AS_CTRL_FORMAT_ARGB8888 (0x0 << 4) 108 #define AS_CTRL_ENABLE_COLORKEY BIT(3) 109 #define AS_CTRL_ALPHA_CTRL_ROP (3 << 1) 110 #define AS_CTRL_ALPHA_CTRL_MULTIPLY (2 << 1) 111 #define AS_CTRL_ALPHA_CTRL_OVERRIDE (1 << 1) 112 #define AS_CTRL_ALPHA_CTRL_EMBEDDED (0 << 1) 113 #define AS_CTRL_AS_ENABLE BIT(0) 114 115 #define MXSFB_MIN_XRES 120 116 #define MXSFB_MIN_YRES 120 117 #define MXSFB_MAX_XRES 0xffff 118 #define MXSFB_MAX_YRES 0xffff 119 120 #endif /* __MXSFB_REGS_H__ */ 121