// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
/*
 * Copyright (c) 2023 MediaTek Inc.
 */
/*
 * Copyright 2023 Sony Corporation
 */

#include <common.h>
#include <mtk_cmdtable.h>
#include <bootflow.h>
#include <time.h>
#include <utility.h>

int do_customized_command_register(void)
{
#if defined(CONFIG_ANDROID_CN_PLATFORM) || defined(CONFIG_LINUX_REF_PLATFORM)
	mtk_add_command_table("mmc cap", 0, BEFORE_CONSOLE_INPUT);
#endif
#ifdef CONFIG_CONSOLE_LOCK
#ifdef CONFIG_CONSOLE_UNLOCK_USB
	mtk_add_command_table("cetest cu_clear", 0, BEFORE_CONSOLE_INPUT);
	mtk_add_command_table("ce_usb", 0, BEFORE_CONSOLE_INPUT);
#endif
	mtk_add_command_table("check_ce", 0, BEFORE_BOOT_KERNEL);
#endif

#ifdef CONFIG_SONY_EMMC_INIT
	mtk_add_command_table("sony_emmc_init", 0, BEFORE_CONSOLE_INPUT);
#endif

#ifdef CONFIG_POWERKEY_FDR
	mtk_add_command_table("check_pkey_fdr", 0, BEFORE_BOOT_KERNEL);
#endif

	mtk_add_command_table("adddid", 0, BEFORE_CONSOLE_INPUT);

	mtk_add_command_table("addpci", 0, BEFORE_CONSOLE_INPUT);

	mtk_add_command_table("panel_enable 1", 0, AFTER_CONSOLE_INPUT);

#ifdef CONFIG_MTK_PANEL
	mtk_add_command_table("panel_mute 0", 0, AFTER_CONSOLE_INPUT);
#endif
	mtk_add_command_table("panel_post_init", 0, AFTER_CONSOLE_INPUT);

	mtk_add_command_table("damp_selector_init", 0, AFTER_CONSOLE_INPUT);

	mtk_add_command_table("be_boot", 0, AFTER_CONSOLE_INPUT);

	mtk_add_command_table("oled_panel_control", 0, AFTER_CONSOLE_INPUT);

	mtk_add_command_table("oled_logo_brightness_control", 0, AFTER_CONSOLE_INPUT);

	mtk_add_command_table("showlogo", 0, AFTER_CONSOLE_INPUT);

#ifdef CONFIG_SONY_FULL_PARTITIONS
	mtk_add_command_table("sony_part_init full mmc 0", 0, AFTER_UBOOT_INIT);
#ifdef CONFIG_SONY_CREATE_PARTITIONS_ON_INIT_BOOT
	mtk_add_command_table("sony_gpt create_on_init_boot mmc 0", 0, AFTER_UBOOT_INIT);
#endif
#else
	mtk_add_command_table("sony_gpt clean_cond_ext_userdata mmc 0", 0, AFTER_UBOOT_INIT);
	mtk_add_command_table("sony_part_init default mmc 0", 0, AFTER_UBOOT_INIT);
#endif

	mtk_add_command_table("wait_pmu_ready", 0, AFTER_UBOOT_INIT);
	mtk_add_command_table("be_power_set", 0, AFTER_UBOOT_INIT);
	mtk_add_command_table("paneldet_callback", 0, AFTER_UBOOT_INIT);

	mtk_add_command_table("rbiread", 0, BEFORE_BOOT_KERNEL);
	mtk_add_command_table("prodconfig_task", 0, BEFORE_BOOT_KERNEL);

	mtk_add_command_table("usbboot_check", 0, BEFORE_BOOT_KERNEL);
	mtk_add_command_table("update_standby_mode", 0, BEFORE_BOOT_KERNEL);

	run_command("sony_gpio_init", 0);
	run_command("serialno", 0);

	return 0;
}

