| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2010 Juergen Beisert, Pengutronix |
|---|
| 3 | 4 | * Copyright (C) 2016 Marek Vasut <marex@denx.de> |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * i.MX23/i.MX28/i.MX6SX MXSFB LCD controller driver. |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or |
|---|
| 8 | | - * modify it under the terms of the GNU General Public License |
|---|
| 9 | | - * as published by the Free Software Foundation; either version 2 |
|---|
| 10 | | - * of the License, or (at your option) any later version. |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | 7 | */ |
|---|
| 16 | 8 | |
|---|
| 17 | 9 | #ifndef __MXSFB_REGS_H__ |
|---|
| .. | .. |
|---|
| 23 | 15 | #define LCDC_CTRL 0x00 |
|---|
| 24 | 16 | #define LCDC_CTRL1 0x10 |
|---|
| 25 | 17 | #define LCDC_V3_TRANSFER_COUNT 0x20 |
|---|
| 18 | +#define LCDC_V4_CTRL2 0x20 |
|---|
| 26 | 19 | #define LCDC_V4_TRANSFER_COUNT 0x30 |
|---|
| 27 | 20 | #define LCDC_V4_CUR_BUF 0x40 |
|---|
| 28 | 21 | #define LCDC_V4_NEXT_BUF 0x50 |
|---|
| .. | .. |
|---|
| 35 | 28 | #define LCDC_VDCTRL4 0xb0 |
|---|
| 36 | 29 | #define LCDC_V4_DEBUG0 0x1d0 |
|---|
| 37 | 30 | #define LCDC_V3_DEBUG0 0x1f0 |
|---|
| 31 | +#define LCDC_AS_CTRL 0x210 |
|---|
| 32 | +#define LCDC_AS_BUF 0x220 |
|---|
| 33 | +#define LCDC_AS_NEXT_BUF 0x230 |
|---|
| 34 | +#define LCDC_AS_CLRKEYLOW 0x240 |
|---|
| 35 | +#define LCDC_AS_CLRKEYHIGH 0x250 |
|---|
| 38 | 36 | |
|---|
| 39 | | -#define CTRL_SFTRST (1 << 31) |
|---|
| 40 | | -#define CTRL_CLKGATE (1 << 30) |
|---|
| 41 | | -#define CTRL_BYPASS_COUNT (1 << 19) |
|---|
| 42 | | -#define CTRL_VSYNC_MODE (1 << 18) |
|---|
| 43 | | -#define CTRL_DOTCLK_MODE (1 << 17) |
|---|
| 44 | | -#define CTRL_DATA_SELECT (1 << 16) |
|---|
| 45 | | -#define CTRL_SET_BUS_WIDTH(x) (((x) & 0x3) << 10) |
|---|
| 46 | | -#define CTRL_GET_BUS_WIDTH(x) (((x) >> 10) & 0x3) |
|---|
| 37 | +#define CTRL_SFTRST BIT(31) |
|---|
| 38 | +#define CTRL_CLKGATE BIT(30) |
|---|
| 39 | +#define CTRL_BYPASS_COUNT BIT(19) |
|---|
| 40 | +#define CTRL_VSYNC_MODE BIT(18) |
|---|
| 41 | +#define CTRL_DOTCLK_MODE BIT(17) |
|---|
| 42 | +#define CTRL_DATA_SELECT BIT(16) |
|---|
| 43 | +#define CTRL_BUS_WIDTH_16 (0 << 10) |
|---|
| 44 | +#define CTRL_BUS_WIDTH_8 (1 << 10) |
|---|
| 45 | +#define CTRL_BUS_WIDTH_18 (2 << 10) |
|---|
| 46 | +#define CTRL_BUS_WIDTH_24 (3 << 10) |
|---|
| 47 | 47 | #define CTRL_BUS_WIDTH_MASK (0x3 << 10) |
|---|
| 48 | | -#define CTRL_SET_WORD_LENGTH(x) (((x) & 0x3) << 8) |
|---|
| 49 | | -#define CTRL_GET_WORD_LENGTH(x) (((x) >> 8) & 0x3) |
|---|
| 50 | | -#define CTRL_MASTER (1 << 5) |
|---|
| 51 | | -#define CTRL_DF16 (1 << 3) |
|---|
| 52 | | -#define CTRL_DF18 (1 << 2) |
|---|
| 53 | | -#define CTRL_DF24 (1 << 1) |
|---|
| 54 | | -#define CTRL_RUN (1 << 0) |
|---|
| 48 | +#define CTRL_WORD_LENGTH_16 (0 << 8) |
|---|
| 49 | +#define CTRL_WORD_LENGTH_8 (1 << 8) |
|---|
| 50 | +#define CTRL_WORD_LENGTH_18 (2 << 8) |
|---|
| 51 | +#define CTRL_WORD_LENGTH_24 (3 << 8) |
|---|
| 52 | +#define CTRL_MASTER BIT(5) |
|---|
| 53 | +#define CTRL_DF16 BIT(3) |
|---|
| 54 | +#define CTRL_DF18 BIT(2) |
|---|
| 55 | +#define CTRL_DF24 BIT(1) |
|---|
| 56 | +#define CTRL_RUN BIT(0) |
|---|
| 55 | 57 | |
|---|
| 56 | | -#define CTRL1_FIFO_CLEAR (1 << 21) |
|---|
| 58 | +#define CTRL1_RECOVER_ON_UNDERFLOW BIT(24) |
|---|
| 59 | +#define CTRL1_FIFO_CLEAR BIT(21) |
|---|
| 57 | 60 | #define CTRL1_SET_BYTE_PACKAGING(x) (((x) & 0xf) << 16) |
|---|
| 58 | 61 | #define CTRL1_GET_BYTE_PACKAGING(x) (((x) >> 16) & 0xf) |
|---|
| 59 | | -#define CTRL1_CUR_FRAME_DONE_IRQ_EN (1 << 13) |
|---|
| 60 | | -#define CTRL1_CUR_FRAME_DONE_IRQ (1 << 9) |
|---|
| 62 | +#define CTRL1_CUR_FRAME_DONE_IRQ_EN BIT(13) |
|---|
| 63 | +#define CTRL1_CUR_FRAME_DONE_IRQ BIT(9) |
|---|
| 64 | + |
|---|
| 65 | +#define CTRL2_SET_OUTSTANDING_REQS_1 0 |
|---|
| 66 | +#define CTRL2_SET_OUTSTANDING_REQS_2 (0x1 << 21) |
|---|
| 67 | +#define CTRL2_SET_OUTSTANDING_REQS_4 (0x2 << 21) |
|---|
| 68 | +#define CTRL2_SET_OUTSTANDING_REQS_8 (0x3 << 21) |
|---|
| 69 | +#define CTRL2_SET_OUTSTANDING_REQS_16 (0x4 << 21) |
|---|
| 70 | +#define CTRL2_SET_OUTSTANDING_REQS_MASK (0x7 << 21) |
|---|
| 61 | 71 | |
|---|
| 62 | 72 | #define TRANSFER_COUNT_SET_VCOUNT(x) (((x) & 0xffff) << 16) |
|---|
| 63 | 73 | #define TRANSFER_COUNT_GET_VCOUNT(x) (((x) >> 16) & 0xffff) |
|---|
| 64 | 74 | #define TRANSFER_COUNT_SET_HCOUNT(x) ((x) & 0xffff) |
|---|
| 65 | 75 | #define TRANSFER_COUNT_GET_HCOUNT(x) ((x) & 0xffff) |
|---|
| 66 | 76 | |
|---|
| 67 | | -#define VDCTRL0_ENABLE_PRESENT (1 << 28) |
|---|
| 68 | | -#define VDCTRL0_VSYNC_ACT_HIGH (1 << 27) |
|---|
| 69 | | -#define VDCTRL0_HSYNC_ACT_HIGH (1 << 26) |
|---|
| 70 | | -#define VDCTRL0_DOTCLK_ACT_FALLING (1 << 25) |
|---|
| 71 | | -#define VDCTRL0_ENABLE_ACT_HIGH (1 << 24) |
|---|
| 72 | | -#define VDCTRL0_VSYNC_PERIOD_UNIT (1 << 21) |
|---|
| 73 | | -#define VDCTRL0_VSYNC_PULSE_WIDTH_UNIT (1 << 20) |
|---|
| 74 | | -#define VDCTRL0_HALF_LINE (1 << 19) |
|---|
| 75 | | -#define VDCTRL0_HALF_LINE_MODE (1 << 18) |
|---|
| 77 | +#define VDCTRL0_ENABLE_PRESENT BIT(28) |
|---|
| 78 | +#define VDCTRL0_VSYNC_ACT_HIGH BIT(27) |
|---|
| 79 | +#define VDCTRL0_HSYNC_ACT_HIGH BIT(26) |
|---|
| 80 | +#define VDCTRL0_DOTCLK_ACT_FALLING BIT(25) |
|---|
| 81 | +#define VDCTRL0_ENABLE_ACT_HIGH BIT(24) |
|---|
| 82 | +#define VDCTRL0_VSYNC_PERIOD_UNIT BIT(21) |
|---|
| 83 | +#define VDCTRL0_VSYNC_PULSE_WIDTH_UNIT BIT(20) |
|---|
| 84 | +#define VDCTRL0_HALF_LINE BIT(19) |
|---|
| 85 | +#define VDCTRL0_HALF_LINE_MODE BIT(18) |
|---|
| 76 | 86 | #define VDCTRL0_SET_VSYNC_PULSE_WIDTH(x) ((x) & 0x3ffff) |
|---|
| 77 | 87 | #define VDCTRL0_GET_VSYNC_PULSE_WIDTH(x) ((x) & 0x3ffff) |
|---|
| 78 | 88 | |
|---|
| 79 | 89 | #define VDCTRL2_SET_HSYNC_PERIOD(x) ((x) & 0x3ffff) |
|---|
| 80 | 90 | #define VDCTRL2_GET_HSYNC_PERIOD(x) ((x) & 0x3ffff) |
|---|
| 81 | 91 | |
|---|
| 82 | | -#define VDCTRL3_MUX_SYNC_SIGNALS (1 << 29) |
|---|
| 83 | | -#define VDCTRL3_VSYNC_ONLY (1 << 28) |
|---|
| 92 | +#define VDCTRL3_MUX_SYNC_SIGNALS BIT(29) |
|---|
| 93 | +#define VDCTRL3_VSYNC_ONLY BIT(28) |
|---|
| 84 | 94 | #define SET_HOR_WAIT_CNT(x) (((x) & 0xfff) << 16) |
|---|
| 85 | 95 | #define GET_HOR_WAIT_CNT(x) (((x) >> 16) & 0xfff) |
|---|
| 86 | 96 | #define SET_VERT_WAIT_CNT(x) ((x) & 0xffff) |
|---|
| .. | .. |
|---|
| 88 | 98 | |
|---|
| 89 | 99 | #define VDCTRL4_SET_DOTCLK_DLY(x) (((x) & 0x7) << 29) /* v4 only */ |
|---|
| 90 | 100 | #define VDCTRL4_GET_DOTCLK_DLY(x) (((x) >> 29) & 0x7) /* v4 only */ |
|---|
| 91 | | -#define VDCTRL4_SYNC_SIGNALS_ON (1 << 18) |
|---|
| 101 | +#define VDCTRL4_SYNC_SIGNALS_ON BIT(18) |
|---|
| 92 | 102 | #define SET_DOTCLK_H_VALID_DATA_CNT(x) ((x) & 0x3ffff) |
|---|
| 93 | 103 | |
|---|
| 94 | | -#define DEBUG0_HSYNC (1 < 26) |
|---|
| 95 | | -#define DEBUG0_VSYNC (1 < 25) |
|---|
| 104 | +#define DEBUG0_HSYNC BIT(26) |
|---|
| 105 | +#define DEBUG0_VSYNC BIT(25) |
|---|
| 106 | + |
|---|
| 107 | +#define AS_CTRL_PS_DISABLE BIT(23) |
|---|
| 108 | +#define AS_CTRL_ALPHA_INVERT BIT(20) |
|---|
| 109 | +#define AS_CTRL_ALPHA(a) (((a) & 0xff) << 8) |
|---|
| 110 | +#define AS_CTRL_FORMAT_RGB565 (0xe << 4) |
|---|
| 111 | +#define AS_CTRL_FORMAT_RGB444 (0xd << 4) |
|---|
| 112 | +#define AS_CTRL_FORMAT_RGB555 (0xc << 4) |
|---|
| 113 | +#define AS_CTRL_FORMAT_ARGB4444 (0x9 << 4) |
|---|
| 114 | +#define AS_CTRL_FORMAT_ARGB1555 (0x8 << 4) |
|---|
| 115 | +#define AS_CTRL_FORMAT_RGB888 (0x4 << 4) |
|---|
| 116 | +#define AS_CTRL_FORMAT_ARGB8888 (0x0 << 4) |
|---|
| 117 | +#define AS_CTRL_ENABLE_COLORKEY BIT(3) |
|---|
| 118 | +#define AS_CTRL_ALPHA_CTRL_ROP (3 << 1) |
|---|
| 119 | +#define AS_CTRL_ALPHA_CTRL_MULTIPLY (2 << 1) |
|---|
| 120 | +#define AS_CTRL_ALPHA_CTRL_OVERRIDE (1 << 1) |
|---|
| 121 | +#define AS_CTRL_ALPHA_CTRL_EMBEDDED (0 << 1) |
|---|
| 122 | +#define AS_CTRL_AS_ENABLE BIT(0) |
|---|
| 96 | 123 | |
|---|
| 97 | 124 | #define MXSFB_MIN_XRES 120 |
|---|
| 98 | 125 | #define MXSFB_MIN_YRES 120 |
|---|
| 99 | 126 | #define MXSFB_MAX_XRES 0xffff |
|---|
| 100 | 127 | #define MXSFB_MAX_YRES 0xffff |
|---|
| 101 | | - |
|---|
| 102 | | -#define RED 0 |
|---|
| 103 | | -#define GREEN 1 |
|---|
| 104 | | -#define BLUE 2 |
|---|
| 105 | | -#define TRANSP 3 |
|---|
| 106 | | - |
|---|
| 107 | | -#define STMLCDIF_8BIT 1 /* pixel data bus to the display is of 8 bit width */ |
|---|
| 108 | | -#define STMLCDIF_16BIT 0 /* pixel data bus to the display is of 16 bit width */ |
|---|
| 109 | | -#define STMLCDIF_18BIT 2 /* pixel data bus to the display is of 18 bit width */ |
|---|
| 110 | | -#define STMLCDIF_24BIT 3 /* pixel data bus to the display is of 24 bit width */ |
|---|
| 111 | | - |
|---|
| 112 | | -#define MXSFB_SYNC_DATA_ENABLE_HIGH_ACT (1 << 6) |
|---|
| 113 | | -#define MXSFB_SYNC_DOTCLK_FALLING_ACT (1 << 7) /* negative edge sampling */ |
|---|
| 114 | 128 | |
|---|
| 115 | 129 | #endif /* __MXSFB_REGS_H__ */ |
|---|