[BeagleBone] userspace spidev dissappear after I swap the SPI MOSI / MISO

I’ve follow the instructions from [1] and [2] (I used [1]) to add spidev1.0 to userspace. I’ve been working with those spi port without an issue until when I try to swap the MOSI/MISO setting:

I tried to swap the MOSI / MISO pin on the Beaglebone - by kernel default the MOSI is set to pin 18 (spi0_d1) and MISO is set to pin 21 (spi0_d0). I modify the McSPI Channel configuration register in the spi-omap2-mcspi.c file in /KERNEL/driver/spi (p.4195 AM335 Tech Ref Manual):

l &= ~(OMAP2_MCSPI_CHCONF_DPE0);
l |= (OMAP2_MCSPI_CHCONF_IS|OMAP2_MCSPI_CHCONF_DPE1);

This should set data line 0 (spi0_d0) to output (MOSI) and datal line 1 (spi0_d1) to input (MISO).

Once I did that and recompile the kernel, my two userspace driver no longer exist in the /dev directory

I’m wondering if I’m missing something - other than spi-omap2-mcspi.c, is there something else I need to modify in order to get userspace spidev with flipped MOSI / MISO?

Many thanks!

[1] http://theredblacktree.wordpress.com/tag/beaglebone/
[2] http://communistcode.co.uk/blog/blogPost.php?blogPostID=1

That should work. I’ve done exactly that in the driver. Incidentally, a patch for configuring the MOSI/MISO pins is making its way up to the mainline kernel.

I would check:

  1. SPIDEV kernel option is actually turned on in your kernel config
  2. Verify the spi_register_board_info() call is properly using the “spidev” modalias

Thanks, got it to work - somehow, it seems that some of the .o file are not recompiled if I didn’t delete them - so I deleted the spi-omap2-mcspi.o and board-am335xevm.o, recompile the kernel, got it work work again. weird.