After applying your patch the following things changed:
After loading kernel to RAM:
## Flattened Device Tree blob at 83000000
Booting using the fdt blob at 0x83000000
Loading Device Tree to 9fb4f000, end 9fb5ab35 ... OK
Starting kernel ...
Nothing happens for about 60 seconds - until SDMA firmware should be loaded. Then kernel starts printing boot messages
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.15.52+ge140f98d5bd3 (oe-user@oe-host) (arm-fsl-linux-gnueabi-gcc (GCC) 11.3.0, GNU ld (GNU Binutils) 2.38.20220623) #1 SMP PREEMPT Wed Mar 8 20:16:20 UTC 2023
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: CBDM01
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] Reserved memory: created CMA memory pool at 0x8a000000, size 320 MiB
[ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x0000000080000000-0x000000009fffffff]
[ 0.000000] HighMem empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080000000-0x000000009fffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x000000009fffffff]
[ 0.000000] percpu: Embedded 12 pages/cpu s17164 r8192 d23796 u49152
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 129920
[ 0.000000] Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk1p3 rootwait rw
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 170548K/524288K available (12288K kernel code, 1338K rwdata, 4300K rodata, 1024K init, 433K bss, 26060K reserved, 327680K cma-reserved, 0K highmem)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] rcu: Preemptible hierarchical RCU implementation.
[ 0.000000] rcu: RCU event tracing is enabled.
[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=1.
[ 0.000000] Trampoline variant of Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] Switching to timer-based delay loop, resolution 41ns
[ 0.000003] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000056] clocksource: mxc_timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.003201] Console: colour dummy device 80x30
[ 0.003319] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
[ 0.003376] pid_max: default: 32768 minimum: 301
[ 0.003889] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.003956] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.005794] CPU: Testing write buffer coherency: ok
[ 0.006508] CPU0: update cpu_capacity 1024
[ 0.006561] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.008981] Setting up static identity map for 0x80100000 - 0x80100060
[ 0.009403] rcu: Hierarchical SRCU implementation.
[ 0.010733] smp: Bringing up secondary CPUs ...
[ 0.010782] smp: Brought up 1 node, 1 CPU
[ 0.010817] SMP: Total of 1 processors activated (48.00 BogoMIPS).
[ 0.010847] CPU: All CPU(s) started in SVC mode.
[ 0.011938] devtmpfs: initialized
[ 0.028313] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[ 0.028896] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.028975] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[ 0.053396] pinctrl core: initialized pinctrl subsystem
[ 0.057295] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[ 0.075131] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.078101] thermal_sys: Registered thermal governor 'step_wise'
[ 0.078510] cpuidle: using governor menu
[ 0.078863] CPU identified as i.MX6ULL, silicon rev 1.1
[ 0.105887] vdd3p0: supplied by regulator-dummy
[ 0.106944] cpu: supplied by regulator-dummy
[ 0.108460] vddsoc: supplied by regulator-dummy
[ 0.147032] failed to find ocotp node
[ 0.147516] failed to find ocotp node
[ 0.147937] No ATAGs?
[ 0.148077] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[ 0.148120] hw-breakpoint: maximum watchpoint size is 8 bytes.
[ 0.151091] imx6ul-pinctrl 20e0000.pinctrl: initialized IMX pinctrl driver
[ 0.152671] imx6ul-pinctrl 2290000.iomuxc-snvs: initialized IMX pinctrl driver
[ 0.155807] imx mu driver is registered.
[ 0.156831] imx rpmsg driver is registered.
[ 0.192903] Kprobes globally optimized
[ 0.218813] gpio-65 (can_enable): hogged as output/high
[ 0.223441] gpio-123 (lte_enable): hogged as output/high
[ 0.227364] gpio-134 (hub_reset): hogged as output/high
[ 0.241594] vgaarb: loaded
[ 0.243618] SCSI subsystem initialized
[ 0.244866] usbcore: registered new interface driver usbfs
[ 0.245039] usbcore: registered new interface driver hub
[ 0.245172] usbcore: registered new device driver usb
[ 0.249589] i2c i2c-0: IMX I2C adapter registered
[ 0.252433] i2c i2c-1: IMX I2C adapter registered
[ 0.253313] mc: Linux media interface: v0.10
[ 0.253443] videodev: Linux video capture interface: v2.00
[ 0.253707] pps_core: LinuxPPS API ver. 1 registered
[ 0.253740] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.253803] PTP clock support registered
[ 0.256962] MIPI CSI2 driver module loaded
[ 0.257130] Advanced Linux Sound Architecture Driver Initialized.
[ 0.259054] Bluetooth: Core ver 2.22
[ 0.259232] NET: Registered PF_BLUETOOTH protocol family
[ 0.259266] Bluetooth: HCI device and connection manager initialized
[ 0.259313] Bluetooth: HCI socket layer initialized
[ 0.259346] Bluetooth: L2CAP socket layer initialized
[ 0.259407] Bluetooth: SCO socket layer initialized
[ 0.260718] clocksource: Switched to clocksource mxc_timer1
[ 0.261146] VFS: Disk quotas dquot_6.6.0
[ 0.261310] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[ 0.282331] NET: Registered PF_INET protocol family
[ 0.282909] IP idents hash table entries: 8192 (order: 4, 65536 bytes, linear)
[ 0.285171] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[ 0.285287] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.285339] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)
[ 0.285458] TCP bind hash table entries: 4096 (order: 3, 32768 bytes, linear)
[ 0.285633] TCP: Hash tables configured (established 4096 bind 4096)
[ 0.285852] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.285946] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.286391] NET: Registered PF_UNIX/PF_LOCAL protocol family
[ 0.288076] RPC: Registered named UNIX socket transport module.
[ 0.288139] RPC: Registered udp transport module.
[ 0.288164] RPC: Registered tcp transport module.
[ 0.288185] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.290504] PCI: CLS 0 bytes, default 64
[ 0.291790] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 5 counters available
[ 0.296270] Bus freq driver module loaded
[ 0.298495] Initialise system trusted keyrings
[ 0.299824] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[ 0.315293] NFS: Registering the id_resolver key type
[ 0.315604] Key type id_resolver registered
[ 0.315637] Key type id_legacy registered
[ 0.315902] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 0.315940] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[ 0.316041] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[ 0.317299] fuse: init (API version 7.34)
[ 0.558313] Key type asymmetric registered
[ 0.558376] Asymmetric key parser 'x509' registered
[ 0.558571] io scheduler mq-deadline registered
[ 0.558608] io scheduler kyber registered
Here kernel tries to load firmware:
[ 0.581201] imx-sdma 20ec000.sdma: Direct firmware load for imx/sdma/sdma-imx6q.bin failed with error -2
[ 0.581277] imx-sdma 20ec000.sdma: Falling back to sysfs fallback for: imx/sdma/sdma-imx6q.bin
[ 64.497374] imx-sdma 20ec000.sdma: failed to get firmware.
but without success. Rootfs is not ready yet
[ 64.606310] mxs-dma 1804000.dma-apbh: initialized
[ 64.803768] 2018000.serial: ttymxc6 at MMIO 0x2018000 (irq = 28, base_baud = 5000000) is a IMX
[ 64.857364] 2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 29, base_baud = 5000000) is a IMX
[ 65.714919] printk: console [ttymxc0] enabled
[ 65.784830] 21e8000.serial: ttymxc1 at MMIO 0x21e8000 (irq = 66, base_baud = 5000000) is a IMX
[ 65.849489] 21ec000.serial: ttymxc2 at MMIO 0x21ec000 (irq = 67, base_baud = 5000000) is a IMX
[ 65.917209] 21f0000.serial: ttymxc3 at MMIO 0x21f0000 (irq = 68, base_baud = 5000000) is a IMX
[ 65.986190] 21f4000.serial: ttymxc4 at MMIO 0x21f4000 (irq = 69, base_baud = 5000000) is a IMX
....
and then about 2 mins after system boot(my service is started after delay) kernel panic occurs:
144.918973] imx-uart 21f0000.serial: We cannot prepare for the RX slave dma!
[ 144.962052] 8<--- cut here ---
[ 144.965154] Unable to handle kernel NULL pointer dereference at virtual address 00000003
[ 144.973256] pgd = 239a35ca
[ 144.975979] [00000003] *pgd=00000000
[ 144.979573] Internal error: Oops: 805 [#1] PREEMPT SMP ARM
[ 144.985070] Modules linked in: imx_rngc rng_core 8188eu(O) option usb_wwan usbserial secvio error evbug
[ 144.994528] CPU: 0 PID: 569 Comm: sunspecd Tainted: G O 5.15.52+ge140f98d5bd3 #1
[ 145.003239] Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[ 145.009424] PC is at sdma_transfer_init+0x120/0x23c
[ 145.014328] LR is at 0x0
[ 145.016867] pc : [<805e46d8>] lr : [<00000000>] psr: 80000193
[ 145.023141] sp : 82b8fdd8 ip : 8a040280 fp : 822faca0
[ 145.028374] r10: 822f8040 r9 : 822fa040 r8 : 00000002
[ 145.033604] r7 : 8a040200 r6 : 00000000 r5 : 83b21600 r4 : 822f82d4
[ 145.040139] r3 : 00000002 r2 : 00000008 r1 : 00000001 r0 : 8a040200
[ 145.046674] Flags: Nzcv IRQs off FIQs on Mode SVC_32 ISA ARM Segment none
[ 145.053908] Control: 10c5387d Table: 83ae006a DAC: 00000051
[ 145.059658] Register r0 information: 0-page vmalloc region starting at 0x8a000000 allocated at iotable_init+0x0/0xec
[ 145.070213] Register r1 information: non-paged memory
[ 145.075274] Register r2 information: non-paged memory
[ 145.080333] Register r3 information: non-paged memory
[ 145.085395] Register r4 information: non-slab/vmalloc memory
[ 145.091064] Register r5 information: slab kmalloc-128 start 83b21600 pointer offset 0 size 128
[ 145.099714] Register r6 information: NULL pointer
[ 145.104426] Register r7 information: 0-page vmalloc region starting at 0x8a000000 allocated at iotable_init+0x0/0xec
[ 145.114969] Register r8 information: non-paged memory
[ 145.120030] Register r9 information: non-slab/vmalloc memory
[ 145.125698] Register r10 information: non-slab/vmalloc memory
[ 145.131453] Register r11 information: non-slab/vmalloc memory
[ 145.137209] Register r12 information: 0-page vmalloc region starting at 0x8a000000 allocated at iotable_init+0x0/0xec
[ 145.147838] Process sunspecd (pid: 569, stack limit = 0x0f604475)
[ 145.153943] Stack: (0x82b8fdd8 to 0x82b90000)
[ 145.158308] fdc0: 00000000 00000000
[ 145.166499] fde0: 00000002 20000193 f2720306 8218b5dc 00000001 822f82d4 00000001 822fa040
[ 145.174687] fe00: 822f8040 00000000 20000193 805e5310 8218b5dc 82132010 00004000 00000002
[ 145.182876] fe20: 20000193 8218b440 00000000 822f82d4 8218b5dc 82132010 805e52a4 00000021
[ 145.191065] fe40: 20000193 80632d88 00000001 00000000 00000008 20000193 8218b440 9ff347c0
[ 145.199253] fe60: 9ff347c0 9ff34814 80635934 80635974 8218b658 9ff34800 9ff347c0 8019d834
[ 145.207441] fe80: 00000000 bfc5a69b 00000006 bfc5a69b 00000021 8144e1f4 00000008 9ff347c0
[ 145.215629] fea0: 20000193 00000003 bfc5a69b 9ff347cc 9ff34848 9ff34870 9ff34898 8019e910
[ 145.223816] fec0: 20000193 0000000f 806147ec 9ff34910 9ff348f0 9ff34940 bfc5a69b 00000021
[ 145.232004] fee0: 82b8ff80 8200c140 8200c26c 00000000 82b8ff48 00000019 8200c200 8144e16b
[ 145.240192] ff00: 80fe94cc 80931ce4 82023800 8017f3e8 7e96949c 00000008 00010000 80fe94f4
[ 145.248380] ff20: 00000000 8200c200 8200c26c 8200c26c 00000000 a080200c 82b8ff90 82b8ffb0
[ 145.256568] ff40: 00000000 8017f5a0 00000000 fa0dd3da 8200c200 8200c26c 8130cac0 80183e98
[ 145.264756] ff60: 81278430 00000000 00000057 00000000 a080200c 8017ed50 81305474 813e76ec
[ 145.272944] ff80: a0802000 8127843c a080200c 80539b74 76e58d88 40000030 ffffffff 10c5387d
[ 145.281132] ffa0: 10c5387d 76f55c4c 7e9693dc 80100f50 00000005 7e9693e4 00000000 00000000
[ 145.289320] ffc0: 7e9693dc 7e969378 01f55da8 7e9693dc 76f66edc 76f55c4c 7e9693dc 00000000
[ 145.297508] ffe0: 76f66f18 7e969370 76e58fed 76e58d88 40000030 ffffffff 00000000 00000000
[ 145.305699] [<805e46d8>] (sdma_transfer_init) from [<805e5310>] (sdma_prep_slave_sg+0x6c/0x284)
[ 145.314425] [<805e5310>] (sdma_prep_slave_sg) from [<80632d88>] (imx_uart_dma_tx+0xfc/0x230)
[ 145.322889] [<80632d88>] (imx_uart_dma_tx) from [<80635974>] (imx_trigger_start_tx+0x40/0x44)
[ 145.331440] [<80635974>] (imx_trigger_start_tx) from [<8019d834>] (__hrtimer_run_queues+0x15c/0x218)
[ 145.340599] [<8019d834>] (__hrtimer_run_queues) from [<8019e910>] (hrtimer_interrupt+0x124/0x2b0)
[ 145.349494] [<8019e910>] (hrtimer_interrupt) from [<80931ce4>] (mxc_timer_interrupt+0x34/0x3c)
[ 145.358132] [<80931ce4>] (mxc_timer_interrupt) from [<8017f3e8>] (__handle_irq_event_percpu+0x50/0x130)
[ 145.367553] [<8017f3e8>] (__handle_irq_event_percpu) from [<8017f5a0>] (handle_irq_event+0x58/0xc4)
[ 145.376623] [<8017f5a0>] (handle_irq_event) from [<80183e98>] (handle_fasteoi_irq+0x9c/0x204)
[ 145.385171] [<80183e98>] (handle_fasteoi_irq) from [<8017ed50>] (handle_domain_irq+0x5c/0x78)
[ 145.393717] [<8017ed50>] (handle_domain_irq) from [<80539b74>] (gic_handle_irq+0x7c/0x90)
[ 145.401922] [<80539b74>] (gic_handle_irq) from [<80100f50>] (__irq_usr+0x50/0x80)
[ 145.409427] Exception stack(0x82b8ffb0 to 0x82b8fff8)
[ 145.414488] ffa0: 00000005 7e9693e4 00000000 00000000
[ 145.422677] ffc0: 7e9693dc 7e969378 01f55da8 7e9693dc 76f66edc 76f55c4c 7e9693dc 00000000
[ 145.430864] ffe0: 76f66f18 7e969370 76e58fed 76e58d88 40000030 ffffffff
[ 145.437494] Code: e5942108 e5872024 e59d3008 e3a01001 (e5c61003)
[ 145.443600] ---[ end trace 0274ce7a37069a08 ]---
[ 145.448224] Kernel panic - not syncing: Fatal exception in interrupt
[ 145.454594] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
It happens because no firmware is loaded, and it was not possible right after start because rootfs isn't ready.
SDMA driver was configured as module:
CONFIG_IMX_SDMA=m