pwg5300: WIP LCD support

This commit is contained in:
Suguru Saito 2021-03-21 23:17:19 +09:00
parent 2812ea7c45
commit 48c576e62b
5 changed files with 142 additions and 4 deletions

View File

@ -79,12 +79,23 @@ void mxsfb_system_setup(void)
gpio_direction_output(MX28_PAD_ENET_CLK__GPIO_4_16, 1);
mdelay(20);
#ifdef CONFIG_BRAIN_2G
/* Reset LCD Controller */
writel(LCDIF_CTRL1_RESET, &lcdif->hw_lcdif_ctrl1_set);
mdelay(30);
writel(LCDIF_CTRL1_RESET, &lcdif->hw_lcdif_ctrl1_clr);
mdelay(30);
writel(LCDIF_CTRL1_RESET, &lcdif->hw_lcdif_ctrl1_set);
mdelay(30);
#endif
for (i = 0; i < ARRAY_SIZE(regs_early); i++) {
mxsfb_write_byte(regs_early[i].payload, regs_early[i].data);
if (regs_early[i].delay)
mdelay(regs_early[i].delay);
}
#ifndef CONFIG_BRAIN_2G
if (config.flip_x) {
ili9805_mac |= 1 << ILI9805_MAC_MX_OFFSET;
}
@ -111,10 +122,16 @@ void mxsfb_system_setup(void)
if (config.inversion) {
mxsfb_write_byte(0x21, 0); /* Display Inversion On */
}
#endif
mxsfb_write_byte(0x11, 0); /* Sleep Out */
mdelay(120);
#ifdef CONFIG_BRAIN_2G
mxsfb_write_byte(0x34, 0);
mdelay(30);
#endif
mxsfb_write_byte(0x29, 0); /* Display On */
mdelay(20);
@ -123,27 +140,43 @@ void mxsfb_system_setup(void)
mxsfb_write_byte(0x00, 1); /* Start Column in 2 Bytes */
mxsfb_write_byte(0x00, 1);
#ifndef CONFIG_BRAIN_2G
mxsfb_write_byte((config.width & 0xff00) >> 8, 1); /* End Column in 2 Bytes */
mxsfb_write_byte((config.width & 0x00ff) >> 0, 1);
#else
mxsfb_write_byte((config.height & 0xff00) >> 8, 1); /* End Column in 2 Bytes */
mxsfb_write_byte((config.height & 0x00ff) >> 0, 1);
#endif
mxsfb_write_byte(0x2b, 0); /* Page Address Set */
mxsfb_write_byte(0x00, 1); /* Start Page in 2 Bytes */
mxsfb_write_byte(0x00, 1);
#ifndef CONFIG_BRAIN_2G
mxsfb_write_byte((config.height & 0xff00) >> 8, 1); /* End Page in 2 Bytes */
mxsfb_write_byte((config.height & 0x00ff) >> 0, 1);
#else
mxsfb_write_byte((config.width & 0xff00) >> 8, 1); /* End Page in 2 Bytes */
mxsfb_write_byte((config.width & 0x00ff) >> 0, 1);
#endif
mxsfb_write_byte(0x2c, 0); /* Memory Write */
#ifndef CONFIG_BRAIN_2G
/* Fill black */
for (i = 0; i < config.height; i++) {
for (j = 0; j < config.width; j++) {
mxsfb_write_byte(0, 1);
}
}
#endif
#ifndef CONFIG_BRAIN_2G
writel(valid_data, &lcdif->hw_lcdif_ctrl1);
#else
writel(valid_data | LCDIF_CTRL1_RESET, &lcdif->hw_lcdif_ctrl1);
#endif
writel(LCDIF_CTRL_LCDIF_MASTER | LCDIF_CTRL_DATA_SELECT,
&lcdif->hw_lcdif_ctrl_set);

View File

