From: 黄涛 Date: Tue, 6 Aug 2013 03:18:36 +0000 (+0800) Subject: rk: refactor boot_mode code X-Git-Tag: firefly_0821_release~6747 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2703c5572107a77ad80d7a9ba863c69039b6733e;p=firefly-linux-kernel-4.4.55.git rk: refactor boot_mode code --- diff --git a/arch/arm/mach-rk2928/common.c b/arch/arm/mach-rk2928/common.c index 82df448f6002..525310edc10e 100755 --- a/arch/arm/mach-rk2928/common.c +++ b/arch/arm/mach-rk2928/common.c @@ -117,40 +117,6 @@ static void __init rk2928_l2_cache_init(void) static int boot_mode; -static const char *boot_flag_name(u32 flag) -{ - flag -= SYS_KERNRL_REBOOT_FLAG; - switch (flag) { - case BOOT_NORMAL: return "NORMAL"; - case BOOT_LOADER: return "LOADER"; - case BOOT_MASKROM: return "MASKROM"; - case BOOT_RECOVER: return "RECOVER"; - case BOOT_NORECOVER: return "NORECOVER"; - case BOOT_SECONDOS: return "SECONDOS"; - case BOOT_WIPEDATA: return "WIPEDATA"; - case BOOT_WIPEALL: return "WIPEALL"; - case BOOT_CHECKIMG: return "CHECKIMG"; - case BOOT_FASTBOOT: return "FASTBOOT"; - default: return ""; - } -} - -static const char *boot_mode_name(u32 mode) -{ - switch (mode) { - case BOOT_MODE_NORMAL: return "NORMAL"; - case BOOT_MODE_FACTORY2: return "FACTORY2"; - case BOOT_MODE_RECOVERY: return "RECOVERY"; - case BOOT_MODE_CHARGE: return "CHARGE"; - case BOOT_MODE_POWER_TEST: return "POWER_TEST"; - case BOOT_MODE_OFFMODE_CHARGING: return "OFFMODE_CHARGING"; - case BOOT_MODE_REBOOT: return "REBOOT"; - case BOOT_MODE_PANIC: return "PANIC"; - case BOOT_MODE_WATCHDOG: return "WATCHDOG"; - default: return ""; - } -} - static void __init rk2928_boot_mode_init(void) { u32 boot_flag = readl_relaxed(RK2928_GRF_BASE + GRF_OS_REG4) | (readl_relaxed(RK2928_GRF_BASE + GRF_OS_REG5) << 16); diff --git a/arch/arm/mach-rk30/common.c b/arch/arm/mach-rk30/common.c index 5909a8d962ab..b2ae61f88646 100755 --- a/arch/arm/mach-rk30/common.c +++ b/arch/arm/mach-rk30/common.c @@ -122,40 +122,6 @@ static void __init rk30_l2_cache_init(void) static int boot_mode; -static const char *boot_flag_name(u32 flag) -{ - flag -= SYS_KERNRL_REBOOT_FLAG; - switch (flag) { - case BOOT_NORMAL: return "NORMAL"; - case BOOT_LOADER: return "LOADER"; - case BOOT_MASKROM: return "MASKROM"; - case BOOT_RECOVER: return "RECOVER"; - case BOOT_NORECOVER: return "NORECOVER"; - case BOOT_SECONDOS: return "SECONDOS"; - case BOOT_WIPEDATA: return "WIPEDATA"; - case BOOT_WIPEALL: return "WIPEALL"; - case BOOT_CHECKIMG: return "CHECKIMG"; - case BOOT_FASTBOOT: return "FASTBOOT"; - default: return ""; - } -} - -static const char *boot_mode_name(u32 mode) -{ - switch (mode) { - case BOOT_MODE_NORMAL: return "NORMAL"; - case BOOT_MODE_FACTORY2: return "FACTORY2"; - case BOOT_MODE_RECOVERY: return "RECOVERY"; - case BOOT_MODE_CHARGE: return "CHARGE"; - case BOOT_MODE_POWER_TEST: return "POWER_TEST"; - case BOOT_MODE_OFFMODE_CHARGING: return "OFFMODE_CHARGING"; - case BOOT_MODE_REBOOT: return "REBOOT"; - case BOOT_MODE_PANIC: return "PANIC"; - case BOOT_MODE_WATCHDOG: return "WATCHDOG"; - default: return ""; - } -} - static void __init rk30_boot_mode_init(void) { u32 boot_flag = readl_relaxed(RK30_PMU_BASE + PMU_SYS_REG0); diff --git a/arch/arm/plat-rk/include/plat/board.h b/arch/arm/plat-rk/include/plat/board.h index 04b1689dc45e..ad7070ddd86b 100755 --- a/arch/arm/plat-rk/include/plat/board.h +++ b/arch/arm/plat-rk/include/plat/board.h @@ -517,6 +517,22 @@ struct rk_hdmi_platform_data { #define BOOT_MODE_WATCHDOG 8 int board_boot_mode(void); +static inline const char *boot_mode_name(u32 mode) +{ + switch (mode) { + case BOOT_MODE_NORMAL: return "NORMAL"; + case BOOT_MODE_FACTORY2: return "FACTORY2"; + case BOOT_MODE_RECOVERY: return "RECOVERY"; + case BOOT_MODE_CHARGE: return "CHARGE"; + case BOOT_MODE_POWER_TEST: return "POWER_TEST"; + case BOOT_MODE_OFFMODE_CHARGING: return "OFFMODE_CHARGING"; + case BOOT_MODE_REBOOT: return "REBOOT"; + case BOOT_MODE_PANIC: return "PANIC"; + case BOOT_MODE_WATCHDOG: return "WATCHDOG"; + default: return ""; + } +} + /* for USB detection */ #if defined(CONFIG_USB_GADGET) && !defined(CONFIG_RK_USB_DETECT_BY_OTG_BVALID) int __init board_usb_detect_init(unsigned gpio); @@ -555,8 +571,7 @@ void __sramfunc board_pmu_resume(void); * For DDR frequency scaling setup. Board code something like this: * * This array _must_ be sorted in ascending frequency (without DDR_FREQ_*) order. - * 必须按频率(不必考虑DDR_FREQ_*)递增ã€? *static struct cpufreq_frequency_table dvfs_ddr_table[] = { - * {.frequency = 200 * 1000 + DDR_FREQ_SUSPEND, .index = xxxx * 1000}, + * static struct cpufreq_frequency_table dvfs_ddr_table[] = { * {.frequency = 200 * 1000 + DDR_FREQ_IDLE, .index = xxxx * 1000}, * {.frequency = 300 * 1000 + DDR_FREQ_VIDEO, .index = xxxx * 1000}, * {.frequency = 400 * 1000 + DDR_FREQ_NORMAL, .index = xxxx * 1000}, diff --git a/arch/arm/plat-rk/include/plat/loader.h b/arch/arm/plat-rk/include/plat/loader.h index bb83a86b4452..6f3746b481cf 100644 --- a/arch/arm/plat-rk/include/plat/loader.h +++ b/arch/arm/plat-rk/include/plat/loader.h @@ -18,4 +18,22 @@ enum { BOOT_MAX /* MAX VALID BOOT TYPE.*/ }; +static inline const char *boot_flag_name(u32 flag) +{ + flag -= SYS_KERNRL_REBOOT_FLAG; + switch (flag) { + case BOOT_NORMAL: return "NORMAL"; + case BOOT_LOADER: return "LOADER"; + case BOOT_MASKROM: return "MASKROM"; + case BOOT_RECOVER: return "RECOVER"; + case BOOT_NORECOVER: return "NORECOVER"; + case BOOT_SECONDOS: return "SECONDOS"; + case BOOT_WIPEDATA: return "WIPEDATA"; + case BOOT_WIPEALL: return "WIPEALL"; + case BOOT_CHECKIMG: return "CHECKIMG"; + case BOOT_FASTBOOT: return "FASTBOOT"; + default: return ""; + } +} + #endif