summaryrefslogtreecommitdiff
path: root/include/miiphy.h
diff options
context:
space:
mode:
authorAndy Fleming <afleming@freescale.com>2011-04-08 02:10:27 -0500
committerAndy Fleming <afleming@freescale.com>2011-04-20 15:09:19 -0500
commit5f184715ecd31bfcb8d09ba2d9f14adfa172a141 (patch)
tree60d95bc3e46ad53edc26900caee5bfc84fbf569e /include/miiphy.h
parent16a5323833cc3536fac4c6aa3c6c4cf681679952 (diff)
downloadu-boot-5f184715ecd31bfcb8d09ba2d9f14adfa172a141.tar.gz
u-boot-5f184715ecd31bfcb8d09ba2d9f14adfa172a141.tar.bz2
u-boot-5f184715ecd31bfcb8d09ba2d9f14adfa172a141.zip
Create PHY Lib for U-Boot
Extends the mii_dev structure to participate in a full-blown MDIO and PHY driver scheme. The mii_dev structure and miiphy calls are modified in such a way to allow the original mii command and miiphy infrastructure to work as before, but also to support a new set of APIs which allow (among other things) sharing of PHY driver code and 10G support The mii command will continue to support normal PHY management functions (Clause 22 of 802.3), but will not be changed to support 10G (Clause 45). The basic design is similar to PHY Lib from Linux, but simplified for U-Boot's network and driver infrastructure. We now have MDIO drivers and PHY drivers An MDIO driver provides: read write reset A PHY driver provides: (optionally): probe config - initial setup, starting of auto-negotiation startup - waiting for AN, and reading link state shutdown - any cleanup needed The ethernet drivers interact with the PHY Lib using these functions: phy_connect() phy_config() phy_startup() phy_shutdown() Each PHY driver can be configured separately, or all at once using config_phylib_all_drivers.h (added in the patch which adds the drivers) We also provide generic drivers for Clause 22 (10/100/1000), and Clause 45 (10G) PHYs. We also implement phy_reset(), and call it in phy_connect(). Because phy_reset() is essentially the same as miiphy_reset, but: a) must support 10G PHYs, and b) should use the phylib primitives, we implement miiphy_reset, using phy_reset(), but only when CONFIG_PHYLIB is set. Otherwise, we just use the old version. In this way, we save on compile size, even if we don't manage to save code size. Pulled ethtool.h and mdio.h from: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 782d640afd15af7a1faf01cfe566ca4ac511319d With many, many deletions so as to enable compilation under u-boot Signed-off-by: Andy Fleming <afleming@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Detlev Zundel <dzu@denx.de>
Diffstat (limited to 'include/miiphy.h')
-rw-r--r--include/miiphy.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/miiphy.h b/include/miiphy.h
index 34ebce6779..7e70cf81e4 100644
--- a/include/miiphy.h
+++ b/include/miiphy.h
@@ -34,8 +34,18 @@
#ifndef _miiphy_h_
#define _miiphy_h_
+#include <common.h>
#include <linux/mii.h>
+#include <linux/list.h>
#include <net.h>
+#include <phy.h>
+
+struct legacy_mii_dev {
+ int (*read)(const char *devname, unsigned char addr,
+ unsigned char reg, unsigned short *value);
+ int (*write)(const char *devname, unsigned char addr,
+ unsigned char reg, unsigned short value);
+};
int miiphy_read(const char *devname, unsigned char addr, unsigned char reg,
unsigned short *value);
@@ -61,9 +71,16 @@ void miiphy_register(const char *devname,
int miiphy_set_current_dev(const char *devname);
const char *miiphy_get_current_dev(void);
+struct mii_dev *mdio_get_current_dev(void);
+struct mii_dev *miiphy_get_dev_by_name(const char *devname);
+struct phy_device *mdio_phydev_for_ethname(const char *devname);
void miiphy_listdev(void);
+struct mii_dev *mdio_alloc(void);
+int mdio_register(struct mii_dev *bus);
+void mdio_list_devices(void);
+
#ifdef CONFIG_BITBANGMII
#define BB_MII_DEVNAME "bb_miiphy"