Commit 0809edba authored by Linus Torvalds's avatar Linus Torvalds

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

Pull devicetree fixes and cleanups from Rob Herring:

 - Fix a regression when probing a child device reusing the parent
   device's DT node pointer

 - Refactor of_parse_phandle*() variants to static inlines

 - Drop Enric Balletbo i Serra as a maintainer

 - Fix DT schemas with arrays incorrectly encoded as a matrix

 - Drop unneeded pinctrl properties from schemas

 - Add SPI peripheral schema to SPI based displays

 - Clean-up several schema examples

 - Clean-up trivial-devices.yaml comments

 - Add missing, in use vendor prefixes: Wingtech, Thundercomm, Huawei,
   F(x)tec, 8devices

* tag 'devicetree-fixes-for-5.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
  dt-bindings: google,cros-ec: drop Enric Balletbo i Serra from maintainers
  dt-bindings: display: bridge: drop Enric Balletbo i Serra from maintainers
  of: Check 'of_node_reused' flag on of_match_device()
  of: property: define of_property_read_u{8,16,32,64}_array() unconditionally
  of: base: make small of_parse_phandle() variants static inline
  dt-bindings: mfd: cirrus,madera: Fix 'interrupts' in example
  dt-bindings: Fix array schemas encoded as matrices
  dt-bindings: Drop unnecessary pinctrl properties
  dt-bindings: rtc: st,stm32-rtc: Make each example a separate entry
  dt-bindings: mmc: arm,pl18x: Make each example a separate entry
  dt-bindings: display: Add SPI peripheral schema to SPI based displays
  scripts/dtc: dtx_diff: remove broken example from help text
  dt-bindings: trivial-devices: fix double spaces in comments
  dt-bindings: trivial-devices: fix swapped comments
  dt-bindings: vendor-prefixes: add Wingtech
  dt-bindings: vendor-prefixes: add Thundercomm
  dt-bindings: vendor-prefixes: add Huawei
  dt-bindings: vendor-prefixes: add F(x)tec
  dt-bindings: vendor-prefixes: add 8devices
  dt-bindings: power: reset: gpio-restart: Correct default priority
