@@ -10117,15 +10117,20 @@ static int bnx2x_84858_cmd_hdlr(struct bnx2x_phy *phy,
1011710117
1011810118static int bnx2x_84833_cmd_hdlr (struct bnx2x_phy * phy ,
1011910119 struct link_params * params , u16 fw_cmd ,
10120- u16 cmd_args [], int argc )
10120+ u16 cmd_args [], int argc , int process )
1012110121{
1012210122 int idx ;
1012310123 u16 val ;
1012410124 struct bnx2x * bp = params -> bp ;
10125- /* Write CMD_OPEN_OVERRIDE to STATUS reg */
10126- bnx2x_cl45_write (bp , phy , MDIO_CTL_DEVAD ,
10127- MDIO_848xx_CMD_HDLR_STATUS ,
10128- PHY84833_STATUS_CMD_OPEN_OVERRIDE );
10125+ int rc = 0 ;
10126+
10127+ if (process == PHY84833_MB_PROCESS2 ) {
10128+ /* Write CMD_OPEN_OVERRIDE to STATUS reg */
10129+ bnx2x_cl45_write (bp , phy , MDIO_CTL_DEVAD ,
10130+ MDIO_848xx_CMD_HDLR_STATUS ,
10131+ PHY84833_STATUS_CMD_OPEN_OVERRIDE );
10132+ }
10133+
1012910134 for (idx = 0 ; idx < PHY848xx_CMDHDLR_WAIT ; idx ++ ) {
1013010135 bnx2x_cl45_read (bp , phy , MDIO_CTL_DEVAD ,
1013110136 MDIO_848xx_CMD_HDLR_STATUS , & val );
@@ -10135,15 +10140,27 @@ static int bnx2x_84833_cmd_hdlr(struct bnx2x_phy *phy,
1013510140 }
1013610141 if (idx >= PHY848xx_CMDHDLR_WAIT ) {
1013710142 DP (NETIF_MSG_LINK , "FW cmd: FW not ready.\n" );
10143+ /* if the status is CMD_COMPLETE_PASS or CMD_COMPLETE_ERROR
10144+ * clear the status to CMD_CLEAR_COMPLETE
10145+ */
10146+ if (val == PHY84833_STATUS_CMD_COMPLETE_PASS ||
10147+ val == PHY84833_STATUS_CMD_COMPLETE_ERROR ) {
10148+ bnx2x_cl45_write (bp , phy , MDIO_CTL_DEVAD ,
10149+ MDIO_848xx_CMD_HDLR_STATUS ,
10150+ PHY84833_STATUS_CMD_CLEAR_COMPLETE );
10151+ }
1013810152 return - EINVAL ;
1013910153 }
10140-
10141- /* Prepare argument(s) and issue command */
10142- for (idx = 0 ; idx < argc ; idx ++ ) {
10143- bnx2x_cl45_write (bp , phy , MDIO_CTL_DEVAD ,
10144- MDIO_848xx_CMD_HDLR_DATA1 + idx ,
10145- cmd_args [idx ]);
10154+ if (process == PHY84833_MB_PROCESS1 ||
10155+ process == PHY84833_MB_PROCESS2 ) {
10156+ /* Prepare argument(s) */
10157+ for (idx = 0 ; idx < argc ; idx ++ ) {
10158+ bnx2x_cl45_write (bp , phy , MDIO_CTL_DEVAD ,
10159+ MDIO_848xx_CMD_HDLR_DATA1 + idx ,
10160+ cmd_args [idx ]);
10161+ }
1014610162 }
10163+
1014710164 bnx2x_cl45_write (bp , phy , MDIO_CTL_DEVAD ,
1014810165 MDIO_848xx_CMD_HDLR_COMMAND , fw_cmd );
1014910166 for (idx = 0 ; idx < PHY848xx_CMDHDLR_WAIT ; idx ++ ) {
@@ -10157,24 +10174,30 @@ static int bnx2x_84833_cmd_hdlr(struct bnx2x_phy *phy,
1015710174 if ((idx >= PHY848xx_CMDHDLR_WAIT ) ||
1015810175 (val == PHY84833_STATUS_CMD_COMPLETE_ERROR )) {
1015910176 DP (NETIF_MSG_LINK , "FW cmd failed.\n" );
10160- return - EINVAL ;
10177+ rc = - EINVAL ;
1016110178 }
10162- /* Gather returning data */
10163- for (idx = 0 ; idx < argc ; idx ++ ) {
10164- bnx2x_cl45_read (bp , phy , MDIO_CTL_DEVAD ,
10165- MDIO_848xx_CMD_HDLR_DATA1 + idx ,
10166- & cmd_args [idx ]);
10179+ if (process == PHY84833_MB_PROCESS3 && rc == 0 ) {
10180+ /* Gather returning data */
10181+ for (idx = 0 ; idx < argc ; idx ++ ) {
10182+ bnx2x_cl45_read (bp , phy , MDIO_CTL_DEVAD ,
10183+ MDIO_848xx_CMD_HDLR_DATA1 + idx ,
10184+ & cmd_args [idx ]);
10185+ }
1016710186 }
10168- bnx2x_cl45_write (bp , phy , MDIO_CTL_DEVAD ,
10169- MDIO_848xx_CMD_HDLR_STATUS ,
10170- PHY84833_STATUS_CMD_CLEAR_COMPLETE );
10171- return 0 ;
10187+ if (val == PHY84833_STATUS_CMD_COMPLETE_ERROR ||
10188+ val == PHY84833_STATUS_CMD_COMPLETE_PASS ) {
10189+ bnx2x_cl45_write (bp , phy , MDIO_CTL_DEVAD ,
10190+ MDIO_848xx_CMD_HDLR_STATUS ,
10191+ PHY84833_STATUS_CMD_CLEAR_COMPLETE );
10192+ }
10193+ return rc ;
1017210194}
1017310195
1017410196static int bnx2x_848xx_cmd_hdlr (struct bnx2x_phy * phy ,
1017510197 struct link_params * params ,
1017610198 u16 fw_cmd ,
10177- u16 cmd_args [], int argc )
10199+ u16 cmd_args [], int argc ,
10200+ int process )
1017810201{
1017910202 struct bnx2x * bp = params -> bp ;
1018010203
@@ -10187,7 +10210,7 @@ static int bnx2x_848xx_cmd_hdlr(struct bnx2x_phy *phy,
1018710210 argc );
1018810211 } else {
1018910212 return bnx2x_84833_cmd_hdlr (phy , params , fw_cmd , cmd_args ,
10190- argc );
10213+ argc , process );
1019110214 }
1019210215}
1019310216
@@ -10214,7 +10237,7 @@ static int bnx2x_848xx_pair_swap_cfg(struct bnx2x_phy *phy,
1021410237
1021510238 status = bnx2x_848xx_cmd_hdlr (phy , params ,
1021610239 PHY848xx_CMD_SET_PAIR_SWAP , data ,
10217- PHY848xx_CMDHDLR_MAX_ARGS );
10240+ 2 , PHY84833_MB_PROCESS2 );
1021810241 if (status == 0 )
1021910242 DP (NETIF_MSG_LINK , "Pairswap OK, val=0x%x\n" , data [1 ]);
1022010243
@@ -10303,8 +10326,8 @@ static int bnx2x_8483x_disable_eee(struct bnx2x_phy *phy,
1030310326 DP (NETIF_MSG_LINK , "Don't Advertise 10GBase-T EEE\n" );
1030410327
1030510328 /* Prevent Phy from working in EEE and advertising it */
10306- rc = bnx2x_848xx_cmd_hdlr (phy , params ,
10307- PHY848xx_CMD_SET_EEE_MODE , & cmd_args , 1 );
10329+ rc = bnx2x_848xx_cmd_hdlr (phy , params , PHY848xx_CMD_SET_EEE_MODE ,
10330+ & cmd_args , 1 , PHY84833_MB_PROCESS1 );
1030810331 if (rc ) {
1030910332 DP (NETIF_MSG_LINK , "EEE disable failed.\n" );
1031010333 return rc ;
@@ -10321,8 +10344,8 @@ static int bnx2x_8483x_enable_eee(struct bnx2x_phy *phy,
1032110344 struct bnx2x * bp = params -> bp ;
1032210345 u16 cmd_args = 1 ;
1032310346
10324- rc = bnx2x_848xx_cmd_hdlr (phy , params ,
10325- PHY848xx_CMD_SET_EEE_MODE , & cmd_args , 1 );
10347+ rc = bnx2x_848xx_cmd_hdlr (phy , params , PHY848xx_CMD_SET_EEE_MODE ,
10348+ & cmd_args , 1 , PHY84833_MB_PROCESS1 );
1032610349 if (rc ) {
1032710350 DP (NETIF_MSG_LINK , "EEE enable failed.\n" );
1032810351 return rc ;
@@ -10443,7 +10466,7 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy,
1044310466 cmd_args [3 ] = PHY84833_CONSTANT_LATENCY ;
1044410467 rc = bnx2x_848xx_cmd_hdlr (phy , params ,
1044510468 PHY848xx_CMD_SET_EEE_MODE , cmd_args ,
10446- PHY848xx_CMDHDLR_MAX_ARGS );
10469+ 4 , PHY84833_MB_PROCESS1 );
1044710470 if (rc )
1044810471 DP (NETIF_MSG_LINK , "Cfg AutogrEEEn failed.\n" );
1044910472 }
0 commit comments