X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=board%2Fsamsung%2Fcommon%2Fmisc.c;h=c9df7e69d9ad031ab1733da6d67b6ccdb139bfc7;hb=83d290c56fab2d38cd1ab4c4cc7099559c1d5046;hp=4538ac7f2a2fc2d2a91f840944d13ec542e35e11;hpb=625509ab0edbb7d943ad9028de3c21ca48aa58be;p=platform%2Fkernel%2Fu-boot.git diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c index 4538ac7..c9df7e6 100644 --- a/board/samsung/common/misc.c +++ b/board/samsung/common/misc.c @@ -1,8 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2013 Samsung Electronics * Przemyslaw Marczak - * - * SPDX-License-Identifier: GPL-2.0+ */ #include @@ -12,17 +11,32 @@ #include #include #include +#include #include #include #include #include +#include +/* + * Use #ifdef to work around conflicting headers while we wait for this to be + * converted to driver model. + */ +#ifdef CONFIG_DM_PMIC_MAX77686 +#include +#endif +#ifdef CONFIG_DM_PMIC_MAX8998 +#include +#endif +#ifdef CONFIG_PMIC_MAX8997 +#include +#endif #include #include DECLARE_GLOBAL_DATA_PTR; #ifdef CONFIG_SET_DFU_ALT_INFO -void set_dfu_alt_info(void) +void set_dfu_alt_info(char *interface, char *devstr) { size_t buf_size = CONFIG_SET_DFU_ALT_BUF_LEN; ALLOC_CACHE_ALIGN_BUFFER(char, buf, buf_size); @@ -34,13 +48,13 @@ void set_dfu_alt_info(void) puts("DFU alt info setting: "); - alt_setting = get_dfu_alt_boot(); + alt_setting = get_dfu_alt_boot(interface, devstr); if (alt_setting) { - setenv("dfu_alt_boot", alt_setting); + env_set("dfu_alt_boot", alt_setting); offset = snprintf(buf, buf_size, "%s", alt_setting); } - alt_setting = get_dfu_alt_system(); + alt_setting = get_dfu_alt_system(interface, devstr); if (alt_setting) { if (offset) alt_sep = ";"; @@ -56,7 +70,7 @@ void set_dfu_alt_info(void) status = "done\n"; } - setenv("dfu_alt_info", alt_info); + env_set("dfu_alt_info", alt_info); puts(status); } #endif @@ -68,14 +82,14 @@ void set_board_info(void) snprintf(info, ARRAY_SIZE(info), "%u.%u", (s5p_cpu_rev & 0xf0) >> 4, s5p_cpu_rev & 0xf); - setenv("soc_rev", info); + env_set("soc_rev", info); snprintf(info, ARRAY_SIZE(info), "%x", s5p_cpu_id); - setenv("soc_id", info); + env_set("soc_id", info); #ifdef CONFIG_REVISION_TAG snprintf(info, ARRAY_SIZE(info), "%x", get_board_rev()); - setenv("board_rev", info); + env_set("board_rev", info); #endif #ifdef CONFIG_OF_LIBFDT const char *bdtype = ""; @@ -83,12 +97,15 @@ void set_board_info(void) #ifdef CONFIG_BOARD_TYPES bdtype = get_board_type(); + if (!bdtype) + bdtype = ""; + sprintf(info, "%s%s", bdname, bdtype); - setenv("boardname", info); + env_set("boardname", info); #endif snprintf(info, ARRAY_SIZE(info), "%s%x-%s%s.dtb", CONFIG_SYS_SOC, s5p_cpu_id, bdname, bdtype); - setenv("fdtfile", info); + env_set("fdtfile", info); #endif } #endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */ @@ -96,6 +113,7 @@ void set_board_info(void) #ifdef CONFIG_LCD_MENU static int power_key_pressed(u32 reg) { +#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ struct pmic *pmic; u32 status; u32 mask; @@ -118,6 +136,9 @@ static int power_key_pressed(u32 reg) return 0; return !!(status & mask); +#else + return 0; +#endif } static int key_pressed(int key) @@ -142,6 +163,7 @@ static int key_pressed(int key) return value; } +#ifdef CONFIG_LCD static int check_keys(void) { int keys = 0; @@ -198,7 +220,7 @@ mode_cmd[BOOT_MODE_EXIT + 1] = { static void display_board_info(void) { -#ifdef CONFIG_GENERIC_MMC +#ifdef CONFIG_MMC struct mmc *mmc = find_mmc_device(0); #endif vidinfo_t *vid = &panel_info; @@ -216,7 +238,7 @@ static void display_board_info(void) lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS); lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M); -#ifdef CONFIG_GENERIC_MMC +#ifdef CONFIG_MMC if (mmc) { if (!mmc->capacity) mmc_init(mmc); @@ -230,9 +252,11 @@ static void display_board_info(void) lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix); } +#endif static int mode_leave_menu(int mode) { +#ifdef CONFIG_LCD char *exit_option; char *exit_reset = "reset"; char *exit_back = "back"; @@ -254,9 +278,9 @@ static int mode_leave_menu(int mode) cmd = find_cmd(mode_name[mode][1]); if (cmd) { printf("Enter: %s %s\n", mode_name[mode][0], - mode_info[mode]); + mode_info[mode]); lcd_printf("\n\n\t%s %s\n", mode_name[mode][0], - mode_info[mode]); + mode_info[mode]); lcd_puts("\n\tDo not turn off device before finish!\n"); cmd_result = run_command(mode_cmd[mode], 0); @@ -296,8 +320,12 @@ static int mode_leave_menu(int mode) lcd_clear(); return leave; +#else + return 0; +#endif } +#ifdef CONFIG_LCD static void display_download_menu(int mode) { char *selection[BOOT_MODE_EXIT + 1]; @@ -313,12 +341,13 @@ static void display_download_menu(int mode) for (i = 0; i <= BOOT_MODE_EXIT; i++) lcd_printf("\t%s %s - %s\n\n", selection[i], - mode_name[i][0], - mode_info[i]); + mode_name[i][0], mode_info[i]); } +#endif static void download_menu(void) { +#ifdef CONFIG_LCD int mode = 0; int last_mode = 0; int run; @@ -389,6 +418,7 @@ static void download_menu(void) } lcd_clear(); +#endif } void check_boot_mode(void) @@ -426,7 +456,7 @@ void draw_logo(void) addr = panel_info.logo_addr; if (!addr) { - error("There is no logo data."); + pr_err("There is no logo data."); return; }