mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 06:01:57 +00:00
Merge branch 'net-stmmac-provide-platform-select_pcs-method'
Russell King says: ==================== net: stmmac: provide platform select_pcs method This series adds a select_pcs() method to the stmmac platform data to allow platforms that need to provide their own PCSes to do so, moving the decision making into platform code. This avoids questions such as "what should the priority of XPCS vs some other platform PCS be?" and when we provide a PCS for the internal PCS, how that interacts with both the XPCS and platform provided PCS. Note that if a platform implements the select_pcs() method, then the return values are: - a phylink_pcs pointer - the PCS to be used. - NULL - no phylink_pcs to be used. Otherwise (if not implemented or returns an error-pointer), then allow the the stmmac internal PCS to be used if appropriate (once that patch set is merged.) Patch 1 introduces the new method. Patch 2 converts Intel mGBE to use this to provide the XPCS and removes the XPCS decision making from core code. Patch 3 provides an implementation for rzn1 to return its PCS. Patch 4 does the same for socfpga. Patch 5 removes the core code returning priv->hw->phylink_pcs. No functional change is anticipated. Once this has been merged, it will be expected that platforms should populate all three PCS methods or none of the PCS methods. ==================== Link: https://lore.kernel.org/r/ZmrLbdwv6ALoy+gs@shell.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
6a21fb7a9e
@ -443,6 +443,16 @@ static void common_default_data(struct plat_stmmacenet_data *plat)
|
||||
plat->rx_queues_cfg[0].pkt_route = 0x0;
|
||||
}
|
||||
|
||||
static struct phylink_pcs *intel_mgbe_select_pcs(struct stmmac_priv *priv,
|
||||
phy_interface_t interface)
|
||||
{
|
||||
/* plat->mdio_bus_data->has_xpcs has been set true, so there
|
||||
* should always be an XPCS. The original code would always
|
||||
* return this if present.
|
||||
*/
|
||||
return &priv->hw->xpcs->pcs;
|
||||
}
|
||||
|
||||
static int intel_mgbe_common_data(struct pci_dev *pdev,
|
||||
struct plat_stmmacenet_data *plat)
|
||||
{
|
||||
@ -587,6 +597,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
|
||||
plat->phy_interface == PHY_INTERFACE_MODE_1000BASEX) {
|
||||
plat->mdio_bus_data->has_xpcs = true;
|
||||
plat->mdio_bus_data->default_an_inband = true;
|
||||
plat->select_pcs = intel_mgbe_select_pcs;
|
||||
}
|
||||
|
||||
/* Ensure mdio bus scan skips intel serdes and pcs-xpcs */
|
||||
|
@ -39,6 +39,12 @@ static void rzn1_dwmac_pcs_exit(struct stmmac_priv *priv)
|
||||
miic_destroy(priv->hw->phylink_pcs);
|
||||
}
|
||||
|
||||
static struct phylink_pcs *rzn1_dwmac_select_pcs(struct stmmac_priv *priv,
|
||||
phy_interface_t interface)
|
||||
{
|
||||
return priv->hw->phylink_pcs;
|
||||
}
|
||||
|
||||
static int rzn1_dwmac_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct plat_stmmacenet_data *plat_dat;
|
||||
@ -57,6 +63,7 @@ static int rzn1_dwmac_probe(struct platform_device *pdev)
|
||||
plat_dat->bsp_priv = plat_dat;
|
||||
plat_dat->pcs_init = rzn1_dwmac_pcs_init;
|
||||
plat_dat->pcs_exit = rzn1_dwmac_pcs_exit;
|
||||
plat_dat->select_pcs = rzn1_dwmac_select_pcs;
|
||||
|
||||
ret = stmmac_dvr_probe(dev, plat_dat, &stmmac_res);
|
||||
if (ret)
|
||||
|
@ -429,6 +429,12 @@ static void socfpga_dwmac_pcs_exit(struct stmmac_priv *priv)
|
||||
lynx_pcs_destroy(priv->hw->phylink_pcs);
|
||||
}
|
||||
|
||||
static struct phylink_pcs *socfpga_dwmac_select_pcs(struct stmmac_priv *priv,
|
||||
phy_interface_t interface)
|
||||
{
|
||||
return priv->hw->phylink_pcs;
|
||||
}
|
||||
|
||||
static int socfpga_dwmac_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct plat_stmmacenet_data *plat_dat;
|
||||
@ -478,6 +484,7 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
|
||||
plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed;
|
||||
plat_dat->pcs_init = socfpga_dwmac_pcs_init;
|
||||
plat_dat->pcs_exit = socfpga_dwmac_pcs_exit;
|
||||
plat_dat->select_pcs = socfpga_dwmac_select_pcs;
|
||||
|
||||
ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
|
||||
if (ret)
|
||||
|
@ -949,11 +949,15 @@ 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->hw->xpcs)
|
||||
return &priv->hw->xpcs->pcs;
|
||||
if (priv->plat->select_pcs) {
|
||||
pcs = priv->plat->select_pcs(priv, interface);
|
||||
if (!IS_ERR(pcs))
|
||||
return pcs;
|
||||
}
|
||||
|
||||
return priv->hw->phylink_pcs;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void stmmac_mac_config(struct phylink_config *config, unsigned int mode,
|
||||
|
@ -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
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user