From patchwork Sun May 7 09:12:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13233708 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 D1593C7EE22 for ; Sun, 7 May 2023 09:14:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231686AbjEGJO3 (ORCPT ); Sun, 7 May 2023 05:14:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231604AbjEGJOB (ORCPT ); Sun, 7 May 2023 05:14:01 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F27AC18DC9; Sun, 7 May 2023 02:13:45 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 952FBCECCF; Sun, 7 May 2023 09:13:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1683450781; bh=i6MUY07ZK9aW+SSGpZnVlsq92bvXpLa0zV//65KE6Q4=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=jUnIRj2bvZzcpmqU388i/CJpLh5Ul932Kl9UyU2ykbyRLUkyhrRpMOxUf7NB3tx9a sGOOjMZDmq0yBLei6hO0kN60rfIb4G8dVrwkfK8MJPlh25GeS7O/De9Jd6tz+kAJPW 16pakdWQXxOUW7rU2JCIaBaIivgy0X3CJUyLNvWA= From: Luca Weiss Date: Sun, 07 May 2023 11:12:18 +0200 Subject: [PATCH 1/6] soc: qcom: ocmem: Fix NUM_PORTS & NUM_MACROS macros MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v1-1-3e24e2724f01@z3ntu.xyz> References: <20230506-msm8226-ocmem-v1-0-3e24e2724f01@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v1-0-3e24e2724f01@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=1310; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=i6MUY07ZK9aW+SSGpZnVlsq92bvXpLa0zV//65KE6Q4=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkV2uXNsyOTr0Fd1werpTcyV2+17F9vo/cxSUxi kgvyaM2K7yJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZFdrlwAKCRBy2EO4nU3X VvE/D/9UjaK3G0QJaYUD8DHa3KGYor5qczjYAkRVxMGHm0T9h6ydke9VFQhJ78gPrmoExDEnwpA a35r5HA2Mh7ciTZPv+5dJU8mS/j33+Au3V4JeIy2i8O5sNIbKKmgbyY/Rp5UMgdeuSE1/nH0GvS eMHaA5TmGLObD3MuoUEElmW6fO2v7tCBBP8c6OK/bQlJzMOYVj5bv+4fJlGilFmw0jcOxPEe6oK 3Q/BVIUqtaYy1CFZjGFtKFc9mKLQulRlb3jeMGVcsEsT0t2Uos/txlsO5LtrXmrMP/Be4+e7qLO HJMfTvguo+7J1On4m2MspvTJwDDzNAjIpsvf38rIQn9MPSUJQtInbzGkEkU7EqWMTCzBeb8fFtc 2qiGirtKFOWJ92ywhXw1GIVsyv6KAplISE7dcduyEu4cajWZ/o4pUaPDhOBp6/Rx8ajWBQlPDNG rCSy9xHoj2VAHwSkz0vNUY0rMbT/vq0igzyh5WcZAQmoND/Kn4r9CZfynjObeFhnoaiSEI5qHIr Qy/C1a6rXWdHRWl6aceHsE1BPNr6wp99UdHBCt5ae8LfcYkuEShifaaLWi2b9q9MKeLNfruW/5/ SPupv/ICXH/RVSW0U7HUIdCs1Bo8oi/4vm6e1ZRaAem92YBCmsFsrSO/XgTxq1DciFUavtFeQY5 oj3WpnCnF/uIFjw== 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") Signed-off-by: Luca Weiss Reviewed-by: Konrad Dybcio Reviewed-by: Caleb Connolly --- 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 Sun May 7 09:12:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13233702 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 0650BC7EE2C for ; Sun, 7 May 2023 09:13:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231282AbjEGJNG (ORCPT ); Sun, 7 May 2023 05:13:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230489AbjEGJNF (ORCPT ); Sun, 7 May 2023 05:13:05 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E9D293E2; Sun, 7 May 2023 02:13:04 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id DEF16CECD0; Sun, 7 May 2023 09:13:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1683450782; bh=E9biyDI0DLfbEBqzwl+YBfznH2gNa4Wog6B7dyC2CpE=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=rochLcLlq/GwnKaGjqG6zMTk2CtFbnQ7KW2dDmmbooN/YmigA3DVS5t/dFGhhaDqG N9/rLuJCGyUE2NEfaaby4oXzmQp5FE7ATaBjZmzz0rC6apDNV6HhiAIEX14BwGTCTu NTTa7U2oRejkiBoRW47UEaQcdXfNHf9+I59cBGg4= From: Luca Weiss Date: Sun, 07 May 2023 11:12:19 +0200 Subject: [PATCH 2/6] soc: qcom: ocmem: Use dev_err_probe where appropriate MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v1-2-3e24e2724f01@z3ntu.xyz> References: <20230506-msm8226-ocmem-v1-0-3e24e2724f01@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v1-0-3e24e2724f01@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=2078; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=E9biyDI0DLfbEBqzwl+YBfznH2gNa4Wog6B7dyC2CpE=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkV2uYkTqSmoNdinvDWXQg0A55V40l2a/IxNNBx WB7YuikTkmJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZFdrmAAKCRBy2EO4nU3X Vi/JD/9ZcJj/mqviz3iy/mdm570hSsWfyw80mEYheJnimMGcsgckJK7Or5uJzTGgPCetG9dxHOM McYB33PT5yiHMvAG2XHBmVvOSdlrZEniHGVNMhVBMS2ogcd/i7MUEkJhuNxPk0Y3tX3RDBYgWQ3 W9lje/OcxPtfjCYm5Yg75qaJ1Mx+LIOGw78rKIjtwMTi5iFQKLVRU3SUw9OS0Bnm1ANjXa0VjPu uy+HxU8heH5GEMJ/aENf2VJ1DZJWwOoh3RSfJL3M6w4jD5vMqxu9F1b1g/CJCGpZ/FgA4OAyg0V EPXmtzXitaklNNCVUA/O/cYdkpaCYMSDGvx77xWZk0xwHeWNcG6NajA7J4qDGhej4XZmKT8Owih THxQJLa/NumrMYPZ+rlb5W16KMdpBGUtaTazI36YdKNEg2yectgukCnjbPQyyWYnAtpyrADFil0 SH5uYu5wmZY6LRwUfEdHgpEsNf6Oo13Aw9ZgmWNwR3ohjnol7KOLg41shkkic0wwaGkyztFzefl 8AqNauuF6oH16tQiWBgEMnxTLUiwzrsUTp54bPHOA7JTdcWgi/LF60QIM6WMhyBair97HMDiaxo OynDMpiFtto7xy8ZFfGszYG8tIoSBy2mIQmq3duK9CeCSv90eSMXJsAh04OJBUBgtTOBYrrlM2f LwSuQTNOOk0HMfw== 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. Signed-off-by: Luca Weiss Reviewed-by: Konrad Dybcio Reviewed-by: Caleb Connolly --- 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 Sun May 7 09:12:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13233707 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 5A1BCC7EE26 for ; Sun, 7 May 2023 09:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231702AbjEGJOa (ORCPT ); Sun, 7 May 2023 05:14:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231519AbjEGJOB (ORCPT ); Sun, 7 May 2023 05:14:01 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F263E18DC5; Sun, 7 May 2023 02:13:45 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 2CF0FCED42; Sun, 7 May 2023 09:13:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1683450782; bh=7KtnS7Z+etOjmKrOyowpeMfEieUCur9/xBWzDiV//qM=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=oFZt2cFig6qgSnBk2+zaN8QNc6lgs1R7D3YHe8UoE7TMByAcU+R6mtQD8T3iKl9ss ROapqefpVN4YZq2D+QuotC0hTyHCWcBQTdLAeOS18M1rVUdjTwMOKOjDR0dTlpftwu On0CQT0ZR/DNypgZ3ZUgri0DCa44YDdN/gFKKhtA= From: Luca Weiss Date: Sun, 07 May 2023 11:12:20 +0200 Subject: [PATCH 3/6] soc: qcom: ocmem: make iface clock optional MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v1-3-3e24e2724f01@z3ntu.xyz> References: <20230506-msm8226-ocmem-v1-0-3e24e2724f01@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v1-0-3e24e2724f01@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=3377; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=7KtnS7Z+etOjmKrOyowpeMfEieUCur9/xBWzDiV//qM=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkV2uZ0+L8JdjISj+5P1ZXupY/dHokPjna72Ot7 sNVXd2PtB2JAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZFdrmQAKCRBy2EO4nU3X VgcREACUq7S1p9RsFUHU5Iny4N3ctDjH3jdSBvkmpF2wkDw/Xq2iSwNxXyodKttmnjcGSxqXoDy R9Qq8VwEg2Rg8uClBJbxdwHUI/T1KM9+fJdvP8AwgyX9i6kgeBhlsmiRLEqs72zBkCf75vCfA+L B1toXx12VTlXCjJXBI84THzbD5dUASoh+Mh+z/EJyCJDwGm+PnAUoWot+fcJ5ImY/USMAD8Rs47 kUNA6P1agnLQcHcqzC3+3jFr/9Y9TEO40cUT2imaYLV/jx5YZ0K79JmKXiW04SaTyOSBAjb8rwY KRi5mj3c+UAIHY4PTFCHSrGBDBbjeePguWYmQCFGRrL38EoJnEHNhoKlPRCGpb16cUo55kYiWck k3mcr7sUZDMmLyLS2tbH36zFRtlx96NLM/Ppr1e4SmYAMThEMysQUsPv/P7rOb+hlBK7Ur64bSV 4qfOxf/rvCxK/inU8ejBKXzntXSEo88e+b4cQSLrbNyUCQPEBuLq/EUzD8ycn8HT2+en4q+qtHr nh+TMDQrsh1LgKYNHSXCyNs1fn6Jr6vjlrRCAChzJPc2XJfVTNfOmFXUJctUusv1RHu9DvuYE4A nEjd0qBRRo627Z9q5B4bevrGGXfVj2Jk5SQCnR3m2O1JYHH/J230pBu2wLvrUWVPeUA6OGLQhSx eFSIRAGajsBSQ7A== 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. Signed-off-by: Luca Weiss Reviewed-by: Konrad Dybcio --- 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 Sun May 7 09:12:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13233704 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 533A9C7EE2E for ; Sun, 7 May 2023 09:13:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231339AbjEGJNH (ORCPT ); Sun, 7 May 2023 05:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231160AbjEGJNF (ORCPT ); Sun, 7 May 2023 05:13:05 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BE0293EF; Sun, 7 May 2023 02:13:04 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 70D90CED44; Sun, 7 May 2023 09:13:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1683450782; bh=+HLqotxx7gZMNsXvbHFzLrlC56VGgmQVw5mOG7any3k=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=I/dZSPdDA572hljFRrN7W+2ZA4mwDEMq7391pceKwdyz751WCX5XnFBoMod0rd1E7 2bikMtFQoes2CN2bykdWKZVG7E203fuAmAoznXZ581X//h6kpObsQrSTs1wGORjCug wqL3wTx0FwtY3TqGFil29xZ0mNxe9naDlnbSLshQ= From: Luca Weiss Date: Sun, 07 May 2023 11:12:21 +0200 Subject: [PATCH 4/6] dt-bindings: sram: qcom,ocmem: Add msm8226 support MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v1-4-3e24e2724f01@z3ntu.xyz> References: <20230506-msm8226-ocmem-v1-0-3e24e2724f01@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v1-0-3e24e2724f01@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=1059; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=+HLqotxx7gZMNsXvbHFzLrlC56VGgmQVw5mOG7any3k=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkV2ua0xwuSXq/FjkXsYzhznBLwXPROZrFFglpf spNVlbngv+JAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZFdrmgAKCRBy2EO4nU3X VneiEADYmn8WW8ia3MJJq/N9f/5r4Cd/U20tZ21DQ9MdG3y27pipiRNgtx9Re9Ji9zbl2xIQSg6 Jp5LgZ/ixxmCPq5AANj3Y6K+oi7Ljh5Z/OcWLnlc2ZokKHq6NvTxeK0xNCqaOStQ/bsmh+38/GT uZRLIHV3VfdISsWTSNIrm+uZ1Nz/rUew6gsagvXKNBiCo66bIDFcLjGOhR5+7HWWUj/puJA9KRP RXuVpQLbu9tG4lToOYFnSRDX9RFpR0dX0v/6ZAhCk1UE5ObL1hSHPJ5KtLbBsfBh7coGxBJy1Qq 4xkrKAAyuCb7aZdjgbgv7u87/KXBMz6rgeiPxX5/BD2wH6HGXOGip/NRpcEwv9yif2roQ/YwJH/ omemRNmuwi5dGpsHYZwl1w2WQiDaHntVdTnfWPl7KzotyWXJNvAVhMzd5NEWR6+LPdnY3Yh9Vj8 zWTBGdYWvktpsmzFn+APIGnYU7CV/4MddBtoAPHuEqdV4cr4NXucL3V0x862r2mzccdnxVIydSL bzrO4omIBHr7qm+Ba3TVOPhwqfdxwrn9Xgc1xWQpckLEXnfBObw9WYsRexWdgd4LQQp2tRF4HoA DXZlGsGZ/GR78vWq2jmFRnQTas4KWtZwz04JGdFi+MWywjr8iaL8SiFbipYr2Qt01Kr1/7aT7Fn Rcg8Azc/jc9tGuw== 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 --- Documentation/devicetree/bindings/sram/qcom,ocmem.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sram/qcom,ocmem.yaml b/Documentation/devicetree/bindings/sram/qcom,ocmem.yaml index 4bbf6db0b6bd..515f0d8ec641 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 + - qcom,msm8974-ocmem 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 From patchwork Sun May 7 09:12:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13233709 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 9824EC7EE2F for ; Sun, 7 May 2023 09:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231604AbjEGJOc (ORCPT ); Sun, 7 May 2023 05:14:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231484AbjEGJOC (ORCPT ); Sun, 7 May 2023 05:14:02 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3058192; Sun, 7 May 2023 02:13:46 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id B06E4CED45; Sun, 7 May 2023 09:13:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1683450782; bh=MC8BJTkVNHFkpuzAQk1SVZ5OYONedDEetKHltlnaN1A=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=A6lcWCmHw5qdziSAay4U8p/SCdz24UD25mIemDtpcjQlcdhj3wvJ4LwU6MQQNq94e E8w+V2kkRO/+BOKLSgx5X1Ch2l+e6oeg406yqcQWnbkI9TgtnxrUpdY+YK+zh9Y9yE r1Rthq26pnoumzEXQ4VUV4DBGEjigySmMgrmGE8E= From: Luca Weiss Date: Sun, 07 May 2023 11:12:22 +0200 Subject: [PATCH 5/6] soc: qcom: ocmem: Add support for msm8226 MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v1-5-3e24e2724f01@z3ntu.xyz> References: <20230506-msm8226-ocmem-v1-0-3e24e2724f01@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v1-0-3e24e2724f01@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=909; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=MC8BJTkVNHFkpuzAQk1SVZ5OYONedDEetKHltlnaN1A=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkV2ub1U8OPVlxEdg5XyRaCndznhLRJNWmqUMTm bOYxKro0/aJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZFdrmwAKCRBy2EO4nU3X VsG3EACuCSoWyCHmUgzYkcnWvSHPhjroNs9okr5opad6kYowZdVQwqjGoDxmhuFsQwZE+w1TZ+K cOBQCV8oXSnntdaPKfyNM2ycedTQRL60J0gvQsfN1HyFFOJ/AwPbrtuOljRdm2+OH+trrgx9lrF ejlIOMSpKGLnsGzt5OQn3AcOYhBVKiOJSjkzdkP5D2sBpKHZ6+br6T/cVNuB0FcpPHuYGw34IfD SUGIVgiwU3ZPbCbrmtPHJjIX4cgwRWloYd/FEZ+YMF0lHLlsvTVptny58M+MAfPbbhAwa8yDwa3 Z9ZT/t4yw+iKhQQb4YggTJrU3z6Fr4449igoSibr24vowRzqNpy1QVqLSzOzd2JWX3KgTOB1RY5 jWIpedZdTiP8T6MzOnH9kCYsGfrp/MWuVtfG5G7/oIRgtiFmAjoWycJkYuxA9GxXTIzmqzQOJ6a a5l3PadOXkk5YTto+TpazxUxDcL7Jy+JXHZR5d9otME45Ghxiuh8PqX2AcU1jx3g+HBZwXl5jMn AwFVPPJpursVXmRDtr/++XqZPh75qt1h8F+dJXFJlITKfYrcy7RkUB2No4EPCLuAztV9V2fJbU6 f/6FJuroNJHW5MK4TqXQAVzEt69JDWxkzDEev4rMH73ph2Rl918vrcO8DeXu/3nbyMoxUo/3A4Z 8wxPinFE3v+x4Ew== 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. Signed-off-by: Luca Weiss Reviewed-by: Konrad Dybcio --- 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 Sun May 7 09:12:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13233705 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 A9868C77B7D for ; Sun, 7 May 2023 09:13:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230421AbjEGJNJ (ORCPT ); Sun, 7 May 2023 05:13:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231335AbjEGJNH (ORCPT ); Sun, 7 May 2023 05:13:07 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53E13192; Sun, 7 May 2023 02:13:06 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id E953CCED46; Sun, 7 May 2023 09:13:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1683450783; bh=N+w7jq7XeEONyTDg1iFjOZ+41A3wQL7SjMniFaAAMjs=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=GHogfyBMCuCtPytpym6kxvbfXYmQXgXanqBqynOJVkWth/f4zfqNZbdwzsCG0vjow YrAPawq8dO4j58PRmrEOZ+UiNIwSj8DHMU32w5dnCpsuBzh4wBltuw1eQlWrfjH5hB r8HStf/Y9IB8WR8WerI3QEgxzWAcfHYb5dvbtS/Y= From: Luca Weiss Date: Sun, 07 May 2023 11:12:23 +0200 Subject: [PATCH 6/6] ARM: dts: qcom: msm8226: Add ocmem MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v1-6-3e24e2724f01@z3ntu.xyz> References: <20230506-msm8226-ocmem-v1-0-3e24e2724f01@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v1-0-3e24e2724f01@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=952; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=N+w7jq7XeEONyTDg1iFjOZ+41A3wQL7SjMniFaAAMjs=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkV2ucx1260XKj8iQgsWYL36Tvoz+ZL22ms9O5o rVY2Mfy/hKJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZFdrnAAKCRBy2EO4nU3X Vn5FD/0fq/DQTw7hQB267BiTXJXPrsDu27z82VephJ8RV7XK0yP8uaNrk81MYLqxVa+pZD3cjY6 /GdYfgwJ4+rRROyDQZGuEie11ZXeBePhmSosg3yFPwouuHuUJ9HKXjWRXGf1mbU86Ha2zydygMZ 4dcRd+Qzf+saRnIWFJYL8/SlQ7sdsp+ce5LcT53wN/3UwAzvuNl2zf+hyAvKKkhaB7pPw3uxsVr HC3fSWoFpQax3xLuHLDnMfEDfzwn76NPBHLhVCAI3zbT2CW77jB62Yc49SXt7EuoHeGYWvROaPj m+J0haDtJ/tE955gAEpnJ4OlauK4fCcBLf8OR9XP0N2z7JXordyg0zS2QKgnJG6YRs4HbRzPcD6 SPNxUXS6m7IkdcNd1HEHs5/xDI+F+tPrZdyYlh+aEm+e3pJN5BWbkbIKJGxM7+DyJpYjRdMCERX B/C0pVErf0tNi8Lx7U3Q6GXFtpyXDXFRYco7ZbNphr0zwh8/pHDArX5Uo28RzPtZKzJ2/rD6Kbd csMDRV6p+gENv0qs22YWy0y3xnhUK/h6qefY+zmkV67KrWMzzcMrtu1EN5R/mzRKbAIny/QpP3W rXp9bCZZya4WDcAG0I1HMMMpJbufUIhSGLXjMOVN/IWsZdNLxC7vfefwkq8zrQHzDDCQcmhzw/O IEjF8MF8I9YufMg== 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. Signed-off-by: Luca Weiss Reviewed-by: Konrad Dybcio --- 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 {