Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 719655a1 authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller
Browse files

net: phy: Replace phy driver features u32 with link_mode bitmap



This is one step in allowing phylib to make use of link_mode bitmaps,
instead of u32 for supported and advertised features. Convert the phy
drivers to use bitmaps to indicates the features they support.

Build bitmap equivalents of the u32 values at runtime, and have the
drivers point to the appropriate bitmap. These bitmaps are shared, and
we don't want a driver to modify them. So mark them __ro_after_init.

Within phylib, the features bitmap is currently turned back into a
u32. This will be removed once the whole of phylib, and the drivers
are converted to use bitmaps.

Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d0939c26
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -988,8 +988,8 @@ static int pxa168_init_phy(struct net_device *dev)
	cmd.base.phy_address = pep->phy_addr;
	cmd.base.speed = pep->phy_speed;
	cmd.base.duplex = pep->phy_duplex;
	ethtool_convert_legacy_u32_to_link_mode(cmd.link_modes.advertising,
						PHY_BASIC_FEATURES);
	bitmap_copy(cmd.link_modes.advertising, PHY_BASIC_FEATURES,
		    __ETHTOOL_LINK_MODE_MASK_NBITS);
	cmd.base.autoneg = AUTONEG_ENABLE;

	if (cmd.base.speed != 0)
