Skip to content

Instantly share code, notes, and snippets.

@gnitnaw
Last active November 5, 2015 17:38
Show Gist options
  • Save gnitnaw/385bc60244cf1091d8c8 to your computer and use it in GitHub Desktop.
Save gnitnaw/385bc60244cf1091d8c8 to your computer and use it in GitHub Desktop.
Device tree overlay for mcp3008
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835", "brcm,bcm2708";
/* disable spi-dev for spi0.0 */
fragment@0 {
target = <&spi0>;
__overlay__ {
status = "okay";
spidev@0{
status = "disabled";
};
};
};
fragment@1 {
target = <&spi0>;
__overlay__ {
/* needed to avoid dtc warning */
#address-cells = <1>;
#size-cells = <0>;
mcp3x0x@0 {
compatible = "mcp3008";
reg = <0>;
spi-max-frequency = <1000000>;
};
};
};
};
@gnitnaw
Copy link
Author

gnitnaw commented Jul 9, 2015

Compile : dtc -@ -I dts -O dtb -o mcp320x.dtb mcp320x.dts
install :
(Make sure you have selected iio driver for mcp320x when compiling kernel)
sudo cp mcp320x.dtb /boot/overlays
Add this in /boot/config.txt :
dtoverlay=mcp320x,mcp3008

@tgaryet
Copy link

tgaryet commented Nov 5, 2015

Would you please explain why you set mcp3008 with the dtoverlay command in config.txt?

I am trying to adapt this dt to an mcp3004. I set compatible="mcp3004". Doesn't that set the actual device type?

Thanks,
Terry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment