From patchwork Tue Feb 14 10:39:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Paracuellos X-Patchwork-Id: 13139843 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 39370C64EC7 for ; Tue, 14 Feb 2023 10:39:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232624AbjBNKjo (ORCPT ); Tue, 14 Feb 2023 05:39:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231821AbjBNKjm (ORCPT ); Tue, 14 Feb 2023 05:39:42 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9F8522790; Tue, 14 Feb 2023 02:39:41 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id co8so11381255wrb.1; Tue, 14 Feb 2023 02:39:41 -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=R3sle6vuJ5ZYj6zgwI9CIQN7irdJcOFiW2OuMgXb4rs=; b=JxplB8Ky26UGe9loBVHiSx1XcBVzieiq3QSgtjF7xy0DSxcQnqZ1TkWA8n4MMR4u9k uJqZejYgwkWBA/hwIOyz5xuzyo0pqpK4dXY4hw+MC2iJUO9p+bUCmuAK4PDVFuMcU5fv JmN540jx4AuwmCxprANzwDqJaVNEfYxIs9vtuOCulCJFp62+amMAMNxReFVQtViUscG9 K2trPT6ImGChkD2Z83ZYgSVhzIvDsClycKo2ereoqDT5znNUuF9Y7lZ5DX92Y9bNoL7m o23V34pYg44pRPYrWwHbrJmfXtN0Qe7wOeoKCx9aKKmHJf5DzjLDhZunQMuH/IEv5Vl9 4IFg== 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=R3sle6vuJ5ZYj6zgwI9CIQN7irdJcOFiW2OuMgXb4rs=; b=x3duznDXrtoBMXI2DctkuWEl9TCmk0uVUUwTLZC8G9EAOgQgBVlh8PbLjkKhY10DIJ 31JxU0AppaAuj3ttgKht1cHYXYGd+br6M9nPrF4OHQGFUkh69tPwwWRvud8znvggAPck 7Q4PlAFhOd8+1T6k/joneC33O+buSw7iiTEFYHegLpX9cZRLUvSQPkEK6tTdWecAatDE E/kB2TBT2vda12oSqkJhSYBA3BU69er0roEwLSturWqN1+iK/ciReeuo3t63FFbVd7Zh 1XKu+37E+rgttTKzk497jCigkGgDpkHI4fHN3UYQ/JIp6FfP10Kegx6K5wtTk9SsJrml 1LPA== X-Gm-Message-State: AO0yUKW1r4AZov2n9G8z3454RAsLKhzJ2VIu9U99QzJIt5jZ2SBlzQak +/b7zI9SG6qZcD2K6XG/2NTqB7IOLDE= X-Google-Smtp-Source: AK7set/O59WS6Lcp7zvlgmIQ639/Lvnj3eaoEDyNx7m9GscQZTM+/ZeQHkNP5GJFlBurI62NTl7hoQ== X-Received: by 2002:adf:f643:0:b0:2bf:1ec:a068 with SMTP id x3-20020adff643000000b002bf01eca068mr1803480wrp.53.1676371180095; Tue, 14 Feb 2023 02:39:40 -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 v2-20020a5d6102000000b002be5bdbe40csm12693241wrt.27.2023.02.14.02.39.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 02:39:39 -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, Krzysztof Kozlowski Subject: [PATCH v7 1/5] dt-bindings: watchdog: mt7621-wdt: add phandle to access system controller registers Date: Tue, 14 Feb 2023 11:39:32 +0100 Message-Id: <20230214103936.1061078-2-sergio.paracuellos@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230214103936.1061078-1-sergio.paracuellos@gmail.com> References: <20230214103936.1061078-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. Acked-by: Krzysztof Kozlowski Signed-off-by: Sergio Paracuellos Reviewed-by: Guenter Roeck --- .../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 b2b17fdf4e39..a668d0c2f14b 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 Tue Feb 14 10:39:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergio Paracuellos X-Patchwork-Id: 13139845 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 6EB80C678DB for ; Tue, 14 Feb 2023 10:39:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232650AbjBNKjv (ORCPT ); Tue, 14 Feb 2023 05:39:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232645AbjBNKjo (ORCPT ); Tue, 14 Feb 2023 05:39:44 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0144F244B3; Tue, 14 Feb 2023 02:39:42 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id g6-20020a05600c310600b003e1f6dff952so672729wmo.1; Tue, 14 Feb 2023 02:39:42 -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=9x1QraTZIx1mxn1ybzEQ9Nso18S7k6Ao6CArkPQDRXU=; b=ELd61XLdoBzFgVcqTvGtMDXoG/8GNoIoGuLMHnedoJVRea/0zUU12mqJEmRcOoL3aZ M0zl8lPOtTx1pUdXyRtU3agwb6e2b1ONZrl1RQxQmDNbYInfxg9NgpDM4MmKSynwmmFO j3KkllZBM20EtIQKWLSmJ4eTpZ6adk/65gtPkV3w2c4ZctYQwvLkXGHqujqsBD9C9wul l1Wt4AXOZWYzmMJpdWw+dU8zz1n4WwRbO0EFwiCKGPffKFq7XzlCFapauxx2CEwMZbpe qA1fKiqfM/7co1pAmR5Ig9VMScV/1VY06c/7RTAR0H6lB0LTmjOIg/p2vWUCoWugEJcA ssVw== 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=9x1QraTZIx1mxn1ybzEQ9Nso18S7k6Ao6CArkPQDRXU=; b=4KlcEa+bpzpbXD/dgztpSz95StmGUGuT7Q8DhJerP38FDiE0d28mEL/c5mJkrM7Fow jhH7rtMKTJ/HikelKcxIC2JwO4TG8jZKZmg+fQFIaCC9ZqYjurR+Wu5VHfA8cZWrO0lA h4hvAotCQD81tn8fVcxeLH99szl9AB7KDdxBU3wWP7f83bEU59t/PuHf13K0bmF7niRy 5oGadxM7MgHeiYOGyPAEtuuJ8oek3C1rMmOXm3peeDB83D0+sXeveoYeKe18JLG8YsK7 FZ8fi041gop+WEKcKDW6rxfjvvun7hjKfouxpLwQZvgZXrI2XxnhHv9NifCSoMG6cXqW UuPw== X-Gm-Message-State: AO0yUKWLJqkLLNT/w5Yf0yozAlqBB9wM7eT8aGOZ/n98f4CA9SluuJoD 7RQzVjaM8Lrs/ss8M1hItsy3THs72No= X-Google-Smtp-Source: AK7set/Qf6TB5G+MxxRm/ADJl3gFIvHnQw7N3RmvZi01c1mr2P5CX0IIMDA1lgs8Q/UtFrTbK22FvQ== X-Received: by 2002:a05:600c:3412:b0:3dd:b0b3:811b with SMTP id y18-20020a05600c341200b003ddb0b3811bmr1549659wmp.31.1676371181298; Tue, 14 Feb 2023 02:39:41 -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 v2-20020a5d6102000000b002be5bdbe40csm12693241wrt.27.2023.02.14.02.39.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 02:39:40 -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, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v7 2/5] mips: dts: ralink: mt7621: rename watchdog node from 'wdt' into 'watchdog' Date: Tue, 14 Feb 2023 11:39:33 +0100 Message-Id: <20230214103936.1061078-3-sergio.paracuellos@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230214103936.1061078-1-sergio.paracuellos@gmail.com> References: <20230214103936.1061078-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'. Reviewed-by: Arınç ÜNAL Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Sergio Paracuellos Acked-by: Guenter Roeck --- 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 5ca40fd21662..ac818fd721ae 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>; }; From patchwork Tue Feb 14 10:39:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergio Paracuellos X-Patchwork-Id: 13139844 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 76C7CC64ED8 for ; Tue, 14 Feb 2023 10:39:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231715AbjBNKjv (ORCPT ); Tue, 14 Feb 2023 05:39:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232653AbjBNKjp (ORCPT ); Tue, 14 Feb 2023 05:39:45 -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 4AC0A244B6; Tue, 14 Feb 2023 02:39:44 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id l37-20020a05600c1d2500b003dfe46a9801so11230701wms.0; Tue, 14 Feb 2023 02:39:44 -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=ekxDSggQEhQ7H1NkJge9cvo6SYMx9+I0A7x1Q/tQJSo=; b=hweHO2jbKLEYBnzJIcDq8JaPYzxv/MTxMwloUS5d8wcZPUWgLNHa7VPTMG4deBK5kR ILIwcNSV73+iydbWDKSEqxb9PaLRqL27RtVeVyiq/mB1HBHYhVwwdtsPkYGm7ePaOOu0 2YDMUb4xb4jhiSqeb78HNh38cmDi5NpBYaKn3SmxO8lSxg37RbEk+Zxw0fBhLSvBcxxv FsMX9lluBzCeucOvd341nNoAB6eLsLLdgoyjkxsSbX2+fIbsrtjm1Q7mksWqDo+FhxvP VQcZ4AHjUAKaT6kwCt/fVXsLHBcsQNGr3kLl459KfHk4/lkg3QM1JOn3U/sZyvsHTbQh Qd3g== 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=ekxDSggQEhQ7H1NkJge9cvo6SYMx9+I0A7x1Q/tQJSo=; b=7JTvFGPnuJ9Nhwoo9CDcrkZDHC8MyDMyFq7V3zRnAQvo2eybo91gSg9yyNgRkC3cyP p7/v9cJc0vHBV+4etQM6Czsl3dZ8TuvPbAbRdHHXcnf7LuxYWZkGrhXslN+O0IPhO8pN h8CTnb3GjD6DLQpqDf4I641QXjLw2LKRxHOsIqGDgxg8aj9B04HRS2v2fsnJiwWFyvtN gR9ndX88k4qwmEf2c2QClumITzJpPJuSJYWt2IGDvGWM3VkZ8a4vWljC7ycmNcXZD9k7 9a1DF6e7SlaFxvE15uJgMo3dW1vweGU2mns3M7xpe6NnSbeWxqYXWoeyKC9HtYlOBiQU Q/RQ== X-Gm-Message-State: AO0yUKV2LpDRsNSIK/lfljhGfO24ixWUST8NenEvjYdhpkRdGVa7ryky 1lBcgv7hTY+CcKAO91o0wdG0K/KCcYg= X-Google-Smtp-Source: AK7set87QWbytswcbk5ef/eFip2htvxUelGTmP3NtH6bAsafuVc7gj7Vp8RGeEdr8VEDMPBY1P9GPw== X-Received: by 2002:a05:600c:1656:b0:3dc:561a:79d8 with SMTP id o22-20020a05600c165600b003dc561a79d8mr1546799wmn.35.1676371182460; Tue, 14 Feb 2023 02:39:42 -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 v2-20020a5d6102000000b002be5bdbe40csm12693241wrt.27.2023.02.14.02.39.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 02:39:42 -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 v7 3/5] mips: dts: ralink: mt7621: add phandle to system controller node for watchdog Date: Tue, 14 Feb 2023 11:39:34 +0100 Message-Id: <20230214103936.1061078-4-sergio.paracuellos@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230214103936.1061078-1-sergio.paracuellos@gmail.com> References: <20230214103936.1061078-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. Reviewed-by: Arınç ÜNAL Signed-off-by: Sergio Paracuellos Acked-by: Guenter Roeck --- 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 ac818fd721ae..3d16beb77440 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: watchdog@100 { compatible = "mediatek,mt7621-wdt"; reg = <0x100 0x100>; + mediatek,sysctl = <&sysc>; }; gpio: gpio@600 { From patchwork Tue Feb 14 10:39:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Paracuellos X-Patchwork-Id: 13139846 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 2A810C6FA8E for ; Tue, 14 Feb 2023 10:39:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232658AbjBNKjw (ORCPT ); Tue, 14 Feb 2023 05:39:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232662AbjBNKjq (ORCPT ); Tue, 14 Feb 2023 05:39:46 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56D69244BF; Tue, 14 Feb 2023 02:39:45 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id y1so15145797wru.2; Tue, 14 Feb 2023 02:39:45 -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=ewfJwtiy2W78qOtjbFlDdsN+Z28Z6BOnhlNXuwrvpus=; b=EbPAhAtWgeF/um6jlBHeNDIrEKnJA3+JYO0xH8aqEBPl0RqDUVnWa70e3XC/1D47VK L+O0ewUHSLevm8iEGGcivVOV0rdQ+rfOKK76gMYXRaEU73GHto635E68U8mzTCX0i3m9 WNt+TKdUKoBwFm5LUO2nsAJCM4kMbAo5KQizI2f7t6AsRBzYCkoVofRM0iydblbUBxaa ceb6wMGRQE4HOs1pEadYMhrYC5y+DODbvF1UCUNnq74HrTWaGR2l0YlEKMQA21oaZ1ai /13JLJ/edobVd9xkqMk7HbniRplZ4/Q3BAf1nDiabXKfzSvDHNmiFBFkt/A+matOgfdj hsWA== 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=ewfJwtiy2W78qOtjbFlDdsN+Z28Z6BOnhlNXuwrvpus=; b=t+GwT+W/UcoTt4/bzlfO0pvvA0Xiznc2qqMGWxm1L9j54U35S49j8QiqfaEaSBA5lL YWwsMLF3kBuTAvUJkPYz+zq9Rxacweeti5YIQyffoAUbWd8htSdrchqMUz4KkfIrsfMl 715Yn/VhP6HBSix1M7ahKakNlUIKa1qVDnLVopOiQ/JbAKtsUnI8t4NCve+khXUQ7ahV usjOzV+duBfNvOYhExRrgL/Slr1vgT8u6HisZ0BltEMSxQyzTZ7bDLQWXT95XlQ2Fpx8 0lJw4ewFHTJkLSvoc//sae7SNIxrPm4mhTWSy3O0XfIx5sN4Ux/BiN3Fn9wSxTSvKov1 DanA== X-Gm-Message-State: AO0yUKWOUo5jPo5vj0wnOXGrwI8dvmu4F8HQ37S7Osb4iZ7Oq5cy3C79 rJexU6xOjjgshiokdBhx1DyC13cHyfU= X-Google-Smtp-Source: AK7set99iXceNG+B5zJJCyhryLyCEZgaThQxM38LclsQ1+FASrZXV+8GvDPOI0gyLefR2KWhxOBclw== X-Received: by 2002:a05:6000:1244:b0:2c5:4cd0:4b86 with SMTP id j4-20020a056000124400b002c54cd04b86mr1686641wrx.68.1676371183603; Tue, 14 Feb 2023 02:39:43 -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 v2-20020a5d6102000000b002be5bdbe40csm12693241wrt.27.2023.02.14.02.39.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 02:39:43 -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 v7 4/5] watchdog: mt7621-wdt: avoid static global declarations Date: Tue, 14 Feb 2023 11:39:35 +0100 Message-Id: <20230214103936.1061078-5-sergio.paracuellos@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230214103936.1061078-1-sergio.paracuellos@gmail.com> References: <20230214103936.1061078-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 a8aa3522cfda..40fb2c9ba9d9 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 Tue Feb 14 10:39:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Paracuellos X-Patchwork-Id: 13139847 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 E5852C6FA9E for ; Tue, 14 Feb 2023 10:39:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232270AbjBNKjw (ORCPT ); Tue, 14 Feb 2023 05:39:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232670AbjBNKjr (ORCPT ); Tue, 14 Feb 2023 05:39:47 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C12C244B3; Tue, 14 Feb 2023 02:39:46 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id a2so15134376wrd.6; Tue, 14 Feb 2023 02:39:46 -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=CG6+guVzRQjTbRLIGLzjFnyLsgkRwGsfNNLnjnu+i0s=; b=TNfbzoo0DPmK0ZpI0MZ0cwW6nGW+rhf0ZoQnJtepOR3qG1j0Qs6QCvVcEyBJ3Ysv4m Sw9VZdcBhLKa11W40/Q2ZCGOsVNSxZnyK709poQQX3DFD8ztEp9OTfPdKmBiXn7yibCD Y5LerYKNvhDSGFTDj677xHzBaJ0A0vGHYWgwBSjNBYtwllL3w/JHSCDrorgClwNE8XQQ G2U7eOxHEMY+C2P2reIkIYwktp5nyjO+QL2Tf7VCv7vx5l0AKHpGZ+Yqdie41pqhz7YF OCW6GaOlpDUCkJYY7Cndzd/e2IMf3s7YmptH9wxe3/vqx3sKNcrX2/q9uM/smaI6mBHJ 9r+A== 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=CG6+guVzRQjTbRLIGLzjFnyLsgkRwGsfNNLnjnu+i0s=; b=hO3ghkH+FmFc8TD8FfxwnHPMrsM+39u2md8pNOOj1FxGxJH88QeeuCnM0CCyn+msPO qUQQEVTuPxZJaK8hyZqgKs28UmuQY+PNFZkcTF7A9nvGFELOCnWreBhVkQblUPuwLBvu BpoHp+N0joq7dWD2kT2W2mxCjnnWWwjEzUfsQ+g/l0k614oUwOLQ/tFYdy/Bl/pZ5n9K ya5KgWNDBLy+kcopBjQ14XsHRNmAIbL+tUtnEQQEYpRSYDiXMqnbYSBtYx93GVW42Wr5 cxN1r8avi6/SMyMOPJOS3hwEXUWG17FvNTA584F01UP07+PVw1dp4cdxRIOCD4GtZUuw Hqow== X-Gm-Message-State: AO0yUKWQUuIibMgZG8LFg9GxGPLyho1LhouSY5v6cUePFq0gcnF+/lYV 0YF3sXeWsw7zcAbMwDjHNfav2BxfJSA= X-Google-Smtp-Source: AK7set+RJaZMNjJyW8sfMcSBInlOma1zNgii+lyMKRjaUcpAVyogYmZPSUDuX8PWn4cjmLQCBNXgoQ== X-Received: by 2002:a5d:4e8a:0:b0:2c5:5847:3910 with SMTP id e10-20020a5d4e8a000000b002c558473910mr1472528wru.8.1676371184809; Tue, 14 Feb 2023 02:39:44 -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 v2-20020a5d6102000000b002be5bdbe40csm12693241wrt.27.2023.02.14.02.39.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 02:39:44 -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 v7 5/5] watchdog: mt7621-wdt: avoid ralink architecture dependent code Date: Tue, 14 Feb 2023 11:39:36 +0100 Message-Id: <20230214103936.1061078-6-sergio.paracuellos@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230214103936.1061078-1-sergio.paracuellos@gmail.com> References: <20230214103936.1061078-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. Signed-off-by: Sergio Paracuellos Reviewed-by: Guenter Roeck --- drivers/watchdog/Kconfig | 4 +++- drivers/watchdog/mt7621_wdt.c | 22 +++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index b64bc49c7f30..cf752ad64392 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 40fb2c9ba9d9..f37d8298a480 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,13 @@ 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)) { + drvdata->sysc = syscon_regmap_lookup_by_compatible("mediatek,mt7621-sysc"); + 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 +170,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);