From patchwork Thu Jan 19 01:59:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoyou Xie X-Patchwork-Id: 91836 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp67269qgi; Wed, 18 Jan 2017 18:00:45 -0800 (PST) X-Received: by 10.84.216.91 with SMTP id f27mr9539505plj.92.1484791245361; Wed, 18 Jan 2017 18:00:45 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id f12si1938178pln.227.2017.01.18.18.00.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jan 2017 18:00:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cU21s-0000TG-4h; Thu, 19 Jan 2017 02:00:44 +0000 Received: from mail-pg0-x229.google.com ([2607:f8b0:400e:c05::229]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cU21m-0008W4-W4 for linux-arm-kernel@lists.infradead.org; Thu, 19 Jan 2017 02:00:41 +0000 Received: by mail-pg0-x229.google.com with SMTP id 194so9321021pgd.2 for ; Wed, 18 Jan 2017 18:00:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=jeq5Jy2FUiDTw6MRndXACEUX1newYWdsMkWkdTSQrtA=; b=JP6Tybp+FQsD2Kfio9VEYbqSAZY8sztgzK/c2IoLRHuc4Rezo9dQY8SEc7qB81ccdz 3ETMAqtzFfucakNEmMNuGZb2VMvkMJz9PYxfyKrMHFudu3qM0s4W0XGk952U0WPNe5dY uBpiL273i9Z29WnRQ14dMvfeBxQzu0UWTJxG0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=jeq5Jy2FUiDTw6MRndXACEUX1newYWdsMkWkdTSQrtA=; b=bUv/io/MrYFj5auh9rF5Ac8DdgiMn+pGukT13afQu4JZWSNgu7LVyLWaptrduKbSDi HiPkQeUWEXDdRwlRrL/xf0YhfimvNEX4u4jJw/x5ncfkuu+SAq1HVZFzyRNc6mdK9Xox ben+atRP4bwN3DLGCEjcWW9U+TVeeVOvlDzvsbXhPUdHQdb9IEZG9/+5chcUq1elU8uf GNoJlw9J9jy0dDk9W5WJi6yf1Bgsq0kuFVX14OtrJ0I/EWye55l5iQfwVBM/RjzrqqW8 RnQi8Q5nOhT8sbDsI0mL9Zqett+3MEMz/ictQw6teLjeX/Q7z+muDzm+OLA4Qlil8ZPA JZcw== X-Gm-Message-State: AIkVDXJVsh14QICMYP6YY/9HVO1iJUjgBE8it2ljTPc/VsXpYNF7X0HroF2llPe+xKCg+mov X-Received: by 10.99.47.199 with SMTP id v190mr7534177pgv.26.1484791217741; Wed, 18 Jan 2017 18:00:17 -0800 (PST) Received: from localhost.localdomain ([104.237.91.131]) by smtp.gmail.com with ESMTPSA id 66sm3526114pgg.47.2017.01.18.18.00.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Jan 2017 18:00:17 -0800 (PST) From: Baoyou Xie To: jun.nie@linaro.org, wim@iguana.be, linux@roeck-us.net, robh+dt@kernel.org, mark.rutland@arm.com Subject: [PATCH v2 1/3] dt: bindings: add documentation for zx2967 family watchdog controller Date: Thu, 19 Jan 2017 09:59:50 +0800 Message-Id: <1484791192-31674-1-git-send-email-baoyou.xie@linaro.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170118_180039_066569_96279F4B X-CRM114-Status: GOOD ( 13.00 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 HK_RANDOM_ENVFROM Envelope sender username looks random -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-watchdog@vger.kernel.org, xie.baoyou@zte.com.cn, linux-kernel@vger.kernel.org, chen.chaokai@zte.com.cn, wang.qiang01@zte.com.cn, baoyou.xie@linaro.org, shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org This patch adds dt-binding documentation for zx2967 family watchdog controller. Signed-off-by: Baoyou Xie --- .../bindings/watchdog/zte,zx2967-wdt.txt | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Documentation/devicetree/bindings/watchdog/zte,zx2967-wdt.txt -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/Documentation/devicetree/bindings/watchdog/zte,zx2967-wdt.txt b/Documentation/devicetree/bindings/watchdog/zte,zx2967-wdt.txt new file mode 100644 index 0000000..6e35ce7 --- /dev/null +++ b/Documentation/devicetree/bindings/watchdog/zte,zx2967-wdt.txt @@ -0,0 +1,32 @@ +ZTE zx2967 Watchdog timer + +Required properties: + +- compatible : should be one of the following. + * zte,zx296718-wdt +- reg : Specifies base physical address and size of the registers. +- clocks : Pairs of phandle and specifier referencing the controller's clocks. +- clock-names: "wdtclk" for the watchdog clock. +- resets : Reference to the reset controller controlling the watchdog + controller. +- reset-names : Must include the following entries: + * wdtrst + +Optional properties: + +- wdt-reset-sysctrl : should include following fields. + * phandle of aon-sysctrl. + * configuare value that be wrote to aon-sysctrl. + * bit mask, corresponding bits will be affected. + +Example: + +wdt_ares: watchdog@1465000 { + compatible = "zte,zx296718-wdt"; + reg = <0x1465000 0x1000>; + clocks = <&topcrm WDT_WCLK>; + clock-names = "wdtclk"; + resets = <&toprst 35>; + reset-names = "wdtrst"; + wdt-reset-sysctrl = <&aon_sysctrl 1 0x115>; +}; From patchwork Thu Jan 19 01:59:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoyou Xie X-Patchwork-Id: 91837 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp67362qgi; Wed, 18 Jan 2017 18:00:58 -0800 (PST) X-Received: by 10.84.217.133 with SMTP id p5mr9534972pli.164.1484791258266; Wed, 18 Jan 2017 18:00:58 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id 3si659657plz.256.2017.01.18.18.00.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jan 2017 18:00:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cU224-0000kd-DM; Thu, 19 Jan 2017 02:00:56 +0000 Received: from mail-pg0-x22e.google.com ([2607:f8b0:400e:c05::22e]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cU21v-0000PP-7g for linux-arm-kernel@lists.infradead.org; Thu, 19 Jan 2017 02:00:49 +0000 Received: by mail-pg0-x22e.google.com with SMTP id t6so9300849pgt.3 for ; Wed, 18 Jan 2017 18:00:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Bp3j5DodJQ5kA+onWaBYsyhHHbKAkehXcC9DybKAhV4=; b=iKe+ypA1lm4J4MQnQt5oM1fTwZ/BV30tB669u9CWeASNrhWgIbjQYpSCvRsuqUvk0J zKe3jdMUHvD7pBpEptU/n3QzSnfsZEJH+oq47/TW8QDWo9pJQ0IsFgjzQL9ORIpSonca 4VkJlOAbGv2HxA8Hk/yg+rLhif60F7cnhZUSE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Bp3j5DodJQ5kA+onWaBYsyhHHbKAkehXcC9DybKAhV4=; b=ew0lI9e/bcc7Ce8zcJ/x90MUX1ClCK/hLfmHtsreY8FXzD/Z9DWVIB099xvJq8mgsw KCX/93x/UoVve973rlkFLa4+FfLB1TmZaQLq55ksa4/MVaI1p2827rEQWeZdg46kB2Nd HNzdhYS3HxReZbdyjhbBxE0SNqSw49jq2TdDBMfSbKLsEPXrD7ruxlNdUxy6qspeodl6 piCYDbB6riFFeQf9uPp5llsDFbRGrR5n1OPPiKFikNI30g/IcWHbXYLhGdrYi7Qh++Xq 1JYwGNTSonQrFoXuMedi/XO/srQarza9oblqGLaNXYmq5/GC/kE7hDiL5MHvJ3sbpIb4 9VVg== X-Gm-Message-State: AIkVDXJwbexfU7ZwkVfgKCutMtWv6PRVjtgGvvBhJ27MLGBOnHwViBnx0DLun2VfALbLRolj X-Received: by 10.84.224.133 with SMTP id s5mr9671921plj.130.1484791226713; Wed, 18 Jan 2017 18:00:26 -0800 (PST) Received: from localhost.localdomain ([104.237.91.131]) by smtp.gmail.com with ESMTPSA id 66sm3526114pgg.47.2017.01.18.18.00.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Jan 2017 18:00:26 -0800 (PST) From: Baoyou Xie To: jun.nie@linaro.org, wim@iguana.be, linux@roeck-us.net, robh+dt@kernel.org, mark.rutland@arm.com Subject: [PATCH v2 2/3] MAINTAINERS: add zx2967 watchdog controller driver to ARM ZTE architecture Date: Thu, 19 Jan 2017 09:59:51 +0800 Message-Id: <1484791192-31674-2-git-send-email-baoyou.xie@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484791192-31674-1-git-send-email-baoyou.xie@linaro.org> References: <1484791192-31674-1-git-send-email-baoyou.xie@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170118_180047_355389_AED08F46 X-CRM114-Status: UNSURE ( 9.05 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c05:0:0:0:22e listed in] [list.dnswl.org] 0.0 HK_RANDOM_ENVFROM Envelope sender username looks random -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-watchdog@vger.kernel.org, xie.baoyou@zte.com.cn, linux-kernel@vger.kernel.org, chen.chaokai@zte.com.cn, wang.qiang01@zte.com.cn, baoyou.xie@linaro.org, shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Add the zx2967 watchdog controller driver as maintained by ARM ZTE architecture maintainers, as they're parts of the core IP. Signed-off-by: Baoyou Xie --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/MAINTAINERS b/MAINTAINERS index edfdea3..275c434 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1990,11 +1990,13 @@ F: drivers/clk/zte/ F: drivers/reset/reset-zx2967.c F: drivers/soc/zte/ F: drivers/thermal/zx* +F: drivers/watchdog/zx2967_wdt.c F: Documentation/devicetree/bindings/arm/zte.txt F: Documentation/devicetree/bindings/clock/zx296702-clk.txt F: Documentation/devicetree/bindings/reset/zte,zx2967-reset.txt F: Documentation/devicetree/bindings/soc/zte/ F: Documentation/devicetree/bindings/thermal/zx* +F: Documentation/devicetree/bindings/watchdog/zte,zx2967-wdt.txt F: include/dt-bindings/soc/zx*.h ARM/ZYNQ ARCHITECTURE From patchwork Thu Jan 19 01:59:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoyou Xie X-Patchwork-Id: 91838 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp67815qgi; Wed, 18 Jan 2017 18:02:15 -0800 (PST) X-Received: by 10.99.4.71 with SMTP id 68mr7415107pge.77.1484791335580; Wed, 18 Jan 2017 18:02:15 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id g2si1944266pgf.153.2017.01.18.18.02.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jan 2017 18:02:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cU23K-0001Dc-LN; Thu, 19 Jan 2017 02:02:14 +0000 Received: from mail-pg0-x230.google.com ([2607:f8b0:400e:c05::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cU225-0000SC-Bq for linux-arm-kernel@lists.infradead.org; Thu, 19 Jan 2017 02:01:01 +0000 Received: by mail-pg0-x230.google.com with SMTP id 194so9323805pgd.2 for ; Wed, 18 Jan 2017 18:00:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=a29VBpeI+GStof6TphGy+mOO3pfQwdW/JS7p5WHYqP8=; b=Wh1T6Dmnd0kiyJ12iTtK6BHlvsk/jSQrHo4kWi7Argp/MnJQU5VHj4CnTOIZu4UatG Kz93qVW1B3g8kLoWbr3WTovDsjCfG6z4Ly2FxIBHL9kMnuwh2wdhGOvVkczG3+MwtnZn EbEhZwC0//O2B+3bbKaSSnulXM61oRg/NnMKM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=a29VBpeI+GStof6TphGy+mOO3pfQwdW/JS7p5WHYqP8=; b=QfGEImVOsRmWbR1b577LKaGqHAJVD7RboEQCr8lz1B3hCKCu3hvyqevNmpXHzQEthy wUtfKheVNiYkXQ8tkBgqLCYoM8ktDrFHNe+SRUSkA3FuR7kcwbpCwM0GHickaVZlRWOW weXUgoWUs9k3zU/tihhv+4EsrPSfcEVmB9Tha7UvrWTBTNPdVUtjGOqZy3zkPN8or4cy eUAf0PwFmmtMCUn/lXBW5wy+41ut/rZw0ZTaxEF3qCFAdQvn2psLdQMSImOkNAllJL+f KHesthhvNlB0wu+OIkf0Kx7lZueEXmakfvvirybyLS1YTXdsscuqsrlB6xkZzUdX9sIv 1O9Q== X-Gm-Message-State: AIkVDXJg8VBabxIXvvsCDcURwCedjXUpedcJtTZYDigPa4uFZsK8DG6yR3tC9//O/XDRuOGQ X-Received: by 10.84.195.1 with SMTP id i1mr5076033pld.77.1484791236379; Wed, 18 Jan 2017 18:00:36 -0800 (PST) Received: from localhost.localdomain ([104.237.91.131]) by smtp.gmail.com with ESMTPSA id 66sm3526114pgg.47.2017.01.18.18.00.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Jan 2017 18:00:35 -0800 (PST) From: Baoyou Xie To: jun.nie@linaro.org, wim@iguana.be, linux@roeck-us.net, robh+dt@kernel.org, mark.rutland@arm.com Subject: [PATCH v2 3/3] watchdog: zx2967: add watchdog controller driver for ZTE's zx2967 family Date: Thu, 19 Jan 2017 09:59:52 +0800 Message-Id: <1484791192-31674-3-git-send-email-baoyou.xie@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484791192-31674-1-git-send-email-baoyou.xie@linaro.org> References: <1484791192-31674-1-git-send-email-baoyou.xie@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170118_180057_525570_2594F16F X-CRM114-Status: GOOD ( 21.85 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c05:0:0:0:230 listed in] [list.dnswl.org] 0.0 HK_RANDOM_ENVFROM Envelope sender username looks random -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-watchdog@vger.kernel.org, xie.baoyou@zte.com.cn, linux-kernel@vger.kernel.org, chen.chaokai@zte.com.cn, wang.qiang01@zte.com.cn, baoyou.xie@linaro.org, shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org This patch adds watchdog controller driver for ZTE's zx2967 family. Signed-off-by: Baoyou Xie --- drivers/watchdog/Kconfig | 10 ++ drivers/watchdog/Makefile | 1 + drivers/watchdog/zx2967_wdt.c | 383 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 394 insertions(+) create mode 100644 drivers/watchdog/zx2967_wdt.c -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index acb00b5..05093a2 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -714,6 +714,16 @@ config ASPEED_WATCHDOG To compile this driver as a module, choose M here: the module will be called aspeed_wdt. +config ZX2967_WATCHDOG + tristate "ZTE zx2967 SoCs watchdog support" + depends on ARCH_ZX + select WATCHDOG_CORE + help + Say Y here to include support for the watchdog timer + in ZTE zx2967 SoCs. + To compile this driver as a module, choose M here: the + module will be called zx2967_wdt. + # AVR32 Architecture config AT32AP700X_WDT diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 0c3d35e..bf2d296 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -82,6 +82,7 @@ obj-$(CONFIG_BCM7038_WDT) += bcm7038_wdt.o obj-$(CONFIG_ATLAS7_WATCHDOG) += atlas7_wdt.o obj-$(CONFIG_RENESAS_WDT) += renesas_wdt.o obj-$(CONFIG_ASPEED_WATCHDOG) += aspeed_wdt.o +obj-$(CONFIG_ZX2967_WATCHDOG) += zx2967_wdt.o # AVR32 Architecture obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o diff --git a/drivers/watchdog/zx2967_wdt.c b/drivers/watchdog/zx2967_wdt.c new file mode 100644 index 0000000..35eaecd --- /dev/null +++ b/drivers/watchdog/zx2967_wdt.c @@ -0,0 +1,383 @@ +/* + * watchdog driver for ZTE's zx2967 family + * + * Copyright (C) 2017 ZTE Ltd. + * + * Author: Baoyou Xie + * + * License terms: GNU General Public License (GPL) version 2 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ZX2967_WDT_CFG_REG 0x4 +#define ZX2967_WDT_LOAD_REG 0x8 +#define ZX2967_WDT_REFRESH_REG 0x18 +#define ZX2967_WDT_START_REG 0x1c + +#define ZX2967_WDT_REFRESH_MASK 0x3f + +#define ZX2967_WDT_CFG_DIV(n) ((((n) & 0xff) - 1) << 8) +#define ZX2967_WDT_START_EN 0x1 + +#define ZX2967_WDT_WRITEKEY 0x12340000 + +#define ZX2967_WDT_DIV_DEFAULT 16 +#define ZX2967_WDT_DEFAULT_TIMEOUT 32 +#define ZX2967_WDT_MIN_TIMEOUT 1 +#define ZX2967_WDT_MAX_TIMEOUT 500 +#define ZX2967_WDT_MAX_COUNT 0xffff + +#define ZX2967_WDT_FLAG_REBOOT_MON (1 << 0) + +#define ZX2967_RESET_MASK_REG 0xb0 + +struct zx2967_wdt { + struct device *dev; + struct clk *clock; + void __iomem *reg_base; + unsigned int conf; + unsigned int load; + unsigned int flags; + struct watchdog_device wdt_device; + struct notifier_block restart_handler; + struct notifier_block reboot_handler; +}; + +#define zx2967_wdt_read_reg(r) readl_relaxed(r) + +static inline void +zx2967_wdt_write_reg(u32 val, void __iomem *addr) +{ + writel_relaxed(val | ZX2967_WDT_WRITEKEY, addr); +} + +static void zx2967_wdt_refresh(struct zx2967_wdt *wdt) +{ + u32 val; + + val = zx2967_wdt_read_reg(wdt->reg_base + ZX2967_WDT_REFRESH_REG); + val ^= ZX2967_WDT_REFRESH_MASK; + zx2967_wdt_write_reg(val, wdt->reg_base + ZX2967_WDT_REFRESH_REG); +} + +static unsigned int +__zx2967_wdt_set_timeout(struct zx2967_wdt *wdt, unsigned int timeout) +{ + unsigned int freq = clk_get_rate(wdt->clock); + unsigned int divisor = ZX2967_WDT_DIV_DEFAULT; + unsigned int count; + + count = timeout * freq; + if (count > divisor * ZX2967_WDT_MAX_COUNT) + divisor = DIV_ROUND_UP(count, ZX2967_WDT_MAX_COUNT); + count = DIV_ROUND_UP(count, divisor); + zx2967_wdt_write_reg(ZX2967_WDT_CFG_DIV(divisor), + wdt->reg_base + ZX2967_WDT_CFG_REG); + zx2967_wdt_write_reg(count, wdt->reg_base + ZX2967_WDT_LOAD_REG); + zx2967_wdt_refresh(wdt); + wdt->load = count; + + return (count * divisor) / freq; +} + +static int zx2967_wdt_set_timeout(struct watchdog_device *wdd, + unsigned int timeout) +{ + struct zx2967_wdt *wdt = watchdog_get_drvdata(wdd); + + if (watchdog_timeout_invalid(&wdt->wdt_device, timeout)) { + dev_err(wdt->dev, "timeout %d is invalid\n", timeout); + return -EINVAL; + } + + wdd->timeout = __zx2967_wdt_set_timeout(wdt, timeout); + + return 0; +} + +static void __zx2967_wdt_start(struct zx2967_wdt *wdt) +{ + u32 val; + + val = zx2967_wdt_read_reg(wdt->reg_base + ZX2967_WDT_START_REG); + val |= ZX2967_WDT_START_EN; + zx2967_wdt_write_reg(val, wdt->reg_base + ZX2967_WDT_START_REG); +} + +static void __zx2967_wdt_stop(struct zx2967_wdt *wdt) +{ + u32 val; + + val = zx2967_wdt_read_reg(wdt->reg_base + ZX2967_WDT_START_REG); + val &= ~ZX2967_WDT_START_EN; + zx2967_wdt_write_reg(val, wdt->reg_base + ZX2967_WDT_START_REG); +} + +static int zx2967_wdt_start(struct watchdog_device *wdd) +{ + struct zx2967_wdt *wdt = watchdog_get_drvdata(wdd); + + __zx2967_wdt_stop(wdt); + zx2967_wdt_set_timeout(wdd, wdd->timeout); + __zx2967_wdt_start(wdt); + + return 0; +} + +static int zx2967_wdt_stop(struct watchdog_device *wdd) +{ + struct zx2967_wdt *wdt = watchdog_get_drvdata(wdd); + + __zx2967_wdt_stop(wdt); + + return 0; +} + +static int zx2967_wdt_keepalive(struct watchdog_device *wdd) +{ + struct zx2967_wdt *wdt = watchdog_get_drvdata(wdd); + + zx2967_wdt_refresh(wdt); + + return 0; +} + +#define ZX2967_WDT_OPTIONS \ + (WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE) +static const struct watchdog_info zx2967_wdt_ident = { + .options = ZX2967_WDT_OPTIONS, + .firmware_version = 0, + .identity = "zx2967 watchdog", +}; + +static struct watchdog_ops zx2967_wdt_ops = { + .owner = THIS_MODULE, + .start = zx2967_wdt_start, + .stop = zx2967_wdt_stop, + .ping = zx2967_wdt_keepalive, + .set_timeout = zx2967_wdt_set_timeout, +}; + +static void zx2967_wdt_fix_sysdown(struct zx2967_wdt *wdt) +{ + __zx2967_wdt_stop(wdt); + __zx2967_wdt_set_timeout(wdt, 15); + __zx2967_wdt_start(wdt); +} + +static int zx2967_wdt_notify_sys(struct notifier_block *this, + unsigned long code, void *unused) +{ + struct zx2967_wdt *wdt = container_of(this, struct zx2967_wdt, + reboot_handler); + + wdt->flags |= ZX2967_WDT_FLAG_REBOOT_MON; + switch (code) { + case SYS_HALT: + case SYS_POWER_OFF: + case SYS_RESTART: + zx2967_wdt_fix_sysdown(wdt); + break; + default: + break; + } + + return 0; +} + +static int zx2967_wdt_restart(struct notifier_block *this, + unsigned long mode, void *cmd) +{ + struct zx2967_wdt *wdt; + + wdt = container_of(this, struct zx2967_wdt, restart_handler); + + zx2967_wdt_stop(&wdt->wdt_device); + + zx2967_wdt_write_reg(0x80, wdt->reg_base + ZX2967_WDT_LOAD_REG); + zx2967_wdt_refresh(wdt); + zx2967_wdt_write_reg(ZX2967_WDT_START_EN, + wdt->reg_base + ZX2967_WDT_START_REG); + + zx2967_wdt_start(&wdt->wdt_device); + /* wait for reset*/ + mdelay(500); + + return NOTIFY_DONE; +} + +static void zx2967_wdt_reset_sysctrl(struct device *dev) +{ + int ret; + struct device_node *np = NULL; + void __iomem *regmap; + unsigned int val, mask, config; + struct of_phandle_args out_args; + + ret = of_parse_phandle_with_fixed_args(dev->of_node, + "wdt-reset-sysctrl", 2, 0, &out_args); + if (ret) { + dev_info(dev, "have no wdt-reset-sysctrl node"); + return; + } + config = out_args.args[0]; + mask = out_args.args[1]; + + regmap = syscon_node_to_regmap(out_args.np); + if (IS_ERR(regmap)) + goto out; + + ret = regmap_read(regmap, ZX2967_RESET_MASK_REG, &val); + + val &= ~mask; + val |= config; + regmap_write(regmap, ZX2967_RESET_MASK_REG, val); +out: + of_node_put(np); +} + +static int zx2967_wdt_probe(struct platform_device *pdev) +{ + struct device *dev; + struct zx2967_wdt *wdt; + struct resource *base; + int err, ret = 0; + unsigned int rate; + + struct reset_control *rstc; + + dev = &pdev->dev; + + wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + if (!wdt) + return -ENOMEM; + + platform_set_drvdata(pdev, wdt); + + wdt->dev = dev; + wdt->wdt_device.info = &zx2967_wdt_ident; + wdt->wdt_device.ops = &zx2967_wdt_ops; + wdt->wdt_device.timeout = ZX2967_WDT_DEFAULT_TIMEOUT; + wdt->wdt_device.max_timeout = ZX2967_WDT_MAX_TIMEOUT; + wdt->wdt_device.min_timeout = ZX2967_WDT_MIN_TIMEOUT; + wdt->wdt_device.parent = &pdev->dev; + + base = platform_get_resource(pdev, IORESOURCE_MEM, 0); + wdt->reg_base = devm_ioremap_resource(dev, base); + if (IS_ERR(wdt->reg_base)) { + dev_err(dev, "ioremap failed\n"); + return PTR_ERR(wdt->reg_base); + } + + zx2967_wdt_reset_sysctrl(dev); + + wdt->reboot_handler.notifier_call = zx2967_wdt_notify_sys; + ret = register_reboot_notifier(&wdt->reboot_handler); + wdt->clock = devm_clk_get(dev, "wdtclk"); + if (IS_ERR(wdt->clock)) { + dev_err(dev, "failed to find watchdog clock source\n"); + return PTR_ERR(wdt->clock); + } + ret = clk_prepare_enable(wdt->clock); + if (ret < 0) { + dev_err(dev, "failed to enable clock\n"); + return ret; + } + + rate = clk_get_rate(wdt->clock); + if (rate == 24000000) + clk_set_rate(wdt->clock, 32768); + + rstc = devm_reset_control_get(dev, "wdtrst"); + if (!rstc) { + dev_err(dev, "rstc get failed"); + } else { + reset_control_assert(rstc); + mdelay(10); + reset_control_deassert(rstc); + } + + watchdog_set_drvdata(&wdt->wdt_device, wdt); + + watchdog_init_timeout(&wdt->wdt_device, + ZX2967_WDT_DEFAULT_TIMEOUT, dev); + watchdog_set_nowayout(&wdt->wdt_device, WATCHDOG_NOWAYOUT); + + zx2967_wdt_stop(&wdt->wdt_device); + + err = watchdog_register_device(&wdt->wdt_device); + if (unlikely(err)) { + ret = err; + goto fail_register; + } + + wdt->restart_handler.notifier_call = zx2967_wdt_restart; + wdt->restart_handler.priority = 128; + ret = register_restart_handler(&wdt->restart_handler); + if (ret) { + dev_err(dev, "cannot register restart handler, %d\n", ret); + goto fail_restart; + } + + dev_info(dev, "watchdog enabled (timeout=%d sec, nowayout=%d)", + wdt->wdt_device.timeout, WATCHDOG_NOWAYOUT); + + return 0; + +fail_restart: + watchdog_unregister_device(&wdt->wdt_device); +fail_register: + clk_disable_unprepare(wdt->clock); + return ret; +} + +static int zx2967_wdt_remove(struct platform_device *pdev) +{ + struct zx2967_wdt *wdt = platform_get_drvdata(pdev); + + unregister_restart_handler(&wdt->restart_handler); + watchdog_unregister_device(&wdt->wdt_device); + clk_disable_unprepare(wdt->clock); + + return 0; +} + +static void zx2967_wdt_shutdown(struct platform_device *pdev) +{ + struct zx2967_wdt *wdt = platform_get_drvdata(pdev); + + if (!(wdt->flags & ZX2967_WDT_FLAG_REBOOT_MON)) + zx2967_wdt_stop(&wdt->wdt_device); +} + +static const struct of_device_id zx2967_wdt_match[] = { + { .compatible = "zte,zx296718-wdt", }, + {} +}; +MODULE_DEVICE_TABLE(of, zx2967_wdt_match); + +static struct platform_driver zx2967_wdt_driver = { + .probe = zx2967_wdt_probe, + .remove = zx2967_wdt_remove, + .shutdown = zx2967_wdt_shutdown, + .driver = { + .name = "zx2967-wdt", + .of_match_table = of_match_ptr(zx2967_wdt_match), + }, +}; +module_platform_driver(zx2967_wdt_driver); + +MODULE_AUTHOR("Baoyou Xie "); +MODULE_DESCRIPTION("ZTE zx2967 Watchdog Device Driver"); +MODULE_LICENSE("GPL v2");