From patchwork Sat Feb 11 07:33:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Paracuellos X-Patchwork-Id: 13136933 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 98ECCC64ED6 for ; Sat, 11 Feb 2023 07:34:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229460AbjBKHeG (ORCPT ); Sat, 11 Feb 2023 02:34:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbjBKHeF (ORCPT ); Sat, 11 Feb 2023 02:34:05 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47FBE1D906; Fri, 10 Feb 2023 23:34:03 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id z13so5384785wmp.2; Fri, 10 Feb 2023 23:34:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=BnXrkD6mC1X9wvYtsECorUK6F5CsiEFkvfTGl5Os3Dw=; b=g8wJsbloOWG7ZeCFfvDC4383nh4NdFa3ZV7kJJmeo+jb051yTKZP7+54FvsEucq023 tYHL6cVpiS+GN/i1dQnXVZu7jsrKME9xAgRIsBDW+NM4nHzTO4RQVSxewGuKwHcqetaq FQUjW1nFdE6sTG+vzoR2OFJkfY4ng+7KGwtqfp2oUHeLnUcrQgr31ea14fv4iXv8AS4L KBHcKiEIqN5eAMAngE+whyYbLLmS0a3HRWJokWg5Yq1XiCVhX1UKRpANjwu5wbdC3Ggo vhaHAB95WoXzUFtnLX4VENts0NuyIEpvWaKXIpDo3QixfMJmDT6Oc9glwBK33B9KJ7HP pMNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=BnXrkD6mC1X9wvYtsECorUK6F5CsiEFkvfTGl5Os3Dw=; b=HPFbxsvIPyD0l5pN67Xgk+tLT9Fk5hq13EVs/x+PLqZNgbccA79jijrwo3rlu3ZUAn 5lrko5Y9fIuiLOnK+3XNjlh3413NQ9n1rZSKoBU3i+KwVSczl271ViEY4is1b2aw7GVL k3OOeiiEel0iayZOXqHCMHo/6sr5JASsYj7bt1ZKy8lzM+ZUa28MPI38wexSyC0n5La6 WR8LQJW2truZktOE61KiKMb9zwJWffNAriBFXCL2RFV5tX5iMe9UNEi36PV5fpaZcqKg 9cspFupduFN7pJNzrK1GrBYvlgHOAcZhvW4FHNMqYVWWhXw+YrMgaj/mUo09BU7jdEZa j6dQ== X-Gm-Message-State: AO0yUKWfP17kZmml/ZyY2k+u0wEklx8i5HRGTTACyLNHJMaQiqPRuPI3 +Iej17IGW2QBIWui8FvMI76va3Hn+rQ= X-Google-Smtp-Source: AK7set/gpMxYCx7vqUG0H8KOtvNcQ3NU29c0Qq0mZR3KNRxKfk3P5iNzmqK7Pzsu/AomWOqbzCFabw== X-Received: by 2002:a05:600c:44c9:b0:3df:f9e9:7600 with SMTP id f9-20020a05600c44c900b003dff9e97600mr14775977wmo.25.1676100841458; Fri, 10 Feb 2023 23:34:01 -0800 (PST) Received: from localhost.localdomain (23.red-88-10-60.dynamicip.rima-tde.net. [88.10.60.23]) by smtp.gmail.com with ESMTPSA id j23-20020a05600c1c1700b003daf681d05dsm7917829wms.26.2023.02.10.23.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 23:34:01 -0800 (PST) From: Sergio Paracuellos To: linux-watchdog@vger.kernel.org Cc: wim@linux-watchdog.org, linux@roeck-us.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, arinc.unal@arinc9.com, tsbogend@alpha.franken.de, p.zabel@pengutronix.de, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mips@vger.kernel.org Subject: [PATCH v4 1/5] dt-bindings: watchdog: mt7621-wdt: add phandle to access system controller registers Date: Sat, 11 Feb 2023 08:33:53 +0100 Message-Id: <20230211073357.755893-2-sergio.paracuellos@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230211073357.755893-1-sergio.paracuellos@gmail.com> References: <20230211073357.755893-1-sergio.paracuellos@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org MT7621 SoC provides a system controller node for accessing to some registers. Add a phandle in this node to avoid using MIPS related arch operations and includes in watchdog driver code. Signed-off-by: Sergio Paracuellos Acked-by: Krzysztof Kozlowski --- .../devicetree/bindings/watchdog/mediatek,mt7621-wdt.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/watchdog/mediatek,mt7621-wdt.yaml b/Documentation/devicetree/bindings/watchdog/mediatek,mt7621-wdt.yaml index b2b17fdf4..a668d0c2f 100644 --- a/Documentation/devicetree/bindings/watchdog/mediatek,mt7621-wdt.yaml +++ b/Documentation/devicetree/bindings/watchdog/mediatek,mt7621-wdt.yaml @@ -19,6 +19,12 @@ properties: reg: maxItems: 1 + mediatek,sysctl: + $ref: /schemas/types.yaml#/definitions/phandle + description: + phandle to system controller 'sysc' syscon node which + controls system registers + required: - compatible - reg @@ -30,4 +36,5 @@ examples: watchdog@100 { compatible = "mediatek,mt7621-wdt"; reg = <0x100 0x100>; + mediatek,sysctl = <&sysc>; }; From patchwork Sat Feb 11 07:33:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergio Paracuellos X-Patchwork-Id: 13136934 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 814DBC6379F for ; Sat, 11 Feb 2023 07:34:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229644AbjBKHeJ (ORCPT ); Sat, 11 Feb 2023 02:34:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbjBKHeJ (ORCPT ); Sat, 11 Feb 2023 02:34:09 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A3091CF48; Fri, 10 Feb 2023 23:34:04 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id m16-20020a05600c3b1000b003dc4050c94aso5593155wms.4; Fri, 10 Feb 2023 23:34:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=u2xLyJ53huQXvmhIZNGemIcemfb0LptCrFwxhBre8f0=; b=nc53IyZLnmhvc74W4zDkK+Mcte68rwcfHhr1kVA84eFIf+6fG0aJfFPJpwRYLheq3d RXBDThvOUW2agefnaD6muBg8jgCa7BkPODnVobIuFD8dpUseO286v5LtX+UR5U7MuO9m fxWW4kH4Y+66nAd0U4wAVAPW3dEXl01K1n/fH6PG+ZbqbQ+/Whsj1HuBn2+IvlFJdWzb 91XkBHG/F9kbmgiyQaqKIx3vdK+YKkrTzhDJO1oXiIC8gic6i2WDL0uVL3kQUxJiMRAl T9dRp9VHetMex4EgDU4mN8ruCPw+Z68zHYdD8FToNQwOqxpISIDnGa122LZSTeq9YIGZ vLwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=u2xLyJ53huQXvmhIZNGemIcemfb0LptCrFwxhBre8f0=; b=AXZiPjz7PWFztXsVs+xS5kWqplxarW5YMYOaJAo7lfHEgnk9z8GFfdf1l57fkEs9j2 jLRYHHbLhArXTcz+qpy0bs2rGgIMQQHOyzJGevUKl6jvcsDx/f5c3qdRlTdRthRjI2JK SFC9yUComQalPj3W9kveN37SPdt4IJX8hZ/952R4Q9O5Pz5hjteeNcuVSGRVzVRpoI+7 zyLJnuFWB/ZontSqp2C02nr12EIgy8WZ03BtZlrjM1G7zPiCiX374ASZNwoNKMF3ghdw p4encyQmytrld5RCZEhkwp/QexWFmXJlLiQTye5JykLxVNeVlxEcvZe20Uz7zrcSQz/n 1Afg== X-Gm-Message-State: AO0yUKXMVb3LfLVoLXUtXaUv7rxqZFoQ2bdlz1amP14mfXLRx2/KYNom nbf04BNsJZwfuhV3S6sDE6Dialz8j5g= X-Google-Smtp-Source: AK7set+5U8eANFbrGx5rWx2jKG8XMhxyEUTPapURmlBhvDbErJNk1+B6dF+JZoiz9mdNQappXVF7JA== X-Received: by 2002:a05:600c:319d:b0:3dc:5950:b358 with SMTP id s29-20020a05600c319d00b003dc5950b358mr15819171wmp.14.1676100842669; Fri, 10 Feb 2023 23:34:02 -0800 (PST) Received: from localhost.localdomain (23.red-88-10-60.dynamicip.rima-tde.net. [88.10.60.23]) by smtp.gmail.com with ESMTPSA id j23-20020a05600c1c1700b003daf681d05dsm7917829wms.26.2023.02.10.23.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 23:34:02 -0800 (PST) From: Sergio Paracuellos To: linux-watchdog@vger.kernel.org Cc: wim@linux-watchdog.org, linux@roeck-us.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, arinc.unal@arinc9.com, tsbogend@alpha.franken.de, p.zabel@pengutronix.de, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mips@vger.kernel.org Subject: [PATCH v4 2/5] mips: dts: ralink: mt7621: add phandle to system controller node for watchdog Date: Sat, 11 Feb 2023 08:33:54 +0100 Message-Id: <20230211073357.755893-3-sergio.paracuellos@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230211073357.755893-1-sergio.paracuellos@gmail.com> References: <20230211073357.755893-1-sergio.paracuellos@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org To allow to access system controller registers from watchdog driver code add a phandle in the watchdog 'wdt' node. This avoid using arch dependent operations in driver code. Signed-off-by: Sergio Paracuellos Reviewed-by: Arınç ÜNAL --- arch/mips/boot/dts/ralink/mt7621.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/boot/dts/ralink/mt7621.dtsi b/arch/mips/boot/dts/ralink/mt7621.dtsi index 5ca40fd21..764916eaf 100644 --- a/arch/mips/boot/dts/ralink/mt7621.dtsi +++ b/arch/mips/boot/dts/ralink/mt7621.dtsi @@ -73,6 +73,7 @@ sysc: syscon@0 { wdt: wdt@100 { compatible = "mediatek,mt7621-wdt"; reg = <0x100 0x100>; + mediatek,sysctl = <&sysc>; }; gpio: gpio@600 { From patchwork Sat Feb 11 07:33:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergio Paracuellos X-Patchwork-Id: 13136936 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 C22BBC6379F for ; Sat, 11 Feb 2023 07:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229705AbjBKHeM (ORCPT ); Sat, 11 Feb 2023 02:34:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229677AbjBKHeK (ORCPT ); Sat, 11 Feb 2023 02:34:10 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6EF028866; Fri, 10 Feb 2023 23:34:06 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id n13so5363956wmr.4; Fri, 10 Feb 2023 23:34:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=kVRb8cmWOFqU9n4+7sFTWzjVPS3DujkHQ/+pnVD+RAM=; b=EsUPcIoTv12ndczXEyY8G3j5BCqL4EGj9zTY3O8JFJrnrOzHAxtyx4rFYcxDezgORC mlMgbiGd7V5AxOw9Z8GIEa3shiwWGAEBq3rnplqtNLWBGFtFOh7NLa/Q3tVfS7DNTujd 2+h8ucJumps/3T/FNWEBm+bWfoRxbtfd6U8wEk4XB7aK6GbFzqkzCTwM4xlZvhG3+JNC Q2t17VZVkkXtYl4Y9xDz2XR1fxJ/GhDfWk0vhh8ScWh52LDBaV2rOoAaawYZS0Ij2X/u H1Mj745u0kJu0aLhvKoQDu5pz/GCbkc9TwkTsg0NYIBF41Ndd8O8pqoAP1Wq7XLW5dI3 pFcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=kVRb8cmWOFqU9n4+7sFTWzjVPS3DujkHQ/+pnVD+RAM=; b=OH4hnzKjOfT9w8/GGIqkiSOQnX/GsV8Kd9v8GXnA03F6mAXCX5/ouhHM+IyMLJCquS PiTTtZtTDVtdVa/TdxCDVl88hXjD/IROLXysV/sUUgh0bOb34DBSjzpew9QJ0fj4WaMm v/rjCwubqJHZ0HeQj64NN7b06eg8Ev7xFhFYlBIsNB2rh7XqoIZQeUheiVSXDZYoarhw GwKaIksbaG3ZVBmQ3nwFIze9V9BTVj9BYVxw7JXxqgcndsH/tAePKx5ezKpTwC3SNKke f/5R64QcKTB3ndgPndtYQ7WnhYorgHzmufoeZfvIS1k9aezWcVtSwCbnd/1kUAFTioON R4jw== X-Gm-Message-State: AO0yUKXEhRzEXturGDCXr6KpWa6pQmEp1GQAva95jr/qVTkUud8Xm5bU hAX3hdQjAQOPkUrt/Cl8XYlrozR1eJM= X-Google-Smtp-Source: AK7set/uHYB64dWcXKWq6/xg8SKAKSDXYYqo/RaXqR1A3Tvra4Coz9kalYEBsgZFp3s+xNlGNCqteQ== X-Received: by 2002:a05:600c:319b:b0:3db:8de:6993 with SMTP id s27-20020a05600c319b00b003db08de6993mr562560wmp.4.1676100843864; Fri, 10 Feb 2023 23:34:03 -0800 (PST) Received: from localhost.localdomain (23.red-88-10-60.dynamicip.rima-tde.net. [88.10.60.23]) by smtp.gmail.com with ESMTPSA id j23-20020a05600c1c1700b003daf681d05dsm7917829wms.26.2023.02.10.23.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 23:34:03 -0800 (PST) From: Sergio Paracuellos To: linux-watchdog@vger.kernel.org Cc: wim@linux-watchdog.org, linux@roeck-us.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, arinc.unal@arinc9.com, tsbogend@alpha.franken.de, p.zabel@pengutronix.de, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mips@vger.kernel.org Subject: [PATCH v4 3/5] mips: dts: ralink: mt7621: rename watchdog node from 'wdt' into 'watchdog' Date: Sat, 11 Feb 2023 08:33:55 +0100 Message-Id: <20230211073357.755893-4-sergio.paracuellos@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230211073357.755893-1-sergio.paracuellos@gmail.com> References: <20230211073357.755893-1-sergio.paracuellos@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Watchdog nodes must use 'watchdog' for node name. When a 'make dtbs_check' is performed the following warning appears: wdt@100: $nodename:0: 'wdt@100' does not match '^watchdog(@.*|-[0-9a-f])?$' Fix this warning up properly renaming the node into 'watchdog'. Signed-off-by: Sergio Paracuellos Reviewed-by: Arınç ÜNAL --- arch/mips/boot/dts/ralink/mt7621.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/boot/dts/ralink/mt7621.dtsi b/arch/mips/boot/dts/ralink/mt7621.dtsi index 764916eaf..3d16beb77 100644 --- a/arch/mips/boot/dts/ralink/mt7621.dtsi +++ b/arch/mips/boot/dts/ralink/mt7621.dtsi @@ -70,7 +70,7 @@ sysc: syscon@0 { "250m", "270m"; }; - wdt: wdt@100 { + wdt: watchdog@100 { compatible = "mediatek,mt7621-wdt"; reg = <0x100 0x100>; mediatek,sysctl = <&sysc>; From patchwork Sat Feb 11 07:33:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Paracuellos X-Patchwork-Id: 13136937 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 9E4DEC64ED9 for ; Sat, 11 Feb 2023 07:34:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229716AbjBKHeN (ORCPT ); Sat, 11 Feb 2023 02:34:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229676AbjBKHeK (ORCPT ); Sat, 11 Feb 2023 02:34:10 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAB5E2A170; Fri, 10 Feb 2023 23:34:06 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id u10so5373106wmj.3; Fri, 10 Feb 2023 23:34:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=eTGPGFaQb/DlfYZrXhPbzKJDWxh4+D5n3UiQCEuPX0I=; b=WBZBv5+/3LplUniui6ce9L03+sig+cCpsE45lmaFPXquqBtPf6vjgs4/0cV88zJUtG aNbJ316TG+LjPmaZ7Bi38CElHvzIr/RK+iq+OTFrtW1MKl+OL3wFFxsK6T5goIeZ5sbF 8s6IVu05+dyCeETEtP3luSaI0xTR2g60S8l+vbzoH232jePOGCb1mKRyU4h60lROfTnb 4NolYJgXsxQSQZaKqRxkqKoQPAdErYBTWn0Cd199PP9Juot3rOrdSpvj4aGBhYao1Kh5 pDAmHMha4FIx1j1/+NEqiPAG8fShODh6ffxF7JEDM/uHVJe5m3AZNueDeNMXlDTWQiam znxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=eTGPGFaQb/DlfYZrXhPbzKJDWxh4+D5n3UiQCEuPX0I=; b=kkyKZqMS9ZsrfuyT15VwCNC2KamD7aGSesY9BqtRjdtfcPL5Om3BAUP0O6hUt2W5Pa HwZ2Cwfumpx8ax6KnUzcFYSnnUzcqpe1a+vbJf85JFzs16urfBXo6oRDgnv/DPlkZC+M YchNYxtf7rZhcXxgxDJs3ofOINhxRMzfKYHSojmylUvuRWuksCoXhCYAFrYxKX0pNgAG lPrlciWe3MK26mAJb/O4fl41amUGVRYaVNO+3MDNedAIRzzTglpqxvwltIqm7oFXPD/Q BhMmJ+CYeqKs34mXIWx1SD/FZns5npXFoVS2kTgTLKe0ipw8adJ48sHrjK3bPNyMy8tt sjYg== X-Gm-Message-State: AO0yUKWog0kYlAsl3NJBiT9VUVoABAijJhxK3qaTBmR0+AoLgEd3YS4o 4rq4tdAkYpA5HVLBcdziR9730tsqXmk= X-Google-Smtp-Source: AK7set+kGAX7SGuIrUm9Q0aGQ7UyfjpMTPfaQTrLDwPG1KEIr2bqNZ4uc9YEM1YYFN9/sKDP9b8D1g== X-Received: by 2002:a05:600c:2b46:b0:3df:e472:fe03 with SMTP id e6-20020a05600c2b4600b003dfe472fe03mr16333119wmf.30.1676100845036; Fri, 10 Feb 2023 23:34:05 -0800 (PST) Received: from localhost.localdomain (23.red-88-10-60.dynamicip.rima-tde.net. [88.10.60.23]) by smtp.gmail.com with ESMTPSA id j23-20020a05600c1c1700b003daf681d05dsm7917829wms.26.2023.02.10.23.34.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 23:34:04 -0800 (PST) From: Sergio Paracuellos To: linux-watchdog@vger.kernel.org Cc: wim@linux-watchdog.org, linux@roeck-us.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, arinc.unal@arinc9.com, tsbogend@alpha.franken.de, p.zabel@pengutronix.de, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mips@vger.kernel.org Subject: [PATCH v4 4/5] watchdog: mt7621-wdt: avoid static global declarations Date: Sat, 11 Feb 2023 08:33:56 +0100 Message-Id: <20230211073357.755893-5-sergio.paracuellos@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230211073357.755893-1-sergio.paracuellos@gmail.com> References: <20230211073357.755893-1-sergio.paracuellos@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Instead of using static global definitions in driver code, refactor code introducing a new watchdog driver data structure and use it along the code. Reviewed-by: Guenter Roeck Signed-off-by: Sergio Paracuellos --- drivers/watchdog/mt7621_wdt.c | 102 ++++++++++++++++++++++------------ 1 file changed, 65 insertions(+), 37 deletions(-) diff --git a/drivers/watchdog/mt7621_wdt.c b/drivers/watchdog/mt7621_wdt.c index a8aa3522c..40fb2c9ba 100644 --- a/drivers/watchdog/mt7621_wdt.c +++ b/drivers/watchdog/mt7621_wdt.c @@ -31,8 +31,11 @@ #define TMR1CTL_RESTART BIT(9) #define TMR1CTL_PRESCALE_SHIFT 16 -static void __iomem *mt7621_wdt_base; -static struct reset_control *mt7621_wdt_reset; +struct mt7621_wdt_data { + void __iomem *base; + struct reset_control *rst; + struct watchdog_device wdt; +}; static bool nowayout = WATCHDOG_NOWAYOUT; module_param(nowayout, bool, 0); @@ -40,27 +43,31 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); -static inline void rt_wdt_w32(unsigned reg, u32 val) +static inline void rt_wdt_w32(void __iomem *base, unsigned reg, u32 val) { - iowrite32(val, mt7621_wdt_base + reg); + iowrite32(val, base + reg); } -static inline u32 rt_wdt_r32(unsigned reg) +static inline u32 rt_wdt_r32(void __iomem *base, unsigned reg) { - return ioread32(mt7621_wdt_base + reg); + return ioread32(base + reg); } static int mt7621_wdt_ping(struct watchdog_device *w) { - rt_wdt_w32(TIMER_REG_TMRSTAT, TMR1CTL_RESTART); + struct mt7621_wdt_data *drvdata = watchdog_get_drvdata(w); + + rt_wdt_w32(drvdata->base, TIMER_REG_TMRSTAT, TMR1CTL_RESTART); return 0; } static int mt7621_wdt_set_timeout(struct watchdog_device *w, unsigned int t) { + struct mt7621_wdt_data *drvdata = watchdog_get_drvdata(w); + w->timeout = t; - rt_wdt_w32(TIMER_REG_TMR1LOAD, t * 1000); + rt_wdt_w32(drvdata->base, TIMER_REG_TMR1LOAD, t * 1000); mt7621_wdt_ping(w); return 0; @@ -68,29 +75,31 @@ static int mt7621_wdt_set_timeout(struct watchdog_device *w, unsigned int t) static int mt7621_wdt_start(struct watchdog_device *w) { + struct mt7621_wdt_data *drvdata = watchdog_get_drvdata(w); u32 t; /* set the prescaler to 1ms == 1000us */ - rt_wdt_w32(TIMER_REG_TMR1CTL, 1000 << TMR1CTL_PRESCALE_SHIFT); + rt_wdt_w32(drvdata->base, TIMER_REG_TMR1CTL, 1000 << TMR1CTL_PRESCALE_SHIFT); mt7621_wdt_set_timeout(w, w->timeout); - t = rt_wdt_r32(TIMER_REG_TMR1CTL); + t = rt_wdt_r32(drvdata->base, TIMER_REG_TMR1CTL); t |= TMR1CTL_ENABLE; - rt_wdt_w32(TIMER_REG_TMR1CTL, t); + rt_wdt_w32(drvdata->base, TIMER_REG_TMR1CTL, t); return 0; } static int mt7621_wdt_stop(struct watchdog_device *w) { + struct mt7621_wdt_data *drvdata = watchdog_get_drvdata(w); u32 t; mt7621_wdt_ping(w); - t = rt_wdt_r32(TIMER_REG_TMR1CTL); + t = rt_wdt_r32(drvdata->base, TIMER_REG_TMR1CTL); t &= ~TMR1CTL_ENABLE; - rt_wdt_w32(TIMER_REG_TMR1CTL, t); + rt_wdt_w32(drvdata->base, TIMER_REG_TMR1CTL, t); return 0; } @@ -105,7 +114,9 @@ static int mt7621_wdt_bootcause(void) static int mt7621_wdt_is_running(struct watchdog_device *w) { - return !!(rt_wdt_r32(TIMER_REG_TMR1CTL) & TMR1CTL_ENABLE); + struct mt7621_wdt_data *drvdata = watchdog_get_drvdata(w); + + return !!(rt_wdt_r32(drvdata->base, TIMER_REG_TMR1CTL) & TMR1CTL_ENABLE); } static const struct watchdog_info mt7621_wdt_info = { @@ -121,30 +132,39 @@ static const struct watchdog_ops mt7621_wdt_ops = { .set_timeout = mt7621_wdt_set_timeout, }; -static struct watchdog_device mt7621_wdt_dev = { - .info = &mt7621_wdt_info, - .ops = &mt7621_wdt_ops, - .min_timeout = 1, - .max_timeout = 0xfffful / 1000, -}; - static int mt7621_wdt_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - mt7621_wdt_base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(mt7621_wdt_base)) - return PTR_ERR(mt7621_wdt_base); + struct watchdog_device *mt7621_wdt; + struct mt7621_wdt_data *drvdata; + int err; + + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; - mt7621_wdt_reset = devm_reset_control_get_exclusive(dev, NULL); - if (!IS_ERR(mt7621_wdt_reset)) - reset_control_deassert(mt7621_wdt_reset); + drvdata->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(drvdata->base)) + return PTR_ERR(drvdata->base); - mt7621_wdt_dev.bootstatus = mt7621_wdt_bootcause(); + drvdata->rst = devm_reset_control_get_exclusive(dev, NULL); + if (!IS_ERR(drvdata->rst)) + reset_control_deassert(drvdata->rst); - watchdog_init_timeout(&mt7621_wdt_dev, mt7621_wdt_dev.max_timeout, - dev); - watchdog_set_nowayout(&mt7621_wdt_dev, nowayout); - if (mt7621_wdt_is_running(&mt7621_wdt_dev)) { + mt7621_wdt = &drvdata->wdt; + mt7621_wdt->info = &mt7621_wdt_info; + mt7621_wdt->ops = &mt7621_wdt_ops; + mt7621_wdt->min_timeout = 1; + mt7621_wdt->max_timeout = 0xfffful / 1000; + mt7621_wdt->parent = dev; + + mt7621_wdt->bootstatus = mt7621_wdt_bootcause(); + + watchdog_init_timeout(mt7621_wdt, mt7621_wdt->max_timeout, dev); + watchdog_set_nowayout(mt7621_wdt, nowayout); + watchdog_set_drvdata(mt7621_wdt, drvdata); + + if (mt7621_wdt_is_running(mt7621_wdt)) { /* * Make sure to apply timeout from watchdog core, taking * the prescaler of this driver here into account (the @@ -154,17 +174,25 @@ static int mt7621_wdt_probe(struct platform_device *pdev) * we first disable the watchdog, set the new prescaler * and timeout, and then re-enable the watchdog. */ - mt7621_wdt_stop(&mt7621_wdt_dev); - mt7621_wdt_start(&mt7621_wdt_dev); - set_bit(WDOG_HW_RUNNING, &mt7621_wdt_dev.status); + mt7621_wdt_stop(mt7621_wdt); + mt7621_wdt_start(mt7621_wdt); + set_bit(WDOG_HW_RUNNING, &mt7621_wdt->status); } - return devm_watchdog_register_device(dev, &mt7621_wdt_dev); + err = devm_watchdog_register_device(dev, &drvdata->wdt); + if (err) + return err; + + platform_set_drvdata(pdev, drvdata); + + return 0; } static void mt7621_wdt_shutdown(struct platform_device *pdev) { - mt7621_wdt_stop(&mt7621_wdt_dev); + struct mt7621_wdt_data *drvdata = platform_get_drvdata(pdev); + + mt7621_wdt_stop(&drvdata->wdt); } static const struct of_device_id mt7621_wdt_match[] = { From patchwork Sat Feb 11 07:33:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Paracuellos X-Patchwork-Id: 13136935 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 ACA1FC64ED8 for ; Sat, 11 Feb 2023 07:34:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229671AbjBKHeK (ORCPT ); Sat, 11 Feb 2023 02:34:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbjBKHeJ (ORCPT ); Sat, 11 Feb 2023 02:34:09 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E1432A6D6; Fri, 10 Feb 2023 23:34:08 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id az4-20020a05600c600400b003dff767a1f1so5612640wmb.2; Fri, 10 Feb 2023 23:34:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=BLAmTwGROSc7NPK5pPUXsH009XpQBIleEsTQztuacG0=; b=K31o9ot37al44f+dNK/AWrD7FpEn5jU8g/Wq8H1nazUjutTvjldG4dCjn+F5XPr+Ew XTZmGQRTAq4zpRNTQtaO5n8P0G6gsXOXppCFyFkGlZjdzikjQ97DysAaqqOEuq9qO3SR h2nyL1ugBmsBzIsFRyxNKhlwDCj/DYnNFjSGnK+bqzltonkvfxyveQhQ7npCPSYDvhvL iFVVmFE56Epk06eOXi85fmvBIO00RdBcQEUkMGEUnGgdkhkv2jKwCmGNBSC6Bs62iinF zBoI5QUwQMAmzhFG1e6YztK3lk5AGPpkLXJ6anDntTWgQvqnkb7yuG8hY8ZJXLV4f7fM Vrww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=BLAmTwGROSc7NPK5pPUXsH009XpQBIleEsTQztuacG0=; b=EooilULHwf3cNm7NgBSWdRvevJ+p+nmeuNdISW/CSzkzyFLTbB5Bk4KwpGqyCkAShc QN1NMYG3RUw1goUILqEIJ8YUcT2G8mON3QAuIDPmcDib7ranjC6j7dUi4vI2EWb7E7iq dOmRbJnWiRM0ww24TIHCGJ3IMB8OycJGIBR36pO5vH52Wb03SjLLeRoq9uDAGAwrAB87 woc2p9p8Kw6cKaaQVO8yHzDbfRlyTcySavijahveH5MAEk/wgQ7EJGwJbU2+kmDh7z75 kG9+Jy7ZtbhU4HdsQlxvOeivaW09YzD7IQ9wfUbgEUrFjPYRdOt23wpoRkF5dmpwedvx iaAg== X-Gm-Message-State: AO0yUKUUbKxMJAysu1659mosuzV1stGAYbvkHGTUJcN3/p2VrEWKLZ3U LFJPEelV776bnXKEyv19dQRfAxSZ6NQ= X-Google-Smtp-Source: AK7set/iq7UVY+SA3X2XBZTFdGF8890AM3Pvqf+1eK5jQ6/W5TzH5XDefv26kfKvCqhuBwJTTJOTFg== X-Received: by 2002:a05:600c:43c7:b0:3dc:5d34:dbe5 with SMTP id f7-20020a05600c43c700b003dc5d34dbe5mr14491745wmn.28.1676100846266; Fri, 10 Feb 2023 23:34:06 -0800 (PST) Received: from localhost.localdomain (23.red-88-10-60.dynamicip.rima-tde.net. [88.10.60.23]) by smtp.gmail.com with ESMTPSA id j23-20020a05600c1c1700b003daf681d05dsm7917829wms.26.2023.02.10.23.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 23:34:05 -0800 (PST) From: Sergio Paracuellos To: linux-watchdog@vger.kernel.org Cc: wim@linux-watchdog.org, linux@roeck-us.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, arinc.unal@arinc9.com, tsbogend@alpha.franken.de, p.zabel@pengutronix.de, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mips@vger.kernel.org Subject: [PATCH v4 5/5] watchdog: mt7621-wdt: avoid ralink architecture dependent code Date: Sat, 11 Feb 2023 08:33:57 +0100 Message-Id: <20230211073357.755893-6-sergio.paracuellos@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230211073357.755893-1-sergio.paracuellos@gmail.com> References: <20230211073357.755893-1-sergio.paracuellos@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org MT7621 SoC has a system controller node. Watchdog need to access to reset status register. Ralink architecture and related driver are old and from the beggining they are using some architecture dependent operations for accessing this shared registers through 'asm/mach-ralink/ralink_regs.h' header file. However this is not ideal from a driver perspective which can just access to the system controller registers in an arch independent way using regmap syscon APIs. Update Kconfig accordingly to select new added dependencies and allow driver to be compile tested. Reviewed-by: Guenter Roeck Signed-off-by: Sergio Paracuellos --- drivers/watchdog/Kconfig | 4 +++- drivers/watchdog/mt7621_wdt.c | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index b64bc49c7..cf752ad64 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -1865,7 +1865,9 @@ config GXP_WATCHDOG config MT7621_WDT tristate "Mediatek SoC watchdog" select WATCHDOG_CORE - depends on SOC_MT7620 || SOC_MT7621 + select REGMAP_MMIO + select MFD_SYSCON + depends on SOC_MT7620 || SOC_MT7621 || COMPILE_TEST help Hardware driver for the Mediatek/Ralink MT7621/8 SoC Watchdog Timer. diff --git a/drivers/watchdog/mt7621_wdt.c b/drivers/watchdog/mt7621_wdt.c index 40fb2c9ba..9ed07c187 100644 --- a/drivers/watchdog/mt7621_wdt.c +++ b/drivers/watchdog/mt7621_wdt.c @@ -15,8 +15,8 @@ #include #include #include - -#include +#include +#include #define SYSC_RSTSTAT 0x38 #define WDT_RST_CAUSE BIT(1) @@ -34,6 +34,7 @@ struct mt7621_wdt_data { void __iomem *base; struct reset_control *rst; + struct regmap *sysc; struct watchdog_device wdt; }; @@ -104,9 +105,12 @@ static int mt7621_wdt_stop(struct watchdog_device *w) return 0; } -static int mt7621_wdt_bootcause(void) +static int mt7621_wdt_bootcause(struct mt7621_wdt_data *d) { - if (rt_sysc_r32(SYSC_RSTSTAT) & WDT_RST_CAUSE) + u32 val; + + regmap_read(d->sysc, SYSC_RSTSTAT, &val); + if (val & WDT_RST_CAUSE) return WDIOF_CARDRESET; return 0; @@ -134,6 +138,7 @@ static const struct watchdog_ops mt7621_wdt_ops = { static int mt7621_wdt_probe(struct platform_device *pdev) { + struct device_node *np = pdev->dev.of_node; struct device *dev = &pdev->dev; struct watchdog_device *mt7621_wdt; struct mt7621_wdt_data *drvdata; @@ -143,6 +148,10 @@ static int mt7621_wdt_probe(struct platform_device *pdev) if (!drvdata) return -ENOMEM; + drvdata->sysc = syscon_regmap_lookup_by_phandle(np, "mediatek,sysctl"); + if (IS_ERR(drvdata->sysc)) + return PTR_ERR(drvdata->sysc); + drvdata->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(drvdata->base)) return PTR_ERR(drvdata->base); @@ -158,7 +167,7 @@ static int mt7621_wdt_probe(struct platform_device *pdev) mt7621_wdt->max_timeout = 0xfffful / 1000; mt7621_wdt->parent = dev; - mt7621_wdt->bootstatus = mt7621_wdt_bootcause(); + mt7621_wdt->bootstatus = mt7621_wdt_bootcause(drvdata); watchdog_init_timeout(mt7621_wdt, mt7621_wdt->max_timeout, dev); watchdog_set_nowayout(mt7621_wdt, nowayout);