From patchwork Mon Sep 11 20:07:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 13379615 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 597CEEE57DF for ; Mon, 11 Sep 2023 20:07:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=583+wlsnW5T/+F40s711ffUH4S1HISL3AWneZf/HNKo=; b=vMkGGoLcTXuYaO 63zWtOIWD5g27M0gHfEKgu1rJpPHC/+hTou22AlPGt94ho9kaYGrgGxnCb3pNz+ma2vy0hs5Xlk7+ BWttXAyoYwZATMvzm0XHHjcMuOzglsdUJHf9/Au71jPsIkDe9F4g4yHSeu7/+atJZPCCPemmb/e0A lYDlJ8/y3Rem7UanDBsAkSllgo9EIL/5ux0xt/ajw5iuPmkTJG2PlYu4kjOst6UJ/agtKIk6mdFkH wRTaOQobFx1VgSPEPNsXMDSd0oo8SCYI0q5V2IXRlb9tn+bMJF6f/DaF1ubXlMN4HqiP2IBs3g/Yz z2mTUWE95ZooFLb3SNUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfnBs-001FeW-0I; Mon, 11 Sep 2023 20:07:24 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfnBo-001Fdn-2A for linux-phy@lists.infradead.org; Mon, 11 Sep 2023 20:07:21 +0000 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2bcb0b973a5so79087431fa.3 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=lists.infradead.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=rWSoU2GP7vRgHKgc/9ciadr1ci7hI3ugwCfJRAcDAMYDYHTmhlRxeiWl0pPN7wqGE3 AJ8Esitl12Q7xIAfnpokTO3QmQYXglH/ygSzoXgk3Ovxe55eWHyy2sYEjgjI2Iybb3Nb Zfgf0CcUjZOY/4ru+QfLuWkBhwReJ53L5DoUefsfOF5iNz8ZHnuLQpWGL6g4H7KvPHmm sHkrcRL5CZRtyio83JCiwn+I6HhJtYGmZTzLn2gI8n9rL7oY2AWCbvksDZ/rMnrKMEiW fJ6tq7BqyUssC7NtnZ5Ao6Bx3zOM27QA9GA6x1HQi+UA84P+LTlMK8LbrweVQGvjr2/d c+jA== 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=kgNfeAp1+ECfMhNvZq1XK6CJAueCbvH/tOTqd/V+jJoMc0zyT6SvHhl0BTvRU34Iuv 9UnR2BZ29s2j0D3CY1Y7bFiNxkq2tdg9SkCgpoXwYycRUozueYUrfp7CzkpJo0mumyH0 q3fpdpWpFITxR9jpR2ovEgCTbUstdDNeF/wLRIIY4TMaXUGh+yy6CbhK99aetgR2CBmE GVDqwVcFRuDew1UY5c8XeJeLCsAeLEFlF/pfXq6jsr4kjnSsz8zJAbt9lBCgefXqtqn+ 5kjJchYDYfkPrgakJetPcbZ7Eklsr/9ic1VQdwIMpxmkCrPLIRo4BFbhqLUfSHj5eXgG ZlDw== X-Gm-Message-State: AOJu0YyRu0sTRghGClft603ndYsrU7n1008enXh6Xh29rABy0G/w2JUi tBjpxWOR4wByo819kaEIpZ1aZg== 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 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= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230911_130720_708069_339E4439 X-CRM114-Status: GOOD ( 11.48 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.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..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[] = { 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_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/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 20:07:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 13379616 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB952C71153 for ; Mon, 11 Sep 2023 20:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=40BXzLJ3C6KliuJLLNsfvIOVz0Id5rWGCgXYnZBM10k=; b=qVWSgW9wukUr5K F/+RYlNG+rJLfGarZ0opED9TaAP1DLanjKRK3QVq3zP2AL16wO4bwsk+3gpqdyyw12l+TboIvRGPv 0MzLfa34XLYHUXEF/ayVclRxTv1zsAVma4CPDMpkEIFf77n82CUIp49RBUMPfMbHAC2UVWu+BhoBj BEFBrPC+tIwt7YYU14n4pcLnU36bnsW3Stom49LPReRRGuWES+JdBtszUCcf8Z3bmTwRbB9OuIw0J QWnzf0GloLixSXGhawCOv8dHJ8hT37aVY7MllDL/tcj66V5o3BfzR2nUFJRTP1uqjF0qBkv+PaOh+ FUKMixz5SZF20g9toUNA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfnBv-001FfF-1a; Mon, 11 Sep 2023 20:07:27 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfnBt-001FeJ-0L for linux-phy@lists.infradead.org; Mon, 11 Sep 2023 20:07:26 +0000 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-5007c8308c3so8081683e87.0 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=lists.infradead.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=MpmN6yEyP40av0nupXjIAiKSnPIAKAlJB9CdVu1OQpYbseiY11zdTJfDQrvr2boOUF zzxSbxspujF4STgL7e1i7hHAa1+Oo6hDvWjxkOunnF0VUuT2Yi9rVg99TTwYgEl2BsdS lO/3YxbFM0EM9Y2ZYAjyFSNLi7fLWPHSQQpw+LvtmxGR6SbMhuWyk5agGigM8xiY4vIl W96paaDgiJXoYOCPyuqTcN2O1lib+ydHB3ubEM6/2G9EvIQoLHvSta7ItehtY+8fNVD/ OXKcf0XrNbCGELHD6XeYJU3N03Bsj6F+mWsjHeY6Y8L2zDzhdYSST+mrwESHcYz1hZvi kM7g== 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=q6xuaIK1Vo2PY7YGcctfHfCVsLk0LBMtfsnGEUSmiElPGIXpIO2F9gyonorBfUEqp2 rvMMT0sEoHl7I/9BVEXb+88hCH5aEDQfuvFQvW0+Pr2bKbQtM9T01McKxqSMI8yRV6T2 xfGevekYsg7t+YiG9CzUb1PUFAEvktYuOWGx+R4RNlNgr9miA7zPuTAlnPj5CFE9hN5k WBsPsM9pVO7SrkCE0nNmjcFNzuHSTHQEOQZ1dXxUyOVoHR8v9BY2BPm4mhW5trHVbu4j /3HwAKE2DkUGH/3cXTXTNt7pUKrqqZbeUGgw1uMWdcLfinRMYEpkPB2yjtNbNsQHN4uW lrEA== X-Gm-Message-State: AOJu0YwDnjKu8H78bYm8v+JZhLxAz1GjdpsY3V0r1nl+cIYqLbI2OLsh ZA0Pg8Mt3qZJPEb5+fS0LnUknA== 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 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= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230911_130725_144451_0656B8AE X-CRM114-Status: UNSURE ( 8.55 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.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 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 = 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);