From patchwork Tue May 23 20:55:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 686073 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 39C9BC7EE23 for ; Tue, 23 May 2023 20:55:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238249AbjEWUz0 (ORCPT ); Tue, 23 May 2023 16:55:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230332AbjEWUzV (ORCPT ); Tue, 23 May 2023 16:55:21 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA2A711A; Tue, 23 May 2023 13:55:20 -0700 (PDT) Received: from [192.168.122.1] (84-115-214-73.cable.dynamic.surfer.at [84.115.214.73]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 967E5CFBBB; Tue, 23 May 2023 20:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1684875319; bh=YjTptnEb5/JjSbifG6vzXu6nUUHMPKQYPG4+UHcnidg=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=qcOaQDdAaaYqE049ckHiY7s8oHp//icmSBETQjPlz3UzgknlRntBOx/mMdg4zFKMM y5y6ssMg1EvNd2WNg6QAmk7zxSatn0HdecKZDiWm27vwCbM6Tcuxe3azetcUnXYO3Y C236u91kOqouoUkaNuupC+4jnRhfa8/KLUysosO4= From: Luca Weiss Date: Tue, 23 May 2023 22:55:08 +0200 Subject: [PATCH v2 1/6] soc: qcom: ocmem: Fix NUM_PORTS & NUM_MACROS macros MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v2-1-177d697e43a9@z3ntu.xyz> References: <20230506-msm8226-ocmem-v2-0-177d697e43a9@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v2-0-177d697e43a9@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Clark , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss , Caleb Connolly X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1422; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=YjTptnEb5/JjSbifG6vzXu6nUUHMPKQYPG4+UHcnidg=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkbSgw3OEwGS59qxpQAig/EAaGhkgIu2qG4Ss/A 9WlgqLkdI6JAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZG0oMAAKCRBy2EO4nU3X VlwzD/9wY81zFENNfYkJX3nlFGfitX/zvhzG14WdGf/UglMrvf6vk5ABKjIILizTcIRB2Q+hHgO j/e7i72pxAW1zsuhHmxOWLRTZPIgcjVXRPXDragYP5OrfZC+j8Z8fpJEiF7Sm6LvW5KfpeM57Ek Fgabft1g9xmOGTAPn/Dl7OzVoC7vcwkajBF4epHl/brjBHooAv5SWiyFfgNBBuC84NknzQVz2P/ hRV4oFbYi7inPseG9H9HD4FKhI1rECzTsJUiz81uqlwacwueTnRrjh34i2lwsu8zLuXaH2FoTDu dnqWLF8U4Z6f6FKMlPpDkm0zHe8UYvBBPV4umBPm0sx2rRxFfdrNQzjc+0+m8UFZiSoLeMTNDMl wOH9b6MuEisEcAk3d8KjsZhshWW0jLpQdKhmL88TMIsV2njgzxMwjcsC/B58qj6jRBfQ8EJ9kAg 08Q+HFMIeR4I9KRIQQ4OcA3MCQv7UAV9yx2XOCLShDH/1xhhCzAVKeDf1Aspn23VdOHZuRGnbb4 1bHAwiR4cqP0yK6/M+QeZAivgMiWovoNwEJVwxo9h03F2RGtenBvq69PP16+JLxP04LzvSaYlA6 MWXmF2HtG/Me2oSugRz9gB6uRUVFQNaOLYnm9DUghnSWROy6Le//DzyGYb5CZgqf8na/+2nD03p QIHEUiR89KxBigg== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Since we're using these two macros to read a value from a register, we need to use the FIELD_GET instead of the FIELD_PREP macro, otherwise we're getting wrong values. So instead of: [ 3.111779] ocmem fdd00000.sram: 2 ports, 1 regions, 512 macros, not interleaved we now get the correct value of: [ 3.129672] ocmem fdd00000.sram: 2 ports, 1 regions, 2 macros, not interleaved Fixes: 88c1e9404f1d ("soc: qcom: add OCMEM driver") Reviewed-by: Caleb Connolly Reviewed-by: Konrad Dybcio Signed-off-by: Luca Weiss --- drivers/soc/qcom/ocmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/qcom/ocmem.c b/drivers/soc/qcom/ocmem.c index 199fe9872035..c3e78411c637 100644 --- a/drivers/soc/qcom/ocmem.c +++ b/drivers/soc/qcom/ocmem.c @@ -76,8 +76,8 @@ struct ocmem { #define OCMEM_REG_GFX_MPU_START 0x00001004 #define OCMEM_REG_GFX_MPU_END 0x00001008 -#define OCMEM_HW_PROFILE_NUM_PORTS(val) FIELD_PREP(0x0000000f, (val)) -#define OCMEM_HW_PROFILE_NUM_MACROS(val) FIELD_PREP(0x00003f00, (val)) +#define OCMEM_HW_PROFILE_NUM_PORTS(val) FIELD_GET(0x0000000f, (val)) +#define OCMEM_HW_PROFILE_NUM_MACROS(val) FIELD_GET(0x00003f00, (val)) #define OCMEM_HW_PROFILE_LAST_REGN_HALFSIZE 0x00010000 #define OCMEM_HW_PROFILE_INTERLEAVING 0x00020000 From patchwork Tue May 23 20:55:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 685094 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 F18C9C7EE23 for ; Tue, 23 May 2023 20:56:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237314AbjEWU4V (ORCPT ); Tue, 23 May 2023 16:56:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233459AbjEWU4U (ORCPT ); Tue, 23 May 2023 16:56:20 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07D82FA; Tue, 23 May 2023 13:55:52 -0700 (PDT) Received: from [192.168.122.1] (84-115-214-73.cable.dynamic.surfer.at [84.115.214.73]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 56C70CFBBC; Tue, 23 May 2023 20:55:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1684875320; bh=T7XDh+PO9dz+QnCgA9kCzxLQh8WK3LvPi+JrZSIZVdM=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=uSaa0LDPK97B2K7JfZBJuPf2Jl4BLU6Iy34vxzxaplWorAAIDL6aeXgKBCnYLfhDU mp8K1S5QsFB3zQlDlYXdTWiGfCq6U10NGpmA6aQaeAuXqLv4xxILBE9Ml1FFdQHYWn Pq/pX4oTx8gw7yZ21h5P4i+y+zxwhFk4JUCgSjzk= From: Luca Weiss Date: Tue, 23 May 2023 22:55:09 +0200 Subject: [PATCH v2 2/6] soc: qcom: ocmem: Use dev_err_probe where appropriate MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v2-2-177d697e43a9@z3ntu.xyz> References: <20230506-msm8226-ocmem-v2-0-177d697e43a9@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v2-0-177d697e43a9@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Clark , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss , Caleb Connolly X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2190; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=T7XDh+PO9dz+QnCgA9kCzxLQh8WK3LvPi+JrZSIZVdM=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkbSgx9V7M2s527/6rSs9yPhD1WsiYQgMBAowr0 BoqKZfJNmCJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZG0oMQAKCRBy2EO4nU3X VtIuD/9ESmXVIvHIGHlB1n0fs1ZmpGXzehXi5J+TxUR1hBIdvq6eQjOZj+jCkprY3RUQiJfpVH5 3MUvvXejF69hfz3JJyfnDp9MFrg0w9pY11WNNWEpszES3bhCXJmKUNaENiYP4dWgTDfMdGw0OuO GG/OPwaNSTopWq/j2TWB7zMxCF1ZKA19WWvKlv60ayJbGGb9b92iYyudYy29w5iNLEQg0t36pvm foePjPNjyiQpnQShnrVVqONpIySZuoNqeWLJpz4rK4uz8l8b0vFORWBhT/KOlK7/SbtaRPp6Lzs 2rTWUupANI+nnraOpcKPofBJ39n1MLt36EBhU35HKrsPb0OG2FNrsuFAVKydQayB7NeOM3jiaDI v8vkHPBgDSEmv3AeOIuOw3Rci/HrvCRN83oTLzzbejke6dwLufM5R4AyH82eHsBYdwIOZo2TSzb F25r3c9/56O/e1jTVAqrfGXEaL+ZSI7kmpYEiOODyQkEaW/U80WDGIS6WRDBFDDI6QXTrnyC44z xWK6MrGebNrlSOtfvS1ZlRu/FatVMX5sRtst4C6KdRN1tRbjADHtzHBoFHDVPkJ/Urd0a7khHGw dSNa/rCFUOaCaaSOvbrmh2w3thQadvxflHmHMqUL1Y094BGkU/8lUuIGnD3h7D4Ac/y3eUcNERF 9iAJRpUsSFsVDQw== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use dev_err_probe in the driver probe function where useful, to simplify getting PTR_ERR and to ensure the underlying errors are included in the error message. Reviewed-by: Caleb Connolly Reviewed-by: Konrad Dybcio Signed-off-by: Luca Weiss --- drivers/soc/qcom/ocmem.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/soc/qcom/ocmem.c b/drivers/soc/qcom/ocmem.c index c3e78411c637..a11a955a1327 100644 --- a/drivers/soc/qcom/ocmem.c +++ b/drivers/soc/qcom/ocmem.c @@ -317,18 +317,13 @@ static int ocmem_dev_probe(struct platform_device *pdev) ocmem->config = device_get_match_data(dev); ret = devm_clk_bulk_get(dev, ARRAY_SIZE(ocmem_clks), ocmem_clks); - if (ret) { - if (ret != -EPROBE_DEFER) - dev_err(dev, "Unable to get clocks\n"); - - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Unable to get clocks\n"); ocmem->mmio = devm_platform_ioremap_resource_byname(pdev, "ctrl"); - if (IS_ERR(ocmem->mmio)) { - dev_err(&pdev->dev, "Failed to ioremap ocmem_ctrl resource\n"); - return PTR_ERR(ocmem->mmio); - } + if (IS_ERR(ocmem->mmio)) + return dev_err_probe(&pdev->dev, PTR_ERR(ocmem->mmio), + "Failed to ioremap ocmem_ctrl resource\n"); ocmem->memory = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mem"); @@ -341,16 +336,14 @@ static int ocmem_dev_probe(struct platform_device *pdev) WARN_ON(clk_set_rate(ocmem_clks[OCMEM_CLK_CORE_IDX].clk, 1000) < 0); ret = clk_bulk_prepare_enable(ARRAY_SIZE(ocmem_clks), ocmem_clks); - if (ret) { - dev_info(ocmem->dev, "Failed to enable clocks\n"); - return ret; - } + if (ret) + return dev_err_probe(ocmem->dev, ret, "Failed to enable clocks\n"); if (qcom_scm_restore_sec_cfg_available()) { dev_dbg(dev, "configuring scm\n"); ret = qcom_scm_restore_sec_cfg(QCOM_SCM_OCMEM_DEV_ID, 0); if (ret) { - dev_err(dev, "Could not enable secure configuration\n"); + dev_err_probe(dev, ret, "Could not enable secure configuration\n"); goto err_clk_disable; } } From patchwork Tue May 23 20:55:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 686071 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 D9A15C7EE2E for ; Tue, 23 May 2023 20:56:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238394AbjEWU40 (ORCPT ); Tue, 23 May 2023 16:56:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237960AbjEWU4Z (ORCPT ); Tue, 23 May 2023 16:56:25 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA7E6E46; Tue, 23 May 2023 13:55:53 -0700 (PDT) Received: from [192.168.122.1] (84-115-214-73.cable.dynamic.surfer.at [84.115.214.73]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 1D8F0CFBBD; Tue, 23 May 2023 20:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1684875320; bh=KbyN660P4K9nXZQ1uRPCzoYIz9+m7zFQSZkHmEEPGaw=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=QTR7zoe3edw+1NnWiN68jjpa/etlAj/tvj0gcD8+tF0V67Yc44WeLtx9NzLDdUdyG OrkcdojcFGMMJ9WKHMTRLWmM5ybmEHUdo9av+y8GuirOWp3Hp+gLIVccsCzj9IK7Ma cIxECV5hKrXQU9dl12XwY8JZXFnoc8ls7FY41Ths= From: Luca Weiss Date: Tue, 23 May 2023 22:55:10 +0200 Subject: [PATCH v2 3/6] soc: qcom: ocmem: make iface clock optional MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v2-3-177d697e43a9@z3ntu.xyz> References: <20230506-msm8226-ocmem-v2-0-177d697e43a9@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v2-0-177d697e43a9@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Clark , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3432; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=KbyN660P4K9nXZQ1uRPCzoYIz9+m7zFQSZkHmEEPGaw=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkbSgyRTnZM3H5u4pMaBwi7IpVq0Wll25i/4497 qr8wpmLne2JAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZG0oMgAKCRBy2EO4nU3X VktQEACfUvu7M189YLfnMWagUJPnYZEXeChN2/F3H8GtZwUxS1w6HlFvRB6EuRMbkTQ+2YyDsre QXV/F7bywppTH4ShrGckIYBuOHdTzFViXOvuNz/0OaL92T9yxubIv3kfXrwt26Qnz2zYJAppve4 qEbGo5/xhqfmzBUBQELzwg6hmHg6s8lVQ8scQJecvW0+NmrQk44cJ1KHHoZ9RmsVNXf0naDyk+S KgPa7oTW2rUjd9u4V7C2OKJX1c2htUo6ucEU2VNdevMGfjNGmsPBRHaJSFTcin+pSbgmmHM5wwh /S5yYgb3Jl8RwpBI5SctdFFSyjI1vrYdfYrhQwQvVovxlE5lU8vS8iUk6FA62gocMKab2WUGzwQ EqJzANheNdRBApZVTqJVFieibtSDgVBxEXZFDWjAR1caKg9JaXF4w1OaO2Nj6in44UfqTgjnCho HTxeSgUFzYd2pjKgeK2nevN2z7y1r4lQk8IHnKEAMGe4bJi1X2+nsPbgSSzrsuvgdTwJsY+m3C0 RGM6h4YkmknI3ZSmZctd9Zu5WPcbmoQmVRCKg3VECfJKO1lWsPpmN8nvgj7BEN2Zjj0DI5Ad3Wq OXzJPil74rkMB7MPvSsX3LtEduq669HxNou3ayIbLHoDUFUz6dcXI+j912yJ2cj5zNc01yp2WXn lBz0kbIz/mLjIug== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Some platforms such as msm8226 do not have an iface clk. Since clk_bulk APIs don't offer to a way to treat some clocks as optional simply add core_clk and iface_clk members to our drvdata. Reviewed-by: Konrad Dybcio Signed-off-by: Luca Weiss --- drivers/soc/qcom/ocmem.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/drivers/soc/qcom/ocmem.c b/drivers/soc/qcom/ocmem.c index a11a955a1327..6235065d3bc9 100644 --- a/drivers/soc/qcom/ocmem.c +++ b/drivers/soc/qcom/ocmem.c @@ -54,6 +54,8 @@ struct ocmem { const struct ocmem_config *config; struct resource *memory; void __iomem *mmio; + struct clk *core_clk; + struct clk *iface_clk; unsigned int num_ports; unsigned int num_macros; bool interleaved; @@ -91,16 +93,6 @@ struct ocmem { #define OCMEM_PSGSC_CTL_MACRO2_MODE(val) FIELD_PREP(0x00000700, (val)) #define OCMEM_PSGSC_CTL_MACRO3_MODE(val) FIELD_PREP(0x00007000, (val)) -#define OCMEM_CLK_CORE_IDX 0 -static struct clk_bulk_data ocmem_clks[] = { - { - .id = "core", - }, - { - .id = "iface", - }, -}; - static inline void ocmem_write(struct ocmem *ocmem, u32 reg, u32 data) { writel(data, ocmem->mmio + reg); @@ -316,9 +308,15 @@ static int ocmem_dev_probe(struct platform_device *pdev) ocmem->dev = dev; ocmem->config = device_get_match_data(dev); - ret = devm_clk_bulk_get(dev, ARRAY_SIZE(ocmem_clks), ocmem_clks); - if (ret) - return dev_err_probe(dev, ret, "Unable to get clocks\n"); + ocmem->core_clk = devm_clk_get(dev, "core"); + if (IS_ERR(ocmem->core_clk)) + return dev_err_probe(dev, PTR_ERR(ocmem->core_clk), + "Unable to get core clock\n"); + + ocmem->iface_clk = devm_clk_get_optional(dev, "iface"); + if (IS_ERR(ocmem->iface_clk)) + return dev_err_probe(dev, PTR_ERR(ocmem->iface_clk), + "Unable to get iface clock\n"); ocmem->mmio = devm_platform_ioremap_resource_byname(pdev, "ctrl"); if (IS_ERR(ocmem->mmio)) @@ -333,11 +331,15 @@ static int ocmem_dev_probe(struct platform_device *pdev) } /* The core clock is synchronous with graphics */ - WARN_ON(clk_set_rate(ocmem_clks[OCMEM_CLK_CORE_IDX].clk, 1000) < 0); + WARN_ON(clk_set_rate(ocmem->core_clk, 1000) < 0); + + ret = clk_prepare_enable(ocmem->core_clk); + if (ret) + return dev_err_probe(ocmem->dev, ret, "Failed to enable core clock\n"); - ret = clk_bulk_prepare_enable(ARRAY_SIZE(ocmem_clks), ocmem_clks); + ret = clk_prepare_enable(ocmem->iface_clk); if (ret) - return dev_err_probe(ocmem->dev, ret, "Failed to enable clocks\n"); + return dev_err_probe(ocmem->dev, ret, "Failed to enable iface clock\n"); if (qcom_scm_restore_sec_cfg_available()) { dev_dbg(dev, "configuring scm\n"); @@ -396,13 +398,17 @@ static int ocmem_dev_probe(struct platform_device *pdev) return 0; err_clk_disable: - clk_bulk_disable_unprepare(ARRAY_SIZE(ocmem_clks), ocmem_clks); + clk_disable_unprepare(ocmem->core_clk); + clk_disable_unprepare(ocmem->iface_clk); return ret; } static int ocmem_dev_remove(struct platform_device *pdev) { - clk_bulk_disable_unprepare(ARRAY_SIZE(ocmem_clks), ocmem_clks); + struct ocmem *ocmem = platform_get_drvdata(pdev); + + clk_disable_unprepare(ocmem->core_clk); + clk_disable_unprepare(ocmem->iface_clk); return 0; } From patchwork Tue May 23 20:55:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 685093 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 61541C7EE31 for ; Tue, 23 May 2023 20:56:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238414AbjEWU41 (ORCPT ); Tue, 23 May 2023 16:56:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238372AbjEWU4Z (ORCPT ); Tue, 23 May 2023 16:56:25 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F542E47; Tue, 23 May 2023 13:55:54 -0700 (PDT) Received: from [192.168.122.1] (84-115-214-73.cable.dynamic.surfer.at [84.115.214.73]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id C2217CFBBE; Tue, 23 May 2023 20:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1684875321; bh=aPtCVb7bMGI3Bez5WNGrIPZXM0gwdzb6rJaHCsnocYU=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=coK+yKsOw86vwe8Hi00MaAmKNDBCUZmxlp31PgyID85GJ4sEVdT+R1rKkfun0B1j+ r4fmp09OFvlJHfXhhxBEXyROXPFYRDTEHUyWFJStpyhm7/C5Wf+PT45MKhQz588NNm SQPADe8B8Px1wNC0vg6iqCY6e1G1JF5pXGWoAHPo= From: Luca Weiss Date: Tue, 23 May 2023 22:55:11 +0200 Subject: [PATCH v2 4/6] dt-bindings: sram: qcom,ocmem: Add msm8226 support MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v2-4-177d697e43a9@z3ntu.xyz> References: <20230506-msm8226-ocmem-v2-0-177d697e43a9@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v2-0-177d697e43a9@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Clark , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1487; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=aPtCVb7bMGI3Bez5WNGrIPZXM0gwdzb6rJaHCsnocYU=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkbSgyWin8k5mWSVatDg1flE4t9aVuyq4JFZYg3 OOBJTafggyJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZG0oMgAKCRBy2EO4nU3X Vi/LEADWu/gzjzzWKwuTgK0ZS+N6xklZGSQ/H8f6X8i6Oi0GvkD035oMlm5ylVw97hIzLblkPz6 O1n1Tn0RSseS/XfSrh5s0wlzn5wcHLLuNFcgaRYXPiYnoBvE4IGKeyRkC4bSUHv4uls38oO7tVQ INJZBmXrnTdrcccDZWSJ5F7oZMKVD3wZSBsWiPoCNvV4Yx7Hw1rMYXdxX0+pLElx7LSgSswt92A DElKqvlcZyBDKatBHElj7dyLuZrW/qdgi/acXnVDe4US1OAqiqG4Cew6AXkSim9dzHF34lGIBWb IgbRdRMK8AW8LGA2XVDaLaFUe1pTmnPPSeUZ9MeGSrCgRFTjE+NgaVXst+mo/PYu+5Gy9/vXlhP 7r8vXyT1YabttpzLiTKefm/kc4CX/TgCAIF41qU6cO0Yy12ZDy6oLqtYmBF1qyJCA5DFgGDKpdS HTpSN+y0gdGbW8IcoRPxAWlnDbPH91KEvFwor7TuoijJYOA3j84rBgNX5W0TwK5LCuMmbeR8qgP 4UDfM/CVQOIfxOrArQzSpJUe9P+aqVijb2p/GLSaiiy5Kw+LKkxhVecOp3D14DD7h7t4eI0y1pm RCr69knGTJ1rABXnxX/jKfqndY0tN4DI/UOXAWi/eDPFKYEqyzehZHJKVvFGiTLuYdAtP0aD9+9 qF1ia0L5LxqGMEw== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add the compatible for the OCMEM found on msm8226 which compared to msm8974 only has a core clock and no iface clock. Signed-off-by: Luca Weiss Reviewed-by: Conor Dooley --- .../devicetree/bindings/sram/qcom,ocmem.yaml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sram/qcom,ocmem.yaml b/Documentation/devicetree/bindings/sram/qcom,ocmem.yaml index 4bbf6db0b6bd..02e4da9649fd 100644 --- a/Documentation/devicetree/bindings/sram/qcom,ocmem.yaml +++ b/Documentation/devicetree/bindings/sram/qcom,ocmem.yaml @@ -15,7 +15,9 @@ description: | properties: compatible: - const: qcom,msm8974-ocmem + enum: + - qcom,msm8226-ocmem # v1.1.0 + - qcom,msm8974-ocmem # v1.4.0 reg: items: @@ -28,11 +30,13 @@ properties: - const: mem clocks: + minItems: 1 items: - description: Core clock - description: Interface clock clock-names: + minItems: 1 items: - const: core - const: iface @@ -58,6 +62,20 @@ required: additionalProperties: false +allOf: + - if: + properties: + compatible: + contains: + enum: + - qcom,msm8974-ocmem + then: + properties: + clocks: + minItems: 2 + clock-names: + minItems: 2 + patternProperties: "-sram@[0-9a-f]+$": type: object From patchwork Tue May 23 20:55:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 686072 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 D49C5C7EE23 for ; Tue, 23 May 2023 20:55:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230214AbjEWUz2 (ORCPT ); Tue, 23 May 2023 16:55:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237846AbjEWUzZ (ORCPT ); Tue, 23 May 2023 16:55:25 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EEEE192; Tue, 23 May 2023 13:55:23 -0700 (PDT) Received: from [192.168.122.1] (84-115-214-73.cable.dynamic.surfer.at [84.115.214.73]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 71CDCCFBBF; Tue, 23 May 2023 20:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1684875322; bh=aDpqE5sNhXGbjAX9JLCTPksROWy3/PvZ9EHy0OnWauA=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=dBJGw0gNdyu9hLScQKC0ssdduM3zm+nPw8O/5x8SHaR0J4p/RSXDNa54ThzTXDlVd SJfCws/2257g+JAwUKr1OoejAwceNSg5HasXrO2Gf6X/SeCytSsv6nJ8hrkLjvSVH8 XcfAUXIGK3euMBI6qjMst5LA5pDlt2xqVmB2dA/0= From: Luca Weiss Date: Tue, 23 May 2023 22:55:12 +0200 Subject: [PATCH v2 5/6] soc: qcom: ocmem: Add support for msm8226 MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v2-5-177d697e43a9@z3ntu.xyz> References: <20230506-msm8226-ocmem-v2-0-177d697e43a9@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v2-0-177d697e43a9@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Clark , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=964; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=aDpqE5sNhXGbjAX9JLCTPksROWy3/PvZ9EHy0OnWauA=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkbSgzjZe8geHMxNlgyKmC13XCKhTjhGg2GPOE9 ld3edkHq/6JAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZG0oMwAKCRBy2EO4nU3X Vso5D/9pWg+T3ytFhvltXhLKg4OxDz/EMvbbSNNzrZB4bVUbuKY/6k8cWdhDEQhQ15Wv36ZJd65 d2ZeKmYS8S41v+62hXe9B1kuNCaQ9GMnoH2Allq27TwqQAyTKjUvTtMgqSW04fN+Yc8jsgNXKGh B4j6JrOuDasfFZUxjBNVLS/Gh68NW/XCPAUKio9Aj24Oeo/ectjxzAtPRJHntTTX3+wSBfmvGyK cv6wipk5jF3prvqN6dqRRFqyj1W5+JnVqUAwjUYnqVGJ6j8TAd6SPozkWm+SGB9NaB75lj+gjaC CAOl0Jak8EXDLHHgtoBEKmKyyaWQJPuz0mYTZGNizSxOWQfnPETRz43FbwVGJynlu6HjdYrZ3/n V8dbVUk12muHSi0AfYtGJmMobHEw85a49S+kEi6lnH9KS/YwQBavPzhYH74eOotA09gz2YWnptQ eHX45WDg2UmN+nvaZb1escdrt5Qr7c8cB8lOBLIFl1Zojn1iqg4ud2TgKWPPRub4Q8II+4kB2Bm q8qekReGj8Fi4pWagrCpTdb1o6PuJx/uMloFFTX5shWJIH07aWfP/MximXWMM7wa7bmWCfws1WI 2Y22wW8P0+GVKnZfPk8WOmjs5z/Rx3JjT52jf3KajmLIon7Nvaq/x0ztdcvrccqA9UKhZt1Ohm/ kumzeN7IPlmiHpA== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The msm8226 SoC also contains OCMEM but with one region only. Reviewed-by: Konrad Dybcio Signed-off-by: Luca Weiss --- drivers/soc/qcom/ocmem.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/soc/qcom/ocmem.c b/drivers/soc/qcom/ocmem.c index 6235065d3bc9..d5892ce999c9 100644 --- a/drivers/soc/qcom/ocmem.c +++ b/drivers/soc/qcom/ocmem.c @@ -413,12 +413,18 @@ static int ocmem_dev_remove(struct platform_device *pdev) return 0; } +static const struct ocmem_config ocmem_8226_config = { + .num_regions = 1, + .macro_size = SZ_128K, +}; + static const struct ocmem_config ocmem_8974_config = { .num_regions = 3, .macro_size = SZ_128K, }; static const struct of_device_id ocmem_of_match[] = { + { .compatible = "qcom,msm8226-ocmem", .data = &ocmem_8226_config }, { .compatible = "qcom,msm8974-ocmem", .data = &ocmem_8974_config }, { } }; From patchwork Tue May 23 20:55:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 686070 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 4B2C7C7EE23 for ; Tue, 23 May 2023 20:56:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238417AbjEWU42 (ORCPT ); Tue, 23 May 2023 16:56:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238377AbjEWU40 (ORCPT ); Tue, 23 May 2023 16:56:26 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64741E4F; Tue, 23 May 2023 13:55:57 -0700 (PDT) Received: from [192.168.122.1] (84-115-214-73.cable.dynamic.surfer.at [84.115.214.73]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 225CDCFBC0; Tue, 23 May 2023 20:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1684875322; bh=/f9dqg9L6IlOJuDdcS8mZ2hEPNfzmqpNeoG6GKRuzBk=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=kTU+SPIoooPWjW1kd9VLXHp2SOo1A9Fkoq6bV45jjH8L8FtkiaVwX58XAU6lCdYYb 4ACwAbEKWm2AvdNVwYadHMO8M+BDV/H71yFbMllYBTS6BlXgpzcQaWQJBcc+hBFxQE bQ3eSv6Nv/TEm/+uIJ7a15qSzyF7NGwCh/cPCp6M= From: Luca Weiss Date: Tue, 23 May 2023 22:55:13 +0200 Subject: [PATCH v2 6/6] ARM: dts: qcom: msm8226: Add ocmem MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v2-6-177d697e43a9@z3ntu.xyz> References: <20230506-msm8226-ocmem-v2-0-177d697e43a9@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v2-0-177d697e43a9@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Clark , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1007; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=/f9dqg9L6IlOJuDdcS8mZ2hEPNfzmqpNeoG6GKRuzBk=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkbSg0MIzSV935ZDPSAxyzVLovGYyPf1a9yrySF zmowdqy7OiJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZG0oNAAKCRBy2EO4nU3X VhwfEACYCNM7mdJN4oOSZxaoDgx+xQTsWllDrNHV57pSzIortFI7G3syWNStMvYjrXm9j+/jTTD U0lCK522IX/UAbpVNT7rUrbg/5tacpsi7oS35D9oqdksTpDlJ4K8pXxT3tmuXQJ3FJilVJQpVow cG8IGvDBFejF7kbcSa2wBJvzSbJZUBzhawmZjHdDHShaVTMEUuApy7q+fhLruMMlR6VJ6aNVdZ9 36chQ+IM8gJd4YBaFbGopL/Gw8QptWNR1WsgCH7xiMONvFW4Q/3mumc636CWE4zEid0kbv6zHqt V+bRwo+PhwV3qYX4NNcmgTtBmFBV/I1r0dwD+ls786ogbEBBfXsiFkzhl68b9Tjza700R0ro3Lm qO0IYT4Y25SHs+YF8jcwhn3PdOpDMdmaJRatn5F69+lzgltzMU3Y+6/3md7uiAtErVRYgmBruIh Cnyualdp8zXCosACUuhgatRTrSGjIps6Rk9yAT9QpGTDhkVhW4N/ulE2FM+lEf+bLRCtsM6CYJM D7rl4Cpmx8ScugJDRA56XwJbcfDY9GGMid5woeYBy4M13ciR+lwyp4/unWz1Sf1G0gwKXtjsyZ4 3eJzqlNP6IrF8pDgfdGX+h3t6qQX7B7MyLNiuAv4XQS6axh266gtHr2CM+7s/ECKHbhowhN32Uv 6q+G4xkJu1GoDUw== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add a node for the ocmem found on msm8226. It contains one region, used as gmu_ram. Reviewed-by: Konrad Dybcio Signed-off-by: Luca Weiss --- arch/arm/boot/dts/qcom-msm8226.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/arm/boot/dts/qcom-msm8226.dtsi b/arch/arm/boot/dts/qcom-msm8226.dtsi index 42acb9ddb8cc..7ad073eb85c8 100644 --- a/arch/arm/boot/dts/qcom-msm8226.dtsi +++ b/arch/arm/boot/dts/qcom-msm8226.dtsi @@ -636,6 +636,23 @@ smd-edge { label = "lpass"; }; }; + + sram@fdd00000 { + compatible = "qcom,msm8226-ocmem"; + reg = <0xfdd00000 0x2000>, + <0xfec00000 0x20000>; + reg-names = "ctrl", "mem"; + ranges = <0 0xfec00000 0x20000>; + clocks = <&rpmcc RPM_SMD_OCMEMGX_CLK>; + clock-names = "core"; + + #address-cells = <1>; + #size-cells = <1>; + + gmu_sram: gmu-sram@0 { + reg = <0x0 0x20000>; + }; + }; }; timer {