Commit 3ef2bc09 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull DeviceTree updates from Rob Herring:

 - fix sparse warnings in drivers/of/

 - add more overlay unittests

 - update dtc to v1.4.4-8-g756ffc4f52f6. This adds more checks on dts
   files such as unit-address formatting and stricter character sets for
   node and property names

 - add a common DT modalias function

 - move trivial-devices.txt up and out of i2c dir

 - ARM NVIC interrupt controller binding

 - vendor prefixes for Sensirion, Dioo, Nordic, ROHM

 - correct some binding file locations

* tag 'devicetree-for-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (24 commits)
  of: fix sparse warnings in fdt, irq, reserved mem, and resolver code
  of: fix sparse warning in of_pci_range_parser_one
  of: fix sparse warnings in of_find_next_cache_node
  of/unittest: Missing unlocks on error
  of: fix uninitialized variable warning for overlay test
  of: fix unittest build without CONFIG_OF_OVERLAY
  of: Add unit tests for applying overlays
  of: per-file dtc compiler flags
  fpga: region: add missing DT documentation for config complete timeout
  of: Add vendor prefix for ROHM Semiconductor
  of: fix "/cpus" reference leak in of_numa_parse_cpu_nodes()
  of: Add vendor prefix for Nordic Semiconductor
  dt-bindings: arm,nvic: Binding for ARM NVIC interrupt controller on Cortex-M
  dtc: update warning settings for new bus and node/property name checks
  scripts/dtc: Update to upstream version v1.4.4-8-g756ffc4f52f6
  scripts/dtc: automate getting dtc version and log in update script
  of: Add function for generating a DT modalias with a newline
  of: fix of_device_get_modalias returned length when truncating buffers
  Documentation: devicetree: move trivial-devices out of I2C realm
  dt-bindings: add vendor prefix for Dioo
  ..
