* [PATCH net-next v2 0/4] net: ethernet: renesas: rswitch: Modify initialization for SERDES and PHY
@ 2023-01-10 5:02 Yoshihiro Shimoda
2023-01-10 5:02 ` [PATCH net-next v2 1/4] net: phylink: Set host_interfaces for a non-sfp PHY Yoshihiro Shimoda
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: Yoshihiro Shimoda @ 2023-01-10 5:02 UTC (permalink / raw)
To: linux, andrew, hkallweit1, davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda
The patch [1/4] sets phydev->host_interfaces by phylink for Marvell PHY
driver (marvell10g) to initialize the MACTYPE.
The patch [2/4] siplifies the rswitch driver, the patch [3/4] enables
the ovr_host_interfaces flag, and the patch [4/4] phy_power_on() calling
to initialize the Ethernet SERDES PHY driver (r8a779f0-eth-serdes)
for each channel.
Changes from v1:
https://lore.kernel.org/all/20221226071425.3895915-1-yoshihiro.shimoda.uh@renesas.com/
- Add a new flag (ovr_host_interfaces) into phylink_config in the patch [1/4].
- Add a new patch [3/4] for the new flag.
- Add a error message to the patch [4/4/] for MLO_AN_INBAND mode.
Yoshihiro Shimoda (4):
net: phylink: Set host_interfaces for a non-sfp PHY
net: ethernet: renesas: rswitch: Simplify struct phy * handling
net: ethernet: renesas: rswitch: Enable ovr_host_interfaces
net: ethernet: renesas: rswitch: Add phy_power_{on,off}() calling
drivers/net/ethernet/renesas/rswitch.c | 53 +++++++++++++++-----------
drivers/net/ethernet/renesas/rswitch.h | 1 +
drivers/net/phy/phylink.c | 9 +++++
include/linux/phylink.h | 3 ++
4 files changed, 44 insertions(+), 22 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH net-next v2 1/4] net: phylink: Set host_interfaces for a non-sfp PHY
2023-01-10 5:02 [PATCH net-next v2 0/4] net: ethernet: renesas: rswitch: Modify initialization for SERDES and PHY Yoshihiro Shimoda
@ 2023-01-10 5:02 ` Yoshihiro Shimoda
2023-01-10 14:21 ` Arun.Ramadoss
2023-01-10 5:02 ` [PATCH net-next v2 2/4] net: ethernet: renesas: rswitch: Simplify struct phy * handling Yoshihiro Shimoda
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Yoshihiro Shimoda @ 2023-01-10 5:02 UTC (permalink / raw)
To: linux, andrew, hkallweit1, davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda
If a new flag (ovr_host_interfaces) in the phylink_config is set,
overwrite the host_interfaces in the phy_device by link_interface.
Note that an ethernet PHY driver like marvell10g will check
PHY_INTERFACE_MODE_SGMII in the host_interfaces whther the host
controller supports a rate matching interface mode or not. So, set
PHY_INTERFACE_MODE_SGMII to the host_interfaces if it is set in
the supported_interfaces.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/net/phy/phylink.c | 9 +++++++++
include/linux/phylink.h | 3 +++
2 files changed, 12 insertions(+)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 09cc65c0da93..0d863e55994e 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1809,6 +1809,15 @@ int phylink_fwnode_phy_connect(struct phylink *pl,
pl->link_interface = phy_dev->interface;
pl->link_config.interface = pl->link_interface;
}
+ if (pl->config->ovr_host_interfaces) {
+ __set_bit(pl->link_interface, phy_dev->host_interfaces);
+ /* An ethernet PHY driver will check PHY_INTERFACE_MODE_SGMII
+ * in the host_interfaces whether the host controller supports
+ * a rate matching interface mode or not.
+ */
+ if (test_bit(PHY_INTERFACE_MODE_SGMII, pl->config->supported_interfaces))
+ __set_bit(PHY_INTERFACE_MODE_SGMII, phy_dev->host_interfaces);
+ }
ret = phy_attach_direct(pl->netdev, phy_dev, flags,
pl->link_interface);
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index c492c26202b5..c8dd53b1e857 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -124,6 +124,8 @@ enum phylink_op_type {
* if MAC link is at %MLO_AN_FIXED mode.
* @mac_managed_pm: if true, indicate the MAC driver is responsible for PHY PM.
* @ovr_an_inband: if true, override PCS to MLO_AN_INBAND
+ * @ovr_host_interfaces: if true, override host_interfaces of phy_device from
+ * link_interface.
* @get_fixed_state: callback to execute to determine the fixed link state,
* if MAC link is at %MLO_AN_FIXED mode.
* @supported_interfaces: bitmap describing which PHY_INTERFACE_MODE_xxx
@@ -137,6 +139,7 @@ struct phylink_config {
bool poll_fixed_state;
bool mac_managed_pm;
bool ovr_an_inband;
+ bool ovr_host_interfaces;
void (*get_fixed_state)(struct phylink_config *config,
struct phylink_link_state *state);
DECLARE_PHY_INTERFACE_MASK(supported_interfaces);
--
2.25.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net-next v2 2/4] net: ethernet: renesas: rswitch: Simplify struct phy * handling
2023-01-10 5:02 [PATCH net-next v2 0/4] net: ethernet: renesas: rswitch: Modify initialization for SERDES and PHY Yoshihiro Shimoda
2023-01-10 5:02 ` [PATCH net-next v2 1/4] net: phylink: Set host_interfaces for a non-sfp PHY Yoshihiro Shimoda
@ 2023-01-10 5:02 ` Yoshihiro Shimoda
2023-01-10 14:15 ` Arun.Ramadoss
2023-01-10 5:02 ` [PATCH net-next v2 3/4] net: ethernet: renesas: rswitch: Enable ovr_host_interfaces Yoshihiro Shimoda
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Yoshihiro Shimoda @ 2023-01-10 5:02 UTC (permalink / raw)
To: linux, andrew, hkallweit1, davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda
Simplify struct phy *serdes handling by keeping the valiable in
the struct rswitch_device.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/net/ethernet/renesas/rswitch.c | 40 ++++++++++++--------------
drivers/net/ethernet/renesas/rswitch.h | 1 +
2 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index 6441892636db..ca79ee168206 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -1235,49 +1235,40 @@ static void rswitch_phylink_deinit(struct rswitch_device *rdev)
phylink_destroy(rdev->phylink);
}
-static int rswitch_serdes_set_params(struct rswitch_device *rdev)
+static int rswitch_serdes_phy_get(struct rswitch_device *rdev)
{
struct device_node *port = rswitch_get_port_node(rdev);
struct phy *serdes;
- int err;
serdes = devm_of_phy_get(&rdev->priv->pdev->dev, port, NULL);
of_node_put(port);
if (IS_ERR(serdes))
return PTR_ERR(serdes);
+ rdev->serdes = serdes;
+
+ return 0;
+}
+
+static int rswitch_serdes_set_params(struct rswitch_device *rdev)
+{
+ int err;
- err = phy_set_mode_ext(serdes, PHY_MODE_ETHERNET,
+ err = phy_set_mode_ext(rdev->serdes, PHY_MODE_ETHERNET,
rdev->etha->phy_interface);
if (err < 0)
return err;
- return phy_set_speed(serdes, rdev->etha->speed);
+ return phy_set_speed(rdev->serdes, rdev->etha->speed);
}
static int rswitch_serdes_init(struct rswitch_device *rdev)
{
- struct device_node *port = rswitch_get_port_node(rdev);
- struct phy *serdes;
-
- serdes = devm_of_phy_get(&rdev->priv->pdev->dev, port, NULL);
- of_node_put(port);
- if (IS_ERR(serdes))
- return PTR_ERR(serdes);
-
- return phy_init(serdes);
+ return phy_init(rdev->serdes);
}
static int rswitch_serdes_deinit(struct rswitch_device *rdev)
{
- struct device_node *port = rswitch_get_port_node(rdev);
- struct phy *serdes;
-
- serdes = devm_of_phy_get(&rdev->priv->pdev->dev, port, NULL);
- of_node_put(port);
- if (IS_ERR(serdes))
- return PTR_ERR(serdes);
-
- return phy_exit(serdes);
+ return phy_exit(rdev->serdes);
}
static int rswitch_ether_port_init_one(struct rswitch_device *rdev)
@@ -1299,6 +1290,10 @@ static int rswitch_ether_port_init_one(struct rswitch_device *rdev)
if (err < 0)
goto err_phylink_init;
+ err = rswitch_serdes_phy_get(rdev);
+ if (err < 0)
+ goto err_serdes_phy_get;
+
err = rswitch_serdes_set_params(rdev);
if (err < 0)
goto err_serdes_set_params;
@@ -1306,6 +1301,7 @@ static int rswitch_ether_port_init_one(struct rswitch_device *rdev)
return 0;
err_serdes_set_params:
+err_serdes_phy_get:
rswitch_phylink_deinit(rdev);
err_phylink_init:
diff --git a/drivers/net/ethernet/renesas/rswitch.h b/drivers/net/ethernet/renesas/rswitch.h
index edbdd1b98d3d..d9a0be6666f5 100644
--- a/drivers/net/ethernet/renesas/rswitch.h
+++ b/drivers/net/ethernet/renesas/rswitch.h
@@ -941,6 +941,7 @@ struct rswitch_device {
int port;
struct rswitch_etha *etha;
+ struct phy *serdes;
};
struct rswitch_mfwd_mac_table_entry {
--
2.25.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net-next v2 3/4] net: ethernet: renesas: rswitch: Enable ovr_host_interfaces
2023-01-10 5:02 [PATCH net-next v2 0/4] net: ethernet: renesas: rswitch: Modify initialization for SERDES and PHY Yoshihiro Shimoda
2023-01-10 5:02 ` [PATCH net-next v2 1/4] net: phylink: Set host_interfaces for a non-sfp PHY Yoshihiro Shimoda
2023-01-10 5:02 ` [PATCH net-next v2 2/4] net: ethernet: renesas: rswitch: Simplify struct phy * handling Yoshihiro Shimoda
@ 2023-01-10 5:02 ` Yoshihiro Shimoda
2023-01-10 5:02 ` [PATCH net-next v2 4/4] net: ethernet: renesas: rswitch: Add phy_power_{on,off}() calling Yoshihiro Shimoda
2023-01-10 14:35 ` [PATCH net-next v2 0/4] net: ethernet: renesas: rswitch: Modify initialization for SERDES and PHY Russell King (Oracle)
4 siblings, 0 replies; 11+ messages in thread
From: Yoshihiro Shimoda @ 2023-01-10 5:02 UTC (permalink / raw)
To: linux, andrew, hkallweit1, davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda
Enable ovr_host_interfaces to set the host_interfaces of phy_dev
for a non-sfp PHY.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/net/ethernet/renesas/rswitch.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index ca79ee168206..5a8a0c48dfd3 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -1208,6 +1208,7 @@ static int rswitch_phylink_init(struct rswitch_device *rdev)
rdev->phylink_config.dev = &rdev->ndev->dev;
rdev->phylink_config.type = PHYLINK_NETDEV;
+ rdev->phylink_config.ovr_host_interfaces = true;
__set_bit(PHY_INTERFACE_MODE_SGMII, rdev->phylink_config.supported_interfaces);
__set_bit(PHY_INTERFACE_MODE_USXGMII, rdev->phylink_config.supported_interfaces);
rdev->phylink_config.mac_capabilities = MAC_100FD | MAC_1000FD | MAC_2500FD;
--
2.25.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net-next v2 4/4] net: ethernet: renesas: rswitch: Add phy_power_{on,off}() calling
2023-01-10 5:02 [PATCH net-next v2 0/4] net: ethernet: renesas: rswitch: Modify initialization for SERDES and PHY Yoshihiro Shimoda
` (2 preceding siblings ...)
2023-01-10 5:02 ` [PATCH net-next v2 3/4] net: ethernet: renesas: rswitch: Enable ovr_host_interfaces Yoshihiro Shimoda
@ 2023-01-10 5:02 ` Yoshihiro Shimoda
2023-01-10 14:35 ` [PATCH net-next v2 0/4] net: ethernet: renesas: rswitch: Modify initialization for SERDES and PHY Russell King (Oracle)
4 siblings, 0 replies; 11+ messages in thread
From: Yoshihiro Shimoda @ 2023-01-10 5:02 UTC (permalink / raw)
To: linux, andrew, hkallweit1, davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda
Some Ethernet PHYs (like marvell10g) will decide the host interface
mode by the media-side speed. So, the rswitch driver needs to
initialize one of the Ethernet SERDES (r8a779f0-eth-serdes) ports
after linked the Ethernet PHY up. The r8a779f0-eth-serdes driver has
.init() for initializing all ports and .power_on() for initializing
each port. So, add phy_power_{on,off} calling for it.
Notes that in-band mode will not work because the initialization
is not completed. So, output error message if in-band mode.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/net/ethernet/renesas/rswitch.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index 5a8a0c48dfd3..c027c2be9151 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -1174,12 +1174,20 @@ static void rswitch_mac_config(struct phylink_config *config,
unsigned int mode,
const struct phylink_link_state *state)
{
+ struct net_device *ndev = to_net_dev(config->dev);
+
+ if (mode == MLO_AN_INBAND)
+ netdev_err(ndev, "Link up/down will not work because in-band mode\n");
}
static void rswitch_mac_link_down(struct phylink_config *config,
unsigned int mode,
phy_interface_t interface)
{
+ struct net_device *ndev = to_net_dev(config->dev);
+ struct rswitch_device *rdev = netdev_priv(ndev);
+
+ phy_power_off(rdev->serdes);
}
static void rswitch_mac_link_up(struct phylink_config *config,
@@ -1187,7 +1195,11 @@ static void rswitch_mac_link_up(struct phylink_config *config,
phy_interface_t interface, int speed,
int duplex, bool tx_pause, bool rx_pause)
{
+ struct net_device *ndev = to_net_dev(config->dev);
+ struct rswitch_device *rdev = netdev_priv(ndev);
+
/* Current hardware cannot change speed at runtime */
+ phy_power_on(rdev->serdes);
}
static const struct phylink_mac_ops rswitch_phylink_ops = {
--
2.25.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v2 2/4] net: ethernet: renesas: rswitch: Simplify struct phy * handling
2023-01-10 5:02 ` [PATCH net-next v2 2/4] net: ethernet: renesas: rswitch: Simplify struct phy * handling Yoshihiro Shimoda
@ 2023-01-10 14:15 ` Arun.Ramadoss
2023-01-12 7:32 ` Yoshihiro Shimoda
0 siblings, 1 reply; 11+ messages in thread
From: Arun.Ramadoss @ 2023-01-10 14:15 UTC (permalink / raw)
To: andrew, yoshihiro.shimoda.uh, linux, kuba, pabeni, edumazet,
davem, hkallweit1
Cc: netdev, linux-renesas-soc
Hi Yoshihiro,
On Tue, 2023-01-10 at 14:02 +0900, Yoshihiro Shimoda wrote:
> Simplify struct phy *serdes handling by keeping the valiable in
> the struct rswitch_device.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
> drivers/net/ethernet/renesas/rswitch.c | 40 ++++++++++++----------
> ----
> drivers/net/ethernet/renesas/rswitch.h | 1 +
> 2 files changed, 19 insertions(+), 22 deletions(-)
>
>
>
> -static int rswitch_serdes_set_params(struct rswitch_device *rdev)
>
>
> static int rswitch_ether_port_init_one(struct rswitch_device *rdev)
> @@ -1299,6 +1290,10 @@ static int rswitch_ether_port_init_one(struct
> rswitch_device *rdev)
> if (err < 0)
> goto err_phylink_init;
>
> + err = rswitch_serdes_phy_get(rdev);
> + if (err < 0)
> + goto err_serdes_phy_get;
I think, we can use *err_serdes_set_params* instead of creating new
label err_serdes_phy_get, since the label is not doing any work.
> +
> err = rswitch_serdes_set_params(rdev);
> if (err < 0)
> goto err_serdes_set_params;
> @@ -1306,6 +1301,7 @@ static int rswitch_ether_port_init_one(struct
> rswitch_device *rdev)
> return 0;
>
> err_serdes_set_params:
> +err_serdes_phy_get:
> rswitch_phylink_deinit(rdev);
>
> err_phylink_init:
> diff --git a/drivers/net/ethernet/renesas/rswitch.h
> b/drivers/net/ethernet/renesas/rswitch.h
> index edbdd1b98d3d..d9a0be6666f5 100644
> --- a/drivers/net/ethernet/renesas/rswitch.h
> +++ b/drivers/net/ethernet/renesas/rswitch.h
> @@ -941,6 +941,7 @@ struct rswitch_device {
>
> int port;
> struct rswitch_etha *etha;
> + struct phy *serdes;
> };
>
> struct rswitch_mfwd_mac_table_entry {
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v2 1/4] net: phylink: Set host_interfaces for a non-sfp PHY
2023-01-10 5:02 ` [PATCH net-next v2 1/4] net: phylink: Set host_interfaces for a non-sfp PHY Yoshihiro Shimoda
@ 2023-01-10 14:21 ` Arun.Ramadoss
2023-01-12 7:33 ` Yoshihiro Shimoda
0 siblings, 1 reply; 11+ messages in thread
From: Arun.Ramadoss @ 2023-01-10 14:21 UTC (permalink / raw)
To: andrew, yoshihiro.shimoda.uh, linux, kuba, pabeni, edumazet,
davem, hkallweit1
Cc: netdev, linux-renesas-soc
Hi Yoshihiro,
On Tue, 2023-01-10 at 14:02 +0900, Yoshihiro Shimoda wrote:
> If a new flag (ovr_host_interfaces) in the phylink_config is set,
> overwrite the host_interfaces in the phy_device by link_interface.
>
> Note that an ethernet PHY driver like marvell10g will check
> PHY_INTERFACE_MODE_SGMII in the host_interfaces whther the host
> controller supports a rate matching interface mode or not. So, set
> PHY_INTERFACE_MODE_SGMII to the host_interfaces if it is set in
> the supported_interfaces.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
> drivers/net/phy/phylink.c | 9 +++++++++
> include/linux/phylink.h | 3 +++
> 2 files changed, 12 insertions(+)
>
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 09cc65c0da93..0d863e55994e 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -1809,6 +1809,15 @@ int phylink_fwnode_phy_connect(struct phylink
> *pl,
> pl->link_interface = phy_dev->interface;
> pl->link_config.interface = pl->link_interface;
> }
> + if (pl->config->ovr_host_interfaces) {
> + __set_bit(pl->link_interface, phy_dev-
> >host_interfaces);
Blank line before comment will increase the readability.
> + /* An ethernet PHY driver will check
> PHY_INTERFACE_MODE_SGMII
> + * in the host_interfaces whether the host controller
> supports
> + * a rate matching interface mode or not.
> + */
Commit message description and this comment are same. following code
snippet implies it test the SGMII in supported interfaces and set it in
phy_dev.
> + if (test_bit(PHY_INTERFACE_MODE_SGMII, pl->config-
> >supported_interfaces))
> + __set_bit(PHY_INTERFACE_MODE_SGMII, phy_dev-
> >host_interfaces);
> + }
>
> ret = phy_attach_direct(pl->netdev, phy_dev, flags,
> pl->link_interface);
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v2 0/4] net: ethernet: renesas: rswitch: Modify initialization for SERDES and PHY
2023-01-10 5:02 [PATCH net-next v2 0/4] net: ethernet: renesas: rswitch: Modify initialization for SERDES and PHY Yoshihiro Shimoda
` (3 preceding siblings ...)
2023-01-10 5:02 ` [PATCH net-next v2 4/4] net: ethernet: renesas: rswitch: Add phy_power_{on,off}() calling Yoshihiro Shimoda
@ 2023-01-10 14:35 ` Russell King (Oracle)
2023-01-12 1:09 ` Yoshihiro Shimoda
4 siblings, 1 reply; 11+ messages in thread
From: Russell King (Oracle) @ 2023-01-10 14:35 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: andrew, hkallweit1, davem, edumazet, kuba, pabeni, netdev,
linux-renesas-soc
On Tue, Jan 10, 2023 at 02:02:02PM +0900, Yoshihiro Shimoda wrote:
> The patch [1/4] sets phydev->host_interfaces by phylink for Marvell PHY
> driver (marvell10g) to initialize the MACTYPE.
I don't yet understand the "why" behind the need for this. Doesn't your
platform strap the 88x3310 correctly, so MACTYPE is properly set?
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH net-next v2 0/4] net: ethernet: renesas: rswitch: Modify initialization for SERDES and PHY
2023-01-10 14:35 ` [PATCH net-next v2 0/4] net: ethernet: renesas: rswitch: Modify initialization for SERDES and PHY Russell King (Oracle)
@ 2023-01-12 1:09 ` Yoshihiro Shimoda
0 siblings, 0 replies; 11+ messages in thread
From: Yoshihiro Shimoda @ 2023-01-12 1:09 UTC (permalink / raw)
To: Russell King
Cc: andrew, hkallweit1, davem, edumazet, kuba, pabeni, netdev,
linux-renesas-soc
Hi Russell,
> From: Russell King, Sent: Tuesday, January 10, 2023 11:36 PM
>
> On Tue, Jan 10, 2023 at 02:02:02PM +0900, Yoshihiro Shimoda wrote:
> > The patch [1/4] sets phydev->host_interfaces by phylink for Marvell PHY
> > driver (marvell10g) to initialize the MACTYPE.
>
> I don't yet understand the "why" behind the need for this. Doesn't your
> platform strap the 88x3310 correctly, so MACTYPE is properly set?
Oops! I should have shared why the patches are needed.
You're correct.
- My platform has the 88x2110.
- The MACTYPE setting of strap pin on the platform is SXGMII.
- However, we realized that the SoC cannot communicate the PHY with SXGMII
because of mismatching hardware specification.
- We have a lot of boards which mismatch the MACTYPE setting.
So, I would like to change the MACTYPE as SGMII by software for the platform.
Best regards,
Yoshihiro Shimoda
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH net-next v2 2/4] net: ethernet: renesas: rswitch: Simplify struct phy * handling
2023-01-10 14:15 ` Arun.Ramadoss
@ 2023-01-12 7:32 ` Yoshihiro Shimoda
0 siblings, 0 replies; 11+ messages in thread
From: Yoshihiro Shimoda @ 2023-01-12 7:32 UTC (permalink / raw)
To: Arun.Ramadoss, andrew, linux, kuba, pabeni, edumazet, davem, hkallweit1
Cc: netdev, linux-renesas-soc
Hi Arun,
> From: Arun.Ramadoss@microchip.com, Sent: Tuesday, January 10, 2023 11:15 PM
>
> Hi Yoshihiro,
> On Tue, 2023-01-10 at 14:02 +0900, Yoshihiro Shimoda wrote:
> > Simplify struct phy *serdes handling by keeping the valiable in
> > the struct rswitch_device.
> >
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> > ---
> > drivers/net/ethernet/renesas/rswitch.c | 40 ++++++++++++----------
> > ----
> > drivers/net/ethernet/renesas/rswitch.h | 1 +
> > 2 files changed, 19 insertions(+), 22 deletions(-)
> >
> >
> >
> > -static int rswitch_serdes_set_params(struct rswitch_device *rdev)
> >
> >
> > static int rswitch_ether_port_init_one(struct rswitch_device *rdev)
> > @@ -1299,6 +1290,10 @@ static int rswitch_ether_port_init_one(struct
> > rswitch_device *rdev)
> > if (err < 0)
> > goto err_phylink_init;
> >
> > + err = rswitch_serdes_phy_get(rdev);
> > + if (err < 0)
> > + goto err_serdes_phy_get;
>
> I think, we can use *err_serdes_set_params* instead of creating new
> label err_serdes_phy_get, since the label is not doing any work.
Thank you for your comment. However, this driver already has a similar
label and error handling like below:
---
err = rswitch_gwca_request_irqs(priv);
if (err < 0)
goto err_gwca_request_irq;
err = rswitch_gwca_hw_init(priv);
if (err < 0)
goto err_gwca_hw_init;
...
err_gwca_hw_init:
err_gwca_request_irq:
rcar_gen4_ptp_unregister(priv->ptp_priv);
---
The err_ labels are related to the functions.
So, I think keeping same function names/label names is
better for readability.
Best regards,
Yoshihiro Shimoda
> > +
> > err = rswitch_serdes_set_params(rdev);
> > if (err < 0)
> > goto err_serdes_set_params;
> > @@ -1306,6 +1301,7 @@ static int rswitch_ether_port_init_one(struct
> > rswitch_device *rdev)
> > return 0;
> >
> > err_serdes_set_params:
> > +err_serdes_phy_get:
> > rswitch_phylink_deinit(rdev);
> >
> > err_phylink_init:
> > diff --git a/drivers/net/ethernet/renesas/rswitch.h
> > b/drivers/net/ethernet/renesas/rswitch.h
> > index edbdd1b98d3d..d9a0be6666f5 100644
> > --- a/drivers/net/ethernet/renesas/rswitch.h
> > +++ b/drivers/net/ethernet/renesas/rswitch.h
> > @@ -941,6 +941,7 @@ struct rswitch_device {
> >
> > int port;
> > struct rswitch_etha *etha;
> > + struct phy *serdes;
> > };
> >
> > struct rswitch_mfwd_mac_table_entry {
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH net-next v2 1/4] net: phylink: Set host_interfaces for a non-sfp PHY
2023-01-10 14:21 ` Arun.Ramadoss
@ 2023-01-12 7:33 ` Yoshihiro Shimoda
0 siblings, 0 replies; 11+ messages in thread
From: Yoshihiro Shimoda @ 2023-01-12 7:33 UTC (permalink / raw)
To: Arun.Ramadoss, andrew, linux, kuba, pabeni, edumazet, davem, hkallweit1
Cc: netdev, linux-renesas-soc
Hi Arun,
> From: Arun.Ramadoss@microchip.com, Sent: Tuesday, January 10, 2023 11:21 PM
>
> Hi Yoshihiro,
> On Tue, 2023-01-10 at 14:02 +0900, Yoshihiro Shimoda wrote:
> > If a new flag (ovr_host_interfaces) in the phylink_config is set,
> > overwrite the host_interfaces in the phy_device by link_interface.
> >
> > Note that an ethernet PHY driver like marvell10g will check
> > PHY_INTERFACE_MODE_SGMII in the host_interfaces whther the host
> > controller supports a rate matching interface mode or not. So, set
> > PHY_INTERFACE_MODE_SGMII to the host_interfaces if it is set in
> > the supported_interfaces.
> >
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> > ---
> > drivers/net/phy/phylink.c | 9 +++++++++
> > include/linux/phylink.h | 3 +++
> > 2 files changed, 12 insertions(+)
> >
> > diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> > index 09cc65c0da93..0d863e55994e 100644
> > --- a/drivers/net/phy/phylink.c
> > +++ b/drivers/net/phy/phylink.c
> > @@ -1809,6 +1809,15 @@ int phylink_fwnode_phy_connect(struct phylink
> > *pl,
> > pl->link_interface = phy_dev->interface;
> > pl->link_config.interface = pl->link_interface;
> > }
> > + if (pl->config->ovr_host_interfaces) {
> > + __set_bit(pl->link_interface, phy_dev-
> > >host_interfaces);
>
> Blank line before comment will increase the readability.
I got it.
> > + /* An ethernet PHY driver will check
> > PHY_INTERFACE_MODE_SGMII
> > + * in the host_interfaces whether the host controller
> > supports
> > + * a rate matching interface mode or not.
> > + */
>
> Commit message description and this comment are same. following code
> snippet implies it test the SGMII in supported interfaces and set it in
> phy_dev.
Thank you for your comment! You're correct.
But, I don't understand what I should fix.
Best regards,
Yoshihiro Shimoda
> > + if (test_bit(PHY_INTERFACE_MODE_SGMII, pl->config-
> > >supported_interfaces))
> > + __set_bit(PHY_INTERFACE_MODE_SGMII, phy_dev-
> > >host_interfaces);
> > + }
> >
> > ret = phy_attach_direct(pl->netdev, phy_dev, flags,
> > pl->link_interface);
> >
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-01-12 7:33 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 5:02 [PATCH net-next v2 0/4] net: ethernet: renesas: rswitch: Modify initialization for SERDES and PHY Yoshihiro Shimoda
2023-01-10 5:02 ` [PATCH net-next v2 1/4] net: phylink: Set host_interfaces for a non-sfp PHY Yoshihiro Shimoda
2023-01-10 14:21 ` Arun.Ramadoss
2023-01-12 7:33 ` Yoshihiro Shimoda
2023-01-10 5:02 ` [PATCH net-next v2 2/4] net: ethernet: renesas: rswitch: Simplify struct phy * handling Yoshihiro Shimoda
2023-01-10 14:15 ` Arun.Ramadoss
2023-01-12 7:32 ` Yoshihiro Shimoda
2023-01-10 5:02 ` [PATCH net-next v2 3/4] net: ethernet: renesas: rswitch: Enable ovr_host_interfaces Yoshihiro Shimoda
2023-01-10 5:02 ` [PATCH net-next v2 4/4] net: ethernet: renesas: rswitch: Add phy_power_{on,off}() calling Yoshihiro Shimoda
2023-01-10 14:35 ` [PATCH net-next v2 0/4] net: ethernet: renesas: rswitch: Modify initialization for SERDES and PHY Russell King (Oracle)
2023-01-12 1:09 ` Yoshihiro Shimoda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).