From patchwork Wed Jan 17 18:41:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 188920 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:30f:b0:101:a8e8:374 with SMTP id ia15csp110506dyb; Wed, 17 Jan 2024 10:47:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNJxXm3AJGTlodscYxAreb114+Gq90Gyr6kqfBZ1k27s6FkOGEus0O7j/9JLx5DXoIYch7 X-Received: by 2002:a17:907:930a:b0:a27:5343:d3e8 with SMTP id bu10-20020a170907930a00b00a275343d3e8mr5423330ejc.97.1705517274815; Wed, 17 Jan 2024 10:47:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705517274; cv=pass; d=google.com; s=arc-20160816; b=aTND4HtToG4HAm8QlPzmRzcRYD1L43ciO7fzIFoHFw3ksdkDZeyJk3XVsKNftgzLzn PIdgZmlw9J4nWMZqjYyokzW7PvhxgYFjqXNtNfNBVKImgqR8G3ijgnD1YmShvCsEsyJy 9PlmqaZyblqJtMme+6JclzJVKgEB8dnheQYzv3GyMJ/5tIsrVnIxd79lnkRHdUSzMbWW HIK+nr1SZy+vnFMkZFfzgKscm191DINmcRW9Agaj4g2X1CInDfa8Dm9mzKSBtquzdlZa gIzH+vmyMqGZDUPqaRHIjW3uNJXMPA8wjoeU/oJTFNdyxh8PS/amH2au5RsMeYjXAoyL QoFA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Eehw8xyDiZKe3Ta/XcMEznmzFYJTK+Bv5i2VMfGjjM0=; fh=LUzJhCHXByutVbZY6Go/tqbqcJ6i1wxNrBhOCG2u75w=; b=jn9p1Ea+M+YPBGO03Q3H7aqqn+W7CS0Owi72EBFRAfjrCtpRjC317sZmMXzDSZOYvP nNVmHoQ4YtrIIlBM/eeXwoT0qIghc4BKpyOF2HWz1fT+RQwmuSmRmCVQ93ElLsTf2o33 ZBFEtp9qmW/fuv55s572ngFMwm900WsdZaHWgdRl2VKkTRpDwAmgxB+ad4vIr4pQbbIF X2NyW3iwLs8tu3TEM48n6+WC7Rkc8UfIouKtIfDl/K1Q08mcrXljy4w2aOpdV5vgY6ot urFu1oamRtRenQ3yDNOmlOtGBm7jybvPAmbQk1bD0jwdXERFDFIFhzEC/3IhMFSWIrbJ 6Rzg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mailerdienst.de header.s=20200217 header.b="M6/QKBL9"; arc=pass (i=1 spf=pass spfdomain=fw-web.de dkim=pass dkdomain=mailerdienst.de); spf=pass (google.com: domain of linux-kernel+bounces-29331-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29331-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gr8-20020a170906e2c800b00a2d2edbcf5fsi4076637ejb.255.2024.01.17.10.47.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 10:47:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29331-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@mailerdienst.de header.s=20200217 header.b="M6/QKBL9"; arc=pass (i=1 spf=pass spfdomain=fw-web.de dkim=pass dkdomain=mailerdienst.de); spf=pass (google.com: domain of linux-kernel+bounces-29331-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29331-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6E1501F220ED for ; Wed, 17 Jan 2024 18:47:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B6F0E23779; Wed, 17 Jan 2024 18:47:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mailerdienst.de header.i=@mailerdienst.de header.b="M6/QKBL9" Received: from mxout3.routing.net (mxout3.routing.net [134.0.28.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E22223750; Wed, 17 Jan 2024 18:47:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=134.0.28.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705517255; cv=none; b=s/nICqK9auj6YfzqBXPOU/BZ8REdLg6XdgNQIoGEFseubMfVaFLnn36z5IlsognJ6MGKpxHFQjRoSBcqs0VDWnMoASGF1PoUw8sKbm+sPiGPHzau7BrQ3CDaG3V+NOov5smWhm7zfy8LqiaLTUtwkfgm3li3/Hu5uacSBbOKWJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705517255; c=relaxed/simple; bh=gozWPMqk/rhDpsDJOgN1+wlwUjEtXnVyTAYjJMeFUyc=; h=Received:DKIM-Signature:Received:From:To:Cc:Subject:Date: Message-Id:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Mail-ID; b=NPOEdmxgWYeMwgyARgzBHpLJLwjljhL15iyL1aL6ZeOeA742wf0GY7F39Pp6o09PwY/zI5+aITZ07xG5IVbhBbA7WoFh3qi0IDb3UzL7bIWBxsTFfvuliJ9pSrutwFFKOjNGVZArUhMR9xbLWiOOeNjq28h1SFyj9he2FCajWIk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fw-web.de; spf=pass smtp.mailfrom=fw-web.de; dkim=pass (1024-bit key) header.d=mailerdienst.de header.i=@mailerdienst.de header.b=M6/QKBL9; arc=none smtp.client-ip=134.0.28.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fw-web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fw-web.de Received: from mxbox2.masterlogin.de (unknown [192.168.10.89]) by mxout3.routing.net (Postfix) with ESMTP id 945F8605FE; Wed, 17 Jan 2024 18:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailerdienst.de; s=20200217; t=1705516876; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Eehw8xyDiZKe3Ta/XcMEznmzFYJTK+Bv5i2VMfGjjM0=; b=M6/QKBL945SLCiX3SObAD3UVp8V1jXvZ7+OCFilnQu/Zw5KRlyJbuuF8uWUmxQOI2KcyV4 gVWaOMUugPfb8bPDoXE7+AIz1QMLTXiw09d45jilzZ5SQ91oQTAZ/9NP4JT/yRmB9oIaKA eSm6ZRLutKlprpiC/6ZdgqUNQ2ysvyU= Received: from frank-G5.. (fttx-pool-217.61.151.254.bambit.de [217.61.151.254]) by mxbox2.masterlogin.de (Postfix) with ESMTPSA id B06A610022F; Wed, 17 Jan 2024 18:41:15 +0000 (UTC) From: Frank Wunderlich To: Michael Turquette , Stephen Boyd , Matthias Brugger , AngeloGioacchino Del Regno , Philipp Zabel , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Frank Wunderlich , Sam Shih , Daniel Golle , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 2/2] clk: mediatek: add infracfg reset controller for mt7988 Date: Wed, 17 Jan 2024 19:41:11 +0100 Message-Id: <20240117184111.62371-3-linux@fw-web.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240117184111.62371-1-linux@fw-web.de> References: <20240117184111.62371-1-linux@fw-web.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mail-ID: 19467ab5-d765-4cf7-a1c2-db41340e92b1 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788364482081586657 X-GMAIL-MSGID: 1788364482081586657 From: Frank Wunderlich Infracfg can also operate as reset controller, add support for it. Signed-off-by: Frank Wunderlich Reviewed-by: AngeloGioacchino Del Regno --- v3: - start with RST0 (LVTS is in RST1) - rename reset offset to contain SOC to not collide with constants defined in reset.h --- drivers/clk/mediatek/clk-mt7988-infracfg.c | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/clk/mediatek/clk-mt7988-infracfg.c b/drivers/clk/mediatek/clk-mt7988-infracfg.c index 8011ef278bea..449041f8abbc 100644 --- a/drivers/clk/mediatek/clk-mt7988-infracfg.c +++ b/drivers/clk/mediatek/clk-mt7988-infracfg.c @@ -14,6 +14,10 @@ #include "clk-gate.h" #include "clk-mux.h" #include +#include + +#define MT7988_INFRA_RST0_SET_OFFSET 0x70 +#define MT7988_INFRA_RST1_SET_OFFSET 0x80 static DEFINE_SPINLOCK(mt7988_clk_lock); @@ -249,12 +253,31 @@ static const struct mtk_gate infra_clks[] = { GATE_INFRA3(CLK_INFRA_133M_PCIE_CK_P3, "infra_133m_pcie_ck_p3", "sysaxi_sel", 31), }; +static u16 infra_rst_ofs[] = { + MT7988_INFRA_RST0_SET_OFFSET, + MT7988_INFRA_RST1_SET_OFFSET, +}; + +static u16 infra_idx_map[] = { + [MT7988_INFRA_RST0_PEXTP_MAC_SWRST] = 0 * RST_NR_PER_BANK + 6, + [MT7988_INFRA_RST1_THERM_CTRL_SWRST] = 1 * RST_NR_PER_BANK + 9, +}; + +static struct mtk_clk_rst_desc infra_rst_desc = { + .version = MTK_RST_SET_CLR, + .rst_bank_ofs = infra_rst_ofs, + .rst_bank_nr = ARRAY_SIZE(infra_rst_ofs), + .rst_idx_map = infra_idx_map, + .rst_idx_map_nr = ARRAY_SIZE(infra_idx_map), +}; + static const struct mtk_clk_desc infra_desc = { .clks = infra_clks, .num_clks = ARRAY_SIZE(infra_clks), .mux_clks = infra_muxes, .num_mux_clks = ARRAY_SIZE(infra_muxes), .clk_lock = &mt7988_clk_lock, + .rst_desc = &infra_rst_desc, }; static const struct of_device_id of_match_clk_mt7988_infracfg[] = {