@@ -515,6 +515,15 @@ static void ravb_emac_init_gbeth(struct net_device *ndev)
515
515
{
516
516
struct ravb_private * priv = netdev_priv (ndev );
517
517
518
+ if (priv -> phy_interface == PHY_INTERFACE_MODE_MII ) {
519
+ ravb_write (ndev , (1000 << 16 ) | CXR35_SEL_XMII_MII , CXR35 );
520
+ ravb_modify (ndev , CXR31 , CXR31_SEL_LINK0 | CXR31_SEL_LINK1 , 0 );
521
+ } else {
522
+ ravb_write (ndev , (1000 << 16 ) | CXR35_SEL_XMII_RGMII , CXR35 );
523
+ ravb_modify (ndev , CXR31 , CXR31_SEL_LINK0 | CXR31_SEL_LINK1 ,
524
+ CXR31_SEL_LINK0 );
525
+ }
526
+
518
527
/* Receive frame limit set register */
519
528
ravb_write (ndev , GBETH_RX_BUFF_MAX + ETH_FCS_LEN , RFLR );
520
529
@@ -537,14 +546,6 @@ static void ravb_emac_init_gbeth(struct net_device *ndev)
537
546
538
547
/* E-MAC interrupt enable register */
539
548
ravb_write (ndev , ECSIPR_ICDIP , ECSIPR );
540
-
541
- if (priv -> phy_interface == PHY_INTERFACE_MODE_MII ) {
542
- ravb_modify (ndev , CXR31 , CXR31_SEL_LINK0 | CXR31_SEL_LINK1 , 0 );
543
- ravb_write (ndev , (1000 << 16 ) | CXR35_SEL_XMII_MII , CXR35 );
544
- } else {
545
- ravb_modify (ndev , CXR31 , CXR31_SEL_LINK0 | CXR31_SEL_LINK1 ,
546
- CXR31_SEL_LINK0 );
547
- }
548
549
}
549
550
550
551
static void ravb_emac_init_rcar (struct net_device * ndev )
@@ -1811,19 +1812,20 @@ static int ravb_open(struct net_device *ndev)
1811
1812
if (info -> gptp )
1812
1813
ravb_ptp_init (ndev , priv -> pdev );
1813
1814
1814
- netif_tx_start_all_queues (ndev );
1815
-
1816
1815
/* PHY control start */
1817
1816
error = ravb_phy_start (ndev );
1818
1817
if (error )
1819
1818
goto out_ptp_stop ;
1820
1819
1820
+ netif_tx_start_all_queues (ndev );
1821
+
1821
1822
return 0 ;
1822
1823
1823
1824
out_ptp_stop :
1824
1825
/* Stop PTP Clock driver */
1825
1826
if (info -> gptp )
1826
1827
ravb_ptp_stop (ndev );
1828
+ ravb_stop_dma (ndev );
1827
1829
out_free_irq_mgmta :
1828
1830
if (!info -> multi_irqs )
1829
1831
goto out_free_irq ;
@@ -2654,9 +2656,14 @@ static int ravb_probe(struct platform_device *pdev)
2654
2656
ndev -> features = info -> net_features ;
2655
2657
ndev -> hw_features = info -> net_hw_features ;
2656
2658
2657
- reset_control_deassert (rstc );
2659
+ error = reset_control_deassert (rstc );
2660
+ if (error )
2661
+ goto out_free_netdev ;
2662
+
2658
2663
pm_runtime_enable (& pdev -> dev );
2659
- pm_runtime_get_sync (& pdev -> dev );
2664
+ error = pm_runtime_resume_and_get (& pdev -> dev );
2665
+ if (error < 0 )
2666
+ goto out_rpm_disable ;
2660
2667
2661
2668
if (info -> multi_irqs ) {
2662
2669
if (info -> err_mgmt_irqs )
@@ -2881,11 +2888,12 @@ static int ravb_probe(struct platform_device *pdev)
2881
2888
out_disable_refclk :
2882
2889
clk_disable_unprepare (priv -> refclk );
2883
2890
out_release :
2884
- free_netdev (ndev );
2885
-
2886
2891
pm_runtime_put (& pdev -> dev );
2892
+ out_rpm_disable :
2887
2893
pm_runtime_disable (& pdev -> dev );
2888
2894
reset_control_assert (rstc );
2895
+ out_free_netdev :
2896
+ free_netdev (ndev );
2889
2897
return error ;
2890
2898
}
2891
2899
@@ -2895,22 +2903,26 @@ static void ravb_remove(struct platform_device *pdev)
2895
2903
struct ravb_private * priv = netdev_priv (ndev );
2896
2904
const struct ravb_hw_info * info = priv -> info ;
2897
2905
2898
- /* Stop PTP Clock driver */
2899
- if (info -> ccc_gac )
2900
- ravb_ptp_stop (ndev );
2901
-
2902
- clk_disable_unprepare (priv -> gptp_clk );
2903
- clk_disable_unprepare (priv -> refclk );
2904
-
2905
- /* Set reset mode */
2906
- ravb_write (ndev , CCC_OPC_RESET , CCC );
2907
2906
unregister_netdev (ndev );
2908
2907
if (info -> nc_queues )
2909
2908
netif_napi_del (& priv -> napi [RAVB_NC ]);
2910
2909
netif_napi_del (& priv -> napi [RAVB_BE ]);
2910
+
2911
2911
ravb_mdio_release (priv );
2912
+
2913
+ /* Stop PTP Clock driver */
2914
+ if (info -> ccc_gac )
2915
+ ravb_ptp_stop (ndev );
2916
+
2912
2917
dma_free_coherent (ndev -> dev .parent , priv -> desc_bat_size , priv -> desc_bat ,
2913
2918
priv -> desc_bat_dma );
2919
+
2920
+ /* Set reset mode */
2921
+ ravb_write (ndev , CCC_OPC_RESET , CCC );
2922
+
2923
+ clk_disable_unprepare (priv -> gptp_clk );
2924
+ clk_disable_unprepare (priv -> refclk );
2925
+
2914
2926
pm_runtime_put_sync (& pdev -> dev );
2915
2927
pm_runtime_disable (& pdev -> dev );
2916
2928
reset_control_assert (priv -> rstc );
0 commit comments