Skip to content

Commit 7b98f63

Browse files
Raju Lakkarajudavem330
authored andcommitted
net: phy: mscc: Fix the VSC 8531/41 Chip Init sequence
- Turn on Broadcast writes - UNH 1.8.1 clear bias for UNH 1000BT distortion - UNH 1.8.7 optimize pre-emphasis for 100BasTx UNH 100W fix - Enable Token-ring during 'Coma Mode' Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 29d3c04 commit 7b98f63

1 file changed

Lines changed: 54 additions & 1 deletion

File tree

‎drivers/net/phy/mscc.c‎

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,51 @@ static void vsc85xx_tr_write(struct phy_device *phydev, u16 addr, u32 val)
853853
__phy_write(phydev, MSCC_PHY_TR_CNTL, TR_WRITE | TR_ADDR(addr));
854854
}
855855

856+
static int vsc8531_pre_init_seq_set(struct phy_device *phydev)
857+
{
858+
int rc;
859+
const struct reg_val init_seq[] = {
860+
{0x0f90, 0x00688980},
861+
{0x0696, 0x00000003},
862+
{0x07fa, 0x0050100f},
863+
{0x1686, 0x00000004},
864+
};
865+
unsigned int i;
866+
int oldpage;
867+
868+
rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_STANDARD,
869+
MSCC_PHY_EXT_CNTL_STATUS, SMI_BROADCAST_WR_EN,
870+
SMI_BROADCAST_WR_EN);
871+
if (rc < 0)
872+
return rc;
873+
rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_TEST,
874+
MSCC_PHY_TEST_PAGE_24, 0, 0x0400);
875+
if (rc < 0)
876+
return rc;
877+
rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_TEST,
878+
MSCC_PHY_TEST_PAGE_5, 0x0a00, 0x0e00);
879+
if (rc < 0)
880+
return rc;
881+
rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_TEST,
882+
MSCC_PHY_TEST_PAGE_8, 0x8000, 0x8000);
883+
if (rc < 0)
884+
return rc;
885+
886+
mutex_lock(&phydev->lock);
887+
oldpage = phy_select_page(phydev, MSCC_PHY_PAGE_TR);
888+
if (oldpage < 0)
889+
goto out_unlock;
890+
891+
for (i = 0; i < ARRAY_SIZE(init_seq); i++)
892+
vsc85xx_tr_write(phydev, init_seq[i].reg, init_seq[i].val);
893+
894+
out_unlock:
895+
oldpage = phy_restore_page(phydev, oldpage, oldpage);
896+
mutex_unlock(&phydev->lock);
897+
898+
return oldpage;
899+
}
900+
856901
static int vsc85xx_eee_init_seq_set(struct phy_device *phydev)
857902
{
858903
const struct reg_val init_eee[] = {
@@ -1650,7 +1695,7 @@ static int vsc8584_config_init(struct phy_device *phydev)
16501695

16511696
static int vsc85xx_config_init(struct phy_device *phydev)
16521697
{
1653-
int rc, i;
1698+
int rc, i, phy_id;
16541699
struct vsc8531_private *vsc8531 = phydev->priv;
16551700

16561701
rc = vsc85xx_default_config(phydev);
@@ -1665,6 +1710,14 @@ static int vsc85xx_config_init(struct phy_device *phydev)
16651710
if (rc)
16661711
return rc;
16671712

1713+
phy_id = phydev->drv->phy_id & phydev->drv->phy_id_mask;
1714+
if (PHY_ID_VSC8531 == phy_id || PHY_ID_VSC8541 == phy_id ||
1715+
PHY_ID_VSC8530 == phy_id || PHY_ID_VSC8540 == phy_id) {
1716+
rc = vsc8531_pre_init_seq_set(phydev);
1717+
if (rc)
1718+
return rc;
1719+
}
1720+
16681721
rc = vsc85xx_eee_init_seq_set(phydev);
16691722
if (rc)
16701723
return rc;

0 commit comments

Comments
 (0)