2 * (C) Copyright 2015 Google, Inc
4 * SPDX-License-Identifier: GPL-2.0
13 #include <asm/arch/clock.h>
14 #include <asm/arch/cru_rk3188.h>
15 #include <asm/arch/grf_rk3188.h>
16 #include <asm/arch/hardware.h>
17 #include <linux/err.h>
19 int rk3188_sysreset_request(struct udevice *dev, enum sysreset_t type)
21 struct rk3188_cru *cru = rockchip_get_cru();
22 struct rk3188_grf *grf;
28 grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
30 return -EPROTONOSUPPORT;
33 * warm-reset keeps the remap value,
34 * so make sure it's disabled.
36 rk_clrsetreg(&grf->soc_con0,
37 NOC_REMAP_MASK << NOC_REMAP_SHIFT,
38 0 << NOC_REMAP_SHIFT);
40 rk_clrreg(&cru->cru_mode_con, 0xffff);
41 writel(0xeca8, &cru->cru_glb_srst_snd_value);
44 rk_clrreg(&cru->cru_mode_con, 0xffff);
45 writel(0xfdb9, &cru->cru_glb_srst_fst_value);
48 return -EPROTONOSUPPORT;
54 static struct sysreset_ops rk3188_sysreset = {
55 .request = rk3188_sysreset_request,
58 U_BOOT_DRIVER(sysreset_rk3188) = {
59 .name = "rk3188_sysreset",
60 .id = UCLASS_SYSRESET,
61 .ops = &rk3188_sysreset,