@@ -133,22 +133,6 @@ static void _eth_arch_low_level_init(struct netif *netif)
133
133
/* Enable MAC and DMA transmission and reception */
134
134
HAL_ETH_Start (& EthHandle );
135
135
136
- /**** Configure PHY to generate an interrupt when Eth Link state changes ****/
137
- /* Read Register Configuration */
138
- HAL_ETH_ReadPHYRegister (& EthHandle , PHY_MICR , & regvalue );
139
-
140
- regvalue |= (PHY_MICR_INT_EN | PHY_MICR_INT_OE );
141
-
142
- /* Enable Interrupts */
143
- HAL_ETH_WritePHYRegister (& EthHandle , PHY_MICR , regvalue );
144
-
145
- /* Read Register Configuration */
146
- HAL_ETH_ReadPHYRegister (& EthHandle , PHY_MISR , & regvalue );
147
-
148
- regvalue |= PHY_MISR_LINK_INT_EN ;
149
-
150
- /* Enable Interrupt on change of link status */
151
- HAL_ETH_WritePHYRegister (& EthHandle , PHY_MISR , regvalue );
152
136
#endif
153
137
}
154
138
@@ -362,10 +346,10 @@ static void _eth_arch_phy_task(void *arg)
362
346
363
347
while (1 ) {
364
348
uint32_t status ;
365
- if (HAL_ETH_ReadPHYRegister (& EthHandle , PHY_SR , & status ) == HAL_OK ) {
366
- if ((status & PHY_LINK_STATUS ) && !(phy_status & PHY_LINK_STATUS )) {
349
+ if (HAL_ETH_ReadPHYRegister (& EthHandle , PHY_BSR , & status ) == HAL_OK ) {
350
+ if ((status & PHY_LINKED_STATUS ) && !(phy_status & PHY_LINKED_STATUS )) {
367
351
tcpip_callback_with_block ((tcpip_callback_fn )netif_set_link_up , (void * ) netif , 1 );
368
- } else if (!(status & PHY_LINK_STATUS ) && (phy_status & PHY_LINK_STATUS )) {
352
+ } else if (!(status & PHY_LINKED_STATUS ) && (phy_status & PHY_LINKED_STATUS )) {
369
353
tcpip_callback_with_block ((tcpip_callback_fn )netif_set_link_down , (void * ) netif , 1 );
370
354
}
371
355
phy_status = status ;
0 commit comments