D-Link 1565 is one of the few routers which integrates a PLC (Power line Communication) chipset (in this case QCA AR7400). Unfortunately, OpenWrt does not provide support for this feature yet.



This post presents configuration steps to enable PLC support in OpenWrt for this device.

Hardware configuration

Network configuration

$ swconfig dev switch0 show [ ... ] Port 6 : mib: Port 6 MIB counters RxBroad : 2282 Rx64Byte : 2282 RxGoodByte : 146048 Filtered : 2152 [ ... ] enable_eee: ??? pvid: 0 link: port:6 link:up speed:1000baseT full-duplex txflow rxflow [ ... ]

By digging into D-Link GPL source code released for this device, especially functionin file, we notice the port 6 of internal switch AR8327 is related to PLC:This port 6 is configured as a RGMII interface to communicate with PLC chipset. The following patch reproduces the same configuration in OpenWrt:To build a custom firmware image, please see OpenWrt build system wiki page To flash an OpenWrt image, please see OpenWrt flashing wiki page . Don't forget to choose theimage if you're still running the OEM firmware. If you are already using an OpenWrt firmware, you can use theimage.Once our customized OpenWrt image is flashed & booted, we are already able to see PLC bootloader probes with the swconfig command:

The pvid field indicates that the primary VLAN identifier of port 6 is 0. In file /etc/config/network, we add the port 6 to VLAN identifier 2, which is dedicated to WAN interface in default configuration:



config switch_vlan

option device 'switch0'

option vlan '2'

option ports '0t 5 6'

System configuration

open-plc-utils

PATH = $PATH :<OpenWrt-Toolchain-ar71xx>/bin CROSS = mips-openwrt-linux-musl- ROOTFS = <open-plc-utils>/build

Since the PLC chipset is flashless on this board, PLC firmware needs to be loaded at each boot. We can use Qualcomm Atheros Open Powerline Toolkit to manage & configure this PLC chipset.We can cross-compile open-plc-utils with the OpenWrt toolchain First, we setup the following environment variables:

Then, make & make install commands are enough to build it.

Finally, we copy these freshly built binaries to the device in /overlay/upper/open-plc-utils/.



To do a quick test, we can try the Request Information command:



# /overlay/upper/open-plc-utils/amptool -i eth0.2 -Iar

eth0.2 00:B0:52:00:00:01 Request Version Information

eth0.2 00:B0:52:00:00:01 AR7400 BootLoader

eth0.2 00:B0:52:00:00:01 Fetch Device Attributes

eth0.2 00:B0:52:00:00:01 Device Identity