From patchwork Wed Jun 14 16:35:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13280228 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 798D9C001DD for ; Wed, 14 Jun 2023 16:36:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235153AbjFNQg3 (ORCPT ); Wed, 14 Jun 2023 12:36:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234558AbjFNQgO (ORCPT ); Wed, 14 Jun 2023 12:36:14 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2FF32130; Wed, 14 Jun 2023 09:36:12 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 7CF5ECFDAD; Wed, 14 Jun 2023 16:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1686760570; bh=/Nap/h5b8ifbytezb1RECo6i67zkmm+JJ16tgLDL5U0=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=OfxvI8eg6MCmxixT0y3le+iOeLQVOXt7OZQqzGw+q7kHqUdbUS67gh9XyD6r9V3Fp i3XmjhW/VVGPc6FxmNUDe0qXa5f79F9Lya4H+1iyFGBHrKqUakQyqNbFq0G0kHddei B6udNErXW0licLl6spB/Ml4QtJyK+gbHJ2eShgRg= From: Luca Weiss Date: Wed, 14 Jun 2023 18:35:47 +0200 Subject: [PATCH v3 1/6] soc: qcom: ocmem: Fix NUM_PORTS & NUM_MACROS macros MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v3-1-79da95a2581f@z3ntu.xyz> References: <20230506-msm8226-ocmem-v3-0-79da95a2581f@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v3-0-79da95a2581f@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=1470; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=/Nap/h5b8ifbytezb1RECo6i67zkmm+JJ16tgLDL5U0=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkiex0QxiX051YGU3US5+bhXZmRwUWOPqTdKlr7 G0extjMpSaJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZInsdAAKCRBy2EO4nU3X VsF6D/458w91+bkJJGwKYob7yR28gw3zEleuIJDF8JLm3XVvbKovoPNVcTc9XgIonAI/M5L6tl8 feR3TY3EMXkrh4NCRM7HrfqyAJX+nTBDyCzEq6yiPAHFG+EsLs4cGeuZwdhNkOGGlYddb/nGzv6 cQ+7ZAIlLRIBZBKiZdEdZtb+oAr2W4DCXCG3Gf63LeIm0EqILhEEN73dxnD+Qbs9mqcNsmgJQ7G WP7zmuMu3C5lJlUYm1KRZZy12bc04d8slUNs+w3vkkUBc0y6kulkrtbdX7euXT80wMt21/jiyf6 Um3TvCBI/dmCkDOPQSuUblp0jjxwfNmYKaoqzOGCzvFuBX37r3Z37gonPJAhgex4HBYNOVyrUMp AZfs7wPuLRKY4MvBidoHNivgwIh3tUY7uNv761+f+BKyRrYVw1aAQLUCh5k6wttdb9WphAqr4/d EsWfuxpp9S6bW+r6Dg6KNz8djwt9AYZOoKz+QRmlvKh+yBC/2Ds2O1GcOnYq0Bbp8vOOVCEKP5J vXrznHGT/ocf39GLNlnMiks8nsSYEJwxrsClw2vvPoRc86/7jq+6UFGlIRnKUoTDzvx2YSbhOiq XLhyqn9zQv2+zs5hmkPuADFc+lhNrqMBGbWbkl5fwDQbhzQVt/K2y2D69w/gGshJPmUT5BezcxW nxoT7McJJ6njyQQ== 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 aaddc3cc53b7..ef7c1748242a 100644 --- a/drivers/soc/qcom/ocmem.c +++ b/drivers/soc/qcom/ocmem.c @@ -80,8 +80,8 @@ struct ocmem { #define OCMEM_HW_VERSION_MINOR(val) FIELD_GET(GENMASK(27, 16), val) #define OCMEM_HW_VERSION_STEP(val) FIELD_GET(GENMASK(15, 0), val) -#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 Wed Jun 14 16:35:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13280231 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 74883C001DB for ; Wed, 14 Jun 2023 16:37:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235507AbjFNQhM (ORCPT ); Wed, 14 Jun 2023 12:37:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235462AbjFNQgr (ORCPT ); Wed, 14 Jun 2023 12:36:47 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FE92E62; Wed, 14 Jun 2023 09:36:43 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id BE29ACFDAF; Wed, 14 Jun 2023 16:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1686760570; bh=UYXnMctzgGjbbadSnEuPjVT8RCUV5VfXXmHjVfoOibo=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=wA+XiKeBtGN6GMSTX5e1oi7/z6XgDwt7+3jUj29l1ni6lL4w23/jqqkreDk2wcVjE MMM1nUFWWd8aqIs4QOh1mPHlb7wo7fP24HvEuwKcGtTTOYCrFqRAMZUyLayI4jQWRb HWN1mWmvQn5COg50iKLhBzhlAPZFyqPDpgn5vsPY= From: Luca Weiss Date: Wed, 14 Jun 2023 18:35:48 +0200 Subject: [PATCH v3 2/6] soc: qcom: ocmem: Use dev_err_probe where appropriate MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v3-2-79da95a2581f@z3ntu.xyz> References: <20230506-msm8226-ocmem-v3-0-79da95a2581f@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v3-0-79da95a2581f@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=UYXnMctzgGjbbadSnEuPjVT8RCUV5VfXXmHjVfoOibo=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkiex1EvDlh0l16NTUdVdGYGuATCym7G2cRt0lj SXH0W1bVI+JAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZInsdQAKCRBy2EO4nU3X Vh7rD/9CywBQ8OuCcA8kGTFpjO+zzsF4FW8sLiLeFiL/4/HUqU+0VktLnBbPSDLVS4j4GFPZbNK tNlPZ+IMch07xfpPyq8UmSe9K9/Uubocc2PAGhO8zkt25SL406h72GhggPchNvQCmAmpgtQmYsu SoBSOnO5SCA7HXFvGu01L4ju1YmA6zfdRIal62/KPNkPHQuF0c78M8hLIroGcLNvvSrPNgXmmrh quw7aeZq6hCRb930xBoZpErBdN84PS31VYyt6HpD5Cpkxcxdqj5LoHDoNkOspDOB6BIpBz2Hy1I L6uIm2/IwZrRkzp9/x1RnWHQ4xtrUkcsCKJdCptEhvzEvbZ6h1UdgSsWUS4iogm0edEEjO3xjKp rNl4b5y6rV1ogwC3x4NuwjATdlmuQSAEVRkCQaImFM42VyMuy5LfQXtyvLPl4Gyf1MqBqv2dA7T 6YLYyjA6qAjuIqsCPH7rAUSWX2AJ8+kGx19ILL5rbhvdq6exjvc113xTSUK2yIGZ6TD2iNDVwJZ fNww2a5gYJSBf9WYKCI1kzKLVmFimDRN+DZhu4/RC+WKinc9b2P4RbsvxWxNmyAewJlSPP3hGG4 EBYLgafwkGVnRb0pejuWKRd1jddbvG5t//KLIXhYBIH1VFbEtsJKFjTtGV6QfuEOP37F7UKscfS nD1M96KnPqsNVpA== 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 ef7c1748242a..462514dfd9e3 100644 --- a/drivers/soc/qcom/ocmem.c +++ b/drivers/soc/qcom/ocmem.c @@ -321,18 +321,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"); @@ -345,16 +340,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 Wed Jun 14 16:35:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13280229 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 8DB06C001E0 for ; Wed, 14 Jun 2023 16:36:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234964AbjFNQga (ORCPT ); Wed, 14 Jun 2023 12:36:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234810AbjFNQgO (ORCPT ); Wed, 14 Jun 2023 12:36:14 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BC452132; Wed, 14 Jun 2023 09:36:13 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 02170CFDBD; Wed, 14 Jun 2023 16:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1686760571; bh=jXbcz8pgmHv7Ubvp/lgQSXeBlXJ95BLlvZUZUS9B2+o=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=BaQg5mJIxWMnIIGOyEkI0F9KWpoKaHfeS3sVywJmpMEr8FQ2I9J4gn0A5JW7eJk6i y8//it7HtNQA0CmpiQGqxTL26F434RYyDRwDnF76jV84Fs18tgJSTgDVV9IWx9XQhK 6Lq7mQ9T7QBMaHBBg0b+oprD6JWdtiF1fy0qREfU= From: Luca Weiss Date: Wed, 14 Jun 2023 18:35:49 +0200 Subject: [PATCH v3 3/6] soc: qcom: ocmem: make iface clock optional MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v3-3-79da95a2581f@z3ntu.xyz> References: <20230506-msm8226-ocmem-v3-0-79da95a2581f@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v3-0-79da95a2581f@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=jXbcz8pgmHv7Ubvp/lgQSXeBlXJ95BLlvZUZUS9B2+o=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkiex2CBWSebxRdei5WX11jWa9Bc/Ct8Y10OL+S nL3K9VO6nGJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZInsdgAKCRBy2EO4nU3X Vtn4D/4rcAZBSGRBneIhUZLF7til1eiBlWBAr3YIr/2u7eDS6s7QFWF8k/vjKrKqG4PjddeJtEA QI1mlBa8WvtUmuL4SwlvlZ8P/l3GNU6Zj9VC1tNMzDXX9Qs03tdgYO7xFOiKpHUqdxCsDesNCVM EDI1d1rCuX2R9DR3kJmsNH7/nnobOmG0jS//RpahTPCVhraruNGc5bgV4g9eF3jOHlw/0QMAl+L Y975EhnvoqSOwbLKWuuGiPD/bdzOqZh8Z+kgnbpV2yWGKllEjViLm1qOsCPCPm0aMY6dgxvbW1K OU3VmUIL9GlojlinI2nue4mB6vTnzFl+41uze13x3qDgvj39I0dInxXmtd1chuAXP00reu5V0PO ObQbIFSK5kyhghEzLBpaJtcPxtn5ZeT7I0+SD/Q+TmMILRiuqp6S1HbWg40YHRROuATR5tJ1KZN BeZuPFZEYWXZTh86uW2V7H7Vp4pNkfRlDtFQ1nAFhoTFDpbrn+ts6O9NvUIrgs0JHKd5TvtcKTK QoVpIE2jYHjamxmMGR/BzCCwC75WuzQVRvP+22PYo7lexmzfoLJdcczp7qNHfxcRzCgfd8noCeb iLRuwD2TKlhyxvm+YEEE+DUayyIS5UdZQj12sDoauWzGfyiQ4nHvkDTAE6RttIWibNrPnR5kZ02 hIrJxWdOjF2UaKw== 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 462514dfd9e3..ff8d01b0ac68 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; @@ -95,16 +97,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); @@ -320,9 +312,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)) @@ -337,11 +335,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"); @@ -406,13 +408,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 Wed Jun 14 16:35:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13280230 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 A37BFEB64DB for ; Wed, 14 Jun 2023 16:37:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235440AbjFNQhK (ORCPT ); Wed, 14 Jun 2023 12:37:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235460AbjFNQgr (ORCPT ); Wed, 14 Jun 2023 12:36:47 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2D521BD4; Wed, 14 Jun 2023 09:36:43 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 308C9CFDC3; Wed, 14 Jun 2023 16:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1686760571; bh=YDl2tvHHlHynpu6yX+1RRCk0EMdjswQ742sDIsDbcEQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=LzrVXewQaK3NM+myFVY67p5y86JuEt2MBPfRCqwU5uNsBtvB0mOOn7GFIdCDVR0Qb 7vQCUt2MSBhA1E6qCdNcajFPY1cHrELMaBZ/Nr34zyxvCjMggN64wFN5heIyhnM6uQ 0ZbmWwHly/ta0xGD4UHyZuvBwKU9buPOGZwYsl1M= From: Luca Weiss Date: Wed, 14 Jun 2023 18:35:50 +0200 Subject: [PATCH v3 4/6] dt-bindings: sram: qcom,ocmem: Add msm8226 support MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v3-4-79da95a2581f@z3ntu.xyz> References: <20230506-msm8226-ocmem-v3-0-79da95a2581f@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v3-0-79da95a2581f@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 , Conor Dooley X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1664; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=YDl2tvHHlHynpu6yX+1RRCk0EMdjswQ742sDIsDbcEQ=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkiex3PqIJUJA1I7YxQu4nSojJ4YWb5CZNxFSTT 9L39yLTMCyJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZInsdwAKCRBy2EO4nU3X VnruEACC+AoxPpJqOz/fFKRniSPON+RnZBUgxdx6q7gZK/p4gppq4qm1ysNyyM5CvXepyc4a4NK 1hEzMN2bxqMje+OPRAU95HWm1ethnmRn/R8OYPdJJYcyB+tWRXxZJnWFL9cqDcoSWsPzxDUPxss 1zKp4MeDg85zkDzcxfoP9CsM25lSv8WTjttWy1c9MrYAVxT8Y/OY0HkeumZaontCt57SgTTq3fw qvW+GQulTHdnp2QiHWQi2kkhsIjlOY48ZwnFwFdMo8Nq2mNsA47bSe+ts45VlztoojIm1bAII1J E57Y5C8+8bJaN0+dKBt+SRI9E4QwV9nM94ETgznOlD8KBuXeYgjEwJ4ZtWVmrT+pb045VRz2hQb /ObxxhU5i5/J0ot3Myyw1t7iCYHX+YetaYL2EKGQd5ndtM1YyecDDKkWhBBqzaDqEbWVdnZIIY4 NremeuFAQg4OOZqKtJPfwTq4FSaks1Z+tJDL2D4tzP0fUpAPO6wUY6jvFGOCpLYGW8BdGqlNRvx dbgpOuSdbfFydxk/j+BABPM75aDF2EZvWIiwbNyxrQtAiV4fzFRSHrus1oUEseroiChLfYkiGRJ qaRJvr+q8Ot6Y5+UolGRh9cnvZZ2lyB9I6SWu7PkQj2Gcf1ZjlaGT/LA0P1K4MqtBu1wQpLxaRO 8E2PV4FqHA+mFSA== 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. Reviewed-by: Conor Dooley Signed-off-by: Luca Weiss --- .../devicetree/bindings/sram/qcom,ocmem.yaml | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sram/qcom,ocmem.yaml b/Documentation/devicetree/bindings/sram/qcom,ocmem.yaml index 4bbf6db0b6bd..61c784ef7b51 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,26 @@ required: additionalProperties: false +allOf: + - if: + properties: + compatible: + contains: + enum: + - qcom,msm8974-ocmem + then: + properties: + clocks: + minItems: 2 + clock-names: + minItems: 2 + else: + properties: + clocks: + minItems: 1 + clock-names: + minItems: 1 + patternProperties: "-sram@[0-9a-f]+$": type: object From patchwork Wed Jun 14 16:35:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13280233 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 813B8EB64D8 for ; Wed, 14 Jun 2023 16:37:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235866AbjFNQhO (ORCPT ); Wed, 14 Jun 2023 12:37:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235552AbjFNQgu (ORCPT ); Wed, 14 Jun 2023 12:36:50 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C005212B; Wed, 14 Jun 2023 09:36:45 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 6E255CFDC4; Wed, 14 Jun 2023 16:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1686760571; bh=ZcQi4gcQ9xL6CFZvOAjPus5Or0PLbs0aejkO5TB4+r4=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=Cl3fWUm+cOdVqgXdDsCVWYcI7VRIy1kFDqZczlOVRUvL9oMkxFJCykiJ9jlE5RtV9 W1PKp9GOd4b8NHjvbD5jRPmbEnlM+DYYHvB/jFDS59cSjaSEKEJ+6vQNjuolm1j/58 9ZGl4Hi4Vvy2Y47RTm7ZZRCntL0AuvYobY5EYd10= From: Luca Weiss Date: Wed, 14 Jun 2023 18:35:51 +0200 Subject: [PATCH v3 5/6] soc: qcom: ocmem: Add support for msm8226 MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v3-5-79da95a2581f@z3ntu.xyz> References: <20230506-msm8226-ocmem-v3-0-79da95a2581f@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v3-0-79da95a2581f@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=ZcQi4gcQ9xL6CFZvOAjPus5Or0PLbs0aejkO5TB4+r4=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkiex4a3dI1fG3YDwRky/rM6jnxOsN0G59nQMCj /YNxZXC0SaJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZInseAAKCRBy2EO4nU3X VkqMEAChw6VBJFtVhya2Ckv5YroFpmaQnmjcnIhuSVjZ/Vp+/MptkCNRsRSS5CpP3m2ZWMutALP vbaadfdKLiofuvBs9jdfVIaOnbmYs/fVOLmalRBT2w1eZzQeam2hIbdgxhCws7SMxjqGcPE9Mcc jliWT0o2FFgQiAxGcXqVgztJZctfntAiuOtzT4uc7GutZ1UUzZevhrpnKfPfDFGXzRoxi/VQf+o 9zpcD+NAeOkIdjTtJ/VLkSmveeKZ3Y3KLOSZ2jrND2slkpbvVs6pYlN5uADEg5wuW6TU8M5Ek8I kqPfqDnvANinsI0CDHaiMfGMBnbZNv0ZTX/0RQV3ibZxPPymFw/EAHpgrHG2OTZeMNUnyukwAcZ r/5DfoQoYYc8jgTSHmqDFp23oSGcIsz9I2fj19P7sIGpdGo3w+CG8TTdAYNqPTdxNpuzSLSBHgk hRtE5Uh3J0F990srqzMJU0JuEfAzXgZzgWlahc4CDNRK9YpA0QfMfqNT6H78SynjmWT395QK7IB X+dV/bceHanOMfVaceokwjq3vv6GSgg7IB9AFQdzo6cntaS0LZlh+SYTIxaSEWI3yglSAn6Deex 9gA1RaoK8M+tugkF2I360Yb9LU40tZwppu5GcLhuGY9FzQ+xnOVWVTKqHNVx4cPwTnQySKcNmcL Zk0bqSB8DGEQD1g== 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 ff8d01b0ac68..2064e9512301 100644 --- a/drivers/soc/qcom/ocmem.c +++ b/drivers/soc/qcom/ocmem.c @@ -423,12 +423,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 Wed Jun 14 16:35:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 13280232 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 62B2AC001DE for ; Wed, 14 Jun 2023 16:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235769AbjFNQhN (ORCPT ); Wed, 14 Jun 2023 12:37:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235535AbjFNQgt (ORCPT ); Wed, 14 Jun 2023 12:36:49 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C2EC2706; Wed, 14 Jun 2023 09:36:45 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id C2F5CCFDC7; Wed, 14 Jun 2023 16:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1686760571; bh=oKwU2II8v2XK8a5QmHSSegoJ8EFPKKaePlMwwzSDrTY=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=Q9ArM7LxEyzLlI6D18nPSodcAj9LXBXXZNOI/4O2Z4Wl7rTenlkiESYkIMAuSQ7Vn GjiETPqZfVVQIdoz9iw1iY50jrLtTMdy+OwsVa85/5hX71/O3Ko2RfipVkeSSJGV1x quiCSl5mSQ4LmE/C444hovcxW4/LDSe8/nKVYGXY= From: Luca Weiss Date: Wed, 14 Jun 2023 18:35:52 +0200 Subject: [PATCH v3 6/6] ARM: dts: qcom: msm8226: Add ocmem MIME-Version: 1.0 Message-Id: <20230506-msm8226-ocmem-v3-6-79da95a2581f@z3ntu.xyz> References: <20230506-msm8226-ocmem-v3-0-79da95a2581f@z3ntu.xyz> In-Reply-To: <20230506-msm8226-ocmem-v3-0-79da95a2581f@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=1082; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=oKwU2II8v2XK8a5QmHSSegoJ8EFPKKaePlMwwzSDrTY=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkiex5kC8GI+n/EiN2TV8rbfsk0eiX9NWiTft/v BnpTCZQViCJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZInseQAKCRBy2EO4nU3X ViOLEACe+HKRU7BVYV6CsoWpGLfV0wkDgbbUlJlpZxdirMOXR4qlxfTDbHd2x0C/8UisepVvCmy 0uuOHwqcFOst6lVwqDJOxp2psVqV+6WufYs7k4xx8lGe5JccjygYg6a0VXkkMKRuFBc1lbN155f bOLzOMyrUP/DCarZwnPyt/HtxMbem/dxUwUJJqjoGgXDU1Wvn0zJu0UHRubuVybsQIlCLcSyT7l 5UfpvRYkUsZLk8GZ6SrmjrtyM7Jc3uWPFfAtwZc/byQWA1sVdemdAnhbV8ttGYGizXH6eX7KzD9 oSSsTSKvkxIwg/I9FeODOJIZS13Ahk+FC/oJoMjj1paOvdABkGHqsCUBeuIEO3VXNu6mqjulRIH EeHsIJVmAsVjR25OgRTY0CG5GJigBYKVd85o+b4G8TpBiHcxUC1fUQ+3E9blDj2rIU+02iqBAR6 HnkmGF0JdFKcFEN/vEDQcPhttGgVzlQ0go+APOodhgxgdQzH1dN9BTjnO/eVoOez4kvJ4hRPxwy BtVIkMkgwRDFxFx++07q0Vu1MhBpUR1OtmyfkvBsoUvEzO97B1GM3+4BPeHQ5bXvOqcV8jsCG/y sXle+fQPhrY9tWiWAjopoEZ2q/O7XPNQ8DDrN/V14yHu3aaPustWFKNuFIkR0iHSRyCQJ1CHn8K xO2QBs8iZlTXWrA== 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 ec1b72af80aa..7670ea93d76a 100644 --- a/arch/arm/boot/dts/qcom-msm8226.dtsi +++ b/arch/arm/boot/dts/qcom-msm8226.dtsi @@ -664,6 +664,23 @@ smd-edge { }; }; + 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>; + }; + }; + sram@fe805000 { compatible = "qcom,msm8226-imem", "syscon", "simple-mfd"; reg = <0xfe805000 0x1000>;