Devicetree updates for 6.7:

- Add a kselftest to check for unprobed DT devices
 
 - Fix address translation for some 3 address cells cases
 
 - Refactor firmware node refcounting for AMBA bus
 
 - Add bindings for qcom,sm4450-pdc, Qualcomm Kryo 465 CPU, and Freescale
   QMC HDLC
 
 - Add Marantec vendor prefix
 
 - Convert qcom,pm8921-keypad, cnxt,cx92755-wdt, da9062-wdt,
   and atmel,at91rm9200-wdt bindings to DT schema
 
 - Several additionalProperties/unevaluatedProperties on child node
   schemas fixes
 
 - Drop reserved-memory bindings which now live in dtschema project
 
 - Fix a reference to rockchip,inno-usb2phy.yaml
 
 - Remove backlight nodes from display panel examples
 
 - Expand example for using DT_SCHEMA_FILES
 
 - Merge simple LVDS panel bindings to one binding doc
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEktVUI4SxYhzZyEuo+vtdtY28YcMFAmVBdEoACgkQ+vtdtY28
 YcObKw//ZkdPTh8t2m4ZH0kGSzcFGx1RiRxOOwVW9UTLovGDsxHixxu/j/9kerQw
 LHQH2UntlpmZhfIGgqlDf6QrPIuCAFLKTlx0+G2upq4TfHWUEOGcGCracDs65zJa
 XleEDw9Kt37fiVMUH/i+0mKTm98f+Zb//7IReSzGYtKW1alIr8TAUds26SbBckQ+
 /KClOJXuJmsqIWi3cJm3j59rzsSUcnLPR/GHEa03grazZXZ1MNHeaGB3+xZmSKMu
 0rhJrBX3PICxFx7FZevZFcHR4S4BQWmste72GTPZi+Htb3CtgjJFkzRdutoPByF7
 sSaLhs7f2msfcXhlgw2QoK3Wb2m33cZ+TaESXxx4YmVs/pRMD7kPGfODk7qf+vvJ
 kPN+bPh2THlp/L8x7S5EeqH+8NqJzXrdLf7CSUnOmkF/0GZ7/Id3Wt0rpoQeXLs3
 gi/v3K6qDyBKJ8cqEudftXMiYFcmSQJMvOA3x97j2J5iDAYltNFwI30hE07uXFhz
 WpNt/6wM8JLtQfL1IiMiL2I++0tEA4zCc8/aLfwcl6IkAjbP8KTGxtw3gFcyGaqt
 jzJQXr0j2xrfN6M/g55xXpPhN7R+2NaeiDETlDF9NggadrwnV7Nn9FFxASSXNomD
 BQU0jIECDo946NJv7/vw7RKxDJuzNdmqp54QZwoMlUPdxJgMw6g=
 =JCj5
 -----END PGP SIGNATURE-----

Merge tag 'devicetree-for-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull devicetree updates from Rob Herring:

 - Add a kselftest to check for unprobed DT devices

 - Fix address translation for some 3 address cells cases

 - Refactor firmware node refcounting for AMBA bus

 - Add bindings for qcom,sm4450-pdc, Qualcomm Kryo 465 CPU, and
   Freescale QMC HDLC

 - Add Marantec vendor prefix

 - Convert qcom,pm8921-keypad, cnxt,cx92755-wdt, da9062-wdt, and
   atmel,at91rm9200-wdt bindings to DT schema

 - Several additionalProperties/unevaluatedProperties on child node
   schemas fixes

 - Drop reserved-memory bindings which now live in dtschema project

 - Fix a reference to rockchip,inno-usb2phy.yaml

 - Remove backlight nodes from display panel examples

 - Expand example for using DT_SCHEMA_FILES

 - Merge simple LVDS panel bindings to one binding doc

* tag 'devicetree-for-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (34 commits)
  dt-bindings: soc: fsl: cpm_qe: cpm1-scc-qmc: Add support for QMC HDLC
  dt-bindings: soc: fsl: cpm_qe: cpm1-scc-qmc: Add 'additionalProperties: false' in child nodes
  dt-bindings: soc: fsl: cpm_qe: cpm1-scc-qmc: Fix example property name
  dt-bindings: arm,coresight-cti: Add missing additionalProperties on child nodes
  dt-bindings: arm,coresight-cti: Drop type for 'cpu' property
  dt-bindings: soundwire: Add reference to soundwire-controller.yaml schema
  dt-bindings: input: syna,rmi4: Make "additionalProperties: true" explicit
  media: dt-bindings: ti,ds90ub960: Add missing type for "i2c-alias"
  dt-bindings: input: qcom,pm8921-keypad: convert to YAML format
  of: overlay: unittest: overlay_bad_unresolved: Spelling s/ok/okay/
  of: address: Consolidate bus .map() functions
  of: address: Store number of bus flag cells rather than bool
  of: unittest: Add tests for address translations
  of: address: Remove duplicated functions
  of: address: Fix address translation when address-size is greater than 2
  dt-bindings: watchdog: cnxt,cx92755-wdt: convert txt to yaml
  dt-bindings: watchdog: da9062-wdt: convert txt to yaml
  dt-bindings: watchdog: fsl,scu-wdt: Document imx8dl
  dt-bindings: watchdog: atmel,at91rm9200-wdt: convert txt to yaml
  dt-bindings: usb: rockchip,dwc3: update inno usb2 phy binding name
  ...
This commit is contained in:
Linus Torvalds 2023-10-31 18:50:13 -10:00
commit 8bc9e65151
50 changed files with 902 additions and 656 deletions

View file

@ -6,7 +6,7 @@ DT_MK_SCHEMA ?= dt-mk-schema
DT_SCHEMA_LINT = $(shell which yamllint || \
echo "warning: python package 'yamllint' not installed, skipping" >&2)
DT_SCHEMA_MIN_VERSION = 2022.3
DT_SCHEMA_MIN_VERSION = 2023.9
PHONY += check_dtschema_version
check_dtschema_version:

View file

@ -92,11 +92,8 @@ properties:
maxItems: 1
cpu:
$ref: /schemas/types.yaml#/definitions/phandle
description:
Handle to cpu this device is associated with. This must appear in the
base cti node if compatible string arm,coresight-cti-v8-arch is used,
or may appear in a trig-conns child node when appropriate.
Handle to cpu this CTI is associated with.
power-domains:
maxItems: 1
@ -113,12 +110,12 @@ properties:
description:
defines a phandle reference to an associated CoreSight trace device.
When the associated trace device is enabled, then the respective CTI
will be enabled. Use in a trig-conns node, or in CTI base node when
compatible string arm,coresight-cti-v8-arch used. If the associated
device has not been registered then the node name will be stored as
the connection name for later resolution. If the associated device is
not a CoreSight device or not registered then the node name will remain
the connection name and automatic enabling will not occur.
will be enabled. Use in CTI base node when compatible string
arm,coresight-cti-v8-arch used. If the associated device has not been
registered then the node name will be stored as the connection name for
later resolution. If the associated device is not a CoreSight device or
not registered then the node name will remain the connection name and
automatic enabling will not occur.
# size cells and address cells required if trig-conns node present.
"#size-cells":
@ -130,6 +127,8 @@ properties:
patternProperties:
'^trig-conns@([0-9]+)$':
type: object
additionalProperties: false
description:
A trigger connections child node which describes the trigger signals
between this CTI and another hardware device. This device may be a CPU,
@ -141,6 +140,21 @@ patternProperties:
reg:
maxItems: 1
cpu:
description:
Handle to cpu this trigger connection is associated with.
arm,cs-dev-assoc:
$ref: /schemas/types.yaml#/definitions/phandle
description:
defines a phandle reference to an associated CoreSight trace device.
When the associated trace device is enabled, then the respective CTI
will be enabled. If the associated device has not been registered
then the node name will be stored as the connection name for later
resolution. If the associated device is not a CoreSight device or
not registered then the node name will remain the connection name
and automatic enabling will not occur.
arm,trig-in-sigs:
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 1

View file

@ -190,6 +190,7 @@ properties:
- qcom,kryo280
- qcom,kryo360
- qcom,kryo385
- qcom,kryo465
- qcom,kryo468
- qcom,kryo485
- qcom,kryo560

View file

@ -101,6 +101,7 @@ properties:
patternProperties:
"^power-domain-":
$ref: /schemas/power/power-domain.yaml#
unevaluatedProperties: false
type: object
description: |

View file

@ -50,10 +50,6 @@ examples:
- |
#include <dt-bindings/gpio/gpio.h>
backlight: backlight {
compatible = "gpio-backlight";
gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
};
spi {
#address-cells = <1>;
#size-cells = <0>;

View file

@ -48,10 +48,6 @@ examples:
- |
#include <dt-bindings/gpio/gpio.h>
backlight: backlight {
compatible = "gpio-backlight";
gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
};
spi {
#address-cells = <1>;
#size-cells = <0>;

View file

@ -0,0 +1,118 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/display/panel/panel-simple-lvds-dual-ports.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Simple LVDS panels with one power supply and dual LVDS ports
maintainers:
- Liu Ying <victor.liu@nxp.com>
- Thierry Reding <thierry.reding@gmail.com>
- Sam Ravnborg <sam@ravnborg.org>
description: |
This binding file is a collection of the LVDS panels that
has dual LVDS ports and requires only a single power-supply.
The first port receives odd pixels, and the second port receives even pixels.
There are optionally a backlight and an enable GPIO.
The panel may use an OF graph binding for the association to the display,
or it may be a direct child node of the display.
If the panel is more advanced a dedicated binding file is required.
allOf:
- $ref: panel-common.yaml#
properties:
compatible:
enum:
# compatible must be listed in alphabetical order, ordered by compatible.
# The description in the comment is mandatory for each compatible.
# AU Optronics Corporation 13.3" FHD (1920x1080) TFT LCD panel
- auo,g133han01
# AU Optronics Corporation 18.5" FHD (1920x1080) TFT LCD panel
- auo,g185han01
# AU Optronics Corporation 19.0" (1280x1024) TFT LCD panel
- auo,g190ean01
# Kaohsiung Opto-Electronics Inc. 10.1" WUXGA (1920 x 1200) LVDS TFT LCD panel
- koe,tx26d202vm0bwa
# NLT Technologies, Ltd. 15.6" FHD (1920x1080) LVDS TFT LCD panel
- nlt,nl192108ac18-02d
ports:
$ref: /schemas/graph.yaml#/properties/ports
properties:
port@0:
$ref: /schemas/graph.yaml#/$defs/port-base
unevaluatedProperties: false
description: The first sink port.
properties:
dual-lvds-odd-pixels:
type: boolean
description: The first sink port for odd pixels.
required:
- dual-lvds-odd-pixels
port@1:
$ref: /schemas/graph.yaml#/$defs/port-base
unevaluatedProperties: false
description: The second sink port.
properties:
dual-lvds-even-pixels:
type: boolean
description: The second sink port for even pixels.
required:
- dual-lvds-even-pixels
required:
- port@0
- port@1
backlight: true
enable-gpios: true
power-supply: true
additionalProperties: false
required:
- compatible
- ports
- power-supply
examples:
- |
panel: panel-lvds {
compatible = "koe,tx26d202vm0bwa";
power-supply = <&vdd_lcd_reg>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
dual-lvds-odd-pixels;
reg = <0>;
panel_lvds0_in: endpoint {
remote-endpoint = <&lvds0_out>;
};
};
port@1 {
dual-lvds-even-pixels;
reg = <1>;
panel_lvds1_in: endpoint {
remote-endpoint = <&lvds1_out>;
};
};
};
};

View file

@ -65,14 +65,8 @@ properties:
- auo,g104sn02
# AU Optronics Corporation 12.1" (1280x800) TFT LCD panel
- auo,g121ean01
# AU Optronics Corporation 13.3" FHD (1920x1080) TFT LCD panel
- auo,g133han01
# AU Optronics Corporation 15.6" (1366x768) TFT LCD panel
- auo,g156xtn01
# AU Optronics Corporation 18.5" FHD (1920x1080) TFT LCD panel
- auo,g185han01
# AU Optronics Corporation 19.0" (1280x1024) TFT LCD panel
- auo,g190ean01
# AU Optronics Corporation 31.5" FHD (1920x1080) TFT LCD panel
- auo,p320hvn03
# AU Optronics Corporation 21.5" FHD (1920x1080) color TFT LCD panel
@ -204,8 +198,6 @@ properties:
- kingdisplay,kd116n21-30nv-a010
# Kaohsiung Opto-Electronics Inc. 5.7" QVGA (320 x 240) TFT LCD panel
- koe,tx14d24vm1bpa
# Kaohsiung Opto-Electronics Inc. 10.1" WUXGA (1920 x 1200) LVDS TFT LCD panel
- koe,tx26d202vm0bwa
# Kaohsiung Opto-Electronics. TX31D200VM0BAA 12.3" HSXGA LVDS panel
- koe,tx31d200vm0baa
# Kyocera Corporation 7" WVGA (800x480) transmissive color TFT
@ -254,8 +246,6 @@ properties:
- neweast,wjfh116008a
# Newhaven Display International 480 x 272 TFT LCD panel
- newhaven,nhd-4.3-480272ef-atxl
# NLT Technologies, Ltd. 15.6" FHD (1920x1080) LVDS TFT LCD panel
- nlt,nl192108ac18-02d
# New Vision Display 7.0" 800 RGB x 480 TFT LCD panel
- nvd,9128
# OKAYA Electric America, Inc. RS800480T-7X0GP 7" WVGA LCD panel

View file

