And implement DT_ANY_INST_ON_BUS() in terms of it. This makes some error messages quite a bit shorter by avoiding UTIL_LISTIFY(), which has a nasty temper and tends to explode if not treated gently. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
261 lines
6 KiB
Text
261 lines
6 KiB
Text
/*
|
|
* Copyright (c) 2020 Nordic Semiconductor ASA
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* Application overlay for testing the devicetree.h API.
|
|
*
|
|
* Names in this file should be chosen in a way that won't conflict
|
|
* with real-world devicetree nodes, to allow these tests to run on
|
|
* (and be extended to test) real hardware.
|
|
*/
|
|
|
|
/ {
|
|
aliases {
|
|
test-alias = &test_nodelabel;
|
|
};
|
|
|
|
chosen {
|
|
ztest,gpio = &test_nodelabel;
|
|
};
|
|
|
|
test {
|
|
#address-cells = < 0x1 >;
|
|
#size-cells = < 0x1 >;
|
|
interrupt-parent = <&test_intc>;
|
|
|
|
test_arrays: array-holder {
|
|
/* vnd,undefined-compat is for DT_NODE_HAS_COMPAT() */
|
|
compatible = "vnd,array-holder", "vnd,undefined-compat";
|
|
a = <1000 2000 3000>;
|
|
b = [aa bb cc dd];
|
|
c = "bar", "baz";
|
|
};
|
|
|
|
test_phandles: phandle-holder-0 {
|
|
compatible = "vnd,phandle-holder";
|
|
ph = <&test_gpio_1>;
|
|
phs = <&test_gpio_1 &test_gpio_2 &test_i2c>;
|
|
gpios = <&test_gpio_1 10 20>, <&test_gpio_2 30 40>;
|
|
pha-gpios = <&test_gpio_1 50 60>, <&test_gpio_3 70>, <&test_gpio_2 80 90>;
|
|
foos = <&test_gpio_1 100>, <&test_gpio_2 110>;
|
|
foo-names = "A", "b-c";
|
|
};
|
|
|
|
test_enum_0: enum-0 {
|
|
compatible = "vnd,enum-holder";
|
|
val = "zero";
|
|
};
|
|
|
|
test_enum_1: enum-1 {
|
|
compatible = "vnd,enum-holder";
|
|
val = "two";
|
|
};
|
|
|
|
/*
|
|
* This should be the only node with this
|
|
* compatible in the tree.
|
|
*/
|
|
disabled-node@0 {
|
|
compatible = "vnd,disabled-compat";
|
|
reg = < 0x0 0x1000 >;
|
|
label = "DISABLED_NODE_0";
|
|
status = "disabled";
|
|
};
|
|
|
|
disabled_gpio: gpio@0 {
|
|
compatible = "vnd,gpio";
|
|
gpio-controller;
|
|
reg = < 0x0 0x1000 >;
|
|
interrupts = <3 1>;
|
|
#gpio-cells = < 0x2 >;
|
|
label = "TEST_GPIO_0";
|
|
status = "disabled";
|
|
};
|
|
|
|
test_nodelabel: TEST_NODELABEL_ALLCAPS: test_gpio_1: gpio@deadbeef {
|
|
compatible = "vnd,gpio";
|
|
gpio-controller;
|
|
reg = < 0xdeadbeef 0x1000 >;
|
|
#gpio-cells = < 0x2 >;
|
|
#foo-cells = < 0x1 >;
|
|
label = "TEST_GPIO_1";
|
|
interrupts = <4 3>;
|
|
status = "okay";
|
|
};
|
|
|
|
test_gpio_2: gpio@abcd1234 {
|
|
compatible = "vnd,gpio";
|
|
gpio-controller;
|
|
reg = < 0xabcd1234 0x500 0x98765432 0xff >;
|
|
reg-names = "one", "two";
|
|
#gpio-cells = < 0x2 >;
|
|
#foo-cells = < 0x1 >;
|
|
interrupts = <5 2>;
|
|
label = "TEST_GPIO_2";
|
|
status = "okay";
|
|
};
|
|
|
|
test_gpio_3: gpio@1234 {
|
|
compatible = "vnd,gpio-one-cell";
|
|
gpio-controller;
|
|
reg = < 0x1234 0x500 >;
|
|
#gpio-cells = < 0x1 >;
|
|
label = "TEST_GPIO_3";
|
|
status = "okay";
|
|
};
|
|
|
|
test_i2c: i2c@11112222 {
|
|
#address-cells = < 1 >;
|
|
#size-cells = < 0 >;
|
|
compatible = "vnd,i2c";
|
|
reg = < 0x11112222 0x1000 >;
|
|
label = "TEST_I2C_CTLR";
|
|
status = "okay";
|
|
clock-frequency = < 100000 >;
|
|
interrupts = <6 2 7 1>;
|
|
interrupt-names = "status", "error";
|
|
|
|
test-i2c-dev@10 {
|
|
compatible = "vnd,i2c-device";
|
|
label = "TEST_I2C_DEV_10";
|
|
reg = < 0x10 >;
|
|
};
|
|
|
|
gpio@11 {
|
|
compatible = "vnd,gpio-expander";
|
|
reg = <0x11>;
|
|
label = "TEST_EXPANDER_I2C";
|
|
};
|
|
};
|
|
|
|
test_spi: spi@33334444 {
|
|
#address-cells = < 1 >;
|
|
#size-cells = < 0 >;
|
|
compatible = "vnd,spi";
|
|
reg = < 0x33334444 0x1000 >;
|
|
interrupts = <8 3 9 0 10 1>;
|
|
label = "TEST_SPI_CTLR";
|
|
status = "okay";
|
|
clock-frequency = < 2000000 >;
|
|
|
|
cs-gpios = <&test_gpio_1 0x10 0x20>,
|
|
<&test_gpio_2 0x30 0x40>,
|
|
<&test_gpio_2 0x50 0x60>;
|
|
|
|
/* all vnd,spi-device instances should have CS */
|
|
|
|
test-spi-dev@0 {
|
|
compatible = "vnd,spi-device";
|
|
label = "TEST_SPI_DEV_0";
|
|
reg = <0>;
|
|
spi-max-frequency = < 2000000 >;
|
|
};
|
|
|
|
test-spi-dev@1 {
|
|
compatible = "vnd,spi-device";
|
|
label = "TEST_SPI_DEV_1";
|
|
reg = <1>;
|
|
spi-max-frequency = < 2000000 >;
|
|
};
|
|
|
|
gpio@2 {
|
|
compatible = "vnd,gpio-expander";
|
|
reg = <2>;
|
|
label = "TEST_EXPANDER_SPI";
|
|
spi-max-frequency = <(1 * 1000 * 1000)>;
|
|
};
|
|
};
|
|
|
|
test_spi_no_cs: spi@55556666 {
|
|
#address-cells = < 1 >;
|
|
#size-cells = < 0 >;
|
|
compatible = "vnd,spi";
|
|
reg = < 0x55556666 0x1000 >;
|
|
label = "TEST_SPI_CTLR_NO_CS";
|
|
status = "okay";
|
|
clock-frequency = < 2000000 >;
|
|
|
|
/* no vnd,spi-device-2 instances should have CS */
|
|
test_spi_dev_no_cs: test-spi-dev@0 {
|
|
compatible = "vnd,spi-device-2";
|
|
label = "TEST_SPI_DEV_NO_CS";
|
|
reg = <0>;
|
|
spi-max-frequency = < 2000000 >;
|
|
};
|
|
};
|
|
|
|
test_i2c_1: i2c@77778888 {
|
|
#address-cells = < 1 >;
|
|
#size-cells = < 0 >;
|
|
compatible = "vnd,i2c";
|
|
reg = < 0x77778888 0x1000 >;
|
|
label = "TEST_I2C_CTLR_1";
|
|
status = "okay";
|
|
clock-frequency = < 100000 >;
|
|
interrupts = <11 3 12 2>;
|
|
interrupt-names = "status", "error";
|
|
};
|
|
|
|
test_adc_1: adc@10002000 {
|
|
reg = <0x10002000 0x1000>;
|
|
compatible = "vnd,adc";
|
|
label = "TEST_ADC_1";
|
|
status = "okay";
|
|
#io-channel-cells = <1>;
|
|
};
|
|
|
|
test_adc_2: adc@10003000 {
|
|
reg = <0x10003000 0x1000>;
|
|
compatible = "vnd,adc";
|
|
label = "TEST_ADC_2";
|
|
status = "okay";
|
|
#io-channel-cells = <1>;
|
|
};
|
|
|
|
/* there should only be one of these */
|
|
test_temp_sensor: temperature-sensor {
|
|
compatible = "vnd,adc-temp-sensor";
|
|
label = "TEST_TEMP";
|
|
io-channels = <&test_adc_1 10>, <&test_adc_2 20>;
|
|
io-channel-names = "ch1", "ch2";
|
|
clocks = <&test_clk 3 7>, <&test_fixed_clk>, <&test_clk 8 2>;
|
|
};
|
|
|
|
/* there should only be one of these */
|
|
test_reg: reg-holder@9999aaaa {
|
|
compatible = "vnd,reg-holder";
|
|
reg = < 0x9999aaaa 0x1000 0xbbbbcccc 0x3f >;
|
|
status = "okay";
|
|
reg-names = "first", "second";
|
|
misc-prop = <1234>;
|
|
};
|
|
|
|
test_intc: interrupt-controller@bbbbcccc {
|
|
compatible = "vnd,intc";
|
|
reg = <0xbbbbcccc 0x1000>;
|
|
interrupt-controller;
|
|
#interrupt-cells = <2>;
|
|
};
|
|
|
|
/* there should only be one of these */
|
|
test_irq: interrupt-holder {
|
|
compatible = "vnd,interrupt-holder";
|
|
status = "okay";
|
|
interrupts = <30 3 40 5 60 7>;
|
|
interrupt-names = "err", "stat", "done";
|
|
};
|
|
|
|
test_fixed_clk: test-fixed-clock {
|
|
compatible = "fixed-clock";
|
|
clock-frequency = <25000000>;
|
|
#clock-cells = <0>;
|
|
};
|
|
|
|
test_clk: test-clock {
|
|
compatible = "vnd,clock";
|
|
label = "TEST_CLOCK";
|
|
#clock-cells = <2>;
|
|
};
|
|
};
|
|
};
|