commit
d9d76023ea
@ -0,0 +1,37 @@ |
||||
/* |
||||
* (C) 2017 Theobroma Systems Design und Consulting GmbH |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <config.h> |
||||
#include <asm/assembler.h> |
||||
#include <linux/linkage.h> |
||||
|
||||
.pushsection .text.setjmp, "ax" |
||||
ENTRY(setjmp) |
||||
/* |
||||
* A subroutine must preserve the contents of the registers |
||||
* r4-r8, r10, r11 (v1-v5, v7 and v8) and SP (and r9 in PCS |
||||
* variants that designate r9 as v6). |
||||
*/ |
||||
mov ip, sp |
||||
stm a1, {v1-v8, ip, lr} |
||||
mov a1, #0 |
||||
bx lr |
||||
ENDPROC(setjmp) |
||||
.popsection |
||||
|
||||
.pushsection .text.longjmp, "ax" |
||||
ENTRY(longjmp) |
||||
ldm a1, {v1-v8, ip, lr} |
||||
mov sp, ip |
||||
mov a1, a2 |
||||
/* If we were passed a return value of zero, return one instead */ |
||||
cmp a1, #0 |
||||
bne 1f |
||||
mov a1, #1 |
||||
1: |
||||
bx lr |
||||
ENDPROC(longjmp) |
||||
.popsection |
@ -0,0 +1,42 @@ |
||||
/* |
||||
* (C) 2017 Theobroma Systems Design und Consulting GmbH |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <config.h> |
||||
#include <asm/macro.h> |
||||
#include <linux/linkage.h> |
||||
|
||||
.pushsection .text.setjmp, "ax" |
||||
ENTRY(setjmp) |
||||
/* Preserve all callee-saved registers and the SP */ |
||||
stp x19, x20, [x0,#0] |
||||
stp x21, x22, [x0,#16] |
||||
stp x23, x24, [x0,#32] |
||||
stp x25, x26, [x0,#48] |
||||
stp x27, x28, [x0,#64] |
||||
stp x29, x30, [x0,#80] |
||||
mov x2, sp |
||||
str x2, [x0, #96] |
||||
mov x0, #0 |
||||
ret |
||||
ENDPROC(setjmp) |
||||
.popsection |
||||
|
||||
.pushsection .text.longjmp, "ax" |
||||
ENTRY(longjmp) |
||||
ldp x19, x20, [x0,#0] |
||||
ldp x21, x22, [x0,#16] |
||||
ldp x23, x24, [x0,#32] |
||||
ldp x25, x26, [x0,#48] |
||||
ldp x27, x28, [x0,#64] |
||||
ldp x29, x30, [x0,#80] |
||||
ldr x2, [x0,#96] |
||||
mov sp, x2 |
||||
/* Move the return value in place, but return 1 if passed 0. */ |
||||
adds x0, xzr, x1 |
||||
csinc x0, x0, xzr, ne |
||||
ret |
||||
ENDPROC(longjmp) |
||||
.popsection |
@ -0,0 +1,76 @@ |
||||
/*
|
||||
* (C) Copyright 2016 Rockchip Electronics Co., Ltd |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <adc.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/boot_mode.h> |
||||
|
||||
void set_back_to_bootrom_dnl_flag(void) |
||||
{ |
||||
writel(BOOT_BROM_DOWNLOAD, CONFIG_ROCKCHIP_BOOT_MODE_REG); |
||||
} |
||||
|
||||
/*
|
||||
* detect download key status by adc, most rockchip |
||||
* based boards use adc sample the download key status, |
||||
* but there are also some use gpio. So it's better to |
||||
* make this a weak function that can be override by |
||||
* some special boards. |
||||
*/ |
||||
#define KEY_DOWN_MIN_VAL 0 |
||||
#define KEY_DOWN_MAX_VAL 30 |
||||
|
||||
__weak int rockchip_dnl_key_pressed(void) |
||||
{ |
||||
unsigned int val; |
||||
|
||||
if (adc_channel_single_shot("saradc", 1, &val)) { |
||||
pr_err("%s: adc_channel_single_shot fail!\n", __func__); |
||||
return false; |
||||
} |
||||
|
||||
if ((val >= KEY_DOWN_MIN_VAL) && (val <= KEY_DOWN_MAX_VAL)) |
||||
return true; |
||||
else |
||||
return false; |
||||
} |
||||
|
||||
void rockchip_dnl_mode_check(void) |
||||
{ |
||||
if (rockchip_dnl_key_pressed()) { |
||||
printf("download key pressed, entering download mode..."); |
||||
set_back_to_bootrom_dnl_flag(); |
||||
do_reset(NULL, 0, 0, NULL); |
||||
} |
||||
} |
||||
|
||||
int setup_boot_mode(void) |
||||
{ |
||||
void *reg = (void *)CONFIG_ROCKCHIP_BOOT_MODE_REG; |
||||
int boot_mode = readl(reg); |
||||
|
||||
rockchip_dnl_mode_check(); |
||||
|
||||
boot_mode = readl(reg); |
||||
debug("%s: boot mode 0x%08x\n", __func__, boot_mode); |
||||
|
||||
/* Clear boot mode */ |
||||
writel(BOOT_NORMAL, reg); |
||||
|
||||
switch (boot_mode) { |
||||
case BOOT_FASTBOOT: |
||||
debug("%s: enter fastboot!\n", __func__); |
||||
env_set("preboot", "setenv preboot; fastboot usb0"); |
||||
break; |
||||
case BOOT_UMS: |
||||
debug("%s: enter UMS!\n", __func__); |
||||
env_set("preboot", "setenv preboot; ums mmc 0"); |
||||
break; |
||||
} |
||||
|
||||
return 0; |
||||
} |
@ -1,86 +0,0 @@ |
||||
/*
|
||||
* (C) Copyright 2015 Google, Inc |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <debug_uart.h> |
||||
#include <spl.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/bootrom.h> |
||||
#include <asm/arch/pmu_rk3188.h> |
||||
|
||||
DECLARE_GLOBAL_DATA_PTR; |
||||
|
||||
/* track how often we were entered */ |
||||
static int rk3188_num_entries __attribute__ ((section(".data"))); |
||||
|
||||
#define PMU_BASE 0x20004000 |
||||
#define SPL_ENTRY 0x10080C00 |
||||
|
||||
static void jump_to_spl(void) |
||||
{ |
||||
typedef void __noreturn (*image_entry_noargs_t)(void); |
||||
|
||||
struct rk3188_pmu * const pmu = (void *)PMU_BASE; |
||||
image_entry_noargs_t tpl_entry = |
||||
(image_entry_noargs_t)(unsigned long)SPL_ENTRY; |
||||
|
||||
/* Store the SAVE_SP_ADDR in a location shared with SPL. */ |
||||
writel(SAVE_SP_ADDR, &pmu->sys_reg[2]); |
||||
tpl_entry(); |
||||
} |
||||
|
||||
void board_init_f(ulong dummy) |
||||
{ |
||||
/* Example code showing how to enable the debug UART on RK3188 */ |
||||
#ifdef EARLY_UART |
||||
#include <asm/arch/grf_rk3188.h> |
||||
/* Enable early UART on the RK3188 */ |
||||
#define GRF_BASE 0x20008000 |
||||
struct rk3188_grf * const grf = (void *)GRF_BASE; |
||||
|
||||
rk_clrsetreg(&grf->gpio1b_iomux, |
||||
GPIO1B1_MASK << GPIO1B1_SHIFT | |
||||
GPIO1B0_MASK << GPIO1B0_SHIFT, |
||||
GPIO1B1_UART2_SOUT << GPIO1B1_SHIFT | |
||||
GPIO1B0_UART2_SIN << GPIO1B0_SHIFT); |
||||
/*
|
||||
* Debug UART can be used from here if required: |
||||
* |
||||
* debug_uart_init(); |
||||
* printch('a'); |
||||
* printhex8(0x1234); |
||||
* printascii("string"); |
||||
*/ |
||||
debug_uart_init(); |
||||
|
||||
printch('t'); |
||||
printch('p'); |
||||
printch('l'); |
||||
printch('-'); |
||||
printch(rk3188_num_entries + 1 + '0'); |
||||
printch('\n'); |
||||
#endif |
||||
|
||||
rk3188_num_entries++; |
||||
|
||||
if (rk3188_num_entries == 1) { |
||||
/*
|
||||
* The original loader did some very basic integrity |
||||
* checking at this point, but the remaining few bytes |
||||
* could be used for any improvement making sense |
||||
* really early on. |
||||
*/ |
||||
|
||||
back_to_bootrom(); |
||||
} else { |
||||
/*
|
||||
* TPL part of the loader should now wait for us |
||||
* at offset 0xC00 in the sram. Should never return |
||||
* from there. |
||||
*/ |
||||
jump_to_spl(); |
||||
} |
||||
} |
@ -0,0 +1,14 @@ |
||||
/*
|
||||
* Copyright (c) 2017 Rockchip Electronics Co., Ltd |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/arch/boot_mode.h> |
||||
|
||||
int board_late_init(void) |
||||
{ |
||||
setup_boot_mode(); |
||||
return 0; |
||||
} |
@ -1,69 +0,0 @@ |
||||
/* |
||||
* (C) Copyright 2016 Rockchip Electronics Co., Ltd |
||||
* (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <linux/linkage.h> |
||||
|
||||
#if defined(CONFIG_ARM64) |
||||
.globl SAVE_SP_ADDR
|
||||
SAVE_SP_ADDR: |
||||
.quad 0
|
||||
|
||||
ENTRY(save_boot_params) |
||||
sub sp, sp, #0x60 |
||||
stp x29, x30, [sp, #0x50] |
||||
stp x27, x28, [sp, #0x40] |
||||
stp x25, x26, [sp, #0x30] |
||||
stp x23, x24, [sp, #0x20] |
||||
stp x21, x22, [sp, #0x10] |
||||
stp x19, x20, [sp, #0] |
||||
ldr x8, =SAVE_SP_ADDR |
||||
mov x9, sp |
||||
str x9, [x8] |
||||
b save_boot_params_ret /* back to my caller */ |
||||
ENDPROC(save_boot_params) |
||||
|
||||
.globl _back_to_bootrom_s
|
||||
ENTRY(_back_to_bootrom_s) |
||||
ldr x0, =SAVE_SP_ADDR |
||||
ldr x0, [x0] |
||||
mov sp, x0 |
||||
ldp x29, x30, [sp, #0x50] |
||||
ldp x27, x28, [sp, #0x40] |
||||
ldp x25, x26, [sp, #0x30] |
||||
ldp x23, x24, [sp, #0x20] |
||||
ldp x21, x22, [sp, #0x10] |
||||
ldp x19, x20, [sp] |
||||
add sp, sp, #0x60 |
||||
mov x0, xzr |
||||
ret |
||||
ENDPROC(_back_to_bootrom_s) |
||||
#else |
||||
.globl SAVE_SP_ADDR
|
||||
SAVE_SP_ADDR: |
||||
.word 0
|
||||
|
||||
/* |
||||
* void save_boot_params |
||||
* |
||||
* Save sp, lr, r1~r12 |
||||
*/ |
||||
ENTRY(save_boot_params) |
||||
push {r1-r12, lr} |
||||
ldr r0, =SAVE_SP_ADDR |
||||
str sp, [r0] |
||||
b save_boot_params_ret @ back to my caller
|
||||
ENDPROC(save_boot_params) |
||||
|
||||
|
||||
.globl _back_to_bootrom_s
|
||||
ENTRY(_back_to_bootrom_s) |
||||
ldr r0, =SAVE_SP_ADDR |
||||
ldr sp, [r0] |
||||
mov r0, #0 |
||||
pop {r1-r12, pc} |
||||
ENDPROC(_back_to_bootrom_s) |
||||
#endif |
@ -1,45 +0,0 @@ |
||||
/*
|
||||
* (C) Copyright 2015 Rockchip Electronics Co., Ltd |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <dm.h> |
||||
#include <errno.h> |
||||
#include <sysreset.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/clock.h> |
||||
#include <asm/arch/cru_rk3036.h> |
||||
#include <asm/arch/hardware.h> |
||||
#include <linux/err.h> |
||||
|
||||
int rk3036_sysreset_request(struct udevice *dev, enum sysreset_t type) |
||||
{ |
||||
struct rk3036_cru *cru = rockchip_get_cru(); |
||||
|
||||
if (IS_ERR(cru)) |
||||
return PTR_ERR(cru); |
||||
switch (type) { |
||||
case SYSRESET_WARM: |
||||
writel(0xeca8, &cru->cru_glb_srst_snd_value); |
||||
break; |
||||
case SYSRESET_COLD: |
||||
writel(0xfdb9, &cru->cru_glb_srst_fst_value); |
||||
break; |
||||
default: |
||||
return -EPROTONOSUPPORT; |
||||
} |
||||
|
||||
return -EINPROGRESS; |
||||
} |
||||
|
||||
static struct sysreset_ops rk3036_sysreset = { |
||||
.request = rk3036_sysreset_request, |
||||
}; |
||||
|
||||
U_BOOT_DRIVER(sysreset_rk3036) = { |
||||
.name = "rk3036_sysreset", |
||||
.id = UCLASS_SYSRESET, |
||||
.ops = &rk3036_sysreset, |
||||
}; |
@ -1,62 +0,0 @@ |
||||
/*
|
||||
* (C) Copyright 2015 Google, Inc |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0 |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <dm.h> |
||||
#include <errno.h> |
||||
#include <syscon.h> |
||||
#include <sysreset.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/clock.h> |
||||
#include <asm/arch/cru_rk3188.h> |
||||
#include <asm/arch/grf_rk3188.h> |
||||
#include <asm/arch/hardware.h> |
||||
#include <linux/err.h> |
||||
|
||||
int rk3188_sysreset_request(struct udevice *dev, enum sysreset_t type) |
||||
{ |
||||
struct rk3188_cru *cru = rockchip_get_cru(); |
||||
struct rk3188_grf *grf; |
||||
|
||||
if (IS_ERR(cru)) |
||||
return PTR_ERR(cru); |
||||
switch (type) { |
||||
case SYSRESET_WARM: |
||||
grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); |
||||
if (IS_ERR(grf)) |
||||
return -EPROTONOSUPPORT; |
||||
|
||||
/*
|
||||
* warm-reset keeps the remap value, |
||||
* so make sure it's disabled. |
||||
*/ |
||||
rk_clrsetreg(&grf->soc_con0, |
||||
NOC_REMAP_MASK << NOC_REMAP_SHIFT, |
||||
0 << NOC_REMAP_SHIFT); |
||||
|
||||
rk_clrreg(&cru->cru_mode_con, 0xffff); |
||||
writel(0xeca8, &cru->cru_glb_srst_snd_value); |
||||
break; |
||||
case SYSRESET_COLD: |
||||
rk_clrreg(&cru->cru_mode_con, 0xffff); |
||||
writel(0xfdb9, &cru->cru_glb_srst_fst_value); |
||||
break; |
||||
default: |
||||
return -EPROTONOSUPPORT; |
||||
} |
||||
|
||||
return -EINPROGRESS; |
||||
} |
||||
|
||||
static struct sysreset_ops rk3188_sysreset = { |
||||
.request = rk3188_sysreset_request, |
||||
}; |
||||
|
||||
U_BOOT_DRIVER(sysreset_rk3188) = { |
||||
.name = "rk3188_sysreset", |
||||
.id = UCLASS_SYSRESET, |
||||
.ops = &rk3188_sysreset, |
||||
}; |
@ -1,45 +0,0 @@ |
||||
/*
|
||||
* (C) Copyright 2017 Rockchip Electronics Co., Ltd |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <dm.h> |
||||
#include <errno.h> |
||||
#include <sysreset.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/clock.h> |
||||
#include <asm/arch/cru_rk322x.h> |
||||
#include <asm/arch/hardware.h> |
||||
#include <linux/err.h> |
||||
|
||||
int rk322x_sysreset_request(struct udevice *dev, enum sysreset_t type) |
||||
{ |
||||
struct rk322x_cru *cru = rockchip_get_cru(); |
||||
|
||||
if (IS_ERR(cru)) |
||||
return PTR_ERR(cru); |
||||
switch (type) { |
||||
case SYSRESET_WARM: |
||||
writel(0xeca8, &cru->cru_glb_srst_snd_value); |
||||
break; |
||||
case SYSRESET_COLD: |
||||
writel(0xfdb9, &cru->cru_glb_srst_fst_value); |
||||
break; |
||||
default: |
||||
return -EPROTONOSUPPORT; |
||||
} |
||||
|
||||
return -EINPROGRESS; |
||||
} |
||||
|
||||
static struct sysreset_ops rk322x_sysreset = { |
||||
.request = rk322x_sysreset_request, |
||||
}; |
||||
|
||||
U_BOOT_DRIVER(sysreset_rk322x) = { |
||||
.name = "rk322x_sysreset", |
||||
.id = UCLASS_SYSRESET, |
||||
.ops = &rk322x_sysreset, |
||||
}; |
@ -1,47 +0,0 @@ |
||||
/*
|
||||
* (C) Copyright 2015 Google, Inc |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0 |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <dm.h> |
||||
#include <errno.h> |
||||
#include <sysreset.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/clock.h> |
||||
#include <asm/arch/cru_rk3288.h> |
||||
#include <asm/arch/hardware.h> |
||||
#include <linux/err.h> |
||||
|
||||
int rk3288_sysreset_request(struct udevice *dev, enum sysreset_t type) |
||||
{ |
||||
struct rk3288_cru *cru = rockchip_get_cru(); |
||||
|
||||
if (IS_ERR(cru)) |
||||
return PTR_ERR(cru); |
||||
switch (type) { |
||||
case SYSRESET_WARM: |
||||
rk_clrreg(&cru->cru_mode_con, 0xffff); |
||||
writel(0xeca8, &cru->cru_glb_srst_snd_value); |
||||
break; |
||||
case SYSRESET_COLD: |
||||
rk_clrreg(&cru->cru_mode_con, 0xffff); |
||||
writel(0xfdb9, &cru->cru_glb_srst_fst_value); |
||||
break; |
||||
default: |
||||
return -EPROTONOSUPPORT; |
||||
} |
||||
|
||||
return -EINPROGRESS; |
||||
} |
||||
|
||||
static struct sysreset_ops rk3288_sysreset = { |
||||
.request = rk3288_sysreset_request, |
||||
}; |
||||
|
||||
U_BOOT_DRIVER(sysreset_rk3288) = { |
||||
.name = "rk3288_sysreset", |
||||
.id = UCLASS_SYSRESET, |
||||
.ops = &rk3288_sysreset, |
||||
}; |
@ -1,45 +0,0 @@ |
||||
/*
|
||||
* (C) Copyright 2016 Rockchip Electronics Co., Ltd |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0 |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <dm.h> |
||||
#include <errno.h> |
||||
#include <sysreset.h> |
||||
#include <asm/arch/clock.h> |
||||
#include <asm/arch/cru_rk3328.h> |
||||
#include <asm/arch/hardware.h> |
||||
#include <asm/io.h> |
||||
#include <linux/err.h> |
||||
|
||||
int rk3328_sysreset_request(struct udevice *dev, enum sysreset_t type) |
||||
{ |
||||
struct rk3328_cru *cru = rockchip_get_cru(); |
||||
|
||||
if (IS_ERR(cru)) |
||||
return PTR_ERR(cru); |
||||
switch (type) { |
||||
case SYSRESET_WARM: |
||||
writel(0xeca8, &cru->glb_srst_snd_value); |
||||
break; |
||||
case SYSRESET_COLD: |
||||
writel(0xfdb9, &cru->glb_srst_fst_value); |
||||
break; |
||||
default: |
||||
return -EPROTONOSUPPORT; |
||||
} |
||||
|
||||
return -EINPROGRESS; |
||||
} |
||||
|
||||
static struct sysreset_ops rk3328_sysreset = { |
||||
.request = rk3328_sysreset_request, |
||||
}; |
||||
|
||||
U_BOOT_DRIVER(sysreset_rk3328) = { |
||||
.name = "rk3328_sysreset", |
||||
.id = UCLASS_SYSRESET, |
||||
.ops = &rk3328_sysreset, |
||||
}; |
@ -1,62 +0,0 @@ |
||||
/*
|
||||
* (C) Copyright Rockchip Electronics Co., Ltd |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0 |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <dm.h> |
||||
#include <errno.h> |
||||
#include <sysreset.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/clock.h> |
||||
#include <asm/arch/cru_rk3368.h> |
||||
#include <asm/arch/hardware.h> |
||||
#include <linux/err.h> |
||||
|
||||
static void rk3368_pll_enter_slow_mode(struct rk3368_cru *cru) |
||||
{ |
||||
struct rk3368_pll *pll; |
||||
int i; |
||||
|
||||
for (i = 0; i < 6; i++) { |
||||
pll = &cru->pll[i]; |
||||
rk_clrreg(&pll->con3, PLL_MODE_MASK); |
||||
} |
||||
} |
||||
|
||||
static int rk3368_sysreset_request(struct udevice *dev, enum sysreset_t type) |
||||
{ |
||||
struct rk3368_cru *cru = rockchip_get_cru(); |
||||
|
||||
if (IS_ERR(cru)) |
||||
return PTR_ERR(cru); |
||||
switch (type) { |
||||
case SYSRESET_WARM: |
||||
rk3368_pll_enter_slow_mode(cru); |
||||
rk_clrsetreg(&cru->glb_rst_con, PMU_GLB_SRST_CTRL_MASK, |
||||
PMU_RST_BY_SND_GLB_SRST << PMU_GLB_SRST_CTRL_SHIFT); |
||||
writel(0xeca8, &cru->glb_srst_snd_val); |
||||
break; |
||||
case SYSRESET_COLD: |
||||
rk3368_pll_enter_slow_mode(cru); |
||||
rk_clrsetreg(&cru->glb_rst_con, PMU_GLB_SRST_CTRL_MASK, |
||||
PMU_RST_BY_FST_GLB_SRST << PMU_GLB_SRST_CTRL_SHIFT); |
||||
writel(0xfdb9, &cru->glb_srst_fst_val); |
||||
break; |
||||
default: |
||||
return -EPROTONOSUPPORT; |
||||
} |
||||
|
||||
return -EINPROGRESS; |
||||
} |
||||
|
||||
static struct sysreset_ops rk3368_sysreset = { |
||||
.request = rk3368_sysreset_request, |
||||
}; |
||||
|
||||
U_BOOT_DRIVER(sysreset_rk3368) = { |
||||
.name = "rk3368_sysreset", |
||||
.id = UCLASS_SYSRESET, |
||||
.ops = &rk3368_sysreset, |
||||
}; |
@ -1,45 +0,0 @@ |
||||
/*
|
||||
* (C) Copyright 2016 Rockchip Electronics Co., Ltd |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0 |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <dm.h> |
||||
#include <errno.h> |
||||
#include <sysreset.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/clock.h> |
||||
#include <asm/arch/cru_rk3399.h> |
||||
#include <asm/arch/hardware.h> |
||||
#include <linux/err.h> |
||||
|
||||
int rk3399_sysreset_request(struct udevice *dev, enum sysreset_t type) |
||||
{ |
||||
struct rk3399_cru *cru = rockchip_get_cru(); |
||||
|
||||
if (IS_ERR(cru)) |
||||
return PTR_ERR(cru); |
||||
switch (type) { |
||||
case SYSRESET_WARM: |
||||
writel(0xeca8, &cru->glb_srst_snd_value); |
||||
break; |
||||
case SYSRESET_COLD: |
||||
writel(0xfdb9, &cru->glb_srst_fst_value); |
||||
break; |
||||
default: |
||||
return -EPROTONOSUPPORT; |
||||
} |
||||
|
||||
return -EINPROGRESS; |
||||
} |
||||
|
||||
static struct sysreset_ops rk3399_sysreset = { |
||||
.request = rk3399_sysreset_request, |
||||
}; |
||||
|
||||
U_BOOT_DRIVER(sysreset_rk3399) = { |
||||
.name = "rk3399_sysreset", |
||||
.id = UCLASS_SYSRESET, |
||||
.ops = &rk3399_sysreset, |
||||
}; |
@ -0,0 +1,47 @@ |
||||
/*
|
||||
* (C) Copyright 2017 Rockchip Electronics Co., Ltd |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0 |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <dm.h> |
||||
#include <errno.h> |
||||
#include <sysreset.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/clock.h> |
||||
#include <asm/arch/cru_rk3328.h> |
||||
#include <asm/arch/hardware.h> |
||||
#include <linux/err.h> |
||||
|
||||
int rockchip_sysreset_request(struct udevice *dev, enum sysreset_t type) |
||||
{ |
||||
struct sysreset_reg *offset = dev_get_priv(dev); |
||||
unsigned long cru_base = (unsigned long)rockchip_get_cru(); |
||||
|
||||
if (IS_ERR_VALUE(cru_base)) |
||||
return (int)cru_base; |
||||
|
||||
switch (type) { |
||||
case SYSRESET_WARM: |
||||
writel(0xeca8, cru_base + offset->glb_srst_snd_value); |
||||
break; |
||||
case SYSRESET_COLD: |
||||
writel(0xfdb9, cru_base + offset->glb_srst_fst_value); |
||||
break; |
||||
default: |
||||
return -EPROTONOSUPPORT; |
||||
} |
||||
|
||||
return -EINPROGRESS; |
||||
} |
||||
|
||||
static struct sysreset_ops rockchip_sysreset = { |
||||
.request = rockchip_sysreset_request, |
||||
}; |
||||
|
||||
U_BOOT_DRIVER(sysreset_rockchip) = { |
||||
.name = "rockchip_sysreset", |
||||
.id = UCLASS_SYSRESET, |
||||
.ops = &rockchip_sysreset, |
||||
}; |
@ -1,46 +0,0 @@ |
||||
/*
|
||||
* (C) Copyright 2015 Rockchip Electronics Co., Ltd |
||||
* Author: Andy Yan <andy.yan@rock-chips.com> |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <dm.h> |
||||
#include <errno.h> |
||||
#include <sysreset.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/clock.h> |
||||
#include <asm/arch/cru_rv1108.h> |
||||
#include <asm/arch/hardware.h> |
||||
#include <linux/err.h> |
||||
|
||||
int rv1108_sysreset_request(struct udevice *dev, enum sysreset_t type) |
||||
{ |
||||
struct rv1108_cru *cru = rockchip_get_cru(); |
||||
|
||||
if (IS_ERR(cru)) |
||||
return PTR_ERR(cru); |
||||
|
||||
switch (type) { |
||||
case SYSRESET_WARM: |
||||
writel(0xeca8, &cru->glb_srst_snd_val); |
||||
break; |
||||
case SYSRESET_COLD: |
||||
writel(0xfdb9, &cru->glb_srst_fst_val); |
||||
break; |
||||
default: |
||||
return -EPROTONOSUPPORT; |
||||
} |
||||
|
||||
return -EINPROGRESS; |
||||
} |
||||
|
||||
static struct sysreset_ops rv1108_sysreset = { |
||||
.request = rv1108_sysreset_request, |
||||
}; |
||||
|
||||
U_BOOT_DRIVER(sysreset_rv1108) = { |
||||
.name = "rv1108_sysreset", |
||||
.id = UCLASS_SYSRESET, |
||||
.ops = &rv1108_sysreset, |
||||
}; |
Loading…
Reference in new issue