Commit c84f9324 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'ravb-add-mii-support-for-r-car-v4m'

Geert Uytterhoeven says:

====================
ravb: Add MII support for R-Car V4M

All EtherAVB instances on R-Car Gen3/Gen4 SoCs support the RGMII
interface.  In addition, the first two EtherAVB instances on R-Car V4M
also support the MII interface, but this is not yet supported by the
driver.  This patch series adds support for MII on R-Car Gen4, after the
customary cleanup.

The corresponding pin control support is available in [1].

Compile-tested only, as all AVB interfaces on the Gray Hawk Single
development board are connected to RGMII PHYs.
No regressions on R-Car V4H.

[1] "[PATCH/RFC] pinctrl: renesas: r8a779h0: Add AVB MII pins and groups"
    https://lore.kernel.org/4a0a12227f2145ef53b18bc08f45b19dcd745fc6.1718378739.git.geert+renesas@glider.be/

v1: https://lore.kernel.org/f0ef3e00aec461beb33869ab69ccb44a23d78f51.1718378166.git.geert+renesas@glider.be
====================

Link: https://patch.msgid.link/cover.1719234830.git.geert+renesas@glider.beSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents d891317f 6e0713cc
...@@ -258,6 +258,7 @@ enum APSR_BIT { ...@@ -258,6 +258,7 @@ enum APSR_BIT {
APSR_CMSW = 0x00000010, APSR_CMSW = 0x00000010,
APSR_RDM = 0x00002000, APSR_RDM = 0x00002000,
APSR_TDM = 0x00004000, APSR_TDM = 0x00004000,
APSR_MIISELECT = 0x01000000, /* R-Car V4M only */
}; };
/* RCR */ /* RCR */
......
...@@ -579,6 +579,16 @@ static void ravb_emac_init_rcar(struct net_device *ndev) ...@@ -579,6 +579,16 @@ static void ravb_emac_init_rcar(struct net_device *ndev)
ravb_write(ndev, ECSIPR_ICDIP | ECSIPR_MPDIP | ECSIPR_LCHNGIP, ECSIPR); ravb_write(ndev, ECSIPR_ICDIP | ECSIPR_MPDIP | ECSIPR_LCHNGIP, ECSIPR);
} }
static void ravb_emac_init_rcar_gen4(struct net_device *ndev)
{
struct ravb_private *priv = netdev_priv(ndev);
bool mii = priv->phy_interface == PHY_INTERFACE_MODE_MII;
ravb_modify(ndev, APSR, APSR_MIISELECT, mii ? APSR_MIISELECT : 0);
ravb_emac_init_rcar(ndev);
}
/* E-MAC init function */ /* E-MAC init function */
static void ravb_emac_init(struct net_device *ndev) static void ravb_emac_init(struct net_device *ndev)
{ {
...@@ -2652,6 +2662,28 @@ static int ravb_mdio_release(struct ravb_private *priv) ...@@ -2652,6 +2662,28 @@ static int ravb_mdio_release(struct ravb_private *priv)
return 0; return 0;
} }
static const struct ravb_hw_info ravb_gen2_hw_info = {
.receive = ravb_rx_rcar,
.set_rate = ravb_set_rate_rcar,
.set_feature = ravb_set_features_rcar,
.dmac_init = ravb_dmac_init_rcar,
.emac_init = ravb_emac_init_rcar,
.gstrings_stats = ravb_gstrings_stats,
.gstrings_size = sizeof(ravb_gstrings_stats),
.net_hw_features = NETIF_F_RXCSUM,
.net_features = NETIF_F_RXCSUM,
.stats_len = ARRAY_SIZE(ravb_gstrings_stats),
.tccr_mask = TCCR_TSRQ0 | TCCR_TSRQ1 | TCCR_TSRQ2 | TCCR_TSRQ3,
.rx_max_frame_size = SZ_2K,
.rx_buffer_size = SZ_2K +
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
.rx_desc_size = sizeof(struct ravb_ex_rx_desc),
.aligned_tx = 1,
.gptp = 1,
.nc_queues = 1,
.magic_pkt = 1,
};
static const struct ravb_hw_info ravb_gen3_hw_info = { static const struct ravb_hw_info ravb_gen3_hw_info = {
.receive = ravb_rx_rcar, .receive = ravb_rx_rcar,
.set_rate = ravb_set_rate_rcar, .set_rate = ravb_set_rate_rcar,
...@@ -2677,12 +2709,12 @@ static const struct ravb_hw_info ravb_gen3_hw_info = { ...@@ -2677,12 +2709,12 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
.magic_pkt = 1, .magic_pkt = 1,
}; };
static const struct ravb_hw_info ravb_gen2_hw_info = { static const struct ravb_hw_info ravb_gen4_hw_info = {
.receive = ravb_rx_rcar, .receive = ravb_rx_rcar,
.set_rate = ravb_set_rate_rcar, .set_rate = ravb_set_rate_rcar,
.set_feature = ravb_set_features_rcar, .set_feature = ravb_set_features_rcar,
.dmac_init = ravb_dmac_init_rcar, .dmac_init = ravb_dmac_init_rcar,
.emac_init = ravb_emac_init_rcar, .emac_init = ravb_emac_init_rcar_gen4,
.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,
...@@ -2693,8 +2725,11 @@ static const struct ravb_hw_info ravb_gen2_hw_info = { ...@@ -2693,8 +2725,11 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
.rx_buffer_size = SZ_2K + .rx_buffer_size = SZ_2K +
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
.rx_desc_size = sizeof(struct ravb_ex_rx_desc), .rx_desc_size = sizeof(struct ravb_ex_rx_desc),
.aligned_tx = 1, .internal_delay = 1,
.gptp = 1, .tx_counters = 1,
.multi_irqs = 1,
.irq_en_dis = 1,
.ccc_gac = 1,
.nc_queues = 1, .nc_queues = 1,
.magic_pkt = 1, .magic_pkt = 1,
}; };
...@@ -2751,7 +2786,7 @@ static const struct of_device_id ravb_match_table[] = { ...@@ -2751,7 +2786,7 @@ static const struct of_device_id ravb_match_table[] = {
{ .compatible = "renesas,etheravb-rcar-gen2", .data = &ravb_gen2_hw_info }, { .compatible = "renesas,etheravb-rcar-gen2", .data = &ravb_gen2_hw_info },
{ .compatible = "renesas,etheravb-r8a7795", .data = &ravb_gen3_hw_info }, { .compatible = "renesas,etheravb-r8a7795", .data = &ravb_gen3_hw_info },
{ .compatible = "renesas,etheravb-rcar-gen3", .data = &ravb_gen3_hw_info }, { .compatible = "renesas,etheravb-rcar-gen3", .data = &ravb_gen3_hw_info },
{ .compatible = "renesas,etheravb-rcar-gen4", .data = &ravb_gen3_hw_info }, { .compatible = "renesas,etheravb-rcar-gen4", .data = &ravb_gen4_hw_info },
{ .compatible = "renesas,etheravb-rzv2m", .data = &ravb_rzv2m_hw_info }, { .compatible = "renesas,etheravb-rzv2m", .data = &ravb_rzv2m_hw_info },
{ .compatible = "renesas,rzg2l-gbeth", .data = &gbeth_hw_info }, { .compatible = "renesas,rzg2l-gbeth", .data = &gbeth_hw_info },
{ } { }
......
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