m4xell
Posts: 13
Joined: Mon Jan 18, 2016 1:59 pm

U-boot compilation on CM4

Tue Jun 29, 2021 9:05 am

I have a problem with u-boot compilation on compute module 4. I clone the source from git://git.denx.de/u-boot.git and compile it. I'm using config rpi_4_32b_defconfig. Everything compiling ok, but after run the device by this u-boot the system is stuck and show this message

2.784587] mmc0: ADMA error: 0x02000000
[ 2.788727] mmc0: error -5 whilst initialising MMC card
[ 2.897754] mmc0: ADMA error: 0x02000000
[ 2.903871] mmc0: error -5 whilst initialising MMC card
[ 3.009424] mmc0: ADMA error: 0x02000000
[ 3.013484] mmc0: error -5 whilst initialising MMC card

How can I fix it?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5607
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: U-boot compilation on CM4

Tue Jun 29, 2021 9:11 am

Someone here might be able to answer your question (I can't - we don't actively support U-boot), but they'll probably want to know whether your U-boot configuration is passing on the DTB/FDT provided by the firmware or using one of its own.

m4xell
Posts: 13
Joined: Mon Jan 18, 2016 1:59 pm

Re: U-boot compilation on CM4

Tue Jun 29, 2021 9:17 am

What do you mean DTB/FDT? Are you talking about device tree? I want to use the same like normal kernel use it. Is it possible?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5607
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: U-boot compilation on CM4

Tue Jun 29, 2021 10:38 am

Yes DTB and FDT refers to the Device Tree file. It is possible to make the kernel use the DT passed to U-boot by the firmware - you may already have done that. Post the contents of your "boot.scr" file - use the "</>" button to add code tags that will make it easier to read.

m4xell
Posts: 13
Joined: Mon Jan 18, 2016 1:59 pm

Re: U-boot compilation on CM4

Tue Jun 29, 2021 10:49 am

Yes, I have this.

Code: Select all

fatload mmc 0 ${kernel_addr_r} zImage
fatload mmc 0 ${fdt_addr_r} bcm2710-rpi-cm3.dtb
setenv bootargs dwc_otg.lpm_enable=0 earlyprintk console=ttyAMA0,115200 console=tty1 smsc95xx.macaddr=<MAC_ADDRESS> root=/dev/mmcblk0p2 rootfstype=ext4 rootwait noinitrd elevator=deadline bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080 coherent_pool=1M
bootz ${kernel_addr_r} - ${fdt_addr_r}

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5607
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: U-boot compilation on CM4

Tue Jun 29, 2021 2:03 pm

I think you can understand that these two lines are a problem on CM4:

Code: Select all

fatload mmc 0 ${fdt_addr_r} bcm2710-rpi-cm3.dtb
bootz ${kernel_addr_r} - ${fdt_addr_r}
The first load the DTB for a CM3(!). The second launches the kernel, passing in the address of the loaded DTB.

Fortunately a current U-boot already inherits the DTB from the firmware, putting its address in ${fdt_addr}. This means you don't need the first line, and the second line becomes:

Code: Select all

bootz ${kernel_addr_r} - ${fdt_addr}
The end result is something like this:

Code: Select all

