Support for Mikrotik RB3011UiAS-RM?


#22

For UART, use this patch: https://www.spinics.net/lists/linux-arm-msm/msg27201.html


#23

I can use the same bootloader that I use for 8devices Jalapeno then, I modified it for the company that I work for and its meant to be used for IQP40XX series, so no modifications for that.
Biggest issue is that since there is no dtb available I cant read which pins are used for what.


#24

@adron It looks like RouterBoot on RB450Gx4 does not like either my version of u-boot or GL-Inets, simply says kernel out of range and refuses to boot them


#25

Hello. kernel out of range means incorrect TEXT_BASE address! RouterBOOT checks it in ELF. For RB3011 I changed CONFIG_SYS_TEXT_BASE to 0x41200000 and only after that it began to load.


#26

Do you maybe have a hint on figuring out what is the correct one, I tried 0x41200000 like you did and RouterBoot will load it but after jumping to kernel it will simply reset.
Its most likely because U-boot cant access that adress.


#27

I think 0x41200000 for IPQ-806X and 0x87300000 for IPQ-4XXX.
In a week I will get my RB450Gx4 and check it out. Now I am working on an intermediate bootloader.
In general, the fact that a U-Boot does not display any messages on a screen can be many reasons. For example, incorrect initialization of the UART port and a whole lot more! Need to watch.


#28

Try something like this:

