2 * Device Tree support for Rockchip RK3036
4 * Copyright (C) 2014 ROCKCHIP, Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #include <linux/clk-provider.h>
18 #include <linux/clocksource.h>
19 #include <linux/cpuidle.h>
20 #include <linux/delay.h>
21 #include <linux/init.h>
22 #include <linux/irqchip.h>
23 #include <linux/kernel.h>
24 #include <linux/of_address.h>
25 #include <linux/of_platform.h>
26 #include <linux/wakeup_reason.h>
27 #include <linux/rockchip/common.h>
28 #include <linux/rockchip/cpu.h>
29 #include <linux/rockchip/cpu_axi.h>
30 #include <linux/rockchip/cru.h>
31 #include <linux/rockchip/dvfs.h>
32 #include <linux/rockchip/grf.h>
33 #include <linux/rockchip/iomap.h>
34 #include <linux/rockchip/pmu.h>
35 #include <asm/cpuidle.h>
36 #include <asm/cputype.h>
37 #include <asm/mach/arch.h>
38 #include <asm/mach/map.h>
44 #define RK3036_DEVICE(name) \
46 .virtual = (unsigned long) RK_##name##_VIRT, \
47 .pfn = __phys_to_pfn(RK3036_##name##_PHYS), \
48 .length = RK3036_##name##_SIZE, \
52 #define RK3036_IMEM_VIRT (RK_BOOTRAM_VIRT + SZ_32K)
53 #define RK3036_TIMER5_VIRT (RK_TIMER_VIRT + 0xa0)
55 static struct map_desc rk3036_io_desc[] __initdata = {
60 RK3036_DEVICE(CPU_AXI_BUS),
61 RK_DEVICE(RK_DDR_VIRT, RK3036_DDR_PCTL_PHYS, RK3036_DDR_PCTL_SIZE),
62 RK_DEVICE(RK_DDR_VIRT + RK3036_DDR_PCTL_SIZE, RK3036_DDR_PHY_PHYS,
64 RK_DEVICE(RK_GPIO_VIRT(0), RK3036_GPIO0_PHYS, RK3036_GPIO_SIZE),
65 RK_DEVICE(RK_GPIO_VIRT(1), RK3036_GPIO1_PHYS, RK3036_GPIO_SIZE),
66 RK_DEVICE(RK_GPIO_VIRT(2), RK3036_GPIO2_PHYS, RK3036_GPIO_SIZE),
67 RK_DEVICE(RK_DEBUG_UART_VIRT, RK3036_UART2_PHYS, RK3036_UART_SIZE),
68 RK_DEVICE(RK_GIC_VIRT, RK3036_GIC_DIST_PHYS, RK3036_GIC_DIST_SIZE),
69 RK_DEVICE(RK_GIC_VIRT + RK3036_GIC_DIST_SIZE, RK3036_GIC_CPU_PHYS,
71 RK_DEVICE(RK3036_IMEM_VIRT, RK3036_IMEM_PHYS, SZ_4K),
72 RK_DEVICE(RK_TIMER_VIRT, RK3036_TIMER_PHYS, RK3036_TIMER_SIZE),
73 RK_DEVICE(RK_PWM_VIRT, RK3036_PWM_PHYS, RK3036_PWM_SIZE),
76 static void __init rk3036_boot_mode_init(void)
78 u32 flag = readl_relaxed(RK_GRF_VIRT + RK3036_GRF_OS_REG4);
79 u32 mode = readl_relaxed(RK_GRF_VIRT + RK3036_GRF_OS_REG5);
80 u32 rst_st = readl_relaxed(RK_CRU_VIRT + RK3036_CRU_RST_ST);
82 if (flag == (SYS_KERNRL_REBOOT_FLAG | BOOT_RECOVER))
83 mode = BOOT_MODE_RECOVERY;
84 if (rst_st & ((1 << 2) | (1 << 3)))
85 mode = BOOT_MODE_WATCHDOG;
86 rockchip_boot_mode_init(flag, mode);
89 static void usb_uart_init(void)
91 #ifdef CONFIG_RK_USB_UART
92 u32 soc_status0 = readl_relaxed(RK_GRF_VIRT + RK3036_GRF_SOC_STATUS0);
94 writel_relaxed(0x34000000, RK_GRF_VIRT + RK3036_GRF_UOC1_CON4);
95 #ifdef CONFIG_RK_USB_UART
96 if (!(soc_status0 & (1 << 14)) && (soc_status0 & (1 << 17))) {
97 /* software control usb phy enable */
98 writel_relaxed(0x007f0055, RK_GRF_VIRT + RK3036_GRF_UOC0_CON5);
99 writel_relaxed(0x34003000, RK_GRF_VIRT + RK3036_GRF_UOC1_CON4);
103 writel_relaxed(0x07, RK_DEBUG_UART_VIRT + 0x88);
104 writel_relaxed(0x00, RK_DEBUG_UART_VIRT + 0x04);
105 writel_relaxed(0x83, RK_DEBUG_UART_VIRT + 0x0c);
106 writel_relaxed(0x0d, RK_DEBUG_UART_VIRT + 0x00);
107 writel_relaxed(0x00, RK_DEBUG_UART_VIRT + 0x04);
108 writel_relaxed(0x03, RK_DEBUG_UART_VIRT + 0x0c);
111 static void __init rk3036_dt_map_io(void)
113 rockchip_soc_id = ROCKCHIP_SOC_RK3036;
115 iotable_init(rk3036_io_desc, ARRAY_SIZE(rk3036_io_desc));
119 /* enable timer5 for core */
120 writel_relaxed(0, RK3036_TIMER5_VIRT + 0x10);
122 writel_relaxed(0xFFFFFFFF, RK3036_TIMER5_VIRT + 0x00);
123 writel_relaxed(0xFFFFFFFF, RK3036_TIMER5_VIRT + 0x04);
125 writel_relaxed(1, RK3036_TIMER5_VIRT + 0x10);
128 rk3036_boot_mode_init();
131 extern void secondary_startup(void);
132 static int rk3036_sys_set_power_domain(enum pmu_power_domain pd, bool on)
136 if (PD_CPU_1 == pd) {
137 writel_relaxed(0x20000
138 , RK_CRU_VIRT + RK3036_CRU_SOFTRST0_CON);
141 writel_relaxed(virt_to_phys(secondary_startup),
142 RK3036_IMEM_VIRT + 8);
143 writel_relaxed(0xDEADBEAF, RK3036_IMEM_VIRT + 4);
149 if (PD_CPU_1 == pd) {
150 writel_relaxed(0x20002
151 , RK_CRU_VIRT + RK3036_CRU_SOFTRST0_CON);
160 static bool rk3036_pmu_power_domain_is_on(enum pmu_power_domain pd)
165 static int rk3036_pmu_set_idle_request(enum pmu_idle_req req, bool idle)
170 static void __init rk3036_dt_init_timer(void)
172 rockchip_pmu_ops.set_power_domain = rk3036_sys_set_power_domain;
173 rockchip_pmu_ops.power_domain_is_on = rk3036_pmu_power_domain_is_on;
174 rockchip_pmu_ops.set_idle_request = rk3036_pmu_set_idle_request;
176 clocksource_of_init();
180 static inline void rk3036_uart_printch(char byte)
183 writel_relaxed(byte, RK_DEBUG_UART_VIRT);
186 /* loop check LSR[6], Transmitter Empty bit */
187 while (!(readl_relaxed(RK_DEBUG_UART_VIRT + 0x14) & 0x40))
196 static void rk3036_ddr_printch(char byte)
198 rk3036_uart_printch(byte);
200 rk_last_log_text(&byte, 1);
204 rk_last_log_text(&byte, 1);
215 #define GPIO_INTEN 0x30
216 #define GPIO_INT_STATUS 0x40
217 #define GIC_DIST_PENDING_SET 0x200
218 static void rk3036_pm_dump_irq(void)
220 u32 irq_gpio = (readl_relaxed(RK_GIC_VIRT
221 + GIC_DIST_PENDING_SET + 8) >> 4) & 7;
225 for (i = 0; i < ARRAY_SIZE(irq); i++) {
226 irq[i] = readl_relaxed(RK_GIC_VIRT + GIC_DIST_PENDING_SET +
229 log_wakeup_reason(32 * (i + 1) + fls(irq[i]) - 1);
231 pr_info("wakeup irq: %08x %08x %08x %08x\n",
232 irq[0], irq[1], irq[2], irq[3]);
233 for (i = 0; i <= 2; i++) {
234 if (irq_gpio & (1 << i))
235 pr_info("wakeup gpio%d: %08x\n", i,
236 readl_relaxed(RK_GPIO_VIRT(i) +
241 #define DUMP_GPIO_INTEN(ID) \
243 u32 en = readl_relaxed(RK_GPIO_VIRT(ID) + GPIO_INTEN); \
245 pr_info("GPIO%d_INTEN: %08x\n", ID, en); \
249 static void rk3036_pm_dump_inten(void)
256 static void rkpm_prepare(void)
258 rk3036_pm_dump_inten();
260 static void rkpm_finish(void)
262 rk3036_pm_dump_irq();
265 static u32 clk_ungt_msk[RK3036_CRU_CLKGATES_CON_CNT];
266 /*first clk gating setting*/
268 static u32 clk_ungt_msk_1[RK3036_CRU_CLKGATES_CON_CNT];
269 /* first clk gating setting*/
271 static u32 clk_ungt_save[RK3036_CRU_CLKGATES_CON_CNT];
272 /*first clk gating value saveing*/
274 static u32 *p_rkpm_clkgt_last_set;
275 #define CLK_MSK_GATING(msk, con) cru_writel((msk << 16) | 0xffff, con)
276 #define CLK_MSK_UNGATING(msk, con) cru_writel(((~msk) << 16) | 0xffff, con)
278 static void gtclks_suspend(void)
282 for (i = 0; i < RK3036_CRU_CLKGATES_CON_CNT; i++) {
283 clk_ungt_save[i] = cru_readl(RK3036_CRU_CLKGATES_CON(i));
285 CLK_MSK_UNGATING(clk_ungt_msk[i]
286 , RK3036_CRU_CLKGATES_CON(i));
288 cru_writel(clk_ungt_msk[i], RK3036_CRU_CLKGATES_CON(i));
291 /*gpio0_a1 clk gate should be disable for volt adjust*/
292 if (cru_readl(RK3036_CRU_CLKGATES_CON(8)) & 0x200)
293 cru_writel(0x02000000, RK3036_CRU_CLKGATES_CON(8));
296 static void gtclks_resume(void)
300 for (i = 0; i < RK3036_CRU_CLKGATES_CON_CNT; i++) {
302 cru_writel(clk_ungt_save[i] | 0xffff0000
303 , RK3036_CRU_CLKGATES_CON(i));
305 cru_writel(clk_ungt_save[i]
306 , RK3036_CRU_CLKGATES_CON(i));
310 static void clks_gating_suspend_init(void)
312 p_rkpm_clkgt_last_set = &clk_ungt_msk_1[0];
313 if (clk_suspend_clkgt_info_get(clk_ungt_msk, p_rkpm_clkgt_last_set
314 , RK3036_CRU_CLKGATES_CON_CNT) == RK3036_CRU_CLKGATES_CON(0))
315 rkpm_set_ops_gtclks(gtclks_suspend, gtclks_resume);
318 #define RK3036_PLL_BYPASS CRU_W_MSK_SETBITS(1, 0xF, 0x01)
319 #define RK3036_PLL_NOBYPASS CRU_W_MSK_SETBITS(0, 0xF, 0x01)
320 #define RK3036_PLL_POWERDOWN CRU_W_MSK_SETBITS(1, 0xD, 0x01)
321 #define RK3036_PLL_POWERON CRU_W_MSK_SETBITS(0, 0xD, 0x01)
323 #define grf_readl(offset) readl_relaxed(RK_GRF_VIRT + offset)
324 #define grf_writel(v, offset) do { writel_relaxed(v, \
325 RK_GRF_VIRT + offset); dsb(); } while (0)
327 #define gpio0_readl(offset) readl_relaxed(RK_GPIO_VIRT(0) + offset)
328 #define gpio0_writel(v, offset) do { writel_relaxed(v, RK_GPIO_VIRT(0) \
329 + offset); dsb(); } while (0)
331 static u32 plls_con0_save[RK3036_END_PLL_ID];
332 static u32 plls_con1_save[RK3036_END_PLL_ID];
333 static u32 plls_con2_save[RK3036_END_PLL_ID];
335 static u32 cru_mode_con;
336 static u32 clk_sel0, clk_sel1, clk_sel10;
337 static void pm_pll_wait_lock(u32 pll_idx)
348 if ((cru_readl(RK3036_PLL_CONS(pll_idx, 1)) & (0x1 << 10)))
353 rkpm_ddr_printascii("unlock-pll:");
354 rkpm_ddr_printhex(pll_idx);
355 rkpm_ddr_printch('\n');
359 static void pll_udelay(u32 udelay)
363 mode = cru_readl(RK3036_CRU_MODE_CON);
364 cru_writel(RK3036_PLL_MODE_SLOW(APLL_ID), RK3036_CRU_MODE_CON);
365 rkpm_udelay(udelay * 5);
366 cru_writel(mode|(RK3036_PLL_MODE_MSK(APLL_ID)
367 << 16), RK3036_CRU_MODE_CON);
370 static inline void plls_suspend(u32 pll_id)
372 plls_con0_save[pll_id] = cru_readl(RK3036_PLL_CONS((pll_id), 0));
373 plls_con1_save[pll_id] = cru_readl(RK3036_PLL_CONS((pll_id), 1));
374 plls_con2_save[pll_id] = cru_readl(RK3036_PLL_CONS((pll_id), 2));
376 /*cru_writel(RK3036_PLL_BYPASS, RK3036_PLL_CONS((pll_id), 0));*/
377 cru_writel(RK3036_PLL_POWERDOWN, RK3036_PLL_CONS((pll_id), 1));
379 static inline void plls_resume(u32 pll_id)
381 u32 pllcon0, pllcon1, pllcon2;
383 pllcon0 = plls_con0_save[pll_id];
384 pllcon1 = plls_con1_save[pll_id];
385 pllcon2 = plls_con2_save[pll_id];
387 cru_writel(pllcon0 | 0xffff0000, RK3036_PLL_CONS(pll_id, 0));
388 cru_writel(pllcon1 | 0xf5ff0000, RK3036_PLL_CONS(pll_id, 1));
389 cru_writel(pllcon2, RK3036_PLL_CONS(pll_id, 2));
391 cru_writel(RK3036_PLL_POWERON, RK3036_PLL_CONS((pll_id), 1));
396 pm_pll_wait_lock(pll_id);
399 static void pm_plls_suspend(void)
401 cru_mode_con = cru_readl(RK3036_CRU_MODE_CON);
403 clk_sel0 = cru_readl(RK3036_CRU_CLKSELS_CON(0));
404 clk_sel1 = cru_readl(RK3036_CRU_CLKSELS_CON(1));
405 clk_sel10 = cru_readl(RK3036_CRU_CLKSELS_CON(10));
407 cru_writel(RK3036_PLL_MODE_SLOW(GPLL_ID), RK3036_CRU_MODE_CON);
409 |CRU_W_MSK_SETBITS(0, 0, 0x1f)
410 |CRU_W_MSK_SETBITS(0, 8, 0x3)
411 |CRU_W_MSK_SETBITS(0, 12, 0x3)
412 , RK3036_CRU_CLKSELS_CON(10));
413 plls_suspend(GPLL_ID);
416 cru_writel(RK3036_PLL_MODE_SLOW(APLL_ID), RK3036_CRU_MODE_CON);
419 |CRU_W_MSK_SETBITS(0, 0, 0x1f)
420 |CRU_W_MSK_SETBITS(0, 8, 0x1f)
421 , RK3036_CRU_CLKSELS_CON(0));
424 |CRU_W_MSK_SETBITS(0, 0, 0xf)
425 |CRU_W_MSK_SETBITS(0, 4, 0x7)
426 |CRU_W_MSK_SETBITS(0, 8, 0x3)
427 |CRU_W_MSK_SETBITS(0, 12, 0x7)
428 , RK3036_CRU_CLKSELS_CON(1));
430 plls_suspend(APLL_ID);
433 static void pm_plls_resume(void)
435 plls_resume(APLL_ID);
436 cru_writel(clk_sel0 | (CRU_W_MSK(0, 0x1f) | CRU_W_MSK(8, 0x1f))
437 , RK3036_CRU_CLKSELS_CON(0));
438 cru_writel(clk_sel1 | (CRU_W_MSK(0, 0xf) | CRU_W_MSK(4, 0x7)
439 |CRU_W_MSK(8, 0x3) | CRU_W_MSK(12, 0x7))
440 , RK3036_CRU_CLKSELS_CON(1));
441 cru_writel(cru_mode_con | (RK3036_PLL_MODE_MSK(APLL_ID) << 16)
442 , RK3036_CRU_MODE_CON);
444 plls_resume(GPLL_ID);
445 cru_writel(clk_sel10 | (CRU_W_MSK(0, 0x1f) | CRU_W_MSK(8, 0x3)
446 | CRU_W_MSK(12, 0x3)), RK3036_CRU_CLKSELS_CON(10));
447 cru_writel(cru_mode_con | (RK3036_PLL_MODE_MSK(GPLL_ID)
448 << 16), RK3036_CRU_MODE_CON);
451 #include "ddr_rk3036.c"
454 char PIE_DATA(sram_stack)[1024];
455 EXPORT_PIE_SYMBOL(DATA(sram_stack));
457 static int __init rk3036_pie_init(void)
461 if (!cpu_is_rk3036())
464 err = rockchip_pie_init();
468 rockchip_pie_chunk = pie_load_sections(rockchip_sram_pool, rk3036);
469 if (IS_ERR(rockchip_pie_chunk)) {
470 err = PTR_ERR(rockchip_pie_chunk);
471 pr_err("%s: failed to load section %d\n", __func__, err);
472 rockchip_pie_chunk = NULL;
476 rockchip_sram_virt = kern_to_pie(rockchip_pie_chunk
477 , &__pie_common_start[0]);
478 rockchip_sram_stack = kern_to_pie(rockchip_pie_chunk
479 , (char *)DATA(sram_stack) + sizeof(DATA(sram_stack)));
483 arch_initcall(rk3036_pie_init);
485 static void reg_pread(void)
490 volatile u32 *temp = (volatile unsigned int *)rockchip_sram_virt;
494 local_flush_tlb_all();
496 for (i = 0; i < 2; i++) {
501 n = readl_relaxed(RK_GPIO_VIRT(0));
502 n = readl_relaxed(RK_GPIO_VIRT(1));
503 n = readl_relaxed(RK_GPIO_VIRT(2));
505 n = readl_relaxed(RK_DEBUG_UART_VIRT);
506 n = readl_relaxed(RK_CPU_AXI_BUS_VIRT);
507 n = readl_relaxed(RK_DDR_VIRT);
508 n = readl_relaxed(RK_GRF_VIRT);
509 n = readl_relaxed(RK_CRU_VIRT);
510 n = readl_relaxed(RK_PWM_VIRT);
513 #define RK3036_CRU_UNGATING_OPS(id) cru_writel(\
514 CRU_W_MSK_SETBITS(0, (id), 0x1), RK3036_CRU_UART_GATE)
515 #define RK3036_CRU_GATING_OPS(id) cru_writel(\
516 CRU_W_MSK_SETBITS(1, (id), 0x1), RK3036_CRU_UART_GATE)
518 static inline void uart_printch(char bbyte)
521 u32 u_clk_id = (RK3036_CLKGATE_UART0_SRC + CONFIG_RK_DEBUG_UART * 2);
522 u32 u_pclk_id = (RK3036_CLKGATE_UART0_PCLK + CONFIG_RK_DEBUG_UART * 2);
524 reg_save = cru_readl(RK3036_CRU_UART_GATE);
525 RK3036_CRU_UNGATING_OPS(u_clk_id);
526 RK3036_CRU_UNGATING_OPS(u_pclk_id);
531 writel_relaxed(bbyte, RK_DEBUG_UART_VIRT);
534 while (!(readl_relaxed(RK_DEBUG_UART_VIRT + 0x14) & 0x40))
542 cru_writel(reg_save | CRU_W_MSK(u_clk_id
543 , 0x1), RK3036_CRU_UART_GATE);
544 cru_writel(reg_save | CRU_W_MSK(u_pclk_id
545 , 0x1), RK3036_CRU_UART_GATE);
550 writel_relaxed(bbyte, RK_DEBUG_UART_VIRT);
553 while (!(readl_relaxed(RK_DEBUG_UART_VIRT + 0x14) & 0x40))
563 void PIE_FUNC(sram_printch)(char byte)
568 static __sramdata u32 rkpm_pwm_duty0;
569 static __sramdata u32 rkpm_pwm_duty1;
570 static __sramdata u32 rkpm_pwm_duty2;
571 #define PWM_VOLTAGE 0x600
573 void PIE_FUNC(pwm_regulator_suspend)(void)
575 if (rkpm_chk_sram_ctrbit(RKPM_CTR_VOL_PWM0)) {
576 rkpm_pwm_duty0 = readl_relaxed(RK_PWM_VIRT + 0x08);
577 writel_relaxed(PWM_VOLTAGE, RK_PWM_VIRT + 0x08);
580 if (rkpm_chk_sram_ctrbit(RKPM_CTR_VOL_PWM1)) {
581 rkpm_pwm_duty1 = readl_relaxed(RK_PWM_VIRT + 0x18);
582 writel_relaxed(PWM_VOLTAGE, RK_PWM_VIRT + 0x18);
585 if (rkpm_chk_sram_ctrbit(RKPM_CTR_VOL_PWM2)) {
586 rkpm_pwm_duty2 = readl_relaxed(RK_PWM_VIRT + 0x28);
587 writel_relaxed(PWM_VOLTAGE, RK_PWM_VIRT + 0x28);
592 void PIE_FUNC(pwm_regulator_resume)(void)
597 if (rkpm_chk_sram_ctrbit(RKPM_CTR_VOL_PWM0))
598 writel_relaxed(rkpm_pwm_duty0, RK_PWM_VIRT + 0x08);
600 if (rkpm_chk_sram_ctrbit(RKPM_CTR_VOL_PWM1))
601 writel_relaxed(rkpm_pwm_duty1, RK_PWM_VIRT + 0x18);
603 if (rkpm_chk_sram_ctrbit(RKPM_CTR_VOL_PWM2))
604 writel_relaxed(rkpm_pwm_duty2, RK_PWM_VIRT + 0x28);
608 static void __init rk3036_suspend_init(void)
610 struct device_node *parent;
613 PM_LOG("%s enter\n", __func__);
615 parent = of_find_node_by_name(NULL, "rockchip_suspend");
617 if (IS_ERR_OR_NULL(parent)) {
618 PM_ERR("%s dev node err\n", __func__);
622 if (of_property_read_u32_array(parent, "rockchip,ctrbits"
624 PM_ERR("%s:get pm ctr error\n", __func__);
627 PM_LOG("%s: pm_ctrbits =%x\n", __func__, pm_ctrbits);
628 rkpm_set_ctrbits(pm_ctrbits);
630 clks_gating_suspend_init();
631 rkpm_set_ops_prepare_finish(rkpm_prepare, rkpm_finish);
632 rkpm_set_ops_plls(pm_plls_suspend, pm_plls_resume);
634 rkpm_set_ops_regs_pread(reg_pread);
635 rkpm_set_sram_ops_ddr(fn_to_pie(rockchip_pie_chunk
636 , &FUNC(ddr_suspend))
637 , fn_to_pie(rockchip_pie_chunk, &FUNC(ddr_resume)));
639 rkpm_set_sram_ops_volt(fn_to_pie(rockchip_pie_chunk
640 , &FUNC(pwm_regulator_suspend))
641 , fn_to_pie(rockchip_pie_chunk, &FUNC(pwm_regulator_resume)));
644 rkpm_set_sram_ops_printch(fn_to_pie(rockchip_pie_chunk
645 , &FUNC(sram_printch)));
646 rkpm_set_ops_printch(rk3036_ddr_printch);
650 static void __init rk3036_init_suspend(void)
652 pr_info("%s\n", __func__);
653 rockchip_suspend_init();
655 rk3036_suspend_init();
658 static void __init rk3036_init_late(void)
661 rk3036_init_suspend();
665 static void __init rk3036_reserve(void)
667 /* reserve memory for ION */
668 rockchip_ion_reserve();
671 static void rk3036_restart(char mode, const char *cmd)
673 u32 boot_flag, boot_mode;
675 rockchip_restart_get_boot_mode(cmd, &boot_flag, &boot_mode);
677 writel_relaxed(boot_flag, RK_GRF_VIRT + RK3036_GRF_OS_REG4);
679 writel_relaxed(boot_mode, RK_GRF_VIRT + RK3036_GRF_OS_REG5);
682 /* pll enter slow mode */
683 writel_relaxed(0x30110000, RK_CRU_VIRT + RK3036_CRU_MODE_CON);
685 writel_relaxed(0xeca8, RK_CRU_VIRT + RK3036_CRU_GLB_SRST_SND_VALUE);
689 static const char *const rk3036_dt_compat[] __initconst = {
694 DT_MACHINE_START(RK3036_DT, "Rockchip RK3036")
695 .dt_compat = rk3036_dt_compat,
696 .smp = smp_ops(rockchip_smp_ops),
697 .reserve = rk3036_reserve,
698 .map_io = rk3036_dt_map_io,
699 .init_time = rk3036_dt_init_timer,
700 .init_late = rk3036_init_late,
701 .reserve = rk3036_reserve,
702 .restart = rk3036_restart,