kernel: bump 5.4 to 5.4.111
[openwrt/openwrt.git] / target / linux / layerscape / patches-5.4 / 701-net-0384-net-mscc-ocelot-make-phy_mode-a-member-of-the-common.patch
1 From 1737de8045838dcf3c7713c940eb1582810a319f Mon Sep 17 00:00:00 2001
2 From: Vladimir Oltean <vladimir.oltean@nxp.com>
3 Date: Mon, 16 Dec 2019 15:07:20 +0200
4 Subject: [PATCH] net: mscc: ocelot: make phy_mode a member of the common
5 struct ocelot_port
6
7 The Ocelot switchdev driver and the Felix DSA one need it for different
8 reasons. Felix (or at least the VSC9959 instantiation in NXP LS1028A) is
9 integrated with the traditional NXP Layerscape PCS design which does not
10 support runtime configuration of SerDes protocol. So it needs to
11 pre-validate the phy-mode from the device tree and prevent PHYLINK from
12 attempting to change it. For this, it needs to cache it in a private
13 variable.
14
15 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
16 ---
17 drivers/net/ethernet/mscc/ocelot.c | 7 ++++---
18 drivers/net/ethernet/mscc/ocelot.h | 1 -
19 drivers/net/ethernet/mscc/ocelot_board.c | 4 ++--
20 include/soc/mscc/ocelot.h | 2 ++
21 4 files changed, 8 insertions(+), 6 deletions(-)
22
23 --- a/drivers/net/ethernet/mscc/ocelot.c
24 +++ b/drivers/net/ethernet/mscc/ocelot.c
25 @@ -500,13 +500,14 @@ EXPORT_SYMBOL(ocelot_port_enable);
26 static int ocelot_port_open(struct net_device *dev)
27 {
28 struct ocelot_port_private *priv = netdev_priv(dev);
29 - struct ocelot *ocelot = priv->port.ocelot;
30 + struct ocelot_port *ocelot_port = &priv->port;
31 + struct ocelot *ocelot = ocelot_port->ocelot;
32 int port = priv->chip_port;
33 int err;
34
35 if (priv->serdes) {
36 err = phy_set_mode_ext(priv->serdes, PHY_MODE_ETHERNET,
37 - priv->phy_mode);
38 + ocelot_port->phy_mode);
39 if (err) {
40 netdev_err(dev, "Could not set mode of SerDes\n");
41 return err;
42 @@ -514,7 +515,7 @@ static int ocelot_port_open(struct net_d
43 }
44
45 err = phy_connect_direct(dev, priv->phy, &ocelot_port_adjust_link,
46 - priv->phy_mode);
47 + ocelot_port->phy_mode);
48 if (err) {
49 netdev_err(dev, "Could not attach to PHY\n");
50 return err;
51 --- a/drivers/net/ethernet/mscc/ocelot.h
52 +++ b/drivers/net/ethernet/mscc/ocelot.h
53 @@ -70,7 +70,6 @@ struct ocelot_port_private {
54
55 u8 vlan_aware;
56
57 - phy_interface_t phy_mode;
58 struct phy *serdes;
59
60 struct ocelot_port_tc tc;
61 --- a/drivers/net/ethernet/mscc/ocelot_board.c
62 +++ b/drivers/net/ethernet/mscc/ocelot_board.c
63 @@ -412,9 +412,9 @@ static int mscc_ocelot_probe(struct plat
64 if (phy_mode < 0)
65 phy_mode = PHY_INTERFACE_MODE_NA;
66
67 - priv->phy_mode = phy_mode;
68 + ocelot_port->phy_mode = phy_mode;
69
70 - switch (priv->phy_mode) {
71 + switch (ocelot_port->phy_mode) {
72 case PHY_INTERFACE_MODE_NA:
73 continue;
74 case PHY_INTERFACE_MODE_SGMII:
75 --- a/include/soc/mscc/ocelot.h
76 +++ b/include/soc/mscc/ocelot.h
77 @@ -425,6 +425,8 @@ struct ocelot_port {
78 u8 ptp_cmd;
79 struct sk_buff_head tx_skbs;
80 u8 ts_id;
81 +
82 + phy_interface_t phy_mode;
83 };
84
85 struct ocelot {