From: Ben Hutchings Date: Wed, 29 Feb 2012 14:26:22 +0000 (+0000) Subject: ethtool, mdio, mii: Specify MDIO information fields in struct ethtool_cmd X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9c4df53bc3f9c72d7f1f1226927f456d46412381;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git ethtool, mdio, mii: Specify MDIO information fields in struct ethtool_cmd Add comments for ethtool_cmd::phy_address and ethtool_cmd::mdio_support, and definitions of the flags currently used in mdio_support. In the mdio library, assert that its own flags continue to match those in the ethtool interface. In the mii library, use the ethtool flag definition and stop including . Signed-off-by: Ben Hutchings Signed-off-by: David S. Miller --- diff --git a/drivers/net/mdio.c b/drivers/net/mdio.c index 16fbb11d92ac..8403316eb02b 100644 --- a/drivers/net/mdio.c +++ b/drivers/net/mdio.c @@ -190,6 +190,9 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio, int reg; u32 speed; + BUILD_BUG_ON(MDIO_SUPPORTS_C22 != ETH_MDIO_SUPPORTS_C22); + BUILD_BUG_ON(MDIO_SUPPORTS_C45 != ETH_MDIO_SUPPORTS_C45); + ecmd->transceiver = XCVR_INTERNAL; ecmd->phy_address = mdio->prtad; ecmd->mdio_support = diff --git a/drivers/net/mii.c b/drivers/net/mii.c index c70c2332d15e..4a99c3919037 100644 --- a/drivers/net/mii.c +++ b/drivers/net/mii.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include static u32 mii_get_an(struct mii_if_info *mii, u16 addr) { @@ -74,7 +74,7 @@ int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd) /* this isn't fully supported at higher layers */ ecmd->phy_address = mii->phy_id; - ecmd->mdio_support = MDIO_SUPPORTS_C22; + ecmd->mdio_support = ETH_MDIO_SUPPORTS_C22; ecmd->advertising = ADVERTISED_TP | ADVERTISED_MII; diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index da5b2de99ae4..e1d9e0ede309 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -30,10 +30,15 @@ struct ethtool_cmd { * access it */ __u8 duplex; /* Duplex, half or full */ __u8 port; /* Which connector port */ - __u8 phy_address; + __u8 phy_address; /* MDIO PHY address (PRTAD for clause 45). + * May be read-only or read-write + * depending on the driver. + */ __u8 transceiver; /* Which transceiver to use */ __u8 autoneg; /* Enable or disable autonegotiation */ - __u8 mdio_support; + __u8 mdio_support; /* MDIO protocols supported. Read-only. + * Not set by all drivers. + */ __u32 maxtxpkt; /* Tx pkts before generating tx int */ __u32 maxrxpkt; /* Rx pkts before generating rx int */ __u16 speed_hi; /* The forced speed (upper @@ -59,6 +64,20 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) return (ep->speed_hi << 16) | ep->speed; } +/* Device supports clause 22 register access to PHY or peripherals + * using the interface defined in . This should not be + * set if there are known to be no such peripherals present or if + * the driver only emulates clause 22 registers for compatibility. + */ +#define ETH_MDIO_SUPPORTS_C22 1 + +/* Device supports clause 45 register access to PHY or peripherals + * using the interface defined in and . + * This should not be set if there are known to be no such peripherals + * present. + */ +#define ETH_MDIO_SUPPORTS_C45 2 + #define ETHTOOL_FWVERS_LEN 32 #define ETHTOOL_BUSINFO_LEN 32 /* these strings are set to whatever the driver author decides... */