IIO driver MCP4725 "invalid platform or devicetree data"

175 views
Skip to first unread message

john whittle

unread,
Feb 27, 2020, 7:59:06 PM2/27/20
to BeagleBoard
Greetings,

I'm trying to load this MCP4725 IIO driver

modprobe mcp4725

echo "mcp4725 0x60" >/sys/bus/i2c/devices/i2c-2/new_device


no problems up until i run dmesg and it doesnt recognize it as an iio device.

root@beaglebone:/sys/bus/iio/devices# ls -l
total 0

run dmesg


[  471.215225] mcp4725 2-0060: invalid platform or devicetree data
[  471.232912] i2c i2c-2: new_device: Instantiated device mcp4725 at 0x60

It works with other chips the mcp3422 for instance. exact same commands except different address

any thoughts? is this driver no good for beaglebone?


root@beaglebone:/home/debian# i2cdetect -r 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --



Robert Nelson

unread,
Feb 27, 2020, 10:02:02 PM2/27/20
to Beagle Board, jo...@poseidonos.com
On Thu, Feb 27, 2020 at 6:59 PM john whittle <jo...@poseidonos.com> wrote:
>
> Greetings,
>
> I'm trying to load this MCP4725 IIO driver
>
> modprobe mcp4725
>
> echo "mcp4725 0x60" >/sys/bus/i2c/devices/i2c-2/new_device
>
>
> no problems up until i run dmesg and it doesnt recognize it as an iio device.
>
> root@beaglebone:/sys/bus/iio/devices# ls -l
> total 0
>
> run dmesg
>
>
> [ 471.215225] mcp4725 2-0060: invalid platform or devicetree data
> [ 471.232912] i2c i2c-2: new_device: Instantiated device mcp4725 at 0x60
>
> It works with other chips the mcp3422 for instance. exact same commands except different address
>
> any thoughts? is this driver no good for beaglebone?

The kernel message gave you a hint of what's wrong.. "invalid platform
or devicetree data"...

The mcp4725 driver has a required property "vdd-supply" that must be
provided either thru the platform (legacy) or device tree data..

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/iio/dac/mcp4725.txt

Start with a basic overlay (assuming P9_19/P9_20 right? )

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-I2C2-00A0.dts

and update this section for what your driver needs..

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-I2C2-00A0.dts#L84-L91

assuming it's v3.3 use:

vdd-supply = <&vmmcsd_fixed>;

Regards,

--
Robert Nelson
https://rcn-ee.com/

john whittle

unread,
Mar 2, 2020, 4:20:38 PM3/2/20
to BeagleBoard
Awesome. I felt it was a bit beyond my grasp, thank!

took me a bit longer but.
I edited the BB-I2C2-00A0.dts. adding

/* add any i2c devices on the bus here */
   mcp4725@60 {
compatible = "microchip,mcp4725";
reg = <0x60>;
vdd-supply = <&vmmcsd_fixed>;
   };
   adc@68 {
        compatible = "microchip,mcp3428";
        reg = <0x68>;
   };

                           mcp23008@20 {
                                compatible = "microchip,mcp23008";
                                reg = <0x20>;
                           };

going back to the bb.org/overlays. running the ./install.sh

then editing /boot/uEnv.txt to load the cape

###
###Overide capes with eeprom
uboot_overlay_addr0=/lib/firmware/BB-I2C2-00A0.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###

and voila it registers on boot as a device and works 

root@beaglebone:/boot# i2cdetect -r 2
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-2 using read byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n] Y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: UU -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Thanks!
Reply all
Reply to author
Forward
0 new messages