Initial commit
[wrt350n-kernel.git] / drivers / net / ibm_newemac / phy.h
blob1b65c81f65577513af7ab34a52b7205fee10bab5
1 /*
2 * drivers/net/ibm_newemac/phy.h
4 * Driver for PowerPC 4xx on-chip ethernet controller, PHY support
6 * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
7 * <benh@kernel.crashing.org>
9 * Based on the arch/ppc version of the driver:
11 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 * February 2003
14 * Minor additions by Eugene Surovegin <ebs@ebshome.net>, 2004
16 * This program is free software; you can redistribute it and/or modify it
17 * under the terms of the GNU General Public License as published by the
18 * Free Software Foundation; either version 2 of the License, or (at your
19 * option) any later version.
21 * This file basically duplicates sungem_phy.{c,h} with different PHYs
22 * supported. I'm looking into merging that in a single mii layer more
23 * flexible than mii.c
26 #ifndef __IBM_NEWEMAC_PHY_H
27 #define __IBM_NEWEMAC_PHY_H
29 struct mii_phy;
31 /* Operations supported by any kind of PHY */
32 struct mii_phy_ops {
33 int (*init) (struct mii_phy * phy);
34 int (*suspend) (struct mii_phy * phy, int wol_options);
35 int (*setup_aneg) (struct mii_phy * phy, u32 advertise);
36 int (*setup_forced) (struct mii_phy * phy, int speed, int fd);
37 int (*poll_link) (struct mii_phy * phy);
38 int (*read_link) (struct mii_phy * phy);
41 /* Structure used to statically define an mii/gii based PHY */
42 struct mii_phy_def {
43 u32 phy_id; /* Concatenated ID1 << 16 | ID2 */
44 u32 phy_id_mask; /* Significant bits */
45 u32 features; /* Ethtool SUPPORTED_* defines or
46 0 for autodetect */
47 int magic_aneg; /* Autoneg does all speed test for us */
48 const char *name;
49 const struct mii_phy_ops *ops;
52 /* An instance of a PHY, partially borrowed from mii_if_info */
53 struct mii_phy {
54 struct mii_phy_def *def;
55 u32 advertising; /* Ethtool ADVERTISED_* defines */
56 u32 features; /* Copied from mii_phy_def.features
57 or determined automaticaly */
58 int address; /* PHY address */
59 int mode; /* PHY mode */
61 /* 1: autoneg enabled, 0: disabled */
62 int autoneg;
64 /* forced speed & duplex (no autoneg)
65 * partner speed & duplex & pause (autoneg)
67 int speed;
68 int duplex;
69 int pause;
70 int asym_pause;
72 /* Provided by host chip */
73 struct net_device *dev;
74 int (*mdio_read) (struct net_device * dev, int addr, int reg);
75 void (*mdio_write) (struct net_device * dev, int addr, int reg,
76 int val);
79 /* Pass in a struct mii_phy with dev, mdio_read and mdio_write
80 * filled, the remaining fields will be filled on return
82 int emac_mii_phy_probe(struct mii_phy *phy, int address);
83 int emac_mii_reset_phy(struct mii_phy *phy);
85 #endif /* __IBM_NEWEMAC_PHY_H */