@ -54,11 +54,6 @@ examples:
- |
#include <dt-bindings/gpio/gpio.h>
backlight: backlight {
compatible = "gpio-backlight";
gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
};
spi {
#address-cells = <1>;
#size-cells = <0>;

View file

@ -0,0 +1,89 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/input/qcom,pm8921-keypad.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Qualcomm PM8921 PMIC KeyPad
maintainers:
- Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
allOf:
- $ref: input.yaml#
- $ref: matrix-keymap.yaml#
properties:
compatible:
enum:
- qcom,pm8058-keypad
- qcom,pm8921-keypad
reg:
maxItems: 1
interrupts:
items:
- description: key sense
- description: key stuck
wakeup-source:
type: boolean
description: use any event on keypad as wakeup event
linux,keypad-wakeup:
type: boolean
deprecated: true
description: legacy version of the wakeup-source property
debounce:
description:
Time in microseconds that key must be pressed or
released for state change interrupt to trigger.
$ref: /schemas/types.yaml#/definitions/uint32
scan-delay:
$ref: /schemas/types.yaml#/definitions/uint32
description: time in microseconds to pause between successive scans of the
matrix array
row-hold:
$ref: /schemas/types.yaml#/definitions/uint32
description: time in nanoseconds to pause between scans of each row in the
matrix array.
required:
- compatible
- reg
- interrupts
- linux,keymap
unevaluatedProperties: false
examples:
- |
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
pmic {
#address-cells = <1>;
#size-cells = <0>;
keypad@148 {
compatible = "qcom,pm8921-keypad";
reg = <0x148>;
interrupt-parent = <&pmicintc>;
interrupts = <74 IRQ_TYPE_EDGE_RISING>, <75 IRQ_TYPE_EDGE_RISING>;
linux,keymap = <
MATRIX_KEY(0, 0, KEY_VOLUMEUP)
MATRIX_KEY(0, 1, KEY_VOLUMEDOWN)
MATRIX_KEY(0, 2, KEY_CAMERA_FOCUS)
MATRIX_KEY(0, 3, KEY_CAMERA)
>;
keypad,num-rows = <1>;
keypad,num-columns = <5>;
debounce = <15>;
scan-delay = <32>;
row-hold = <91500>;
};
};
...

View file

@ -1,90 +0,0 @@
Qualcomm PM8xxx PMIC Keypad
PROPERTIES
- compatible:
Usage: required
Value type: <string>
Definition: must be one of:
"qcom,pm8058-keypad"
"qcom,pm8921-keypad"
- reg:
Usage: required
Value type: <prop-encoded-array>
Definition: address of keypad control register
- interrupts:
Usage: required
Value type: <prop-encoded-array>
Definition: the first interrupt specifies the key sense interrupt
and the second interrupt specifies the key stuck interrupt.
The format of the specifier is defined by the binding
document describing the node's interrupt parent.
- linux,keymap:
Usage: required
Value type: <prop-encoded-array>
Definition: the linux keymap. More information can be found in
input/matrix-keymap.txt.
- linux,keypad-no-autorepeat:
Usage: optional
Value type: <bool>
Definition: don't enable autorepeat feature.
- wakeup-source:
Usage: optional
Value type: <bool>
Definition: use any event on keypad as wakeup event.
(Legacy property supported: "linux,keypad-wakeup")
- keypad,num-rows:
Usage: required
Value type: <u32>
Definition: number of rows in the keymap. More information can be found
in input/matrix-keymap.txt.
- keypad,num-columns:
Usage: required
Value type: <u32>
Definition: number of columns in the keymap. More information can be
found in input/matrix-keymap.txt.
- debounce:
Usage: optional
Value type: <u32>
Definition: time in microseconds that key must be pressed or release
for key sense interrupt to trigger.
- scan-delay:
Usage: optional
Value type: <u32>
Definition: time in microseconds to pause between successive scans
of the matrix array.
- row-hold:
Usage: optional
Value type: <u32>
Definition: time in nanoseconds to pause between scans of each row in
the matrix array.
EXAMPLE
keypad@148 {
compatible = "qcom,pm8921-keypad";
reg = <0x148>;
interrupt-parent = <&pmicintc>;
interrupts = <74 1>, <75 1>;
linux,keymap = <
MATRIX_KEY(0, 0, KEY_VOLUMEUP)
MATRIX_KEY(0, 1, KEY_VOLUMEDOWN)
MATRIX_KEY(0, 2, KEY_CAMERA_FOCUS)
MATRIX_KEY(0, 3, KEY_CAMERA)
>;
keypad,num-rows = <1>;
keypad,num-columns = <5>;
debounce = <15>;
scan-delay = <32>;
row-hold = <91500>;
};

View file

@ -164,6 +164,8 @@ patternProperties:
"^rmi4-f[0-9a-f]+@[0-9a-f]+$":
type: object
additionalProperties: true
description:
Other functions, not documented yet.

View file

@ -35,6 +35,7 @@ properties:
- qcom,sdm845-pdc
- qcom,sdx55-pdc
- qcom,sdx65-pdc
- qcom,sm4450-pdc
- qcom,sm6350-pdc
- qcom,sm8150-pdc
- qcom,sm8250-pdc

View file

@ -69,6 +69,7 @@ properties:
maxItems: 1
i2c-alias:
$ref: /schemas/types.yaml#/definitions/uint32
description:
The I2C address used for the serializer. Transactions to this
address on the I2C bus where the deserializer resides are

View file

@ -31,7 +31,7 @@ properties:
remoteproc device. This is variable and describes the memories shared with
the remote processor (e.g. remoteproc firmware and carveouts, rpmsg
vrings, ...).
(see ../reserved-memory/reserved-memory.yaml)
(see reserved-memory/reserved-memory.yaml in dtschema project)
required:
- compatible

View file

@ -1,52 +0,0 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/reserved-memory/framebuffer.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: /reserved-memory framebuffer node
maintainers:
- devicetree-spec@vger.kernel.org
allOf:
- $ref: reserved-memory.yaml
properties:
compatible:
const: framebuffer
description: >
This indicates a region of memory meant to be used as a framebuffer for
a set of display devices. It can be used by an operating system to keep
the framebuffer from being overwritten and use it as the backing memory
for a display device (such as simple-framebuffer).
unevaluatedProperties: false
examples:
- |
/ {
compatible = "foo";
model = "foo";
#address-cells = <1>;
#size-cells = <1>;
chosen {
framebuffer {
compatible = "simple-framebuffer";
memory-region = <&fb>;
};
};
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
fb: framebuffer@80000000 {
compatible = "framebuffer";
reg = <0x80000000 0x007e9000>;
};
};
};
...

View file

@ -1,40 +0,0 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/reserved-memory/memory-region.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Reserved Memory Region
maintainers:
- devicetree-spec@vger.kernel.org
description: |
Regions in the /reserved-memory node may be referenced by other device
nodes by adding a memory-region property to the device node.
select: true
properties:
memory-region:
$ref: /schemas/types.yaml#/definitions/phandle-array
description: >
Phandle to a /reserved-memory child node assigned to the device.
memory-region-names:
$ref: /schemas/types.yaml#/definitions/string-array
description: >
A list of names, one for each corresponding entry in the
memory-region property
additionalProperties: true
examples:
- |
fb0: video@12300000 {
/* ... */
reg = <0x12300000 0x1000>;
memory-region = <&display_reserved>;
};
...

View file

@ -1 +1 @@
This file has been moved to reserved-memory.yaml.
This file has been moved to reserved-memory.yaml in the dtschema repository.

View file

@ -1,181 +0,0 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/reserved-memory/reserved-memory.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: /reserved-memory Child Node Common
maintainers:
- devicetree-spec@vger.kernel.org
description: >
Reserved memory is specified as a node under the /reserved-memory node. The
operating system shall exclude reserved memory from normal usage one can
create child nodes describing particular reserved (excluded from normal use)
memory regions. Such memory regions are usually designed for the special
usage by various device drivers.
Each child of the reserved-memory node specifies one or more regions
of reserved memory. Each child node may either use a 'reg' property to
specify a specific range of reserved memory, or a 'size' property with
optional constraints to request a dynamically allocated block of
memory.
Following the generic-names recommended practice, node names should
reflect the purpose of the node (ie. "framebuffer" or "dma-pool").
Unit address (@<address>) should be appended to the name if the node
is a static allocation.
properties:
reg: true
size:
oneOf:
- $ref: /schemas/types.yaml#/definitions/uint32
- $ref: /schemas/types.yaml#/definitions/uint64
description: >
Length based on parent's \#size-cells. Size in bytes of memory to
reserve.
alignment:
oneOf:
- $ref: /schemas/types.yaml#/definitions/uint32
- $ref: /schemas/types.yaml#/definitions/uint64
description: >
Length based on parent's \#size-cells. Address boundary for
alignment of allocation.
alloc-ranges:
$ref: /schemas/types.yaml#/definitions/uint32-array
description: >
Address and Length pairs. Specifies regions of memory that are
acceptable to allocate from.
iommu-addresses:
$ref: /schemas/types.yaml#/definitions/phandle-array
description: >
A list of phandle and specifier pairs that describe static IO virtual
address space mappings and carveouts associated with a given reserved
memory region. The phandle in the first cell refers to the device for
which the mapping or carveout is to be created.
The specifier consists of an address/size pair and denotes the IO
virtual address range of the region for the given device. The exact
format depends on the values of the "#address-cells" and "#size-cells"
properties of the device referenced via the phandle.
When used in combination with a "reg" property, an IOVA mapping is to
be established for this memory region. One example where this can be
useful is to create an identity mapping for physical memory that the
firmware has configured some hardware to access (such as a bootsplash
framebuffer).
If no "reg" property is specified, the "iommu-addresses" property
defines carveout regions in the IOVA space for the given device. This
can be useful if a certain memory region should not be mapped through
the IOMMU.
no-map:
type: boolean
description: >
Indicates the operating system must not create a virtual mapping
of the region as part of its standard mapping of system memory,
nor permit speculative access to it under any circumstances other
than under the control of the device driver using the region.
reusable:
type: boolean
description: >
The operating system can use the memory in this region with the
limitation that the device driver(s) owning the region need to be
able to reclaim it back. Typically that means that the operating
system can use that region to store volatile or cached data that
can be otherwise regenerated or migrated elsewhere.
allOf:
- if:
required:
- no-map
then:
not:
required:
- reusable
- if:
required:
- reusable
then:
not:
required:
- no-map
oneOf:
- oneOf:
- required:
- reg
- required:
- size
- oneOf:
# IOMMU reservations
- required:
- iommu-addresses
# IOMMU mappings
- required:
- reg
- iommu-addresses
additionalProperties: true
examples:
- |
/ {
compatible = "foo";
model = "foo";
#address-cells = <2>;
#size-cells = <2>;
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
adsp_resv: reservation-adsp {
/*
* Restrict IOVA mappings for ADSP buffers to the 512 MiB region
* from 0x40000000 - 0x5fffffff. Anything outside is reserved by
* the ADSP for I/O memory and private memory allocations.
*/
iommu-addresses = <&adsp 0x0 0x00000000 0x00 0x40000000>,
<&adsp 0x0 0x60000000 0xff 0xa0000000>;
};
fb: framebuffer@90000000 {
reg = <0x0 0x90000000 0x0 0x00800000>;
iommu-addresses = <&dc0 0x0 0x90000000 0x0 0x00800000>;
};
};
bus@0 {
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x0 0x0 0x0 0x40000000>;
adsp: adsp@2990000 {
reg = <0x2990000 0x2000>;
memory-region = <&adsp_resv>;
};
dc0: display@15200000 {
reg = <0x15200000 0x10000>;
memory-region = <&fb>;
};
};
};
...

