[openwrt/openwrt] ltq-ptm: add NVMEM MAC support for ADSL
LEDE Commits
lede-commits at lists.infradead.org
Tue Sep 23 14:26:10 PDT 2025
hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/fa442c50102a016f46af0114ad9fbb7ff331c69c
commit fa442c50102a016f46af0114ad9fbb7ff331c69c
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Wed Aug 27 17:21:44 2025 -0700
ltq-ptm: add NVMEM MAC support for ADSL
fcc48204d2 added support for VDSL. This is the same commit but for ADSL.
Signed-off-by: Rosen Penev <rosenp at gmail.com>
Link: https://github.com/openwrt/openwrt/pull/19910
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
package/kernel/lantiq/ltq-ptm/Makefile | 2 +-
.../kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c | 32 +++++++++++++++-------
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/package/kernel/lantiq/ltq-ptm/Makefile b/package/kernel/lantiq/ltq-ptm/Makefile
index f4d5f766c7..5fffe6dfe7 100644
--- a/package/kernel/lantiq/ltq-ptm/Makefile
+++ b/package/kernel/lantiq/ltq-ptm/Makefile
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ltq-ptm
-PKG_RELEASE:=5
+PKG_RELEASE:=6
PKG_MAINTAINER:=John Crispin <john at phrozen.org>
PKG_LICENSE:=GPL-2.0+
diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
index 23460501e1..944c941d8b 100644
--- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
+++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
@@ -46,6 +46,7 @@
#include <linux/netdevice.h>
#include <linux/platform_device.h>
#include <linux/of_device.h>
+#include <linux/of_net.h>
#include <asm/io.h>
/*
@@ -119,7 +120,7 @@ MODULE_PARM_DESC(eth_efmtc_crc_cfg, "Configuration for PTM TX/RX ethernet/efm-tc
/*
* Network Operations
*/
-static void ptm_setup(struct net_device *, int);
+static int ptm_setup(struct device_node *np, struct net_device *, int);
static struct net_device_stats *ptm_get_stats(struct net_device *);
static int ptm_open(struct net_device *);
static int ptm_stop(struct net_device *);
@@ -275,9 +276,10 @@ static int g_showtime = 0;
* ####################################
*/
-static void ptm_setup(struct net_device *dev, int ndev)
+static int ptm_setup(struct device_node *np, struct net_device *dev, int ndev)
{
u8 addr[ETH_ALEN];
+ int err;
#if defined(CONFIG_IFXMIPS_DSL_CPE_MEI) || defined(CONFIG_IFXMIPS_DSL_CPE_MEI_MODULE)
netif_carrier_off(dev);
@@ -294,13 +296,20 @@ static void ptm_setup(struct net_device *dev, int ndev)
#endif
dev->watchdog_timeo = ETH_WATCHDOG_TIMEOUT;
- addr[0] = 0x00;
- addr[1] = 0x20;
- addr[2] = 0xda;
- addr[3] = 0x86;
- addr[4] = 0x23;
- addr[5] = 0x75 + ndev;
- eth_hw_addr_set(dev, addr);
+ err = of_get_ethdev_address(np, dev);
+ if (err == -EPROBE_DEFER)
+ return err;
+ if (err) {
+ addr[0] = 0x00;
+ addr[1] = 0x20;
+ addr[2] = 0xda;
+ addr[3] = 0x86;
+ addr[4] = 0x23;
+ addr[5] = 0x75 + ndev;
+ eth_hw_addr_set(dev, addr);
+ }
+
+ return 0;
}
static struct net_device_stats *ptm_get_stats(struct net_device *dev)
@@ -1463,6 +1472,7 @@ static int ltq_ptm_probe(struct platform_device *pdev)
{
int ret;
struct port_cell_info port_cell = {0};
+ struct device_node *np = pdev->dev.of_node;
void *xdata_addr = NULL;
int i;
char ver_str[256];
@@ -1482,7 +1492,9 @@ static int ltq_ptm_probe(struct platform_device *pdev)
g_net_dev[i] = alloc_netdev(0, g_net_dev_name[i], NET_NAME_UNKNOWN, ether_setup);
if ( g_net_dev[i] == NULL )
goto ALLOC_NETDEV_FAIL;
- ptm_setup(g_net_dev[i], i);
+ ret = ptm_setup(np, g_net_dev[i], i);
+ if (ret == -EPROBE_DEFER)
+ goto ALLOC_NETDEV_FAIL;
}
for ( i = 0; i < ARRAY_SIZE(g_net_dev); i++ ) {
More information about the lede-commits
mailing list