From patchwork Tue Nov 28 09:43:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 170659 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3794135vqx; Tue, 28 Nov 2023 01:43:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFo+GWurNnu2B3npcaIPEE0ex3/Se7WMAUN0vph2fxj3w84jcBRMKRcv/eYpeoB/lYf10hs X-Received: by 2002:a05:6871:5ca:b0:1fa:132b:ab70 with SMTP id v10-20020a05687105ca00b001fa132bab70mr14556015oan.37.1701164636946; Tue, 28 Nov 2023 01:43:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701164636; cv=none; d=google.com; s=arc-20160816; b=wYRnNSp/3bA2i3U9QJrpkuNtN6evUDJaGPd+x+CDuVlvvUvSCfxkW8M1M8NYipNJcQ PPCQof63+qXuS7gBlxWCioAvWG1TcrB3aSncXXF9GG58aotzcbDiEU0V/h2911LB5aTS ifoTABcY5FZ4oi/kqJuEmdMTUGH6zeUCqGG4RKUBtyiG7wPxXPBlilhs15he4lZJMjoT GnPZSkuHYdNTvzHkEioriIhHzaSrjzKmlv+Xv5IYZrL4gDazC4eny/YX0kIu5ZuRpoaW LTe74IMxcNEXHmt8JVncaMXzZQjlDaTeBrSreJa+SX62sfvC9hVcZfSrwq96uBKKwRm+ TikQ== 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=9KbMf3Wwnz9sl7k+vIjP8ILlV978ueS9S52e5elZ8v4=; fh=G50WESriYCxuL8pWq+/emZiN93thjcFMI3iSASoeCxo=; b=RVkWkIMIUgkeKcFx8Yx/xo8yDcXkBPOnzj0sgfp+ANFp4mLESQiWAfilPG9qFWEm8Y VBlsWG3tbwwNl4YmOvbAkF5+eAeXeQFth8Sea67XUbRnY0xLsoGwK1kKlq8v4aKZ8/kt 9KB6l+FHmPX2yYrI7d/n9bf2FhBm0aYqIAJ4TIy12T7nE48oL7PXF/pXCXHkdkfaFhLn sUwxfTWwJJ+kuAnhR98lIp64rsP8/2IexbMmcypYDhtvih3HHgZLR2IdO92EKRYhDh3M 5ZBROINzWGhkND+vBjeuFpMs3X/eQyq0M8jHL2FKlYRu+i/tPB9y2B9XeV7HLD2hgkk3 A8ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=EnGpX4BS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id bn17-20020a056a02031100b005bdff97f97bsi13387940pgb.92.2023.11.28.01.43.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 01:43:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=EnGpX4BS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 389238057B11; Tue, 28 Nov 2023 01:43:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343753AbjK1Jnk (ORCPT + 99 others); Tue, 28 Nov 2023 04:43:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231316AbjK1Jng (ORCPT ); Tue, 28 Nov 2023 04:43:36 -0500 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FC64DA; Tue, 28 Nov 2023 01:43:42 -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=9KbMf3Wwnz9sl7k+vIjP8ILlV978ueS9S52e5elZ8v4=; b=EnGpX4BSGQGYxrkUjnp4HZ7vuJ KXHqjdo7zMpLvgfrse5dFNZ3GwWlBk+9fT8aEUQNJkOJ1RcV5tLWxy4jXjqFmPv+wSdcQWeDMeePw VyZtasf7k/IibR+6p3wlLXstwhQwRAoooJqa273CGJMvIIQ+Me/F1ZNSqBiGy0xe6DgyY4xtobjsy FKZ20e+mLTkbFh5Zb1hZRucA0d45LwXlIOk18+VVsdz4gQ+yzRe2+YSFtER8gRscG0hfHV6fDVgV/ BxYLUd4dWf+C3uFVgHMeCawSziU1FPy5BU3pzOA79OfMVE1ZjJtT2EYXi4SZyZQkmeU4x5JpmAMCc KgsEaWug==; 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 1r7ud0-008PbT-2K; Tue, 28 Nov 2023 10:43:38 +0100 From: Stephan Gerhold Date: Tue, 28 Nov 2023 10:43:32 +0100 Subject: [PATCH 1/2] dt-bindings: serial: qcom,msm-uartdm: Vote for shared resources MIME-Version: 1.0 Message-Id: <20231128-serial-msm-dvfs-v1-1-4f290d20a4be@kernkonzept.com> References: <20231128-serial-msm-dvfs-v1-0-4f290d20a4be@kernkonzept.com> In-Reply-To: <20231128-serial-msm-dvfs-v1-0-4f290d20a4be@kernkonzept.com> To: Greg Kroah-Hartman Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Jiri Slaby , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-msm@vger.kernel.org, linux-serial@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 agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 28 Nov 2023 01:43:52 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783800410481280315 X-GMAIL-MSGID: 1783800410481280315 Document power-domains, operating-points-v2 and interconnects to allow making performance state votes for certain clock frequencies of the UART DM controller. The interconnect path to DRAM is needed when UART DM is used together with a DMA engine. Voting for these shared resources is necessary to guarantee performance with power management enabled. Otherwise these resources might run at minimal performance state which is not sufficient for certain UART baud rates. Signed-off-by: Stephan Gerhold Reviewed-by: Rob Herring --- .../devicetree/bindings/serial/qcom,msm-uartdm.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Documentation/devicetree/bindings/serial/qcom,msm-uartdm.yaml b/Documentation/devicetree/bindings/serial/qcom,msm-uartdm.yaml index ee52bf8e8917..e0fa363ad7e2 100644 --- a/Documentation/devicetree/bindings/serial/qcom,msm-uartdm.yaml +++ b/Documentation/devicetree/bindings/serial/qcom,msm-uartdm.yaml @@ -48,9 +48,17 @@ properties: - const: tx - const: rx + interconnects: + maxItems: 1 + interrupts: maxItems: 1 + operating-points-v2: true + + power-domains: + maxItems: 1 + qcom,rx-crci: $ref: /schemas/types.yaml#/definitions/uint32 description: @@ -99,7 +107,9 @@ unevaluatedProperties: false examples: - | + #include #include + #include serial@f991e000 { compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; @@ -109,4 +119,7 @@ examples: clock-names = "core", "iface"; dmas = <&dma0 0>, <&dma0 1>; dma-names = "tx", "rx"; + power-domains = <&rpmpd MSM8996_VDDCX>; + operating-points-v2 = <&uart_opp_table>; + interconnects = <&pnoc MASTER_BLSP_1 &bimc SLAVE_EBI_CH0>; }; From patchwork Tue Nov 28 09:43:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 170660 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3794228vqx; Tue, 28 Nov 2023 01:44:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxv/WXdy3e+ZAEOrHxwMHwfK41wEAEQ2o5S5NsDsPzH3w0rbZgDPrJnEhktdOO3rzrvnAc X-Received: by 2002:a05:6808:1205:b0:3b6:da98:437b with SMTP id a5-20020a056808120500b003b6da98437bmr16012866oil.45.1701164648366; Tue, 28 Nov 2023 01:44:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701164648; cv=none; d=google.com; s=arc-20160816; b=nNzjM0CcX4JYpwGJNw/S3jwp3deO5QZi8i2Dlc7M1fJJoGPV/RUy6xZdGjMQFiSbQM WH2zj06zLD/pTWV6QZtPRKDmcaSnEr9ytFtMGDag9/534xjGec5n75507bC2lKEdZf3P 5pTsfTcsWHQkusyQq3GP2D8IwS4IXCkLKnN8859zhPs7fejS0Yke1uC5jyj6CIGyjSI4 6hcMLTf7MhJFUUOvUa62Fjwx/UMTVo2idrnUBrglI790YolGXwqnbqaQ7IrodCl+bu0M 3bvLgugBVF/MSNarZKOTd1lL8MICEI47YPP0Whlvxdu+3TQeNVu/kSWcLMDZFsWXfMqn +q9Q== 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=GjQ22P+oFYyA7vy5m4Ea/60ju9n2QPtg1X1479aEht8=; fh=G50WESriYCxuL8pWq+/emZiN93thjcFMI3iSASoeCxo=; b=XpYzQHpx7bKXHdcABWXw7AZEn1PZIO1j0yon5YqVrZymt0CyprGeWDMPcb6S0yaw9n sSGMhbGCs2xEEO2vOWuKPAOZbIQJxgJOYMDMKHpXUI5FIeXoGGW/hbpLnuvNfB14Rx3R tA97YJ1iWHf8d/TibzOyTT94U7J8enVY5J26/zOgo9L3SLivSjkeX5sAPPtUnMhC/64s 8fPCmhGyrw1I8UM5sXOHn7p/2LGQs68T+VYEumShLYwAuP8qx527OTs5wnpSbEGP+ez9 DcSNE+14LCIvqE/KmWdPUMOxescfZKaGowDqkpuHLBm6Tn7lVscVHxMMgEvYSEaRiA5u Epbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=W3O6YEh3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id s32-20020a635260000000b0058556a636dbsi11511177pgl.434.2023.11.28.01.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 01:44:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=W3O6YEh3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id B3D5180C6190; Tue, 28 Nov 2023 01:44:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343806AbjK1Jnm (ORCPT + 99 others); Tue, 28 Nov 2023 04:43:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231495AbjK1Jnh (ORCPT ); Tue, 28 Nov 2023 04:43:37 -0500 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1D7BBE; Tue, 28 Nov 2023 01:43:43 -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=GjQ22P+oFYyA7vy5m4Ea/60ju9n2QPtg1X1479aEht8=; b=W3O6YEh3bTw4DKC7ZJpbBcYyxv 2tZrbqjlwRBSgE2O0V1e3GyIqb2yO/2ZNytCSoyjS6hsyLg64u3cx0MCkbgFtpeA2YdZMh70AJ/xO 3JgVY3HJkLpjy6c2OCM859TWMTzanLEcTi/XiqrGYvcecY6mmcoGns7fY+haIc7sOTYn/5djyGtoo opiandhH6j42aDImRc2Qys4osvdAU7TKADQukEwSOdKCKWN1yeiXeYu9u4Dr4aFCdrN3W1tvlq2Af t6dGhWSGWQUj5uK0F3tsVUDXTHMJPGvvUPZd5zQOul4nDGhShtnB6DuFWAp6abjkIN9yjWjKNyBRH UECpp/Iw==; 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 1r7ud2-008PbT-17; Tue, 28 Nov 2023 10:43:40 +0100 From: Stephan Gerhold Date: Tue, 28 Nov 2023 10:43:33 +0100 Subject: [PATCH 2/2] serial: msm: Use OPP table for DVFS support MIME-Version: 1.0 Message-Id: <20231128-serial-msm-dvfs-v1-2-4f290d20a4be@kernkonzept.com> References: <20231128-serial-msm-dvfs-v1-0-4f290d20a4be@kernkonzept.com> In-Reply-To: <20231128-serial-msm-dvfs-v1-0-4f290d20a4be@kernkonzept.com> To: Greg Kroah-Hartman Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Jiri Slaby , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-msm@vger.kernel.org, linux-serial@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 morse.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 (morse.vger.email [0.0.0.0]); Tue, 28 Nov 2023 01:44:05 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783800421907839994 X-GMAIL-MSGID: 1783800421907839994 Parse the OPP table from the device tree and use dev_pm_opp_set_rate() instead of clk_set_rate() to allow making performance state votes specified in the OPP table (e.g. for power domains and interconnects). Without an OPP table in the device tree this will behave just as before this patch. Signed-off-by: Stephan Gerhold --- drivers/tty/serial/msm_serial.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index 7fc8f0b16aef..e24204ad35de 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -1131,7 +1132,7 @@ static int msm_set_baud_rate(struct uart_port *port, unsigned int baud, uart_port_unlock_irqrestore(port, flags); entry = msm_find_best_baud(port, baud, &rate); - clk_set_rate(msm_port->clk, rate); + dev_pm_opp_set_rate(port->dev, rate); baud = rate / 16 / entry->divisor; uart_port_lock_irqsave(port, &flags); @@ -1186,6 +1187,7 @@ static void msm_init_clock(struct uart_port *port) { struct msm_port *msm_port = to_msm_port(port); + dev_pm_opp_set_rate(port->dev, port->uartclk); clk_prepare_enable(msm_port->clk); clk_prepare_enable(msm_port->pclk); msm_serial_set_mnd_regs(port); @@ -1239,6 +1241,7 @@ static int msm_startup(struct uart_port *port) clk_disable_unprepare(msm_port->pclk); clk_disable_unprepare(msm_port->clk); + dev_pm_opp_set_rate(port->dev, 0); return ret; } @@ -1254,6 +1257,7 @@ static void msm_shutdown(struct uart_port *port) msm_release_dma(msm_port); clk_disable_unprepare(msm_port->clk); + dev_pm_opp_set_rate(port->dev, 0); free_irq(port->irq, port); } @@ -1419,11 +1423,13 @@ static void msm_power(struct uart_port *port, unsigned int state, switch (state) { case 0: + dev_pm_opp_set_rate(port->dev, port->uartclk); clk_prepare_enable(msm_port->clk); clk_prepare_enable(msm_port->pclk); break; case 3: clk_disable_unprepare(msm_port->clk); + dev_pm_opp_set_rate(port->dev, 0); clk_disable_unprepare(msm_port->pclk); break; default: @@ -1789,7 +1795,7 @@ static int msm_serial_probe(struct platform_device *pdev) struct resource *resource; struct uart_port *port; const struct of_device_id *id; - int irq, line; + int irq, line, ret; if (pdev->dev.of_node) line = of_alias_get_id(pdev->dev.of_node, "serial"); @@ -1824,6 +1830,15 @@ static int msm_serial_probe(struct platform_device *pdev) return PTR_ERR(msm_port->pclk); } + ret = devm_pm_opp_set_clkname(&pdev->dev, "core"); + if (ret) + return ret; + + /* OPP table is optional */ + ret = devm_pm_opp_of_add_table(&pdev->dev); + if (ret && ret != -ENODEV) + return dev_err_probe(&pdev->dev, ret, "invalid OPP table\n"); + port->uartclk = clk_get_rate(msm_port->clk); dev_info(&pdev->dev, "uartclk = %d\n", port->uartclk);