View file

@ -1,97 +0,0 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/reserved-memory/shared-dma-pool.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: /reserved-memory DMA pool
maintainers:
- devicetree-spec@vger.kernel.org
allOf:
- $ref: reserved-memory.yaml
properties:
compatible:
oneOf:
- const: shared-dma-pool
description: >
This indicates a region of memory meant to be used as a shared
pool of DMA buffers for a set of devices. It can be used by an
operating system to instantiate the necessary pool management
subsystem if necessary.
- const: restricted-dma-pool
description: >
This indicates a region of memory meant to be used as a pool
of restricted DMA buffers for a set of devices. The memory
region would be the only region accessible to those devices.
When using this, the no-map and reusable properties must not
be set, so the operating system can create a virtual mapping
that will be used for synchronization. The main purpose for
restricted DMA is to mitigate the lack of DMA access control
on systems without an IOMMU, which could result in the DMA
accessing the system memory at unexpected times and/or
unexpected addresses, possibly leading to data leakage or
corruption. The feature on its own provides a basic level of
protection against the DMA overwriting buffer contents at
unexpected times. However, to protect against general data
leakage and system memory corruption, the system needs to
provide way to lock down the memory access, e.g., MPU. Note
that since coherent allocation needs remapping, one must set
up another device coherent pool by shared-dma-pool and use
dma_alloc_from_dev_coherent instead for atomic coherent
allocation.
linux,cma-default:
type: boolean
description: >
If this property is present, then Linux will use the region for
the default pool of the contiguous memory allocator.
linux,dma-default:
type: boolean
description: >
If this property is present, then Linux will use the region for
the default pool of the consistent DMA allocator.
if:
properties:
compatible:
contains:
const: restricted-dma-pool
then:
properties:
no-map: false
reusable: false
unevaluatedProperties: false
examples:
- |
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
/* global autoconfigured region for contiguous allocations */
linux,cma {
compatible = "shared-dma-pool";
reusable;
size = <0x4000000>;
alignment = <0x2000>;
linux,cma-default;
};
display_reserved: framebuffer@78000000 {
reg = <0x78000000 0x800000>;
};
restricted_dma_reserved: restricted-dma-pool@50000000 {
compatible = "restricted-dma-pool";
reg = <0x50000000 0x4000000>;
};
};
...

View file

