@@ -213,11 +213,10 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
213
213
udelay (2 );
214
214
}
215
215
216
- priv -> ext_phy = !priv -> internal_phy &&
217
- (priv -> phy_interface != PHY_INTERFACE_MODE_MOCA );
218
-
219
216
switch (priv -> phy_interface ) {
220
217
case PHY_INTERFACE_MODE_INTERNAL :
218
+ phy_name = "internal PHY" ;
219
+ /* fall through */
221
220
case PHY_INTERFACE_MODE_MOCA :
222
221
/* Irrespective of the actually configured PHY speed (100 or
223
222
* 1000) GENETv4 only has an internal GPHY so we will just end
@@ -229,11 +228,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
229
228
else
230
229
port_ctrl = PORT_MODE_INT_EPHY ;
231
230
232
- bcmgenet_sys_writel (priv , port_ctrl , SYS_PORT_CTRL );
233
-
234
- if (priv -> internal_phy ) {
235
- phy_name = "internal PHY" ;
236
- } else if (priv -> phy_interface == PHY_INTERFACE_MODE_MOCA ) {
231
+ if (!phy_name ) {
237
232
phy_name = "MoCA" ;
238
233
bcmgenet_moca_phy_setup (priv );
239
234
}
@@ -242,11 +237,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
242
237
case PHY_INTERFACE_MODE_MII :
243
238
phy_name = "external MII" ;
244
239
phy_set_max_speed (phydev , SPEED_100 );
245
- bcmgenet_sys_writel (priv ,
246
- PORT_MODE_EXT_EPHY , SYS_PORT_CTRL );
247
- /* Restore the MII PHY after isolation */
248
- if (bmcr >= 0 )
249
- phy_write (phydev , MII_BMCR , bmcr );
240
+ port_ctrl = PORT_MODE_EXT_EPHY ;
250
241
break ;
251
242
252
243
case PHY_INTERFACE_MODE_REVMII :
@@ -261,31 +252,38 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
261
252
port_ctrl = PORT_MODE_EXT_RVMII_50 ;
262
253
else
263
254
port_ctrl = PORT_MODE_EXT_RVMII_25 ;
264
- bcmgenet_sys_writel (priv , port_ctrl , SYS_PORT_CTRL );
265
255
break ;
266
256
267
257
case PHY_INTERFACE_MODE_RGMII :
268
258
/* RGMII_NO_ID: TXC transitions at the same time as TXD
269
259
* (requires PCB or receiver-side delay)
270
- * RGMII: Add 2ns delay on TXC (90 degree shift)
271
260
*
272
261
* ID is implicitly disabled for 100Mbps (RG)MII operation.
273
262
*/
263
+ phy_name = "external RGMII (no delay)" ;
274
264
id_mode_dis = BIT (16 );
275
- /* fall through */
265
+ port_ctrl = PORT_MODE_EXT_GPHY ;
266
+ break ;
267
+
276
268
case PHY_INTERFACE_MODE_RGMII_TXID :
277
- if (id_mode_dis )
278
- phy_name = "external RGMII (no delay)" ;
279
- else
280
- phy_name = "external RGMII (TX delay)" ;
281
- bcmgenet_sys_writel (priv ,
282
- PORT_MODE_EXT_GPHY , SYS_PORT_CTRL );
269
+ /* RGMII_TXID: Add 2ns delay on TXC (90 degree shift) */
270
+ phy_name = "external RGMII (TX delay)" ;
271
+ port_ctrl = PORT_MODE_EXT_GPHY ;
283
272
break ;
284
273
default :
285
274
dev_err (kdev , "unknown phy mode: %d\n" , priv -> phy_interface );
286
275
return - EINVAL ;
287
276
}
288
277
278
+ bcmgenet_sys_writel (priv , port_ctrl , SYS_PORT_CTRL );
279
+
280
+ /* Restore the MII PHY after isolation */
281
+ if (bmcr >= 0 )
282
+ phy_write (phydev , MII_BMCR , bmcr );
283
+
284
+ priv -> ext_phy = !priv -> internal_phy &&
285
+ (priv -> phy_interface != PHY_INTERFACE_MODE_MOCA );
286
+
289
287
/* This is an external PHY (xMII), so we need to enable the RGMII
290
288
* block for the interface to work
291
289
*/
0 commit comments