Skip to content

Commit

Permalink
Merge tag 'devicetree-for-4.12' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/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
  ..
  • Loading branch information
torvalds committed May 6, 2017
2 parents 2eecf3a + 17a7035 commit 3ef2bc0
Show file tree
Hide file tree
Showing 49 changed files with 1,152 additions and 233 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Device-Tree bindings for Atmel's HLCDC (High LCD Controller) DRM driver

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:
- compatible: value should be "atmel,hlcdc-display-controller"
Expand Down
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/fpga/fpga-region.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ Optional properties:
- region-freeze-timeout-us : The maximum time in microseconds to wait for
bridges to successfully become disabled before the region has been
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.

In the example below, when an overlay is applied targeting fpga-region0,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
* 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>;
};
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/mfd/atmel-hlcdc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Required properties:

The HLCDC IP exposes two subdevices:
- 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:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
MOXA ART Ethernet Controller
Faraday Ethernet Controller

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
- interrupts : Should contain the mac interrupt number

Expand Down
3 changes: 3 additions & 0 deletions Documentation/devicetree/bindings/vendor-prefixes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ denx Denx Software Engineering
devantech Devantech, Ltd.
digi Digi International Inc.
digilent Diglent, Inc.
dioo Dioo Microcircuit Co., Ltd
dlg Dialog Semiconductor
dlink D-Link Corporation
dmo Data Modul AG
Expand Down Expand Up @@ -215,6 +216,7 @@ newhaven Newhaven Display International
ni National Instruments
nintendo Nintendo
nokia Nokia
nordic Nordic Semiconductor
nuvoton Nuvoton Technology Corporation
nvd New Vision Display
nvidia NVIDIA
Expand Down Expand Up @@ -261,6 +263,7 @@ richtek Richtek Technology Corporation
ricoh Ricoh Co. Ltd.
rikomagic Rikomagic Tech Corp. Ltd
rockchip Fuzhou Rockchip Electronics Co., Ltd
rohm ROHM Semiconductor Co., Ltd
samsung Samsung Semiconductor
samtec Samtec/Softing company
sandisk Sandisk Corporation
Expand Down
5 changes: 1 addition & 4 deletions arch/powerpc/platforms/pseries/ibmebus.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,7 @@ static ssize_t name_show(struct device *dev,
static ssize_t modalias_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
ssize_t len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2);
buf[len] = '\n';
buf[len+1] = 0;
return len+1;
return of_device_modalias(dev, buf, PAGE_SIZE);
}

static struct device_attribute ibmebus_bus_device_attrs[] = {
Expand Down
2 changes: 1 addition & 1 deletion drivers/base/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
struct platform_device *pdev = to_platform_device(dev);
int len;

len = of_device_get_modalias(dev, buf, PAGE_SIZE -1);
len = of_device_modalias(dev, buf, PAGE_SIZE);
if (len != -ENODEV)
return len;

Expand Down
7 changes: 1 addition & 6 deletions drivers/macintosh/macio_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
char *buf)
{
int len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2);

buf[len] = '\n';
buf[len+1] = 0;

return len+1;
return of_device_modalias(dev, buf, PAGE_SIZE);
}