@ -64,6 +64,7 @@ patternProperties:
description:
A channel managed by this controller
type: object
additionalProperties: false
properties:
reg:
@ -100,6 +101,32 @@ patternProperties:
Channel assigned Rx time-slots within the Rx time-slots routed by the
TSA to this cell.
compatible:
items:
- enum:
- fsl,mpc885-scc-qmc-hdlc
- fsl,mpc866-scc-qmc-hdlc
- const: fsl,cpm1-scc-qmc-hdlc
- const: fsl,qmc-hdlc
fsl,framer:
$ref: /schemas/types.yaml#/definitions/phandle
description:
phandle to the framer node. The framer is in charge of an E1/T1 line
interface connected to the TDM bus. It can be used to get the E1/T1 line
status such as link up/down.
allOf:
- if:
properties:
compatible:
not:
contains:
const: fsl,qmc-hdlc
then:
properties:
fsl,framer: false
required:
- reg
- fsl,tx-ts-mask
@ -137,7 +164,7 @@ examples:
channel@16 {
/* Ch16 : First 4 even TS from all routed from TSA */
reg = <16>;
fsl,mode = "transparent";
fsl,operational-mode = "transparent";
fsl,reverse-data;
fsl,tx-ts-mask = <0x00000000 0x000000aa>;
fsl,rx-ts-mask = <0x00000000 0x000000aa>;
@ -146,7 +173,7 @@ examples:
channel@17 {
/* Ch17 : First 4 odd TS from all routed from TSA */
reg = <17>;
fsl,mode = "transparent";
fsl,operational-mode = "transparent";
fsl,reverse-data;
fsl,tx-ts-mask = <0x00000000 0x00000055>;
fsl,rx-ts-mask = <0x00000000 0x00000055>;
@ -154,9 +181,13 @@ examples:
channel@19 {
/* Ch19 : 8 TS (TS 8..15) from all routed from TSA */
compatible = "fsl,mpc885-scc-qmc-hdlc",
"fsl,cpm1-scc-qmc-hdlc",
"fsl,qmc-hdlc";
reg = <19>;
fsl,mode = "hdlc";
fsl,operational-mode = "hdlc";
fsl,tx-ts-mask = <0x00000000 0x0000ff00>;
fsl,rx-ts-mask = <0x00000000 0x0000ff00>;
fsl,framer = <&framer>;
};
};

View file

@ -29,7 +29,7 @@ properties:
maxItems: 1
description: |
Shared memory region for AFE memif. A "shared-dma-pool".
See ../reserved-memory/reserved-memory.yaml for details.
See dtschema reserved-memory/shared-dma-pool.yaml for details.
mediatek,topckgen:
$ref: /schemas/types.yaml#/definitions/phandle

View file

@ -209,17 +209,6 @@ properties:
label:
maxItems: 1
patternProperties:
"^.*@[0-9a-f],[0-9a-f]$":
type: object
additionalProperties: true
description:
Child nodes for a standalone audio codec or speaker amplifier IC.
It has RX and TX Soundwire secondary devices.
properties:
compatible:
pattern: "^sdw[0-9a-f]{1}[0-9a-f]{4}[0-9a-f]{4}[0-9a-f]{2}$"
required:
- compatible
- reg
@ -240,7 +229,10 @@ oneOf:
- required:
- qcom,ports-sinterval
additionalProperties: false
allOf:
- $ref: soundwire-controller.yaml#
unevaluatedProperties: false
examples:
- |

View file

@ -48,14 +48,18 @@ properties:
maxItems: 1
clocks:
minItems: 2
items:
- description: SoC GPT ipg clock
- description: SoC GPT per clock
- description: SoC GPT osc per clock
clock-names:
minItems: 2
items:
- const: ipg
- const: per
- const: osc_per
required:
- compatible
@ -64,6 +68,29 @@ required:
- clocks
- clock-names
allOf:
- if:
properties:
compatible:
contains:
enum:
- fsl,imx6dl-gpt
- fsl,imx6q-gpt
then:
properties:
clocks:
minItems: 2
maxItems: 3
clock-names:
minItems: 2
maxItems: 3
else:
properties:
clocks:
maxItems: 2
clock-names:
maxItems: 2
additionalProperties: false
examples:

View file

@ -15,7 +15,7 @@ description:
Phy documentation is provided in the following places.
USB2.0 PHY
Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml
Documentation/devicetree/bindings/phy/rockchip,inno-usb2phy.yaml
Type-C PHY
Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt

View file

@ -32,11 +32,14 @@ properties:
items:
- const: irq
connector:
$ref: /schemas/connector/usb-connector.yaml#
required:
- compatible
- reg
additionalProperties: true
additionalProperties: false
examples:
- |

View file

@ -805,6 +805,8 @@ patternProperties:
description: Mantix Display Technology Co.,Ltd.
"^mapleboard,.*":
description: Mapleboard.org
"^marantec,.*":
description: Marantec electronics GmbH
"^marvell,.*":
description: Marvell Technology Group Ltd.
"^maxbotix,.*":

View file

@ -0,0 +1,33 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/watchdog/atmel,at91rm9200-wdt.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Atmel AT91RM9200 System Timer Watchdog
maintainers:
- Nicolas Ferre <nicolas.ferre@microchip.com>
allOf:
- $ref: watchdog.yaml#
properties:
compatible:
const: atmel,at91rm9200-wdt
reg:
maxItems: 1
required:
- compatible
- reg
unevaluatedProperties: false
examples:
- |
watchdog@fffffd00 {
compatible = "atmel,at91rm9200-wdt";
reg = <0xfffffd00 0x10>;
};

View file

@ -1,9 +0,0 @@
Atmel AT91RM9200 System Timer Watchdog
Required properties:
- compatible: must be "atmel,at91sam9260-wdt".
Example:
watchdog@fffffd00 {
compatible = "atmel,at91rm9200-wdt";
};

View file

@ -0,0 +1,45 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/watchdog/cnxt,cx92755-wdt.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Conexant Digicolor SoCs Watchdog timer
description: |
The watchdog functionality in Conexant Digicolor SoCs relies on the so called
"Agent Communication" block. This block includes the eight programmable system
timer counters. The first timer (called "Timer A") is the only one that can be
used as watchdog.
allOf:
- $ref: watchdog.yaml#
maintainers:
- Baruch Siach <baruch@tkos.co.il>
properties:
compatible:
const: cnxt,cx92755-wdt
reg:
maxItems: 1
clocks:
maxItems: 1
required:
- compatible
- reg
- clocks
unevaluatedProperties: false
examples:
- |
watchdog@f0000fc0 {
compatible = "cnxt,cx92755-wdt";
reg = <0xf0000fc0 0x8>;
clocks = <&main_clk>;
timeout-sec = <15>;
};

View file

@ -1,34 +0,0 @@
* Dialog Semiconductor DA9062/61 Watchdog Timer
Required properties:
- compatible: should be one of the following valid compatible string lines:
"dlg,da9061-watchdog", "dlg,da9062-watchdog"
"dlg,da9062-watchdog"
Optional properties:
- dlg,use-sw-pm: Add this property to disable the watchdog during suspend.
Only use this option if you can't use the watchdog automatic suspend
function during a suspend (see register CONTROL_B).
- dlg,wdt-sd: Set what happens on watchdog timeout. If this bit is set the
watchdog timeout triggers SHUTDOWN, if cleared the watchdog triggers
POWERDOWN. Can be 0 or 1. Only use this option if you want to change the
default chip's OTP setting for WATCHDOG_SD bit. If this property is NOT
set the WATCHDOG_SD bit and on timeout watchdog behavior will match the
chip's OTP settings.
Example: DA9062
pmic0: da9062@58 {
watchdog {
compatible = "dlg,da9062-watchdog";
};
};
Example: DA9061 using a fall-back compatible for the DA9062 watchdog driver
pmic0: da9061@58 {
watchdog {
compatible = "dlg,da9061-watchdog", "dlg,da9062-watchdog";
};
};

View file

@ -1,25 +0,0 @@
Conexant Digicolor SoCs Watchdog timer
The watchdog functionality in Conexant Digicolor SoCs relies on the so called
"Agent Communication" block. This block includes the eight programmable system
timer counters. The first timer (called "Timer A") is the only one that can be
used as watchdog.
Required properties:
- compatible : Should be "cnxt,cx92755-wdt"
- reg : Specifies base physical address and size of the registers
- clocks : phandle; specifies the clock that drives the timer
Optional properties:
- timeout-sec : Contains the watchdog timeout in seconds
Example:
watchdog@f0000fc0 {
compatible = "cnxt,cx92755-wdt";
reg = <0xf0000fc0 0x8>;
clocks = <&main_clk>;
timeout-sec = <15>;
};

View file

@ -0,0 +1,50 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/watchdog/dlg,da9062-watchdog.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Dialog Semiconductor DA9062/61 Watchdog Timer
maintainers:
- Steve Twiss <stwiss.opensource@diasemi.com>
allOf:
- $ref: watchdog.yaml#
properties:
compatible:
enum:
- dlg,da9061-watchdog
- dlg,da9062-watchdog
dlg,use-sw-pm:
type: boolean
description:
Add this property to disable the watchdog during suspend.
Only use this option if you can't use the watchdog automatic suspend
function during a suspend (see register CONTROL_B).
dlg,wdt-sd:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [0, 1]
description:
Set what happens on watchdog timeout. If this bit is set the
watchdog timeout triggers SHUTDOWN, if cleared the watchdog triggers
POWERDOWN. Can be 0 or 1. Only use this option if you want to change the
default chip's OTP setting for WATCHDOG_SD bit. If this property is NOT
set the WATCHDOG_SD bit and on timeout watchdog behavior will match the
chip's OTP settings.
required:
- compatible
unevaluatedProperties: false
examples:
- |
watchdog {
compatible = "dlg,da9062-watchdog";
dlg,use-sw-pm;
dlg,wdt-sd = <1>;
};

View file

@ -18,7 +18,9 @@ allOf:
properties:
compatible:
items:
- const: fsl,imx8qxp-sc-wdt
- enum:
- fsl,imx8dxl-sc-wdt
- fsl,imx8qxp-sc-wdt
- const: fsl,imx-sc-wdt
required:

View file

@ -159,11 +159,14 @@ It is possible to run both in a single command::
make dt_binding_check dtbs_check
It is also possible to run checks with a subset of matching schema files by
setting the ``DT_SCHEMA_FILES`` variable to a specific schema file or pattern.
setting the ``DT_SCHEMA_FILES`` variable to 1 or more specific schema files or
patterns (partial match of a fixed string). Each file or pattern should be
separated by ':'.
::
make dt_binding_check DT_SCHEMA_FILES=trivial-devices.yaml
make dt_binding_check DT_SCHEMA_FILES=trivial-devices.yaml:rtc.yaml
make dt_binding_check DT_SCHEMA_FILES=/gpio/
make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml

View file

@ -16034,6 +16034,7 @@ F: Documentation/ABI/testing/sysfs-firmware-ofw
F: drivers/of/
F: include/linux/of*.h
F: scripts/dtc/
F: tools/testing/selftests/dt/
K: of_overlay_notifier_
K: of_overlay_fdt_apply
K: of_overlay_remove

View file

@ -101,7 +101,7 @@ static int amba_handler_attach(struct acpi_device *adev,
if (parent)
dev->dev.parent = acpi_get_first_physical_node(parent);
ACPI_COMPANION_SET(&dev->dev, adev);
device_set_node(&dev->dev, acpi_fwnode_handle(adev));
ret = amba_device_add(dev, &iomem_resource);
if (ret) {

View file

@ -18,6 +18,7 @@
#include <linux/limits.h>
#include <linux/clk/clk-conf.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/reset.h>
#include <linux/of_irq.h>
#include <linux/of_device.h>
@ -528,7 +529,7 @@ static void amba_device_release(struct device *dev)
{
struct amba_device *d = to_amba_device(dev);
of_node_put(d->dev.of_node);
fwnode_handle_put(dev_fwnode(&d->dev));
if (d->res.parent)
release_resource(&d->res);
mutex_destroy(&d->periphid_lock);
@ -548,6 +549,8 @@ int amba_device_add(struct amba_device *dev, struct resource *parent)
{
int ret;
fwnode_handle_get(dev_fwnode(&dev->dev));
ret = request_resource(parent, &dev->res);
if (ret)
return ret;

View file

@ -43,9 +43,9 @@ struct of_bus {
void (*count_cells)(struct device_node *child,
int *addrc, int *sizec);
u64 (*map)(__be32 *addr, const __be32 *range,
int na, int ns, int pna);
int na, int ns, int pna, int fna);
int (*translate)(__be32 *addr, u64 offset, int na);
bool has_flags;
int flag_cells;
unsigned int (*get_flags)(const __be32 *addr);
};
@ -63,13 +63,13 @@ static void of_bus_default_count_cells(struct device_node *dev,
}
static u64 of_bus_default_map(__be32 *addr, const __be32 *range,
int na, int ns, int pna)
int na, int ns, int pna, int fna)
{
u64 cp, s, da;
cp = of_read_number(range, na);
cp = of_read_number(range + fna, na - fna);
s = of_read_number(range + na + pna, ns);
da = of_read_number(addr, na);
da = of_read_number(addr + fna, na - fna);
pr_debug("default map, cp=%llx, s=%llx, da=%llx\n", cp, s, da);
@ -100,6 +100,21 @@ static unsigned int of_bus_default_get_flags(const __be32 *addr)
return IORESOURCE_MEM;
}
static u64 of_bus_default_flags_map(__be32 *addr, const __be32 *range, int na,
int ns, int pna, int fna)
{
/* Check that flags match */
if (*addr != *range)
return OF_BAD_ADDR;
return of_bus_default_map(addr, range, na, ns, pna, fna);
}
static int of_bus_default_flags_translate(__be32 *addr, u64 offset, int na)
{
/* Keep "flags" part (high cell) in translated address */
return of_bus_default_translate(addr + 1, offset, na - 1);
}
#ifdef CONFIG_PCI
static unsigned int of_bus_pci_get_flags(const __be32 *addr)
@ -166,9 +181,8 @@ static void of_bus_pci_count_cells(struct device_node *np,
}
static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns,
int pna)
int pna, int fna)
{
u64 cp, s, da;
unsigned int af, rf;
af = of_bus_pci_get_flags(addr);
@ -178,22 +192,9 @@ static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns,
if ((af ^ rf) & (IORESOURCE_MEM | IORESOURCE_IO))
return OF_BAD_ADDR;
/* Read address values, skipping high cell */
cp = of_read_number(range + 1, na - 1);
s = of_read_number(range + na + pna, ns);
da = of_read_number(addr + 1, na - 1);
pr_debug("PCI map, cp=%llx, s=%llx, da=%llx\n", cp, s, da);
if (da < cp || da >= (cp + s))
return OF_BAD_ADDR;
return da - cp;
return of_bus_default_map(addr, range, na, ns, pna, fna);
}
static int of_bus_pci_translate(__be32 *addr, u64 offset, int na)
{
return of_bus_default_translate(addr + 1, offset, na - 1);
}
#endif /* CONFIG_PCI */
/*
@ -297,29 +298,13 @@ static void of_bus_isa_count_cells(struct device_node *child,
}
static u64 of_bus_isa_map(__be32 *addr, const __be32 *range, int na, int ns,
int pna)
int pna, int fna)
{
u64 cp, s, da;
/* Check address type match */
if ((addr[0] ^ range[0]) & cpu_to_be32(1))
return OF_BAD_ADDR;
/* Read address values, skipping high cell */
cp = of_read_number(range + 1, na - 1);
s = of_read_number(range + na + pna, ns);
da = of_read_number(addr + 1, na - 1);
pr_debug("ISA map, cp=%llx, s=%llx, da=%llx\n", cp, s, da);
if (da < cp || da >= (cp + s))
return OF_BAD_ADDR;
return da - cp;
}
static int of_bus_isa_translate(__be32 *addr, u64 offset, int na)
{
return of_bus_default_translate(addr + 1, offset, na - 1);
return of_bus_default_map(addr, range, na, ns, pna, fna);
}
static unsigned int of_bus_isa_get_flags(const __be32 *addr)
@ -352,8 +337,8 @@ static struct of_bus of_busses[] = {
.match = of_bus_pci_match,
.count_cells = of_bus_pci_count_cells,
.map = of_bus_pci_map,
.translate = of_bus_pci_translate,
.has_flags = true,
.translate = of_bus_default_flags_translate,
.flag_cells = 1,
.get_flags = of_bus_pci_get_flags,
},
#endif /* CONFIG_PCI */
@ -364,8 +349,8 @@ static struct of_bus of_busses[] = {
.match = of_bus_isa_match,
.count_cells = of_bus_isa_count_cells,
.map = of_bus_isa_map,
.translate = of_bus_isa_translate,
.has_flags = true,
.translate = of_bus_default_flags_translate,
.flag_cells = 1,
.get_flags = of_bus_isa_get_flags,
},
/* Default with flags cell */
@ -374,9 +359,9 @@ static struct of_bus of_busses[] = {
.addresses = "reg",
.match = of_bus_default_flags_match,
.count_cells = of_bus_default_count_cells,
.map = of_bus_default_map,
.translate = of_bus_default_translate,
.has_flags = true,
.map = of_bus_default_flags_map,
.translate = of_bus_default_flags_translate,
.flag_cells = 1,
.get_flags = of_bus_default_flags_get_flags,
},
/* Default */
@ -469,7 +454,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
rlen /= 4;
rone = na + pna + ns;
for (; rlen >= rone; rlen -= rone, ranges += rone) {
offset = bus->map(addr, ranges, na, ns, pna);
offset = bus->map(addr, ranges, na, ns, pna, bus->flag_cells);
if (offset != OF_BAD_ADDR)
break;
}
@ -809,7 +794,7 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
int na = parser->na;
int ns = parser->ns;
int np = parser->pna + na + ns;
int busflag_na = 0;
int busflag_na = parser->bus->flag_cells;
if (!range)
return NULL;
@ -819,10 +804,6 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
range->flags = parser->bus->get_flags(parser->range);
/* A extra cell for resource flags */
if (parser->bus->has_flags)
busflag_na = 1;
range->bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na);
if (parser->dma)