fatload mmc 0 ${kernel_addr_r} zImage
setenv bootargs dwc_otg.lpm_enable=0 earlyprintk console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait noinitrd elevator=deadline coherent_pool=1M
bootz ${kernel_addr_r} - ${fdt_addr}
(I've removed some of the unneeded command line options)

m4xell
Posts: 13
Joined: Mon Jan 18, 2016 1:59 pm

Re: U-boot compilation on CM4

Wed Jun 30, 2021 8:11 am

Sorry, I paste wrong, of course it was bcm2711-rpi-cm4.dtb, not bcm2710-rpi-cm3.dtb
About remove the line with loading device-tree, after this, my device is stuck.

Code: Select all

ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree
To better understand, my system is booting but just stuck when try to read eMMC, it looks that it want to read SD card which is not exist because we have eMMC.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5607
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: U-boot compilation on CM4

Wed Jun 30, 2021 8:46 am

DId you also change the ${fdt_addr_r} to ${fdt_addr}? Without that it won't work.
my system is booting but just stuck when try to read eMMC, it looks that it want to read SD card which is not exist because we have eMMC.
I understand that, but the kernel always looks for MMC and SD at run time - it can understand both, so there is no need to tell it which you have.

m4xell
Posts: 13
Joined: Mon Jan 18, 2016 1:59 pm

Re: U-boot compilation on CM4

Mon Jul 05, 2021 9:57 am

Hello,

I checked with "r" and without and still same.

Code: Select all

fatload mmc 0 ${kernel_addr_r} zImage
fatload mmc 0 ${fdt_addr} bcm2711-rpi-cm4.dtb
setenv bootargs dwc_otg.lpm_enable=0 earlyprintk console=ttyAMA0,115200 console=tty1 smsc95xx.macaddr=<MAC_ADDRESS> root=/dev/mmcblk0p2 rootfstype=ext4 rootwait noinitrd elevator=deadline bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080 coherent_pool=1M
bootz ${kernel_addr_r} - ${fdt_addr}
Once again, u-boot can run the kernel, but after few second just appear message about MMC card error. The same uboot working good on CM3.

Code: Select all

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.4.81-v7l+ (root@xxx-VirtualBox) (gcc version 4.8.3 20140106 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2014.01 - Linaro GCC 2013.11)) #50 SMP Wed May 5 16:10:48 CEST 2021
[    0.000000] CPU: ARMv7 Processor [410fd083] revision 3 (ARMv7), cr=30c5383d
[    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: Raspberry Pi Compute Module 4
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] Reserved memory: created CMA memory pool at 0x000000002ac00000, size 64 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] percpu: Embedded 20 pages/cpu s49920 r8192 d23808 u81920
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 502528
[    0.000000] Kernel command line: dwc_otg.lpm_enable=0 earlyprintk console=ttyAMA0,115200 console=tty1 smsc95xx.macaddr=00:00:00:00:00:01 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait noinitrd elevator=deadline bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080 coherent_pool=1M
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] software IO TLB: mapped [mem 0x25400000-0x29400000] (64MB)
[    0.000000] Memory: 1844776K/2019328K available (10240K kernel code, 739K rwdata, 2816K rodata, 2048K init, 858K bss, 109016K reserved, 65536K cma-reserved, 1232896K highmem)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] ftrace: allocating 31148 entries in 61 pages
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] random: get_random_bytes called from start_kernel+0x2f8/0x51c with crng_init=0
[    0.000008] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483647500ns
[    0.000031] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
[    0.000113] bcm2835: system timer (irq = 17)
[    0.000809] arch_timer: cp15 timer(s) running at 54.00MHz (phys).
[    0.000829] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xc743ce346, max_idle_ns: 440795203123 ns
[    0.000849] sched_clock: 56 bits at 54MHz, resolution 18ns, wraps every 4398046511102ns
[    0.000865] Switching to timer-based delay loop, resolution 18ns
[    0.001102] Console: colour dummy device 80x30
[    0.001593] printk: console [tty1] enabled
[    0.001656] Calibrating delay loop (skipped), value calculated using timer frequency.. 108.00 BogoMIPS (lpj=540000)
[    0.001697] pid_max: default: 32768 minimum: 301
[    0.001854] LSM: Security Framework initializing
[    0.002053] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.002093] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.003309] Disabling memory control group subsystem
[    0.003449] CPU: Testing write buffer coherency: ok
[    0.003938] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.004786] Setting up static identity map for 0x200000 - 0x20003c
[    0.004987] rcu: Hierarchical SRCU implementation.
[    0.005636] smp: Bringing up secondary CPUs ...
[    0.006767] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.008026] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.009231] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.009377] smp: Brought up 1 node, 4 CPUs
[    0.009445] SMP: Total of 4 processors activated (432.00 BogoMIPS).
[    0.009470] CPU: All CPU(s) started in HYP mode.
[    0.009493] CPU: Virtualization extensions available.
[    0.010279] devtmpfs: initialized
[    0.023852] VFP support v0.3: implementor 41 architecture 3 part 40 variant 8 rev 0
[    0.024123] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.024170] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.026566] pinctrl core: initialized pinctrl subsystem
[    0.027527] NET: Registered protocol family 16
[    0.031051] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[    0.031654] audit: initializing netlink subsys (disabled)
[    0.031910] audit: type=2000 audit(0.030:1): state=initialized audit_enabled=0 res=1
[    0.032876] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.032909] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.033247] Serial: AMBA PL011 UART driver
[    0.036458] bcm2835-mbox fe00b880.mailbox: mailbox enabled
[    0.060861] raspberrypi-firmware soc:firmware: Attached to firmware from 2021-03-26 16:33, variant start
[    0.070876] raspberrypi-firmware soc:firmware: Firmware hash is edf2e9c318863999c97c50cdb74eee235ede3af5
[    0.124573] bcm2835-dma fe007000.dma: DMA legacy API manager, dmachans=0x1
[    0.129283] vgaarb: loaded
[    0.129757] SCSI subsystem initialized
[    0.129994] usbcore: registered new interface driver usbfs
[    0.130066] usbcore: registered new interface driver hub
[    0.130193] usbcore: registered new device driver usb
[    0.130513] usb_phy_generic phy: phy supply vcc not found, using dummy regulator
[    0.132240] clocksource: Switched to clocksource arch_sys_counter
[    0.890369] VFS: Disk quotas dquot_6.6.0
[    0.890480] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.890685] FS-Cache: Loaded
[    0.890899] CacheFiles: Loaded
[    0.900824] thermal_sys: Registered thermal governor 'step_wise'
[    0.901164] NET: Registered protocol family 2
[    0.901913] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.901965] TCP established hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.902058] TCP bind hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.902146] TCP: Hash tables configured (established 8192 bind 8192)
[    0.902487] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.902537] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.902795] NET: Registered protocol family 1
[    0.903518] RPC: Registered named UNIX socket transport module.
[    0.903547] RPC: Registered udp transport module.
[    0.903570] RPC: Registered tcp transport module.
[    0.903594] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.903627] PCI: CLS 0 bytes, default 64
[    0.905319] hw perfevents: enabled with armv7_cortex_a15 PMU driver, 7 counters available
[    0.907462] Initialise system trusted keyrings
[    0.907687] workingset: timestamp_bits=14 max_order=19 bucket_order=5
[    0.918546] FS-Cache: Netfs 'nfs' registered for caching
[    0.919240] NFS: Registering the id_resolver key type
[    0.919308] Key type id_resolver registered
[    0.919333] Key type id_legacy registered
[    0.919366] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.920488] Key type asymmetric registered
[    0.920516] Asymmetric key parser 'x509' registered
[    0.920702] bounce: pool size: 64 pages
[    0.920763] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[    0.920990] io scheduler mq-deadline registered
[    0.921016] io scheduler kyber registered
[    0.924910] GPIO line 507 (ant1) hogged as output/high
[    0.926281] GPIO line 511 (ant2) hogged as output/low
[    0.927406] brcm-pcie fd500000.pcie: host bridge /scb/pcie@7d500000 ranges:
[    0.927446] brcm-pcie fd500000.pcie:   No bus range found for /scb/pcie@7d500000, using [bus 00-ff]
[    0.927530] brcm-pcie fd500000.pcie:      MEM 0x0600000000..0x0603ffffff -> 0x00f8000000
[    0.927613] brcm-pcie fd500000.pcie:   IB MEM 0x0000000000..0x00bfffffff -> 0x0000000000
[    1.522269] brcm-pcie fd500000.pcie: link down
[    1.522706] bcm2708_fb soc:fb: Unable to determine number of FBs. Disabling driver.
[    1.522749] bcm2708_fb: probe of soc:fb failed with error -2
[    1.526425] Serial: 8250/16550 driver, 1 ports, IRQ sharing enabled
[    1.529285] iproc-rng200 fe104000.rng: hwrng registered
[    1.529625] vc-mem: phys_addr:0x00000000 mem_base=0x00000000 mem_size:0x00000000(0 MiB)
[    1.530298] vc-sm: Videocore shared memory driver
[    1.530839] gpiomem-bcm2835 fe200000.gpiomem: Initialised: Registers at 0xfe200000
[    1.542558] brd: module loaded
[    1.554446] loop: module loaded
[    1.555806] Loading iSCSI transport class v2.0-870.
[    1.557743] libphy: Fixed MDIO Bus: probed
[    1.558355] bcmgenet fd580000.ethernet: failed to get enet clock
[    1.558389] bcmgenet fd580000.ethernet: GENET 5.0 EPHY: 0x0000
[    1.558423] bcmgenet fd580000.ethernet: failed to get enet-wol clock
[    1.558457] bcmgenet fd580000.ethernet: failed to get enet-eee clock
[    1.558497] bcmgenet: Skipping UMAC reset
[    1.572277] libphy: bcmgenet MII bus: probed
[    1.592314] mdio_bus unimac-mdio--19: MDIO device at address 1 is missing.
[    1.592347] unimac-mdio unimac-mdio.-19: Broadcom UniMAC MDIO bus
[    1.593348] usbcore: registered new interface driver r8152
[    1.593428] usbcore: registered new interface driver lan78xx
[    1.593499] usbcore: registered new interface driver smsc95xx
[    1.593999] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    1.594792] usbcore: registered new interface driver uas
[    1.594868] usbcore: registered new interface driver usb-storage
[    1.595082] mousedev: PS/2 mouse device common for all mice
[    1.596853] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[    1.600118] sdhci: Secure Digital Host Controller Interface driver
[    1.600147] sdhci: Copyright(c) Pierre Ossman
[    1.600742] mmc-bcm2835 fe300000.mmcnr: could not get clk, deferring probe
[    1.601333] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.605099] ledtrig-cpu: registered to indicate activity on CPUs
[    1.605411] hidraw: raw HID events driver (C) Jiri Kosina
[    1.605603] usbcore: registered new interface driver usbhid
[    1.605629] usbhid: USB HID core driver
[    1.606660] vchiq: vchiq_init_state: slot_zero = (ptrval)
[    1.608196] [vc_sm_connected_init]: start
[    1.614294] [vc_sm_connected_init]: end - returning 0
[    1.616122] Initializing XFRM netlink socket
[    1.616172] NET: Registered protocol family 17
[    1.616286] Key type dns_resolver registered
[    1.616566] Registering SWP/SWPB emulation handler
[    1.616895] registered taskstats version 1
[    1.616927] Loading compiled-in X.509 certificates
[    1.617436] Key type ._fscrypt registered
[    1.617463] Key type .fscrypt registered
[    1.627807] uart-pl011 fe201000.serial: cts_event_workaround enabled
[    1.627895] fe201000.serial: ttyAMA0 at MMIO 0xfe201000 (irq = 29, base_baud = 0) is a PL011 rev2
[    2.608756] printk: console [ttyAMA0] enabled
[    2.619499] fe215040.serial: ttyS0 at MMIO 0x0 (irq = 32, base_baud = 62500000) is a 16550
[    2.628498] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver
[    2.636658] mmc-bcm2835 fe300000.mmcnr: mmc_debug:0 mmc_debug2:0
[    2.642710] mmc-bcm2835 fe300000.mmcnr: DMA channel allocated
[    2.718415] mmc0: SDHCI controller on fe340000.emmc2 [fe340000.emmc2] using ADMA
[    2.728750] of_cfs_init
[    2.731438] of_cfs_init: OK
[    2.785046] mmc0: ADMA error: 0x02000000
[    2.789187] mmc0: error -5 whilst initialising MMC card
[    2.898239] mmc0: ADMA error: 0x02000000
[    2.904356] mmc0: error -5 whilst initialising MMC card
[    3.009905] mmc0: ADMA error: 0x02000000
[    3.013965] mmc0: error -5 whilst initialising MMC card
[   13.341754] mmc0: ADMA error: 0x02000000
[   13.345871] mmc0: error -5 whilst initialising MMC card
[   14.478785] mmc0: ADMA error: 0x02000000
[   14.482809] mmc0: error -5 whilst initialising MMC card
[   14.563186] random: fast init done
[   14.582762] mmc0: ADMA error: 0x02000000
[   14.586798] mmc0: error -5 whilst initialising MMC card
[   14.688769] mmc0: ADMA error: 0x02000000
[   14.692823] mmc0: error -5 whilst initialising MMC card
[   14.811931] mmc0: ADMA error: 0x02000000
Best Regards
--

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5607
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: U-boot compilation on CM4

Mon Jul 05, 2021 10:09 am

You didn't read carefully enough - you shouldn't need to fatload the DTB:

Code: Select all

fatload mmc 0 ${kernel_addr_r} zImage
setenv bootargs dwc_otg.lpm_enable=0 earlyprintk console=ttyAMA0,115200 console=tty1 smsc95xx.macaddr=<MAC_ADDRESS> root=/dev/mmcblk0p2 rootfstype=ext4 rootwait noinitrd elevator=deadline bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080 coherent_pool=1M
bootz ${kernel_addr_r} - ${fdt_addr}

m4xell
Posts: 13
Joined: Mon Jan 18, 2016 1:59 pm

Re: U-boot compilation on CM4

Mon Jul 05, 2021 10:19 am

I read, but after change boot.scr like you want, the u-boot just stop, i wrote you this.
In other hand is that I want to have my own device-tree.

Code: Select all

Hit any key to stop autoboot:  2 switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
6045104 bytes read in 346 ms (16.7 MiB/s)
Kernel image @ 0x080000 [ 0x000000 - 0x5c3db0 ]
ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree
SCRIPT FAILED: continuing...

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5607
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: U-boot compilation on CM4

Mon Jul 05, 2021 12:30 pm

Sorry - I can't help you.

m4xell
Posts: 13
Joined: Mon Jan 18, 2016 1:59 pm

