From patchwork Mon Oct 24 09:00: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: 8266 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp336569wru; Mon, 24 Oct 2022 02:07:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gqbEwQZdMlBsNs9KCVHDKxgPvDef2rYEaJ8uV4bkmBsCP0Q2mpu5lFbKxOx2K9Yy8xVcC X-Received: by 2002:a17:907:3fa3:b0:78d:d11c:389f with SMTP id hr35-20020a1709073fa300b0078dd11c389fmr26313480ejc.415.1666602412399; Mon, 24 Oct 2022 02:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666602412; cv=none; d=google.com; s=arc-20160816; b=08mCy385Hcd9J0Tvu1JNaiCeb3BSL64BDD+kyGTVRTAb/XCyL8rcv+TYspVR++7TGh tj7BHPUZ+m4eKQnduv4lVYBQiZPd+D02Oqj9zb26sMDej69Rjb2atfEch2E76yHOKvaM mMIi/HZ2X4eIFKSIZAP3n2oBvQKloy+WqlcykgaBfMRQypaRvwe6NQRqx3fS4tqUBmXk B2ZbDVL9WQ8D9VrBBqiQZVrF4K/ux7O62zEb9ESI8qQPB6t9sr7y4JUxgBAcKJS/wENN L/jl3g8a60jIRhygx4pqpYaL5W55zq/jn5HY1SmJ1rPE4EdfkVyGbYT7MohsNlH3DzC1 yHgQ== 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=pzJr9D70yS9F/CSE1G5R5r6bQ6mKHDsPb0q0LZaFtOI=; b=VdY0A60lGTuRoi8oMGj7aMc1Q7hmpmoFVOX/MRRwnSuQf/f9NIuh2ElzyZpsaxA8Ls FfcmJSpWkHSMExWjL2cUDBYvwkcHeKMs5UQm8pH+FuOWaKPTjZTjbEUlyukZLMNPXbSX 8r3cAUkHV4ncSOEXjRo+8VaBbo5O4jLzpRnnfx8fT7XCdrlC2YNhCF06UhW6HJgjCm8B huVVgJeyiBh317ZKpptJR32oLa64E3yyE+6AMFmFxGOzTinVncGd0C7ImM64nAnxiXX7 ASWHzIIVK4XgoCREoLdi/9m/92c+BeXQ9QVTqi+vpxPpa1I9U3SAgVAYR1Kt2QNZLS7P ML5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=irTWdS5L; 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 dp14-20020a170906c14e00b007800ee1b748si27196333ejc.953.2022.10.24.02.06.28; Mon, 24 Oct 2022 02:06:52 -0700 (PDT) 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=irTWdS5L; 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 S230489AbiJXJCN (ORCPT + 99 others); Mon, 24 Oct 2022 05:02:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbiJXJBl (ORCPT ); Mon, 24 Oct 2022 05:01:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 683112ED63; Mon, 24 Oct 2022 02:01:40 -0700 (PDT) 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 12FE0B80FD3; Mon, 24 Oct 2022 09:01:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A98DBC433D7; Mon, 24 Oct 2022 09:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666602097; bh=/QOd/A9j2LYjcIHbC2MjcBtERDD4VyR/2Wsyxi0u9T4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=irTWdS5LhaCd53En9T6AMWsM8Zp+9Ohltok3bZc4rw5BQfb20vZHbb5kOGtzt2sMg N6vSRbrPZEqdJzkJhB6Yw5J8I0iMUDBCr0PXqy+eSQ4KB6XJ+3QkTar1hUYtsHzdcs Kywpas+NHSc4SzfGCSIMgipfNIuXSxhT1AqAZj2f5zR0yY9QIJ7gdZgoE7DirVXLZG gbe+zyj+H+aG4+2ELglXdVEYX3n1c7K8cJFQ5uFiqQk5oumWmQWFApxnI6A/ULQ1/u 4t+nmIY3h9bPwTDwCs2rUmMgLHmeRFJnQBwfCL11NXRGR51tJWeWykgzbWorpYI5JU IDfNd/sr67ITg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omtKj-00056N-0h; Mon, 24 Oct 2022 11:01:21 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 01/10] phy: qcom-qmp-ufs: move device-id table Date: Mon, 24 Oct 2022 11:00:32 +0200 Message-Id: <20221024090041.19574-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024090041.19574-1-johan+linaro@kernel.org> References: <20221024090041.19574-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747559291161199461?= X-GMAIL-MSGID: =?utf-8?q?1747559291161199461?= Move the device-id table below probe() and next to the driver structure to keep the driver callback functions grouped together. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 78 ++++++++++++------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c index 9b58d742af3b..acb8efa1d758 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c @@ -1081,45 +1081,6 @@ static int qmp_ufs_create(struct device *dev, struct device_node *np, int id, return 0; } -static const struct of_device_id qmp_ufs_of_match_table[] = { - { - .compatible = "qcom,msm8996-qmp-ufs-phy", - .data = &msm8996_ufs_cfg, - }, { - .compatible = "qcom,msm8998-qmp-ufs-phy", - .data = &sdm845_ufsphy_cfg, - }, { - .compatible = "qcom,sc8180x-qmp-ufs-phy", - .data = &sm8150_ufsphy_cfg, - }, { - .compatible = "qcom,sc8280xp-qmp-ufs-phy", - .data = &sm8350_ufsphy_cfg, - }, { - .compatible = "qcom,sdm845-qmp-ufs-phy", - .data = &sdm845_ufsphy_cfg, - }, { - .compatible = "qcom,sm6115-qmp-ufs-phy", - .data = &sm6115_ufsphy_cfg, - }, { - .compatible = "qcom,sm6350-qmp-ufs-phy", - .data = &sdm845_ufsphy_cfg, - }, { - .compatible = "qcom,sm8150-qmp-ufs-phy", - .data = &sm8150_ufsphy_cfg, - }, { - .compatible = "qcom,sm8250-qmp-ufs-phy", - .data = &sm8150_ufsphy_cfg, - }, { - .compatible = "qcom,sm8350-qmp-ufs-phy", - .data = &sm8350_ufsphy_cfg, - }, { - .compatible = "qcom,sm8450-qmp-ufs-phy", - .data = &sm8450_ufsphy_cfg, - }, - { }, -}; -MODULE_DEVICE_TABLE(of, qmp_ufs_of_match_table); - static int qmp_ufs_probe(struct platform_device *pdev) { struct qcom_qmp *qmp; @@ -1185,6 +1146,45 @@ static int qmp_ufs_probe(struct platform_device *pdev) return ret; } +static const struct of_device_id qmp_ufs_of_match_table[] = { + { + .compatible = "qcom,msm8996-qmp-ufs-phy", + .data = &msm8996_ufs_cfg, + }, { + .compatible = "qcom,msm8998-qmp-ufs-phy", + .data = &sdm845_ufsphy_cfg, + }, { + .compatible = "qcom,sc8180x-qmp-ufs-phy", + .data = &sm8150_ufsphy_cfg, + }, { + .compatible = "qcom,sc8280xp-qmp-ufs-phy", + .data = &sm8350_ufsphy_cfg, + }, { + .compatible = "qcom,sdm845-qmp-ufs-phy", + .data = &sdm845_ufsphy_cfg, + }, { + .compatible = "qcom,sm6115-qmp-ufs-phy", + .data = &sm6115_ufsphy_cfg, + }, { + .compatible = "qcom,sm6350-qmp-ufs-phy", + .data = &sdm845_ufsphy_cfg, + }, { + .compatible = "qcom,sm8150-qmp-ufs-phy", + .data = &sm8150_ufsphy_cfg, + }, { + .compatible = "qcom,sm8250-qmp-ufs-phy", + .data = &sm8150_ufsphy_cfg, + }, { + .compatible = "qcom,sm8350-qmp-ufs-phy", + .data = &sm8350_ufsphy_cfg, + }, { + .compatible = "qcom,sm8450-qmp-ufs-phy", + .data = &sm8450_ufsphy_cfg, + }, + { }, +}; +MODULE_DEVICE_TABLE(of, qmp_ufs_of_match_table); + static struct platform_driver qmp_ufs_driver = { .probe = qmp_ufs_probe, .driver = { From patchwork Mon Oct 24 09:00:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8268 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp336859wru; Mon, 24 Oct 2022 02:07:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kKLd1HC9x6FxYlb494Gi4PgKZ4W6SdOXNIW1zv40ZD71aQ99fSGaIwqZ1xAYGs7V1A3on X-Received: by 2002:a50:ec0a:0:b0:461:c0ca:a0bc with SMTP id g10-20020a50ec0a000000b00461c0caa0bcmr4402568edr.306.1666602465615; Mon, 24 Oct 2022 02:07:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666602465; cv=none; d=google.com; s=arc-20160816; b=VhYY24Qphrd0KveTlHEPtieseDPBipcux6DpGxAjwND/o9Vah8ev0YEBAOVUnGvIQq VBMXTvVME3VxwsEMzx69acimuqILAgcC6x8HY6fKJimuD1K4FG9BCrOJ0JMX1KvCwg6i DAmB8ZffOV7iTBfzWwZNaO3W+8ifTW6Kz1OOBPbsX/sB6urJxRgJKbeIhhqI8gXea6n8 jWZ7zK1reO33IefKoU3+0z9IX0R4KsthpcN8NLkPJEgTcX6bwPD2nYIFbCFH0ws2wyQh WKgS5o2CRmjIQr1zLJJwT9vOmL24puxHUwfzhH68Rl1t4R/Vt8+4DPLNgijp7KvBRlGQ 60vQ== 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=UchHEcsSJjqJbKpCXO0U96gMqkBZ+Df/COCI/qsLlNA=; b=bZbim10nnwqnO2JDN0Suf2RsE9YwkvLyFRVjpydOkq4hNgZEKPaAgzSnWMZU0wHXVU yJprUwPfX/OY8SwVOHycSL8yq6W7rWd1tCsfhvbvy7p3baTHvaZIoWmBD19WdWYxCYDD Xr8bLMLRluaXLbVA4OoouTxh39Va+0EjPg9ptmvlgqUhwe09TfwtvFqKh/ExqQ5svMVO N8fEXK5gpAUoneLgt5gHGNRljX/ud1ADDDdm09BP695Bw8PkhHnZzLeeU/AJ/kPfvOfF TQV0ghhadGwXmVfSZTe2It1ETPBw/pTHULew5u0sVPkADcN0z8xk1hFFd/svp+NvGdl6 pf6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eNspZSZe; 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 f21-20020a0564021e9500b00461a144e980si4593226edf.379.2022.10.24.02.07.19; Mon, 24 Oct 2022 02:07:45 -0700 (PDT) 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=eNspZSZe; 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 S230490AbiJXJC0 (ORCPT + 99 others); Mon, 24 Oct 2022 05:02:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229613AbiJXJBm (ORCPT ); Mon, 24 Oct 2022 05:01:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22CF227CD8; Mon, 24 Oct 2022 02:01:41 -0700 (PDT) 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 ADE42B80FC9; Mon, 24 Oct 2022 09:01:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAA8DC4347C; Mon, 24 Oct 2022 09:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666602097; bh=XfrhZZ3hdURm8ajGKt9NS2MAtDQc+KzKurmU2+Tfeyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eNspZSZecXgQUmn8Zwgwx9XYXoY1InofeQu7HDGa9EpGPRKQGwm0apmG4hLL7w5TT 4kQtFjv6txcDuJhMGWtgrQ+ooek/DvoRNY9bVIcVpG8mAtFvWm3MWtvQkLhj3uhlti XujkM/GEAWqmaiFjvC3UpDqT1IqcaIN0wVxaitEiQLIam55dKfJXuACpW57bGve1sW NzaESSVdmVoRkNnrCMx/anGuvwZLGB5jilU3grNDHJTyqsDG+oycUxPJ97IYTgywNV 1gPWRl619ZYYIhJxQoR85YpTmR1U9i1CwBolrQBmIF13wjz4Yem2PyT3x9usMHJo+g JMJuGWjwd5veg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omtKj-00056P-3y; Mon, 24 Oct 2022 11:01:21 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 02/10] phy: qcom-qmp-ufs: merge driver data Date: Mon, 24 Oct 2022 11:00:33 +0200 Message-Id: <20221024090041.19574-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024090041.19574-1-johan+linaro@kernel.org> References: <20221024090041.19574-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747559346752904115?= X-GMAIL-MSGID: =?utf-8?q?1747559346752904115?= The UFS QMP PHY driver only manages a single PHY so merge the old qcom_qmp and qmp_phy structures and drop the PHY array. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 171 +++++++++--------------- 1 file changed, 63 insertions(+), 108 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c index acb8efa1d758..b4c3b3d97f52 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c @@ -548,54 +548,24 @@ struct qmp_phy_cfg { bool no_pcs_sw_reset; }; -/** - * struct qmp_phy - per-lane phy descriptor - * - * @phy: generic phy - * @cfg: phy specific configuration - * @serdes: iomapped memory space for phy's serdes (i.e. PLL) - * @tx: iomapped memory space for lane's tx - * @rx: iomapped memory space for lane's rx - * @pcs: iomapped memory space for lane's pcs - * @tx2: iomapped memory space for second lane's tx (in dual lane PHYs) - * @rx2: iomapped memory space for second lane's rx (in dual lane PHYs) - * @pcs_misc: iomapped memory space for lane's pcs_misc - * @qmp: QMP phy to which this lane belongs - */ -struct qmp_phy { - struct phy *phy; +struct qmp_ufs { + struct device *dev; + const struct qmp_phy_cfg *cfg; + void __iomem *serdes; + void __iomem *pcs; + void __iomem *pcs_misc; void __iomem *tx; void __iomem *rx; - void __iomem *pcs; void __iomem *tx2; void __iomem *rx2; - void __iomem *pcs_misc; - struct qcom_qmp *qmp; -}; - -/** - * struct qcom_qmp - structure holding QMP phy block attributes - * - * @dev: device - * - * @clks: array of clocks required by phy - * @resets: array of resets required by phy - * @vregs: regulator supplies bulk data - * - * @phys: array of per-lane phy descriptors - * @ufs_reset: optional UFS PHY reset handle - */ -struct qcom_qmp { - struct device *dev; struct clk_bulk_data *clks; struct regulator_bulk_data *vregs; - - struct qmp_phy **phys; - struct reset_control *ufs_reset; + + struct phy *phy; }; static inline void qphy_setbits(void __iomem *base, u32 offset, u32 val) @@ -782,10 +752,10 @@ static void qmp_ufs_configure(void __iomem *base, qmp_ufs_configure_lane(base, tbl, num, 0xff); } -static int qmp_ufs_serdes_init(struct qmp_phy *qphy) +static int qmp_ufs_serdes_init(struct qmp_ufs *qmp) { - const struct qmp_phy_cfg *cfg = qphy->cfg; - void __iomem *serdes = qphy->serdes; + const struct qmp_phy_cfg *cfg = qmp->cfg; + void __iomem *serdes = qmp->serdes; const struct qmp_phy_init_tbl *serdes_tbl = cfg->serdes_tbl; int serdes_tbl_num = cfg->serdes_tbl_num; @@ -794,11 +764,10 @@ static int qmp_ufs_serdes_init(struct qmp_phy *qphy) return 0; } -static int qmp_ufs_com_init(struct qmp_phy *qphy) +static int qmp_ufs_com_init(struct qmp_ufs *qmp) { - struct qcom_qmp *qmp = qphy->qmp; - const struct qmp_phy_cfg *cfg = qphy->cfg; - void __iomem *pcs = qphy->pcs; + const struct qmp_phy_cfg *cfg = qmp->cfg; + void __iomem *pcs = qmp->pcs; int ret; ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs); @@ -821,10 +790,9 @@ static int qmp_ufs_com_init(struct qmp_phy *qphy) return ret; } -static int qmp_ufs_com_exit(struct qmp_phy *qphy) +static int qmp_ufs_com_exit(struct qmp_ufs *qmp) { - struct qcom_qmp *qmp = qphy->qmp; - const struct qmp_phy_cfg *cfg = qphy->cfg; + const struct qmp_phy_cfg *cfg = qmp->cfg; reset_control_assert(qmp->ufs_reset); @@ -837,9 +805,8 @@ static int qmp_ufs_com_exit(struct qmp_phy *qphy) static int qmp_ufs_init(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; + struct qmp_ufs *qmp = phy_get_drvdata(phy); + const struct qmp_phy_cfg *cfg = qmp->cfg; int ret; dev_vdbg(qmp->dev, "Initializing QMP phy\n"); @@ -870,7 +837,7 @@ static int qmp_ufs_init(struct phy *phy) return ret; } - ret = qmp_ufs_com_init(qphy); + ret = qmp_ufs_com_init(qmp); if (ret) return ret; @@ -879,28 +846,27 @@ static int qmp_ufs_init(struct phy *phy) static int qmp_ufs_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 *tx = qphy->tx; - void __iomem *rx = qphy->rx; - void __iomem *pcs = qphy->pcs; + struct qmp_ufs *qmp = phy_get_drvdata(phy); + const struct qmp_phy_cfg *cfg = qmp->cfg; + void __iomem *tx = qmp->tx; + void __iomem *rx = qmp->rx; + void __iomem *pcs = qmp->pcs; void __iomem *status; unsigned int val; int ret; - qmp_ufs_serdes_init(qphy); + qmp_ufs_serdes_init(qmp); /* Tx, Rx, and PCS configurations */ qmp_ufs_configure_lane(tx, cfg->tx_tbl, cfg->tx_tbl_num, 1); if (cfg->lanes >= 2) - qmp_ufs_configure_lane(qphy->tx2, cfg->tx_tbl, cfg->tx_tbl_num, 2); + qmp_ufs_configure_lane(qmp->tx2, cfg->tx_tbl, cfg->tx_tbl_num, 2); qmp_ufs_configure_lane(rx, cfg->rx_tbl, cfg->rx_tbl_num, 1); if (cfg->lanes >= 2) - qmp_ufs_configure_lane(qphy->rx2, cfg->rx_tbl, cfg->rx_tbl_num, 2); + qmp_ufs_configure_lane(qmp->rx2, cfg->rx_tbl, cfg->rx_tbl_num, 2); qmp_ufs_configure(pcs, cfg->pcs_tbl, cfg->pcs_tbl_num); @@ -928,18 +894,18 @@ static int qmp_ufs_power_on(struct phy *phy) static int qmp_ufs_power_off(struct phy *phy) { - struct qmp_phy *qphy = phy_get_drvdata(phy); - const struct qmp_phy_cfg *cfg = qphy->cfg; + struct qmp_ufs *qmp = phy_get_drvdata(phy); + const struct qmp_phy_cfg *cfg = qmp->cfg; /* PHY reset */ if (!cfg->no_pcs_sw_reset) - qphy_setbits(qphy->pcs, cfg->regs[QPHY_SW_RESET], SW_RESET); + qphy_setbits(qmp->pcs, cfg->regs[QPHY_SW_RESET], SW_RESET); /* stop SerDes */ - qphy_clrbits(qphy->pcs, cfg->regs[QPHY_START_CTRL], SERDES_START); + qphy_clrbits(qmp->pcs, cfg->regs[QPHY_START_CTRL], SERDES_START); /* Put PHY into POWER DOWN state: active low */ - qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], + qphy_clrbits(qmp->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], SW_PWRDN); return 0; @@ -947,9 +913,9 @@ static int qmp_ufs_power_off(struct phy *phy) static int qmp_ufs_exit(struct phy *phy) { - struct qmp_phy *qphy = phy_get_drvdata(phy); + struct qmp_ufs *qmp = phy_get_drvdata(phy); - qmp_ufs_com_exit(qphy); + qmp_ufs_com_exit(qmp); return 0; } @@ -981,7 +947,7 @@ static int qmp_ufs_disable(struct phy *phy) static int qmp_ufs_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg) { - struct qcom_qmp *qmp = dev_get_drvdata(dev); + struct qmp_ufs *qmp = dev_get_drvdata(dev); int num = cfg->num_vregs; int i; @@ -997,7 +963,7 @@ static int qmp_ufs_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg) static int qmp_ufs_clk_init(struct device *dev, const struct qmp_phy_cfg *cfg) { - struct qcom_qmp *qmp = dev_get_drvdata(dev); + struct qmp_ufs *qmp = dev_get_drvdata(dev); int num = cfg->num_clks; int i; @@ -1017,78 +983,71 @@ static const struct phy_ops qcom_qmp_ufs_ops = { .owner = THIS_MODULE, }; -static int qmp_ufs_create(struct device *dev, struct device_node *np, int id, +static int qmp_ufs_create(struct device *dev, struct device_node *np, void __iomem *serdes, const struct qmp_phy_cfg *cfg) { - struct qcom_qmp *qmp = dev_get_drvdata(dev); + struct qmp_ufs *qmp = dev_get_drvdata(dev); struct phy *generic_phy; - struct qmp_phy *qphy; int ret; - qphy = devm_kzalloc(dev, sizeof(*qphy), GFP_KERNEL); - if (!qphy) - return -ENOMEM; - - qphy->cfg = cfg; - qphy->serdes = serdes; + qmp->cfg = cfg; + qmp->serdes = serdes; /* * Get memory resources for the PHY: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2. * For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5 * For single lane PHYs: pcs_misc (optional) -> 3. */ - qphy->tx = devm_of_iomap(dev, np, 0, NULL); - if (IS_ERR(qphy->tx)) - return PTR_ERR(qphy->tx); + qmp->tx = devm_of_iomap(dev, np, 0, NULL); + if (IS_ERR(qmp->tx)) + return PTR_ERR(qmp->tx); - qphy->rx = devm_of_iomap(dev, np, 1, NULL); - if (IS_ERR(qphy->rx)) - return PTR_ERR(qphy->rx); + qmp->rx = devm_of_iomap(dev, np, 1, NULL); + if (IS_ERR(qmp->rx)) + return PTR_ERR(qmp->rx); - qphy->pcs = devm_of_iomap(dev, np, 2, NULL); - if (IS_ERR(qphy->pcs)) - return PTR_ERR(qphy->pcs); + qmp->pcs = devm_of_iomap(dev, np, 2, NULL); + if (IS_ERR(qmp->pcs)) + return PTR_ERR(qmp->pcs); if (cfg->lanes >= 2) { - qphy->tx2 = devm_of_iomap(dev, np, 3, NULL); - if (IS_ERR(qphy->tx2)) - return PTR_ERR(qphy->tx2); + qmp->tx2 = devm_of_iomap(dev, np, 3, NULL); + if (IS_ERR(qmp->tx2)) + return PTR_ERR(qmp->tx2); - qphy->rx2 = devm_of_iomap(dev, np, 4, NULL); - if (IS_ERR(qphy->rx2)) - return PTR_ERR(qphy->rx2); + qmp->rx2 = devm_of_iomap(dev, np, 4, NULL); + if (IS_ERR(qmp->rx2)) + return PTR_ERR(qmp->rx2); - qphy->pcs_misc = devm_of_iomap(dev, np, 5, NULL); + qmp->pcs_misc = devm_of_iomap(dev, np, 5, NULL); } else { - qphy->pcs_misc = devm_of_iomap(dev, np, 3, NULL); + qmp->pcs_misc = devm_of_iomap(dev, np, 3, NULL); } - if (IS_ERR(qphy->pcs_misc)) + if (IS_ERR(qmp->pcs_misc)) dev_vdbg(dev, "PHY pcs_misc-reg not used\n"); generic_phy = devm_phy_create(dev, np, &qcom_qmp_ufs_ops); if (IS_ERR(generic_phy)) { ret = PTR_ERR(generic_phy); - dev_err(dev, "failed to create qphy %d\n", ret); + dev_err(dev, "failed to create PHY: %d\n", ret); return ret; } - qphy->phy = generic_phy; - qphy->qmp = qmp; - qmp->phys[id] = qphy; - phy_set_drvdata(generic_phy, qphy); + qmp->phy = generic_phy; + phy_set_drvdata(generic_phy, qmp); return 0; } static int qmp_ufs_probe(struct platform_device *pdev) { - struct qcom_qmp *qmp; struct device *dev = &pdev->dev; struct device_node *child; struct phy_provider *phy_provider; void __iomem *serdes; const struct qmp_phy_cfg *cfg = NULL; + struct qmp_ufs *qmp; int num, id; int ret; @@ -1120,14 +1079,10 @@ static int qmp_ufs_probe(struct platform_device *pdev) if (num > 1) return -EINVAL; - qmp->phys = devm_kcalloc(dev, num, sizeof(*qmp->phys), GFP_KERNEL); - if (!qmp->phys) - return -ENOMEM; - id = 0; for_each_available_child_of_node(dev->of_node, child) { /* Create per-lane phy */ - ret = qmp_ufs_create(dev, child, id, serdes, cfg); + ret = qmp_ufs_create(dev, child, serdes, cfg); if (ret) { dev_err(dev, "failed to create lane%d phy, %d\n", id, ret); From patchwork Mon Oct 24 09:00:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8256 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp335418wru; Mon, 24 Oct 2022 02:04:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM43H9VfeoAYP2T9jnuoL4vvlBiReGpxWK17Ch8boO2IHlRxN0q98sDgKvtu+QRBoRS3Gb/y X-Received: by 2002:a17:907:7627:b0:78d:b6f5:9f15 with SMTP id jy7-20020a170907762700b0078db6f59f15mr26912316ejc.149.1666602259531; Mon, 24 Oct 2022 02:04:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666602259; cv=none; d=google.com; s=arc-20160816; b=k1OM5tJ+YxbGDpkqCkbkNeeTSRZGV8UZ/vPNAHbZdG205fv+AVJ1n8P1ehxsYlqw7S qCNfbxRkFuHrM7C2tqqZmATTdiOkaBlRrjaWNxvWDGYKqU17uIRP12zX0C6IKtZGaXs+ qPWkx4t0qurfAL0c8R9TmhJ5PWKBIl4PxWWoF5ranPcUII8bFHLMN7NyMJUTN8rM+vA7 HWnsyIQ3eH+nOtE7z7Aoz+8lo1HuA23r851gFMtYRnlS/Imo3yCcyDQGR4r5oSUvw9OT UeyeBPY5qm0ImbHvII1GeNHsKg+i+tDBGDs/jwrrkajTqAkLaAV1J+njY50VmV1+R7hM PO6Q== 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=MLV3JHsKEBAvGjplut/QX4ROz0obncaOekJpJerFCMM=; b=xlaboHBQH8MCZsQ6YVKrk7lmHlg8uT0rpkCIc8fg0MDwdrwCbR4Hg36jKRMXTz/RJv hKFbuADLtOwz1350gXhaAg3OAH8yVFUvzhe60K31MuZR7yUQr7VvsyPEHd/p0vQMuH39 cnyG8oiXF0ufggpVWVZgSUK3dpCruXgeOwkfV/U2gBriRBX13LTbhDMsJu53EGhXDnCU +GpjUsm4zv8m34dgVDnen558l7PRTgwLfhPAaJZcvuT0l1JEGEPUllMRuZo5QoovYI+h hmn6wQduOJO2wOM+zrCkUfaXvaP4euAcXNyRNlM4FpdY7nV05h9EPfRpt4HawP9y86xC tIiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mLLwT6sM; 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 du9-20020a17090772c900b0078df185078esi18793979ejc.663.2022.10.24.02.03.53; Mon, 24 Oct 2022 02:04:19 -0700 (PDT) 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=mLLwT6sM; 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 S230209AbiJXJBp (ORCPT + 99 others); Mon, 24 Oct 2022 05:01:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbiJXJBk (ORCPT ); Mon, 24 Oct 2022 05:01:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B62FA3AE5F; Mon, 24 Oct 2022 02:01:38 -0700 (PDT) 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 52CD36108B; Mon, 24 Oct 2022 09:01:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A619EC433C1; Mon, 24 Oct 2022 09:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666602097; bh=Cv1cUkVYs6lIJWVxJOjj6NKJUi/gghBkbGA1cKOYu9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mLLwT6sMxfenDfX4tcDm2PaQXNlVEFVJwtuypGtXPQniC5s9bqGb7gB6MtcBuNNgL 9qWTXne0nIz0Ocse0smIy7dn40XwEaVfLSG6NmwPC2gNezymw79tA98IiU0B9J2bos p5sh1ohw8uPWHVkzgc3IUK5Ma8kFyoQGGOQut53UZsZqpUjtZPt4I1A0F2tZafuSD6 /y4qgDUGyAVMXmN94wpTwtlavwJcraeNDzauSNs6zTmwG7yYm+BJhkiXiz0epcgQba LC2h0hJ/pTwm7D8coyeqplree5nlar6+Xo25Nv3jGVHDWeMF8ZsWR/KfxQxyvZI5Q1 zV+84a9ElNYaw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omtKj-00056R-7X; Mon, 24 Oct 2022 11:01:21 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 03/10] phy: qcom-qmp-ufs: clean up device-tree parsing Date: Mon, 24 Oct 2022 11:00:34 +0200 Message-Id: <20221024090041.19574-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024090041.19574-1-johan+linaro@kernel.org> References: <20221024090041.19574-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747559131116378299?= X-GMAIL-MSGID: =?utf-8?q?1747559131116378299?= Since the QMP driver split there will be at most a single child node so drop the obsolete iteration construct. While at it, drop the verbose error logging that would have been printed also on probe deferrals. Note that there's no need to check if there are additional child nodes (the kernel is not a devicetree validator), but let's return an error if there are no child nodes at all for now. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c index b4c3b3d97f52..25744b3576f3 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c @@ -1048,7 +1048,6 @@ static int qmp_ufs_probe(struct platform_device *pdev) void __iomem *serdes; const struct qmp_phy_cfg *cfg = NULL; struct qmp_ufs *qmp; - int num, id; int ret; qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL); @@ -1074,23 +1073,15 @@ static int qmp_ufs_probe(struct platform_device *pdev) if (ret) return ret; - num = of_get_available_child_count(dev->of_node); - /* do we have a rogue child node ? */ - if (num > 1) + child = of_get_next_available_child(dev->of_node, NULL); + if (!child) return -EINVAL; - id = 0; - for_each_available_child_of_node(dev->of_node, child) { - /* Create per-lane phy */ - ret = qmp_ufs_create(dev, child, serdes, cfg); - if (ret) { - dev_err(dev, "failed to create lane%d phy, %d\n", - id, ret); - goto err_node_put; - } + ret = qmp_ufs_create(dev, child, serdes, cfg); + if (ret) + goto err_node_put; - id++; - } + of_node_put(child); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); From patchwork Mon Oct 24 09:00:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8259 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp335622wru; Mon, 24 Oct 2022 02:04:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79LEkchZgZokmxJw4yPSPYxH1IgNb7S9azHagWH1e08cHz2zhLMd/nC4nWZzPftyRk2sUq X-Received: by 2002:a17:907:5c2:b0:77e:def7:65d8 with SMTP id wg2-20020a17090705c200b0077edef765d8mr26990379ejb.487.1666602295053; Mon, 24 Oct 2022 02:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666602295; cv=none; d=google.com; s=arc-20160816; b=DnFbOX5/+Dl3strYCucqcmQlOL4AlC/P/bwjGpJ3OqIpgcmWMB+g1LxLMOnso+4+iZ lAwPod33jjueutWFcPa5MTUBjbnRtmQtp6E/5RYQcfHtpXuqPWltiFzazxyO5LS4hmra jJWuXWla8azlqv44pKpfCrkuN7If/FD+uhQHbwdg5uvm+BkliTDKMHsM5vDIxksTLTDe zlHTvYlvN3eIgvV1mhKUEXEC6sGio+YdmCfGhUShVTLKR2Z7TzEsFnfxu0tIgAv0z83J /RX9FHCkoug0ENYjTr0pPFGJk5zhrBO8BxVN/PusWc+I2fX6Ixhbawxfhjj4xyTjhRnr QU2Q== 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=HhYGp3xj4fETUdoi6c4BpQ6p+BS7FEs9YxaRow5bRfw=; b=hqbiJldzNxPeYTFpWv76IxBhlDH0m8V6e5tlQAqdlZ4QEe48HSs0FpVm0UJYdMi4cV LapM3gTwzkB1syoTDyyI/OZCrOFKUI71UAbeBnBfsFNOdGOfDunl5DK1Z2uYOOWxcZYC wZq/HFWLML+KBs5BD2WNIRYcutTynYHRm6MpuyIBtOwT1OWt8xN2L3ZYS4V66CYEmqIp MyDX9PwDPaoBd4T28dcIyxdGeEqLcvo5Ld1tfcGfJqUjfPmo95Cy34UNE0n7jvI65XW7 TMzNpSFJZQx+uns2RLfaQTHWEHoy1chIzCGsiD2WKJPdc+LlofQvJaiFS0ij/MFx05/3 4erw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dvo6dhRO; 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 hq8-20020a1709073f0800b0078c37681f89si33614774ejc.650.2022.10.24.02.04.30; Mon, 24 Oct 2022 02:04:55 -0700 (PDT) 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=dvo6dhRO; 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 S229544AbiJXJCA (ORCPT + 99 others); Mon, 24 Oct 2022 05:02:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229874AbiJXJBk (ORCPT ); Mon, 24 Oct 2022 05:01:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 622F94DB46; Mon, 24 Oct 2022 02:01:39 -0700 (PDT) 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 E44DF61090; Mon, 24 Oct 2022 09:01:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEA06C43147; Mon, 24 Oct 2022 09:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666602097; bh=kUu1wS6SClje+mygFdWFEMGHxt8IMZqWUdrDHplK5nY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dvo6dhROYScXXqv0k2xgGWLSEeqM6ukZdFGsRK4Z0Mnpr4aAidbU3mSDuKq3PFiwy 5NIJojb+xTo15iRn0PyhN0LCbzoNxFwxLOj1D5K9TQOOCjxhL+w/LoAHo8jg9adzq6 BJFssNvdQmcT1+Jv1JPEwVLiVkI5OGRWt1Z2p1BYJo9YKMpe8rf5fp1utslcyoQihs VQhyD+MiXbmkJPgb1mzskEj4hJhFheroEmiDdAiSAN+eZS3kXHkaf4LvA95ZZ96aQu cZglcLoumMk36/Zt3QcwhH7cqqgQ16XlrYFQu0KvaRG9Cyd/iaXxHmPTdluSOSNbC3 oZJkssKTDICEA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omtKj-00056T-Ao; Mon, 24 Oct 2022 11:01:21 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 04/10] phy: qcom-qmp-ufs: clean up probe initialisation Date: Mon, 24 Oct 2022 11:00:35 +0200 Message-Id: <20221024090041.19574-5-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024090041.19574-1-johan+linaro@kernel.org> References: <20221024090041.19574-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747559168158006300?= X-GMAIL-MSGID: =?utf-8?q?1747559168158006300?= Stop abusing the driver data pointer and instead pass the driver state structure directly to the initialisation helpers during probe. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 37 ++++++++++++------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c index 25744b3576f3..057f9a3fdd6d 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c @@ -945,9 +945,10 @@ static int qmp_ufs_disable(struct phy *phy) return qmp_ufs_exit(phy); } -static int qmp_ufs_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg) +static int qmp_ufs_vreg_init(struct qmp_ufs *qmp) { - struct qmp_ufs *qmp = dev_get_drvdata(dev); + const struct qmp_phy_cfg *cfg = qmp->cfg; + struct device *dev = qmp->dev; int num = cfg->num_vregs; int i; @@ -961,9 +962,10 @@ static int qmp_ufs_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg) return devm_regulator_bulk_get(dev, num, qmp->vregs); } -static int qmp_ufs_clk_init(struct device *dev, const struct qmp_phy_cfg *cfg) +static int qmp_ufs_clk_init(struct qmp_ufs *qmp) { - struct qmp_ufs *qmp = dev_get_drvdata(dev); + const struct qmp_phy_cfg *cfg = qmp->cfg; + struct device *dev = qmp->dev; int num = cfg->num_clks; int i; @@ -983,15 +985,13 @@ static const struct phy_ops qcom_qmp_ufs_ops = { .owner = THIS_MODULE, }; -static int qmp_ufs_create(struct device *dev, struct device_node *np, - void __iomem *serdes, const struct qmp_phy_cfg *cfg) +static int qmp_ufs_create(struct qmp_ufs *qmp, struct device_node *np) { - struct qmp_ufs *qmp = dev_get_drvdata(dev); + const struct qmp_phy_cfg *cfg = qmp->cfg; + struct device *dev = qmp->dev; struct phy *generic_phy; int ret; - qmp->cfg = cfg; - qmp->serdes = serdes; /* * Get memory resources for the PHY: * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2. @@ -1045,8 +1045,6 @@ static int qmp_ufs_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *child; struct phy_provider *phy_provider; - void __iomem *serdes; - const struct qmp_phy_cfg *cfg = NULL; struct qmp_ufs *qmp; int ret; @@ -1055,21 +1053,20 @@ static int qmp_ufs_probe(struct platform_device *pdev) return -ENOMEM; qmp->dev = dev; - dev_set_drvdata(dev, qmp); - cfg = of_device_get_match_data(dev); - if (!cfg) + qmp->cfg = of_device_get_match_data(dev); + if (!qmp->cfg) return -EINVAL; - serdes = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(serdes)) - return PTR_ERR(serdes); + qmp->serdes = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(qmp->serdes)) + return PTR_ERR(qmp->serdes); - ret = qmp_ufs_clk_init(dev, cfg); + ret = qmp_ufs_clk_init(qmp); if (ret) return ret; - ret = qmp_ufs_vreg_init(dev, cfg); + ret = qmp_ufs_vreg_init(qmp); if (ret) return ret; @@ -1077,7 +1074,7 @@ static int qmp_ufs_probe(struct platform_device *pdev) if (!child) return -EINVAL; - ret = qmp_ufs_create(dev, child, serdes, cfg); + ret = qmp_ufs_create(qmp, child); if (ret) goto err_node_put; From patchwork Mon Oct 24 09:00:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8269 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp336929wru; Mon, 24 Oct 2022 02:07:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ltRkAtFkgb9N/C6xLKbhbs1nVTSLiKV+zcKTBJSN75qlPew3vq8UERw44Mw1dfrDip4tK X-Received: by 2002:a17:906:3fd2:b0:78d:b793:5ef9 with SMTP id k18-20020a1709063fd200b0078db7935ef9mr25773259ejj.496.1666602475197; Mon, 24 Oct 2022 02:07:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666602475; cv=none; d=google.com; s=arc-20160816; b=EiXcgIJWe7LEQAXyU2wMScN1onrjDwGD/QrdI08AALU2hKbIyZJSrjgj816G8p/Zsf BUbrKct2qePNvSmxyRsm9jQWyuBi2JiGSfSVRSFooDbzY511nY8jWzvgjpXyI2LRtO2W C4zoleZ1JDOQPE7DzWMo5dLu3O7rp31AehB7eiyme9XKNZWf8FVeIKSaIh+Ph9suHZaS vGTVr3vShjS1e8m2Er3rHD/O07J8fNwP7JEV9hYCkCsnykO6fFJ6XbQixEjR9q9ZgsfZ 6a+3rIBRVNN3uXbyDBeiufHXcrpjYVCwXyfDOUkRugCVxIwKgFlx4lD93xVJ1CN2DgK2 mAHQ== 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=nVSswn3j1buVGYFnUSaLz2g8i4jpWAv4ksdAEOgM/RE=; b=XnpqfnujEsrDhQ8NVNl5e/niKL6JOixTjzvVWQBeBRu1KBD8wOTQyvKoc1BDcGn+/o FnjD9nLqPtruBV+Hz5h5w616pWxzPwI/jaa3JUaUqWDSquMhTdQ4CDk3n0wFgOZGI7vW AOjKLUjFoAUBytEnT8HeAzNj/y6KcrrSR34CimKQ2Gh/me9Snljv91/hMQA2n8tPrP9J 9fkH7PAZWsCoWZ+1z43yRFwl0S5PhvY3eF8jEg0SF+L6jEgtEfqHSy/7OjMNRAVQnyfs 9TQq20a1EK/tmcdRMRMrbSypRQTVrtMXUs0t836oyZm5ajG8tWK6Or8sw/ICuR1j6kKU 0HsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NHEk0KKM; 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 qa6-20020a170907868600b007836ec6999dsi28412500ejc.904.2022.10.24.02.07.31; Mon, 24 Oct 2022 02:07:55 -0700 (PDT) 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=NHEk0KKM; 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 S230062AbiJXJCm (ORCPT + 99 others); Mon, 24 Oct 2022 05:02:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbiJXJBm (ORCPT ); Mon, 24 Oct 2022 05:01:42 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C37A53FA10; Mon, 24 Oct 2022 02:01:41 -0700 (PDT) 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 sin.source.kernel.org (Postfix) with ESMTPS id 22800CE11E3; Mon, 24 Oct 2022 09:01:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4EF7C43140; Mon, 24 Oct 2022 09:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666602097; bh=Tmh6pbvKpEc0/eNCkRs724u74bdzB1yjPkgJEJk9y9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NHEk0KKMkMiHpQe3w3rT7WYhnEGnTXW+mVHEo9TmKYvbOrw+cHSBW1Wmw3dhrXHTv 6yxYd+9WRqENiFr7/6oYDQzY+b/SbmLh36Chk3tv4CalCCwk/ib7zOo7BSwD8dokQr cwtUrZjJqWgjXAGMeUZUs4JEzpViRa4KGcC9fzlg8e2+vAOENgYp9i5k5kcTniCZ0Z e+74HtyeXhkstvDz1O9beziqkyjGi69C4TVUAViBNZMa9otuHqrYxydAKyunqZ6jWn kgPWda7XE106CABlC8tLmVRSg8iCLXuujN6Zoy+0I8fxkaEa6j5Da80ENNLow3OQNL aMdlABSt5cD6w== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omtKj-00056X-E1; Mon, 24 Oct 2022 11:01:21 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 05/10] phy: qcom-qmp-ufs: rename PHY ops structure Date: Mon, 24 Oct 2022 11:00:36 +0200 Message-Id: <20221024090041.19574-6-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024090041.19574-1-johan+linaro@kernel.org> References: <20221024090041.19574-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747559356872661706?= X-GMAIL-MSGID: =?utf-8?q?1747559356872661706?= Rename the PHY operation structure so that it has a "phy_ops" suffix and move it next to the implementation. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c index 057f9a3fdd6d..90583b87efd1 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c @@ -945,6 +945,12 @@ static int qmp_ufs_disable(struct phy *phy) return qmp_ufs_exit(phy); } +static const struct phy_ops qcom_qmp_ufs_phy_ops = { + .power_on = qmp_ufs_enable, + .power_off = qmp_ufs_disable, + .owner = THIS_MODULE, +}; + static int qmp_ufs_vreg_init(struct qmp_ufs *qmp) { const struct qmp_phy_cfg *cfg = qmp->cfg; @@ -979,12 +985,6 @@ static int qmp_ufs_clk_init(struct qmp_ufs *qmp) return devm_clk_bulk_get(dev, num, qmp->clks); } -static const struct phy_ops qcom_qmp_ufs_ops = { - .power_on = qmp_ufs_enable, - .power_off = qmp_ufs_disable, - .owner = THIS_MODULE, -}; - static int qmp_ufs_create(struct qmp_ufs *qmp, struct device_node *np) { const struct qmp_phy_cfg *cfg = qmp->cfg; @@ -1027,7 +1027,7 @@ static int qmp_ufs_create(struct qmp_ufs *qmp, struct device_node *np) if (IS_ERR(qmp->pcs_misc)) dev_vdbg(dev, "PHY pcs_misc-reg not used\n"); - generic_phy = devm_phy_create(dev, np, &qcom_qmp_ufs_ops); + generic_phy = devm_phy_create(dev, np, &qcom_qmp_ufs_phy_ops); if (IS_ERR(generic_phy)) { ret = PTR_ERR(generic_phy); dev_err(dev, "failed to create PHY: %d\n", ret); From patchwork Mon Oct 24 09:00:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8270 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp336934wru; Mon, 24 Oct 2022 02:07:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4WqRJjPIXMFaGKxwyO2OjXGY3k3DOVwb/fD5mLBkxNu4BFG72WE9PavKXj4ToCAEe9IkdG X-Received: by 2002:a17:907:9611:b0:78d:bb06:90a3 with SMTP id gb17-20020a170907961100b0078dbb0690a3mr26749386ejc.233.1666602465276; Mon, 24 Oct 2022 02:07:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666602465; cv=none; d=google.com; s=arc-20160816; b=bonmA8nG4L/zriBgpyBg5tHezl2xtGySCm4TllPERWro/P65A0fffi7bUXqJ3U+Eqp kJbHa+Uz2O9e+YtWJif+Nv9XfkQgoPwWDso2dBMaZ/HK36Gayt/MTDnG1Ml0d7C5Y0Dy X4u6i9bXp2jcR71/tzgDK9wg3r8G+/T/cqkGovPeTmT8UF9lsX4P1Ut1npaZZCxq3rxv QwgiFgIiSuKBO6HxyOPRG48idEbkGKlxjSLi7567hGGWqnxZ7l8edHMjsq4gfFs55mH7 04GVLTc2yQZGkRVnXvn+5/30JN+P86bgyRNUZJq00afEdSQ1/zBy6KPHcbu7DGVjFnOH Nshg== 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=lfSe3wOUbFFAux5wQDGvL2H8hi9huPKKmeLtqSv8udc=; b=pP2T8m6Qa3hTGBPjSq9Q4O/tQlrHFByvgUhZvApPx+ndhnYnHV1ctk+z8mxAMG92Az /TsOyJKH01SyWiANMKvGbMclBMGezcAjrsp0ygzBN4EkcidzWxQ0ukMApxIhzW11nl6e XojIhs3vVHSOcmzcL/aqmDsU3tEyWA2e0lV6vfbKiC2JaBNptnflOon33R6ibH+RvLm9 fUXhwoJfavJ0TSYs+oof70bNm3APrfcsnuKq4fmXMPkiQC1hKXIaTK3Ds8LT0wPpFFdQ xCE3UAnEritP3howIsaXi3MqyG05tGZdSdmTf1GleVznNfi0xJSAcV1T0AiuU32IkqxN xexA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EEQJiv8E; 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 dp17-20020a170906c15100b00793988d8dc7si15932316ejc.351.2022.10.24.02.07.19; Mon, 24 Oct 2022 02:07:45 -0700 (PDT) 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=EEQJiv8E; 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 S231144AbiJXJCd (ORCPT + 99 others); Mon, 24 Oct 2022 05:02:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230029AbiJXJBm (ORCPT ); Mon, 24 Oct 2022 05:01:42 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06263236; Mon, 24 Oct 2022 02:01:40 -0700 (PDT) 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 sin.source.kernel.org (Postfix) with ESMTPS id 62BF7CE11D9; Mon, 24 Oct 2022 09:01:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B09B2C433B5; Mon, 24 Oct 2022 09:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666602097; bh=g6UD0qYqIr8RCrOv0xEU22lm63plP68e+mK5h1Jr0Ss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EEQJiv8EDidsXDfSI/YpKBHoeIGHyq9VuUZOkzJoKDIIOEi3COs2YLXLLailrja26 KMTd9OFbQY4idO9IvCoo93rW4gXymvDbMH8zxbuIQUtryh5RPjghkrqamZr724P7S1 /NEmYUraEdhYN6Tv7pnVbqLWx2g33mIPv5m2daBVWiySyib5RI5QlapN/lagSjNoei zXqYcopUeyndZh+k6x8MXBMI8CTrHeVeJfFuGEUakJk0XEkKtEVhO8rJLEXHrtnKdA BAjKORnNo5LimuVQYcsKUTg477gJxfL0fO9tmRd+WAuoWAeL10/gUiL5+DqgmepJsE 6rekbNURYYF6w== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omtKj-00056Z-GX; Mon, 24 Oct 2022 11:01:21 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 06/10] phy: qcom-qmp-ufs: clean up PHY init Date: Mon, 24 Oct 2022 11:00:37 +0200 Message-Id: <20221024090041.19574-7-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024090041.19574-1-johan+linaro@kernel.org> References: <20221024090041.19574-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747559346415414181?= X-GMAIL-MSGID: =?utf-8?q?1747559346415414181?= Clean up the PHY initialisation somewhat programming both tx and rx for the second lane after the first lane. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c index 90583b87efd1..fa703e856eb7 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c @@ -859,14 +859,12 @@ static int qmp_ufs_power_on(struct phy *phy) /* Tx, Rx, and PCS configurations */ qmp_ufs_configure_lane(tx, cfg->tx_tbl, cfg->tx_tbl_num, 1); - - if (cfg->lanes >= 2) - qmp_ufs_configure_lane(qmp->tx2, cfg->tx_tbl, cfg->tx_tbl_num, 2); - qmp_ufs_configure_lane(rx, cfg->rx_tbl, cfg->rx_tbl_num, 1); - if (cfg->lanes >= 2) + if (cfg->lanes >= 2) { + qmp_ufs_configure_lane(qmp->tx2, cfg->tx_tbl, cfg->tx_tbl_num, 2); qmp_ufs_configure_lane(qmp->rx2, cfg->rx_tbl, cfg->rx_tbl_num, 2); + } qmp_ufs_configure(pcs, cfg->pcs_tbl, cfg->pcs_tbl_num); From patchwork Mon Oct 24 09:00:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8263 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp336328wru; Mon, 24 Oct 2022 02:06:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5zBYe2q3zV6GbMBhZkYgf+oWPlbATxc8inTZ8stB6igDzF3SlwL8nRPnZz6xmKivVs6Bib X-Received: by 2002:a17:906:5dce:b0:78d:e71a:6e0 with SMTP id p14-20020a1709065dce00b0078de71a06e0mr26185305ejv.360.1666602390833; Mon, 24 Oct 2022 02:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666602390; cv=none; d=google.com; s=arc-20160816; b=rirVKuAM43tuTFXoiD1TqoQljipv1TOYYCmr7sIlfJhlV8NbcRFqIwXe462r1Ee6pZ l+umbx911RAMnJBs8jH/Q4MujtLx8uWPVOdhymNq9HBN99Kv7eKGh6w3z05zmnAoK5WA 9UBqCqg5Vxc444TO5efyQX9/q4DMuyoCoXbSHVPLx2JStNnBQGQFa80DEALMg1Sji0vC DkAmrhHF7vH8HrZNNFUqBQeKm324Jyd9NWWcj8E6yqD/32kfAzdw5Dp1YVIFtjr+Ee6N BJ0EHaa9ohZbJF4TQTIuIpLUWtGTtS5bf8SYZcrqrbdSQISGzI+K7ppkSzAzQErWnPN1 RYNA== 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=o/qtFvXlDb1VsPkhtF8x55LTJAnqlEU4oBD+thFYUAg=; b=iHBkmdr25PjBhkoFlLWRAP+5XIT1g2JjjgpcWQ38kg1kE1Q1O4ZJnnMDYPeUTpIHTx ScrdBzwTN/Ou8OVQJJ/+MO1VWzRFqL4z0zzNUpTFuVIhE36g5rJ9lwujCmFTKLpv2yd8 PUFkgjIo2vNlXEd1IKeAnsVGmOIDz2vOVFm4FqPzBMdtGdgv2tl0zxS5Lr5t2zOfUaKz JnQU0ph+p0FApiWEyET/hf9FsT9m+rlc0ZZDzsKudo2wzrTcs4ycvI3JfYNxYTPvURDX YemzDoC0CZi7RqM8FKmHXGIO7VF0FAE+xMaP+7Uu+5ylnjEhqHRLzpRUDTvhx08SDG/S 5WAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FJWz98zG; 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 ne38-20020a1709077ba600b00788a70eed08si7400842ejc.610.2022.10.24.02.06.07; Mon, 24 Oct 2022 02:06:30 -0700 (PDT) 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=FJWz98zG; 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 S229823AbiJXJB4 (ORCPT + 99 others); Mon, 24 Oct 2022 05:01:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbiJXJBk (ORCPT ); Mon, 24 Oct 2022 05:01:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF3AE3FA10; Mon, 24 Oct 2022 02:01:38 -0700 (PDT) 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 639AE61074; Mon, 24 Oct 2022 09:01:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6AF2C433D6; Mon, 24 Oct 2022 09:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666602097; bh=1R8yc2SvpelM4g9C9noqmpA7ytRQEi/9AxHWjzgCCh4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FJWz98zG/8SirD1vmMVimK6hokJbTYRDN0VAclAod/ETzOtagNFh2VhHILda7QLMs oPWmQYuqk8m9PRnQmJSeEZ7bCmSWYxpDgmCBVgCSVNYzJZHBUxB/nUNqhmy/aQmBfQ jmieLmOuebof374xYSluHKKyyr2QBVY1Dp9swfhilk+ApCTp53HOt0dbtkDgRTqSii 0I2zmSi9zXwR7zsPCcjMnWFETweIUlH8FMkzg3kXoOx0P8G5TagNHPnRqUEDuC00lv LFUSaBrCGTF0ID/9gxTzsKk1Gcg2kytW1Wja1v2frAxPCGmafRntWunDKzbJZIX/5+ sEvm4ASJddQWg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omtKj-00056c-JS; Mon, 24 Oct 2022 11:01:21 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 07/10] dt-bindings: phy: qcom,qmp-ufs: rename current bindings Date: Mon, 24 Oct 2022 11:00:38 +0200 Message-Id: <20221024090041.19574-8-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024090041.19574-1-johan+linaro@kernel.org> References: <20221024090041.19574-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747559268266771702?= X-GMAIL-MSGID: =?utf-8?q?1747559268266771702?= The current QMP UFS PHY bindings are based on the original MSM8996 PCIe PHY binding which provided multiple PHYs per IP block and these in turn were described by child nodes. The QMP UFS PHY block only provide a single PHY and the remnant child node does not really reflect the hardware. The original MSM8996 binding also ended up describing the individual register blocks as belonging to either the wrapper node or the PHY child nodes. This is an unnecessary level of detail which has lead to problems when later IP blocks using different register layouts have been forced to fit the original mould rather than updating the binding. The bindings are arguable also incomplete as they only the describe register blocks used by the current Linux drivers. In preparation for adding new bindings for SC8280XP which further bindings can be based on, rename the current bindings after MSM8996 and add a reference to the SC8280XP bindings. Signed-off-by: Johan Hovold Reviewed-by: Krzysztof Kozlowski --- ...qcom,qmp-ufs-phy.yaml => qcom,msm8996-qmp-ufs-phy.yaml} | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) rename Documentation/devicetree/bindings/phy/{qcom,qmp-ufs-phy.yaml => qcom,msm8996-qmp-ufs-phy.yaml} (95%) diff --git a/Documentation/devicetree/bindings/phy/qcom,qmp-ufs-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-ufs-phy.yaml similarity index 95% rename from Documentation/devicetree/bindings/phy/qcom,qmp-ufs-phy.yaml rename to Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-ufs-phy.yaml index 815c375d0f7b..438f9606414a 100644 --- a/Documentation/devicetree/bindings/phy/qcom,qmp-ufs-phy.yaml +++ b/Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-ufs-phy.yaml @@ -1,10 +1,10 @@ # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/phy/qcom,qmp-ufs-phy.yaml# +$id: http://devicetree.org/schemas/phy/qcom,msm8996-qmp-ufs-phy.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Qualcomm QMP PHY controller (UFS) +title: Qualcomm QMP PHY controller (UFS, MSM8996) maintainers: - Vinod Koul @@ -13,6 +13,9 @@ description: QMP PHY controller supports physical layer functionality for a number of controllers on Qualcomm chipsets, such as, PCIe, UFS, and USB. + Note that these bindings are for SoCs up to SC8180X. For newer SoCs, see + qcom,sc8280xp-qmp-ufs-phy.yaml. + properties: compatible: enum: From patchwork Mon Oct 24 09:00:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8267 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp336805wru; Mon, 24 Oct 2022 02:07:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6d7Y2qNsnDcbECCN3eQxRw0me94Afl+kp+zGn8bWwZQLWgVdxkLYBDZ3EspxgC0Zfl+pg9 X-Received: by 2002:a17:907:2c59:b0:7a9:1134:db02 with SMTP id hf25-20020a1709072c5900b007a91134db02mr2295849ejc.508.1666602457692; Mon, 24 Oct 2022 02:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666602457; cv=none; d=google.com; s=arc-20160816; b=NajY/ldnFMi0pWDJGhb43s+/m0pgBX7u9AOLIYzWMS9G1+0j9RMwYx5EBAA2buReNg t7+PeA3aJ6+ZaQAisg5/IHtijUNzn8a0nNUz4XUI1lg92iQcEhZx0x0mWINw/SeHpsuK sQZEP64Mn62UmBzTboqfJjeCcms42eKJ58rt7hZieF9aH3MjbGfLtuH4Wz4IC4XuyrCK kH6U7jR8xfUQzMkTYedJxWYlDtwx0KtARcb7hDBHG4wXOm119R5j3zhwchkg+jO9K0IC OPWjbq3LrpOHlDLWRWjYKLvT0KObbt4RCTzcBSnMW9yiAefxsgSzgzY5Qa0k+avEXtJw GIuA== 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=TAh8AEk7MMZCh9VY+Swj5cWI1NTIdCJJzvWso6jvH0M=; b=jEgtmQrQH67kxxR8q9HRiUOmGU5iW82FxiuNtaEuM12/1DIRiu7NcuwVF5Rgpfdn9+ PGnRSbSv4mnf5HMxK0Hev/KnmLqsqim20gyjyqzz2+2kc0Ej5y+/rc/ZWS3WQCrS7H95 ZCaVOkt5aCcVj84NHexJR0I3zNx4DXFMRkbTx8gnvCUanj2w//2xeFkp9JHskP+cE3jI B32xK1m5nDDoV+vkTUgSWKd706lElyF7sx7iuihkCvjYQGPj0wl/7RlXAnDR12Yp/AIg ocA1BIcxJYwVjXRxDY23aRqMNWApzi+mb5LeX2O8JaWbCogT3aDmiu99lKKtIxwrXE24 /AVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JEzrhd5+; 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 c26-20020a056402159a00b0046189831142si5196637edv.7.2022.10.24.02.07.13; Mon, 24 Oct 2022 02:07:37 -0700 (PDT) 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=JEzrhd5+; 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 S230472AbiJXJCV (ORCPT + 99 others); Mon, 24 Oct 2022 05:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230012AbiJXJBl (ORCPT ); Mon, 24 Oct 2022 05:01:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5E064E19D; Mon, 24 Oct 2022 02:01:39 -0700 (PDT) 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 08C2C61092; Mon, 24 Oct 2022 09:01:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1145EC4FEBE; Mon, 24 Oct 2022 09:01:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666602098; bh=+WkGHWoLZtDbhsbGRmzXKHjD/rB4ftzUCrvrsjeND8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JEzrhd5+5POIVX4OipjaIv2tUjNV+1BnXX31ZbFe+6VVJa0QvKcDsPkGPMHXTt9kG B9DmbrTIowiNObhzhPI1E2RcuXzYyzoa1j+hJ4GBDj0i3NFwgKi0qsmPgyvFOR5dyB l94LVPpYUu0WFlSkLMjrKKSClrG9YWAfgDAB5RX9zTt7YDxFU1o06bwY1Z+vPW+SjX Q5K4tJ/Wwcz/+6QYp0qKym6oKBFNEKy/vXEnOBc+hzIAuvbARCVhFV2OXIvbXuW/nh fYx+XwYf+aLevQU/fKpn+PR++WsVuvh4CNJYcZj/67RhAdUTk/snWmfE39kfWiX8bY 50kIj+CvzTkaQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omtKj-00056g-Mj; Mon, 24 Oct 2022 11:01:21 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 08/10] dt-bindings: phy: qcom,qmp-ufs: fix sc8280xp binding Date: Mon, 24 Oct 2022 11:00:39 +0200 Message-Id: <20221024090041.19574-9-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024090041.19574-1-johan+linaro@kernel.org> References: <20221024090041.19574-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747559338706311651?= X-GMAIL-MSGID: =?utf-8?q?1747559338706311651?= The current QMP UFS PHY bindings are based on the original MSM8996 PCIe PHY binding which provided multiple PHYs per IP block and these in turn were described by child nodes. The QMP UFS PHY block only provide a single PHY and the remnant child node does not really reflect the hardware. The original MSM8996 binding also ended up describing the individual register blocks as belonging to either the wrapper node or the PHY child nodes. This is an unnecessary level of detail which has lead to problems when later IP blocks using different register layouts have been forced to fit the original mould rather than updating the binding. The bindings are arguable also incomplete as they only the describe register blocks used by the current Linux drivers. Add a new binding for the UFS QMP PHYs found on SC8280XP which further bindings can be based on. Note that the current binding is simply removed instead of being deprecated as it was only recently merged and support for SC8280XP is still under development. Signed-off-by: Johan Hovold Reviewed-by: Krzysztof Kozlowski --- .../phy/qcom,msm8996-qmp-ufs-phy.yaml | 10 +-- .../phy/qcom,sc8280xp-qmp-ufs-phy.yaml | 83 +++++++++++++++++++ 2 files changed, 87 insertions(+), 6 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-ufs-phy.yaml diff --git a/Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-ufs-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-ufs-phy.yaml index 438f9606414a..be41acbd3b6c 100644 --- a/Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-ufs-phy.yaml +++ b/Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-ufs-phy.yaml @@ -22,7 +22,6 @@ properties: - qcom,msm8996-qmp-ufs-phy - qcom,msm8998-qmp-ufs-phy - qcom,sc8180x-qmp-ufs-phy - - qcom,sc8280xp-qmp-ufs-phy - qcom,sdm845-qmp-ufs-phy - qcom,sm6115-qmp-ufs-phy - qcom,sm6350-qmp-ufs-phy @@ -122,7 +121,6 @@ allOf: enum: - qcom,msm8998-qmp-ufs-phy - qcom,sc8180x-qmp-ufs-phy - - qcom,sc8280xp-qmp-ufs-phy - qcom,sdm845-qmp-ufs-phy - qcom,sm6115-qmp-ufs-phy - qcom,sm6350-qmp-ufs-phy @@ -159,7 +157,6 @@ allOf: contains: enum: - qcom,msm8998-qmp-ufs-phy - - qcom,sc8280xp-qmp-ufs-phy - qcom,sdm845-qmp-ufs-phy - qcom,sm6350-qmp-ufs-phy - qcom,sm8150-qmp-ufs-phy @@ -214,11 +211,12 @@ allOf: examples: - | - #include + #include #include + phy-wrapper@1d87000 { - compatible = "qcom,sc8280xp-qmp-ufs-phy"; - reg = <0x01d87000 0xe10>; + compatible = "qcom,sm8250-qmp-ufs-phy"; + reg = <0x01d87000 0x1c0>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x01d87000 0x1000>; diff --git a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-ufs-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-ufs-phy.yaml new file mode 100644 index 000000000000..dde86a19f792 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-ufs-phy.yaml @@ -0,0 +1,83 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/qcom,sc8280xp-qmp-ufs-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm QMP PHY controller (UFS, SC8280XP) + +maintainers: + - Vinod Koul + +description: + The QMP PHY controller supports physical layer functionality for a number of + controllers on Qualcomm chipsets, such as, PCIe, UFS, and USB. + +properties: + compatible: + enum: + - qcom,sc8280xp-qmp-ufs-phy + + reg: + maxItems: 1 + + clocks: + maxItems: 2 + + clock-names: + items: + - const: ref + - const: ref_aux + + power-domains: + maxItems: 1 + + resets: + maxItems: 1 + + reset-names: + items: + - const: ufsphy + + vdda-phy-supply: true + + vdda-pll-supply: true + + "#phy-cells": + const: 0 + +required: + - compatible + - reg + - clocks + - clock-names + - power-domains + - resets + - reset-names + - vdda-phy-supply + - vdda-pll-supply + - "#phy-cells" + +additionalProperties: false + +examples: + - | + #include + + ufs_mem_phy: phy@1d87000 { + compatible = "qcom,sc8280xp-qmp-ufs-phy"; + reg = <0x01d87000 0x1000>; + + clocks = <&gcc GCC_UFS_REF_CLKREF_CLK>, <&gcc GCC_UFS_PHY_PHY_AUX_CLK>; + clock-names = "ref", "ref_aux"; + + power-domains = <&gcc UFS_PHY_GDSC>; + + resets = <&ufs_mem_hc 0>; + reset-names = "ufsphy"; + + vdda-phy-supply = <&vreg_l6b>; + vdda-pll-supply = <&vreg_l3b>; + + #phy-cells = <0>; + }; From patchwork Mon Oct 24 09:00:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 8264 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp336404wru; Mon, 24 Oct 2022 02:06:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5tQGnyIZvs3L3Easb/xPahPqD5l22efKZSgI6WXj/jPP/yjlbWkSe/amUjqaP1WBOO0ojn X-Received: by 2002:a05:6402:2486:b0:460:8f86:1fca with SMTP id q6-20020a056402248600b004608f861fcamr19683690eda.70.1666602401013; Mon, 24 Oct 2022 02:06:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666602401; cv=none; d=google.com; s=arc-20160816; b=ZwbJVWgOHmV9KqDhZg++p+X7Zszz04o8dUD7e44oqEmyj3nAV1nvWxqfaY+FQHFh03 G8c2oJR6Q2es53HlqfEJ2gRMxI/AreyZj05snh5tGJeWkTwkPngaCCeIBUbPr1G0cpy8 NE4ibEHNe9DTfjSmAiClWcIR6XFs5SyMGZWNxu6Wysi9YazAvNWwwmal7buuJZm3F6bM 2z1DkpUZMO/uWECG0zYR9eejwtVJ1lRO9fI3hEKq5fvqNkDdQY5OyCr0LIdSRrnjvv5F 0tjsGjnw5sA8eoSjA5dLO5FziYrnMOwNztdnSorDfvVaF7Pg6QLKcpFeWfVFWrzdSehj aCHw== 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=oa/isEZElLRJTEbkZoXpUIP1aWoZCQBo7zFUHdSzlgU=; b=W26xigDG4t82+K/66wOAciEAGia06YKTJsIu4Ir/47tzd1JPEbMMt/AXVC2ChN2Lss PvC5Ff0yGa1xOgdPAtgWzYrnH0Io3II60Ubv7gBic4X/qOJ6ElaX9U1s/KFdjC62Gu7g KTbMAAGsdYWNMg+4rpSU7nNUqdQPpBAWFgZsBSyfLvvhwEboZgKtsHXxqE0ZS36k5v9C IqA+sWmzXY1whoxygyYd38RV9U0EDlcYpUuJUh+HZPlFoWJGJFvGLXyahX3V5MELt9Qo Up+iiu6XQ5MBf4e1GncRJgyC1gOhUvmwTniQoZrnnU5fHzxezdHwpj1VsALRZzzONtym nM9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q7XBzBVR; 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 hb44-20020a170907162c00b007aad0673343si67567ejc.313.2022.10.24.02.06.16; Mon, 24 Oct 2022 02:06:40 -0700 (PDT) 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=q7XBzBVR; 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 S229777AbiJXJCG (ORCPT + 99 others); Mon, 24 Oct 2022 05:02:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229974AbiJXJBk (ORCPT ); Mon, 24 Oct 2022 05:01:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6371C4DB55; Mon, 24 Oct 2022 02:01:39 -0700 (PDT) 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 F2F2B6108A; Mon, 24 Oct 2022 09:01:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC32CC4315C; Mon, 24 Oct 2022 09:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666602097; bh=eORV9LmEcdHb6Kr3GUyjApeVuli873Sn/SlzBLhCixE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q7XBzBVRtDWnivgHChKd8A/o1R1cb2VYbr4gnTcDGLrR86JS7bQQhNT8mGyivYcul vwFBYJZEUjz8rd8qEKMSxVhcC8TydFAciESdoYPXWZlE9sgcQWCJRScjhdYdJze1bJ 0Wez0oSziuZ9ZyhcFBxJnXdu3+qutXqO9DqEXld84PSf7vBBJqMdFx88/Lg5Lqrtl5 i3mzW+nMXW/sabTHP2g4V9uUbM5YMg4NeU0ujNAiZTzZom2GGh0LwqCOh7inOder4H CBUCAb3/+U16HOaeADXyirs+xfNlH1uACipBUseyVCQ7M5E5HOQRvLLw6eqyO9ZdTC Qlk0WYccbCjHw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omtKj-00056j-Px; Mon, 24 Oct 2022 11:01:21 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 09/10] phy: qcom-qmp-ufs: restructure PHY creation Date: Mon, 24 Oct 2022 11:00:40 +0200 Message-Id: <20221024090041.19574-10-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024090041.19574-1-johan+linaro@kernel.org> References: <20221024090041.19574-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747559279512589506?= X-GMAIL-MSGID: =?utf-8?q?1747559279512589506?= In preparation for supporting devicetree bindings which do not use a child node, move the PHY creation to probe() proper and parse the serdes resource in what is now the legacy devicetree helper. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 34 ++++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c index fa703e856eb7..bf5c1a6b9ca4 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c @@ -983,12 +983,15 @@ static int qmp_ufs_clk_init(struct qmp_ufs *qmp) return devm_clk_bulk_get(dev, num, qmp->clks); } -static int qmp_ufs_create(struct qmp_ufs *qmp, struct device_node *np) +static int qmp_ufs_parse_dt_legacy(struct qmp_ufs *qmp, struct device_node *np) { + struct platform_device *pdev = to_platform_device(qmp->dev); const struct qmp_phy_cfg *cfg = qmp->cfg; struct device *dev = qmp->dev; - struct phy *generic_phy; - int ret; + + qmp->serdes = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(qmp->serdes)) + return PTR_ERR(qmp->serdes); /* * Get memory resources for the PHY: @@ -1025,16 +1028,6 @@ static int qmp_ufs_create(struct qmp_ufs *qmp, struct device_node *np) if (IS_ERR(qmp->pcs_misc)) dev_vdbg(dev, "PHY pcs_misc-reg not used\n"); - generic_phy = devm_phy_create(dev, np, &qcom_qmp_ufs_phy_ops); - if (IS_ERR(generic_phy)) { - ret = PTR_ERR(generic_phy); - dev_err(dev, "failed to create PHY: %d\n", ret); - return ret; - } - - qmp->phy = generic_phy; - phy_set_drvdata(generic_phy, qmp); - return 0; } @@ -1056,10 +1049,6 @@ static int qmp_ufs_probe(struct platform_device *pdev) if (!qmp->cfg) return -EINVAL; - qmp->serdes = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(qmp->serdes)) - return PTR_ERR(qmp->serdes); - ret = qmp_ufs_clk_init(qmp); if (ret) return ret; @@ -1072,10 +1061,19 @@ static int qmp_ufs_probe(struct platform_device *pdev) if (!child) return -EINVAL; - ret = qmp_ufs_create(qmp, child); + ret = qmp_ufs_parse_dt_legacy(qmp, child); if (ret) goto err_node_put; + qmp->phy = devm_phy_create(dev, child, &qcom_qmp_ufs_phy_ops); + if (IS_ERR(qmp->phy)) { + ret = PTR_ERR(qmp->phy); + dev_err(dev, "failed to create PHY: %d\n", ret); + goto err_node_put; + } + + phy_set_drvdata(qmp->phy, qmp); + of_node_put(child); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); From patchwork Mon Oct 24 09:00: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: 8262 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp335814wru; Mon, 24 Oct 2022 02:05:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7CghMb9iAKo/Au79IS2Mu/qCwqXe0VaeOEUxgGhc6/VZMxqHWSlwc0fNuQHkt3SZWfhUQ9 X-Received: by 2002:aa7:c6c1:0:b0:460:f684:901a with SMTP id b1-20020aa7c6c1000000b00460f684901amr19091283eds.6.1666602326831; Mon, 24 Oct 2022 02:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666602326; cv=none; d=google.com; s=arc-20160816; b=D6t1VLnRPTTBQG5al3Wj8EtuZAHuWSboDBOL/1Y0FNILgibAPJ1MdjksLF9wmbo4EY niJPxfZtQCsfg2FgBDdzi9yAOHR9br6QvpkJ7TSIKENFtT7cTT7DoyWIbzQVGWXcCm3T PGtRwu5ssf+Uaz/GepUEooxLGNmY4BGsQzkwZ459axntOHZMUd/oKS5w+AfbQeiAool+ 7ZqzI1ebqAJ9NNClqQ+m4Cks0rmujv8ZfG6zbIC/5HVJ6YTeEuu6d6qGbuuG1dw/8gTO gEJOrkV7vvhTQD2WTPT/RsTYSQa4Ta5geOPvNErHMPoQdQwCYdEX+bEZabE4yXV+tcaM g1gw== 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=S6kHiHA7xVtoBVHGfm8uo0WWd3T4SnBzxMpkheb2cbs=; b=E9KrkN+PQdos4olTxmh/zTtsyxYesoqInNBsGqKcVS2oH+3vFnZIBLXMmMOWz16t85 xsXIEIHIWDBlLV38OA75RS/8krnx9EjVqFLMixg8xUYUXlkI0VyRb7ecxv8yKArM/aCS rGVQbZeMqJn+byhnW6qXDknveZaxGrdQVaxa8RjfDmrs5jiDAkWRFcwdYjyNwm78+zgH b49IvhrZslafseaoGot3yqkzT8xEXyHX2xJWCbMBxMpiyrNYDY6osH7HpzkDFdAFFUSG UMbBBK5CgQ7SrBLi13dYC2ZWoeN93LrodUawFtqaU0hgIuCXkjSB1qAZQFNvIE/8cCQX P6eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=umcSX8tW; 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 k6-20020a50cb86000000b0045c97cb9027si24068344edi.421.2022.10.24.02.05.02; Mon, 24 Oct 2022 02:05:26 -0700 (PDT) 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=umcSX8tW; 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 S229874AbiJXJCK (ORCPT + 99 others); Mon, 24 Oct 2022 05:02:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230003AbiJXJBl (ORCPT ); Mon, 24 Oct 2022 05:01:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5F4254647; Mon, 24 Oct 2022 02:01:39 -0700 (PDT) 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 0AC856109A; Mon, 24 Oct 2022 09:01:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BC22C4FEBF; Mon, 24 Oct 2022 09:01:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666602098; bh=uAsae8vn+6rxUI7yeq1aFl7/4iIeDVod4FR5wtZmmRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=umcSX8tWKFKYP0M4tqzm57Tf2h6XAhW20S639wL/pvqoa/NxvOIz0TFkXijd9ddiN WWNn9Bs7M5txKVXPJmfsn9aYrfAzFJLEC3VcTBB2X7UCn+1PbYxjDJAUznOWidDz/y D/T5VsF7FSA21wKXsMG3X/Fargx0dcykaRUGfvvBpPDJPl6l729bQ+lYuIDzz88s3Z Ci/6RNRPK1PHl/+vGOsXDtVpo1knMtgF+I90zoRwdRYTiikk8xh3C73KTWICEMx7IP CTwAGzTVDN6NW+lq2CnP1PRgrYLlPFx8IFIyb9fwG9bARhaDeSIaipJvGgJZLVNpeh z58F9CtolhPJQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1omtKj-00056m-Sr; Mon, 24 Oct 2022 11:01:21 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 10/10] phy: qcom-qmp-ufs: add support for updated sc8280xp binding Date: Mon, 24 Oct 2022 11:00:41 +0200 Message-Id: <20221024090041.19574-11-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221024090041.19574-1-johan+linaro@kernel.org> References: <20221024090041.19574-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747559201339010024?= X-GMAIL-MSGID: =?utf-8?q?1747559201339010024?= Add support for the new SC8280XP binding. Note that the binding does not try to describe every register subregion and instead the driver holds the corresponding offsets. Also note that the driver will continue to accept the old binding, at least for the time being. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 90 ++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 10 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c index bf5c1a6b9ca4..189103d1bd18 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c @@ -520,10 +520,21 @@ static const struct qmp_phy_init_tbl sm8350_ufsphy_pcs_tbl[] = { QMP_PHY_INIT_CFG(QPHY_V5_PCS_UFS_MULTI_LANE_CTRL1, 0x02), }; +struct qmp_ufs_offsets { + u16 serdes; + u16 pcs; + u16 tx; + u16 rx; + u16 tx2; + u16 rx2; +}; + /* struct qmp_phy_cfg - per-PHY initialization config */ struct qmp_phy_cfg { int lanes; + const struct qmp_ufs_offsets *offsets; + /* Init sequence for PHY blocks - serdes, tx, rx, pcs */ const struct qmp_phy_init_tbl *serdes_tbl; int serdes_tbl_num; @@ -611,6 +622,15 @@ static const char * const qmp_phy_vreg_l[] = { "vdda-phy", "vdda-pll", }; +static const struct qmp_ufs_offsets qmp_ufs_offsets_v5 = { + .serdes = 0, + .pcs = 0xc00, + .tx = 0x400, + .rx = 0x600, + .tx2 = 0x800, + .rx2 = 0xa00, +}; + static const struct qmp_phy_cfg msm8996_ufs_cfg = { .lanes = 1, @@ -632,6 +652,26 @@ static const struct qmp_phy_cfg msm8996_ufs_cfg = { .no_pcs_sw_reset = true, }; +static const struct qmp_phy_cfg sc8280xp_ufsphy_cfg = { + .lanes = 2, + + .offsets = &qmp_ufs_offsets_v5, + + .serdes_tbl = sm8350_ufsphy_serdes_tbl, + .serdes_tbl_num = ARRAY_SIZE(sm8350_ufsphy_serdes_tbl), + .tx_tbl = sm8350_ufsphy_tx_tbl, + .tx_tbl_num = ARRAY_SIZE(sm8350_ufsphy_tx_tbl), + .rx_tbl = sm8350_ufsphy_rx_tbl, + .rx_tbl_num = ARRAY_SIZE(sm8350_ufsphy_rx_tbl), + .pcs_tbl = sm8350_ufsphy_pcs_tbl, + .pcs_tbl_num = ARRAY_SIZE(sm8350_ufsphy_pcs_tbl), + .clk_list = sdm845_ufs_phy_clk_l, + .num_clks = ARRAY_SIZE(sdm845_ufs_phy_clk_l), + .vreg_list = qmp_phy_vreg_l, + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), + .regs = sm8150_ufsphy_regs_layout, +}; + static const struct qmp_phy_cfg sdm845_ufsphy_cfg = { .lanes = 2, @@ -1031,11 +1071,38 @@ static int qmp_ufs_parse_dt_legacy(struct qmp_ufs *qmp, struct device_node *np) return 0; } +static int qmp_ufs_parse_dt(struct qmp_ufs *qmp) +{ + struct platform_device *pdev = to_platform_device(qmp->dev); + const struct qmp_phy_cfg *cfg = qmp->cfg; + const struct qmp_ufs_offsets *offs = cfg->offsets; + void __iomem *base; + + if (!offs) + return -EINVAL; + + base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(base)) + return PTR_ERR(base); + + qmp->serdes = base + offs->serdes; + qmp->pcs = base + offs->pcs; + qmp->tx = base + offs->tx; + qmp->rx = base + offs->rx; + + if (cfg->lanes >= 2) { + qmp->tx2 = base + offs->tx2; + qmp->rx2 = base + offs->rx2; + } + + return 0; +} + static int qmp_ufs_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *child; struct phy_provider *phy_provider; + struct device_node *np; struct qmp_ufs *qmp; int ret; @@ -1057,15 +1124,18 @@ static int qmp_ufs_probe(struct platform_device *pdev) if (ret) return ret; - child = of_get_next_available_child(dev->of_node, NULL); - if (!child) - return -EINVAL; - - ret = qmp_ufs_parse_dt_legacy(qmp, child); + /* Check for legacy binding with child node. */ + np = of_get_next_available_child(dev->of_node, NULL); + if (np) { + ret = qmp_ufs_parse_dt_legacy(qmp, np); + } else { + np = of_node_get(dev->of_node); + ret = qmp_ufs_parse_dt(qmp); + } if (ret) goto err_node_put; - qmp->phy = devm_phy_create(dev, child, &qcom_qmp_ufs_phy_ops); + qmp->phy = devm_phy_create(dev, np, &qcom_qmp_ufs_phy_ops); if (IS_ERR(qmp->phy)) { ret = PTR_ERR(qmp->phy); dev_err(dev, "failed to create PHY: %d\n", ret); @@ -1074,14 +1144,14 @@ static int qmp_ufs_probe(struct platform_device *pdev) phy_set_drvdata(qmp->phy, qmp); - of_node_put(child); + of_node_put(np); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); return PTR_ERR_OR_ZERO(phy_provider); err_node_put: - of_node_put(child); + of_node_put(np); return ret; } @@ -1097,7 +1167,7 @@ static const struct of_device_id qmp_ufs_of_match_table[] = { .data = &sm8150_ufsphy_cfg, }, { .compatible = "qcom,sc8280xp-qmp-ufs-phy", - .data = &sm8350_ufsphy_cfg, + .data = &sc8280xp_ufsphy_cfg, }, { .compatible = "qcom,sdm845-qmp-ufs-phy", .data = &sdm845_ufsphy_cfg,