linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org, Vinod Koul <vkoul@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: octeon-ethernet: fix incorrect PHY mode
Date: Tue, 26 Mar 2019 10:01:50 +0100	[thread overview]
Message-ID: <20190326090150.GE31524@lunn.ch> (raw)
In-Reply-To: <20190325204801.7013-1-aaro.koskinen@iki.fi>

> -static void cvm_set_rgmii_delay(struct device_node *np, int iface, int port)
> +static void cvm_set_rgmii_delay(struct octeon_ethernet *priv, int iface,
> +				int port)
>  {
> +	struct device_node *np = priv->of_node;
>  	u32 delay_value;
> +	bool rx_delay;
> +	bool tx_delay;
>  
> -	if (!of_property_read_u32(np, "rx-delay", &delay_value))
> +	/* By default, both RX/TX delay is enabled in
> +	 * __cvmx_helper_rgmii_enable().
> +	 */
> +	rx_delay = true;
> +	tx_delay = true;
> +
> +	if (!of_property_read_u32(np, "rx-delay", &delay_value)) {
>  		cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(port, iface), delay_value);
> -	if (!of_property_read_u32(np, "tx-delay", &delay_value))
> +		rx_delay = delay_value > 0;
> +	}
> +	if (!of_property_read_u32(np, "tx-delay", &delay_value)) {
>  		cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, iface), delay_value);
> +		tx_delay = delay_value > 0;
> +	}
> +
> +	if (!rx_delay && !tx_delay)
> +		priv->phy_mode = PHY_INTERFACE_MODE_RGMII_ID;
> +	else if (!rx_delay)
> +		priv->phy_mode = PHY_INTERFACE_MODE_RGMII_RXID;
> +	else if (!tx_delay)
> +		priv->phy_mode = PHY_INTERFACE_MODE_RGMII_TXID;
> +	else
> +		priv->phy_mode = PHY_INTERFACE_MODE_RGMII;

Humm, that is unique, as far as i know. Every other MAC driver uses
of_get_phy_mode() to get the value out of device tree. The proprietary
delay values can then be used to fine tune the basic delay setting
read from DT.

	Andrew

  reply	other threads:[~2019-03-26  9:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25 20:48 [PATCH] staging: octeon-ethernet: fix incorrect PHY mode Aaro Koskinen
2019-03-26  9:01 ` Andrew Lunn [this message]
2019-03-26  9:36   ` Aaro Koskinen

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=20190326090150.GE31524@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=aaro.koskinen@iki.fi \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vkoul@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).