Device tree bindings

This article contains a list of device tree binding examples to enable and configure the the device drivers on teh Acme Systems Linux boards

SPI

Acqua

spi0: spi@f0004000 {
    status = "okay";
    cs-gpios = <&pioD 13 0>, <&pioD 14 0>, <&pioD 15>, <&pioD 16>;

    device@0 {
        compatible = "spidev";
        spi-max-frequency = <50000000>;     // 50 MHz
        reg = <0>;
    };
    device@1 {
        compatible = "spidev";
        spi-max-frequency = <5000000>;      // 5 MHz
        reg = <1>;
    };
    device@2 {
        compatible = "spidev";
        spi-max-frequency = <5000000>;      // 5 MHz
        reg = <2>;
    };
    device@3 {
        compatible = "spidev";
        spi-max-frequency = <5000000>;      // 5 MHz
        reg = <3>;
    };
};

spi1: spi@f8008000 {
    status = "disabled";
    cs-gpios = <&pioC 25 0>, <&pioC 26 0>, <&pioC 27 0>, <&pioC 28 0>;
};

Aria

spi0: spi@f0000000 {
    status = "okay";
    interrupts = <13 4 5>;
    cs-gpios = <&pioA 14 0>, <&pioA 7 0>, <0>, <0>;

    device@0 {
        compatible = "spidev";
        spi-max-frequency = <5000000>;
        reg = <0>;
    };

    device@1 {
        compatible = "spidev";
        spi-max-frequency = <5000000>;
        reg = <1>;
    };
};

Arietta

spi1: spi@f0004000 {
    status = "okay";
    cs-gpios = <&pioA 8 0>, <&pioA 0 0>, <&pioA 31 0>, <&pioA 30 0>;
    device@0 {
        compatible = "spidev";
        spi-max-frequency = <50000000>;     // 50 MHz
        reg = <0>;
    };
    device@1 {
        compatible = "spidev";
        spi-max-frequency = <5000000>;      // 5 MHz
        reg = <1>;
    };
    device@2 {
        compatible = "spidev";
        spi-max-frequency = <5000000>;      // 5 MHz
        reg = <2>;
    };
    device@3 {
        compatible = "spidev";
        spi-max-frequency = <5000000>;      // 5 MHz
        reg = <3>;
    };
};

ADC

RoadRunner

Insert this definition to enable the driver:

adc: adc@fc030000 {
    compatible = "atmel,sama5d2-adc";
    vddana-supply = <&vdd_3v3_lp_reg>;
    vref-supply = <&vdd_3v3_lp_reg>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_adc_default>;
    status = "okay";

    vdd_3v3_lp_reg: REG_LDO2 {
        regulator-name = "VDD_3V3_LP";
        regulator-min-microvolt = <3300000>;
        regulator-max-microvolt = <3300000>;
        regulator-always-on;
    };
};

Insert this definition to select the pin to use:

pinctrl_adc_default: adc_default {
    pinmux = <PIN_PD19__GPIO>,
             <PIN_PD20__GPIO>,
             <PIN_PD21__GPIO>,
             <PIN_PD22__GPIO>;
    bias-disable;
};

Acqua

Insert this definition to enable the driver and the pin to use (Acqua pinout):

adc0: adc@f8018000 {
    pinctrl-names = "default";
    pinctrl-0 = <
        &pinctrl_adc0_adtrg
        &pinctrl_adc0_ad0
        &pinctrl_adc0_ad1
        &pinctrl_adc0_ad2
        &pinctrl_adc0_ad3
        &pinctrl_adc0_ad4
        &pinctrl_adc0_ad5
        &pinctrl_adc0_ad6
        &pinctrl_adc0_ad7
        &pinctrl_adc0_ad8
        &pinctrl_adc0_ad9
        &pinctrl_adc0_ad10
        &pinctrl_adc0_ad11
        >;
    status = "okay";
};

PWM

Acqua

pwm0: pwm@f002c000 {
    pinctrl-names = "default";
    pinctrl-0 = <   
                    &pinctrl_pwm0_pwmh0
                    &pinctrl_pwm0_pwml0
                    &pinctrl_pwm0_pwmh1 
                    &pinctrl_pwm0_pwml1
                    &pinctrl_pwm0_pwmh2 
                    &pinctrl_pwm0_pwml2
                    &pinctrl_pwm0_pwmh3 
                    &pinctrl_pwm0_pwml3
                    >;
    status = "okay";
};

