From 0dc579f36c912188c42122574911cf4e64fc357c Mon Sep 17 00:00:00 2001 From: Przemyslaw Marczak Date: Mon, 1 Sep 2014 13:50:42 +0200 Subject: samsung: misc: fix soc revision setting in the set_board_info() The byte order of soc revision was inverted, now it is fixed. Signed-off-by: Przemyslaw Marczak Cc: Minkyu Kang Signed-off-by: Minkyu Kang --- board/samsung/common/misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'board/samsung/common') diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c index 03106fd..a453a82 100644 --- a/board/samsung/common/misc.c +++ b/board/samsung/common/misc.c @@ -26,8 +26,8 @@ void set_board_info(void) { char info[64]; - snprintf(info, ARRAY_SIZE(info), "%d.%d", s5p_cpu_rev & 0x0f, - (s5p_cpu_rev & 0xf0) >> 0x04); + snprintf(info, ARRAY_SIZE(info), "%u.%u", (s5p_cpu_rev & 0xf0) >> 4, + s5p_cpu_rev & 0xf); setenv("soc_rev", info); snprintf(info, ARRAY_SIZE(info), "%x", s5p_cpu_id); -- cgit v1.1 From 33a4fcf637c306d43109b37d55bb718c069b8cdf Mon Sep 17 00:00:00 2001 From: Przemyslaw Marczak Date: Mon, 1 Sep 2014 13:50:45 +0200 Subject: board:samsung: check the boot device and init the right mmc driver. It is possible to boot device using a micro SD or eMMC slots. In this situation, boot device should be registered as a block device 0 in the MMC framework, because CONFIG_SYS_MMC_ENV_DEV is usually set to "0" in the most config cases. Signed-off-by: Przemyslaw Marczak Signed-off-by: Minkyu Kang --- board/samsung/common/board.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'board/samsung/common') diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c index 9dc7c83..1fa0e51 100644 --- a/board/samsung/common/board.c +++ b/board/samsung/common/board.c @@ -240,22 +240,39 @@ int board_eth_init(bd_t *bis) } #ifdef CONFIG_GENERIC_MMC -int board_mmc_init(bd_t *bis) +static int init_mmc(void) +{ +#ifdef CONFIG_SDHCI + return exynos_mmc_init(gd->fdt_blob); +#else + return 0; +#endif +} + +static int init_dwmmc(void) { - int ret; #ifdef CONFIG_DWMMC - /* dwmmc initializattion for available channels */ - ret = exynos_dwmmc_init(gd->fdt_blob); - if (ret) - debug("dwmmc init failed\n"); + return exynos_dwmmc_init(gd->fdt_blob); +#else + return 0; #endif +} + +int board_mmc_init(bd_t *bis) +{ + int ret; + + if (get_boot_mode() == BOOT_MODE_SD) { + ret = init_mmc(); + ret |= init_dwmmc(); + } else { + ret = init_dwmmc(); + ret |= init_mmc(); + } -#ifdef CONFIG_SDHCI - /* mmc initializattion for available channels */ - ret = exynos_mmc_init(gd->fdt_blob); if (ret) debug("mmc init failed\n"); -#endif + return ret; } #endif -- cgit v1.1 From 1d07c1013c717bd79bb2bd7a94861fbeb2067176 Mon Sep 17 00:00:00 2001 From: Przemyslaw Marczak Date: Mon, 1 Sep 2014 13:50:46 +0200 Subject: samsung: misc: add function for setting $dfu_alt_info This change introduces new common function: - set_dfu_alt_info() - put dfu system and bootloader setting into $dfu_alt_info. functions declaration: - char *get_dfu_alt_system(void) - char *get_dfu_alt_boot(void) - void set_dfu_alt_info(void) and new config: - CONFIG_SET_DFU_ALT_INFO This function can be used for auto setting dfu configuration on boot. Such feature is useful for multi board support by one u-boot binary. Each board should define two functions: - get_dfu_alt_system() - get_dfu_alt_boot() Signed-off-by: Przemyslaw Marczak Cc: Minkyu Kang Signed-off-by: Minkyu Kang --- board/samsung/common/misc.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'board/samsung/common') diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c index a453a82..9e52452 100644 --- a/board/samsung/common/misc.c +++ b/board/samsung/common/misc.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -21,6 +22,46 @@ DECLARE_GLOBAL_DATA_PTR; +#ifdef CONFIG_SET_DFU_ALT_INFO +void set_dfu_alt_info(void) +{ + size_t buf_size = CONFIG_SET_DFU_ALT_BUF_LEN; + ALLOC_CACHE_ALIGN_BUFFER(char, buf, buf_size); + char *alt_info = "Settings not found!"; + char *status = "error!\n"; + char *alt_setting; + char *alt_sep; + int offset = 0; + + puts("DFU alt info setting: "); + + alt_setting = get_dfu_alt_boot(); + if (alt_setting) { + setenv("dfu_alt_boot", alt_setting); + offset = snprintf(buf, buf_size, "%s", alt_setting); + } + + alt_setting = get_dfu_alt_system(); + if (alt_setting) { + if (offset) + alt_sep = ";"; + else + alt_sep = ""; + + offset += snprintf(buf + offset, buf_size - offset, + "%s%s", alt_sep, alt_setting); + } + + if (offset) { + alt_info = buf; + status = "done\n"; + } + + setenv("dfu_alt_info", alt_info); + puts(status); +} +#endif + #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG void set_board_info(void) { -- cgit v1.1 From 32ee9bc5ed615497179a4b0e38322d1a250f2c79 Mon Sep 17 00:00:00 2001 From: Przemyslaw Marczak Date: Mon, 1 Sep 2014 13:50:47 +0200 Subject: samsung:board: misc_init_r: call set_dfu_alt_info() This change enable automatic setting of dfu alt info on every boot. This is useful in case of booting one u-boot binary from multiple media. Signed-off-by: Przemyslaw Marczak Signed-off-by: Minkyu Kang --- board/samsung/common/board.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'board/samsung/common') diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c index 1fa0e51..5693813 100644 --- a/board/samsung/common/board.c +++ b/board/samsung/common/board.c @@ -324,6 +324,9 @@ int arch_early_init_r(void) #ifdef CONFIG_MISC_INIT_R int misc_init_r(void) { +#ifdef CONFIG_SET_DFU_ALT_INFO + set_dfu_alt_info(); +#endif #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG set_board_info(); #endif -- cgit v1.1 From d50c41efcd6621481dbf4ff25331badf980cb429 Mon Sep 17 00:00:00 2001 From: Przemyslaw Marczak Date: Mon, 1 Sep 2014 13:50:49 +0200 Subject: samsung: board: enable support of multiple board types This change adds declaration of functions: - set_board_type() - called at board_early_init_f() - get_board_type() - called at checkboard() For supporting multiple board types in a one config - it is welcome to display the current board model. This is what get_board_type() should return. Signed-off-by: Przemyslaw Marczak Cc: Minkyu Kang Signed-off-by: Minkyu Kang --- board/samsung/common/board.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'board/samsung/common') diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c index 5693813..3d1cf43 100644 --- a/board/samsung/common/board.c +++ b/board/samsung/common/board.c @@ -137,7 +137,9 @@ static int board_uart_init(void) int board_early_init_f(void) { int err; - +#ifdef CONFIG_BOARD_TYPES + set_board_type(); +#endif err = board_uart_init(); if (err) { debug("UART init failed\n"); @@ -147,7 +149,6 @@ int board_early_init_f(void) #ifdef CONFIG_SYS_I2C_INIT_BOARD board_i2c_init(gd->fdt_blob); #endif - return exynos_early_init_f(); } #endif @@ -280,11 +281,15 @@ int board_mmc_init(bd_t *bis) #ifdef CONFIG_DISPLAY_BOARDINFO int checkboard(void) { - const char *board_name; + const char *board_info; - board_name = fdt_getprop(gd->fdt_blob, 0, "model", NULL); - printf("Board: %s\n", board_name ? board_name : "unknown"); + board_info = fdt_getprop(gd->fdt_blob, 0, "model", NULL); + printf("Board: %s\n", board_info ? board_info : "unknown"); +#ifdef CONFIG_BOARD_TYPES + board_info = get_board_type(); + printf("Model: %s\n", board_info ? board_info : "unknown"); +#endif return 0; } #endif -- cgit v1.1 From c9c36bf56e4c6a7df3ea5abafbd993df265c9538 Mon Sep 17 00:00:00 2001 From: Przemyslaw Marczak Date: Mon, 1 Sep 2014 13:50:50 +0200 Subject: samsung: misc: use board specific functions to set env board info This change adds setup of environmental board info using get_board_name() and get_board_type() functions for config CONFIG_BOARD_TYPES. This is useful in case of running many boards with just one config. Signed-off-by: Przemyslaw Marczak Cc: Minkyu Kang Signed-off-by: Minkyu Kang --- board/samsung/common/misc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'board/samsung/common') diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c index 9e52452..8766f0c 100644 --- a/board/samsung/common/misc.c +++ b/board/samsung/common/misc.c @@ -79,8 +79,16 @@ void set_board_info(void) setenv("board_rev", info); #endif #ifdef CONFIG_OF_LIBFDT - snprintf(info, ARRAY_SIZE(info), "%s%x-%s.dtb", - CONFIG_SYS_SOC, s5p_cpu_id, CONFIG_SYS_BOARD); + const char *bdtype = ""; + const char *bdname = CONFIG_SYS_BOARD; + +#ifdef CONFIG_BOARD_TYPES + bdtype = get_board_type(); + sprintf(info, "%s%s", bdname, bdtype); + setenv("boardname", info); +#endif + snprintf(info, ARRAY_SIZE(info), "%s%x-%s%s.dtb", + CONFIG_SYS_SOC, s5p_cpu_id, bdname, bdtype); setenv("fdtfile", info); #endif } -- cgit v1.1 From f0017175e33d7c21269deebc5e2ca2827b1e5975 Mon Sep 17 00:00:00 2001 From: Ajay Kumar Date: Fri, 5 Sep 2014 16:53:30 +0530 Subject: exynos_fb: Remove usage of static defines Previously, we used to statically assign values for vl_col, vl_row and vl_bpix using #defines like LCD_XRES, LCD_YRES and LCD_COLOR16. Introducing the function exynos_lcd_early_init() would take care of this assignment on the fly by parsing FIMD DT properties, thereby allowing us to remove LCD_XRES and LCD_YRES from the main config file. Signed-off-by: Ajay Kumar Acked-by: Simon Glass Tested-by: Simon Glass Signed-off-by: Minkyu Kang --- board/samsung/common/board.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'board/samsung/common') diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c index 3d1cf43..5c3c5bb 100644 --- a/board/samsung/common/board.c +++ b/board/samsung/common/board.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -149,6 +150,21 @@ int board_early_init_f(void) #ifdef CONFIG_SYS_I2C_INIT_BOARD board_i2c_init(gd->fdt_blob); #endif + +#if defined(CONFIG_OF_CONTROL) && defined(CONFIG_EXYNOS_FB) +/* + * board_init_f(arch/arm/lib/board.c) calls lcd_setmem() which needs + * panel_info.vl_col, panel_info.vl_row and panel_info.vl_bpix, to reserve + * FB memory at a very early stage. So, we need to fill panel_info.vl_col, + * panel_info.vl_row and panel_info.vl_bpix before lcd_setmem() is called. + */ + err = exynos_lcd_early_init(gd->fdt_blob); + if (err) { + debug("LCD early init failed\n"); + return err; + } +#endif + return exynos_early_init_f(); } #endif -- cgit v1.1