Commit graph

6 commits

Author SHA1 Message Date
Kumar Gala da40dd4c78 devicetree: Fix argument order for DT_*_CELL_BY_IDX
The cell paramater should have been last to match both the
DT_*_CELL_BY_NAME macros as well as how DT_PHA_BY_IDX works.  We fix the
DT_INST_*_CELL_BY_NAME macros as well.

The dma macro's implemented the behavior correctly, but got the argument
names in correct.  We fix that to make everything consistent.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-27 17:58:35 +02:00
Martí Bolívar 13965f2ef3 doc: update devicetree/clocks.h
Align with devicetree/adc.h conventions.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-26 22:32:34 +02:00
Kumar Gala 670358c039 devicetree.h: clocks: Rename clock node name
Rename clock controller node name to match recommend generic name from
device tree spec.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-21 15:39:36 -05:00
Kumar Gala fc6aa9214c devicetree.h: clocks: Add support for _BY_NAME macros
Add the following macro's to get clock info by name:
	DT_CLOCKS_LABEL_BY_NAME
	DT_CLOCKS_CELL_BY_NAME
	DT_INST_CLOCKS_LABEL_BY_NAME
	DT_INST_CLOCKS_CELL_BY_NAME

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Co-Authored-By: Marti Bolivar <marti.bolivar@nordicsemi.no>
2020-04-21 15:39:36 -05:00
Martí Bolívar 3e0d4be271 doc: devicetree: change doxygen groups
Create a top level devicetree group, and put everything underneath it.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-13 22:38:13 -04:00
Martí Bolívar c3ec5db6d2 devicetree.h: add accessor API for nodes and properties
This is joint work with Kumar Gala (see signed-off-by).

Add helper macros which abstract the "true names" of each of the four
types of node identifier we intend to support (e.g. DT_ALIAS(),
DT_INST()).

These can be passed to a new DT_PROP() macro which can be used to read
the value of a devicetree property given a node identifier from one of
these four other macros, and the as-a-c-token name of the property.
Add other accessor macros and tests as well.

Add some convenience APIs for writing device drivers based on instance
numbers as well. Drivers can "#define DT_DRV_COMPAT driver_compatible"
at the top of the file, then utilize these DT_INST_* macros to access
various property defines.

For example, the uart_sifive driver can do:

  #define DT_DRV_COMPAT sifive_uart0

Then use DT_INST macros like:

  .port         = DT_INST_REG_ADDR(0),
  .sys_clk_freq = DT_INST_PROP(0, clock_frequency),

For convenience working with specific hardware, also add:

  <devicetree/gpio.h>
  <devicetree/adc.h>
  <devicetree/spi.h>

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-24 10:11:20 -05:00