Linux Audio

Check our new training course

Loading...
v6.8
 1/* SPDX-License-Identifier: GPL-2.0-or-later */
 2/*
 3 * drivers/net/ethernet/ibm/emac/phy.h
 4 *
 5 * Driver for PowerPC 4xx on-chip ethernet controller, PHY support
 6 *
 7 * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
 8 *                <benh@kernel.crashing.org>
 9 *
10 * Based on the arch/ppc version of the driver:
11 *
12 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 * February 2003
14 *
15 * Minor additions by Eugene Surovegin <ebs@ebshome.net>, 2004
 
 
 
 
 
16 *
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
19 * flexible than mii.c
20 */
21
22#ifndef __IBM_NEWEMAC_PHY_H
23#define __IBM_NEWEMAC_PHY_H
24
25struct mii_phy;
26
27/* Operations supported by any kind of PHY */
28struct mii_phy_ops {
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);
35};
36
37/* Structure used to statically define an mii/gii based PHY */
38struct mii_phy_def {
39	u32 phy_id;		/* Concatenated ID1 << 16 | ID2 */
40	u32 phy_id_mask;	/* Significant bits */
41	u32 features;		/* Ethtool SUPPORTED_* defines or
42				   0 for autodetect */
43	int magic_aneg;		/* Autoneg does all speed test for us */
44	const char *name;
45	const struct mii_phy_ops *ops;
46};
47
48/* An instance of a PHY, partially borrowed from mii_if_info */
49struct mii_phy {
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 */
57
58	/* 1: autoneg enabled, 0: disabled */
59	int autoneg;
60
61	/* forced speed & duplex (no autoneg)
62	 * partner speed & duplex & pause (autoneg)
63	 */
64	int speed;
65	int duplex;
66	int pause;
67	int asym_pause;
68
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,
73			    int val);
74};
75
76/* Pass in a struct mii_phy with dev, mdio_read and mdio_write
77 * filled, the remaining fields will be filled on return
78 */
79int emac_mii_phy_probe(struct mii_phy *phy, int address);
80int emac_mii_reset_phy(struct mii_phy *phy);
81int emac_mii_reset_gpcs(struct mii_phy *phy);
82
83#endif /* __IBM_NEWEMAC_PHY_H */
v4.6
 
 1/*
 2 * drivers/net/ethernet/ibm/emac/phy.h
 3 *
 4 * Driver for PowerPC 4xx on-chip ethernet controller, PHY support
 5 *
 6 * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
 7 *                <benh@kernel.crashing.org>
 8 *
 9 * Based on the arch/ppc version of the driver:
10 *
11 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 * February 2003
13 *
14 * Minor additions by Eugene Surovegin <ebs@ebshome.net>, 2004
15 *
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.
20 *
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
24 */
25
26#ifndef __IBM_NEWEMAC_PHY_H
27#define __IBM_NEWEMAC_PHY_H
28
29struct mii_phy;
30
31/* Operations supported by any kind of PHY */
32struct 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);
39};
40
41/* Structure used to statically define an mii/gii based PHY */
42struct 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;
50};
51
52/* An instance of a PHY, partially borrowed from mii_if_info */
53struct 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 */
60	int gpcs_address;	/* GPCS PHY address */
61
62	/* 1: autoneg enabled, 0: disabled */
63	int autoneg;
64
65	/* forced speed & duplex (no autoneg)
66	 * partner speed & duplex & pause (autoneg)
67	 */
68	int speed;
69	int duplex;
70	int pause;
71	int asym_pause;
72
73	/* Provided by host chip */
74	struct net_device *dev;
75	int (*mdio_read) (struct net_device * dev, int addr, int reg);
76	void (*mdio_write) (struct net_device * dev, int addr, int reg,
77			    int val);
78};
79
80/* Pass in a struct mii_phy with dev, mdio_read and mdio_write
81 * filled, the remaining fields will be filled on return
82 */
83int emac_mii_phy_probe(struct mii_phy *phy, int address);
84int emac_mii_reset_phy(struct mii_phy *phy);
85int emac_mii_reset_gpcs(struct mii_phy *phy);
86
87#endif /* __IBM_NEWEMAC_PHY_H */