瀏覽代碼

of: mdio: export of_mdio_parse_addr

Export of_mdio_parse_addr() which allows parsing a given Ethernet PHY
node MDIO address, verify it is within the allowed range, and return
its value. This is going to be useful for the DSA code which needs to
deal with multiple layers of MDIO buses.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Florian Fainelli 10 年之前
父節點
當前提交
33d6737761
共有 2 個文件被更改,包括 9 次插入1 次删除
  1. 2 1
      drivers/of/of_mdio.c
  2. 7 0
      include/linux/of_mdio.h

+ 2 - 1
drivers/of/of_mdio.c

@@ -88,7 +88,7 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *chi
 	return 0;
 	return 0;
 }
 }
 
 
-static int of_mdio_parse_addr(struct device *dev, const struct device_node *np)
+int of_mdio_parse_addr(struct device *dev, const struct device_node *np)
 {
 {
 	u32 addr;
 	u32 addr;
 	int ret;
 	int ret;
@@ -108,6 +108,7 @@ static int of_mdio_parse_addr(struct device *dev, const struct device_node *np)
 
 
 	return addr;
 	return addr;
 }
 }
+EXPORT_SYMBOL(of_mdio_parse_addr);
 
 
 /**
 /**
  * of_mdiobus_register - Register mii_bus and create PHYs from the device tree
  * of_mdiobus_register - Register mii_bus and create PHYs from the device tree

+ 7 - 0
include/linux/of_mdio.h

@@ -24,6 +24,7 @@ struct phy_device *of_phy_attach(struct net_device *dev,
 				 phy_interface_t iface);
 				 phy_interface_t iface);
 
 
 extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
 extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
+extern int of_mdio_parse_addr(struct device *dev, const struct device_node *np);
 
 
 #else /* CONFIG_OF */
 #else /* CONFIG_OF */
 static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
 static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
@@ -60,6 +61,12 @@ static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np)
 {
 {
 	return NULL;
 	return NULL;
 }
 }
+
+static inline int of_mdio_parse_addr(struct device *dev,
+				     const struct device_node *np)
+{
+	return -ENOSYS;
+}
 #endif /* CONFIG_OF */
 #endif /* CONFIG_OF */
 
 
 #if defined(CONFIG_OF) && defined(CONFIG_FIXED_PHY)
 #if defined(CONFIG_OF) && defined(CONFIG_FIXED_PHY)