omap2-mcspi, invalid SPI data received

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have this problem that originally started when I tried to use an ENC28J60 device on a Beaglebone (Beaglebone Green Wireless). I noted that while reading one register on the device (EREVID) the value was 0x3C. That register holds the hardware revision and should not be higher than 6 or possibly 7. So I started investigating the code and to make a long story short I ended up writing this silly loop that continuously reads and prints out EREVID:

for(;;) {
 printk(KERN_ALERT "REV: 0x%02x\n", nolock_regb_read(priv, EREVID));
}

It reports 0x3C every time so it’s not completely random. If I force the pin to 0V i get 0x00 instead, and 0xFF if I force the pin to 3.3V. That should mean that the hardware config and pinmux is correct, since otherwise it would not change anything if I manipulate the pin.

With this loop active I could investigate what happens with a scope and to my surprise both the sent byte and the received byte are what to be expected: 0x12 and 0x06.  But somehow the SPI driver still reads 0x3C instead of 0x06.

Here’s two screenshots from the scope: https://dl.dropboxusercontent.com/u/176615/erevid.png

The first shows clock and mosi, the second clock and miso.

I’ve tried to track the error and got as far as drivers/spi/spi-omap2-mcspi.c, function omap2_mcspi_txrx_pio. Around line 715, readl_relaxed returns 0x3C.

I’m using mainline kernel 4.7.1 with no custom patches applied.

One more thing: I just tried to force DMA by setting DMA_MIN_LEN to 1 instead of 160 in spi-omap2-mcspi.c. After doing that I get the following error on the first SPI read operation:

