net: mvneta: Convert to use PHY_FIXED for fixed-link
Stop parsing fixed-link in the MAC driver. Instead support only PHY mode and let the fixed PHY driver handle the fixed-link case. Enable CONFIG_PHY_FIXED for mvneta boards that need it: Turris Omnia and ESPRESSObin. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
This commit is contained in:
parent
31f4ccca0a
commit
77fcf3cf12
@ -74,6 +74,7 @@ CONFIG_SPI_FLASH_STMICRO=y
|
|||||||
CONFIG_SPI_FLASH_WINBOND=y
|
CONFIG_SPI_FLASH_WINBOND=y
|
||||||
CONFIG_SPI_FLASH_MTD=y
|
CONFIG_SPI_FLASH_MTD=y
|
||||||
CONFIG_PHY_MARVELL=y
|
CONFIG_PHY_MARVELL=y
|
||||||
|
CONFIG_PHY_FIXED=y
|
||||||
CONFIG_PHY_GIGE=y
|
CONFIG_PHY_GIGE=y
|
||||||
CONFIG_E1000=y
|
CONFIG_E1000=y
|
||||||
CONFIG_MVNETA=y
|
CONFIG_MVNETA=y
|
||||||
|
@ -82,6 +82,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
|
|||||||
CONFIG_SPI_FLASH_SPANSION=y
|
CONFIG_SPI_FLASH_SPANSION=y
|
||||||
CONFIG_SPI_FLASH_MTD=y
|
CONFIG_SPI_FLASH_MTD=y
|
||||||
CONFIG_PHY_MARVELL=y
|
CONFIG_PHY_MARVELL=y
|
||||||
|
CONFIG_PHY_FIXED=y
|
||||||
CONFIG_PHY_GIGE=y
|
CONFIG_PHY_GIGE=y
|
||||||
CONFIG_MVNETA=y
|
CONFIG_MVNETA=y
|
||||||
CONFIG_MII=y
|
CONFIG_MII=y
|
||||||
|
@ -1152,11 +1152,6 @@ static void mvneta_adjust_link(struct udevice *dev)
|
|||||||
struct phy_device *phydev = pp->phydev;
|
struct phy_device *phydev = pp->phydev;
|
||||||
bool status_change = false;
|
bool status_change = false;
|
||||||
|
|
||||||
if (pp->fixed_link) {
|
|
||||||
debug("Using fixed link, skip link adjust\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (phydev->link &&
|
if (phydev->link &&
|
||||||
(pp->speed != phydev->speed || pp->duplex != phydev->duplex)) {
|
(pp->speed != phydev->speed || pp->duplex != phydev->duplex)) {
|
||||||
u32 val;
|
u32 val;
|
||||||
@ -1168,6 +1163,21 @@ static void mvneta_adjust_link(struct udevice *dev)
|
|||||||
MVNETA_GMAC_AN_SPEED_EN |
|
MVNETA_GMAC_AN_SPEED_EN |
|
||||||
MVNETA_GMAC_AN_DUPLEX_EN);
|
MVNETA_GMAC_AN_DUPLEX_EN);
|
||||||
|
|
||||||
|
/* FIXME: For fixed-link case, these were the initial settings
|
||||||
|
* used before the code was converted to use PHY_FIXED. Some of
|
||||||
|
* these may look nonsensical (for example BYPASS_AN makes sense
|
||||||
|
* for 1000base-x and 2500base-x modes, AFAIK), and in fact this
|
||||||
|
* may be changed in the future (when support for inband AN will
|
||||||
|
* be added). Also, why is ADVERT_FC enabled if we don't enable
|
||||||
|
* inband AN at all?
|
||||||
|
*/
|
||||||
|
if (pp->fixed_link)
|
||||||
|
val = MVNETA_GMAC_FORCE_LINK_UP |
|
||||||
|
MVNETA_GMAC_IB_BYPASS_AN_EN |
|
||||||
|
MVNETA_GMAC_SET_FC_EN |
|
||||||
|
MVNETA_GMAC_ADVERT_FC_EN |
|
||||||
|
MVNETA_GMAC_SAMPLE_TX_CFG_EN;
|
||||||
|
|
||||||
if (phydev->duplex)
|
if (phydev->duplex)
|
||||||
val |= MVNETA_GMAC_CONFIG_FULL_DUPLEX;
|
val |= MVNETA_GMAC_CONFIG_FULL_DUPLEX;
|
||||||
|
|
||||||
@ -1413,36 +1423,16 @@ static int mvneta_start(struct udevice *dev)
|
|||||||
mvneta_port_power_up(pp, pp->phy_interface);
|
mvneta_port_power_up(pp, pp->phy_interface);
|
||||||
|
|
||||||
if (!pp->init || pp->link == 0) {
|
if (!pp->init || pp->link == 0) {
|
||||||
if (pp->fixed_link) {
|
|
||||||
u32 val;
|
|
||||||
|
|
||||||
pp->init = 1;
|
|
||||||
pp->link = 1;
|
|
||||||
mvneta_init(dev);
|
|
||||||
|
|
||||||
val = MVNETA_GMAC_FORCE_LINK_UP |
|
|
||||||
MVNETA_GMAC_IB_BYPASS_AN_EN |
|
|
||||||
MVNETA_GMAC_SET_FC_EN |
|
|
||||||
MVNETA_GMAC_ADVERT_FC_EN |
|
|
||||||
MVNETA_GMAC_SAMPLE_TX_CFG_EN;
|
|
||||||
|
|
||||||
if (pp->duplex)
|
|
||||||
val |= MVNETA_GMAC_CONFIG_FULL_DUPLEX;
|
|
||||||
|
|
||||||
if (pp->speed == SPEED_1000)
|
|
||||||
val |= MVNETA_GMAC_CONFIG_GMII_SPEED;
|
|
||||||
else if (pp->speed == SPEED_100)
|
|
||||||
val |= MVNETA_GMAC_CONFIG_MII_SPEED;
|
|
||||||
|
|
||||||
mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
|
|
||||||
} else {
|
|
||||||
phydev = dm_eth_phy_connect(dev);
|
phydev = dm_eth_phy_connect(dev);
|
||||||
if (!phydev) {
|
if (!phydev) {
|
||||||
printf("dm_eth_phy_connect failed\n");
|
printf("dm_eth_phy_connect failed\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pp->fixed_link = phydev->phy_id == PHY_FIXED_ID;
|
||||||
|
|
||||||
/* Set PHY address in case we will enable HW polling */
|
/* Set PHY address in case we will enable HW polling */
|
||||||
|
if (!pp->fixed_link)
|
||||||
mvreg_write(pp, MVNETA_PHY_ADDR, phydev->addr);
|
mvreg_write(pp, MVNETA_PHY_ADDR, phydev->addr);
|
||||||
|
|
||||||
pp->phydev = phydev;
|
pp->phydev = phydev;
|
||||||
@ -1456,13 +1446,11 @@ static int mvneta_start(struct udevice *dev)
|
|||||||
/* Full init on first call */
|
/* Full init on first call */
|
||||||
mvneta_init(dev);
|
mvneta_init(dev);
|
||||||
pp->init = 1;
|
pp->init = 1;
|
||||||
return 0;
|
} else {
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Upon all following calls, this is enough */
|
/* Upon all following calls, this is enough */
|
||||||
mvneta_port_up(pp);
|
mvneta_port_up(pp);
|
||||||
mvneta_port_enable(pp);
|
mvneta_port_enable(pp);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1560,10 +1548,7 @@ static int mvneta_probe(struct udevice *dev)
|
|||||||
#if CONFIG_IS_ENABLED(DM_GPIO)
|
#if CONFIG_IS_ENABLED(DM_GPIO)
|
||||||
struct ofnode_phandle_args sfp_args;
|
struct ofnode_phandle_args sfp_args;
|
||||||
#endif
|
#endif
|
||||||
void *blob = (void *)gd->fdt_blob;
|
|
||||||
int node = dev_of_offset(dev);
|
|
||||||
void *bd_space;
|
void *bd_space;
|
||||||
int fl_node;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate buffer area for descs and rx_buffers. This is only
|
* Allocate buffer area for descs and rx_buffers. This is only
|
||||||
@ -1600,15 +1585,6 @@ static int mvneta_probe(struct udevice *dev)
|
|||||||
else
|
else
|
||||||
mvneta_conf_mbus_windows(pp);
|
mvneta_conf_mbus_windows(pp);
|
||||||
|
|
||||||
/* fetch 'fixed-link' property from 'neta' node */
|
|
||||||
fl_node = fdt_subnode_offset(blob, node, "fixed-link");
|
|
||||||
if (fl_node != -FDT_ERR_NOTFOUND) {
|
|
||||||
/* set phy_addr to invalid value for fixed link */
|
|
||||||
pp->duplex = fdtdec_get_bool(blob, fl_node, "full-duplex");
|
|
||||||
pp->speed = fdtdec_get_int(blob, fl_node, "speed", 0);
|
|
||||||
pp->fixed_link = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if CONFIG_IS_ENABLED(DM_GPIO)
|
#if CONFIG_IS_ENABLED(DM_GPIO)
|
||||||
if (!dev_read_phandle_with_args(dev, "sfp", NULL, 0, 0, &sfp_args) &&
|
if (!dev_read_phandle_with_args(dev, "sfp", NULL, 0, 0, &sfp_args) &&
|
||||||
ofnode_is_enabled(sfp_args.node))
|
ofnode_is_enabled(sfp_args.node))
|
||||||
|
Loading…
Reference in New Issue
Block a user