parents 636b5284 18a86e59
......@@ -7,7 +7,9 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Analogix ANX7814 SlimPort (Full-HD Transmitter)
maintainers:
- Enric Balletbo i Serra <enric.balletbo@collabora.com>
- Andrzej Hajda <andrzej.hajda@intel.com>
- Neil Armstrong <narmstrong@baylibre.com>
- Robert Foss <robert.foss@linaro.org>
properties:
compatible:
......
......@@ -8,7 +8,6 @@ title: ChromeOS EC ANX7688 HDMI to DP Converter through Type-C Port
maintainers:
- Nicolas Boichat <drinkcat@chromium.org>
- Enric Balletbo i Serra <enric.balletbo@collabora.com>
description: |
ChromeOS EC ANX7688 is a display bridge that converts HDMI 2.0 to
......
......@@ -8,7 +8,6 @@ title: MIPI DSI to eDP Video Format Converter Device Tree Bindings
maintainers:
- Nicolas Boichat <drinkcat@chromium.org>
- Enric Balletbo i Serra <enric.balletbo@collabora.com>
description: |
The PS8640 is a low power MIPI-to-eDP video format converter supporting
......
......@@ -6,15 +6,12 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Asia Better Technology 3.0" (320x480 pixels) 24-bit IPS LCD panel
description: |
The panel must obey the rules for a SPI slave device as specified in
spi/spi-controller.yaml
maintainers:
- Paul Cercueil <paul@crapouillou.net>
allOf:
- $ref: panel-common.yaml#
- $ref: /schemas/spi/spi-peripheral-props.yaml#
properties:
compatible:
......
......@@ -15,11 +15,9 @@ description: |
960 TFT source driver pins and 240 TFT gate driver pins, VCOM, VCOML and
VCOMH outputs.
The panel must obey the rules for a SPI slave device as specified in
spi/spi-controller.yaml
allOf:
- $ref: panel-common.yaml#
- $ref: /schemas/spi/spi-peripheral-props.yaml#
properties:
compatible:
......
......@@ -6,15 +6,12 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Innolux EJ030NA 3.0" (320x480 pixels) 24-bit TFT LCD panel
description: |
The panel must obey the rules for a SPI slave device as specified in
spi/spi-controller.yaml
maintainers:
- Paul Cercueil <paul@crapouillou.net>
allOf:
- $ref: panel-common.yaml#
- $ref: /schemas/spi/spi-peripheral-props.yaml#
properties:
compatible:
......
......@@ -6,15 +6,12 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: King Display KD035G6-54NT 3.5" (320x240 pixels) 24-bit TFT LCD panel
description: |
The panel must obey the rules for a SPI slave device as specified in
spi/spi-controller.yaml
maintainers:
- Paul Cercueil <paul@crapouillou.net>
allOf:
- $ref: panel-common.yaml#
- $ref: /schemas/spi/spi-peripheral-props.yaml#
properties:
compatible:
......
......@@ -6,15 +6,12 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: LG.Philips LB035Q02 Panel
description: |
The panel must obey the rules for a SPI slave device as specified in
spi/spi-controller.yaml
maintainers:
- Tomi Valkeinen <tomi.valkeinen@ti.com>
allOf:
- $ref: panel-common.yaml#
- $ref: /schemas/spi/spi-peripheral-props.yaml#
properties:
compatible:
......
......@@ -6,15 +6,12 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Samsung LD9040 AMOLED LCD parallel RGB panel with SPI control bus
description: |
The panel must obey the rules for a SPI slave device as specified in
spi/spi-controller.yaml
maintainers:
- Andrzej Hajda <a.hajda@samsung.com>
allOf:
- $ref: panel-common.yaml#
- $ref: /schemas/spi/spi-peripheral-props.yaml#
properties:
compatible:
......@@ -63,8 +60,6 @@ examples:
lcd@0 {
compatible = "samsung,ld9040";
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
vdd3-supply = <&ldo7_reg>;
......
......@@ -12,6 +12,7 @@ maintainers:
allOf:
- $ref: panel-common.yaml#
- $ref: /schemas/leds/backlight/common.yaml#
- $ref: /schemas/spi/spi-peripheral-props.yaml#
properties:
compatible:
......
......@@ -6,15 +6,12 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Sitronix ST7789V RGB panel with SPI control bus
description: |
The panel must obey the rules for a SPI slave device as specified in
spi/spi-controller.yaml
maintainers:
- Maxime Ripard <mripard@kernel.org>
allOf:
- $ref: panel-common.yaml#
- $ref: /schemas/spi/spi-peripheral-props.yaml#
properties:
compatible:
......
......@@ -6,15 +6,12 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Sony ACX565AKM SDI Panel
description: |
The panel must obey the rules for a SPI slave device as specified in
spi/spi-controller.yaml
maintainers:
- Tomi Valkeinen <tomi.valkeinen@ti.com>
allOf:
- $ref: panel-common.yaml#
- $ref: /schemas/spi/spi-peripheral-props.yaml#
properties:
compatible:
......
......@@ -6,16 +6,13 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Toppoly TD Panels
description: |
The panel must obey the rules for a SPI slave device as specified in
spi/spi-controller.yaml
maintainers:
- Marek Belisko <marek@goldelico.com>
- H. Nikolaus Schaller <hns@goldelico.com>
allOf:
- $ref: panel-common.yaml#
- $ref: /schemas/spi/spi-peripheral-props.yaml#
properties:
compatible:
......
......@@ -26,14 +26,6 @@ properties:
clock-names:
const: hclk
pinctrl-0:
maxItems: 2
pinctrl-names:
const: default
description:
Switch the iomux for the HPD/I2C pins to HDMI function.
power-domains:
maxItems: 1
......
......@@ -8,7 +8,6 @@ title: ChromeOS EC USB Type-C cable and accessories detection
maintainers:
- Benson Leung <bleung@chromium.org>
- Enric Balletbo i Serra <enric.balletbo@collabora.com>
description: |
On ChromeOS systems with USB Type C ports, the ChromeOS Embedded Controller is
......
......@@ -10,7 +10,6 @@ title: I2C bus that tunnels through the ChromeOS EC (cros-ec)
maintainers:
- Doug Anderson <dianders@chromium.org>
- Benson Leung <bleung@chromium.org>
- Enric Balletbo i Serra <enric.balletbo@collabora.com>
description: |
On some ChromeOS board designs we've got a connection to the EC
......
......@@ -10,7 +10,6 @@ title: ChromeOS EC MKBP Proximity Sensor
maintainers:
- Stephen Boyd <swboyd@chromium.org>
- Benson Leung <bleung@chromium.org>
- Enric Balletbo i Serra <enric.balletbo@collabora.com>
description: |
Google's ChromeOS EC sometimes has the ability to detect user proximity.
......
......@@ -10,7 +10,6 @@ title: ChromeOS EC Keyboard
maintainers:
- Simon Glass <sjg@chromium.org>
- Benson Leung <bleung@chromium.org>
- Enric Balletbo i Serra <enric.balletbo@collabora.com>
description: |
Google's ChromeOS EC Keyboard is a simple matrix keyboard
......
......@@ -88,12 +88,6 @@ patternProperties:
which can be disabled to suppress events from the button.
type: boolean
pinctrl-0:
maxItems: 1
pinctrl-names:
maxItems: 1
required:
- linux,code
......
......@@ -81,14 +81,12 @@ properties:
data-lanes:
description:
Note that 'fsl,imx7-mipi-csi2' only supports up to 2 data lines.
minItems: 1
items:
minItems: 1
maxItems: 4
items:
- const: 1
- const: 2
- const: 3
- const: 4
- const: 1
- const: 2
- const: 3
- const: 4
required:
- data-lanes
......
......@@ -87,14 +87,12 @@ properties:
properties:
data-lanes:
minItems: 1
items:
minItems: 1
maxItems: 4
items:
- const: 1
- const: 2
- const: 3
- const: 4
- const: 1
- const: 2
- const: 3
- const: 4
required:
- data-lanes
......
......@@ -245,8 +245,7 @@ examples:
interrupt-controller;
#interrupt-cells = <2>;
interrupts = <&host_irq1>;
interrupt-parent = <&gic>;
interrupts = <4 1 0>;
gpio-controller;
#gpio-cells = <2>;
......
......@@ -8,7 +8,6 @@ title: ChromeOS Embedded Controller
maintainers:
- Benson Leung <bleung@chromium.org>
- Enric Balletbo i Serra <enric.balletbo@collabora.com>
- Guenter Roeck <groeck@chromium.org>
description:
......
......@@ -185,6 +185,9 @@ examples:
clock-names = "mclk", "apb_pclk";
};
- |
#include <dt-bindings/interrupt-controller/irq.h>
mmc@80126000 {
compatible = "arm,pl18x", "arm,primecell";
reg = <0x80126000 0x1000>;
......@@ -206,12 +209,12 @@ examples:
vqmmc-supply = <&vmmci>;
};
- |
mmc@101f6000 {
compatible = "arm,pl18x", "arm,primecell";
reg = <0x101f6000 0x1000>;
clocks = <&sdiclk>, <&pclksdi>;
clock-names = "mclk", "apb_pclk";
interrupt-parent = <&vica>;
interrupts = <22>;
max-frequency = <400000>;
bus-width = <4>;
......@@ -226,6 +229,7 @@ examples:
vmmc-supply = <&vmmc_regulator>;
};
- |
mmc@52007000 {
compatible = "arm,pl18x", "arm,primecell";
arm,primecell-periphid = <0x10153180>;
......
......@@ -76,33 +76,31 @@ properties:
M_CAN user manual for details.
$ref: /schemas/types.yaml#/definitions/int32-array
items:
items:
- description: The 'offset' is an address offset of the Message RAM where
the following elements start from. This is usually set to 0x0 if
you're using a private Message RAM.
default: 0
- description: 11-bit Filter 0-128 elements / 0-128 words
minimum: 0
maximum: 128
- description: 29-bit Filter 0-64 elements / 0-128 words
minimum: 0
maximum: 64
- description: Rx FIFO 0 0-64 elements / 0-1152 words
minimum: 0
maximum: 64
- description: Rx FIFO 1 0-64 elements / 0-1152 words
minimum: 0
maximum: 64
- description: Rx Buffers 0-64 elements / 0-1152 words
minimum: 0
maximum: 64
- description: Tx Event FIFO 0-32 elements / 0-64 words
minimum: 0
maximum: 32
- description: Tx Buffers 0-32 elements / 0-576 words
minimum: 0
maximum: 32
maxItems: 1
- description: The 'offset' is an address offset of the Message RAM where
the following elements start from. This is usually set to 0x0 if
you're using a private Message RAM.
default: 0
- description: 11-bit Filter 0-128 elements / 0-128 words
minimum: 0
maximum: 128
- description: 29-bit Filter 0-64 elements / 0-128 words
minimum: 0
maximum: 64
- description: Rx FIFO 0 0-64 elements / 0-1152 words
minimum: 0
maximum: 64
- description: Rx FIFO 1 0-64 elements / 0-1152 words
minimum: 0
maximum: 64
- description: Rx Buffers 0-64 elements / 0-1152 words
minimum: 0
maximum: 64
- description: Tx Event FIFO 0-32 elements / 0-64 words
minimum: 0
maximum: 32
- description: Tx Buffers 0-32 elements / 0-576 words
minimum: 0
maximum: 32
power-domains:
description:
......
......@@ -17,9 +17,8 @@ properties:
description:
Specifies the MAC address that was assigned to the network device.
$ref: /schemas/types.yaml#/definitions/uint8-array
items:
- minItems: 6
maxItems: 6
minItems: 6
maxItems: 6
mac-address:
description:
......@@ -28,9 +27,8 @@ properties:
to the device by the boot program is different from the
local-mac-address property.
$ref: /schemas/types.yaml#/definitions/uint8-array
items:
- minItems: 6
maxItems: 6
minItems: 6
maxItems: 6
max-frame-size:
$ref: /schemas/types.yaml#/definitions/uint32
......@@ -164,33 +162,30 @@ properties:
type: array
then:
deprecated: true
minItems: 1
maxItems: 1
items:
items:
- minimum: 0
maximum: 31
description:
Emulated PHY ID, choose any but unique to the all
specified fixed-links
- enum: [0, 1]
description:
Duplex configuration. 0 for half duplex or 1 for
full duplex
- enum: [10, 100, 1000, 2500, 10000]
description:
Link speed in Mbits/sec.
- enum: [0, 1]
description:
Pause configuration. 0 for no pause, 1 for pause
- enum: [0, 1]
description:
Asymmetric pause configuration. 0 for no asymmetric
pause, 1 for asymmetric pause
- minimum: 0
maximum: 31
description:
Emulated PHY ID, choose any but unique to the all
specified fixed-links
- enum: [0, 1]
description:
Duplex configuration. 0 for half duplex or 1 for
full duplex
- enum: [10, 100, 1000, 2500, 10000]
description:
Link speed in Mbits/sec.
- enum: [0, 1]
description:
Pause configuration. 0 for no pause, 1 for pause
- enum: [0, 1]
description:
Asymmetric pause configuration. 0 for no asymmetric
pause, 1 for asymmetric pause
- if:
......
......@@ -50,16 +50,15 @@ patternProperties:
Offset and size in bytes within the storage device.
bits:
maxItems: 1
$ref: /schemas/types.yaml#/definitions/uint32-array
items:
items:
- minimum: 0
maximum: 7
description:
Offset in bit within the address range specified by reg.
- minimum: 1
description:
Size in bit within the address range specified by reg.
- minimum: 0
maximum: 7
description:
Offset in bit within the address range specified by reg.
- minimum: 1
description:
Size in bit within the address range specified by reg.
required:
- reg
......
......@@ -51,15 +51,6 @@ properties:
appropriate of the LOCHNAGARx_PIN_NUM_GPIOS define, see [3].
maxItems: 1
pinctrl-0:
description:
A phandle to the default pinctrl state.
pinctrl-names:
description:
A pinctrl state named "default" must be defined.
const: default
pin-settings:
type: object
patternProperties:
......
......@@ -30,16 +30,6 @@ description: |
Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
properties:
pinctrl-0:
description:
A phandle to the node containing the subnodes containing default
configurations.
pinctrl-names:
description:
A pinctrl state named "default" must be defined.
const: default
pin-settings:
description:
One subnode is required to contain the default settings. It
......
......@@ -43,7 +43,7 @@ properties:
priority:
$ref: /schemas/types.yaml#/definitions/uint32
description: |
A priority ranging from 0 to 255 (default 128) according to the following guidelines:
A priority ranging from 0 to 255 (default 129) according to the following guidelines:
0: Restart handler of last resort, with limited restart capabilities.
128: Default restart handler; use if no other restart handler is expected to be available,
......@@ -51,7 +51,7 @@ properties:
255: Highest priority restart handler, will preempt all other restart handlers.
minimum: 0
maximum: 255
default: 128
default: 129
active-delay:
$ref: /schemas/types.yaml#/definitions/uint32
......
......@@ -127,6 +127,7 @@ examples:
st,syscfg = <&pwrcfg 0x00 0x100>;
};
- |
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/clock/stm32mp1-clks.h>
rtc@5c004000 {
......
......@@ -110,12 +110,6 @@ properties:
Internal DMA register base address of the audio
subsystem (used in secondary sound source).
pinctrl-0:
description: Should specify pin control groups used for this controller.
pinctrl-names:
const: default
power-domains:
maxItems: 1
......
......@@ -31,7 +31,7 @@ properties:
- enum:
# SMBus/I2C Digital Temperature Sensor in 6-Pin SOT with SMBus Alert and Over Temperature Pin
- ad,ad7414
# ADM9240: Complete System Hardware Monitor for uProcessor-Based Systems
# ADM9240: Complete System Hardware Monitor for uProcessor-Based Systems
- ad,adm9240
# AD5110 - Nonvolatile Digital Potentiometer
- adi,ad5110
......@@ -43,7 +43,7 @@ properties:
- adi,adp5589
# AMS iAQ-Core VOC Sensor
- ams,iaq-core
# i2c serial eeprom (24cxx)
# i2c serial eeprom (24cxx)
- at,24c08
# i2c trusted platform module (TPM)
- atmel,at97sc3204t
......@@ -303,9 +303,9 @@ properties:
- skyworks,sky81452
# Socionext SynQuacer TPM MMIO module
- socionext,synquacer-tpm-mmio
# i2c serial eeprom (24cxx)
- sparkfun,qwiic-joystick
# SparkFun Qwiic Joystick (COM-15168) with i2c interface
- sparkfun,qwiic-joystick
# i2c serial eeprom (24cxx)
- st,24c256
# Ambient Light Sensor with SMBUS/Two Wire Serial Interface
- taos,tsl2550
......
......@@ -25,6 +25,8 @@ patternProperties:
# Keep list in alphabetical order.
"^70mai,.*":
description: 70mai Co., Ltd.
"^8dev,.*":
description: 8devices, UAB
"^abb,.*":
description: ABB
"^abilis,.*":
......@@ -441,6 +443,8 @@ patternProperties:
description: Freescale Semiconductor
"^fujitsu,.*":
description: Fujitsu Ltd.
"^fxtec,.*":
description: FX Technology Ltd.
"^gardena,.*":
description: GARDENA GmbH
"^gateworks,.*":
......@@ -515,6 +519,8 @@ patternProperties:
description: HannStar Display Co.
"^holtek,.*":
description: Holtek Semiconductor, Inc.
"^huawei,.*":
description: Huawei Technologies Co., Ltd.
"^hugsun,.*":
description: Shenzhen Hugsun Technology Co. Ltd.
"^hwacom,.*":
......@@ -1207,6 +1213,8 @@ patternProperties:
description: THine Electronics, Inc.
"^thingyjp,.*":
description: thingy.jp
"^thundercomm,.*":
description: Thundercomm Technology Co., Ltd.
"^ti,.*":
description: Texas Instruments
"^tianma,.*":
......@@ -1334,6 +1342,8 @@ patternProperties:
description: Wiligear, Ltd.
"^winbond,.*":
description: Winbond Electronics corp.
"^wingtech,.*":
description: Wingtech Technology Co., Ltd.
"^winlink,.*":
description: WinLink Co., Ltd
"^winstar,.*":
......
......@@ -1420,15 +1420,18 @@ int of_phandle_iterator_args(struct of_phandle_iterator *it,
return count;
}
static int __of_parse_phandle_with_args(const struct device_node *np,
const char *list_name,
const char *cells_name,
int cell_count, int index,
struct of_phandle_args *out_args)
int __of_parse_phandle_with_args(const struct device_node *np,
const char *list_name,
const char *cells_name,
int cell_count, int index,
struct of_phandle_args *out_args)
{
struct of_phandle_iterator it;
int rc, cur_index = 0;
if (index < 0)
return -EINVAL;
/* Loop over the phandles until all the requested entry is found */
of_for_each_phandle(&it, rc, np, list_name, cells_name, cell_count) {
/*
......@@ -1471,82 +1474,7 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
of_node_put(it.node);
return rc;
}
/**
* of_parse_phandle - Resolve a phandle property to a device_node pointer
* @np: Pointer to device node holding phandle property
* @phandle_name: Name of property holding a phandle value
* @index: For properties holding a table of phandles, this is the index into
* the table
*
* Return: The device_node pointer with refcount incremented. Use
* of_node_put() on it when done.
*/
struct device_node *of_parse_phandle(const struct device_node *np,
const char *phandle_name, int index)
{
struct of_phandle_args args;
if (index < 0)
return NULL;
if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0,
index, &args))
return NULL;
return args.np;
}
EXPORT_SYMBOL(of_parse_phandle);
/**
* of_parse_phandle_with_args() - Find a node pointed by phandle in a list
* @np: pointer to a device tree node containing a list
* @list_name: property name that contains a list
* @cells_name: property name that specifies phandles' arguments count
* @index: index of a phandle to parse out
* @out_args: optional pointer to output arguments structure (will be filled)
*
* This function is useful to parse lists of phandles and their arguments.
* Returns 0 on success and fills out_args, on error returns appropriate
* errno value.
*
* Caller is responsible to call of_node_put() on the returned out_args->np
* pointer.
*
* Example::
*
* phandle1: node1 {
* #list-cells = <2>;
* };
*
* phandle2: node2 {
* #list-cells = <1>;
* };
*
* node3 {
* list = <&phandle1 1 2 &phandle2 3>;
* };
*
* To get a device_node of the ``node2`` node you may call this:
* of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args);
*/
int of_parse_phandle_with_args(const struct device_node *np, const char *list_name,
const char *cells_name, int index,
struct of_phandle_args *out_args)
{
int cell_count = -1;
if (index < 0)
return -EINVAL;
/* If cells_name is NULL we assume a cell count of 0 */
if (!cells_name)
cell_count = 0;
return __of_parse_phandle_with_args(np, list_name, cells_name,
cell_count, index, out_args);
}
EXPORT_SYMBOL(of_parse_phandle_with_args);
EXPORT_SYMBOL(__of_parse_phandle_with_args);
/**
* of_parse_phandle_with_args_map() - Find a node pointed by phandle in a list and remap it
......@@ -1732,47 +1660,6 @@ int of_parse_phandle_with_args_map(const struct device_node *np,
}
EXPORT_SYMBOL(of_parse_phandle_with_args_map);
/**
* of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list
* @np: pointer to a device tree node containing a list
* @list_name: property name that contains a list
* @cell_count: number of argument cells following the phandle
* @index: index of a phandle to parse out
* @out_args: optional pointer to output arguments structure (will be filled)
*
* This function is useful to parse lists of phandles and their arguments.
* Returns 0 on success and fills out_args, on error returns appropriate
* errno value.
*
* Caller is responsible to call of_node_put() on the returned out_args->np
* pointer.
*
* Example::
*
* phandle1: node1 {
* };
*
* phandle2: node2 {
* };
*
* node3 {
* list = <&phandle1 0 2 &phandle2 2 3>;
* };
*
* To get a device_node of the ``node2`` node you may call this:
* of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args);
*/
int of_parse_phandle_with_fixed_args(const struct device_node *np,
const char *list_name, int cell_count,
int index, struct of_phandle_args *out_args)
{
if (index < 0)
return -EINVAL;
return __of_parse_phandle_with_args(np, list_name, NULL, cell_count,
index, out_args);
}
EXPORT_SYMBOL(of_parse_phandle_with_fixed_args);
/**
* of_count_phandle_with_args() - Find the number of phandles references in a property
* @np: pointer to a device tree node containing a list
......
......@@ -28,7 +28,7 @@
const struct of_device_id *of_match_device(const struct of_device_id *matches,
const struct device *dev)
{
if ((!matches) || (!dev->of_node))
if (!matches || !dev->of_node || dev->of_node_reused)
return NULL;
return of_match_node(matches, dev->of_node);
}
......
......@@ -364,18 +364,12 @@ extern const struct of_device_id *of_match_node(
const struct of_device_id *matches, const struct device_node *node);
extern int of_modalias_node(struct device_node *node, char *modalias, int len);
extern void of_print_phandle_args(const char *msg, const struct of_phandle_args *args);
extern struct device_node *of_parse_phandle(const struct device_node *np,
const char *phandle_name,
int index);
extern int of_parse_phandle_with_args(const struct device_node *np,
const char *list_name, const char *cells_name, int index,
struct of_phandle_args *out_args);
extern int __of_parse_phandle_with_args(const struct device_node *np,
const char *list_name, const char *cells_name, int cell_count,
int index, struct of_phandle_args *out_args);
extern int of_parse_phandle_with_args_map(const struct device_node *np,
const char *list_name, const char *stem_name, int index,
struct of_phandle_args *out_args);
extern int of_parse_phandle_with_fixed_args(const struct device_node *np,
const char *list_name, int cells_count, int index,
struct of_phandle_args *out_args);
extern int of_count_phandle_with_args(const struct device_node *np,
const char *list_name, const char *cells_name);
......@@ -416,130 +410,6 @@ extern int of_detach_node(struct device_node *);
#define of_match_ptr(_ptr) (_ptr)
/**
* of_property_read_u8_array - Find and read an array of u8 from a property.
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_values: pointer to return value, modified only if return value is 0.
* @sz: number of array elements to read
*
* Search for a property in a device node and read 8-bit value(s) from
* it.
*
* dts entry of array should be like:
* ``property = /bits/ 8 <0x50 0x60 0x70>;``
*
* Return: 0 on success, -EINVAL if the property does not exist,
* -ENODATA if property does not have a value, and -EOVERFLOW if the
* property data isn't large enough.
*
* The out_values is modified only if a valid u8 value can be decoded.
*/
static inline int of_property_read_u8_array(const struct device_node *np,
const char *propname,
u8 *out_values, size_t sz)
{
int ret = of_property_read_variable_u8_array(np, propname, out_values,
sz, 0);
if (ret >= 0)
return 0;
else
return ret;
}
/**
* of_property_read_u16_array - Find and read an array of u16 from a property.
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_values: pointer to return value, modified only if return value is 0.
* @sz: number of array elements to read
*
* Search for a property in a device node and read 16-bit value(s) from
* it.
*
* dts entry of array should be like:
* ``property = /bits/ 16 <0x5000 0x6000 0x7000>;``
*
* Return: 0 on success, -EINVAL if the property does not exist,
* -ENODATA if property does not have a value, and -EOVERFLOW if the
* property data isn't large enough.
*
* The out_values is modified only if a valid u16 value can be decoded.
*/
static inline int of_property_read_u16_array(const struct device_node *np,
const char *propname,
u16 *out_values, size_t sz)
{
int ret = of_property_read_variable_u16_array(np, propname, out_values,
sz, 0);
if (ret >= 0)
return 0;
else
return ret;
}
/**
* of_property_read_u32_array - Find and read an array of 32 bit integers
* from a property.
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_values: pointer to return value, modified only if return value is 0.
* @sz: number of array elements to read
*
* Search for a property in a device node and read 32-bit value(s) from
* it.
*
* Return: 0 on success, -EINVAL if the property does not exist,
* -ENODATA if property does not have a value, and -EOVERFLOW if the
* property data isn't large enough.
*
* The out_values is modified only if a valid u32 value can be decoded.
*/
static inline int of_property_read_u32_array(const struct device_node *np,
const char *propname,
u32 *out_values, size_t sz)
{
int ret = of_property_read_variable_u32_array(np, propname, out_values,
sz, 0);
if (ret >= 0)
return 0;
else
return ret;
}
/**
* of_property_read_u64_array - Find and read an array of 64 bit integers
* from a property.
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_values: pointer to return value, modified only if return value is 0.
* @sz: number of array elements to read
*
* Search for a property in a device node and read 64-bit value(s) from
* it.
*
* Return: 0 on success, -EINVAL if the property does not exist,
* -ENODATA if property does not have a value, and -EOVERFLOW if the
* property data isn't large enough.
*
* The out_values is modified only if a valid u64 value can be decoded.
*/
static inline int of_property_read_u64_array(const struct device_node *np,
const char *propname,
u64 *out_values, size_t sz)
{
int ret = of_property_read_variable_u64_array(np, propname, out_values,
sz, 0);
if (ret >= 0)
return 0;
else
return ret;
}
/*
* struct property *prop;
* const __be32 *p;
......@@ -734,32 +604,6 @@ static inline int of_property_count_elems_of_size(const struct device_node *np,
return -ENOSYS;
}
static inline int of_property_read_u8_array(const struct device_node *np,
const char *propname, u8 *out_values, size_t sz)
{
return -ENOSYS;
}
static inline int of_property_read_u16_array(const struct device_node *np,
const char *propname, u16 *out_values, size_t sz)
{
return -ENOSYS;
}
static inline int of_property_read_u32_array(const struct device_node *np,
const char *propname,
u32 *out_values, size_t sz)
{
return -ENOSYS;
}
static inline int of_property_read_u64_array(const struct device_node *np,
const char *propname,
u64 *out_values, size_t sz)
{
return -ENOSYS;
}
static inline int of_property_read_u32_index(const struct device_node *np,
const char *propname, u32 index, u32 *out_value)
{
......@@ -865,18 +709,12 @@ static inline int of_property_read_string_helper(const struct device_node *np,
return -ENOSYS;
}
static inline struct device_node *of_parse_phandle(const struct device_node *np,
const char *phandle_name,
int index)
{
return NULL;
}
static inline int of_parse_phandle_with_args(const struct device_node *np,
const char *list_name,
const char *cells_name,
int index,
struct of_phandle_args *out_args)
static inline int __of_parse_phandle_with_args(const struct device_node *np,
const char *list_name,
const char *cells_name,
int cell_count,
int index,
struct of_phandle_args *out_args)
{
return -ENOSYS;
}
......@@ -890,13 +728,6 @@ static inline int of_parse_phandle_with_args_map(const struct device_node *np,
return -ENOSYS;
}
static inline int of_parse_phandle_with_fixed_args(const struct device_node *np,
const char *list_name, int cells_count, int index,
struct of_phandle_args *out_args)
{
return -ENOSYS;
}
static inline int of_count_phandle_with_args(const struct device_node *np,
const char *list_name,
const char *cells_name)
......@@ -1077,6 +908,117 @@ static inline bool of_node_is_type(const struct device_node *np, const char *typ
return np && match && type && !strcmp(match, type);
}
/**
* of_parse_phandle - Resolve a phandle property to a device_node pointer
* @np: Pointer to device node holding phandle property
* @phandle_name: Name of property holding a phandle value
* @index: For properties holding a table of phandles, this is the index into
* the table
*
* Return: The device_node pointer with refcount incremented. Use
* of_node_put() on it when done.
*/
static inline struct device_node *of_parse_phandle(const struct device_node *np,
const char *phandle_name,
int index)
{
struct of_phandle_args args;
if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0,
index, &args))
return NULL;
return args.np;
}
/**
* of_parse_phandle_with_args() - Find a node pointed by phandle in a list
* @np: pointer to a device tree node containing a list
* @list_name: property name that contains a list
* @cells_name: property name that specifies phandles' arguments count
* @index: index of a phandle to parse out
* @out_args: optional pointer to output arguments structure (will be filled)
*
* This function is useful to parse lists of phandles and their arguments.
* Returns 0 on success and fills out_args, on error returns appropriate
* errno value.
*
* Caller is responsible to call of_node_put() on the returned out_args->np
* pointer.
*
* Example::
*
* phandle1: node1 {
* #list-cells = <2>;
* };
*
* phandle2: node2 {
* #list-cells = <1>;
* };
*
* node3 {
* list = <&phandle1 1 2 &phandle2 3>;
* };
*
* To get a device_node of the ``node2`` node you may call this:
* of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args);
*/
static inline int of_parse_phandle_with_args(const struct device_node *np,
const char *list_name,
const char *cells_name,
int index,
struct of_phandle_args *out_args)
{
int cell_count = -1;
/* If cells_name is NULL we assume a cell count of 0 */
if (!cells_name)
cell_count = 0;
return __of_parse_phandle_with_args(np, list_name, cells_name,
cell_count, index, out_args);
}
/**
* of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list
* @np: pointer to a device tree node containing a list
* @list_name: property name that contains a list
* @cell_count: number of argument cells following the phandle
* @index: index of a phandle to parse out
* @out_args: optional pointer to output arguments structure (will be filled)
*
* This function is useful to parse lists of phandles and their arguments.
* Returns 0 on success and fills out_args, on error returns appropriate
* errno value.
*
* Caller is responsible to call of_node_put() on the returned out_args->np
* pointer.
*
* Example::
*
* phandle1: node1 {
* };
*
* phandle2: node2 {
* };
*
* node3 {
* list = <&phandle1 0 2 &phandle2 2 3>;
* };
*
* To get a device_node of the ``node2`` node you may call this:
* of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args);
*/
static inline int of_parse_phandle_with_fixed_args(const struct device_node *np,
const char *list_name,
int cell_count,
int index,
struct of_phandle_args *out_args)
{
return __of_parse_phandle_with_args(np, list_name, NULL, cell_count,
index, out_args);
}
/**
* of_property_count_u8_elems - Count the number of u8 elements in a property
*
......@@ -1236,6 +1178,130 @@ static inline bool of_property_read_bool(const struct device_node *np,
return prop ? true : false;
}
/**
* of_property_read_u8_array - Find and read an array of u8 from a property.
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_values: pointer to return value, modified only if return value is 0.
* @sz: number of array elements to read
*
* Search for a property in a device node and read 8-bit value(s) from
* it.
*
* dts entry of array should be like:
* ``property = /bits/ 8 <0x50 0x60 0x70>;``
*
* Return: 0 on success, -EINVAL if the property does not exist,
* -ENODATA if property does not have a value, and -EOVERFLOW if the
* property data isn't large enough.
*
* The out_values is modified only if a valid u8 value can be decoded.
*/
static inline int of_property_read_u8_array(const struct device_node *np,
const char *propname,
u8 *out_values, size_t sz)
{
int ret = of_property_read_variable_u8_array(np, propname, out_values,
sz, 0);
if (ret >= 0)
return 0;
else
return ret;
}
/**
* of_property_read_u16_array - Find and read an array of u16 from a property.
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_values: pointer to return value, modified only if return value is 0.
* @sz: number of array elements to read
*
* Search for a property in a device node and read 16-bit value(s) from
* it.
*
* dts entry of array should be like:
* ``property = /bits/ 16 <0x5000 0x6000 0x7000>;``
*
* Return: 0 on success, -EINVAL if the property does not exist,
* -ENODATA if property does not have a value, and -EOVERFLOW if the
* property data isn't large enough.
*
* The out_values is modified only if a valid u16 value can be decoded.
*/
static inline int of_property_read_u16_array(const struct device_node *np,
const char *propname,
u16 *out_values, size_t sz)
{
int ret = of_property_read_variable_u16_array(np, propname, out_values,
sz, 0);
if (ret >= 0)
return 0;
else
return ret;
}
/**
* of_property_read_u32_array - Find and read an array of 32 bit integers
* from a property.
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_values: pointer to return value, modified only if return value is 0.
* @sz: number of array elements to read
*
* Search for a property in a device node and read 32-bit value(s) from
* it.
*
* Return: 0 on success, -EINVAL if the property does not exist,
* -ENODATA if property does not have a value, and -EOVERFLOW if the
* property data isn't large enough.
*
* The out_values is modified only if a valid u32 value can be decoded.
*/
static inline int of_property_read_u32_array(const struct device_node *np,
const char *propname,
u32 *out_values, size_t sz)
{
int ret = of_property_read_variable_u32_array(np, propname, out_values,
sz, 0);
if (ret >= 0)
return 0;
else
return ret;
}
/**
* of_property_read_u64_array - Find and read an array of 64 bit integers
* from a property.
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_values: pointer to return value, modified only if return value is 0.
* @sz: number of array elements to read
*
* Search for a property in a device node and read 64-bit value(s) from
* it.
*
* Return: 0 on success, -EINVAL if the property does not exist,
* -ENODATA if property does not have a value, and -EOVERFLOW if the
* property data isn't large enough.
*
* The out_values is modified only if a valid u64 value can be decoded.
*/
static inline int of_property_read_u64_array(const struct device_node *np,
const char *propname,
u64 *out_values, size_t sz)
{
int ret = of_property_read_variable_u64_array(np, propname, out_values,
sz, 0);
if (ret >= 0)
return 0;
else
return ret;
}
static inline int of_property_read_u8(const struct device_node *np,
const char *propname,
u8 *out_value)
......
......@@ -59,12 +59,8 @@ Otherwise DTx is treated as a dts source file (aka .dts).
or '/include/' to be processed.
If DTx_1 and DTx_2 are in different architectures, then this script
may not work since \${ARCH} is part of the include path. Two possible
workarounds:
`basename $0` \\
<(ARCH=arch_of_dtx_1 `basename $0` DTx_1) \\
<(ARCH=arch_of_dtx_2 `basename $0` DTx_2)
may not work since \${ARCH} is part of the include path. The following
workaround can be used:
`basename $0` ARCH=arch_of_dtx_1 DTx_1 >tmp_dtx_1.dts
`basename $0` ARCH=arch_of_dtx_2 DTx_2 >tmp_dtx_2.dts
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment