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 1845d59d70SMarek Vasut #define LCDC_V4_TRANSFER_COUNT 0x30 1945d59d70SMarek Vasut #define LCDC_V4_CUR_BUF 0x40 2045d59d70SMarek Vasut #define LCDC_V4_NEXT_BUF 0x50 2145d59d70SMarek Vasut #define LCDC_V3_CUR_BUF 0x30 2245d59d70SMarek Vasut #define LCDC_V3_NEXT_BUF 0x40 2345d59d70SMarek Vasut #define LCDC_VDCTRL0 0x70 2445d59d70SMarek Vasut #define LCDC_VDCTRL1 0x80 2545d59d70SMarek Vasut #define LCDC_VDCTRL2 0x90 2645d59d70SMarek Vasut #define LCDC_VDCTRL3 0xa0 2745d59d70SMarek Vasut #define LCDC_VDCTRL4 0xb0 2845d59d70SMarek Vasut #define LCDC_V4_DEBUG0 0x1d0 2945d59d70SMarek Vasut #define LCDC_V3_DEBUG0 0x1f0 3045d59d70SMarek Vasut 31*8c6619ffSLaurent Pinchart #define CTRL_SFTRST BIT(31) 32*8c6619ffSLaurent Pinchart #define CTRL_CLKGATE BIT(30) 33*8c6619ffSLaurent Pinchart #define CTRL_BYPASS_COUNT BIT(19) 34*8c6619ffSLaurent Pinchart #define CTRL_VSYNC_MODE BIT(18) 35*8c6619ffSLaurent Pinchart #define CTRL_DOTCLK_MODE BIT(17) 36*8c6619ffSLaurent Pinchart #define CTRL_DATA_SELECT BIT(16) 3745d59d70SMarek Vasut #define CTRL_SET_BUS_WIDTH(x) (((x) & 0x3) << 10) 3845d59d70SMarek Vasut #define CTRL_GET_BUS_WIDTH(x) (((x) >> 10) & 0x3) 3910f2889bSStefan Agner #define CTRL_BUS_WIDTH_MASK (0x3 << 10) 4045d59d70SMarek Vasut #define CTRL_SET_WORD_LENGTH(x) (((x) & 0x3) << 8) 4145d59d70SMarek Vasut #define CTRL_GET_WORD_LENGTH(x) (((x) >> 8) & 0x3) 42*8c6619ffSLaurent Pinchart #define CTRL_MASTER BIT(5) 43*8c6619ffSLaurent Pinchart #define CTRL_DF16 BIT(3) 44*8c6619ffSLaurent Pinchart #define CTRL_DF18 BIT(2) 45*8c6619ffSLaurent Pinchart #define CTRL_DF24 BIT(1) 46*8c6619ffSLaurent Pinchart #define CTRL_RUN BIT(0) 4745d59d70SMarek Vasut 48*8c6619ffSLaurent Pinchart #define CTRL1_FIFO_CLEAR BIT(21) 4945d59d70SMarek Vasut #define CTRL1_SET_BYTE_PACKAGING(x) (((x) & 0xf) << 16) 5045d59d70SMarek Vasut #define CTRL1_GET_BYTE_PACKAGING(x) (((x) >> 16) & 0xf) 51*8c6619ffSLaurent Pinchart #define CTRL1_CUR_FRAME_DONE_IRQ_EN BIT(13) 52*8c6619ffSLaurent Pinchart #define CTRL1_CUR_FRAME_DONE_IRQ BIT(9) 5345d59d70SMarek Vasut 5445d59d70SMarek Vasut #define TRANSFER_COUNT_SET_VCOUNT(x) (((x) & 0xffff) << 16) 5545d59d70SMarek Vasut #define TRANSFER_COUNT_GET_VCOUNT(x) (((x) >> 16) & 0xffff) 5645d59d70SMarek Vasut #define TRANSFER_COUNT_SET_HCOUNT(x) ((x) & 0xffff) 5745d59d70SMarek Vasut #define TRANSFER_COUNT_GET_HCOUNT(x) ((x) & 0xffff) 5845d59d70SMarek Vasut 59*8c6619ffSLaurent Pinchart #define VDCTRL0_ENABLE_PRESENT BIT(28) 60*8c6619ffSLaurent Pinchart #define VDCTRL0_VSYNC_ACT_HIGH BIT(27) 61*8c6619ffSLaurent Pinchart #define VDCTRL0_HSYNC_ACT_HIGH BIT(26) 62*8c6619ffSLaurent Pinchart #define VDCTRL0_DOTCLK_ACT_FALLING BIT(25) 63*8c6619ffSLaurent Pinchart #define VDCTRL0_ENABLE_ACT_HIGH BIT(24) 64*8c6619ffSLaurent Pinchart #define VDCTRL0_VSYNC_PERIOD_UNIT BIT(21) 65*8c6619ffSLaurent Pinchart #define VDCTRL0_VSYNC_PULSE_WIDTH_UNIT BIT(20) 66*8c6619ffSLaurent Pinchart #define VDCTRL0_HALF_LINE BIT(19) 67*8c6619ffSLaurent Pinchart #define VDCTRL0_HALF_LINE_MODE BIT(18) 6845d59d70SMarek Vasut #define VDCTRL0_SET_VSYNC_PULSE_WIDTH(x) ((x) & 0x3ffff) 6945d59d70SMarek Vasut #define VDCTRL0_GET_VSYNC_PULSE_WIDTH(x) ((x) & 0x3ffff) 7045d59d70SMarek Vasut 7145d59d70SMarek Vasut #define VDCTRL2_SET_HSYNC_PERIOD(x) ((x) & 0x3ffff) 7245d59d70SMarek Vasut #define VDCTRL2_GET_HSYNC_PERIOD(x) ((x) & 0x3ffff) 7345d59d70SMarek Vasut 74*8c6619ffSLaurent Pinchart #define VDCTRL3_MUX_SYNC_SIGNALS BIT(29) 75*8c6619ffSLaurent Pinchart #define VDCTRL3_VSYNC_ONLY BIT(28) 7645d59d70SMarek Vasut #define SET_HOR_WAIT_CNT(x) (((x) & 0xfff) << 16) 7745d59d70SMarek Vasut #define GET_HOR_WAIT_CNT(x) (((x) >> 16) & 0xfff) 7845d59d70SMarek Vasut #define SET_VERT_WAIT_CNT(x) ((x) & 0xffff) 7945d59d70SMarek Vasut #define GET_VERT_WAIT_CNT(x) ((x) & 0xffff) 8045d59d70SMarek Vasut 8145d59d70SMarek Vasut #define VDCTRL4_SET_DOTCLK_DLY(x) (((x) & 0x7) << 29) /* v4 only */ 8245d59d70SMarek Vasut #define VDCTRL4_GET_DOTCLK_DLY(x) (((x) >> 29) & 0x7) /* v4 only */ 83*8c6619ffSLaurent Pinchart #define VDCTRL4_SYNC_SIGNALS_ON BIT(18) 8445d59d70SMarek Vasut #define SET_DOTCLK_H_VALID_DATA_CNT(x) ((x) & 0x3ffff) 8545d59d70SMarek Vasut 86*8c6619ffSLaurent Pinchart #define DEBUG0_HSYNC BIT(26) 87*8c6619ffSLaurent Pinchart #define DEBUG0_VSYNC BIT(25) 8845d59d70SMarek Vasut 8945d59d70SMarek Vasut #define MXSFB_MIN_XRES 120 9045d59d70SMarek Vasut #define MXSFB_MIN_YRES 120 9145d59d70SMarek Vasut #define MXSFB_MAX_XRES 0xffff 9245d59d70SMarek Vasut #define MXSFB_MAX_YRES 0xffff 9345d59d70SMarek Vasut 9445d59d70SMarek Vasut #define RED 0 9545d59d70SMarek Vasut #define GREEN 1 9645d59d70SMarek Vasut #define BLUE 2 9745d59d70SMarek Vasut #define TRANSP 3 9845d59d70SMarek Vasut 9945d59d70SMarek Vasut #define STMLCDIF_8BIT 1 /* pixel data bus to the display is of 8 bit width */ 10045d59d70SMarek Vasut #define STMLCDIF_16BIT 0 /* pixel data bus to the display is of 16 bit width */ 10145d59d70SMarek Vasut #define STMLCDIF_18BIT 2 /* pixel data bus to the display is of 18 bit width */ 10245d59d70SMarek Vasut #define STMLCDIF_24BIT 3 /* pixel data bus to the display is of 24 bit width */ 10345d59d70SMarek Vasut 10445d59d70SMarek Vasut #define MXSFB_SYNC_DATA_ENABLE_HIGH_ACT (1 << 6) 10545d59d70SMarek Vasut #define MXSFB_SYNC_DOTCLK_FALLING_ACT (1 << 7) /* negative edge sampling */ 10645d59d70SMarek Vasut 10745d59d70SMarek Vasut #endif /* __MXSFB_REGS_H__ */ 108