|  | /* | 
|  | * 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_STATUS(..,okay). | 
|  | * There should only be one vnd,array-holder in the entire DTS. | 
|  | */ | 
|  | 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"; | 
|  | /* | 
|  | * At least one of these phandles must refer to | 
|  | * test_gpio_1, or dependency ordinal tests may fail. | 
|  | */ | 
|  | ph = <&test_gpio_1>; | 
|  | phs = <&test_gpio_1 &test_gpio_2 &test_i2c>; | 
|  | phs-or = <&test_enum_default_0 &test_enum_default_1>; | 
|  | gpios = <&test_gpio_1 10 20>, <&test_gpio_2 30 40>; | 
|  | pha-gpios = <&test_gpio_1 50 60>, <0>, <&test_gpio_3 70>, <&test_gpio_2 80 90>; | 
|  | foos = <&test_gpio_1 100>, <&test_gpio_2 110>; | 
|  | foo-names = "A", "b-c"; | 
|  | pwms = <&test_pwm1 8 200 3>, <&test_pwm2 5 100 1>; | 
|  | pwm-names = "red", "green"; | 
|  | }; | 
|  |  | 
|  | test_enum_0: enum-0 { | 
|  | compatible = "vnd,enum-holder"; | 
|  | val = "zero"; | 
|  | }; | 
|  |  | 
|  | test_enum_1: enum-1 { | 
|  | compatible = "vnd,enum-holder"; | 
|  | val = "two"; | 
|  | }; | 
|  |  | 
|  | test_enum_default_0: enum-2 { | 
|  | compatible = "vnd,enum-required-false-holder"; | 
|  | val = "one"; | 
|  | }; | 
|  |  | 
|  | test_enum_default_1: enum-3 { | 
|  | compatible = "vnd,enum-required-false-holder"; | 
|  | }; | 
|  |  | 
|  | test_enum_int_default_0: enum-4 { | 
|  | compatible = "vnd,enum-int-required-false-holder"; | 
|  | val = < 5 >; | 
|  | }; | 
|  |  | 
|  | test_enum_int_default_1: enum-5 { | 
|  | compatible = "vnd,enum-int-required-false-holder"; | 
|  | }; | 
|  |  | 
|  | /* | 
|  | * 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_no_status: intc_no_status@0 { | 
|  | compatible = "vnd,intc"; | 
|  | reg = <0x0 0x1000>; | 
|  | interrupt-controller; | 
|  | #interrupt-cells = <2>; | 
|  | }; | 
|  |  | 
|  | 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 { | 
|  | gpio-controller; | 
|  | #gpio-cells = <2>; | 
|  | compatible = "vnd,gpio-expander"; | 
|  | reg = <0x11>; | 
|  | label = "TEST_EXPANDER_I2C"; | 
|  | }; | 
|  |  | 
|  | test_i2c_mux: i2c-mux@12 { | 
|  | compatible = "vnd,i2c-mux"; | 
|  | label = "I2C_MUX"; | 
|  | reg = <0x12>; | 
|  | i2c-mux-ctlr-1 { | 
|  | compatible = "vnd,i2c-mux-controller"; | 
|  | #address-cells = <1>; | 
|  | #size-cells = <0>; | 
|  | label = "I2C_MUX_CTLR_1"; | 
|  | test_muxed_i2c_dev_1: muxed-i2c-dev@10 { | 
|  | compatible = "vnd,i2c-device"; | 
|  | status = "disabled"; | 
|  | reg = <0x10>; | 
|  | }; | 
|  | }; | 
|  | i2c-mux-ctlr-2 { | 
|  | compatible = "vnd,i2c-mux-controller"; | 
|  | #address-cells = <1>; | 
|  | #size-cells = <0>; | 
|  | label = "I2C_MUX_CTLR_1"; | 
|  | test_muxed_i2c_dev_2: muxed-i2c-dev@10 { | 
|  | compatible = "vnd,i2c-device"; | 
|  | status = "disabled"; | 
|  | reg = <0x10>; | 
|  | }; | 
|  | }; | 
|  | }; | 
|  | }; | 
|  |  | 
|  | test_i2c_no_reg: i2c { | 
|  | #address-cells = < 1 >; | 
|  | #size-cells = < 0 >; | 
|  | compatible = "vnd,i2c"; | 
|  | label = "TEST_I2C_NO_REG_CTLR"; | 
|  | status = "okay"; | 
|  | clock-frequency = < 100000 >; | 
|  |  | 
|  | test-i2c-dev@12 { | 
|  | compatible = "vnd,i2c-device"; | 
|  | label = "TEST_I2C_DEV_12"; | 
|  | reg = < 0x12 >; | 
|  | }; | 
|  | }; | 
|  |  | 
|  | 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 { | 
|  | gpio-controller; | 
|  | #gpio-cells = <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 >; | 
|  |  | 
|  | /* | 
|  | * There should only be one spi-device-2 node. | 
|  | * It should not have a CS GPIO. | 
|  | */ | 
|  | 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"; | 
|  | dmas = <&test_dma1 1 2>, <&test_dma2 3 4>; | 
|  | dma-names = "tx", "rx"; | 
|  | clocks = <&test_clk 3 7>, <&test_fixed_clk>, <&test_clk 8 2>; | 
|  | clock-names = "clk-a", "clk-fixed", "clk-b"; | 
|  | }; | 
|  |  | 
|  | /* 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>; | 
|  | }; | 
|  |  | 
|  | test_dma1: dma@44443333 { | 
|  | compatible = "vnd,dma"; | 
|  | #dma-cells = <2>; | 
|  | reg = < 0x44443333 0x1000 >; | 
|  | interrupts = <11 3>; | 
|  | label = "TEST_DMA_CTRL_1"; | 
|  | status = "okay"; | 
|  | }; | 
|  |  | 
|  | test_dma2: dma@44442222 { | 
|  | compatible = "vnd,dma"; | 
|  | #dma-cells = <2>; | 
|  | reg = < 0x44442222 0x1000 >; | 
|  | interrupts = <12 3>; | 
|  | label = "TEST_DMA_CTRL_2"; | 
|  | status = "okay"; | 
|  | }; | 
|  |  | 
|  | test_pwm1: pwm@55551111 { | 
|  | compatible = "vnd,pwm"; | 
|  | #pwm-cells = <3>; | 
|  | reg = < 0x55551111 0x1000 >; | 
|  | label = "TEST_PWM_CTRL_1"; | 
|  | status = "okay"; | 
|  | }; | 
|  |  | 
|  | test_pwm2: pwm@55552222 { | 
|  | compatible = "vnd,pwm"; | 
|  | #pwm-cells = <3>; | 
|  | reg = < 0x55552222 0x1000 >; | 
|  | label = "TEST_PWM_CTRL_2"; | 
|  | status = "okay"; | 
|  | }; | 
|  |  | 
|  | /* there should only be one of these */ | 
|  | test_children: test-children { | 
|  | compatible = "vnd,child-bindings"; | 
|  |  | 
|  | test_child_a: child-a { | 
|  | val = <0>; | 
|  | }; | 
|  | test_child_b: child-b { | 
|  | val = <1>; | 
|  | }; | 
|  | test_child_c: child-c { | 
|  | val = <2>; | 
|  | }; | 
|  | }; | 
|  |  | 
|  | test-great-grandchildren { | 
|  | compatible = "vnd,great-grandchild-bindings"; | 
|  |  | 
|  | child { | 
|  | grandchild { | 
|  | test_ggc: great-grandchild { | 
|  | ggc-prop = <42>; | 
|  | }; | 
|  | }; | 
|  | }; | 
|  | }; | 
|  | }; | 
|  | }; |