Add test cases that verify various bits and pieces of the legacy devicetree macros match the new APIs. Writing these test cases without giving rise to deprecated macro warnings which might break people's CI if they build with -Werror requires turning off the __WARN() generation in devicetree_legacy_unfixed.h. The entire file is deprecated at this point and must be explicitly enabled with an opt-in Kconfig option, so there isn't any harm in doing this. Nevertheless, take a minimally invasive approach to avoiding __WARN() generation in gen_legacy_defines.py, to avoid the possibility of breakage. This code is basically frozen anyway, so hacks like this won't cause maintainability problems since it isn't being actively maintained. Use the new tests as fodder for a migration guide from the old API in the documentation. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
95 lines
2.1 KiB
Text
95 lines
2.1 KiB
Text
/*
|
|
* Copyright (c) 2020 Nordic Semiconductor ASA
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* Application overlay for testing the legacy devicetree macros can
|
|
* be migrated to 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.
|
|
*/
|
|
#include <dt-bindings/gpio/gpio.h>
|
|
|
|
/*
|
|
* The "start-after..." and "end-before..." comments are because
|
|
* this file is included in the migration HOWTO.
|
|
*/
|
|
|
|
/* start-after-here */
|
|
/ {
|
|
aliases {
|
|
mgr-gpio = &migration_gpio;
|
|
mgr-serial = &migration_serial;
|
|
mgr-i2c-dev = &mgr_i2c_device;
|
|
mgr-spi-dev = &mgr_spi_device;
|
|
};
|
|
|
|
migration {
|
|
#address-cells = <0x1>;
|
|
#size-cells = <0x1>;
|
|
interrupt-parent = <&migration_intc>;
|
|
|
|
migration_gpio: gpio@1000 {
|
|
compatible = "vnd,gpio";
|
|
gpio-controller;
|
|
reg = <0x1000 0x2000>;
|
|
interrupts = <0 1>;
|
|
#gpio-cells = <0x2>;
|
|
label = "MGR_GPIO";
|
|
};
|
|
|
|
migration_serial: serial@3000 {
|
|
compatible = "vnd,serial";
|
|
reg = <0x3000 0x1000>;
|
|
interrupts = <2 1>;
|
|
label = "MGR_SERIAL";
|
|
baud-rate = <115200>;
|
|
};
|
|
|
|
i2c@10000 {
|
|
#address-cells = <1>;
|
|
#size-cells = <0>;
|
|
compatible = "vnd,i2c";
|
|
reg = < 0x10000 0x1000 >;
|
|
label = "MGR_I2C";
|
|
clock-frequency = <100000>;
|
|
interrupts = <10 1>;
|
|
|
|
mgr_i2c_device: i2c-dev@10 {
|
|
compatible = "vnd,i2c-device";
|
|
label = "MGR_I2C_DEV";
|
|
reg = <0x10>;
|
|
};
|
|
};
|
|
|
|
spi@20000 {
|
|
#address-cells = < 1 >;
|
|
#size-cells = < 0 >;
|
|
compatible = "vnd,spi";
|
|
reg = <0x20000 0x1000>;
|
|
interrupts = <20 1>;
|
|
label = "MGR_SPI";
|
|
clock-frequency = <2000000>;
|
|
|
|
cs-gpios = <&migration_gpio 17 GPIO_ACTIVE_LOW>;
|
|
|
|
mgr_spi_device: spi-dev@0 {
|
|
compatible = "vnd,spi-device";
|
|
label = "MGR_SPI_DEV";
|
|
reg = <0>;
|
|
spi-max-frequency = <2000000>;
|
|
};
|
|
};
|
|
|
|
migration_intc: interrupt-controller@30000 {
|
|
compatible = "vnd,intc";
|
|
reg = <0x30000 0x1000>;
|
|
label = "MGR_INTC";
|
|
interrupt-controller;
|
|
#interrupt-cells = <2>;
|
|
};
|
|
};
|
|
};
|
|
/* end-before-here */
|