+6 −6
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ static struct phy_driver aquantia_driver[] = {
	.phy_id		= PHY_ID_AQ1202,
	.phy_id_mask	= 0xfffffff0,
	.name		= "Aquantia AQ1202",
	.features	= PHY_AQUANTIA_FEATURES,
	.features	= PHY_10GBIT_FULL_FEATURES,
	.flags		= PHY_HAS_INTERRUPT,
	.aneg_done	= genphy_c45_aneg_done,
	.config_aneg    = aquantia_config_aneg,
@@ -127,7 +127,7 @@ static struct phy_driver aquantia_driver[] = {
	.phy_id		= PHY_ID_AQ2104,
	.phy_id_mask	= 0xfffffff0,
	.name		= "Aquantia AQ2104",
	.features	= PHY_AQUANTIA_FEATURES,
	.features	= PHY_10GBIT_FULL_FEATURES,
	.flags		= PHY_HAS_INTERRUPT,
	.aneg_done	= genphy_c45_aneg_done,
	.config_aneg    = aquantia_config_aneg,
@@ -139,7 +139,7 @@ static struct phy_driver aquantia_driver[] = {
	.phy_id		= PHY_ID_AQR105,
	.phy_id_mask	= 0xfffffff0,
	.name		= "Aquantia AQR105",
	.features	= PHY_AQUANTIA_FEATURES,
	.features	= PHY_10GBIT_FULL_FEATURES,
	.flags		= PHY_HAS_INTERRUPT,
	.aneg_done	= genphy_c45_aneg_done,
	.config_aneg    = aquantia_config_aneg,
@@ -151,7 +151,7 @@ static struct phy_driver aquantia_driver[] = {
	.phy_id		= PHY_ID_AQR106,
	.phy_id_mask	= 0xfffffff0,
	.name		= "Aquantia AQR106",
	.features	= PHY_AQUANTIA_FEATURES,
	.features	= PHY_10GBIT_FULL_FEATURES,
	.flags		= PHY_HAS_INTERRUPT,
	.aneg_done	= genphy_c45_aneg_done,
	.config_aneg    = aquantia_config_aneg,
@@ -163,7 +163,7 @@ static struct phy_driver aquantia_driver[] = {
	.phy_id		= PHY_ID_AQR107,
	.phy_id_mask	= 0xfffffff0,
	.name		= "Aquantia AQR107",
	.features	= PHY_AQUANTIA_FEATURES,
	.features	= PHY_10GBIT_FULL_FEATURES,
	.flags		= PHY_HAS_INTERRUPT,
	.aneg_done	= genphy_c45_aneg_done,
	.config_aneg    = aquantia_config_aneg,
@@ -175,7 +175,7 @@ static struct phy_driver aquantia_driver[] = {
	.phy_id		= PHY_ID_AQR405,
	.phy_id_mask	= 0xfffffff0,
	.name		= "Aquantia AQR405",
	.features	= PHY_AQUANTIA_FEATURES,
	.features	= PHY_10GBIT_FULL_FEATURES,
	.flags		= PHY_HAS_INTERRUPT,
	.aneg_done	= genphy_c45_aneg_done,
	.config_aneg    = aquantia_config_aneg,
+5 −4
Original line number Diff line number Diff line
@@ -42,6 +42,9 @@ static int bcm63xx_config_init(struct phy_device *phydev)
{
	int reg, err;

	/* ASYM_PAUSE bit is marked RO in datasheet, so don't cheat */
	phydev->supported |= SUPPORTED_Pause;

	reg = phy_read(phydev, MII_BCM63XX_IR);
	if (reg < 0)
		return reg;
@@ -65,8 +68,7 @@ static struct phy_driver bcm63xx_driver[] = {
	.phy_id		= 0x00406000,
	.phy_id_mask	= 0xfffffc00,
	.name		= "Broadcom BCM63XX (1)",
	/* ASYM_PAUSE bit is marked RO in datasheet, so don't cheat */
	.features	= (PHY_BASIC_FEATURES | SUPPORTED_Pause),
	.features	= PHY_BASIC_FEATURES,
	.flags		= PHY_HAS_INTERRUPT | PHY_IS_INTERNAL,
	.config_init	= bcm63xx_config_init,
	.ack_interrupt	= bcm_phy_ack_intr,
@@ -75,8 +77,7 @@ static struct phy_driver bcm63xx_driver[] = {
	/* same phy as above, with just a different OUI */
	.phy_id		= 0x002bdc00,
	.phy_id_mask	= 0xfffffc00,
	.name		= "Broadcom BCM63XX (2)",
	.features	= (PHY_BASIC_FEATURES | SUPPORTED_Pause),
	.features	= PHY_BASIC_FEATURES,
	.flags		= PHY_HAS_INTERRUPT | PHY_IS_INTERNAL,
	.config_init	= bcm63xx_config_init,
	.ack_interrupt	= bcm_phy_ack_intr,
+1 −1
Original line number Diff line number Diff line
@@ -2201,7 +2201,7 @@ static struct phy_driver marvell_drivers[] = {
		.phy_id = MARVELL_PHY_ID_88E1510,
		.phy_id_mask = MARVELL_PHY_ID_MASK,
		.name = "Marvell 88E1510",
		.features = PHY_GBIT_FEATURES | SUPPORTED_FIBRE,
		.features = PHY_GBIT_FIBRE_FEATURES,
		.flags = PHY_HAS_INTERRUPT,
		.probe = &m88e1510_probe,
		.config_init = &m88e1510_config_init,
+1 −10
Original line number Diff line number Diff line
@@ -535,16 +535,7 @@ static struct phy_driver mv3310_drivers[] = {
		.phy_id		= 0x002b09aa,
		.phy_id_mask	= MARVELL_PHY_ID_MASK,
		.name		= "mv88x3310",
		.features	= SUPPORTED_10baseT_Full |
				  SUPPORTED_10baseT_Half |
				  SUPPORTED_100baseT_Full |
				  SUPPORTED_100baseT_Half |
				  SUPPORTED_1000baseT_Full |
				  SUPPORTED_Autoneg |
				  SUPPORTED_TP |
				  SUPPORTED_FIBRE |
				  SUPPORTED_10000baseT_Full |
				  SUPPORTED_Backplane,
		.features	= PHY_10GBIT_FEATURES,
		.soft_reset	= gen10g_no_soft_reset,
		.config_init	= mv3310_config_init,
		.probe		= mv3310_probe,
Loading