generic: backport at803x fixes

As patches for the AR8031/AR8033 copper page selection were merged
upstream, we can backport these patches.

This also fixes a PHY capabilities detection issue on the Ubiquiti
ER-X-SFP.

Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
David Bauer
2021-06-04 15:12:14 +02:00
parent 1412424fc5
commit 15167671b0
12 changed files with 361 additions and 208 deletions

View File

@@ -41,7 +41,7 @@ Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
depends on BCM63XX || COMPILE_TEST
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -63,6 +63,8 @@
@@ -62,6 +62,8 @@
#define AT803X_DEBUG_REG_5 0x05
#define AT803X_DEBUG_TX_CLK_DLY_EN BIT(8)
@@ -50,8 +50,8 @@ Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
#define ATH8030_PHY_ID 0x004dd076
#define ATH8031_PHY_ID 0x004dd074
#define ATH8032_PHY_ID 0x004dd023
@@ -257,6 +259,19 @@ static int at803x_probe(struct phy_devic
return 0;
@@ -299,10 +301,30 @@ static int at803x_probe(struct phy_devic
return ret;
}
+static void at803x_enable_smart_eee(struct phy_device *phydev, int on)
@@ -70,9 +70,6 @@ Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
static int at803x_config_init(struct phy_device *phydev)
{
int ret;
@@ -282,6 +297,13 @@ static int at803x_config_init(struct phy
return ret;
}
+
+#ifdef CONFIG_AT803X_PHY_SMART_EEE

View File

@@ -28,10 +28,10 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
#define AT803X_REG_CHIP_CONFIG 0x1f
#define AT803X_BT_BX_REG_SEL 0x8000
+#define AT803X_SMARTEEE_DISABLED_VAL 0x1000
#define AT803X_SGMII_ANEG_EN 0x1000
#define AT803X_DEBUG_ADDR 0x1D
@@ -65,6 +70,9 @@
#define AT803X_DEBUG_DATA 0x1E
@@ -64,6 +69,9 @@
#define AT803X_LPI_EN BIT(8)
@@ -41,9 +41,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
#define ATH8030_PHY_ID 0x004dd076
#define ATH8031_PHY_ID 0x004dd074
#define ATH8032_PHY_ID 0x004dd023
@@ -72,12 +80,16 @@
#define AT803X_PHY_ID_MASK 0xffffffef
#define AT8032_PHY_ID_MASK 0xffffffff
@@ -74,12 +82,16 @@
#define AT803X_PAGE_FIBER 0
#define AT803X_PAGE_COPPER 1
+#define AT803X_EEE_FEATURE_DISABLE (1 << 1)
+#define AT803X_VDDIO_1P8V (1 << 2)
@@ -58,7 +58,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
};
struct at803x_context {
@@ -141,6 +153,39 @@ static int at803x_disable_tx_delay(struc
@@ -172,6 +184,39 @@ static int at803x_disable_tx_delay(struc
AT803X_DEBUG_TX_CLK_DLY_EN, 0);
}
@@ -98,7 +98,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
/* save relevant PHY registers to private copy */
static void at803x_context_save(struct phy_device *phydev,
struct at803x_context *context)
@@ -254,6 +299,12 @@ static int at803x_probe(struct phy_devic
@@ -286,6 +331,12 @@ static int at803x_probe(struct phy_devic
if (!priv)
return -ENOMEM;
@@ -110,16 +110,16 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
+
phydev->priv = priv;
return 0;
@@ -275,6 +326,7 @@ static void at803x_enable_smart_eee(stru
/* Some bootloaders leave the fiber page selected.
@@ -316,6 +367,7 @@ static void at803x_enable_smart_eee(stru
static int at803x_config_init(struct phy_device *phydev)
{
int ret;
+ struct at803x_priv *priv = phydev->priv;
u32 v;
int ret;
if (phydev->drv->phy_id == ATH8031_PHY_ID &&
@@ -323,6 +375,18 @@ static int at803x_config_init(struct phy
@@ -344,6 +396,18 @@ static int at803x_config_init(struct phy
else
ret = at803x_disable_tx_delay(phydev);