public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
	Rob Herring <robh+dt@kernel.org>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] phy: socionext: Add UniPhier AHCI PHY driver support
Date: Thu, 16 Jul 2020 16:03:24 +0900	[thread overview]
Message-ID: <de019ff3-ba7b-4ace-d415-3ca1caf8b195@socionext.com> (raw)
In-Reply-To: <20200716063750.GH55478@vkoul-mobl>

Hi Vinod,

On 2020/07/16 15:37, Vinod Koul wrote:
> On 16-07-20, 11:43, Kunihiko Hayashi wrote:
> 
>> +static int uniphier_ahciphy_pxs3_init(struct uniphier_ahciphy_priv *priv)
>> +{
>> +	int i;
>> +	u32 val;
>> +
>> +	/* setup port parameter */
>> +	val = readl(priv->base + TXCTRL0);
>> +	val &= ~TXCTRL0_AMP_G3_MASK;
>> +	val |= FIELD_PREP(TXCTRL0_AMP_G3_MASK, 0x73);
>> +	val &= ~TXCTRL0_AMP_G2_MASK;
>> +	val |= FIELD_PREP(TXCTRL0_AMP_G2_MASK, 0x46);
>> +	val &= ~TXCTRL0_AMP_G1_MASK;
>> +	val |= FIELD_PREP(TXCTRL0_AMP_G1_MASK, 0x42);
>> +	writel(val, priv->base + TXCTRL0);
>> +
>> +	val = readl(priv->base + TXCTRL1);
>> +	val &= ~TXCTRL1_DEEMPH_G3_MASK;
>> +	val |= FIELD_PREP(TXCTRL1_DEEMPH_G3_MASK, 0x23);
>> +	val &= ~TXCTRL1_DEEMPH_G2_MASK;
>> +	val |= FIELD_PREP(TXCTRL1_DEEMPH_G2_MASK, 0x05);
>> +	val &= ~TXCTRL1_DEEMPH_G1_MASK;
>> +	val |= FIELD_PREP(TXCTRL1_DEEMPH_G1_MASK, 0x05);
>> +
>> +	val = readl(priv->base + RXCTRL);
>> +	val &= ~RXCTRL_LOS_LVL_MASK;
>> +	val |= FIELD_PREP(RXCTRL_LOS_LVL_MASK, 0x9);
>> +	val &= ~RXCTRL_LOS_BIAS_MASK;
>> +	val |= FIELD_PREP(RXCTRL_LOS_BIAS_MASK, 0x2);
>> +	val &= ~RXCTRL_RX_EQ_MASK;
>> +	val |= FIELD_PREP(RXCTRL_RX_EQ_MASK, 0x1);
>> +
>> +	/* dummy read 25 times to make a wait time for the phy to stablize */
> 
> s/stablize/stabilize

Need more spell checking. I'll fix it.

>> +static int uniphier_ahciphy_power_off(struct phy *phy)
>> +{
>> +	struct uniphier_ahciphy_priv *priv = phy_get_drvdata(phy);
>> +	int ret = 0;
>> +
>> +	if (priv->data->power_off)
>> +		ret = priv->data->power_off(priv);
>> +
>> +	reset_control_assert(priv->rst);
>> +	clk_disable_unprepare(priv->clk);
>> +
>> +	return ret;
>> +}
>> +
>> +
> 
> multiple blank lines

I'll remove it.

>> +static const struct phy_ops uniphier_ahciphy_ops = {
>> +	.init  = uniphier_ahciphy_init,
>> +	.exit  = uniphier_ahciphy_exit,
>> +	.power_on  = uniphier_ahciphy_power_on,
>> +	.power_off = uniphier_ahciphy_power_off,
>> +	.owner = THIS_MODULE,
>> +};
>> +
>> +static int uniphier_ahciphy_probe(struct platform_device *pdev)
>> +{
>> +	struct device *dev = &pdev->dev;
>> +	struct uniphier_ahciphy_priv *priv;
>> +	struct phy *phy;
>> +	struct phy_provider *phy_provider;
>> +
>> +	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
>> +	if (!priv)
>> +		return -ENOMEM;
>> +
>> +	priv->dev = dev;
>> +	priv->data = of_device_get_match_data(dev);
>> +	if (WARN_ON(!priv->data))
>> +		return -EINVAL;
>> +
>> +	priv->base = devm_platform_ioremap_resource(pdev, 0);
>> +	if (IS_ERR(priv->base))
>> +		return PTR_ERR(priv->base);
>> +
>> +	priv->clk_parent = devm_clk_get(dev, "link");
>> +	if (IS_ERR(priv->clk_parent))
>> +		return PTR_ERR(priv->clk_parent);
>> +
>> +	if (priv->data->is_phy_clk) {
>> +		priv->clk = devm_clk_get(dev, "phy");
>> +		if (IS_ERR(priv->clk))
>> +			return PTR_ERR(priv->clk);
>> +	}
>> +
>> +	priv->rst_parent = devm_reset_control_get_shared(dev, "link");
>> +	if (IS_ERR(priv->rst_parent))
>> +		return PTR_ERR(priv->rst_parent);
>> +
>> +	priv->rst = devm_reset_control_get_shared(dev, "phy");
>> +	if (IS_ERR(priv->rst))
>> +		return PTR_ERR(priv->rst);
>> +
>> +	phy = devm_phy_create(dev, dev->of_node, &uniphier_ahciphy_ops);
>> +	if (IS_ERR(phy)) {
>> +		dev_err(dev, "failed to create phy\n");
>> +		return PTR_ERR(phy);
>> +	}
>> +
>> +	phy_set_drvdata(phy, priv);
>> +	phy_provider = devm_of_phy_provider_register(dev,
>> +						     of_phy_simple_xlate);
> 
> single line?

Ok, It can be merged into single line.

Thank you,
  
---
Best Regards
Kunihiko Hayashi

      reply	other threads:[~2020-07-16  7:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16  2:43 [PATCH v3 0/2] Add new UniPhier AHCI PHY driver Kunihiko Hayashi
2020-07-16  2:43 ` [PATCH v3 1/2] dt-bindings: phy: Add UniPhier AHCI PHY description Kunihiko Hayashi
2020-07-16  2:43 ` [PATCH v3 2/2] phy: socionext: Add UniPhier AHCI PHY driver support Kunihiko Hayashi
2020-07-16  6:37   ` Vinod Koul
2020-07-16  7:03     ` Kunihiko Hayashi [this message]

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=de019ff3-ba7b-4ace-d415-3ca1caf8b195@socionext.com \
    --to=hayashi.kunihiko@socionext.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=vkoul@kernel.org \
    --cc=yamada.masahiro@socionext.com \
    /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