Commit f1538eca authored by Heiner Kallweit's avatar Heiner Kallweit Committed by David S. Miller

net: phy: shrink PHY settings array

The definition of array settings[] is quite lengthy meanwhile. Add a
macro to shrink the definition.

v2:
- Fix an indentation issue
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5fa7d3f9
...@@ -58,222 +58,65 @@ EXPORT_SYMBOL_GPL(phy_duplex_to_str); ...@@ -58,222 +58,65 @@ EXPORT_SYMBOL_GPL(phy_duplex_to_str);
/* A mapping of all SUPPORTED settings to speed/duplex. This table /* A mapping of all SUPPORTED settings to speed/duplex. This table
* must be grouped by speed and sorted in descending match priority * must be grouped by speed and sorted in descending match priority
* - iow, descending speed. */ * - iow, descending speed. */
#define PHY_SETTING(s, d, b) { .speed = SPEED_ ## s, .duplex = DUPLEX_ ## d, \
.bit = ETHTOOL_LINK_MODE_ ## b ## _BIT}
static const struct phy_setting settings[] = { static const struct phy_setting settings[] = {
/* 100G */ /* 100G */
{ PHY_SETTING( 100000, FULL, 100000baseCR4_Full ),
.speed = SPEED_100000, PHY_SETTING( 100000, FULL, 100000baseKR4_Full ),
.duplex = DUPLEX_FULL, PHY_SETTING( 100000, FULL, 100000baseLR4_ER4_Full ),
.bit = ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT, PHY_SETTING( 100000, FULL, 100000baseSR4_Full ),
},
{
.speed = SPEED_100000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT,
},
{
.speed = SPEED_100000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT,
},
{
.speed = SPEED_100000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT,
},
/* 56G */ /* 56G */
{ PHY_SETTING( 56000, FULL, 56000baseCR4_Full ),
.speed = SPEED_56000, PHY_SETTING( 56000, FULL, 56000baseKR4_Full ),
.duplex = DUPLEX_FULL, PHY_SETTING( 56000, FULL, 56000baseLR4_Full ),
.bit = ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT, PHY_SETTING( 56000, FULL, 56000baseSR4_Full ),
},
{
.speed = SPEED_56000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT,
},
{
.speed = SPEED_56000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT,
},
{
.speed = SPEED_56000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT,
},
/* 50G */ /* 50G */
{ PHY_SETTING( 50000, FULL, 50000baseCR2_Full ),
.speed = SPEED_50000, PHY_SETTING( 50000, FULL, 50000baseKR2_Full ),
.duplex = DUPLEX_FULL, PHY_SETTING( 50000, FULL, 50000baseSR2_Full ),
.bit = ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT,
},
{
.speed = SPEED_50000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT,
},
{
.speed = SPEED_50000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT,
},
/* 40G */ /* 40G */
{ PHY_SETTING( 40000, FULL, 40000baseCR4_Full ),
.speed = SPEED_40000, PHY_SETTING( 40000, FULL, 40000baseKR4_Full ),
.duplex = DUPLEX_FULL, PHY_SETTING( 40000, FULL, 40000baseLR4_Full ),
.bit = ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT, PHY_SETTING( 40000, FULL, 40000baseSR4_Full ),
},
{
.speed = SPEED_40000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT,
},
{
.speed = SPEED_40000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT,
},
{
.speed = SPEED_40000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT,
},
/* 25G */ /* 25G */
{ PHY_SETTING( 25000, FULL, 25000baseCR_Full ),
.speed = SPEED_25000, PHY_SETTING( 25000, FULL, 25000baseKR_Full ),
.duplex = DUPLEX_FULL, PHY_SETTING( 25000, FULL, 25000baseSR_Full ),
.bit = ETHTOOL_LINK_MODE_25000baseCR_Full_BIT,
},
{
.speed = SPEED_25000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_25000baseKR_Full_BIT,
},
{
.speed = SPEED_25000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_25000baseSR_Full_BIT,
},
/* 20G */ /* 20G */
{ PHY_SETTING( 20000, FULL, 20000baseKR2_Full ),
.speed = SPEED_20000, PHY_SETTING( 20000, FULL, 20000baseMLD2_Full ),
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT,
},
{
.speed = SPEED_20000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT,
},
/* 10G */ /* 10G */
{ PHY_SETTING( 10000, FULL, 10000baseCR_Full ),
.speed = SPEED_10000, PHY_SETTING( 10000, FULL, 10000baseER_Full ),
.duplex = DUPLEX_FULL, PHY_SETTING( 10000, FULL, 10000baseKR_Full ),
.bit = ETHTOOL_LINK_MODE_10000baseCR_Full_BIT, PHY_SETTING( 10000, FULL, 10000baseKX4_Full ),
}, PHY_SETTING( 10000, FULL, 10000baseLR_Full ),
{ PHY_SETTING( 10000, FULL, 10000baseLRM_Full ),
.speed = SPEED_10000, PHY_SETTING( 10000, FULL, 10000baseR_FEC ),
.duplex = DUPLEX_FULL, PHY_SETTING( 10000, FULL, 10000baseSR_Full ),
.bit = ETHTOOL_LINK_MODE_10000baseER_Full_BIT, PHY_SETTING( 10000, FULL, 10000baseT_Full ),
},
{
.speed = SPEED_10000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_10000baseKR_Full_BIT,
},
{
.speed = SPEED_10000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT,
},
{
.speed = SPEED_10000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_10000baseLR_Full_BIT,
},
{
.speed = SPEED_10000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT,
},
{
.speed = SPEED_10000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_10000baseR_FEC_BIT,
},
{
.speed = SPEED_10000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_10000baseSR_Full_BIT,
},
{
.speed = SPEED_10000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_10000baseT_Full_BIT,
},
/* 5G */ /* 5G */
{ PHY_SETTING( 5000, FULL, 5000baseT_Full ),
.speed = SPEED_5000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
},
/* 2.5G */ /* 2.5G */
{ PHY_SETTING( 2500, FULL, 2500baseT_Full ),
.speed = SPEED_2500, PHY_SETTING( 2500, FULL, 2500baseX_Full ),
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
},
{
.speed = SPEED_2500,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_2500baseX_Full_BIT,
},
/* 1G */ /* 1G */
{ PHY_SETTING( 1000, FULL, 1000baseKX_Full ),
.speed = SPEED_1000, PHY_SETTING( 1000, FULL, 1000baseT_Full ),
.duplex = DUPLEX_FULL, PHY_SETTING( 1000, HALF, 1000baseT_Half ),
.bit = ETHTOOL_LINK_MODE_1000baseKX_Full_BIT, PHY_SETTING( 1000, FULL, 1000baseX_Full ),
},
{
.speed = SPEED_1000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
},
{
.speed = SPEED_1000,
.duplex = DUPLEX_HALF,
.bit = ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
},
{
.speed = SPEED_1000,
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
},
/* 100M */ /* 100M */
{ PHY_SETTING( 100, FULL, 100baseT_Full ),
.speed = SPEED_100, PHY_SETTING( 100, HALF, 100baseT_Half ),
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_100baseT_Full_BIT,
},
{
.speed = SPEED_100,
.duplex = DUPLEX_HALF,
.bit = ETHTOOL_LINK_MODE_100baseT_Half_BIT,
},
/* 10M */ /* 10M */
{ PHY_SETTING( 10, FULL, 10baseT_Full ),
.speed = SPEED_10, PHY_SETTING( 10, HALF, 10baseT_Half ),
.duplex = DUPLEX_FULL,
.bit = ETHTOOL_LINK_MODE_10baseT_Full_BIT,
},
{
.speed = SPEED_10,
.duplex = DUPLEX_HALF,
.bit = ETHTOOL_LINK_MODE_10baseT_Half_BIT,
},
}; };
#undef PHY_SETTING
/** /**
* phy_lookup_setting - lookup a PHY setting * phy_lookup_setting - lookup a PHY setting
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment