Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * Device Tree support for Rockchip SoCs
0004  *
0005  * Copyright (c) 2013 MundoReader S.L.
0006  * Author: Heiko Stuebner <heiko@sntech.de>
0007  */
0008 
0009 #include <linux/kernel.h>
0010 #include <linux/init.h>
0011 #include <linux/io.h>
0012 #include <linux/of_clk.h>
0013 #include <linux/of_platform.h>
0014 #include <linux/irqchip.h>
0015 #include <linux/clocksource.h>
0016 #include <linux/mfd/syscon.h>
0017 #include <linux/regmap.h>
0018 #include <asm/mach/arch.h>
0019 #include <asm/mach/map.h>
0020 #include <asm/hardware/cache-l2x0.h>
0021 #include "core.h"
0022 #include "pm.h"
0023 
0024 #define RK3288_TIMER6_7_PHYS 0xff810000
0025 
0026 static void __init rockchip_timer_init(void)
0027 {
0028     if (of_machine_is_compatible("rockchip,rk3288")) {
0029         void __iomem *reg_base;
0030 
0031         /*
0032          * Most/all uboot versions for rk3288 don't enable timer7
0033          * which is needed for the architected timer to work.
0034          * So make sure it is running during early boot.
0035          */
0036         reg_base = ioremap(RK3288_TIMER6_7_PHYS, SZ_16K);
0037         if (reg_base) {
0038             writel(0, reg_base + 0x30);
0039             writel(0xffffffff, reg_base + 0x20);
0040             writel(0xffffffff, reg_base + 0x24);
0041             writel(1, reg_base + 0x30);
0042             dsb();
0043             iounmap(reg_base);
0044         } else {
0045             pr_err("rockchip: could not map timer7 registers\n");
0046         }
0047     }
0048 
0049     of_clk_init(NULL);
0050     timer_probe();
0051 }
0052 
0053 static void __init rockchip_dt_init(void)
0054 {
0055     rockchip_suspend_init();
0056 }
0057 
0058 static const char * const rockchip_board_dt_compat[] = {
0059     "rockchip,rk2928",
0060     "rockchip,rk3066a",
0061     "rockchip,rk3066b",
0062     "rockchip,rk3188",
0063     "rockchip,rk3228",
0064     "rockchip,rk3288",
0065     "rockchip,rv1108",
0066     NULL,
0067 };
0068 
0069 DT_MACHINE_START(ROCKCHIP_DT, "Rockchip (Device Tree)")
0070     .l2c_aux_val    = 0,
0071     .l2c_aux_mask   = ~0,
0072     .init_time  = rockchip_timer_init,
0073     .dt_compat  = rockchip_board_dt_compat,
0074     .init_machine   = rockchip_dt_init,
0075 MACHINE_END