From patchwork Fri Apr 7 11:00:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keguang Zhang X-Patchwork-Id: 671247 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADC0AC76196 for ; Fri, 7 Apr 2023 11:00:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231334AbjDGLAw (ORCPT ); Fri, 7 Apr 2023 07:00:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231229AbjDGLAv (ORCPT ); Fri, 7 Apr 2023 07:00:51 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A131235AC; Fri, 7 Apr 2023 04:00:50 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id v9so3459967pjk.0; Fri, 07 Apr 2023 04:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680865250; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FEKUX88yyRCa/+8I/hmTaP46+2L5p+4mH+ONKNzZlAg=; b=i/TpKG12qTFoyL/DdKVSUDakrdaNAucjMlJ0ZO8Bwy1II+ogUtg7AiYz6pXHGeZgf2 XAW5wEjYv1bLI8H+Cxfk/SWNLxqIhNFjmdsIAgyiT9LYU5agWcY7w9B3WJESWzwA2Ylr o2ou8TdB9bwPjW7WW6bOJ9IoQZZQgTJBvmW26rRNnasy6TKjJADBiTvi7pE82tqBMxdS lP2a36jDTR/12nMwfNs/lost1AnzVkym4S3gKOZ7tQ05LowQcY9AcwfnE7YiqVdVHxm5 eK0Vjlf1xZEumCtb9D0oZtGK0QDbSZdrO6I1OULWIsoqzjVgT/45XeMS+7lqcLmnHec3 HmSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680865250; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FEKUX88yyRCa/+8I/hmTaP46+2L5p+4mH+ONKNzZlAg=; b=mJWKnrWWtlRSh+EulPMYv4av52zTiF1pImevL4rJIgTDywqp2qqlrCT6xKbt1raPC4 ViGIujPoGEDFtCFQydH6PRKd+KQZ4QTRoC9CV2g3MWSI6T6CIY5BmpsDfPbQceYRZhda dGRnb0R0bJYUfkBJdslU9TltvthHsF/9zFKkWtdS48F/KzIuZKinVXS7VmPD1l26g5BZ J8kdpuYnVAAeMW1pxuPByh/UbGE9bTbnERCb/o3irSOSAVdQo3b3rvOtC0beg/UvGBth tnM4gASCcZ8mXeKJ6wmjxUWY9tGumoYaWJjptULmZxwFDfQb2DtFDtAPmXNzMjrTCG9i 7ctw== X-Gm-Message-State: AAQBX9e76RXYdweb6pcvvw7g+aZRoaA5+2qrSUcP4LRaqKXSY9CUN5NL /4YyTxginz+8ArpaMYJEchFR4vnEMcp3Rw== X-Google-Smtp-Source: AKy350baDqPde9rbkA1sKyOezf0KszEE4SIVXiUgD/8lly16HNEThGUAj00ng8w2BpdzMNH9eWlHeg== X-Received: by 2002:a17:902:e745:b0:1a1:cc0c:a5c2 with SMTP id p5-20020a170902e74500b001a1cc0ca5c2mr2228876plf.62.1680865249748; Fri, 07 Apr 2023 04:00:49 -0700 (PDT) Received: from kelvin-ThinkPad-L14-Gen-1.. ([38.84.161.179]) by smtp.gmail.com with ESMTPSA id jw1-20020a170903278100b0019ee042602bsm2732005plb.92.2023.04.07.04.00.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Apr 2023 04:00:49 -0700 (PDT) From: Keguang Zhang To: linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Wim Van Sebroeck , Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Yang Ling , Keguang Zhang Subject: [PATCH 1/2] dt-bindings: watchdog: Add Loongson-1 watchdog Date: Fri, 7 Apr 2023 19:00:24 +0800 Message-Id: <20230407110025.516405-2-keguang.zhang@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230407110025.516405-1-keguang.zhang@gmail.com> References: <20230407110025.516405-1-keguang.zhang@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add devicetree binding document for Loongson-1 watchdog. Signed-off-by: Keguang Zhang --- .../bindings/watchdog/loongson,ls1x-wdt.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/watchdog/loongson,ls1x-wdt.yaml diff --git a/Documentation/devicetree/bindings/watchdog/loongson,ls1x-wdt.yaml b/Documentation/devicetree/bindings/watchdog/loongson,ls1x-wdt.yaml new file mode 100644 index 000000000000..203726da14ff --- /dev/null +++ b/Documentation/devicetree/bindings/watchdog/loongson,ls1x-wdt.yaml @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/watchdog/loongson,ls1x-wdt.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Loongson-1 Watchdog Timer + +maintainers: + - Keguang Zhang + +allOf: + - $ref: watchdog.yaml# + +properties: + compatible: + const: loongson,ls1x-wdt + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + +required: + - compatible + - reg + - clocks + +additionalProperties: false + +examples: + - | + #include + watchdog: watchdog@1fe5c060 { + compatible = "loongson,ls1x-wdt"; + reg = <0x1fe5c060 0xc>; + + clocks = <&clkc LS1X_CLKID_APB>; + }; From patchwork Fri Apr 7 11:00:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keguang Zhang X-Patchwork-Id: 671794 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6260AC77B61 for ; Fri, 7 Apr 2023 11:01:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240120AbjDGLBG (ORCPT ); Fri, 7 Apr 2023 07:01:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235110AbjDGLBB (ORCPT ); Fri, 7 Apr 2023 07:01:01 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C16F859D8; Fri, 7 Apr 2023 04:00:55 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id h12-20020a17090aea8c00b0023d1311fab3so43035742pjz.1; Fri, 07 Apr 2023 04:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680865254; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZzVQzob6w+uGiqMm+prIjkfjAtxo6cGiHRkUXlkvJQE=; b=TX/X/r2mQwqCY10LHjcYSXqp/+x3G7pptxPF/QLR8hauClknYFW0K+kRtmlUVEkDdv MTAkK9WsuKZZGnrU9/P8a3AUyA9LH2nw9RjZ2Dc3mDVMQUVDaXXkppNOI4iL3iGDmhLN JV1nfbFR5RVfGPbUSBvIjJYiXpP9vggrmOnpKwMD9YxKZzQwIP5+NNobcmLgzfvO1TXo 94vLS1Ks6kDqqMVEi9UWlfr56I/ERFgYj7egswrd9ffbcttBr3w15jN8tLVBDRVsOUdY XekU2Ow24gw2Vi9gqANXDwCXaeYRBaZZ3Pm7dhLJFBCWRf3cs7qQrU4yNdMuSXuVaH6/ iROg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680865254; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZzVQzob6w+uGiqMm+prIjkfjAtxo6cGiHRkUXlkvJQE=; b=1nP1xEPLodUhavr12Kh+/kMNRAjhq+fR63n472aqTOq2BNQukqHx+lrqA0SiNQIwvb Zn6iXsTZ+9w5K3DIzHAre80Yd8ngQfF/qWntVQT9MGdUdeBvQ0UshulRpuBmR1iAqyxW FmzLDteftDOWYJ5JDaFvKf8DEBCbM/glYI6JXXlNRMkVl4m0Qkna6OwtxM7Pv8zJe9M2 l08xEJsCPsbEve3LGUNa6UhK10TgluZtujbgaXfsE49g9kn3060KUha+/5LZWRc1lozH 3Rx2yT0l3WC0ebCxJBxE9WR9vtmlPWxIFwjJxuHr0MbY7ol4hNlCJ8iLjySTnuyrIcuU hbrQ== X-Gm-Message-State: AAQBX9dLzs2W1zx62nedDF2cypyYAUh5PGtrpTOOlT95sZCM0Hsw5l8j BfzLFreJMYitQ0TjO08DyEf6LfBk6q5wCQ== X-Google-Smtp-Source: AKy350b/DkHRgvHytEVipvniMLkEFq7pYID8W12uMSjXDNyXHlFxmG/zcmjPkV7my8RwqgGUidkhUg== X-Received: by 2002:a17:902:f541:b0:1a1:d366:b085 with SMTP id h1-20020a170902f54100b001a1d366b085mr3069596plf.21.1680865254264; Fri, 07 Apr 2023 04:00:54 -0700 (PDT) Received: from kelvin-ThinkPad-L14-Gen-1.. ([38.84.161.179]) by smtp.gmail.com with ESMTPSA id jw1-20020a170903278100b0019ee042602bsm2732005plb.92.2023.04.07.04.00.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Apr 2023 04:00:53 -0700 (PDT) From: Keguang Zhang To: linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Wim Van Sebroeck , Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Yang Ling , Keguang Zhang Subject: [PATCH 2/2] watchdog: loongson1_wdt: Add DT support Date: Fri, 7 Apr 2023 19:00:25 +0800 Message-Id: <20230407110025.516405-3-keguang.zhang@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230407110025.516405-1-keguang.zhang@gmail.com> References: <20230407110025.516405-1-keguang.zhang@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds the of_match_table to enable DT support of Loongson-1 watchdog driver. And modify the parameter of devm_clk_get() accordingly. Signed-off-by: Keguang Zhang --- drivers/watchdog/loongson1_wdt.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/loongson1_wdt.c b/drivers/watchdog/loongson1_wdt.c index bb3d075c0633..c2694222ea86 100644 --- a/drivers/watchdog/loongson1_wdt.c +++ b/drivers/watchdog/loongson1_wdt.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -100,7 +101,7 @@ static int ls1x_wdt_probe(struct platform_device *pdev) if (IS_ERR(drvdata->base)) return PTR_ERR(drvdata->base); - drvdata->clk = devm_clk_get(dev, pdev->name); + drvdata->clk = devm_clk_get(dev, NULL); if (IS_ERR(drvdata->clk)) return PTR_ERR(drvdata->clk); @@ -142,10 +143,19 @@ static int ls1x_wdt_probe(struct platform_device *pdev) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id ls1x_wdt_dt_ids[] = { + { .compatible = "loongson,ls1x-wdt", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, ls1x_wdt_dt_ids); +#endif + static struct platform_driver ls1x_wdt_driver = { .probe = ls1x_wdt_probe, .driver = { .name = "ls1x-wdt", + .of_match_table = ls1x_wdt_dt_ids, }, };