Re: [U-Boot] [U-Boot,03/13] rockchip: rk3066: add sysreset driver

2017-07-06 Thread Simon Glass
On 4 July 2017 at 11:41, Philipp Tomsich
 wrote:
>
> Looks like we're ending up with a lot of sysreset_rk3***.o drivers here that
> all have more or less the same logic in them.  This one looks like a
> verbatim copy of the RK3188 one...
>
> Can we start deduplicating this and have rk3188/rk3066_sysreset_request as a
> common function that is  parameterised using register offsets from a
> driver-data structure?
>
> As a side-note: I think I need to do the same for the other ones (i.e.
> RK32xx and RK33xx sysreset drivers that are basically copy-and-paste...) for
> the next iteration.

Sounds good!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,03/13] rockchip: rk3066: add sysreset driver

2017-07-04 Thread Philipp Tomsich


Looks like we're ending up with a lot of sysreset_rk3***.o drivers here 
that all have more or less the same logic in them.  This one looks like a 
verbatim copy of the RK3188 one...


Can we start deduplicating this and have rk3188/rk3066_sysreset_request 
as a common function that is  parameterised using register offsets from a 
driver-data structure?


As a side-note: I think I need to do the same for the other ones (i.e.
RK32xx and RK33xx sysreset drivers that are basically copy-and-paste...) 
for the next iteration.


On Tue, 6 Jun 2017, Paweł Jarosz wrote:


Add support for system reset for rk3066 socs.

Signed-off-by: Paweł Jarosz 
Reviewed-by: Simon Glass 
Acked-by: Philipp Tomsich 
---
drivers/sysreset/Makefile  |  1 +
drivers/sysreset/sysreset_rk3066.c | 62 ++
2 files changed, 63 insertions(+)
create mode 100644 drivers/sysreset/sysreset_rk3066.c

diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile
index b683811..d138278 100644
--- a/drivers/sysreset/Makefile
+++ b/drivers/sysreset/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.o
ifndef CONFIG_SPL_BUILD
obj-$(CONFIG_ROCKCHIP_RK3036) += sysreset_rk3036.o
endif
+obj-$(CONFIG_ROCKCHIP_RK3066) += sysreset_rk3066.o
obj-$(CONFIG_ROCKCHIP_RK3188) += sysreset_rk3188.o
obj-$(CONFIG_ROCKCHIP_RK3288) += sysreset_rk3288.o
obj-$(CONFIG_ROCKCHIP_RK3328) += sysreset_rk3328.o
diff --git a/drivers/sysreset/sysreset_rk3066.c 
b/drivers/sysreset/sysreset_rk3066.c
new file mode 100644
index 000..79f9e4f
--- /dev/null
+++ b/drivers/sysreset/sysreset_rk3066.c
@@ -0,0 +1,62 @@
+/*
+ * (C) Copyright 2015 Google, Inc
+ *
+ * SPDX-License-Identifier:GPL-2.0
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int rk3066_sysreset_request(struct udevice *dev, enum sysreset_t type)
+{
+   struct rk3066_cru *cru = rockchip_get_cru();
+   struct rk3066_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(>soc_con0,
+   NOC_REMAP_MASK << NOC_REMAP_SHIFT,
+   0 << NOC_REMAP_SHIFT);
+
+   rk_clrreg(>cru_mode_con, 0x);
+   writel(0xeca8, >cru_glb_srst_snd_value);
+   break;
+   case SYSRESET_COLD:
+   rk_clrreg(>cru_mode_con, 0x);
+   writel(0xfdb9, >cru_glb_srst_fst_value);
+   break;
+   default:
+   return -EPROTONOSUPPORT;
+   }
+
+   return -EINPROGRESS;
+}
+
+static struct sysreset_ops rk3066_sysreset = {
+   .request= rk3066_sysreset_request,
+};
+
+U_BOOT_DRIVER(sysreset_rk3066) = {
+   .name   = "rk3066_sysreset",
+   .id = UCLASS_SYSRESET,
+   .ops= _sysreset,
+};


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,03/13] rockchip: rk3066: add sysreset driver

2017-06-25 Thread Philipp Tomsich
> Add support for system reset for rk3066 socs.
> 
> Signed-off-by: Paweł Jarosz 
> Reviewed-by: Simon Glass 
> ---
>  drivers/sysreset/Makefile  |  1 +
>  drivers/sysreset/sysreset_rk3066.c | 62 
> ++
>  2 files changed, 63 insertions(+)
>  create mode 100644 drivers/sysreset/sysreset_rk3066.c
> 

Acked-by: Philipp Tomsich 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot