linux-samsung-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Alim Akhtar <alim.akhtar@samsung.com>
Cc: robh+dt@kernel.org, krzk@kernel.org, kwmad.kim@samsung.com,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	kishon@ti.com
Subject: Re: [PATCH v12 2/2] phy: samsung-ufs: add UFS PHY driver for samsung SoC
Date: Mon, 13 Jul 2020 11:47:37 +0530	[thread overview]
Message-ID: <20200713061737.GD34333@vkoul-mobl> (raw)
In-Reply-To: <20200703171135.77389-2-alim.akhtar@samsung.com>

On 03-07-20, 22:41, Alim Akhtar wrote:

> +static const struct samsung_ufs_phy_cfg exynos7_post_init_cfg[] = {
> +	END_UFS_PHY_CFG
> +};

This is dummy, why not add a check to make config optional?

> +static int samsung_ufs_phy_symbol_clk_init(struct samsung_ufs_phy *phy)
> +{
> +	int ret = 0;

superfluous init, am sure I flagged it before as well

> +
> +	phy->tx0_symbol_clk = devm_clk_get(phy->dev, "tx0_symbol_clk");
> +	if (IS_ERR(phy->tx0_symbol_clk)) {
> +		dev_err(phy->dev, "failed to get tx0_symbol_clk clock\n");
> +		goto out;
> +	}
> +
> +	phy->rx0_symbol_clk = devm_clk_get(phy->dev, "rx0_symbol_clk");
> +	if (IS_ERR(phy->rx0_symbol_clk)) {
> +		dev_err(phy->dev, "failed to get rx0_symbol_clk clock\n");
> +		goto out;
> +	}
> +
> +	phy->rx1_symbol_clk = devm_clk_get(phy->dev, "rx1_symbol_clk");
> +	if (IS_ERR(phy->rx0_symbol_clk)) {
> +		dev_err(phy->dev, "failed to get rx1_symbol_clk clock\n");
> +		goto out;
> +	}
> +
> +	ret = clk_prepare_enable(phy->tx0_symbol_clk);
> +	if (ret) {
> +		dev_err(phy->dev, "%s: tx0_symbol_clk enable failed %d\n", __func__, ret);
> +		goto out;
> +	}
> +
> +	ret = clk_prepare_enable(phy->rx0_symbol_clk);
> +	if (ret) {
> +		dev_err(phy->dev, "%s: rx0_symbol_clk enable failed %d\n", __func__, ret);
> +		clk_disable_unprepare(phy->tx0_symbol_clk);
> +		goto out;
> +	}
> +
> +	ret = clk_prepare_enable(phy->rx1_symbol_clk);
> +	if (ret) {
> +		dev_err(phy->dev, "%s: rx1_symbol_clk enable failed %d\n", __func__, ret);
> +		clk_disable_unprepare(phy->tx0_symbol_clk);
> +		clk_disable_unprepare(phy->rx0_symbol_clk);

maybe it will look better if we add common rollback and jump to proper
labels

> +static int samsung_ufs_phy_clks_init(struct samsung_ufs_phy *phy)
> +{
> +	int ret;
> +
> +	phy->ref_clk = devm_clk_get(phy->dev, "ref_clk");
> +	if (IS_ERR(phy->ref_clk))
> +		dev_err(phy->dev, "failed to get ref_clk clock\n");
> +
> +	ret = clk_prepare_enable(phy->ref_clk);
> +	if (ret) {
> +		dev_err(phy->dev, "%s: ref_clk enable failed %d\n", __func__, ret);
> +		return ret;
> +	}
> +
> +	dev_info(phy->dev, "UFS MPHY ref_clk_rate = %ld\n", clk_get_rate(phy->ref_clk));

debug pls

> +static int samsung_ufs_phy_init(struct phy *phy)
> +{
> +	struct samsung_ufs_phy *_phy = get_samsung_ufs_phy(phy);

ss_phy perhaps?

> +	int ret;
> +
> +	_phy->lane_cnt = phy->attrs.bus_width;
> +	_phy->ufs_phy_state = CFG_PRE_INIT;
> +
> +	if (_phy->drvdata->has_symbol_clk) {
> +		ret = samsung_ufs_phy_symbol_clk_init(_phy);
> +		if (ret)
> +			dev_err(_phy->dev, "failed to set ufs phy symbol clocks\n");
> +	}
> +
> +	ret = samsung_ufs_phy_clks_init(_phy);
> +	if (ret)
> +		dev_err(_phy->dev, "failed to set ufs phy  clocks\n");
> +
> +	samsung_ufs_phy_calibrate(phy);
> +
> +	return 0;

not return samsung_ufs_phy_calibrate() ?
-- 
~Vinod

  parent reply	other threads:[~2020-07-13  6:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200703173142epcas5p4e7b758249859dea792958000e2a697b2@epcas5p4.samsung.com>
2020-07-03 17:11 ` [PATCH v12 1/2] dt-bindings: phy: Document Samsung UFS PHY bindings Alim Akhtar
     [not found]   ` <CGME20200703173144epcas5p1daa9f5c594e7f299638cc75b7425b7c8@epcas5p1.samsung.com>
2020-07-03 17:11     ` [PATCH v12 2/2] phy: samsung-ufs: add UFS PHY driver for samsung SoC Alim Akhtar
2020-07-11 17:33       ` Alim Akhtar
2020-07-13  6:17       ` Vinod Koul [this message]
2020-07-16  1:17         ` Alim Akhtar
2020-07-16  5:11           ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200713061737.GD34333@vkoul-mobl \
    --to=vkoul@kernel.org \
    --cc=alim.akhtar@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kishon@ti.com \
    --cc=krzk@kernel.org \
    --cc=kwmad.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).