From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79A63C07E9D for ; Mon, 26 Sep 2022 07:33:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233593AbiIZHdb (ORCPT ); Mon, 26 Sep 2022 03:33:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234064AbiIZHda (ORCPT ); Mon, 26 Sep 2022 03:33:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A8D322530; Mon, 26 Sep 2022 00:33:29 -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 E9E37B81901; Mon, 26 Sep 2022 07:33:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A372C433D6; Mon, 26 Sep 2022 07:33:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664177606; bh=GiOWWB7nawly0z2Qm4RUKkrXtT0fWmsQtvVUHw0aqnM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IbJucAH2EGITulxvElZDPPARZ60G4CnYI5p5Md6xGg9IyaDPpnR+eJ5xZSeRIXD+Y 1LQBTISU5KpR0h08c7TMx62bKK6rr2F9OnK4E89wuiia/CSg30xws5lPcDRfhlqLb2 xTMvXg/bsH9S4H1sA1kdZfkn0LGCs0xUOmqVWFr9b3i72gX5tJ+5UP6k2P5OpcsbA+ e1SLTsm7hYTDGiMNCFVsS2poGFwA+OFuHNyhDxHCOxmIj4l3Tkc06+ORzmGp0AQGuD tQyIiFi964SdnxwipMSC+q0Q0ztZmdg2u9BsGQmIjRujbUaKBXyoZvpfOcq8jEnhUK 3pLk8DuYc94hQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1ocicN-0003jO-SH; Mon, 26 Sep 2022 09:33:31 +0200 Date: Mon, 26 Sep 2022 09:33:31 +0200 From: Johan Hovold To: Dmitry Baryshkov Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , Vinod Koul , Kishon Vijay Abraham I , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-phy@lists.infradead.org Subject: Re: [PATCH v4 2/6] phy: qcom-qmp-pcie: split PHY programming to separate functions Message-ID: References: <20220924160302.285875-1-dmitry.baryshkov@linaro.org> <20220924160302.285875-3-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220924160302.285875-3-dmitry.baryshkov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On Sat, Sep 24, 2022 at 07:02:58PM +0300, Dmitry Baryshkov wrote: > Split the code using PHY programming tables into separate functions, > which take a single struct qmp_phy_cfg_tables instance. > > Signed-off-by: Dmitry Baryshkov > --- > drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 80 ++++++++++++++---------- > 1 file changed, 48 insertions(+), 32 deletions(-) > > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > index 30806816c8b0..6e8c74585670 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > @@ -1877,15 +1877,53 @@ static void qmp_pcie_configure(void __iomem *base, > qmp_pcie_configure_lane(base, regs, tbl, num, 0xff); > } > > -static int qmp_pcie_serdes_init(struct qmp_phy *qphy) > +static void qmp_pcie_serdes_init(struct qmp_phy *qphy, const struct qmp_phy_cfg_tables *tables) > { > const struct qmp_phy_cfg *cfg = qphy->cfg; > void __iomem *serdes = qphy->serdes; > > - qmp_pcie_configure(serdes, cfg->regs, cfg->common.serdes_tbl, cfg->common.serdes_tbl_num); > - qmp_pcie_configure(serdes, cfg->regs, cfg->extra->serdes_tbl, cfg->extra->serdes_tbl_num); > + if (!tables) > + return; > > - return 0; > + qmp_pcie_configure(serdes, cfg->regs, tables->serdes_tbl, tables->serdes_tbl_num); See what I mean about "_tbl" being redundant in "tables->serdes_tbl"? > +} > static int qmp_pcie_init(struct phy *phy) > @@ -1957,15 +1995,13 @@ static int qmp_pcie_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; > - void __iomem *pcs_misc = qphy->pcs_misc; > void __iomem *status; > unsigned int mask, val, ready; > int ret; > > - qmp_pcie_serdes_init(qphy); > + qmp_pcie_serdes_init(qphy, &cfg->common); > + qmp_pcie_serdes_init(qphy, cfg->extra); And "common" and "extra" doesn't really say what it is you're passing here. > > ret = clk_prepare_enable(qphy->pipe_clk); > if (ret) { Johan