From patchwork Tue Nov 28 09:48:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 170662 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3796263vqx; Tue, 28 Nov 2023 01:48:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IEcCPqX27NtB/XuzfwGayhWiacd0BrGI4H1NpaQ0FGXAUqbHxD1YN6r2Spn3q8GHlNIr4RA X-Received: by 2002:a05:6a20:da86:b0:18c:57a7:ea29 with SMTP id iy6-20020a056a20da8600b0018c57a7ea29mr9027672pzb.45.1701164937955; Tue, 28 Nov 2023 01:48:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701164937; cv=none; d=google.com; s=arc-20160816; b=VNWMZWOodbZuacH3vZlEGnoSDMvyXkbX+eW2pnzS8naPUlGEuJuc9nWMEzN8pmFgSC cLUH/AinFd1azeciEjDzsXMvSSAz9YqX6swONko1i76QqyyTFoLTPYl80H6ZCJP3QJhi OBfb4TCsRySbenkQQNCUZDyi0QlvO12xxjm1zXyWGZlJ7OpAOKvU7aSt52Agaq1NpDyd 6Z9CV9BpOGuGHBdmYr6sMl1jylHk4DxcO9Sv1ENNhruVE2EixmaD2KQUPuA7YDOwfGKV A4QjMXelZcgA6Hm/PMI1kNPAPyWffg7hmcUna9sLBBcNl80Gq0KQgyqWqPQWA/OouxuZ eFNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=oHIdPeCtrx4tEmu1lgnT9TOC5wwT1XRZku7i/59y90A=; fh=H2AR/cQfeAfzQaevnNcmxvsu1hOPerjGrGtpbMvZ2sE=; b=zpqHGrt4kXv8hwxF5ha/iNN/v7zEvqiyQdGsoFCbnyFnn6qXKrPDeSDj+K/Q30vaBd ZWxfr4P8HkuyytOKZU2wtjaIIO6Omq/qLmMPqqf/+WU0m8217CTLupmvyfcCisR9MH3w KSsWCLhTPEa19bkNkG+layzinQmPAwyDvFDjG7B17Ay6Dhr0G/uZNSW6Y+X54uzYn94Q f00cl85eLrw845JCcNaUj0neI6RSIyygKVDdPVXrkEjCh5hdyysO/D7AMvt6Ba96LfLQ waLxxllLROL9YAeAwfNK81+7BPBlwFz1Tgn69AnJjqZXzDPbOBT7LI7SuXNem4tpqDM9 gTBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b="Pa6RZ/uG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id n14-20020a17090ade8e00b002840019a45fsi12279569pjv.148.2023.11.28.01.48.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 01:48:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b="Pa6RZ/uG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 9FE9E8074428; Tue, 28 Nov 2023 01:48:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232481AbjK1Jsk (ORCPT + 99 others); Tue, 28 Nov 2023 04:48:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231394AbjK1Jsh (ORCPT ); Tue, 28 Nov 2023 04:48:37 -0500 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A290DE; Tue, 28 Nov 2023 01:48:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kernkonzept.com; s=mx1; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description; bh=oHIdPeCtrx4tEmu1lgnT9TOC5wwT1XRZku7i/59y90A=; b=Pa6RZ/uGw1NL1tis/Y6Zzpxpbx sAOdm8i3M32HbbkJ2TVFtpo0OWA9kqdQNw/0yqDyUZuxfWZRXiwcDFh+GxeVKqauMWCDczbu4dJEg LZA5ehmlcMaOKneJEzIIoQaOCFZ9DjlPj/vqYu5XexB49dLdV9kYWPPPGSiILku7+4faut/rUOHxV JCpLL1arLmGUEGtvxmQ97MO8pJlIUWcISl4i9vofMkJaZC27CqQ+7I6cpVKN4TcA7sJzk/UvwJ4II sMtvPKOGdbZ7Q7eFRgeIoeNrRHRjYDE/iVCqA0NG2uDEKcZxI27kutyzjYFcnpmxpnatCDYK0VnPc 9nZkdM+g==; Received: from [10.22.3.24] (helo=serv1.dd1.int.kernkonzept.com) by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) id 1r7uht-008Pi6-0Q; Tue, 28 Nov 2023 10:48:41 +0100 From: Stephan Gerhold Date: Tue, 28 Nov 2023 10:48:35 +0100 Subject: [PATCH 1/3] dt-bindings: i2c: qcom,i2c-qup: Document power-domains MIME-Version: 1.0 Message-Id: <20231128-i2c-qup-dvfs-v1-1-59a0e3039111@kernkonzept.com> References: <20231128-i2c-qup-dvfs-v1-0-59a0e3039111@kernkonzept.com> In-Reply-To: <20231128-i2c-qup-dvfs-v1-0-59a0e3039111@kernkonzept.com> To: Wolfram Sang Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-msm@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Stephan Gerhold X-Mailer: b4 0.12.4 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 28 Nov 2023 01:48:52 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783800725754399864 X-GMAIL-MSGID: 1783800725754399864 Similar to qcom,geni-i2c, for i2c-qup we need to vote for performance states on the VDDCX power domain to ensure that required clock rates can be generated correctly. I2C is typically used with a fixed clock rate, so a single required-opp is sufficient without a full OPP table (unlike spi-qup for example). Signed-off-by: Stephan Gerhold Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/i2c/qcom,i2c-qup.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/qcom,i2c-qup.yaml b/Documentation/devicetree/bindings/i2c/qcom,i2c-qup.yaml index f43947514d48..fc3077a7af0d 100644 --- a/Documentation/devicetree/bindings/i2c/qcom,i2c-qup.yaml +++ b/Documentation/devicetree/bindings/i2c/qcom,i2c-qup.yaml @@ -52,9 +52,15 @@ properties: - const: default - const: sleep + power-domains: + maxItems: 1 + reg: maxItems: 1 + required-opps: + maxItems: 1 + required: - compatible - clock-names @@ -68,6 +74,7 @@ examples: - | #include #include + #include i2c@c175000 { compatible = "qcom,i2c-qup-v2.2.1"; @@ -82,6 +89,8 @@ examples: pinctrl-names = "default", "sleep"; pinctrl-0 = <&blsp1_i2c1_default>; pinctrl-1 = <&blsp1_i2c1_sleep>; + power-domains = <&rpmpd MSM8909_VDDCX>; + required-opps = <&rpmpd_opp_svs_krait>; clock-frequency = <400000>; #address-cells = <1>; From patchwork Tue Nov 28 09:48:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 170664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3796348vqx; Tue, 28 Nov 2023 01:49:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHiTIpDnJRwEJTOGMPY4onZrOC24LsDYPXVxwoGZYT8eAeWDA7JroHzy5i8nGWhj1ZjlG2O X-Received: by 2002:a17:90b:4b4c:b0:285:9833:d1af with SMTP id mi12-20020a17090b4b4c00b002859833d1afmr16019857pjb.26.1701164948855; Tue, 28 Nov 2023 01:49:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701164948; cv=none; d=google.com; s=arc-20160816; b=XB23ItDKSU1sPZhSe4+nd+3fyvOQxpnfzCIh2x9O50LBwwS6wYNAYrpOiyKniAYphQ /5hgNkZkoAmo4aYZ8LYH5A7Q7NTgqCSVRi2s0xzVaLoZ4mtAwZuaBn21YAd8Xaq0sm1H fXk59FK3WnQXJw88AehU0qpLrbGWwYwWfxd5nmpwJ0tXouFoeF6dCr1VdeipfUTBvYgI POR9TmpejHXeO1q3jsJXhsOk9qitzVZEhLKfDqA6i2cNQZgLPcXQ4hmVGshl4zAce4yI dPHUuC0lvJM2rN/bI4O7d/osql2pTiq7rYWNKsg9X9I1B1Ybn1AfJbaIGhPzzZzm657V bADA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=OiK1HHbIXuMrAQ5QDzllvRpmyyLDkj2IJBFpzigf0F8=; fh=H2AR/cQfeAfzQaevnNcmxvsu1hOPerjGrGtpbMvZ2sE=; b=YChnto935a8nCPXddGFsLRL0Kf9aMPNYxWOzkwEAmE+T5mCxcpQVSGfz4OzsMk1zJP J8ao+9KqN4NAcnfZNT2Dq5J16g1aHKtS64Wc1eciszPr2TSqtvXZdwgPMR2qEReB0DN6 VE7MpAmIeMUKPnUZ+jOxBP67KBnG51FjYmzgeyeilwzTe//JUI5KDGKr4gM2MCROftZN 703+VrVaU7gkUrf+New9/YWp8iZoaUywFeVVtPhc3/1fMSlYKtqts/rv4WrBm2aIbsYT KhDB1R40JFHVse/gRMpjEmNBmT93Dwkysu1WrkLG0W2/FUk65PHhYAd6fgJQL9KUlaS7 nmiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=YiMizUZj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id d6-20020a170902cec600b001d0050e2452si279889plg.45.2023.11.28.01.49.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 01:49:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=YiMizUZj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id A02EF81ADCCB; Tue, 28 Nov 2023 01:49:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343806AbjK1Jso (ORCPT + 99 others); Tue, 28 Nov 2023 04:48:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232396AbjK1Jsj (ORCPT ); Tue, 28 Nov 2023 04:48:39 -0500 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B404ADA; Tue, 28 Nov 2023 01:48:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kernkonzept.com; s=mx1; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description; bh=OiK1HHbIXuMrAQ5QDzllvRpmyyLDkj2IJBFpzigf0F8=; b=YiMizUZjDfol4zngmd/CaqLY6e V4MuDVK7b2vYS1CU+49F7YIFkbuklqZpFsmSWURnZdt/xpgwlnKN2iHei1T5B2B3c7O9OoW51ZFPv HpHEEjgw+7pXvL4sunAwcbXjN4VgZCoG4scBaigslD7iHQatNsd2Zv7B2y69Wx7SiO61cqXgn1QcY KXrLF3umCaDNISI9B3aWU2JdiXjRrYqunZBw0MLFefXswK1VyY8kgMCPiTM5x5GEcurHu4+iFjvVa bb2ULa8PJZic4HrQznL0lTn6m395r7rqFl+HKSt63gPZhyrzVZP5MlW9+JCgF4k23MaZTUESq6WPV PTQhsO2A==; Received: from [10.22.3.24] (helo=serv1.dd1.int.kernkonzept.com) by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) id 1r7uhu-008Pi6-1q; Tue, 28 Nov 2023 10:48:42 +0100 From: Stephan Gerhold Date: Tue, 28 Nov 2023 10:48:36 +0100 Subject: [PATCH 2/3] dt-bindings: i2c: qup: Document interconnects MIME-Version: 1.0 Message-Id: <20231128-i2c-qup-dvfs-v1-2-59a0e3039111@kernkonzept.com> References: <20231128-i2c-qup-dvfs-v1-0-59a0e3039111@kernkonzept.com> In-Reply-To: <20231128-i2c-qup-dvfs-v1-0-59a0e3039111@kernkonzept.com> To: Wolfram Sang Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-msm@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Stephan Gerhold X-Mailer: b4 0.12.4 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 28 Nov 2023 01:49:04 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783800737293361366 X-GMAIL-MSGID: 1783800737293361366 When the I2C QUP controller is used together with a DMA engine it needs to vote for the interconnect path to the DRAM. Otherwise it may be unable to access the memory quickly enough. Signed-off-by: Stephan Gerhold Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/i2c/qcom,i2c-qup.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/qcom,i2c-qup.yaml b/Documentation/devicetree/bindings/i2c/qcom,i2c-qup.yaml index fc3077a7af0d..758d8f6321e1 100644 --- a/Documentation/devicetree/bindings/i2c/qcom,i2c-qup.yaml +++ b/Documentation/devicetree/bindings/i2c/qcom,i2c-qup.yaml @@ -40,6 +40,9 @@ properties: - const: tx - const: rx + interconnects: + maxItems: 1 + interrupts: maxItems: 1 @@ -73,6 +76,7 @@ unevaluatedProperties: false examples: - | #include + #include #include #include @@ -91,6 +95,7 @@ examples: pinctrl-1 = <&blsp1_i2c1_sleep>; power-domains = <&rpmpd MSM8909_VDDCX>; required-opps = <&rpmpd_opp_svs_krait>; + interconnects = <&pnoc MASTER_BLSP_1 &bimc SLAVE_EBI_CH0>; clock-frequency = <400000>; #address-cells = <1>; From patchwork Tue Nov 28 09:48:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 170663 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3796323vqx; Tue, 28 Nov 2023 01:49:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2Nx3RqF1r6HyQW5yPqO561GEaJ77sKuCD3VI4j8YOCgj2gGk67mXySlywIra/9oodVAmM X-Received: by 2002:a17:90b:1913:b0:285:1e91:370c with SMTP id mp19-20020a17090b191300b002851e91370cmr13142843pjb.21.1701164946265; Tue, 28 Nov 2023 01:49:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701164946; cv=none; d=google.com; s=arc-20160816; b=lOLBwnzKMsSSNrUCRVfd2EVsmVADr4NFAgyxOX5eWQt/g2qpAea6cqn5j1DQveI1BA EHlMPsUcihDXOERbj8ynozYVtN+Dpe1uTVvZyfQBtYXqrgyZE0wDdv9cuu4xHCwo83wX ZzB+o+2wB5bQT1cettEyL474Xgb5V7q83MCK9VAz9HqsGXFHVskIbQzX0HqcaJ02c/MP v8BPzC6hX3vbOMCz52O8wMrv1bDsFZo/cXquauPtlyeCQ1JFNFRqnE7c64XNpyl8oT6h dsakfqIZ9HDLMlmln44SLF7Mp+ldCY+rfbmbMHYYlbODYWKsF/6RH7goBriFxBbcUM8k Gcag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=DTg3r4s2dq7irVOmMsd/CGuliapoNYe5wHImtDJ9WS0=; fh=H2AR/cQfeAfzQaevnNcmxvsu1hOPerjGrGtpbMvZ2sE=; b=U7hX0nme39RgEOTll0KRPZbPhbLlqLqU1CJuGVqiWi6/MGr+gDwOLUnxnvgweYvwbT 2q8Kqd6Ucy6HW79HKmCqN1FE0jajNi5Eo8gKLcJuWZJgkRUSMBnl9P9u0SrWDE6eh/hE zgqNERpVWDDrOj1CBaO12DDk0Qax7mKtvlYy+9UVEW7+HNEkZF0A0qwj0wzvd98ze+gP nYEluN3IBZ2yzcMCEnvVHmA1MCdnOBYKRrpNxa3JD+6L72VJ/bOnMYTBN5/ju9WX1OBh 0yumB7sf8n7OMFV6InGwz9qjH/z/envv+0FLizWR4ZOPa0cJm9lo0guG2KxPWtqmVfWV AvDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=bRvo0HuL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id w7-20020a17090aea0700b002805aa7b138si12762451pjy.59.2023.11.28.01.49.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 01:49:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=bRvo0HuL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 4A19D82D1A88; Tue, 28 Nov 2023 01:49:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343735AbjK1Jsq (ORCPT + 99 others); Tue, 28 Nov 2023 04:48:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343740AbjK1Jsl (ORCPT ); Tue, 28 Nov 2023 04:48:41 -0500 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 463A9DD; Tue, 28 Nov 2023 01:48:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kernkonzept.com; s=mx1; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description; bh=DTg3r4s2dq7irVOmMsd/CGuliapoNYe5wHImtDJ9WS0=; b=bRvo0HuLxOYk643Rru5OD62uMA wLoJqM+cxZ9oFqxb6Ikj1xcFGAHwFEOSKrv0afkPCyKsOkOnD2smw+XOStqx2pAU0BPLuSOwYwBz9 Bj5wgtYp+DUF853pZKX2e3kEr2CEIgo5B2l4IK8lHYiEIs7f3Voa3friROnt7ysehS3YYZO1p6D1b tzIA7d38j3Yke2uMff0RZDNjuTrU7DOlf2wAU6rfx8fui06ySGaaOZH88sSQqK5rq8ucqEOKQ3s2W 4MgvNDxMOC08yqBgMdW0rLa1PrxiOJwTzgocFUkFtJMvYkMGI+McEshHi2pYs/OeIhgrDYlVgz93z oJMn64Ag==; Received: from [10.22.3.24] (helo=serv1.dd1.int.kernkonzept.com) by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) id 1r7uhw-008Pi6-07; Tue, 28 Nov 2023 10:48:44 +0100 From: Stephan Gerhold Date: Tue, 28 Nov 2023 10:48:37 +0100 Subject: [PATCH 3/3] i2c: qup: Vote for interconnect bandwidth to DRAM MIME-Version: 1.0 Message-Id: <20231128-i2c-qup-dvfs-v1-3-59a0e3039111@kernkonzept.com> References: <20231128-i2c-qup-dvfs-v1-0-59a0e3039111@kernkonzept.com> In-Reply-To: <20231128-i2c-qup-dvfs-v1-0-59a0e3039111@kernkonzept.com> To: Wolfram Sang Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-msm@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Stephan Gerhold X-Mailer: b4 0.12.4 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 28 Nov 2023 01:49:03 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783800734561407858 X-GMAIL-MSGID: 1783800734561407858 When the I2C QUP controller is used together with a DMA engine it needs to vote for the interconnect path to the DRAM. Otherwise it may be unable to access the memory quickly enough. The requested peak bandwidth is dependent on the I2C core clock. To avoid sending votes too often the bandwidth is always requested when a DMA transfer starts, but dropped only on runtime suspend. Runtime suspend should only happen if no transfer is active. After resumption we can defer the next vote until the first DMA transfer actually happens. The implementation is largely identical to the one introduced for spi-qup in commit ecdaa9473019 ("spi: qup: Vote for interconnect bandwidth to DRAM") since both drivers represent the same hardware block. Signed-off-by: Stephan Gerhold --- The bandwidth calculation is taken over from Qualcomm's downstream/vendor driver [1]. Due to lack of documentation about the interconnect setup/behavior I cannot say exactly if this is right. Unfortunately, this is not implemented very consistently downstream... [1]: https://git.codelinaro.org/clo/la/kernel/msm-3.10/-/commit/67174e2624ea64814231e7e1e4af83fd882302c6 --- drivers/i2c/busses/i2c-qup.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index 598102d16677..ee92a315f074 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -150,6 +151,8 @@ /* TAG length for DATA READ in RX FIFO */ #define READ_RX_TAGS_LEN 2 +#define QUP_BUS_WIDTH 8 + static unsigned int scl_freq; module_param_named(scl_freq, scl_freq, uint, 0444); MODULE_PARM_DESC(scl_freq, "SCL frequency override"); @@ -227,6 +230,7 @@ struct qup_i2c_dev { int irq; struct clk *clk; struct clk *pclk; + struct icc_path *icc_path; struct i2c_adapter adap; int clk_ctl; @@ -255,6 +259,10 @@ struct qup_i2c_dev { /* To configure when bus is in run state */ u32 config_run; + /* bandwidth votes */ + u32 src_clk_freq; + u32 cur_bw_clk_freq; + /* dma parameters */ bool is_dma; /* To check if the current transfer is using DMA */ @@ -453,6 +461,23 @@ static int qup_i2c_bus_active(struct qup_i2c_dev *qup, int len) return ret; } +static int qup_i2c_vote_bw(struct qup_i2c_dev *qup, u32 clk_freq) +{ + u32 needed_peak_bw; + int ret; + + if (qup->cur_bw_clk_freq == clk_freq) + return 0; + + needed_peak_bw = Bps_to_icc(clk_freq * QUP_BUS_WIDTH); + ret = icc_set_bw(qup->icc_path, 0, needed_peak_bw); + if (ret) + return ret; + + qup->cur_bw_clk_freq = clk_freq; + return 0; +} + static void qup_i2c_write_tx_fifo_v1(struct qup_i2c_dev *qup) { struct qup_i2c_block *blk = &qup->blk; @@ -840,6 +865,10 @@ static int qup_i2c_bam_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int ret = 0; int idx = 0; + ret = qup_i2c_vote_bw(qup, qup->src_clk_freq); + if (ret) + return ret; + enable_irq(qup->irq); ret = qup_i2c_req_dma(qup); @@ -1645,6 +1674,7 @@ static void qup_i2c_disable_clocks(struct qup_i2c_dev *qup) config = readl(qup->base + QUP_CONFIG); config |= QUP_CLOCK_AUTO_GATE; writel(config, qup->base + QUP_CONFIG); + qup_i2c_vote_bw(qup, 0); clk_disable_unprepare(qup->pclk); } @@ -1745,6 +1775,11 @@ static int qup_i2c_probe(struct platform_device *pdev) goto fail_dma; } qup->is_dma = true; + + qup->icc_path = devm_of_icc_get(&pdev->dev, NULL); + if (IS_ERR(qup->icc_path)) + return dev_err_probe(&pdev->dev, PTR_ERR(qup->icc_path), + "failed to get interconnect path\n"); } nodma: @@ -1793,6 +1828,7 @@ static int qup_i2c_probe(struct platform_device *pdev) qup_i2c_enable_clocks(qup); src_clk_freq = clk_get_rate(qup->clk); } + qup->src_clk_freq = src_clk_freq; /* * Bootloaders might leave a pending interrupt on certain QUP's,