[{"id":1776885,"web_url":"http://patchwork.ozlabs.org/comment/1776885/","msgid":"<alpine.OSX.2.21.1709281048080.44904@vpn-10-11-0-14.lan>","list_archive_url":null,"date":"2017-09-28T08:54:59","subject":"Re: [U-Boot] [U-Boot,5/8] rockchip: rk3128: add sysreset driver","submitter":{"id":53488,"url":"http://patchwork.ozlabs.org/api/people/53488/","name":"Philipp Tomsich","email":"philipp.tomsich@theobroma-systems.com"},"content":"On Wed, 27 Sep 2017, Kever Yang wrote:\n\n> Add rk3128 sysreset driver.\n>\n> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>\n\nThis duplicates existing driver code, see below.\n\n> ---\n>\n> drivers/sysreset/Makefile          |  1 +\n> drivers/sysreset/sysreset_rk3128.c | 45 ++++++++++++++++++++++++++++++++++++++\n> 2 files changed, 46 insertions(+)\n> create mode 100644 drivers/sysreset/sysreset_rk3128.c\n>\n> diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile\n> index ce161a7..e3a0ab1 100644\n> --- a/drivers/sysreset/Makefile\n> +++ b/drivers/sysreset/Makefile\n> @@ -12,6 +12,7 @@ obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.o\n> ifndef CONFIG_SPL_BUILD\n> obj-$(CONFIG_ROCKCHIP_RK3036) += sysreset_rk3036.o\n> endif\n> +obj-$(CONFIG_ROCKCHIP_RK3128) += sysreset_rk3128.o\n> obj-$(CONFIG_ROCKCHIP_RK3188) += sysreset_rk3188.o\n> obj-$(CONFIG_ROCKCHIP_RK322X) += sysreset_rk322x.o\n> obj-$(CONFIG_ROCKCHIP_RK3288) += sysreset_rk3288.o\n> diff --git a/drivers/sysreset/sysreset_rk3128.c b/drivers/sysreset/sysreset_rk3128.c\n> new file mode 100644\n> index 0000000..5aab8ec\n> --- /dev/null\n> +++ b/drivers/sysreset/sysreset_rk3128.c\n> @@ -0,0 +1,45 @@\n> +/*\n> + * (C) Copyright 2017 Rockchip Electronics Co., Ltd\n> + *\n> + * SPDX-License-Identifier:     GPL-2.0+\n> + */\n> +\n> +#include <common.h>\n> +#include <dm.h>\n> +#include <errno.h>\n> +#include <sysreset.h>\n> +#include <asm/io.h>\n> +#include <asm/arch/clock.h>\n> +#include <asm/arch/cru_rk3128.h>\n> +#include <asm/arch/hardware.h>\n> +#include <linux/err.h>\n> +\n> +int rk3128_sysreset_request(struct udevice *dev, enum sysreset_t type)\n> +{\n> +\tstruct rk3128_cru *cru = rockchip_get_cru();\n> +\n> +\tif (IS_ERR(cru))\n> +\t\treturn PTR_ERR(cru);\n> +\tswitch (type) {\n> +\tcase SYSRESET_WARM:\n> +\t\twritel(0xeca8, &cru->cru_glb_srst_snd_value);\n> +\t\tbreak;\n> +\tcase SYSRESET_COLD:\n> +\t\twritel(0xfdb9, &cru->cru_glb_srst_fst_value);\n> +\t\tbreak;\n> +\tdefault:\n> +\t\treturn -EPROTONOSUPPORT;\n> +\t}\n> +\n> +\treturn -EINPROGRESS;\n> +}\n\nThis is verbatim the same code (with the other rk3xxx variant replaced \nwith rk3128 in all function names, structures and include-header) as for \nthe RK3328, RK322x, RK3399, RK3036 (and possibly others that I may have \nmissed).\n\nCould we merge these and use driver_data to find the appropriate offset \ninto each CRU?\n\nFrom what I have seen, these drivers are always bound dynamically from the \nrespective clk_rk3xxx driver, so it should be easy to inject the correct \noffset values for the two fields controlling reset (cru_glb_srst_snd_value, \ncru_glb_srst_fst_value) when binding the driver using and offsetof().\n\n> +\n> +static struct sysreset_ops rk3128_sysreset = {\n> +\t.request\t= rk3128_sysreset_request,\n> +};\n> +\n> +U_BOOT_DRIVER(sysreset_rk3128) = {\n> +\t.name\t= \"rk3128_sysreset\",\n> +\t.id\t= UCLASS_SYSRESET,\n> +\t.ops\t= &rk3128_sysreset,\n> +};\n>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y2pRn3rcbz9t2Q\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 28 Sep 2017 18:55:17 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid E8E32C21D99; Thu, 28 Sep 2017 08:55:12 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 64C10C21D09;\n\tThu, 28 Sep 2017 08:55:10 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 107FFC21D09; Thu, 28 Sep 2017 08:55:09 +0000 (UTC)","from mail.theobroma-systems.com (vegas.theobroma-systems.com\n\t[144.76.126.164])\n\tby lists.denx.de (Postfix) with ESMTPS id C583FC21CB1\n\tfor <u-boot@lists.denx.de>; Thu, 28 Sep 2017 08:55:08 +0000 (UTC)","from [86.59.122.178] (port=47099 helo=android.lan)\n\tby mail.theobroma-systems.com with esmtps\n\t(TLS1.2:RSA_AES_128_CBC_SHA1:128)\n\t(Exim 4.80) (envelope-from <philipp.tomsich@theobroma-systems.com>)\n\tid 1dxUay-0008S0-Iy; Thu, 28 Sep 2017 10:55:00 +0200","from [10.11.0.14] (helo=vpn-10-11-0-14.lan)\n\tby android.lan with esmtp (Exim 4.84_2)\n\t(envelope-from <philipp.tomsich@theobroma-systems.com>)\n\tid 1dxUay-000DpJ-4F; Thu, 28 Sep 2017 10:55:00 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=none autolearn=unavailable\n\tautolearn_force=no version=3.4.0","Date":"Thu, 28 Sep 2017 10:54:59 +0200 (CEST)","From":"Philipp Tomsich <philipp.tomsich@theobroma-systems.com>","X-X-Sender":"ptomsich@vpn-10-11-0-14.lan","To":"Kever Yang <kever.yang@rock-chips.com>","In-Reply-To":"<1506515969-1472-6-git-send-email-kever.yang@rock-chips.com>","Message-ID":"<alpine.OSX.2.21.1709281048080.44904@vpn-10-11-0-14.lan>","References":"<1506515969-1472-6-git-send-email-kever.yang@rock-chips.com>","User-Agent":"Alpine 2.21 (OSX 202 2017-01-01)","MIME-Version":"1.0","Cc":"u-boot@lists.denx.de, Andy Yan <andy.yan@rock-chips.com>","Subject":"Re: [U-Boot] [U-Boot,5/8] rockchip: rk3128: add sysreset driver","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Transfer-Encoding":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1781754,"web_url":"http://patchwork.ozlabs.org/comment/1781754/","msgid":"<E1e0UuP-000576-Tf@mail.theobroma-systems.com>","list_archive_url":null,"date":"2017-10-06T15:51:30","subject":"Re: [U-Boot] [U-Boot,5/8] rockchip: rk3128: add sysreset driver","submitter":{"id":53488,"url":"http://patchwork.ozlabs.org/api/people/53488/","name":"Philipp Tomsich","email":"philipp.tomsich@theobroma-systems.com"},"content":"> Add rk3128 sysreset driver.\n> \n> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>\n> ---\n> \n>  drivers/sysreset/Makefile          |  1 +\n>  drivers/sysreset/sysreset_rk3128.c | 45 ++++++++++++++++++++++++++++++++++++++\n>  2 files changed, 46 insertions(+)\n>  create mode 100644 drivers/sysreset/sysreset_rk3128.c\n> \n\nAcked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y7vP437C8z9s7G\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  7 Oct 2017 02:55:36 +1100 (AEDT)","by lists.denx.de (Postfix, from userid 105)\n\tid 1C2DBC21DCA; Fri,  6 Oct 2017 15:53:27 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id C9A5CC21CB6;\n\tFri,  6 Oct 2017 15:51:47 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 538CEC21DCE; Fri,  6 Oct 2017 15:51:34 +0000 (UTC)","from mail.theobroma-systems.com (vegas.theobroma-systems.com\n\t[144.76.126.164])\n\tby lists.denx.de (Postfix) with ESMTPS id 4893CC21CB6\n\tfor <u-boot@lists.denx.de>; Fri,  6 Oct 2017 15:51:31 +0000 (UTC)","from 89-104-28-141.customer.bnet.at ([89.104.28.141]:51590\n\thelo=vpn-10-11-0-14.lan) by mail.theobroma-systems.com with esmtpsa\n\t(TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80)\n\t(envelope-from <philipp.tomsich@theobroma-systems.com>)\n\tid 1e0UuP-000576-Tf; Fri, 06 Oct 2017 17:51:30 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=none autolearn=unavailable\n\tautolearn_force=no version=3.4.0","MIME-Version":"1.0","From":"Philipp Tomsich <philipp.tomsich@theobroma-systems.com>","To":"Kever Yang <kever.yang@rock-chips.com>","In-Reply-To":"<1506515969-1472-6-git-send-email-kever.yang@rock-chips.com>","References":"<1506515969-1472-6-git-send-email-kever.yang@rock-chips.com>","Message-Id":"<E1e0UuP-000576-Tf@mail.theobroma-systems.com>","Date":"Fri, 06 Oct 2017 17:51:30 +0200","Cc":"u-boot@lists.denx.de, Andy Yan <andy.yan@rock-chips.com>","Subject":"Re: [U-Boot] [U-Boot,5/8] rockchip: rk3128: add sysreset driver","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1809290,"web_url":"http://patchwork.ozlabs.org/comment/1809290/","msgid":"<alpine.OSX.2.21.1711231456020.23650@vpn-10-11-0-14.lan>","list_archive_url":null,"date":"2017-11-23T13:56:43","subject":"Re: [U-Boot] [U-Boot,5/8] rockchip: rk3128: add sysreset driver","submitter":{"id":53488,"url":"http://patchwork.ozlabs.org/api/people/53488/","name":"Philipp Tomsich","email":"philipp.tomsich@theobroma-systems.com"},"content":"On Wed, 27 Sep 2017, Kever Yang wrote:\n\n> Add rk3128 sysreset driver.\n>\n> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>\n> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>\n\nReviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>\n\nSee below for requested changes.\n\n> ---\n>\n> drivers/sysreset/Makefile          |  1 +\n> drivers/sysreset/sysreset_rk3128.c | 45 ++++++++++++++++++++++++++++++++++++++\n> 2 files changed, 46 insertions(+)\n> create mode 100644 drivers/sysreset/sysreset_rk3128.c\n>\n> diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile\n> index ce161a7..e3a0ab1 100644\n> --- a/drivers/sysreset/Makefile\n> +++ b/drivers/sysreset/Makefile\n> @@ -12,6 +12,7 @@ obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.o\n> ifndef CONFIG_SPL_BUILD\n> obj-$(CONFIG_ROCKCHIP_RK3036) += sysreset_rk3036.o\n> endif\n> +obj-$(CONFIG_ROCKCHIP_RK3128) += sysreset_rk3128.o\n> obj-$(CONFIG_ROCKCHIP_RK3188) += sysreset_rk3188.o\n> obj-$(CONFIG_ROCKCHIP_RK322X) += sysreset_rk322x.o\n> obj-$(CONFIG_ROCKCHIP_RK3288) += sysreset_rk3288.o\n\nPlease update for the new common sysreset driver.\n\n> diff --git a/drivers/sysreset/sysreset_rk3128.c b/drivers/sysreset/sysreset_rk3128.c\n> new file mode 100644\n> index 0000000..5aab8ec\n> --- /dev/null\n> +++ b/drivers/sysreset/sysreset_rk3128.c\n> @@ -0,0 +1,45 @@\n> +/*\n> + * (C) Copyright 2017 Rockchip Electronics Co., Ltd\n> + *\n> + * SPDX-License-Identifier:     GPL-2.0+\n> + */\n> +\n> +#include <common.h>\n> +#include <dm.h>\n> +#include <errno.h>\n> +#include <sysreset.h>\n> +#include <asm/io.h>\n> +#include <asm/arch/clock.h>\n> +#include <asm/arch/cru_rk3128.h>\n> +#include <asm/arch/hardware.h>\n> +#include <linux/err.h>\n> +\n> +int rk3128_sysreset_request(struct udevice *dev, enum sysreset_t type)\n> +{\n> +\tstruct rk3128_cru *cru = rockchip_get_cru();\n> +\n> +\tif (IS_ERR(cru))\n> +\t\treturn PTR_ERR(cru);\n> +\tswitch (type) {\n> +\tcase SYSRESET_WARM:\n> +\t\twritel(0xeca8, &cru->cru_glb_srst_snd_value);\n> +\t\tbreak;\n> +\tcase SYSRESET_COLD:\n> +\t\twritel(0xfdb9, &cru->cru_glb_srst_fst_value);\n> +\t\tbreak;\n> +\tdefault:\n> +\t\treturn -EPROTONOSUPPORT;\n> +\t}\n> +\n> +\treturn -EINPROGRESS;\n> +}\n> +\n> +static struct sysreset_ops rk3128_sysreset = {\n> +\t.request\t= rk3128_sysreset_request,\n> +};\n> +\n> +U_BOOT_DRIVER(sysreset_rk3128) = {\n> +\t.name\t= \"rk3128_sysreset\",\n> +\t.id\t= UCLASS_SYSRESET,\n> +\t.ops\t= &rk3128_sysreset,\n> +};\n>\n\nSame.","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3yjLV55Qjhz9s5L\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 24 Nov 2017 00:57:01 +1100 (AEDT)","by lists.denx.de (Postfix, from userid 105)\n\tid 660EBC21F84; Thu, 23 Nov 2017 13:56:59 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 13088C21F79;\n\tThu, 23 Nov 2017 13:56:58 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid D1C36C21F78; Thu, 23 Nov 2017 13:56:53 +0000 (UTC)","from mail.theobroma-systems.com (vegas.theobroma-systems.com\n\t[144.76.126.164])\n\tby lists.denx.de (Postfix) with ESMTPS id 33402C21F7E\n\tfor <u-boot@lists.denx.de>; Thu, 23 Nov 2017 13:56:45 +0000 (UTC)","from [86.59.122.178] (port=58663 helo=android.lan)\n\tby mail.theobroma-systems.com with esmtps\n\t(TLS1.2:RSA_AES_128_CBC_SHA1:128)\n\t(Exim 4.80) (envelope-from <philipp.tomsich@theobroma-systems.com>)\n\tid 1eHrzf-00028Q-Qf; Thu, 23 Nov 2017 14:56:43 +0100","from [10.11.0.14] (helo=vpn-10-11-0-14.lan)\n\tby android.lan with esmtp (Exim 4.84_2)\n\t(envelope-from <philipp.tomsich@theobroma-systems.com>)\n\tid 1eHrzf-000DDR-CV; Thu, 23 Nov 2017 14:56:43 +0100"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=none autolearn=unavailable\n\tautolearn_force=no version=3.4.0","Date":"Thu, 23 Nov 2017 14:56:43 +0100 (CET)","From":"Philipp Tomsich <philipp.tomsich@theobroma-systems.com>","X-X-Sender":"ptomsich@vpn-10-11-0-14.lan","To":"Kever Yang <kever.yang@rock-chips.com>","In-Reply-To":"<1506515969-1472-6-git-send-email-kever.yang@rock-chips.com>","Message-ID":"<alpine.OSX.2.21.1711231456020.23650@vpn-10-11-0-14.lan>","References":"<1506515969-1472-6-git-send-email-kever.yang@rock-chips.com>","User-Agent":"Alpine 2.21 (OSX 202 2017-01-01)","MIME-Version":"1.0","Cc":"u-boot@lists.denx.de, Andy Yan <andy.yan@rock-chips.com>","Subject":"Re: [U-Boot] [U-Boot,5/8] rockchip: rk3128: add sysreset driver","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Transfer-Encoding":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}}]