parents 2eecf3a4 17a70355
Device-Tree bindings for Atmel's HLCDC (High LCD Controller) DRM driver Device-Tree bindings for Atmel's HLCDC (High LCD Controller) DRM driver
The Atmel HLCDC Display Controller is subdevice of the HLCDC MFD device. The Atmel HLCDC Display Controller is subdevice of the HLCDC MFD device.
See ../mfd/atmel-hlcdc.txt for more details. See ../../mfd/atmel-hlcdc.txt for more details.
Required properties: Required properties:
- compatible: value should be "atmel,hlcdc-display-controller" - compatible: value should be "atmel,hlcdc-display-controller"
......
...@@ -193,6 +193,8 @@ Optional properties: ...@@ -193,6 +193,8 @@ Optional properties:
- region-freeze-timeout-us : The maximum time in microseconds to wait for - region-freeze-timeout-us : The maximum time in microseconds to wait for
bridges to successfully become disabled before the region has been bridges to successfully become disabled before the region has been
programmed. programmed.
- config-complete-timeout-us : The maximum time in microseconds time for the
FPGA to go to operating mode after the region has been programmed.
- child nodes : devices in the FPGA after programming. - child nodes : devices in the FPGA after programming.
In the example below, when an overlay is applied targeting fpga-region0, In the example below, when an overlay is applied targeting fpga-region0,
......
* ARM Nested Vector Interrupt Controller (NVIC)
The NVIC provides an interrupt controller that is tightly coupled to
Cortex-M based processor cores. The NVIC implemented on different SoCs
vary in the number of interrupts and priority bits per interrupt.
Main node required properties:
- compatible : should be one of:
"arm,v6m-nvic"
"arm,v7m-nvic"
"arm,v8m-nvic"
- interrupt-controller : Identifies the node as an interrupt controller
- #interrupt-cells : Specifies the number of cells needed to encode an
interrupt source. The type shall be a <u32> and the value shall be 2.
The 1st cell contains the interrupt number for the interrupt type.
The 2nd cell is the priority of the interrupt.
- reg : Specifies base physical address(s) and size of the NVIC registers.
This is at a fixed address (0xe000e100) and size (0xc00).
- arm,num-irq-priority-bits: The number of priority bits implemented by the
given SoC
Example:
intc: interrupt-controller@e000e100 {
compatible = "arm,v7m-nvic";
#interrupt-cells = <2>;
#address-cells = <1>;
interrupt-controller;
reg = <0xe000e100 0xc00>;
arm,num-irq-priority-bits = <4>;
};
...@@ -15,7 +15,7 @@ Required properties: ...@@ -15,7 +15,7 @@ Required properties:
The HLCDC IP exposes two subdevices: The HLCDC IP exposes two subdevices:
- a PWM chip: see ../pwm/atmel-hlcdc-pwm.txt - a PWM chip: see ../pwm/atmel-hlcdc-pwm.txt
- a Display Controller: see ../display/atmel-hlcdc-dc.txt - a Display Controller: see ../display/atmel/hlcdc-dc.txt
Example: Example:
......
MOXA ART Ethernet Controller Faraday Ethernet Controller
Required properties: Required properties:
- compatible : Must be "moxa,moxart-mac" - compatible : Must contain "faraday,ftmac", as well as one of
the SoC specific identifiers:
"andestech,atmac100"
"moxa,moxart-mac"
- reg : Should contain register location and length - reg : Should contain register location and length
- interrupts : Should contain the mac interrupt number - interrupts : Should contain the mac interrupt number
......
...@@ -80,6 +80,7 @@ denx Denx Software Engineering ...@@ -80,6 +80,7 @@ denx Denx Software Engineering
devantech Devantech, Ltd. devantech Devantech, Ltd.
digi Digi International Inc. digi Digi International Inc.
digilent Diglent, Inc. digilent Diglent, Inc.
dioo Dioo Microcircuit Co., Ltd
dlg Dialog Semiconductor dlg Dialog Semiconductor
dlink D-Link Corporation dlink D-Link Corporation
dmo Data Modul AG dmo Data Modul AG
...@@ -215,6 +216,7 @@ newhaven Newhaven Display International ...@@ -215,6 +216,7 @@ newhaven Newhaven Display International
ni National Instruments ni National Instruments
nintendo Nintendo nintendo Nintendo
nokia Nokia nokia Nokia
nordic Nordic Semiconductor
nuvoton Nuvoton Technology Corporation nuvoton Nuvoton Technology Corporation
nvd New Vision Display nvd New Vision Display
nvidia NVIDIA nvidia NVIDIA
...@@ -261,6 +263,7 @@ richtek Richtek Technology Corporation ...@@ -261,6 +263,7 @@ richtek Richtek Technology Corporation
ricoh Ricoh Co. Ltd. ricoh Ricoh Co. Ltd.
rikomagic Rikomagic Tech Corp. Ltd rikomagic Rikomagic Tech Corp. Ltd
rockchip Fuzhou Rockchip Electronics Co., Ltd rockchip Fuzhou Rockchip Electronics Co., Ltd
rohm ROHM Semiconductor Co., Ltd
samsung Samsung Semiconductor samsung Samsung Semiconductor
samtec Samtec/Softing company samtec Samtec/Softing company
sandisk Sandisk Corporation sandisk Sandisk Corporation
......
...@@ -410,10 +410,7 @@ static ssize_t name_show(struct device *dev, ...@@ -410,10 +410,7 @@ static ssize_t name_show(struct device *dev,
static ssize_t modalias_show(struct device *dev, static ssize_t modalias_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
ssize_t len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2); return of_device_modalias(dev, buf, PAGE_SIZE);
buf[len] = '\n';
buf[len+1] = 0;
return len+1;
} }
static struct device_attribute ibmebus_bus_device_attrs[] = { static struct device_attribute ibmebus_bus_device_attrs[] = {
......
...@@ -847,7 +847,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a, ...@@ -847,7 +847,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
int len; int len;
len = of_device_get_modalias(dev, buf, PAGE_SIZE -1); len = of_device_modalias(dev, buf, PAGE_SIZE);
if (len != -ENODEV) if (len != -ENODEV)
return len; return len;
......
...@@ -41,12 +41,7 @@ compatible_show (struct device *dev, struct device_attribute *attr, char *buf) ...@@ -41,12 +41,7 @@ compatible_show (struct device *dev, struct device_attribute *attr, char *buf)
static ssize_t modalias_show (struct device *dev, struct device_attribute *attr, static ssize_t modalias_show (struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
int len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2); return of_device_modalias(dev, buf, PAGE_SIZE);
buf[len] = '\n';
buf[len+1] = 0;
return len+1;
} }
static ssize_t devspec_show(struct device *dev, static ssize_t devspec_show(struct device *dev,
......
...@@ -263,7 +263,7 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser, ...@@ -263,7 +263,7 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
if (!parser->range || parser->range + parser->np > parser->end) if (!parser->range || parser->range + parser->np > parser->end)
return NULL; return NULL;
range->pci_space = parser->range[0]; range->pci_space = be32_to_cpup(parser->range);
range->flags = of_bus_pci_get_flags(parser->range); range->flags = of_bus_pci_get_flags(parser->range);
range->pci_addr = of_read_number(parser->range + 1, ns); range->pci_addr = of_read_number(parser->range + 1, ns);
range->cpu_addr = of_translate_address(parser->node, range->cpu_addr = of_translate_address(parser->node,
......
...@@ -2281,15 +2281,14 @@ EXPORT_SYMBOL_GPL(of_console_check); ...@@ -2281,15 +2281,14 @@ EXPORT_SYMBOL_GPL(of_console_check);
*/ */
struct device_node *of_find_next_cache_node(const struct device_node *np) struct device_node *of_find_next_cache_node(const struct device_node *np)
{ {
struct device_node *child; struct device_node *child, *cache_node;
const phandle *handle;
handle = of_get_property(np, "l2-cache", NULL); cache_node = of_parse_phandle(np, "l2-cache", 0);
if (!handle) if (!cache_node)
handle = of_get_property(np, "next-level-cache", NULL); cache_node = of_parse_phandle(np, "next-level-cache", 0);
if (handle) if (cache_node)
return of_find_node_by_phandle(be32_to_cpup(handle)); return cache_node;
/* OF on pmac has nodes instead of properties named "l2-cache" /* OF on pmac has nodes instead of properties named "l2-cache"
* beneath CPU nodes. * beneath CPU nodes.
......
...@@ -176,7 +176,7 @@ const void *of_device_get_match_data(const struct device *dev) ...@@ -176,7 +176,7 @@ const void *of_device_get_match_data(const struct device *dev)
} }
EXPORT_SYMBOL(of_device_get_match_data); EXPORT_SYMBOL(of_device_get_match_data);
ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len) static ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len)
{ {
const char *compat; const char *compat;
int cplen, i; int cplen, i;
...@@ -223,9 +223,8 @@ ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len) ...@@ -223,9 +223,8 @@ ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len)
str[i] = '_'; str[i] = '_';
} }
return tsize; return repend;
} }
EXPORT_SYMBOL_GPL(of_device_get_modalias);
int of_device_request_module(struct device *dev) int of_device_request_module(struct device *dev)
{ {
...@@ -250,6 +249,21 @@ int of_device_request_module(struct device *dev) ...@@ -250,6 +249,21 @@ int of_device_request_module(struct device *dev)
} }
EXPORT_SYMBOL_GPL(of_device_request_module); EXPORT_SYMBOL_GPL(of_device_request_module);
/**
* of_device_modalias - Fill buffer with newline terminated modalias string
*/
ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len)
{
ssize_t sl = of_device_get_modalias(dev, str, len - 2);
if (sl < 0)
return sl;
str[sl++] = '\n';
str[sl] = 0;
return sl;
}
EXPORT_SYMBOL_GPL(of_device_modalias);
/** /**
* of_device_uevent - Display OF related uevent information * of_device_uevent - Display OF related uevent information
*/ */
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include <asm/setup.h> /* for COMMAND_LINE_SIZE */ #include <asm/setup.h> /* for COMMAND_LINE_SIZE */
#include <asm/page.h> #include <asm/page.h>
#include "of_private.h"
/* /*
* of_fdt_limit_memory - limit the number of regions in the /memory node * of_fdt_limit_memory - limit the number of regions in the /memory node
* @limit: maximum entries * @limit: maximum entries
...@@ -46,8 +48,8 @@ void of_fdt_limit_memory(int limit) ...@@ -46,8 +48,8 @@ void of_fdt_limit_memory(int limit)
const void *val; const void *val;
int nr_address_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT; int nr_address_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT;
int nr_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT; int nr_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT;
const uint32_t *addr_prop; const __be32 *addr_prop;
const uint32_t *size_prop; const __be32 *size_prop;
int root_offset; int root_offset;
int cell_size; int cell_size;
...@@ -469,11 +471,11 @@ static int unflatten_dt_nodes(const void *blob, ...@@ -469,11 +471,11 @@ static int unflatten_dt_nodes(const void *blob,
* Returns NULL on failure or the memory chunk containing the unflattened * Returns NULL on failure or the memory chunk containing the unflattened
* device tree on success. * device tree on success.
*/ */
static void *__unflatten_device_tree(const void *blob, void *__unflatten_device_tree(const void *blob,
struct device_node *dad, struct device_node *dad,
struct device_node **mynodes, struct device_node **mynodes,
void *(*dt_alloc)(u64 size, u64 align), void *(*dt_alloc)(u64 size, u64 align),
bool detached) bool detached)
{ {
int size; int size;
void *mem; void *mem;
...@@ -1261,6 +1263,8 @@ void __init unflatten_device_tree(void) ...@@ -1261,6 +1263,8 @@ void __init unflatten_device_tree(void)
/* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */ /* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */
of_alias_scan(early_init_dt_alloc_memory_arch); of_alias_scan(early_init_dt_alloc_memory_arch);
unittest_unflatten_overlay_base();
} }
/** /**
......
...@@ -102,7 +102,7 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) ...@@ -102,7 +102,7 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
__be32 initial_match_array[MAX_PHANDLE_ARGS]; __be32 initial_match_array[MAX_PHANDLE_ARGS];
const __be32 *match_array = initial_match_array; const __be32 *match_array = initial_match_array;
const __be32 *tmp, *imap, *imask, dummy_imask[] = { [0 ... MAX_PHANDLE_ARGS] = ~0 }; const __be32 *tmp, *imap, *imask, dummy_imask[] = { [0 ... MAX_PHANDLE_ARGS] = cpu_to_be32(~0) };
u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
int imaplen, match, i, rc = -EINVAL; int imaplen, match, i, rc = -EINVAL;
......
...@@ -57,6 +57,8 @@ static void __init of_numa_parse_cpu_nodes(void) ...@@ -57,6 +57,8 @@ static void __init of_numa_parse_cpu_nodes(void)
else else
node_set(nid, numa_nodes_parsed); node_set(nid, numa_nodes_parsed);
} }
of_node_put(cpus);
} }
static int __init of_numa_parse_memory_nodes(void) static int __init of_numa_parse_memory_nodes(void)
......
...@@ -55,6 +55,18 @@ static inline int of_property_notify(int action, struct device_node *np, ...@@ -55,6 +55,18 @@ static inline int of_property_notify(int action, struct device_node *np,
} }
#endif /* CONFIG_OF_DYNAMIC */ #endif /* CONFIG_OF_DYNAMIC */
#if defined(CONFIG_OF_UNITTEST) && defined(CONFIG_OF_OVERLAY)
extern void __init unittest_unflatten_overlay_base(void);
#else
static inline void unittest_unflatten_overlay_base(void) {};
#endif
extern void *__unflatten_device_tree(const void *blob,
struct device_node *dad,
struct device_node **mynodes,
void *(*dt_alloc)(u64 size, u64 align),
bool detached);
/** /**
* General utilities for working with live trees. * General utilities for working with live trees.
* *
......
...@@ -197,7 +197,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem) ...@@ -197,7 +197,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
const struct of_device_id *i; const struct of_device_id *i;
for (i = __reservedmem_of_table; i < &__rmem_of_table_sentinel; i++) { for (i = __reservedmem_of_table; i < &__rmem_of_table_sentinel; i++) {
reservedmem_of_init_fn initfn = i->data; int const (*initfn)(struct reserved_mem *rmem) = i->data;
const char *compat = i->compatible; const char *compat = i->compatible;
if (!of_flat_dt_is_compatible(rmem->fdt_node, compat)) if (!of_flat_dt_is_compatible(rmem->fdt_node, compat))
......
...@@ -92,7 +92,7 @@ static void adjust_overlay_phandles(struct device_node *overlay, ...@@ -92,7 +92,7 @@ static void adjust_overlay_phandles(struct device_node *overlay,
if (phandle == OF_PHANDLE_ILLEGAL) if (phandle == OF_PHANDLE_ILLEGAL)
continue; continue;
*(uint32_t *)prop->value = cpu_to_be32(overlay->phandle); *(__be32 *)prop->value = cpu_to_be32(overlay->phandle);
} }
for_each_child_of_node(overlay, child) for_each_child_of_node(overlay, child)
......
obj-y += testcases.dtb.o obj-y += testcases.dtb.o
obj-y += overlay.dtb.o
obj-y += overlay_bad_phandle.dtb.o
obj-y += overlay_base.dtb.o
targets += testcases.dtb testcases.dtb.S targets += testcases.dtb testcases.dtb.S
targets += overlay.dtb overlay.dtb.S
targets += overlay_bad_phandle.dtb overlay_bad_phandle.dtb.S
targets += overlay_base.dtb overlay_base.dtb.S
.SECONDARY: \ .PRECIOUS: \
$(obj)/testcases.dtb.S \ $(obj)/%.dtb.S \
$(obj)/testcases.dtb $(obj)/%.dtb
# enable creation of __symbols__ node
DTC_FLAGS_overlay := -@
DTC_FLAGS_overlay_bad_phandle := -@
DTC_FLAGS_overlay_base := -@
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