How to enable spidev in IMX7?

I tried to enable spidev in kernel source(), still I unable to find spidev in /dev directory.

&ecspi3 {
status = "okay";

mcp258x0: mcp258x@1 {
	status = "disable";
};

spidev0: spidev@1 {
	compatible = "spidev";
	reg = <0>;
	spi-max-frequency = <23000000>;
	status = "okay";
};
};

How to enable spidev driver in imx7 eventhough i tried compatible = “spidev”; and compatible = “toradex,evalspi”; ?

Also note that there is no need to change the compatible string in the spidev node. Setting the status property to ‘okay’ should be fine.

@sanchayan.tx @bhuvan.tx, still i could not find spidev after made change in imx7-colibri-eval-v3.dtsi.

&ecspi3 {
status = “okay”;

mcp258x0: mcp258x@1 {
	compatible = "microchip,mcp2515";
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_can_int>;
	reg = <0>;
	clocks = <&clk16m>;
	interrupt-parent = <&gpio3>;
	interrupts = <27 0x2>;
	spi-max-frequency = <10000000>;
	status = "disabled";
};

spidev0: spidev@1 {
	compatible = "toradex,evalspi";
	reg = <0>;
	spi-max-frequency = <23000000>;
	status = "okay";
};
  };

Did you recompile the device tree/kernel source and update the device tree blob on the module?

yes, I do recompile the kernel source and update the dtb. steps carried out were 1. change made over in imx7-colibri-eval-v3.dtsi. 2. build the kernal source using bitbake -k angstrom-lxde-image 3.updating via sdcard.

So you are trying to make the changes to the kernel source tree inside OpenEmbedded?

@sanchayan.tx yes, i tried to change the kernel source tree inside OpenEmbedded.

For development purposes, it is recommended to follow the procedure here.

If you want to do it inside OpenEmbedded, you need to run the following steps in sequence.

MACHINE=colibri-imx7 bitbake -f -c compile virtual/kernel
MACHINE=colibri-imx7 bitbake angstrom-lxde-image

You change the kernel but you do not force it’s compilation again.

Once your changes are finalized, you may integrate it in OpenEmbedded. You may find this article helpful.

During development stage, it is recommended to follow the procedure here.

If you want to still do it inside OE, make sure to run the following steps after changing anything with the kernel source

MACHINE=colibri-imx7 bitbake -f  -c compile virtual/kernel
MACHINE=colibri-imx7 bitbake angstrom-lxde-image

You can just change the “status” property of mcp258x0 node to “disabled”. No need to remove the rest of node properties. And for spidev just change the “status” property to “okay”. Note that it is “disabled” and not “disable”.

Also make sure you update device tree blobs correctly for the changes to take effect.

@sanchayan.tx

hi, I know its long time, thanks for your help, spidev2.0 works after compiling kernel based on here, but in open embedded its still not works. If I made change in imx7-colibri-eval-v3.dtsi. And compile using below command. imx7-colibri-eval-v3.dtsi also changed after compiling. how to make changes to take effect in kernal.

bitbake -f -c compile virtual/kernel

Ideally one would write their own custom meta layer for the project and have a .bbappend to apply patches required to the kernel or maintain one’s own branch of the kernel source with the patches required, which is then used for the project.

You can find an example on this in the Leverage Yocto/OpenEmbedded for your embedded software deployment post.