1
0
Fork 0

Remove custom splash loading, use standard uboot splash stuff

utp
Martin T. H. Sandsmark 2016-12-04 22:17:59 +01:00
parent d5eff378a1
commit e0d40e16d6
6 changed files with 26 additions and 240 deletions

View File

@ -116,170 +116,3 @@ int board_setup_waveform_file(ulong waveform_buf)
return 0;
}
int board_setup_logo_file(void *display_buf)
{
int logo_width, logo_height;
char *fs_argv[5];
char addr[17];
int array[3];
ulong file_len, mmc_dev;
char *buf, *s;
int arg = 0, val = 0, pos = 0;
int i, j, max_check_length;
int row, col, row_end, col_end;
if (!display_buf)
return -EINVAL;
/* Assume PGM header not exceeds 128 bytes */
max_check_length = 128;
if (!check_mmc_autodetect())
mmc_dev = getenv_ulong("mmcdev", 10, 0);
else
mmc_dev = mmc_get_env_devno();
fs_argv[0] = "fatsize";
fs_argv[1] = "mmc";
fs_argv[2] = simple_itoa(mmc_dev);
fs_argv[3] = getenv("logo");
if (!fs_argv[3])
fs_argv[3] = "logo.pgm";
if (do_fat_size(NULL, 0, 4, fs_argv)) {
debug("File %s not found on MMC Device %lu, use black border\n", fs_argv[3], mmc_dev);
/* Draw black border around framebuffer*/
memset(display_buf, 0xFF, 24 * panel_info.vl_col);
for (i = 24; i < (panel_info.vl_row - 24); i++) {
memset((u8 *)display_buf + i * panel_info.vl_col,
0x00, 24);
memset((u8 *)display_buf + i * panel_info.vl_col
+ panel_info.vl_col - 24, 0x00, 24);
}
memset((u8 *)display_buf +
panel_info.vl_col * (panel_info.vl_row - 24),
0xFF, 24 * panel_info.vl_col);
return 0;
}
file_len = getenv_hex("filesize", 0);
if (!file_len)
return -EINVAL;
buf = memalign(ARCH_DMA_MINALIGN, file_len);
if (!buf)
return -ENOMEM;
sprintf(addr, "%lx", (ulong)buf);
fs_argv[0] = "fatload";
fs_argv[1] = "mmc";
fs_argv[2] = simple_itoa(mmc_dev);
fs_argv[3] = addr;
fs_argv[4] = getenv("logo");
if (!fs_argv[4])
fs_argv[4] = "logo.pgm";
if (do_fat_fsload(NULL, 0, 5, fs_argv)) {
printf("File %s not found on MMC Device %lu!\n", fs_argv[4], mmc_dev);
free(buf);
return -1;
}
if (strncmp(buf, "P5", 2)) {
printf("Wrong format for epdc logo, use PGM-P5 format.\n");
free(buf);
return -EINVAL;
}
/* Skip P5\n */
pos += 3;
arg = 0;
for (i = 3; i < max_check_length; ) {
/* skip \n \t and space */
if ((buf[i] == '\n') || (buf[i] == '\t') || (buf[i] == ' ')) {
i++;
continue;
}
/* skip comment */
if (buf[i] == '#') {
while (buf[i++] != '\n')
;
continue;
}
/* HEIGTH, WIDTH, MAX PIXEL VLAUE total 3 args */
if (arg > 2)
break;
val = 0;
while (is_digit(buf[i])) {
val = val * 10 + buf[i] - '0';
i++;
}
array[arg++] = val;
i++;
}
/* Point to data area */
pos = i;
logo_width = array[0];
logo_height = array[1];
if ((logo_width > panel_info.vl_col) ||
(logo_height > panel_info.vl_row)) {
printf("Splash screen too big for display\n");
free(buf);
return -EINVAL;
}
/* m,m means center of screen */
row = -1;
col = -1;
s = getenv("splashpos");
if (s) {
if (s[0] == 'm')
col = (panel_info.vl_col - logo_width) >> 1;
else
col = simple_strtol(s, NULL, 0);
s = strchr(s + 1, ',');
if (s != NULL) {
if (s[1] == 'm')
row = (panel_info.vl_row - logo_height) >> 1;
else
row = simple_strtol(s + 1, NULL, 0);
}
}
if (row < 0) {
row = (panel_info.vl_row - logo_height) >> 1;
}
if (col < 0) {
col = (panel_info.vl_col - logo_width) >> 1;
}
if ((col + logo_width > panel_info.vl_col) ||
(row + logo_height > panel_info.vl_row)) {
printf("Incorrect pos, use (0, 0)\n");
row = 0;
col = 0;
}
/* Draw picture at the center of screen */
row_end = row + logo_height;
col_end = col + logo_width;
for (i = row; i < row_end; i++) {
for (j = col; j < col_end; j++) {
*((u8 *)display_buf + i * (panel_info.vl_col) + j) =
buf[pos++];
}
}
free(buf);
flush_cache((ulong)display_buf, file_len - pos - 1);
return 0;
}

View File

@ -33,6 +33,7 @@
#include <lcd.h>
#include <mxc_epdc_fb.h>
#include <splash.h>
DECLARE_GLOBAL_DATA_PTR;
@ -659,6 +660,20 @@ int board_early_init_f(void)
return 0;
}
static struct splash_location splash_locations[] = {
{
.name = "mmc_fs",
.storage = SPLASH_STORAGE_MMC,
.flags = SPLASH_STORAGE_FS,
.devpart = "1:1",
},
};
int splash_screen_prepare(void)
{
return splash_source_load(splash_locations, ARRAY_SIZE(splash_locations));
}
vidinfo_t panel_info = {
.vl_refresh = 75,
.vl_col = 1872,

View File

@ -19,21 +19,6 @@
DECLARE_GLOBAL_DATA_PTR;
void *lcd_base; /* Start of framebuffer memory */
void *lcd_console_address; /* Start of console buffer */
int lcd_color_fg;
int lcd_color_bg;
short console_col;
short console_row;
int rev;
void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
{
}
#define TEMP_USE_DEFAULT 8
#define UPDATE_MODE_PARTIAL 0x0
@ -140,7 +125,6 @@ static void epdc_init_settings(void)
{
u32 reg_val;
int num_ce;
printf("epdc_init_settings\n");
/* EPDC_CTRL */
reg_val = REG_RD(EPDC_BASE, EPDC_CTRL);
@ -299,42 +283,14 @@ static void epdc_init_settings(void)
REG_WR(EPDC_BASE, EPDC_GPIO, reg_val);
}
static void draw_mode0(void)
static void do_update(int mode, int lut_num)
{
int i;
printf("draw_mode0\n");
/* Program EPDC update to process buffer */
epdc_set_update_coord(0, 0);
epdc_set_update_dimensions(panel_info.vl_col, panel_info.vl_row);
epdc_submit_update(0, panel_info.epdc_data.wv_modes.mode_init,
UPDATE_MODE_FULL, FALSE, 0);
debug("Mode0 update - Waiting for LUT to complete...\n");
/* Will timeout after ~4-5 seconds */
for (i = 0; i < 100; i++) {
if (!epdc_is_lut_active(0)) {
debug("Mode0 init complete after %d iterations\n", i);
return;
}
msleep(100);
}
printf("Mode0 init failed!\n");
}
static void draw_splash_screen(void)
{
int i;
int lut_num = 1;
printf("draw_splash_screen\n");
/* Program EPDC update to process buffer */
epdc_set_update_coord(0, 0);
epdc_set_update_dimensions(panel_info.vl_col, panel_info.vl_row);
epdc_submit_update(lut_num, panel_info.epdc_data.wv_modes.mode_gc16,
UPDATE_MODE_FULL, FALSE, 0);
epdc_submit_update(lut_num, mode, UPDATE_MODE_FULL, FALSE, 0);
for (i = 0; i < 40; i++) {
if (!epdc_is_lut_active(lut_num)) {
@ -343,24 +299,14 @@ static void draw_splash_screen(void)
}
msleep(100);
}
printf("Splash screen update failed!\n");
}
void lcd_enable(void)
{
printf("lcd_enable\n");
epdc_power_on();
draw_mode0();
if (board_setup_logo_file(lcd_base)) {
debug("Load logo failed!\n");
return;
}
flush_cache((ulong)lcd_base, panel_info.vl_col * panel_info.vl_row);
/* Draw data to display */
draw_splash_screen();
do_update(panel_info.epdc_data.wv_modes.mode_init, 0);
do_update(panel_info.epdc_data.wv_modes.mode_gc16, 1);
}
void lcd_disable(void)
@ -379,6 +325,7 @@ void lcd_panel_disable(void)
void lcd_ctrl_init(void *lcdbase)
{
unsigned int val;
int rev;
/*
* We rely on lcdbase being a physical address, i.e., either MMU off,
@ -403,9 +350,6 @@ void lcd_ctrl_init(void *lcdbase)
return;
}
lcd_color_fg = 0x00;
lcd_color_bg = 0xFF;
/* Reset */
REG_SET(EPDC_BASE, EPDC_CTRL, EPDC_CTRL_SFTRST);
while (!(REG_RD(EPDC_BASE, EPDC_CTRL) & EPDC_CTRL_CLKGATE))
@ -449,14 +393,8 @@ void lcd_ctrl_init(void *lcdbase)
/* Initialize EPDC, passing pointer to EPDC registers */
epdc_init_settings();
lcd_base = lcdbase;
lcd_set_flush_dcache(1);
return;
}
ulong calc_fbsize(void)
{
return panel_info.vl_row * panel_info.vl_col * 2 \
* NBITS(panel_info.vl_bpix) / 8;
}

View File

@ -341,9 +341,6 @@ void doc_probe(unsigned long physadr);
/* common/cmd_net.c */
int do_tftpb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
/* common/cmd_fat.c */
int do_fat_size(cmd_tbl_t *, int, int, char * const []);
/* common/cmd_fat.c */
int do_fat_fsload(cmd_tbl_t *, int, int, char * const []);

View File

@ -20,12 +20,14 @@
#define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */
#define CONFIG_SYS_CONSOLE_IS_IN_ENV /* We don't want to use the EPD for console */
#define CONFIG_MXC_EPDC
#define CONFIG_WAVEFORM_BUF_SIZE SZ_4M
#define CONFIG_SPLASH_SCREEN
#define CONFIG_SPLASH_SOURCE
#define CONFIG_SPLASH_SCREEN_ALIGN
#define CONFIG_LCD
#define CONFIG_CMD_BMP
#define LCD_BPP LCD_COLOR16
/* Size of malloc() pool, needs space for EPDC working buffer */
#define CONFIG_SYS_MALLOC_LEN (SZ_32M)
@ -65,6 +67,8 @@
"ip_dyn=yes\0" \
"mmcdev=1\0" \
"mmcpart=1\0" \
"splashimage=0x80000000\0" \
"splashpos=m,m\0" \
"mmcroot=/dev/mmcblk1p2 rootwait rw\0" \
"mmcargs=setenv bootargs console=${console},${baudrate} " \
"root=${mmcroot} max17135:vcom=${vcom};\0" \

View File

@ -556,7 +556,6 @@ enum {
};
int board_setup_waveform_file(ulong waveform_buf);
int board_setup_logo_file(void *display_buf);
void epdc_power_on(void);
void epdc_power_off(void);