Skip to content

Commit

Permalink
Merge tag 'devicetree-for-3.16' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/robh/linux into next

Pull DeviceTree updates from Rob Herring:
 - Another round of clean-up of FDT related code in architecture code.
   This removes knowledge of internal FDT details from most
   architectures except powerpc.
 - Conversion of kernel's custom FDT parsing code to use libfdt.
 - DT based initialization for generic serial earlycon.  The
   introduction of generic serial earlycon support went in through the
   tty tree.
 - Improve the platform device naming for DT probed devices to ensure
   unique naming and use parent names instead of a global index.
 - Fix a race condition in of_update_property.
 - Unify the various linker section OF match tables and fix several
   function prototype errors.
 - Update platform_get_irq_byname to work in deferred probe cases.
 - 2 binding doc updates

* tag 'devicetree-for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (58 commits)
  of: handle NULL node in next_child iterators
  of/irq: provide more wrappers for !CONFIG_OF
  devicetree: bindings: Document micrel vendor prefix
  dt: bindings: dwc2: fix required value for the phy-names property
  of_pci_irq: kill useless variable in of_irq_parse_pci()
  of/irq: do irq resolution in platform_get_irq_byname()
  of: Add a testcase for of_find_node_by_path()
  of: Make of_find_node_by_path() handle /aliases
  of: Create unlocked version of for_each_child_of_node()
  lib: add glibc style strchrnul() variant
  of: Handle memory@0 node on PPC32 only
  pci/of: Remove dead code
  of: fix race between search and remove in of_update_property()
  of: Use NULL for pointers
  of: Stop naming platform_device using dcr address
  of: Ensure unique names without sacrificing determinism
  tty/serial: pl011: add DT based earlycon support
  of/fdt: add FDT serial scanning for earlycon
  of/fdt: add FDT address translation support
  serial: earlycon: add DT support
  ...
  • Loading branch information
Linus Torvalds committed Jun 4, 2014
2 parents b77279b + 43cb436 commit d270506
Show file tree
Hide file tree
Showing 76 changed files with 1,008 additions and 838 deletions.
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/usb/dwc2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Refer to clk/clock-bindings.txt for generic clock consumer properties

Optional properties:
- phys: phy provider specifier
- phy-names: shall be "device"
- phy-names: shall be "usb2-phy"
Refer to phy/phy-bindings.txt for generic phy consumer properties

Example:
Expand Down
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/vendor-prefixes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ lsi LSI Corp. (LSI Logic)
lltc Linear Technology Corporation
marvell Marvell Technology Group Ltd.
maxim Maxim Integrated Products
micrel Micrel Inc.
microchip Microchip Technology Inc.
mosaixtech Mosaix Technologies, Inc.
moxa Moxa
Expand Down
1 change: 0 additions & 1 deletion arch/arc/include/asm/sections.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@
#include <asm-generic/sections.h>

extern char __arc_dccm_base[];
extern char __dtb_start[];

#endif
2 changes: 1 addition & 1 deletion arch/arc/kernel/devtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const struct machine_desc * __init setup_machine_fdt(void *dt)
const struct machine_desc *mdesc;
unsigned long dt_root;
void *clk;
unsigned long len;
int len;

if (!early_init_dt_scan(dt))
return NULL;
Expand Down
2 changes: 0 additions & 2 deletions arch/arm/include/asm/prom.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#ifdef CONFIG_OF

extern const struct machine_desc *setup_machine_fdt(unsigned int dt_phys);
extern void arm_dt_memblock_reserve(void);
extern void __init arm_dt_init_cpu_maps(void);

#else /* CONFIG_OF */
Expand All @@ -24,7 +23,6 @@ static inline const struct machine_desc *setup_machine_fdt(unsigned int dt_phys)
return NULL;
}

static inline void arm_dt_memblock_reserve(void) { }
static inline void arm_dt_init_cpu_maps(void) { }

#endif /* CONFIG_OF */
Expand Down
43 changes: 7 additions & 36 deletions arch/arm/kernel/devtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,51 +32,22 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
arm_add_memory(base, size);
}

void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
{
return memblock_virt_alloc(size, align);
}

void __init arm_dt_memblock_reserve(void)
{
u64 *reserve_map, base, size;

if (!initial_boot_params)
return;

/* Reserve the dtb region */
memblock_reserve(virt_to_phys(initial_boot_params),
be32_to_cpu(initial_boot_params->totalsize));
#ifdef CONFIG_SMP
extern struct of_cpu_method __cpu_method_of_table[];

/*
* Process the reserve map. This will probably overlap the initrd
* and dtb locations which are already reserved, but overlaping
* doesn't hurt anything
*/
reserve_map = ((void*)initial_boot_params) +
be32_to_cpu(initial_boot_params->off_mem_rsvmap);
while (1) {
base = be64_to_cpup(reserve_map++);
size = be64_to_cpup(reserve_map++);
if (!size)
break;
memblock_reserve(base, size);
}
}
static const struct of_cpu_method __cpu_method_of_table_sentinel
__used __section(__cpu_method_of_table_end);

#ifdef CONFIG_SMP
extern struct of_cpu_method __cpu_method_of_table_begin[];
extern struct of_cpu_method __cpu_method_of_table_end[];

