Linux Development :  Bluewater Systems Support Forum
Covers issues with Linux development, such as tool chains, packages, kernel issues etc... 
spidev crash on Snapper 9260
Posted by: pas ()
Date: September 18, 2009 07:39AM

I have added the spidev module to my 2.6.29 kernel and it seems to initialize correctly but I get a crash when I try to use the device.

I added the following to board_snapper9260.c:

static struct spi_board_info spi0_board_info[] __initdata = {
        {
                .modalias       = "spidev",
                .max_speed_hz   = 15 * 1000 * 1000,
                .chip_select    = 0,
                .bus_num        = 1,
        }
};

static void __init sn9260_board_init(void)
{
    at91_add_device_spi(spi0_board_info,ARRAY_SIZE(spi0_board_info));
    .........
}

On boot dmesg shows:

atmel_spi atmel_spi.1: Atmel SPI Controller at 0xfffcc000 (irq 13)
atmel_spi atmel_spi.1: registered master spi1
spi spi1.0: setup: 12861888 Hz bpw 8 mode 0x0 -> csr0 00000702
atmel_spi atmel_spi.1: registered child spi1.0


....and after using mdev -s I have a /dev/spidev1.0 device.

If I then try and use one of the spidev test tools (spidev_test or spidev_fdx) I get the following crash:

root@snapper:~$ ./spidev_fdx -v -m 3 /dev/spidev1.0 
/dekernel BUG at include/linux/spi/spi.h:609!
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c39b8000
[00000000] *pgd=2396d031, *pte=00000000, *ppte=00000000
Internal error: Oops: 817 [#1]
Modules linked in:
CPU: 0    Not tainted  (2.6.29 #24)
PC is at __bug+0x20/0x2c
LR is at release_console_sem+0x198/0x1b0
pc : [<c002a840>]    lr : [<c003ddfc>]    psr: 60000093
sp : c398fe48  ip : c398fd80  fp : c398fe54
r10: 00000000  r9 : 00000002  r8 : c398e000
r7 : c397a004  r6 : c3937e00  r5 : c398fea4  r4 : c3937e00
r3 : 00000000  r2 : c02d2118  r1 : 00001916  r0 : 0000002e
Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 0005317f  Table: 239b8000  DAC: 00000015
Process spidev_fdx (pid: 883, stack limit = 0xc398e268)
Stack: (0xc398fe48 to 0xc3990000)
fe40:                   c398fe84 c398fe58 c017f5cc c002a830 00000000 c398fe68 
fe60: c0081e90 00000000 c398fe68 c398fe68 c3997ee0 c3919848 c398fefc c398fe88 
fe80: c017feb4 c017f544 c0155c04 c38c9270 c3997ea0 c38c9260 00000004 c3919800 
fea0: 00000000 c391981c c3919840 00000000 00000000 c017f814 c398fe64 00000000 
fec0: 00000000 00000000 00000000 00000000 c398e000 bed7aca0 40406b00 00000003 
fee0: c3870240 bed7aca0 c398e000 00000000 c398ff14 c398ff00 c0090c44 c017f938 
ff00: c3870240 bed7aca0 c398ff7c c398ff18 c0091188 c0090c20 00000000 c398e000 
ff20: c398ff3c c398ff30 c0156860 c0141830 c398ff54 c398ff40 c0042500 c015685c 
ff40: 00000100 c398e000 c398ff84 c398ff58 c0042354 c00421d8 00000003 bed7aca0 
ff60: 40406b00 c3870240 c0026f28 00000000 c398ffa4 c398ff80 c009121c c0090cc0 
ff80: c00425a4 00000000 ffffffff 00000000 00000000 00000036 00000000 c398ffa8 
ffa0: c0026d80 c00911ec ffffffff 00000000 00000003 40406b00 bed7aca0 bed7aca0 
ffc0: ffffffff 00000000 00000000 00000036 00000000 00000000 40024000 bed7acf4 
ffe0: 00000000 bed7ac78 00008824 400deb5c 80000010 00000003 00000000 00000000 
Backtrace: 
[<c002a820>] (__bug+0x0/0x2c) from [<c017f5cc>] (spidev_sync+0x98/0xf0)
[<c017f534>] (spidev_sync+0x0/0xf0) from [<c017feb4>] (spidev_ioctl+0x58c/0x650)
 r5:c3919848 r4:c3997ee0
[<c017f928>] (spidev_ioctl+0x0/0x650) from [<c0090c44>] (vfs_ioctl+0x34/0x78)
[<c0090c10>] (vfs_ioctl+0x0/0x78) from [<c0091188>] (do_vfs_ioctl+0x4d8/0x52c)
 r5:bed7aca0 r4:c3870240
[<c0090cb0>] (do_vfs_ioctl+0x0/0x52c) from [<c009121c>] (sys_ioctl+0x40/0x64)
[<c00911dc>] (sys_ioctl+0x0/0x64) from [<c0026d80>] (ret_fast_syscall+0x0/0x2c)
 r7:00000036 r6:00000000 r5:00000000 r4:ffffffff
Code: e1a01000 e59f000c eb004ed0 e3a03000 (e5833000) 
v/---[ end trace 5ea79f764524e3a9 ]---
spidev1.0: spi mode 0, 0 bits per word, 15000000 Hz max
Segmentation fault


Did I miss something? is there something else I need to set up before using this module?

Any help would be appreciated.

Regards,

Pete

Options: ReplyQuote
Re: spidev crash on Snapper 9260
Posted by: Ryan ()
Date: September 20, 2009 10:18PM

This looks like a genuine kernel bug. I will try and find some time over the next few days to attempt to replicate this problem.

~Ryan

Options: ReplyQuote
Re: spidev crash on Snapper 9260
Posted by: pas ()
Date: September 24, 2009 07:01AM

Ryan,

I have taken the drivers/spi/spi.c and include/linux/spi/spi.h code from the OE Angstrom
2.6.29 kernel and they seem to fix the problem. I have not gone in to the code in any great
depth but it looks like the crash was related to spi bus locking.

Regards,

Pete

Options: ReplyQuote


Your Name: 
Your Email: 
Subject: 
Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
This is a moderated forum. Your message will remain hidden until it has been approved by a moderator or administrator
This forum powered by Phorum.

Applications

rs1

rs_2

rs_3

rs_4