All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Stuebner <heiko@sntech.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 12/20] rockchip: rk3188: Add sysreset driver
Date: Sat, 18 Feb 2017 19:46:32 +0100	[thread overview]
Message-ID: <20170218184640.30635-13-heiko@sntech.de> (raw)
In-Reply-To: <20170218184640.30635-1-heiko@sntech.de>

Driver for the sysreset of Rockchip rk3188 socs.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
---
 drivers/sysreset/Makefile          |  1 +
 drivers/sysreset/sysreset_rk3188.c | 47 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)
 create mode 100644 drivers/sysreset/sysreset_rk3188.c

diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile
index fa75cc52de..30f1bce390 100644
--- a/drivers/sysreset/Makefile
+++ b/drivers/sysreset/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_SYSRESET) += sysreset-uclass.o
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_ROCKCHIP_RK3036) += sysreset_rk3036.o
 endif
+obj-$(CONFIG_ROCKCHIP_RK3188) += sysreset_rk3188.o
 obj-$(CONFIG_ROCKCHIP_RK3288) += sysreset_rk3288.o
 obj-$(CONFIG_ROCKCHIP_RK3399) += sysreset_rk3399.o
 obj-$(CONFIG_SANDBOX) += sysreset_sandbox.o
diff --git a/drivers/sysreset/sysreset_rk3188.c b/drivers/sysreset/sysreset_rk3188.c
new file mode 100644
index 0000000000..36ae47600a
--- /dev/null
+++ b/drivers/sysreset/sysreset_rk3188.c
@@ -0,0 +1,47 @@
+/*
+ * (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_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();
+
+	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 rk3188_sysreset = {
+	.request	= rk3188_sysreset_request,
+};
+
+U_BOOT_DRIVER(sysreset_rk3188) = {
+	.name	= "rk3188_sysreset",
+	.id	= UCLASS_SYSRESET,
+	.ops	= &rk3188_sysreset,
+};
-- 
2.11.0

  parent reply	other threads:[~2017-02-18 18:46 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-18 18:46 [U-Boot] [PATCH v4 00/20] rk3188 uboot support Heiko Stuebner
2017-02-18 18:46 ` [U-Boot] [PATCH v4 01/20] dm: allow limiting pre-reloc markings to spl or tpl Heiko Stuebner
2017-02-21 20:34   ` Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 02/20] clk: rk3288: limit gpll and cpll init to SPL build Heiko Stuebner
2017-02-21 18:08   ` Simon Glass
2017-02-21 20:34     ` Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 03/20] rockchip: rk3288: sdram: use constants in ddrconf table Heiko Stuebner
2017-02-21 18:08   ` Simon Glass
2017-02-21 20:34     ` Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 04/20] rockchip: rk3288: sdram: style fixes from rk3188 sdram review Heiko Stuebner
2017-02-21 18:08   ` Simon Glass
2017-02-21 20:34     ` Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 05/20] rockchip: Move bootrom helper compilation to a hidden option Heiko Stuebner
2017-02-21 20:34   ` Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 06/20] rockchip: Move bootrom-related declarations to a header Heiko Stuebner
2017-02-21 20:34   ` Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 07/20] rockchip: mkimage: Allow encoding of loader code in spl images Heiko Stuebner
2017-02-21 20:34   ` Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 08/20] rockchip: mkimage: Add support rk3188 serial Heiko Stuebner
2017-02-21 20:34   ` Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 09/20] rockchip: serial: Adapt rockchip of-platdata driver for rk3188 Heiko Stuebner
2017-02-21 20:34   ` Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 10/20] rockchip: rk3188: Add header files for PMU and GRF Heiko Stuebner
2017-02-21 20:35   ` Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 11/20] rockchip: rk3188: Add pinctrl driver Heiko Stuebner
2017-02-21 20:35   ` Simon Glass
2017-02-18 18:46 ` Heiko Stuebner [this message]
2017-02-21 20:35   ` [U-Boot] [PATCH v4 12/20] rockchip: rk3188: Add sysreset driver Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 13/20] rockchip: rk3188: Add rk3066/rk3188 clock bindings Heiko Stuebner
2017-02-21 20:35   ` Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 14/20] rockchip: rk3188: Add clock driver Heiko Stuebner
2017-02-18 18:46 ` [U-Boot] [PATCH v4 15/20] rockchip: rk3188: Add core devicetree files Heiko Stuebner
2017-02-21 20:35   ` Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 16/20] rockchip: rk3188: Add core support Heiko Stuebner
2017-02-21 20:35   ` Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 17/20] rockchip: rk3188: Add sdram driver Heiko Stuebner
2017-02-21 20:35   ` Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 18/20] rockchip: rk3188: Add main, spl and tpl boards Heiko Stuebner
2017-02-21 20:35   ` Simon Glass
2017-02-18 18:46 ` [U-Boot] [PATCH v4 19/20] rockchip: rk3188: Add Radxa Rock board Heiko Stuebner
2017-02-21 20:35   ` Simon Glass
2017-03-23 16:18     ` Simon Glass
2017-03-23 16:34       ` Heiko Stübner
2017-02-18 18:46 ` [U-Boot] [PATCH v4 20/20] rockchip: rk3188: add README.rockchip paragraph describing sd boot Heiko Stuebner
2017-02-21 18:08   ` Simon Glass
2017-02-21 20:35     ` Simon Glass
2017-02-23  3:26 ` [U-Boot] [PATCH v4 00/20] rk3188 uboot support Simon Glass
2017-02-23  3:59   ` Heiko Stuebner
2017-02-23 16:19     ` Simon Glass
2017-02-23 16:29       ` Heiko Stuebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170218184640.30635-13-heiko@sntech.de \
    --to=heiko@sntech.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.