Message ID | 20210923140813.13541-10-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Add Gigabit Ethernet driver support | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | fail | Series longer than 15 patches |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | success | CCed 11 of 11 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | warning | WARNING: line length of 81 exceeds 80 columns WARNING: line length of 82 exceeds 80 columns WARNING: line length of 83 exceeds 80 columns |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
On 9/23/21 5:08 PM, Biju Das wrote: > RZ/G2L supports half duplex mode. > Add a half_duplex hw feature bit to struct ravb_hw_info for > supporting half duplex mode for RZ/G2L. > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> [...] Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> Just a little bit of change needed... [...] > diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c > index 5d18681582b9..04bff44b7660 100644 > --- a/drivers/net/ethernet/renesas/ravb_main.c > +++ b/drivers/net/ethernet/renesas/ravb_main.c > @@ -1076,6 +1076,18 @@ static int ravb_poll(struct napi_struct *napi, int budget) > return budget - quota; > } > > +static void ravb_set_duplex_rgeth(struct net_device *ndev) > +{ > + struct ravb_private *priv = netdev_priv(ndev); > + u32 ecmr = ravb_read(ndev, ECMR); > + > + if (priv->duplex > 0) /* Full */ > + ecmr |= ECMR_DM; > + else /* Half */ > + ecmr &= ~ECMR_DM; > + ravb_write(ndev, ecmr, ECMR); I think we should do that like sh_eth.c: ravb_modify(ndev, ECMR, ECMR_DM, priv->duplex > 0 ? ECMR_DM : 0); [...] MBR, Sergey
Hi Sergei, Thanks for the feedback. > Subject: Re: [RFC/PATCH 09/18] ravb: Add half_duplex to struct > ravb_hw_info > > On 9/23/21 5:08 PM, Biju Das wrote: > > > RZ/G2L supports half duplex mode. > > Add a half_duplex hw feature bit to struct ravb_hw_info for supporting > > half duplex mode for RZ/G2L. > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > [...] > > Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> > > Just a little bit of change needed... > > [...] > > diff --git a/drivers/net/ethernet/renesas/ravb_main.c > > b/drivers/net/ethernet/renesas/ravb_main.c > > index 5d18681582b9..04bff44b7660 100644 > > --- a/drivers/net/ethernet/renesas/ravb_main.c > > +++ b/drivers/net/ethernet/renesas/ravb_main.c > > @@ -1076,6 +1076,18 @@ static int ravb_poll(struct napi_struct *napi, > int budget) > > return budget - quota; > > } > > > > +static void ravb_set_duplex_rgeth(struct net_device *ndev) { > > + struct ravb_private *priv = netdev_priv(ndev); > > + u32 ecmr = ravb_read(ndev, ECMR); > > + > > + if (priv->duplex > 0) /* Full */ > > + ecmr |= ECMR_DM; > > + else /* Half */ > > + ecmr &= ~ECMR_DM; > > + ravb_write(ndev, ecmr, ECMR); > > I think we should do that like sh_eth.c: > > ravb_modify(ndev, ECMR, ECMR_DM, priv->duplex > 0 ? ECMR_DM : 0); OK. Will do Regards, Biju > > [...] > > MBR, Sergey
Hi Sergei, > Subject: Re: [RFC/PATCH 09/18] ravb: Add half_duplex to struct > ravb_hw_info > > On 9/23/21 5:08 PM, Biju Das wrote: > > > RZ/G2L supports half duplex mode. > > Add a half_duplex hw feature bit to struct ravb_hw_info for supporting > > half duplex mode for RZ/G2L. > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > [...] > > Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> > > Just a little bit of change needed... > > [...] > > diff --git a/drivers/net/ethernet/renesas/ravb_main.c > > b/drivers/net/ethernet/renesas/ravb_main.c > > index 5d18681582b9..04bff44b7660 100644 > > --- a/drivers/net/ethernet/renesas/ravb_main.c > > +++ b/drivers/net/ethernet/renesas/ravb_main.c > > @@ -1076,6 +1076,18 @@ static int ravb_poll(struct napi_struct *napi, > int budget) > > return budget - quota; > > } > > > > +static void ravb_set_duplex_rgeth(struct net_device *ndev) { > > + struct ravb_private *priv = netdev_priv(ndev); > > + u32 ecmr = ravb_read(ndev, ECMR); > > + > > + if (priv->duplex > 0) /* Full */ > > + ecmr |= ECMR_DM; > > + else /* Half */ > > + ecmr &= ~ECMR_DM; > > + ravb_write(ndev, ecmr, ECMR); > > I think we should do that like sh_eth.c: > > ravb_modify(ndev, ECMR, ECMR_DM, priv->duplex > 0 ? ECMR_DM : 0); > I have prepared a patch with this changes and also renamed the function "ravb_set_duplex_rgeth" to " ravb_set_duplex_gbeth" As you suggested. Regards, Biju
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h index dfaf3121da44..7f68f9b8349c 100644 --- a/drivers/net/ethernet/renesas/ravb.h +++ b/drivers/net/ethernet/renesas/ravb.h @@ -1025,6 +1025,7 @@ struct ravb_hw_info { unsigned multi_tsrq:1; /* AVB-DMAC has MULTI TSRQ */ unsigned magic_pkt:1; /* E-MAC supports magic packet detection */ unsigned mii_rgmii_selection:1; /* E-MAC supports mii/rgmii selection */ + unsigned half_duplex:1; /* E-MAC supports half duplex mode */ }; struct ravb_private { @@ -1079,6 +1080,8 @@ struct ravb_private { unsigned rgmii_override:1; /* Deprecated rgmii-*id behavior */ unsigned int num_tx_desc; /* TX descriptors per packet */ + int duplex; + const struct ravb_hw_info *info; struct reset_control *rstc; }; diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 5d18681582b9..04bff44b7660 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1076,6 +1076,18 @@ static int ravb_poll(struct napi_struct *napi, int budget) return budget - quota; } +static void ravb_set_duplex_rgeth(struct net_device *ndev) +{ + struct ravb_private *priv = netdev_priv(ndev); + u32 ecmr = ravb_read(ndev, ECMR); + + if (priv->duplex > 0) /* Full */ + ecmr |= ECMR_DM; + else /* Half */ + ecmr &= ~ECMR_DM; + ravb_write(ndev, ecmr, ECMR); +} + /* PHY state control function */ static void ravb_adjust_link(struct net_device *ndev) { @@ -1092,6 +1104,12 @@ static void ravb_adjust_link(struct net_device *ndev) ravb_rcv_snd_disable(ndev); if (phydev->link) { + if (info->half_duplex && phydev->duplex != priv->duplex) { + new_state = true; + priv->duplex = phydev->duplex; + ravb_set_duplex_rgeth(ndev); + } + if (phydev->speed != priv->speed) { new_state = true; priv->speed = phydev->speed; @@ -1106,6 +1124,8 @@ static void ravb_adjust_link(struct net_device *ndev) new_state = true; priv->link = 0; priv->speed = 0; + if (info->half_duplex) + priv->duplex = -1; } /* Enable TX and RX right over here, if E-MAC change is ignored */ @@ -1136,6 +1156,7 @@ static int ravb_phy_init(struct net_device *ndev) priv->link = 0; priv->speed = 0; + priv->duplex = -1; /* Try connecting to PHY */ pn = of_parse_phandle(np, "phy-handle", 0); @@ -1178,15 +1199,17 @@ static int ravb_phy_init(struct net_device *ndev) priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID) ravb_write(ndev, ravb_read(ndev, CXR35) | CXR35_SEL_MODIN, CXR35); - /* 10BASE, Pause and Asym Pause is not supported */ - phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT); - phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT); - phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_Pause_BIT); - phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_Asym_Pause_BIT); + if (!info->half_duplex) { + /* 10BASE, Pause and Asym Pause is not supported */ + phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT); + phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT); + phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_Pause_BIT); + phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_Asym_Pause_BIT); - /* Half Duplex is not supported */ - phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_1000baseT_Half_BIT); - phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT); + /* Half Duplex is not supported */ + phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_1000baseT_Half_BIT); + phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT); + } phy_attached_info(phydev); @@ -2138,6 +2161,7 @@ static const struct ravb_hw_info rgeth_hw_info = { .tx_counters = 1, .no_gptp = 1, .mii_rgmii_selection = 1, + .half_duplex = 1, }; static const struct of_device_id ravb_match_table[] = {
RZ/G2L supports half duplex mode. Add a half_duplex hw feature bit to struct ravb_hw_info for supporting half duplex mode for RZ/G2L. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- drivers/net/ethernet/renesas/ravb.h | 3 ++ drivers/net/ethernet/renesas/ravb_main.c | 40 +++++++++++++++++++----- 2 files changed, 35 insertions(+), 8 deletions(-)