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: 55728 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1381690wrn; Fri, 10 Feb 2023 23:42:32 -0800 (PST) X-Google-Smtp-Source: AK7set8OULbv9jj8G3szb4ClGHQHCkb1KlyICrcmBBQUm339hfOvglF3PPMGI3V3a/OZnj2U3GVm X-Received: by 2002:a17:906:704f:b0:878:955e:b4a4 with SMTP id r15-20020a170906704f00b00878955eb4a4mr17920851ejj.33.1676101352634; Fri, 10 Feb 2023 23:42:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676101352; cv=none; d=google.com; s=arc-20160816; b=Dk/MtmQ+qkD1lJ+x5ayJ7ugZnSFwmbiPtZKlN/N0d0onY/ZMR+Uv7j9XFK1ykkS5B+ FeoV1yqaSHZ2uQJtFlmNV98UXLLpqpPavzkubcyZmf4WAV/Xf2mGcKNTUwwtbcThuFPU sIkUq1ou0XSAcXkX/a3og9iN6uxDwb/0NSDCSYnQGyDS6O0MlXn6CacManJ0veeyC0D9 00Hm0XI71TvFmYFardKVprF/gkNIgsCvUZ3+g2v/b2G6a/PLYrpBzyGiaqJkiQhxeVmy Gaf+u/9hNcvWTcMIvuLhutSVfcEDnQPYsfHms4ffiC5lBW5mOGL0L3B16A7/AEN+Yxsk 1Z1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BnXrkD6mC1X9wvYtsECorUK6F5CsiEFkvfTGl5Os3Dw=; b=ovjPFV6FV43qIgx5K89lQ7ZIiClxu8EG+HYnbnHfcbbk1fh0FzrXHAJSwQjpYr3pkk 9Jntu7ledV6LgXjEr3Ac6Dde7/G0ZXHt4vP9RX6iBjUfa7YhbEQh4z7jUmbxsCKsBaJI vYPNeDa7XbgQ1YKOel4e468xQ/F97R0F6m1S83X+ZZIm0V3MUMqr2PECssLNBId8DVHP ILWf6aoXF8PynXrODyiJBE46yPZOJO0kfuRRrR1Gpv1YQgNlcYr1D6FhEWBliHkosdqB /mEJBGDrbTEba9RJZpJRv05nyJNgCMa1qQqqc0Qm3nADV1phQGvL0vk2Qe/KCmgXH4nM RA5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=g8wJsblo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gj32-20020a170907742000b0086d4912935csi6747914ejc.267.2023.02.10.23.42.10; Fri, 10 Feb 2023 23:42:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=g8wJsblo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229645AbjBKHeI (ORCPT + 99 others); Sat, 11 Feb 2023 02:34:08 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757519652130650624?= X-GMAIL-MSGID: =?utf-8?q?1757519652130650624?= 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: 55723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1381551wrn; Fri, 10 Feb 2023 23:42:06 -0800 (PST) X-Google-Smtp-Source: AK7set82BQR+0aF5NI5V0EgB0xHxY0EL53lDsOaSyY8lQWKdreYkvY/fxdFZDripGA6+LxJ7izkJ X-Received: by 2002:a17:907:1184:b0:878:6519:c740 with SMTP id uz4-20020a170907118400b008786519c740mr20303307ejb.44.1676101326459; Fri, 10 Feb 2023 23:42:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676101326; cv=none; d=google.com; s=arc-20160816; b=0Og/ocBUBsxWw1ITjKoTCUqoGb6ERtavjij7tAieWZqKFi9rvTejVkUKV4eMeWUxGV 9HFavXZXC9bSd21YKFgCdv/4SCWslo7FCaYeMTQv2NBrELjerql+XWJpzrY3VGtXOoou ft3HuWXYWIWY36TBNAuMA4in0TdkDFY4e4R3tJheth5yGkdHPIWB0fvtWx7ujjVz20qN Rz91HRMoHyAlDsXA7ZLaL5CRaDLtFNy7Dp1d1TmJmzEkRUDm4YB/6hReeZoF/WBX46GB ZlGCLrMSUAs0CMUBTJBg0n2RwwLIwe2rcfu0Q95k5SLgiT4hQ+KntVOVpAG0kEPBXKQw YmrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=u2xLyJ53huQXvmhIZNGemIcemfb0LptCrFwxhBre8f0=; b=Qv6ENAxoDQfcINkYvSgaXkfuZiunoyB4disR3gmb+oh7kNm04PTk1jSCfpTAp+k88t +bTSUBkXys4cChGTIcROModOig/aEiN+dUJ5XZX2FWVKPXTyWg3CEai8Wh9ahByLxco2 CLr0UD4R1v3BrQxJbca/a0P0s2InkVVcRg+7+aLExE8zKxNcrTUR41yU5Vmlhu6TT6py 1qhVC9sYA67HpZKS5MDeG8U97gbzEGcNkVCM1rlEkEUVBwxIRrrKYwPahUGZRFm4/5lb O4mGBc17ghbkJG907L30BL6qKrJQ7Rnr0SZtHa8+E4sU1K4gkm6DQiRY4CsHTBQPf1+u K1+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nc53IyZL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fh3-20020a1709073a8300b0087bd6ca2cb2si7078066ejc.372.2023.02.10.23.41.43; Fri, 10 Feb 2023 23:42:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nc53IyZL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229689AbjBKHeL (ORCPT + 99 others); Sat, 11 Feb 2023 02:34:11 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757519624665437206?= X-GMAIL-MSGID: =?utf-8?q?1757519624665437206?= 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: 55726 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1381660wrn; Fri, 10 Feb 2023 23:42:27 -0800 (PST) X-Google-Smtp-Source: AK7set8vLLoy6boV8P+uI3dO/LARuT+0Lf7F23TEjbdm3vbt+ZGyn5hOXIuwPPCH5A6rLIjyjAP4 X-Received: by 2002:a17:907:2cc3:b0:8ae:e30f:4091 with SMTP id hg3-20020a1709072cc300b008aee30f4091mr14723986ejc.30.1676101347312; Fri, 10 Feb 2023 23:42:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676101347; cv=none; d=google.com; s=arc-20160816; b=LnFFen7m7yKK0xtYfK1FrdeWHXFgdxNJzX76mAAADnyH85kwYtwbBH6xCR3OIgWEpv Clm68Kw7MHNmB3R/neDdfTE6ct+E9kworovEWII26O3FMSevv7jilM26ePBhrwPWVDkN O2N3unGX6Dtsr1DjLmckiGyjoGDuzUqJrkSefRoN1yy699uBvUIwzwH+ILxMFJjJZkP3 nexWvzjMLuF6keLEV9juR0VkkzdP/1qAe/jNPWgkmjFo5KW8zSxCKiYlAuDgqlrVZTSb KOAT1p6pyE2qja0s1267cSjO2XPCaxLA9FoeVvAJYaesErDjGlSCvU9Fg7ptoOgrkQWH hq/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kVRb8cmWOFqU9n4+7sFTWzjVPS3DujkHQ/+pnVD+RAM=; b=hBKbDqjTI9YKfhVxrHo8ogL8ezyNPZrHgHvDsTicIRWCfCFUQsHGIUqrhIa7lOOQpw 1+FxUq/VgyEsZR3N1S8zUajRMHlDA/ovBypLZ8OQ1tfxdeogcKcO9nFQxyDjujJ/jI3a U1o6ap++ExqBNeGOYTXetuTcPk2J5uRXe/AvSvJvSCz7m10OALtffi0ziOfUrKwiJJaA IUMB6yqcNSk21pC52mKPeN0RIY0A44IGGc29NsfparisfC+USg9kRe5inm2eWojUNaSk ZrGDDFgYIX5NIqG/b2kYgyo0M3l3+SbV7M8NB6QlYPwfyPCrl6JxuP1vFhGJiOrlJMso auKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=EsUPcIoT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id vs19-20020a170907139300b00890ac6d67efsi489985ejb.44.2023.02.10.23.42.04; Fri, 10 Feb 2023 23:42:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=EsUPcIoT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229729AbjBKHeP (ORCPT + 99 others); Sat, 11 Feb 2023 02:34:15 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757519646313847427?= X-GMAIL-MSGID: =?utf-8?q?1757519646313847427?= 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: 55725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1381585wrn; Fri, 10 Feb 2023 23:42:13 -0800 (PST) X-Google-Smtp-Source: AK7set8g7eEC9XdG1XgasQ6JZxnxZKLWyHuhaZ2xo1Hsnkr+WGP98/QLT/nN4x8O6+rQ2bzcjU+d X-Received: by 2002:a17:907:1dd9:b0:894:ad38:aafb with SMTP id og25-20020a1709071dd900b00894ad38aafbmr19060528ejc.18.1676101333605; Fri, 10 Feb 2023 23:42:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676101333; cv=none; d=google.com; s=arc-20160816; b=bEFPZCB0sgAZhAleMxJUm4pqbBx9zTDiCkF5fZM9Lv5BsAI3SFZeWsqMt+3n+4IAz4 lncGNVJBX6yw9hHT08KC+4ooGG9ldfI+sWC2ZQdeHltexkdyS6kSyPvTbITwWIRf4GWB 0wUJjhF/n8HrAiLpJHj7aP5xgLRUSw10pn8d8w7WTGqn97e0FhKtb6OB09fc3E8kpXe6 IbXoqwErtytUaXHqXtb75P7XXCcj9obaBZkPoVoJDf/ww8OZrM8dR9GsD8UolYlvKtu6 DWhOKC5e9HfGWjRVtVBUkOKoxnd86m5/16q3q/HHZbE3q3VTU0W5aNrXKFiwH3xGa47T 4vCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eTGPGFaQb/DlfYZrXhPbzKJDWxh4+D5n3UiQCEuPX0I=; b=psCGVIVDMXyL+gls1D5a0A98fACg0OYz4qsmvI6x8Pfv94qmyuMEEQHJckl92QBRZq x3uULLMH9MaLziGzxbl/mQKnTUtgXyLUy/4plOT9QMZXiZYtjEtpsgzfJ784J3nVXhSV M0F2ukdw3EoB5Oq/4RXQ3Oz1zMCplzhJgHkBdBWKvtVFyH+AITv19AxOfMMRVmXTEvym mA/Jy/fW+UOE/MFRncnkSdxGWt323ikLxBnejnY+62FDgwIJOKB4EUgE9XpPBiBupv9U ciwe4HMIw1tOJeRwGQkLKygcUui+X1Ff/EZHeC6VebOBt9UwzmXBHjA5YpHv9rDbMpH+ TMdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="WBZBv5+/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wg15-20020a1709078f0f00b008a9a111ce8dsi7259170ejc.4.2023.02.10.23.41.50; Fri, 10 Feb 2023 23:42:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="WBZBv5+/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229743AbjBKHeS (ORCPT + 99 others); Sat, 11 Feb 2023 02:34:18 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757519632256918423?= X-GMAIL-MSGID: =?utf-8?q?1757519632256918423?= 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: 55724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1381583wrn; Fri, 10 Feb 2023 23:42:13 -0800 (PST) X-Google-Smtp-Source: AK7set+6nNJ2sehkrlZq+oeJqQmW3rsJurujzcowXhKU4PogpjwL39UPQ2GJxjK+YJn/aH0oyTFz X-Received: by 2002:a17:906:fe41:b0:8aa:12c2:5ef2 with SMTP id wz1-20020a170906fe4100b008aa12c25ef2mr22890465ejb.13.1676101333298; Fri, 10 Feb 2023 23:42:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676101333; cv=none; d=google.com; s=arc-20160816; b=KFwe0FD1RKR7g3klbaomnpTf5vnre/+NuJTs8AE3TEu6wnmSR7R4ckVE+OouR/Pqhl 4zZ9cLy/fhEZJ5m/E5wQl6mWZx+wryJ8QfqWBDYi5LiLhOLhjUyTWqnRmQSHsEkcG2Gl 9raM/TtAnntp4EBwt1EAz4wsntWvWOT5y6MUXrCys0TUWJex6wFHpfirc9HaMSzHA4eh VFpAe6r7+7y30i89VTAfqQYRq+fe8wKTGMkLC1/0gsx8wETi9kU+2yyFsmePqn+dGQhy 8FtPbDMFJGOt7Up5oFhMW2IOvXYy4nOKuLsanJ+gprJQSz00lJzQPQ4PGjkdrEjdUXQg ObYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BLAmTwGROSc7NPK5pPUXsH009XpQBIleEsTQztuacG0=; b=AvLQQqz9ThBV3UfKIZ0aou4FcWWn9tkLzjkIbN8QOFEKIkmhQq2AZg9Qh92Jz3WGt0 Xxj4S4+R+P38fHEPZDm92pLEmCk4+G+KXwgBXC/6Y/Y/24+cE9ClDOqKJDwmzp8WgOnZ 3+M69vWc/8vpp8U54NooHIxqm1jljNETFtQ1TEIk5ul92YgKDqyuIrsgtmKn79oIOlp1 EWAKdM9rsNOREaY+/RdA1S+RWk0jMAXAju/8kgCgNcfvzK5WW7bDuXPrpzC4IADc23zW gFSfGaZW/rGzK5xWLjCrP89ZVzP5RWIdpwUgbRIM7wDgPOF1anAxnjxK643UsZBP+tTV hwWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=K31o9ot3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 15-20020a170906208f00b0086f0864592dsi7922782ejq.321.2023.02.10.23.41.50; Fri, 10 Feb 2023 23:42:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=K31o9ot3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229703AbjBKHeM (ORCPT + 99 others); Sat, 11 Feb 2023 02:34:12 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757519631531995131?= X-GMAIL-MSGID: =?utf-8?q?1757519631531995131?= 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);