Implementing NXP Hardware in Device Tree

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Implementing NXP Hardware in Device Tree

Jump to solution
990 Views
DillonM
Contributor II

I currently attempting to implement the mma8452 driver for my mma8451Q accelerometer by adding it to the the Linux Device Tree. 

Currently I am taking the route of creating a device tree overlay file (dtbo) that contains the addition to the device tree describing the accelerometer. It loads properly at boot and correctly pulls in the designated mma8452 driver. The driver however returns the following error in my dmesg log on boot:

 

[ 23.2352] mma8452: probe of 0-001c failed with error -121

 

Does anyone know what this means or how to fix it? Perhaps an overlay is not the correct way to do this and instead I should create a dtsi file or modify the source dts file? I can access the accelerometer from the console using the i2c-tools package at the SA0 address 0x1C. 

The driver supplied by NXP can be found here mma8452.c Driver 

My dtbo file can be seen below:

 

/*
 * MIRA custom cape device tree overlay
 * Supports MMA8451Q Accelerometer  
 */
/dts-v1/;
/plugin/;

#include <dt-bindings/interrupt-controller/irq.h>

/ {
        /*
         * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
         */
        fragment@0 {
                target-path="/";
                __overlay__ {

                        chosen {
                                overlays {
                                        MIRA_EXTENSIONS = __TIMESTAMP__;
                                };
                        };
                };
        };

        fragment@1 {
                target = <&i2c0>;

                __overlay__ {
                        status = "okay";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        accel@1C {
                                compatible = "fsl,mma8451";
                                reg = <0x1C>;
                                interrupt-parent = <&gpio1>;
                                interrupts = <16 IRQ_TYPE_EDGE_RISING>;
                                interrupt-names = "INT1";
                        };
                };
        };
};

 

 The target = <&i2c0> was chosen simply because it was an i2c node in another dtsi file. No other reason. May be wrong.

Labels (1)
0 Kudos
1 Solution
971 Views
DillonM
Contributor II

The solution was to target the correct i2c bus the Accelerometer was connected to. This ended up being i2c2, not i2c0. This solved my issue. 

View solution in original post

0 Kudos
2 Replies
972 Views
DillonM
Contributor II

The solution was to target the correct i2c bus the Accelerometer was connected to. This ended up being i2c2, not i2c0. This solved my issue. 

0 Kudos
566 Views
rockerr
Contributor II

Did you use the Yocto Project for your distribution? If so, could you explain how exactly did you manage to add your device tree to the linux-imx kernel source?

0 Kudos