+// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2013 Samsung Electronics
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
+#include <command.h>
+#include <env.h>
#include <lcd.h>
#include <libtizen.h>
#include <samsung/misc.h>
#include <errno.h>
#include <version.h>
+#include <malloc.h>
+#include <memalign.h>
#include <linux/sizes.h>
#include <asm/arch/cpu.h>
-#include <asm/arch/gpio.h>
#include <asm/gpio.h>
#include <linux/input.h>
+#include <dm.h>
+/*
+ * Use #ifdef to work around conflicting headers while we wait for this to be
+ * converted to driver model.
+ */
+#ifdef CONFIG_DM_PMIC_MAX77686
+#include <power/max77686_pmic.h>
+#endif
+#ifdef CONFIG_DM_PMIC_MAX8998
+#include <power/max8998_pmic.h>
+#endif
+#ifdef CONFIG_PMIC_MAX8997
+#include <power/max8997_pmic.h>
+#endif
#include <power/pmic.h>
#include <mmc.h>
DECLARE_GLOBAL_DATA_PTR;
+#ifdef CONFIG_SET_DFU_ALT_INFO
+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);
+ 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(interface, devstr);
+ if (alt_setting) {
+ env_set("dfu_alt_boot", alt_setting);
+ offset = snprintf(buf, buf_size, "%s", alt_setting);
+ }
+
+ alt_setting = get_dfu_alt_system(interface, devstr);
+ 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";
+ }
+
+ env_set("dfu_alt_info", alt_info);
+ puts(status);
+}
+#endif
+
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
void set_board_info(void)
{
char info[64];
- snprintf(info, ARRAY_SIZE(info), "%d.%d", s5p_cpu_rev & 0x0f,
- (s5p_cpu_rev & 0xf0) >> 0x04);
- setenv("soc_rev", info);
+ snprintf(info, ARRAY_SIZE(info), "%u.%u", (s5p_cpu_rev & 0xf0) >> 4,
+ s5p_cpu_rev & 0xf);
+ 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
- snprintf(info, ARRAY_SIZE(info), "%s%x-%s.dtb",
- CONFIG_SYS_SOC, s5p_cpu_id, CONFIG_SYS_BOARD);
- setenv("fdtfile", info);
+ const char *bdtype = "";
+ const char *bdname = CONFIG_SYS_BOARD;
+
+#ifdef CONFIG_BOARD_TYPES
+ bdtype = get_board_type();
+ if (!bdtype)
+ bdtype = "";
+
+ sprintf(info, "%s%s", bdname, bdtype);
+ env_set("board_name", info);
+#endif
+ snprintf(info, ARRAY_SIZE(info), "%s%x-%s%s.dtb",
+ CONFIG_SYS_SOC, s5p_cpu_id, bdname, bdtype);
+ env_set("fdtfile", info);
#endif
}
#endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
#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;
return 0;
return !!(status & mask);
+#else
+ return 0;
+#endif
}
static int key_pressed(int key)
return value;
}
+#ifdef CONFIG_LCD
static int check_keys(void)
{
int keys = 0;
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;
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);
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";
- cmd_tbl_t *cmd;
+ struct cmd_tbl *cmd;
int cmd_result;
int leave;
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);
lcd_clear();
return leave;
+#else
+ return 0;
+#endif
}
+#ifdef CONFIG_LCD
static void display_download_menu(int mode)
{
char *selection[BOOT_MODE_EXIT + 1];
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;
}
lcd_clear();
+#endif
}
void check_boot_mode(void)
void keys_init(void)
{
/* Set direction to input */
+ gpio_request(KEY_VOL_UP_GPIO, "volume-up");
+ gpio_request(KEY_VOL_DOWN_GPIO, "volume-down");
gpio_direction_input(KEY_VOL_UP_GPIO);
gpio_direction_input(KEY_VOL_DOWN_GPIO);
}
addr = panel_info.logo_addr;
if (!addr) {
- error("There is no logo data.");
+ pr_err("There is no logo data.\n");
return;
}