summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-11-22 07:28:58 -0500
committerTom Rini <trini@konsulko.com>2017-11-22 07:28:58 -0500
commitd9d76023ea0d567b0630e85d1bef67b5b1a788d3 (patch)
tree670247b653a049be8aceebc16bf9dcc1d112f9f4 /drivers
parent16fa2eb95172e63820ee5f3d4052f3362a6de84e (diff)
parent08790230fe80d46ff6368e0dc1e1be500ca3c4bf (diff)
Merge git://git.denx.de/u-boot-rockchip
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/rockchip/clk_rk3036.c17
-rw-r--r--drivers/clk/rockchip/clk_rk3188.c17
-rw-r--r--drivers/clk/rockchip/clk_rk322x.c17
-rw-r--r--drivers/clk/rockchip/clk_rk3288.c17
-rw-r--r--drivers/clk/rockchip/clk_rk3328.c17
-rw-r--r--drivers/clk/rockchip/clk_rk3368.c17
-rw-r--r--drivers/clk/rockchip/clk_rk3399.c17
-rw-r--r--drivers/clk/rockchip/clk_rv1108.c17
-rw-r--r--drivers/spi/rk_spi.c2
-rw-r--r--drivers/sysreset/Makefile11
-rw-r--r--drivers/sysreset/sysreset_rk3036.c45
-rw-r--r--drivers/sysreset/sysreset_rk3188.c62
-rw-r--r--drivers/sysreset/sysreset_rk322x.c45
-rw-r--r--drivers/sysreset/sysreset_rk3288.c47
-rw-r--r--drivers/sysreset/sysreset_rk3328.c45
-rw-r--r--drivers/sysreset/sysreset_rk3368.c62
-rw-r--r--drivers/sysreset/sysreset_rk3399.c45
-rw-r--r--drivers/sysreset/sysreset_rockchip.c47
-rw-r--r--drivers/sysreset/sysreset_rv1108.c46
19 files changed, 161 insertions, 432 deletions
diff --git a/drivers/clk/rockchip/clk_rk3036.c b/drivers/clk/rockchip/clk_rk3036.c
index 83f4ae6ca3..280ebb9ba2 100644
--- a/drivers/clk/rockchip/clk_rk3036.c
+++ b/drivers/clk/rockchip/clk_rk3036.c
@@ -330,11 +330,22 @@ static int rk3036_clk_probe(struct udevice *dev)
static int rk3036_clk_bind(struct udevice *dev)
{
int ret;
+ struct udevice *sys_child;
+ struct sysreset_reg *priv;
/* The reset driver does not have a device node, so bind it here */
- ret = device_bind_driver(gd->dm_root, "rk3036_sysreset", "reset", &dev);
- if (ret)
- debug("Warning: No RK3036 reset driver: ret=%d\n", ret);
+ ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset",
+ &sys_child);
+ if (ret) {
+ debug("Warning: No sysreset driver: ret=%d\n", ret);
+ } else {
+ priv = malloc(sizeof(struct sysreset_reg));
+ priv->glb_srst_fst_value = offsetof(struct rk3036_cru,
+ cru_glb_srst_fst_value);
+ priv->glb_srst_snd_value = offsetof(struct rk3036_cru,
+ cru_glb_srst_snd_value);
+ sys_child->priv = priv;
+ }
return 0;
}
diff --git a/drivers/clk/rockchip/clk_rk3188.c b/drivers/clk/rockchip/clk_rk3188.c
index 8c2c9bc1d8..fca6899d8b 100644
--- a/drivers/clk/rockchip/clk_rk3188.c
+++ b/drivers/clk/rockchip/clk_rk3188.c
@@ -573,11 +573,22 @@ static int rk3188_clk_probe(struct udevice *dev)
static int rk3188_clk_bind(struct udevice *dev)
{
int ret;
+ struct udevice *sys_child;
+ struct sysreset_reg *priv;
/* The reset driver does not have a device node, so bind it here */
- ret = device_bind_driver(gd->dm_root, "rk3188_sysreset", "reset", &dev);
- if (ret)
- debug("Warning: No rk3188 reset driver: ret=%d\n", ret);
+ ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset",
+ &sys_child);
+ if (ret) {
+ debug("Warning: No sysreset driver: ret=%d\n", ret);
+ } else {
+ priv = malloc(sizeof(struct sysreset_reg));
+ priv->glb_srst_fst_value = offsetof(struct rk3188_cru,
+ cru_glb_srst_fst_value);
+ priv->glb_srst_snd_value = offsetof(struct rk3188_cru,
+ cru_glb_srst_snd_value);
+ sys_child->priv = priv;
+ }
return 0;
}
diff --git a/drivers/clk/rockchip/clk_rk322x.c b/drivers/clk/rockchip/clk_rk322x.c
index e87267d239..ff52b55229 100644
--- a/drivers/clk/rockchip/clk_rk322x.c
+++ b/drivers/clk/rockchip/clk_rk322x.c
@@ -385,11 +385,22 @@ static int rk322x_clk_probe(struct udevice *dev)
static int rk322x_clk_bind(struct udevice *dev)
{
int ret;
+ struct udevice *sys_child;
+ struct sysreset_reg *priv;
/* The reset driver does not have a device node, so bind it here */
- ret = device_bind_driver(gd->dm_root, "rk322x_sysreset", "reset", &dev);
- if (ret)
- debug("Warning: No RK322x reset driver: ret=%d\n", ret);
+ ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset",
+ &sys_child);
+ if (ret) {
+ debug("Warning: No sysreset driver: ret=%d\n", ret);
+ } else {
+ priv = malloc(sizeof(struct sysreset_reg));
+ priv->glb_srst_fst_value = offsetof(struct rk322x_cru,
+ cru_glb_srst_fst_value);
+ priv->glb_srst_snd_value = offsetof(struct rk322x_cru,
+ cru_glb_srst_snd_value);
+ sys_child->priv = priv;
+ }
return 0;
}
diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c
index a133810bf6..ac53239363 100644
--- a/drivers/clk/rockchip/clk_rk3288.c
+++ b/drivers/clk/rockchip/clk_rk3288.c
@@ -859,11 +859,22 @@ static int rk3288_clk_probe(struct udevice *dev)
static int rk3288_clk_bind(struct udevice *dev)
{
int ret;
+ struct udevice *sys_child;
+ struct sysreset_reg *priv;
/* The reset driver does not have a device node, so bind it here */
- ret = device_bind_driver(gd->dm_root, "rk3288_sysreset", "reset", &dev);
- if (ret)
- debug("Warning: No RK3288 reset driver: ret=%d\n", ret);
+ ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset",
+ &sys_child);
+ if (ret) {
+ debug("Warning: No sysreset driver: ret=%d\n", ret);
+ } else {
+ priv = malloc(sizeof(struct sysreset_reg));
+ priv->glb_srst_fst_value = offsetof(struct rk3288_cru,
+ cru_glb_srst_fst_value);
+ priv->glb_srst_snd_value = offsetof(struct rk3288_cru,
+ cru_glb_srst_snd_value);
+ sys_child->priv = priv;
+ }
return 0;
}
diff --git a/drivers/clk/rockchip/clk_rk3328.c b/drivers/clk/rockchip/clk_rk3328.c
index 540d9104c3..4d522a7816 100644
--- a/drivers/clk/rockchip/clk_rk3328.c
+++ b/drivers/clk/rockchip/clk_rk3328.c
@@ -597,11 +597,22 @@ static int rk3328_clk_ofdata_to_platdata(struct udevice *dev)
static int rk3328_clk_bind(struct udevice *dev)
{
int ret;
+ struct udevice *sys_child;
+ struct sysreset_reg *priv;
/* The reset driver does not have a device node, so bind it here */
- ret = device_bind_driver(gd->dm_root, "rk3328_sysreset", "reset", &dev);
- if (ret)
- printf("Warning: No RK3328 reset driver: ret=%d\n", ret);
+ ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset",
+ &sys_child);
+ if (ret) {
+ debug("Warning: No sysreset driver: ret=%d\n", ret);
+ } else {
+ priv = malloc(sizeof(struct sysreset_reg));
+ priv->glb_srst_fst_value = offsetof(struct rk3328_cru,
+ glb_srst_fst_value);
+ priv->glb_srst_snd_value = offsetof(struct rk3328_cru,
+ glb_srst_snd_value);
+ sys_child->priv = priv;
+ }
return ret;
}
diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c
index 3661769748..bfeef39d2a 100644
--- a/drivers/clk/rockchip/clk_rk3368.c
+++ b/drivers/clk/rockchip/clk_rk3368.c
@@ -526,11 +526,22 @@ static int rk3368_clk_ofdata_to_platdata(struct udevice *dev)
static int rk3368_clk_bind(struct udevice *dev)
{
int ret;
+ struct udevice *sys_child;
+ struct sysreset_reg *priv;
/* The reset driver does not have a device node, so bind it here */
- ret = device_bind_driver(gd->dm_root, "rk3368_sysreset", "reset", &dev);
- if (ret)
- pr_err("bind RK3368 reset driver failed: ret=%d\n", ret);
+ ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset",
+ &sys_child);
+ if (ret) {
+ debug("Warning: No sysreset driver: ret=%d\n", ret);
+ } else {
+ priv = malloc(sizeof(struct sysreset_reg));
+ priv->glb_srst_fst_value = offsetof(struct rk3368_cru,
+ glb_srst_fst_val);
+ priv->glb_srst_snd_value = offsetof(struct rk3368_cru,
+ glb_srst_snd_val);
+ sys_child->priv = priv;
+ }
return ret;
}
diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c
index 6f85a38e41..e21d056efb 100644
--- a/drivers/clk/rockchip/clk_rk3399.c
+++ b/drivers/clk/rockchip/clk_rk3399.c
@@ -1033,11 +1033,22 @@ static int rk3399_clk_ofdata_to_platdata(struct udevice *dev)
static int rk3399_clk_bind(struct udevice *dev)
{
int ret;
+ struct udevice *sys_child;
+ struct sysreset_reg *priv;
/* The reset driver does not have a device node, so bind it here */
- ret = device_bind_driver(gd->dm_root, "rk3399_sysreset", "reset", &dev);
- if (ret)
- printf("Warning: No RK3399 reset driver: ret=%d\n", ret);
+ ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset",
+ &sys_child);
+ if (ret) {
+ debug("Warning: No sysreset driver: ret=%d\n", ret);
+ } else {
+ priv = malloc(sizeof(struct sysreset_reg));
+ priv->glb_srst_fst_value = offsetof(struct rk3399_cru,
+ glb_srst_fst_value);
+ priv->glb_srst_snd_value = offsetof(struct rk3399_cru,
+ glb_srst_snd_value);
+ sys_child->priv = priv;
+ }
return 0;
}
diff --git a/drivers/clk/rockchip/clk_rv1108.c b/drivers/clk/rockchip/clk_rv1108.c
index 55741c3a1e..a1195486a9 100644
--- a/drivers/clk/rockchip/clk_rv1108.c
+++ b/drivers/clk/rockchip/clk_rv1108.c
@@ -223,11 +223,22 @@ static int rv1108_clk_probe(struct udevice *dev)
static int rv1108_clk_bind(struct udevice *dev)
{
int ret;
+ struct udevice *sys_child;
+ struct sysreset_reg *priv;
/* The reset driver does not have a device node, so bind it here */
- ret = device_bind_driver(gd->dm_root, "rv1108_sysreset", "reset", &dev);
- if (ret)
- pr_err("No Rv1108 reset driver: ret=%d\n", ret);
+ ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset",
+ &sys_child);
+ if (ret) {
+ debug("Warning: No sysreset driver: ret=%d\n", ret);
+ } else {
+ priv = malloc(sizeof(struct sysreset_reg));
+ priv->glb_srst_fst_value = offsetof(struct rv1108_cru,
+ glb_srst_fst_val);
+ priv->glb_srst_snd_value = offsetof(struct rv1108_cru,
+ glb_srst_snd_val);
+ sys_child->priv = priv;
+ }
return 0;
}
diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c
index b18db74e7e..03d3fa6763 100644
--- a/drivers/spi/rk_spi.c
+++ b/drivers/spi/rk_spi.c
@@ -94,7 +94,7 @@ static void rkspi_set_clk(struct rockchip_spi_priv *priv, uint speed)
*/
if (clk_div > 0xfffe) {
clk_div = 0xfffe;
- debug("%s: can't divide down to %d hz (actual will be %d hz)\n",
+ debug("%s: can't divide down to %d Hz (actual will be %d Hz)\n",
__func__, speed, priv->input_rate / clk_div);
}
diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile
index 476d361297..2e9598e300 100644
--- a/drivers/sysreset/Makefile
+++ b/drivers/sysreset/Makefile
@@ -9,16 +9,7 @@ obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o
obj-$(CONFIG_SYSRESET_SYSCON) += sysreset_syscon.o
obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.o
-ifndef CONFIG_SPL_BUILD
-obj-$(CONFIG_ROCKCHIP_RK3036) += sysreset_rk3036.o
-endif
-obj-$(CONFIG_ROCKCHIP_RK3188) += sysreset_rk3188.o
-obj-$(CONFIG_ROCKCHIP_RK322X) += sysreset_rk322x.o
-obj-$(CONFIG_ROCKCHIP_RK3288) += sysreset_rk3288.o
-obj-$(CONFIG_ROCKCHIP_RK3328) += sysreset_rk3328.o
-obj-$(CONFIG_ROCKCHIP_RK3368) += sysreset_rk3368.o
-obj-$(CONFIG_ROCKCHIP_RK3399) += sysreset_rk3399.o
-obj-$(CONFIG_ROCKCHIP_RV1108) += sysreset_rv1108.o
+obj-$(CONFIG_ARCH_ROCKCHIP) += sysreset_rockchip.o
obj-$(CONFIG_SANDBOX) += sysreset_sandbox.o
obj-$(CONFIG_ARCH_SNAPDRAGON) += sysreset_snapdragon.o
obj-$(CONFIG_ARCH_STI) += sysreset_sti.o
diff --git a/drivers/sysreset/sysreset_rk3036.c b/drivers/sysreset/sysreset_rk3036.c
deleted file mode 100644
index b3d2113239..0000000000
--- a/drivers/sysreset/sysreset_rk3036.c
+++ /dev/null
@@ -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,
-};
diff --git a/drivers/sysreset/sysreset_rk3188.c b/drivers/sysreset/sysreset_rk3188.c
deleted file mode 100644
index 053a6344f5..0000000000
--- a/drivers/sysreset/sysreset_rk3188.c
+++ /dev/null
@@ -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,
-};
diff --git a/drivers/sysreset/sysreset_rk322x.c b/drivers/sysreset/sysreset_rk322x.c
deleted file mode 100644
index 5fce79b685..0000000000
--- a/drivers/sysreset/sysreset_rk322x.c
+++ /dev/null
@@ -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,
-};
diff --git a/drivers/sysreset/sysreset_rk3288.c b/drivers/sysreset/sysreset_rk3288.c
deleted file mode 100644
index 0aad1c2160..0000000000
--- a/drivers/sysreset/sysreset_rk3288.c
+++ /dev/null
@@ -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,
-};
diff --git a/drivers/sysreset/sysreset_rk3328.c b/drivers/sysreset/sysreset_rk3328.c
deleted file mode 100644
index 7b9af0925b..0000000000
--- a/drivers/sysreset/sysreset_rk3328.c
+++ /dev/null
@@ -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,
-};
diff --git a/drivers/sysreset/sysreset_rk3368.c b/drivers/sysreset/sysreset_rk3368.c
deleted file mode 100644
index de62921b78..0000000000
--- a/drivers/sysreset/sysreset_rk3368.c
+++ /dev/null
@@ -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,
-};
diff --git a/drivers/sysreset/sysreset_rk3399.c b/drivers/sysreset/sysreset_rk3399.c
deleted file mode 100644
index 9a555464c6..0000000000
--- a/drivers/sysreset/sysreset_rk3399.c
+++ /dev/null
@@ -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,
-};
diff --git a/drivers/sysreset/sysreset_rockchip.c b/drivers/sysreset/sysreset_rockchip.c
new file mode 100644
index 0000000000..894975f3fe
--- /dev/null
+++ b/drivers/sysreset/sysreset_rockchip.c
@@ -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,
+};
diff --git a/drivers/sysreset/sysreset_rv1108.c b/drivers/sysreset/sysreset_rv1108.c
deleted file mode 100644
index 9d8e9f7ade..0000000000
--- a/drivers/sysreset/sysreset_rv1108.c
+++ /dev/null
@@ -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,
-};