From patchwork Fri Nov 11 08:56:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 18575 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp626432wru; Fri, 11 Nov 2022 01:00:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf4dexrUUjRpqI/VvM5k9hxRLVT3L/iRGcPq9k0qPUxeCF6bIcMHFRn6puZQB+JyBJXyz0n4 X-Received: by 2002:a17:906:408b:b0:78d:b88f:1548 with SMTP id u11-20020a170906408b00b0078db88f1548mr1186554ejj.221.1668157244594; Fri, 11 Nov 2022 01:00:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668157244; cv=none; d=google.com; s=arc-20160816; b=LY3MCPaAYFbv/VITj8PaYXMk4Y7wJPyI4OC2EUkWEsdQptMqs5nWdp79OVI/Esql4P uWBYunf8cFkJSO9WW+Vh2V/S7mRrltxlF24OKgU5xAD8U796CDjefIz7iWQdnXZEX5YF 9cESzWI8xzRaUeMmVI4JMty+mCwt/xaA0EJdf5svhWV+I7Q9lVWcqhbCzq9lXRxUzOfe KfmlC1Jz00Nd5xf/nuczADnDp5owoXGnsttyQ5YbccjmeCb3TmJviyiEk9RkLqSIWOVl cr9nVnVDhFAxJ7higriF12yKoBnQJiyNsJaRre7X8Q8zi8s1OgaIOlYZBXA0EKX2U59L ZyJw== 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=N9CUSwDKWfkjcSOoH82jlbZMe3kpMnswK2YLxaF3SPo=; b=gpLRTBwy0Z8S72YIWn9rUYx1OlTU6UpwiWU096JKTCurp0OyuzKEWiNirF25WOMVVX t7FcI6xq2BMJCykQKwRMnXufjCoWk6XQVgq2L88yssiI/EBqHi63wbmIJRhbv74WibEB zRxOAc4C+ky5Uw4ze7mBRzR/pc+1wf4IusAiF0bAKksSGEES+aR5iPcxtzqMfBfVkrzm OpJEQHxxbaJjHaTv3xhb/LFoPzzIY+hWGyS5AWOTaeawUyHaXj69bde7Mtm7cmT9jLbF O1NFUNcMrwMLooJ/05ESbUeR8NUPRYZeeRmS8e8/EDQdE2+l0RzTOPqimFF1hpa0nJpl JdKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Lw+V+7JF; 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 du7-20020a17090772c700b0078db6f5f4b2si1534252ejc.546.2022.11.11.01.00.20; Fri, 11 Nov 2022 01:00:44 -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=Lw+V+7JF; 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 S233630AbiKKI65 (ORCPT + 99 others); Fri, 11 Nov 2022 03:58:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233470AbiKKI53 (ORCPT ); Fri, 11 Nov 2022 03:57:29 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47BB27E9A6; Fri, 11 Nov 2022 00:57:28 -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 8B29AB82476; Fri, 11 Nov 2022 08:57:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85E2EC4FEBE; Fri, 11 Nov 2022 08:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668157043; bh=nWXsAtVF3OLE/Q7SzT/JJOzcMNVMOqmBow0B6bqTAQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lw+V+7JFWvL6CAtkw01384p9gGqy9PJamLZQ+LdL35klKe8wxEXphsXiKQI37QjxF 3O1AbVavdV3DXEIXVy5+ZD7ygvutZ9EmAarpvbL3/Qhz28IqdormsDeDm/wMhC3z9k QMF6uLn7nXoaXhdyLAL/WXwq3lqDh5uOHLPJR1r1IiZj3nY5vo1J1dh1oaa7uN+Vi3 i0r8Nh1EIUWFupuiwozqQL4ZemK1ZNeDzJB9NAXm0a8eRgX+U37+5xnH7qk11NDVX9 qjdDnbCz92nl18BWidMJXWtBwAOFIeNbG8WjHmHD+YO23rHsTQgElnHcjmN5H0eEX4 B8kcAtVred9kQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1otPqJ-0002UH-OC; Fri, 11 Nov 2022 09:56:55 +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 11/22] phy: qcom-qmp-combo: clean up serdes initialisation Date: Fri, 11 Nov 2022 09:56:32 +0100 Message-Id: <20221111085643.9478-12-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221111085643.9478-1-johan+linaro@kernel.org> References: <20221111085643.9478-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?1749189651069522696?= X-GMAIL-MSGID: =?utf-8?q?1749189651069522696?= Clean up serdes initialisation somewhat by making the current helper a dedicated helper for the DP part of the PHY. Note that no error is currently returned for non-supported link rates. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 49 +++++++++++------------ 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index 748fd32a6f72..c059e4aeecdb 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -1313,7 +1313,7 @@ static void qmp_combo_configure(void __iomem *base, qmp_combo_configure_lane(base, tbl, num, 0xff); } -static int qmp_combo_serdes_init(struct qmp_phy *qphy) +static int qmp_combo_dp_serdes_init(struct qmp_phy *qphy) { const struct qmp_phy_cfg *cfg = qphy->cfg; void __iomem *serdes = qphy->serdes; @@ -1323,28 +1323,26 @@ static int qmp_combo_serdes_init(struct qmp_phy *qphy) qmp_combo_configure(serdes, serdes_tbl, serdes_tbl_num); - if (cfg->type == PHY_TYPE_DP) { - switch (dp_opts->link_rate) { - case 1620: - qmp_combo_configure(serdes, cfg->serdes_tbl_rbr, - cfg->serdes_tbl_rbr_num); - break; - case 2700: - qmp_combo_configure(serdes, cfg->serdes_tbl_hbr, - cfg->serdes_tbl_hbr_num); - break; - case 5400: - qmp_combo_configure(serdes, cfg->serdes_tbl_hbr2, - cfg->serdes_tbl_hbr2_num); - break; - case 8100: - qmp_combo_configure(serdes, cfg->serdes_tbl_hbr3, - cfg->serdes_tbl_hbr3_num); - break; - default: - /* Other link rates aren't supported */ - return -EINVAL; - } + switch (dp_opts->link_rate) { + case 1620: + qmp_combo_configure(serdes, cfg->serdes_tbl_rbr, + cfg->serdes_tbl_rbr_num); + break; + case 2700: + qmp_combo_configure(serdes, cfg->serdes_tbl_hbr, + cfg->serdes_tbl_hbr_num); + break; + case 5400: + qmp_combo_configure(serdes, cfg->serdes_tbl_hbr2, + cfg->serdes_tbl_hbr2_num); + break; + case 8100: + qmp_combo_configure(serdes, cfg->serdes_tbl_hbr3, + cfg->serdes_tbl_hbr3_num); + break; + default: + /* Other link rates aren't supported */ + return -EINVAL; } return 0; @@ -1994,7 +1992,7 @@ static int qmp_combo_dp_power_on(struct phy *phy) const struct qmp_phy_cfg *cfg = qphy->cfg; void __iomem *tx = qphy->tx; - qmp_combo_serdes_init(qphy); + qmp_combo_dp_serdes_init(qphy); qmp_combo_configure_lane(tx, cfg->tx_tbl, cfg->tx_tbl_num, 1); @@ -2025,6 +2023,7 @@ static int qmp_combo_usb_power_on(struct phy *phy) struct qmp_phy *qphy = phy_get_drvdata(phy); struct qcom_qmp *qmp = qphy->qmp; const struct qmp_phy_cfg *cfg = qphy->cfg; + void __iomem *serdes = qphy->serdes; void __iomem *tx = qphy->tx; void __iomem *rx = qphy->rx; void __iomem *pcs = qphy->pcs; @@ -2032,7 +2031,7 @@ static int qmp_combo_usb_power_on(struct phy *phy) unsigned int val; int ret; - qmp_combo_serdes_init(qphy); + qmp_combo_configure(serdes, cfg->serdes_tbl, cfg->serdes_tbl_num); ret = clk_prepare_enable(qphy->pipe_clk); if (ret) {