Hi All
As of now i am making a spi slave driver,But in the probe of my slave device
driver which i am writing in linux plateform,i am not able to read and write
registers value of my slave chip using spi_write and spi_read.And whenever
its going to spi_async its giving kernel panic.
The code flow will be like this.
/include/linux/spi/spi.h
static inline int
spi_write(struct spi_device *spi, const u8 *buf, size_t len)
{
printk("*********inside spi_write************\n");
struct spi_transfer t = {
.tx_buf = buf,
.len = len,
};
struct spi_message m;
spi_message_init(&m);
spi_message_add_tail(&t, &m);
return spi_sync(spi, &m);
}
/include/linux/spi.c
int spi_sync(struct spi_device *spi, struct spi_message *message)
{
DECLARE_COMPLETION_ONSTACK(done);
int status;
message->complete = spi_complete;
message->context = &done;
status = spi_async(spi, message); //Error is giving in this
function
if (status == 0)
wait_for_completion(&done);
message->context = NULL;
return status;
}
And the following error is coming.
*********inside spi_write************
*********inside spi_message_init*********
********inside spi_message_add_tail*******
*****1***inside spi_sync*************
*****2***inside spi_sync*************
****3****inside spi_sync*************
****4****inside spi_sync*************
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 0 [#1]
Modules linked in:
CPU: 0
PC is at __init_begin+0x3fff8000/0x30
LR is at spi_sync+0x74/0xec
pc : [<00000000>] lr : [<c0143ad8>] Not tainted
sp : c028dc48 ip : c028db80 fp : c028dc74
r10: c1f56668 r9 : c1f56600 r8 : 00000002
r7 : 00000000 r6 : c028dc4c r5 : c028dc84 r4 : c1f56600
r3 : c02ec800 r2 : 00000000 r1 : c028dc84 r0 : c1f56600
Flags: nZCv IRQs on FIQs on Mode SVC_32 Segment kernel
Control: 5317F
Table: 30004000 DAC: 00000017
Process swapper (pid: 1, stack limit = 0xc028c258)
Stack: (0xc028dc48 to 0xc028e000)
dc40: c003b0d8 00000000 c028dc50 c028dc50 c028dc84
c028dccc
dc60: c028dcd6 c028dcb0 c028dd04 c028dc78 c011c780 c0143a74 c2bb68c0
c2bb5c60
dc80: c028dcac c028dccc c028dccc c1f56600 00000000 c0143b50 c028dc4c
00000000
dca0: 00000000 00000000 00000000 00000000 c028dcd6 00000000 00000002
00000000
dcc0: 00000000 00000000 00000000 c028dc84 c028dc84 90000000 c1f56668
c1f56600
dce0: c01baf14 c01baf14 c028dd74 c2bb5cc0 00000000 c1f56668 c028dd14
c028dd08
dd00: c01441dc c011c624 c028dd3c c028dd18 c0124a7c c01441cc c028dd64
c2bb5cc0
dd20: c01baf14 c1f56600 c028dd74 00000000 c028dd5c c028dd40 c0124bec
c01249d8
dd40: c028dd6c 00000000 c0124bfc c1f56600 c028dd6c c028dd60 c0124c0c
c0124b4c
dd60: c028dd9c c028dd70 c0123dbc c0124c0c c00b66b0 c01bd138 c01bd138
c01baf74
dd80: c1f566d8 c01bd028 c02ec800 00000000 c028ddb4 c028dda0 c0124ca0
c0123d7c
dda0: 00000000 c1f56600 c028ddcc c028ddb8 c0123cec c0124c4c c1f56600
c1f56600
ddc0: c028de14 c028ddd0 c0122794 c0123ccc 00000000 c1f566a4 c1f566c0
c01b0078
dde0: 00000000 c00f03dc c1f56600 c1f56600 c1f56600 c02ec800 c01b0078
c1f566a4
de00: c02ec800 c02ec950 c028de2c c028de18 c0122aac c01223b4 c028de5c
c01b2568
de20: c028de5c c028de30 c0143d00 c0122a9c 00000000 c003adb4 c01b2568
c02ec9f0
de40: 00000001 c01b0070 c01b0078 00000000 c028de94 c028de60 c0145b44
c0143c28
de60: c01bd3c0 00000000 c01b00e0 c01b0078 c01bd320 c01bd320 c01bd320
c2bb5e80
de80: 00000000 c001bb84 c028dea4 c028de98 c01264e8 c014581c c028decc
c028dea8
dea0: c0124a7c c01264d8 c02a1047 c2bb5e80 c01bd320 c01b0078 c01bd320
c028dfa0
dec0: c028deec c028ded0 c0124bec c01249d8 c0150e94 c01b0150 c01b0078
c0124ccc
dee0: c028df04 c028def0 c0124d50 c0124b4c 00000000 c028df0c c028df34
c028df08
df00: c0123ef0 c0124cdc 00000000 c01bb708 c01bb708 c01b00c0 c01bd320
c01bd334
df20: 00000000 c01bb608 c028df44 c028df38 c01248e4 c0123eb0 c028df64
c028df48
df40: c0124244 c01248d4 c01bd320 c001b684 c028c000 00000000 c028df7c
c028df68
df60: c0125004 c01241f4 c028c000 00000000 c028df8c c028df80 c0126780
c0124f80
df80: c028df9c c028df90 c001ad58 c0126724 c028dff4 c028dfa0 c000890c
c001ad4c
dfa0: 00000000 c028dfb0 c001fce4 c0036d2c 00000000 00000000 c0008874
c003d21c
dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000
dfe0: 00000000 00000000 00000000 c028dff8 c003d21c c0008884 7369646c
6c665f63
Backtrace:
[<c0143a64>] (spi_sync+0x0/0xec) from [<c011c780>] (m1172_probe+0x16c/0x390)
r7 = C028DCB0 r6 = C028DCD6 r5 = C028DCCC r4 = C028DC84
[<c011c614>] (m1172_probe+0x0/0x390) from [<c01441dc>]
(spi_drv_probe+0x20/0x24)
[<c01441bc>] (spi_drv_probe+0x0/0x24) from [<c0124a7c>]
(really_probe+0xb4/0x174)
[<c01249c8>] (really_probe+0x0/0x174) from [<c0124bec>]
(driver_probe_device+0xb0/0xc0)
r8 = 00000000 r7 = C028DD74 r6 = C1F56600 r5 = C01BAF14
r4 = C2BB5CC0
Please help me out for this why any register reading writing is not
happening at slave device level.
Regards
Nitin vishnoi
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
spi-devel-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general