From patchwork Mon Sep 11 19:32:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 721545 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 78171CA0ED9 for ; Mon, 11 Sep 2023 21:18:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240136AbjIKVLC (ORCPT ); Mon, 11 Sep 2023 17:11:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244180AbjIKTdB (ORCPT ); Mon, 11 Sep 2023 15:33:01 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 752911B8 for ; Mon, 11 Sep 2023 12:32:56 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-99c93638322so1037341466b.1 for ; Mon, 11 Sep 2023 12:32:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694460775; x=1695065575; 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=qv0VFA8AXkB7cRCKN58lE+5+SoQOFu8EkIMD+Q2nh5A=; b=gYffvhg+CGbFpoHsmhiatmK3W43qZMkFvnFOuBfkKR2Tqiec0yrvQQjWc6607G0B2Q n6tV0pNzQePDEyUvQdO5nCKEqE41PxfqS4hfvJVBa5L6TVgCS8YQfxwXah37Jyx4DDO1 9xj7bhNJV+H72xafIvLtS5KWI9Yul4ZCo2lNuY42j4VEwee1hgsQfZ0pgh4bFyD+QC+Y gjmF0irAWjekSzf9yRhYSNhQMdj0R4w/PHLhFmYAOYFWS5SDw2qMW6UmdvKJcvGGGyqn MurW1Feft/HmAq/0n9FyVsZ3IxKPuLgm7yN4tPasaMoBqgOWpat+iCeiS9IKOmWM/q8o csaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694460775; x=1695065575; 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=qv0VFA8AXkB7cRCKN58lE+5+SoQOFu8EkIMD+Q2nh5A=; b=aYfcjOKd6bUatuq4C5aO2PhSiejhBGTRzMQ67OXbZqB8m9tqfwuQhu00xf9y1fsBFI SIfZtPly4HJC2Bw5019JUSoK/SU0rgfarvGOxPC1iEEid5AaKVqNL1omLR+l9pAvHkeK WoCBK/7fOq/JDEpq/YxBCPgC76CL3KoF2dK/egJmjD/yMeVEfVIfDhW7shXY6t7760mT L8fAEIh2j2Qh0HxtCDzvGrACO/RzgNa5mIx3f5NYXfosASbL3mtY+fELREBcMrBbW9Tv DJzsHK2ZeZ1CoKQOImuI5tMN5iqafeFJif/k5rRllhLaNSjejiQPmchfMZqsjl5cbnWi dXMw== X-Gm-Message-State: AOJu0Yx+z1HtmnmRl98BURzpt/7WBNFozz2XRAsPCWsohzbiOz+lC+BF Eh03zgkeV2O5AI/FDkNvXOASpw== X-Google-Smtp-Source: AGHT+IHp58GrysheyZ4KaZCssvpY0d5GCuHIUswb9q3RrsUP6gg75lzNfzitawynvFr6tipo8V2Kxw== X-Received: by 2002:a17:907:d17:b0:9a9:e3d2:ae4d with SMTP id gn23-20020a1709070d1700b009a9e3d2ae4dmr854344ejc.25.1694460774861; Mon, 11 Sep 2023 12:32:54 -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 j4-20020a170906410400b0099cc402d3ddsm5698607ejk.202.2023.09.11.12.32.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 12:32:54 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 21:32:48 +0200 Subject: [PATCH v2 1/2] phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 MIME-Version: 1.0 Message-Id: <20230829-topic-8550_usbphy-v2-1-a72f43311d19@linaro.org> References: <20230829-topic-8550_usbphy-v2-0-a72f43311d19@linaro.org> In-Reply-To: <20230829-topic-8550_usbphy-v2-0-a72f43311d19@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=1694460770; l=2669; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=JKFDScve4WE4FPTA0n+7atBY834sQWAUXpq8axVVF1o=; b=rmZ8TapO3mCnxCvhfMXw7fR47i9OFTqH0Ifon7ChEI1D6VCZ43FRyhfsPWPu+Bb/cwWFXWpKq mF1HQnuUQp6Cp33Y0y+iUN3D7zHvYp6gKu/wDUZx7yZ5R8Yc5pYIoIY X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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/qualcomm/phy-qcom-qmp-combo.c index cbb28afce135..843099d314bf 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[] = { 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), }; static const struct qmp_phy_init_tbl sm8550_usb3_pcs_usb_tbl[] = { + QMP_PHY_INIT_CFG(QPHY_USB_Q6_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/qualcomm/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 +#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 From patchwork Mon Sep 11 19:32:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 721502 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 8D84DCA0ECE for ; Mon, 11 Sep 2023 23:04:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343682AbjIKVMQ (ORCPT ); Mon, 11 Sep 2023 17:12:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244182AbjIKTdD (ORCPT ); Mon, 11 Sep 2023 15:33:03 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2752C12A for ; Mon, 11 Sep 2023 12:32:58 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2bcde83ce9fso81367661fa.1 for ; Mon, 11 Sep 2023 12:32:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694460776; x=1695065576; 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=SmoYn1hZC3xQGtyelzNab1Xu6ODmKiyQRbBS/HxAMC4=; b=UotyASXNe8JaMvNQqj492rQLsq2hxrshnwenGUpD3NUMHSn+HT6x10/hFdJeDse7g5 kEGHkcu+vsDxGPD9e5/Sl3bzciD25WZ4YWva1ZlXtiqwaChGSrTK/phZpekApygfaWKt Er4mssrD8c4a5Q1YbGjHoX9w8/v4HcSmzf538k33Zq15b2UDWwyNPt1x67XDjr4Q9/3G zlWOWePvaJplD7SX9b+aSOVf8JN8rjz5Fb8RpoQ1AFWmbP6/O+yRIKzq8vLbqZCOHxPv ooM6NNwzZ2T32RkamjRoqL2/abGutacfvcNqRAsKxrRpq4cOXNqpHZuF5G11Ke99KYKN F+qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694460776; x=1695065576; 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=SmoYn1hZC3xQGtyelzNab1Xu6ODmKiyQRbBS/HxAMC4=; b=eKWYivBolJuI+eux2qY2JRcwb1juv4W3siHW6zOXTeDkke/iLu6mp48FBhxsaQKWBs nwUIsJmA3Y80uSCFsuhdQxNdoobStWaxaGkrQNNwTZ+rtRc2ay7/KVNNM2FNrrB+bTYK oxr8sHCT3QhWaB6GvMZuu2a64lQtYFFmbFUyNtjcfoNzrXr5hPfvauxSfhZ6syBsUJm3 N3uY7HsMJqohBJjP/qEFE32RXS/5rsuzivf4bdpjDhYF0sSZ9dIdkwReKbmlh+n28BlI 5F138B7A2CftYMfOVmEkVwioKYS+9AMLM2PXpLEVxv4IvEkO5kj33udNCqVLNwRs1w/p EIZg== X-Gm-Message-State: AOJu0Yy7ks+/pz8MkQ78cohOhxFL/SQthBdSqGzIbge+JfSYQ2LSktrO 8V5FyTARbIRnoMZx78VjLHnIXA== X-Google-Smtp-Source: AGHT+IGVpfF1mPPSu5kGATO/g/0PYmS6AMm2ETruxKwXin501vgUXJVjft33cKKtyBHE1FmZOylGaA== X-Received: by 2002:a2e:3a10:0:b0:2bc:b6ce:eab with SMTP id h16-20020a2e3a10000000b002bcb6ce0eabmr8601981lja.51.1694460776479; Mon, 11 Sep 2023 12:32:56 -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 j4-20020a170906410400b0099cc402d3ddsm5698607ejk.202.2023.09.11.12.32.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 12:32:56 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 21:32:49 +0200 Subject: [PATCH v2 2/2] phy: qcom-qmp-combo: initialize PCS_USB registers MIME-Version: 1.0 Message-Id: <20230829-topic-8550_usbphy-v2-2-a72f43311d19@linaro.org> References: <20230829-topic-8550_usbphy-v2-0-a72f43311d19@linaro.org> In-Reply-To: <20230829-topic-8550_usbphy-v2-0-a72f43311d19@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=1694460770; l=1296; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=DV4nuVtUL74YZJK1G0aNcuFg9vdKLsrw5ToJmi5Mtx8=; b=7QsJOM+zXh00ZIJeXd4vj/+bQ02B5nc7LfNYHDIXk8dqEvIVOII2KvHp/HmaBQI2RgI0gJtJs 7lKj3zZExUtByiiJ7vkNGAsC5j2WzscJL6a9Omhf20n3LffmXcbnglQ X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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/qualcomm/phy-qcom-qmp-combo.c index 843099d314bf..1922b05403ac 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 = qmp->tx2; void __iomem *rx2 = qmp->rx2; void __iomem *pcs = qmp->pcs; + void __iomem *pcs_usb = 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) qmp_combo_configure(pcs, cfg->pcs_tbl, cfg->pcs_tbl_num); + 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);