View file

@ -273,7 +273,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
/* setup generic device info */
device_set_node(&dev->dev, of_fwnode_handle(of_node_get(node)));
device_set_node(&dev->dev, of_fwnode_handle(node));
dev->dev.parent = parent ? : &platform_bus;
dev->dev.platform_data = platform_data;
if (bus_id)

View file

@ -3,5 +3,5 @@
/plugin/;
&this_label_does_not_exist {
status = "ok";
status = "okay";
};

View file

@ -51,5 +51,106 @@ bus@a0000000 {
};
};
address-tests2 {
#address-cells = <2>;
#size-cells = <1>;
ranges = <0x10000000 0x01000000 0xa0000000 0x01000000>,
<0x10000000 0x02000000 0xb0000000 0x01000000>,
<0x20000000 0x01000000 0xc0000000 0x01000000>,
<0x20000000 0x02000000 0xd0000000 0x01000000>,
<0x00000000 0xd1000000 0xd1000000 0x01000000>,
<0x00000000 0xe8000000 0xe8000000 0x07f00000>,
<0x00000000 0xefff0000 0xefff0000 0x00010000>;
bus-2cell@10000000 {
#address-cells = <2>;
#size-cells = <1>;
ranges = <0x100000 0x10000 0x10000000 0x1a00000 0x10000>,
<0x100000 0x20000 0x10000000 0x1b00000 0x10000>,
<0x200000 0x10000 0x20000000 0x1c00000 0x10000>,
<0x200000 0x20000 0x20000000 0x2d00000 0x10000>;
device@100000 {
reg = <0x100000 0x11000 0x100>,
<0x100000 0x12000 0x100>,
<0x200000 0x11000 0x100>,
<0x200000 0x21000 0x100>;
};
};
bus-3cell@20000000 {
#address-cells = <3>;
#size-cells = <1>;
ranges = <0x1 0x100000 0x10000 0x10000000 0x1a00000 0x10000>,
<0x2 0x100000 0x10000 0x10000000 0x1b00000 0x10000>,
<0x3 0x200000 0x10000 0x20000000 0x1c00000 0x10000>,
<0x4 0x200000 0x20000 0x20000000 0x2d00000 0x10000>;
local-bus@100000 {
#address-cells = <1>;
#size-cells = <1>;
ranges = <0xf1000000 0x1 0x100000 0x10000 0x10000>,
<0xf2000000 0x2 0x100000 0x10000 0x10000>,
<0xf3000000 0x3 0x200000 0x10000 0x08000>,
<0xf3800000 0x3 0x200000 0x18000 0x08000>,
<0xf4000000 0x4 0x200000 0x20000 0x10000>;
device@f1001000 {
reg = <0xf1001000 0x100>,
<0xf2002000 0x100>,
<0xf3001000 0x100>,
<0xf3801000 0x100>,
<0xf4001000 0x100>;
};
};
};
pcie@d1070000 {
#address-cells = <0x03>;
#size-cells = <0x02>;
bus-range = <0x00 0xff>;
device_type = "pci";
ranges = <0x82000000 0 0xe8000000 0 0xe8000000 0 0x7f00000>,
<0x81000000 0 0x00000000 0 0xefff0000 0 0x0010000>;
reg = <0x00000000 0xd1070000 0x20000>;
pci@0,0 {
#address-cells = <0x03>;
#size-cells = <0x02>;
bus-range = <0x01 0x01>;
device_type = "pci";
ranges = <0x82000000 0 0xe8000000
0x82000000 0 0xe8000000
0 0x4400000>;
reg = <0x00 0x00 0x00 0x00 0x00>;
dev@0,0 {
#address-cells = <0x03>;
#size-cells = <0x02>;
ranges = <0 0 0 0x82010000 0 0xe8000000 0 0x2000000>,
<1 0 0 0x82010000 0 0xea000000 0 0x1000000>,
<2 0 0 0x82010000 0 0xeb000000 0 0x0800000>,
<3 0 0 0x82010000 0 0xeb800000 0 0x0800000>,
<4 0 0 0x82010000 0 0xec000000 0 0x0020000>,
<5 0 0 0x82010000 0 0xec020000 0 0x0002000>;
reg = <0x10000 0x00 0x00 0x00 0x00>;
local-bus@0 {
#address-cells = <0x01>;
#size-cells = <0x01>;
ranges = <0xa0000000 0 0 0 0x2000000>,
<0xb0000000 1 0 0 0x1000000>;
dev@e0000000 {
reg = <0xa0001000 0x1000>,
<0xb0002000 0x2000>;
};
};
};
};
};
};
};
};

