AnsweredAssumed Answered

AD7266 Devicetree support for i.MX28

Question asked by Garfield on Mar 3, 2013
Latest reply on Mar 6, 2013 by Garfield
Branched to a new discussion


I'm an German student writing my thesis, it's about an embedded Linux

controller board with the AD7266 and an i.MX28 SOC.

I am working on Kernel version 3.6.3-rt9 with devicetree support and the AD7266 connected to SPI3.


I have a problem with the initialization of the AD7266. I found the documentation in the wiki [1] but I have no idea where to set up the driver appropriate. The problem is that I couldn't use GPIOs for setting up which channel I would like to sample.

My connections are as follows:


AD7266 A0 => GPIO2_14 of i.MX28

AD7266 A1 => GPIO4_12 of i.MX28

AD7266 A2 => GPIO4_14 of i.MX28


The kernel loads the module for the AD7266 and the connection between SOC and ADC are O.K. but I have no idea where to put the following code snippet so that I could use Single ended mode and dynamic address mode.


      static  struct  ad7266_platform_data pdata =  {

             .range  =  AD7266_RANGE_2VREF,

             .mode  =  AD7266_MODE_SINGLE_ENDED,

             .fixed_addr  =  false,

             .addr_gpios  =  {  GPIO_PF6,  GPIO_PF7,  GPIO_PF8},



I tested to put it in /arch/arm/mach-mxs/mach-mxs.c but this gave me multiple

compilation errors about an missing equation sign (red) and that the

struct is defined but never used.

Another problem is where do I find the appropriate strings for the .addr_gpios

or how do I define all of this in the devicetree?

The interface itself works. I do get raw values for:





The interesting parts of the devicetree "MICS002.dts":



/include/ "imx28.dtsi"


/ {

    model = "MICS002 Modul";

    compatible = "fsl,MICS002", "fsl,imx28";


    apb@80000000 {

        apbh@80000000 {

             ssp3: ssp@80016000 {

                #address-cells = <1>;

                #size-cells = <0>;

                compatible = "fsl,imx28-spi";

                pinctrl-names = "default";

                pinctrl-0 = <&spi3_pins_MICS002_ADC>;

                status = "okay";


                AD7266: AD7266@0 {

                    compatible = "adi,ad7266";

                    spi-max-frequency = <100000>;

                    reg = <0>;





            pinctrl@80018000 {

                pinctrl-names = "default";


                spi3_pins_MICS002_ADC: spi3@0 {

                    reg = <0>;

                    fsl,pinmux-ids = <

                        0x2180 /* MX28_PAD_SSP3_SCK__SSP3_SCK */

                        0x2190 /* MX28_PAD_SSP3_MOSI__SSP3_CMD */

                        0x21a0 /* MX28_PAD_SSP3_MISO__SSP3_D0 */

                        0x21b0 /* MX28_PAD_SSP3_SS0__SSP3_D3 */


                    fsl,drive-strength = <1>;

                    fsl,voltage = <1>;

                    fsl,pull-up = <1>;





        apbx@80040000 {

            duart: serial@80074000 {

                pinctrl-names = "default";

                pinctrl-0 = <&duart_pins_a>;

                status = "okay";







I hope somebody could help me out or just give me a hint which files I have

to look closer at.