armvirt: add SFP support patches for NXP Layerscape DPAA2 platforms
[openwrt/staging/stintel.git] / target / linux / armvirt / patches-6.1 / 701-v6.2-0003-net-dpaa2-mac-absorb-phylink_start-call-into-dpaa2_m.patch
1 From 97c07369ab8bf9895e05d4b468f18e6567263154 Mon Sep 17 00:00:00 2001
2 From: Vladimir Oltean <vladimir.oltean@nxp.com>
3 Date: Tue, 29 Nov 2022 16:12:12 +0200
4 Subject: [PATCH 05/14] net: dpaa2-mac: absorb phylink_start() call into
5 dpaa2_mac_start()
6
7 The phylink handling is intended to be hidden inside the dpaa2_mac
8 object. Move the phylink_start() call into dpaa2_mac_start(), and
9 phylink_stop() into dpaa2_mac_stop().
10
11 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
12 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
13 Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
14 Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
15 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
16 ---
17 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 5 +----
18 drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 8 ++++++++
19 drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 5 +----
20 3 files changed, 10 insertions(+), 8 deletions(-)
21
22 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
23 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
24 @@ -2082,10 +2082,8 @@ static int dpaa2_eth_open(struct net_dev
25 goto enable_err;
26 }
27
28 - if (dpaa2_eth_is_type_phy(priv)) {
29 + if (dpaa2_eth_is_type_phy(priv))
30 dpaa2_mac_start(priv->mac);
31 - phylink_start(priv->mac->phylink);
32 - }
33
34 return 0;
35
36 @@ -2159,7 +2157,6 @@ static int dpaa2_eth_stop(struct net_dev
37 int retries = 10;
38
39 if (dpaa2_eth_is_type_phy(priv)) {
40 - phylink_stop(priv->mac->phylink);
41 dpaa2_mac_stop(priv->mac);
42 } else {
43 netif_tx_stop_all_queues(net_dev);
44 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
45 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
46 @@ -336,12 +336,20 @@ static void dpaa2_mac_set_supported_inte
47
48 void dpaa2_mac_start(struct dpaa2_mac *mac)
49 {
50 + ASSERT_RTNL();
51 +
52 if (mac->serdes_phy)
53 phy_power_on(mac->serdes_phy);
54 +
55 + phylink_start(mac->phylink);
56 }
57
58 void dpaa2_mac_stop(struct dpaa2_mac *mac)
59 {
60 + ASSERT_RTNL();
61 +
62 + phylink_stop(mac->phylink);
63 +
64 if (mac->serdes_phy)
65 phy_power_off(mac->serdes_phy);
66 }
67 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
68 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
69 @@ -703,10 +703,8 @@ static int dpaa2_switch_port_open(struct
70
71 dpaa2_switch_enable_ctrl_if_napi(ethsw);
72
73 - if (dpaa2_switch_port_is_type_phy(port_priv)) {
74 + if (dpaa2_switch_port_is_type_phy(port_priv))
75 dpaa2_mac_start(port_priv->mac);
76 - phylink_start(port_priv->mac->phylink);
77 - }
78
79 return 0;
80 }
81 @@ -718,7 +716,6 @@ static int dpaa2_switch_port_stop(struct
82 int err;
83
84 if (dpaa2_switch_port_is_type_phy(port_priv)) {
85 - phylink_stop(port_priv->mac->phylink);
86 dpaa2_mac_stop(port_priv->mac);
87 } else {
88 netif_tx_stop_all_queues(netdev);