lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <646450A91FAED74E85C6E9C4D6E936A1453366BB@avsrvexchmbx1.microsemi.net>
Date:   Wed, 24 Aug 2016 12:29:57 +0000
From:   Raju Lakkaraju <Raju.Lakkaraju@...rosemi.com>
To:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC:     "f.fainelli@...il.com" <f.fainelli@...il.com>,
        "Andrew Lunn (andrew@...n.ch)" <andrew@...n.ch>,
        Allan Nielsen <Allan.Nielsen@...rosemi.com>
Subject: [PATCH 4/4] net: phy: Add write driver for Microsemi PHYs.

From: Nagaraju Lakkaraju <Raju.Lakkaraju@...rosemi.com>

PHY write register support will be added for VSC 85xx Microsemi PHYs.

Signed-off-by: Nagaraju Lakkaraju <Raju.Lakkaraju@...rosemi.com>
---
 drivers/net/phy/mscc.c | 24 ++++++++++++++++++++++++
 include/linux/mscc.h   |  1 +
 2 files changed, 25 insertions(+)

diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c
index 5a74f81..9315fde 100644
--- a/drivers/net/phy/mscc.c
+++ b/drivers/net/phy/mscc.c
@@ -194,6 +194,27 @@ static int vsc85xx_mac_if_get(struct phy_device *phydev,
        return rc;
 }

+static int vsc85xx_phy_write_reg(struct phy_device *phydev,
+                                struct phy_reg_op *data)
+{
+       int rc;
+       u16 reg_addr = data->reg;
+       u16 reg_val = data->val;
+       u8  page = data->pg;
+
+       if (page != 0) {
+               mutex_lock(&phydev->lock);
+               vsc85xx_phy_page_set(phydev, page);
+               rc = phy_write(phydev, reg_addr, reg_val);
+               vsc85xx_phy_page_set(phydev, MSCC_PHY_PAGE_STANDARD);
+               mutex_unlock(&phydev->lock);
+       } else {
+               rc = phy_write(phydev, reg_addr, reg_val);
+       }
+
+       return rc;
+}
+
 static int vsc85xx_phy_read_reg(struct phy_device *phydev,
                                struct phy_reg_op *data)
 {
@@ -228,6 +249,9 @@ static int vsc85xx_features_set(struct phy_device *phydev)
        case PHY_MAC_IF:
                rc = vsc85xx_mac_if_set(phydev, &ftrs->mac_if);
                break;
+       case PHY_WRITE_REG:
+               rc = vsc85xx_phy_write_reg(phydev, ftrs->data);
+               break;
        default:
                break;
        }
diff --git a/include/linux/mscc.h b/include/linux/mscc.h
index 4265da7..b2cf373 100644
--- a/include/linux/mscc.h
+++ b/include/linux/mscc.h
@@ -13,6 +13,7 @@ enum phy_features {
        PHY_EDGE_RATE_CONTROL = 0,
        PHY_MAC_IF            = 1,
        PHY_READ_REG          = 2,
+       PHY_WRITE_REG         = 3,
        PHY_SUPPORTED_FEATURES_MAX
 };

-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