This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/PROCESSOR-SDK-AM335X: ti-processor-sdk-linux-am335x-evm-03.03.00.04 - ADC driver kernel panic

Part Number: PROCESSOR-SDK-AM335X
Other Parts Discussed in Thread: AM3358, AM3352

Tool/software: Linux

Hi All,

I am trying to bringup the adc  driver on am3358 sitara processor target. While loading the adc driver on target, i am facing the below kernel panic.

Please guide me what could be the issue.In addition , i have introduced the debug logs in ti_am335x_adc.c and ti_am335x_tscadc.c. But those debug logs are not coming on target while loading driver and dmesg.

PS: If i use debian package, adc driver is up and iio devices are created.

 /ti_am335x_adc.ko  insmod /lib/modules/4.4.41-gf9f6f0db2d/kernel/drivers/iio/adc/
[  237.565192] Unable to handle kernel paging request at virtual address 60070113
[  237.572475] pgd = db660000
[  237.575193] [60070113] *pgd=00000000
[  237.578795] Internal error: Oops: 5 [#1] PREEMPT ARM
[  237.583781] Modules linked in: ti_am335x_adc(+) kfifo_buf industrialio_buffer_cb iio_trig_sysfs iio_trig_interrupt industrialio ti_am335x_tscadc usb_f_acm u_ser)
[  237.649570] CPU: 0 PID: 992 Comm: insmod Tainted: G           O    4.4.41-gf9f6f0db2d #19
[  237.657781] Hardware name: Generic AM33XX (Flattened Device Tree)
[  237.663899] task: db133700 ti: db5e8000 task.ti: db5e8000
[  237.669336] PC is at strnlen+0x14/0x68
[  237.673103] LR is at string+0x3c/0x104
[  237.676869] pc : [<c02baf74>]    lr : [<c02bc4f4>]    psr: a0070193
[  237.676869] sp : db5e9c48  ip : db5e9c58  fp : db5e9c54
[  237.688395] r10: c06ca724  r9 : 00000002  r8 : db5e9d80
[  237.693640] r7 : 60070113  r6 : c09ccb2e  r5 : c09ccf04  r4 : 0000ffff
[  237.700194] r3 : ff0a0004  r2 : 60070113  r1 : ffffffff  r0 : 60070113
[  237.706751] Flags: NzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
[  237.714003] Control: 10c5387d  Table: 9b660019  DAC: 00000051
[  237.719773] Process insmod (pid: 992, stack limit = 0xdb5e8208)
[  237.725717] Stack: (0xdb5e9c48 to 0xdb5ea000)
[  237.730099] 9c40:                   db5e9c74 db5e9c58 c02bc4f4 c02baf6c c09ccb2e bf3d89f2

[  237.565192] Unable to handle kernel paging request at virtual address 60070113
[  237.572475] pgd = db660000
[  237.575193] [60070113] *pgd=00000000
[  237.578795] Internal error: Oops: 5 [#1] PREEMPT ARM
[  237.583781] Modules linked in: ti_am335x_adc(+) kfifo_buf industrialio_buffer_cb iio_trig_sysfs iio_trig_interrupt industrialio ti_am335x_tscadc usb_f_acm u_ser)
[  237.649570] CPU: 0 PID: 992 Comm: insmod Tainted: G           O    4.4.41-gf9f6f0db2d #19
[  237.657781] Hardware name: Generic AM33XX (Flattened Device Tree)
[  237.663899] task: db133700 ti: db5e8000 task.ti: db5e8000
[  237.669336] PC is at strnlen+0x14/0x68
[  237.673103] LR is at string+0x3c/0x104
[  237.676869] pc : [<c02baf74>]    lr : [<c02bc4f4>]    psr: a0070193
[  237.676869] sp : db5e9c48  ip : db5e9c58  fp : db5e9c54
[  237.688395] r10: c06ca724  r9 : 00000002  r8 : db5e9d80
[  237.693640] r7 : 60070113  r6 : c09ccb2e  r5 : c09ccf04  r4 : 0000ffff
[  237.700194] r3 : ff0a0004  r2 : 60070113  r1 : ffffffff  r0 : 60070113
[  237.706751] Flags: NzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
[  237.714003] Control: 10c5387d  Table: 9b660019  DAC: 00000051
[  237.719773] Process insmod (pid: 992, stack limit = 0xdb5e8208)
[  237.725717] Stack: (0xdb5e9c48 to 0xdb5ea000)
[  237.730099] 9c40:                   db5e9c74 db5e9c58 c02bc4f4 c02baf6c c09ccb2e bf3d89f2

 

