From d0183630eea724979c9583825031a23080ca24d1 Mon Sep 17 00:00:00 2001 From: lean Date: Thu, 31 Mar 2022 16:16:51 +0800 Subject: [PATCH] qca-nss-dp: fix of_get_mac_address --- .../0006-NSS-DP-fix-of_get_mac_address.patch | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 package/qca/nss/qca-nss-dp/patches/0006-NSS-DP-fix-of_get_mac_address.patch diff --git a/package/qca/nss/qca-nss-dp/patches/0006-NSS-DP-fix-of_get_mac_address.patch b/package/qca/nss/qca-nss-dp/patches/0006-NSS-DP-fix-of_get_mac_address.patch new file mode 100644 index 000000000..d4965716d --- /dev/null +++ b/package/qca/nss/qca-nss-dp/patches/0006-NSS-DP-fix-of_get_mac_address.patch @@ -0,0 +1,50 @@ +From cadeb62a42296563141d6954eec58e34ef86778d Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Fri, 13 Aug 2021 20:12:08 +0200 +Subject: [PATCH] NSS-DP: fix of_get_mac_address() + +Recently OpenWrt backported the updated of_get_mac_address() +function which returns and error code instead. + +So, patch the SSDK to use it and fix the compilation error. + +Signed-off-by: Robert Marko +--- + nss_dp_main.c | 13 ++++--------- + 1 file changed, 4 insertions(+), 9 deletions(-) + +diff --git a/nss_dp_main.c b/nss_dp_main.c +index 5580b13..28df280 100644 +--- a/nss_dp_main.c ++++ b/nss_dp_main.c +@@ -434,9 +434,10 @@ static int32_t nss_dp_of_get_pdata(struct device_node *np, + struct net_device *netdev, + struct gmac_hal_platform_data *hal_pdata) + { +- uint8_t *maddr; ++ u8 maddr[ETH_ALEN]; + struct nss_dp_dev *dp_priv; + struct resource memres_devtree = {0}; ++ int ret; + + dp_priv = netdev_priv(netdev); + +@@ -475,14 +476,8 @@ static int32_t nss_dp_of_get_pdata(struct device_node *np, + of_property_read_u32(np, "qcom,forced-speed", &dp_priv->forced_speed); + of_property_read_u32(np, "qcom,forced-duplex", &dp_priv->forced_duplex); + +- maddr = (uint8_t *)of_get_mac_address(np); +-#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 4, 0)) +- if (IS_ERR((void *)maddr)) { +- maddr = NULL; +- } +-#endif +- +- if (maddr && is_valid_ether_addr(maddr)) { ++ ret = of_get_mac_address(np, maddr); ++ if (!ret && is_valid_ether_addr(maddr)) { + ether_addr_copy(netdev->dev_addr, maddr); + } else { + random_ether_addr(netdev->dev_addr); +-- +2.31.1