static int __init set_smp_ops_by_method(struct device_node *node)
{
const char *method;
struct of_cpu_method *m = __cpu_method_of_table_begin;
struct of_cpu_method *m = __cpu_method_of_table;

if (of_property_read_string(node, "enable-method", &method))
return 0;

for (; m < __cpu_method_of_table_end; m++)
for (; m->method; m++)
if (!strcmp(m->method, method)) {
smp_set_ops(m->ops);
return 1;
Expand Down Expand Up @@ -252,7 +223,7 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)

if (!mdesc) {
const char *prop;
long size;
int size;
unsigned long dt_root;

early_print("\nError: unrecognized/unsupported "
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-exynos/exynos.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
{
struct map_desc iodesc;
__be32 *reg;
unsigned long len;
int len;

if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") &&
!of_flat_dt_is_compatible(node, "samsung,exynos5440-clock"))
Expand Down
4 changes: 1 addition & 3 deletions arch/arm/mach-imx/clk-imx35.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,12 @@ int __init mx35_clocks_init(void)
return 0;
}

static int __init mx35_clocks_init_dt(struct device_node *ccm_node)
static void __init mx35_clocks_init_dt(struct device_node *ccm_node)
{
clk_data.clks = clk;
clk_data.clk_num = ARRAY_SIZE(clk);
of_clk_add_provider(ccm_node, of_clk_src_onecell_get, &clk_data);

mx35_clocks_init();

return 0;
}
CLK_OF_DECLARE(imx35, "fsl,imx35-ccm", mx35_clocks_init_dt);
1 change: 0 additions & 1 deletion arch/arm/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ void __init arm_memblock_init(struct meminfo *mi,
#endif

arm_mm_memblock_reserve();
arm_dt_memblock_reserve();

/* reserve any platform specific memblock areas */
if (mdesc->reserve)
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/plat-samsung/s5p-dev-mfc.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ device_initcall(s5p_mfc_memory_init);
int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname,
int depth, void *data)
{
__be32 *prop;
unsigned long len;
const __be32 *prop;
int len;
struct s5p_mfc_dt_meminfo mfc_mem;

if (!data)
Expand Down
21 changes: 0 additions & 21 deletions arch/arm64/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ static void arm64_memory_present(void)

void __init arm64_memblock_init(void)
{
u64 *reserve_map, base, size;

/* Register the kernel text, kernel data and initrd with memblock */
memblock_reserve(__pa(_text), _end - _text);
#ifdef CONFIG_BLK_DEV_INITRD
Expand All @@ -142,25 +140,6 @@ void __init arm64_memblock_init(void)
memblock_reserve(__pa(swapper_pg_dir), SWAPPER_DIR_SIZE);
memblock_reserve(__pa(idmap_pg_dir), IDMAP_DIR_SIZE);

/* Reserve the dtb region */
memblock_reserve(virt_to_phys(initial_boot_params),
be32_to_cpu(initial_boot_params->totalsize));

/*
* Process the reserve map. This will probably overlap the initrd
* and dtb locations which are already reserved, but overlapping
* doesn't hurt anything
*/
reserve_map = ((void*)initial_boot_params) +
be32_to_cpu(initial_boot_params->off_mem_rsvmap);
while (1) {
base = be64_to_cpup(reserve_map++);
size = be64_to_cpup(reserve_map++);
if (!size)
break;
memblock_reserve(base, size);
}

early_init_fdt_scan_reserved_mem();
dma_contiguous_reserve(0);

Expand Down
4 changes: 2 additions & 2 deletions arch/c6x/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ int __init c6x_add_memory(phys_addr_t start, unsigned long size)
*/
notrace void __init machine_init(unsigned long dt_ptr)
{
struct boot_param_header *dtb = __va(dt_ptr);
struct boot_param_header *fdt = (struct boot_param_header *)_fdt_start;
const void *dtb = __va(dt_ptr);
const void *fdt = _fdt_start;

/* interrupts must be masked */
set_creg(IER, 2);
Expand Down
4 changes: 0 additions & 4 deletions arch/metag/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@

extern char _heap_start[];

#ifdef CONFIG_METAG_BUILTIN_DTB
extern u32 __dtb_start[];
#endif

#ifdef CONFIG_DA_CONSOLE
/* Our early channel based console driver */
extern struct console dash_console;
Expand Down
39 changes: 4 additions & 35 deletions arch/microblaze/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
#include <asm/pci-bridge.h>

#ifdef CONFIG_EARLY_PRINTK
static char *stdout;
static const char *stdout;

static int __init early_init_dt_scan_chosen_serial(unsigned long node,
const char *uname, int depth, void *data)
{
unsigned long l;
char *p;
int l;
const char *p;

pr_debug("%s: depth: %d, uname: %s\n", __func__, depth, uname);

Expand Down Expand Up @@ -80,7 +80,7 @@ static int __init early_init_dt_scan_chosen_serial(unsigned long node,
(strncmp(p, "xlnx,opb-uartlite", 17) == 0) ||
(strncmp(p, "xlnx,axi-uartlite", 17) == 0) ||
(strncmp(p, "xlnx,mdm", 8) == 0)) {
unsigned int *addrp;
const unsigned int *addrp;

*(u32 *)data = UARTLITE;

Expand Down Expand Up @@ -114,34 +114,3 @@ void __init early_init_devtree(void *params)

pr_debug(" <- early_init_devtree()\n");
}

/*******
*
* New implementation of the OF "find" APIs, return a refcounted
* object, call of_node_put() when done. The device tree and list
* are protected by a rw_lock.
*
* Note that property management will need some locking as well,
* this isn't dealt with yet.
*
*******/

#if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
static struct debugfs_blob_wrapper flat_dt_blob;

static int __init export_flat_device_tree(void)
{
struct dentry *d;

flat_dt_blob.data = initial_boot_params;
flat_dt_blob.size = initial_boot_params->totalsize;

d = debugfs_create_blob("flat-device-tree", S_IFREG | S_IRUSR,
of_debugfs_root, &flat_dt_blob);
if (!d)
return 1;

return 0;
}
device_initcall(export_flat_device_tree);
#endif
20 changes: 5 additions & 15 deletions arch/mips/cavium-octeon/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,44 +1053,34 @@ void prom_free_prom_memory(void)
int octeon_prune_device_tree(void);

extern const char __dtb_octeon_3xxx_begin;
extern const char __dtb_octeon_3xxx_end;
extern const char __dtb_octeon_68xx_begin;
extern const char __dtb_octeon_68xx_end;
void __init device_tree_init(void)
{
int dt_size;
struct boot_param_header *fdt;
const void *fdt;
bool do_prune;

if (octeon_bootinfo->minor_version >= 3 && octeon_bootinfo->fdt_addr) {
fdt = phys_to_virt(octeon_bootinfo->fdt_addr);
if (fdt_check_header(fdt))
panic("Corrupt Device Tree passed to kernel.");
dt_size = be32_to_cpu(fdt->totalsize);
do_prune = false;
} else if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
fdt = (struct boot_param_header *)&__dtb_octeon_68xx_begin;
dt_size = &__dtb_octeon_68xx_end - &__dtb_octeon_68xx_begin;
fdt = &__dtb_octeon_68xx_begin;
do_prune = true;
} else {
fdt = (struct boot_param_header *)&__dtb_octeon_3xxx_begin;
dt_size = &__dtb_octeon_3xxx_end - &__dtb_octeon_3xxx_begin;
fdt = &__dtb_octeon_3xxx_begin;
do_prune = true;
}

/* Copy the default tree from init memory. */
initial_boot_params = early_init_dt_alloc_memory_arch(dt_size, 8);
if (initial_boot_params == NULL)
panic("Could not allocate initial_boot_params");
memcpy(initial_boot_params, fdt, dt_size);
initial_boot_params = (void *)fdt;

if (do_prune) {
octeon_prune_device_tree();
pr_info("Using internal Device Tree.\n");
} else {
pr_info("Using passed Device Tree.\n");
}
unflatten_device_tree();
unflatten_and_copy_device_tree();
}

static int __initdata disable_octeon_edac_p;
Expand Down
4 changes: 0 additions & 4 deletions arch/mips/include/asm/mips-boards/generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@

extern int mips_revision_sconid;

#ifdef CONFIG_OF
extern struct boot_param_header __dtb_start;
#endif

#ifdef CONFIG_PCI
extern void mips_pcibios_init(void);
#else
Expand Down
6 changes: 3 additions & 3 deletions arch/mips/include/asm/prom.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ extern void device_tree_init(void);

struct boot_param_header;

extern void __dt_setup_arch(struct boot_param_header *bph);
extern void __dt_setup_arch(void *bph);

#define dt_setup_arch(sym) \
({ \
extern struct boot_param_header __dtb_##sym##_begin; \
extern char __dtb_##sym##_begin[]; \
\
__dt_setup_arch(&__dtb_##sym##_begin); \
__dt_setup_arch(__dtb_##sym##_begin); \
})

#else /* CONFIG_OF */
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS));
}

void __init __dt_setup_arch(struct boot_param_header *bph)
void __init __dt_setup_arch(void *bph)
{
if (!early_init_dt_scan(bph))
return;
Expand Down
15 changes: 2 additions & 13 deletions arch/mips/lantiq/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,12 @@ void __init plat_mem_setup(void)
* Load the builtin devicetree. This causes the chosen node to be
* parsed resulting in our memory appearing
*/
__dt_setup_arch(&__dtb_start);
__dt_setup_arch(__dtb_start);
}

void __init device_tree_init(void)
{
unsigned long base, size;

if (!initial_boot_params)
return;

base = virt_to_phys((void *)initial_boot_params);
size = be32_to_cpu(initial_boot_params->totalsize);

/* Before we do anything, lets reserve the dt blob */
reserve_bootmem(base, size, BOOTMEM_DEFAULT);

unflatten_device_tree();
unflatten_and_copy_device_tree();
}

void __init prom_init(void)
Expand Down
2 changes: 0 additions & 2 deletions arch/mips/lantiq/prom.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,4 @@ struct ltq_soc_info {
extern void ltq_soc_detect(struct ltq_soc_info *i);
extern void ltq_soc_init(void);

extern struct boot_param_header __dtb_start;

#endif
Loading

0 comments on commit d270506

Please sign in to comment.