yongqiang niu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: mediatek/mt8183: common display driver code ......................................................................
mediatek/mt8183: common display driver code
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ie5709ab6e263caa21fdf7e799dc2ee884ffaf800 Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/mainboard/google/kukui/mainboard.c A src/soc/mediatek/common/ddp.c A src/soc/mediatek/common/include/soc/ddp.h M src/soc/mediatek/mt8173/Makefile.inc R src/soc/mediatek/mt8173/include/soc/mt8173_ddp.h R src/soc/mediatek/mt8173/mt8173_ddp.c M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/addressmap.h R src/soc/mediatek/mt8183/include/soc/mt8183_ddp.h R src/soc/mediatek/mt8183/mt8183_ddp.c 10 files changed, 285 insertions(+), 384 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/34515/1
diff --git a/src/mainboard/google/kukui/mainboard.c b/src/mainboard/google/kukui/mainboard.c index 8a8cdce..3dcdb16 100644 --- a/src/mainboard/google/kukui/mainboard.c +++ b/src/mainboard/google/kukui/mainboard.c @@ -20,7 +20,7 @@ #include <device/device.h> #include <edid.h> #include <gpio.h> -#include <soc/ddp.h> +#include <soc/mt8183_ddp.h> #include <soc/dsi.h> #include <soc/gpio.h> #include <soc/mmu_operations.h> diff --git a/src/soc/mediatek/common/ddp.c b/src/soc/mediatek/common/ddp.c new file mode 100644 index 0000000..ab17594 --- /dev/null +++ b/src/soc/mediatek/common/ddp.c @@ -0,0 +1,92 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2015 MediaTek Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <device/mmio.h> +#include <edid.h> +#include <stdlib.h> +#include <stddef.h> +#include <soc/addressmap.h> +#include <soc/ddp.h> + +#define RDMA_FIFO_PSEUDO_SIZE(bytes) (((bytes) / 16) << 16) +#define RDMA_OUTPUT_VALID_FIFO_THRESHOLD(bytes) ((bytes) / 16) + +void ovl_set_roi(u32 idx, u32 width, u32 height, u32 color) +{ + write32(&disp_ovl[idx]->roi_size, height << 16 | width); + write32(&disp_ovl[idx]->roi_bgclr, color); +} + +void ovl_layer_enable(u32 idx) +{ + write32(&disp_ovl[idx]->rdma[0].ctrl, BIT(0)); + write32(&disp_ovl[idx]->rdma[0].mem_gmc_setting, RDMA_MEM_GMC); + + setbits_le32(&disp_ovl[idx]->src_con, BIT(0)); +} + +void rdma_start(u32 idx) +{ + setbits_le32(&disp_rdma[idx]->global_con, RDMA_ENGINE_EN); +} + +void rdma_config(u32 idx, u32 width, u32 height, u32 pixel_clk) +{ + u32 threshold; + u32 reg; + u32 fifo_size; + + /* Config width */ + clrsetbits_le32(&disp_rdma[idx]->size_con_0, 0x1FFF, width); + + /* Config height */ + clrsetbits_le32(&disp_rdma[idx]->size_con_1, 0xFFFFF, height); + + /* + * Enable FIFO underflow since DSI and DPI can't be blocked. Keep the + * FIFO pseudo size reset default of 8 KiB. Set the output threshold to + * 6 microseconds with 7/6 overhead to account for blanking, and with a + * pixel depth of 4 bytes: + */ + fifo_size = RDMA_FIFO_SIZE_0 * KiB; + + threshold = pixel_clk * 4 * 7 / 1000; + + if (threshold > fifo_size) + threshold = fifo_size; + + reg = RDMA_FIFO_UNDERFLOW_EN | + RDMA_FIFO_PSEUDO_SIZE(fifo_size) | + RDMA_OUTPUT_VALID_FIFO_THRESHOLD(threshold); + + write32(&disp_rdma[idx]->fifo_con, reg); +} + +void color_start(u32 width, u32 height) +{ + write32(&disp_color[0]->width, width); + write32(&disp_color[0]->height, height); + write32(&disp_color[0]->cfg_main, COLOR_BYPASS_ALL | COLOR_SEQ_SEL); + write32(&disp_color[0]->start, BIT(0)); +} + +void ovl_layer_config(u32 idx, u32 fmt, u32 bpp, u32 width, u32 height) +{ + write32(&disp_ovl[idx]->layer[0].con, fmt << 12); + write32(&disp_ovl[idx]->layer[0].src_size, height << 16 | width); + write32(&disp_ovl[idx]->layer[0].pitch, (width * bpp) & 0xFFFF); + + ovl_layer_enable(idx); +} diff --git a/src/soc/mediatek/common/include/soc/ddp.h b/src/soc/mediatek/common/include/soc/ddp.h new file mode 100644 index 0000000..846cdeb --- /dev/null +++ b/src/soc/mediatek/common/include/soc/ddp.h @@ -0,0 +1,168 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2015 MediaTek Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _DDP_REG_H_ +#define _DDP_REG_H_ + +#include <soc/addressmap.h> +#include <types.h> + +#if CONFIG_SOC_MEDIATEK_MT8183 +#define RDMA_FIFO_SIZE_0 5 +#else +#define RDMA_FIFO_SIZE_0 8 +#endif + + +struct disp_ovl_regs { + u32 sta; + u32 inten; + u32 intsta; + u32 en; + u32 trig; + u32 rst; + u8 reserved0[8]; + u32 roi_size; + u32 datapath_con; + u32 roi_bgclr; + u32 src_con; + struct { + u32 con; + u32 srckey; + u32 src_size; + u32 offset; + u32 reserved0; + u32 pitch; + u32 reserved1[2]; + } layer[4]; + u8 reserved8[16]; + struct { + u32 ctrl; + u32 mem_start_trig; + u32 mem_gmc_setting; + u32 mem_slow_con; + u32 fifo_ctrl; + u8 reserved[12]; + } rdma[4]; + u8 reserved12[148]; + u32 debug_mon_sel; + u8 reserved13[8]; + u32 rdma_mem_gmc_setting2[4]; + u8 reserved14[16]; + u32 dummy; + u8 reserved15[60]; + u32 flow_ctrl_dbg; + u32 addcon_dbg; + u32 outmux_dbg; + u32 rdma_dbg[4]; + u8 reserved16[3300]; + u32 l0_addr; + u8 reserved17[28]; + u32 l1_addr; + u8 reserved18[28]; + u32 l2_addr; + u8 reserved19[28]; + u32 l3_addr; +}; + +check_member(disp_ovl_regs, l3_addr, 0xFA0); +static struct disp_ovl_regs *const disp_ovl[2] = { + (void *)DISP_OVL0_BASE, (void *)DISP_OVL1_BASE +}; + +struct disp_rdma_regs { + u32 int_enable; + u32 int_status; + u8 reserved0[8]; + u32 global_con; + u32 size_con_0; + u32 size_con_1; + u32 target_line; + u8 reserved1[4]; + u32 mem_con; + u32 mem_start_addr; + u32 mem_src_pitch; + u32 mem_gmc_setting_0; + u32 mem_slow_con; + u32 mem_gmc_setting_1; + u8 reserved2[4]; + u32 fifo_con; + u8 reserved3[16]; + u32 cf[3][3]; + u32 cf_pre_add[3]; + u32 cf_post_add[3]; + u32 dummy; + u32 debug_out_sel; +}; + +enum { + RDMA_ENGINE_EN = BIT(0), + RDMA_FIFO_UNDERFLOW_EN = BIT(31), + RDMA_MEM_GMC = 0x40402020, +}; + +check_member(disp_rdma_regs, debug_out_sel, 0x94); +static struct disp_rdma_regs *const disp_rdma[2] = { + (void *)DISP_RDMA0_BASE, + (void *)DISP_RDMA1_BASE, +}; + +struct disp_color_regs { + u8 reserved0[1024]; + u32 cfg_main; + u8 reserved1[2044]; + u32 start; + u8 reserved2[76]; + u32 width; + u32 height; +}; + +check_member(disp_color_regs, cfg_main, 0x400); +check_member(disp_color_regs, start, 0xC00); +check_member(disp_color_regs, width, 0xC50); +check_member(disp_color_regs, height, 0xC54); +static struct disp_color_regs *const disp_color[2] = { + (void *)DISP_COLOR0_BASE, +}; + +enum { + COLOR_BYPASS_ALL = BIT(7), + COLOR_SEQ_SEL = BIT(13), +}; + +enum OVL_INPUT_FORMAT { + OVL_INFMT_RGB565 = 0, + OVL_INFMT_RGB888 = 1, + OVL_INFMT_RGBA8888 = 2, + OVL_INFMT_ARGB8888 = 3, + OVL_INFMT_UYVY = 4, + OVL_INFMT_YUYV = 5, + OVL_INFMT_UNKNOWN = 16, + + OVL_COLOR_BASE = 30, + OVL_INFMT_BGR565 = OVL_INFMT_RGB565 + OVL_COLOR_BASE, + OVL_INFMT_BGR888 = OVL_INFMT_RGB888 + OVL_COLOR_BASE, + OVL_INFMT_BGRA8888 = OVL_INFMT_RGBA8888 + OVL_COLOR_BASE, + OVL_INFMT_ABGR8888 = OVL_INFMT_ARGB8888 + OVL_COLOR_BASE, +}; + +void ovl_set_roi(u32 idx, u32 width, u32 height, u32 color); +void ovl_layer_enable(u32 idx); +void rdma_start(u32 idx); +void rdma_config(u32 idx, u32 width, u32 height, u32 pixel_clk); +void color_start(u32 width, u32 height); +void ovl_layer_config(u32 idx, u32 fmt, u32 bpp, u32 width, u32 height); + +#endif diff --git a/src/soc/mediatek/mt8173/Makefile.inc b/src/soc/mediatek/mt8173/Makefile.inc index 0ffa196..1342ef8 100644 --- a/src/soc/mediatek/mt8173/Makefile.inc +++ b/src/soc/mediatek/mt8173/Makefile.inc @@ -81,7 +81,8 @@
ramstage-y += ../common/usb.c usb.c
-ramstage-y += ddp.c +ramstage-y += ../common/ddp.c +ramstage-y += mt8173_ddp.c ramstage-y += dsi.c
ramstage-$(CONFIG_ARM64_USE_ARM_TRUSTED_FIRMWARE) += bl31_plat_params.c diff --git a/src/soc/mediatek/mt8173/include/soc/ddp.h b/src/soc/mediatek/mt8173/include/soc/mt8173_ddp.h similarity index 78% rename from src/soc/mediatek/mt8173/include/soc/ddp.h rename to src/soc/mediatek/mt8173/include/soc/mt8173_ddp.h index 0bd832e..fb032a1 100644 --- a/src/soc/mediatek/mt8173/include/soc/ddp.h +++ b/src/soc/mediatek/mt8173/include/soc/mt8173_ddp.h @@ -13,8 +13,8 @@ * GNU General Public License for more details. */
-#ifndef _DDP_REG_H_ -#define _DDP_REG_H_ +#ifndef _MT8173_DDP_REG_H_ +#define _MT8173_DDP_REG_H_
#include <soc/addressmap.h> #include <types.h> @@ -254,100 +254,6 @@ MUTEX_MOD_DISP_UFOE | MUTEX_MOD_DISP_OD, };
-struct disp_ovl_regs { - u32 sta; - u32 inten; - u32 intsta; - u32 en; - u32 trig; - u32 rst; - u8 reserved0[8]; - u32 roi_size; - u32 datapath_con; - u32 roi_bgclr; - u32 src_con; - struct { - u32 con; - u32 srckey; - u32 src_size; - u32 offset; - u32 reserved0; - u32 pitch; - u32 reserved1[2]; - } layer[4]; - u8 reserved8[16]; - struct { - u32 ctrl; - u32 mem_start_trig; - u32 mem_gmc_setting; - u32 mem_slow_con; - u32 fifo_ctrl; - u8 reserved[12]; - } rdma[4]; - u8 reserved12[148]; - u32 debug_mon_sel; - u8 reserved13[8]; - u32 rdma_mem_gmc_setting2[4]; - u8 reserved14[16]; - u32 dummy; - u8 reserved15[60]; - u32 flow_ctrl_dbg; - u32 addcon_dbg; - u32 outmux_dbg; - u32 rdma_dbg[4]; - u8 reserved16[3300]; - u32 l0_addr; - u8 reserved17[28]; - u32 l1_addr; - u8 reserved18[28]; - u32 l2_addr; - u8 reserved19[28]; - u32 l3_addr; -}; - -check_member(disp_ovl_regs, l3_addr, 0xFA0); -static struct disp_ovl_regs *const disp_ovl[2] = { - (void *)DIS_OVL0_BASE, (void *)DIS_OVL1_BASE -}; - -struct disp_rdma_regs { - u32 int_enable; - u32 int_status; - u8 reserved0[8]; - u32 global_con; - u32 size_con_0; - u32 size_con_1; - u32 target_line; - u8 reserved1[4]; - u32 mem_con; - u32 mem_start_addr; - u32 mem_src_pitch; - u32 mem_gmc_setting_0; - u32 mem_slow_con; - u32 mem_gmc_setting_1; - u8 reserved2[4]; - u32 fifo_con; - u8 reserved3[16]; - u32 cf[3][3]; - u32 cf_pre_add[3]; - u32 cf_post_add[3]; - u32 dummy; - u32 debug_out_sel; -}; - -enum { - RDMA_ENGINE_EN = BIT(0), - RDMA_FIFO_UNDERFLOW_EN = BIT(31), - RDMA_MEM_GMC = 0x40402020, -}; - -check_member(disp_rdma_regs, debug_out_sel, 0x94); -static struct disp_rdma_regs *const disp_rdma[3] = { - (void *)DISP_RDMA0_BASE, - (void *)DISP_RDMA1_BASE, - (void *)DISP_RDMA2_BASE -}; - struct disp_od_regs { u32 en; u32 reset; @@ -436,22 +342,6 @@ COLOR_SEQ_SEL = BIT(13), };
-enum OVL_INPUT_FORMAT { - OVL_INFMT_RGB565 = 0, - OVL_INFMT_RGB888 = 1, - OVL_INFMT_RGBA8888 = 2, - OVL_INFMT_ARGB8888 = 3, - OVL_INFMT_UYVY = 4, - OVL_INFMT_YUYV = 5, - OVL_INFMT_UNKNOWN = 16, - - OVL_COLOR_BASE = 30, - OVL_INFMT_BGR565 = OVL_INFMT_RGB565 + OVL_COLOR_BASE, - OVL_INFMT_BGR888 = OVL_INFMT_RGB888 + OVL_COLOR_BASE, - OVL_INFMT_BGRA8888 = OVL_INFMT_RGBA8888 + OVL_COLOR_BASE, - OVL_INFMT_ABGR8888 = OVL_INFMT_ARGB8888 + OVL_COLOR_BASE, -}; - void mtk_ddp_init(bool dual_dsi_mode); void mtk_ddp_mode_set(const struct edid *edid, bool dual_dsi_mode);
diff --git a/src/soc/mediatek/mt8173/ddp.c b/src/soc/mediatek/mt8173/mt8173_ddp.c similarity index 66% rename from src/soc/mediatek/mt8173/ddp.c rename to src/soc/mediatek/mt8173/mt8173_ddp.c index 0b78c3e..6acdb3b 100644 --- a/src/soc/mediatek/mt8173/ddp.c +++ b/src/soc/mediatek/mt8173/mt8173_ddp.c @@ -20,9 +20,6 @@ #include <soc/addressmap.h> #include <soc/ddp.h>
-#define RDMA_FIFO_PSEUDO_SIZE(bytes) (((bytes) / 16) << 16) -#define RDMA_OUTPUT_VALID_FIFO_THRESHOLD(bytes) ((bytes) / 16) - static void disp_config_main_path_connection(bool dual_dsi_mode) { write32(&mmsys_cfg->disp_ovl0_mout_en, OVL0_MOUT_EN_COLOR0); @@ -50,52 +47,6 @@ write32(&disp_mutex->mutex[0].en, BIT(0)); }
-static void ovl_set_roi(u32 width, u32 height, u32 color) -{ - write32(&disp_ovl[0]->roi_size, height << 16 | width); - write32(&disp_ovl[0]->roi_bgclr, color); -} - -static void ovl_layer_enable(void) -{ - write32(&disp_ovl[0]->rdma[0].ctrl, BIT(0)); - write32(&disp_ovl[0]->rdma[0].mem_gmc_setting, RDMA_MEM_GMC); - - setbits_le32(&disp_ovl[0]->src_con, BIT(0)); -} - -static void rdma_start(void) -{ - setbits_le32(&disp_rdma[0]->global_con, RDMA_ENGINE_EN); -} - -static void rdma_config(u32 width, u32 height, u32 pixel_clk) -{ - u32 threshold; - u32 reg; - - /* Config width */ - clrsetbits_le32(&disp_rdma[0]->size_con_0, 0x1FFF, width); - - /* Config height */ - clrsetbits_le32(&disp_rdma[0]->size_con_1, 0xFFFFF, height); - - /* - * Enable FIFO underflow since DSI and DPI can't be blocked. Keep the - * FIFO pseudo size reset default of 8 KiB. Set the output threshold to - * 6 microseconds with 7/6 overhead to account for blanking, and with a - * pixel depth of 4 bytes: - */ - - threshold = pixel_clk * 4 * 7 / 1000; - - reg = RDMA_FIFO_UNDERFLOW_EN | - RDMA_FIFO_PSEUDO_SIZE(8 * KiB) | - RDMA_OUTPUT_VALID_FIFO_THRESHOLD(threshold); - - write32(&disp_rdma[0]->fifo_con, reg); -} - static void od_start(u32 width, u32 height) { write32(&disp_od->size, width << 16 | height); @@ -115,28 +66,11 @@ } }
-static void color_start(u32 width, u32 height) -{ - write32(&disp_color[0]->width, width); - write32(&disp_color[0]->height, height); - write32(&disp_color[0]->cfg_main, COLOR_BYPASS_ALL | COLOR_SEQ_SEL); - write32(&disp_color[0]->start, BIT(0)); -} - static void split_start(void) { write32(&disp_split->start, 1); }
-static void ovl_layer_config(u32 fmt, u32 bpp, u32 width, u32 height) -{ - write32(&disp_ovl[0]->layer[0].con, fmt << 12); - write32(&disp_ovl[0]->layer[0].src_size, height << 16 | width); - write32(&disp_ovl[0]->layer[0].pitch, (width * bpp) & 0xFFFF); - - ovl_layer_enable(); -} - static void main_disp_path_setup(u32 width, u32 height, u32 pixel_clk, bool dual_dsi_mode) { diff --git a/src/soc/mediatek/mt8183/Makefile.inc b/src/soc/mediatek/mt8183/Makefile.inc index 15ad154..63f8b6b 100644 --- a/src/soc/mediatek/mt8183/Makefile.inc +++ b/src/soc/mediatek/mt8183/Makefile.inc @@ -42,7 +42,8 @@
ramstage-y += auxadc.c ramstage-y += ../common/cbmem.c emi.c -ramstage-y += ddp.c +ramstage-y += ../common/ddp.c +ramstage-y += mt8183_ddp.c ramstage-y += dsi.c ramstage-y += ../common/gpio.c gpio.c ramstage-y += ../common/mmu_operations.c mmu_operations.c diff --git a/src/soc/mediatek/mt8183/include/soc/addressmap.h b/src/soc/mediatek/mt8183/include/soc/addressmap.h index 75202dd..708a2a6 100644 --- a/src/soc/mediatek/mt8183/include/soc/addressmap.h +++ b/src/soc/mediatek/mt8183/include/soc/addressmap.h @@ -54,20 +54,20 @@ IOCFG_LT_BASE = IO_PHYS + 0x01F20000, IOCFG_TL_BASE = IO_PHYS + 0x01F30000, SSUSB_SIF_BASE = IO_PHYS + 0x01F40300, - MMSYS_BASE = IO_PHYS + 0x04000000, - DISP_OVL0_BASE = IO_PHYS + 0x04008000, - DISP_OVL0_2L_BASE = IO_PHYS + 0x04009000, - DISP_OVL1_2L_BASE = IO_PHYS + 0x0400A000, - DISP_RDMA0_BASE = IO_PHYS + 0x0400B000, - DISP_RDMA1_BASE = IO_PHYS + 0x0400C000, - DISP_COLOR0_BASE = IO_PHYS + 0x0400E000, - DISP_CCORR0_BASE = IO_PHYS + 0x0400F000, - DISP_AAL0_BASE = IO_PHYS + 0x04010000, - DISP_GAMMA0_BASE = IO_PHYS + 0x04011000, - DISP_DITHER0_BASE = IO_PHYS + 0x04012000, + MMSYS_BASE = IO_PHYS + 0x04000000, + DISP_OVL0_BASE = IO_PHYS + 0x04008000, + DISP_OVL1_BASE = IO_PHYS + 0x04009000, + DISP_OVL1_2L_BASE = IO_PHYS + 0x0400A000, + DISP_RDMA0_BASE = IO_PHYS + 0x0400B000, + DISP_RDMA1_BASE = IO_PHYS + 0x0400C000, + DISP_COLOR0_BASE = IO_PHYS + 0x0400E000, + DISP_CCORR0_BASE = IO_PHYS + 0x0400F000, + DISP_AAL0_BASE = IO_PHYS + 0x04010000, + DISP_GAMMA0_BASE = IO_PHYS + 0x04011000, + DISP_DITHER0_BASE = IO_PHYS + 0x04012000, DSI_BASE = IO_PHYS + 0x04014000, - DISP_MUTEX_BASE = IO_PHYS + 0x04016000, - SMI_LARB0 = IO_PHYS + 0x04017000, + DISP_MUTEX_BASE = IO_PHYS + 0x04016000, + SMI_LARB0 = IO_PHYS + 0x04017000, SMI_BASE = IO_PHYS + 0x04019000, };
diff --git a/src/soc/mediatek/mt8183/include/soc/ddp.h b/src/soc/mediatek/mt8183/include/soc/mt8183_ddp.h similarity index 67% rename from src/soc/mediatek/mt8183/include/soc/ddp.h rename to src/soc/mediatek/mt8183/include/soc/mt8183_ddp.h index 501efa2..bbbabd7 100644 --- a/src/soc/mediatek/mt8183/include/soc/ddp.h +++ b/src/soc/mediatek/mt8183/include/soc/mt8183_ddp.h @@ -13,8 +13,8 @@ * GNU General Public License for more details. */
-#ifndef _DDP_REG_H_ -#define _DDP_REG_H_ +#ifndef _MT8183_DDP_REG_H_ +#define _MT8183_DDP_REG_H_
#include <soc/addressmap.h> #include <types.h> @@ -161,109 +161,6 @@ MUTEX_SOF_DPI0 = 2, };
-struct disp_ovl_regs { - u32 sta; - u32 inten; - u32 intsta; - u32 en; - u32 trig; - u32 rst; - u32 reserved_0x018[2]; - u32 roi_size; - u32 datapath_con; - u32 roi_bgclr; - u32 src_con; - struct { - u32 con; - u32 srckey; - u32 src_size; - u32 offset; - u32 reserved0; - u32 pitch; - u32 reserved1[2]; - } layer[4]; - u32 reserved_0x0B0[4]; - struct { - u32 ctrl; - u32 reserved0; - u32 mem_gmc_setting; - u32 mem_slow_con; - u32 fifo_ctrl; - u32 reserved1[3]; - } rdma[4]; - u32 reserved_0x140[880]; - u32 reserved_0xF00[16]; - u32 l0_addr; - u32 reserved_0xF44[7]; - u32 l1_addr; - u32 reserved_0xF64[7]; - u32 l2_addr; - u32 reserved_0xF84[7]; - u32 l3_addr; -}; - -check_member(disp_ovl_regs, l3_addr, 0xFA0); -static struct disp_ovl_regs *const disp_ovl[2] = { - (void *)DISP_OVL0_BASE, (void *)DISP_OVL0_2L_BASE -}; - -struct disp_rdma_regs { - u32 int_enable; - u32 int_status; - u32 reserved0[2]; - u32 global_con; - u32 size_con_0; - u32 size_con_1; - u32 target_line; - u32 reserved1; - u32 mem_con; - u32 reserved2; - u32 mem_src_pitch; - u32 mem_gmc_setting_0; - u32 mem_gmc_setting_1; - u32 mem_slow_con; - u32 mem_gmc_setting_2; - u32 fifo_con; - u32 reserved3[4]; - u32 cf[3][3]; - u32 cf_pre_add[3]; - u32 cf_post_add[3]; - u32 dummy; - u32 debug_out_sel; -}; - -enum { - RDMA_ENGINE_EN = BIT(0), - RDMA_FIFO_UNDERFLOW_EN = BIT(31), - RDMA_FIFO_SIZE_0 = 5, /* 5K */ - RDMA_VREFRESH = 60, /* vrefresh 60HZ */ - RDMA_MEM_GMC = 0x40402020, -}; - -check_member(disp_rdma_regs, debug_out_sel, 0x94); -static struct disp_rdma_regs *const disp_rdma[2] = { - (void *)DISP_RDMA0_BASE, - (void *)DISP_RDMA1_BASE, -}; - -struct disp_color_regs { - u8 reserved0[1024]; - u32 cfg_main; - u8 reserved1[2044]; - u32 start; - u8 reserved2[76]; - u32 width; - u32 height; -}; - -check_member(disp_color_regs, height, 0xC54); -static struct disp_color_regs *const disp_color = (void *)DISP_COLOR0_BASE; - -enum { - COLOR_BYPASS_ALL = BIT(7), - COLOR_SEQ_SEL = BIT(13), -}; - struct disp_pq_regs { u32 en; u32 reset; @@ -293,22 +190,6 @@ SMI_LARB_NON_SEC_CON = 0x380, };
-enum OVL_INPUT_FORMAT { - OVL_INFMT_RGB565 = 0, - OVL_INFMT_RGB888 = 1, - OVL_INFMT_RGBA8888 = 2, - OVL_INFMT_ARGB8888 = 3, - OVL_INFMT_UYVY = 4, - OVL_INFMT_YUYV = 5, - OVL_INFMT_UNKNOWN = 16, - - OVL_COLOR_BASE = 30, - OVL_INFMT_BGR565 = OVL_INFMT_RGB565 + OVL_COLOR_BASE, - OVL_INFMT_BGR888 = OVL_INFMT_RGB888 + OVL_COLOR_BASE, - OVL_INFMT_BGRA8888 = OVL_INFMT_RGBA8888 + OVL_COLOR_BASE, - OVL_INFMT_ABGR8888 = OVL_INFMT_ARGB8888 + OVL_COLOR_BASE, -}; - void mtk_ddp_init(void); void mtk_ddp_mode_set(const struct edid *edid);
diff --git a/src/soc/mediatek/mt8183/ddp.c b/src/soc/mediatek/mt8183/mt8183_ddp.c similarity index 63% rename from src/soc/mediatek/mt8183/ddp.c rename to src/soc/mediatek/mt8183/mt8183_ddp.c index d845981..bf8f368 100644 --- a/src/soc/mediatek/mt8183/ddp.c +++ b/src/soc/mediatek/mt8183/mt8183_ddp.c @@ -21,11 +21,9 @@ #include <string.h> #include <stddef.h> #include <soc/addressmap.h> +#include <soc/mt8183_ddp.h> #include <soc/ddp.h>
-#define RDMA_FIFO_PSEUDO_SIZE(bytes) (((bytes) / 16) << 16) -#define RDMA_OUTPUT_VALID_FIFO_THRESHOLD(bytes) ((bytes) / 16) - static void disp_config_main_path_connection(void) { write32(&mmsys_cfg->disp_ovl0_mout_en, OVL0_MOUT_EN_OVL0_2L); @@ -46,67 +44,11 @@ write32(&disp_mutex->mutex[0].en, BIT(0)); }
-static void ovl_set_roi(u32 idx, u32 width, u32 height, u32 color) -{ - write32(&disp_ovl[idx]->roi_size, height << 16 | width); - write32(&disp_ovl[idx]->roi_bgclr, color); -} - -static void ovl_layer_enable(u32 idx) -{ - write32(&disp_ovl[idx]->rdma[0].ctrl, BIT(0)); - write32(&disp_ovl[idx]->rdma[0].mem_gmc_setting, RDMA_MEM_GMC); - - setbits_le32(&disp_ovl[idx]->src_con, BIT(0)); -} - static void ovl_bgclr_in_sel(u32 idx) { setbits_le32(&disp_ovl[idx]->datapath_con, BIT(2)); }
-static void rdma_start(u32 idx) -{ - setbits_le32(&disp_rdma[idx]->global_con, RDMA_ENGINE_EN); -} - -static void rdma_config(u32 idx, u32 width, u32 height, u32 vrefresh) -{ - u32 threshold; - u32 reg; - u32 fifo_size; - - clrsetbits_le32(&disp_rdma[idx]->size_con_0, 0x1FFF, width); - clrsetbits_le32(&disp_rdma[idx]->size_con_1, 0xFFFFF, height); - - /* - * Enable FIFO underflow since DSI and DPI can't be blocked. Keep the - * FIFO pseudo size reset default of 8 KiB. Set the output threshold to - * 6 microseconds with 7/6 overhead to account for blanking, and with a - * pixel depth of 4 bytes: - */ - fifo_size = RDMA_FIFO_SIZE_0 * KiB; - - threshold = width * height * vrefresh * 4 * 7 / 1000000; - - if (threshold > fifo_size) - threshold = fifo_size; - - reg = RDMA_FIFO_UNDERFLOW_EN | - RDMA_FIFO_PSEUDO_SIZE(fifo_size) | - RDMA_OUTPUT_VALID_FIFO_THRESHOLD(threshold); - - write32(&disp_rdma[idx]->fifo_con, reg); -} - -static void color_start(u32 width, u32 height) -{ - write32(&disp_color->width, width); - write32(&disp_color->height, height); - write32(&disp_color->cfg_main, COLOR_BYPASS_ALL | COLOR_SEQ_SEL); - write32(&disp_color->start, BIT(0)); -} - static void aal_start(u32 width, u32 height) { write32(&disp_aal->size, height << 16 | width); @@ -133,18 +75,10 @@ write32(&disp_gamma->en, PQ_EN); }
-static void ovl_layer_config(u32 idx, u32 fmt, u32 bpp, u32 width, u32 height) -{ - write32(&disp_ovl[idx]->layer[0].con, fmt << 12); - write32(&disp_ovl[idx]->layer[0].src_size, height << 16 | width); - write32(&disp_ovl[idx]->layer[0].pitch, (width * bpp) & 0xFFFF); - - ovl_layer_enable(idx); -} - static void main_disp_path_setup(u32 width, u32 height, u32 vrefresh) { u32 idx = 0; + u32 pixel_clk = width * height * vrefresh;
/* Setup OVL */ for (idx = 0; idx < MAIN_PATH_OVL_NR; idx++) { @@ -157,7 +91,7 @@ }
idx = 0; - rdma_config(idx, width, height, vrefresh); + rdma_config(idx, width, height, pixel_clk); color_start(width, height); ccorr_start(width, height); aal_start(width, height);
Hello Jitao Shi, Julius Werner, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34515
to look at the new patch set (#2).
Change subject: mediatek/mt8183: common display driver code ......................................................................
mediatek/mt8183: common display driver code
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ie5709ab6e263caa21fdf7e799dc2ee884ffaf800 Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/mainboard/google/kukui/mainboard.c A src/soc/mediatek/common/ddp.c A src/soc/mediatek/common/include/soc/ddp.h M src/soc/mediatek/mt8173/Makefile.inc R src/soc/mediatek/mt8173/include/soc/mt8173_ddp.h R src/soc/mediatek/mt8173/mt8173_ddp.c M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/addressmap.h R src/soc/mediatek/mt8183/include/soc/mt8183_ddp.h R src/soc/mediatek/mt8183/mt8183_ddp.c 10 files changed, 285 insertions(+), 384 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/34515/2
Hello Jitao Shi, Julius Werner, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34515
to look at the new patch set (#3).
Change subject: mediatek/mt8183: common display driver code ......................................................................
mediatek/mt8183: common display driver code
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ie5709ab6e263caa21fdf7e799dc2ee884ffaf800 Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/mainboard/google/kukui/mainboard.c A src/soc/mediatek/common/ddp.c A src/soc/mediatek/common/include/soc/ddp.h M src/soc/mediatek/mt8173/Makefile.inc R src/soc/mediatek/mt8173/include/soc/mt8173_ddp.h R src/soc/mediatek/mt8173/mt8173_ddp.c M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/addressmap.h R src/soc/mediatek/mt8183/include/soc/mt8183_ddp.h R src/soc/mediatek/mt8183/mt8183_ddp.c 10 files changed, 285 insertions(+), 407 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/34515/3
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: mediatek/mt8183: common display driver code ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/34515/3//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/34515/3//COMMIT_MSG@7 PS3, Line 7: mediatek/mt8183: common display driver code Please use a sentence:
mediatek/mt8183: Refactor display driver code as common code
Hello Jitao Shi, Julius Werner, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34515
to look at the new patch set (#4).
Change subject: mediatek/mt8183: common display driver code ......................................................................
mediatek/mt8183: common display driver code
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ie5709ab6e263caa21fdf7e799dc2ee884ffaf800 Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/mainboard/google/kukui/mainboard.c M src/mainboard/google/oak/mainboard.c A src/soc/mediatek/common/ddp.c A src/soc/mediatek/common/include/soc/ddp.h M src/soc/mediatek/mt8173/Makefile.inc R src/soc/mediatek/mt8173/include/soc/mt8173_ddp.h R src/soc/mediatek/mt8173/mt8173_ddp.c M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/addressmap.h R src/soc/mediatek/mt8183/include/soc/mt8183_ddp.h R src/soc/mediatek/mt8183/mt8183_ddp.c 11 files changed, 274 insertions(+), 396 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/34515/4
Hello Jitao Shi, Julius Werner, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34515
to look at the new patch set (#5).
Change subject: mediatek/mt8183: Refactor display driver code as common code ......................................................................
mediatek/mt8183: Refactor display driver code as common code
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ie5709ab6e263caa21fdf7e799dc2ee884ffaf800 Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/mainboard/google/kukui/mainboard.c M src/mainboard/google/oak/mainboard.c A src/soc/mediatek/common/ddp.c A src/soc/mediatek/common/include/soc/ddp.h M src/soc/mediatek/mt8173/Makefile.inc R src/soc/mediatek/mt8173/include/soc/mt8173_ddp.h R src/soc/mediatek/mt8173/mt8173_ddp.c M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/addressmap.h R src/soc/mediatek/mt8183/include/soc/mt8183_ddp.h R src/soc/mediatek/mt8183/mt8183_ddp.c 11 files changed, 274 insertions(+), 396 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/34515/5
Hello Jitao Shi, Julius Werner, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34515
to look at the new patch set (#6).
Change subject: mediatek/mt8183: Refactor display driver code as common code ......................................................................
mediatek/mt8183: Refactor display driver code as common code
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ie5709ab6e263caa21fdf7e799dc2ee884ffaf800 Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/mainboard/google/kukui/mainboard.c M src/mainboard/google/oak/mainboard.c A src/soc/mediatek/common/ddp.c A src/soc/mediatek/common/include/soc/ddp.h M src/soc/mediatek/mt8173/Makefile.inc R src/soc/mediatek/mt8173/include/soc/mt8173_ddp.h R src/soc/mediatek/mt8173/mt8173_ddp.c M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/addressmap.h R src/soc/mediatek/mt8183/include/soc/mt8183_ddp.h R src/soc/mediatek/mt8183/mt8183_ddp.c 11 files changed, 278 insertions(+), 400 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/34515/6
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: mediatek/mt8183: Refactor display driver code as common code ......................................................................
Patch Set 6: Code-Review+1
Hung-Te Lin has uploaded a new patch set (#7) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
soc/mediatek/mt8173: Refactor display driver to share common parts
Move those will be shared by other MTK SOCs (for example, MT8183) to common/ddp.c.
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Oak
Change-Id: Ie5709ab6e263caa21fdf7e799dc2ee884ffaf800 Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- A src/soc/mediatek/common/ddp.c A src/soc/mediatek/common/include/soc/ddp_common.h M src/soc/mediatek/mt8173/Makefile.inc M src/soc/mediatek/mt8173/ddp.c M src/soc/mediatek/mt8173/include/soc/addressmap.h M src/soc/mediatek/mt8173/include/soc/ddp.h 6 files changed, 260 insertions(+), 208 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/34515/7
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
Patch Set 7: Code-Review+1
(1 comment)
@jwerner are we ok with this version?
https://review.coreboot.org/c/coreboot/+/34515/3//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/34515/3//COMMIT_MSG@7 PS3, Line 7: mediatek/mt8183: common display driver code
Please use a sentence: […]
Ack
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
Patch Set 7:
(1 comment)
https://review.coreboot.org/c/coreboot/+/34515/7/src/soc/mediatek/common/inc... File src/soc/mediatek/common/include/soc/ddp_common.h:
https://review.coreboot.org/c/coreboot/+/34515/7/src/soc/mediatek/common/inc... PS7, Line 111: 2 Why is it changed from 3 to 2?
If you're changing this, consider removing DISP_RDMA2_BASE from addressmap.h.
Hung-Te Lin has uploaded a new patch set (#8) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
soc/mediatek/mt8173: Refactor display driver to share common parts
Move those will be shared by other MTK SOCs (for example, MT8183) to common/ddp.c. The 'dual DSI mode' was actually never used so it's also removed so the API for different MTK SOCs can be more similar to each other.
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Oak
Change-Id: Ie5709ab6e263caa21fdf7e799dc2ee884ffaf800 Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/mainboard/google/oak/mainboard.c A src/soc/mediatek/common/ddp.c A src/soc/mediatek/common/include/soc/ddp_common.h M src/soc/mediatek/mt8173/Makefile.inc M src/soc/mediatek/mt8173/ddp.c M src/soc/mediatek/mt8173/include/soc/addressmap.h M src/soc/mediatek/mt8173/include/soc/ddp.h 7 files changed, 267 insertions(+), 284 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/34515/8
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/c/coreboot/+/34515/7/src/soc/mediatek/common/inc... File src/soc/mediatek/common/include/soc/ddp_common.h:
https://review.coreboot.org/c/coreboot/+/34515/7/src/soc/mediatek/common/inc... PS7, Line 111: 2
Why is it changed from 3 to 2? […]
actually we only used rdma0.
Hung-Te Lin has uploaded a new patch set (#9) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
soc/mediatek/mt8173: Refactor display driver to share common parts
Move those will be shared by other MTK SOCs (for example, MT8183) to common/ddp.c. The 'dual DSI mode' was actually never used so it's also removed so the API for different MTK SOCs can be more similar to each other.
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Oak
Change-Id: Ie5709ab6e263caa21fdf7e799dc2ee884ffaf800 Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/mainboard/google/oak/mainboard.c A src/soc/mediatek/common/ddp.c A src/soc/mediatek/common/include/soc/ddp_common.h M src/soc/mediatek/mt8173/Makefile.inc M src/soc/mediatek/mt8173/ddp.c M src/soc/mediatek/mt8173/include/soc/addressmap.h M src/soc/mediatek/mt8173/include/soc/ddp.h 7 files changed, 267 insertions(+), 283 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/34515/9
Hung-Te Lin has uploaded a new patch set (#10) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
soc/mediatek/mt8173: Refactor display driver to share common parts
Move those will be shared by other MTK SOCs (for example, MT8183) to common/ddp.c. The 'dual DSI mode' was actually never used so it's also removed so the API for different MTK SOCs can be more similar to each other.
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Oak
Change-Id: Ie5709ab6e263caa21fdf7e799dc2ee884ffaf800 Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/mainboard/google/oak/mainboard.c A src/soc/mediatek/common/ddp.c A src/soc/mediatek/common/include/soc/ddp_common.h M src/soc/mediatek/mt8173/Makefile.inc M src/soc/mediatek/mt8173/ddp.c M src/soc/mediatek/mt8173/include/soc/addressmap.h M src/soc/mediatek/mt8173/include/soc/ddp.h 7 files changed, 265 insertions(+), 283 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/34515/10
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
Patch Set 9:
(1 comment)
https://review.coreboot.org/c/coreboot/+/34515/7/src/soc/mediatek/common/inc... File src/soc/mediatek/common/include/soc/ddp_common.h:
https://review.coreboot.org/c/coreboot/+/34515/7/src/soc/mediatek/common/inc... PS7, Line 111: 2
actually we only used rdma0.
I'm keeping addressmap unchanged, since that's the map definition, which may include areas we don't really use.
Instead I'm removing the variable here.
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
Patch Set 10:
(1 comment)
https://review.coreboot.org/c/coreboot/+/34515/7/src/soc/mediatek/common/inc... File src/soc/mediatek/common/include/soc/ddp_common.h:
https://review.coreboot.org/c/coreboot/+/34515/7/src/soc/mediatek/common/inc... PS7, Line 111: 2
I'm keeping addressmap unchanged, since that's the map definition, which may include areas we don't […]
Ack
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
Patch Set 10:
(1 comment)
https://review.coreboot.org/c/coreboot/+/34515/10/src/soc/mediatek/common/dd... File src/soc/mediatek/common/ddp.c:
https://review.coreboot.org/c/coreboot/+/34515/10/src/soc/mediatek/common/dd... PS10, Line 32: void rdma_start() Bad function definition - void rdma_start() should probably be void rdma_start(void)
Hung-Te Lin has uploaded a new patch set (#11) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
soc/mediatek/mt8173: Refactor display driver to share common parts
Move those will be shared by other MTK SOCs (for example, MT8183) to common/ddp.c. The 'dual DSI mode' was actually never used so it's also removed so the API for different MTK SOCs can be more similar to each other.
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Oak
Change-Id: Ie5709ab6e263caa21fdf7e799dc2ee884ffaf800 Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- A src/soc/mediatek/common/ddp.c A src/soc/mediatek/common/include/soc/ddp_common.h M src/soc/mediatek/mt8173/Makefile.inc M src/soc/mediatek/mt8173/ddp.c M src/soc/mediatek/mt8173/include/soc/addressmap.h M src/soc/mediatek/mt8173/include/soc/ddp.h 6 files changed, 248 insertions(+), 226 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/34515/11
Hung-Te Lin has uploaded a new patch set (#12) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
soc/mediatek/mt8173: Refactor display driver to share common parts
Move those will be shared by other MTK SOCs (for example, MT8183) to common/ddp.c.
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Oak
Change-Id: Ie5709ab6e263caa21fdf7e799dc2ee884ffaf800 Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- A src/soc/mediatek/common/ddp.c A src/soc/mediatek/common/include/soc/ddp_common.h M src/soc/mediatek/mt8173/Makefile.inc M src/soc/mediatek/mt8173/ddp.c M src/soc/mediatek/mt8173/include/soc/addressmap.h M src/soc/mediatek/mt8173/include/soc/ddp.h 6 files changed, 248 insertions(+), 226 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/34515/12
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
Patch Set 12:
(1 comment)
https://review.coreboot.org/c/coreboot/+/34515/10/src/soc/mediatek/common/dd... File src/soc/mediatek/common/ddp.c:
https://review.coreboot.org/c/coreboot/+/34515/10/src/soc/mediatek/common/dd... PS10, Line 32: void rdma_start()
Bad function definition - void rdma_start() should probably be void rdma_start(void)
Done
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
Patch Set 11:
(1 comment)
https://review.coreboot.org/c/coreboot/+/34515/11/src/soc/mediatek/common/dd... File src/soc/mediatek/common/ddp.c:
https://review.coreboot.org/c/coreboot/+/34515/11/src/soc/mediatek/common/dd... PS11, Line 32: void rdma_start() Bad function definition - void rdma_start() should probably be void rdma_start(void)
Hung-Te Lin has uploaded a new patch set (#13) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
soc/mediatek/mt8173: Refactor display driver to share common parts
Move those will be shared by other MTK SOCs (for example, MT8183) to common/ddp.c.
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Oak
Change-Id: Ie5709ab6e263caa21fdf7e799dc2ee884ffaf800 Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- A src/soc/mediatek/common/ddp.c A src/soc/mediatek/common/include/soc/ddp_common.h M src/soc/mediatek/mt8173/Makefile.inc M src/soc/mediatek/mt8173/ddp.c M src/soc/mediatek/mt8173/include/soc/addressmap.h M src/soc/mediatek/mt8173/include/soc/ddp.h 6 files changed, 248 insertions(+), 226 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/34515/13
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
Patch Set 13:
(1 comment)
https://review.coreboot.org/c/coreboot/+/34515/13/src/soc/mediatek/common/dd... File src/soc/mediatek/common/ddp.c:
https://review.coreboot.org/c/coreboot/+/34515/13/src/soc/mediatek/common/dd... PS13, Line 32: void rdma_start() Bad function definition - void rdma_start() should probably be void rdma_start(void)
Hung-Te Lin has uploaded a new patch set (#14) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
soc/mediatek/mt8173: Refactor display driver to share common parts
Move those will be shared by other MTK SOCs (for example, MT8183) to common/ddp.c.
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Oak
Change-Id: Ie5709ab6e263caa21fdf7e799dc2ee884ffaf800 Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- A src/soc/mediatek/common/ddp.c A src/soc/mediatek/common/include/soc/ddp_common.h M src/soc/mediatek/mt8173/Makefile.inc M src/soc/mediatek/mt8173/ddp.c M src/soc/mediatek/mt8173/include/soc/addressmap.h M src/soc/mediatek/mt8173/include/soc/ddp.h 6 files changed, 248 insertions(+), 226 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/34515/14
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
Patch Set 14: Code-Review+2
(1 comment)
https://review.coreboot.org/c/coreboot/+/34515/14/src/soc/mediatek/common/in... File src/soc/mediatek/common/include/soc/ddp_common.h:
https://review.coreboot.org/c/coreboot/+/34515/14/src/soc/mediatek/common/in... PS14, Line 151: void ovl_set_roi(u32 idx, u32 width, u32 height, u32 color); nit: Please namespace these better now that they're no longer static (e.g. mtk_ddp_ovl_set_roi()).
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
Patch Set 15:
(1 comment)
https://review.coreboot.org/c/coreboot/+/34515/14/src/soc/mediatek/common/in... File src/soc/mediatek/common/include/soc/ddp_common.h:
https://review.coreboot.org/c/coreboot/+/34515/14/src/soc/mediatek/common/in... PS14, Line 151: void ovl_set_roi(u32 idx, u32 width, u32 height, u32 color);
nit: Please namespace these better now that they're no longer static (e.g. mtk_ddp_ovl_set_roi()).
let's do that later since there's almost no one except SOC ddp module will call them. and this has been taking so long to where we are...
Julius Werner has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/34515 )
Change subject: soc/mediatek/mt8173: Refactor display driver to share common parts ......................................................................
soc/mediatek/mt8173: Refactor display driver to share common parts
Move those will be shared by other MTK SOCs (for example, MT8183) to common/ddp.c.
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Oak
Change-Id: Ie5709ab6e263caa21fdf7e799dc2ee884ffaf800 Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/34515 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Julius Werner jwerner@chromium.org --- A src/soc/mediatek/common/ddp.c A src/soc/mediatek/common/include/soc/ddp_common.h M src/soc/mediatek/mt8173/Makefile.inc M src/soc/mediatek/mt8173/ddp.c M src/soc/mediatek/mt8173/include/soc/addressmap.h M src/soc/mediatek/mt8173/include/soc/ddp.h 6 files changed, 248 insertions(+), 226 deletions(-)
Approvals: build bot (Jenkins): Verified Julius Werner: Looks good to me, approved
diff --git a/src/soc/mediatek/common/ddp.c b/src/soc/mediatek/common/ddp.c new file mode 100644 index 0000000..173fa90 --- /dev/null +++ b/src/soc/mediatek/common/ddp.c @@ -0,0 +1,82 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2019 MediaTek Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <device/mmio.h> +#include <edid.h> +#include <stdlib.h> +#include <stddef.h> +#include <soc/addressmap.h> +#include <soc/ddp.h> + +#define RDMA_FIFO_PSEUDO_SIZE(bytes) (((bytes) / 16) << 16) +#define RDMA_OUTPUT_VALID_FIFO_THRESHOLD(bytes) ((bytes) / 16) + +void ovl_set_roi(u32 idx, u32 width, u32 height, u32 color) +{ + write32(&disp_ovl[idx]->roi_size, height << 16 | width); + write32(&disp_ovl[idx]->roi_bgclr, color); +} + +void rdma_start(void) +{ + setbits_le32(&disp_rdma0->global_con, RDMA_ENGINE_EN); +} + +void rdma_config(u32 width, u32 height, u32 pixel_clk, u32 fifo_size) +{ + u32 threshold; + u32 reg; + + clrsetbits_le32(&disp_rdma0->size_con_0, 0x1FFF, width); + clrsetbits_le32(&disp_rdma0->size_con_1, 0xFFFFF, height); + + /* + * Enable FIFO underflow since DSI and DPI can't be blocked. Set the + * output threshold to 6 microseconds with 7/6 overhead to account for + * blanking, and with a pixel depth of 4 bytes: + */ + threshold = pixel_clk * 4 * 7 / 1000; + + if (threshold > fifo_size) + threshold = fifo_size; + + reg = RDMA_FIFO_UNDERFLOW_EN | RDMA_FIFO_PSEUDO_SIZE(fifo_size) | + RDMA_OUTPUT_VALID_FIFO_THRESHOLD(threshold); + + write32(&disp_rdma0->fifo_con, reg); +} + +void color_start(u32 width, u32 height) +{ + + write32(&disp_color0->width, width); + write32(&disp_color0->height, height); + write32(&disp_color0->cfg_main, COLOR_BYPASS_ALL | COLOR_SEQ_SEL); + write32(&disp_color0->start, BIT(0)); +} + +void ovl_layer_config(u32 fmt, u32 bpp, u32 width, u32 height) +{ + struct disp_ovl_regs *const ovl0 = disp_ovl[0]; + write32(&ovl0->layer[0].con, fmt << 12); + write32(&ovl0->layer[0].src_size, height << 16 | width); + write32(&ovl0->layer[0].pitch, (width * bpp) & 0xFFFF); + + /* Enable layer */ + write32(&ovl0->rdma[0].ctrl, BIT(0)); + write32(&ovl0->rdma[0].mem_gmc_setting, RDMA_MEM_GMC); + + setbits_le32(&ovl0->src_con, BIT(0)); +} diff --git a/src/soc/mediatek/common/include/soc/ddp_common.h b/src/soc/mediatek/common/include/soc/ddp_common.h new file mode 100644 index 0000000..6d00ea3 --- /dev/null +++ b/src/soc/mediatek/common/include/soc/ddp_common.h @@ -0,0 +1,157 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2019 MediaTek Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _DDP_COMMON_H_ +#define _DDP_COMMON_H_ + +#include <soc/addressmap.h> +#include <types.h> + + +struct disp_ovl_regs { + u32 sta; + u32 inten; + u32 intsta; + u32 en; + u32 trig; + u32 rst; + u8 reserved0[8]; + u32 roi_size; + u32 datapath_con; + u32 roi_bgclr; + u32 src_con; + struct { + u32 con; + u32 srckey; + u32 src_size; + u32 offset; + u32 reserved0; + u32 pitch; + u32 reserved1[2]; + } layer[4]; + u8 reserved8[16]; + struct { + u32 ctrl; + u32 mem_start_trig; + u32 mem_gmc_setting; + u32 mem_slow_con; + u32 fifo_ctrl; + u8 reserved[12]; + } rdma[4]; + u8 reserved12[148]; + u32 debug_mon_sel; + u8 reserved13[8]; + u32 rdma_mem_gmc_setting2[4]; + u8 reserved14[16]; + u32 dummy; + u8 reserved15[60]; + u32 flow_ctrl_dbg; + u32 addcon_dbg; + u32 outmux_dbg; + u32 rdma_dbg[4]; + u8 reserved16[3300]; + u32 l0_addr; + u8 reserved17[28]; + u32 l1_addr; + u8 reserved18[28]; + u32 l2_addr; + u8 reserved19[28]; + u32 l3_addr; +}; + +check_member(disp_ovl_regs, l3_addr, 0xFA0); +static struct disp_ovl_regs *const disp_ovl[2] = { + (void *)DISP_OVL0_BASE, (void *)DISP_OVL1_BASE +}; + +struct disp_rdma_regs { + u32 int_enable; + u32 int_status; + u8 reserved0[8]; + u32 global_con; + u32 size_con_0; + u32 size_con_1; + u32 target_line; + u8 reserved1[4]; + u32 mem_con; + u32 mem_start_addr; + u32 mem_src_pitch; + u32 mem_gmc_setting_0; + u32 mem_slow_con; + u32 mem_gmc_setting_1; + u8 reserved2[4]; + u32 fifo_con; + u8 reserved3[16]; + u32 cf[3][3]; + u32 cf_pre_add[3]; + u32 cf_post_add[3]; + u32 dummy; + u32 debug_out_sel; +}; + +enum { + RDMA_ENGINE_EN = BIT(0), + RDMA_FIFO_UNDERFLOW_EN = BIT(31), + RDMA_MEM_GMC = 0x40402020, +}; + +check_member(disp_rdma_regs, debug_out_sel, 0x94); +static struct disp_rdma_regs *const disp_rdma0 = (void *)DISP_RDMA0_BASE; + +struct disp_color_regs { + u8 reserved0[1024]; + u32 cfg_main; + u8 reserved1[2044]; + u32 start; + u8 reserved2[76]; + u32 width; + u32 height; +}; + +check_member(disp_color_regs, cfg_main, 0x400); +check_member(disp_color_regs, start, 0xC00); +check_member(disp_color_regs, width, 0xC50); +check_member(disp_color_regs, height, 0xC54); +static struct disp_color_regs *const disp_color0 = (void *)DISP_COLOR0_BASE; + + +enum { + COLOR_BYPASS_ALL = BIT(7), + COLOR_SEQ_SEL = BIT(13), +}; + +enum OVL_INPUT_FORMAT { + OVL_INFMT_RGB565 = 0, + OVL_INFMT_RGB888 = 1, + OVL_INFMT_RGBA8888 = 2, + OVL_INFMT_ARGB8888 = 3, + OVL_INFMT_UYVY = 4, + OVL_INFMT_YUYV = 5, + OVL_INFMT_UNKNOWN = 16, + + OVL_COLOR_BASE = 30, + OVL_INFMT_BGR565 = OVL_INFMT_RGB565 + OVL_COLOR_BASE, + OVL_INFMT_BGR888 = OVL_INFMT_RGB888 + OVL_COLOR_BASE, + OVL_INFMT_BGRA8888 = OVL_INFMT_RGBA8888 + OVL_COLOR_BASE, + OVL_INFMT_ABGR8888 = OVL_INFMT_ARGB8888 + OVL_COLOR_BASE, +}; + +void ovl_set_roi(u32 idx, u32 width, u32 height, u32 color); +void rdma_start(void); +void rdma_config(u32 width, u32 height, u32 pixel_clk, u32 fifo_size); +void color_start(u32 width, u32 height); +void ovl_layer_config(u32 fmt, u32 bpp, u32 width, u32 height); + +#endif diff --git a/src/soc/mediatek/mt8173/Makefile.inc b/src/soc/mediatek/mt8173/Makefile.inc index 1492dd1..510fbf0c 100644 --- a/src/soc/mediatek/mt8173/Makefile.inc +++ b/src/soc/mediatek/mt8173/Makefile.inc @@ -82,7 +82,7 @@
ramstage-y += ../common/usb.c usb.c
-ramstage-y += ddp.c +ramstage-y += ../common/ddp.c ddp.c ramstage-y += dsi.c
ramstage-$(CONFIG_ARM64_USE_ARM_TRUSTED_FIRMWARE) += bl31_plat_params.c diff --git a/src/soc/mediatek/mt8173/ddp.c b/src/soc/mediatek/mt8173/ddp.c index d3d91ef..9f201fd 100644 --- a/src/soc/mediatek/mt8173/ddp.c +++ b/src/soc/mediatek/mt8173/ddp.c @@ -21,9 +21,6 @@ #include <soc/ddp.h> #include <types.h>
-#define RDMA_FIFO_PSEUDO_SIZE(bytes) (((bytes) / 16) << 16) -#define RDMA_OUTPUT_VALID_FIFO_THRESHOLD(bytes) ((bytes) / 16) - static void disp_config_main_path_connection(void) { write32(&mmsys_cfg->disp_ovl0_mout_en, OVL0_MOUT_EN_COLOR0); @@ -42,52 +39,6 @@ write32(&disp_mutex->mutex[0].en, BIT(0)); }
-static void ovl_set_roi(u32 width, u32 height, u32 color) -{ - write32(&disp_ovl[0]->roi_size, height << 16 | width); - write32(&disp_ovl[0]->roi_bgclr, color); -} - -static void ovl_layer_enable(void) -{ - write32(&disp_ovl[0]->rdma[0].ctrl, BIT(0)); - write32(&disp_ovl[0]->rdma[0].mem_gmc_setting, RDMA_MEM_GMC); - - setbits_le32(&disp_ovl[0]->src_con, BIT(0)); -} - -static void rdma_start(void) -{ - setbits_le32(&disp_rdma[0]->global_con, RDMA_ENGINE_EN); -} - -static void rdma_config(u32 width, u32 height, u32 pixel_clk) -{ - u32 threshold; - u32 reg; - - /* Config width */ - clrsetbits_le32(&disp_rdma[0]->size_con_0, 0x1FFF, width); - - /* Config height */ - clrsetbits_le32(&disp_rdma[0]->size_con_1, 0xFFFFF, height); - - /* - * Enable FIFO underflow since DSI and DPI can't be blocked. Keep the - * FIFO pseudo size reset default of 8 KiB. Set the output threshold to - * 6 microseconds with 7/6 overhead to account for blanking, and with a - * pixel depth of 4 bytes: - */ - - threshold = pixel_clk * 4 * 7 / 1000; - - reg = RDMA_FIFO_UNDERFLOW_EN | - RDMA_FIFO_PSEUDO_SIZE(8 * KiB) | - RDMA_OUTPUT_VALID_FIFO_THRESHOLD(threshold); - - write32(&disp_rdma[0]->fifo_con, reg); -} - static void od_start(u32 width, u32 height) { write32(&disp_od->size, width << 16 | height); @@ -96,49 +47,14 @@ write32(&disp_od->en, 1); }
-static void ufoe_start(u32 width, u32 height) -{ - write32(&disp_ufoe->start, UFO_BYPASS); -} - -static void color_start(u32 width, u32 height) -{ - write32(&disp_color[0]->width, width); - write32(&disp_color[0]->height, height); - write32(&disp_color[0]->cfg_main, COLOR_BYPASS_ALL | COLOR_SEQ_SEL); - write32(&disp_color[0]->start, BIT(0)); -} - -static void ovl_layer_config(u32 fmt, u32 bpp, u32 width, u32 height) -{ - write32(&disp_ovl[0]->layer[0].con, fmt << 12); - write32(&disp_ovl[0]->layer[0].src_size, height << 16 | width); - write32(&disp_ovl[0]->layer[0].pitch, (width * bpp) & 0xFFFF); - - ovl_layer_enable(); -} - static void main_disp_path_setup(u32 width, u32 height, u32 pixel_clk) { - /* Setup OVL */ - ovl_set_roi(width, height, 0); - - /* Setup RDMA0 */ - rdma_config(width, height, pixel_clk); - - /* Setup OD */ + ovl_set_roi(0, width, height, 0); + rdma_config(width, height, pixel_clk, 8 * KiB); od_start(width, height); - - /* Setup UFOE */ - ufoe_start(width, height); - - /* Setup Color */ + write32(&disp_ufoe->start, UFO_BYPASS); color_start(width, height); - - /* Setup main path connection */ disp_config_main_path_connection(); - - /* Setup main path mutex */ disp_config_main_path_mutex(); }
@@ -171,6 +87,5 @@ edid->mode.pixel_clock);
rdma_start(); - ovl_layer_config(fmt, bpp, edid->mode.ha, edid->mode.va); } diff --git a/src/soc/mediatek/mt8173/include/soc/addressmap.h b/src/soc/mediatek/mt8173/include/soc/addressmap.h index 0ebe3d1..90834a3 100644 --- a/src/soc/mediatek/mt8173/include/soc/addressmap.h +++ b/src/soc/mediatek/mt8173/include/soc/addressmap.h @@ -56,8 +56,8 @@ SSUSB_IPPC_BASE = IO_PHYS + 0x1280700, SSUSB_SIF_BASE = IO_PHYS + 0x1290800, MMSYS_BASE = IO_PHYS + 0x4000000, - DIS_OVL0_BASE = IO_PHYS + 0x400C000, - DIS_OVL1_BASE = IO_PHYS + 0x400D000, + DISP_OVL0_BASE = IO_PHYS + 0x400C000, + DISP_OVL1_BASE = IO_PHYS + 0x400D000, DISP_RDMA0_BASE = IO_PHYS + 0x400E000, DISP_RDMA1_BASE = IO_PHYS + 0x400F000, DISP_RDMA2_BASE = IO_PHYS + 0x4010000, diff --git a/src/soc/mediatek/mt8173/include/soc/ddp.h b/src/soc/mediatek/mt8173/include/soc/ddp.h index 2f154dd..dbac5f7 100644 --- a/src/soc/mediatek/mt8173/include/soc/ddp.h +++ b/src/soc/mediatek/mt8173/include/soc/ddp.h @@ -13,10 +13,11 @@ * GNU General Public License for more details. */
-#ifndef _DDP_REG_H_ -#define _DDP_REG_H_ +#ifndef _MT8173_SOC_DDP_H_ +#define _MT8173_SOC_DDP_H_
#include <soc/addressmap.h> +#include <soc/ddp_common.h> #include <types.h>
struct mmsys_cfg_regs { @@ -254,100 +255,6 @@ MUTEX_MOD_DISP_UFOE | MUTEX_MOD_DISP_OD, };
-struct disp_ovl_regs { - u32 sta; - u32 inten; - u32 intsta; - u32 en; - u32 trig; - u32 rst; - u8 reserved0[8]; - u32 roi_size; - u32 datapath_con; - u32 roi_bgclr; - u32 src_con; - struct { - u32 con; - u32 srckey; - u32 src_size; - u32 offset; - u32 reserved0; - u32 pitch; - u32 reserved1[2]; - } layer[4]; - u8 reserved8[16]; - struct { - u32 ctrl; - u32 mem_start_trig; - u32 mem_gmc_setting; - u32 mem_slow_con; - u32 fifo_ctrl; - u8 reserved[12]; - } rdma[4]; - u8 reserved12[148]; - u32 debug_mon_sel; - u8 reserved13[8]; - u32 rdma_mem_gmc_setting2[4]; - u8 reserved14[16]; - u32 dummy; - u8 reserved15[60]; - u32 flow_ctrl_dbg; - u32 addcon_dbg; - u32 outmux_dbg; - u32 rdma_dbg[4]; - u8 reserved16[3300]; - u32 l0_addr; - u8 reserved17[28]; - u32 l1_addr; - u8 reserved18[28]; - u32 l2_addr; - u8 reserved19[28]; - u32 l3_addr; -}; - -check_member(disp_ovl_regs, l3_addr, 0xFA0); -static struct disp_ovl_regs *const disp_ovl[2] = { - (void *)DIS_OVL0_BASE, (void *)DIS_OVL1_BASE -}; - -struct disp_rdma_regs { - u32 int_enable; - u32 int_status; - u8 reserved0[8]; - u32 global_con; - u32 size_con_0; - u32 size_con_1; - u32 target_line; - u8 reserved1[4]; - u32 mem_con; - u32 mem_start_addr; - u32 mem_src_pitch; - u32 mem_gmc_setting_0; - u32 mem_slow_con; - u32 mem_gmc_setting_1; - u8 reserved2[4]; - u32 fifo_con; - u8 reserved3[16]; - u32 cf[3][3]; - u32 cf_pre_add[3]; - u32 cf_post_add[3]; - u32 dummy; - u32 debug_out_sel; -}; - -enum { - RDMA_ENGINE_EN = BIT(0), - RDMA_FIFO_UNDERFLOW_EN = BIT(31), - RDMA_MEM_GMC = 0x40402020, -}; - -check_member(disp_rdma_regs, debug_out_sel, 0x94); -static struct disp_rdma_regs *const disp_rdma[3] = { - (void *)DISP_RDMA0_BASE, - (void *)DISP_RDMA1_BASE, - (void *)DISP_RDMA2_BASE -}; - struct disp_od_regs { u32 en; u32 reset; @@ -407,45 +314,6 @@ UFO_LR = BIT(3) | BIT(0), };
-struct disp_color_regs { - u8 reserved0[1024]; - u32 cfg_main; - u8 reserved1[2044]; - u32 start; - u8 reserved2[76]; - u32 width; - u32 height; -}; - -check_member(disp_color_regs, cfg_main, 0x400); -check_member(disp_color_regs, start, 0xC00); -check_member(disp_color_regs, width, 0xC50); -check_member(disp_color_regs, height, 0xC54); -static struct disp_color_regs *const disp_color[2] = { - (void *)DISP_COLOR0_BASE, (void *)DISP_COLOR1_BASE -}; - -enum { - COLOR_BYPASS_ALL = BIT(7), - COLOR_SEQ_SEL = BIT(13), -}; - -enum OVL_INPUT_FORMAT { - OVL_INFMT_RGB565 = 0, - OVL_INFMT_RGB888 = 1, - OVL_INFMT_RGBA8888 = 2, - OVL_INFMT_ARGB8888 = 3, - OVL_INFMT_UYVY = 4, - OVL_INFMT_YUYV = 5, - OVL_INFMT_UNKNOWN = 16, - - OVL_COLOR_BASE = 30, - OVL_INFMT_BGR565 = OVL_INFMT_RGB565 + OVL_COLOR_BASE, - OVL_INFMT_BGR888 = OVL_INFMT_RGB888 + OVL_COLOR_BASE, - OVL_INFMT_BGRA8888 = OVL_INFMT_RGBA8888 + OVL_COLOR_BASE, - OVL_INFMT_ABGR8888 = OVL_INFMT_ARGB8888 + OVL_COLOR_BASE, -}; - void mtk_ddp_init(void); void mtk_ddp_mode_set(const struct edid *edid);