net: phy: bcm5481x: add support for BroadR-Reach mode
Subsystems (5)
v2 cover net: phy: bcm5481x: add support for BroadR-Reach mode
PATCH 1 - Add the 1BR10 link mode and capability to switch to
BroadR-Reach as a PHY tunable value
PATCH 2 - Add the definitions of LRE registers, necessary to use
BroadR-Reach modes on the BCM5481x PHY
PATCH 3 - Implementation of the BroadR-Reach modes for the Broadcom
PHYs
Changes in v2:
- Divided into multiple patches, removed useless link modes
Kamil Horák - 2N (3):
net: phy: bcm54811: New link mode for BroadR-Reach
net: phy: bcm54811: Add LRE registers definitions
net: phy: bcm-phy-lib: Implement BroadR-Reach link modes
drivers/net/phy/bcm-phy-lib.c | 122 ++++++++++++ drivers/net/phy/bcm-phy-lib.h | 4 + drivers/net/phy/broadcom.c | 336 ++++++++++++++++++++++++++++++++-- drivers/net/phy/phy-core.c | 9 +- include/linux/brcmphy.h | 91 ++++++++- include/uapi/linux/ethtool.h | 9 +- net/ethtool/common.c | 7 + net/ethtool/ioctl.c | 1 + 8 files changed, 559 insertions(+), 20 deletions(-)
Signature · 1 line
2.39.2
PATCH v2 1/3 net: phy: bcm54811: New link mode for BroadR-Reach
Introduce new link modes necessary for the BroadR-Reach mode on bcm5481x PHY by Broadcom and new PHY tunable to choose between normal (IEEE) ethernet and BroadR-Reach modes of the PHY.
--- drivers/net/phy/phy-core.c | 9 +++++---- include/uapi/linux/ethtool.h | 9 ++++++++- net/ethtool/common.c | 7 +++++++ net/ethtool/ioctl.c | 1 + 4 files changed, 21 insertions(+), 5 deletions(-)
drivers/net/phy/phy-core.c +5 -4
@@ -13,10 +13,9 @@*/ const char *phy_speed_to_str (int speed) { -BUILD_BUG_ON_MSG (__ETHTOOL_LINK_MODE_MASK_NBITS !=102 , -"Enum ethtool_link_mode_bit_indices and phylib are out of sync. " -"If a speed or mode has been added please update phy_speed_to_str " -"and the PHY settings array.\n" ); +BUILD_BUG_ON_MSG (__ETHTOOL_LINK_MODE_MASK_NBITS !=103 , +"Enum ethtool_link_mode_bit_indices and phylib are out of sync. If a speed or mode has been added please update phy_speed_to_str and the PHY settings array.\n" + );switch (speed) {case SPEED_10 :
@@ -265,6 +264,8 @@ static const struct phy_setting settings[] = { PHY_SETTING( 10, FULL, 10baseT1S_Full ), PHY_SETTING( 10, HALF, 10baseT1S_Half ), PHY_SETTING( 10, HALF, 10baseT1S_P2MP_Half ), + PHY_SETTING( 10, FULL, 1BR10 ), + };#undef PHY_SETTING
include/uapi/linux/ethtool.h +8 -1
@@ -289,11 +289,18 @@ struct ethtool_tunable {#define ETHTOOL_PHY_EDPD_NO_TX 0xfffe#define ETHTOOL_PHY_EDPD_DISABLE 0 +/* +* BroadR-Reach Mode Control +*/ +#define ETHTOOL_PHY_BRR_MODE_ON 1 +#define ETHTOOL_PHY_BRR_MODE_OFF 0 +enum phy_tunable_id {ETHTOOL_PHY_ID_UNSPEC ,ETHTOOL_PHY_DOWNSHIFT ,ETHTOOL_PHY_FAST_LINK_DOWN ,ETHTOOL_PHY_EDPD , +ETHTOOL_PHY_BRR_MODE ,/* * Add your fresh new phy tunable attribute above and remember to update * phy_tunable_strings[] in net/ethtool/common.c
@@ -1845,7 +1852,7 @@ enum ethtool_link_mode_bit_indices { ETHTOOL_LINK_MODE_10baseT1S_Full_BIT =99 , ETHTOOL_LINK_MODE_10baseT1S_Half_BIT =100 , ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT =101 , - +ETHTOOL_LINK_MODE_1BR10_BIT =102 ,/* must be last entry */ __ETHTOOL_LINK_MODE_MASK_NBITS };
net/ethtool/common.c +7 -0
@@ -98,6 +98,7 @@ phy_tunable_strings[__ETHTOOL_PHY_TUNABLE_COUNT][ETH_GSTRING_LEN] = { [ETHTOOL_PHY_DOWNSHIFT] = "phy-downshift", [ETHTOOL_PHY_FAST_LINK_DOWN] = "phy-fast-link-down", [ETHTOOL_PHY_EDPD] = "phy-energy-detect-power-down", + [ETHTOOL_PHY_BRR_MODE] = "phy-broadrreach-mode", };#define __LINK_MODE_NAME (speed, type, duplex) \
@@ -211,6 +212,7 @@ const char link_mode_names[][ETH_GSTRING_LEN] = {__DEFINE_LINK_MODE_NAME (10 ,T1S , Full),__DEFINE_LINK_MODE_NAME (10 ,T1S , Half),__DEFINE_LINK_MODE_NAME (10 ,T1S_P2MP , Half), + __DEFINE_SPECIAL_MODE_NAME(1BR10, "1BR10"), };static_assert (ARRAY_SIZE (link_mode_names) == __ETHTOOL_LINK_MODE_MASK_NBITS);
@@ -374,6 +376,11 @@ const struct link_mode_info link_mode_params[] = {__DEFINE_LINK_MODE_PARAMS (10 ,T1S , Full),__DEFINE_LINK_MODE_PARAMS (10 ,T1S , Half), __DEFINE_LINK_MODE_PARAMS(10, T1S_P2MP, Half), + [ETHTOOL_LINK_MODE_1BR10_BIT] = { + .speed =SPEED_10 , + .lanes = 1, + .duplex = DUPLEX_FULL, + }, };static_assert (ARRAY_SIZE (link_mode_params) == __ETHTOOL_LINK_MODE_MASK_NBITS);
net/ethtool/ioctl.c +1 -0
@@ -2722,6 +2722,7 @@ static int ethtool_phy_tunable_valid(const struct ethtool_tunable *tuna)switch (tuna->id) {case ETHTOOL_PHY_DOWNSHIFT :case ETHTOOL_PHY_FAST_LINK_DOWN : +case ETHTOOL_PHY_BRR_MODE :if (tuna->len !=sizeof (u8) || tuna->type_id !=ETHTOOL_TUNABLE_U8 )return -EINVAL ;
Signature · 1 line
2.39.2
PATCH v2 2/3 net: phy: bcm54811: Add LRE registers definitions
In reply to Kamil Horák - 2NAdd the definitions of LRE registers for Broadcom BCM5481x PHY
--- include/linux/brcmphy.h | 91 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-)
include/linux/brcmphy.h +90 -1
@@ -270,16 +270,105 @@#define BCM5482_SSD_SGMII_SLAVE 0x15/* SGMII Slave Register */ #define BCM5482_SSD_SGMII_SLAVE_EN 0x0002/* Slave mode enable */ #define BCM5482_SSD_SGMII_SLAVE_AD 0x0001/* Slave auto-detection */ +#define BCM5482_SSD_SGMII_SLAVE_AD 0x0001/* Slave auto-detection */ + +/* BroadR-Reach LRE Registers. */ +#define MII_BCM54XX_LRECR 0x00/* LRE Control Register */ +#define MII_BCM54XX_LRESR 0x01/* LRE Status Register */ +#define MII_BCM54XX_LREPHYSID1 0x02/* LRE PHYS ID 1 */ +#define MII_BCM54XX_LREPHYSID2 0x03/* LRE PHYS ID 2 */ +#define MII_BCM54XX_LREANAA 0x04/* LDS Auto-Negotiation Advertised Ability */ +#define MII_BCM54XX_LREANAC 0x05/* LDS Auto-Negotiation Advertised Control */ +#define MII_BCM54XX_LREANPT 0x06/* LDS Ability Next Page Transmit */ +#define MII_BCM54XX_LRELPA 0x07/* LDS Link Partner Ability */ +#define MII_BCM54XX_LRELPNPM 0x08/* LDS Link Partner Next Page Message */ +#define MII_BCM54XX_LRELPNPC 0x09/* LDS Link Partner Next Page Control */ +#define MII_BCM54XX_LRELDSE 0x0a/* LDS Expansion Register */ +#define MII_BCM54XX_LREES 0x0f/* LRE Extended Status */ + +/* LRE control register. */ +#define LRECR_RESET 0x8000/* Reset to default state */ +#define LRECR_LOOPBACK 0x4000/* Internal Loopback */ +#define LRECR_LDSRES 0x2000/* Restart LDS Process */ +#define LRECR_LDSEN 0x1000/* LDS Enable */ +#define LRECR_PDOWN 0x0800/* Enable low power state */ +#define LRECR_ISOLATE 0x0400/* Isolate data paths from MII */ +#define LRECR_SPEED100 0x0200/* Select 100 Mbps */ +#define LRECR_SPEED10 0x0000/* Select 10 Mbps */ +#define LRECR_4PAIRS 0x0020/* Select 4 Pairs */ +#define LRECR_2PAIRS 0x0010/* Select 2 Pairs */ +#define LRECR_1PAIR 0x0000/* Select 1 Pair */ +#define LRECR_MASTER 0x0008/* Force Master when LDS disabled */ +#define LRECR_SLAVE 0x0000/* Force Slave when LDS disabled */ + +/* LRE status register. */ +#define LRESR_ERCAP 0x0001/* Ext-reg capability */ +#define LRESR_JCD 0x0002/* Jabber detected */ +#define LRESR_LSTATUS 0x0004/* Link status */ +#define LRESR_LDSABILITY 0x0008/* Can do LDS */ +#define LRESR_8023 0x0010/* Has IEEE 802.3 Support */ +#define LRESR_LDSCOMPLETE 0x0020/* LDS Auto-negotiation complete */ +#define LRESR_MFPS 0x0040/* Can suppress Management Frames Preamble */ +#define LRESR_RESV 0x0080/* Unused... */ +#define LRESR_ESTATEN 0x0100/* Extended Status in R15 */ +#define LRESR_10_1PAIR 0x0200/* Can do 10Mbps 1 Pair */ +#define LRESR_10_2PAIR 0x0400/* Can do 10Mbps 2 Pairs */ +#define LRESR_100_2PAIR 0x0800/* Can do 100Mbps 2 Pairs */ +#define LRESR_100_4PAIR 0x1000/* Can do 100Mbps 4 Pairs */ +#define LRESR_100_1PAIR 0x2000/* Can do 100Mbps 1 Pair */ + +/* LDS Auto-Negotiation Advertised Ability. */ +#define LREANAA_PAUSE_ASYM 0x8000/* Can pause asymmetrically */ +#define LREANAA_PAUSE 0x4000/* Can pause */ +#define LREANAA_100_1PAIR 0x0020/* Can do 100Mbps 1 Pair */ +#define LREANAA_100_4PAIR 0x0010/* Can do 100Mbps 4 Pair */ +#define LREANAA_100_2PAIR 0x0008/* Can do 100Mbps 2 Pair */ +#define LREANAA_10_2PAIR 0x0004/* Can do 10Mbps 2 Pair */ +#define LREANAA_10_1PAIR 0x0002/* Can do 10Mbps 1 Pair */ + +#define LRE_ADVERTISE_FULL (LREANAA_100_1PAIR | LREANAA_100_4PAIR | \ + LREANAA_100_2PAIR | LREANAA_10_2PAIR | \ + LREANAA_10_1PAIR) + +#define LRE_ADVERTISE_ALL LRE_ADVERTISE_FULL + +/* LDS Link Partner Ability. */ +#define LRELPA_PAUSE_ASYM 0x8000/* Supports asymmetric pause */ +#define LRELPA_PAUSE 0x4000/* Supports pause capability */ +#define LRELPA_100_1PAIR 0x0020/* 100Mbps 1 Pair capable */ +#define LRELPA_100_4PAIR 0x0010/* 100Mbps 4 Pair capable */ +#define LRELPA_100_2PAIR 0x0008/* 100Mbps 2 Pair capable */ +#define LRELPA_10_2PAIR 0x0004/* 10Mbps 2 Pair capable */ +#define LRELPA_10_1PAIR 0x0002/* 10Mbps 1 Pair capable */ + +/* LDS Expansion register. */ +#define LDSE_DOWNGRADE 0x8000/* Can do LDS Speed Downgrade */ +#define LDSE_MASTER 0x4000/* Master / Slave */ +#define LDSE_PAIRS_MASK 0x3000/* Pair Count Mask */ +#define LDSE_4PAIRS 0x2000/* 4 Pairs Connection */ +#define LDSE_2PAIRS 0x1000/* 2 Pairs Connection */ +#define LDSE_1PAIR 0x0000/* 1 Pair Connection */ +#define LDSE_CABLEN_MASK 0x0FFF/* Cable Length Mask */ /* BCM54810 Registers */ #define BCM54810_EXP_BROADREACH_LRE_MISC_CTL (MII_BCM54XX_EXP_SEL_ER + 0x90)#define BCM54810_EXP_BROADREACH_LRE_MISC_CTL_EN (1 << 0)#define BCM54810_SHD_CLK_CTL 0x3#define BCM54810_SHD_CLK_CTL_GTXCLK_EN (1 << 9) +#define BCM54810_SHD_SCR3_TRDDAPD 0x0100 + +/* BCM54811 Registers */ +#define BCM54811_EXP_BROADREACH_LRE_OVERLAY_CTL (MII_BCM54XX_EXP_SEL_ER + 0x9A) +/* Access Control Override Enable */ +#define BCM54811_EXP_BROADREACH_LRE_OVERLAY_CTL_EN BIT(15) +/* Access Control Override Value */ +#define BCM54811_EXP_BROADREACH_LRE_OVERLAY_CTL_OVERRIDE_VAL BIT(14) +/* Access Control Value */ +#define BCM54811_EXP_BROADREACH_LRE_OVERLAY_CTL_VAL BIT(13)/* BCM54612E Registers */ #define BCM54612E_EXP_SPARE0 (MII_BCM54XX_EXP_SEL_ETC + 0x34) -#define BCM54612E_LED4_CLK125OUT_EN (1 << 1) +#define BCM54612E_LED4_CLK125OUT_EN BIT(1)/* Wake-on-LAN registers */
Signature · 1 line
2.39.2
PATCH v2 3/3 net: phy: bcm-phy-lib: Implement BroadR-Reach link modes
In reply to Kamil Horák - 2NImplement single-pair BroadR-Reach modes on bcm5481x PHY by Broadcom. Create set of functions alternative to IEEE 802.3 to handle configuration of these modes on compatible Broadcom PHYs.
--- drivers/net/phy/bcm-phy-lib.c | 122 ++++++++++++ drivers/net/phy/bcm-phy-lib.h | 4 + drivers/net/phy/broadcom.c | 336 ++++++++++++++++++++++++++++++++-- 3 files changed, 448 insertions(+), 14 deletions(-)
drivers/net/phy/bcm-phy-lib.c +122 -0
@@ -794,6 +794,46 @@ static int _bcm_phy_cable_test_get_status(struct phy_device *phydev,return ret; } +static int bcm_setup_forced (struct phy_device *phydev) +{ +u16 ctl =0 ; + + phydev->pause =0 ; + phydev->asym_pause =0 ; + +if (phydev->speed ==SPEED_100 ) + ctl |=LRECR_SPEED100 ; + +if (phydev->duplex !=DUPLEX_FULL ) +return -EOPNOTSUPP ; + +return phy_modify (phydev,MII_BCM54XX_LRECR ,LRECR_SPEED100 , ctl); +} + +/** +* bcm_linkmode_adv_to_mii_adv_t +* @advertising: the linkmode advertisement settings +* +* A small helper function that translates linkmode advertisement +* settings to phy autonegotiation advertisements for the +* MII_BCM54XX_LREANAA register. +*/ +static inline u32 bcm_linkmode_adv_to_mii_adv_t (unsigned long *advertising) +{ +u32 result =0 ; + +if (linkmode_test_bit (ETHTOOL_LINK_MODE_1BR10_BIT , advertising)) + result |=LREANAA_10_1PAIR ; +if (linkmode_test_bit (ETHTOOL_LINK_MODE_100baseT1_Full_BIT, advertising)) + result |=LREANAA_100_1PAIR ; +if (linkmode_test_bit (ETHTOOL_LINK_MODE_Pause_BIT, advertising)) + result |=LRELPA_PAUSE ; +if (linkmode_test_bit (ETHTOOL_LINK_MODE_Asym_Pause_BIT, advertising)) + result |=LRELPA_PAUSE_ASYM ; + +return result; +} +int bcm_phy_cable_test_start (struct phy_device *phydev) {return _bcm_phy_cable_test_start (phydev, false);
@@ -1066,6 +1106,88 @@ int bcm_phy_led_brightness_set(struct phy_device *phydev, }EXPORT_SYMBOL_GPL (bcm_phy_led_brightness_set); +int bcm_setup_master_slave (struct phy_device *phydev) +{ +u16 ctl =0 ; + +switch (phydev->master_slave_set) { +case MASTER_SLAVE_CFG_MASTER_PREFERRED : +case MASTER_SLAVE_CFG_MASTER_FORCE : + ctl =LRECR_MASTER ; +break ; +case MASTER_SLAVE_CFG_SLAVE_PREFERRED : +case MASTER_SLAVE_CFG_SLAVE_FORCE : +break ; +case MASTER_SLAVE_CFG_UNKNOWN : +case MASTER_SLAVE_CFG_UNSUPPORTED : +return 0 ; +default : +phydev_warn (phydev,"Unsupported Master/Slave mode\n" ); +return -EOPNOTSUPP ; + } + +return phy_modify_changed (phydev,MII_BCM54XX_LRECR ,LRECR_MASTER , ctl); +} +EXPORT_SYMBOL_GPL (bcm_setup_master_slave); + +int bcm_config_aneg (struct phy_device *phydev,bool changed) +{ +int err; + +if (genphy_config_eee_advert (phydev)) + changed = true; + + err =bcm_setup_master_slave (phydev); +if (err <0 ) +return err; +else if (err) + changed = true; + +if (phydev->autoneg !=AUTONEG_ENABLE ) +return bcm_setup_forced (phydev); + + err =bcm_config_advert (phydev); +if (err <0 )/* error */ +return err; +else if (err) + changed = true; + +return genphy_check_and_restart_aneg (phydev, changed); +} +EXPORT_SYMBOL_GPL (bcm_config_aneg); + +/** +* bcm_config_advert - sanitize and advertise auto-negotiation parameters +* @phydev: target phy_device struct +* +* Description: Writes MII_BCM54XX_LREANAA with the appropriate values, +* after sanitizing the values to make sure we only advertise +* what is supported. Returns < 0 on error, 0 if the PHY's advertisement +* hasn't changed, and > 0 if it has changed. +*/ +int bcm_config_advert (struct phy_device *phydev) +{ +int err; +u32 adv; + +/* Only allow advertising what this PHY supports */ +linkmode_and (phydev->advertising, phydev->advertising, + phydev->supported); + + adv =bcm_linkmode_adv_to_mii_adv_t (phydev->advertising); + +/* Setup BroadR-Reach mode advertisement */ + err =phy_modify_changed (phydev,MII_BCM54XX_LREANAA , +LRE_ADVERTISE_ALL |LREANAA_PAUSE | +LREANAA_PAUSE_ASYM , adv); + +if (err <0 ) +return err; + +return err >0 ?1 :0 ; +} +EXPORT_SYMBOL_GPL (bcm_config_advert); +MODULE_DESCRIPTION ("Broadcom PHY Library" );MODULE_LICENSE ("GPL v2" );MODULE_AUTHOR ("Broadcom Corporation" );
drivers/net/phy/bcm-phy-lib.h +4 -0
@@ -121,4 +121,8 @@ irqreturn_t bcm_phy_wol_isr(int irq, void *dev_id);int bcm_phy_led_brightness_set (struct phy_device *phydev,u8 index,enum led_brightness value); +int bcm_setup_master_slave (struct phy_device *phydev); +int bcm_config_aneg (struct phy_device *phydev,bool changed); +int bcm_config_advert (struct phy_device *phydev); +#endif /* _LINUX_BCM_PHY_LIB_H */
drivers/net/phy/broadcom.c +322 -14
379 lines not on this page · raw message
Signature · 1 line
2.39.2
kernel test robot
build botRe: [PATCH v2 3/3] net: phy: bcm-phy-lib: Implement BroadR-Reach link modes
kernel test robot noticed the following build warnings:
Hi Kamil,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net/main]
[also build test WARNING on net-next/main linus/master v6.9-rc6 next-20240503] [cannot apply to horms-ipvs/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Kamil-Hor-k-2N/net-phy-bcm54811-New-link-mode-for-BroadR-Reach/20240503-164308 base: net/main patch link: https://lore.kernel.org/r/20240503083719.899312-4-kamilh%40axis.com patch subject: [PATCH v2 3/3] net: phy: bcm-phy-lib: Implement BroadR-Reach link modes config: powerpc-randconfig-r081-20240504 (https://download.01.org/0day-ci/archive/20240504/[email protected]/config) compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 37ae4ad0eef338776c7e2cffb3896153d43dcd90) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240504/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from drivers/net/phy/broadcom.c:13:
In file included from drivers/net/phy/bcm-phy-lib.h:9:
In file included from include/linux/brcmphy.h:5:
In file included from include/linux/phy.h:16:
In file included from include/linux/ethtool.h:18:
In file included from include/linux/if_ether.h:19:
In file included from include/linux/skbuff.h:17:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:8:
In file included from include/linux/cacheflush.h:5:
In file included from arch/powerpc/include/asm/cacheflush.h:7:
In file included from include/linux/mm.h:2210:
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> drivers/net/phy/broadcom.c:619:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
619 | if (of_property_read_bool(np, "enet-phy-lane-swap")) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/phy/broadcom.c:627:9: note: uninitialized use occurs here
627 | return ret;
| ^~~
drivers/net/phy/broadcom.c:619:2: note: remove the 'if' if its condition is always true
619 | if (of_property_read_bool(np, "enet-phy-lane-swap")) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/phy/broadcom.c:614:9: note: initialize the variable 'ret' to silence this warning
614 | int ret;
| ^
| = 02 warnings generated.
vim +619 drivers/net/phy/broadcom.c
b0ed0bbfb3046e Kevin Lo 2020-05-16 610f1e9c8e593d6ea Kamil Horák - 2N 2024-05-03 611 static int bcm5481x_config_delay_swap(struct phy_device *phydev)
57bb7e222804c6 Anton Vorontsov 2008-03-04 612 {
b14995ac2527b4 Jon Mason 2016-11-04 613 struct device_node *np = phydev->mdio.dev.of_node;
57bb7e222804c6 Anton Vorontsov 2008-03-04 614 int ret;
57bb7e222804c6 Anton Vorontsov 2008-03-04 615
f1e9c8e593d6ea Kamil Horák - 2N 2024-05-03 616 /* Set up the delay. */
042cb56478152b Tao Ren 2018-11-05 617 bcm54xx_config_clock_delay(phydev);
57bb7e222804c6 Anton Vorontsov 2008-03-04 618
b14995ac2527b4 Jon Mason 2016-11-04 @619 if (of_property_read_bool(np, "enet-phy-lane-swap")) {
b14995ac2527b4 Jon Mason 2016-11-04 620 /* Lane Swap - Undocumented register...magic! */
b14995ac2527b4 Jon Mason 2016-11-04 621 ret = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_SEL_ER + 0x9,
b14995ac2527b4 Jon Mason 2016-11-04 622 0x11B);
b14995ac2527b4 Jon Mason 2016-11-04 623 if (ret < 0)
b14995ac2527b4 Jon Mason 2016-11-04 624 return ret;
b14995ac2527b4 Jon Mason 2016-11-04 625 }
b14995ac2527b4 Jon Mason 2016-11-04 626
57bb7e222804c6 Anton Vorontsov 2008-03-04 627 return ret;
57bb7e222804c6 Anton Vorontsov 2008-03-04 628 }
57bb7e222804c6 Anton Vorontsov 2008-03-04 629 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH v2 3/3] net: phy: bcm-phy-lib: Implement BroadR-Reach link modes
In reply to Kamil Horák - 2NHi Kamil,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Kamil-Hor-k-2N/net-phy-bcm54811-New-link-mode-for-BroadR-Reach/20240503-164308 base: net/main patch link: https://lore.kernel.org/r/20240503083719.899312-4-kamilh%40axis.com patch subject: [PATCH v2 3/3] net: phy: bcm-phy-lib: Implement BroadR-Reach link modes config: i386-randconfig-141-20240504 (https://download.01.org/0day-ci/archive/20240504/[email protected]/config) compiler: clang version 18.1.4 (https://github.com/llvm/llvm-project e6c3289804a67ea0bb6a86fadbe454dd93b8d855)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:drivers/net/phy/broadcom.c:627 bcm5481x_config_delay_swap() error: uninitialized symbol 'ret'. drivers/net/phy/broadcom.c:1249 bcm_read_master_slave() error: uninitialized symbol 'cfg'.
vim +/ret +627 drivers/net/phy/broadcom.c
f1e9c8e593d6ea Kamil Horák - 2N 2024-05-03 611 static int bcm5481x_config_delay_swap(struct phy_device *phydev)
57bb7e222804c6 Anton Vorontsov 2008-03-04 612 {
b14995ac2527b4 Jon Mason 2016-11-04 613 struct device_node *np = phydev->mdio.dev.of_node;
57bb7e222804c6 Anton Vorontsov 2008-03-04 614 int ret;
57bb7e222804c6 Anton Vorontsov 2008-03-04 615
f1e9c8e593d6ea Kamil Horák - 2N 2024-05-03 616 /* Set up the delay. */
042cb56478152b Tao Ren 2018-11-05 617 bcm54xx_config_clock_delay(phydev);
57bb7e222804c6 Anton Vorontsov 2008-03-04 618
b14995ac2527b4 Jon Mason 2016-11-04 619 if (of_property_read_bool(np, "enet-phy-lane-swap")) {
b14995ac2527b4 Jon Mason 2016-11-04 620 /* Lane Swap - Undocumented register...magic! */
b14995ac2527b4 Jon Mason 2016-11-04 621 ret = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_SEL_ER + 0x9,
b14995ac2527b4 Jon Mason 2016-11-04 622 0x11B);
b14995ac2527b4 Jon Mason 2016-11-04 623 if (ret < 0)
b14995ac2527b4 Jon Mason 2016-11-04 624 return ret;
b14995ac2527b4 Jon Mason 2016-11-04 625 }"ret" not initialized on else path.
b14995ac2527b4 Jon Mason 2016-11-04 62657bb7e222804c6 Anton Vorontsov 2008-03-04 @627 return ret;
Also "return 0;" is always better.
57bb7e222804c6 Anton Vorontsov 2008-03-04 628 }
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki