From patchwork Thu May 11 12:11:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keguang Zhang X-Patchwork-Id: 13237841 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 246EEC7EE23 for ; Thu, 11 May 2023 12:13:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237959AbjEKMNc (ORCPT ); Thu, 11 May 2023 08:13:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237906AbjEKMNI (ORCPT ); Thu, 11 May 2023 08:13:08 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26217DC5F; Thu, 11 May 2023 05:12:19 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-643990c5319so6089756b3a.2; Thu, 11 May 2023 05:12:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683807130; x=1686399130; 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=On9N88gLZYLQdmk44hl2omlUa9IquKB2qRmA2LW1HWU=; b=d35w62FiWW+qfRxGM8hF+yB2bqN2tcjRlz+/iPMb0V5w91Lp1+zEg0zVpash66eENR 7iuWZZ1i/5ZvlC0nLuxoRaPIqNlpucJRT5CSju71MP9tL1CyI27mMG8/j151ojpRiRGy hkrPa3oJ8Vxa5CAAUUPChg2OpsUg1ulgd68kixNK196FPzHz36hgHLOcu/Z2CH8eRW15 6+cg7MmyIx1xiBe7e/UlJppt4J9l28D4eupyPIyhhBtdnHoE/px7Y0AWe4+xYgBiLyK6 Zz2dNg9viicG9gW+sy0DqaK3qyQBqp9BqREKb2c0TRKxpOdy5qj87aF1iit6HPhqDQqV +Tgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683807130; x=1686399130; 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=On9N88gLZYLQdmk44hl2omlUa9IquKB2qRmA2LW1HWU=; b=aGc0UaJRT4a/5vmh2/j4wZpHfEdNuhDuH93AFyxPsTIBTnlWevp2UoNnEi26g6bIOx thL2GXEQcBQ6YuDSPTWctI/jJD4xLMS2iUuzon9f8WeyT6je82BLmubMZUhF2tgjMLlm BpWq3csXICSH1tBoYtBUM/B33q6Kt1HN98ShLvZJJCxP4PjxxSFUVSb7ITculsIqU6gq yXCO8YjT67kaXVBhyA6q9pmJboyVv6L4XdWi+92bnNQPErNgR4VMy2iFD2HjejRomLUj im2BNQT1VLDXr4IjM5yKpgJVIgmGo7kGh1HjeJDZApiHC4LaeRYdyURbus4uRpCbUyEQ moQg== X-Gm-Message-State: AC+VfDy13o53RGjofOeoj/m69SmpcI5kEqa9TA50VMu6H9IfNZLGP06j nKyFtO09Z1MpF3SqVSH6XORwu+konj2+1Qg1 X-Google-Smtp-Source: ACHHUZ5rp26Wy86X1QU+wEviKpLLY368Nc/vPuxsCQmHAc014wFabt/bchsPdzM1N1/YtFxNXiC+QQ== X-Received: by 2002:a05:6a00:17a3:b0:643:aa8d:8cd7 with SMTP id s35-20020a056a0017a300b00643aa8d8cd7mr30016691pfg.32.1683807129844; Thu, 11 May 2023 05:12:09 -0700 (PDT) Received: from kelvin-ThinkPad-L14-Gen-1.lan ([103.184.129.7]) by smtp.gmail.com with ESMTPSA id j10-20020a62e90a000000b0063f16daf7dbsm5134562pfh.55.2023.05.11.05.12.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 05:12:09 -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 v2 1/2] dt-bindings: watchdog: Add Loongson-1 watchdog Date: Thu, 11 May 2023 20:11:58 +0800 Message-Id: <20230511121159.463645-2-keguang.zhang@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230511121159.463645-1-keguang.zhang@gmail.com> References: <20230511121159.463645-1-keguang.zhang@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org Add devicetree binding document for Loongson-1 watchdog. Signed-off-by: Keguang Zhang Reviewed-by: Krzysztof Kozlowski Reviewed-by: Guenter Roeck --- V1 -> V2: Replaced the wildcard compatible string with specific ones Use unevaluatedProperties instead of additionalProperties (suggested by Krzysztof Kozlowski) --- .../bindings/watchdog/loongson,ls1x-wdt.yaml | 42 +++++++++++++++++++ 1 file changed, 42 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..81690d4b62a6 --- /dev/null +++ b/Documentation/devicetree/bindings/watchdog/loongson,ls1x-wdt.yaml @@ -0,0 +1,42 @@ +# 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: + enum: + - loongson,ls1b-wdt + - loongson,ls1c-wdt + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + +required: + - compatible + - reg + - clocks + +unevaluatedProperties: false + +examples: + - | + #include + watchdog: watchdog@1fe5c060 { + compatible = "loongson,ls1b-wdt"; + reg = <0x1fe5c060 0xc>; + + clocks = <&clkc LS1X_CLKID_APB>; + }; From patchwork Thu May 11 12:11:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keguang Zhang X-Patchwork-Id: 13237842 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 C0449C7EE2A for ; Thu, 11 May 2023 12:13:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237806AbjEKMNg (ORCPT ); Thu, 11 May 2023 08:13:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237701AbjEKMNK (ORCPT ); Thu, 11 May 2023 08:13:10 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90B01AD38; Thu, 11 May 2023 05:12:24 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-643bb9cdd6eso6152928b3a.1; Thu, 11 May 2023 05:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683807133; x=1686399133; 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=Kz2nBW8WdiIk4F8j/i6m8NjQZbdSdX7MIghawAp0rWw=; b=FkbkwpbPgSf5kZapM88YbrP7S64ke8Y6DuKf11L2l7UQiro7rKt2KiANbHbmHK95dW DeTNn3JgkW/5pJirwBiTY29UU0PH026LEserBmivl0iYxF8kyYa26d7jgbjRh35pHqHY HRf6tMwEwcNVUO5JzHqR6zS44WxSQrb/Kmd4uOL+763/aMR7xmzHuUwGsP7KFvGrJJXJ P24Ja7GXwF84rgLOmE7fvXvTK8P2Jr9iaONphXIlTXvy1lcMmR4l58BX+zI7G4o2ya4I 9qh7xz3E6/88mYrUNPAwLzfHVFZ5UZBCtANvkRe9IlcNUG9109tZJJryM9awh98yrJoI UQtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683807133; x=1686399133; 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=Kz2nBW8WdiIk4F8j/i6m8NjQZbdSdX7MIghawAp0rWw=; b=Qm8/8ho8kuVmUqVl+DxAILgM8TL8CkLHU9+NIBqaANm53IqCM6XpYACLuFNAgHwzKZ Oyei1+cCHHxHN42ms+ApaWfDrcSUscWDFcXPTXuoahyFXLZqtlSCDV1wUlNsrY3wHML1 vhL/WmicE9f053TTVLMY5O7j8hvFOyNYipzzCI6HMbjZu8dcQlHzyTsGYVgOZ1G5XzT+ 7cfyx1fqa/JHRHQBM3kHbMx/Hk+VeJKkNAqfIoqRFuIfE5BoQBdTIvQ2jVOsAeDjGysp WLnSRnizkrrrZ2+lOROJ0XdGk1Yx55YRNsNbjiMOrHR2uUnUtE5RC713MIKe79UeFDz/ fRLw== X-Gm-Message-State: AC+VfDwMdQHbCi5LYVocV1E29rHT6OmrE9ZyG6AQg1g/XGnl+IYwvV0n 5ARXwuSu/f6/pRBM4YQ1FT7/GQ8IpxNJev9n X-Google-Smtp-Source: ACHHUZ5LCES57o7ITKxiLkwWKBQ1VUFFKq1mslja/Ps8Wg/UKmabaPXQawVElCz/JemuMAwwRd0HLA== X-Received: by 2002:a05:6a00:24c1:b0:637:f1ae:d47 with SMTP id d1-20020a056a0024c100b00637f1ae0d47mr27023742pfv.17.1683807133072; Thu, 11 May 2023 05:12:13 -0700 (PDT) Received: from kelvin-ThinkPad-L14-Gen-1.lan ([103.184.129.7]) by smtp.gmail.com with ESMTPSA id j10-20020a62e90a000000b0063f16daf7dbsm5134562pfh.55.2023.05.11.05.12.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 05:12:12 -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 v2 2/2] watchdog: loongson1_wdt: Add DT support Date: Thu, 11 May 2023 20:11:59 +0800 Message-Id: <20230511121159.463645-3-keguang.zhang@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230511121159.463645-1-keguang.zhang@gmail.com> References: <20230511121159.463645-1-keguang.zhang@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@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_enabled() accordingly. Signed-off-by: Keguang Zhang Reviewed-by: Guenter Roeck --- V1 -> V2: Change the wildcard compatible string to specific ones Use of_match_ptr() to aviod the build error when CONFIG_OF=n --- drivers/watchdog/loongson1_wdt.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/loongson1_wdt.c b/drivers/watchdog/loongson1_wdt.c index 3c651c50a98c..4ac7810a314d 100644 --- a/drivers/watchdog/loongson1_wdt.c +++ b/drivers/watchdog/loongson1_wdt.c @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -112,7 +113,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_enabled(dev, pdev->name); + drvdata->clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(drvdata->clk)) return PTR_ERR(drvdata->clk); @@ -144,10 +145,20 @@ 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,ls1b-wdt", }, + { .compatible = "loongson,ls1c-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 = of_match_ptr(ls1x_wdt_dt_ids), }, };