@@ -313,10 +313,13 @@ static int sparx5_create_port(struct sparx5 *sparx5,
313
313
struct initial_port_config * config )
314
314
{
315
315
struct sparx5_port * spx5_port ;
316
+ const struct sparx5_ops * ops ;
316
317
struct net_device * ndev ;
317
318
struct phylink * phylink ;
318
319
int err ;
319
320
321
+ ops = sparx5 -> data -> ops ;
322
+
320
323
ndev = sparx5_create_netdev (sparx5 , config -> portno );
321
324
if (IS_ERR (ndev )) {
322
325
dev_err (sparx5 -> dev , "Could not create net device: %02u\n" ,
@@ -357,6 +360,9 @@ static int sparx5_create_port(struct sparx5 *sparx5,
357
360
MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD |
358
361
MAC_2500FD | MAC_5000FD | MAC_10000FD | MAC_25000FD ;
359
362
363
+ if (ops -> is_port_rgmii (spx5_port -> portno ))
364
+ phy_interface_set_rgmii (spx5_port -> phylink_config .supported_interfaces );
365
+
360
366
__set_bit (PHY_INTERFACE_MODE_SGMII ,
361
367
spx5_port -> phylink_config .supported_interfaces );
362
368
__set_bit (PHY_INTERFACE_MODE_QSGMII ,
@@ -830,6 +836,7 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
830
836
struct initial_port_config * configs , * config ;
831
837
struct device_node * np = pdev -> dev .of_node ;
832
838
struct device_node * ports , * portnp ;
839
+ const struct sparx5_ops * ops ;
833
840
struct reset_control * reset ;
834
841
struct sparx5 * sparx5 ;
835
842
int idx = 0 , err = 0 ;
@@ -851,6 +858,7 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
851
858
return - EINVAL ;
852
859
853
860
regs = sparx5 -> data -> regs ;
861
+ ops = sparx5 -> data -> ops ;
854
862
855
863
/* Do switch core reset if available */
856
864
reset = devm_reset_control_get_optional_shared (& pdev -> dev , "switch" );
@@ -880,7 +888,7 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
880
888
881
889
for_each_available_child_of_node (ports , portnp ) {
882
890
struct sparx5_port_config * conf ;
883
- struct phy * serdes ;
891
+ struct phy * serdes = NULL ;
884
892
u32 portno ;
885
893
886
894
err = of_property_read_u32 (portnp , "reg" , & portno );
@@ -910,13 +918,17 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
910
918
conf -> sd_sgpio = ~0 ;
911
919
else
912
920
sparx5 -> sd_sgpio_remapping = true;
913
- serdes = devm_of_phy_get (sparx5 -> dev , portnp , NULL );
914
- if (IS_ERR (serdes )) {
915
- err = dev_err_probe (sparx5 -> dev , PTR_ERR (serdes ),
916
- "port %u: missing serdes\n" ,
917
- portno );
918
- of_node_put (portnp );
919
- goto cleanup_config ;
921
+ /* There is no SerDes node for RGMII ports. */
922
+ if (!ops -> is_port_rgmii (portno )) {
923
+ serdes = devm_of_phy_get (sparx5 -> dev , portnp , NULL );
924
+ if (IS_ERR (serdes )) {
925
+ err = dev_err_probe (sparx5 -> dev ,
926
+ PTR_ERR (serdes ),
927
+ "port %u: missing serdes\n" ,
928
+ portno );
929
+ of_node_put (portnp );
930
+ goto cleanup_config ;
931
+ }
920
932
}
921
933
config -> portno = portno ;
922
934
config -> node = portnp ;
0 commit comments