Have
include: foo.dts
include: [foo.dts, bar.dts]
instead of
inherits:
!include foo.dts
inherits:
!include [foo.dts, bar.dts]
This is a nicer and shorter and less cryptic syntax, and will make it
possible to get rid of the custom PyYAML constructor for '!include'
later.
'inherits: !include ...' is still supported for backwards compatibility
for now. Later on, I'm planning to mass-replace it, add a deprecation
warning if it's used, and document 'include:'. Then the '!include'
implementation can be removed a bit later.
'!include' has caused issues in the past (see the comment above the
add_constructor() call), gets iffy with multiple EDT instances, and
makes the code harder to follow.
I'm guessing '!include' might've been intended to be useful outside of
'inherits:' originally, but that's the only place where it's used. It's
undocumented that it's possible to put it elsewhere.
To implement the backwards compatibility, the code just transforms
inherits:
!include foo.dts
into
inherits:
- foo.dts
and treats 'inherits:' similarly to 'include:'. Previously, !include
inserted the contents of the included file instead.
Some more sanity checks for 'include:'/'inherits:' are included as well.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
The 'category: required/optional' setting for properties is just a
yes/no thing. Using a boolean makes it clearer, so have
'required: true/false' instead.
Print a clear error when 'category:' is used:
edtlib.EDTError: please put 'required: true' instead of 'category:
required' in 'properties: foo: ...' in
test-bindings/sub-node-parent.yaml - 'category' has been removed
The old scripts in scripts/dts/ ignore this setting, and only print a
warning if 'category: required' in an inherited binding is changed to
'category: optional'. Remove that code, since the new scripts already
have the same check.
The replacement was done with
git ls-files 'dts/bindings/*.yaml' | xargs sed -i \
-e 's/category:\s*required/required: true/' \
-e 's/category:\s*optional/required: false/'
dts/binding-template.yaml is updated as well.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update the ADC bindings to include #io-channel-cells and update the
related dts files to set #io-channel-cells.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Renaming bindings to consistently be called foo-controller.yaml for
controllers and foo-device.yaml for devices (last one mostly makes sense
for devices on buses and the like).
I was thinking of having a plain foo.yaml be the controller as well, but
!include interrupt.yaml
reads much worse than
!include interrupt-controller.yaml
Another advantage of this approach is that no binding changes meaning
(which could be risky). It's just adding suffixes to filenames.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Renaming bindings to consistently be called foo-controller.yaml for
controllers and foo-device.yaml for devices (last one mostly makes sense
for devices on buses and the like).
I was thinking of having a plain foo.yaml be the controller as well, but
!include interrupt.yaml
reads much worse than
!include interrupt-controller.yaml
Another advantage of this approach is that no binding changes meaning
(which could be risky). It's just adding suffixes to filenames.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Renaming bindings to consistently be called foo-controller.yaml for
controllers and foo-device.yaml for devices (last one mostly makes sense
for devices on buses and the like).
I was thinking of having a plain foo.yaml be the controller as well, but
!include interrupt.yaml
reads much worse than
!include interrupt-controller.yaml
Another advantage of this approach is that no binding changes meaning
(which could be risky). It's just adding suffixes to filenames.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Renaming bindings to consistently be called foo-controller.yaml for
controllers and foo-device.yaml for devices (last one mostly makes sense
for devices on buses and the like).
I was thinking of having a plain foo.yaml be the controller as well, but
!include interrupt.yaml
reads much worse than
!include interrupt-controller.yaml
Another advantage of this approach is that no binding changes meaning
(which could be risky). It's just adding suffixes to filenames.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Renaming bindings to consistently be called foo-controller.yaml for
controllers and foo-device.yaml for devices (last one mostly makes sense
for devices on buses and the like).
I was thinking of having a plain foo.yaml be the controller as well, but
!include interrupt.yaml
reads much worse than
!include interrupt-controller.yaml
Another advantage of this approach is that no binding changes meaning
(which could be risky). It's just adding suffixes to filenames.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Renaming bindings to consistently be called foo-controller.yaml for
controllers and foo-device.yaml for devices (last one mostly makes sense
for devices on buses and the like).
I was thinking of having a plain foo.yaml be the controller as well, but
!include interrupt.yaml
reads much worse than
!include interrupt-controller.yaml
Another advantage of this approach is that no binding changes meaning
(which could be risky). It's just adding suffixes to filenames.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Renaming bindings to consistently be called foo-controller.yaml for
controllers and foo-device.yaml for devices (last one mostly makes sense
for devices on buses and the like).
I was thinking of having a plain foo.yaml be the controller as well, but
!include interrupt.yaml
reads much worse than
!include interrupt-controller.yaml
Another advantage of this approach is that no binding changes meaning
(which could be risky). It's just adding suffixes to filenames.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Renaming bindings to consistently be called foo-controller.yaml for
controllers and foo-device.yaml for devices (last one mostly makes sense
for devices on buses and the like).
I was thinking of having a plain foo.yaml be the controller as well, but
!include interrupt.yaml
reads much worse than
!include interrupt-controller.yaml
Another advantage of this approach is that no binding changes meaning
(which could be risky). It's just adding suffixes to filenames.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Renaming bindings to consistently be called foo-controller.yaml for
controllers and foo-device.yaml for devices (last one mostly makes sense
for devices on buses and the like).
I was thinking of having a plain foo.yaml be the controller as well, but
!include interrupt.yaml
reads much worse than
!include interrupt-controller.yaml
Another advantage of this approach is that no binding changes meaning
(which could be risky). It's just adding suffixes to filenames.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Renaming bindings to consistently be called foo-controller.yaml for
controllers and foo-device.yaml for devices (last one mostly makes sense
for devices on buses and the like).
I was thinking of having a plain foo.yaml be the controller as well, but
!include interrupt.yaml
reads much worse than
!include interrupt-controller.yaml
Another advantage of this approach is that no binding changes meaning
(which could be risky). It's just adding suffixes to filenames.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Renaming bindings to consistently be called foo-controller.yaml for
controllers and foo-device.yaml for devices (last one mostly makes sense
for devices on buses and the like).
I was thinking of having a plain foo.yaml be the controller as well, but
!include interrupt.yaml
reads much worse than
!include interrupt-controller.yaml
Another advantage of this approach is that no binding changes meaning
(which could be risky). It's just adding suffixes to filenames.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Sanity-checking each !included file separately was inherited from the
old scripts. It makes it messy to check that combinations of fields make
sense, e.g. to check 'const:' or 'default:' against 'type:', since those
fields might come from different files (this is handy, since it makes
sense to just add/change a 'const:' value, for example).
Drop the requirement that each !included file is a complete binding in
itself, and treat them as binding fragments instead. Only check the
final merged binding.
This also means that !included files no longer need to have a
'description:' or 'title:' (those have always been unused for !included
files), so remove those, and add comments that explain what the
fragments are for instead. That should demystify bindings a bit.
Also fix the descriptions of i2c.yaml, i2s.yaml, spi.yaml, and
uart.yaml. They're for controllers, not devices. These are copy-paste
error from the corresponding device .yaml files.
Piggyback some indentation consistency nits in binding-template.yaml.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Convert type from compound to phandle-array for various bindings that
have properties like like <FOO>-gpios, pwms, clocks,
interrupt-extended, etc. that are phandle-array's.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add two new type-checked property types 'phandles' and 'phandle-array'
to edtlib.
'phandles' is for pure lists of phandles, with no other data, like
foo = < &bar &baz ... >
'phandle-array' is for lists of phandles and (possibly) numbers, like
foo = < &bar 1 2 &baz 3 4 ... >
dt-schema also has the 'phandle-array' type.
Property.val (in edtlib) is set to an array of Device objects for the
'phandles' type.
For the 'phandle-array' type, no Property object is created. This type
is only used for type checking.
Also refactor how types that do not create a Property object
('phandle-array' and 'compound') are handled. Have _prop_val() return
None for them.
The new types are implemented with two new TYPE_PHANDLES and
TYPE_PHANDLES_AND_NUMS types at the dtlib level. There is also a new
Property.to_nodes() functions for fetching the Nodes for an array of
phandles, with type checking.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
* Add "#address-cells" and "#size-cells" to base.yaml as properties
that can exist on any node. Cleanup other bindings that inherit
from the base.yaml.
* Add "status" property with an enum of valid options.
* Add "interrupt-parent" to base.yaml. It's a phandle to the node
which is the interrupt controller for the interrupt.
* Add "interrupt-extended" to base.yaml. Provides a way to specify
an interrupt-parent and specifier in a single property. Useful if
a device has multiple interrupts in which different interrupts go
to different interrult controllers.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
In most cases #<FOO>-cells should be a constant. For example in spi
controller #address-cells should be 1, and #size-cells should be 0.
Use the const attribute to specify such single known values. Add const
value to missing bindings which have cells.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add a 'const' property to bindings for any properties that are expected
to have a specifi known value. For example, #address-cells for an I2C
bus should always be '1'. So we can do something like the following in
the I2C bus binding:
"#address-cells":
type: int
category: required
const: 1
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Change binding for ST sensors property 'irq-gpios' to optional for the
cases of in which its obvious from the driver that the property is
optional (there's an ifdef based on the #define
DT_INST_0_ST_LIS2DH_IRQ_GPIOS_*).
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The file contained an invalid license which came from a Nordic custom
repository. Switch it to Apache 2.0.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
'child: bus:' should be in the binding for the bus node, and
'parent: bus:' in the binding for devices that appear on the bus.
The description accidentally swapped them. Fix it.
Fixes: #18821
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Adding required fields to the devicetree overlay of the CAN sample as
this is often used as a reference. Also use these fields instead of the
KConfig entries.
Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
'interrupt-parent' should contain just the phandle of the node
interrupts are sent to.
This node (gic: interrupt-controller@f9010000) doesn't generate any
interrupts, so the 'interrupt-parent' value is never used (this is why
it wasn't caught). It'll give an error later with 'interrupt-parent'
declared as 'type: phandle' in bindings though.
Don't know what was intended. Just remove the 0.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Mark the 'reset-gpios' property as optional. It was incorrectly set
as required and its not required for the driver to function.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Property type-checking has been pretty rudimentary until now, only
checking things like the length being divisible by 4 for 'type: array',
and strings being null-terminated. In particular, no checking was done
for 'type: uint8-array', letting
jedec-id = < 0xc8 0x28 0x17 >;
slip through when
jedec-id = [ 0xc8 0x28 0x17 ];
was intended.
Fix it by adding a syntax-based type checker:
1. Add Property.type, which gives a high-level type for the property,
derived from the markers added in the previous commit.
This includes types like TYPE_EMPTY ('foo;'),
TYPE_NUM ('foo = < 3 >;'), TYPE_BYTES ('foo = [ 01 02 ];'),
TYPE_STRINGS ('foo = "bar", "baz"'),
TYPE_PHANDLE ('foo = < &bar >;'), and TYPE_COMPOUND (everything not
recognized).
See the Property.type docstring in dtlib for more info.
2. Use the high-level type in
Property.to_num()/to_string()/to_node()/etc. to verify that the
property was assigned in an expected way for the type.
If the assignment looks bad, give a helpful error:
expected property 'nums' on /foo/bar in some.dts to be assigned
with 'nums = < (number) (number) ... >', not 'nums = "oops";'
Some other related changes are included as well:
- There's a new Property.to_bytes() function that works like accessing
Property.bytes, except with an added check for the value being
assigned like 'foo = [ ... ]'.
This function solves problems like the jedec-id one.
- There's a new Property.to_path() function for fetching the
referenced node for assignments like 'foo = &node;', with type
checking. (Strings are accepted too, as long as they give the path
to an existing node.)
This function is used for /chosen and /aliases.
- A new 'type: phandle' type can now be given in bindings, for
properties that are assigned like 'foo = < &node >;'.
- Property.__str__() now displays phandles and path references as they
were written (e.g. '< &foo >' instead of '< 0x1 >', if the
allocated phandle happened to be 1).
- Property.to_num() and Property.to_nums() no longer take a 'length'
parameter, because it makes no sense with the type checking.
- The global dtlib.to_string() and dtlib.to_strings() functions were
removed, because they're not that useful.
- More tests were added, along with misc. minor cleanup in various
places.
- Probably other stuff I forgot.
The more strict type checking in dtlib indirectly makes some parts of
edtlib more strict as well (wherever Property.to_*() is used).
Fixes: #18131
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
the microchip,mcp2515 and microchip,enc28j60 bindings would hit the
following build error:
device tree error: dts/bindings/can/microchip,mcp2515.yaml (in 'reg'):
'category' from !included file overwritten
('required' replaced with 'optional')
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
SPI3 clock info were missing and following macros were
not generated:
- DT_ST_STM32_SPI_FIFO_40003C00_CLOCK_BITS
- DT_ST_STM32_SPI_FIFO_40003C00_CLOCK_BUS
Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit includes the initial support of ARC HS Development Kit:
* hsdk soc support
* hsdk board support
* no mmu support, so no userspace
* smp support
Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
This adds support for SARA-U2 modems. They have different timings on
the PWR_ON pin, don't support AT+CESQ and require a manual GPRS
connection setup.
The VINT pin is used as a more reliable and faster way to power on the
modem.
Based on work by Göran Weinholt <goran.weinholt@endian.se>
Signed-off-by: Michael Scott <mike@foundries.io>
This commit adds support for the Zynq UltraScale+ MPSoC as a qemu based
platform for Cortex-R based testing. This SoC only supports an
interrupt controller and serial port for limited testing.
Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
The GIC400 is a common interrupt controller that can be used with the
Cortex A and R series processors. This patch adds basic interrupt
handling for the GIC, but does not handle multiple routing or
priorities.
Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
Remove unused "system-clock-frequency" property, we don't have this
defined in various bindings and thus aren't using it.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add "#address-cells" and "#size-cells" to the fixed-partition binding as
these are properties that may existing in the fixed-partition node.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
* Change pwm device bindings to include both base and pwm.yaml. This
allow for flexibility for any nodes that might not need/utilize the
base binding.
* Added pwm.yaml to a few device bindings that were missing it.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Introduce a clock.yaml that clock controller bindings should inherit
from. clock.yaml defines the properties "#clock-cells" which all
clock controllers should have.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Introduce a gpio.yaml that GPIO controller bindings should inherit
from. gpio.yaml defines the properties "gpio-controller" and
"#gpio-cells" which all gpio controllers should have.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Introduce a intc.yaml that interrupt controller bindings should inherit
from. intc.yaml defines the properties "interrupt-controller" and
"#interrupt-cells" which all interrupt controllers should have.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This is to support e.g. "<&adc 3>" in the device tree to create e.g.
DT_FOO_IO_CHANNELS_CONTROLLER = "ADC_0"
DT_FOO_IO_CHANNELS_INPUT = 3
Signed-off-by: Jim Paris <jim@jtan.com>