linux-imx/drivers/net/pcs/mtip_backplane.h
Vladimir Oltean de750c69a7 net: pcs: lynx: use MTIP AN/LT block for copper backplanes
If the phylink_pcs is in the MLO_AN_C73 mode, then the Lynx PCS makes
use of the AN/LT block to advertise the supported backplane link modes
using clause 73 autoneg.

Note that we could also be advertising BASE-CR link modes (for SFP28
modules) but we don't have a way of detecting the medium type, so we
just hardcode backplane (BASE-K) for now.

Note that we find out whether we operate in MLO_AN_C73 mode a bit late
(later than lynx_pcs_create()). So we need mtip_backplane_create() to
not actually do anything until we know that C73 is required, and delay
any configuration until the phylink state machine kicks in.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 17:16:57 +08:00

90 lines
2.2 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright 2023 NXP
*/
#ifndef _MTIP_BACKPLANE_H
#define _MTIP_BACKPLANE_H
struct mdio_device;
struct mtip_backplane;
struct phy;
struct phylink_link_state;
enum mtip_model {
MTIP_MODEL_AUTODETECT,
MTIP_MODEL_LX2160A,
};
#define MTIP_PRIMARY_LANE 0
#define MTIP_MAX_NUM_LANES 4
#if IS_ENABLED(CONFIG_MTIP_BACKPLANE_PHY)
int mtip_backplane_config_aneg(struct mtip_backplane *priv, bool autoneg,
const unsigned long *advertising);
void mtip_backplane_an_restart(struct mtip_backplane *priv);
void mtip_backplane_get_state(struct mtip_backplane *priv,
struct phylink_link_state *state);
int mtip_backplane_suspend(struct mtip_backplane *priv);
int mtip_backplane_resume(struct mtip_backplane *priv);
int mtip_backplane_validate(struct phy *serdes, unsigned long *supported);
void mtip_backplane_add_subordinate(struct mtip_backplane *priv,
struct mtip_backplane *subordinate);
struct mtip_backplane *mtip_backplane_create(struct mdio_device *pcs_mdiodev,
struct phy *serdes,
enum mtip_model model);
void mtip_backplane_destroy(struct mtip_backplane *priv);
#else
static inline int mtip_backplane_config_aneg(struct mtip_backplane *priv,
bool autoneg,
const unsigned long *advertising)
{
return -ENODEV;
}
static inline void mtip_backplane_an_restart(struct mtip_backplane *priv)
{
}
static inline void mtip_backplane_get_state(struct mtip_backplane *priv,
struct phylink_link_state *state)
{
}
static inline int mtip_backplane_suspend(struct mtip_backplane *priv)
{
return -ENODEV;
}
static inline int mtip_backplane_resume(struct mtip_backplane *priv)
{
return -ENODEV;
}
static inline int mtip_backplane_validate(struct phy *serdes,
unsigned long *supported)
{
return -ENODEV;
}
static inline void mtip_backplane_add_subordinate(struct mtip_backplane *priv,
struct mtip_backplane *subordinate)
{
}
static inline struct mtip_backplane *mtip_backplane_create(struct mdio_device *pcs_mdiodev,
struct phy *serdes,
enum mtip_model model)
{
return ERR_PTR(-ENODEV);
}
static inline void mtip_backplane_destroy(struct mtip_backplane *priv)
{
}
#endif
#endif