3 Replies Latest reply on Sep 25, 2014 12:09 PM by Simba

    Kernel crash during AD7606 driver probe.

    Simba

      Hi,

      I have included AD7606 adc driver in the BSP 1.0.0 build as a SPI platform driver.

      Followed Instructions from http://wiki.analog.com/resources/tools-software/linux-drivers/iio-adc/ad7606

       

      Kernel crashes during the AD7606 driver probe [in build into the kernel image]. Reset function in the AD7606 probe does some gpio_set_value(st->pdata->gpio_reset, 1); which causes the kernel crash.

      Before that step ad7606_request_gpios() is executed with out errors. This requests all the GPIO's required by the AD7606 & reports error if any.

       

      Even while starting conversion there is gpio_set_value() call which is causing kernel crash.

       

      Need help in resolving this issue.

      Note: I have disabled "spidev" module as ad7606 is using SPI 1.

       

      Regards,

      - Simba

       

      Below shown is the excerpt of the kernel logs showing these error logs:

       

      [   14.377899] GAL_QRK: intel_qrk_gpio_restrict_probe.

      [   14.382921] AD7606: INT gpio line request in restrict probe.

      [   14.388618] AD7606: Requesting INT gpio line.

      [   14.393070] AD7606: Valid 30 15 INT gpio line.

      [   14.461243] AD7606: Allocating INT gpio line SUCCESS GPIO 15 IRQ 63. // For BUSY Signal

      [   14.467746] AD7606: spi registration request in restrict probe.

      [   14.473776] AD7606: SPI registration.

      [   14.487241] spi spi1.1: 500000 Hz actual, PIO

      [   14.487306] spi spi1.1: setup mode 3, 8 bits/w, 4000000 Hz max --> 0

      [   14.492795] AD7606: Registering AD7606 as a SPI platform device.

      [   14.498958] AD7606: Driver Probe.

      [   14.502387] AD7606: ad7606 Requesting GPIOs.

      [   14.575720] AD7606: GPIO's allocation succeded.

      [   14.580452] AD7606: Calling Reset.

      [   14.583908] AD7606: Apply Reset to GPIO 28. // custom print before executing gpio_set_value(st->pdata->gpio_reset, 1);

      // CRASH during the reset

      [   14.588112] ------------[ cut here ]------------

      [   14.592870] WARNING: at /home/simba/Galileo/meta-clanton_v1.0.0/yocto_build/tmp/work/clanton-poky-linux/linux-yocto-clanton/3.8-r0/linux/drivers/gpio/gpiolib.c:1921 __gpio_set_value+0x8d/0xa0()

      [   14.610306] Hardware name: QUARK

      [   14.613566] Modules linked in: cy8c9540a at24 spi_pxa2xx gpio_sch intel_qrk_gip uio spi_pxa2xx_pci evdev mmc_block ehci_pci ehci_hcd ohci_hcd sdhci_pci sdhci led_class stmmac usbcore usb_common mmc_core

      [   14.632060] Pid: 6, comm: kworker/u:0 Not tainted 3.8.7-yocto-standard #22

      [   14.638967] Call Trace:

      [   14.641547]  [<c1029d2d>] warn_slowpath_common+0x6d/0xa0

      [   14.646926]  [<c116275d>] ? __gpio_set_value+0x8d/0xa0

      [   14.652197]  [<c116275d>] ? __gpio_set_value+0x8d/0xa0

      [   14.657404]  [<c1029d7d>] warn_slowpath_null+0x1d/0x20

      [   14.662680]  [<c116275d>] __gpio_set_value+0x8d/0xa0

      [   14.667704]  [<c1232a96>] ad7606_reset+0x36/0x70

      [   14.672453]  [<c12331e3>] ad7606_probe+0x483/0x530

      [   14.677306]  [<c1233699>] ad7606_spi_probe+0x39/0x60

      [   14.682401]  [<c1212835>] spi_drv_probe+0x15/0x20

      [   14.687164]  [<c11e68a6>] driver_probe_device+0x56/0x1e0

      [   14.692608]  [<c121355a>] ? spi_match_device+0x3a/0x90

      [   14.697805]  [<c11e6ac0>] ? __driver_attach+0x90/0x90

      [   14.702987]  [<c11e6af9>] __device_attach+0x39/0x50

      [   14.707939]  [<c11e51f4>] bus_for_each_drv+0x34/0x70

      [   14.713038]  [<c11e681b>] device_attach+0x7b/0x90

      [   14.717797]  [<c11e6ac0>] ? __driver_attach+0x90/0x90

      [   14.722976]  [<c11e5ec7>] bus_probe_device+0x67/0x90

      [   14.728011]  [<c11e4896>] device_add+0x556/0x600

      [   14.732769]  [<c121324e>] spi_add_device+0xee/0x1c0

      [   14.737709]  [<c1213b56>] spi_new_device+0x76/0xa0

      [   14.742638]  [<c1213bb9>] spi_match_master_to_boardinfo+0x39/0x60

      [   14.748793]  [<c1213fcd>] ? spi_register_board_info+0x1d/0x130

      [   14.754765]  [<c1214091>] spi_register_board_info+0xe1/0x130

      [   14.760573]  [<c123444f>] intel_qrk_gpio_restrict_probe+0xff/0x320

      [   14.766825]  [<c11e82c2>] platform_drv_probe+0x32/0x60

      [   14.772104]  [<c11e68a6>] driver_probe_device+0x56/0x1e0

      [   14.777480]  [<c11e8239>] ? platform_match+0x29/0x80

      [   14.782581]  [<c11e6ac0>] ? __driver_attach+0x90/0x90

      [   14.787688]  [<c11e6af9>] __device_attach+0x39/0x50

      [   14.792713]  [<c11e51f4>] bus_for_each_drv+0x34/0x70

      [   14.797743]  [<c11e681b>] device_attach+0x7b/0x90

      [   14.802577]  [<c11e6ac0>] ? __driver_attach+0x90/0x90

      [   14.807692]  [<c11e5ec7>] bus_probe_device+0x67/0x90

      [   14.812791]  [<c11e632b>] deferred_probe_work_func+0x5b/0x90

      [   14.818516]  [<c103db1e>] process_one_work+0x10e/0x370

      [   14.823795]  [<c1035095>] ? internal_add_timer+0x15/0x40

      [   14.829178]  [<c103e9f1>] worker_thread+0x101/0x330

      [   14.834198]  [<c103e8f0>] ? busy_worker_rebind_fn+0xb0/0xb0

      [   14.839843]  [<c104248e>] kthread+0x8e/0xa0

      [   14.844179]  [<c12c957b>] ret_from_kernel_thread+0x1b/0x30

      [   14.849743]  [<c1042400>] ? kthread_create_on_node+0xa0/0xa0

      [   14.855521] ---[ end trace 9f8a8a16f6b3e7c2 ]---

      [   14.865754] ------------[ cut here ]------------

      [   14.870624] WARNING: at /home/simba/Galileo/meta-clanton_v1.0.0/yocto_build/tmp/work/clanton-poky-linux/linux-yocto-clanton/3.8-r0/linux/drivers/gpio/gpiolib.c:1921 __gpio_set_value+0x8d/0xa0()

      [   14.888057] Hardware name: QUARK

      [   14.891369] Modules linked in: cy8c9540a at24 spi_pxa2xx gpio_sch intel_qrk_gip uio spi_pxa2xx_pci evdev mmc_block ehci_pci ehci_hcd ohci_hcd sdhci_pci sdhci led_class stmmac usbcore usb_common mmc_core

      [   14.909831] Pid: 6, comm: kworker/u:0 Tainted: G        W    3.8.7-yocto-standard #22

      [   14.917763] Call Trace:

      [   14.920336]  [<c1029d2d>] warn_slowpath_common+0x6d/0xa0

      [   14.925714]  [<c116275d>] ? __gpio_set_value+0x8d/0xa0

      [   14.930985]  [<c116275d>] ? __gpio_set_value+0x8d/0xa0

      [   14.936193]  [<c1029d7d>] warn_slowpath_null+0x1d/0x20

      [   14.941469]  [<c116275d>] __gpio_set_value+0x8d/0xa0

      [   14.946493]  [<c1232aad>] ad7606_reset+0x4d/0x70

      [   14.951240]  [<c12331e3>] ad7606_probe+0x483/0x530

      [   14.956093]  [<c1233699>] ad7606_spi_probe+0x39/0x60

      [   14.961189]  [<c1212835>] spi_drv_probe+0x15/0x20

      [   14.965952]  [<c11e68a6>] driver_probe_device+0x56/0x1e0

      [   14.971399]  [<c121355a>] ? spi_match_device+0x3a/0x90

      [   14.976597]  [<c11e6ac0>] ? __driver_attach+0x90/0x90

      [   14.981778]  [<c11e6af9>] __device_attach+0x39/0x50

      [   14.986731]  [<c11e51f4>] bus_for_each_drv+0x34/0x70

      [   14.991832]  [<c11e681b>] device_attach+0x7b/0x90

      [   14.996591]  [<c11e6ac0>] ? __driver_attach+0x90/0x90

      [   15.001780]  [<c11e5ec7>] bus_probe_device+0x67/0x90

      [   15.006815]  [<c11e4896>] device_add+0x556/0x600

      [   15.011574]  [<c121324e>] spi_add_device+0xee/0x1c0

      [   15.016513]  [<c1213b56>] spi_new_device+0x76/0xa0

      [   15.021441]  [<c1213bb9>] spi_match_master_to_boardinfo+0x39/0x60

      [   15.027596]  [<c1213fcd>] ? spi_register_board_info+0x1d/0x130

      [   15.033568]  [<c1214091>] spi_register_board_info+0xe1/0x130

      [   15.039299]  [<c123444f>] intel_qrk_gpio_restrict_probe+0xff/0x320

      [   15.045628]  [<c11e82c2>] platform_drv_probe+0x32/0x60

      [   15.050934]  [<c11e68a6>] driver_probe_device+0x56/0x1e0

      [   15.056312]  [<c11e8239>] ? platform_match+0x29/0x80

      [   15.061436]  [<c11e6ac0>] ? __driver_attach+0x90/0x90

      [   15.066544]  [<c11e6af9>] __device_attach+0x39/0x50

      [   15.071573]  [<c11e51f4>] bus_for_each_drv+0x34/0x70

      [   15.076602]  [<c11e681b>] device_attach+0x7b/0x90

      [   15.081437]  [<c11e6ac0>] ? __driver_attach+0x90/0x90

      [   15.086550]  [<c11e5ec7>] bus_probe_device+0x67/0x90

      [   15.091647]  [<c11e632b>] deferred_probe_work_func+0x5b/0x90

      [   15.097372]  [<c103db1e>] process_one_work+0x10e/0x370

      [   15.102651]  [<c1035095>] ? internal_add_timer+0x15/0x40

      [   15.108034]  [<c103e9f1>] worker_thread+0x101/0x330

      [   15.113066]  [<c103e8f0>] ? busy_worker_rebind_fn+0xb0/0xb0

      [   15.118713]  [<c104248e>] kthread+0x8e/0xa0

      [   15.123049]  [<c12c957b>] ret_from_kernel_thread+0x1b/0x30

      [   15.128613]  [<c1042400>] ? kthread_create_on_node+0xa0/0xa0

      [   15.134393] ---[ end trace 9f8a8a16f6b3e7c3 ]---

      [   15.147330] EFI Variables Facility v0.08 2004-May-17

      [   15.159464] AD7606: IRQ 63 req.

      [   15.171959] AD7606: Probe succeded 0xCE6BEC00.

      [   15.199578] pxa2xx-spi pxa2xx-spi.1: registered child spi1.1

      [   15.199620] GAL_QRK: intel_qrk_gpio_restrict_probe() END 0.

      // AD7606 probe shown as successful with out other errors.

      [   17.673959] eth0: device MAC address 98:4f:ee:00:88:54

      [   19.670199] libphy: stmmac-1:01 - Link is Up - 100/Half

      [   25.720865] NET: Registered protocol family 10

      [   27.768874] eth0: device MAC address 98:4f:ee:00:88:54

      [   27.835222] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready

      [   29.810321] libphy: stmmac-1:01 - Link is Up - 100/Half

      [   29.815623] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

      root@clanton:~#

      root@clanton:~#

      root@clanton:~# cat /proc/kmsg

      <4>[ 1269.919841] AD7606: ad7606_scan_direct() setting convst.

      <4>[ 1269.925310] ------------[ cut here ]------------

      <4>[ 1269.930013] WARNING: at /home/simba/Galileo/meta-clanton_v1.0.0/yocto_build/tmp/work/clanton-poky-linux/linux-yocto-clanton/3.8-r0/linux/drivers/gpio/gpiolib.c:1921 __gpio_set_value+0x8d/0xa0()

      <4>[ 1269.947590] Hardware name: QUARK

      <4>[ 1269.950925] Modules linked in: ipv6 efivars cy8c9540a at24 spi_pxa2xx gpio_sch intel_qrk_gip uio spi_pxa2xx_pci evdev mmc_block ehci_pci ehci_hcd ohci_hcd sdhci_pci sdhci led_class stmmac usbcore usb_common mmc_core

      <4>[ 1269.970618] Pid: 1448, comm: cat Tainted: G        W    3.8.7-yocto-standard #22

      <4>[ 1269.978047] Call Trace:

      <4>[ 1269.980633]  [<c1029d2d>] warn_slowpath_common+0x6d/0xa0

      <4>[ 1269.986012]  [<c116275d>] ? __gpio_set_value+0x8d/0xa0

      <4>[ 1269.991293]  [<c116275d>] ? __gpio_set_value+0x8d/0xa0

      <4>[ 1269.996499]  [<c1029d7d>] warn_slowpath_null+0x1d/0x20

      <4>[ 1270.001784]  [<c116275d>] __gpio_set_value+0x8d/0xa0

      <4>[ 1270.006807]  [<c1232bb4>] ad7606_read_raw+0xe4/0x290

      <4>[ 1270.011944]  [<c1237702>] iio_read_channel_info+0x32/0x1f0

      <4>[ 1270.017502]  [<c12376d0>] ? iio_read_const_attr+0x20/0x20

      <4>[ 1270.023060]  [<c11e3c4a>] dev_attr_show+0x1a/0x50

      <4>[ 1270.027828]  [<c10f294a>] sysfs_read_file+0x7a/0x110

      <4>[ 1270.032942]  [<c10a8066>] ? rw_verify_area+0x66/0x130

      <4>[ 1270.038058]  [<c10f28d0>] ? sysfs_write_file+0xf0/0xf0

      <4>[ 1270.043347]  [<c10a8300>] vfs_read+0x80/0x150

      <4>[ 1270.047774]  [<c107f38a>] ? sys_fadvise64_64+0x1a/0x250

      <4>[ 1270.053145]  [<c10f28d0>] ? sysfs_write_file+0xf0/0xf0

      <4>[ 1270.058355]  [<c10a8412>] sys_read+0x42/0x80

      <4>[ 1270.062780]  [<c12c8f18>] syscall_call+0x7/0xb

      <4>[ 1270.067271] ---[ end trace 9f8a8a16f6b3e7c4 ]---

       

       

      <4>[ 1297.526353] ------------[ cut here ]------------

      <4>[ 1297.531176] WARNING: at /home/simba/Galileo/meta-clanton_v1.0.0/yocto_build/tmp/work/clanton-poky-linux/linux-yocto-clanton/3.8-r0/linux/drivers/gpio/gpiolib.c:1921 __gpio_set_value+0x8d/0xa0()

      <4>[ 1297.548615] Hardware name: QUARK

      <4>[ 1297.551923] Modules linked in: ipv6 efivars cy8c9540a at24 spi_pxa2xx gpio_sch intel_qrk_gip uio spi_pxa2xx_pci evdev mmc_block ehci_pci ehci_hcd ohci_hcd sdhci_pci sdhci led_class stmmac usbcore usb_common mmc_core

      <4>[ 1297.571732] Pid: 1448, comm: cat Tainted: G        W    3.8.7-yocto-standard #22

      <4>[ 1297.579161] Call Trace:

      <4>[ 1297.581750]  [<c1029d2d>] warn_slowpath_common+0x6d/0xa0

      <4>[ 1297.587129]  [<c116275d>] ? __gpio_set_value+0x8d/0xa0

      <4>[ 1297.592412]  [<c116275d>] ? __gpio_set_value+0x8d/0xa0

      <4>[ 1297.597619]  [<c1029d7d>] warn_slowpath_null+0x1d/0x20

      <4>[ 1297.602927]  [<c116275d>] __gpio_set_value+0x8d/0xa0

      <4>[ 1297.607951]  [<c1232d1e>] ad7606_read_raw+0x24e/0x290

      <4>[ 1297.613161]  [<c1042a70>] ? abort_exclusive_wait+0x60/0x60

      <4>[ 1297.618720]  [<c1237702>] iio_read_channel_info+0x32/0x1f0

      <4>[ 1297.624364]  [<c12376d0>] ? iio_read_const_attr+0x20/0x20

      <4>[ 1297.629838]  [<c11e3c4a>] dev_attr_show+0x1a/0x50

      <4>[ 1297.634688]  [<c10f294a>] sysfs_read_file+0x7a/0x110

      <4>[ 1297.639724]  [<c10a8066>] ? rw_verify_area+0x66/0x130

      <4>[ 1297.644925]  [<c10f28d0>] ? sysfs_write_file+0xf0/0xf0

      <4>[ 1297.650215]  [<c10a8300>] vfs_read+0x80/0x150

      <4>[ 1297.654643]  [<c107f38a>] ? sys_fadvise64_64+0x1a/0x250

      <4>[ 1297.659923]  [<c10f28d0>] ? sysfs_write_file+0xf0/0xf0

      <4>[ 1297.665218]  [<c10a8412>] sys_read+0x42/0x80

      <4>[ 1297.669560]  [<c12c8f18>] syscall_call+0x7/0xb

      <4>[ 1297.674126] ---[ end trace 9f8a8a16f6b3e7c5 ]---

      <6>[ 1355.435581] Buffer not started:buffer parameter update failed

       

      - Simba

        • 1. Re: Kernel crash during AD7606 driver probe.
          JPMontero_Intel

          The Yocto build completed without any errors and Galileo booted from the custom image without any issues that proves that the problem is not with Galileo or the Yocto built. The issue must be with the driver software. I suggest contacting the driver software provider to help you resolving this issue.

          Regards,
          JPMontero_Intel

          • 2. Re: Kernel crash during AD7606 driver probe.
            Simba

            Hi,


            The problem doesn't seem to be from the driver, in fact I am able to reproduce the issue even without the driver integrated.

            I allocated some GPIO's in the Galileo board file, function intel_qrk_gpio_restrict_probe() and toggled them this issue could be reproduced.

            The driver [AD7606], I am trying to integrate, is present in main line kernel since 2.6.x days and it seems to have no issues.

             

            root@clanton:~# cat /sys/kernel/debug/gpio

            "GPIOs 16-55, cy8c9540a, can sleep:"


            The Issue seems to be form the GPIO driver, If I use gpio_set_value_cansleep(), I am able to set the values to the gpio, but ADC can't support buffered captured in this mode, only single capture.

             

            Can any one let me know how to get gpio_set_value() function working for GPIO's 16- 55?

            How to make sure the gpio driver responsible for the gpio's 16 - 55 doesn't got to sleep?

             

            - Simba

             


            • 3. Re: Kernel crash during AD7606 driver probe.
              Simba

              Current GPIO expander cy8c9540a supports can sleep mode. Hence use gpio_set_value_cansleep() to set values to GPIOs between 16 - 55.

               

              Regards

              Simba.