Electronic – SPI transaction timeout linux device driver

driverlinuxspi

I am stuck for last 3 days at a point.

I am working on eink device driver with msm8960 qualcomm chipset.

Scenario:
In file: kernel/arch/arm/mach-msm/devices-8960.c

I cannot verify the use of spidm_channels" and "spidm_crci" and the corresponding entries.(msm8960 pro)(copied from some reference code)
How to verify if the values of corresponding start and end are correct??
I have datasheet for msm but cannot find any reference.

I have added the following code in order to create a new gsbi resource in file as:

static struct resource resources_qup_spi_gsbi9[] = {
    {
            .name   = "spi_base",
            .start  = MSM_GSBI9_QUP_PHYS,
            .end    = MSM_GSBI9_QUP_PHYS + SZ_4K - 1,
            .flags  = IORESOURCE_MEM,
    },
    {
            .name   = "gsbi_base",
            .start  = MSM_GSBI9_PHYS,
            .end    = MSM_GSBI9_PHYS + 4 - 1,
            .flags  = IORESOURCE_MEM,
    },
    {
            .name   = "spi_irq_in",
            .start  = GSBI9_QUP_IRQ,
            .end    = GSBI9_QUP_IRQ,
            .flags  = IORESOURCE_IRQ,
    },
    {
             .name   = "spidm_channels",
            .start  = 3,
            .end    = 4,
            .flags  = IORESOURCE_DMA,
    },
    {
            .name   = "spidm_crci",
            .start  = 12,
            .end    = 13,
            .flags  = IORESOURCE_DMA,
    }, 
};

The reason for having this doubt is that our DMA operation is failing with the error :
from logs:

<6>[    0.764932] wait_for_ready: I/F Ready.^M
<7>[    0.765176] s1d13522_ spi9.0: setup mode 0, 16 bits/w, 51200000 Hz max --> 0^M
<3>[    1.756630] spi_qsd spi_qsd.9: msm_spi_process_transfer: SPI transaction timeout^M

and then if we try to perform another DMA operation it gives the following error:

<3>[    6.773355] s1d13522if_cmd: wait_for_ready: I/F busy bit stuck^M
<7>[    6.775400] s1d13522_ spi9.0: setup mode 0, 16 bits/w, 51200000 Hz max --> 0^M
<4>[    6.775583] ------------[ cut here ]------------^M
<4>[    6.775614] WARNING: at /home/anshul_10605816/hip_mirror_2330_code/kernel        /lib/list_debug.c:32 __list_add+0x58/0x78()^M
<4>[    6.775644] list_add corruption. prev->next should be next (c0d5124c), but was 00100100. (prev=edf643b8).^M
<4>[    6.775675] Modules linked in:^M
<4>[    6.775766] [<c00149b8>] (unwind_backtrace+0x0/0x11c) from [<c007c818>] (warn_slowpath_common+0x4c/0x64)^M
<4>[    6.775827] [<c007c818>] (warn_slowpath_common+0x4c/0x64) from [<c007c8b0>] (warn_slowpath_fmt+0x2c/0x3c)^M
<4>[    6.775888] [<c007c8b0>] (warn_slowpath_fmt+0x2c/0x3c) from [<c02a9538>] (__list_add+0x58/0x78)^M
<4>[    6.775919] [<c02a9538>] (__list_add+0x58/0x78) from [<c001e3d4>] (start_ready_cmd+0x84/0x13c)^M
<4>[    6.775980] [<c001e3d4>] (start_ready_cmd+0x84/0x13c) from [<c001e704>] (msm_dmov_enqueue_cmd_ext_work+0x148/0x284)^M
<4>[    6.776041] [<c001e704>] (msm_dmov_enqueue_cmd_ext_work+0x148/0x284) from [<c0094e0c>] (process_one_work+0x27c/0x484)^M
<4>[    6.776072] [<c0094e0c>] (process_one_work+0x27c/0x484) from [<c0095224>] (worker_thread+0x210/0x3b0)^M
<4>[    6.776133] [<c0095224>] (worker_thread+0x210/0x3b0) from [<c00990c0>] (kthread+0x80/0x8c)^M
<4>[    6.776194] [<c00990c0>] (kthread+0x80/0x8c) from [<c000f108>] (kernel_thread_exit+0x0/0x8)^M
<4>[    6.776224] ---[ end trace da227214a82491b8 ]---^M
<3>[   11.766732] spi_qsd spi_qsd.9: msm_spi_process_transfer: SPI transaction timeout^M

Any help would be highly appreciated.

If any more code information is required please let me know.

Best Answer

The resource setup depend on your platform, not only the driver.

An idea could be to validate your SPI bus before using it with the target chipset directly. I suggest to use spidev interface and a user space code to send something on the bus and observing the result on a logical analyser or an oscilloscope. I usually do that to validate new boards.

The list_add corruption is suspicious, but difficult to say more at that point.