Driver Adding to Kernel

Hello,

I am trying to apply sensoray 1012 for IMX8.
I followed this guilde here to build an image:

and after for kernel driver activation:

bitbake virtual/kernel -c menuconfig

and i activate the below settings for Sensoray reccomends below with no problem:
http://www.sensoray.com/wiki/index.php?title=1012_TORADEX

  • Use arrows to scroll down to “Device Drivers —>”: Press Enter ()

  • Use arrows to scroll down to:
    “Multimedia support”: Press Enter
    ()

  • Use arrows to scroll down to: “Analog
    TV support”: Press Space Bar. Item
    selected will have an asterisk *.

  • Use arrows to scroll down to: “Media
    USB Adapters”: Press Enter

  • Use arrows to scroll down to: “USB
    Sensoray 2255 Video capture device”:
    Press Space bar to select.

  • Press right arrow once until
    is selected. Press Enter.

  • Use arrows to scroll down to: “Media
    PCI Adapters”: Press Space Bar to
    select then press Enter.

  • Use down arrow to scroll down to:
    TW686x cards (NEW)”.: Press Space
    Bar to select and press Enter

  • Use down arrow to scroll down to:
    "Philips SAA7134 support (NEW): Press
    Space Bar to select and press

  • Enter. This installed other libraries
    that #may be useful in the future
    without having to recompile the
    entire kernel.

  • Press right arrow once until
    is selected. Press Enter. Multimedia
    support menu will appear.

  • Press right arrow once until
    is selected. Press Enter. This brings
    you back to the device drivers root
    menu.

  • Press right arrow once until
    is selected. Press Enter. This brings
    you back to the main kernel root
    menu.

  • Press right arrow once until
    is selected. Press Enter. A pop-up
    asking if you want to save your new
    configuration appears. should
    be #selected. Press enter to save the
    configuration.

After these setting bitbake again:

bitbake tdx-reference-multimedia-image

bitbake ends with this warning maybe relevent:

WARNING: /home/stg/oe-core/build/../layers/meta-toradex-nxp/recipes-kernel/linux/linux-toradex_5.4-2.3.x.bb:do_compile is tainted from a forced run

But drivers doesnt get loaded.

Here is the start-up output relevent with PCI and TW686x driver:

[ 3.612508] pci 0000:00:00.0: BAR 0: assigned [mem 0x60000000-0x60ffffff]
[ 3.619329] pci 0000:00:00.0: BAR 6: assigned [mem 0x61000000-0x61ffffff pref]
[ 3.626598] pci 0000:00:00.0: BAR 14: assigned [mem 0x62000000-0x620fffff]
[ 3.633494] pci 0000:01:00.0: BAR 0: assigned [mem 0x62000000-0x62000fff pref]
[ 3.640756] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[ 3.646021] pci 0000:00:00.0: bridge window [mem 0x62000000-0x620fffff]
[ 3.653276] pcieport 0000:00:00.0: PME: Signaling with IRQ 568
[ 3.659449] tw6869: PCI 0000:01:00.0, IRQ 568, MMIO 0x62000000 (memcpy mode)
[ 3.666543] tw686x 0000:01:00.0: enabling device (0000 → 0002)
[ 3.673621] tw686x 0000:01:00.0: dma0: unable to allocate P-buffer
[ 3.679837] tw686x 0000:01:00.0: can’t register video
[ 3.684938] tw686x: probe of 0000:01:00.0 failed with error -12

root@apalis-imx8:~# modinfo tw686x                                                                                                                              
modinfo: ERROR: Module tw686x not found.

i see some imx6q. Might this coused by a wrong setting? I am using Apalis IMX8QM

