0

I am trying to create a custom Linux image with Yocto, for use with de10-nano and cn0540. However, after loading the correct device tree and enabling the device driver, no device file is created.

dmesg shows nothing related to ad7768-1 or iio.

The correct HDL is loaded on the FPGA.

The kernel I'm using comes from meta-altera.

I've made a kernel configuration fragment ad7768-1.cfg,

CONFIG_IIO_BUFFER=y
# CONFIG_IIO_BUFFER_CB is not set
# CONFIG_IIO_BUFFER_DMA is not set
# CONFIG_IIO_BUFFER_DMAENGINE is not set
# CONFIG_IIO_BUFFER_HW_CONSUMER is not set
CONFIG_IIO_KFIFO_BUF=y
CONFIG_IIO_TRIGGERED_BUFFER=y
CONFIG_IIO_TRIGGER=y
CONFIG_IIO_CONSUMERS_PER_TRIGGER=2
CONFIG_AD7768_1=y

#
# Triggers - standalone
#
# CONFIG_IIO_INTERRUPT_TRIGGER is not set
# CONFIG_IIO_SYSFS_TRIGGER is not set
# end of Triggers - standalone

and apply it with a kernel .bbappend file. Checking bitbake -c menuconfig virtual/kernel after building shows ad7768-1 to be enabled.

I've confirmed the correct device tree is loaded by looking in /sys/firmware/devicetree/base/.

Yet, there is no iio device in /dev/ or /sys/bus/iio/devices/, shouldn't the driver create the device files because compatible = "adi,ad7768-1"; is in the device tree?

EDIT: After changing ad7768-1.cfg to:

CONFIG_IIO_BUFFER=y
# CONFIG_IIO_BUFFER_CB is not set
# CONFIG_IIO_BUFFER_DMA is not set
# CONFIG_IIO_BUFFER_DMAENGINE is not set
# CONFIG_IIO_BUFFER_HW_CONSUMER is not set
CONFIG_IIO_KFIFO_BUF=y
CONFIG_IIO_TRIGGERED_BUFFER=y
CONFIG_IIO_TRIGGER=y
CONFIG_IIO_CONSUMERS_PER_TRIGGER=2
CONFIG_AD7768_1=y

CONFIG_SPI_AXI_SPI_ENGINE=y
CONFIG_DMA_VIRTUAL_CHANNELS=y
CONFIG_AXI_DMAC=y

#
# Triggers - standalone
#
# CONFIG_IIO_INTERRUPT_TRIGGER is not set
# CONFIG_IIO_SYSFS_TRIGGER is not set
# end of Triggers - standalone

