kernel: bump 5.4 to 5.4.109
[openwrt/openwrt.git] / target / linux / layerscape / patches-5.4 / 701-net-0353-staging-fsl-dpaa2-mac-do-not-stop-MAC-when-the-net_d.patch
1 From aae18d4ce3055e459855cc8661cf8f2a5e2cbe73 Mon Sep 17 00:00:00 2001
2 From: Ioana Ciornei <ioana.ciornei@nxp.com>
3 Date: Fri, 13 Dec 2019 13:24:01 +0200
4 Subject: [PATCH] staging: fsl-dpaa2/mac: do not stop MAC when the net_dev is
5 not up
6
7 In case the net_device is not up, there is no need to call
8 dpmac_mac_stop(). Guard the call by checking the IFF_UP flag.
9 This patch will also solve the following warning generated by removing a
10 dpmac that is not up.
11
12 [ 40.942937] called from state READY
13 [ 40.946442] WARNING: CPU: 0 PID: 755 at drivers/net/phy/phy.c:838
14 phy_stop+0x6c/0x78
15 [ 40.954171] Modules linked in:
16 [ 40.957214] CPU: 0 PID: 755 Comm: bash Tainted: G W
17 5.4.0-03629-gfd7102c32b2c-dirty #911
18 [ 40.966592] Hardware name: NXP Layerscape LX2160ARDB (DT)
19 [ 40.971978] pstate: 40000005 (nZcv daif -PAN -UAO)
20 [ 40.976756] pc : phy_stop+0x6c/0x78
21 [ 40.980232] lr : phy_stop+0x6c/0x78
22 (..)
23 [ 41.066487] Call trace:
24 [ 41.068922] phy_stop+0x6c/0x78
25 [ 41.072052] dpaa2_mac_stop.part.4+0x34/0x5c
26 [ 41.076309] dpaa2_mac_remove+0x9c/0xa8
27
28 Also, remove the IFF_UP flag from the mac netdev since the PHY is not
29 anymore started at probe time but is rather started/stopped on ifconfig
30 up/down.
31
32 Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
33 ---
34 drivers/staging/fsl-dpaa2/mac/mac.c | 8 +++-----
35 1 file changed, 3 insertions(+), 5 deletions(-)
36
37 --- a/drivers/staging/fsl-dpaa2/mac/mac.c
38 +++ b/drivers/staging/fsl-dpaa2/mac/mac.c
39 @@ -1,5 +1,5 @@
40 /* Copyright 2015 Freescale Semiconductor Inc.
41 - * Copyright 2018 NXP
42 + * Copyright 2018-2019 NXP
43 *
44 * Redistribution and use in source and binary forms, with or without
45 * modification, are permitted provided that the following conditions are met:
46 @@ -664,9 +664,6 @@ static int dpaa2_mac_probe(struct fsl_mc
47 netdev->netdev_ops = &dpaa2_mac_ndo_ops;
48 netdev->ethtool_ops = &dpaa2_mac_ethtool_ops;
49
50 - /* phy starts up enabled so netdev should be up too */
51 - netdev->flags |= IFF_UP;
52 -
53 err = register_netdev(priv->netdev);
54 if (err < 0) {
55 dev_err(dev, "register_netdev error %d\n", err);
56 @@ -775,7 +772,8 @@ static int dpaa2_mac_remove(struct fsl_m
57 struct dpaa2_mac_priv *priv = dev_get_drvdata(dev);
58 struct net_device *netdev = priv->netdev;
59
60 - dpaa2_mac_stop(netdev);
61 + if (netdev->flags & IFF_UP)
62 + dpaa2_mac_stop(netdev);
63
64 if (phy_is_pseudo_fixed_link(netdev->phydev))
65 fixed_phy_unregister(netdev->phydev);