9fb0c2f0a3f253300b4a63c03db8933ec635d1ee
[openwrt/openwrt.git] / target / linux / octeon / patches-5.4 / 701-honor_sgmii_node_device_tree_status.patch
1 From: Roman Kuzmitskii <damex.pp@icloud.com>
2 Date: Sun, 01 Nov 2020 19:00:00 +0000
3 Subject: [PATCH] staging: octeon: sgmii to honor disabled dt node status
4
5 With this patch, sgmii interface device tree node could be disabled and
6 that disabled interface will not be unnecessarily initialized.
7
8 It solves the problem with Octeon boards that have 8 sgmii or more ports
9 initialized but have nothing connected to them.
10
11 Tested-by: Johannes Kimmel <fff@bareminimum.eu>
12 Signed-off-by: Roman Kuzmitskii <damex.pp@icloud.com>
13 --- a/drivers/staging/octeon/ethernet.c
14 +++ b/drivers/staging/octeon/ethernet.c
15 @@ -885,8 +885,10 @@ static int cvm_oct_probe(struct platform
16
17 case CVMX_HELPER_INTERFACE_MODE_SGMII:
18 priv->phy_mode = PHY_INTERFACE_MODE_SGMII;
19 - dev->netdev_ops = &cvm_oct_sgmii_netdev_ops;
20 - strscpy(dev->name, "eth%d", sizeof(dev->name));
21 + if (of_device_is_available(priv->of_node)) {
22 + dev->netdev_ops = &cvm_oct_sgmii_netdev_ops;
23 + strscpy(dev->name, "eth%d", sizeof(dev->name));
24 + }
25 break;
26
27 case CVMX_HELPER_INTERFACE_MODE_SPI: