]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/karo/common/splashimage.c
arm64: add support for Ka-Ro TXSD-410E
[karo-tx-uboot.git] / board / karo / common / splashimage.c
1 /*
2  * (C) Copyright 2012 Lothar Waßmann <LW@KARO-electronics.de>
3  *
4  * See file CREDITS for list of people who contributed to this
5  * project.
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  * version 2 as published by the Free Software Foundation.
10  *
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  *
16  */
17
18 #include <common.h>
19 #include <console.h>
20 #include <errno.h>
21 #include <lcd.h>
22 #include <nand.h>
23 #include <jffs2/load_kernel.h>
24
25 #include "karo.h"
26
27 DECLARE_GLOBAL_DATA_PTR;
28
29 #ifndef CONFIG_DM_VIDEO
30 static ulong calc_fbsize(void)
31 {
32         return panel_info.vl_row * panel_info.vl_col *
33                 NBITS(panel_info.vl_bpix) / 8;
34 }
35 #else
36 static ulong calc_fbsize(void)
37 {
38         return 1;
39 }
40 #endif
41
42 int karo_load_splashimage(int mode)
43 {
44         int ret;
45         unsigned long la = gd->fb_base;
46         char *splashimage = getenv("splashimage");
47         ulong fbsize = calc_fbsize();
48         char *end;
49
50         if (!la || !splashimage)
51                 return 0;
52
53         if ((simple_strtoul(splashimage, &end, 16) != 0) &&
54                 *end == '\0') {
55                 if (mode)
56                         return 0;
57                 la = simple_strtoul(splashimage, NULL, 16);
58                 splashimage = "logo.bmp";
59         } else if (!mode) {
60                 return 0;
61         }
62
63         if (had_ctrlc())
64                 return -ENODEV;
65
66         ret = karo_load_part(splashimage, (void *)la, fbsize);
67         if (ret) {
68                 printf("Failed to load logo from '%s': %d\n", splashimage, ret);
69                 return ret;
70         }
71         return 0;
72 }