Pergunta

Do we have to go through the Device tree bindings documentation of a linux kernel when you start working on it.
Is there no standard set of fields in the device tree which are followed by all distros/kernel sources?

Secondly I need some guidance regarding adding nodes for devices on gpio bus using device tree. I have already consulted http://devicetree.org/Device_Tree_Usage.

Foi útil?

Solução

stackoverflow-query here should point you to documentation on device tree. And yes it is a good idea to go through the documentation before you dive into using it.

As for your gpio devices (I assume you already have a gpio controller in place in your dts/dtsi file in place), there should be plenty under arch/arc/boot/dts . Pick one :)!

Eg: gpio1_8 for mmc dts and gpio1 controller dtsi

Outras dicas

Device Tree Binding for peripherals in an SoC:

As an example for the v5.1 kernel, here are the device tree bindings listed for various peripherals available on an SoC.

Link: https://elixir.bootlin.com/linux/v5.1/source/Documentation/devicetree/bindings

Device Tree Binding for a particular peripheral in an SoC:

To explain a bit about the device tree binding for a particular peripheral let's take an example of an SPI for a very popular TI OMAP family.

Link: https://elixir.bootlin.com/linux/v5.1/source/Documentation/devicetree/bindings/spi/omap-spi.txt

The text in this particular link introduces basically the key-value pairs. The 'key' is the device tree property and the 'value' is the possible place holder values for the corresponding 'key'. As an example, in the above link the "compatible" property, which holds one of the value as "ti,omap2-mcspi".

Another example is the "dma-names" property which holds txN, rxN .

Now, in the below link you can clearly see how these device tree properties are used in the real device trees: https://elixir.bootlin.com/linux/v5.1/source/arch/arm/boot/dts/omap3.dtsi#L365

    mcspi1: spi@48098000 {
        compatible = "ti,omap2-mcspi";
        reg = <0x48098000 0x100>;
        ...
    }

The value "ti,omap2-mcspi" for the key "compatible" is one of the available value in accordance with the device tree binding document for omap-spi.txt (as seen in the second listed link).

So now based on SoC and the peripheral used, the device tree property can be written consulting the device tree binding document.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top