pinctrl@fffff200 {
    board {
        pinctrl_pwm0_pwmh0: pwm0_pwmh0 {
            atmel,pins =
                < AT91_PIOB 0 AT91_PERIPH_B AT91_PINCTRL_NONE >;
        };
        pinctrl_pwm0_pwml0: pwm0_pwml0 {
            atmel,pins =
                < AT91_PIOB 1 AT91_PERIPH_B AT91_PINCTRL_NONE >;
        };
        pinctrl_pwm0_pwmh1: pwm0_pwmh1 {
            atmel,pins =
                < AT91_PIOB 4 AT91_PERIPH_B AT91_PINCTRL_NONE >;
        };
        pinctrl_pwm0_pwml1: pwm0_pwml1 {
            atmel,pins =
                < AT91_PIOB 5 AT91_PERIPH_B AT91_PINCTRL_NONE >;
        };
        pinctrl_pwm0_pwmh2: pwm0_pwmh2 {
            atmel,pins =
                < AT91_PIOB 8 AT91_PERIPH_B AT91_PINCTRL_NONE >;
        };
        pinctrl_pwm0_pwml2: pwm0_pwml2 {
            atmel,pins =
                < AT91_PIOB 9 AT91_PERIPH_B AT91_PINCTRL_NONE >;
        };
        pinctrl_pwm0_pwmh3: pwm0_pwmh3 {
            atmel,pins =
                < AT91_PIOB 12 AT91_PERIPH_B AT91_PINCTRL_NONE >;
        };
        pinctrl_pwm0_pwml3: pwm0_pwml3 {
            atmel,pins =
                < AT91_PIOB 13 AT91_PERIPH_B AT91_PINCTRL_NONE >;
        };
    };
};

Aria

pinctrl@fffff400 {
    pwm0 {
        pinctrl_pwm0: pwm0-0 {
            atmel,pins =
            < AT91_PIOC 18 AT91_PERIPH_C AT91_PINCTRL_NONE
              AT91_PIOC 19 AT91_PERIPH_C AT91_PINCTRL_NONE
              AT91_PIOC 20 AT91_PERIPH_C AT91_PINCTRL_NONE
              AT91_PIOC 21 AT91_PERIPH_C AT91_PINCTRL_NONE >;
        };
    };
};

pwm0: pwm@f8034000 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_pwm0>;
    status = "okay";
};

Arietta

pinctrl@fffff400 {
    pwm0 {
        pinctrl_pwm0: pwm0-0 {
            atmel,pins =
            < AT91_PIOB 11 AT91_PERIPH_B AT91_PINCTRL_NONE
              AT91_PIOB 12 AT91_PERIPH_B AT91_PINCTRL_NONE
              AT91_PIOB 13 AT91_PERIPH_B AT91_PINCTRL_NONE
              AT91_PIOB 14 AT91_PERIPH_B AT91_PINCTRL_NONE >;
        };
    };
};

Ethernet port

RoadRunner

To have a native ethernet port the RoadRunner SOM needs an external phy chip like a LAN8720 as explained on this guide.

Two different DTS configurations can be used. The first one is fully compatible with Microchip sama5d2 evaluation kit and is the same used on Acme Systems Berta D2 board. The second one is used on Acme Systems XTERM-02 terminal. The main differences is that in the XTERM-02 dts we'll assign to the display cell all the pin requested to have 24 lines for RGB colors.

This binding under apb section is the same for both configurations:

macb0: ethernet@f8008000 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_macb0_default &pinctrl_macb0_phy_irq>;
    phy-mode = "rmii";
    status = "okay";

    ethernet-phy@1 {
        reg = <0x1>;
        interrupt-parent = <&pioA>;
        interrupts = <73 IRQ_TYPE_LEVEL_LOW>;
    };
};

If you are using a Berta D2 board leave this section as is:

pinctrl_macb0_default: macb0_default {
    pinmux = <PIN_PB14__GTXCK>,
         <PIN_PB15__GTXEN>,
         <PIN_PB16__GRXDV>,
         <PIN_PB17__GRXER>,
         <PIN_PB18__GRX0>,
         <PIN_PB19__GRX1>,
         <PIN_PB20__GTX0>,
         <PIN_PB21__GTX1>,
         <PIN_PB22__GMDC>,
         <PIN_PB23__GMDIO>;
    bias-disable;
};

If you are using a XTERM-02 board use this alternative configuration:

pinctrl_macb0_default: macb0_default {
    pinmux = <PIN_PB14__GTXCK>,
         <PIN_PB15__GTXEN>,
         <PIN_PB16__GRXDV>,
         <PIN_PB17__GRXER>,
         <PIN_PB18__GRX0>,
         <PIN_PD14__GRX1>,
         <PIN_PD15__GTX0>,
         <PIN_PB21__GTX1>,
         <PIN_PB22__GMDC>,
         <PIN_PB23__GMDIO>;
    bias-disable;
};

Serial ports

Acqua

usart0: serial@f001c000 {
    status = "okay";
};

usart1: serial@f0020000 {
    status = "okay";
};

usart2: serial@f8020000 {
    status = "okay";
};

usart3: serial@f8024000 {
    status = "okay";
};

uart1: serial@f8028000 {
    status = "okay";
};

uart0: serial@f0024000 {
    status = "okay";
};

I2C Bus

Acqua

i2c0: i2c@f8010000 {
    status ="okay";
};

i2c1: i2c@f8014000 {
    status ="okay";
};

i2c2: i2c@f801c000 {
    status = "okay";
};

Aria & Arietta

i2c0: i2c@f8010000 {
    status ="okay";
};

i2c1: i2c@f8014000 {
    status ="okay";
};

Links

Related links

Author: Sergio Tanzilli - tanzilli@acmesystems.it
System designer and CEO of Acme Systems srl
Web master of: https://www.acmesystems.it and http://www.tanzolab.it
Software developer on: https://github.com/tanzilli and https://github.com/acmesystemsss