# FreeBSD on Marvell ARMADA 7040/8040



## SleepWalker (Jun 1, 2022)

Hi All!
Can anyone share their experience using FreeBSD on Marvell ARMADA 7040/8040 boards?
Does Ethernet work on boards like MACCHIATObin
DOUBLE SHOT, SINGLE SHOT, CLEARFOG GT 8K





						ClearFog CN9130 Single Board Computer | Marvell CN9130 SBC | SolidRun
					

Versatile platforms designed for Marvell's CN913x SoCs - tailor-made for powerful networking and edge applications. Click to learn more about ClearFog CN9130.




					www.solid-run.com
				




I have a new MOCHAbin board on A7040.






It's pretty simple and powerful enough to install OPNsense on it. MOCHAbin wiki

But there are several problems, I have not yet been able to make Ethernet and PCIe care.
Here is the dmesg log.





						NYC*BUG dmesgd
					

New York City BSD User Group dmesgd



					dmesgd.nycbug.org
				





Is it possible to get Ethernet to work?


----------



## Phishfry (Jun 1, 2022)

I have noticed that with many Arm boards. Network support comes last.


SleepWalker said:


> PCIe care.


That would require a PCIe bus driver on FreeBSD.
Unfortunately they are not common to all Arm boards.
Each platform needs their own it seems.

I wish we had a PCIe bus driver for iMX6.
Without PCIe slot support it makes my Hummingboards only half usable.
I just bring myself to get Linux running on them.

There is a FreeBSD PCIe Bus driver for Rockchip Rock64Pro/Quartz.
Very jealous.

I see your board has MikoBus. On Hummingboard those are muxxed with GPIO pins.


----------



## SleepWalker (Jun 1, 2022)

The PCIe driver is present on the system and is not working properly.
That's what I see:


```
root@MOCHAbin:~ # pciconf -lvcBb
pcib1@pci0:0:0:0:       class=0x060400 rev=0x00 hdr=0x01 vendor=0x11ab device=0x0110 subvendor=0x0000 subdevice=0x0000
    vendor     = 'Marvell Technology Group Ltd.'
    device     = '88F8040 PCI Express controller'
    class      = bridge
    subclass   = PCI-PCI
    bar   [10] = type Memory, range 64, base 0, size 1048576, enabled
    bus range  = 1-255
    window[1c] = type I/O Port, range 32, addr 0xfffff000-0xfff, disabled
    window[20] = type Memory, range 32, addr 0xfff00000-0xfffff, disabled
    window[24] = type Prefetchable Memory, range 64, addr 0xfffffffffff00000-0xfffff, disabled
    cap 01[40] = powerspec 3  supports D0 D1 D2 D3  current D0
    cap 05[50] = MSI supports 32 messages, 64 bit, vector masks 
    cap 10[70] = PCI-Express 2 root port max data 128(256) RO NS ARI disabled
                 max read 128
                 link x1(x1) speed 2.5(8.0) ASPM disabled(L0s/L1)
    cap 11[b0] = MSI-X supports 1 message
                 Table in map 0x10[0x0], PBA in map 0x18[0x0]
    ecap 0001[100] = AER 2 0 fatal 1 non-fatal 0 corrected
    ecap 0019[158] = PCIe Sec 1 lane errors 0
    ecap 0017[1a8] = TPH Requester 1
    ecap 001e[23c] = L1 PM Substates 1
root@MOCHAbin:~ #
```

But


```
pcib0: <Marvell Armada8K PCI-E Controller> mem 0xf2640000-0xf264ffff,0xf8f00000-0xf8f7ffff irq 25 on simplebus2
pcib0: Cannot get phy[0]
pcib0: Bus is cache-coherent
pcib0: Using iATU legacy mode
pcib0: Detected outbound iATU regions: 8
pci0: <PCI bus> on pcib0
pci0: domain=0, physical bus=0
found-> vendor=0x11ab, dev=0x0110, revid=0x00
        domain=0, bus=0, slot=0, func=0
        class=06-04-00, hdrtype=0x01, mfdev=0
        cmdreg=0x0107, statreg=0x0010, cachelnsz=0 (dwords)
        lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
        intpin=a, irq=255
        powerspec 3  supports D0 D1 D2 D3  current D0
        MSI supports 32 messages, 64 bit, vector masks
        MSI-X supports 1 message in maps 0x10 and 0x18
        map[10]: type Memory, range 64, base 0, size 20, enabled
        secbus=1, subbus=255
pcib1: <PCI-PCI bridge> at device 0.0 on pci0
pcib0: failed to reserve resource for pcib1
pcib1: failed to allocate initial I/O port window: 0-0xfff
pcib0: failed to reserve resource for pcib1
pcib1: failed to allocate initial memory window: 0-0xfffff
pcib0: failed to reserve resource for pcib1
pcib1: failed to allocate initial prefetch window: 0-0xfffff
pcib1:   domain            0
pcib1:   secondary bus     1
pcib1:   subordinate bus   255
pci1: <PCI bus> on pcib1
pcib1: allocated bus range (1-1) for rid 0 of pci1
pci1: domain=0, physical bus=1
```


----------



## Phishfry (Jun 2, 2022)

Does u-boot see anything PCIe? SerDES should show if PCIe is working.
I am talking out my ass. I have no PCIe bus on any Arm board.
I have researched it well.
Here is an example.








						Uboot SERDES configuration for PCIEx4
					

I am trying to create a pcie x4 interface using a standard SERDES map on a Marvell 38x chip in Uboot. However lane verification prevents me from enabling the pcie x4 configuration. The closest exam...




					stackoverflow.com


----------



## Phishfry (Jun 2, 2022)

SleepWalker said:


> pcib0: <Marvell Armada8K PCI-E Controller>


Searching that brought up this:





						PersonalBSD.org » Run FreeBSD on MOCHAbin #1
					

Run FreeBSD on MOCHAbin #1



					personalbsd.org
				



That u-boot is showing real promise:


> EEPROM configuration pattern not detected.
> Comphy chip #0:
> Comphy-0: SGMII1        3.125 Gbps
> Comphy-1: USB3_HOST0
> ...


So Comphy #0 is ethernet and Comphy #4 looks like the 10G.


> Net:   eth0: mvpp2-0 [PRIME], eth1: mvpp2-1, eth2: mvpp2-2



With U-Boot working correctly you are half way there.
Am I citing your website here or is that somebody else?


----------



## Phishfry (Jun 2, 2022)

> mmc0: Failed to set VCCQ for card at relative address 2


Looks like a u-boot env setting.





						250006 – mmc0: Failed to set VCCQ for card at relative address 22964 - bananapi-m1
					






					bugs.freebsd.org


----------



## SleepWalker (Jun 3, 2022)

Phishfry said:


> Searching that brought up this:
> 
> 
> 
> ...


Yes, this is my site!

In fact, everything looks like this.
1. Marvell U-boot is installed in the box in SPI flash and the bootefi command does not work correctly in it (it does not work at all)
The log can be viewed here





						PersonalBSD.org » Run FreeBSD on MOCHAbin #1
					

Run FreeBSD on MOCHAbin #1



					personalbsd.org
				




Therefore, FreeBSD will not start.

2. I compiled EDK2 UEFI BootLoader (not quite clean yet )
It runs FreeBSD from USB or SATA just fine.
The log can be viewed here





						PersonalBSD.org » Run FreeBSD on MOCHAbin #2
					

Run FreeBSD on MOCHAbin #2



					personalbsd.org
				




I think I figured out how to solve the problem with PCIe, you just need to
create correct DTS file for EDK2 UEFI. (where only one PCIe port is enabled).

Thanks for the hints.

It will be more difficult to solve the problem with Ethernet, since there is currently no driver in FreeBSD.
Might have to port from Linux, but I'll check out the NetBSD and OpenBSD source code as well.
If anyone has any ideas or experience of porting from Linux
please let me know (I'm a complete layman in the Linux kernel  )


----------



## Phishfry (Jun 3, 2022)

What about Topaz driver from expressobin? Too different? It is supported on FreeBSD right?


----------



## SleepWalker (Jun 3, 2022)

Phishfry said:


> What about Topaz driver from expressobin? Too different? It is supported on FreeBSD right?


Topaz is an ethernet switch chip that has a driver that will work, but it needs to be an RGMII driver for SoC A7040


----------



## muhammadn (Nov 28, 2022)

SleepWalker According to this diagram:





The OPNsense codebase is quite outdated. The latest release of FreeBSD has more enhancements to support SGMII for Topaz









						freebsd-src/e6000sw.c at main · freebsd/freebsd-src
					

FreeBSD src tree (read-only mirror). Contribute to freebsd/freebsd-src development by creating an account on GitHub.




					github.com
				




and









						freebsd-src/e6000sw.c at main · freebsd/freebsd-src
					

FreeBSD src tree (read-only mirror). Contribute to freebsd/freebsd-src development by creating an account on GitHub.




					github.com
				



There is some things small changes i see that needs to be done. (after reading linux's driver)
I had also been working on Quectel 5G LTE m.2 support (which is simple, thanks to linux's getting early driver support) and E1512.


----------

