From patchwork Fri Nov 11 08:42:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 18557 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp625659wru; Fri, 11 Nov 2022 00:58:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf5PfS+KxscfB34aKvdM5Nc9KbPpYL20dTmQIGbBL3hbDxl+AVO+AET25s5iaXMnTSrFh/nU X-Received: by 2002:a17:906:dfd8:b0:7ad:a8c3:588f with SMTP id jt24-20020a170906dfd800b007ada8c3588fmr1012534ejc.687.1668157128036; Fri, 11 Nov 2022 00:58:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668157128; cv=none; d=google.com; s=arc-20160816; b=AN2gnv5IKLSLjW2KvOm5To5IaiDOwprj1jZLnZR5CcsU1kbzCycqWcJoGvH6Iy1Bq/ T/Oo4s/AxMoK98nfpN4L0zHtXPALS/6OgC1oM6a+GOXn8fWmS8w7WhcaclWjremqHPju LFfP08c+JLOlB+P0e8z3bLMcC8Se6M5vAAAHlGTpGlU4J7SbPjLAzUXgWA5r+4+MOA/u aDwWT7eLQ9lRCxuZ/dvT8NqDTegTsPLiY1DpiiYRQfxjde0EL2DMc3ObgYEK7biAULC8 rNooYZhR6uO4GRujDAiG436iA4wuhlxXlkfwiYMQztOS3E42jSGkc0uVHmygrF5PMxiU RwBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aTwFTxVwW8mGZfkJYCcvXNo09/xgQuaK/cc20ML2k3c=; b=bR+woExkIXvP7i8G0xMmY9GsSPQWQFsP8nAS/qSKCAoAsmQwOGT6FMzriTrZlFd2Uq FEfq9+oqffIKJU3DIMU61/7t51tnjC1yFfz5QSmO6T0XHTxAlagxQo56I6VLAxSjLCBt UhmS2k/mHh1RUmz/R5XUhM0f3LdVNUMllv85wOJrDOsgpVW3Dmmeh/3tC5gCxp3/rX7c CaCIizDrTDqup2B/WdPJ8rwqokituKrDRn5V4D9jdPLgP6AQ0HKwI8K0pKOAbD9+7ZZ8 OEaikNVc4suoy3+nm88JcDj7sGlneVWhTzq8DnXHeegxgbtdOcN3xYUAIuUoMHmN+jAg DY5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LMsnzaTo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg7-20020a1709072cc700b007a6ec6fb027si1774253ejc.538.2022.11.11.00.58.24; Fri, 11 Nov 2022 00:58:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LMsnzaTo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233331AbiKKIpO (ORCPT + 99 others); Fri, 11 Nov 2022 03:45:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233294AbiKKIo5 (ORCPT ); Fri, 11 Nov 2022 03:44:57 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89C58748EC; Fri, 11 Nov 2022 00:44:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 47C9BB82456; Fri, 11 Nov 2022 08:44:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6260C433B5; Fri, 11 Nov 2022 08:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668156293; bh=I4u+iA9wG+mse/x7qapE0EwSlmwdaRWKqs47dh11hNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LMsnzaTo8wn929aBHWk99K0FyRSzj+oelLX7Pfj+NXjWhRvgrsskrqaXuZZTHAfAd Zr25+FET+uCUswqjZLmkQ1WTcppq4Obgu+7RYbezg+obKgo3rVwWCX1YCcQWcv1vt+ umhAUZM9WBPy+5CCgJL8huMIMPEYis4JilKab0cK7+sKXpqh9NgPi/21R/xFLS83Lm B886jhZG+aZQdkr30DTcNzH4m/78ShiitzIwTCTU5FpP9ZdVYJFNuT3xvayLcnz/wA 47s4xxmSoeFB78oz3oI/DYhcKCkkdfyuhJ2wqgykwC9qTkaW5BJei1Q8qV7e+GZyYz EcjRRC/WVKm6w== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1otPeD-0002Mg-JA; Fri, 11 Nov 2022 09:44:25 +0100 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 1/6] phy: qcom-qmp-combo: fix out-of-bounds clock access Date: Fri, 11 Nov 2022 09:42:50 +0100 Message-Id: <20221111084255.8963-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221111084255.8963-1-johan+linaro@kernel.org> References: <20221111084255.8963-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749189528780320395?= X-GMAIL-MSGID: =?utf-8?q?1749189528780320395?= The SM8250 only uses three clocks but the DP configuration erroneously described four clocks. In case the DP part of the PHY is initialised before the USB part, this would lead to uninitialised memory beyond the bulk-clocks array to be treated as a clock pointer as the clocks are requested based on the USB configuration. Fixes: aff188feb5e1 ("phy: qcom-qmp: add support for sm8250-usb3-dp phy") Cc: stable@vger.kernel.org # 5.13 Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index 5e11b6a1d189..bb38b18258ca 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -1270,8 +1270,8 @@ static const struct qmp_phy_cfg sm8250_dpphy_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v3_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v3_pre_emphasis_hbr3_hbr2, - .clk_list = qmp_v4_phy_clk_l, - .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l), + .clk_list = qmp_v4_sm8250_usbphy_clk_l, + .num_clks = ARRAY_SIZE(qmp_v4_sm8250_usbphy_clk_l), .reset_list = msm8996_usb3phy_reset_l, .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), .vreg_list = qmp_phy_vreg_l, From patchwork Fri Nov 11 08:42:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 18551 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp621924wru; Fri, 11 Nov 2022 00:46:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Hr/lGJ0fxvhUXRX9TIomMaTwuUXuMbYbAD3bWO4rZWjS0mCJAWcfNlh9Rzma0ySYmCORh X-Received: by 2002:a17:90a:2c01:b0:1fe:b9b:7d31 with SMTP id m1-20020a17090a2c0100b001fe0b9b7d31mr869055pjd.152.1668156372666; Fri, 11 Nov 2022 00:46:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668156372; cv=none; d=google.com; s=arc-20160816; b=fA+wcxjBrKmP8GEB3h5oUQ+iAcnXCjqzyzKiqRTOJzaBL3gyuUbp44Kuf450bQ7Q4M YujIDfmfUw1KD3RdrFSNvvZxHCxFgIbA0a+7E+vADqTjChtf0L6XTR1C2EXH+AesLaVt NdgcGItn1l3Rgn6aI0hKA756o0E+tzvXMLs/AAMtILJfC9NQqZ8HjvU9B8WzfR6BVXu+ MQ0mGmZHNl78Hexjv4j5qBbHI4iAtWe9T1iPxTntlR5GzMCR00Q0SmTDboOLnNjBfbj+ LSYEIWYFY59pM/Qb+Flu02Tj2hZz/KogBt8qnBbPkVOWQSfV39ofFdzjUAGTmEntBrUG 2jKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6CHBgy6rbeJs9Ag5gEzQLckCJlu2Ybv16hhK64/HyKI=; b=omR4KWwJkRfK0AiwZQKON9cJ5I3Nmr5EdIH1YjrPZ/x2NFXJybpLNk2zOudUDtRSdR ldZeVdaBKa2i5woQbnqwPGSEgjITa/pC+xsUDzCbwGEETK/UYkviM1KDgIcWbKhhplit tACG9i4VJhvh9MueiVv5Dk36e/n/XR+pBjQeUHgCFxdwkR6z9A/73ckIlwXV9PeLwIOn lUoh0tyviH+6ZbmBzKy11uAAvTSRHZfp2QVP87S5R6NnjjilFFW8aWkyBslyxue6w5p6 EFL9xWYJyALRuanFQQEJn0gQdB6+gxqJhZLC2Ml4U1GNPtYxPI2vphkIDt7Sg+Ed4qQo qtuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Arcu4vGl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb17-20020a17090b281100b00212d63cd243si6735995pjb.109.2022.11.11.00.45.59; Fri, 11 Nov 2022 00:46:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Arcu4vGl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233306AbiKKIo7 (ORCPT + 99 others); Fri, 11 Nov 2022 03:44:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233270AbiKKIoz (ORCPT ); Fri, 11 Nov 2022 03:44:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0DC17C8E9; Fri, 11 Nov 2022 00:44:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8E37061ED4; Fri, 11 Nov 2022 08:44:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3430C433C1; Fri, 11 Nov 2022 08:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668156293; bh=BsM6e57E76PP1RYFVtT8hgjhqoIm78zr8LXoGcM453w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Arcu4vGl2iArUUjbEgyd0rM4627m/lwmFwbJYhsJVkhGMUgddru7vVbPFWdFc74tH 0mXNwNeaRvtJV/0x33fgIJAliMlZIYdaG2Pv6Bp0eIshD23LRRz7ImHnNrU1b8cHFo csJNjHciLKkWbMATl+pwLOH8JwxQXC2GVeUtMgvhQ9IslLIGB+mR9qCChFJRfPXzR2 xjw+YWnicinABDv6ET0G/9IwyR39k05OPgNRi5rX+YzTAz/63+aRpgV0r/gM8oI0m+ riZUPdi/71Ee8AsPF7bNqs6m1yYpGLWGuhX1sIBFzsmwoeb4UVUvlf+0Wf2OX0A9t7 F6iYC2dZMqGUg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1otPeD-0002Mi-M3; Fri, 11 Nov 2022 09:44:25 +0100 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 2/6] phy: qcom-qmp-combo: fix sdm845 reset Date: Fri, 11 Nov 2022 09:42:51 +0100 Message-Id: <20221111084255.8963-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221111084255.8963-1-johan+linaro@kernel.org> References: <20221111084255.8963-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749188736831622295?= X-GMAIL-MSGID: =?utf-8?q?1749188736831622295?= The SDM845 has two resets but the DP configuration erroneously described only one. In case the DP part of the PHY is initialised before the USB part (e.g. depending on probe order), then only the first reset would be asserted. Add a dedicated configuration for SDM845 rather than reuse the incompatible SC7180 configuration. Fixes: d88497fb6bbd ("phy: qualcomm: phy-qcom-qmp: add support for combo USB3+DP phy on SDM845") Cc: stable@vger.kernel.org # 6.1 Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 39 ++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index bb38b18258ca..cc53e2f99121 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -1084,9 +1084,46 @@ static const struct qmp_phy_cfg sdm845_usb3phy_cfg = { .has_pwrdn_delay = true, }; +static const struct qmp_phy_cfg sdm845_dpphy_cfg = { + .type = PHY_TYPE_DP, + .lanes = 2, + + .serdes_tbl = qmp_v3_dp_serdes_tbl, + .serdes_tbl_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl), + .tx_tbl = qmp_v3_dp_tx_tbl, + .tx_tbl_num = ARRAY_SIZE(qmp_v3_dp_tx_tbl), + + .serdes_tbl_rbr = qmp_v3_dp_serdes_tbl_rbr, + .serdes_tbl_rbr_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl_rbr), + .serdes_tbl_hbr = qmp_v3_dp_serdes_tbl_hbr, + .serdes_tbl_hbr_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl_hbr), + .serdes_tbl_hbr2 = qmp_v3_dp_serdes_tbl_hbr2, + .serdes_tbl_hbr2_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl_hbr2), + .serdes_tbl_hbr3 = qmp_v3_dp_serdes_tbl_hbr3, + .serdes_tbl_hbr3_num = ARRAY_SIZE(qmp_v3_dp_serdes_tbl_hbr3), + + .swing_hbr_rbr = &qmp_dp_v3_voltage_swing_hbr_rbr, + .pre_emphasis_hbr_rbr = &qmp_dp_v3_pre_emphasis_hbr_rbr, + .swing_hbr3_hbr2 = &qmp_dp_v3_voltage_swing_hbr3_hbr2, + .pre_emphasis_hbr3_hbr2 = &qmp_dp_v3_pre_emphasis_hbr3_hbr2, + + .clk_list = qmp_v3_phy_clk_l, + .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l), + .reset_list = msm8996_usb3phy_reset_l, + .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), + .vreg_list = qmp_phy_vreg_l, + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), + .regs = qmp_v3_usb3phy_regs_layout, + + .dp_aux_init = qcom_qmp_v3_phy_dp_aux_init, + .configure_dp_tx = qcom_qmp_v3_phy_configure_dp_tx, + .configure_dp_phy = qcom_qmp_v3_phy_configure_dp_phy, + .calibrate_dp_phy = qcom_qmp_v3_dp_phy_calibrate, +}; + static const struct qmp_phy_combo_cfg sdm845_usb3dpphy_cfg = { .usb_cfg = &sdm845_usb3phy_cfg, - .dp_cfg = &sc7180_dpphy_cfg, + .dp_cfg = &sdm845_dpphy_cfg, }; static const struct qmp_phy_cfg sm8150_usb3phy_cfg = { From patchwork Fri Nov 11 08:42:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 18552 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622064wru; Fri, 11 Nov 2022 00:46:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf5zWKfLbgK3uVSE7fEYx0BO+rY/Y5WW/la1upj084OY6chE+lLtLZn9r8oRjUBdiiTjMpjh X-Received: by 2002:a63:4d16:0:b0:46f:9c0c:8673 with SMTP id a22-20020a634d16000000b0046f9c0c8673mr852649pgb.154.1668156397527; Fri, 11 Nov 2022 00:46:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668156397; cv=none; d=google.com; s=arc-20160816; b=n/abxeh9VTYBrIveo9A0C1bFlMiKClzLaLsGThQWSW7lKECTan9QtZvZK2MayEnMIE OX+rQlAjnKO1yuEfdtYEMldQ8APCuiv5qjLFimozx7teXZFIAD+Daq8V97igl9z0TgGH bKgQKDfkuB3b/qdJJkfHd7cVDeJ8CoILV2VpubQ0VHh3rLyCOYx5ycIJT2q22CL/JHP2 37svPsR9WbOaWWNUYGdAhacF+Xz4TRISHxPuK9B1PvVUVmo5AQWXuR9PLbJlcryXIihz +lmMi8rXueV7JweyNiERtlBVKf6eGhfI/BcNAlwMuNdVQDqCuzkadcy36V8YxnEvXyZ4 vkbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uglgdjCAGTRjflFWYVNBQJLOFLgyhATZ5NgWnBydyBw=; b=j3X4WOgVrfy/AzNTMTD+95YdUpcBSJGeFfUF8ndo5ZolATRmdpESFlFdnUDajYQMyu lpwyee0fQJz21c1eszZA8K/JZKrm7N1GQsMKtDtunQ0yXeilP8bu1I5oQfKWHKNf9sCx ZC90qaKE7Af5PxGv4KAolsVQvtMLKAvb5qME8ln5VOsZXpz+yIqsw/2d4+V+Ticp2vg7 TFjOZfi+CaQfb1nkDRlj4txuydfTFN/8BJOdxqzGL0zQ9tzeL8uxgPQnjGQqZXjD44+m iqmfdkk4W5xqU0czKnL6LWkj5qCgpEgruBDld5kzHZcgEI0SE2rgN09Djw/6OjknGCX1 cfkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="idK/EQQB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q21-20020a170902789500b00178276c2e35si1802806pll.38.2022.11.11.00.46.24; Fri, 11 Nov 2022 00:46:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="idK/EQQB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233320AbiKKIpD (ORCPT + 99 others); Fri, 11 Nov 2022 03:45:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233272AbiKKIoz (ORCPT ); Fri, 11 Nov 2022 03:44:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09197748EC; Fri, 11 Nov 2022 00:44:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 96E5561EF6; Fri, 11 Nov 2022 08:44:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9163C43470; Fri, 11 Nov 2022 08:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668156293; bh=w13zs6FKj0SdIEJZ1oD2GuvAHcCJq00Kw69kuCxONBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=idK/EQQBCwNV4wB58B/l10bmWyvHS9yGNUlpzFrwtEpBJGEPdvCL/84dB7jSl1kDM OihJsY+hpaUwzKI4nRXJ5owiDvoC5FTeQb3RfJ6TIn3tXZpZ1uGoUeYC4nCgBVEghN o3GTpM3ClR7li8cwqUhQdA8V9F+4QCOy7ibFaSMPfHloso3z+JnPL/O56SnSxWNBwv +kpuhQEMK/rBdMqyd8kPXG4kTgaoR/cZHkGP1+GPBhz3HUIQHPW03auv6bsP8YopVK q+Kr9NSeof7uABfUum+jmrd5q96rQFhJH4KxUg3xVV9xm1GV/RCBe7/3BsLrD4tkjK C10775VzrrHWg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1otPeD-0002Mk-Ox; Fri, 11 Nov 2022 09:44:25 +0100 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 3/6] phy: qcom-qmp-combo: fix sc8180x reset Date: Fri, 11 Nov 2022 09:42:52 +0100 Message-Id: <20221111084255.8963-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221111084255.8963-1-johan+linaro@kernel.org> References: <20221111084255.8963-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749188762593229896?= X-GMAIL-MSGID: =?utf-8?q?1749188762593229896?= The SC8180X has two resets but the DP configuration erroneously described only one. In case the DP part of the PHY is initialised before the USB part (e.g. depending on probe order), then only the first reset would be asserted. Fixes: 1633802cd4ac ("phy: qcom: qmp: Add SC8180x USB/DP combo") Cc: stable@vger.kernel.org # 5.15 Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index cc53e2f99121..40c25a0ead23 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -1177,8 +1177,8 @@ static const struct qmp_phy_cfg sc8180x_dpphy_cfg = { .clk_list = qmp_v3_phy_clk_l, .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l), - .reset_list = sc7180_usb3phy_reset_l, - .num_resets = ARRAY_SIZE(sc7180_usb3phy_reset_l), + .reset_list = msm8996_usb3phy_reset_l, + .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), .vreg_list = qmp_phy_vreg_l, .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), .regs = qmp_v3_usb3phy_regs_layout, From patchwork Fri Nov 11 08:42:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 18556 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp625549wru; Fri, 11 Nov 2022 00:58:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Re9QdgotTM3CoE0zsQypxRIYf9BqMKCDwPHJfxPXvbNNud6TUEXznOhum/oa/zIJF/jyz X-Received: by 2002:a17:906:af5a:b0:7ae:4a7d:813b with SMTP id ly26-20020a170906af5a00b007ae4a7d813bmr1002495ejb.573.1668157104524; Fri, 11 Nov 2022 00:58:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668157104; cv=none; d=google.com; s=arc-20160816; b=EjtFXoI3v1SXUpv0+tlvxnZjvV6Vs/OwVfeeuIVuNL6ea1NKDCLZ9RY/QiU2oMhl95 iLMV6dzjt16PJSef5LODODjy6dQVi6lINw+UmjT61KXYA89Yn4b3DTWJBvFVdALeuLEq HgsY9Bh99u6m2FqivntcdIzciF3FW5WXbt7xG3v6hqJPX6KjYzdjuHzdh/etQSJ/vNVp L9jfdo40zkxsLNydWpfRnrogUelCClnjmM6fYz+XVFFss40awwEJGc4++lHlfP41il3a IYnHkEbo/tCzYPRrW7Bk4u1zV+ysPJjTCYhOD5W0MDz+7h14zoBG3gK+hN3PU3drROvB BiEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Rk5Q52+ehFOl+6oHgxh4ZtMqs92H5K43/WOu4Kt4S68=; b=aavyz10qLsl9Xu8R/sSyAE+JqqEyNfC0ykNb+7aRKxj7g8giS0IWaP8hsYnJ0Mq9Ix MIIBGAFU5W5SnaGP50/5wNTzBCnIQ7kcove2qWzB8ROKxu8eJ4+aLMmL3jiBAmwgLtzb 7q4HPIZSXf55wfS/X7oliw9+oW3vFmXZ9lGbS/1gojSh8+tSZpUCdFyMFS/+SU7nu6/o lE+J2msTyDaADw47r/bGxNSawe2M5wR1HMlJx1FS0f4rWvp6vktMH7zYTqdI0Ioc0NgT HeofPPb+RIA/GaNesXehzKdVTIByPIRN+Raht/KXr9yEryDuTZL9f+w6YP5BZUwNVlCT 8K4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UTz2aeWw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q7-20020a056402248700b00456964d3369si1925135eda.230.2022.11.11.00.58.01; Fri, 11 Nov 2022 00:58:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UTz2aeWw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233342AbiKKIpQ (ORCPT + 99 others); Fri, 11 Nov 2022 03:45:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233295AbiKKIo5 (ORCPT ); Fri, 11 Nov 2022 03:44:57 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 933D17C8E7; Fri, 11 Nov 2022 00:44:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4ED05B8245A; Fri, 11 Nov 2022 08:44:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF7ACC43142; Fri, 11 Nov 2022 08:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668156293; bh=lNIoKDoFO4aYN+HOb6Or1Q9qGXfioSo1MkkvV/9tMeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UTz2aeWwlbSVEsHLWLBdKOrgty07atSygAyISrUHTGrZg9E22blnBH86WfMYkQEtC a5VVc6NWCMDkRV/xTlojDysgXgD/Gi2nt6hK+rFtCDrAYBdE2I8oT7sAmuJhZi1i45 OZZnhM+3zHUxDGoUNdHbqAkyWBf9Jhmb4p6GEe7tHSr+2VNeTQs7L7vxxfIOArcgzS Stxyi/SYnTCmD0ogaHu7YTp0pW4xVI3X66TQGgILlYO2Y5weCaLztLVZwMSxntATtu u4jb/3YJsKl6DJgzleaCsZm3sbvprMHDuHR4Tj/7fge1tzAL5CTnxDDadivQzpArIV Cc9FoZxw4XGGA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1otPeD-0002Mm-Rp; Fri, 11 Nov 2022 09:44:25 +0100 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 4/6] phy: qcom-qmp-combo: fix broken power on Date: Fri, 11 Nov 2022 09:42:53 +0100 Message-Id: <20221111084255.8963-5-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221111084255.8963-1-johan+linaro@kernel.org> References: <20221111084255.8963-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749189504050701712?= X-GMAIL-MSGID: =?utf-8?q?1749189504050701712?= The PHY is powered on during phy-init by setting the SW_PRWDN bit in the COM_POWER_DOWN_CTRL register and then setting the same bit in the in the PCS_POWER_DOWN_CONTROL register that belongs to the USB part of the PHY. Currently, whether power on succeeds depends on probe order and having the USB part of the PHY be initialised first. In case the DP part of the PHY is instead initialised first, the intended power on of the USB block results in a corrupted DP_PHY register (e.g. DP_PHY_AUX_CFG8). Add a pointer to the USB part of the PHY to the driver data and use that to power on the PHY also if the DP part of the PHY is initialised first. Fixes: 52e013d0bffa ("phy: qcom-qmp: Add support for DP in USB3+DP combo phy") Cc: stable@vger.kernel.org # 5.10 Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index 40c25a0ead23..17707f68d482 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -932,6 +932,7 @@ struct qcom_qmp { struct regulator_bulk_data *vregs; struct qmp_phy **phys; + struct qmp_phy *usb_phy; struct mutex phy_mutex; int init_count; @@ -1911,7 +1912,7 @@ static int qmp_combo_com_init(struct qmp_phy *qphy) { struct qcom_qmp *qmp = qphy->qmp; const struct qmp_phy_cfg *cfg = qphy->cfg; - void __iomem *pcs = qphy->pcs; + struct qmp_phy *usb_phy = qmp->usb_phy; void __iomem *dp_com = qmp->dp_com; int ret; @@ -1963,7 +1964,8 @@ static int qmp_combo_com_init(struct qmp_phy *qphy) qphy_clrbits(dp_com, QPHY_V3_DP_COM_SWI_CTRL, 0x03); qphy_clrbits(dp_com, QPHY_V3_DP_COM_SW_RESET, SW_RESET); - qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], SW_PWRDN); + qphy_setbits(usb_phy->pcs, usb_phy->cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], + SW_PWRDN); mutex_unlock(&qmp->phy_mutex); @@ -2831,6 +2833,8 @@ static int qmp_combo_probe(struct platform_device *pdev) goto err_node_put; } + qmp->usb_phy = qmp->phys[id]; + /* * Register the pipe clock provided by phy. * See function description to see details of this pipe clock. @@ -2846,6 +2850,9 @@ static int qmp_combo_probe(struct platform_device *pdev) id++; } + if (!qmp->usb_phy) + return -EINVAL; + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); return PTR_ERR_OR_ZERO(phy_provider); From patchwork Fri Nov 11 08:42:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 18550 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp621893wru; Fri, 11 Nov 2022 00:46:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf4SMV8CWwNJvwR0gtWAE4I9XJER8hSfbjfIfybB9hDFCS/n0RFy3lAmgeRPK9chiClYnZoL X-Received: by 2002:a17:90a:4593:b0:213:f8a9:fd49 with SMTP id v19-20020a17090a459300b00213f8a9fd49mr876091pjg.73.1668156368393; Fri, 11 Nov 2022 00:46:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668156368; cv=none; d=google.com; s=arc-20160816; b=IJJ8dd56byKbK1p3QBX52XWfK2xD/lDKWTdencQkSIBzZeduYrZbrqousj1rwbpr7/ 6Ry1wd1sew8kYB7XiMiFH3c90LvekkC+q8BW7Bfi/BsoA/nyfb/tqv8AEsC5ID5fxUyE W+FSskP1LgeavvibGnyT/OVZQqjNtxAWgGVZIITkJBMeL3zDebRrbkkLmnI/4BsTVvDV HO24qlSQFLWM4Vrs9jqlpz0DQ1CZ0C7tdaE+5Hp+9e66Nq7+jJS1Its2XqGWXYiK9FHl ubmjre7XIgpwMyotKaoTbVmAvUgCqTalPVu5acUKKs4GoP2V2DgC0UwBJmcbBAEZ+MPh m5NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rRwe4w16dyun7VdHZyxZMkjARwmJPve761txZFryPog=; b=T9R1GipAArU/1Bn96N3uTnRY9popmgHUjU6uOyEpPEIxGLiy2TKm2hGe2tlibDNwjh 5hYCQYGgG1uFD5nRDscF14CJIZ+E8rK8wg65bQJOkFMmbcc0z55O7CPuZdP76RTAmG8C RXzboJ2aQvr5aEDEPZ62LchBQa/batTyCh0wgXCn6NkYS4BFIA1dmZphTqbijaSQ/enK NQMoiJIO4jf9n6gk1lUF18Bvd6c+qLSdSkeux+cwre5wp7KUzMqIbsqpY3ZjbmX9xbgc U5oVXBlgiNHRliSwu8LAFSINHypkTBzvesgFUEGKgcGfxdCdse95rJI1zONYsAnHrbDb R0Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Sc16wmgR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z15-20020a056a00240f00b00562fc008395si1888075pfh.341.2022.11.11.00.45.54; Fri, 11 Nov 2022 00:46:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Sc16wmgR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233296AbiKKIo5 (ORCPT + 99 others); Fri, 11 Nov 2022 03:44:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233271AbiKKIoz (ORCPT ); Fri, 11 Nov 2022 03:44:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E87187C8DA; Fri, 11 Nov 2022 00:44:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 87B6F61EF4; Fri, 11 Nov 2022 08:44:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE389C433D6; Fri, 11 Nov 2022 08:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668156293; bh=n6gU/Kh4pLDrdvJwnrFedkFVS9iAnD1+wNhxscwN2M4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sc16wmgRz0fnc1vnv7vYp7ZAnYJnLymMZlmKpeukxR6m2NQUV9AzgSPA8ZwjLANLA miKXJ1rLB7NWLRM5G93LjMiWOQHIYCioqLs9+TutSTH/DJhCE6uUcwhUWAhkf9d/wY P3qceWqhcIT4+c9aZ30dRjDt314nQXW6zmKsZFHeUtlD2V8JbjYi5WlcX91l+AzXV/ iEl25p4WMthcHEJWzrB11LaGAn6c+JbDxVL64mlyIqQmj6A/vyV5AvmnXbG/4z3ETQ FE5+6RoTPSx0IOTHVzp8bRVeEFKJiLONEL0qqhJosqWyWrme9thwoE1fUaK4I+WEff 2Ovw58G6jlabg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1otPeD-0002Mo-U1; Fri, 11 Nov 2022 09:44:25 +0100 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 5/6] phy: qcom-qmp-combo: fix runtime suspend Date: Fri, 11 Nov 2022 09:42:54 +0100 Message-Id: <20221111084255.8963-6-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221111084255.8963-1-johan+linaro@kernel.org> References: <20221111084255.8963-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749188731794320363?= X-GMAIL-MSGID: =?utf-8?q?1749188731794320363?= Drop the confused runtime-suspend type check which effectively broke runtime PM if the DP child node happens to be parsed before the USB child node during probe (e.g. due to order of child nodes in the devicetree). Instead use the new driver data USB PHY pointer to access the USB configuration and resources. Fixes: ac0d239936bd ("phy: qcom-qmp: Add support for runtime PM") Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index 17707f68d482..fde30205f332 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -2207,15 +2207,11 @@ static void qmp_combo_disable_autonomous_mode(struct qmp_phy *qphy) static int __maybe_unused qmp_combo_runtime_suspend(struct device *dev) { struct qcom_qmp *qmp = dev_get_drvdata(dev); - struct qmp_phy *qphy = qmp->phys[0]; + struct qmp_phy *qphy = qmp->usb_phy; const struct qmp_phy_cfg *cfg = qphy->cfg; dev_vdbg(dev, "Suspending QMP phy, mode:%d\n", qphy->mode); - /* Supported only for USB3 PHY and luckily USB3 is the first phy */ - if (cfg->type != PHY_TYPE_USB3) - return 0; - if (!qmp->init_count) { dev_vdbg(dev, "PHY not initialized, bailing out\n"); return 0; @@ -2232,16 +2228,12 @@ static int __maybe_unused qmp_combo_runtime_suspend(struct device *dev) static int __maybe_unused qmp_combo_runtime_resume(struct device *dev) { struct qcom_qmp *qmp = dev_get_drvdata(dev); - struct qmp_phy *qphy = qmp->phys[0]; + struct qmp_phy *qphy = qmp->usb_phy; const struct qmp_phy_cfg *cfg = qphy->cfg; int ret = 0; dev_vdbg(dev, "Resuming QMP phy, mode:%d\n", qphy->mode); - /* Supported only for USB3 PHY and luckily USB3 is the first phy */ - if (cfg->type != PHY_TYPE_USB3) - return 0; - if (!qmp->init_count) { dev_vdbg(dev, "PHY not initialized, bailing out\n"); return 0; From patchwork Fri Nov 11 08:42:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 18562 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp626008wru; Fri, 11 Nov 2022 00:59:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf782izaLJH86baD9xSA26HzViuzkMYXSR9wG6y+eYvKPRMXzS6CK2J1VU0PZaBcLXyuTrdW X-Received: by 2002:a17:906:1416:b0:78d:e869:f328 with SMTP id p22-20020a170906141600b0078de869f328mr996326ejc.696.1668157191382; Fri, 11 Nov 2022 00:59:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668157191; cv=none; d=google.com; s=arc-20160816; b=GoBIbRU3v3ZXt8gVA8CwAsmBs1GW9mPVu8w7XnYDh/dHBVjEZLpQg1WG+PRjCUbsYu L/6p2TrWBM+GaZWLEdmhacM2MhUYV9zx5RU9qKph1QLhp7W4yWmEgoLWvkT+gxh0jyIs 7PRi6JgaLNS93Pti2TXPDb0fBwszNP9oAcj69vX/OKvIJsyrsy+aKTH8L3oOAN1om8m2 oaw7KwdoZl9MEX9b1SHq3zr71N9oZshtpDIoivkqTWNh7DEPDPG2vbHYSvpR35YDlfgJ cq3yYUmYzOyDa/8FbUlv8ShyK/Bv/INzi6b5gF94U7T5ko46zPOpK+yJjASlZIgQE66x +Eig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=E47HdHGrKsL7tQ+n/X9XO5x1qYKjKGRYS7y5Bn8NEN0=; b=MhjLUUhdEWnYxCsTb8WI7b4efvy2JdqGaKDxEi8uAOOOu71yRrlabZS5PTW4dP+ZUF 2LcUaQfGtN4sePkt9gSDvkU3x/1sPZUxyPVmJLn2//wqGVZyicl6RCECBpz5bXgMUOOs fY1d1bzXAKXEOZuKrCiSmK01e1tisu34m0uSJpq6EjjM/JYOgcvwtz/55J4clU7i5tsw ORgJg1PxYH4GD2SZDJAXnY3gdD677/gsbd02ci2GNKdMjyD5SydjmcTwWNoSFi0rLf/E OPbf3OIhzlZmjusa+mFGOqnQrok2qbg4nShYjnO/D+D4wip+ij3wSc2Khb9y44RV8ruK 365w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lRyqQOTc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a9-20020a50e709000000b0045c7c7b95easi1748942edn.73.2022.11.11.00.59.28; Fri, 11 Nov 2022 00:59:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lRyqQOTc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233272AbiKKIpK (ORCPT + 99 others); Fri, 11 Nov 2022 03:45:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233276AbiKKIo4 (ORCPT ); Fri, 11 Nov 2022 03:44:56 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F7C67C8EC; Fri, 11 Nov 2022 00:44:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 25A3561EF8; Fri, 11 Nov 2022 08:44:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FC23C4315C; Fri, 11 Nov 2022 08:44:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668156294; bh=GOkeZXFvRBATroumnNo6PXdgXEhOj5gelgwu1q1W47o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lRyqQOTcF+8h8LwiUSVFsFjk6qdhxCBaWBdcXxBCnWRRzz3ph156sR22WeYcTMctR VrChpFQxxNnhvJeF/LgudRQSeuszZlF2Fq6w5St2nSBllP9mde3ne2c+7Q0uRIaB3D idBbDRotJeh4tZJYbEwLytkQYZVZW6AM5laDdW4yOwQh3mFXrtzSJPi8kZPsTWhsYk yw2d5Nzq0wiqHiLW6WhH2SoSxuTkWEuCq+2BSq/3e2PMpq+dBDihpOeJe3EAdLheY/ L6sOllLuwSh6FxUc+/WVo4SoeArxDCeVviXdYXDoa9iSTbCBwCN5JEOH9mTDFuCpcC qABcZsDH99q7A== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1otPeE-0002Mx-0F; Fri, 11 Nov 2022 09:44:26 +0100 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 6/6] phy: qcom-qmp-combo: clean up common initialisation Date: Fri, 11 Nov 2022 09:42:55 +0100 Message-Id: <20221111084255.8963-7-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221111084255.8963-1-johan+linaro@kernel.org> References: <20221111084255.8963-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749189595223437325?= X-GMAIL-MSGID: =?utf-8?q?1749189595223437325?= Commit 52e013d0bffa ("phy: qcom-qmp: Add support for DP in USB3+DP combo phy") added support for the DisplayPort part of QMP PHYs but unfortunately did so by duplicating parts of the shared configuration, something which has lead to subtle bugs depending on probe order. As the resources have always been requested based on the USB configuration, make sure to not rely on fields from the DP configuration when using them (e.g. in case they get out of sync) and remove the now unused fields from the DP configurations. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 47 ++--------------------- 1 file changed, 4 insertions(+), 43 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index fde30205f332..c7a926d548d8 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -1043,14 +1043,6 @@ static const struct qmp_phy_cfg sc7180_dpphy_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v3_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v3_pre_emphasis_hbr3_hbr2, - .clk_list = qmp_v3_phy_clk_l, - .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l), - .reset_list = sc7180_usb3phy_reset_l, - .num_resets = ARRAY_SIZE(sc7180_usb3phy_reset_l), - .vreg_list = qmp_phy_vreg_l, - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), - .regs = qmp_v3_usb3phy_regs_layout, - .dp_aux_init = qcom_qmp_v3_phy_dp_aux_init, .configure_dp_tx = qcom_qmp_v3_phy_configure_dp_tx, .configure_dp_phy = qcom_qmp_v3_phy_configure_dp_phy, @@ -1108,14 +1100,6 @@ static const struct qmp_phy_cfg sdm845_dpphy_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v3_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v3_pre_emphasis_hbr3_hbr2, - .clk_list = qmp_v3_phy_clk_l, - .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l), - .reset_list = msm8996_usb3phy_reset_l, - .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), - .vreg_list = qmp_phy_vreg_l, - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), - .regs = qmp_v3_usb3phy_regs_layout, - .dp_aux_init = qcom_qmp_v3_phy_dp_aux_init, .configure_dp_tx = qcom_qmp_v3_phy_configure_dp_tx, .configure_dp_phy = qcom_qmp_v3_phy_configure_dp_phy, @@ -1176,14 +1160,6 @@ static const struct qmp_phy_cfg sc8180x_dpphy_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v3_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v3_pre_emphasis_hbr3_hbr2, - .clk_list = qmp_v3_phy_clk_l, - .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l), - .reset_list = msm8996_usb3phy_reset_l, - .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), - .vreg_list = qmp_phy_vreg_l, - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), - .regs = qmp_v3_usb3phy_regs_layout, - .dp_aux_init = qcom_qmp_v4_phy_dp_aux_init, .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx, .configure_dp_phy = qcom_qmp_v4_phy_configure_dp_phy, @@ -1240,14 +1216,6 @@ static const struct qmp_phy_cfg sc8280xp_usb43dp_dp_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v5_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v5_pre_emphasis_hbr3_hbr2, - .clk_list = qmp_v4_phy_clk_l, - .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l), - .reset_list = msm8996_usb3phy_reset_l, - .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), - .vreg_list = qmp_phy_vreg_l, - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), - .regs = qmp_v4_usb3phy_regs_layout, - .dp_aux_init = qcom_qmp_v4_phy_dp_aux_init, .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx, .configure_dp_phy = qcom_qmp_v5_phy_configure_dp_phy, @@ -1308,14 +1276,6 @@ static const struct qmp_phy_cfg sm8250_dpphy_cfg = { .swing_hbr3_hbr2 = &qmp_dp_v3_voltage_swing_hbr3_hbr2, .pre_emphasis_hbr3_hbr2 = &qmp_dp_v3_pre_emphasis_hbr3_hbr2, - .clk_list = qmp_v4_sm8250_usbphy_clk_l, - .num_clks = ARRAY_SIZE(qmp_v4_sm8250_usbphy_clk_l), - .reset_list = msm8996_usb3phy_reset_l, - .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), - .vreg_list = qmp_phy_vreg_l, - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), - .regs = qmp_v4_usb3phy_regs_layout, - .dp_aux_init = qcom_qmp_v4_phy_dp_aux_init, .configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx, .configure_dp_phy = qcom_qmp_v4_phy_configure_dp_phy, @@ -1911,8 +1871,8 @@ static int qcom_qmp_dp_phy_calibrate(struct phy *phy) static int qmp_combo_com_init(struct qmp_phy *qphy) { struct qcom_qmp *qmp = qphy->qmp; - const struct qmp_phy_cfg *cfg = qphy->cfg; struct qmp_phy *usb_phy = qmp->usb_phy; + const struct qmp_phy_cfg *cfg = usb_phy->cfg; void __iomem *dp_com = qmp->dp_com; int ret; @@ -1964,7 +1924,7 @@ static int qmp_combo_com_init(struct qmp_phy *qphy) qphy_clrbits(dp_com, QPHY_V3_DP_COM_SWI_CTRL, 0x03); qphy_clrbits(dp_com, QPHY_V3_DP_COM_SW_RESET, SW_RESET); - qphy_setbits(usb_phy->pcs, usb_phy->cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], + qphy_setbits(usb_phy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], SW_PWRDN); mutex_unlock(&qmp->phy_mutex); @@ -1984,7 +1944,8 @@ static int qmp_combo_com_init(struct qmp_phy *qphy) static int qmp_combo_com_exit(struct qmp_phy *qphy) { struct qcom_qmp *qmp = qphy->qmp; - const struct qmp_phy_cfg *cfg = qphy->cfg; + struct qmp_phy *usb_phy = qmp->usb_phy; + const struct qmp_phy_cfg *cfg = usb_phy->cfg; mutex_lock(&qmp->phy_mutex); if (--qmp->init_count) {