Re: U-boot compilation on CM4

Wed Jul 14, 2021 8:17 am

any tips?

Praveenmuthusamy
Posts: 2
Joined: Tue Aug 10, 2021 6:17 pm

Re: U-boot compilation on CM4

Tue Aug 10, 2021 6:30 pm

I am facing same issue, starting the kernel with the dtb loaded by the first-stage bootloader works fine, starting the kernel with the manually loaded dtb (in essence the same dtb) fails with below error.

[ 2.865803] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[ 2.879319] ALSA device list:
[ 2.882350] No soundcards found.
[ 2.886588] Waiting for root device /dev/mmcblk0p2...
[ 2.888825] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[ 2.898963] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[ 2.927761] mmc0: ADMA error: 0x02000000
[ 2.931872] mmc0: error -5 whilst initialising MMC card

Any help/suggestions to resolve this issue?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5607
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: U-boot compilation on CM4

Wed Aug 11, 2021 2:36 pm

I think the problem is that the CM4, like newer Pi 4s, has a BCM2711C0. They differ in that the EMMC2 interface is on the ARM (not VPU) memory bus, so the (dma-)ranges property is different. The firmware takes care of the changes, but by bypassing it you miss out.

parthitce
Posts: 2
Joined: Wed Aug 11, 2021 8:37 am