the device is no longer able to boot, with dmesg being:

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.13.0-altera (oe-user@oe-host) (arm-poky-linux-gnueabi-gcc (GCC) 11.3.0, GNU ld (GNU Binutils) 2.38.20220708) #1 SMP Mon Aug 30 08:24:45 UTC 2021
[    0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Terasic DE10-Nano
[    0.000000] earlycon: uart0 at MMIO32 0xffc02000 (options '115200n8')
[    0.000000] printk: bootconsole [uart0] enabled
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000002fffffff]
[    0.000000]   HighMem  [mem 0x0000000030000000-0x000000003fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000003fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000003fffffff]
[    0.000000] percpu: Embedded 19 pages/cpu s45388 r8192 d24244 u77824
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 260608
[    0.000000] Kernel command line: root=/dev/mmcblk0p3 rootwait rw earlycon console=,115200
[    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] Memory: 1026112K/1048576K available (9216K kernel code, 754K rwdata, 1852K rodata, 1024K init, 141K bss, 22464K reserved, 0K cma-reserved, 262144K highmem)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] ftrace: allocating 29229 entries in 58 pages
[    0.000000] ftrace: allocated 58 pages with 4 groups
[    0.000000] trace event string verifier disabled
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU event tracing is enabled.
[    0.000000]  Rude variant of Tasks RCU enabled.
[    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] L2C-310 erratum 769419 enabled
[    0.000000] L2C-310 enabling early BRESP for Cortex-A9
[    0.000000] L2C-310 full line of zeros enabled for Cortex-A9
[    0.000000] L2C-310 ID prefetch enabled, offset 8 lines
[    0.000000] L2C-310 dynamic clock gating enabled, standby mode enabled
[    0.000000] L2C-310 cache controller enabled, 8 ways, 512 kB
[    0.000000] L2C-310: CACHE_ID 0x410030c9, AUX_CTRL 0x76460001
[    0.000000] random: get_random_bytes called from start_kernel+0x3c4/0x568 with crng_init=0
[    0.000000] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604467 ns
[    0.000001] sched_clock: 32 bits at 100MHz, resolution 10ns, wraps every 21474836475ns
[    0.008039] Switching to timer-based delay loop, resolution 10ns
[    0.014526] Console: colour dummy device 80x30
[    0.019065] Calibrating delay loop (skipped), value calculated using timer frequency.. 200.00 BogoMIPS (lpj=1000000)
[    0.029740] pid_max: default: 32768 minimum: 301
[    0.034469] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.041757] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.050308] CPU: Testing write buffer coherency: ok
[    0.055318] CPU0: Spectre v2: using BPIALL workaround
[    0.060606] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.066961] Setting up static identity map for 0x100000 - 0x100060
[    0.073392] rcu: Hierarchical SRCU implementation.
[    0.078571] smp: Bringing up secondary CPUs ...
[    0.083771] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.083788] CPU1: Spectre v2: using BPIALL workaround
[    0.094748] smp: Brought up 1 node, 2 CPUs
[    0.098906] SMP: Total of 2 processors activated (400.00 BogoMIPS).
[    0.105291] CPU: All CPU(s) started in SVC mode.
[    0.110513] devtmpfs: initialized
[    0.119534] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
[    0.127540] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.137559] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[    0.145276] NET: Registered protocol family 16
[    0.150599] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.158595] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
[    0.166740] hw-breakpoint: maximum watchpoint size is 4 bytes.
[    0.192619] wait_for_initramfs() called before rootfs_initcalls
[    0.201589] debugfs: Directory 'fixed-supply' with parent 'regulator' already present!
[    0.209888] vgaarb: loaded
[    0.212888] SCSI subsystem initialized
[    0.216883] usbcore: registered new interface driver usbfs
[    0.222531] usbcore: registered new interface driver hub
[    0.227970] usbcore: registered new device driver usb
[    0.233290] usb_phy_generic soc:usbphy: supply vcc not found, using dummy regulator
[    0.241996] i2c 0-0039: Fixing up cyclic dependency with ff290000.axi_hdmi
[    0.249733] pps_core: LinuxPPS API ver. 1 registered
[    0.254790] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.264095] PTP clock support registered
[    0.268229] FPGA manager framework
[    0.272779] clocksource: Switched to clocksource timer1
[    0.316500] NET: Registered protocol family 2
[    0.321050] IP idents hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.329536] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.337971] TCP established hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.345871] TCP bind hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.353201] TCP: Hash tables configured (established 8192 bind 8192)
[    0.359666] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.366361] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.373708] NET: Registered protocol family 1
[    0.402941] RPC: Registered named UNIX socket transport module.
[    0.408958] RPC: Registered udp transport module.
[    0.413723] RPC: Registered tcp transport module.
[    0.418495] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.424985] PCI: CLS 0 bytes, default 64
[    0.951052] hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
[    0.960693] workingset: timestamp_bits=30 max_order=18 bucket_order=0
[    0.973391] NFS: Registering the id_resolver key type
[    0.978543] Key type id_resolver registered
[    0.982805] Key type id_legacy registered
[    0.986880] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    0.994163] ntfs: driver 2.1.32 [Flags: R/W].
[    0.998770] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    1.005565] bounce: pool size: 64 pages
[    1.009488] io scheduler mq-deadline registered
[    1.014105] io scheduler kyber registered
[    1.021050] 8<--- cut here ---
[    1.024135] Unhandled fault: imprecise external abort (0x406) at 0x9c8a457f
[    1.031190] pgd = (ptrval)
[    1.033930] [9c8a457f] *pgd=00000000
[    1.037552] Internal error: : 406 [#1] SMP ARM
[    1.042059] Modules linked in:
[    1.045139] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.13.0-altera #1
[    1.051764] Hardware name: Altera SOCFPGA
[    1.055817] PC is at axi_dmac_probe+0xe0/0x72c
[    1.060335] LR is at clk_enable_unlock+0x68/0xe8
[    1.065001] pc : [<c05c31ac>]    lr : [<c05b34d0>]    psr: 60000013
[    1.071362] sp : c1113d28  ip : c1113cf8  fp : c1113d84
[    1.076641] r10: 00000000  r9 : c124a810  r8 : c1112000
[    1.081939] r7 : c1824fc0  r6 : c124a800  r5 : 00000000  r4 : c1856a40
[    1.088550] r3 : 00000000  r2 : 00000000  r1 : a0000013  r0 : 00000000
[    1.095162] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[    1.102407] Control: 10c5387d  Table: 0000404a  DAC: 00000051
[    1.108222] Register r0 information: NULL pointer
[    1.112979] Register r1 information: non-paged memory
[    1.118107] Register r2 information: NULL pointer
[    1.122871] Register r3 information: NULL pointer
[    1.127635] Register r4 information: slab kmalloc-512 start c1856a00 pointer offset 64 size 512
[    1.136489] Register r5 information: NULL pointer
[    1.141254] Register r6 information: slab kmalloc-1k start c124a800 pointer offset 0 size 1024
[    1.150002] Register r7 information: slab kmalloc-64 start c1824fc0 pointer offset 0 size 64
[    1.158575] Register r8 information: non-slab/vmalloc memory
[    1.164316] Register r9 information: slab kmalloc-1k start c124a800 pointer offset 16 size 1024
[    1.173149] Register r10 information: NULL pointer
[    1.178017] Register r11 information: non-slab/vmalloc memory
[    1.183845] Register r12 information: non-slab/vmalloc memory
[    1.189681] Process swapper/0 (pid: 1, stack limit = 0x(ptrval))
[    1.195776] Stack: (0xc1113d28 to 0xc1114000)
[    1.200198] 3d20:                   c034dd50 c034bddc 00000000 00000004 00000000 c1829800
[    1.208501] 3d40: c182a420 00000000 c1113d7c c1113d58 c034f1f0 3e3e226c c124a810 00000000
[    1.216803] 3d60: c124a810 c0d78e94 c0dd9fec 00000000 c0d78e94 00000000 c1113da4 c1113d88
[    1.225088] 3d80: c061d1a4 c05c30d8 c124a810 c0dd9fe8 00000000 c0dd9fec c1113ddc c1113da8
[    1.233381] 3da0: c061a674 c061d144 00000000 c0d78e94 c1113ddc c124a810 c0d78e94 c124a854
[    1.241683] 3dc0: c0d78e94 00000000 c0c47854 c0dbd000 c1113df4 c1113de0 c061aae8 c061a58c
[    1.249976] 3de0: c124a810 00000000 c1113e14 c1113df8 c061b168 c061aa7c 00000000 c0d78e94
[    1.258261] 3e00: c124a810 00000000 c1113e34 c1113e18 c061b20c c061b0bc c0d78e94 c061b170
[    1.266545] 3e20: c1112000 00000000 c1113e64 c1113e38 c0618334 c061b17c c1113e70 c107e858
[    1.274820] 3e40: c11e1b34 3e3e226c c0d78e94 c1829800 00000000 c0d7fe18 c1113e74 c1113e68
[    1.283113] 3e60: c0619efc c06182b8 c1113e9c c1113e78 c061989c c0619edc c0b49d4c c055ef5c
[    1.291414] 3e80: c0d78e94 00000000 c0c23a54 ffffe000 c1113eb4 c1113ea0 c061bd44 c06197a0
[    1.299716] 3ea0: c1112000 c0daef80 c1113ec4 c1113eb8 c061cea8 c061bcb8 c1113ed4 c1113ec8
[    1.308017] 3ec0: c0c23a78 c061ce88 c1113f4c c1113ed8 c01021d4 c0c23a60 c0b08254 c0b08234
[    1.316310] 3ee0: c0b08280 c0b1aa00 c0b08210 00000006 00000006 c1112000 c0c0043c 00000000
[    1.324594] 3f00: 000000c6 c0b66ec4 00000000 00000000 c0c01268 c11c3829 c11c3831 3e3e226c
[    1.332887] 3f20: c0dbd000 3e3e226c c11c3800 c0c726f0 c11c3800 00000007 c0c47834 000000c6
[    1.341180] 3f40: c1113f94 c1113f50 c0c01330 c0102180 00000006 00000006 00000000 c0c0043c
[    1.349472] 3f60: c0bccfbc c0c0043c c1113f8c 00000000 c0972fcc 00000000 00000000 00000000
[    1.357765] 3f80: 00000000 00000000 c1113fac c1113f98 c0972fe4 c0c010d0 00000000 c0972fcc
[    1.366075] 3fa0: 00000000 c1113fb0 c0100150 c0972fd8 00000000 00000000 00000000 00000000
[    1.374375] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    1.382668] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[    1.390963] Backtrace:
[    1.393428] [<c05c30cc>] (axi_dmac_probe) from [<c061d1a4>] (platform_probe+0x6c/0xcc)
[    1.401342]  r10:00000000 r9:c0d78e94 r8:00000000 r7:c0dd9fec r6:c0d78e94 r5:c124a810
[    1.409163]  r4:00000000
[    1.411685] [<c061d138>] (platform_probe) from [<c061a674>] (really_probe+0xf4/0x4f0)
[    1.419603]  r7:c0dd9fec r6:00000000 r5:c0dd9fe8 r4:c124a810
[    1.425288] [<c061a580>] (really_probe) from [<c061aae8>] (driver_probe_device+0x78/0xd0)
[    1.433465]  r10:c0dbd000 r9:c0c47854 r8:00000000 r7:c0d78e94 r6:c124a854 r5:c0d78e94
[    1.441259]  r4:c124a810
[    1.443789] [<c061aa70>] (driver_probe_device) from [<c061b168>] (device_driver_attach+0xb8/0xc0)
[    1.452637]  r5:00000000 r4:c124a810
[    1.456248] [<c061b0b0>] (device_driver_attach) from [<c061b20c>] (__driver_attach+0x9c/0x12c)
[    1.464837]  r7:00000000 r6:c124a810 r5:c0d78e94 r4:00000000
[    1.470470] [<c061b170>] (__driver_attach) from [<c0618334>] (bus_for_each_dev+0x88/0xc8)
[    1.478731]  r7:00000000 r6:c1112000 r5:c061b170 r4:c0d78e94
[    1.484389] [<c06182ac>] (bus_for_each_dev) from [<c0619efc>] (driver_attach+0x2c/0x30)
[    1.492373]  r7:c0d7fe18 r6:00000000 r5:c1829800 r4:c0d78e94
[    1.498092] [<c0619ed0>] (driver_attach) from [<c061989c>] (bus_add_driver+0x108/0x1f0)
[    1.506071] [<c0619794>] (bus_add_driver) from [<c061bd44>] (driver_register+0x98/0x128)
[    1.514167]  r7:ffffe000 r6:c0c23a54 r5:00000000 r4:c0d78e94
[    1.519809] [<c061bcac>] (driver_register) from [<c061cea8>] (__platform_driver_register+0x2c/0x34)
[    1.528873]  r5:c0daef80 r4:c1112000
[    1.532483] [<c061ce7c>] (__platform_driver_register) from [<c0c23a78>] (axi_dmac_driver_init+0x24/0x28)
[    1.541938] [<c0c23a54>] (axi_dmac_driver_init) from [<c01021d4>] (do_one_initcall+0x60/0x250)
[    1.550535] [<c0102174>] (do_one_initcall) from [<c0c01330>] (kernel_init_freeable+0x26c/0x2cc)
[    1.559319]  r8:000000c6 r7:c0c47834 r6:00000007 r5:c11c3800 r4:c0c726f0
[    1.565989] [<c0c010c4>] (kernel_init_freeable) from [<c0972fe4>] (kernel_init+0x18/0x12c)
[    1.574239]  r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c0972fcc
[    1.582042]  r4:00000000
[    1.584572] [<c0972fcc>] (kernel_init) from [<c0100150>] (ret_from_fork+0x14/0x24)
[    1.592120] Exception stack(0xc1113fb0 to 0xc1113ff8)
[    1.597231] 3fa0:                                     00000000 00000000 00000000 00000000
[    1.605412] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    1.613677] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    1.620264]  r5:c0972fcc r4:00000000
[    1.623870] Code: e5933000 e1a02003 e50b3040 f57ff04f (e3a03e36)
[    1.630057] ---[ end trace 6420cf9c4e87884e ]---
[    1.634740] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    1.642505] CPU0: stopping
[    1.645285] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G      D           5.13.0-altera #1
[    1.653217] Hardware name: Altera SOCFPGA
[    1.657244] Backtrace:
[    1.659700] [<c096a3ec>] (dump_backtrace) from [<c096a694>] (show_stack+0x20/0x24)
[    1.667575]  r7:c1003ac0 r6:60000193 r5:00000000 r4:c0d76f10
[    1.673459] [<c096a674>] (show_stack) from [<c096dc8c>] (dump_stack+0x9c/0xb0)
[    1.680980] [<c096dbf0>] (dump_stack) from [<c010f340>] (do_handle_IPI+0x2e4/0x318)
[    1.688932]  r7:c1003ac0 r6:00000000 r5:c0daf020 r4:c0dbd2c8
[    1.694573] [<c010f05c>] (do_handle_IPI) from [<c010f39c>] (ipi_handler+0x28/0x30)
[    1.702428]  r9:c0d01ed0 r8:c1048800 r7:c1003ac0 r6:00000014 r5:c0d043fc r4:c1073c00
[    1.710135] [<c010f374>] (ipi_handler) from [<c0182980>] (handle_percpu_devid_irq+0x9c/0x224)
[    1.719003] [<c01828e4>] (handle_percpu_devid_irq) from [<c017bf64>] (__handle_domain_irq+0x8c/0xe0)
[    1.728510]  r7:00000001 r6:00000000 r5:00000000 r4:c0c7c958
[    1.734402] [<c017bed8>] (__handle_domain_irq) from [<c0101398>] (gic_handle_irq+0x8c/0xa0)
[    1.743122]  r9:c0d01ed0 r8:f080210c r7:c0c7c964 r6:f0802100 r5:c0d76fd0 r4:c0d043fc
[    1.751174] [<c010130c>] (gic_handle_irq) from [<c0100b4c>] (__irq_svc+0x6c/0x90)
[    1.758935] Exception stack(0xc0d01ed0 to 0xc0d01f18)
[    1.764176] 1ec0:                                     00000000 00000000 00000350 c011ae20
[    1.772694] 1ee0: c0dafe00 00000000 c0d03d0c c0d03d4c c0daea05 c0b08e1c c0c47a60 c0d01f2c
[    1.781210] 1f00: c0d01f30 c0d01f20 c0108364 c0108368 60000013 ffffffff
[    1.788103]  r9:c0d00000 r8:c0daea05 r7:c0d01f04 r6:ffffffff r5:60000013 r4:c0108368
[    1.796121] [<c0108320>] (arch_cpu_idle) from [<c097abe8>] (default_idle_call+0x4c/0xf4)
[    1.804537] [<c097ab9c>] (default_idle_call) from [<c015bda0>] (do_idle+0xd0/0x134)
[    1.812512]  r5:00000000 r4:c0d00000
[    1.816226] [<c015bcd0>] (do_idle) from [<c015c124>] (cpu_startup_entry+0x28/0x2c)
[    1.824115]  r9:efffedc0 r8:00000000 r7:c0c47a60 r6:c0d00000 r5:c0d03cc0 r4:000000e1
[    1.832176] [<c015c0fc>] (cpu_startup_entry) from [<c0972fc4>] (rest_init+0xbc/0xc4)
[    1.840228] [<c0972f08>] (rest_init) from [<c0c00a7c>] (arch_call_rest_init+0x18/0x1c)
[    1.848470]  r5:c0d03cc0 r4:c0dbd068
[    1.852193] [<c0c00a64>] (arch_call_rest_init) from [<c0c01028>] (start_kernel+0x530/0x568)
[    1.860881] [<c0c00af8>] (start_kernel) from [<00000000>] (0x0)
[    1.866790]  r10:10c5387d r9:413fc090 r8:09ff5000 r7:00000000 r6:10c0387d r5:00000051
[    1.874593]  r4:c0c00330
[    1.877233] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---

  • Do you also configure the kernel to support "Analog Devices AXI SPI Engine controller" (`CONFIG_SPI_AXI_SPI_ENGINE`) and "Analog Devices AXI-DMAC DMA support" (`CONFIG_AXI_DMAC`)? – Ian Abbott Apr 03 '23 at 10:40
  • @IanAbbott Those were not enabled, however when I enable them the device is no longer able to boot. I've updated my question with the `dmesg` output. – ThePumkinMelon Apr 03 '23 at 21:06
  • That looks like a fault when it tries to access the registers in the AXI DMA controller (implemented in the FPGA logic). That could be either because the DMA controller does not exist at the expected address (looking at the device tree source, its registers are at offset 0x20000 from the FPGA's LWHPS2FPGA bridge) or because the LWHPS2FPGA bridge has not been enabled after loading the FPGA. – Ian Abbott Apr 04 '23 at 09:47
  • @IanAbbott I confirmed the address is correct and tried setting `status = "okay"` for the LWHPS2FPGA bridge, but the same error happens. I'm I enabling the bridge wrong, or is there something else I can try? – ThePumkinMelon Apr 05 '23 at 01:34
  • Is the FPGA being loaded from the bootloader? If so, which one, and what exactly are you (or a script) doing to reenable the bridges after loading the FPGA? – Ian Abbott Apr 05 '23 at 15:28
  • @IanAbbott I'm using the U-Boot command `fpga load` to program the fpga, I thought that command re-enabled the bridges? – ThePumkinMelon Apr 05 '23 at 15:47
  • I'm pretty sure `fpga load` leaves the bridges disabled. Try running the `bridge enable` command afterwards if your U-Boot is recent enough to support that command. If that is not supported, try `run bridge-enable-handoff` if using the Altera/Intel port of U-Boot. – Ian Abbott Apr 05 '23 at 16:17
  • @IanAbbott `bridge enable` worked. However, the spi interface does not seem to load, `ad7768-1: probe of spi0.0 failed with error -22` is the only line in dmesg that contains `spi`. The dmac driver seems to load without problem. Is there an extra step needed for the spi driver? – ThePumkinMelon Apr 05 '23 at 18:14
  • I think I found the problem, the spi engine driver In the linux altera fork does not support the offload module like the adi one does. So I'll have to patch it or something – ThePumkinMelon Apr 05 '23 at 18:41
  • Patching `spi-axi-spi-engine.c` to be the version from the adi linux fork did not change anything. – ThePumkinMelon Apr 05 '23 at 20:03
  • My usual debugging strategy at that point would be to add a few `printk` or `dev_info` calls in both `spi_engine_probe()` (in "drivers/spi/spi-axi-spi-engine.c") and `ad7768_probe()` (in "drivers/iio/adc/ad7768-1.c") to see how far it gets before failing. – Ian Abbott Apr 06 '23 at 09:43
  • @IanAbbott that's why it's good to have `initcall_debug ignore_loglevel` to be provided in the kernel command line for the bare minimum, follwed by looking into `/sys/kernel/debug/devices_deferred` for the reasons in case the resources are missing. I.o.w. `printk()` approach should be the last resort. – 0andriy Apr 07 '23 at 13:40

1 Answers1

0

There ended up being a few steps to solve the problem.

First was enabling CONFIG_AXI_DMAC, CONFIG_DMA_VIRTUAL_CHANNELS, CONFIG_SPI_AXI_SPI_ENGINE and CONFIG_IIO_BUFFER_DMAENGINE in the kernel config.

Second was re-enabling the FPGA bridges after programming it. This was done by adding bridge enable in U-boot's bootcmd command.

And lastly patching files with their Linux ADI counterpart.

File list:
buffer-dma.h
buffer-dmaengine.h
buffer_impl.h
consumer.h
iio.h
iio_core.h
iio-opaque.h
industrialio-buffer.c
industrialio-buffer-dma.c
industrialio-buffer-dmaengine.c
industrialio-core.c
industrialio-trigger.c
industrialio-trggered-buffer.c
inkern.c
/iio/types.h
/uaip/linux/iio/types.h
spi-axi-spi-engine.c

The driver now loads correctly and creates the device file