Hi there,
so a few months ago i started playing around with an i.mx23 evk board for a project im working on. I was having issues communicating via the spi port. I had some help in another post here: https://community.freescale.com/thread/298439 on how to get spi communication on the board.
For a while i couldn't focus much on the project, and as such i did not get very far with the spi communication. I have taken example code that is shipped with the kernel documentation and tried to send data over the spi port on the 120 pin breakout connector using a custom PCB (see photo)
Essentially, the issue i am having is actually getting a block device for the spi interface in /dev. I have compiled the spi packages into the kernel, inbuilt not as modules, and i can see 'spi' in /proc/devices, however there is no /dev/spidev or /dev/spi or anything relevant to spi in /dev that i can use to physically communicate over the port. What am i missing? How do i gain access to a spi block device so my code can open the device for communication?
Thanks,
Andrew
Andrew, did Marek Vasut answer your question? If yes, please mark the his answer as Correct Answer.
Thanks,
Yixing
I'd recommend you give a shot to upstream kernel (3.7), I recently tested it there. You'll just have to add a DT snippet like this:
ssp0: ssp@80010000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,imx28-spi";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins_a>;
clock-frequency = <3000000>;
status = "okay";
spidev@0x00 {
compatible = "spidev";
spi-max-frequency = <30000000>;
reg = <0>;
};
};
As for non-DT board-file init, you want something like this:
static struct spi_board_info spi_board_info[] __initdata = {
{
.modalias = "spidev",
.bus_num = 1,
.chip_select = 0,
.max_speed_hz = 30000000,
},
};
And then do NOT forget to call spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); in your platform init ! In any case, do not forget to enable the spidev driver in the kernel.
Besides, give a go to devtmpfs (mount -t devtmpfs dev /dev) , your udev might just be crap and won't create the node (you can spy on udev with udevadm).
ok, so i found in mx23evk.c that the spi initialization is loading the enc28j60 ethernet driver. i have changed this to spidev to suit my needs, but still no luck, i have tried all i can think of, as well as all i have found through google, still no block device, and still no communication over the port. I have noticed that in mx23evk_pins.c in the mxs_spi_enc_pin_init function called by mx23evk.c, that when it does a gpio request, it requests "ENC28J60_INTR", does this need to be changed to an spidev requirement?
Hi,
I have already looked at that thread, and have run through the discussion in there, however this doesn't solve my problem. The spidev block device that udev is supposed to place in /dev when you replace the .modalias with the spidev kernel driver never appears, so i cant interface with the driver at all.
Hi,
did you solved your problem? It seems I have the same problem with the MX6...
regards
Patrice