Thanks & Regards,

Krishna

  • Hi,

    But those debug logs are not coming on target while loading driver and dmesg.


    Do you mean that the driver is loaded upon device bootup and you're trying to re-load it from user space? In this case there are probably some memory access issues, because the adc is used for the touchscreen as well.

    Have you seen this wiki guide:
    processors.wiki.ti.com/.../Processor_SDK_Linux_ADC

    If the adc driver is loaded upon device boot, you can use the sysfs entries as specified in the above wiki:
    processors.wiki.ti.com/.../Linux_Core_ADC_Users_Guide

    Best Regards,
    Yordan
  • Hi Yordan,

    Thanks for your quick response.

    Yes, I am already referring the ADC wiki and Linux core adc usersguide.

    While am335x boot up with processor sdk  images(Uboot, MLO, kernel, device tree and rootfs), ADC, IIO and touchscreen driver(static ) are not loaded automatically. So, i built the ADC, IIO and touchscreen driver as loadable module.While loading the adc driver as kernel module after device boot up, i am facing the above kernel panic.

    Below is my present kernel config:

    CONFIG_MFD_TI_AM335X_TSCADC=m

    CONFIG_TI_AM335X_ADC=m

    CONFIG_IIO=m
    CONFIG_IIO_BUFFER=y
    CONFIG_IIO_BUFFER_CB=m
    CONFIG_IIO_KFIFO_BUF=m
    CONFIG_IIO_TRIGGER=y
    CONFIG_IIO_CONSUMERS_PER_TRIGGER=2

    In addition, while booting the am335x device with beagleboard debian package, ADC, touch screen and IIO driver are loaded automatically and able to access adc pins using sys interface. But in processor sdk adc driver, i am facing issues.

    Please provide yours valuable suggestion, I am stucked.

    Thanks & Regards,

    Krishna

  • Hi,

    Can you enable the driver as built-in kernel module, this should enable the automatic loading upon boot up? This means all related CONFIG_* in kernel config file are defined as y.
    Please show the bootlog after configuring your kernel as I suggested.

    Best Regards,
    Yordan
  • Hi Yordan,

    As suggested, I have enabled the driver as built-in module.Below are the kernel config:

    CONFIG_MFD_TI_AM335X_TSCADC=y
    CONFIG_TI_AM335X_ADC=y
    CONFIG_IIO_INTERRUPT_TRIGGER=y
    CONFIG_IIO_SYSFS_TRIGGER=y
    CONFIG_IIO=y
    CONFIG_IIO_BUFFER=y
    CONFIG_IIO_BUFFER_CB=y
    CONFIG_IIO_KFIFO_BUF=y
    CONFIG_IIO_TRIGGER=y
    CONFIG_IIO_CONSUMERS_PER_TRIGGER=2

    Below are the adc device node in device tree:

                    tscadc@44e0d000 {
                            compatible = "ti,am3359-tscadc";
                            reg = <0x44e0d000 0x1000>;
                            interrupt-parent = <0x1>;
                            interrupts = <0x10>;
                            ti,hwmods = "adc_tsc";
                            status = "disabled";

                            tsc {
                                    compatible = "ti,am3359-tsc";
                                    ti,wires = <0x4>;
                                    ti,coordinate-readouts = <0x5>;
                            };

                            adc {
                                    #io-channel-cells = <0x1>;
                                    compatible = "ti,am3359-adc";
                                    ti,adc-channels = <0x1 0x2 0x3 0x4 0x5 0x6 0x7>;
                            };
                    };

    I have removed the debug logs from adc driver and loaded the updated zImage to sd card.But now there null pointer dereference error.Please fine the kernel booting logs below:


    U-Boot 2016.05-g4db46a6bbd (Mar 29 2017 - 17:44:45 -0400)

    CPU  : AM335X-GP rev 2.1
    Model: TI AM335x BeagleBone Black
           Watchdog enabled
    DRAM:  512 MiB
    NAND:  0 MiB
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    reading uboot.env

    ** Unable to read "uboot.env" from mmc0:1 **
    Using default environment

    <ethaddr> not set. Validating first E-fuse MAC
    Net:   eth0: ethernet@4a100000
    Warning: usb_ether MAC addresses don't match:
    Address in SROM is         de:ad:be:ef:00:01
    Address in environment is  38:d2:69:52:92:5a
    , eth1: usb_ether
    Press SPACE to abort autoboot in 2 seconds
    switch to partitions #0, OK
    mmc0 is current device
    SD/MMC found on device 0
    reading boot.scr
    ** Unable to read file boot.scr **
    reading uEnv.txt
    ** Unable to read file uEnv.txt **
    switch to partitions #0, OK
    mmc0 is current device
    Scanning mmc 0:1...
    switch to partitions #0, OK
    mmc0 is current device
    SD/MMC found on device 0
    3580432 bytes read in 235 ms (14.5 MiB/s)
    37364 bytes read in 62 ms (587.9 KiB/s)
    Kernel image @ 0x82000000 [ 0x000000 - 0x36a210 ]
    ## Flattened Device Tree blob at 88000000
       Booting using the fdt blob at 0x88000000
       Loading Device Tree to 8fff3000, end 8ffff1f3 ... OK

    Starting kernel ...

    [    0.000000] Booting Linux on physical CPU 0x0
    [    0.000000] Initializing cgroup subsys cpu
    [    0.000000] Initializing cgroup subsys cpuacct
    [    0.000000] Linux version 4.4.41-gf9f6f0db2d (root@nikon-ThinkCentre-M73) (gcc version 4.8.4 (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04.1) ) #33 PREEMPT Wed Aug 16 06:7
    [    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
    [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
    [    0.000000] Machine model: TI AM335x BeagleBone Black
    [    0.000000] cma: Reserved 48 MiB at 0x9d000000
    [    0.000000] Memory policy: Data cache writeback
    [    0.000000] CPU: All CPU(s) started in SVC mode.
    [    0.000000] AM335X ES2.1 (sgx neon )
    [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 129920
    [    0.000000] Kernel command line: console=ttyO0,115200n8 root=PARTUUID=0002b18b-02 rw rootfstype=ext4 rootwait
    [    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: 459688K/524288K available (6691K kernel code, 368K rwdata, 2504K rodata, 276K init, 265K bss, 15448K reserved, 49152K cma-reserved, 0K highm)
    [    0.000000] Virtual kernel memory layout:
    [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    [    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    [    0.000000]     vmalloc : 0xe0800000 - 0xff800000   ( 496 MB)
    [    0.000000]     lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
    [    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    [    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
    [    0.000000]       .text : 0xc0008000 - 0xc0902fd4   (9196 kB)
    [    0.000000]       .init : 0xc0903000 - 0xc0948000   ( 276 kB)
    [    0.000000]       .data : 0xc0948000 - 0xc09a41b8   ( 369 kB)
    [    0.000000]        .bss : 0xc09a41b8 - 0xc09e6970   ( 266 kB)
    [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    [    0.000000] Preemptible hierarchical RCU implementation.
    [    0.000000]  Build-time adjustment of leaf fanout to 32.
    [    0.000000] NR_IRQS:16 nr_irqs:16 16
    [    0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
    [    0.000000] OMAP clockevent source: timer2 at 24000000 Hz
    [    0.000014] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
    [    0.000032] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
    [    0.000040] OMAP clocksource: timer1 at 24000000 Hz
    [    0.000189] clocksource_probe: no matching clocksources found
    [    0.000351] Console: colour dummy device 80x30
    [    0.000373] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
    [    0.000379] This ensures that you still see kernel messages. Please
    [    0.000383] update your kernel commandline.
    [    0.000400] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
    [    0.089206] pid_max: default: 32768 minimum: 301
    [    0.089309] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.089319] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.089926] Initializing cgroup subsys io
    [    0.089953] Initializing cgroup subsys memory
    [    0.089988] Initializing cgroup subsys devices
    [    0.090002] Initializing cgroup subsys freezer
    [    0.090014] Initializing cgroup subsys perf_event
    [    0.090026] Initializing cgroup subsys pids
    [    0.090050] CPU: Testing write buffer coherency: ok
    [    0.090421] Setting up static identity map for 0x80008200 - 0x80008260
    [    0.094197] devtmpfs: initialized
    [    0.104195] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
    [    0.117241] omap_hwmod: debugss: _wait_target_disable failed
    [    0.171948] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [    0.175382] pinctrl core: initialized pinctrl subsystem
    [    0.176553] NET: Registered protocol family 16
    [    0.178434] DMA: preallocated 256 KiB pool for atomic coherent allocations
    [    0.209198] cpuidle: using governor ladder
    [    0.239189] cpuidle: using governor menu
    [    0.243000] OMAP GPIO hardware version 0.1
    [    0.252606] hw-breakpoint: debug architecture 0x4 unsupported.
    [    0.286295] edma 49000000.edma: TI EDMA DMA engine driver
    [    0.289667] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins, deferring probe
    [    0.289722] omap_i2c 4819c000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c2_pins, deferring probe
    [    0.289829] media: Linux media interface: v0.10
    [    0.289880] Linux video capture interface: v2.00
    [    0.289922] pps_core: LinuxPPS API ver. 1 registered
    [    0.289929] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
    [    0.289953] PTP clock support registered
    [    0.290002] EDAC MC: Ver: 3.0.0
    [    0.291019] omap-mailbox 480c8000.mailbox: omap mailbox rev 0x400
    [    0.291270] Advanced Linux Sound Architecture Driver Initialized.
    [    0.292283] clocksource: Switched to clocksource timer1
    [    0.301439] NET: Registered protocol family 2
    [    0.302111] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
    [    0.302156] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    [    0.302194] TCP: Hash tables configured (established 4096 bind 4096)
    [    0.302261] UDP hash table entries: 256 (order: 0, 4096 bytes)
    [    0.302339] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    [    0.302485] NET: Registered protocol family 1
    [    0.302850] RPC: Registered named UNIX socket transport module.
    [    0.302864] RPC: Registered udp transport module.
    [    0.302870] RPC: Registered tcp transport module.
    [    0.302875] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [    0.303731] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
    [    0.305428] futex hash table entries: 256 (order: -1, 3072 bytes)
    [    0.312433] squashfs: version 4.0 (2009/01/31) Phillip Lougher
    [    0.313145] NFS: Registering the id_resolver key type
    [    0.313203] Key type id_resolver registered
    [    0.313210] Key type id_legacy registered
    [    0.313280] ntfs: driver 2.1.32 [Flags: R/O].
    [    0.316440] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 248)
    [    0.316472] io scheduler noop registered
    [    0.316484] io scheduler deadline registered
    [    0.316610] io scheduler cfq registered (default)
    [    0.317832] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
    [    0.370351] Serial: 8250/16550 driver, 10 ports, IRQ sharing disabled
    [    0.373237] KRISHNA::omap8250_probe
    [    0.374070] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 158, base_baud = 3000000) is a 8250
    [    0.986406] console [ttyS0] enabled
    [    0.990264] KRISHNA::omap8250_probe
    [    0.994512] 48022000.serial: ttyS1 at MMIO 0x48022000 (irq = 159, base_baud = 3000000) is a 8250
    [    1.003738] KRISHNA::omap8250_probe
    [    1.007868] 48024000.serial: ttyS2 at MMIO 0x48024000 (irq = 160, base_baud = 3000000) is a 8250
    [    1.017079] KRISHNA::omap8250_probe
    [    1.021160] 481a6000.serial: ttyS3 at MMIO 0x481a6000 (irq = 161, base_baud = 3000000) is a 8250
    [    1.030376] KRISHNA::omap8250_probe
    [    1.034505] 481a8000.serial: ttyS4 at MMIO 0x481a8000 (irq = 162, base_baud = 3000000) is a 8250
    [    1.043696] KRISHNA::omap8250_probe
    [    1.047756] 481aa000.serial: ttyS5 at MMIO 0x481aa000 (irq = 163, base_baud = 3000000) is a 8250
    [    1.057527] [drm] Initialized drm 1.1.0 20060810
    [    1.068775] loop: module loaded
    [    1.074266] libphy: Fixed MDIO Bus: probed
    [    1.142355] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
    [    1.148491] davinci_mdio 4a101000.mdio: detected phy mask fffffffe
    [    1.155575] libphy: 4a101000.mdio: probed
    [    1.159615] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720
    [    1.169532] cpsw 4a100000.ethernet: Detected MACID = 38:d2:69:52:92:58
    [    1.176305] cpsw 4a100000.ethernet: cpts: overflow check period 850
    [    1.184223] mousedev: PS/2 mouse device common for all mice
    [    1.190337] i2c /dev entries driver
    [    1.194882] cpuidle: enable-method property 'ti,am3352' found operations
    [    1.202439] omap_hsmmc 48060000.mmc: Got CD GPIO
    [    1.279521] mmc0: host does not support reading read-only switch, assuming write-enable
    [    1.289041] ledtrig-cpu: registered to indicate activity on CPUs
    [    1.295608] KRISHNA:: iio_init
    [    1.298800] mmc0: new high speed SDHC card at address 59b4
    [    1.304414] KRISHNA:: devm_iio_device_alloc
    [    1.308614] KRISHNA:: iio_device_alloc
    [    1.312993] mmcblk0: mmc0:59b4 SS04G 3.69 GiB
    [    1.318158] Unable to handle kernel NULL pointer dereference at virtual address 00000000
    [    1.326290] pgd = c0004000
    [    1.329005] [00000000] *pgd=00000000
    [    1.332605] Internal error: Oops: 805 [#1] PREEMPT ARM
    [    1.337761] Modules linked in:
    [    1.340834] CPU: 0 PID: 1 Comm: swapper Not tainted 4.4.41-gf9f6f0db2d #33
    [    1.347735] Hardware name: Generic AM33XX (Flattened Device Tree)
    [    1.353852] task: dc05c000 ti: dc056000 task.ti: dc056000
    [    1.359284] PC is at add_dr+0x28/0x34
    [    1.362960] LR is at devres_add+0x34/0x6c
    [    1.366984] pc : [<c03f1068>]    lr : [<c03f10a8>]    psr: 60000093
    [    1.366984] sp : dc057e38  ip : dc057e48  fp : dc057e44
    [    1.378507] r10: c0939838  r9 : 00000000  r8 : c092efe4
    [    1.383751] r7 : c0903604  r6 : dc42de90  r5 : dc42b000  r4 : a0000013
    [    1.390301] r3 : 00000000  r2 : dc42dfcc  r1 : dc42de40  r0 : dc42de90
    [    1.396855] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
    [    1.404105] Control: 10c5387d  Table: 80004019  DAC: 00000051
    [    1.409871] Process swapper (pid: 1, stack limit = 0xdc056208)
    [    1.415725] Stack: (0xdc057e38 to 0xdc058000)
    [    1.420099] 7e20:                                                       dc057e5c dc057e48
    [    1.428313] 7e40: c03f10a8 c03f104c dc42b180 dc42de50 dc057e7c dc057e60 c0527004 c03f1080
    [    1.436527] 7e60: ffff0000 c094cd20 c094cd20 dc42de40 dc057ecc dc057e80 c092f030 c0526fa8
    [    1.444741] 7e80: 00000000 dc057ec8 00000006 dc42de90 dc42de80 c0903604 dc057ec0 dc057ea8
    [    1.452954] 7ea0: c02b99e0 c094cd20 c094cd20 dc42de40 c0903604 c092efe4 00000000 c0939838
    [    1.461168] 7ec0: dc057f4c dc057ed0 c00096b8 c092eff0 dc057ef4 dc057ee0 00000000 dcfff604
    [    1.469382] 7ee0: c06c2700 000000a8 dc057f4c dc057ef8 c004e0ec c0903610 00000000 00000000
    [    1.477595] 7f00: c0939810 00000006 00000006 c0998530 00000000 c0900ffc c08952b0 00000000
    [    1.485809] 7f20: c0954778 00000006 c09a41c0 c09a41c0 c0903604 c09464b0 c093982c c0939838
    [    1.494022] 7f40: dc057f94 dc057f50 c0903ea4 c0009600 00000006 00000006 00000000 c0903604
    [    1.502236] 7f60: ffff0000 000000a8 ffff0000 00000000 c068b334 00000000 00000000 00000000
    [    1.510449] 7f80: 00000000 00000000 dc057fac dc057f98 c068b344 c0903d74 dc056000 00000000
    [    1.518662] 7fa0: 00000000 dc057fb0 c0010478 c068b340 00000000 00000000 00000000 00000000
    [    1.526875] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    [    1.535088] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 ffff0000 ffff0000
    [    1.543295] Backtrace:
    [    1.545760] [<c03f1040>] (add_dr) from [<c03f10a8>] (devres_add+0x34/0x6c)
    [    1.552670] [<c03f1074>] (devres_add) from [<c0527004>] (devm_iio_device_alloc+0x68/0x8c)
    [    1.560877]  r4:dc42de50 r3:dc42b180
    [    1.564480] [<c0526f9c>] (devm_iio_device_alloc) from [<c092f030>] (tiadc_probe+0x4c/0x340)
    [    1.572860]  r6:dc42de40 r5:c094cd20 r4:c094cd20 r3:ffff0000
    [    1.578567] [<c092efe4>] (tiadc_probe) from [<c00096b8>] (do_one_initcall+0xc4/0x1fc)
    [    1.586425]  r10:c0939838 r9:00000000 r8:c092efe4 r7:c0903604 r6:dc42de40 r5:c094cd20
    [    1.594311]  r4:c094cd20
    [    1.596862] [<c00095f4>] (do_one_initcall) from [<c0903ea4>] (kernel_init_freeable+0x13c/0x1dc)
    [    1.605592]  r10:c0939838 r9:c093982c r8:c09464b0 r7:c0903604 r6:c09a41c0 r5:c09a41c0
    [    1.613477]  r4:00000006
    [    1.616032] [<c0903d68>] (kernel_init_freeable) from [<c068b344>] (kernel_init+0x10/0xfc)
    [    1.624240]  r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c068b334
    [    1.632122]  r4:00000000
    [    1.634675] [<c068b334>] (kernel_init) from [<c0010478>] (ret_from_fork+0x14/0x3c)
    [    1.642272]  r4:00000000 r3:dc056000
    [    1.645871] Code: e5903140 e2802f4f e5801140 e881000c (e5831000)
    [    1.652022] ---[ end trace 5fb105c6bff1b099 ]---
    [    1.656660] note: swapper[1] exited with preempt_count 1
    [    1.662260]  mmcblk0: p1 p2
    [    1.665349] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
    [    1.665349]
    [    1.674528] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
    [    1.674528]
    [   82.622305] random: nonblocking pool is initialized

    I have added the adc node in boneblack.device tree took reference from amm335x-evm device tree.

    Please suggest.

    Thanks & Regards,

    Krishna

  • Hi Yordan,

    I have introduced the debug logs in industrialio-core.c driver iio_device_alloc() function called by devm_iio_device_alloc () which in turn called by tiadc_probe() function.Below are the logs:

    I have printed the dev->id of allocated iio device i.e 0.

    [ 1.285533] KRISHNA:: iio_init
    [ 1.288727] mmc0: new high speed SDHC card at address 59b4
    [ 1.294343] KRISHNA::tiadc_probe
    [ 1.297585] KRISHNA:: devm_iio_device_alloc
    [ 1.301781] KRISHNA:: iio_device_alloc
    [ 1.306152] mmcblk0: mmc0:59b4 SS04G 3.69 GiB
    [ 1.311274] KRISHNA::Size allocated
    [ 1.314938] mmcblk0: p1 p2
    [ 1.318103] KRISHNA:: Memory allocated for dev
    [ 1.323071] KRISHNA:: iio_dev structured initialised
    [ 1.328136] KRISHNA:: iio device id - 0
    [ 1.333090] KRISHNA:: iio device name set -iio:device0
    [ 1.340263] KRISHNA:: Returning iio device
    [ 1.344467] Unable to handle kernel NULL pointer dereference at virtual address 00000000

    Please provide yours valuable suggestions. I feel in adc driver there should no bugs. Can you please verify the adc node i have added in device tree.

    Thanks for yours help and previous inputs!!

    Thanks & Regards,
    Krishna
  • Hi,

    Can you change the status to "enable", like bellow:
    tscadc@44e0d000 {
    compatible = "ti,am3359-tscadc";
    reg = <0x44e0d000 0x1000>;
    interrupt-parent = <0x1>;
    interrupts = <0x10>;
    ti,hwmods = "adc_tsc";
    status = "enabled";

    tsc {
    compatible = "ti,am3359-tsc";
    ti,wires = <0x4>;
    ti,coordinate-readouts = <0x5>;
    };

    adc {
    #io-channel-cells = <0x1>;
    compatible = "ti,am3359-adc";
    ti,adc-channels = <0x1 0x2 0x3 0x4 0x5 0x6 0x7>;
    };
    };

    From the dts part you've shared I see you keep tscadc status as disabled & you're trying to insmod the driver, which could cause a problem.

    Best Regards,
    Yordan
  • Hi Yordan,

    Thanks for yours valuable suggestion.

    Presently, I am not trying to insmod the driver. As suggested earlier, I have changed the kernel config to build adc driver as static driver.

    I have changed the tscadc status to enabled and facing the same kernel panic(Static adc driver).

    Can you please let me know if i can get the kernel source of debian image, since adc driver is working with debian image.Then, i can port adc driver from debian kernel source to TI processor sdk kernel. I have tried to reuse debian package device tree(adc node) with processor sdk adc driver but it did not worked.It means adc driver is different in beaglebone debian package and processor sdk.

    Please suggest if this approach is correct.

    Thanks & Regards,

    Krishna

  • Hi Yordan,

    Can you please help. Please provide pointers to proceed.

    Thanks & Regards,

    Krishna