Re: U-boot compilation on CM4

Sun Sep 05, 2021 8:29 pm

PhilE wrote:
Wed Aug 11, 2021 2:36 pm
I think the problem is that the CM4, like newer Pi 4s, has a BCM2711C0. They differ in that the EMMC2 interface is on the ARM (not VPU) memory bus, so the (dma-)ranges property is different. The firmware takes care of the changes, but by bypassing it you miss out.
Many thanks, you are right. Able to boot after changing the dma-range for emmc2bus node.

Modified the dma-range as below

Code: Select all

dma-ranges = <0x00000000 0x00000000 0x00000000 0x00000000 0xfc000000>;
Last edited by parthitce on Sun Sep 05, 2021 9:17 pm, edited 1 time in total.

lePereT
Posts: 1
Joined: Thu May 06, 2021 2:04 pm

Re: U-boot compilation on CM4

Sun Sep 26, 2021 3:20 pm

@parthitce where exactly did you change the dma-ranges property? in the dt node below?

Code: Select all

	emmc2bus: emmc2bus {
		compatible = "simple-bus";
		#address-cells = <2>;
		#size-cells = <1>;

		ranges = <0x0 0x7e000000  0x0 0xfe000000  0x01800000>;
		dma-ranges = <0x0 0xc0000000  0x0 0x00000000  0x40000000>;

		emmc2: mmc@7e340000 {
			compatible = "brcm,bcm2711-emmc2";
			reg = <0x0 0x7e340000 0x100>;
			interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&clocks BCM2711_CLOCK_EMMC2>;
			status = "disabled";
		};
	};
parthitce wrote:
Sun Sep 05, 2021 8:29 pm
...
Modified the dma-range as below

Code: Select all

dma-ranges = <0x00000000 0x00000000 0x00000000 0x00000000 0xfc000000>;

parthitce
Posts: 2
Joined: Wed Aug 11, 2021 8:37 am

Re: U-boot compilation on CM4

Sun Sep 26, 2021 8:00 pm

Yes. Am developing custom device tree based on CM4 for my custom board. So I did add

Code: Select all

