Skip to content

Commit

Permalink
Merge remote-tracking branch 'robh/for-next' into devicetree/next
Browse files Browse the repository at this point in the history
  • Loading branch information
glikely committed Jun 30, 2015
2 parents ce32f85 + 0b34c1a commit becfc3c
Show file tree
Hide file tree
Showing 53 changed files with 1,832 additions and 1,568 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 @@ -211,3 +211,4 @@ xillybus Xillybus Ltd.
xlnx Xilinx
zyxel ZyXEL Communications Corp.
zarlink Zarlink Semiconductor
zii Zodiac Inflight Innovations
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: 1 addition & 1 deletion arch/mips/include/asm/prom.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#ifndef __ASM_PROM_H
#define __ASM_PROM_H

#ifdef CONFIG_OF
#ifdef CONFIG_USE_OF
#include <linux/bug.h>
#include <linux/io.h>
#include <linux/types.h>
Expand Down
1 change: 1 addition & 0 deletions arch/mips/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/of_fdt.h>
#include <linux/of_platform.h>

#include <asm/bootinfo.h>
#include <asm/page.h>
#include <asm/prom.h>

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
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
17 changes: 14 additions & 3 deletions drivers/of/fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static void *unflatten_dt_alloc(void **mem, unsigned long size,
* @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 @@ -381,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 @@ -444,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 @@ -1018,13 +1018,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
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
19 changes: 12 additions & 7 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
static inline bool is_of_node(struct fwnode_handle *fwnode)
{
Expand Down Expand Up @@ -217,12 +223,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 @@ -422,6 +422,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 @@ -818,7 +823,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 becfc3c

Please sign in to comment.