From cddd4591404fb4c53dc0b3c0b15b942cdbed4356 Mon Sep 17 00:00:00 2001 From: Yangbo Lu Date: Fri, 10 Apr 2020 10:47:05 +0800 Subject: layerscape: add patches-5.4 Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release which was tagged LSDK-20.04-V5.4. https://source.codeaurora.org/external/qoriq/qoriq-components/linux/ For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in LSDK, port the dts patches from 4.14. The patches are sorted into the following categories: 301-arch-xxxx 302-dts-xxxx 303-core-xxxx 701-net-xxxx 801-audio-xxxx 802-can-xxxx 803-clock-xxxx 804-crypto-xxxx 805-display-xxxx 806-dma-xxxx 807-gpio-xxxx 808-i2c-xxxx 809-jailhouse-xxxx 810-keys-xxxx 811-kvm-xxxx 812-pcie-xxxx 813-pm-xxxx 814-qe-xxxx 815-sata-xxxx 816-sdhc-xxxx 817-spi-xxxx 818-thermal-xxxx 819-uart-xxxx 820-usb-xxxx 821-vfio-xxxx Signed-off-by: Yangbo Lu --- ...T-protocol-information-to-set-up-the-port.patch | 195 +++++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 target/linux/layerscape/patches-5.4/701-net-0231-enetc-Use-DT-protocol-information-to-set-up-the-port.patch (limited to 'target/linux/layerscape/patches-5.4/701-net-0231-enetc-Use-DT-protocol-information-to-set-up-the-port.patch') diff --git a/target/linux/layerscape/patches-5.4/701-net-0231-enetc-Use-DT-protocol-information-to-set-up-the-port.patch b/target/linux/layerscape/patches-5.4/701-net-0231-enetc-Use-DT-protocol-information-to-set-up-the-port.patch new file mode 100644 index 0000000000..54fc619dd6 --- /dev/null +++ b/target/linux/layerscape/patches-5.4/701-net-0231-enetc-Use-DT-protocol-information-to-set-up-the-port.patch @@ -0,0 +1,195 @@ +From 98f64a89977a32df96cdb8aaf3884086b2309924 Mon Sep 17 00:00:00 2001 +From: Alex Marginean +Date: Tue, 27 Aug 2019 15:14:11 +0300 +Subject: [PATCH] enetc: Use DT protocol information to set up the ports + +Use DT information rather than in-band information from bootloader to +set up MAC for XGMII. For RGMII use the DT indication in addition to +RGMII defaults in hardware. +However, this implies that PHY connection information needs to be +extracted before netdevice creation, when the ENETC Port MAC is +being configured. + +Signed-off-by: Alex Marginean +Signed-off-by: Claudiu Manoil +--- + drivers/net/ethernet/freescale/enetc/enetc_pf.c | 55 ++++++++++++++----------- + drivers/net/ethernet/freescale/enetc/enetc_pf.h | 3 ++ + 2 files changed, 33 insertions(+), 25 deletions(-) + +--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c ++++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c +@@ -507,7 +507,8 @@ static void enetc_port_si_configure(stru + enetc_port_wr(hw, ENETC_PSIVLANFMR, ENETC_PSIVLANFMR_VS); + } + +-static void enetc_configure_port_mac(struct enetc_hw *hw) ++static void enetc_configure_port_mac(struct enetc_hw *hw, ++ phy_interface_t phy_mode) + { + enetc_port_wr(hw, ENETC_PM0_MAXFRM, + ENETC_SET_MAXFRM(ENETC_RX_MAXFRM_SIZE)); +@@ -523,9 +524,11 @@ static void enetc_configure_port_mac(str + ENETC_PM0_CMD_TXP | ENETC_PM0_PROMISC | + ENETC_PM0_TX_EN | ENETC_PM0_RX_EN); + /* set auto-speed for RGMII */ +- if (enetc_port_rd(hw, ENETC_PM0_IF_MODE) & ENETC_PMO_IFM_RG) ++ if (enetc_port_rd(hw, ENETC_PM0_IF_MODE) & ENETC_PMO_IFM_RG || ++ phy_mode == PHY_INTERFACE_MODE_RGMII) + enetc_port_wr(hw, ENETC_PM0_IF_MODE, ENETC_PM0_IFM_RGAUTO); +- if (enetc_global_rd(hw, ENETC_G_EPFBLPR(1)) == ENETC_G_EPFBLPR1_XGMII) ++ ++ if (phy_mode == PHY_INTERFACE_MODE_XGMII) + enetc_port_wr(hw, ENETC_PM0_IF_MODE, ENETC_PM0_IFM_XGMII); + } + +@@ -549,7 +552,7 @@ static void enetc_configure_port(struct + + enetc_configure_port_pmac(hw); + +- enetc_configure_port_mac(hw); ++ enetc_configure_port_mac(hw, pf->if_mode); + + enetc_port_si_configure(pf->si); + +@@ -749,28 +752,28 @@ static void enetc_pf_netdev_setup(struct + enetc_get_primary_mac_addr(&si->hw, ndev->dev_addr); + } + +-static int enetc_of_get_phy(struct enetc_ndev_priv *priv) ++static int enetc_of_get_phy(struct enetc_pf *pf) + { +- struct enetc_pf *pf = enetc_si_priv(priv->si); +- struct device_node *np = priv->dev->of_node; ++ struct device *dev = &pf->si->pdev->dev; ++ struct device_node *np = dev->of_node; + struct device_node *mdio_np; + int phy_mode; + int err; + +- priv->phy_node = of_parse_phandle(np, "phy-handle", 0); +- if (!priv->phy_node) { ++ pf->phy_node = of_parse_phandle(np, "phy-handle", 0); ++ if (!pf->phy_node) { + if (!of_phy_is_fixed_link(np)) { +- dev_err(priv->dev, "PHY not specified\n"); ++ dev_err(dev, "PHY not specified\n"); + return -ENODEV; + } + + err = of_phy_register_fixed_link(np); + if (err < 0) { +- dev_err(priv->dev, "fixed link registration failed\n"); ++ dev_err(dev, "fixed link registration failed\n"); + return err; + } + +- priv->phy_node = of_node_get(np); ++ pf->phy_node = of_node_get(np); + } + + mdio_np = of_get_child_by_name(np, "mdio"); +@@ -778,28 +781,28 @@ static int enetc_of_get_phy(struct enetc + of_node_put(mdio_np); + err = enetc_mdio_probe(pf); + if (err) { +- of_node_put(priv->phy_node); ++ of_node_put(pf->phy_node); + return err; + } + } + + phy_mode = of_get_phy_mode(np); + if (phy_mode < 0) +- priv->if_mode = PHY_INTERFACE_MODE_NA; /* fixed link */ ++ pf->if_mode = PHY_INTERFACE_MODE_NA; /* fixed link */ + else +- priv->if_mode = phy_mode; ++ pf->if_mode = phy_mode; + + return 0; + } + +-static void enetc_of_put_phy(struct enetc_ndev_priv *priv) ++static void enetc_of_put_phy(struct enetc_pf *pf) + { +- struct device_node *np = priv->dev->of_node; ++ struct device_node *np = pf->si->pdev->dev.of_node; + + if (np && of_phy_is_fixed_link(np)) + of_phy_deregister_fixed_link(np); +- if (priv->phy_node) +- of_node_put(priv->phy_node); ++ if (pf->phy_node) ++ of_node_put(pf->phy_node); + } + + static void enetc_configure_sgmii(struct mii_bus *imdio) +@@ -888,6 +891,10 @@ static int enetc_pf_probe(struct pci_dev + pf->si = si; + pf->total_vfs = pci_sriov_get_totalvfs(pdev); + ++ err = enetc_of_get_phy(pf); ++ if (err) ++ dev_warn(&pdev->dev, "Fallback to PHY-less operation\n"); ++ + enetc_configure_port(pf); + + enetc_get_si_caps(si); +@@ -902,6 +909,8 @@ static int enetc_pf_probe(struct pci_dev + enetc_pf_netdev_setup(si, ndev, &enetc_ndev_ops); + + priv = netdev_priv(ndev); ++ priv->phy_node = pf->phy_node; ++ priv->if_mode = pf->if_mode; + + enetc_init_si_rings_params(priv); + +@@ -917,10 +926,6 @@ static int enetc_pf_probe(struct pci_dev + goto err_alloc_msix; + } + +- err = enetc_of_get_phy(priv); +- if (err) +- dev_warn(&pdev->dev, "Fallback to PHY-less operation\n"); +- + err = enetc_configure_serdes(priv); + if (err) + dev_warn(&pdev->dev, "Attempted serdes config but failed\n"); +@@ -937,7 +942,6 @@ static int enetc_pf_probe(struct pci_dev + return 0; + + err_reg_netdev: +- enetc_of_put_phy(priv); + enetc_free_msix(priv); + err_alloc_msix: + enetc_free_si_resources(priv); +@@ -945,6 +949,7 @@ err_alloc_si_res: + si->ndev = NULL; + free_netdev(ndev); + err_alloc_netdev: ++ enetc_of_put_phy(pf); + err_map_pf_space: + enetc_pci_remove(pdev); + +@@ -967,7 +972,7 @@ static void enetc_pf_remove(struct pci_d + unregister_netdev(si->ndev); + + enetc_mdio_remove(pf); +- enetc_of_put_phy(priv); ++ enetc_of_put_phy(pf); + + enetc_free_msix(priv); + +--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.h ++++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.h +@@ -45,6 +45,9 @@ struct enetc_pf { + + struct mii_bus *mdio; /* saved for cleanup */ + struct mii_bus *imdio; ++ ++ struct device_node *phy_node; ++ phy_interface_t if_mode; + }; + + int enetc_msg_psi_init(struct enetc_pf *pf); -- cgit v1.2.3