提交 ce19a9eb 编写于 作者: G Geert Uytterhoeven 提交者: David S. Miller

ravb: Split delay handling in parsing and applying

Currently, full delay handling is done in both the probe and resume
paths.  Split it in two parts, so the resume path doesn't have to redo
the parsing part over and over again.
Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d7adf633
...@@ -1036,6 +1036,8 @@ struct ravb_private { ...@@ -1036,6 +1036,8 @@ struct ravb_private {
unsigned no_avb_link:1; unsigned no_avb_link:1;
unsigned avb_link_active_low:1; unsigned avb_link_active_low:1;
unsigned wol_enabled:1; unsigned wol_enabled:1;
unsigned rxcidm:1; /* RX Clock Internal Delay Mode */
unsigned txcidm:1; /* TX Clock Internal Delay Mode */
int num_tx_desc; /* TX descriptors per packet */ int num_tx_desc; /* TX descriptors per packet */
}; };
......
...@@ -1999,23 +1999,32 @@ static const struct soc_device_attribute ravb_delay_mode_quirk_match[] = { ...@@ -1999,23 +1999,32 @@ static const struct soc_device_attribute ravb_delay_mode_quirk_match[] = {
}; };
/* Set tx and rx clock internal delay modes */ /* Set tx and rx clock internal delay modes */
static void ravb_set_delay_mode(struct net_device *ndev) static void ravb_parse_delay_mode(struct net_device *ndev)
{ {
struct ravb_private *priv = netdev_priv(ndev); struct ravb_private *priv = netdev_priv(ndev);
int set = 0;
if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID || if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID ||
priv->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) priv->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID)
set |= APSR_DM_RDM; priv->rxcidm = 1;
if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID || if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID ||
priv->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) { priv->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) {
if (!WARN(soc_device_match(ravb_delay_mode_quirk_match), if (!WARN(soc_device_match(ravb_delay_mode_quirk_match),
"phy-mode %s requires TX clock internal delay mode which is not supported by this hardware revision. Please update device tree", "phy-mode %s requires TX clock internal delay mode which is not supported by this hardware revision. Please update device tree",
phy_modes(priv->phy_interface))) phy_modes(priv->phy_interface)))
set |= APSR_DM_TDM; priv->txcidm = 1;
} }
}
static void ravb_set_delay_mode(struct net_device *ndev)
{
struct ravb_private *priv = netdev_priv(ndev);
u32 set = 0;
if (priv->rxcidm)
set |= APSR_DM_RDM;
if (priv->txcidm)
set |= APSR_DM_TDM;
ravb_modify(ndev, APSR, APSR_DM, set); ravb_modify(ndev, APSR, APSR_DM, set);
} }
...@@ -2148,8 +2157,10 @@ static int ravb_probe(struct platform_device *pdev) ...@@ -2148,8 +2157,10 @@ static int ravb_probe(struct platform_device *pdev)
/* Request GTI loading */ /* Request GTI loading */
ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);
if (priv->chip_id != RCAR_GEN2) if (priv->chip_id != RCAR_GEN2) {
ravb_parse_delay_mode(ndev);
ravb_set_delay_mode(ndev); ravb_set_delay_mode(ndev);
}
/* Allocate descriptor base address table */ /* Allocate descriptor base address table */
priv->desc_bat_size = sizeof(struct ravb_desc) * DBAT_ENTRY_NUM; priv->desc_bat_size = sizeof(struct ravb_desc) * DBAT_ENTRY_NUM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册