Skip to content

Commit

Permalink
Merge tag 'devicetree-for-linus' of git://git.kernel.org/pub/scm/linu…
Browse files Browse the repository at this point in the history
…x/kernel/git/glikely/linux

Pull devicetree updates from Grant Likely:
 "A whole lot of bug fixes.

  Nothing stands out here except the ability to enable CONFIG_OF on
  every architecture, and an import of a newer version of dtc"

* tag 'devicetree-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/glikely/linux: (22 commits)
  of/irq: Rename "intc_desc" to "of_intc_desc" to fix OF on sh
  of/irq: Fix pSeries boot failure
  Documentation: DT: Fix a typo in the filename "lantiq,<chip>-pinumx.txt"
  of: define of_find_node_by_phandle for !CONFIG_OF
  of/address: use atomic allocation in pci_register_io_range()
  of: Add vendor prefix for Zodiac Inflight Innovations
  dt/fdt: add empty versions of early_init_dt_*_memory_arch
  of: clean-up unnecessary libfdt include paths
  of: make unittest select OF_EARLY_FLATTREE instead of depend on it
  of: make CONFIG_OF user selectable
  MIPS: prepare for user enabling of CONFIG_OF
  of/fdt: fix argument name and add comments of unflatten_dt_node()
  of: return NUMA_NO_NODE from fallback of_node_to_nid()
  tps6507x.txt: Remove executable permission
  of/overlay: Grammar s/an negative/a negative/
  of/fdt: Make fdt blob input parameters of unflatten functions const
  of: add helper function to retrive match data
  of: Grammar s/property exist/property exists/
  of: Move OF flags to be visible even when !CONFIG_OF
  scripts/dtc: Update to upstream version 9d3649bd3be245c9
  ...
  • Loading branch information
torvalds committed Jul 2, 2015
2 parents 93899e3 + 48a9b73 commit 4da3064
Show file tree
Hide file tree
Showing 53 changed files with 1,843 additions and 1,575 deletions.
Empty file modified Documentation/devicetree/bindings/mfd/tps6507x.txt
100755 → 100644
Empty file.
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/vendor-prefixes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,5 @@ xillybus Xillybus Ltd.
xlnx Xilinx
zyxel ZyXEL Communications Corp.
zarlink Zarlink Semiconductor
zii Zodiac Inflight Innovations
zte ZTE Corp.
4 changes: 4 additions & 0 deletions arch/arm/boot/compressed/libfdt_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#include <linux/string.h>
#include <asm/byteorder.h>

typedef __be16 fdt16_t;
typedef __be32 fdt32_t;
typedef __be64 fdt64_t;

#define fdt16_to_cpu(x) be16_to_cpu(x)
#define cpu_to_fdt16(x) cpu_to_be16(x)
#define fdt32_to_cpu(x) be32_to_cpu(x)
Expand Down
3 changes: 0 additions & 3 deletions arch/mips/cavium-octeon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
# Copyright (C) 2005-2009 Cavium Networks
#

CFLAGS_octeon-platform.o = -I$(src)/../../../scripts/dtc/libfdt
CFLAGS_setup.o = -I$(src)/../../../scripts/dtc/libfdt

obj-y := cpu.o setup.o octeon-platform.o octeon-irq.o csrc-octeon.o
obj-y += dma-octeon.o
obj-y += octeon-memcpy.o
Expand Down
2 changes: 0 additions & 2 deletions arch/mips/mti-sead3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@ obj-y := sead3-lcd.o sead3-display.o sead3-init.o \
obj-y += leds-sead3.o

obj-$(CONFIG_EARLY_PRINTK) += sead3-console.o

CFLAGS_sead3-setup.o = -I$(src)/../../../scripts/dtc/libfdt
4 changes: 4 additions & 0 deletions arch/powerpc/boot/libfdt_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ typedef u32 uint32_t;
typedef u64 uint64_t;
typedef unsigned long uintptr_t;

typedef __be16 fdt16_t;
typedef __be32 fdt32_t;
typedef __be64 fdt64_t;