[   3.075401] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00000fff pref]
[    3.090684] pci 0000:01:00.0: enabling Extended Tags
[    3.095910] pci 0000:01:00.0: PME# supported from D0 D3hot D3cold
[    3.107150] ALSA device list:
[    3.110135]   #0: imx-spdif
[    3.112940]   #1: apalis-imx8qm-sgtl5000
[    3.118532] pci 0000:00:00.0: BAR 0: assigned [mem 0x60000000-0x60ffffff]
[    3.125346] pci 0000:00:00.0: BAR 6: assigned [mem 0x61000000-0x61ffffff pref]
[    3.132586] pci 0000:00:00.0: BAR 14: assigned [mem 0x62000000-0x620fffff]
[    3.139498] pci 0000:01:00.0: BAR 0: assigned [mem 0x62000000-0x62000fff pref]
[    3.146749] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    3.151990] pci 0000:00:00.0:   bridge window [mem 0x62000000-0x620fffff]
[    3.159346] pcieport 0000:00:00.0: PME: Signaling with IRQ 568
[    3.165705] tw6869: PCI 0000:01:00.0, IRQ 568, MMIO 0x62000000 (memcpy mode)
[    3.172826] tw686x 0000:01:00.0: enabling device (0000 -> 0002)
[    3.180062] tw686x 0000:01:00.0: dma0: unable to allocate P-buffer
[    3.186270] tw686x 0000:01:00.0: can't register video
[    3.191390] tw686x: probe of 0000:01:00.0 failed with error -12
[    3.192014] imx6q-pcie 5f010000.pcie: PCIe PLL locked after 0 us.
[    3.203503] imx6q-pcie 5f010000.pcie: host bridge /bus@5f000000/pcie@0x5f010000 ranges:
[    3.211556] imx6q-pcie 5f010000.pcie:    IO 0x7ff80000..0x7ff8ffff -> 0x00000000
[    3.218983] imx6q-pcie 5f010000.pcie:   MEM 0x70000000..0x7fefffff -> 0x70000000
[    3.332030] usb 4-1: new high-speed USB device number 2 using ci_hdrc
[    3.493192] hub 4-1:1.0: USB hub found
[    3.497178] hub 4-1:1.0: 3 ports detected
[    4.227038] imx6q-pcie 5f010000.pcie: Phy link never came up
[    4.232789] imx6q-pcie 5f010000.pcie: failed to initialize host
[    4.238794] imx6q-pcie 5f010000.pcie: unable to add pcie port.

Hello @Engineering_AV ,

Greetings and Welcome to Toradex Community!

One thing you could try is to bitbake -c cleanall and resume the build. Please kindly refer to the following pages that discusses this issue in detail:

https://www.yoctoproject.org/pipermail/yocto/2015-January/023274.html

Hope this helps!

Best Regards,
Janani

Hello @saijanani.tx and thank you for your reply.

One thing you could try is to bitbake -c cleanall and resume the build.

Solved some problems.
Now there is no tw686x memcpy error at start up output. And i can do

when i do modinfo

root@apalis-imx8:~# modinfo tw686x
filename:       /lib/modules/5.4.91-5.2.0-devel+git.c59b3c2da1e9/kernel/drivers/media/pci/tw686x/tw686x.ko
license:        GPL v2
author:         Krzysztof Ha?asa <khalasa@piap.pl>
author:         Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
description:    Driver for video frame grabber cards based on Intersil/Techwell TW686[4589]
alias:          pci:v00001797d00006869sv*sd*bc*sc*i*
alias:          pci:v00001797d00006868sv*sd*bc*sc*i*
alias:          pci:v00001797d00006865sv*sd*bc*sc*i*
alias:          pci:v00001797d00006864sv*sd*bc*sc*i*
depends:        videobuf2-dma-sg
intree:         Y
name:           tw686x
vermagic:       5.4.91-5.2.0-devel+git.c59b3c2da1e9 SMP preempt mod_unload modversions aarch64
parm:           dma_interval:Minimum time span for DMA interrupting host (int)
parm:           dma_mode:DMA operation mode (memcpy/contig/sg, default=memcpy)

when i lscpci -v

root@apalis-imx8:~# lspci -v
00:00.0 PCI bridge: Freescale Semiconductor Inc Device 0000 (rev 01) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0, IRQ 568
        Memory at 60000000 (32-bit, non-prefetchable) [size=16M]
        Bus: primary=00, secondary=01, subordinate=ff, sec-latency=0
        I/O behind bridge: [disabled]
        Memory behind bridge: 62000000-620fffff [size=1M]
        Prefetchable memory behind bridge: [disabled]
        Expansion ROM at 61000000 [virtual] [disabled] [size=16M]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/16 Maskable- 64bit+
        Capabilities: [70] Express Root Port (Slot-), MSI 00
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [148] Secondary PCI Express
        Capabilities: [168] L1 PM Substates
        Kernel driver in use: pcieport