@ -35,7 +35,7 @@ typedef struct {
} lcd_regs_t;
/* clang-format off */
#ifndef CONFIG_BRAIN_2G
const static lcd_regs_t regs_early[] = {
{ 0xff, 0, 0 }, /* EXTC Command Set Enable */
{ 0xff, 1, 0 }, { 0x98, 1, 0 }, { 0x05, 1, 0 },
@ -85,7 +85,75 @@ const static lcd_regs_t regs_early[] = {
{ 0x35, 0, 0 }, /* Tearing Effect Line On */
{ 0x00, 1, 0 },
};
#else
const static lcd_regs_t regs_early[] = {
{ 0x3a, 0, 0 },
{ 0x55, 1, 0 },
{ 0xb2, 0, 0 },
{ 0x45, 1, 0 }, { 0x00, 1, 0 }, { 0xd9, 1, 0 }, { 0x00, 1, 0 },
{ 0x00, 1, 0 },
{ 0xb3, 0, 0 },
{ 0x81, 1, 0 }, { 0x00, 1, 0 }, { 0x01, 1, 0 },
{ 0xb4, 0, 0 },
{ 0x00, 1, 0 },
{ 0xb5, 0, 0 },
{ 0x02, 1, 0 }, { 0x11, 1, 0 }, { 0x50, 1, 0 }, { 0x00,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 1, 0 }, { 0x3f, 1, 0 }, { 0x0f, 1, 0 }, { 0x0e, 1, 0 },
{ 0x78, 1, 0 }, { 0xee, 1, 0 }, { 0xed, 1, 0 }, { 0x93, 1, 0 },
{ 0x04, 1, 0 },
{ 0xe2, 0, 0 },
{ 0x24, 1, 0 }, { 0x29, 1, 0 }, { 0x14, 1, 0 }, { 0x1c, 1, 0 },
{ 0x67, 1, 0 }, { 0xdd, 1, 0 }, { 0xdd, 1, 0 }, { 0x97, 1, 0 },
{ 0x0b, 1, 0 },
{ 0xe3, 0, 0 },
{ 0x24, 1, 0 }, { 0x29, 1, 0 }, { 0x14, 1, 0 }, { 0x1c, 1, 0 },
{ 0x67, 1, 0 }, { 0xdd, 1, 0 }, { 0xdd, 1, 0 }, { 0x97, 1, 0 },
{ 0x0a, 1, 0 },
{ 0xe4, 0, 0 },
{ 0x24, 1, 0 }, { 0x2a, 1, 0 }, { 0x15, 1, 0 }, { 0x1a, 1, 0 },
{ 0x99, 1, 0 }, { 0xdd, 1, 0 }, { 0xed, 1, 0 }, { 0xa6, 1, 0 },
{ 0x09, 1, 0 },
{ 0xe5, 0, 0 },
{ 0x24, 1, 0 }, { 0x2a, 1, 0 }, { 0x15, 1, 0 }, { 0x1a, 1, 0 },
{ 0x88, 1, 0 }, { 0xdd, 1, 0 }, { 0xdd, 1, 0 }, { 0x97, 1, 0 },
{ 0x0c, 1, 0 },
{ 0x36, 0, 0 }, /* Memory Acess Control */
{ 0x28, 1, 0 },
{ 0x2c, 0, 0 }, /* Display On */
{ 0x00, 1, 0 },
};
#endif
/* clang-format on */
#endif

View File

@ -28,6 +28,8 @@
#include <netdev.h>
#include <errno.h>
#include "../common/lcd.h"
DECLARE_GLOBAL_DATA_PTR;
/*
@ -94,3 +96,20 @@ int board_mmc_init(bd_t *bis)
return 0;
}
#endif
#ifdef CONFIG_VIDEO_MXS
static const lcd_config_t lcd_config = {
.width = 480,
.height = 320,
.flip_x = ILI9805_DISABLE, /* not used */
.flip_y = ILI9805_DISABLE, /* not used */
.transpose = ILI9805_DISABLE, /* not used */
.inversion = ILI9805_DISABLE, /* not used */
.bgr = ILI9805_DISABLE, /* not used */
};
lcd_config_t get_lcd_config()
{
return lcd_config;
}
#endif

View File

@ -26,4 +26,5 @@ CONFIG_ENV_IS_IN_MMC=y
# CONFIG_NET is not set
CONFIG_MMC_MXS=y
CONFIG_CONS_INDEX=0
CONFIG_VIDEO=y
CONFIG_OF_LIBFDT=y

View File

@ -34,6 +34,22 @@
#define CONFIG_SYS_MMC_ENV_DEV 0
#endif
/* Framebuffer support */
#ifdef CONFIG_VIDEO
#define CONFIG_VIDEO_MXS
#define CONFIG_VIDEO_MXS_MODE_SYSTEM
#define CONFIG_VIDEO_LOGO
#define CONFIG_VIDEO_BMP_LOGO
#define CONFIG_HIDE_LOGO_VERSION
#define CONFIG_SPLASH_SCREEN
#define CONFIG_BMP_16BPP
#define CONFIG_VIDEO_BMP_RLE8
#define CONFIG_VIDEO_BMP_GZIP
#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (512 << 10)
#define CONFIG_VIDEO_FONT_6X11
#define LCD_BPP LCD_COLOR16
#endif
/* USB */
#ifdef CONFIG_CMD_USB
#define CONFIG_EHCI_MXS_PORT1
@ -48,8 +64,9 @@
/* Extra Environment */
#define CONFIG_EXTRA_ENV_SETTINGS \
"stdin=serial\0" \
"stdout=serial\0" \
"stderr=serial\0" \
"stdout=serial,vga\0" \
"stderr=serial,vga\0" \
"videomode=video=ctfb:x:480,y:320,depth:16,pclk:180000,le:0,ri:0,up:0,lo:0,hs:0,vs:0,sync:0,vmode:0\0" \
"bootdelay=0\0" \
"image=zImage\0" \
"console_mainline=ttyAMA0\0" \