qca-nss-gmac: fixes nvmem patches

This commit is contained in:
AmadeusGhost 2022-03-31 23:12:25 +08:00
parent f5a661247d
commit 3186d2e169
3 changed files with 21 additions and 30 deletions

View File

@ -2,10 +2,10 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=qca-nss-gmac PKG_NAME:=qca-nss-gmac
PKG_RELEASE:=3 PKG_RELEASE:=1
PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/nss-gmac
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/nss-gmac
PKG_SOURCE_VERSION:=9b74deef2816d91e58926e6fab7a6ff931eb3b22 PKG_SOURCE_VERSION:=9b74deef2816d91e58926e6fab7a6ff931eb3b22
PKG_MIRROR_HASH:=a1939caa638414323e60f7d29f797ea831c6036e424b8e7bd6cf2d3d874de064 PKG_MIRROR_HASH:=a1939caa638414323e60f7d29f797ea831c6036e424b8e7bd6cf2d3d874de064
@ -15,7 +15,7 @@ define KernelPackage/qca-nss-gmac
SECTION:=kernel SECTION:=kernel
CATEGORY:=Kernel modules CATEGORY:=Kernel modules
SUBMENU:=Network Devices SUBMENU:=Network Devices
DEPENDS:=@TARGET_ipq806x||TARGET_ipq_ipq806x @LINUX_5_4 DEPENDS:=@TARGET_ipq806x @LINUX_5_4
TITLE:=Kernel driver for NSS gmac TITLE:=Kernel driver for NSS gmac
FILES:=$(PKG_BUILD_DIR)/ipq806x/qca-nss-gmac.ko FILES:=$(PKG_BUILD_DIR)/ipq806x/qca-nss-gmac.ko
AUTOLOAD:=$(call AutoLoad,31,qca-nss-gmac) AUTOLOAD:=$(call AutoLoad,31,qca-nss-gmac)

View File

@ -1,11 +1,25 @@
--- a/ipq806x/nss_gmac_ctrl.c --- a/ipq806x/nss_gmac_ctrl.c
+++ b/ipq806x/nss_gmac_ctrl.c +++ b/ipq806x/nss_gmac_ctrl.c
@@ -992,7 +992,7 @@ static int32_t nss_gmac_of_get_pdata(str @@ -957,7 +957,8 @@ static int32_t nss_gmac_of_get_pdata(struct device_node *np,
struct net_device *netdev,
struct msm_nss_gmac_platform_data *gmaccfg)
{
- uint8_t *maddr = NULL;
+ int ret;
+ u8 maddr[ETH_ALEN];
struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev);
struct resource memres_devtree = {0};
@@ -991,9 +992,9 @@ static int32_t nss_gmac_of_get_pdata(struct device_node *np,
pr_err("%s: Can't map interrupt\n", np->name);
return -EFAULT; return -EFAULT;
} }
maddr = (uint8_t *)of_get_mac_address(np); - maddr = (uint8_t *)of_get_mac_address(np);
- if (maddr) - if (maddr)
+ if (!IS_ERR_OR_NULL(maddr)) - memcpy(gmaccfg->mac_addr, maddr, ETH_ALEN);
memcpy(gmaccfg->mac_addr, maddr, ETH_ALEN); + ret = of_get_mac_address(np, maddr);
+ if (!ret && is_valid_ether_addr(maddr))
+ ether_addr_copy(gmaccfg->mac_addr, maddr);
if (of_address_to_resource(np, 0, &memres_devtree) != 0) if (of_address_to_resource(np, 0, &memres_devtree) != 0)
return -EFAULT;

View File

@ -1,23 +0,0 @@
--- a/ipq806x/nss_gmac_ctrl.c
+++ b/ipq806x/nss_gmac_ctrl.c
@@ -957,7 +957,6 @@
struct net_device *netdev,
struct msm_nss_gmac_platform_data *gmaccfg)
{
- uint8_t *maddr = NULL;
struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev);
struct resource memres_devtree = {0};
@@ -991,9 +990,8 @@
pr_err("%s: Can't map interrupt\n", np->name);
return -EFAULT;
}
- maddr = (uint8_t *)of_get_mac_address(np);
- if (!IS_ERR_OR_NULL(maddr))
- memcpy(gmaccfg->mac_addr, maddr, ETH_ALEN);
+
+ of_get_mac_address(np, gmaccfg->mac_addr);
if (of_address_to_resource(np, 0, &memres_devtree) != 0)
return -EFAULT;