View file

@ -1186,6 +1186,82 @@ static void __init of_unittest_reg(void)
of_node_put(np);
}
struct of_unittest_expected_res {
int index;
struct resource res;
};
static void __init of_unittest_check_addr(const char *node_path,
const struct of_unittest_expected_res *tab_exp,
unsigned int tab_exp_count)
{
const struct of_unittest_expected_res *expected;
struct device_node *np;
struct resource res;
unsigned int count;
int ret;
if (!IS_ENABLED(CONFIG_OF_ADDRESS))
return;
np = of_find_node_by_path(node_path);
if (!np) {
pr_err("missing testcase data (%s)\n", node_path);
return;
}
expected = tab_exp;
count = tab_exp_count;
while (count--) {
ret = of_address_to_resource(np, expected->index, &res);
unittest(!ret, "of_address_to_resource(%pOF, %d) returned error %d\n",
np, expected->index, ret);
unittest(resource_type(&res) == resource_type(&expected->res) &&
res.start == expected->res.start &&
resource_size(&res) == resource_size(&expected->res),
"of_address_to_resource(%pOF, %d) wrong resource %pR, expected %pR\n",
np, expected->index, &res, &expected->res);
expected++;
}
of_node_put(np);
}
static const struct of_unittest_expected_res of_unittest_reg_2cell_expected_res[] = {
{.index = 0, .res = DEFINE_RES_MEM(0xa0a01000, 0x100) },
{.index = 1, .res = DEFINE_RES_MEM(0xa0a02000, 0x100) },
{.index = 2, .res = DEFINE_RES_MEM(0xc0c01000, 0x100) },
{.index = 3, .res = DEFINE_RES_MEM(0xd0d01000, 0x100) },
};
static const struct of_unittest_expected_res of_unittest_reg_3cell_expected_res[] = {
{.index = 0, .res = DEFINE_RES_MEM(0xa0a01000, 0x100) },
{.index = 1, .res = DEFINE_RES_MEM(0xa0b02000, 0x100) },
{.index = 2, .res = DEFINE_RES_MEM(0xc0c01000, 0x100) },
{.index = 3, .res = DEFINE_RES_MEM(0xc0c09000, 0x100) },
{.index = 4, .res = DEFINE_RES_MEM(0xd0d01000, 0x100) },
};
static const struct of_unittest_expected_res of_unittest_reg_pci_expected_res[] = {
{.index = 0, .res = DEFINE_RES_MEM(0xe8001000, 0x1000) },
{.index = 1, .res = DEFINE_RES_MEM(0xea002000, 0x2000) },
};
static void __init of_unittest_translate_addr(void)
{
of_unittest_check_addr("/testcase-data/address-tests2/bus-2cell@10000000/device@100000",
of_unittest_reg_2cell_expected_res,
ARRAY_SIZE(of_unittest_reg_2cell_expected_res));
of_unittest_check_addr("/testcase-data/address-tests2/bus-3cell@20000000/local-bus@100000/device@f1001000",
of_unittest_reg_3cell_expected_res,
ARRAY_SIZE(of_unittest_reg_3cell_expected_res));
of_unittest_check_addr("/testcase-data/address-tests2/pcie@d1070000/pci@0,0/dev@0,0/local-bus@0/dev@e0000000",
of_unittest_reg_pci_expected_res,
ARRAY_SIZE(of_unittest_reg_pci_expected_res));
}
static void __init of_unittest_parse_interrupts(void)
{
struct device_node *np;
@ -4034,6 +4110,7 @@ static int __init of_unittest(void)
of_unittest_bus_ranges();
of_unittest_bus_3cell_ranges();
of_unittest_reg();
of_unittest_translate_addr();
of_unittest_match_node();
of_unittest_platform_populate();
of_unittest_overlay();

View file

@ -7,11 +7,15 @@ import re
import argparse
def parse_of_declare_macros(data):
def parse_of_declare_macros(data, include_driver_macros=True):
""" Find all compatible strings in OF_DECLARE() style macros """
compat_list = []
# CPU_METHOD_OF_DECLARE does not have a compatible string
for m in re.finditer(r'(?<!CPU_METHOD_)(IRQCHIP|OF)_(DECLARE|MATCH)(_DRIVER)?\(.*?\)', data):
if include_driver_macros:
re_macros = r'(?<!CPU_METHOD_)(IRQCHIP|OF)_(DECLARE|MATCH)(_DRIVER)?\(.*?\)'
else:
re_macros = r'(?<!CPU_METHOD_)(IRQCHIP|OF)_(DECLARE|MATCH)\(.*?\)'
for m in re.finditer(re_macros, data):
try:
compat = re.search(r'"(.*?)"', m[0])[1]
except:
@ -22,24 +26,52 @@ def parse_of_declare_macros(data):
return compat_list
def parse_of_device_id(data):
def parse_of_device_id(data, match_table_list=None):
""" Find all compatible strings in of_device_id structs """
compat_list = []
for m in re.finditer(r'of_device_id(\s+\S+)?\s+\S+\[\](\s+\S+)?\s*=\s*({.*?);', data):
compat_list += re.findall(r'\.compatible\s+=\s+"(\S+)"', m[3])
for m in re.finditer(r'of_device_id(\s+\S+)?\s+(\S+)\[\](\s+\S+)?\s*=\s*({.*?);', data):
if match_table_list is not None and m[2] not in match_table_list:
continue
compat_list += re.findall(r'\.compatible\s+=\s+"(\S+)"', m[4])
return compat_list
def parse_compatibles(file):
def parse_of_match_table(data):
""" Find all driver's of_match_table """
match_table_list = []
for m in re.finditer(r'\.of_match_table\s+=\s+(of_match_ptr\()?([a-zA-Z0-9_-]+)', data):
match_table_list.append(m[2])
return match_table_list
def parse_compatibles(file, compat_ignore_list):
with open(file, 'r', encoding='utf-8') as f:
data = f.read().replace('\n', '')
compat_list = parse_of_declare_macros(data)
compat_list += parse_of_device_id(data)
if compat_ignore_list is not None:
# For a compatible in the DT to be matched to a driver it needs to show
# up in a driver's of_match_table
match_table_list = parse_of_match_table(data)
compat_list = parse_of_device_id(data, match_table_list)
compat_list = [compat for compat in compat_list if compat not in compat_ignore_list]
else:
compat_list = parse_of_declare_macros(data)
compat_list += parse_of_device_id(data)
return compat_list
def parse_compatibles_to_ignore(file):
with open(file, 'r', encoding='utf-8') as f:
data = f.read().replace('\n', '')
# Compatibles that show up in OF_DECLARE macros can't be expected to
# match a driver, except for the _DRIVER ones.
return parse_of_declare_macros(data, include_driver_macros=False)
def print_compat(filename, compatibles):
if not compatibles:
return
@ -49,21 +81,31 @@ def print_compat(filename, compatibles):
else:
print(*compatibles, sep='\n')
def files_to_parse(path_args):
for f in path_args:
if os.path.isdir(f):
for filename in glob.iglob(f + "/**/*.c", recursive=True):
yield filename
else:
yield f
show_filename = False
if __name__ == "__main__":
ap = argparse.ArgumentParser()
ap.add_argument("cfile", type=str, nargs='*', help="C source files or directories to parse")
ap.add_argument('-H', '--with-filename', help="Print filename with compatibles", action="store_true")
ap.add_argument('-d', '--driver-match', help="Only print compatibles that should match to a driver", action="store_true")
args = ap.parse_args()
show_filename = args.with_filename
compat_ignore_list = None
for f in args.cfile:
if os.path.isdir(f):
for filename in glob.iglob(f + "/**/*.c", recursive=True):
compat_list = parse_compatibles(filename)
print_compat(filename, compat_list)
else:
compat_list = parse_compatibles(f)
print_compat(f, compat_list)
if args.driver_match:
compat_ignore_list = []
for f in files_to_parse(args.cfile):
compat_ignore_list.extend(parse_compatibles_to_ignore(f))
for f in files_to_parse(args.cfile):
compat_list = parse_compatibles(f, compat_ignore_list)
print_compat(f, compat_list)

View file

@ -18,6 +18,7 @@ TARGETS += drivers/dma-buf
TARGETS += drivers/s390x/uvdevice
TARGETS += drivers/net/bonding
TARGETS += drivers/net/team
TARGETS += dt
TARGETS += efivarfs
TARGETS += exec
TARGETS += fchmodat2

1
tools/testing/selftests/dt/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
compatible_list

View file

@ -0,0 +1,21 @@
PY3 = $(shell which python3 2>/dev/null)
ifneq ($(PY3),)
TEST_PROGS := test_unprobed_devices.sh
TEST_GEN_FILES := compatible_list
TEST_FILES := compatible_ignore_list ktap_helpers.sh
include ../lib.mk
$(OUTPUT)/compatible_list:
$(top_srcdir)/scripts/dtc/dt-extract-compatibles -d $(top_srcdir) > $@
else
all: no_py3_warning
no_py3_warning:
@echo "Missing python3. This test will be skipped."
endif

View file

@ -0,0 +1 @@
simple-mfd

View file

@ -0,0 +1,70 @@
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2023 Collabora Ltd
#
# Helpers for outputting in KTAP format
#
KTAP_TESTNO=1
KTAP_CNT_PASS=0
KTAP_CNT_FAIL=0
KTAP_CNT_SKIP=0
ktap_print_header() {
echo "TAP version 13"
}
ktap_set_plan() {
num_tests="$1"
echo "1..$num_tests"
}
ktap_skip_all() {
echo -n "1..0 # SKIP "
echo $@
}
__ktap_test() {
result="$1"
description="$2"
directive="$3" # optional
local directive_str=
[[ ! -z "$directive" ]] && directive_str="# $directive"
echo $result $KTAP_TESTNO $description $directive_str
KTAP_TESTNO=$((KTAP_TESTNO+1))
}
ktap_test_pass() {
description="$1"
result="ok"
__ktap_test "$result" "$description"
KTAP_CNT_PASS=$((KTAP_CNT_PASS+1))
}
ktap_test_skip() {
description="$1"
result="ok"
directive="SKIP"
__ktap_test "$result" "$description" "$directive"
KTAP_CNT_SKIP=$((KTAP_CNT_SKIP+1))
}
ktap_test_fail() {
description="$1"
result="not ok"
__ktap_test "$result" "$description"
KTAP_CNT_FAIL=$((KTAP_CNT_FAIL+1))
}
ktap_print_totals() {
echo "# Totals: pass:$KTAP_CNT_PASS fail:$KTAP_CNT_FAIL xfail:0 xpass:0 skip:$KTAP_CNT_SKIP error:0"
}

View file

@ -0,0 +1,83 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2023 Collabora Ltd
#
# Based on Frank Rowand's dt_stat script.
#
# This script tests for devices that were declared on the Devicetree and are
# expected to bind to a driver, but didn't.
#
# To achieve this, two lists are used:
# * a list of the compatibles that can be matched by a Devicetree node
# * a list of compatibles that should be ignored
#
DIR="$(dirname $(readlink -f "$0"))"
source "${DIR}"/ktap_helpers.sh
PDT=/proc/device-tree/
COMPAT_LIST="${DIR}"/compatible_list
IGNORE_LIST="${DIR}"/compatible_ignore_list
KSFT_PASS=0
KSFT_FAIL=1
KSFT_SKIP=4
ktap_print_header
if [[ ! -d "${PDT}" ]]; then
ktap_skip_all "${PDT} doesn't exist."
exit "${KSFT_SKIP}"
fi
nodes_compatible=$(
for node_compat in $(find ${PDT} -name compatible); do
node=$(dirname "${node_compat}")
# Check if node is available
if [[ -e "${node}"/status ]]; then
status=$(tr -d '\000' < "${node}"/status)
[[ "${status}" != "okay" && "${status}" != "ok" ]] && continue
fi
echo "${node}" | sed -e 's|\/proc\/device-tree||'
done | sort
)
nodes_dev_bound=$(
IFS=$'\n'
for uevent in $(find /sys/devices -name uevent); do
if [[ -d "$(dirname "${uevent}")"/driver ]]; then
grep '^OF_FULLNAME=' "${uevent}" | sed -e 's|OF_FULLNAME=||'
fi
done
)
num_tests=$(echo ${nodes_compatible} | wc -w)
ktap_set_plan "${num_tests}"
retval="${KSFT_PASS}"
for node in ${nodes_compatible}; do
if ! echo "${nodes_dev_bound}" | grep -E -q "(^| )${node}( |\$)"; then
compatibles=$(tr '\000' '\n' < "${PDT}"/"${node}"/compatible)
for compatible in ${compatibles}; do
if grep -x -q "${compatible}" "${IGNORE_LIST}"; then
continue
fi
if grep -x -q "${compatible}" "${COMPAT_LIST}"; then
ktap_test_fail "${node}"
retval="${KSFT_FAIL}"
continue 2
fi
done
ktap_test_skip "${node}"
else
ktap_test_pass "${node}"
fi
done
ktap_print_totals
exit "${retval}"