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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD558C433FE for ; Sat, 29 Oct 2022 09:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7G8b+rsd/4vxLZxBEnjKQVlCcgde0z6Kp849mdfFuPU=; b=4ftsCo2nySA4KV 1iZc53/Jxrr8/yan5tMjNTaeCUBubmH2wDxFBbrPgp1S03F0iKlsG5vVyDYA6QMLAqwuknxfEk7Df ZG2wr8Heg9WZSIXPgLPWtoM/gIXRklsh3s3lYFUtAOZ5WfYdk93E4qSbwyrltcTyWreoZ9ZBlHHbM AfdbK3eKhX035nAqAJF40PE35/YKvVlBSEtLgHXhaDEXCytnuOzWdJz4u3Pf6IJYfpfg2Npiq7Ra3 YOfg8v/LChqBFijEgKuwGKk2W+I3yEf3GJmnv4Mvg3wd98fZgHW4HUI1YHvEW3P0XSWBDlgZuT9L8 qUiYKXVpRezMy4Yuomyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oohkJ-005dRx-4Z; Sat, 29 Oct 2022 09:03:15 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oohkG-005dHD-BN for linux-phy@lists.infradead.org; Sat, 29 Oct 2022 09:03:13 +0000 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 D08B060E26; Sat, 29 Oct 2022 09:03:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3407EC433D6; Sat, 29 Oct 2022 09:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667034189; bh=KOp4149gFTxhvWHD2Z7vtNmIcuGs+lR9FJExOgj9UJE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=B3VSmmqRad1T4DE55WKpzqg32vDqllSdyYHyb/TPDi7zpjvEEfqo1pQS3ZR/akJQY g47dqCwlP6yK/wQGFkazX7jmnJR6gGhTfuRw/OtmbzTHCldbjmcY4wWTzbdqVexmY9 2kujJrVD/bJvPI0wwUcAExR/Y4O3jSLn5xygmx2wk1i5e7eJhSsayjEtrxSxRe+tBs UtAgVCsxoCnwaAQhmjYAm8JhrrBz9WNCnPLFlCnx+PRExyaUEixRA5H4qCWe6731nB dslQmqx+4Nrbc69Q4Ccl5tnF0gUM/CQrMR7zeoGQJq4zctPllzaxBxHcqCS8xsszjQ iSXCoCZF1uj8w== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1oohk0-0000JY-JQ; Sat, 29 Oct 2022 11:02:56 +0200 Date: Sat, 29 Oct 2022 11:02:56 +0200 From: Johan Hovold To: Dmitry Baryshkov Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Kishon Vijay Abraham I , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org Subject: Re: [PATCH v6] phy: qcom-qmp-ufs: provide symbol clocks Message-ID: References: <20221028164847.485874-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221028164847.485874-1-dmitry.baryshkov@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221029_020312_516224_77EBD5CE X-CRM114-Status: GOOD ( 26.62 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org On Fri, Oct 28, 2022 at 07:48:47PM +0300, Dmitry Baryshkov wrote: > Register three UFS symbol clocks (ufs_rx_symbol_0_clk_src, > ufs_rx_symbol_1_clk_src ufs_tx_symbol_0_clk_src). Register OF clock > provider to let other devices link these clocks through the DT. > > Signed-off-by: Dmitry Baryshkov > --- > > Changes since v5: > - Rebased on top of phy/next > > Changes since v4: > - Rebased, dropping merged clk patches > - Fixed whitespace errors > - Added linebreaks to fit into 100 chars limit > > --- > drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 67 +++++++++++++++++++++++++ > 1 file changed, 67 insertions(+) > > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c > index 189103d1bd18..c1c9c6e7949d 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c > @@ -1023,6 +1023,66 @@ static int qmp_ufs_clk_init(struct qmp_ufs *qmp) > return devm_clk_bulk_get(dev, num, qmp->clks); > } > > +static void phy_clk_release_provider(void *res) > +{ > + of_clk_del_provider(res); > +} > + > +#define UFS_SYMBOL_CLOCKS 3 > + > +static int phy_symbols_clk_register(struct qmp_ufs *qmp, struct device_node *np) > +{ > + struct clk_hw_onecell_data *clk_data; > + struct clk_hw *hw; > + char name[64]; > + int ret; > + > + clk_data = devm_kzalloc(qmp->dev, > + struct_size(clk_data, hws, UFS_SYMBOL_CLOCKS), > + GFP_KERNEL); > + if (!clk_data) > + return -ENOMEM; > + > + clk_data->num = UFS_SYMBOL_CLOCKS; > + > + snprintf(name, sizeof(name), "%s::rx_symbol_0", dev_name(qmp->dev)); > + hw = devm_clk_hw_register_fixed_rate(qmp->dev, name, NULL, 0, 0); > + if (IS_ERR(hw)) > + return PTR_ERR(hw); > + > + clk_data->hws[0] = hw; > + > + snprintf(name, sizeof(name), "%s::rx_symbol_1", dev_name(qmp->dev)); > + hw = devm_clk_hw_register_fixed_rate(qmp->dev, name, NULL, 0, 0); > + if (IS_ERR(hw)) > + return PTR_ERR(hw); > + > + clk_data->hws[1] = hw; > + > + snprintf(name, sizeof(name), "%s::tx_symbol_0", dev_name(qmp->dev)); > + hw = devm_clk_hw_register_fixed_rate(qmp->dev, name, NULL, 0, 0); > + if (IS_ERR(hw)) > + return PTR_ERR(hw); > + > + clk_data->hws[2] = hw; > + > + ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data); > + if (ret) > + return ret; > + > + /* > + * Roll a devm action because the clock provider is the child node, but > + * the child node is not actually a device. > + */ > + return devm_add_action_or_reset(qmp->dev, phy_clk_release_provider, np); > +} > + > +static const struct phy_ops qcom_qmp_ufs_ops = { > + .power_on = qmp_ufs_enable, > + .power_off = qmp_ufs_disable, > + .owner = THIS_MODULE, > +}; This phy_ops addition looks an artefact of the rebase and should not be here. > static int qmp_ufs_parse_dt_legacy(struct qmp_ufs *qmp, struct device_node *np) > { > struct platform_device *pdev = to_platform_device(qmp->dev); > @@ -1135,6 +1195,13 @@ static int qmp_ufs_probe(struct platform_device *pdev) > if (ret) > goto err_node_put; > > + ret = phy_symbols_clk_register(qmp, np); Looks like this should go in probe() instead, or was there a reason for not registering these clocks when using the new bindings? And don't they need to be described in both the old and new bindings first either way? > + if (ret) { > + dev_err(dev, "failed to create symbol clocks, %d\n", > + ret); Please use the "...: %d\n" form for consistency. But you can probably just drop this error message instead. > + goto err_node_put; > + } > + > qmp->phy = devm_phy_create(dev, np, &qcom_qmp_ufs_phy_ops); > if (IS_ERR(qmp->phy)) { > ret = PTR_ERR(qmp->phy); Johan -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy