Skip to content

Commit

Permalink
rockchip: enable timer7 on rk3288 platforms for broken bootloaders
Browse files Browse the repository at this point in the history
timer7 supplies the architected timer and thus as has to run when
the system clocksource and clockevents drivers are registered.

While it should be the responsibility of the bootloader to do this,
older uboot variants for the rk3288 did not do this.

Therefore add a snippet for those, enabling the timer early in the
kernel.
  • Loading branch information
mmind committed Dec 16, 2014
1 parent bbfaf85 commit 32e43ca
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions arch/arm/mach-rockchip/rockchip.c
Expand Up @@ -24,6 +24,36 @@
#include <asm/hardware/cache-l2x0.h>
#include "core.h"

#include <linux/clocksource.h>
#include <linux/clk-provider.h>

static void __init rockchip_timer_init(void)
{
of_clk_init(NULL);

if (of_machine_is_compatible("rockchip,rk3288")) {
void __iomem *reg_base;

/* enable timer7 for core */
pr_warn("rockchip: enabling rk3288-timer7 workaround\n");
reg_base = ioremap(0xFF810000, 0x4000);
if (reg_base) {
writel_relaxed(0, reg_base + 0x30);
dsb();
writel_relaxed(0xFFFFFFFF, reg_base + 0x20);
writel_relaxed(0xFFFFFFFF, reg_base + 0x24);
dsb();
writel_relaxed(1, reg_base + 0x30);
dsb();
iounmap(reg_base);
} else {
pr_err("rockchip: could not map timer7 registers\n");
}
}

clocksource_of_init();
}

static void __init rockchip_dt_init(void)
{
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
Expand All @@ -42,6 +72,8 @@ static const char * const rockchip_board_dt_compat[] = {
DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)")
.l2c_aux_val = 0,
.l2c_aux_mask = ~0,
.init_time = rockchip_timer_init,
.init_machine = rockchip_dt_init,
.dt_compat = rockchip_board_dt_compat,
.init_machine = rockchip_dt_init,
MACHINE_END

0 comments on commit 32e43ca

Please sign in to comment.