Permalink
Browse files

ARM: exynos: ungate chipid clock before kexec

The kernel assumes that the bootloader has left the CHIPID IP block
ungated, so when we kexec we need to make sure the same thing has
happened.
  • Loading branch information...
fourkbomb committed Nov 14, 2017
1 parent 5ca29b7 commit ddf12e02d9479fd5d76c99731d52c44f39c2cdd1
Showing with 31 additions and 0 deletions.
  1. +31 −0 arch/arm/mach-exynos/exynos.c
@@ -9,6 +9,7 @@
* published by the Free Software Foundation.
*/

#include <linux/clk.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/of.h>
@@ -20,6 +21,7 @@

#include <asm/cacheflush.h>
#include <asm/hardware/cache-l2x0.h>
#include <asm/kexec.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>

@@ -169,6 +171,33 @@ static void exynos_map_pmu(void)
pmu_base_addr = of_iomap(np, 0);
}

/*
* Prepare to kexec a new kernel. We need to make sure the
* CHIPID clock is enabled, so the new kernel can detect platform
* properly.
*/
static void exynos_kexec_reinit(void)
{
struct device_node *np;
struct clk *chipid_clk;

pr_err("%s\n", __func__);

np = of_find_compatible_node(NULL, NULL, "samsung,exynos4210-chipid");
if (np == NULL)
return;

chipid_clk = of_clk_get_by_name(np, "chipid");
if (IS_ERR_OR_NULL(chipid_clk)) {
pr_err("Failed to get 'chipid' clk: %lu\n", PTR_ERR(chipid_clk));
return;
}

clk_prepare_enable(chipid_clk);

clk_put(chipid_clk);
}

static void __init exynos_init_irq(void)
{
irqchip_init();
@@ -189,6 +218,8 @@ static void __init exynos_dt_machine_init(void)
if (!IS_ENABLED(CONFIG_SMP))
exynos_sysram_init();

kexec_reinit = exynos_kexec_reinit;

#if defined(CONFIG_SMP) && defined(CONFIG_ARM_EXYNOS_CPUIDLE)
if (of_machine_is_compatible("samsung,exynos4210") ||
of_machine_is_compatible("samsung,exynos3250"))

0 comments on commit ddf12e0

Please sign in to comment.