Convert mvpp2 to split PCS support
Subsystems (3)
PATCH 1/6 net: mvpp2: tidy up ACPI hack
In reply to Russell King - ARM Linux adminTidy up the ACPI hack so that we can minimise the function prototypes for this. This avoids adding further prototypes unnecessarily.
--- .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +18 -18
@@ -57,13 +57,7 @@ static struct {/* The prototype is added here to be used in start_dev when using ACPI. This * will be removed once phylink is used for all modes (dt+ACPI). */ -static void mvpp2_mac_config (struct phylink_config *config,unsigned int mode, -const struct phylink_link_state *state); -static void mvpp2_mac_link_up (struct phylink_config *config, -struct phy_device *phy, -unsigned int mode,phy_interface_t interface, -int speed,int duplex, -bool tx_pause,bool rx_pause); +static void mvpp2_acpi_start (struct mvpp2_port *port);/* Queue modes */ #define MVPP2_QDIST_SINGLE_MODE 0
@@ -4007,17 +4001,7 @@ static void mvpp2_start_dev(struct mvpp2_port *port)if (port->phylink) {phylink_start (port->phylink); }else { -/* Phylink isn't used as of now for ACPI, so the MAC has to be -* configured manually when the interface is started. This will -* be removed as soon as the phylink ACPI support lands in. -*/ -struct phylink_link_state state = { - .interface = port->phy_interface, - }; -mvpp2_mac_config (&port->phylink_config,MLO_AN_INBAND , &state); -mvpp2_mac_link_up (&port->phylink_config,NULL , -MLO_AN_INBAND , port->phy_interface, -SPEED_UNKNOWN ,DUPLEX_UNKNOWN , false, false); +mvpp2_acpi_start (port); }netif_tx_start_all_queues (port->dev);
@@ -5850,6 +5834,22 @@ static const struct phylink_mac_ops mvpp2_phylink_ops = { .mac_link_down = mvpp2_mac_link_down, }; +/* Work-around for ACPI */ +static void mvpp2_acpi_start (struct mvpp2_port *port) +{ +/* Phylink isn't used as of now for ACPI, so the MAC has to be +* configured manually when the interface is started. This will +* be removed as soon as the phylink ACPI support lands in. +*/ +struct phylink_link_state state = { + .interface = port->phy_interface, + }; +mvpp2_mac_config (&port->phylink_config,MLO_AN_INBAND , &state); +mvpp2_mac_link_up (&port->phylink_config,NULL , +MLO_AN_INBAND , port->phy_interface, +SPEED_UNKNOWN ,DUPLEX_UNKNOWN , false, false); +} +/* Ports initialization */ static int mvpp2_port_probe(struct platform_device *pdev, struct fwnode_handle *port_fwnode,
Signature · 1 line
2.20.1
PATCH 2/6 net: mvpp2: convert to use mac_prepare()/mac_finish()
In reply to Russell King - ARM Linux adminConvert mvpp2 to use the mac_prepare() and mac_finish() methods in preparation to converting mvpp2 to split-PCS support.
--- .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 48 ++++++++++++++----- 1 file changed, 37 insertions(+), 11 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +37 -11
@@ -5691,31 +5691,35 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode, } } -static void mvpp2_mac_config (struct phylink_config *config,unsigned int mode, -const struct phylink_link_state *state) +static int mvpp2_mac_prepare (struct phylink_config *config,unsigned int mode, +phy_interface_t interface) {struct mvpp2_port *port =mvpp2_phylink_to_port (config); -bool change_interface = port->phy_interface != state->interface;/* Check for invalid configuration */ -if (mvpp2_is_xlg (state->interface) && port->gop_id !=0 ) { +if (mvpp2_is_xlg (interface) && port->gop_id !=0 ) {netdev_err (port->dev,"Invalid mode on %s\n" , port->dev->name); -return ; +return -EINVAL ; }/* Make sure the port is disabled when reconfiguring the mode */ mvpp2_port_disable (port); -if (port->priv->hw_version ==MVPP22 && change_interface) { +if (port->priv->hw_version ==MVPP22 && + port->phy_interface != interface) {mvpp22_gop_mask_irq (port); - port->phy_interface = state->interface; - -/* Reconfigure the serdes lanes */ phy_power_off (port->comphy); -mvpp22_mode_reconfigure (port); } +return 0 ; +} + +static void mvpp2_mac_config (struct phylink_config *config,unsigned int mode, +const struct phylink_link_state *state) +{ +struct mvpp2_port *port =mvpp2_phylink_to_port (config); +/* mac (re)configuration */ if (mvpp2_is_xlg (state->interface))mvpp2_xlg_config (port, mode, state);
@@ -5726,11 +5730,27 @@ static void mvpp2_mac_config(struct phylink_config *config, unsigned int mode,if (port->priv->hw_version ==MVPP21 && port->flags &MVPP2_F_LOOPBACK )mvpp2_port_loopback_set (port, state); +} + +static int mvpp2_mac_finish (struct phylink_config *config,unsigned int mode, +phy_interface_t interface) +{ +struct mvpp2_port *port =mvpp2_phylink_to_port (config); + +if (port->priv->hw_version ==MVPP22 && + port->phy_interface != interface) { + port->phy_interface = interface; -if (port->priv->hw_version ==MVPP22 && change_interface) +/* Reconfigure the serdes lanes */ +mvpp22_mode_reconfigure (port); + +/* Unmask interrupts */ mvpp22_gop_unmask_irq (port); + }mvpp2_port_enable (port); + +return 0 ; } static void mvpp2_mac_link_up(struct phylink_config *config,
@@ -5829,7 +5849,9 @@ static const struct phylink_mac_ops mvpp2_phylink_ops = { .validate = mvpp2_phylink_validate, .mac_pcs_get_state = mvpp2_phylink_mac_pcs_get_state, .mac_an_restart = mvpp2_mac_an_restart, + .mac_prepare = mvpp2_mac_prepare, .mac_config = mvpp2_mac_config, + .mac_finish = mvpp2_mac_finish, .mac_link_up = mvpp2_mac_link_up, .mac_link_down = mvpp2_mac_link_down, };
@@ -5844,7 +5866,11 @@ static void mvpp2_acpi_start(struct mvpp2_port *port)struct phylink_link_state state = { .interface = port->phy_interface, }; +mvpp2_mac_prepare (&port->phylink_config,MLO_AN_INBAND , + port->phy_interface);mvpp2_mac_config (&port->phylink_config,MLO_AN_INBAND , &state); +mvpp2_mac_finish (&port->phylink_config,MLO_AN_INBAND , + port->phy_interface);mvpp2_mac_link_up (&port->phylink_config,NULL ,MLO_AN_INBAND , port->phy_interface,SPEED_UNKNOWN ,DUPLEX_UNKNOWN , false, false);
Signature · 1 line
2.20.1
Russell King - ARM Linux admin
maintainercover Convert mvpp2 to split PCS support
Hi,
This series converts the mvpp2 driver to use the split PCS support that has been merged into phylink last time around. I've been running this for some time here and, apart from the recent bug fix sent to net-next, have not seen any issues on DT based systems. I have not tested ACPI setups, although I've tried to preserve the workaround.
Patch 1 formalises the ACPI workaround.
Patch 2 moves some of mac_config() to the mac_prepare() and
mac_finish() callbacks so we can keep the ordering when we split the PCS bits out.
Patch 3 ensures that the port is forced down while changing the
interface mode - when in in-band mode, doing this in mac_prepare() and mac_finish().
Patch 4 moves the reset handling to mac_prepare() and mac_finish() Patch 5 does a straight conversion to use PCS operations. Patch 6 splits the PCS operations into a GMAC PCS operations and
XLG PCS operations, selecting the appropriate set during mac_prepare(). This eliminates a bunch of conditionals from the code.
drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 1 + drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 466 ++++++++++++++---------- 2 files changed, 284 insertions(+), 183 deletions(-)
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
PATCH 5/6 net: mvpp2: convert to phylink pcs operations
Convert mvpp2 to phylink's new pcs support.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 1 + .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 292 +++++++++++------- 2 files changed, 177 insertions(+), 116 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2.h +1 -0
@@ -967,6 +967,7 @@ struct mvpp2_port {phy_interface_t phy_interface;struct phylink *phylink;struct phylink_config phylink_config; +struct phylink_pcs phylink_pcs;struct phy *comphy;struct mvpp2_bm_pool *pool_long;
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +176 -116
366 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 6/6 net: mvpp2: split xlg and gmac pcs
In reply to Russell King - ARM Linux adminSplit the XLG and GMAC PCS implementations and switch between them during the mac_prepare() method.
--- .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 110 +++++++++--------- 1 file changed, 55 insertions(+), 55 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +55 -55
@@ -5381,9 +5381,10 @@ static struct mvpp2_port *mvpp2_pcs_to_port(struct phylink_pcs *pcs) return container_of(pcs, struct mvpp2_port, phylink_pcs); } -static void mvpp22_xlg_pcs_get_state (struct mvpp2_port *port, -struct phylink_link_state *state) +static void mvpp2_xlg_pcs_get_state (struct phylink_pcs *pcs, +struct phylink_link_state *state) { +struct mvpp2_port *port =mvpp2_pcs_to_port (pcs);u32 val; state->speed =SPEED_10000 ;
@@ -5401,9 +5402,24 @@ static void mvpp22_xlg_pcs_get_state(struct mvpp2_port *port, state->pause |=MLO_PAUSE_RX ; } -static void mvpp2_gmac_pcs_get_state (struct mvpp2_port *port, +static int mvpp2_xlg_pcs_config (struct phylink_pcs *pcs, +unsigned int mode, +phy_interface_t interface, +const unsigned long *advertising, +bool permit_pause_to_mac) +{ +return 0 ; +} + +static const struct phylink_pcs_ops mvpp2_phylink_xlg_pcs_ops = { + .pcs_get_state = mvpp2_xlg_pcs_get_state, + .pcs_config = mvpp2_xlg_pcs_config, +}; + +static void mvpp2_gmac_pcs_get_state (struct phylink_pcs *pcs,struct phylink_link_state *state) { +struct mvpp2_port *port =mvpp2_pcs_to_port (pcs);u32 val; val =readl (port->base +MVPP2_GMAC_STATUS0 );
@@ -5435,29 +5451,12 @@ static void mvpp2_gmac_pcs_get_state(struct mvpp2_port *port, state->pause |=MLO_PAUSE_TX ; } -static void mvpp2_phylink_pcs_get_state (struct phylink_pcs *pcs, -struct phylink_link_state *state) -{ -struct mvpp2_port *port =mvpp2_pcs_to_port (pcs); - -if (port->priv->hw_version ==MVPP22 && port->gop_id ==0 ) { -u32 mode =readl (port->base +MVPP22_XLG_CTRL3_REG ); - mode &=MVPP22_XLG_CTRL3_MACMODESELECT_MASK ; - -if (mode ==MVPP22_XLG_CTRL3_MACMODESELECT_10G ) { -mvpp22_xlg_pcs_get_state (port, state); -return ; - } - } - -mvpp2_gmac_pcs_get_state (port, state); -} - -static int mvpp2_gmac_pcs_config (struct mvpp2_port *port,unsigned int mode, +static int mvpp2_gmac_pcs_config (struct phylink_pcs *pcs,unsigned int mode,phy_interface_t interface,const unsigned long *advertising,bool permit_pause_to_mac) { +struct mvpp2_port *port =mvpp2_pcs_to_port (pcs);u32 mask, val, an, old_an, changed; mask = MVPP2_GMAC_IN_BAND_AUTONEG_BYPASS |
@@ -5509,25 +5508,7 @@ static int mvpp2_gmac_pcs_config(struct mvpp2_port *port, unsigned int mode,return changed & (MVPP2_GMAC_FC_ADV_EN |MVPP2_GMAC_FC_ADV_ASM_EN ); } -static int mvpp2_phylink_pcs_config (struct phylink_pcs *pcs, -unsigned int mode, -phy_interface_t interface, -const unsigned long *advertising, -bool permit_pause_to_mac) -{ -struct mvpp2_port *port =mvpp2_pcs_to_port (pcs); -int ret; - -if (mvpp2_is_xlg (interface)) - ret =0 ; -else - ret =mvpp2_gmac_pcs_config (port, mode, interface, advertising, - permit_pause_to_mac); - -return ret; -} - -static void mvpp2_phylink_pcs_an_restart (struct phylink_pcs *pcs) +static void mvpp2_gmac_pcs_an_restart (struct phylink_pcs *pcs) {struct mvpp2_port *port =mvpp2_pcs_to_port (pcs);u32 val =readl (port->base +MVPP2_GMAC_AUTONEG_CONFIG );
@@ -5538,10 +5519,10 @@ static void mvpp2_phylink_pcs_an_restart(struct phylink_pcs *pcs) port->base + MVPP2_GMAC_AUTONEG_CONFIG); } -static const struct phylink_pcs_ops mvpp2_phylink_pcs_ops = { - .pcs_get_state = mvpp2_phylink_pcs_get_state, - .pcs_config = mvpp2_phylink_pcs_config, - .pcs_an_restart = mvpp2_phylink_pcs_an_restart, +static const struct phylink_pcs_ops mvpp2_phylink_gmac_pcs_ops = { + .pcs_get_state = mvpp2_gmac_pcs_get_state, + .pcs_config = mvpp2_gmac_pcs_config, + .pcs_an_restart = mvpp2_gmac_pcs_an_restart, }; static void mvpp2_phylink_validate(struct phylink_config *config,
@@ -5711,8 +5692,8 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode,writel (ctrl4, port->base +MVPP22_GMAC_CTRL_4_REG ); } -static int mvpp2_mac_prepare (struct phylink_config *config,unsigned int mode, -phy_interface_t interface) +static int mvpp2__mac_prepare (struct phylink_config *config,unsigned int mode, +phy_interface_t interface) {struct mvpp2_port *port =mvpp2_phylink_to_port (config);
@@ -5758,9 +5739,31 @@ static int mvpp2_mac_prepare(struct phylink_config *config, unsigned int mode, } } +/* Select the appropriate PCS operations depending on the +* configured interface mode. We will only switch to a mode +* that the validate() checks have already passed. +*/ +if (mvpp2_is_xlg (interface)) + port->phylink_pcs.ops = &mvpp2_phylink_xlg_pcs_ops; +else + port->phylink_pcs.ops = &mvpp2_phylink_gmac_pcs_ops; +return 0 ; } +static int mvpp2_mac_prepare (struct phylink_config *config,unsigned int mode, +phy_interface_t interface) +{ +struct mvpp2_port *port =mvpp2_phylink_to_port (config); +int ret; + + ret =mvpp2__mac_prepare (config, mode, interface); +if (ret ==0 ) +phylink_set_pcs (port->phylink, &port->phylink_pcs); + +return ret; +} +static void mvpp2_mac_config (struct phylink_config *config,unsigned int mode,const struct phylink_link_state *state) {
@@ -5934,12 +5937,12 @@ static void mvpp2_acpi_start(struct mvpp2_port *port)struct phylink_link_state state = { .interface = port->phy_interface, }; -mvpp2_mac_prepare (&port->phylink_config,MLO_AN_INBAND , - port->phy_interface); +mvpp2__mac_prepare (&port->phylink_config,MLO_AN_INBAND , + port->phy_interface);mvpp2_mac_config (&port->phylink_config,MLO_AN_INBAND , &state); -mvpp2_phylink_pcs_config (&port->phylink_pcs,MLO_AN_INBAND , - port->phy_interface, state.advertising, - false); + port->phylink_pcs.ops->pcs_config (&port->phylink_pcs,MLO_AN_INBAND , + port->phy_interface, + state.advertising, false);mvpp2_mac_finish (&port->phylink_config,MLO_AN_INBAND , port->phy_interface); mvpp2_mac_link_up(&port->phylink_config, NULL,
@@ -6171,9 +6174,6 @@ static int mvpp2_port_probe(struct platform_device *pdev, goto err_free_port_pcpu; } port->phylink = phylink; - - port->phylink_pcs.ops = &mvpp2_phylink_pcs_ops; -phylink_set_pcs (phylink, &port->phylink_pcs); }else { port->phylink =NULL ; }
Signature · 1 line
2.20.1
PATCH 3/6 net: mvpp2: ensure the port is forced down while changing modes
In reply to Russell King - ARM Linux adminEnsure that the port is forced down while reconfiguring, controlling this via mac_prepare() and mac_finish() so that it is down while we are configuring our (future) PCS.
--- .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 47 ++++++++++++++----- 1 file changed, 36 insertions(+), 11 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +36 -11
@@ -5622,9 +5622,7 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode, }else if (state->interface ==PHY_INTERFACE_MODE_SGMII ) {/* SGMII in-band mode receives the speed and duplex from * the PHY. Flow control information is not received. */ - an &= ~(MVPP2_GMAC_FORCE_LINK_DOWN | -MVPP2_GMAC_FORCE_LINK_PASS | -MVPP2_GMAC_CONFIG_MII_SPEED | + an &= ~(MVPP2_GMAC_CONFIG_MII_SPEED |MVPP2_GMAC_CONFIG_GMII_SPEED |MVPP2_GMAC_CONFIG_FULL_DUPLEX ); an |= MVPP2_GMAC_IN_BAND_AUTONEG |
@@ -5637,9 +5635,7 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode,* speed and full duplex here. */ ctrl0 |=MVPP2_GMAC_PORT_TYPE_MASK ; - an &= ~(MVPP2_GMAC_FORCE_LINK_DOWN | -MVPP2_GMAC_FORCE_LINK_PASS | -MVPP2_GMAC_CONFIG_MII_SPEED | + an &= ~(MVPP2_GMAC_CONFIG_MII_SPEED |MVPP2_GMAC_CONFIG_GMII_SPEED |MVPP2_GMAC_CONFIG_FULL_DUPLEX ); an |= MVPP2_GMAC_IN_BAND_AUTONEG |
@@ -5663,11 +5659,6 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode,if ((old_ctrl0 ^ ctrl0) &MVPP2_GMAC_PORT_TYPE_MASK || (old_ctrl2 ^ ctrl2) &MVPP2_GMAC_INBAND_AN_MASK || (old_an ^ an) &MVPP2_GMAC_AN_PORT_DOWN_MASK ) { -/* Force link down */ - old_an &= ~MVPP2_GMAC_FORCE_LINK_PASS ; - old_an |=MVPP2_GMAC_FORCE_LINK_DOWN ; -writel (old_an, port->base +MVPP2_GMAC_AUTONEG_CONFIG ); -/* Set the GMAC in a reset state - do this in a way that * ensures we clear it below. */
@@ -5702,6 +5693,26 @@ static int mvpp2_mac_prepare(struct phylink_config *config, unsigned int mode,return -EINVAL ; } +if (port->phy_interface != interface || +phylink_autoneg_inband (mode)) { +/* Force the link down when changing the interface or if in +* in-band mode to ensure we do not change the configuration +* while the hardware is indicating link is up. We force both +* XLG and GMAC down to ensure that they're both in a known +* state. +*/ +mvpp2_modify (port->base +MVPP2_GMAC_AUTONEG_CONFIG , +MVPP2_GMAC_FORCE_LINK_PASS | +MVPP2_GMAC_FORCE_LINK_DOWN , +MVPP2_GMAC_FORCE_LINK_DOWN ); + +if (mvpp2_port_supports_xlg (port)) +mvpp2_modify (port->base +MVPP22_XLG_CTRL0_REG , +MVPP22_XLG_CTRL0_FORCE_LINK_PASS | +MVPP22_XLG_CTRL0_FORCE_LINK_DOWN , +MVPP22_XLG_CTRL0_FORCE_LINK_DOWN ); + } +/* Make sure the port is disabled when reconfiguring the mode */ mvpp2_port_disable (port);
@@ -5750,6 +5761,20 @@ static int mvpp2_mac_finish(struct phylink_config *config, unsigned int mode,mvpp2_port_enable (port); +/* Allow the link to come up if in in-band mode, otherwise the +* link is forced via mac_link_down()/mac_link_up() +*/ +if (phylink_autoneg_inband (mode)) { +if (mvpp2_is_xlg (interface)) +mvpp2_modify (port->base +MVPP22_XLG_CTRL0_REG , +MVPP22_XLG_CTRL0_FORCE_LINK_PASS | +MVPP22_XLG_CTRL0_FORCE_LINK_DOWN ,0 ); +else +mvpp2_modify (port->base +MVPP2_GMAC_AUTONEG_CONFIG , +MVPP2_GMAC_FORCE_LINK_PASS | +MVPP2_GMAC_FORCE_LINK_DOWN ,0 ); + } +return 0 ; }
Signature · 1 line
2.20.1
PATCH 4/6 net: mvpp2: move GMAC reset handling into mac_prepare()/mac_finish()
In reply to Russell King - ARM Linux adminMove the GMAC reset handling into mac_prepare() / mac_finish()
--- .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 53 ++++++++----------- 1 file changed, 21 insertions(+), 32 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +21 -32
@@ -5585,8 +5585,7 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode,MVPP2_GMAC_AN_DUPLEX_EN |MVPP2_GMAC_IN_BAND_AUTONEG | MVPP2_GMAC_IN_BAND_AUTONEG_BYPASS); ctrl0 &= ~MVPP2_GMAC_PORT_TYPE_MASK ; - ctrl2 &= ~(MVPP2_GMAC_INBAND_AN_MASK |MVPP2_GMAC_PORT_RESET_MASK | -MVPP2_GMAC_PCS_ENABLE_MASK ); + ctrl2 &= ~(MVPP2_GMAC_INBAND_AN_MASK |MVPP2_GMAC_PCS_ENABLE_MASK );/* Configure port type */ if (phy_interface_mode_is_8023z (state->interface)) {
@@ -5646,26 +5645,6 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode, an |=MVPP2_GMAC_FLOW_CTRL_AUTONEG ; } -/* Some fields of the auto-negotiation register require the port to be down when -* their value is updated. -*/ -#define MVPP2_GMAC_AN_PORT_DOWN_MASK \ - (MVPP2_GMAC_IN_BAND_AUTONEG | \ - MVPP2_GMAC_IN_BAND_AUTONEG_BYPASS | \ - MVPP2_GMAC_CONFIG_MII_SPEED | MVPP2_GMAC_CONFIG_GMII_SPEED | \ - MVPP2_GMAC_AN_SPEED_EN | MVPP2_GMAC_CONFIG_FULL_DUPLEX | \ - MVPP2_GMAC_AN_DUPLEX_EN) - -if ((old_ctrl0 ^ ctrl0) &MVPP2_GMAC_PORT_TYPE_MASK || - (old_ctrl2 ^ ctrl2) &MVPP2_GMAC_INBAND_AN_MASK || - (old_an ^ an) &MVPP2_GMAC_AN_PORT_DOWN_MASK ) { -/* Set the GMAC in a reset state - do this in a way that -* ensures we clear it below. -*/ - old_ctrl2 |=MVPP2_GMAC_PORT_RESET_MASK ; -writel (old_ctrl2, port->base +MVPP2_GMAC_CTRL_2_REG ); - } -if (old_ctrl0 != ctrl0)writel (ctrl0, port->base +MVPP2_GMAC_CTRL_0_REG );if (old_ctrl2 != ctrl2)
@@ -5674,12 +5653,6 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode,writel (ctrl4, port->base +MVPP22_GMAC_CTRL_4_REG );if (old_an != an)writel (an, port->base +MVPP2_GMAC_AUTONEG_CONFIG ); - -if (old_ctrl2 &MVPP2_GMAC_PORT_RESET_MASK ) { -while (readl (port->base +MVPP2_GMAC_CTRL_2_REG ) & -MVPP2_GMAC_PORT_RESET_MASK ) -continue ; - } } static int mvpp2_mac_prepare(struct phylink_config *config, unsigned int mode,
@@ -5716,11 +5689,17 @@ static int mvpp2_mac_prepare(struct phylink_config *config, unsigned int mode,/* Make sure the port is disabled when reconfiguring the mode */ mvpp2_port_disable (port); -if (port->priv->hw_version ==MVPP22 && - port->phy_interface != interface) { -mvpp22_gop_mask_irq (port); +if (port->phy_interface != interface) { +/* Place GMAC into reset */ +mvpp2_modify (port->base +MVPP2_GMAC_CTRL_2_REG , +MVPP2_GMAC_PORT_RESET_MASK , +MVPP2_GMAC_PORT_RESET_MASK ); + +if (port->priv->hw_version ==MVPP22 ) { +mvpp22_gop_mask_irq (port); -phy_power_off (port->comphy); +phy_power_off (port->comphy); + } }return 0 ;
@@ -5759,6 +5738,16 @@ static int mvpp2_mac_finish(struct phylink_config *config, unsigned int mode,mvpp22_gop_unmask_irq (port); } +if (!mvpp2_is_xlg (interface)) { +/* Release GMAC reset and wait */ +mvpp2_modify (port->base +MVPP2_GMAC_CTRL_2_REG , +MVPP2_GMAC_PORT_RESET_MASK ,0 ); + +while (readl (port->base +MVPP2_GMAC_CTRL_2_REG ) & +MVPP2_GMAC_PORT_RESET_MASK ) +continue ; + } +mvpp2_port_enable (port);/* Allow the link to come up if in in-band mode, otherwise the
Signature · 1 line
2.20.1
David Miller
maintainerFrom: Russell King - ARM Linux admin <[email protected]>
Date: Tue, 1 Sep 2020 14:47:46 +0100
Quoted 5 lines
This series converts the mvpp2 driver to use the split PCS support that has been merged into phylink last time around. I've been running this for some time here and, apart from the recent bug fix sent to net-next, have not seen any issues on DT based systems. I have not tested ACPI setups, although I've tried to preserve the workaround.
...
Series applied, thank you.