aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2016-02-03 09:33:50 +0000
committerRafał Miłecki <zajec5@gmail.com>2016-02-03 09:33:50 +0000
commitb3c3542515f6065d4278e063e814cbc39baccd0c (patch)
tree5f5a0fd369467282a7e4bf6bd9f49013a6bf357f /target/linux/generic/files/drivers/net/phy/b53/b53_common.c
parent19b9e14c47cf289758dc465fd44ee282c41c469a (diff)
downloadupstream-b3c3542515f6065d4278e063e814cbc39baccd0c.tar.gz
upstream-b3c3542515f6065d4278e063e814cbc39baccd0c.tar.bz2
upstream-b3c3542515f6065d4278e063e814cbc39baccd0c.zip
b53: provide PHY access to swconfig
Thanks to this change swconfig can access port PHYs e.g. when setting port link state with a generic helper. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 48622
Diffstat (limited to 'target/linux/generic/files/drivers/net/phy/b53/b53_common.c')
-rw-r--r--target/linux/generic/files/drivers/net/phy/b53/b53_common.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
index 859d8d1bdc..41b5ae96c3 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
@@ -794,6 +794,26 @@ static int b53_port_get_link(struct switch_dev *dev, int port,
}
+static int b53_phy_read16(struct switch_dev *dev, int addr, u8 reg, u16 *value)
+{
+ struct b53_device *priv = sw_to_b53(dev);
+
+ if (priv->ops->phy_read16)
+ return priv->ops->phy_read16(priv, addr, reg, value);
+
+ return b53_read16(priv, B53_PORT_MII_PAGE(addr), reg, value);
+}
+
+static int b53_phy_write16(struct switch_dev *dev, int addr, u8 reg, u16 value)
+{
+ struct b53_device *priv = sw_to_b53(dev);
+
+ if (priv->ops->phy_write16)
+ return priv->ops->phy_write16(priv, addr, reg, value);
+
+ return b53_write16(priv, B53_PORT_MII_PAGE(addr), reg, value);
+}
+
static int b53_global_reset_switch(struct switch_dev *dev)
{
struct b53_device *priv = sw_to_b53(dev);
@@ -1002,6 +1022,8 @@ static const struct switch_dev_ops b53_switch_ops_25 = {
.apply_config = b53_global_apply_config,
.reset_switch = b53_global_reset_switch,
.get_port_link = b53_port_get_link,
+ .phy_read16 = b53_phy_read16,
+ .phy_write16 = b53_phy_write16,
};
static const struct switch_dev_ops b53_switch_ops_65 = {
@@ -1025,6 +1047,8 @@ static const struct switch_dev_ops b53_switch_ops_65 = {
.apply_config = b53_global_apply_config,
.reset_switch = b53_global_reset_switch,
.get_port_link = b53_port_get_link,
+ .phy_read16 = b53_phy_read16,
+ .phy_write16 = b53_phy_write16,
};
static const struct switch_dev_ops b53_switch_ops = {
@@ -1048,6 +1072,8 @@ static const struct switch_dev_ops b53_switch_ops = {
.apply_config = b53_global_apply_config,
.reset_switch = b53_global_reset_switch,
.get_port_link = b53_port_get_link,
+ .phy_read16 = b53_phy_read16,
+ .phy_write16 = b53_phy_write16,
};
struct b53_chip_data {