static ssize_t devspec_show(struct device *dev,
Expand Down
2 changes: 1 addition & 1 deletion drivers/of/address.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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->pci_addr = of_read_number(parser->range + 1, ns);
range->cpu_addr = of_translate_address(parser->node,
Expand Down
13 changes: 6 additions & 7 deletions drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *child;
const phandle *handle;
struct device_node *child, *cache_node;

handle = of_get_property(np, "l2-cache", NULL);
if (!handle)
handle = of_get_property(np, "next-level-cache", NULL);
cache_node = of_parse_phandle(np, "l2-cache", 0);
if (!cache_node)
cache_node = of_parse_phandle(np, "next-level-cache", 0);

if (handle)
return of_find_node_by_phandle(be32_to_cpup(handle));
if (cache_node)
return cache_node;

/* OF on pmac has nodes instead of properties named "l2-cache"
* beneath CPU nodes.
Expand Down
20 changes: 17 additions & 3 deletions drivers/of/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const void *of_device_get_match_data(const struct device *dev)
}
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;
int cplen, i;
Expand Down Expand Up @@ -223,9 +223,8 @@ ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len)
str[i] = '_';
}

return tsize;
return repend;
}
EXPORT_SYMBOL_GPL(of_device_get_modalias);

int of_device_request_module(struct device *dev)
{
Expand All @@ -250,6 +249,21 @@ int of_device_request_module(struct device *dev)
}
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
*/
Expand Down
18 changes: 11 additions & 7 deletions drivers/of/fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include <asm/setup.h> /* for COMMAND_LINE_SIZE */
#include <asm/page.h>

#include "of_private.h"

/*
* of_fdt_limit_memory - limit the number of regions in the /memory node
* @limit: maximum entries
Expand All @@ -46,8 +48,8 @@ void of_fdt_limit_memory(int limit)
const void *val;
int nr_address_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT;
int nr_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT;
const uint32_t *addr_prop;
const uint32_t *size_prop;
const __be32 *addr_prop;
const __be32 *size_prop;
int root_offset;
int cell_size;

Expand Down Expand Up @@ -469,11 +471,11 @@ static int unflatten_dt_nodes(const void *blob,
* Returns NULL on failure or the memory chunk containing the unflattened
* device tree on success.
*/
static void *__unflatten_device_tree(const void *blob,
struct device_node *dad,
struct device_node **mynodes,
void *(*dt_alloc)(u64 size, u64 align),
bool detached)
void *__unflatten_device_tree(const void *blob,
struct device_node *dad,
struct device_node **mynodes,
void *(*dt_alloc)(u64 size, u64 align),
bool detached)
{
int size;
void *mem;
Expand Down Expand Up @@ -1261,6 +1263,8 @@ void __init unflatten_device_tree(void)

/* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */
of_alias_scan(early_init_dt_alloc_memory_arch);

unittest_unflatten_overlay_base();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion drivers/of/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
__be32 initial_match_array[MAX_PHANDLE_ARGS];
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;
int imaplen, match, i, rc = -EINVAL;

Expand Down
2 changes: 2 additions & 0 deletions drivers/of/of_numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ static void __init of_numa_parse_cpu_nodes(void)
else
node_set(nid, numa_nodes_parsed);
}

of_node_put(cpus);
}

static int __init of_numa_parse_memory_nodes(void)
Expand Down
12 changes: 12 additions & 0 deletions drivers/of/of_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ static inline int of_property_notify(int action, struct device_node *np,
}
#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.
*
Expand Down
2 changes: 1 addition & 1 deletion drivers/of/of_reserved_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
const struct of_device_id *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;

if (!of_flat_dt_is_compatible(rmem->fdt_node, compat))
Expand Down
2 changes: 1 addition & 1 deletion drivers/of/resolver.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static void adjust_overlay_phandles(struct device_node *overlay,
if (phandle == OF_PHANDLE_ILLEGAL)
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)
Expand Down
17 changes: 14 additions & 3 deletions drivers/of/unittest-data/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
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 += overlay.dtb overlay.dtb.S
targets += overlay_bad_phandle.dtb overlay_bad_phandle.dtb.S
targets += overlay_base.dtb overlay_base.dtb.S

.SECONDARY: \
$(obj)/testcases.dtb.S \
$(obj)/testcases.dtb
.PRECIOUS: \
$(obj)/%.dtb.S \
$(obj)/%.dtb

# enable creation of __symbols__ node
DTC_FLAGS_overlay := -@
DTC_FLAGS_overlay_bad_phandle := -@
DTC_FLAGS_overlay_base := -@
53 changes: 53 additions & 0 deletions drivers/of/unittest-data/overlay.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/dts-v1/;
/plugin/;

/ {

fragment@0 {
target = <&electric_1>;

__overlay__ {
status = "ok";

hvac_2: hvac-large-1 {
compatible = "ot,hvac-large";
heat-range = < 40 75 >;
cool-range = < 65 80 >;
};
};
};

fragment@1 {
target = <&rides_1>;

__overlay__ {
#address-cells = <1>;
#size-cells = <1>;
status = "ok";

ride@200 {
compatible = "ot,ferris-wheel";
reg = < 0x00000200 0x100 >;
hvac-provider = < &hvac_2 >;
hvac-thermostat = < 27 32 > ;
hvac-zones = < 12 5 >;
hvac-zone-names = "operator", "snack-bar";
spin-controller = < &spin_ctrl_1 3 >;
spin-rph = < 30 >;
gondolas = < 16 >;
gondola-capacity = < 6 >;
};
};
};

fragment@2 {
target = <&lights_2>;

__overlay__ {
status = "ok";
color = "purple", "white", "red", "green";
rate = < 3 256 >;
};
};

};
Loading

0 comments on commit 3ef2bc0

Please sign in to comment.