I'm trying to build a simple example program that allows me to test connection to
an SPI device I've wired up to my SABRESD.
Unlike I2C (which has /dev/i2c-0, /dev/i2c-1, and /dev/i2c-2), SPI doesn't have
an equivalent nodes in /dev.
It appears to have been built in the kernel tree; however, I don't see any
support for it under /dev.
Has anyone worked with SPI hooked to a device that is not MTD?
What's the trick?
Tx
Solved! Go to Solution.
Do you have
CONFIG_SPI_SPIDEV=m
in your Kernel config and the necessary Kernel module avaiable?
SabreSD has a m25p80 spi flash, you may check the relevant struct and function in board-mx6q_sabresd.c
Regards,
Jacky
Thanks for responding. The problem, as far as I can tell, is that code only deals with SPI-flash as MTD partitions.
I need hooks for other SPI devices that will be on one of the ECSPIx controllers.
On imx508 RDP board, MC13892 PMIC is controlled by the SOC through the spi bus. The source is arch/arm/mach-mx5/mx50_rdp_pmic_mc13892.c. That should be an example for the spi interface coding.
Regards,
Jacky
Ok, thanks much, I'll take a look at that.
Ed, has your question been answered? If yes, please click Corret Answer
Thanks,
Yixing
Yixing,
No it hasn't been answered. As a result of me hunting around for this, I've transitioned up to a more up-to-date kernel (3.4.11) and u-boot (u-boot-2013.10).
I now have them both booting; but the SPI-flash interface that used to work in the older u-boot doesn't appear to work (or at least its not working for me at
the moment).
My conclusion at this point is that SPI is not supported very well in this environment; so I'm still digging.
If I do get an answer I will certainly check it off as the correct one.
Thanks,
Ed
Hi Ed,
is spidev ( https://www.kernel.org/doc/Documentation/spi/spidev ) what you are looking for?
Stefan,
Hi, thanks for responding...
I had read through that briefly prior to taking the shot at the updated kernel/uboot.
The code in spidev_fdx.c didn't give any hint on how the underlying driver is installed or how
to access it.
Note: if its not already obvious I'm still on the steep part of the learning curve regarding
this stuff. I did a reasonable amount of work on 2.4 years ago, but have not kept up. Most of
my embedded work is not with linux, so I'm frantically in catch-up mode.
Anyway, I assumed that it would be similar to I2C, where conveniently /dev/i2c-0 and /dev/i2c-2 show up.
Now that I'm a few weeks further into this, I suppose I should go back and reread that.
Thanks,
Ed
My problem at the moment, by the way, is that it appears that in the latest u-boot, the 'sf' command
doesn't work properly for the SABRESD board. Would sure like to know if anyone else has used
this successfully.
Do you have
CONFIG_SPI_SPIDEV=m
in your Kernel config and the necessary Kernel module avaiable?
Stefan,
I have
CONFIG_SPI_IMX_VER_2_3=y
CONFIG_SPI_IMX=y
but not SPIDEV...
Hmmm, I'm just realizing (thanks to this discussion) that I've been brain farting a bit...
As I was reading about "spidev" (even weeks back), I was assuming "dev" referred to "development";
meaning that it was a hook that you could use to debug a SPI interface.
I'm just now realizing (I shouldn't be admitting this publically! :-( ) that the 'dev'
is probably referring to "device"... Ugghh...
Yet again, I will refer to myself as an IDIOT (I seem to do that more and more as I get older).
My guess is that this will give me what I need, so I'll dig in with a different perspective.
Thanks much!