1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * drivers/net/ethernet/ibm/emac/phy.h
5 * Driver for PowerPC 4xx on-chip ethernet controller, PHY support
7 * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
8 * <benh@kernel.crashing.org>
10 * Based on the arch/ppc version of the driver:
12 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
15 * Minor additions by Eugene Surovegin <ebs@ebshome.net>, 2004
17 * This file basically duplicates sungem_phy.{c,h} with different PHYs
18 * supported. I'm looking into merging that in a single mii layer more
22 #ifndef __IBM_NEWEMAC_PHY_H
23 #define __IBM_NEWEMAC_PHY_H
27 /* Operations supported by any kind of PHY */
29 int (*init
) (struct mii_phy
* phy
);
30 int (*suspend
) (struct mii_phy
* phy
, int wol_options
);
31 int (*setup_aneg
) (struct mii_phy
* phy
, u32 advertise
);
32 int (*setup_forced
) (struct mii_phy
* phy
, int speed
, int fd
);
33 int (*poll_link
) (struct mii_phy
* phy
);
34 int (*read_link
) (struct mii_phy
* phy
);
37 /* Structure used to statically define an mii/gii based PHY */
39 u32 phy_id
; /* Concatenated ID1 << 16 | ID2 */
40 u32 phy_id_mask
; /* Significant bits */
41 u32 features
; /* Ethtool SUPPORTED_* defines or
43 int magic_aneg
; /* Autoneg does all speed test for us */
45 const struct mii_phy_ops
*ops
;
48 /* An instance of a PHY, partially borrowed from mii_if_info */
50 struct mii_phy_def
*def
;
51 u32 advertising
; /* Ethtool ADVERTISED_* defines */
52 u32 features
; /* Copied from mii_phy_def.features
53 or determined automaticaly */
54 int address
; /* PHY address */
55 int mode
; /* PHY mode */
56 int gpcs_address
; /* GPCS PHY address */
58 /* 1: autoneg enabled, 0: disabled */
61 /* forced speed & duplex (no autoneg)
62 * partner speed & duplex & pause (autoneg)
69 /* Provided by host chip */
70 struct net_device
*dev
;
71 int (*mdio_read
) (struct net_device
* dev
, int addr
, int reg
);
72 void (*mdio_write
) (struct net_device
* dev
, int addr
, int reg
,
76 /* Pass in a struct mii_phy with dev, mdio_read and mdio_write
77 * filled, the remaining fields will be filled on return
79 int emac_mii_phy_probe(struct mii_phy
*phy
, int address
);
80 int emac_mii_reset_phy(struct mii_phy
*phy
);
81 int emac_mii_reset_gpcs(struct mii_phy
*phy
);
83 #endif /* __IBM_NEWEMAC_PHY_H */