of_mdio.h 2.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*
 * OF helpers for the MDIO (Ethernet PHY) API
 *
 * Copyright (c) 2009 Secret Lab Technologies, Ltd.
 *
 * This file is released under the GPLv2
 */

#ifndef __LINUX_OF_MDIO_H
#define __LINUX_OF_MDIO_H

#include <linux/phy.h>
#include <linux/of.h>

15
#ifdef CONFIG_OF
16 17 18 19 20 21
extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np);
extern struct phy_device *of_phy_find_device(struct device_node *phy_np);
extern struct phy_device *of_phy_connect(struct net_device *dev,
					 struct device_node *phy_np,
					 void (*hndlr)(struct net_device *),
					 u32 flags, phy_interface_t iface);
A
Andy Fleming 已提交
22 23 24
struct phy_device *of_phy_attach(struct net_device *dev,
				 struct device_node *phy_np, u32 flags,
				 phy_interface_t iface);
25 26 27
extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
					 void (*hndlr)(struct net_device *),
					 phy_interface_t iface);
28

29 30
extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);

31
#else /* CONFIG_OF */
M
Mark Brown 已提交
32
static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
33
{
34 35 36 37 38 39
	/*
	 * Fall back to the non-DT function to register a bus.
	 * This way, we don't have to keep compat bits around in drivers.
	 */

	return mdiobus_register(mdio);
40 41
}

M
Mark Brown 已提交
42
static inline struct phy_device *of_phy_find_device(struct device_node *phy_np)
43 44 45 46
{
	return NULL;
}

M
Mark Brown 已提交
47 48 49 50
static inline struct phy_device *of_phy_connect(struct net_device *dev,
						struct device_node *phy_np,
						void (*hndlr)(struct net_device *),
						u32 flags, phy_interface_t iface)
51 52 53 54
{
	return NULL;
}

A
Andy Fleming 已提交
55 56 57 58 59 60 61
static inline struct phy_device *of_phy_attach(struct net_device *dev,
					       struct device_node *phy_np,
					       u32 flags, phy_interface_t iface)
{
	return NULL;
}

M
Mark Brown 已提交
62 63 64
static inline struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
							   void (*hndlr)(struct net_device *),
							   phy_interface_t iface)
65 66 67 68
{
	return NULL;
}

M
Mark Brown 已提交
69
static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np)
70 71 72 73 74
{
	return NULL;
}
#endif /* CONFIG_OF */

75
#endif /* __LINUX_OF_MDIO_H */