[    4.578601] Unable to handle kernel paging request at virtual address 40000000
[    4.586213] pgd = ddd70000
[    4.589037] [40000000] *pgd=00000000
[    4.592799] Internal error: Oops: 805 [#1] ARM
[    4.597438] Modules linked in: enc28j60(+)
[    4.601728] CPU: 0 PID: 136 Comm: udevd Not tainted 4.7.1-myeden-griffin-amun-bbg-dirty #12
[    4.610445] Hardware name: Generic AM33XX (Flattened Device Tree)
[    4.616804] task: ddd1ae80 ti: ddd14000 task.ti: ddd14000
[    4.622452] PC is at v7_dma_inv_range+0x2c/0x48
[    4.627190] LR is at __dma_page_dev_to_cpu+0x90/0x154
[    4.632462] pc : [<c0117b80>]    lr : [<c011331c>]    psr: 20010013
[    4.632462] sp : ddd15a40  ip : de36d000  fp : dd8f1c48
[    4.644444] r10: c0114304  r9 : 00000001  r8 : 00000fff
[    4.649895] r7 : 00000002  r6 : 00000000  r5 : 00000001  r4 : dd16d000
[    4.656707] r3 : 0000003f  r2 : 00000040  r1 : 40000000  r0 : 40000000
[    4.663521] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[    4.670968] Control: 10c5387d  Table: 9dd70019  DAC: 00000051
[    4.676963] Process udevd (pid: 136, stack limit = 0xddd14210)
[    4.683050] Stack: (0xddd15a40 to 0xddd16000)
[    4.687601] 5a40: c0117c14 ddd15cac ddbc3000 ddd15cac dd8f1c48 00000000 00000000 c04c2558
[    4.696140] 5a60: 00000000 00000000 ddd1b358 ddd1b350 d0550367 dd8f1800 ddbc3220 00000000
[    4.704679] 5a80: ddbc8a00 dd8f1c48 00000001 dd8c7181 00000008 ddbc688c 00000000 00000000
[    4.713219] 5aa0: 201113fc 00000001 00002414 00000002 00000000 00000000 00000000 00000000
[    4.721757] 5ac0: 48030150 4803014c 00000001 00000001 00000001 00000001 00000000 00000000
[    4.730297] 5ae0: 00000001 00000080 00000000 c04bc7c0 ddbc3258 ddd1b3d8 00000004 00000004
[    4.738836] 5b00: 00000006 00000000 48030150 4803014c 00000001 00000001 00000001 00000001
[    4.747375] 5b20: 00000000 00000000 dd8f1b90 ddd15cac ddd15c38 dd8f1800 ddbc3258 dd8f1b90
[    4.755915] 5b40: 00000000 dd8f1b30 c0d251b8 c04becf4 ddbc3000 00000000 00000001 00000000
[    4.764454] 5b60: dd8f1800 ddd15c38 00000000 00000000 00000000 ddbc3258 dd8f1b90 c04bf328
[    4.772993] 5b80: 00000001 ddd15c38 dd8f1800 ddd15bb8 00000000 ddbc3000 ddd15c38 dd8f1800
[    4.781532] 5ba0: 00000000 ddbc3258 dd8f1b90 c04bf6b8 60010013 dd8f1a3c 00000000 00000001
[    4.790072] 5bc0: dead4ead ffffffff ffffffff c152d520 00000000 00000000 c0a98274 ddd15bdc
[    4.798611] 5be0: ddd15bdc 00000000 00000001 dead4ead ffffffff ffffffff c152d520 00000000
[    4.807150] 5c00: 00000000 c0a98274 ddd15bdc ddd15bdc 00000001 dd8c7181 dd8c7180 00000001
[    4.815690] 5c20: ddbc3000 ddd15d12 ddd15d14 c152d518 bf003e08 c04bf7b0 ddd15ca4 ddd15ce0
[    4.824229] 5c40: ddbc3000 00000000 c04bd9a4 ddd15bb8 00000002 00000001 ffffff8d ddd15c5c
[    4.832768] 5c60: ddd15c5c 00000000 ddd15c68 ddd15c68 dd8c7180 00000000 00000001 00000000
[    4.841307] 5c80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000802
[    4.849846] 5ca0: 000f4240 ddd15ce0 ddd15c38 00000000 dd8c7181 00000001 00000000 00000000
[    4.858385] 5cc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000810 000f4240
[    4.866925] 5ce0: ddd15c38 ddd15ca4 ddcb35a0 00000001 ddcb35a0 ddcb35a0 00000000 00000007
[    4.875464] 5d00: 221dbe28 bf000e08 00000001 ddcb35a0 00120003 bf000550 ddcb35a0 ddcb35a8
[    4.884004] 5d20: 00000072 bf00160c ddcb35a0 ffffffe0 ddcb35a8 bf002074 ddbc3000 ffffffe0
[    4.892543] 5d40: ddcb3000 ddcb35a0 00000000 bf0023b0 00000000 00000000 00000000 ddbc3000
[    4.901082] 5d60: 00000000 bf003d38 bf003d48 c04bd43c ddbc3000 c152b7a4 c152b7ac c04372cc
[    4.909622] 5d80: bf003d38 ddbc3000 ddbc3000 ddbc3000 ddbc3034 bf003d48 c0d34014 c0d52870
[    4.918161] 5da0: 00000001 c04376fc 00000000 bf003d48 c0437614 c0435394 dd8cdaa4 ddbc02d0
[    4.926700] 5dc0: bf003d48 dddc1780 00000000 c0436694 bf003304 bf007000 bf003d48 bf007000
[    4.935240] 5de0: dde24e40 bf003dc0 00000000 c0437c3c bf003dc0 bf007000 dde24e40 c0101778
[    4.943779] 5e00: 00000001 dde24200 0009de6f dde6f000 c01d1800 c015cf40 00000001 00000000
[    4.952319] 5e20: 60070013 0009de6f ddcb0600 c015cecc de340000 ddcb0600 dde24e40 c015cecc
[    4.960858] 5e40: dd800080 dde24e40 024000c0 c020cc48 bf003dc0 00000001 dde24e40 bf003dc0
[    4.969397] 5e60: dde24200 c01c8b30 ddd15f4c 00000001 ddd15f4c 00000001 dde24208 c01897b0
[    4.977937] 5e80: bf003dcc 00007fff bf003dc0 c0187510 c150acb4 bf003f10 000007f8 e09763f8
[    4.986476] 5ea0: bf003fb4 bf003dcc 00000000 c0905440 00000000 00048448 00000000 ddd15f40
[    4.995015] 5ec0: 00048448 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    5.003554] 5ee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    5.012094] 5f00: 7fffffff 00000000 00000008 b6e95dac 0000017b 7fffffff 00000000 00000000
[    5.020633] 5f20: 00065258 c0189f70 7fffffff 00000000 00000002 00000000 bef9886c e092e000
[    5.029172] 5f40: 00048448 00000000 00000002 e092e000 00048448 e0975c50 e0975a64 e0963bbc
[    5.037712] 5f60: 0000402c 00004edc bf003d88 00000002 00000000 00002118 00000031 00000032
[    5.046251] 5f80: 0000001c 00000017 00000013 00000000 00000000 00000005 00000000 c0108484
[    5.054790] 5fa0: ddd14000 c01082e0 00000000 00000005 00000008 b6e95dac 00000000 00000000
[    5.063329] 5fc0: 00000000 00000005 00000000 0000017b 000636f8 00000000 000636f8 00065258
[    5.071869] 5fe0: bef98870 bef98860 b6e8ecd0 b6e18f10 600e0010 00000008 00000000 00000000
[    5.080416] [<c0117b80>] (v7_dma_inv_range) from [<c011331c>] (__dma_page_dev_to_cpu+0x90/0x154)
[    5.089596] [<c011331c>] (__dma_page_dev_to_cpu) from [<c04c2558>] (omap2_mcspi_transfer_one+0xbe0/0x1350)
[    5.099693] [<c04c2558>] (omap2_mcspi_transfer_one) from [<c04becf4>] (spi_transfer_one_message+0xb0/0x350)
[    5.109868] [<c04becf4>] (spi_transfer_one_message) from [<c04bf328>] (__spi_pump_messages+0x394/0x520)
[    5.119679] [<c04bf328>] (__spi_pump_messages) from [<c04bf6b8>] (__spi_sync+0x1f0/0x204)
[    5.128221] [<c04bf6b8>] (__spi_sync) from [<c04bf7b0>] (spi_write_then_read+0xd0/0x188)
[    5.136711] [<c04bf7b0>] (spi_write_then_read) from [<bf000e08>] (spi_read_op.constprop.10+0x50/0xa8 [enc28j60])
[    5.147359] [<bf000e08>] (spi_read_op.constprop.10 [enc28j60]) from [<bf00160c>] (locked_regb_read+0x34/0x48 [enc28j60])
[    5.158730] [<bf00160c>] (locked_regb_read [enc28j60]) from [<bf002074>] (enc28j60_hw_init+0xe0/0x2c0 [enc28j60])
[    5.169466] [<bf002074>] (enc28j60_hw_init [enc28j60]) from [<bf0023b0>] (enc28j60_probe+0x15c/0x304 [enc28j60])
[    5.180103] [<bf0023b0>] (enc28j60_probe [enc28j60]) from [<c04bd43c>] (spi_drv_probe+0x7c/0xa8)
[    5.189287] [<c04bd43c>] (spi_drv_probe) from [<c04372cc>] (driver_probe_device+0x100/0x448)
[    5.198100] [<c04372cc>] (driver_probe_device) from [<c04376fc>] (__driver_attach+0xe8/0x110)
[    5.207004] [<c04376fc>] (__driver_attach) from [<c0435394>] (bus_for_each_dev+0x6c/0xa0)
[    5.215544] [<c0435394>] (bus_for_each_dev) from [<c0436694>] (bus_add_driver+0x1b8/0x26c)
[    5.224175] [<c0436694>] (bus_add_driver) from [<c0437c3c>] (driver_register+0x78/0xf8)
[    5.232535] [<c0437c3c>] (driver_register) from [<c0101778>] (do_one_initcall+0x3c/0x174)
[    5.241082] [<c0101778>] (do_one_initcall) from [<c01c8b30>] (do_init_module+0x58/0x1c0)
[    5.249541] [<c01c8b30>] (do_init_module) from [<c01897b0>] (load_module+0x1c64/0x21d4)
[    5.257901] [<c01897b0>] (load_module) from [<c0189f70>] (SyS_finit_module+0xa8/0xec)
[    5.266083] [<c0189f70>] (SyS_finit_module) from [<c01082e0>] (ret_fast_syscall+0x0/0x1c)
[    5.274625] Code: e1c00003 1e070f3e e1110003 e1c11003 (1e071f3e)
[    5.281075] ---[ end trace 3cb87b7624342da0 ]---
[    5.307736] udevd[133]: worker [136] terminated by signal 11 (Segmentation fault)
[    5.315749] udevd[133]: worker [136] failed while handling '/devices/platform/ocp/48030000.spi/spi_master/spi1/spi1.1’



Best regards,
Jonatan Magnusson

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux