Help Adding support for NetComm NF4V

Hello,

I have attempted a few times to install OpenWRT on an old NetComm NF4V that I have lying around and I have never been able to get past flashing it. When launching OpenWRT it will boot fine, but I can't seem to use any of the network devices.

What I have worked out so far is that it's a BCM63268, with a BCM53124 ethernet switch. During boot I get "b53_common: found switch: BCM63xx, rev 0", which I have assumed means that it is connecting correctly, but I honestly don't have the greatest idea on how it all works.

If I insert or remove the ethernet cable from the WAN port I get a notification of "bcm63xx_enetsw.0: link UP on LAN1, 1000Mbps, full-duplex", but none of the LAN ports appear to do anything.

I have read a lot of documentation and been searching through old forum posts but have not been able to find anything that has made a difference.. hoping that someone here could help me out and point me in the right direction?

1 Like

Here is the output of "swconfig list":
Found: switch0 - eth0

Here is the output of "swconfig dev switch0 help"

switch0: eth0(BCM63xx), ports: 9 (cpu @ 8), vlans: 4096
     --switch
        Attribute 1 (int): enable_vlan (Enable VLAN mode)
        Attribute 2 (string): ports (Available Ports (as bitmask))
        Attribute 3 (int): reset_mib (Reset MIB counters)
        Attribute 4 (int): enable_jumbo (Enable Jumbo Frames)
        Attribute 5 (int): allow_vid_4095 (Allow VID 4095)
        Attribute 6 (none): apply (Activate changes in the hardware)
        Attribute 7 (none): reset (Reset the switch)
     --vlan
        Attribute 1 (ports): ports (VLAN port mapping)
     --port
        Attribute 1 (string): mib (Get port's MIB counters)
        Attribute 2 (int): pvid (Primary VLAN ID)
        Attribute 3 (unknown): link (Get port link information)

I can post the full show results, but it seems pretty large. Port 0 and 8 are up, 1, 2, 3, and 4 are down and 5, 6, and 7 don't display anything.

openwrt don't have default network/switch/macaddr/leds configuration for new/unknown devices. But if your SoC fully support configuration with dts-file it seems easy to add new device. It's unclear which image you use (self complied or from another device?). If you compile from source you need at least correct files:

  1. target/linux/brcm63xx/base-files/lib/brcm63xx.sh - board identification (pay attention to "model" property of your dts-file)
  2. target/linux/brcm63xx/base-files/etc/board.d/02_network - network configuration (use board_name from step 1)
  3. target/linux/brcm63xx/base-files/etc/board.d/01_leds - LED configuration (use board_name from step 1 and pay attention to led definition in dts-file)

BTW you can configure network/switch/macaddr/leds from command line by hand but without saving changes in openwrt configurations files /etc/config/{network,system} they lost after reboot.

As example you can configure your switch0 with commands and if i'm not mistaken your device may be accessible from network:

swconfig dev switch0 set reset 1
swconfig dev switch0 set enable_vlan 1
swconfig dev switch0 vlan 1 set ports '1 2 3 4 8t'
swconfig dev switch0 vlan 2 set ports '0 8t'
swconfig dev switch0 set apply 1

But it will be better show output of commands before:

ifconfig -a
cat /etc/config/network

Hey Serge,

Thanks for helping out. I have built my own image by adding a dtsi file, modifing the brcm63xx and the 02_network file. It was mostly guessing based on other commits I saw, so I could have gotten it wrong.

I gave the swconfig commands a go, but no luck still. Communicating through the CFE works fine, but doesn't work from OpenWRT.

Here is the output of ifconfig -a:

root@OpenWrt:/# ifconfig -a
br-lan    Link encap:Ethernet  HWaddr 00:60:64:BB:7D:60  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fd5a:2919:209c::1/60 Scope:Global
          inet6 addr: fe80::260:64ff:febb:7d60/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:2612 (2.5 KiB)

eth0      Link encap:Ethernet  HWaddr 00:60:64:BB:7D:60  
          inet6 addr: fe80::260:64ff:febb:7d60/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:190 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:53280 (52.0 KiB)

eth0.1    Link encap:Ethernet  HWaddr 00:60:64:BB:7D:60  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:2612 (2.5 KiB)

eth0.2    Link encap:Ethernet  HWaddr 00:60:64:BB:7D:60  
          inet6 addr: fe80::260:64ff:febb:7d60/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:149 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:45962 (44.8 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:195 errors:0 dropped:0 overruns:0 frame:0
          TX packets:195 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:13392 (13.0 KiB)  TX bytes:13392 (13.0 KiB)

Here is the config from cat /etc/config/network:

root@OpenWrt:/# cat /etc/config/network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd5a:2919:209c::/48'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth0.1'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'
        option ifname 'eth0.2'
        option proto 'dhcp'

config interface 'wan6'
        option ifname 'eth0.2'
        option proto 'dhcpv6'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 3 8t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '4 8t'

As I understand correctly commands output made after configiration scripts changes? Then one note:

so port 0 is WAN but you put it in vlan 1 which is LAN (/etc/config/network):

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 3 8t'

Exchange ports 0 and 4 between vlans.
Next step - check that switch correctly detect cable connection in lan ports (message in kernel log with ports 1 2 3 4 as for port 0).
Or simply

swconfig dev switch0 port 1 show
swconfig dev switch0 port 2 show

Pay attention to link status and tx/rx statistic. ifconfig show tx traffic for both LAN and WAN interface. Check that these packets reach corresponding switch ports.

And check and try to set switch attributes "ports" and "allow_vid_4095" with swconfig

Ok, so there is some progress here. I wasn't sure if you meant for me to switch 0 and 4 in the /etc/config/network file, swconfig or the 02_network.h, so I tried all of them.

First I tried just swapping them in /etc/config/network:

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '1 2 3 4 8t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '0 8t'

I even tried service network restart, but there was no change and no activity when I used swconfig dev switch0 port 1 show

I then tried running these commands again so that it matched the /etc/config/network file:

swconfig dev switch0 set reset 1
swconfig dev switch0 set enable_vlan 1
swconfig dev switch0 vlan 1 set ports '1 2 3 4 8t'
swconfig dev switch0 vlan 2 set ports '0 8t'
swconfig dev switch0 set apply 1

Finally I switched them in 02_network.h and board_bcrm963xx.c

02_network.h:

netcomm,nf4v)
	ucidef_add_switch "switch0" \
		"0:wan" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "8t@eth0"
	;;

board_bcm963xx.c: (WAN originally had phy_id 4, and LAN1 had phy_id 0)

static struct board_info __initdata board_963168_T132A_9 = {
	.name				= "963168_T132A_9",
	.expected_cpu_id	= 0x63268,

	.has_ehci0			= 1,
	.has_ohci0			= 1,
	.num_usbh_ports		= 2,

	.has_enetsw			= 1,

	.enetsw = {
		.used_ports = {
			[0] = {
				.used	= 1,
				.phy_id	= 0,
				.name	= "WAN",
			},

			[1] = {
				.used	= 1,
				.phy_id	= 1,
				.name	= "LAN1",
			},

			[2] = {
				.used	= 1,
				.phy_id	= 2,
				.name	= "LAN2",
			},

			[3] = {
				.used	= 1,
				.phy_id	= 3,
				.name	= "LAN3",
			},

			[4] = {
				.used	= 1,
				.phy_id	= 4,
				.name	= "LAN4",
			},
		},
	},
};

After building the new image with the above changes I now get this notification when plugging in the cable to port 4:

bcm63xx_enetsw bcm63xx_enetsw.0: link UP on LAN4, 1000Mbps, full-duplex

Although the WAN port no longer shows any activity I can now ping to and from my machine!

As I understand now ports 1-4 (LAN1-LAN4 from switch driver point of view) of switch are working but port 0 (WAN) no linkup/linkdown activity?
You can check ports 5,6,7 of switch. Now they are marked as unused in driver. Correct source of try to use "ports" attribute of switch driver without recompilation. See output of

swconfig dev switch0 get ports

and enable ports 5,6,7. Description of "ports" say that it's bitmask. Now it must be something like if cpu port 8 is included:
binary 100011111 = hex 11f = decimal 287. Change to 111111111 = 1ff = 511
or if cpu port is excluded:
binary 000011111 = hex 1f = decimal 15. Change to 11111111 = ff = 255
Set with commad (as example for last case)

swconfig dev switch0 set ports 255

It's possible that additional command
swconfig dev switch0 set apply 1 is needed to activate corrections.
And check cable connection to WAN port again.

As I understand now ports 1-4 (LAN1-LAN4 from switch driver point of view) of switch are working but port 0 (WAN) no linkup/linkdown activity?

Only port 4 is currently working at the moment, WAN and ports 1-3 are not working.

The bitmask was a good idea, but unfortunately I can't seem to set the value:

root@OpenWrt:/# swconfig dev switch0 set ports 255
Failed to set attribute: Invalid input data or parameter

I have tried to set them in everyway I could think of, including: 255, 511, 0x0ff, 0x1ff, 0x00ff, 0x01ff, 0ff, 1ff, etc. I even tried entering them in as binary to see if it would work, but no matter what I entered I received the same message.

I had a look around on the internet to see where the validation is performed on the input so that I could see what format it should be, but could not find anything. Running the help command, it only says that it's a string:

root@OpenWrt:/# swconfig dev switch0 help
switch0: eth0(BCM63xx), ports: 9 (cpu @ 8), vlans: 4096
     --switch
        Attribute 1 (int): enable_vlan (Enable VLAN mode)
        Attribute 2 (string): ports (Available Ports (as bitmask))
        Attribute 3 (int): reset_mib (Reset MIB counters)
        Attribute 4 (int): enable_jumbo (Enable Jumbo Frames)
        Attribute 5 (int): allow_vid_4095 (Allow VID 4095)
        Attribute 6 (none): apply (Activate changes in the hardware)
        Attribute 7 (none): reset (Reset the switch)
     --vlan
        Attribute 1 (ports): ports (VLAN port mapping)
     --port
        Attribute 1 (string): mib (Get port's MIB counters)
        Attribute 2 (int): pvid (Primary VLAN ID)
        Attribute 3 (unknown): link (Get port link information)

That seemed very promising... any other ideas what might be causing this?

I've also noticed something else strange, is that the LED indicators for ports 1-4 light up when the cable is connected, but only port 4 gives "bcm63xx_enetsw bcm63xx_enetsw.0: link UP on LAN4". That may be done at a hardware level though..

`Curiouser and curiouser!' cried Alice (c)

I look source. This attribute is read only :frowning:so you have to add ports 5-7 in source explicitly.

I think I've got it, I changed the board definition based on your recommendations:

	.enetsw = {
		.used_ports = {
			[0] = {
				.used	= 1,
				.phy_id	= 11,
				.name	= "WAN",
			},

			[4] = {
				.used	= 1,
				.phy_id	= 1,
				.name	= "LAN4",
			},

			[5] = {
				.used	= 1,
				.phy_id	= 2,
				.name	= "LAN3",
			},

			[6] = {
				.used	= 1,
				.phy_id	= 3,
				.name	= "LAN2",
			},

			[7] = {
				.used	= 1,
				.phy_id	= 4,
				.name	= "LAN1",
			},
		},
	},

I now get the correct connection status for all of the LAN ports :slight_smile: Ignore the phy_id of 11 for the WAN port, that was me testing. It was originally 0 and still wouldn't connect.. I now have the opposite of my original problem. I'll continue tinkering..

On a side note, my wireless driver doesn't appear to be working at all. Do you have any idea where I could look for more information on that?

Start with

Oh, that doesn’t sound positive... haha. Won’t get my hopes up then

Can you change your WAN configuration to the following and give it a go?

			[3] = {
				.used	= 1,
				.phy_id	= 4,
				.name	= "WAN",
			},

Which model of router are you working on? I'm working on Sagemcom F@st 3864OP, which has almost identical hardware, the same CPU (63168), and the same external switch (BCM53124S). I'm experiencing the exact opposite problem, where the WAN port is working perfectly (except the LEDs), the LAN port kind of works, but the vlan tagging does not work on any of the LAN ports. My board_bcm963xx.c looks like this:

I used to think that the switch was 53125 (as the boot log suggests), but later I noticed that the switch was 53124. There is an unpopulated SPI Flash footprint on the bottom of my board, I soldered on an SPI Flash (HSSPI) and successfully got access to its content. I probed the HSSPI bus, I could observe the SPI Flash communication in my OpenWRT build, but cannot observe any communication when using the stock firmware. This can prove that the external switch IC has nothing to do with HSSPI, otherwise there has to be some activity going on when the stock firmware boots. In the you can see that the bootloader CFE configures and disables the external switch before boots the Linux kernel, it has to be performed on another bus/interface, other than SPI.

In the board_bcm963xx.c, I specified .has_pci = 1,, so my lspci showed the root node, but none of the attached devices was identified. The stock firmware does not have lspci, but I can see in /sys that there must be something attached to the PCIE bus. Later I noticed that my OpenWRT build could not assign memory range to PCIE correctly, check out this:

I have no idea how to fix that.