#define fdt16_to_cpu(x) be16_to_cpu(x)
#define cpu_to_fdt16(x) cpu_to_be16(x)
#define fdt32_to_cpu(x) be32_to_cpu(x)
Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/boot/of.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ int of_setprop(const void *phandle, const char *name, const void *buf,
/* Console functions */
void of_console_init(void);

typedef u16 __be16;
typedef u32 __be32;
typedef u64 __be64;

#ifdef __LITTLE_ENDIAN__
#define cpu_to_be16(x) swab16(x)
Expand Down
1 change: 0 additions & 1 deletion arch/powerpc/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Makefile for the linux kernel.
#

CFLAGS_prom.o = -I$(src)/../../../scripts/dtc/libfdt
CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'

subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
Expand Down
2 changes: 0 additions & 2 deletions drivers/firmware/efi/libstub/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ KASAN_SANITIZE := n
lib-y := efi-stub-helper.o
lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o

CFLAGS_fdt.o += -I$(srctree)/scripts/dtc/libfdt/

#
# arm64 puts the stub in the kernel proper, which will unnecessarily retain all
# code indefinitely unless it is annotated as __init/__initdata/__initconst etc.
Expand Down
17 changes: 11 additions & 6 deletions drivers/of/Kconfig
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
config DTC
bool

config OF
bool
menuconfig OF
bool "Device Tree and Open Firmware support"
help
This option enables the device tree infrastructure.
It is automatically selected by platforms that need it or can
be enabled manually for unittests, overlays or
compile-coverage.

menu "Device Tree and Open Firmware support"
depends on OF
if OF

config OF_UNITTEST
bool "Device Tree runtime unit tests"
depends on OF_IRQ && OF_EARLY_FLATTREE
depends on OF_IRQ
select OF_EARLY_FLATTREE
select OF_RESOLVE
help
This option builds in test cases for the device tree infrastructure
Expand Down Expand Up @@ -97,4 +102,4 @@ config OF_OVERLAY
While this option is selected automatically when needed, you can
enable it manually to improve device tree unit test coverage.

endmenu # OF
endif # OF
3 changes: 0 additions & 3 deletions drivers/of/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,3 @@ obj-$(CONFIG_OF_RESOLVE) += resolver.o
obj-$(CONFIG_OF_OVERLAY) += overlay.o

obj-$(CONFIG_OF_UNITTEST) += unittest-data/

CFLAGS_fdt.o = -I$(src)/../../scripts/dtc/libfdt
CFLAGS_fdt_address.o = -I$(src)/../../scripts/dtc/libfdt
2 changes: 1 addition & 1 deletion drivers/of/address.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ int __weak pci_register_io_range(phys_addr_t addr, resource_size_t size)
}

/* add the range to the list */
range = kzalloc(sizeof(*range), GFP_KERNEL);
range = kzalloc(sizeof(*range), GFP_ATOMIC);
if (!range) {
err = -ENOMEM;
goto end_register;
Expand Down
2 changes: 1 addition & 1 deletion drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ EXPORT_SYMBOL(of_n_size_cells);
#ifdef CONFIG_NUMA
int __weak of_node_to_nid(struct device_node *np)
{
return numa_node_id();
return NUMA_NO_NODE;
}
#endif

Expand Down
12 changes: 12 additions & 0 deletions drivers/of/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,18 @@ void of_device_unregister(struct platform_device *ofdev)
}
EXPORT_SYMBOL(of_device_unregister);