01:00.0 Unclassified device [0004]: Intersil Techwell Device 6869 (rev 01)
        Flags: fast devsel, IRQ 568
        Memory at 62000000 (32-bit, prefetchable) [size=4K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Legacy Endpoint, MSI 00
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [140] Virtual Channel
        Kernel modules: tw686x

But still i cant reach sensoray 1012(i should see 8 more video input here).

root@apalis-imx8:~# ls /dev/video*
/dev/video0  /dev/video1  /dev/video12  /dev/video13


root@apalis-imx8:~# GST_DEBUG=2 gst-device-monitor-1.0 video
Probing devices...

0:00:00.052641948  1572 0xaaaaf7281460 WARN                 default gstdevicemonitor.c:466:gst_device_monitor_start:<devicemonitor0> No providers match ths
Failed to start device monitor!

No, various SoCs just share certain IP like in this case where the PCIe IP of the i.MX 6 and i.MX 8 is similar and therefore using the same driver.

Greatings,

Thanks for your answer @saijanani.tx

bitbake -c cleanall

followed by bitbake solved some of the problems. Now there is no kernel boot error about tw868x. And now i can see an output with modinfo tw686x

root@apalis-imx8:~# modinfo tw686x
filename:       /lib/modules/5.4.91-5.2.0-devel+git.c59b3c2da1e9/kernel/drivers/media/pci/tw686x/tw686x.ko
license:        GPL v2
author:         Krzysztof Ha?asa <khalasa@piap.pl>
author:         Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
description:    Driver for video frame grabber cards based on Intersil/Techwell TW686[4589]
alias:          pci:v00001797d00006869sv*sd*bc*sc*i*
alias:          pci:v00001797d00006868sv*sd*bc*sc*i*
alias:          pci:v00001797d00006865sv*sd*bc*sc*i*
alias:          pci:v00001797d00006864sv*sd*bc*sc*i*
depends:        videobuf2-dma-sg
intree:         Y
name:           tw686x
vermagic:       5.4.91-5.2.0-devel+git.c59b3c2da1e9 SMP preempt mod_unload modversions aarch64
parm:           dma_interval:Minimum time span for DMA interrupting host (int)
parm:           dma_mode:DMA operation mode (memcpy/contig/sg, default=memcpy)

but still sensoray 1012 device is unclassified:

root@apalis-imx8:~# lspci
00:00.0 PCI bridge: Freescale Semiconductor Inc Device 0000 (rev 01)
01:00.0 Unclassified device [0004]: Intersil Techwell Device 6869 (rev 01)
root@apalis-imx8:~# lspci -v
00:00.0 PCI bridge: Freescale Semiconductor Inc Device 0000 (rev 01) (prog-if 00 [Normal decode])                         
        Flags: bus master, fast devsel, latency 0, IRQ 568                                                                
        Memory at 60000000 (32-bit, non-prefetchable) [size=16M]                                                          
        Bus: primary=00, secondary=01, subordinate=ff, sec-latency=0                                                      
        I/O behind bridge: [disabled]                                                                                     
        Memory behind bridge: 62000000-620fffff [size=1M]                                                                 
        Prefetchable memory behind bridge: [disabled]                                                                     
        Expansion ROM at 61000000 [virtual] [disabled] [size=16M]                                                         
        Capabilities: [40] Power Management version 3                                                                     
        Capabilities: [50] MSI: Enable- Count=1/16 Maskable- 64bit+                                                       
        Capabilities: [70] Express Root Port (Slot-), MSI 00                                                              
        Capabilities: [100] Advanced Error Reporting                                                                      
        Capabilities: [148] Secondary PCI Express                                                                         
        Capabilities: [168] L1 PM Substates                                                                               
        Kernel driver in use: pcieport                                                                                    
                                                                                                                          
01:00.0 Unclassified device [0004]: Intersil Techwell Device 6869 (rev 01)                                                
        Flags: fast devsel, IRQ 568                                                                                       
        Memory at 62000000 (32-bit, prefetchable) [size=4K]                                                               
        Capabilities: [40] Power Management version 3                                                                     
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+                                                        
        Capabilities: [70] Express Legacy Endpoint, MSI 00                                                                
        Capabilities: [100] Advanced Error Reporting                                                                      
        Capabilities: [140] Virtual Channel                                                                               
        Kernel modules: tw686x  

Pci has the right driver(tw686x) but still it doesnt work. There should be 8 mode video device.

root@apalis-imx8:~# ls /dev/video*                                                                                        
/dev/video0  /dev/video1  /dev/video12  /dev/video13                                                                      
root@apalis-imx8:~# GST_DEBUG=2 gst-device-monitor-1.0 video                                                              
Probing devices...                                                                                                        
                                                                                                                          
0:00:00.052878578  1933 0xaaaae7b5c460 WARN                 default gstdevicemonitor.c:466:gst_device_monitor_start:<devis
Failed to start device monitor! 

is there any idea how can i activate this device.

Best regards, Ugur

Solved:

The problem was about pci. At sturtup press space for u-boot and

# setenv defargs 'pci=nomsi coherent_pool=128M'
# saveenv
# reset

Perfect. Thanks for your Input.

Best regards,
Jaski