kernel: bump 5.4 to 5.4.73
[openwrt/openwrt.git] / target / linux / layerscape / patches-5.4 / 701-net-0110-sdk_dpaa-adapt-to-kernel-5.1.0-rc1.patch
1 From 68b77d267414d790e5cbd76f46a77501559e5748 Mon Sep 17 00:00:00 2001
2 From: Camelia Groza <camelia.groza@nxp.com>
3 Date: Tue, 26 Mar 2019 18:27:11 +0200
4 Subject: [PATCH] sdk_dpaa: adapt to kernel 5.1.0 rc1
5
6 Apply fixes corresponding to the following upstream patches:
7 3c1bcc8 net: ethernet: Convert phydev advertize and supported from u32 to link mode
8 1e562c8 ptp_qoriq: make structure/function names more consistent
9 70814e8 net: ethernet: Add helper for set_pauseparam for Asym Pause
10 22b7d29 net: ethernet: Add helper to determine if pause configuration is supported
11
12 Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
13 ---
14 .../net/ethernet/freescale/sdk_dpaa/dpaa_ethtool.c | 31 +++-------------------
15 drivers/net/ethernet/freescale/sdk_dpaa/mac-api.c | 27 +++++++++----------
16 2 files changed, 16 insertions(+), 42 deletions(-)
17
18 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_ethtool.c
19 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_ethtool.c
20 @@ -225,7 +225,6 @@ static int __cold dpa_set_pauseparam(str
21 struct mac_device *mac_dev;
22 struct phy_device *phy_dev;
23 int _errno;
24 - u32 newadv, oldadv;
25 bool rx_pause, tx_pause;
26
27 priv = netdev_priv(net_dev);
28 @@ -242,9 +241,7 @@ static int __cold dpa_set_pauseparam(str
29 return -ENODEV;
30 }
31
32 - if (!(phy_dev->supported & SUPPORTED_Pause) ||
33 - (!(phy_dev->supported & SUPPORTED_Asym_Pause) &&
34 - (epause->rx_pause != epause->tx_pause)))
35 + if (!phy_validate_pause(phy_dev, epause))
36 return -EINVAL;
37
38 /* The MAC should know how to handle PAUSE frame autonegotiation before
39 @@ -258,29 +255,7 @@ static int __cold dpa_set_pauseparam(str
40 /* Determine the sym/asym advertised PAUSE capabilities from the desired
41 * rx/tx pause settings.
42 */
43 - newadv = 0;
44 - if (epause->rx_pause)
45 - newadv = ADVERTISED_Pause | ADVERTISED_Asym_Pause;
46 - if (epause->tx_pause)
47 - newadv |= ADVERTISED_Asym_Pause;
48 -
49 - oldadv = phy_dev->advertising &
50 - (ADVERTISED_Pause | ADVERTISED_Asym_Pause);
51 -
52 - /* If there are differences between the old and the new advertised
53 - * values, restart PHY autonegotiation and advertise the new values.
54 - */
55 - if (oldadv != newadv) {
56 - phy_dev->advertising &= ~(ADVERTISED_Pause
57 - | ADVERTISED_Asym_Pause);
58 - phy_dev->advertising |= newadv;
59 - if (phy_dev->autoneg) {
60 - _errno = phy_start_aneg(phy_dev);
61 - if (unlikely(_errno < 0))
62 - netdev_err(net_dev, "phy_start_aneg() = %d\n",
63 - _errno);
64 - }
65 - }
66 + phy_set_asym_pause(phy_dev, epause->rx_pause, epause->tx_pause);
67
68 get_pause_cfg(mac_dev, &rx_pause, &tx_pause);
69 _errno = set_mac_active_pause(mac_dev, rx_pause, tx_pause);
70 @@ -530,7 +505,7 @@ static int dpaa_get_ts_info(struct net_d
71 struct device_node *mac_node = dev->of_node;
72 struct device_node *fman_node = NULL, *ptp_node = NULL;
73 struct platform_device *ptp_dev = NULL;
74 - struct qoriq_ptp *ptp = NULL;
75 + struct ptp_qoriq *ptp = NULL;
76
77 info->phc_index = -1;
78
79 --- a/drivers/net/ethernet/freescale/sdk_dpaa/mac-api.c
80 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/mac-api.c
81 @@ -385,11 +385,7 @@ void get_pause_cfg(struct mac_device *ma
82 */
83
84 /* get local capabilities */
85 - lcl_adv = 0;
86 - if (phy_dev->advertising & ADVERTISED_Pause)
87 - lcl_adv |= ADVERTISE_PAUSE_CAP;
88 - if (phy_dev->advertising & ADVERTISED_Asym_Pause)
89 - lcl_adv |= ADVERTISE_PAUSE_ASYM;
90 + lcl_adv = linkmode_adv_to_lcl_adv_t(phy_dev->advertising);
91
92 /* get link partner capabilities */
93 rmt_adv = 0;
94 @@ -439,6 +435,7 @@ static int dtsec_init_phy(struct net_dev
95 struct mac_device *mac_dev)
96 {
97 struct phy_device *phy_dev;
98 + __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
99
100 if (of_phy_is_fixed_link(mac_dev->phy_node))
101 phy_dev = of_phy_attach(net_dev, mac_dev->phy_node,
102 @@ -455,12 +452,12 @@ static int dtsec_init_phy(struct net_dev
103 }
104
105 /* Remove any features not supported by the controller */
106 - phy_dev->supported &= mac_dev->if_support;
107 + ethtool_convert_legacy_u32_to_link_mode(mask, mac_dev->if_support);
108 + linkmode_and(phy_dev->supported, phy_dev->supported, mask);
109 /* Enable the symmetric and asymmetric PAUSE frame advertisements,
110 * as most of the PHY drivers do not enable them by default.
111 */
112 - phy_dev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
113 - phy_dev->advertising = phy_dev->supported;
114 + phy_support_asym_pause(phy_dev);
115
116 mac_dev->phy_dev = phy_dev;
117
118 @@ -471,6 +468,7 @@ static int xgmac_init_phy(struct net_dev
119 struct mac_device *mac_dev)
120 {
121 struct phy_device *phy_dev;
122 + __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
123
124 if (of_phy_is_fixed_link(mac_dev->phy_node))
125 phy_dev = of_phy_attach(net_dev, mac_dev->phy_node,
126 @@ -486,12 +484,12 @@ static int xgmac_init_phy(struct net_dev
127 return phy_dev == NULL ? -ENODEV : PTR_ERR(phy_dev);
128 }
129
130 - phy_dev->supported &= mac_dev->if_support;
131 + ethtool_convert_legacy_u32_to_link_mode(mask, mac_dev->if_support);
132 + linkmode_and(phy_dev->supported, phy_dev->supported, mask);
133 /* Enable the symmetric and asymmetric PAUSE frame advertisements,
134 * as most of the PHY drivers do not enable them by default.
135 */
136 - phy_dev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
137 - phy_dev->advertising = phy_dev->supported;
138 + phy_support_asym_pause(phy_dev);
139
140 mac_dev->phy_dev = phy_dev;
141
142 @@ -502,6 +500,7 @@ static int memac_init_phy(struct net_dev
143 struct mac_device *mac_dev)
144 {
145 struct phy_device *phy_dev;
146 + __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
147 void (*adjust_link_handler)(struct net_device *);
148
149 if ((macdev2enetinterface(mac_dev) == e_ENET_MODE_XGMII_10000) ||
150 @@ -547,12 +546,12 @@ static int memac_init_phy(struct net_dev
151 }
152
153 /* Remove any features not supported by the controller */
154 - phy_dev->supported &= mac_dev->if_support;
155 + ethtool_convert_legacy_u32_to_link_mode(mask, mac_dev->if_support);
156 + linkmode_and(phy_dev->supported, phy_dev->supported, mask);
157 /* Enable the symmetric and asymmetric PAUSE frame advertisements,
158 * as most of the PHY drivers do not enable them by default.
159 */
160 - phy_dev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
161 - phy_dev->advertising = phy_dev->supported;
162 + phy_support_asym_pause(phy_dev);
163
164 mac_dev->phy_dev = phy_dev;
165