&emmc2bus {
       dma-ranges = <0x0 0x0 0x0 0x0 0xfc000000>;
};
to make it work.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5607
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: U-boot compilation on CM4

Sun Sep 26, 2021 8:00 pm

Yes - that's the one.

coolvibes
Posts: 3
Joined: Tue Oct 12, 2021 1:23 am

Re: U-boot compilation on CM4

Tue Oct 12, 2021 1:35 am

This also worked for me, however I have lost my PHY when I use anything but the boot blob fallback dtb.
Any Idea where to start looking in the device tree. thanks in advance.
I am using nixos.
This config enables the usb port just in case any one else has the issue.
imports = [
# import the dwc and modesetting device trees
../4/dwc2.nix
../4/modesetting.nix

];
boot.kernelPackages = pkgs.linuxPackages_rpi4;
hardware.deviceTree.enable = true;
hardware.deviceTree.filter = "bcm2711-rpi-*.dtb";
hardware.raspberry-pi."4".dwc2.enable = true;
hardware.raspberry-pi."4".dwc2.dr_mode = "host";


first sign of an issue
[ 1.542932] brcm-pcie fd500000.pcie: host bridge /scb/pcie@7d500000 ranges:
[ 1.542956] brcm-pcie fd500000.pcie: No bus range found for /scb/pcie@7d500000, using [bus 00-ff]
[ 1.543012] brcm-pcie fd500000.pcie: MEM 0x0600000000..0x063fffffff -> 0x00c0000000
[ 1.543102] brcm-pcie fd500000.pcie: IB MEM 0x0000000000..0x00bfffffff -> 0x0000000000
[ 1.863064] brcm-pcie fd500000.pcie: link down

Second point of failure.
[ 1.921350] libphy: Fixed MDIO Bus: probed
[ 1.922728] bcmgenet fd580000.ethernet: GENET 5.0 EPHY: 0x0000
[ 1.935063] libphy: bcmgenet MII bus: probed
[ 1.947075] mdio_bus unimac-mdio--19: MDIO device at address 1 is missing.
Final failure

[ 7.092597] could not attach to PHY
[ 7.093774] bcmgenet fd580000.ethernet eth0: failed to connect to PHY

coolvibes
Posts: 3
Joined: Tue Oct 12, 2021 1:23 am

Re: U-boot compilation on CM4

Tue Oct 12, 2021 5:33 am

I have fixed this updating the reg from 1 to 0 fixes it. These trees are in a bit of a state at the moment. :-(

Code: Select all

 mdio@e14 {
				compatible = "brcm,genet-mdio-v5";
				reg = <0xe14 0x08>;
				reg-names = "mdio";
				#address-cells = <0x00>;
				#size-cells = <0x01>;
				phandle = <0xd8>;

				ethernet-phy@1 {
					reg = <0x01>;     ## change to 0 for c0 module. 
					led-modes = <0x00 0x08>;
					phandle = <0x2d>;
				};
			};

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5607
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: U-boot compilation on CM4

Tue Oct 12, 2021 11:12 am

These trees are in a bit of a state at the moment.
Which trees? The current kernel tree (rpi-5.10.y) has 0 as the default PHY value, and if you use the firmware DTB loading the PHY address is patched to match the board.

coolvibes
Posts: 3
Joined: Tue Oct 12, 2021 1:23 am

Re: U-boot compilation on CM4

Tue Oct 12, 2021 10:24 pm

You are correct. The base device tree from the firmware is ok apart from the emmc issue. I am using nixos to generate the device tree that should be pulled in from the git repo.
https://github.com/raspberrypi/firmware ... aster/boot

I have just had a look at the src for the cm4 and you are correct it is set at reg 0
So something in the nixos device tree is over riding the correct value.
I will just replace the generated tree with the one from the git repo. Along with the mod above and add my extra devices. This is for a waveshare cm4 io poe box.

emmc2bus {
compatible = "simple-bus";
#address-cells = <0x02>;
#size-cells = <0x01>;
ranges = <0x00 0x7e000000 0x00 0xfe000000 0x1800000>;
dma-ranges = <0x00 0xo0000000 0x00 0x00 0xfc000000>;
phandle = <0xd8>;
Until the nixos pi device tree is staightened out. That is obviously broken. I have seen a few changes in the dtb area so I expect it will catch up soon.

Return to “Compute Module”