Commit 511d74d9 authored by Biju Das's avatar Biju Das Committed by David S. Miller

ravb: Factorise ravb_emac_init function

The E-MAC IP on the R-Car AVB module has different initialization
parameters for RX frame size, duplex settings, different offset
for transfer speed setting and has magic packet detection support
compared to E-MAC on RZ/G2L Gigabit Ethernet module. Factorise
the ravb_emac_init function to support the later SoC.
Signed-off-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: default avatarLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eb4fd127
...@@ -987,6 +987,7 @@ struct ravb_hw_info { ...@@ -987,6 +987,7 @@ struct ravb_hw_info {
void (*set_rate)(struct net_device *ndev); void (*set_rate)(struct net_device *ndev);
int (*set_rx_csum_feature)(struct net_device *ndev, netdev_features_t features); int (*set_rx_csum_feature)(struct net_device *ndev, netdev_features_t features);
void (*dmac_init)(struct net_device *ndev); void (*dmac_init)(struct net_device *ndev);
void (*emac_init)(struct net_device *ndev);
const char (*gstrings_stats)[ETH_GSTRING_LEN]; const char (*gstrings_stats)[ETH_GSTRING_LEN];
size_t gstrings_size; size_t gstrings_size;
netdev_features_t net_hw_features; netdev_features_t net_hw_features;
......
...@@ -425,8 +425,7 @@ static int ravb_ring_init(struct net_device *ndev, int q) ...@@ -425,8 +425,7 @@ static int ravb_ring_init(struct net_device *ndev, int q)
return -ENOMEM; return -ENOMEM;
} }
/* E-MAC init function */ static void ravb_rcar_emac_init(struct net_device *ndev)
static void ravb_emac_init(struct net_device *ndev)
{ {
/* Receive frame limit set register */ /* Receive frame limit set register */
ravb_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN, RFLR); ravb_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN, RFLR);
...@@ -452,6 +451,15 @@ static void ravb_emac_init(struct net_device *ndev) ...@@ -452,6 +451,15 @@ static void ravb_emac_init(struct net_device *ndev)
ravb_write(ndev, ECSIPR_ICDIP | ECSIPR_MPDIP | ECSIPR_LCHNGIP, ECSIPR); ravb_write(ndev, ECSIPR_ICDIP | ECSIPR_MPDIP | ECSIPR_LCHNGIP, ECSIPR);
} }
/* E-MAC init function */
static void ravb_emac_init(struct net_device *ndev)
{
struct ravb_private *priv = netdev_priv(ndev);
const struct ravb_hw_info *info = priv->info;
info->emac_init(ndev);
}
static void ravb_rcar_dmac_init(struct net_device *ndev) static void ravb_rcar_dmac_init(struct net_device *ndev)
{ {
struct ravb_private *priv = netdev_priv(ndev); struct ravb_private *priv = netdev_priv(ndev);
...@@ -1999,6 +2007,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = { ...@@ -1999,6 +2007,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
.set_rate = ravb_set_rate, .set_rate = ravb_set_rate,
.set_rx_csum_feature = ravb_set_features_rx_csum, .set_rx_csum_feature = ravb_set_features_rx_csum,
.dmac_init = ravb_rcar_dmac_init, .dmac_init = ravb_rcar_dmac_init,
.emac_init = ravb_rcar_emac_init,
.gstrings_stats = ravb_gstrings_stats, .gstrings_stats = ravb_gstrings_stats,
.gstrings_size = sizeof(ravb_gstrings_stats), .gstrings_size = sizeof(ravb_gstrings_stats),
.net_hw_features = NETIF_F_RXCSUM, .net_hw_features = NETIF_F_RXCSUM,
...@@ -2019,6 +2028,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = { ...@@ -2019,6 +2028,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
.set_rate = ravb_set_rate, .set_rate = ravb_set_rate,
.set_rx_csum_feature = ravb_set_features_rx_csum, .set_rx_csum_feature = ravb_set_features_rx_csum,
.dmac_init = ravb_rcar_dmac_init, .dmac_init = ravb_rcar_dmac_init,
.emac_init = ravb_rcar_emac_init,
.gstrings_stats = ravb_gstrings_stats, .gstrings_stats = ravb_gstrings_stats,
.gstrings_size = sizeof(ravb_gstrings_stats), .gstrings_size = sizeof(ravb_gstrings_stats),
.net_hw_features = NETIF_F_RXCSUM, .net_hw_features = NETIF_F_RXCSUM,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment