From patchwork Sat Oct 30 14:20:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Paracuellos X-Patchwork-Id: 12594413 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3DA3C433F5 for ; Sat, 30 Oct 2021 14:20:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE70660FC4 for ; Sat, 30 Oct 2021 14:20:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230088AbhJ3OWo (ORCPT ); Sat, 30 Oct 2021 10:22:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230071AbhJ3OWn (ORCPT ); Sat, 30 Oct 2021 10:22:43 -0400 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 6AC11C061570; Sat, 30 Oct 2021 07:20:13 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 133so1035440wme.0; Sat, 30 Oct 2021 07:20:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DToYAQHxf/EmU+9Qq/Jcp+BO8Gdd2Z8qCSR2az0OK88=; b=lch/4hovwMuDOBS9A1cTb7nQndbyEguJ3+9lcAlXv1X9QT8JN53xNT2HkYxZVFRjmp xywnmlU6TprkgBN1WEvKLxrGp2uRJiKaJpTNcMHVcz+7utONDz5PC4Oyxe1j5MbNl7wY tjKVEXE35n75hm14SdqYhAkeDILX4WV0gtE0FEOnNzFXr/9eWGmO+4R2qZ6sdVzx4xdm k0bq7Hc0iK42ulFXN2Kr6CULXefS8bwDUQhHNWxEV036BY4270T5PZU8hFdZwYj4gvH1 U/FR9IRiw8+J8WdPfaApjR/tWz2y+OeyTJnx/m2cLamYYsnCMs9DZUWeCKac6F+N43Ey rDBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DToYAQHxf/EmU+9Qq/Jcp+BO8Gdd2Z8qCSR2az0OK88=; b=WKrnroOKR8KbnykoKSjExZVAz5PgVOpld1cxzmpeKJWSCeRuKelTh9hknFQOLKSaNh 7b40+b9RoYdfTk86thR2+HsByjkqG6mvMKC+CghViEvWVwmedNJ+d/VI8+mAVQUL88EP 6qx2xGPlDuzhn6kibGVCJVV8IZ9ulyyL0oomCzmlblQ3krNxhMcCNHrxt1oTnTolxEKo Kn+vnwByHFXCwtSJ8DYm/RLaW0Y7xy5wg7exldq1bovQQhWUGG8WiO3s3kmEZISGrWcY K86QkUZCgfzmLTaWHrZ6pqIXbsrFnnk6hrF+hiQfUqcgmuluGbrurenICira/f0RQ9k+ tnpA== X-Gm-Message-State: AOAM530igmvfAv7A/xLBzx+RCsvdnp0e5PiuwqHr4NtThzxxS4ViG0J2 ngmDYjzdI7o7kUENRwj+WabxKjj8zKHckg== X-Google-Smtp-Source: ABdhPJxYdplZsYeZu0kDBxVD5SD/C4Oi+ARiKw4LEdiCrHM5gXLecnRUd0iKipp6Y8Vu6fdKX+DQhA== X-Received: by 2002:a7b:cbc2:: with SMTP id n2mr21756186wmi.123.1635603611767; Sat, 30 Oct 2021 07:20:11 -0700 (PDT) Received: from localhost.localdomain (252.red-83-54-181.dynamicip.rima-tde.net. [83.54.181.252]) by smtp.gmail.com with ESMTPSA id m12sm8208521wrq.69.2021.10.30.07.20.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Oct 2021 07:20:11 -0700 (PDT) From: Sergio Paracuellos To: linux-clk@vger.kernel.org Cc: linux-kernel@vger.kernel.org, sboyd@kernel.org, john@phrozen.org, linux-staging@lists.linux.dev, gregkh@linuxfoundation.org, neil@brown.name, Rob Herring Subject: [PATCH v3 1/4] dt-bindings: reset: add dt binding header for Mediatek MT7621 resets Date: Sat, 30 Oct 2021 16:20:04 +0200 Message-Id: <20211030142007.27085-2-sergio.paracuellos@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211030142007.27085-1-sergio.paracuellos@gmail.com> References: <20211030142007.27085-1-sergio.paracuellos@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Add dt binding header for resets lines in Mediatek MT7621 SoCs. Acked-by: Rob Herring Signed-off-by: Sergio Paracuellos --- include/dt-bindings/reset/mt7621-reset.h | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 include/dt-bindings/reset/mt7621-reset.h diff --git a/include/dt-bindings/reset/mt7621-reset.h b/include/dt-bindings/reset/mt7621-reset.h new file mode 100644 index 000000000000..7572c6b41453 --- /dev/null +++ b/include/dt-bindings/reset/mt7621-reset.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Copyright (c) 2021 Sergio Paracuellos + * Author: Sergio Paracuellos + */ + +#ifndef DT_BINDING_MT7621_RESET_H +#define DT_BINDING_MT7621_RESET_H + +#define MT7621_RST_SYS 0 +#define MT7621_RST_MCM 2 +#define MT7621_RST_HSDMA 5 +#define MT7621_RST_FE 6 +#define MT7621_RST_SPDIFTX 7 +#define MT7621_RST_TIMER 8 +#define MT7621_RST_INT 9 +#define MT7621_RST_MC 10 +#define MT7621_RST_PCM 11 +#define MT7621_RST_PIO 13 +#define MT7621_RST_GDMA 14 +#define MT7621_RST_NFI 15 +#define MT7621_RST_I2C 16 +#define MT7621_RST_I2S 17 +#define MT7621_RST_SPI 18 +#define MT7621_RST_UART1 19 +#define MT7621_RST_UART2 20 +#define MT7621_RST_UART3 21 +#define MT7621_RST_ETH 23 +#define MT7621_RST_PCIE0 24 +#define MT7621_RST_PCIE1 25 +#define MT7621_RST_PCIE2 26 +#define MT7621_RST_AUX_STCK 28 +#define MT7621_RST_CRYPTO 29 +#define MT7621_RST_SDXC 30 +#define MT7621_RST_PPE 31 + +#endif /* DT_BINDING_MT7621_RESET_H */ From patchwork Sat Oct 30 14:20:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Paracuellos X-Patchwork-Id: 12594415 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D656C433F5 for ; Sat, 30 Oct 2021 14:20:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A2FC6101E for ; Sat, 30 Oct 2021 14:20:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230470AbhJ3OWq (ORCPT ); Sat, 30 Oct 2021 10:22:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbhJ3OWo (ORCPT ); Sat, 30 Oct 2021 10:22:44 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BA1BC061570; Sat, 30 Oct 2021 07:20:14 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id o14so21129898wra.12; Sat, 30 Oct 2021 07:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OJp/wZiERGVBUU7HIuspGPpojRpXm2e3BfdSR6ZgDTc=; b=JEUQHEz7bQf2OP6y0/Ta376kQgRSsPMSL15aqYo0Z0p5RG85Z7g+/dIDirWzrAnUfl DLW09vDWRWfRHCE9mv9E8t92lSwRPEIudUygoA8GiaFa2iNLeSkZkAyHZMxV0K8RFg1g rbmAPkTiqbuXuH/zf9DbxaS97uW9UTIJbJD1Jb+fD0NkhMWHsgkrTRJld7h0cj9dU4Fn +aSWb7HUKsh8LLWR1zk+3j2DDdW/xuVhAKhRcwS+gVHyClNW6w4IkRMcuhzCfYkqcths YyaEN4z4f0vHpU4zd0W0u0rLzTB9eQ6pV4ZPV+9NNnZtDXP/1r+vaUefUOFmggI517uX lslQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OJp/wZiERGVBUU7HIuspGPpojRpXm2e3BfdSR6ZgDTc=; b=RGrCC/5/LNWo7vAM8gLuiEsph3OvDeSj10SICSGqvuewboJTWNBS7GfCuMpoOKJTNZ ylILroyymEenv2j5wYcNs5H7Rrq3Bnw6Ha0MtOAbZcKsCS1Gg6VRabRSS84bnHGr0JXp RIdSX4UjIb9lbSbQHqxKziZvYJMLYwFOyyyuC7oxmfEnj6iqqstnT9z6U9Hb4RX9EPXQ VLYD+u8+gTbhyVjxsIUbvoEQ8VOgp3cunPOTTep5bfbtWh2k+ySDESjVadScpfw70lcK mCqJyRFqmWtFTbVNBlcHFoXvu3977XC+ENIHwBlwyfLMDMWR5VmkLr9c1CpIKgT1+Ee3 /E9A== X-Gm-Message-State: AOAM532Z5SuuN/cebYwdBl1GprK5nZhcojJQM0qs51DKTBpPUgoFN92T mglfcktdrNMfAWBHmmgg7R/4IEu4LSvfiQ== X-Google-Smtp-Source: ABdhPJz7QSlwLY1YRbetjzWjw7/3EjxA/mbkzu0Xnm2Awq8L+ztW9XbXGuoUMg4NgTlWGt7KD+Qi/Q== X-Received: by 2002:a5d:59a7:: with SMTP id p7mr22897326wrr.141.1635603612739; Sat, 30 Oct 2021 07:20:12 -0700 (PDT) Received: from localhost.localdomain (252.red-83-54-181.dynamicip.rima-tde.net. [83.54.181.252]) by smtp.gmail.com with ESMTPSA id m12sm8208521wrq.69.2021.10.30.07.20.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Oct 2021 07:20:12 -0700 (PDT) From: Sergio Paracuellos To: linux-clk@vger.kernel.org Cc: linux-kernel@vger.kernel.org, sboyd@kernel.org, john@phrozen.org, linux-staging@lists.linux.dev, gregkh@linuxfoundation.org, neil@brown.name, Rob Herring Subject: [PATCH v3 2/4] dt-bindings: clock: mediatek,mt7621-sysc: add '#reset-cells' property Date: Sat, 30 Oct 2021 16:20:05 +0200 Message-Id: <20211030142007.27085-3-sergio.paracuellos@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211030142007.27085-1-sergio.paracuellos@gmail.com> References: <20211030142007.27085-1-sergio.paracuellos@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Make system controller a reset provider for all the peripherals in the MT7621 SoC adding '#reset-cells' property. Acked-by: Rob Herring Signed-off-by: Sergio Paracuellos --- .../bindings/clock/mediatek,mt7621-sysc.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml b/Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml index 915f84efd763..0c0b0ae5e2ac 100644 --- a/Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml +++ b/Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml @@ -22,6 +22,11 @@ description: | The clocks are provided inside a system controller node. + This node is also a reset provider for all the peripherals. + + Reset related bits are defined in: + [2]: . + properties: compatible: items: @@ -37,6 +42,12 @@ properties: clocks. const: 1 + "#reset-cells": + description: + The first cell indicates the reset bit within the register, see + [2] for available resets. + const: 1 + ralink,memctl: $ref: /schemas/types.yaml#/definitions/phandle description: @@ -61,6 +72,7 @@ examples: compatible = "mediatek,mt7621-sysc", "syscon"; reg = <0x0 0x100>; #clock-cells = <1>; + #reset-cells = <1>; ralink,memctl = <&memc>; clock-output-names = "xtal", "cpu", "bus", "50m", "125m", "150m", From patchwork Sat Oct 30 14:20:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Paracuellos X-Patchwork-Id: 12594417 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F044C433F5 for ; Sat, 30 Oct 2021 14:20:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 550E46101E for ; Sat, 30 Oct 2021 14:20:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230071AbhJ3OWr (ORCPT ); Sat, 30 Oct 2021 10:22:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbhJ3OWp (ORCPT ); Sat, 30 Oct 2021 10:22:45 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54C17C061570; Sat, 30 Oct 2021 07:20:15 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id v17so21170323wrv.9; Sat, 30 Oct 2021 07:20:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=F5x1oqtvVP/PGtFgO2U9FSpcbZxZK7r+xhICFV95IKo=; b=KkVOt+LAZlq1nTiNsYPYr/MlwIStQYb0R/EKITJAyNqUIykthIosrTrJEUoLSPg/K7 8REM4Wv1pQ7EXJp+X58Z6e4/jJ1A3LOK+UpDA4UkIgaM48ULQx5iLbDm1MRs8LGpsHD1 yrEg9r8WgVR376MgDhP9qEI/0rYXOLzn74oqOsXnv9koKgMdQOyxLazmq5jkmfA3zH0g jAzC/Qyt4FWLKHqbNEMWU5rG/89MhgURScmA0yfcWyLZ/orKHZQt/bJAVXMbO2KUyZJf 8g3ixTTh+oQFWW9+qyrPrhOH9dZuZwkWnZN8cB6Zoq+sUlBCOIpQMs3XuLVydRSZ/7SN yFzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F5x1oqtvVP/PGtFgO2U9FSpcbZxZK7r+xhICFV95IKo=; b=ymoNDWkmqUZiEGWj2jODFcQZly3+Roo60r4NgAEerTdmjJ/d2OuH2UYbv6xt9aubMt siB9eMG8FzBPIpWAD0QVvWsKqZ0/Assi8NLGSV9KRZnVPZ7wvXfgGQqWuC/m9UCbrZUC WdyDHXw1kiW7Ec3qEQH9YiWBtHA1qJMP4UBpOP08jzsdLDh83mRunrB15iryL1quzoyO IQk+kYLTHCh049s9JsyF5gofgzhQE1X0e18BarAMMMGCWyuDbZJhTaRNDyV4Z1ebo4Cp +s5lw5prPPabaBnAfSH4F/1rQkHvfbI5AfEDRDiRw34c7JNCSa5i9BPgD5VjNR68SErp F/Cw== X-Gm-Message-State: AOAM532XbAyiwvUOA7JCse4cQ5HXhZUZlEvnLn9f9EtZ/duCGye59x4+ Ajr1oXYy8CUdRUiYivzUrWrrKe5gce7deQ== X-Google-Smtp-Source: ABdhPJxtz+uMrR/oOgJ8L1C/5tOkqi1DpssmgGY8Xkz39G7bLAlUp5zXg1vB25tIKREwgogIObk//Q== X-Received: by 2002:a05:6000:2a4:: with SMTP id l4mr23395325wry.221.1635603613662; Sat, 30 Oct 2021 07:20:13 -0700 (PDT) Received: from localhost.localdomain (252.red-83-54-181.dynamicip.rima-tde.net. [83.54.181.252]) by smtp.gmail.com with ESMTPSA id m12sm8208521wrq.69.2021.10.30.07.20.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Oct 2021 07:20:13 -0700 (PDT) From: Sergio Paracuellos To: linux-clk@vger.kernel.org Cc: linux-kernel@vger.kernel.org, sboyd@kernel.org, john@phrozen.org, linux-staging@lists.linux.dev, gregkh@linuxfoundation.org, neil@brown.name Subject: [PATCH v3 3/4] clk: ralink: make system controller node a reset provider Date: Sat, 30 Oct 2021 16:20:06 +0200 Message-Id: <20211030142007.27085-4-sergio.paracuellos@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211030142007.27085-1-sergio.paracuellos@gmail.com> References: <20211030142007.27085-1-sergio.paracuellos@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org MT7621 system controller node is already providing the clocks for the whole system but must also serve as a reset provider. Hence, add reset controller related code to the clock driver itself. Signed-off-by: Sergio Paracuellos --- drivers/clk/ralink/clk-mt7621.c | 79 +++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/drivers/clk/ralink/clk-mt7621.c b/drivers/clk/ralink/clk-mt7621.c index a2c045390f00..f149dd2d1325 100644 --- a/drivers/clk/ralink/clk-mt7621.c +++ b/drivers/clk/ralink/clk-mt7621.c @@ -11,14 +11,17 @@ #include #include #include +#include #include #include +#include /* Configuration registers */ #define SYSC_REG_SYSTEM_CONFIG0 0x10 #define SYSC_REG_SYSTEM_CONFIG1 0x14 #define SYSC_REG_CLKCFG0 0x2c #define SYSC_REG_CLKCFG1 0x30 +#define SYSC_REG_RESET_CTRL 0x34 #define SYSC_REG_CUR_CLK_STS 0x44 #define MEMC_REG_CPU_PLL 0x648 @@ -398,6 +401,76 @@ static void __init mt7621_clk_init(struct device_node *node) } CLK_OF_DECLARE_DRIVER(mt7621_clk, "mediatek,mt7621-sysc", mt7621_clk_init); +struct mt7621_rst { + struct reset_controller_dev rcdev; + struct regmap *sysc; +}; + +static inline struct mt7621_rst *to_mt7621_rst(struct reset_controller_dev *dev) +{ + return container_of(dev, struct mt7621_rst, rcdev); +} + +static int mt7621_assert_device(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct mt7621_rst *data = to_mt7621_rst(rcdev); + struct regmap *sysc = data->sysc; + + if (id == MT7621_RST_SYS) + return -1; + + return regmap_update_bits(sysc, SYSC_REG_RESET_CTRL, BIT(id), BIT(id)); +} + +static int mt7621_deassert_device(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct mt7621_rst *data = to_mt7621_rst(rcdev); + struct regmap *sysc = data->sysc; + + if (id == MT7621_RST_SYS) + return -1; + + return regmap_update_bits(sysc, SYSC_REG_RESET_CTRL, BIT(id), 0); +} + +static int mt7621_reset_device(struct reset_controller_dev *rcdev, + unsigned long id) +{ + int ret; + + ret = mt7621_assert_device(rcdev, id); + if (ret < 0) + return ret; + + return mt7621_deassert_device(rcdev, id); +} + +static const struct reset_control_ops reset_ops = { + .reset = mt7621_reset_device, + .assert = mt7621_assert_device, + .deassert = mt7621_deassert_device +}; + +static int mt7621_reset_init(struct device *dev, struct regmap *sysc) +{ + struct mt7621_rst *rst_data; + + rst_data = kzalloc(sizeof(*rst_data), GFP_KERNEL); + if (!rst_data) + return -ENOMEM; + + rst_data->sysc = sysc; + rst_data->rcdev.ops = &reset_ops; + rst_data->rcdev.owner = THIS_MODULE; + rst_data->rcdev.nr_resets = 32; + rst_data->rcdev.of_reset_n_cells = 1; + rst_data->rcdev.of_node = dev_of_node(dev); + + return devm_reset_controller_register(dev, &rst_data->rcdev); +} + static int mt7621_clk_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -424,6 +497,12 @@ static int mt7621_clk_probe(struct platform_device *pdev) return ret; } + ret = mt7621_reset_init(dev, priv->sysc); + if (ret) { + dev_err(dev, "Could not init reset controller\n"); + return ret; + } + count = ARRAY_SIZE(mt7621_clks_base) + ARRAY_SIZE(mt7621_fixed_clks) + ARRAY_SIZE(mt7621_gates); clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, count), From patchwork Sat Oct 30 14:20:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Paracuellos X-Patchwork-Id: 12594419 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A97AC4332F for ; Sat, 30 Oct 2021 14:20:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 744CE60FC4 for ; Sat, 30 Oct 2021 14:20:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231836AbhJ3OWr (ORCPT ); Sat, 30 Oct 2021 10:22:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231199AbhJ3OWq (ORCPT ); Sat, 30 Oct 2021 10:22:46 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 619C2C061764; Sat, 30 Oct 2021 07:20:16 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id g191-20020a1c9dc8000000b0032fbf912885so4777731wme.4; Sat, 30 Oct 2021 07:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n0RL45OoJsxDqII6WqqJzrCBAIvt4D77cElanpVHtTc=; b=GNeo7I0U8PGWtkl9WICK3ZlFrQ4n2yjQeX+zgUYaUwDmWS+4uYnTXX4e6gswMDbZ1m WH8nWomgiwHqE7Rmv6LCfJqRbk3T2wkNChpmKDpQMk4eTHRvnz5NLDS3mX1bzp8cQ8sE 44esKJ0F40hmj9H1OhXUEhnnXd6sd3n5TInbZkbya01ZTATfFzi2UkyMX2kWPPulKuh1 W9oebzvO4MK4HMU6jU5x8FIyogDJnkjFS0XBc/9BTOSXiY7yRNOWWP7TXeky0Lc7XBvM DwMWG+7yE73v2eYHSV71ZLqd/1c+oEValxqc7+c2lkGdTCnRFWZi2VqEipkloVErRf1+ GO4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n0RL45OoJsxDqII6WqqJzrCBAIvt4D77cElanpVHtTc=; b=4mGIlBCTViDin2Y90IKV6VaK7s209HjIquAVOjSGC29uMR1U+z8p3RJqwnx2hB2zDz mURa3i5usLx9CGeaXdevnFQEMdxCs0z6DdD0/bOfUndRuPCaf8fbcxNKaKYlGp1pWXNo rQ628oKlyvPT3FruYO2Kq/4UKA50ACTUTGeAHtHRrqWf0KAFOLc5bG7l/9zFHsGeGxvI dxkHCzwJLbrN3urhRwO46MtT9Puyf9JV3VIa1eQmuh4KDb9+O3BHwqfUC5MMVKVPLgRX UW+kEbVS3CAtfChJQRj5woaUZLZkNsr7SZE/WMYAhzeyoYZZwaloirCvPr7OjBdEGpUE srZg== X-Gm-Message-State: AOAM5328odwZPHUTw6zruKtLnfzcPU65pYPK6v9HfV+fCH7FMrj7+cBO P51b4KtFYih272EivcriMhocNpv9ei7/dg== X-Google-Smtp-Source: ABdhPJy0ZkfweqZlJjFujNSr2CZvexAqhEQkVVUqsOlnPCE3zbzKoRd492AVjqCEKpK5hGO8Eiawxw== X-Received: by 2002:a05:600c:4f96:: with SMTP id n22mr19151208wmq.168.1635603614655; Sat, 30 Oct 2021 07:20:14 -0700 (PDT) Received: from localhost.localdomain (252.red-83-54-181.dynamicip.rima-tde.net. [83.54.181.252]) by smtp.gmail.com with ESMTPSA id m12sm8208521wrq.69.2021.10.30.07.20.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Oct 2021 07:20:14 -0700 (PDT) From: Sergio Paracuellos To: linux-clk@vger.kernel.org Cc: linux-kernel@vger.kernel.org, sboyd@kernel.org, john@phrozen.org, linux-staging@lists.linux.dev, gregkh@linuxfoundation.org, neil@brown.name Subject: [PATCH v3 4/4] staging: mt7621-dts: align resets with binding documentation Date: Sat, 30 Oct 2021 16:20:07 +0200 Message-Id: <20211030142007.27085-5-sergio.paracuellos@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211030142007.27085-1-sergio.paracuellos@gmail.com> References: <20211030142007.27085-1-sergio.paracuellos@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Binding documentation for compatible 'mediatek,mt7621-sysc' has been updated to be used as a reset provider. Align reset related bits and system controller node with binding documentation along the dtsi file. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-dts/mt7621.dtsi | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi index 6d158e4f4b8c..2bf74468d495 100644 --- a/drivers/staging/mt7621-dts/mt7621.dtsi +++ b/drivers/staging/mt7621-dts/mt7621.dtsi @@ -2,6 +2,7 @@ #include #include #include +#include / { #address-cells = <1>; @@ -67,6 +68,7 @@ sysc: syscon@0 { compatible = "mediatek,mt7621-sysc", "syscon"; reg = <0x0 0x100>; #clock-cells = <1>; + #reset-cells = <1>; ralink,memctl = <&memc>; clock-output-names = "xtal", "cpu", "bus", "50m", "125m", "150m", @@ -96,7 +98,7 @@ i2c: i2c@900 { clocks = <&sysc MT7621_CLK_I2C>; clock-names = "i2c"; - resets = <&rstctrl 16>; + resets = <&sysc MT7621_RST_I2C>; reset-names = "i2c"; #address-cells = <1>; @@ -137,7 +139,7 @@ spi0: spi@b00 { clocks = <&sysc MT7621_CLK_SPI>; clock-names = "spi"; - resets = <&rstctrl 18>; + resets = <&sysc MT7621_RST_SPI>; reset-names = "spi"; #address-cells = <1>; @@ -153,7 +155,7 @@ gdma: gdma@2800 { clocks = <&sysc MT7621_CLK_GDMA>; clock-names = "gdma"; - resets = <&rstctrl 14>; + resets = <&sysc MT7621_RST_GDMA>; reset-names = "dma"; interrupt-parent = <&gic>; @@ -172,7 +174,7 @@ hsdma: hsdma@7000 { clocks = <&sysc MT7621_CLK_HSDMA>; clock-names = "hsdma"; - resets = <&rstctrl 5>; + resets = <&sysc MT7621_RST_HSDMA>; reset-names = "hsdma"; interrupt-parent = <&gic>; @@ -272,11 +274,6 @@ pinmux { }; }; - rstctrl: rstctrl { - compatible = "ralink,rt2880-reset"; - #reset-cells = <1>; - }; - sdhci: sdhci@1e130000 { status = "disabled"; @@ -355,7 +352,7 @@ ethernet: ethernet@1e100000 { #address-cells = <1>; #size-cells = <0>; - resets = <&rstctrl 6 &rstctrl 23>; + resets = <&sysc MT7621_CLK_FE &sysc MT7621_CLK_ETH>; reset-names = "fe", "eth"; interrupt-parent = <&gic>; @@ -400,7 +397,7 @@ switch0: switch0@0 { #size-cells = <0>; reg = <0>; mediatek,mcm; - resets = <&rstctrl 2>; + resets = <&sysc MT7621_RST_MCM>; reset-names = "mcm"; interrupt-controller; #interrupt-cells = <1>; @@ -486,7 +483,7 @@ pcie@0,0 { #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &gic GIC_SHARED 4 IRQ_TYPE_LEVEL_HIGH>; - resets = <&rstctrl 24>; + resets = <&sysc MT7621_RST_PCIE0>; clocks = <&sysc MT7621_CLK_PCIE0>; phys = <&pcie0_phy 1>; phy-names = "pcie-phy0"; @@ -501,7 +498,7 @@ pcie@1,0 { #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &gic GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH>; - resets = <&rstctrl 25>; + resets = <&sysc MT7621_RST_PCIE1>; clocks = <&sysc MT7621_CLK_PCIE1>; phys = <&pcie0_phy 1>; phy-names = "pcie-phy1"; @@ -516,7 +513,7 @@ pcie@2,0 { #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &gic GIC_SHARED 25 IRQ_TYPE_LEVEL_HIGH>; - resets = <&rstctrl 26>; + resets = <&sysc MT7621_RST_PCIE2>; clocks = <&sysc MT7621_CLK_PCIE2>; phys = <&pcie2_phy 0>; phy-names = "pcie-phy2";