Skip to content

Commit

Permalink
[bot] AutoMerging: merge all upstream's changes:
Browse files Browse the repository at this point in the history
* https://github.com/coolsnowwolf/lede:
  ramips: mt7530: Implement set_port_link
  kernel: add missing 5.15 symbols
  • Loading branch information
github-actions[bot] committed Aug 9, 2022
2 parents 684b791 + 665970a commit 51fb00e
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 7 deletions.
6 changes: 6 additions & 0 deletions target/linux/generic/config-5.15
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CONFIG_64BIT_TIME=y
# CONFIG_ACORN_PARTITION is not set
# CONFIG_ACPI_ALS is not set
# CONFIG_ACPI_APEI is not set
# CONFIG_ACPI_APEI_PCIEAER is not set
# CONFIG_ACPI_BUTTON is not set
# CONFIG_ACPI_CONFIGFS is not set
# CONFIG_ACPI_CUSTOM_METHOD is not set
Expand Down Expand Up @@ -5066,6 +5067,7 @@ CONFIG_RTC_DRV_CMOS=y
# CONFIG_RTC_DRV_MAX6900 is not set
# CONFIG_RTC_DRV_MAX6902 is not set
# CONFIG_RTC_DRV_MAX6916 is not set
# CONFIG_RTC_DRV_MAX77686 is not set
# CONFIG_RTC_DRV_MCP795 is not set
# CONFIG_RTC_DRV_MOXART is not set
# CONFIG_RTC_DRV_MPC5121 is not set
Expand Down Expand Up @@ -5103,6 +5105,7 @@ CONFIG_RTC_DRV_CMOS=y
# CONFIG_RTC_DRV_SNVS is not set
# CONFIG_RTC_DRV_STK17TA8 is not set
# CONFIG_RTC_DRV_SUN6I is not set
# CONFIG_RTC_DRV_TEGRA is not set
# CONFIG_RTC_DRV_TEST is not set
# CONFIG_RTC_DRV_V3020 is not set
# CONFIG_RTC_DRV_X1205 is not set
Expand Down Expand Up @@ -5896,7 +5899,9 @@ CONFIG_SND_PROC_FS=y
# CONFIG_SND_SOC_FSL_AUD2HTX is not set
# CONFIG_SND_SOC_FSL_AUDMIX is not set
# CONFIG_SND_SOC_FSL_ESAI is not set
# CONFIG_SND_SOC_IMX_RPMSG is not set
# CONFIG_SND_SOC_FSL_MICFIL is not set
# CONFIG_SND_SOC_FSL_RPMSG is not set
# CONFIG_SND_SOC_FSL_SAI is not set
# CONFIG_SND_SOC_FSL_SPDIF is not set
# CONFIG_SND_SOC_FSL_SSI is not set
Expand Down Expand Up @@ -7385,6 +7390,7 @@ CONFIG_WLAN=y
CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y
# CONFIG_WQ_WATCHDOG is not set
# CONFIG_WWAN is not set
# CONFIG_WWAN_HWSIM is not set
# CONFIG_WW_MUTEX_SELFTEST is not set
# CONFIG_X25 is not set
# CONFIG_X509_CERTIFICATE_PARSER is not set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,17 +273,63 @@ static int mt753x_get_port_link(struct switch_dev *dev, int port,
return 0;
}

static int mt753x_set_port_link(struct switch_dev *dev, int port,
static int mt753x_set_port_link(struct switch_dev *sw_dev, int port,
struct switch_port_link *link)
{
#ifndef MODULE
if (port >= MT753X_NUM_PHYS)
if (port < 0 || port >= MT753X_NUM_PHYS)
return -EINVAL;

return switch_generic_set_link(dev, port, link);
#else
return -ENOTSUPP;
#endif
/* Setup autoneg advertise here */
if (link->aneg) {
u16 bmsr, adv, gctrl;
bool ercap;

sw_dev->ops->phy_read16(sw_dev, port, MII_BMSR, &bmsr);
/* ERCAP means we have MII_CTRL1000 register */
ercap = !!(bmsr | BMSR_ERCAP);

adv = ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
gctrl = CTL1000_ENABLE_MASTER;

switch (link->speed) {
case SWITCH_PORT_SPEED_10:
if (link->duplex)
adv |= ADVERTISE_10FULL;
else
adv |= ADVERTISE_10HALF;
break;
case SWITCH_PORT_SPEED_100:
if (link->duplex)
adv |= ADVERTISE_100FULL;
else
adv |= ADVERTISE_100HALF;
break;
case SWITCH_PORT_SPEED_1000:
if (!ercap || !link->duplex)
return -ENOTSUPP;
/* PHY only supports 1000FULL */
gctrl |= ADVERTISE_1000FULL;
break;
default:
/* For unknown input speed just enable all speed grades */
if (link->duplex) {
adv |= ADVERTISE_FULL;
gctrl |= ADVERTISE_1000FULL;
} else {
adv |= ADVERTISE_10HALF | ADVERTISE_100HALF;
gctrl = 0x0;
}
break;
}

sw_dev->ops->phy_write16(sw_dev, port, MII_ADVERTISE, adv);
if (ercap)
sw_dev->ops->phy_write16(sw_dev, port, MII_CTRL1000, gctrl);
/* Autoneg restart will be triggered in switch_generic_set_link */
}

/* Let switch_generic_set_link handle not autoneg case */
return switch_generic_set_link(sw_dev, port, link);
}

static u64 get_mib_counter(struct gsw_mt753x *gsw, int i, int port)
Expand Down

0 comments on commit 51fb00e

Please sign in to comment.