@@ -19,8 +19,8 @@ void txgbe_gpio_init_aml(struct wx *wx)
1919{
2020	u32  status ;
2121
22- 	wr32 (wx , WX_GPIO_INTTYPE_LEVEL , TXGBE_GPIOBIT_2  |  TXGBE_GPIOBIT_3 );
23- 	wr32 (wx , WX_GPIO_INTEN , TXGBE_GPIOBIT_2  |  TXGBE_GPIOBIT_3 );
22+ 	wr32 (wx , WX_GPIO_INTTYPE_LEVEL , TXGBE_GPIOBIT_2 );
23+ 	wr32 (wx , WX_GPIO_INTEN , TXGBE_GPIOBIT_2 );
2424
2525	status  =  rd32 (wx , WX_GPIO_INTSTATUS );
2626	for  (int  i  =  0 ; i  <  6 ; i ++ ) {
@@ -42,11 +42,6 @@ irqreturn_t txgbe_gpio_irq_handler_aml(int irq, void *data)
4242		wr32 (wx , WX_GPIO_EOI , TXGBE_GPIOBIT_2 );
4343		wx_service_event_schedule (wx );
4444	}
45- 	if  (status  &  TXGBE_GPIOBIT_3 ) {
46- 		set_bit (WX_FLAG_NEED_LINK_CONFIG , wx -> flags );
47- 		wx_service_event_schedule (wx );
48- 		wr32 (wx , WX_GPIO_EOI , TXGBE_GPIOBIT_3 );
49- 	}
5045
5146	wr32 (wx , WX_GPIO_INTMASK , 0 );
5247	return  IRQ_HANDLED ;
@@ -96,6 +91,9 @@ static int txgbe_set_phy_link_hostif(struct wx *wx, int speed, int autoneg, int
9691	case  SPEED_10000 :
9792		buffer .speed  =  TXGBE_LINK_SPEED_10GB_FULL ;
9893		break ;
94+ 	default :
95+ 		buffer .speed  =  TXGBE_LINK_SPEED_UNKNOWN ;
96+ 		break ;
9997	}
10098
10199	buffer .fec_mode  =  TXGBE_PHY_FEC_AUTO ;
@@ -106,22 +104,21 @@ static int txgbe_set_phy_link_hostif(struct wx *wx, int speed, int autoneg, int
106104					 WX_HI_COMMAND_TIMEOUT , true);
107105}
108106
109- static  void  txgbe_get_link_capabilities (struct  wx  * wx )
107+ static  void  txgbe_get_link_capabilities (struct  wx  * wx ,  int   * speed ,  int   * duplex )
110108{
111109	struct  txgbe  * txgbe  =  wx -> priv ;
112110
113111	if  (test_bit (PHY_INTERFACE_MODE_25GBASER , txgbe -> sfp_interfaces ))
114- 		wx -> adv_speed  =  SPEED_25000 ;
112+ 		* speed  =  SPEED_25000 ;
115113	else  if  (test_bit (PHY_INTERFACE_MODE_10GBASER , txgbe -> sfp_interfaces ))
116- 		wx -> adv_speed  =  SPEED_10000 ;
114+ 		* speed  =  SPEED_10000 ;
117115	else 
118- 		wx -> adv_speed  =  SPEED_UNKNOWN ;
116+ 		* speed  =  SPEED_UNKNOWN ;
119117
120- 	wx -> adv_duplex  =  wx -> adv_speed  ==  SPEED_UNKNOWN  ?
121- 			 DUPLEX_HALF  : DUPLEX_FULL ;
118+ 	* duplex  =  * speed  ==  SPEED_UNKNOWN  ? DUPLEX_HALF  : DUPLEX_FULL ;
122119}
123120
124- static  void  txgbe_get_phy_link (struct  wx  * wx , int  * speed )
121+ static  void  txgbe_get_mac_link (struct  wx  * wx , int  * speed )
125122{
126123	u32  status ;
127124
@@ -138,23 +135,11 @@ static void txgbe_get_phy_link(struct wx *wx, int *speed)
138135
139136int  txgbe_set_phy_link (struct  wx  * wx )
140137{
141- 	int  speed , err ;
142- 	u32  gpio ;
143- 
144- 	/* Check RX signal */ 
145- 	gpio  =  rd32 (wx , WX_GPIO_EXT );
146- 	if  (gpio  &  TXGBE_GPIOBIT_3 )
147- 		return  - ENODEV ;
138+ 	int  speed , duplex , err ;
148139
149- 	txgbe_get_link_capabilities (wx );
150- 	if  (wx -> adv_speed  ==  SPEED_UNKNOWN )
151- 		return  - ENODEV ;
152- 
153- 	txgbe_get_phy_link (wx , & speed );
154- 	if  (speed  ==  wx -> adv_speed )
155- 		return  0 ;
140+ 	txgbe_get_link_capabilities (wx , & speed , & duplex );
156141
157- 	err  =  txgbe_set_phy_link_hostif (wx , wx -> adv_speed , 0 , wx -> adv_duplex );
142+ 	err  =  txgbe_set_phy_link_hostif (wx , speed , 0 , duplex );
158143	if  (err ) {
159144		wx_err (wx , "Failed to setup link\n" );
160145		return  err ;
@@ -230,14 +215,7 @@ int txgbe_identify_sfp(struct wx *wx)
230215		return  - ENODEV ;
231216	}
232217
233- 	err  =  txgbe_sfp_to_linkmodes (wx , id );
234- 	if  (err )
235- 		return  err ;
236- 
237- 	if  (gpio  &  TXGBE_GPIOBIT_3 )
238- 		set_bit (WX_FLAG_NEED_LINK_CONFIG , wx -> flags );
239- 
240- 	return  0 ;
218+ 	return  txgbe_sfp_to_linkmodes (wx , id );
241219}
242220
243221void  txgbe_setup_link (struct  wx  * wx )
@@ -256,7 +234,7 @@ static void txgbe_get_link_state(struct phylink_config *config,
256234	struct  wx  * wx  =  phylink_to_wx (config );
257235	int  speed ;
258236
259- 	txgbe_get_phy_link (wx , & speed );
237+ 	txgbe_get_mac_link (wx , & speed );
260238	state -> link  =  speed  !=  SPEED_UNKNOWN ;
261239	state -> speed  =  speed ;
262240	state -> duplex  =  state -> link  ? DUPLEX_FULL  : DUPLEX_UNKNOWN ;
0 commit comments