static board_ipq4xxx_params_t *get_board_param(unsigned int machid)
{
	unsigned int index = 0;
	machid = MACH_TYPE_IPQ40XX_AP_DK01_1_S1; //!!!!

on uboot/board/qcom/ipq40xx_cdp/ipq40xx_cdp.c
machids for check:

		.machid = MACH_TYPE_IPQ40XX_AP_DK01_1_S1,
		.machid = MACH_TYPE_IPQ40XX_AP_DK01_1_C1,
		.machid = MACH_TYPE_IPQ40XX_AP_DK01_1_C2,
		.machid = MACH_TYPE_IPQ40XX_AP_DK04_1_C1,
		.machid = MACH_TYPE_IPQ40XX_AP_DK04_1_C4,
		.machid = MACH_TYPE_IPQ40XX_AP_DK04_1_C2,
		.machid = MACH_TYPE_IPQ40XX_AP_DK04_1_C3,
		.machid = MACH_TYPE_IPQ40XX_AP_DK04_1_C5,
		.machid = MACH_TYPE_IPQ40XX_AP_DK05_1_C1,
		.machid = MACH_TYPE_IPQ40XX_AP_DK06_1_C1,
		.machid = MACH_TYPE_IPQ40XX_AP_DK07_1_C1,
		.machid = MACH_TYPE_IPQ40XX_AP_DK07_1_C2,
		.machid = MACH_TYPE_IPQ40XX_DB_DK01_1_C1,
		.machid = MACH_TYPE_IPQ40XX_DB_DK02_1_C1,
		.machid = MACH_TYPE_IPQ40XX_TB832

#29

Hm, I already tried with 0x87300000 as base address and I got kernel is out of range error.

RouterBOOT booter 6.43.11

RB450Gx4

CPU frequency: 716 MHz
  Memory size: 1024 MiB
    NAND size: 512 MiB

Press any key within 2 seconds to enter setup..
writing settings to flash... OK
trying dhcp protocol.................. OK
resolved mac address C4:93:00:0F:30:DA
Gateway: 192.168.1.1
transfer started ... transfer ok, time=0.57s
setting up elf image... kernel out of range
kernel loading failed

Yes, checking machids makes sense as U-boot I was using is meant for a DK04.1 based board while DTB when converted back to DTS indicates that DK01.1 reference design was used.

But U-boot that I am using has all of the reference designs listed in ipq40xx_board_param.h and a for loop is used to check whether the board matches one of those.
Even if wrong board is detected it makes not sense for RouterBoot to refuse booting the image with correct BASE adress


#30

Try to place reset_cpu(0); in a start of get_board_param. I don’t know how to IPQ-4XXX, but for a IPQ-806X, a watch dog reloads the CPU once in a 30 seconds. When the console did not work for me, I use this trick to checked whether the code is being executed or not.


#31

Some progress, with #define CONFIG_SYS_TEXT_BASE 0x80000000
It gets partially booting, it loads U-boot but after couple of seconds it gets reset.

setting up elf image... OK
jumping to kernel code


U-Boot 2012.07-gb997d208a-dirty [local,local] (Feb 10 2019 - 20:24:32)

=====================================
Caraboot v4.2 (IPQ4018) U-boot
http://www.8devices.com/
-------------------------------------
smem ram ptable found: ver: 1 len: 4

#32

Yes, I also had something similar. As a result, the problem turned out to be with relocation and static variables. Try this in uboot/arch/arm/cpu/armv7/start.S:

@@ -188,7 +242,8 @@ stack_setup:
 #ifndef CONFIG_IPQ40XX_XIP
        beq     clear_bss               /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy_loop */
-       ldr     r3, _image_copy_end_ofs
+       @ ldr   r3, _image_copy_end_ofs
+       ldr     r3, _bss_end_ofs @ !!! copy MORE _image + bss(some important static variables!) !!!
        add     r2, r0, r3              /* r2 <- source end address         */
 
 copy_loop:
@@ -255,6 +310,9 @@ clear_bss:
 #else
        ldr     r0, _bss_start_ofs
        ldr     r1, _bss_end_ofs
+       sub r1, r1, #128 @ skip last 128 bytes(important static variables?)
+       @ sub r1, r1, #2048
+       @ sub r1, r1, #1600
        mov     r4, r6                  /* reloc addr */
        add     r0, r0, r4
        add     r1, r1, r4

#33

Unfortunately, it did not help.
It still gets stuck on the same thing and resets.

Did I express my hate for RouterBoot and Mikrotiks locking everything already?


#34

I don't know yet. But I think that we can deal with this problem. The fact that you managed to start an U-Boot is already very good. Next we need to determine where exactly it is stuck.
And my work on creating an intermediate loader is progressing. So soon everything will be easier.


#35

Yes, its most likely stuck either on a weird instruction or trying to init something it should not do.
Issue is that I have worked on U-boot previously but it was only adding recovery UI so I dont know how to debug it.

Loader would be awesome as it would enable use to completely get rid of this U-boot step.


#36

First results of the intermediate bootloader:

RouterBOOT booter 6.43.7

RouterBOARD 3011UiAS

CPU frequency: 1400 MHz
  Memory size: 1024 MiB
    NAND size: 128 MiB

Press any key within 2 seconds to enter setup..
trying bootp protocol.... OK
Got IP address: 172.20.1.54
resolved mac address 0C:54:A5:45:C4:E9
Gateway: 172.20.1.1
transfer started .......................................... transfer ok, time=2.84s
setting up elf image... OK
jumping to kernel code

Copy kernel ... Done
Starting kernel at 42208000 ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.97 (root@adron-nout.yapic.net) (gcc version 7.4.0 (OpenWrt GCC 7.4.0 r9274-ab189
[    0.000000] CPU: ARMv7 Processor [512f04d0] revision 0 (ARMv7), cr=10c5787d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000] OF: fdt: Machine model: Netgear Nighthawk X4 R7500v2
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] random: get_random_bytes called from start_kernel+0x88/0x408 with crng_init=0
[    0.000000] percpu: Embedded 15 pages/cpu @dda03000 s29324 r8192 d23924 u61440
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 121920
[    0.000000] Kernel command line: 
[    0.000000] Bootloader command line not present
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 473300K/491520K available (4753K kernel code, 152K rwdata, 1264K rodata, 4096K init, 228K )
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xde800000 - 0xff800000   ( 528 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xde000000   ( 480 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0208000 - 0xc07a4450   (5746 kB)
[    0.000000]       .init : 0xc0a00000 - 0xc0e00000   (4096 kB)
[    0.000000]       .data : 0xc0e00000 - 0xc0e261c0   ( 153 kB)
[    0.000000]        .bss : 0xc0e28000 - 0xc0e610d8   ( 229 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] clocksource: dg_timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 305801671480 ns
[    0.000007] sched_clock: 32 bits at 6MHz, resolution 160ns, wraps every 343597383600ns
[    0.000020] Switching to timer-based delay loop, resolution 160ns
[    0.000211] Calibrating delay loop (skipped), value calculated using timer frequency.. 12.50 BogoMIPS (lpj=625)
[    0.000237] pid_max: default: 32768 minimum: 301
[    0.000365] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000384] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000960] CPU: Testing write buffer coherency: ok
[    0.001725] Setting up static identity map for 0x42300000 - 0x42300060
[    0.001880] Hierarchical SRCU implementation.
[    0.002617] smp: Bringing up secondary CPUs ...
[    0.004427] smp: Brought up 1 node, 2 CPUs
[    0.004446] SMP: Total of 2 processors activated (25.00 BogoMIPS).
[    0.004457] CPU: All CPU(s) started in SVC mode.
[    0.014009] VFP support v0.3: implementor 51 architecture 64 part 4d variant 2 rev 0
[    0.014161] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.014187] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.014295] pinctrl core: initialized pinctrl subsystem
[    0.015272] NET: Registered protocol family 16
[    0.015527] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.016894] cpuidle: using governor ladder
[    0.016962] cpuidle: using governor menu
[    0.031997] qcom-smem smem: SMEM is not initialized by SBL
[    0.032054] qcom-smem: probe of smem failed with error -22
[    0.037685] msm_bus_fabric_init_driver
[    0.039038] usbcore: registered new interface driver usbfs
[    0.039120] usbcore: registered new interface driver hub
[    0.039205] usbcore: registered new device driver usb
[    0.039267] pps_core: LinuxPPS API ver. 1 registered
[    0.039280] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.039318] PTP clock support registered
[    0.040959] clocksource: Switched to clocksource dg_timer
[    0.044446] NET: Registered protocol family 2
[    0.044948] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[    0.044993] TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
[    0.045046] TCP: Hash tables configured (established 4096 bind 4096)
[    0.045140] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.045169] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.045353] NET: Registered protocol family 1
[    2.841591] No memory allocated for crashlog
[    2.841904] workingset: timestamp_bits=30 max_order=17 bucket_order=0
[    2.848766] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    2.848790] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    2.858844] io scheduler noop registered
[    2.858872] io scheduler deadline registered (default)
[    2.860883] qcom-pcie 1b500000.pci: 1b500000.pci supply vdda not found, using dummy regulator
[    2.861035] qcom-pcie 1b500000.pci: 1b500000.pci supply vdda_phy not found, using dummy regulator
[    2.861175] qcom-pcie 1b500000.pci: 1b500000.pci supply vdda_refclk not found, using dummy regulator
[    2.862374] OF: PCI: host bridge /soc/pci@1b500000 ranges:
[    2.862449] OF: PCI:    IO 0x0fe00000..0x0fefffff -> 0x0fe00000
[    2.862490] OF: PCI:   MEM 0x08000000..0x0fdfffff -> 0x08000000
[    3.894932] qcom-pcie 1b500000.pci: phy link never came up
[    3.896900] qcom-pcie 1b500000.pci: cannot initialize host
[    3.897767] qcom-pcie: probe of 1b500000.pci failed with error -110
[    3.900956] L2 @ QSB rate. Forcing new rate.
[    3.901414] L2 @ 384000 KHz
[    3.901620] CPU0 @ 800000 KHz
[    3.901643] CPU1 @ QSB rate. Forcing new rate.
[    3.901924] CPU1 @ 384000 KHz
[    3.907767] gsbi 1a200000.gsbi: GSBI port protocol: 3 crci: 0
[    3.908805] gsbi 16600000.gsbi: GSBI port protocol: 6 crci: 0
[    3.910395] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    3.911702] msm_serial 16640000.serial: msm_serial: detected port #0
[    3.911854] msm_serial 16640000.serial: uartclk = 7372800
[    3.911975] 16640000.serial: ttyMSM0 at MMIO 0x16640000 (irq = 66, base_baud = 460800) is a MSM
[    3.912031] msm_serial: console setup on port #0
[    4.481983] console [ttyMSM0] enabled
[    4.487066] msm_serial: driver initialized
[    4.498130] loop: module loaded
[    4.500758] nand: device found, Manufacturer ID: 0x98, Chip ID: 0xa1
[    4.500812] nand: Toshiba NAND 128MiB 1,8V 8-bit
[    4.506808] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    4.511542] 9 fixed-partitions partitions found on MTD device qcom_nand.0
[    4.518673] Creating 9 MTD partitions on "qcom_nand.0":
[    4.525641] 0x000000000000-0x000000c80000 : "qcadata"
[    4.539806] random: fast init done
[    4.570225] 0x000000c80000-0x000001180000 : "APPSBL"
[    4.586733] 0x000001180000-0x000001200000 : "APPSBLENV"
[    4.589424] 0x000001200000-0x000001340000 : "art"
[    4.595865] 0x000001340000-0x000001480000 : "artbak"
[    4.600879] 0x000001480000-0x000001880000 : "kernel"
[    4.614413] 0x000001880000-0x000003480000 : "ubi"
[    4.701796] 0x000003480000-0x000007900000 : "netgear"
[    4.913589] 0x000007900000-0x000008000000 : "reserve"
[    4.937388] spi_qup 1a280000.spi: IN:block:16, fifo:64, OUT:block:16, fifo:64
[    4.950316] m25p80 spi0.0: s25fl016k (2048 Kbytes)
[    4.950376] Unable to read flash type from SMEM
[    4.956631] libphy: GPIO Bitbanged MDIO: probed
[    4.996290] switch0: Atheros AR8337 rev. 2 switch registered on gpio-0
[    5.870669] ar8327: qca,phy-rgmii-en is not specified
[    5.871380] libphy: Fixed MDIO Bus: probed
[    5.890299] ipq806x-gmac-dwmac 37200000.ethernet: PTP uses main clock
[    5.890779] stmmac - user ID: 0x10, Synopsys ID: 0x37
[    5.895838] ipq806x-gmac-dwmac 37200000.ethernet: Ring mode enabled
[    5.900776] ipq806x-gmac-dwmac 37200000.ethernet: DMA HW capability register supported
[    5.906944] ipq806x-gmac-dwmac 37200000.ethernet: Enhanced/Alternate descriptors
[    5.914910] ipq806x-gmac-dwmac 37200000.ethernet: Enabled extended descriptors
[    5.922467] ipq806x-gmac-dwmac 37200000.ethernet: RX Checksum Offload Engine supported
[    5.929425] ipq806x-gmac-dwmac 37200000.ethernet: COE Type 2
[    5.937405] ipq806x-gmac-dwmac 37200000.ethernet: TX Checksum insertion supported
[    5.943210] ipq806x-gmac-dwmac 37200000.ethernet: Wake-Up On Lan supported
[    5.950520] ipq806x-gmac-dwmac 37200000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    5.971622] ipq806x-gmac-dwmac 37400000.ethernet: PTP uses main clock
[    5.971966] stmmac - user ID: 0x10, Synopsys ID: 0x37
[    5.977062] ipq806x-gmac-dwmac 37400000.ethernet: Ring mode enabled
[    5.982216] ipq806x-gmac-dwmac 37400000.ethernet: DMA HW capability register supported
[    5.988173] ipq806x-gmac-dwmac 37400000.ethernet: Enhanced/Alternate descriptors
[    5.996257] ipq806x-gmac-dwmac 37400000.ethernet: Enabled extended descriptors
[    6.003797] ipq806x-gmac-dwmac 37400000.ethernet: RX Checksum Offload Engine supported
[    6.010745] ipq806x-gmac-dwmac 37400000.ethernet: COE Type 2
[    6.018720] ipq806x-gmac-dwmac 37400000.ethernet: TX Checksum insertion supported
[    6.024529] ipq806x-gmac-dwmac 37400000.ethernet: Wake-Up On Lan supported
[    6.031936] ipq806x-gmac-dwmac 37400000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    6.039638] i2c /dev entries driver
[    6.048511] Calibration not found.
[    6.050412] qcom-tsens 900000.thermal-sensor: tsens calibration failed
[    6.055616] Speed bin: 0
[    6.060381] PVS bin: 1
[    6.065056] cpuidle: enable-method property 'qcom,kpss-acc-v1' found operations
[    6.065352] cpuidle: enable-method property 'qcom,kpss-acc-v1' found operations
[    6.073234] sdhci: Secure Digital Host Controller Interface driver
[    6.079744] sdhci: Copyright(c) Pierre Ossman
[    6.086068] sdhci-pltfm: SDHCI platform and OF driver helper
[    6.092926] NET: Registered protocol family 10
[    6.098090] Segment Routing with IPv6
[    6.100519] NET: Registered protocol family 17
[    6.104986] 8021q: 802.1Q VLAN Support v1.8
[    6.108528] Registering SWP/SWPB emulation handler
[    6.129570] qcom_rpm 108000.rpm: RPM firmware 3.0.16777342
[    6.144546] s1a: supplied by regulator-dummy
[    6.144690] s1a: Bringing 0uV into 1050000-1050000uV
[    6.148303] s1b: supplied by regulator-dummy
[    6.153013] s1b: Bringing 0uV into 1050000-1050000uV
[    6.157467] s2a: supplied by regulator-dummy
[    6.162211] s2a: Bringing 0uV into 800000-800000uV
[    6.166680] s2b: supplied by regulator-dummy
[    6.170967] s2b: Bringing 0uV into 800000-800000uV
[    6.182835] UBI: auto-attach mtd6
[    6.182884] ubi0: attaching mtd6
[    6.316890] random: crng init done
[    6.675684] ubi0: scanning is finished
[    6.675719] ubi0 error: ubi_read_volume_table: the layout volume was not found
[    6.678387] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd6, error -22
[    6.685603] UBI error: cannot attac�[    6.699663] Freeing unused kernel memory: 4096K
[    6.755857] init: Console is alive
[    6.756217] init: - watchdog -
[    6.770070] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    6.773515] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    6.779598] SCSI subsystem initialized
[    6.787647] ehci-platform: EHCI generic platform driver
[    6.790144] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    6.792140] ohci-platform: OHCI generic platform driver
[    6.929448] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[    6.929528] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
[    6.934233] xhci-hcd xhci-hcd.0.auto: hcc params 0x0228f065 hci version 0x100 quirks 0x0000000002010010
[    6.941567] xhci-hcd xhci-hcd.0.auto: irq 67, io mem 0x11000000
[    6.951530] hub 1-0:1.0: USB hub found
[    6.956689] hub 1-0:1.0: 1 port detected
[    6.960767] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[    6.964639] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
[    6.969862] xhci-hcd xhci-hcd.0.auto: Host supports USB 3.0  SuperSpeed
[    6.977597] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    6.984445] hub 2-0:1.0: USB hub found
[    6.992416] hub 2-0:1.0: 1 port detected
[    6.996155] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[    6.999987] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 3
[    7.005517] xhci-hcd xhci-hcd.1.auto: hcc params 0x0228f065 hci version 0x100 quirks 0x0000000002010010
[    7.012911] xhci-hcd xhci-hcd.1.auto: irq 68, io mem 0x10000000
[    7.022674] hub 3-0:1.0: USB hub found
[    7.028124] hub 3-0:1.0: 1 port detected
[    7.032198] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
[    7.036007] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 4
[    7.041383] xhci-hcd xhci-hcd.1.auto: Host supports USB 3.0  SuperSpeed
[    7.048925] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[    7.055865] hub 4-0:1.0: USB hub found
[    7.063912] hub 4-0:1.0: 1 port detected
[    7.068232] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    7.073571] init: - preinit -
[    8.405603] ipq806x-gmac-dwmac 37400000.ethernet eth1: device MAC address 32:94:08:1c:b8:f1
[    8.405827] Generic PHY fixed-0:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=fixed-0:01, irq=POLL)
[    8.524655] ipq806x-gmac-dwmac 37400000.ethernet: Failed to reset the dma
[    8.524704] ipq806x-gmac-dwmac 37400000.ethernet eth1: stmmac_hw_setup: DMA engine initialization failed
[    8.530442] ipq806x-gmac-dwmac 37400000.ethernet eth1: stmmac_open: Hw setup failed
RTNETLINK answers: Resource busy
sendto(): Network unreachable
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[   11.749198] procd: - early -
[   11.749378] procd: - watchdog -
[   12.394247] procd: - watchdog -
[   12.394452] procd: - ubus -
[   12.449085] procd: - init -
Please press Enter to activate this console.
[   12.562230] kmodloader: loading kernel modules from /etc/modules.d/*
[   12.564119] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   12.571549] Loading modules backported from Linux version v4.19.7-0-g61c68f2a2af0
[   12.572940] Backport generated by backports.git v4.19.7-1-0-g148b072d
[   12.581212] ip_tables: (C) 2000-2006 Netfilter Core Team
[   12.589326] nf_conntrack version 0.5.0 (8192 buckets, 32768 max)
[   12.604630] usbcore: registered new interface driver r8152
[   12.610146] xt_time: kernel timezone is -0000
[   12.623727] PPP generic driver version 2.4.2
[   12.624173] NET: Registered protocol family 24
[   12.634275] kmodloader: done loading kernel modules from /etc/modules.d/*
[   17.299956] Generic PHY fixed-0:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=fixed-0:01, irq=POLL)
[   17.401342] ipq806x-gmac-dwmac 37400000.ethernet: Failed to reset the dma
[   17.401379] ipq806x-gmac-dwmac 37400000.ethernet eth1: stmmac_hw_setup: DMA engine initialization failed
[   17.407125] ipq806x-gmac-dwmac 37400000.ethernet eth1: stmmac_open: Hw setup failed
[   17.422000] stmmac_ethtool_get_link_ksettings: eth1: PHY is not registered
[   17.424066] br-lan: port 1(eth1.1) entered blocking state
[   17.430992] br-lan: port 1(eth1.1) entered disabled state
[   17.436903] device eth1.1 entered promiscuous mode
[   17.443876] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   17.453976] ipq806x-gmac-dwmac 37200000.ethernet eth0: device MAC address 46:34:66:67:d7:64
[   17.454167] Generic PHY fixed-0:00: attached PHY driver [Generic PHY] (mii_bus:phy_addr=fixed-0:00, irq=POLL)
[   17.571364] ipq806x-gmac-dwmac 37200000.ethernet: Failed to reset the dma
[   17.571400] ipq806x-gmac-dwmac 37200000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[   17.577142] ipq806x-gmac-dwmac 37200000.ethernet eth0: stmmac_open: Hw setup failed

Network not working. Apparently because of the lack of smem initialization?


#37

Awesome job, it could easily be SMEM but it also could easily be due to wrong GPIO pins in DTS since it will most definitively be different than R7500v2 that you are using as base.

Is there a lot of platform specific stuff in the loader?
I am really looking forward to getting RB450Gx4 finally booting


#38

The loader with minor modifications should also work on a Rb450Gx4. Tomorrow, if I can, I'll go pick up the Rb450Gx4 from delivery service and try to run on it.


#39

I can test it on mine if you publish the source code and custom image generation needed


#40

After correction of qcom-ipq8064-r7500v2.dts eth0 and switch0 works ok. eth0 appeared gmac0 not gmac1.
But if I try to add mdio1 for eth1, all mdios(mdio0, mdio1) stop working.
Kernel report this error:

[    4.904639] libphy: GPIO Bitbanged MDIO: probed
[    4.908363] mdio_bus gpio-0: MDIO device at address 0 is missing.
[    4.912949] mdio_bus gpio-0: MDIO device at address 4 is missing.

My code for mdio1 is here:

@@ -29,6 +29,7 @@
 	aliases {
 		serial0 = &gsbi7_serial;
 		mdio-gpio0 = &mdio0;
+		mdio-gpio1 = &mdio1;
 	};
 
 	chosen {
@@ -75,6 +76,15 @@
 				};
 			};
 
+			mdio1_pins: mdio1_pins {
+				mux {
+					pins = "gpio10", "gpio11";
+					function = "gpio";
+					drive-strength = <8>;
+					bias-disable;
+				};
+			};
+
 			nand_pins: nand_pins {
 				mux {
 					pins = "gpio34", "gpio35", "gpio36",
@@ -353,6 +363,32 @@
 			};
 		};
 
+		 mdio1: mdio {
+			compatible = "virtual,mdio-gpio";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			gpios = <&qcom_pinmux 11 GPIO_ACTIVE_HIGH &qcom_pinmux 10 GPIO_ACTIVE_HIGH>;
+			pinctrl-0 = <&mdio1_pins>;
+			pinctrl-names = "default";
+
+			phy0: ethernet-phy@0 {
+				reg = <0>;
+				qca,ar8327-initvals = <
+					0x00004 0x7600000   /* PAD0_MODE */
+					0x00008 0x1000000   /* PAD5_MODE */
+					0x0000c 0x80        /* PAD6_MODE */
+					0x000e4 0xaa545     /* MAC_POWER_SEL */
+					0x000e0 0xc74164de  /* SGMII_CTRL */
+					0x0007c 0x4e        /* PORT0_STATUS */
+					0x00094 0x4e        /* PORT6_STATUS */
+					>;
+			};
+
+			phy4: ethernet-phy@4 {
+				reg = <4>;
+			};
+		};
+
 		gmac0: ethernet@37000000 {
 			status = "ok";
 			phy-mode = "rgmii";
@@ -367,6 +403,24 @@
 
 			fixed-link {
 				speed = <1000>;
+				full-duplex;
+			};
+		};
+
+		gmac1: ethernet@37200000 {
+			status = "ok";
+			phy-mode = "rgmii";
+			qcom,id = <1>;
+			qcom,phy_mdio_addr = <0>;
+			qcom,poll_required = <0>;
+			qcom,rgmii_delay = <0>;
+			qcom,emulation = <0>;
+			pinctrl-0 = <&rgmii2_pins>; /* Not sure about this ! */
+			pinctrl-names = "default";
+			mdiobus = <&mdio1>;
+
+			fixed-link {
+				speed = <1000>;
 				full-duplex;
 			};
 		};


#41

Finally I got an RB450Gx4. Mikrotik presumably setup a watchdog for 1 second. I still do not understand how to turn it off.