From nobody Fri Dec 19 14:35:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17CC6CA0ED3 for ; Mon, 11 Sep 2023 21:17:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235437AbjIKVKP (ORCPT ); Mon, 11 Sep 2023 17:10:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244329AbjIKUH0 (ORCPT ); Mon, 11 Sep 2023 16:07:26 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5F731A7 for ; Mon, 11 Sep 2023 13:07:20 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2bcc14ea414so79758161fa.0 for ; Mon, 11 Sep 2023 13:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694462839; x=1695067639; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=jIPY3ZeD9RZYBeo46KSBRi4oVhTY3fvnq69UA3KgJ1g=; b=C8o9LsTRQrCCSfzm/BgvdS94wvxTZ6Y+0+m54ZedHVo5mP672dCJ6/Z9KscpkC8AyH 4YMmts6zfjjF5T/n93q9nrxvpclcDK/R/bYxOHBeVMM6SWbjVLJQ2anqrNtRE8YT5J1d WX2hTthtd4UbhdFGckhEjsOLBDmWFsACGWK41HmW7VwcRhRzciYAGd8bESFgFCU9CWMp WctarFl+bWeGppCYX483ecnjaOkWpEi2iVaAAusffZv4SD3/WASLlTJFGabfpB4HaZm3 5JQNQZ0RVDq1eF4y1mvv967Jrd+xX6ttg9kJdCB558N3BGK3DFIVp5kRkloCSOzB0fsm YR7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694462839; x=1695067639; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jIPY3ZeD9RZYBeo46KSBRi4oVhTY3fvnq69UA3KgJ1g=; b=an3Y9EMljPxcAubkpyQrfdlf1KKSOThbLsaP92/9b0BaiaMHhCevDCX2uYxL83xK2p vDt9T3rX5HfUuHFguFjLPjp8WB0d0E6emn8hlyiyo7NQiXDaoRBa6zTLa8L1PIJLep/6 i5QJjmoIidj/NS5yEFuItP3tN7c7bKjA1bm71D2p4YjZEFGPUXexVX78OKs/1Kf/foHR f5HTOcN76+I3gkoVqOzXXV9oOVWL+T+8oUoP9V+1KPWhCCyYsXIDq9E1LkBZgRjm3UTk 2+PLvrSi093E98OSGFCJEJybZfrXABadKMrE3htkp+ErBNoaBSpJYhkqsjeiCQhIokfH 6rSg== X-Gm-Message-State: AOJu0Yy95Fomlb4/cdKql+purCllBpFloQ2/3tpi63A4lQ/YmjjmY7Yy 0Pw8ipmfkaIf/Se5AYQFhmJN3A== X-Google-Smtp-Source: AGHT+IE/1HDfzOTAP8eklU+C4JP9+PukuBtRDRhCVtswxDlcEQKjXGZUD+Jm3ckfgmPb3O6tj3N1rg== X-Received: by 2002:a2e:86c4:0:b0:2bd:beb:4aca with SMTP id n4-20020a2e86c4000000b002bd0beb4acamr8490191ljj.13.1694462838979; Mon, 11 Sep 2023 13:07:18 -0700 (PDT) Received: from [10.167.154.1] (178235177248.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.248]) by smtp.gmail.com with ESMTPSA id z19-20020a170906715300b00992e14af9b9sm5753258ejj.134.2023.09.11.13.07.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 13:07:18 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 22:07:14 +0200 Subject: [PATCH v3 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230829-topic-8550_usbphy-v3-1-34ec434194c5@linaro.org> References: <20230829-topic-8550_usbphy-v3-0-34ec434194c5@linaro.org> In-Reply-To: <20230829-topic-8550_usbphy-v3-0-34ec434194c5@linaro.org> To: Andy Gross , Bjorn Andersson , Vinod Koul , Kishon Vijay Abraham I , Abel Vesa , Johan Hovold , Dmitry Baryshkov Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694462835; l=2669; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=P24s4MTH43feXZouHmdX2bCNRD1wRxSGhxRPf9k16jM=; b=vMUGLlQHGkFe3DFvN4KoE43ckcfBy/90CByfwT9ra/44i5nIRrzDaj7uPHK5DAfehq7nCPHRW o4m2sVpOy/EB97pa6o5MRqcmKaH1gWQiL5iXtqQOBYA0yNQyDQQyedS X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are two instances of the POWER_STATE_CONFIG1 register: one in the PCS space and another one in PCS_USB. The downstream init sequence pokes the latter one while we've been poking the former one (and misnamed it as the latter one, impostor!). Fix that up to avoid UB. Fixes: 49742e9edab3 ("phy: qcom-qmp-combo: Add support for SM8550") Reviewed-by: Abel Vesa Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 +- drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualco= mm/phy-qcom-qmp-combo.c index cbb28afce135..8fd240dd5127 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -859,10 +859,10 @@ static const struct qmp_phy_init_tbl sm8550_usb3_pcs_= tbl[] =3D { QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_PCS_TX_RX_CONFIG, 0x0c), QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_EQ_CONFIG1, 0x4b), QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_EQ_CONFIG5, 0x10), - QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1, 0x68), }; =20 static const struct qmp_phy_init_tbl sm8550_usb3_pcs_usb_tbl[] =3D { + QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1, 0x68), QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L, 0x40), diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h b/drivers/phy/q= ualcomm/phy-qcom-qmp-pcs-usb-v6.h index 9510e63ba9d8..c38530d6776b 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h @@ -12,7 +12,7 @@ #define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG3 0xcc #define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG6 0xd8 #define QPHY_USB_V6_PCS_REFGEN_REQ_CONFIG1 0xdc -#define QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1 0x90 +#define QPHY_USB_V6_PCS_POWER_STATE_CONFIG1 0x90 #define QPHY_USB_V6_PCS_RX_SIGDET_LVL 0x188 #define QPHY_USB_V6_PCS_RCVR_DTCT_DLY_P1U2_L 0x190 #define QPHY_USB_V6_PCS_RCVR_DTCT_DLY_P1U2_H 0x194 @@ -23,6 +23,7 @@ #define QPHY_USB_V6_PCS_EQ_CONFIG1 0x1dc #define QPHY_USB_V6_PCS_EQ_CONFIG5 0x1ec =20 +#define QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1 0x00 #define QPHY_USB_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL 0x18 #define QPHY_USB_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2 0x3c #define QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L 0x40 --=20 2.42.0 From nobody Fri Dec 19 14:35:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3F26CA0EC5 for ; Mon, 11 Sep 2023 21:39:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349735AbjIKVem (ORCPT ); Mon, 11 Sep 2023 17:34:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244330AbjIKUH2 (ORCPT ); Mon, 11 Sep 2023 16:07:28 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F20781A7 for ; Mon, 11 Sep 2023 13:07:22 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-500c7796d8eso8060372e87.1 for ; Mon, 11 Sep 2023 13:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694462841; x=1695067641; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=A/oE5bznBg4aKiDvY6jBIZITJo1kBxpGdGt4GJUgziI=; b=C1o6HFTcLASMKnVuE0Eum4+Ec/+aNQc1iywqhcTiPOg++IMIKOuwQOs1lwnrrxxs/O JCtj6mrPBdhtPl4IKI6AyaVTOyTPLTyoPht5QdH4ub3gOZLWvIlxuOoYTTW7rABi/iM6 FX9daCrrfYMBRvK9Sh94HUFMslo4EBscKZqcJ+yPGcPJJ8KNy1EnEUknx6PbRHU9Uqyi zmeFOS4cy08X+9XtxnVCjmmRvzP0NRFVyZRv6Bg4Wlw2wX3OhE49Yh2DNBrZhVuIc3ML KiUQAgp2hAh8cv1CQVzXppkcKkwFosO4E+fjm02A3mfmcKSlITAN05c3hhM01/UH70u3 Egxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694462841; x=1695067641; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A/oE5bznBg4aKiDvY6jBIZITJo1kBxpGdGt4GJUgziI=; b=QWhYJZrtlZOWt4qXdaEQcDVwkqiGD6tamscokX4PN5CQtpPvJdUVttiTPDpgOemQZ7 ZB4DIH2yILaoVpv6EoLCUT0C6DgRc4KnEaD/amrwoYC8VIkeMEQZiwPq4tyYv6/Rdimr BO5PvHq4kjkRovM5xn+zzowCkoJcvS9Dt4HOB2oQjfFIvLsKgBhU3d3tBmXBw8Hsr6c+ fC56SusjXizHFVgAvbpi8kHHklNX+zvvnccEHLyEXNQM/+cHTTbqh/jpSPGBZb8FQ9Qy bVJoMb6qP9wd6zVbftwONraxfTcHyE/3MEhC92qkFBRzWU2vCbPWZJGdirhraji+Drs+ nexQ== X-Gm-Message-State: AOJu0YwIWFLDT2LLGge7dm7JBS5/+WxlDVBGp8eb/kt4HbUJJp/pu1cV YAj8+Qv/edLqMfZfxRf5cDw9aw== X-Google-Smtp-Source: AGHT+IEAONeGtGXQL5OMvfLz4zVnvNRaE/NPqN7TVCaRAiiECgk2yb47kEGsYyVaCnTkcckP44AI3w== X-Received: by 2002:a05:6512:3710:b0:502:bdbd:841c with SMTP id z16-20020a056512371000b00502bdbd841cmr2848849lfr.33.1694462841235; Mon, 11 Sep 2023 13:07:21 -0700 (PDT) Received: from [10.167.154.1] (178235177248.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.248]) by smtp.gmail.com with ESMTPSA id z19-20020a170906715300b00992e14af9b9sm5753258ejj.134.2023.09.11.13.07.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 13:07:20 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 22:07:15 +0200 Subject: [PATCH v3 2/2] phy: qcom-qmp-combo: initialize PCS_USB registers MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230829-topic-8550_usbphy-v3-2-34ec434194c5@linaro.org> References: <20230829-topic-8550_usbphy-v3-0-34ec434194c5@linaro.org> In-Reply-To: <20230829-topic-8550_usbphy-v3-0-34ec434194c5@linaro.org> To: Andy Gross , Bjorn Andersson , Vinod Koul , Kishon Vijay Abraham I , Abel Vesa , Johan Hovold , Dmitry Baryshkov Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Konrad Dybcio , Adrien Thierry X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694462835; l=1296; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=cNyDA6fMaENsuHCLNNVW+UYlzx4pIxp/iYgLeni49ug=; b=uHEXpp8NQFwG0H2NddAl1WapfQ5ssKAAw81IEZDNcf3fTfOUgytXxoDVsDQ9foqs+IqEJDHGw ptoxYYM09iNA2n89eJVs81tUR7PiSpIfuKVTYNJw+2k3HyugLS1GbuY X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, PCS_USB registers that have their initialization data in a pcs_usb_tbl table are never initialized. Fix that. Fixes: fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS= _USB region") Reported-by: Adrien Thierry Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualco= mm/phy-qcom-qmp-combo.c index 8fd240dd5127..5e6fc8103e9d 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -2555,6 +2555,7 @@ static int qmp_combo_usb_power_on(struct phy *phy) void __iomem *tx2 =3D qmp->tx2; void __iomem *rx2 =3D qmp->rx2; void __iomem *pcs =3D qmp->pcs; + void __iomem *pcs_usb =3D qmp->pcs_usb; void __iomem *status; unsigned int val; int ret; @@ -2576,6 +2577,9 @@ static int qmp_combo_usb_power_on(struct phy *phy) =20 qmp_combo_configure(pcs, cfg->pcs_tbl, cfg->pcs_tbl_num); =20 + if (pcs_usb) + qmp_combo_configure(pcs_usb, cfg->pcs_usb_tbl, cfg->pcs_usb_tbl_num); + if (cfg->has_pwrdn_delay) usleep_range(10, 20); =20 --=20 2.42.0