]> git.sur5r.net Git - u-boot/commitdiff
Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
authorTom Rini <trini@konsulko.com>
Mon, 20 Apr 2015 21:12:45 +0000 (17:12 -0400)
committerTom Rini <trini@konsulko.com>
Mon, 20 Apr 2015 21:12:45 +0000 (17:12 -0400)
27 files changed:
README
arch/arm/include/asm/imx-common/video.h
arch/sandbox/cpu/cpu.c
arch/sandbox/lib/Makefile
arch/sandbox/lib/bootm.c [new file with mode: 0644]
common/Makefile
common/cmd_host.c [new file with mode: 0644]
common/cmd_pxe.c
common/cmd_sandbox.c [deleted file]
common/lcd.c
common/lcd_console.c
common/lcd_console_rotation.c [new file with mode: 0644]
drivers/video/Makefile
drivers/video/ipu.h
drivers/video/ipu_common.c
drivers/video/lg4573.c [new file with mode: 0644]
fs/sandbox/sandboxfs.c
include/atmel_lcd.h
include/config_distro_bootcmd.h
include/config_distro_defaults.h
include/configs/sandbox.h
include/exynos_lcd.h
include/lcd.h
include/lcd_console.h
include/mpc823_lcd.h
include/pxa_lcd.h
include/video.h

diff --git a/README b/README
index caba4602bc7253af33d49244e0901e791b6e8547..fc1fd52f53053268fe3bdb4d7040dffc855a53f4 100644 (file)
--- a/README
+++ b/README
@@ -1947,6 +1947,26 @@ CBFS (Coreboot Filesystem) support
                the console jump but can help speed up operation when scrolling
                is slow.
 
+               CONFIG_LCD_ROTATION
+
+               Sometimes, for example if the display is mounted in portrait
+               mode or even if it's mounted landscape but rotated by 180degree,
+               we need to rotate our content of the display relative to the
+               framebuffer, so that user can read the messages which are
+               printed out.
+               Once CONFIG_LCD_ROTATION is defined, the lcd_console will be
+               initialized with a given rotation from "vl_rot" out of
+               "vidinfo_t" which is provided by the board specific code.
+               The value for vl_rot is coded as following (matching to
+               fbcon=rotate:<n> linux-kernel commandline):
+               0 = no rotation respectively 0 degree
+               1 = 90 degree rotation
+               2 = 180 degree rotation
+               3 = 270 degree rotation
+
+               If CONFIG_LCD_ROTATION is not defined, the console will be
+               initialized with 0degree rotation.
+
                CONFIG_LCD_BMP_RLE8
 
                Support drawing of RLE8-compressed bitmaps on the LCD.
index 1a907d44e405a4a51898f9d3eab6da833101633b..cad5f861cb857ed91af00f5304c5ec7b9e73440b 100644 (file)
@@ -26,4 +26,5 @@ extern struct display_info_t const displays[];
 extern size_t display_count;
 #endif
 
+int ipu_set_ldb_clock(int rate);
 #endif
index 007ae860346fa32dc88b445c78c8fd4b7a6919e1..f0dafedc254fb5d0ca3973946539babf7a75d267 100644 (file)
@@ -49,18 +49,6 @@ unsigned long __attribute__((no_instrument_function)) timer_get_us(void)
        return os_get_nsec() / 1000;
 }
 
-int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
-{
-       if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
-               bootstage_mark(BOOTSTAGE_ID_RUN_OS);
-               printf("## Transferring control to Linux (at address %08lx)...\n",
-                      images->ep);
-               reset_cpu(0);
-       }
-
-       return 0;
-}
-
 int cleanup_before_linux(void)
 {
        return 0;
index 75b135cfc0ef0a254e47a5a2441b99ff6eb17698..96761e27f7a38a80a20176d85ca3c2f2242cc65a 100644 (file)
@@ -9,3 +9,4 @@
 
 obj-y  += interrupts.o
 obj-$(CONFIG_PCI)      += pci_io.o
+obj-$(CONFIG_CMD_BOOTM) += bootm.o
diff --git a/arch/sandbox/lib/bootm.c b/arch/sandbox/lib/bootm.c
new file mode 100644 (file)
index 0000000..d49c927
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * Copyright (c) 2015 Sjoerd Simons <sjoerd.simons@collabora.co.uk>
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define        LINUX_ARM_ZIMAGE_MAGIC  0x016f2818
+
+struct arm_z_header {
+       uint32_t        code[9];
+       uint32_t        zi_magic;
+       uint32_t        zi_start;
+       uint32_t        zi_end;
+} __attribute__ ((__packed__));
+
+int bootz_setup(ulong image, ulong *start, ulong *end)
+{
+       uint8_t *zimage = map_sysmem(image, 0);
+       struct arm_z_header *arm_hdr = (struct arm_z_header *)zimage;
+       int ret = 0;
+
+       if (memcmp(zimage + 0x202, "HdrS", 4) == 0) {
+               uint8_t setup_sects = *(zimage + 0x1f1);
+               uint32_t syssize =
+                       le32_to_cpu(*(uint32_t *)(zimage + 0x1f4));
+
+               *start = 0;
+               *end = (setup_sects + 1) * 512 + syssize * 16;
+
+               printf("setting up X86 zImage [ %ld - %ld ]\n",
+                      *start, *end);
+       } else if (le32_to_cpu(arm_hdr->zi_magic) == LINUX_ARM_ZIMAGE_MAGIC) {
+               *start = le32_to_cpu(arm_hdr->zi_start);
+               *end = le32_to_cpu(arm_hdr->zi_end);
+
+               printf("setting up ARM zImage [ %ld - %ld ]\n",
+                      *start, *end);
+       } else {
+               printf("Unrecognized zImage\n");
+               ret = 1;
+       }
+
+       unmap_sysmem((void *)image);
+
+       return ret;
+}
+
+int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
+{
+       if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
+               bootstage_mark(BOOTSTAGE_ID_RUN_OS);
+               printf("## Transferring control to Linux (at address %08lx)...\n",
+                      images->ep);
+               reset_cpu(0);
+       }
+
+       return 0;
+}
index 252fbf194b0ed436b9f419b98c54ff9ea0b1d739..fba3830f1d2cf19788e42d09dc8ee8d124a39960 100644 (file)
@@ -152,7 +152,7 @@ obj-$(CONFIG_CMD_PXE) += cmd_pxe.o
 obj-$(CONFIG_CMD_READ) += cmd_read.o
 obj-$(CONFIG_CMD_REGINFO) += cmd_reginfo.o
 obj-$(CONFIG_CMD_REISER) += cmd_reiser.o
-obj-$(CONFIG_SANDBOX) += cmd_sandbox.o
+obj-$(CONFIG_SANDBOX) += cmd_host.o
 obj-$(CONFIG_CMD_SATA) += cmd_sata.o
 obj-$(CONFIG_CMD_SF) += cmd_sf.o
 obj-$(CONFIG_CMD_SCSI) += cmd_scsi.o
@@ -201,6 +201,7 @@ obj-$(CONFIG_KALLSYMS) += kallsyms.o
 obj-y += splash.o
 obj-$(CONFIG_SPLASH_SOURCE) += splash_source.o
 obj-$(CONFIG_LCD) += lcd.o lcd_console.o
+obj-$(CONFIG_LCD_ROTATION) += lcd_console_rotation.o
 obj-$(CONFIG_LCD_DT_SIMPLEFB) += lcd_simplefb.o
 obj-$(CONFIG_LYNXKDI) += lynxkdi.o
 obj-$(CONFIG_MENU) += menu.o
diff --git a/common/cmd_host.c b/common/cmd_host.c
new file mode 100644 (file)
index 0000000..ba1460e
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2012, Google Inc.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <fs.h>
+#include <part.h>
+#include <sandboxblockdev.h>
+#include <asm/errno.h>
+
+static int host_curr_device = -1;
+
+static int do_host_load(cmd_tbl_t *cmdtp, int flag, int argc,
+                          char * const argv[])
+{
+       return do_load(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
+}
+
+static int do_host_ls(cmd_tbl_t *cmdtp, int flag, int argc,
+                          char * const argv[])
+{
+       return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
+}
+
+static int do_host_save(cmd_tbl_t *cmdtp, int flag, int argc,
+                          char * const argv[])
+{
+       return do_save(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
+}
+
+static int do_host_bind(cmd_tbl_t *cmdtp, int flag, int argc,
+                          char * const argv[])
+{
+       if (argc < 2 || argc > 3)
+               return CMD_RET_USAGE;
+       char *ep;
+       char *dev_str = argv[1];
+       char *file = argc >= 3 ? argv[2] : NULL;
+       int dev = simple_strtoul(dev_str, &ep, 16);
+       if (*ep) {
+               printf("** Bad device specification %s **\n", dev_str);
+               return CMD_RET_USAGE;
+       }
+       return host_dev_bind(dev, file);
+}
+
+static int do_host_info(cmd_tbl_t *cmdtp, int flag, int argc,
+                          char * const argv[])
+{
+       if (argc < 1 || argc > 2)
+               return CMD_RET_USAGE;
+       int min_dev = 0;
+       int max_dev = CONFIG_HOST_MAX_DEVICES - 1;
+       if (argc >= 2) {
+               char *ep;
+               char *dev_str = argv[1];
+               int dev = simple_strtoul(dev_str, &ep, 16);
+               if (*ep) {
+                       printf("** Bad device specification %s **\n", dev_str);
+                       return CMD_RET_USAGE;
+               }
+               min_dev = dev;
+               max_dev = dev;
+       }
+       int dev;
+       printf("%3s %12s %s\n", "dev", "blocks", "path");
+       for (dev = min_dev; dev <= max_dev; dev++) {
+               block_dev_desc_t *blk_dev;
+               int ret;
+
+               printf("%3d ", dev);
+               ret = host_get_dev_err(dev, &blk_dev);
+               if (ret) {
+                       if (ret == -ENOENT)
+                               puts("Not bound to a backing file\n");
+                       else if (ret == -ENODEV)
+                               puts("Invalid host device number\n");
+
+                       continue;
+               }
+               struct host_block_dev *host_dev = blk_dev->priv;
+               printf("%12lu %s\n", (unsigned long)blk_dev->lba,
+                      host_dev->filename);
+       }
+       return 0;
+}
+
+static int do_host_dev(cmd_tbl_t *cmdtp, int flag, int argc,
+                      char * const argv[])
+{
+       int dev;
+       char *ep;
+       block_dev_desc_t *blk_dev;
+       int ret;
+
+       if (argc < 1 || argc > 3)
+               return CMD_RET_USAGE;
+
+       if (argc == 1) {
+               if (host_curr_device < 0) {
+                       printf("No current host device\n");
+                       return 1;
+               }
+               printf("Current host device %d\n", host_curr_device);
+               return 0;
+       }
+
+       dev = simple_strtoul(argv[1], &ep, 16);
+       if (*ep) {
+               printf("** Bad device specification %s **\n", argv[2]);
+               return CMD_RET_USAGE;
+       }
+
+       ret = host_get_dev_err(dev, &blk_dev);
+       if (ret) {
+               if (ret == -ENOENT)
+                       puts("Not bound to a backing file\n");
+               else if (ret == -ENODEV)
+                       puts("Invalid host device number\n");
+
+               return 1;
+       }
+
+       host_curr_device = dev;
+       return 0;
+}
+
+static cmd_tbl_t cmd_host_sub[] = {
+       U_BOOT_CMD_MKENT(load, 7, 0, do_host_load, "", ""),
+       U_BOOT_CMD_MKENT(ls, 3, 0, do_host_ls, "", ""),
+       U_BOOT_CMD_MKENT(save, 6, 0, do_host_save, "", ""),
+       U_BOOT_CMD_MKENT(bind, 3, 0, do_host_bind, "", ""),
+       U_BOOT_CMD_MKENT(info, 3, 0, do_host_info, "", ""),
+       U_BOOT_CMD_MKENT(dev, 0, 1, do_host_dev, "", ""),
+};
+
+static int do_host(cmd_tbl_t *cmdtp, int flag, int argc,
+                     char * const argv[])
+{
+       cmd_tbl_t *c;
+
+       /* Skip past 'host' */
+       argc--;
+       argv++;
+
+       c = find_cmd_tbl(argv[0], cmd_host_sub,
+                        ARRAY_SIZE(cmd_host_sub));
+
+       if (c)
+               return c->cmd(cmdtp, flag, argc, argv);
+       else
+               return CMD_RET_USAGE;
+}
+
+U_BOOT_CMD(
+       sb,     8,      1,      do_host,
+       "Deprecated: use 'host' command instead.", ""
+);
+
+U_BOOT_CMD(
+       host, 8, 1, do_host,
+       "Miscellaneous host commands",
+       "load hostfs - <addr> <filename> [<bytes> <offset>]  - "
+               "load a file from host\n"
+       "host ls hostfs - <filename>                    - list files on host\n"
+       "host save hostfs - <addr> <filename> <bytes> [<offset>] - "
+               "save a file to host\n"
+       "host bind <dev> [<filename>] - bind \"host\" device to file\n"
+       "host info [<dev>]            - show device binding & info\n"
+       "host dev [<dev>] - Set or retrieve the current host device\n"
+       "host commands use the \"hostfs\" device. The \"host\" device is used\n"
+       "with standard IO commands such as fatls or ext2load"
+);
index 5cde5b6258ccee2e39c14874daa333323f39352c..4cbb2b11734542caf44fcc9fd1c01ec21dc26e33 100644 (file)
@@ -14,6 +14,7 @@
 #include <errno.h>
 #include <linux/list.h>
 #include <fs.h>
+#include <asm/io.h>
 
 #include "menu.h"
 #include "cli.h"
@@ -189,11 +190,12 @@ static int do_get_any(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr)
  *
  * Returns 1 for success, or < 0 on error.
  */
-static int get_relfile(cmd_tbl_t *cmdtp, const char *file_path, void *file_addr)
+static int get_relfile(cmd_tbl_t *cmdtp, const char *file_path,
+       unsigned long file_addr)
 {
        size_t path_len;
        char relfile[MAX_TFTP_PATH_LEN+1];
-       char addr_buf[10];
+       char addr_buf[18];
        int err;
 
        err = get_bootfile_path(file_path, relfile, sizeof(relfile));
@@ -216,7 +218,7 @@ static int get_relfile(cmd_tbl_t *cmdtp, const char *file_path, void *file_addr)
 
        printf("Retrieving file: %s\n", relfile);
 
-       sprintf(addr_buf, "%p", file_addr);
+       sprintf(addr_buf, "%lx", file_addr);
 
        return do_getfile(cmdtp, relfile, addr_buf);
 }
@@ -228,11 +230,13 @@ static int get_relfile(cmd_tbl_t *cmdtp, const char *file_path, void *file_addr)
  *
  * Returns 1 on success, or < 0 for error.
  */
-static int get_pxe_file(cmd_tbl_t *cmdtp, const char *file_path, void *file_addr)
+static int get_pxe_file(cmd_tbl_t *cmdtp, const char *file_path,
+       unsigned long file_addr)
 {
        unsigned long config_file_size;
        char *tftp_filesize;
        int err;
+       char *buf;
 
        err = get_relfile(cmdtp, file_path, file_addr);
 
@@ -251,7 +255,9 @@ static int get_pxe_file(cmd_tbl_t *cmdtp, const char *file_path, void *file_addr
        if (strict_strtoul(tftp_filesize, 16, &config_file_size) < 0)
                return -EINVAL;
 
-       *(char *)(file_addr + config_file_size) = '\0';
+       buf = map_sysmem(file_addr + config_file_size, 1);
+       *buf = '\0';
+       unmap_sysmem(buf);
 
        return 1;
 }
@@ -267,7 +273,8 @@ static int get_pxe_file(cmd_tbl_t *cmdtp, const char *file_path, void *file_addr
  *
  * Returns 1 on success or < 0 on error.
  */
-static int get_pxelinux_path(cmd_tbl_t *cmdtp, const char *file, void *pxefile_addr_r)
+static int get_pxelinux_path(cmd_tbl_t *cmdtp, const char *file,
+       unsigned long pxefile_addr_r)
 {
        size_t base_len = strlen(PXELINUX_DIR);
        char path[MAX_TFTP_PATH_LEN+1];
@@ -288,7 +295,7 @@ static int get_pxelinux_path(cmd_tbl_t *cmdtp, const char *file, void *pxefile_a
  *
  * Returns 1 on success or < 0 on error.
  */
-static int pxe_uuid_path(cmd_tbl_t *cmdtp, void *pxefile_addr_r)
+static int pxe_uuid_path(cmd_tbl_t *cmdtp, unsigned long pxefile_addr_r)
 {
        char *uuid_str;
 
@@ -306,7 +313,7 @@ static int pxe_uuid_path(cmd_tbl_t *cmdtp, void *pxefile_addr_r)
  *
  * Returns 1 on success or < 0 on error.
  */
-static int pxe_mac_path(cmd_tbl_t *cmdtp, void *pxefile_addr_r)
+static int pxe_mac_path(cmd_tbl_t *cmdtp, unsigned long pxefile_addr_r)
 {
        char mac_str[21];
        int err;
@@ -326,7 +333,7 @@ static int pxe_mac_path(cmd_tbl_t *cmdtp, void *pxefile_addr_r)
  *
  * Returns 1 on success or < 0 on error.
  */
-static int pxe_ipaddr_paths(cmd_tbl_t *cmdtp, void *pxefile_addr_r)
+static int pxe_ipaddr_paths(cmd_tbl_t *cmdtp, unsigned long pxefile_addr_r)
 {
        char ip_addr[9];
        int mask_pos, err;
@@ -385,9 +392,9 @@ do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
         * Keep trying paths until we successfully get a file we're looking
         * for.
         */
-       if (pxe_uuid_path(cmdtp, (void *)pxefile_addr_r) > 0 ||
-           pxe_mac_path(cmdtp, (void *)pxefile_addr_r) > 0 ||
-           pxe_ipaddr_paths(cmdtp, (void *)pxefile_addr_r) > 0) {
+       if (pxe_uuid_path(cmdtp, pxefile_addr_r) > 0 ||
+           pxe_mac_path(cmdtp, pxefile_addr_r) > 0 ||
+           pxe_ipaddr_paths(cmdtp, pxefile_addr_r) > 0) {
                printf("Config file found\n");
 
                return 0;
@@ -395,7 +402,7 @@ do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
        while (pxe_default_paths[i]) {
                if (get_pxelinux_path(cmdtp, pxe_default_paths[i],
-                                     (void *)pxefile_addr_r) > 0) {
+                                     pxefile_addr_r) > 0) {
                        printf("Config file found\n");
                        return 0;
                }
@@ -428,7 +435,7 @@ static int get_relfile_envaddr(cmd_tbl_t *cmdtp, const char *file_path, const ch
        if (strict_strtoul(envaddr, 16, &file_addr) < 0)
                return -EINVAL;
 
-       return get_relfile(cmdtp, file_path, (void *)file_addr);
+       return get_relfile(cmdtp, file_path, file_addr);
 }
 
 /*
@@ -791,6 +798,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
        else
                do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
 #endif
+       unmap_sysmem(buf);
        return 1;
 }
 
@@ -1055,7 +1063,8 @@ static int parse_integer(char **c, int *dst)
        return 1;
 }
 
-static int parse_pxefile_top(cmd_tbl_t *cmdtp, char *p, struct pxe_menu *cfg, int nest_level);
+static int parse_pxefile_top(cmd_tbl_t *cmdtp, char *p, unsigned long base,
+       struct pxe_menu *cfg, int nest_level);
 
 /*
  * Parse an include statement, and retrieve and parse the file it mentions.
@@ -1065,12 +1074,14 @@ static int parse_pxefile_top(cmd_tbl_t *cmdtp, char *p, struct pxe_menu *cfg, in
  * include, nest_level has already been incremented and doesn't need to be
  * incremented here.
  */
-static int handle_include(cmd_tbl_t *cmdtp, char **c, char *base,
+static int handle_include(cmd_tbl_t *cmdtp, char **c, unsigned long base,
                                struct pxe_menu *cfg, int nest_level)
 {
        char *include_path;
        char *s = *c;
        int err;
+       char *buf;
+       int ret;
 
        err = parse_sliteral(c, &include_path);
 
@@ -1087,20 +1098,25 @@ static int handle_include(cmd_tbl_t *cmdtp, char **c, char *base,
                return err;
        }
 
-       return parse_pxefile_top(cmdtp, base, cfg, nest_level);
+       buf = map_sysmem(base, 0);
+       ret = parse_pxefile_top(cmdtp, buf, base, cfg, nest_level);
+       unmap_sysmem(buf);
+
+       return ret;
 }
 
 /*
  * Parse lines that begin with 'menu'.
  *
- * b and nest are provided to handle the 'menu include' case.
+ * base and nest are provided to handle the 'menu include' case.
  *
- * b should be the address where the file currently being parsed is stored.
+ * base should point to a location where it's safe to store the included file.
  *
  * nest_level should be 1 when parsing the top level pxe file, 2 when parsing
  * a file it includes, 3 when parsing a file included by that file, and so on.
  */
-static int parse_menu(cmd_tbl_t *cmdtp, char **c, struct pxe_menu *cfg, char *b, int nest_level)
+static int parse_menu(cmd_tbl_t *cmdtp, char **c, struct pxe_menu *cfg,
+                               unsigned long base, int nest_level)
 {
        struct token t;
        char *s = *c;
@@ -1115,7 +1131,7 @@ static int parse_menu(cmd_tbl_t *cmdtp, char **c, struct pxe_menu *cfg, char *b,
                break;
 
        case T_INCLUDE:
-               err = handle_include(cmdtp, c, b + strlen(b) + 1, cfg,
+               err = handle_include(cmdtp, c, base, cfg,
                                                nest_level + 1);
                break;
 
@@ -1282,7 +1298,8 @@ static int parse_label(char **c, struct pxe_menu *cfg)
  *
  * Returns 1 on success, < 0 on error.
  */
-static int parse_pxefile_top(cmd_tbl_t *cmdtp, char *p, struct pxe_menu *cfg, int nest_level)
+static int parse_pxefile_top(cmd_tbl_t *cmdtp, char *p, unsigned long base,
+                               struct pxe_menu *cfg, int nest_level)
 {
        struct token t;
        char *s, *b, *label_name;
@@ -1304,7 +1321,9 @@ static int parse_pxefile_top(cmd_tbl_t *cmdtp, char *p, struct pxe_menu *cfg, in
                switch (t.type) {
                case T_MENU:
                        cfg->prompt = 1;
-                       err = parse_menu(cmdtp, &p, cfg, b, nest_level);
+                       err = parse_menu(cmdtp, &p, cfg,
+                               base + ALIGN(strlen(b) + 1, 4),
+                               nest_level);
                        break;
 
                case T_TIMEOUT:
@@ -1329,8 +1348,9 @@ static int parse_pxefile_top(cmd_tbl_t *cmdtp, char *p, struct pxe_menu *cfg, in
                        break;
 
                case T_INCLUDE:
-                       err = handle_include(cmdtp, &p, b + ALIGN(strlen(b), 4), cfg,
-                                                       nest_level + 1);
+                       err = handle_include(cmdtp, &p,
+                               base + ALIGN(strlen(b), 4), cfg,
+                               nest_level + 1);
                        break;
 
                case T_PROMPT:
@@ -1386,9 +1406,11 @@ static void destroy_pxe_menu(struct pxe_menu *cfg)
  * files it includes). The resulting pxe_menu struct can be free()'d by using
  * the destroy_pxe_menu() function.
  */
-static struct pxe_menu *parse_pxefile(cmd_tbl_t *cmdtp, char *menucfg)
+static struct pxe_menu *parse_pxefile(cmd_tbl_t *cmdtp, unsigned long menucfg)
 {
        struct pxe_menu *cfg;
+       char *buf;
+       int r;
 
        cfg = malloc(sizeof(struct pxe_menu));
 
@@ -1399,7 +1421,11 @@ static struct pxe_menu *parse_pxefile(cmd_tbl_t *cmdtp, char *menucfg)
 
        INIT_LIST_HEAD(&cfg->labels);
 
-       if (parse_pxefile_top(cmdtp, menucfg, cfg, 1) < 0) {
+       buf = map_sysmem(menucfg, 0);
+       r = parse_pxefile_top(cmdtp, buf, menucfg, cfg, 1);
+       unmap_sysmem(buf);
+
+       if (r < 0) {
                destroy_pxe_menu(cfg);
                return NULL;
        }
@@ -1557,7 +1583,7 @@ do_pxe_boot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                return 1;
        }
 
-       cfg = parse_pxefile(cmdtp, (char *)(pxefile_addr_r));
+       cfg = parse_pxefile(cmdtp, pxefile_addr_r);
 
        if (cfg == NULL) {
                printf("Error parsing config file\n");
@@ -1664,12 +1690,12 @@ static int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                return 1;
        }
 
-       if (get_pxe_file(cmdtp, filename, (void *)pxefile_addr_r) < 0) {
+       if (get_pxe_file(cmdtp, filename, pxefile_addr_r) < 0) {
                printf("Error reading config file\n");
                return 1;
        }
 
-       cfg = parse_pxefile(cmdtp, (char *)(pxefile_addr_r));
+       cfg = parse_pxefile(cmdtp, pxefile_addr_r);
 
        if (cfg == NULL) {
                printf("Error parsing config file\n");
diff --git a/common/cmd_sandbox.c b/common/cmd_sandbox.c
deleted file mode 100644 (file)
index 4286969..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2012, Google Inc.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <fs.h>
-#include <part.h>
-#include <sandboxblockdev.h>
-#include <asm/errno.h>
-
-static int do_sandbox_load(cmd_tbl_t *cmdtp, int flag, int argc,
-                          char * const argv[])
-{
-       return do_load(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
-}
-
-static int do_sandbox_ls(cmd_tbl_t *cmdtp, int flag, int argc,
-                          char * const argv[])
-{
-       return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
-}
-
-static int do_sandbox_save(cmd_tbl_t *cmdtp, int flag, int argc,
-                          char * const argv[])
-{
-       return do_save(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
-}
-
-static int do_sandbox_bind(cmd_tbl_t *cmdtp, int flag, int argc,
-                          char * const argv[])
-{
-       if (argc < 2 || argc > 3)
-               return CMD_RET_USAGE;
-       char *ep;
-       char *dev_str = argv[1];
-       char *file = argc >= 3 ? argv[2] : NULL;
-       int dev = simple_strtoul(dev_str, &ep, 16);
-       if (*ep) {
-               printf("** Bad device specification %s **\n", dev_str);
-               return CMD_RET_USAGE;
-       }
-       return host_dev_bind(dev, file);
-}
-
-static int do_sandbox_info(cmd_tbl_t *cmdtp, int flag, int argc,
-                          char * const argv[])
-{
-       if (argc < 1 || argc > 2)
-               return CMD_RET_USAGE;
-       int min_dev = 0;
-       int max_dev = CONFIG_HOST_MAX_DEVICES - 1;
-       if (argc >= 2) {
-               char *ep;
-               char *dev_str = argv[1];
-               int dev = simple_strtoul(dev_str, &ep, 16);
-               if (*ep) {
-                       printf("** Bad device specification %s **\n", dev_str);
-                       return CMD_RET_USAGE;
-               }
-               min_dev = dev;
-               max_dev = dev;
-       }
-       int dev;
-       printf("%3s %12s %s\n", "dev", "blocks", "path");
-       for (dev = min_dev; dev <= max_dev; dev++) {
-               block_dev_desc_t *blk_dev;
-               int ret;
-
-               printf("%3d ", dev);
-               ret = host_get_dev_err(dev, &blk_dev);
-               if (ret) {
-                       if (ret == -ENOENT)
-                               puts("Not bound to a backing file\n");
-                       else if (ret == -ENODEV)
-                               puts("Invalid host device number\n");
-
-                       continue;
-               }
-               struct host_block_dev *host_dev = blk_dev->priv;
-               printf("%12lu %s\n", (unsigned long)blk_dev->lba,
-                      host_dev->filename);
-       }
-       return 0;
-}
-
-static cmd_tbl_t cmd_sandbox_sub[] = {
-       U_BOOT_CMD_MKENT(load, 7, 0, do_sandbox_load, "", ""),
-       U_BOOT_CMD_MKENT(ls, 3, 0, do_sandbox_ls, "", ""),
-       U_BOOT_CMD_MKENT(save, 6, 0, do_sandbox_save, "", ""),
-       U_BOOT_CMD_MKENT(bind, 3, 0, do_sandbox_bind, "", ""),
-       U_BOOT_CMD_MKENT(info, 3, 0, do_sandbox_info, "", ""),
-};
-
-static int do_sandbox(cmd_tbl_t *cmdtp, int flag, int argc,
-                     char * const argv[])
-{
-       cmd_tbl_t *c;
-
-       /* Skip past 'sandbox' */
-       argc--;
-       argv++;
-
-       c = find_cmd_tbl(argv[0], cmd_sandbox_sub,
-                        ARRAY_SIZE(cmd_sandbox_sub));
-
-       if (c)
-               return c->cmd(cmdtp, flag, argc, argv);
-       else
-               return CMD_RET_USAGE;
-}
-
-U_BOOT_CMD(
-       sb,     8,      1,      do_sandbox,
-       "Miscellaneous sandbox commands",
-       "load hostfs - <addr> <filename> [<bytes> <offset>]  - "
-               "load a file from host\n"
-       "sb ls hostfs - <filename>                    - list files on host\n"
-       "sb save hostfs - <addr> <filename> <bytes> [<offset>] - "
-               "save a file to host\n"
-       "sb bind <dev> [<filename>] - bind \"host\" device to file\n"
-       "sb info [<dev>]            - show device binding & info\n"
-       "sb commands use the \"hostfs\" device. The \"host\" device is used\n"
-       "with standard IO commands such as fatls or ext2load"
-);
index 6982759e9e2a34a9bd180ed27f949ccd72192ee2..055c366b191e32469c100c2d010fa9ba401526ef 100644 (file)
@@ -168,7 +168,6 @@ int drv_lcd_init(void)
 
 void lcd_clear(void)
 {
-       short console_rows, console_cols;
        int bg_color;
        char *s;
        ulong addr;
@@ -212,16 +211,14 @@ void lcd_clear(void)
        }
 #endif
 #endif
+       /* setup text-console */
+       debug("[LCD] setting up console...\n");
+       lcd_init_console(lcd_base,
+                        panel_info.vl_col,
+                        panel_info.vl_row,
+                        panel_info.vl_rot);
        /* Paint the logo and retrieve LCD base address */
        debug("[LCD] Drawing the logo...\n");
-#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
-       console_rows = (panel_info.vl_row - BMP_LOGO_HEIGHT);
-       console_rows /= VIDEO_FONT_HEIGHT;
-#else
-       console_rows = panel_info.vl_row / VIDEO_FONT_HEIGHT;
-#endif
-       console_cols = panel_info.vl_col / VIDEO_FONT_WIDTH;
-       lcd_init_console(lcd_base, console_rows, console_cols);
        if (do_splash) {
                s = getenv("splashimage");
                if (s) {
@@ -237,7 +234,8 @@ void lcd_clear(void)
        lcd_logo();
 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
        addr = (ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length;
-       lcd_init_console((void *)addr, console_rows, console_cols);
+       lcd_init_console((void *)addr, panel_info.vl_row,
+                        panel_info.vl_col, panel_info.vl_rot);
 #endif
        lcd_sync();
 }
index 8bf83b90d5b1a30e4cd9eec79769d24bd42e6bee..bb0d7c54858a3291feca8edc4bba8697a5bf2c0f 100644 (file)
@@ -1,7 +1,8 @@
 /*
- * (C) Copyright 2001-2014
+ * (C) Copyright 2001-2015
  * DENX Software Engineering -- wd@denx.de
  * Compulab Ltd - http://compulab.co.il/
+ * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
 #include <lcd.h>
 #include <video_font.h>                /* Get font data, width and height */
+#if defined(CONFIG_LCD_LOGO)
+#include <bmp_logo.h>
+#endif
 
-#define CONSOLE_ROW_SIZE       (VIDEO_FONT_HEIGHT * lcd_line_length)
-#define CONSOLE_ROW_FIRST      lcd_console_address
-#define CONSOLE_SIZE           (CONSOLE_ROW_SIZE * console_rows)
-
-static short console_curr_col;
-static short console_curr_row;
-static short console_cols;
-static short console_rows;
-static void *lcd_console_address;
-
-void lcd_init_console(void *address, int rows, int cols)
-{
-       console_curr_col = 0;
-       console_curr_row = 0;
-       console_cols = cols;
-       console_rows = rows;
-       lcd_console_address = address;
-}
+static struct console_t cons;
 
 void lcd_set_col(short col)
 {
-       console_curr_col = col;
+       cons.curr_col = col;
 }
 
 void lcd_set_row(short row)
 {
-       console_curr_row = row;
+       cons.curr_row = row;
 }
 
 void lcd_position_cursor(unsigned col, unsigned row)
 {
-       console_curr_col = min_t(short, col, console_cols - 1);
-       console_curr_row = min_t(short, row, console_rows - 1);
+       cons.curr_col = min_t(short, col, cons.cols - 1);
+       cons.curr_row = min_t(short, row, cons.rows - 1);
 }
 
 int lcd_get_screen_rows(void)
 {
-       return console_rows;
+       return cons.rows;
 }
 
 int lcd_get_screen_columns(void)
 {
-       return console_cols;
+       return cons.cols;
 }
 
-static void lcd_drawchars(ushort x, ushort y, uchar *str, int count)
+static void lcd_putc_xy0(struct console_t *pcons, ushort x, ushort y, char c)
 {
-       uchar *dest;
-       ushort row;
-       int fg_color, bg_color;
+       int fg_color = lcd_getfgcolor();
+       int bg_color = lcd_getbgcolor();
+       int i, row;
+       fbptr_t *dst = (fbptr_t *)pcons->fbbase +
+                                 y * pcons->lcdsizex +
+                                 x;
+
+       for (row = 0; row < VIDEO_FONT_HEIGHT; row++) {
+               uchar bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row];
+               for (i = 0; i < VIDEO_FONT_WIDTH; ++i) {
+                       *dst++ = (bits & 0x80) ? fg_color : bg_color;
+                       bits <<= 1;
+               }
+               dst += (pcons->lcdsizex - VIDEO_FONT_WIDTH);
+       }
+}
 
-       dest = (uchar *)(lcd_console_address +
-                        y * lcd_line_length + x * NBITS(LCD_BPP) / 8);
+static inline void console_setrow0(struct console_t *pcons, u32 row, int clr)
+{
+       int i;
+       fbptr_t *dst = (fbptr_t *)pcons->fbbase +
+                                 row * VIDEO_FONT_HEIGHT *
+                                 pcons->lcdsizex;
 
-       for (row = 0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) {
-               uchar *s = str;
-               int i;
-#if LCD_BPP == LCD_COLOR16
-               ushort *d = (ushort *)dest;
-#elif LCD_BPP == LCD_COLOR32
-               u32 *d = (u32 *)dest;
-#else
-               uchar *d = dest;
-#endif
+       for (i = 0; i < (VIDEO_FONT_HEIGHT * pcons->lcdsizex); i++)
+               *dst++ = clr;
+}
 
-               fg_color = lcd_getfgcolor();
-               bg_color = lcd_getbgcolor();
-               for (i = 0; i < count; ++i) {
-                       uchar c, bits;
+static inline void console_moverow0(struct console_t *pcons,
+                                   u32 rowdst, u32 rowsrc)
+{
+       int i;
+       fbptr_t *dst = (fbptr_t *)pcons->fbbase +
+                                 rowdst * VIDEO_FONT_HEIGHT *
+                                 pcons->lcdsizex;
 
-                       c = *s++;
-                       bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row];
+       fbptr_t *src = (fbptr_t *)pcons->fbbase +
+                                 rowsrc * VIDEO_FONT_HEIGHT *
+                                 pcons->lcdsizex;
 
-                       for (c = 0; c < 8; ++c) {
-                               *d++ = (bits & 0x80) ? fg_color : bg_color;
-                               bits <<= 1;
-                       }
-               }
-       }
+       for (i = 0; i < (VIDEO_FONT_HEIGHT * pcons->lcdsizex); i++)
+               *dst++ = *src++;
 }
 
-static inline void lcd_putc_xy(ushort x, ushort y, uchar c)
+static inline void console_back(void)
 {
-       lcd_drawchars(x, y, &c, 1);
+       if (--cons.curr_col < 0) {
+               cons.curr_col = cons.cols - 1;
+               if (--cons.curr_row < 0)
+                       cons.curr_row = 0;
+       }
+
+       cons.fp_putc_xy(&cons,
+                       cons.curr_col * VIDEO_FONT_WIDTH,
+                       cons.curr_row * VIDEO_FONT_HEIGHT, ' ');
 }
 
-static void console_scrollup(void)
+static inline void console_newline(void)
 {
        const int rows = CONFIG_CONSOLE_SCROLL_LINES;
        int bg_color = lcd_getbgcolor();
+       int i;
 
-       /* Copy up rows ignoring those that will be overwritten */
-       memcpy(CONSOLE_ROW_FIRST,
-              lcd_console_address + CONSOLE_ROW_SIZE * rows,
-              CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows);
+       cons.curr_col = 0;
 
-       /* Clear the last rows */
-#if (LCD_BPP != LCD_COLOR32)
-       memset(lcd_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows,
-              bg_color, CONSOLE_ROW_SIZE * rows);
-#else
-       u32 *ppix = lcd_console_address +
-                   CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows;
-       u32 i;
-       for (i = 0;
-           i < (CONSOLE_ROW_SIZE * rows) / NBYTES(panel_info.vl_bpix);
-           i++) {
-               *ppix++ = bg_color;
+       /* Check if we need to scroll the terminal */
+       if (++cons.curr_row >= cons.rows) {
+               for (i = 0; i < cons.rows-rows; i++)
+                       cons.fp_console_moverow(&cons, i, i+rows);
+               for (i = 0; i < rows; i++)
+                       cons.fp_console_setrow(&cons, cons.rows-i-1, bg_color);
+               cons.curr_row -= rows;
        }
-#endif
        lcd_sync();
-       console_curr_row -= rows;
 }
 
-static inline void console_back(void)
+void console_calc_rowcol(struct console_t *pcons, u32 sizex, u32 sizey)
 {
-       if (--console_curr_col < 0) {
-               console_curr_col = console_cols - 1;
-               if (--console_curr_row < 0)
-                       console_curr_row = 0;
-       }
+       pcons->cols = sizex / VIDEO_FONT_WIDTH;
+#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
+       pcons->rows = (pcons->lcdsizey - BMP_LOGO_HEIGHT);
+       pcons->rows /= VIDEO_FONT_HEIGHT;
+#else
+       pcons->rows = sizey / VIDEO_FONT_HEIGHT;
+#endif
+}
 
-       lcd_putc_xy(console_curr_col * VIDEO_FONT_WIDTH,
-                   console_curr_row * VIDEO_FONT_HEIGHT, ' ');
+void __weak lcd_init_console_rot(struct console_t *pcons)
+{
+       return;
 }
 
-static inline void console_newline(void)
+void lcd_init_console(void *address, int vl_cols, int vl_rows, int vl_rot)
 {
-       console_curr_col = 0;
+       memset(&cons, 0, sizeof(cons));
+       cons.fbbase = address;
 
-       /* Check if we need to scroll the terminal */
-       if (++console_curr_row >= console_rows)
-               console_scrollup();
-       else
-               lcd_sync();
+       cons.lcdsizex = vl_cols;
+       cons.lcdsizey = vl_rows;
+       cons.lcdrot = vl_rot;
+
+       cons.fp_putc_xy = &lcd_putc_xy0;
+       cons.fp_console_moverow = &console_moverow0;
+       cons.fp_console_setrow = &console_setrow0;
+       console_calc_rowcol(&cons, cons.lcdsizex, cons.lcdsizey);
+
+       lcd_init_console_rot(&cons);
+
+       debug("lcd_console: have %d/%d col/rws on scr %dx%d (%d deg rotated)\n",
+             cons.cols, cons.rows, cons.lcdsizex, cons.lcdsizey, vl_rot);
 }
 
 void lcd_putc(const char c)
@@ -157,18 +166,17 @@ void lcd_putc(const char c)
 
        switch (c) {
        case '\r':
-               console_curr_col = 0;
-
+               cons.curr_col = 0;
                return;
        case '\n':
                console_newline();
 
                return;
        case '\t':      /* Tab (8 chars alignment) */
-               console_curr_col +=  8;
-               console_curr_col &= ~7;
+               cons.curr_col +=  8;
+               cons.curr_col &= ~7;
 
-               if (console_curr_col >= console_cols)
+               if (cons.curr_col >= cons.cols)
                        console_newline();
 
                return;
@@ -177,9 +185,10 @@ void lcd_putc(const char c)
 
                return;
        default:
-               lcd_putc_xy(console_curr_col * VIDEO_FONT_WIDTH,
-                           console_curr_row * VIDEO_FONT_HEIGHT, c);
-               if (++console_curr_col >= console_cols)
+               cons.fp_putc_xy(&cons,
+                               cons.curr_col * VIDEO_FONT_WIDTH,
+                               cons.curr_row * VIDEO_FONT_HEIGHT, c);
+               if (++cons.curr_col >= cons.cols)
                        console_newline();
        }
 }
diff --git a/common/lcd_console_rotation.c b/common/lcd_console_rotation.c
new file mode 100644 (file)
index 0000000..7aac521
--- /dev/null
@@ -0,0 +1,195 @@
+/*
+ * (C) Copyright 2015
+ * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <lcd.h>
+#include <video_font.h>                /* Get font data, width and height */
+
+static void lcd_putc_xy90(struct console_t *pcons, ushort x, ushort y, char c)
+{
+       int fg_color = lcd_getfgcolor();
+       int bg_color = lcd_getbgcolor();
+       int col, i;
+
+       fbptr_t *dst = (fbptr_t *)pcons->fbbase +
+                                 (x+1) * pcons->lcdsizex -
+                                 y;
+
+       uchar msk = 0x80;
+       uchar *pfont = video_fontdata + c * VIDEO_FONT_HEIGHT;
+       for (col = 0; col < VIDEO_FONT_WIDTH; ++col) {
+               for (i = 0; i < VIDEO_FONT_HEIGHT; ++i)
+                       *dst-- = (*(pfont + i) & msk) ? fg_color : bg_color;
+               msk >>= 1;
+               dst += (pcons->lcdsizex + VIDEO_FONT_HEIGHT);
+       }
+}
+
+static inline void console_setrow90(struct console_t *pcons, u32 row, int clr)
+{
+       int i, j;
+       fbptr_t *dst = (fbptr_t *)pcons->fbbase +
+                                 pcons->lcdsizex -
+                                 row*VIDEO_FONT_HEIGHT+1;
+
+       for (j = 0; j < pcons->lcdsizey; j++) {
+               for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
+                       *dst-- = clr;
+               dst += (pcons->lcdsizex + VIDEO_FONT_HEIGHT);
+       }
+}
+
+static inline void console_moverow90(struct console_t *pcons,
+                                     u32 rowdst, u32 rowsrc)
+{
+       int i, j;
+       fbptr_t *dst = (fbptr_t *)pcons->fbbase +
+                                 pcons->lcdsizex -
+                                 (rowdst*VIDEO_FONT_HEIGHT+1);
+
+       fbptr_t *src = (fbptr_t *)pcons->fbbase +
+                                 pcons->lcdsizex -
+                                 (rowsrc*VIDEO_FONT_HEIGHT+1);
+
+       for (j = 0; j < pcons->lcdsizey; j++) {
+               for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
+                       *dst-- = *src--;
+               src += (pcons->lcdsizex + VIDEO_FONT_HEIGHT);
+               dst += (pcons->lcdsizex + VIDEO_FONT_HEIGHT);
+       }
+}
+static void lcd_putc_xy180(struct console_t *pcons, ushort x, ushort y, char c)
+{
+       int fg_color = lcd_getfgcolor();
+       int bg_color = lcd_getbgcolor();
+       int i, row;
+       fbptr_t *dst = (fbptr_t *)pcons->fbbase +
+                                 pcons->lcdsizex +
+                                 pcons->lcdsizey * pcons->lcdsizex -
+                                 y * pcons->lcdsizex -
+                                 (x+1);
+
+       for (row = 0; row < VIDEO_FONT_HEIGHT; row++) {
+               uchar bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row];
+
+               for (i = 0; i < VIDEO_FONT_WIDTH; ++i) {
+                       *dst-- = (bits & 0x80) ? fg_color : bg_color;
+                       bits <<= 1;
+               }
+               dst -= (pcons->lcdsizex - VIDEO_FONT_WIDTH);
+       }
+}
+
+static inline void console_setrow180(struct console_t *pcons, u32 row, int clr)
+{
+       int i;
+       fbptr_t *dst = (fbptr_t *)pcons->fbbase +
+                                 (pcons->rows-row-1) * VIDEO_FONT_HEIGHT *
+                                 pcons->lcdsizex;
+
+       for (i = 0; i < (VIDEO_FONT_HEIGHT * pcons->lcdsizex); i++)
+               *dst++ = clr;
+}
+
+static inline void console_moverow180(struct console_t *pcons,
+                                     u32 rowdst, u32 rowsrc)
+{
+       int i;
+       fbptr_t *dst = (fbptr_t *)pcons->fbbase +
+                                 (pcons->rows-rowdst-1) * VIDEO_FONT_HEIGHT *
+                                 pcons->lcdsizex;
+
+       fbptr_t *src = (fbptr_t *)pcons->fbbase +
+                                 (pcons->rows-rowsrc-1) * VIDEO_FONT_HEIGHT *
+                                 pcons->lcdsizex;
+
+       for (i = 0; i < (VIDEO_FONT_HEIGHT * pcons->lcdsizex); i++)
+               *dst++ = *src++;
+}
+
+static void lcd_putc_xy270(struct console_t *pcons, ushort x, ushort y, char c)
+{
+       int fg_color = lcd_getfgcolor();
+       int bg_color = lcd_getbgcolor();
+       int i, col;
+       fbptr_t *dst = (fbptr_t *)pcons->fbbase +
+                                 pcons->lcdsizey * pcons->lcdsizex -
+                                 (x+1) * pcons->lcdsizex +
+                                 y;
+
+       uchar msk = 0x80;
+       uchar *pfont = video_fontdata + c * VIDEO_FONT_HEIGHT;
+       for (col = 0; col < VIDEO_FONT_WIDTH; ++col) {
+               for (i = 0; i < VIDEO_FONT_HEIGHT; ++i)
+                       *dst++ = (*(pfont + i) & msk) ? fg_color : bg_color;
+               msk >>= 1;
+               dst -= (pcons->lcdsizex + VIDEO_FONT_HEIGHT);
+       }
+}
+
+static inline void console_setrow270(struct console_t *pcons, u32 row, int clr)
+{
+       int i, j;
+       fbptr_t *dst = (fbptr_t *)pcons->fbbase +
+                                 row*VIDEO_FONT_HEIGHT;
+
+       for (j = 0; j < pcons->lcdsizey; j++) {
+               for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
+                       *dst++ = clr;
+               dst += (pcons->lcdsizex - VIDEO_FONT_HEIGHT);
+       }
+}
+
+static inline void console_moverow270(struct console_t *pcons,
+                                    u32 rowdst, u32 rowsrc)
+{
+       int i, j;
+       fbptr_t *dst = (fbptr_t *)pcons->fbbase +
+                                 rowdst*VIDEO_FONT_HEIGHT;
+
+       fbptr_t *src = (fbptr_t *)pcons->fbbase +
+                                 rowsrc*VIDEO_FONT_HEIGHT;
+
+       for (j = 0; j < pcons->lcdsizey; j++) {
+               for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
+                       *dst++ = *src++;
+               src += (pcons->lcdsizex - VIDEO_FONT_HEIGHT);
+               dst += (pcons->lcdsizex - VIDEO_FONT_HEIGHT);
+       }
+}
+
+static void console_calc_rowcol_rot(struct console_t *pcons)
+{
+       if (pcons->lcdrot == 1 || pcons->lcdrot == 3)
+               console_calc_rowcol(pcons, pcons->lcdsizey, pcons->lcdsizex);
+       else
+               console_calc_rowcol(pcons, pcons->lcdsizex, pcons->lcdsizey);
+}
+
+void lcd_init_console_rot(struct console_t *pcons)
+{
+       if (pcons->lcdrot == 0) {
+               return;
+       } else if (pcons->lcdrot == 1) {
+               pcons->fp_putc_xy = &lcd_putc_xy90;
+               pcons->fp_console_moverow = &console_moverow90;
+               pcons->fp_console_setrow = &console_setrow90;
+       } else if (pcons->lcdrot == 2) {
+               pcons->fp_putc_xy = &lcd_putc_xy180;
+               pcons->fp_console_moverow = &console_moverow180;
+               pcons->fp_console_setrow = &console_setrow180;
+       } else if (pcons->lcdrot == 3) {
+               pcons->fp_putc_xy = &lcd_putc_xy270;
+               pcons->fp_console_moverow = &console_moverow270;
+               pcons->fp_console_setrow = &console_setrow270;
+       } else {
+               printf("%s: invalid framebuffer rotation (%d)!\n",
+                      __func__, pcons->lcdrot);
+               return;
+       }
+       console_calc_rowcol_rot(pcons);
+}
index 22a316b5366d7e303a719bb881491a29618e7b46..f64918e6bae41dbaead0d688fd81a1156fb31b60 100644 (file)
@@ -45,5 +45,6 @@ obj-$(CONFIG_VIDEO_TEGRA) += tegra.o
 obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o
 obj-$(CONFIG_VIDEO_VESA) += vesa_fb.o
 obj-$(CONFIG_FORMIKE) += formike.o
+obj-$(CONFIG_LG4573) += lg4573.o
 obj-$(CONFIG_AM335X_LCD) += am335x-fb.o
 obj-$(CONFIG_VIDEO_PARADE) += parade.o
index 091b58fb47bfccfa4bc30bfdd9e87006bbafa438..348be58bf6abaa729401d0db9744bdc0cf801c90 100644 (file)
@@ -265,5 +265,4 @@ int ipu_dp_init(ipu_channel_t channel, uint32_t in_pixel_fmt,
 void ipu_dp_uninit(ipu_channel_t channel);
 void ipu_dp_dc_disable(ipu_channel_t channel, unsigned char swap);
 ipu_color_space_t format_to_colorspace(uint32_t fmt);
-
 #endif
index 5873531953316a25799c020206328bd84280b97d..9f851029157624605e8ae4450432accf283f3bdc 100644 (file)
@@ -210,9 +210,13 @@ static struct clk ipu_clk = {
        .usecount = 0,
 };
 
+#if !defined CONFIG_SYS_LDB_CLOCK
+#define CONFIG_SYS_LDB_CLOCK 65000000
+#endif
+
 static struct clk ldb_clk = {
        .name = "ldb_clk",
-       .rate = 65000000,
+       .rate = CONFIG_SYS_LDB_CLOCK,
        .usecount = 0,
 };
 
@@ -1194,3 +1198,11 @@ ipu_color_space_t format_to_colorspace(uint32_t fmt)
        }
        return RGB;
 }
+
+/* should be removed when clk framework is availiable */
+int ipu_set_ldb_clock(int rate)
+{
+       ldb_clk.rate = rate;
+
+       return 0;
+}
diff --git a/drivers/video/lg4573.c b/drivers/video/lg4573.c
new file mode 100644 (file)
index 0000000..43670fc
--- /dev/null
@@ -0,0 +1,231 @@
+/*
+ * LCD: LG4573, TFT 4.3", 480x800, RGB24
+ * LCD initialization via SPI
+ *
+ * SPDX-License-Identifier:    GPL-2.0
+ *
+ */
+#include <common.h>
+#include <errno.h>
+#include <spi.h>
+
+#define PWR_ON_DELAY_MSECS  120
+
+static int lb043wv_spi_write_u16(struct spi_slave *spi, u16 val)
+{
+       unsigned long flags = SPI_XFER_BEGIN;
+       unsigned short buf16 = htons(val);
+       int ret = 0;
+
+       flags |= SPI_XFER_END;
+
+       ret = spi_xfer(spi, 16, &buf16, NULL, flags);
+       if (ret)
+               debug("%s: Failed to send: %d\n", __func__, ret);
+
+       return ret;
+}
+
+static void lb043wv_spi_write_u16_array(struct spi_slave *spi, u16 *buff,
+                                       int size)
+{
+       int i;
+
+       for (i = 0; i < size; i++)
+               lb043wv_spi_write_u16(spi, buff[i]);
+}
+
+static void lb043wv_display_mode_settings(struct spi_slave *spi)
+{
+       static u16 display_mode_settings[] = {
+         0x703A,
+         0x7270,
+         0x70B1,
+         0x7208,
+         0x723B,
+         0x720F,
+         0x70B2,
+         0x7200,
+         0x72C8,
+         0x70B3,
+         0x7200,
+         0x70B4,
+         0x7200,
+         0x70B5,
+         0x7242,
+         0x7210,
+         0x7210,
+         0x7200,
+         0x7220,
+         0x70B6,
+         0x720B,
+         0x720F,
+         0x723C,
+         0x7213,
+         0x7213,
+         0x72E8,
+         0x70B7,
+         0x7246,
+         0x7206,
+         0x720C,
+         0x7200,
+         0x7200,
+       };
+
+       debug("transfer display mode settings\n");
+       lb043wv_spi_write_u16_array(spi, display_mode_settings,
+                                   ARRAY_SIZE(display_mode_settings));
+}
+
+static void lb043wv_power_settings(struct spi_slave *spi)
+{
+       static u16 power_settings[] = {
+         0x70C0,
+         0x7201,
+         0x7211,
+         0x70C3,
+         0x7207,
+         0x7203,
+         0x7204,
+         0x7204,
+         0x7204,
+         0x70C4,
+         0x7212,
+         0x7224,
+         0x7218,
+         0x7218,
+         0x7202,
+         0x7249,
+         0x70C5,
+         0x726F,
+         0x70C6,
+         0x7241,
+         0x7263,
+       };
+
+       debug("transfer power settings\n");
+       lb043wv_spi_write_u16_array(spi, power_settings,
+                                   ARRAY_SIZE(power_settings));
+}
+
+static void lb043wv_gamma_settings(struct spi_slave *spi)
+{
+       static u16 gamma_settings[] = {
+         0x70D0,
+         0x7203,
+         0x7207,
+         0x7273,
+         0x7235,
+         0x7200,
+         0x7201,
+         0x7220,
+         0x7200,
+         0x7203,
+         0x70D1,
+         0x7203,
+         0x7207,
+         0x7273,
+         0x7235,
+         0x7200,
+         0x7201,
+         0x7220,
+         0x7200,
+         0x7203,
+         0x70D2,
+         0x7203,
+         0x7207,
+         0x7273,
+         0x7235,
+         0x7200,
+         0x7201,
+         0x7220,
+         0x7200,
+         0x7203,
+         0x70D3,
+         0x7203,
+         0x7207,
+         0x7273,
+         0x7235,
+         0x7200,
+         0x7201,
+         0x7220,
+         0x7200,
+         0x7203,
+         0x70D4,
+         0x7203,
+         0x7207,
+         0x7273,
+         0x7235,
+         0x7200,
+         0x7201,
+         0x7220,
+         0x7200,
+         0x7203,
+         0x70D5,
+         0x7203,
+         0x7207,
+         0x7273,
+         0x7235,
+         0x7200,
+         0x7201,
+         0x7220,
+         0x7200,
+         0x7203,
+       };
+
+       debug("transfer gamma settings\n");
+       lb043wv_spi_write_u16_array(spi, gamma_settings,
+                                   ARRAY_SIZE(gamma_settings));
+}
+
+static void lb043wv_display_on(struct spi_slave *spi)
+{
+       static u16 sleep_out = 0x7011;
+       static u16 display_on = 0x7029;
+
+       lb043wv_spi_write_u16(spi, sleep_out);
+       mdelay(PWR_ON_DELAY_MSECS);
+       lb043wv_spi_write_u16(spi, display_on);
+}
+
+int lg4573_spi_startup(unsigned int bus, unsigned int cs,
+       unsigned int max_hz, unsigned int spi_mode)
+{
+       struct spi_slave *spi;
+       int ret;
+
+       spi = spi_setup_slave(bus, cs, max_hz, spi_mode);
+       if (!spi) {
+               debug("%s: Failed to set up slave\n", __func__);
+               return -1;
+       }
+
+       ret = spi_claim_bus(spi);
+       if (ret) {
+               debug("%s: Failed to claim SPI bus: %d\n", __func__, ret);
+               goto err_claim_bus;
+       }
+
+       lb043wv_display_mode_settings(spi);
+       lb043wv_power_settings(spi);
+       lb043wv_gamma_settings(spi);
+
+       lb043wv_display_on(spi);
+       return 0;
+err_claim_bus:
+       spi_free_slave(spi);
+       return -1;
+}
+
+static int do_lgset(cmd_tbl_t *cmdtp, int flag, int argc,
+                      char * const argv[])
+{
+       lg4573_spi_startup(0, 0, 10000000, SPI_MODE_0);
+       return 0;
+}
+
+U_BOOT_CMD(
+       lgset,  2,      1,      do_lgset,
+       "set lgdisplay",
+       ""
+);
index a920bc087712ff289c65eec948f0f234229f9f5c..5acfc03704a9b35d9f823637ffac86e06f051208 100644 (file)
 
 int sandbox_fs_set_blk_dev(block_dev_desc_t *rbdd, disk_partition_t *info)
 {
-       return 0;
+       /*
+        * Only accept a NULL block_dev_desc_t for the sandbox, which is when
+        * hostfs interface is used
+        */
+       return rbdd != NULL;
 }
 
 int sandbox_fs_read_at(const char *filename, loff_t pos, void *buffer,
index fa8aa294542f60e2af44a723417e6ec6183507ee..6993128b1b4c37df8d6c544cb2e06e0f220269c0 100644 (file)
@@ -13,7 +13,8 @@
 typedef struct vidinfo {
        ushort vl_col;          /* Number of columns (i.e. 640) */
        ushort vl_row;          /* Number of rows (i.e. 480) */
-       u_long vl_clk;  /* pixel clock in ps    */
+       ushort vl_rot;          /* Rotation of Display (0, 1, 2, 3) */
+       u_long vl_clk;          /* pixel clock in ps    */
 
        /* LCD configuration register */
        u_long vl_sync;         /* Horizontal / vertical sync */
index d71e58dae1e54e98141fa941aa14e804ffbb89e2..3a360ca49a16159e4e4f8793ca419f9ab2b39150 100644 (file)
 #define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \
        #devtypel #instance " "
 
+#ifdef CONFIG_SANDBOX
+#define BOOTENV_SHARED_HOST    BOOTENV_SHARED_BLKDEV(host)
+#define BOOTENV_DEV_HOST       BOOTENV_DEV_BLKDEV
+#define BOOTENV_DEV_NAME_HOST  BOOTENV_DEV_NAME_BLKDEV
+#else
+#define BOOTENV_SHARED_HOST
+#define BOOTENV_DEV_HOST \
+       BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX
+#define BOOTENV_DEV_NAME_HOST \
+       BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX
+#endif
+
 #ifdef CONFIG_CMD_MMC
 #define BOOTENV_SHARED_MMC     BOOTENV_SHARED_BLKDEV(mmc)
 #define BOOTENV_DEV_MMC                BOOTENV_DEV_BLKDEV
 #define BOOTENV_DEV(devtypeu, devtypel, instance) \
        BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance)
 #define BOOTENV \
+       BOOTENV_SHARED_HOST \
        BOOTENV_SHARED_MMC \
        BOOTENV_SHARED_USB \
        BOOTENV_SHARED_SATA \
index 8237239c0021d32f53e53ff8e4cf0109c0539277..5eea5cf900d83876cdc68c748ac870fe5a95cfa3 100644 (file)
 #else
 #define CONFIG_BOOTP_VCI_STRING         "U-boot.arm"
 #endif
+#elif defined(__i386__)
+#define CONFIG_BOOTP_PXE_CLIENTARCH     0x0
+#elif defined(__x86_64__)
+#define CONFIG_BOOTP_PXE_CLIENTARCH     0x9
 #endif
 
 #define CONFIG_OF_LIBFDT
index 0a3671990c55392b396c3a15d647e7040c4ef488..3bf45a224d292747b7ddb8ba5cd9ebe0a26d1e40 100644 (file)
@@ -73,7 +73,6 @@
 #define CONFIG_CMDLINE_EDITING
 #define CONFIG_COMMAND_HISTORY
 #define CONFIG_AUTO_COMPLETE
-#define CONFIG_BOOTDELAY       3
 
 #define CONFIG_ENV_SIZE                8192
 #define CONFIG_ENV_IS_NOWHERE
 
 /* include default commands */
 #include <config_cmd_default.h>
+#include <config_distro_defaults.h>
+
+#define BOOT_TARGET_DEVICES(func) \
+       func(HOST, host, 1) \
+       func(HOST, host, 0)
+
+#include <config_distro_bootcmd.h>
 
 #define CONFIG_KEEP_SERVERADDR
 #define CONFIG_UDP_CHECKSUM
 #define CONFIG_CMD_LINK_LOCAL
 #define CONFIG_CMD_CDP
 #define CONFIG_CMD_DNS
-#define CONFIG_CMD_NFS
 #define CONFIG_CMD_SNTP
 #define CONFIG_TIMESTAMP
 #define CONFIG_CMD_RARP
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_DHCP
 #define CONFIG_BOOTP_DNS
 #define CONFIG_BOOTP_DNS2
-#define CONFIG_BOOTP_GATEWAY
 #define CONFIG_BOOTP_SEND_HOSTNAME
 #define CONFIG_BOOTP_SERVERIP
-#define CONFIG_BOOTP_SUBNETMASK
 #define CONFIG_IP_DEFRAG
 
+/* Can't boot elf images */
+#undef CONFIG_CMD_ELF
+
 #define CONFIG_CMD_HASH
 #define CONFIG_HASH_VERIFY
 #define CONFIG_SHA1
                                        "eth5addr=00:00:11:22:33:46\0" \
                                        "ipaddr=1.2.3.4\0"
 
-#define CONFIG_EXTRA_ENV_SETTINGS      SANDBOX_SERIAL_SETTINGS \
-                                       SANDBOX_ETH_SETTINGS
+#define MEM_LAYOUT_ENV_SETTINGS \
+       "bootm_size=0x10000000\0" \
+       "kernel_addr_r=0x1000000\0" \
+       "fdt_addr_r=0xc00000\0" \
+       "ramdisk_addr_r=0x2000000\0" \
+       "scriptaddr=0x1000\0" \
+       "pxefile_addr_r=0x2000\0"
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+       SANDBOX_SERIAL_SETTINGS \
+       SANDBOX_ETH_SETTINGS \
+       BOOTENV \
+       MEM_LAYOUT_ENV_SETTINGS
 
 #define CONFIG_GZIP_COMPRESSED
 #define CONFIG_BZIP2
index cf389dac692f603698f5639814480cebd8118b91..3969a6a06662408482aa06b521a5a619ef8ffa16 100644 (file)
@@ -25,6 +25,7 @@ enum exynos_fb_rgb_mode_t {
 typedef struct vidinfo {
        ushort vl_col;          /* Number of columns (i.e. 640) */
        ushort vl_row;          /* Number of rows (i.e. 480) */
+       ushort vl_rot;          /* Rotation of Display (0, 1, 2, 3) */
        ushort vl_width;        /* Width of display area in millimeters */
        ushort vl_height;       /* Height of display area in millimeters */
 
index f049fd3489e201fbd0f275930bc59729668b1b0b..59202b7e59de8ddf7f4fb4321bf1886b47a7d2fd 100644 (file)
@@ -51,6 +51,7 @@ void lcd_set_flush_dcache(int flush);
 typedef struct vidinfo {
        ushort  vl_col;         /* Number of columns (i.e. 160) */
        ushort  vl_row;         /* Number of rows (i.e. 100) */
+       ushort  vl_rot;         /* Rotation of Display (0, 1, 2, 3) */
        u_char  vl_bpix;        /* Bits per pixel, 0 = 1 */
        ushort  *cmap;          /* Pointer to the colormap */
        void    *priv;          /* Pointer to driver-specific data */
@@ -196,6 +197,14 @@ void lcd_sync(void);
 #define CONSOLE_COLOR_WHITE    0xffff          /* Must remain last / highest */
 #endif /* color definitions */
 
+#if LCD_BPP == LCD_COLOR16
+#define fbptr_t ushort
+#elif LCD_BPP == LCD_COLOR32
+#define fbptr_t u32
+#else
+#define fbptr_t uchar
+#endif
+
 #ifndef PAGE_SIZE
 #define PAGE_SIZE      4096
 #endif
index 429214df80943ebf142a326ac1e2221dbec911ae..2e0f56f9903a24259c18b58e151206cd02fda941 100644 (file)
@@ -9,6 +9,26 @@
 #define CONFIG_CONSOLE_SCROLL_LINES 1
 #endif
 
+struct console_t {
+       short curr_col, curr_row;
+       short cols, rows;
+       void *fbbase;
+       u32 lcdsizex, lcdsizey, lcdrot;
+       void (*fp_putc_xy)(struct console_t *pcons, ushort x, ushort y, char c);
+       void (*fp_console_moverow)(struct console_t *pcons,
+                                  u32 rowdst, u32 rowsrc);
+       void (*fp_console_setrow)(struct console_t *pcons, u32 row, int clr);
+};
+
+/**
+ * console_calc_rowcol() - calculate available rows / columns wihtin a given
+ * screen-size based on used VIDEO_FONT.
+ *
+ * @pcons: Pointer to struct console_t
+ * @sizex: size X of the screen in pixel
+ * @sizey: size Y of the screen in pixel
+ */
+void console_calc_rowcol(struct console_t *pcons, u32 sizex, u32 sizey);
 /**
  * lcd_init_console() - Initialize lcd console parameters
  *
  * console has.
  *
  * @address: Console base address
- * @rows: Number of rows in the console
- * @cols: Number of columns in the console
+ * @vl_rows: Number of rows in the console
+ * @vl_cols: Number of columns in the console
+ * @vl_rot: Rotation of display in degree (0 - 90 - 180 - 270) counterlockwise
  */
-void lcd_init_console(void *address, int rows, int cols);
-
+void lcd_init_console(void *address, int vl_cols, int vl_rows, int vl_rot);
 /**
  * lcd_set_col() - Set the number of the current lcd console column
  *
index 7e210e329602f09515d0d1d0b8e0405760ee3596..cc72cde13f05ae69caeb06fd2679294d03982bc9 100644 (file)
@@ -16,6 +16,7 @@
 typedef struct vidinfo {
        ushort  vl_col;         /* Number of columns (i.e. 640) */
        ushort  vl_row;         /* Number of rows (i.e. 480) */
+       ushort  vl_rot;         /* Rotation of Display (0, 1, 2, 3) */
        ushort  vl_width;       /* Width of display area in millimeters */
        ushort  vl_height;      /* Height of display area in millimeters */
 
index 723f6ab76670e4a0a229f831a00b84821aaf2eda..1ea3717bf74283fcd53ab476318505324b7104b8 100644 (file)
@@ -48,6 +48,7 @@ struct pxafb_info {
 typedef struct vidinfo {
        ushort  vl_col;         /* Number of columns (i.e. 640) */
        ushort  vl_row;         /* Number of rows (i.e. 480) */
+       ushort  vl_rot;         /* Rotation of Display (0, 1, 2, 3) */
        ushort  vl_width;       /* Width of display area in millimeters */
        ushort  vl_height;      /* Height of display area in millimeters */
 
index 673aa2ec56fb4ef8cb5379472f00e4a8d2b6b193..65e4ec1e1a3df81ed83562914b902a18530b6fe3 100644 (file)
@@ -69,4 +69,8 @@ void video_clear(void);
 int kwh043st20_f01_spi_startup(unsigned int bus, unsigned int cs,
        unsigned int max_hz, unsigned int spi_mode);
 #endif
+#if defined(CONFIG_LG4573)
+int lg4573_spi_startup(unsigned int bus, unsigned int cs,
+       unsigned int max_hz, unsigned int spi_mode);
+#endif
 #endif