mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-26 14:17:26 -04:00
The sja1105 hardware has a quirk in that some changes require a switch reset, which loses all configuration. When the reset is initiated, everything needs to be reprogrammed, including the MACs and the PCS. This is currently done in sja1105_static_config_reload() - we manually call sja1105_adjust_port_config(), sja1105_sgmii_pcs_config() and sja1105_sgmii_pcs_force_speed() which are all internal functions. There is a desire for sja1105 to use the common xpcs driver, and that means that the equivalents of those functions, xpcs_do_config() and xpcs_link_up() respectively, will no longer be local functions. Forcing phylink to retrigger a resolve somehow, say by doing dev_close() followed by dev_open() is not really an option, because the CPU port might have a PCS as well, and there is no net device which we can close and reopen for that. Additionally, the dev_close/dev_open sequence might force a renegotiation of the copper-side link for SGMII ports connected to a PHY, and this is undesirable as well, because the switch reset is much quicker than a PHY autoneg, so we would have a lot more downtime. The only solution I see is for the sja1105 driver to keep doing what it's doing, and that means we need to export the equivalents from xpcs for sja1105_sgmii_pcs_config and sja1105_sgmii_pcs_force_speed, and call them directly in sja1105_static_config_reload(). This will be done during the conversion patch. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (c) 2020 Synopsys, Inc. and/or its affiliates.
|
|
* Synopsys DesignWare XPCS helpers
|
|
*/
|
|
|
|
#ifndef __LINUX_PCS_XPCS_H
|
|
#define __LINUX_PCS_XPCS_H
|
|
|
|
#include <linux/phy.h>
|
|
#include <linux/phylink.h>
|
|
|
|
#define NXP_SJA1105_XPCS_ID 0x00000010
|
|
#define NXP_SJA1110_XPCS_ID 0x00000020
|
|
|
|
/* AN mode */
|
|
#define DW_AN_C73 1
|
|
#define DW_AN_C37_SGMII 2
|
|
#define DW_2500BASEX 3
|
|
|
|
struct xpcs_id;
|
|
|
|
struct dw_xpcs {
|
|
struct mdio_device *mdiodev;
|
|
const struct xpcs_id *id;
|
|
struct phylink_pcs pcs;
|
|
};
|
|
|
|
int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface);
|
|
void xpcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
|
|
phy_interface_t interface, int speed, int duplex);
|
|
int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
|
|
unsigned int mode);
|
|
void xpcs_validate(struct dw_xpcs *xpcs, unsigned long *supported,
|
|
struct phylink_link_state *state);
|
|
int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns,
|
|
int enable);
|
|
struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev,
|
|
phy_interface_t interface);
|
|
void xpcs_destroy(struct dw_xpcs *xpcs);
|
|
|
|
#endif /* __LINUX_PCS_XPCS_H */
|