const void *of_device_get_match_data(const struct device *dev)
{
const struct of_device_id *match;

match = of_match_device(dev->driver->of_match_table, dev);
if (!match)
return NULL;

return match->data;
}
EXPORT_SYMBOL(of_device_get_match_data);

ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len)
{
const char *compat;
Expand Down
22 changes: 18 additions & 4 deletions drivers/of/fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,14 @@ static void *unflatten_dt_alloc(void **mem, unsigned long size,
* unflatten_dt_node - Alloc and populate a device_node from the flat tree
* @blob: The parent device tree blob
* @mem: Memory chunk to use for allocating device nodes and properties
* @p: pointer to node in flat tree
* @poffset: pointer to node in flat tree
* @dad: Parent struct device_node
* @nodepp: The device_node tree created by the call
* @fpsize: Size of the node path up at the current depth.
* @dryrun: If true, do not allocate device nodes but still calculate needed
* memory size
*/
static void * unflatten_dt_node(void *blob,
static void * unflatten_dt_node(const void *blob,
void *mem,
int *poffset,
struct device_node *dad,
Expand Down Expand Up @@ -378,7 +381,7 @@ static void * unflatten_dt_node(void *blob,
* @dt_alloc: An allocator that provides a virtual address to memory
* for the resulting tree
*/
static void __unflatten_device_tree(void *blob,
static void __unflatten_device_tree(const void *blob,
struct device_node **mynodes,
void * (*dt_alloc)(u64 size, u64 align))
{
Expand Down Expand Up @@ -441,7 +444,7 @@ static void *kernel_tree_alloc(u64 size, u64 align)
* pointers of the nodes so the normal device-tree walking functions
* can be used.
*/
void of_fdt_unflatten_tree(unsigned long *blob,
void of_fdt_unflatten_tree(const unsigned long *blob,
struct device_node **mynodes)
{
__unflatten_device_tree(blob, mynodes, &kernel_tree_alloc);
Expand Down Expand Up @@ -1024,13 +1027,24 @@ void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align)
return __va(memblock_alloc(size, align));
}
#else
void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
{
WARN_ON(1);
}

int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base,
phys_addr_t size, bool nomap)
{
pr_err("Reserved memory not supported, ignoring range 0x%pa - 0x%pa%s\n",
&base, &size, nomap ? " (nomap)" : "");
return -ENOSYS;
}

void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align)
{
WARN_ON(1);
return NULL;
}
#endif

bool __init early_init_dt_verify(void *params)
Expand Down
9 changes: 4 additions & 5 deletions drivers/of/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,6 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
* Successfully parsed an interrrupt-map translation; copy new
* interrupt specifier into the out_irq structure
*/
out_irq->np = newpar;

match_array = imap - newaddrsize - newintsize;
for (i = 0; i < newintsize; i++)
out_irq->args[i] = be32_to_cpup(imap - newintsize + i);
Expand All @@ -262,6 +260,7 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)

skiplevel:
/* Iterate again with new parent */
out_irq->np = newpar;
pr_debug(" -> new parent: %s\n", of_node_full_name(newpar));
of_node_put(ipar);
ipar = newpar;
Expand Down Expand Up @@ -469,7 +468,7 @@ int of_irq_to_resource_table(struct device_node *dev, struct resource *res,
}
EXPORT_SYMBOL_GPL(of_irq_to_resource_table);

struct intc_desc {
struct of_intc_desc {
struct list_head list;
struct device_node *dev;
struct device_node *interrupt_parent;
Expand All @@ -485,7 +484,7 @@ struct intc_desc {
void __init of_irq_init(const struct of_device_id *matches)
{
struct device_node *np, *parent = NULL;
struct intc_desc *desc, *temp_desc;
struct of_intc_desc *desc, *temp_desc;
struct list_head intc_desc_list, intc_parent_list;

INIT_LIST_HEAD(&intc_desc_list);
Expand All @@ -496,7 +495,7 @@ void __init of_irq_init(const struct of_device_id *matches)
!of_device_is_available(np))
continue;
/*
* Here, we allocate and populate an intc_desc with the node
* Here, we allocate and populate an of_intc_desc with the node
* pointer, interrupt-parent device_node etc.
*/
desc = kzalloc(sizeof(*desc), GFP_KERNEL);
Expand Down
6 changes: 3 additions & 3 deletions drivers/of/overlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ static DEFINE_IDR(ov_idr);
* of the overlay in a list. This list can be used to prevent
* illegal overlay removals.
*
* Returns the id of the created overlay, or an negative error number
* Returns the id of the created overlay, or a negative error number
*/
int of_overlay_create(struct device_node *tree)
{
Expand Down Expand Up @@ -481,7 +481,7 @@ static int overlay_removal_is_ok(struct of_overlay *ov)
*
* Removes an overlay if it is permissible.
*
* Returns 0 on success, or an negative error number
* Returns 0 on success, or a negative error number
*/
int of_overlay_destroy(int id)
{
Expand Down Expand Up @@ -528,7 +528,7 @@ EXPORT_SYMBOL_GPL(of_overlay_destroy);
*
* Removes all overlays from the system in the correct order.
*
* Returns 0 on success, or an negative error number
* Returns 0 on success, or a negative error number
*/
int of_overlay_destroy_all(void)
{
Expand Down
4 changes: 4 additions & 0 deletions include/linux/libfdt_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

#include <asm/byteorder.h>

typedef __be16 fdt16_t;
typedef __be32 fdt32_t;
typedef __be64 fdt64_t;

#define fdt32_to_cpu(x) be32_to_cpu(x)
#define cpu_to_fdt32(x) cpu_to_be32(x)
#define fdt64_to_cpu(x) be64_to_cpu(x)
Expand Down
24 changes: 16 additions & 8 deletions include/linux/of.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ extern struct device_node *of_aliases;
extern struct device_node *of_stdout;
extern raw_spinlock_t devtree_lock;

/* flag descriptions (need to be visible even when !CONFIG_OF) */
#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
#define OF_DETACHED 2 /* node has been detached from the device tree */
#define OF_POPULATED 3 /* device already created for the node */
#define OF_POPULATED_BUS 4 /* of_platform_populate recursed to children of this node */

#ifdef CONFIG_OF
void of_core_init(void);

Expand Down Expand Up @@ -219,12 +225,6 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
#define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
#endif

/* flag descriptions */
#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
#define OF_DETACHED 2 /* node has been detached from the device tree */
#define OF_POPULATED 3 /* device already created for the node */
#define OF_POPULATED_BUS 4 /* of_platform_populate recursed to children of this node */

#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)

Expand Down Expand Up @@ -428,6 +428,11 @@ static inline struct device_node *of_find_node_opts_by_path(const char *path,
return NULL;
}

static inline struct device_node *of_find_node_by_phandle(phandle handle)
{
return NULL;
}

static inline struct device_node *of_get_parent(const struct device_node *node)
{
return NULL;
Expand Down Expand Up @@ -673,7 +678,10 @@ static inline void of_property_clear_flag(struct property *p, unsigned long flag
#if defined(CONFIG_OF) && defined(CONFIG_NUMA)
extern int of_node_to_nid(struct device_node *np);
#else
static inline int of_node_to_nid(struct device_node *device) { return 0; }
static inline int of_node_to_nid(struct device_node *device)
{
return NUMA_NO_NODE;
}
#endif

static inline struct device_node *of_find_matching_node(
Expand Down Expand Up @@ -821,7 +829,7 @@ static inline int of_property_read_string_index(struct device_node *np,
* @propname: name of the property to be searched.
*
* Search for a property in a device node.
* Returns true if the property exist false otherwise.
* Returns true if the property exists false otherwise.
*/
static inline bool of_property_read_bool(const struct device_node *np,
const char *propname)
Expand Down
7 changes: 7 additions & 0 deletions include/linux/of_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ extern int of_device_add(struct platform_device *pdev);
extern int of_device_register(struct platform_device *ofdev);
extern void of_device_unregister(struct platform_device *ofdev);

extern const void *of_device_get_match_data(const struct device *dev);

extern ssize_t of_device_get_modalias(struct device *dev,
char *str, ssize_t len);

Expand Down Expand Up @@ -65,6 +67,11 @@ static inline int of_driver_match_device(struct device *dev,
static inline void of_device_uevent(struct device *dev,
struct kobj_uevent_env *env) { }

static inline const void *of_device_get_match_data(const struct device *dev)
{
return NULL;
}

static inline int of_device_get_modalias(struct device *dev,
char *str, ssize_t len)
{
Expand Down
2 changes: 1 addition & 1 deletion include/linux/of_fdt.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern bool of_fdt_is_big_endian(const void *blob,
unsigned long node);
extern int of_fdt_match(const void *blob, unsigned long node,
const char *const *compat);
extern void of_fdt_unflatten_tree(unsigned long *blob,
extern void of_fdt_unflatten_tree(const unsigned long *blob,
struct device_node **mynodes);

/* TBD: Temporary export of fdt globals - remove when code fully merged */
Expand Down
Loading

0 comments on commit 4da3064

Please sign in to comment.