target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl839x.c
int rtl839x_eee_port_ability(struct rtl838x_switch_priv *priv, struct ethtool_eee *e, int port)
{
	u64 link, a;

	if (port >= 48)
		return 0;

	link = rtl839x_get_port_reg_le(RTL839X_MAC_LINK_STS);
	if (!(link & BIT_ULL(port)))
		return 0;

	if (sw_r32(rtl839x_mac_force_mode_ctrl(port)) & BIT(8))
		e->advertised |= ADVERTISED_100baseT_Full;

	if (sw_r32(rtl839x_mac_force_mode_ctrl(port)) & BIT(10))
		e->advertised |= ADVERTISED_1000baseT_Full;

	a = rtl839x_get_port_reg_le(RTL839X_MAC_EEE_ABLTY);
	pr_info("Link partner: %016llx\n", a);
	if (rtl839x_get_port_reg_le(RTL839X_MAC_EEE_ABLTY) & BIT_ULL(port)) {
		e->lp_advertised = ADVERTISED_100baseT_Full;
		e->lp_advertised |= ADVERTISED_1000baseT_Full;
		return 1;
	}

	return 0;
}
/*
 * Get EEE own capabilities and negotiation result
 */
Get EEE own capabilities and negotiation result
Get EEE own capabilities and negotiation result
int rtl839x_eee_port_ability(struct rtl838x_switch_priv *priv, struct ethtool_eee *e, int port)
{
	u64 link, a;
	if (port >= 48)
		return 0;
	link = rtl839x_get_port_reg_le(RTL839X_MAC_LINK_STS);
	if (!(link & BIT_ULL(port)))
		return 0;
	if (sw_r32(rtl839x_mac_force_mode_ctrl(port)) & BIT(8))
		e->advertised |= ADVERTISED_100baseT_Full;
	if (sw_r32(rtl839x_mac_force_mode_ctrl(port)) & BIT(10))
		e->advertised |= ADVERTISED_1000baseT_Full;
	a = rtl839x_get_port_reg_le(RTL839X_MAC_EEE_ABLTY);
	pr_info("Link partner: %016llx\n", a);
	if (rtl839x_get_port_reg_le(RTL839X_MAC_EEE_ABLTY) & BIT_ULL(port)) {
		e->lp_advertised = ADVERTISED_100baseT_Full;
		e->lp_advertised |= ADVERTISED_1000baseT_Full;
		return 1;
	}
	return 0;
}
int rtl839x_eee_port_ability ( struct rtl838x_switch_priv * priv , struct ethtool_eee * e , int port ) { u64 link , a ; if ( port >= 48 ) return 0 ; link = rtl839x_get_port_reg_le ( RTL839X_MAC_LINK_STS ) ; if ( ! ( link & BIT_ULL ( port ) ) ) return 0 ; if ( sw_r32 ( rtl839x_mac_force_mode_ctrl ( port ) ) & BIT ( 8 ) ) e -> advertised |= ADVERTISED_100baseT_Full ; if ( sw_r32 ( rtl839x_mac_force_mode_ctrl ( port ) ) & BIT ( 10 ) ) e -> advertised |= ADVERTISED_1000baseT_Full ; a = rtl839x_get_port_reg_le ( RTL839X_MAC_EEE_ABLTY ) ; pr_info ( " \n " , a ) ; if ( rtl839x_get_port_reg_le ( RTL839X_MAC_EEE_ABLTY ) & BIT_ULL ( port ) ) { e -> lp_advertised = ADVERTISED_100baseT_Full ; e -> lp_advertised |= ADVERTISED_1000baseT_Full ; return 1 ; } return 0 ; }
Get EEE own capabilities and negotiation result
Get EEE own capabilities and negotiation result