From patchwork Mon Nov 14 08:13:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 19587 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2029097wru; Mon, 14 Nov 2022 00:19:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf5xeuHXLgB+DEudneyAJGqr8EVwEAIKD+iteRJEDMw4nhvwRbU7g4CxhBCcHpqzDYVupRNj X-Received: by 2002:a17:907:88cc:b0:7ae:d58e:3a4a with SMTP id rq12-20020a17090788cc00b007aed58e3a4amr8415710ejc.332.1668413940502; Mon, 14 Nov 2022 00:19:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668413940; cv=none; d=google.com; s=arc-20160816; b=tFVa1qj8qgUGbMxWOc9Q7EPgYZRJ/4zqLPho0Xd0eph0bsH8CI9C7CARu4086G8Uez cjuxTYh6XaazIMI6S5a7RMtuRN/47shUReUzuhVxAq302r/qxYqARBVWqDaBpNiiVvrI NS9DlEzYMzQ048SA3jqz/0ixx8NuSmV7Ut5dej1Eb9h/5ffXUgqk8y6XGCHEctT8ffvG GzZl03JKSL/PZDDWVaP3iVnAsd5giPzupNJ+eFr2w6TOup21skZUqZs7MUUh2tpmzuZN HpObG148ZExK6029FQeOJ9/L3bWOUvMXMJIxronGmgaOWc9YNk1vDhnUn0rb9Snm033m jAYQ== 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=jpzyL3PrpJ2DlPgoCe7jkffmCzZ18s2i09n1NUMFGlw=; b=t10X7CSKYTgoWq6lcObRJJ6gcGDrmou/WTf2Z1h8SWW57+wvD82EgW5xR2dvk1CEJk CGAagpzNgs7ucl0IZoclR9qkYp30rZLabuxNt0+qrFiP01qWjNmfKVnXJBKglwERjL1L O1iPHGkL/ycwAM3fOcVHdM2g5RyWjfMZsHOoqFdwYOEP7WKNwaweFSjeT8mFczPGV/Uw Z2ZmXkleqPt/f0EdVpwkWwuipnmG0x4t7jVKO0pM32CssTt7l2XmVZNJlCHgYvkMdAMm 4oIjXa4cx91pZ1lZf1QC3bYqpKmrh8jApgcqv0MXD5IlvMe7lmFxtzXCDX1wf4k0oVp2 6ndg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NYZ7QyZy; 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 dz10-20020a0564021d4a00b004635dccd3casi9367110edb.57.2022.11.14.00.18.36; Mon, 14 Nov 2022 00:19:00 -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=NYZ7QyZy; 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 S236293AbiKNIOk (ORCPT + 99 others); Mon, 14 Nov 2022 03:14:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236257AbiKNIOc (ORCPT ); Mon, 14 Nov 2022 03:14:32 -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 ADFCE19298; Mon, 14 Nov 2022 00:14:31 -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 5C49FB80D3A; Mon, 14 Nov 2022 08:14:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2967C433C1; Mon, 14 Nov 2022 08:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668413669; bh=7DSO9Gw0gcP3qm2ojYnCecGJVIZo7r1rdwoBiR4mUlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NYZ7QyZynJDa3KOfDTKvV0O41UPk+gMW0rphp7pSC2N3OMEq1GlWYBRhVkA61rRGH e5M1CA8+MzsTgK8LjmK9riGUP0EnGqpKUOrlG/Dp1URt4Q552UiSRVfZW0K8/IE4qS Z+UueWeqRkWI4S9PUlEWRoIPmiN1z2X1lZj1fG8T4uTgtvFynx02IewAh44U8GuJN/ DEmb4NNMKPko1BmUv84RvJ7kJlCMjH0iPV9AJOZFwgBcXfNelr0rTR2Ad6HnY8UHCA yIP4rvNXJv1pVQWbtZqQ3u+TWitvvjW1sDaKP4glf9LllRh/XR1UMmw0uaNlgLdGMw UfvgOhDbmIN7w== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1ouUbM-0001Ky-LB; Mon, 14 Nov 2022 09:13:56 +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 v2 1/6] phy: qcom-qmp-combo: fix out-of-bounds clock access Date: Mon, 14 Nov 2022 09:13:41 +0100 Message-Id: <20221114081346.5116-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221114081346.5116-1-johan+linaro@kernel.org> References: <20221114081346.5116-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?1749458816244751481?= X-GMAIL-MSGID: =?utf-8?q?1749458816244751481?= 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 Reviewed-by: Dmitry Baryshkov Signed-off-by: Johan Hovold --- 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 Mon Nov 14 08:13:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 19589 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2029174wru; Mon, 14 Nov 2022 00:19:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf5jvTmboMpJFOG8OtwV7u+v82DL/LggY7KT/KNZY4rVReVgPs5cd32JAHnZ/rqPaT3zkrCi X-Received: by 2002:aa7:d286:0:b0:461:505f:4a79 with SMTP id w6-20020aa7d286000000b00461505f4a79mr9766496edq.329.1668413956133; Mon, 14 Nov 2022 00:19:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668413956; cv=none; d=google.com; s=arc-20160816; b=ymwlwAU8QxRd6AXsc/AtZxIfrYL0IFO+Hspo7JQaXt0xl9DeYpxDSHP0TOYVQSDWGq H4I9PHY/11GkL5+FdYgMK8T20dn9wEhznvivd01JRPl9tb7Q7WQC/wK32GvHSljqAgFl QY9cbKWTxqybU+E++Y8w/c4hCZgGNuixbclfl+fG1VMDa/l5OT/yiJ+QC1HpBtCy8t4j /BgsBpHlnc8haxydlYx6KANdfz+6H3RWZTIVYuIq7/KhY4MwNRu5Ah9UH+GiCezbdRkz HO4CgmeqCFpUEke3NCOfjTP7nMXNLqbQWjflpWPagw6o9SQvbaANq8g95iEY4YmpvbZq LLKg== 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=seEEPlwHthqNmd3jTT+WiijfwXDKxcbul3wiMsqp4ok=; b=GEmCvRHRkCAWVMMYVe2fDlKb9TkrvVEFor8/kgyKVn5agvI6VvdfiZDZZzjw0hQtAd tjESgtNA1e0MGVirbIP3Ei77yx0sbueL1qaFuGjRQKlJN2lR2Gs0y9sO/w39v66t5ewF R2utU0goIAYPetzGGSWRlsV+Olr5Mgpm66axP8wgBRrgwx5fhBVYnICS6zfP0iUSym2Q d5XS6aTBgNo/g2JhHPcSC1XkYafAqOEI6BpG+eyw0CKWDmOyiyPyFxeodhJuDsYUCIJ5 K1vzSw6UZsf9o8MjMySz0PCCHvev7ZyQ6IrH3HfBrHr2aalBoPQEnHjBdvmeGti0uFxM osLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ZW9zqD/l"; 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 he42-20020a1709073daa00b00781132a4ca6si8925248ejc.850.2022.11.14.00.18.52; Mon, 14 Nov 2022 00:19:16 -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="ZW9zqD/l"; 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 S236295AbiKNIOp (ORCPT + 99 others); Mon, 14 Nov 2022 03:14:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236262AbiKNIOd (ORCPT ); Mon, 14 Nov 2022 03:14:33 -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 584AC193D9; Mon, 14 Nov 2022 00:14:32 -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 1685BB80D1C; Mon, 14 Nov 2022 08:14:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1536CC43145; Mon, 14 Nov 2022 08:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668413669; bh=NzS+/VskG+KkDUr6qPiVoEuNjsO5Y/0j9nTuX6m8hXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZW9zqD/l38xk1Ff/d2yzy/ApfbNb3a3nqetZh/5Hv0Hf0tJmY3YhLO8Ve9zjItkyX iFH8E93XMpK1GJhv3OBUGe+s0gBeDEaFEZB2JCYPT0Z358kh6eT1FKiv+lCaGqaVbx utYfXeD6xwOuuMTCSknGZOYzckNvgN9yBCLZuzc+4W64JThaFuFJv8GV/MuveU166q 1ICXlgPgqWumy5KSXB8eTMzfYTEmQ8mZlT11HKdoZX0MRW49pxoH4SzedaACWTn/CU B3zbbH+l+eqzWxBXPmvGpnA+kTseD+C6wLOUc0geX4PubPYH1xhkH9UAfUJWRX5wPL pjzMhet1EtdFQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1ouUbM-0001L0-O4; Mon, 14 Nov 2022 09:13:56 +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 v2 2/6] phy: qcom-qmp-combo: fix sdm845 reset Date: Mon, 14 Nov 2022 09:13:42 +0100 Message-Id: <20221114081346.5116-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221114081346.5116-1-johan+linaro@kernel.org> References: <20221114081346.5116-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?1749458832780096731?= X-GMAIL-MSGID: =?utf-8?q?1749458832780096731?= 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 Reviewed-by: Dmitry Baryshkov Signed-off-by: Johan Hovold --- 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 Mon Nov 14 08:13:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 19590 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2029907wru; Mon, 14 Nov 2022 00:21:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf6uTgmPfF1R+DRw9fZmNQO29KoR4rLk4D8m93GPfSCr1jLZMzo4xKIvhLtSzie1NWUI4Ibu X-Received: by 2002:a17:906:824e:b0:7ae:77ef:d048 with SMTP id f14-20020a170906824e00b007ae77efd048mr9762552ejx.740.1668414081193; Mon, 14 Nov 2022 00:21:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668414081; cv=none; d=google.com; s=arc-20160816; b=sqbJ0agCpEPP7q6srbEJ9LeIBHcA7btjjETHoZhw7Y1VJSc0636TQ7l4H0t7g56LNe tMIxv3fplMq7mZm+9TcLKIH0MAvGMuTmxaQhSpLN8ZSs44B8OtZ44Nv0SEIv/hO8R4qi A7EXCLHw7la6EJScNfUyGUr0pTNfbnvRZ4hs1QSAwKNgrgp4QQbEhg+lPZ/8MFJUFfyo nJOJiKjnGvujwOUeiZrwU/8Hw4ud3TQQxC40+G/+SYcTSkpUshHtnJizW25UOf17z/q7 +k2Ra/0b/NplO4C1c+1GiaBzouPGWJhSO0KwOWSG8BmYsFkg29m5fig9BhUAjFjGu6xw wJBQ== 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=iyMSPVlL3OHz+UdPTh6349SAnOtLXdxrkRZfa/oykWo=; b=SsByuv06cxBppvjhXmPwwqE8UjS4NRE626U5cpT0oli1h2dePi0FPsvyTx8UgsH6E2 qCGHO9Us6zqtyyHQ6Kqt5e3L9FJ4+4CFvJJ+knVW9jV2J2vv+BXVPYl82hyXehicNISr iU77hhETUvQxdzfDxT1iKWTwRoDdxanjhQtZPQlniDhwyUhpeDVr1Bhk2I+6tKi2Bk7B tqkBbYs+rFMPifHo/lP1C6VJ+LKkseG33jtzd0E8PEr4PSVuiwDc5dKGz06J5z+EQmsz 7HpiCef4YE7nO4OeWGk0JWHB7IW+ucx0kCGvtfiThc3lj0t3LcmvzAF6iHHBblJl4boA t02A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ODGK87TO; 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 oz30-20020a1709077d9e00b0073d5a794b43si8123079ejc.985.2022.11.14.00.20.57; Mon, 14 Nov 2022 00:21:21 -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=ODGK87TO; 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 S236297AbiKNIOm (ORCPT + 99 others); Mon, 14 Nov 2022 03:14:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236258AbiKNIOc (ORCPT ); Mon, 14 Nov 2022 03:14:32 -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 B3C83192A6; Mon, 14 Nov 2022 00:14:31 -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 73097B80D3B; Mon, 14 Nov 2022 08:14:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01F37C433D6; Mon, 14 Nov 2022 08:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668413669; bh=IHFLp839t6wrDbrE/w7CcDSU1XWQfM/BgeoUJmtCdPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ODGK87TO4Kb+6AjqtgTWH3OXfyp38/dR17p3O4ntsFWXrjw2Pt6NZZdLLvsKQcnhB XskAig3EVczgzeo3Z3JwPsJkEcZhqUivMOgOOPi+ZbY6Nc3qX+UZ+DbEfJx3xFYKI0 ujOhwweSk+K9BpwItH0ExG5RnkncVuiyD4P65vRjjEJBgDY2BTgUwjmTUJkCKCmBv5 s4xpp2xFCUhXi47+wU6R1BxnRlcHmrPKo+siGj/CL/x9yyLC6G2esQREdfPSjN6iSB un2nd5IHjfZWNRdEP14GRiITvTYbtazw0LmQnWEZT4tYwu3g37mQm4LDhuFeefXqXg 2PRKcZIEgeIgA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1ouUbM-0001L2-RJ; Mon, 14 Nov 2022 09:13:56 +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 v2 3/6] phy: qcom-qmp-combo: fix sc8180x reset Date: Mon, 14 Nov 2022 09:13:43 +0100 Message-Id: <20221114081346.5116-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221114081346.5116-1-johan+linaro@kernel.org> References: <20221114081346.5116-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?1749458963520839597?= X-GMAIL-MSGID: =?utf-8?q?1749458963520839597?= 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 Reviewed-by: Dmitry Baryshkov Signed-off-by: Johan Hovold --- 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 Mon Nov 14 08:13:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 19588 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2029098wru; Mon, 14 Nov 2022 00:19:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf6HhzwLGpXLyCUpg05NUzfML3MOdWEyKvELXD+Gb9O2qANRoP2cI4fw8WiSL///LFLUDVO+ X-Received: by 2002:aa7:c396:0:b0:467:2efc:a984 with SMTP id k22-20020aa7c396000000b004672efca984mr10236264edq.245.1668413940495; Mon, 14 Nov 2022 00:19:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668413940; cv=none; d=google.com; s=arc-20160816; b=Qe0g4z0OHPliuX9sNsINYubX+HY6mpk0OVF0u4aRyEM9zR+0pFh6kDmJ7SplXfaEuV ksAxLW9k6vJrfm9snSdfCvpQtPJhagjyCKo/THFVlQtJmzkUImaSJeUZ8tpUC+KlhILC 3O51L1lmBC95RamYsw2CqDpn28DQZih65FFC30NNlZwcLwPSGnkVpvJwdI5akd1015Qz MeBXwy0NYJBIx6lyWqCJn03dmqh1kJKzwPLZC6sqPghV7oOyA3Y089Y2XfJPRHmZwlP+ yjHCZh7IWo+dKzq7oXWOz0HVnObzVDp/5CrxvFMJdPWKFbnE6rUiSXyWjJq3oleafpzx 6PRw== 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=UFWaNZTQQbow/ZjhSeV0y4lPssTjg3A7GjovBJH10jo=; b=bG2OiSSKwA69pS7F4Q6yZ9mt6CDBAYwBT48MsEe6s0zyj7HZmBzF3BFhKMeGGvM2ZT ori/hlzKZ29QmJ6p0x3EN8mLbqTK7d+8qRjIMtchP7QHnXa/hcHUdMA9N8BCWbZbYvwh lD6/q44kORXo9xQMYGDufODX+mjSeLeG+UxJM7dr5sLMwt71KHcOpWy1Pv56nToORe0U R02UL0N8UF1MEaHxii12NGQ4WVeW0Oi6/SlW0oKVoXvZNMQpkMZCIc0g4U9REwq3f2zl uMmIrWkNb3Em/qAio11tXnDtT+q1m5XHHDnuQgwIihkHjHcA4iUBjRsuUGqXkGIe5+f5 N7Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="g0Uxo/Kz"; 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 5-20020a170906300500b0078ae5192906si6913982ejz.193.2022.11.14.00.18.36; Mon, 14 Nov 2022 00:19:00 -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="g0Uxo/Kz"; 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 S236285AbiKNIOi (ORCPT + 99 others); Mon, 14 Nov 2022 03:14:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236250AbiKNIOb (ORCPT ); Mon, 14 Nov 2022 03:14:31 -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 B2F42193E4; Mon, 14 Nov 2022 00:14:30 -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 4F41B60EFD; Mon, 14 Nov 2022 08:14:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F32BC4347C; Mon, 14 Nov 2022 08:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668413669; bh=XjGn/EJaHEm5vnkndgkidi1YsQNziJqXZoMhQGdQyjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g0Uxo/KzHjJqCae+QZtQSEuwWB45QuqJkQf5E445JZskJLIGt5zO9mydzAVphnj5Y 6zPa9gjxjQvfldi3vYw5zMzfkkILux59J3gab+m2tUNvA9uv+gbI5aD3412qnfhDTd ChvI/cKeyyQnoXMzqplh8ohpqo8P6xDUlV33wQejCpquIGQApZgBA12FgOoDCM9La+ NeRI4+BTjL/vuP+EAkoy5Ignxi/bYollprN+3gB0+PQ0NXPnINDvgrR2j5oxt6RvaV Lb7D+dxT2CHISbEHmBmQXUvzhHgYeu5Sr3+yBYdknCI0/9I4JH7tfO3HBO+7nd9Wj3 PLYUS/nibo8eg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1ouUbM-0001L4-UX; Mon, 14 Nov 2022 09:13:56 +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 v2 4/6] phy: qcom-qmp-combo: fix broken power on Date: Mon, 14 Nov 2022 09:13:44 +0100 Message-Id: <20221114081346.5116-5-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221114081346.5116-1-johan+linaro@kernel.org> References: <20221114081346.5116-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?1749458815892373391?= X-GMAIL-MSGID: =?utf-8?q?1749458815892373391?= The PHY is powered on during phy-init by setting the SW_PWRDN 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 Reviewed-by: Dmitry Baryshkov Signed-off-by: Johan Hovold --- 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 Mon Nov 14 08:13:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 19585 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2028580wru; Mon, 14 Nov 2022 00:17:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf63fdE/9XItcAU/VMRXl4VJ1Y/v05b2ytk9BGPQ3bzEu5260BEA3GoZPcAWdKaFH38dughL X-Received: by 2002:a17:906:3e96:b0:78d:8bb6:ba7f with SMTP id a22-20020a1709063e9600b0078d8bb6ba7fmr10063766ejj.100.1668413838189; Mon, 14 Nov 2022 00:17:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668413838; cv=none; d=google.com; s=arc-20160816; b=aZEdi4sjbScUjj/YOyx5aHIlK3IisKwF2bNkq9GjGBRQrlnH3cxSK08c3g4C6uiM8d HT61DjqXrC6+QHM8eU7j+XAMCGSw3KbVIb+ibhLQC2Q5xJ9a6l6EVaimjv6hmyVvBPDv gRRL3ZXhZ5Sckp2jKyjZWzUXhpA5xlVo9x5lCpWo96uHUODmkpHxqu36URp2iYnVb1K2 slQeF8IA6dOipSUp/qbJiUQP7Lny5UOXeZvd1nA5bPPlH9dFXv5mFf3j4o/XW2kX1tab VoIlxCgT/c/m7u4nXpOo3CRq//q+B7SDp4KDaI4JdmLsyTANHHsCx1ermTH6MA78VcPg oplg== 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=gxaTpufT0sEezv4FcLCFZpPcsPRzuf9hI1sZZOMlNaw=; b=TauE1FBXnkUO6rBMJ9nwjkTkGEsGji4QyOPCFnffODxR/pEVmybHwbc0gcU3yzpfUy T3kkzGGVEelQU09L4WMOVvU0N+SF+RO9q4e3GKb7eeSb8Ns4xLil8fwD4/lCswVTKX5B zzbJ/9IST8rXklcAfFifo2gXhIF6pxkV9NT21XVP4rBmf3omFlKN6xgvfLObqMTewJGe 5goWFHJUkoCYLexydwLvM4hjeEk4vI1y3Ll28bbWFk465tcYQuIwCj/G15qmp717LwEE 3+rar8eja4hazBeYNKgIZYBOSTNaU6ajm2bKiIo7w1NtCuBQGqXKJZggL+FuEj0K2t3P HOHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P5Kbk1B8; 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 nb36-20020a1709071ca400b007882926c090si10097280ejc.773.2022.11.14.00.16.53; Mon, 14 Nov 2022 00:17:18 -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=P5Kbk1B8; 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 S236254AbiKNIOc (ORCPT + 99 others); Mon, 14 Nov 2022 03:14:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236238AbiKNIOa (ORCPT ); Mon, 14 Nov 2022 03:14:30 -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 1EC8F192A6; Mon, 14 Nov 2022 00:14:30 -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 B19D160F00; Mon, 14 Nov 2022 08:14:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C0BEC433B5; Mon, 14 Nov 2022 08:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668413669; bh=sMPgZqnKL8DZFPSpZhcVt+oCxA6lY/wiRJ9lZ5hP80s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P5Kbk1B8IjHv5mNuLCt4FhSSHLIhTYnLzgiPCLmAVqcLIg71E/DNtrRgHapGFQb6D UTiawCT7xwGOtuJ+YrhvJvVKbpl34+4YSjxLMVmuMUwjXsk8xwS8UzV81sA2cu2UdE 91Lg7+OvckU37z6WP2RI2NLb3IViOkln3p3DoNTsODiaaHMtemQ122qnR3QdEv2btY A5SFIp0EKxZ4xGSCH1hKoyXzp6e707hgWH5HCrk+VSBL5l9qQL7J4vncGpGPB4Z2H0 LpbZFZNLCaT6qvLdYg8u0F3ZGZ/X/Es5Fyz1uUAGOEsj/C/EwjFN+sAn6YUs2qveg2 zvWAyym4c/UlQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1ouUbN-0001L8-1X; Mon, 14 Nov 2022 09:13:57 +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 v2 5/6] phy: qcom-qmp-combo: fix runtime suspend Date: Mon, 14 Nov 2022 09:13:45 +0100 Message-Id: <20221114081346.5116-6-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221114081346.5116-1-johan+linaro@kernel.org> References: <20221114081346.5116-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?1749458708475421919?= X-GMAIL-MSGID: =?utf-8?q?1749458708475421919?= 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: 52e013d0bffa ("phy: qcom-qmp: Add support for DP in USB3+DP combo phy") Reviewed-by: Dmitry Baryshkov Signed-off-by: Johan Hovold --- 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 Mon Nov 14 08:13:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 19586 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2028614wru; Mon, 14 Nov 2022 00:17:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf66RPU5/NTSYb0ENhv7oVS0kI3qaSIj33PBXYSCPKEH+Sh7o2un5/nG2wTjbN9MCJzx7vhZ X-Received: by 2002:aa7:d7c7:0:b0:462:3340:757b with SMTP id e7-20020aa7d7c7000000b004623340757bmr10105211eds.308.1668413843889; Mon, 14 Nov 2022 00:17:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668413843; cv=none; d=google.com; s=arc-20160816; b=ZdrbNMbB61eyhLFa9K+ppuQqJ4vTH9Hzpk/U5rhVC9Uu1mGZb+2pjTMRuGYgmeKjeh fpwqybcByvhkJFeMEJMQasIy6/k96Eu+TmXUrhLViCB7BUL7OaCqJr5uifIblifKTRAg BwEiewXcPm2t7qet3Sc9kyOsSaG9t7xTmQcPAVJmxbwltFv6GFmdfnQRAfEdpyO/JnZL 7ZfI7KrdNg8BneuBlsD7HOIhJI5a8Y+NdMLRM3yWdu8B+O6nT9YQbA0LNYM8m48GUxMU kOV1+y8z/lvtb9wVeiEJrQheH4wisabYr2U3ZvKGChzvdGX32G88KMOZMrGWuSM2+KVh aEpg== 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=//KHljoV+ScPiFItkyz4KSxW2pXQFg/okLMppMURuns=; b=rmEU2iSaPFNUBBSFtBsEaB94AYVb/WtDoc83W5TPWSrIGMbwgjWJssFmKjR6w2rpt2 V+jT9fOGB0aom5Fqi8pWQJLaBcnQUU2wpcVe90bPCmlStKq4XTwykSM7hagKuIctOco/ qg72kYGH6FEl2LO26BMgPyVTC2AUSji5ATGCdjbC2UBLFlwaSDcwoNaU1yDjyP21mk2K 5g9uCCTdn4R3Tt6B4JOgZxQr14zbWmLodGnJ+8VIlpMIr3vcmcHAKC7QbpKkvtPqRQr3 QGgALbkLnMAX+Jxj3ZkttGTm1ZcrFGs0EnSRNS/loDDgJbt1ok65W9GvmBGNe1sDeZGp 0DVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r5T3cPBQ; 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 gn6-20020a1709070d0600b007ae3f78c8d5si8292044ejc.787.2022.11.14.00.17.00; Mon, 14 Nov 2022 00:17:23 -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=r5T3cPBQ; 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 S236264AbiKNIOg (ORCPT + 99 others); Mon, 14 Nov 2022 03:14:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236242AbiKNIOb (ORCPT ); Mon, 14 Nov 2022 03:14:31 -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 1E8B619298; Mon, 14 Nov 2022 00:14:30 -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 B19B060EFF; Mon, 14 Nov 2022 08:14:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09294C433D7; Mon, 14 Nov 2022 08:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668413669; bh=I0gW407logO9ULZNk7dtYHVJN9kTlN+oirFiIbEbYR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r5T3cPBQGoln9yV3qpXleNFS4JpX6G4OVVhjTVsyChL9aCoof50MsCeIHWTq1IyW6 8NEEV1N5xbUH97Fd3khIuOGQzilItUpw7mHLj+X/YtHiC41B9nIJKA1123dRvFjXrl ZRqdf4beh2DO4c8A6/+epjbzY+ZywxBNuJPfUGMqbXIVGfWd43lqb8bj3w4WXijUW7 XGhc8/SZv88RZSe0SUB4qY8xbuMTJT01bmjKqMkBFSKJFMlK+N/Id6LjPMyXj/at9Q h1xv2nnbCG2OZfFlZv++pzy8jHdcimZTWpPO/n3zenOS0IhUCFYaG11DQAb+hkTQw+ NGAD4OI/2122w== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1ouUbN-0001LB-45; Mon, 14 Nov 2022 09:13:57 +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 v2 6/6] phy: qcom-qmp-combo: clean up common initialisation Date: Mon, 14 Nov 2022 09:13:46 +0100 Message-Id: <20221114081346.5116-7-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221114081346.5116-1-johan+linaro@kernel.org> References: <20221114081346.5116-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?1749458714801852401?= X-GMAIL-MSGID: =?utf-8?q?1749458714801852401?= 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. Reviewed-by: Dmitry Baryshkov Signed-off-by: Johan Hovold --- 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) {