linux/include/linux/sungem_phy.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __SUNGEM_PHY_H__
#define __SUNGEM_PHY_H__

#include <linux/types.h>

struct mii_phy;

/* Operations supported by any kind of PHY */
struct mii_phy_ops
{};

/* Structure used to statically define an mii/gii based PHY */
struct mii_phy_def
{};

enum {};

/* An instance of a PHY, partially borrowed from mii_if_info */
struct mii_phy
{};

/* Pass in a struct mii_phy with dev, mdio_read and mdio_write
 * filled, the remaining fields will be filled on return
 */
extern int sungem_phy_probe(struct mii_phy *phy, int mii_id);


/* MII definitions missing from mii.h */

#define BMCR_SPD2
#define LPA_PAUSE

/* More PHY registers (model specific) */

/* MII BCM5201 MULTIPHY interrupt register */
#define MII_BCM5201_INTERRUPT
#define MII_BCM5201_INTERRUPT_INTENABLE

#define MII_BCM5201_AUXMODE2
#define MII_BCM5201_AUXMODE2_LOWPOWER

#define MII_BCM5201_MULTIPHY

/* MII BCM5201 MULTIPHY register bits */
#define MII_BCM5201_MULTIPHY_SERIALMODE
#define MII_BCM5201_MULTIPHY_SUPERISOLATE

/* MII BCM5221 Additional registers */
#define MII_BCM5221_TEST
#define MII_BCM5221_TEST_ENABLE_SHADOWS
#define MII_BCM5221_SHDOW_AUX_STAT2
#define MII_BCM5221_SHDOW_AUX_STAT2_APD
#define MII_BCM5221_SHDOW_AUX_MODE4
#define MII_BCM5221_SHDOW_AUX_MODE4_IDDQMODE
#define MII_BCM5221_SHDOW_AUX_MODE4_CLKLOPWR

/* MII BCM5241 Additional registers */
#define MII_BCM5241_SHDOW_AUX_MODE4_STANDBYPWR

/* MII BCM5400 1000-BASET Control register */
#define MII_BCM5400_GB_CONTROL
#define MII_BCM5400_GB_CONTROL_FULLDUPLEXCAP

/* MII BCM5400 AUXCONTROL register */
#define MII_BCM5400_AUXCONTROL
#define MII_BCM5400_AUXCONTROL_PWR10BASET

/* MII BCM5400 AUXSTATUS register */
#define MII_BCM5400_AUXSTATUS
#define MII_BCM5400_AUXSTATUS_LINKMODE_MASK
#define MII_BCM5400_AUXSTATUS_LINKMODE_SHIFT

/* 1000BT control (Marvell & BCM54xx at least) */
#define MII_1000BASETCONTROL
#define MII_1000BASETCONTROL_FULLDUPLEXCAP
#define MII_1000BASETCONTROL_HALFDUPLEXCAP

/* Marvell 88E1011 PHY control */
#define MII_M1011_PHY_SPEC_CONTROL
#define MII_M1011_PHY_SPEC_CONTROL_MANUAL_MDIX
#define MII_M1011_PHY_SPEC_CONTROL_AUTO_MDIX

/* Marvell 88E1011 PHY status */
#define MII_M1011_PHY_SPEC_STATUS
#define MII_M1011_PHY_SPEC_STATUS_1000
#define MII_M1011_PHY_SPEC_STATUS_100
#define MII_M1011_PHY_SPEC_STATUS_SPD_MASK
#define MII_M1011_PHY_SPEC_STATUS_FULLDUPLEX
#define MII_M1011_PHY_SPEC_STATUS_RESOLVED
#define MII_M1011_PHY_SPEC_STATUS_TX_PAUSE
#define MII_M1011_PHY_SPEC_STATUS_RX_PAUSE

#endif /* __SUNGEM_PHY_H__ */