From patchwork Sat Aug 31 07:18:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 13785955 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 220F6CD1293 for ; Sat, 31 Aug 2024 07:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5xgctmD61d3Eeqgu7kKJJKOAdm4QBqhRa8jvJJLuUDw=; b=3XF45YG+pLihdZ6I4F6ScpWU/r TLf6RQ4k1C/7rNaxqsyKgJ+tuwyiY8purVw4F4dZZWSgL1BuKqxBVqNbnT9LsgmEn4MWNtG5WrwUD lGni6SfCFORSEvQn+6t8dFJWKNrMrsBWgsCUWVKvUShAB/HF0AJzy8POi3ma5kD1/D7sFWp+dml0t c6/CPOMHUnplNrVPfzJwmP0sQo2yiIEOQZHLZ6SGo1b3VvYM5Yh3a2TcftEh0dYqk58bYzIaOKLNI 7qz8Sx2xDAY6LCnoWSt07lCSklEexqe8+FR+P/GLEnzCn1eIVMnNPcegNKKc1fHWSMQSz2QAilkna 5ekoyy+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1skIPp-00000008op0-2OAH; Sat, 31 Aug 2024 07:20:57 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1skIOA-00000008odf-2OAb for linux-arm-kernel@lists.infradead.org; Sat, 31 Aug 2024 07:19:15 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id B1F1AA40109; Sat, 31 Aug 2024 07:19:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F2A7C4CEC0; Sat, 31 Aug 2024 07:19:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725088753; bh=WN8qnYso/OqQzZPqMv9ygjMnLiv6+Y8d2xbdKSe1W/Q=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=t6PXy+RaWEXj3ftmXfbGo7QdQn0lTK+GhJ9CETel+/4gQaT/7yoEhzpyPXH49LqKU UzVJtuHIcLRvaV8EgC0RsX5y0+ME+ze6+P4K7Kb9yZd4YMS5cuT43lc9ls9CX8VDXW uI2InafjZg676bqlrtaqAoerOTEwinzcd7aTPK/F4M9O29KmMEagbqgiEG5YDzfNd2 QvpDzpiOPT/asSbzn2ZsNWbvxbzp8t8pEbSgXyf4PiWO5L6Yux7qbuspGQ/6+sUtzC fZFXxhfXKAj2uCzZuF57F/Zre/8RX16NfIYFpPX4tZUT7MbEB4bKSgZHbABi4zb4Mf UM9D93iYshvgQ== From: Lorenzo Bianconi Date: Sat, 31 Aug 2024 09:18:44 +0200 Subject: [PATCH 2/7] clk: en7523: set REG_PCIE*_{MEM,MEM_MASK} via syscon MIME-Version: 1.0 Message-Id: <20240831-clk-en7581-syscon-v1-2-5c2683541068@kernel.org> References: <20240831-clk-en7581-syscon-v1-0-5c2683541068@kernel.org> In-Reply-To: <20240831-clk-en7581-syscon-v1-0-5c2683541068@kernel.org> To: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Felix Fietkau , Philipp Zabel Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org, upstream@airoha.com, angelogioacchino.delregno@collabora.com, linux-arm-kernel@lists.infradead.org, lorenzo.bianconi83@gmail.com, ansuelsmth@gmail.com, Lorenzo Bianconi X-Mailer: b4 0.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240831_001914_769133_EED69CB0 X-CRM114-Status: GOOD ( 11.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org REG_PCIE*_MEM and REG_PCIE*_MEM_MASK memory regions (PBUS_CSR) are not part of the scu block on the EN7581 SoC, so configure them via a dedicated syscon node. This patch does not introduce any backward incompatibility since the dts for EN7581 SoC is not public yet. Signed-off-by: Lorenzo Bianconi --- drivers/clk/clk-en7523.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c index 22fbea61c3dc..2bc1bf4afbed 100644 --- a/drivers/clk/clk-en7523.c +++ b/drivers/clk/clk-en7523.c @@ -3,8 +3,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -415,25 +417,25 @@ static void en7581_pci_disable(struct clk_hw *hw) static int en7581_clk_hw_init(struct platform_device *pdev, void __iomem *np_base) { - void __iomem *pb_base; + struct regmap *map; u32 val; - pb_base = devm_platform_ioremap_resource(pdev, 3); - if (IS_ERR(pb_base)) - return PTR_ERR(pb_base); - val = readl(np_base + REG_NP_SCU_SSTR); val &= ~(REG_PCIE_XSI0_SEL_MASK | REG_PCIE_XSI1_SEL_MASK); writel(val, np_base + REG_NP_SCU_SSTR); val = readl(np_base + REG_NP_SCU_PCIC); writel(val | 3, np_base + REG_NP_SCU_PCIC); - writel(0x20000000, pb_base + REG_PCIE0_MEM); - writel(0xfc000000, pb_base + REG_PCIE0_MEM_MASK); - writel(0x24000000, pb_base + REG_PCIE1_MEM); - writel(0xfc000000, pb_base + REG_PCIE1_MEM_MASK); - writel(0x28000000, pb_base + REG_PCIE2_MEM); - writel(0xfc000000, pb_base + REG_PCIE2_MEM_MASK); + map = syscon_regmap_lookup_by_compatible("airoha,en7581-pbus-csr"); + if (IS_ERR(map)) + return PTR_ERR(map); + + regmap_write(map, REG_PCIE0_MEM, 0x20000000); + regmap_write(map, REG_PCIE0_MEM_MASK, 0xfc000000); + regmap_write(map, REG_PCIE1_MEM, 0x24000000); + regmap_write(map, REG_PCIE1_MEM_MASK, 0xfc000000); + regmap_write(map, REG_PCIE2_MEM, 0x28000000); + regmap_write(map, REG_PCIE2_MEM_MASK, 0xfc000000); return 0; }