[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190326090150.GE31524@lunn.ch>
Date: Tue, 26 Mar 2019 10:01:50 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Aaro Koskinen <aaro.koskinen@....fi>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devel@...verdev.osuosl.org, Vinod Koul <vkoul@...nel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: octeon-ethernet: fix incorrect PHY mode
> -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
Powered by blists - more mailing lists