mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-01-28 03:37:17 +01:00
realtek: phy: convert confusing BMCR_PDOWN usage for RTL8214FC
Bit 11 of registers 16, 19, 20, 21 in page 0x266 denotes if a port of a RTL8214FC is set/favoured to fibre (0) or copper (1). For unknown reasons the bit was mixed with BMCR_PDOWN. Convert this to a meaningful define. Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de> Link: https://github.com/openwrt/openwrt/pull/21582 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
17f12695d0
commit
07bb4f5115
1 changed files with 5 additions and 3 deletions
|
|
@ -57,6 +57,8 @@ extern struct rtl83xx_soc_info soc_info;
|
|||
#define RTL821X_JOIN_LAST 1
|
||||
#define RTL821X_JOIN_OTHER 2
|
||||
|
||||
#define RTL8214FC_MEDIA_COPPER BIT(11)
|
||||
|
||||
static const struct firmware rtl838x_8380_fw;
|
||||
static const struct firmware rtl838x_8218b_fw;
|
||||
|
||||
|
|
@ -447,7 +449,7 @@ static bool __rtl8214fc_media_is_fibre(struct phy_device *phydev)
|
|||
__phy_write(basephy, RTL821XEXT_MEDIA_PAGE_SELECT, oldxpage);
|
||||
__phy_write(basephy, RTL8XXX_PAGE_SELECT, oldpage);
|
||||
|
||||
return !(val & BMCR_PDOWN);
|
||||
return !(val & RTL8214FC_MEDIA_COPPER);
|
||||
}
|
||||
|
||||
static bool rtl8214fc_media_is_fibre(struct phy_device *phydev)
|
||||
|
|
@ -495,13 +497,13 @@ static int rtl8214fc_resume(struct phy_device *phydev)
|
|||
static void rtl8214fc_media_set(struct phy_device *phydev, bool set_fibre)
|
||||
{
|
||||
struct phy_device *basephy = get_base_phy(phydev);
|
||||
int pdown = set_fibre ? 0 : BMCR_PDOWN;
|
||||
int copper = set_fibre ? 0 : RTL8214FC_MEDIA_COPPER;
|
||||
static int regs[] = {16, 19, 20, 21};
|
||||
int reg = regs[phydev->mdio.addr & 3];
|
||||
|
||||
phydev_info(phydev, "switch to %s\n", set_fibre ? "fibre" : "copper");
|
||||
phy_write_paged(basephy, RTL838X_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_INTERNAL);
|
||||
phy_modify_paged(basephy, RTL821X_PAGE_PORT, reg, BMCR_PDOWN, pdown);
|
||||
phy_modify_paged(basephy, RTL821X_PAGE_PORT, reg, RTL8214FC_MEDIA_COPPER, copper);
|
||||
phy_write_paged(basephy, RTL838X_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO);
|
||||
|
||||
if (!phydev->suspended) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue