* [PATCH net-next 0/2] net: renesas: rswitch: Add speed change support
@ 2023-08-03 12:06 Yoshihiro Shimoda
2023-08-03 12:06 ` [PATCH net-next 1/2] net: renesas: rswitch: Add runtime " Yoshihiro Shimoda
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2023-08-03 12:06 UTC (permalink / raw)
To: s.shtylyov, davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda
Add speed change support at runtime for the latest SoC version.
Also, add ethtool .[gs]et_link_ksettings.
Yoshihiro Shimoda (2):
net: renesas: rswitch: Add runtime speed change support
net: renesas: rswitch: Add .[gs]et_link_ksettings support
drivers/net/ethernet/renesas/rswitch.c | 29 +++++++++++++++++++++++---
drivers/net/ethernet/renesas/rswitch.h | 1 +
2 files changed, 27 insertions(+), 3 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next 1/2] net: renesas: rswitch: Add runtime speed change support
2023-08-03 12:06 [PATCH net-next 0/2] net: renesas: rswitch: Add speed change support Yoshihiro Shimoda
@ 2023-08-03 12:06 ` Yoshihiro Shimoda
2023-08-05 1:02 ` Jakub Kicinski
2023-08-03 12:06 ` [PATCH net-next 2/2] net: renesas: rswitch: Add .[gs]et_link_ksettings support Yoshihiro Shimoda
2023-08-04 13:47 ` [PATCH net-next 0/2] net: renesas: rswitch: Add speed change support Simon Horman
2 siblings, 1 reply; 6+ messages in thread
From: Yoshihiro Shimoda @ 2023-08-03 12:06 UTC (permalink / raw)
To: s.shtylyov, davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda
The latest SoC version can support runtime speed change. So,
add detect SoC version by using soc_device_match() and then
reconfigure the hardware of this and SerDes if needed.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/net/ethernet/renesas/rswitch.c | 27 +++++++++++++++++++++++---
drivers/net/ethernet/renesas/rswitch.h | 1 +
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index 0ba7fb75d589..2c1c584f0ca4 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -20,6 +20,7 @@
#include <linux/rtnetlink.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
+#include <linux/sys_soc.h>
#include "rswitch.h"
@@ -1243,7 +1244,6 @@ static void rswitch_adjust_link(struct net_device *ndev)
struct rswitch_device *rdev = netdev_priv(ndev);
struct phy_device *phydev = ndev->phydev;
- /* Current hardware has a restriction not to change speed at runtime */
if (phydev->link != rdev->etha->link) {
phy_print_status(phydev);
if (phydev->link)
@@ -1252,13 +1252,23 @@ static void rswitch_adjust_link(struct net_device *ndev)
phy_power_off(rdev->serdes);
rdev->etha->link = phydev->link;
+
+ if (!rdev->priv->etha_no_runtime_change &&
+ phydev->speed != rdev->etha->speed) {
+ rdev->etha->speed = phydev->speed;
+
+ rswitch_etha_hw_init(rdev->etha, rdev->ndev->dev_addr);
+ phy_set_speed(rdev->serdes, rdev->etha->speed);
+ }
}
}
static void rswitch_phy_remove_link_mode(struct rswitch_device *rdev,
struct phy_device *phydev)
{
- /* Current hardware has a restriction not to change speed at runtime */
+ if (!rdev->priv->etha_no_runtime_change)
+ return;
+
switch (rdev->etha->speed) {
case SPEED_2500:
phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_1000baseT_Full_BIT);
@@ -1347,7 +1357,8 @@ static int rswitch_ether_port_init_one(struct rswitch_device *rdev)
err = rswitch_etha_hw_init(rdev->etha, rdev->ndev->dev_addr);
if (err < 0)
return err;
- rdev->etha->operated = true;
+ if (rdev->priv->etha_no_runtime_change)
+ rdev->etha->operated = true;
}
err = rswitch_mii_register(rdev);
@@ -1853,8 +1864,14 @@ static int rswitch_init(struct rswitch_private *priv)
return err;
}
+static const struct soc_device_attribute rswitch_soc_match[] = {
+ { .soc_id = "r8a779f0", .revision = "ES1.0" },
+ { /* Sentinel */ }
+};
+
static int renesas_eth_sw_probe(struct platform_device *pdev)
{
+ const struct soc_device_attribute *attr;
struct rswitch_private *priv;
struct resource *res;
int ret;
@@ -1869,6 +1886,10 @@ static int renesas_eth_sw_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;
+ attr = soc_device_match(rswitch_soc_match);
+ if (attr)
+ priv->etha_no_runtime_change = true;
+
priv->ptp_priv = rcar_gen4_ptp_alloc(pdev);
if (!priv->ptp_priv)
return -ENOMEM;
diff --git a/drivers/net/ethernet/renesas/rswitch.h b/drivers/net/ethernet/renesas/rswitch.h
index bb9ed971a97c..54f397effbc6 100644
--- a/drivers/net/ethernet/renesas/rswitch.h
+++ b/drivers/net/ethernet/renesas/rswitch.h
@@ -1011,6 +1011,7 @@ struct rswitch_private {
struct rswitch_etha etha[RSWITCH_NUM_PORTS];
struct rswitch_mfwd mfwd;
+ bool etha_no_runtime_change;
bool gwca_halt;
};
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 2/2] net: renesas: rswitch: Add .[gs]et_link_ksettings support
2023-08-03 12:06 [PATCH net-next 0/2] net: renesas: rswitch: Add speed change support Yoshihiro Shimoda
2023-08-03 12:06 ` [PATCH net-next 1/2] net: renesas: rswitch: Add runtime " Yoshihiro Shimoda
@ 2023-08-03 12:06 ` Yoshihiro Shimoda
2023-08-04 13:47 ` [PATCH net-next 0/2] net: renesas: rswitch: Add speed change support Simon Horman
2 siblings, 0 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2023-08-03 12:06 UTC (permalink / raw)
To: s.shtylyov, davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda
Add .[gs]et_link_ksettings support by using
phy_ethtool_[gs]et_link_ksettings() functions.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/net/ethernet/renesas/rswitch.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index 2c1c584f0ca4..e1731f179d30 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -1664,6 +1664,8 @@ static int rswitch_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *
static const struct ethtool_ops rswitch_ethtool_ops = {
.get_ts_info = rswitch_get_ts_info,
+ .get_link_ksettings = phy_ethtool_get_link_ksettings,
+ .set_link_ksettings = phy_ethtool_set_link_ksettings,
};
static const struct of_device_id renesas_eth_sw_of_table[] = {
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/2] net: renesas: rswitch: Add speed change support
2023-08-03 12:06 [PATCH net-next 0/2] net: renesas: rswitch: Add speed change support Yoshihiro Shimoda
2023-08-03 12:06 ` [PATCH net-next 1/2] net: renesas: rswitch: Add runtime " Yoshihiro Shimoda
2023-08-03 12:06 ` [PATCH net-next 2/2] net: renesas: rswitch: Add .[gs]et_link_ksettings support Yoshihiro Shimoda
@ 2023-08-04 13:47 ` Simon Horman
2 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2023-08-04 13:47 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: s.shtylyov, davem, edumazet, kuba, pabeni, netdev,
linux-renesas-soc, alexanderduyck
+ Alexander Duyck
On Thu, Aug 03, 2023 at 09:06:19PM +0900, Yoshihiro Shimoda wrote:
> Add speed change support at runtime for the latest SoC version.
> Also, add ethtool .[gs]et_link_ksettings.
>
> Yoshihiro Shimoda (2):
> net: renesas: rswitch: Add runtime speed change support
> net: renesas: rswitch: Add .[gs]et_link_ksettings support
Thanks Shimoda-san,
this looks good to me.
For the series,
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/2] net: renesas: rswitch: Add runtime speed change support
2023-08-03 12:06 ` [PATCH net-next 1/2] net: renesas: rswitch: Add runtime " Yoshihiro Shimoda
@ 2023-08-05 1:02 ` Jakub Kicinski
2023-08-06 23:58 ` Yoshihiro Shimoda
0 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2023-08-05 1:02 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: s.shtylyov, davem, edumazet, pabeni, netdev, linux-renesas-soc
On Thu, 3 Aug 2023 21:06:20 +0900 Yoshihiro Shimoda wrote:
> +static const struct soc_device_attribute rswitch_soc_match[] = {
nit: maybe a better than for this table would be good?
To indicate what IDs it holds. E.g. rswitch_soc_no_speed_change[] ?
> + { .soc_id = "r8a779f0", .revision = "ES1.0" },
> + { /* Sentinel */ }
> +};
--
pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH net-next 1/2] net: renesas: rswitch: Add runtime speed change support
2023-08-05 1:02 ` Jakub Kicinski
@ 2023-08-06 23:58 ` Yoshihiro Shimoda
0 siblings, 0 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2023-08-06 23:58 UTC (permalink / raw)
To: Jakub Kicinski
Cc: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, netdev@vger.kernel.org,
linux-renesas-soc@vger.kernel.org
Hi Jakub,
> From: Jakub Kicinski, Sent: Saturday, August 5, 2023 10:03 AM
>
> On Thu, 3 Aug 2023 21:06:20 +0900 Yoshihiro Shimoda wrote:
> > +static const struct soc_device_attribute rswitch_soc_match[] = {
>
> nit: maybe a better than for this table would be good?
> To indicate what IDs it holds. E.g. rswitch_soc_no_speed_change[] ?
Thank you for your suggestion! I think so. I'll fix this name on v2.
Best regards,
Yoshihiro Shimoda
> > + { .soc_id = "r8a779f0", .revision = "ES1.0" },
> > + { /* Sentinel */ }
> > +};
> --
> pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-08-06 23:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-03 12:06 [PATCH net-next 0/2] net: renesas: rswitch: Add speed change support Yoshihiro Shimoda
2023-08-03 12:06 ` [PATCH net-next 1/2] net: renesas: rswitch: Add runtime " Yoshihiro Shimoda
2023-08-05 1:02 ` Jakub Kicinski
2023-08-06 23:58 ` Yoshihiro Shimoda
2023-08-03 12:06 ` [PATCH net-next 2/2] net: renesas: rswitch: Add .[gs]et_link_ksettings support Yoshihiro Shimoda
2023-08-04 13:47 ` [PATCH net-next 0/2] net: renesas: rswitch: Add speed change support Simon Horman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.