Skip to content

Commit

Permalink
net: stmmac: add select_pcs() platform method
Browse files Browse the repository at this point in the history
Allow platform drivers to provide their logic to select an appropriate
PCS.

Tested-by: Romain Gantois <romain.gantois@bootlin.com>
Reviewed-by: Romain Gantois <romain.gantois@bootlin.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/E1sHhoM-00Fesu-8E@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Russell King (Oracle) authored and Jakub Kicinski committed Jun 15, 2024
1 parent ad46951 commit 6c3282a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,13 @@ static struct phylink_pcs *stmmac_mac_select_pcs(struct phylink_config *config,
phy_interface_t interface)
{
struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
struct phylink_pcs *pcs;

if (priv->plat->select_pcs) {
pcs = priv->plat->select_pcs(priv, interface);
if (!IS_ERR(pcs))
return pcs;
}

if (priv->hw->xpcs)
return &priv->hw->xpcs->pcs;
Expand Down
4 changes: 3 additions & 1 deletion include/linux/stmmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#define __STMMAC_PLATFORM_DATA

#include <linux/platform_device.h>
#include <linux/phy.h>
#include <linux/phylink.h>

#define MTL_MAX_RX_QUEUES 8
#define MTL_MAX_TX_QUEUES 8
Expand Down Expand Up @@ -271,6 +271,8 @@ struct plat_stmmacenet_data {
void (*dump_debug_regs)(void *priv);
int (*pcs_init)(struct stmmac_priv *priv);
void (*pcs_exit)(struct stmmac_priv *priv);
struct phylink_pcs *(*select_pcs)(struct stmmac_priv *priv,
phy_interface_t interface);
void *bsp_priv;
struct clk *stmmac_clk;
struct clk *pclk;
Expand Down

0 comments on commit 6c3282a

Please sign in to comment.