Commit 10d0c970 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull devicetree updates from Rob Herring:
 "DeviceTree updates for 3.13.  This is a bit larger pull request than
  usual for this cycle with lots of clean-up.

   - Cross arch clean-up and consolidation of early DT scanning code.
   - Clean-up and removal of arch prom.h headers.  Makes arch specific
     prom.h optional on all but Sparc.
   - Addition of interrupts-extended property for devices connected to
     multiple interrupt controllers.
   - Refactoring of DT interrupt parsing code in preparation for
     deferred probe of interrupts.
   - ARM cpu and cpu topology bindings documentation.
   - Various DT vendor binding documentation updates"

* tag 'devicetree-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (82 commits)
  powerpc: add missing explicit OF includes for ppc
  dt/irq: add empty of_irq_count for !OF_IRQ
  dt: disable self-tests for !OF_IRQ
  of: irq: Fix interrupt-map entry matching
  MIPS: Netlogic: replace early_init_devtree() call
  of: Add Panasonic Corporation vendor prefix
  of: Add Chunghwa Picture Tubes Ltd. vendor prefix
  of: Add AU Optronics Corporation vendor prefix
  of/irq: Fix potential buffer overflow
  of/irq: Fix bug in interrupt parsing refactor.
  of: set dma_mask to point to coherent_dma_mask
  of: add vendor prefix for PHYTEC Messtechnik GmbH
  DT: sort vendor-prefixes.txt
  of: Add vendor prefix for Cadence
  of: Add empty for_each_available_child_of_node() macro definition
  arm/versatile: Fix versatile irq specifications.
  of/irq: create interrupts-extended property
  microblaze/pci: Drop PowerPC-ism from irq parsing
  of/irq: Create of_irq_parse_and_map_pci() to consolidate arch code.
  of/irq: Use irq_of_parse_and_map()
  ...
parents 85b656cf c11eede6
This diff is collapsed.
...@@ -4,16 +4,33 @@ Specifying interrupt information for devices ...@@ -4,16 +4,33 @@ Specifying interrupt information for devices
1) Interrupt client nodes 1) Interrupt client nodes
------------------------- -------------------------
Nodes that describe devices which generate interrupts must contain an Nodes that describe devices which generate interrupts must contain an either an
"interrupts" property. This property must contain a list of interrupt "interrupts" property or an "interrupts-extended" property. These properties
specifiers, one per output interrupt. The format of the interrupt specifier is contain a list of interrupt specifiers, one per output interrupt. The format of
determined by the interrupt controller to which the interrupts are routed; see the interrupt specifier is determined by the interrupt controller to which the
section 2 below for details. interrupts are routed; see section 2 below for details.
Example:
interrupt-parent = <&intc1>;
interrupts = <5 0>, <6 0>;
The "interrupt-parent" property is used to specify the controller to which The "interrupt-parent" property is used to specify the controller to which
interrupts are routed and contains a single phandle referring to the interrupt interrupts are routed and contains a single phandle referring to the interrupt
controller node. This property is inherited, so it may be specified in an controller node. This property is inherited, so it may be specified in an
interrupt client node or in any of its parent nodes. interrupt client node or in any of its parent nodes. Interrupts listed in the
"interrupts" property are always in reference to the node's interrupt parent.
The "interrupts-extended" property is a special form for use when a node needs
to reference multiple interrupt parents. Each entry in this property contains
both the parent phandle and the interrupt specifier. "interrupts-extended"
should only be used when a device has multiple interrupt parents.
Example:
interrupts-extended = <&intc1 5 1>, <&intc2 1 0>;
A device node may contain either "interrupts" or "interrupts-extended", but not
both. If both properties are present, then the operating system should log an
error and use only the data in "interrupts".
2) Interrupt controller nodes 2) Interrupt controller nodes
----------------------------- -----------------------------
......
...@@ -12,12 +12,15 @@ amcc Applied Micro Circuits Corporation (APM, formally AMCC) ...@@ -12,12 +12,15 @@ amcc Applied Micro Circuits Corporation (APM, formally AMCC)
apm Applied Micro Circuits Corporation (APM) apm Applied Micro Circuits Corporation (APM)
arm ARM Ltd. arm ARM Ltd.
atmel Atmel Corporation atmel Atmel Corporation
auo AU Optronics Corporation
avago Avago Technologies avago Avago Technologies
bosch Bosch Sensortec GmbH bosch Bosch Sensortec GmbH
brcm Broadcom Corporation brcm Broadcom Corporation
capella Capella Microsystems, Inc capella Capella Microsystems, Inc
cavium Cavium, Inc. cavium Cavium, Inc.
cdns Cadence Design Systems Inc.
chrp Common Hardware Reference Platform chrp Common Hardware Reference Platform
chunghwa Chunghwa Picture Tubes Ltd.
cirrus Cirrus Logic, Inc. cirrus Cirrus Logic, Inc.
cortina Cortina Systems, Inc. cortina Cortina Systems, Inc.
dallas Maxim Integrated Products (formerly Dallas Semiconductor) dallas Maxim Integrated Products (formerly Dallas Semiconductor)
...@@ -46,6 +49,8 @@ nintendo Nintendo ...@@ -46,6 +49,8 @@ nintendo Nintendo
nvidia NVIDIA nvidia NVIDIA
nxp NXP Semiconductors nxp NXP Semiconductors
onnn ON Semiconductor Corp. onnn ON Semiconductor Corp.
panasonic Panasonic Corporation
phytec PHYTEC Messtechnik GmbH
picochip Picochip Ltd picochip Picochip Ltd
powervr PowerVR (deprecated, use img) powervr PowerVR (deprecated, use img)
qca Qualcomm Atheros, Inc. qca Qualcomm Atheros, Inc.
...@@ -65,12 +70,12 @@ snps Synopsys, Inc. ...@@ -65,12 +70,12 @@ snps Synopsys, Inc.
st STMicroelectronics st STMicroelectronics
ste ST-Ericsson ste ST-Ericsson
stericsson ST-Ericsson stericsson ST-Ericsson
toumaz Toumaz
ti Texas Instruments ti Texas Instruments
toshiba Toshiba Corporation toshiba Toshiba Corporation
toumaz Toumaz
v3 V3 Semiconductor v3 V3 Semiconductor
via VIA Technologies, Inc. via VIA Technologies, Inc.
winbond Winbond Electronics corp.
wlf Wolfson Microelectronics wlf Wolfson Microelectronics
wm Wondermedia Technologies, Inc. wm Wondermedia Technologies, Inc.
winbond Winbond Electronics corp.
xlnx Xilinx xlnx Xilinx
...@@ -51,22 +51,12 @@ struct machine_desc { ...@@ -51,22 +51,12 @@ struct machine_desc {
/* /*
* Current machine - only accessible during boot. * Current machine - only accessible during boot.
*/ */
extern struct machine_desc *machine_desc; extern const struct machine_desc *machine_desc;
/* /*
* Machine type table - also only accessible during boot * Machine type table - also only accessible during boot
*/ */
extern struct machine_desc __arch_info_begin[], __arch_info_end[]; extern const struct machine_desc __arch_info_begin[], __arch_info_end[];
#define for_each_machine_desc(p) \
for (p = __arch_info_begin; p < __arch_info_end; p++)
static inline struct machine_desc *default_machine_desc(void)
{
/* the default machine is the last one linked in */
if (__arch_info_end - 1 < __arch_info_begin)
return NULL;
return __arch_info_end - 1;
}
/* /*
* Set of macros to define architecture features. * Set of macros to define architecture features.
...@@ -81,7 +71,6 @@ __attribute__((__section__(".arch.info.init"))) = { \ ...@@ -81,7 +71,6 @@ __attribute__((__section__(".arch.info.init"))) = { \
#define MACHINE_END \ #define MACHINE_END \
}; };
extern struct machine_desc *setup_machine_fdt(void *dt); extern const struct machine_desc *setup_machine_fdt(void *dt);
extern void __init copy_devtree(void);
#endif #endif
/*
* Copyright (C) 2012 Synopsys, Inc. (www.synopsys.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _ASM_ARC_PROM_H_
#define _ASM_ARC_PROM_H_
#define HAVE_ARCH_DEVTREE_FIXUPS
#endif
...@@ -14,10 +14,22 @@ ...@@ -14,10 +14,22 @@
#include <linux/memblock.h> #include <linux/memblock.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_fdt.h> #include <linux/of_fdt.h>
#include <asm/prom.h>
#include <asm/clk.h> #include <asm/clk.h>
#include <asm/mach_desc.h> #include <asm/mach_desc.h>
static const void * __init arch_get_next_mach(const char *const **match)
{
static const struct machine_desc *mdesc = __arch_info_begin;
const struct machine_desc *m = mdesc;
if (m >= __arch_info_end)
return NULL;
mdesc++;
*match = m->dt_compat;
return m;
}
/** /**
* setup_machine_fdt - Machine setup when an dtb was passed to the kernel * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
* @dt: virtual address pointer to dt blob * @dt: virtual address pointer to dt blob
...@@ -25,93 +37,24 @@ ...@@ -25,93 +37,24 @@
* If a dtb was passed to the kernel, then use it to choose the correct * If a dtb was passed to the kernel, then use it to choose the correct
* machine_desc and to setup the system. * machine_desc and to setup the system.
*/ */
struct machine_desc * __init setup_machine_fdt(void *dt) const struct machine_desc * __init setup_machine_fdt(void *dt)
{ {
struct boot_param_header *devtree = dt; const struct machine_desc *mdesc;
struct machine_desc *mdesc = NULL, *mdesc_best = NULL;
unsigned int score, mdesc_score = ~1;
unsigned long dt_root; unsigned long dt_root;
const char *model, *compat;
void *clk; void *clk;
char manufacturer[16];
unsigned long len; unsigned long len;
/* check device tree validity */ if (!early_init_dt_scan(dt))
if (be32_to_cpu(devtree->magic) != OF_DT_HEADER)
return NULL; return NULL;
initial_boot_params = devtree; mdesc = of_flat_dt_match_machine(NULL, arch_get_next_mach);
dt_root = of_get_flat_dt_root(); if (!mdesc)
/*
* The kernel could be multi-platform enabled, thus could have many
* "baked-in" machine descriptors. Search thru all for the best
* "compatible" string match.
*/
for_each_machine_desc(mdesc) {
score = of_flat_dt_match(dt_root, mdesc->dt_compat);
if (score > 0 && score < mdesc_score) {
mdesc_best = mdesc;
mdesc_score = score;
}
}
if (!mdesc_best) {
const char *prop;
long size;
pr_err("\n unrecognized device tree list:\n[ ");
prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
if (prop) {
while (size > 0) {
printk("'%s' ", prop);
size -= strlen(prop) + 1;
prop += strlen(prop) + 1;
}
}
printk("]\n\n");
machine_halt(); machine_halt();
}
/* compat = "<manufacturer>,<model>" */
compat = mdesc_best->dt_compat[0];
model = strchr(compat, ',');
if (model)
model++;
strlcpy(manufacturer, compat, model ? model - compat : strlen(compat));
pr_info("Board \"%s\" from %s (Manufacturer)\n", model, manufacturer);
/* Retrieve various information from the /chosen node */
of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
/* Initialize {size,address}-cells info */
of_scan_flat_dt(early_init_dt_scan_root, NULL);
/* Setup memory, calling early_init_dt_add_memory_arch */
of_scan_flat_dt(early_init_dt_scan_memory, NULL);
dt_root = of_get_flat_dt_root();
clk = of_get_flat_dt_prop(dt_root, "clock-frequency", &len); clk = of_get_flat_dt_prop(dt_root, "clock-frequency", &len);
if (clk) if (clk)
arc_set_core_freq(of_read_ulong(clk, len/4)); arc_set_core_freq(of_read_ulong(clk, len/4));
return mdesc_best; return mdesc;
}
/*
* Copy the flattened DT out of .init since unflattening doesn't copy strings
* and the normal DT APIs refs them from orig flat DT
*/
void __init copy_devtree(void)
{
void *alloc = early_init_dt_alloc_memory_arch(
be32_to_cpu(initial_boot_params->totalsize), 64);
if (alloc) {
memcpy(alloc, initial_boot_params,
be32_to_cpu(initial_boot_params->totalsize));
initial_boot_params = alloc;
}
} }
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/prom.h>
#include <asm/unwind.h> #include <asm/unwind.h>
#include <asm/clk.h> #include <asm/clk.h>
#include <asm/mach_desc.h> #include <asm/mach_desc.h>
...@@ -31,7 +30,7 @@ ...@@ -31,7 +30,7 @@
int running_on_hw = 1; /* vs. on ISS */ int running_on_hw = 1; /* vs. on ISS */
char __initdata command_line[COMMAND_LINE_SIZE]; char __initdata command_line[COMMAND_LINE_SIZE];
struct machine_desc *machine_desc; const struct machine_desc *machine_desc;
struct task_struct *_current_task[NR_CPUS]; /* For stack switching */ struct task_struct *_current_task[NR_CPUS]; /* For stack switching */
...@@ -345,8 +344,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -345,8 +344,7 @@ void __init setup_arch(char **cmdline_p)
setup_arch_memory(); setup_arch_memory();
/* copy flat DT out of .init and then unflatten it */ /* copy flat DT out of .init and then unflatten it */
copy_devtree(); unflatten_and_copy_device_tree();
unflatten_device_tree();
/* Can be issue if someone passes cmd line arg "ro" /* Can be issue if someone passes cmd line arg "ro"
* But that is unlikely so keeping it as it is * But that is unlikely so keeping it as it is
......
...@@ -125,10 +125,3 @@ void __init free_initrd_mem(unsigned long start, unsigned long end) ...@@ -125,10 +125,3 @@ void __init free_initrd_mem(unsigned long start, unsigned long end)
free_reserved_area((void *)start, (void *)end, -1, "initrd"); free_reserved_area((void *)start, (void *)end, -1, "initrd");
} }
#endif #endif
#ifdef CONFIG_OF_FLATTREE
void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
{
pr_err("%s(%llx, %llx)\n", __func__, start, end);
}
#endif /* CONFIG_OF_FLATTREE */
/ {
testcase-data {
interrupts {
#address-cells = <1>;
#size-cells = <1>;
test_intc0: intc0 {
interrupt-controller;
#interrupt-cells = <1>;
};
test_intc1: intc1 {
interrupt-controller;
#interrupt-cells = <3>;
};
test_intc2: intc2 {
interrupt-controller;
#interrupt-cells = <2>;
};
test_intmap0: intmap0 {
#interrupt-cells = <1>;
#address-cells = <0>;
interrupt-map = <1 &test_intc0 9>,
<2 &test_intc1 10 11 12>,
<3 &test_intc2 13 14>,
<4 &test_intc2 15 16>;
};
test_intmap1: intmap1 {
#interrupt-cells = <2>;
interrupt-map = <0x5000 1 2 &test_intc0 15>;
};
interrupts0 {
interrupt-parent = <&test_intc0>;
interrupts = <1>, <2>, <3>, <4>;
};
interrupts1 {
interrupt-parent = <&test_intmap0>;
interrupts = <1>, <2>, <3>, <4>;
};
interrupts-extended0 {
reg = <0x5000 0x100>;
interrupts-extended = <&test_intc0 1>,
<&test_intc1 2 3 4>,
<&test_intc2 5 6>,
<&test_intmap0 1>,
<&test_intmap0 2>,
<&test_intmap0 3>,
<&test_intmap1 1 2>;
};
};
};
};
/include/ "tests-phandle.dtsi" /include/ "tests-phandle.dtsi"
/include/ "tests-interrupts.dtsi"
...@@ -185,7 +185,7 @@ aaci@4000 { ...@@ -185,7 +185,7 @@ aaci@4000 {
mmc@5000 { mmc@5000 {
compatible = "arm,primecell"; compatible = "arm,primecell";
reg = < 0x5000 0x1000>; reg = < 0x5000 0x1000>;
interrupts = <22 34>; interrupts-extended = <&vic 22 &sic 2>;
}; };
kmi@6000 { kmi@6000 {
compatible = "arm,pl050", "arm,primecell"; compatible = "arm,pl050", "arm,primecell";
......
...@@ -41,7 +41,7 @@ sci@a000 { ...@@ -41,7 +41,7 @@ sci@a000 {
mmc@b000 { mmc@b000 {
compatible = "arm,primecell"; compatible = "arm,primecell";
reg = <0xb000 0x1000>; reg = <0xb000 0x1000>;
interrupts = <23 34>; interrupts-extended = <&vic 23 &sic 2>;
}; };
}; };
}; };
......
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
#ifndef __ASMARM_PROM_H #ifndef __ASMARM_PROM_H
#define __ASMARM_PROM_H #define __ASMARM_PROM_H
#define HAVE_ARCH_DEVTREE_FIXUPS
#ifdef CONFIG_OF #ifdef CONFIG_OF
extern const struct machine_desc *setup_machine_fdt(unsigned int dt_phys); extern const struct machine_desc *setup_machine_fdt(unsigned int dt_phys);
......
...@@ -174,6 +174,19 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id) ...@@ -174,6 +174,19 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
return (phys_id & MPIDR_HWID_BITMASK) == cpu_logical_map(cpu); return (phys_id & MPIDR_HWID_BITMASK) == cpu_logical_map(cpu);
} }
static const void * __init arch_get_next_mach(const char *const **match)
{
static const struct machine_desc *mdesc = __arch_info_begin;
const struct machine_desc *m = mdesc;
if (m >= __arch_info_end)
return NULL;
mdesc++;
*match = m->dt_compat;
return m;
}
/** /**
* setup_machine_fdt - Machine setup when an dtb was passed to the kernel * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
* @dt_phys: physical address of dt blob * @dt_phys: physical address of dt blob
...@@ -183,11 +196,7 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id) ...@@ -183,11 +196,7 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
*/ */
const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
{ {
struct boot_param_header *devtree;
const struct machine_desc *mdesc, *mdesc_best = NULL; const struct machine_desc *mdesc, *mdesc_best = NULL;
unsigned int score, mdesc_score = ~1;
unsigned long dt_root;
const char *model;
#ifdef CONFIG_ARCH_MULTIPLATFORM #ifdef CONFIG_ARCH_MULTIPLATFORM
DT_MACHINE_START(GENERIC_DT, "Generic DT based system") DT_MACHINE_START(GENERIC_DT, "Generic DT based system")
...@@ -196,32 +205,20 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) ...@@ -196,32 +205,20 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
mdesc_best = &__mach_desc_GENERIC_DT; mdesc_best = &__mach_desc_GENERIC_DT;
#endif #endif
if (!dt_phys) if (!dt_phys || !early_init_dt_scan(phys_to_virt(dt_phys)))
return NULL; return NULL;
devtree = phys_to_virt(dt_phys); mdesc = of_flat_dt_match_machine(mdesc_best, arch_get_next_mach);
/* check device tree validity */ if (!mdesc) {
if (be32_to_cpu(devtree->magic) != OF_DT_HEADER)
return NULL;
/* Search the mdescs for the 'best' compatible value match */
initial_boot_params = devtree;
dt_root = of_get_flat_dt_root();
for_each_machine_desc(mdesc) {
score = of_flat_dt_match(dt_root, mdesc->dt_compat);
if (score > 0 && score < mdesc_score) {
mdesc_best = mdesc;
mdesc_score = score;
}
}
if (!mdesc_best) {
const char *prop; const char *prop;
long size; long size;
unsigned long dt_root;
early_print("\nError: unrecognized/unsupported " early_print("\nError: unrecognized/unsupported "
"device tree compatible list:\n[ "); "device tree compatible list:\n[ ");
dt_root = of_get_flat_dt_root();
prop = of_get_flat_dt_prop(dt_root, "compatible", &size); prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
while (size > 0) { while (size > 0) {
early_print("'%s' ", prop); early_print("'%s' ", prop);
...@@ -233,22 +230,8 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) ...@@ -233,22 +230,8 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
dump_machine_table(); /* does not return */ dump_machine_table(); /* does not return */
} }
model = of_get_flat_dt_prop(dt_root, "model", NULL);
if (!model)
model = of_get_flat_dt_prop(dt_root, "compatible", NULL);
if (!model)
model = "<unknown>";
pr_info("Machine: %s, model: %s\n", mdesc_best->name, model);
/* Retrieve various information from the /chosen node */
of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
/* Initialize {size,address}-cells info */
of_scan_flat_dt(early_init_dt_scan_root, NULL);
/* Setup memory, calling early_init_dt_add_memory_arch */
of_scan_flat_dt(early_init_dt_scan_memory, NULL);
/* Change machine number to match the mdesc we're using */ /* Change machine number to match the mdesc we're using */
__machine_arch_type = mdesc_best->nr; __machine_arch_type = mdesc->nr;
return mdesc_best; return mdesc;
} }
...@@ -808,22 +808,6 @@ static u8 __init pci_v3_swizzle(struct pci_dev *dev, u8 *pinp) ...@@ -808,22 +808,6 @@ static u8 __init pci_v3_swizzle(struct pci_dev *dev, u8 *pinp)
return pci_common_swizzle(dev, pinp); return pci_common_swizzle(dev, pinp);
} }
static int __init pci_v3_map_irq_dt(const struct pci_dev *dev, u8 slot, u8 pin)
{
struct of_irq oirq;
int ret;
ret = of_irq_map_pci(dev, &oirq);
if (ret) {
dev_err(&dev->dev, "of_irq_map_pci() %d\n", ret);
/* Proper return code 0 == NO_IRQ */
return 0;
}
return irq_create_of_mapping(oirq.controller, oirq.specifier,
oirq.size);
}
static struct hw_pci pci_v3 __initdata = { static struct hw_pci pci_v3 __initdata = {
.swizzle = pci_v3_swizzle, .swizzle = pci_v3_swizzle,
.setup = pci_v3_setup, .setup = pci_v3_setup,
...@@ -914,7 +898,7 @@ static int __init pci_v3_probe(struct platform_device *pdev) ...@@ -914,7 +898,7 @@ static int __init pci_v3_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
pci_v3.map_irq = pci_v3_map_irq_dt; pci_v3.map_irq = of_irq_parse_and_map_pci;
pci_common_init_dev(&pdev->dev, &pci_v3); pci_common_init_dev(&pdev->dev, &pci_v3);
return 0; return 0;
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <linux/io.h> #include <linux/io.h>
#include <asm/smp_plat.h> #include <asm/smp_plat.h>
#include <asm/prom.h>
#include "keystone.h" #include "keystone.h"
......
...@@ -358,8 +358,7 @@ static struct delay_timer u300_delay_timer; ...@@ -358,8 +358,7 @@ static struct delay_timer u300_delay_timer;
*/ */
static void __init u300_timer_init_of(struct device_node *np) static void __init u300_timer_init_of(struct device_node *np)
{ {
struct resource irq_res; unsigned int irq;
int irq;
struct clk *clk; struct clk *clk;
unsigned long rate; unsigned long rate;
...@@ -368,11 +367,11 @@ static void __init u300_timer_init_of(struct device_node *np) ...@@ -368,11 +367,11 @@ static void __init u300_timer_init_of(struct device_node *np)
panic("could not ioremap system timer\n"); panic("could not ioremap system timer\n");
/* Get the IRQ for the GP1 timer */ /* Get the IRQ for the GP1 timer */
irq = of_irq_to_resource(np, 2, &irq_res); irq = irq_of_parse_and_map(np, 2);
if (irq <= 0) if (!irq)
panic("no IRQ for system timer\n"); panic("no IRQ for system timer\n");
pr_info("U300 GP1 timer @ base: %p, IRQ: %d\n", u300_timer_base, irq); pr_info("U300 GP1 timer @ base: %p, IRQ: %u\n", u300_timer_base, irq);
/* Clock the interrupt controller */ /* Clock the interrupt controller */
clk = of_clk_get(np, 0); clk = of_clk_get(np, 0);
......
...@@ -76,14 +76,6 @@ static int __init parse_tag_initrd2(const struct tag *tag) ...@@ -76,14 +76,6 @@ static int __init parse_tag_initrd2(const struct tag *tag)
__tagtable(ATAG_INITRD2, parse_tag_initrd2); __tagtable(ATAG_INITRD2, parse_tag_initrd2);
#ifdef CONFIG_OF_FLATTREE
void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
{
phys_initrd_start = start;
phys_initrd_size = end - start;
}
#endif /* CONFIG_OF_FLATTREE */
/* /*
* This keeps memory configuration data used by a couple memory * This keeps memory configuration data used by a couple memory
* initialization functions, as well as show_mem() for the skipping * initialization functions, as well as show_mem() for the skipping
...@@ -350,6 +342,11 @@ void __init arm_memblock_init(struct meminfo *mi, ...@@ -350,6 +342,11 @@ void __init arm_memblock_init(struct meminfo *mi,
memblock_reserve(__pa(_stext), _end - _stext); memblock_reserve(__pa(_stext), _end - _stext);
#endif #endif
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
/* FDT scan will populate initrd_start */
if (initrd_start) {
phys_initrd_start = __virt_to_phys(initrd_start);
phys_initrd_size = initrd_end - initrd_start;
}
if (phys_initrd_size && if (phys_initrd_size &&
!memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) { !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) {
pr_err("INITRD: 0x%08llx+0x%08lx is not a memory region - disabling initrd\n", pr_err("INITRD: 0x%08llx+0x%08lx is not a memory region - disabling initrd\n",
......
...@@ -140,70 +140,18 @@ static void __init setup_processor(void) ...@@ -140,70 +140,18 @@ static void __init setup_processor(void)
static void __init setup_machine_fdt(phys_addr_t dt_phys) static void __init setup_machine_fdt(phys_addr_t dt_phys)
{ {
struct boot_param_header *devtree; if (!dt_phys || !early_init_dt_scan(phys_to_virt(dt_phys))) {
unsigned long dt_root;
/* Check we have a non-NULL DT pointer */
if (!dt_phys) {
early_print("\n"
"Error: NULL or invalid device tree blob\n"
"The dtb must be 8-byte aligned and passed in the first 512MB of memory\n"
"\nPlease check your bootloader.\n");
while (true)
cpu_relax();
}
devtree = phys_to_virt(dt_phys);
/* Check device tree validity */
if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) {
early_print("\n" early_print("\n"
"Error: invalid device tree blob at physical address 0x%p (virtual address 0x%p)\n" "Error: invalid device tree blob at physical address 0x%p (virtual address 0x%p)\n"
"Expected 0x%x, found 0x%x\n" "The dtb must be 8-byte aligned and passed in the first 512MB of memory\n"
"\nPlease check your bootloader.\n", "\nPlease check your bootloader.\n",
dt_phys, devtree, OF_DT_HEADER, dt_phys, phys_to_virt(dt_phys));
be32_to_cpu(devtree->magic));
while (true) while (true)
cpu_relax(); cpu_relax();
} }
initial_boot_params = devtree; machine_name = of_flat_dt_get_machine_name();
dt_root = of_get_flat_dt_root();
machine_name = of_get_flat_dt_prop(dt_root, "model", NULL);
if (!machine_name)
machine_name = of_get_flat_dt_prop(dt_root, "compatible", NULL);
if (!machine_name)
machine_name = "<unknown>";
pr_info("Machine: %s\n", machine_name);
/* Retrieve various information from the /chosen node */
of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
/* Initialize {size,address}-cells info */
of_scan_flat_dt(early_init_dt_scan_root, NULL);
/* Setup memory, calling early_init_dt_add_memory_arch */
of_scan_flat_dt(early_init_dt_scan_memory, NULL);
}
void __init early_init_dt_add_memory_arch(u64 base, u64 size)
{
base &= PAGE_MASK;
size &= PAGE_MASK;
if (base + size < PHYS_OFFSET) {
pr_warning("Ignoring memory block 0x%llx - 0x%llx\n",
base, base + size);
return;
}
if (base < PHYS_OFFSET) {
pr_warning("Ignoring memory range 0x%llx - 0x%llx\n",
base, PHYS_OFFSET);
size -= PHYS_OFFSET - base;
base = PHYS_OFFSET;
}
memblock_add(base, size);
} }
/* /*
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include <linux/sort.h> #include <linux/sort.h>
#include <linux/of_fdt.h> #include <linux/of_fdt.h>
#include <asm/prom.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/sizes.h> #include <asm/sizes.h>
...@@ -39,17 +38,9 @@ ...@@ -39,17 +38,9 @@
#include "mm.h" #include "mm.h"
static unsigned long phys_initrd_start __initdata = 0;
static unsigned long phys_initrd_size __initdata = 0;
phys_addr_t memstart_addr __read_mostly = 0; phys_addr_t memstart_addr __read_mostly = 0;
void __init early_init_dt_setup_initrd_arch(u64 start, u64 end) #ifdef CONFIG_BLK_DEV_INITRD
{
phys_initrd_start = start;
phys_initrd_size = end - start;
}
static int __init early_initrd(char *p) static int __init early_initrd(char *p)
{ {
unsigned long start, size; unsigned long start, size;
...@@ -59,12 +50,13 @@ static int __init early_initrd(char *p) ...@@ -59,12 +50,13 @@ static int __init early_initrd(char *p)
if (*endp == ',') { if (*endp == ',') {
size = memparse(endp + 1, NULL); size = memparse(endp + 1, NULL);
phys_initrd_start = start; initrd_start = (unsigned long)__va(start);
phys_initrd_size = size; initrd_end = (unsigned long)__va(start + size);
} }
return 0; return 0;
} }
early_param("initrd", early_initrd); early_param("initrd", early_initrd);
#endif
#define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT) #define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT)
...@@ -137,13 +129,8 @@ void __init arm64_memblock_init(void) ...@@ -137,13 +129,8 @@ void __init arm64_memblock_init(void)
/* Register the kernel text, kernel data and initrd with memblock */ /* Register the kernel text, kernel data and initrd with memblock */
memblock_reserve(__pa(_text), _end - _text); memblock_reserve(__pa(_text), _end - _text);
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
if (phys_initrd_size) { if (initrd_start)
memblock_reserve(phys_initrd_start, phys_initrd_size); memblock_reserve(__virt_to_phys(initrd_start), initrd_end - initrd_start);
/* Now convert initrd to virtual addresses */
initrd_start = __phys_to_virt(phys_initrd_start);
initrd_end = initrd_start + phys_initrd_size;
}
#endif #endif
/* /*
......
/* dummy prom.h; here to make linux/of.h's #includes happy */
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#include <uapi/asm/setup.h> #include <uapi/asm/setup.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern char c6x_command_line[COMMAND_LINE_SIZE];
extern int c6x_add_memory(phys_addr_t start, unsigned long size); extern int c6x_add_memory(phys_addr_t start, unsigned long size);
extern unsigned long ram_start; extern unsigned long ram_start;
......
...@@ -10,37 +10,8 @@ ...@@ -10,37 +10,8 @@
* *
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
#include <linux/initrd.h>
#include <linux/memblock.h> #include <linux/memblock.h>
void __init early_init_devtree(void *params)
{
/* Setup flat device-tree pointer */
initial_boot_params = params;
/* Retrieve various informations from the /chosen node of the
* device-tree, including the platform type, initrd location and
* size and more ...
*/
of_scan_flat_dt(early_init_dt_scan_chosen, c6x_command_line);
/* Scan memory nodes and rebuild MEMBLOCKs */
of_scan_flat_dt(early_init_dt_scan_root, NULL);
of_scan_flat_dt(early_init_dt_scan_memory, NULL);
}
#ifdef CONFIG_BLK_DEV_INITRD
void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
{
initrd_start = (unsigned long)__va(start);
initrd_end = (unsigned long)__va(end);
initrd_below_start_ok = 1;
}
#endif
void __init early_init_dt_add_memory_arch(u64 base, u64 size) void __init early_init_dt_add_memory_arch(u64 base, u64 size)
{ {
c6x_add_memory(base, size); c6x_add_memory(base, size);
......
...@@ -68,13 +68,6 @@ unsigned long ram_end; ...@@ -68,13 +68,6 @@ unsigned long ram_end;
static unsigned long dma_start __initdata; static unsigned long dma_start __initdata;
static unsigned long dma_size __initdata; static unsigned long dma_size __initdata;
char c6x_command_line[COMMAND_LINE_SIZE];
#if defined(CONFIG_CMDLINE_BOOL)
static const char default_command_line[COMMAND_LINE_SIZE] __section(.cmdline) =
CONFIG_CMDLINE;
#endif
struct cpuinfo_c6x { struct cpuinfo_c6x {
const char *cpu_name; const char *cpu_name;
const char *cpu_voltage; const char *cpu_voltage;
...@@ -294,10 +287,8 @@ notrace void __init machine_init(unsigned long dt_ptr) ...@@ -294,10 +287,8 @@ notrace void __init machine_init(unsigned long dt_ptr)
fdt = dtb; fdt = dtb;
/* Do some early initialization based on the flat device tree */ /* Do some early initialization based on the flat device tree */
early_init_devtree(fdt); early_init_dt_scan(fdt);
/* parse_early_param needs a boot_command_line */
strlcpy(boot_command_line, c6x_command_line, COMMAND_LINE_SIZE);
parse_early_param(); parse_early_param();
} }
...@@ -309,7 +300,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -309,7 +300,7 @@ void __init setup_arch(char **cmdline_p)
printk(KERN_INFO "Initializing kernel\n"); printk(KERN_INFO "Initializing kernel\n");
/* Initialize command line */ /* Initialize command line */
*cmdline_p = c6x_command_line; *cmdline_p = boot_command_line;
memory_end = ram_end; memory_end = ram_end;
memory_end &= ~(PAGE_SIZE - 1); memory_end &= ~(PAGE_SIZE - 1);
......
...@@ -37,12 +37,6 @@ SECTIONS ...@@ -37,12 +37,6 @@ SECTIONS
_vectors_end = .; _vectors_end = .;
} }
. = ALIGN(0x1000);
.cmdline :
{
*(.cmdline)
}
/* /*
* This section contains data which may be shared with other * This section contains data which may be shared with other
* cores. It needs to be a fixed offset from PAGE_OFFSET * cores. It needs to be a fixed offset from PAGE_OFFSET
......
...@@ -32,9 +32,6 @@ ...@@ -32,9 +32,6 @@
#include <asm/hexagon_vm.h> #include <asm/hexagon_vm.h>
#include <asm/vm_mmu.h> #include <asm/vm_mmu.h>
#include <asm/time.h> #include <asm/time.h>
#ifdef CONFIG_OF
#include <asm/prom.h>
#endif
char cmd_line[COMMAND_LINE_SIZE]; char cmd_line[COMMAND_LINE_SIZE];
static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
......
...@@ -53,7 +53,7 @@ struct machine_desc { ...@@ -53,7 +53,7 @@ struct machine_desc {
/* /*
* Current machine - only accessible during boot. * Current machine - only accessible during boot.
*/ */
extern struct machine_desc *machine_desc; extern const struct machine_desc *machine_desc;
/* /*
* Machine type table - also only accessible during boot * Machine type table - also only accessible during boot
......
/*
* arch/metag/include/asm/prom.h
*
* Copyright (C) 2012 Imagination Technologies Ltd.
*
* Based on ARM version:
* Copyright (C) 2009 Canonical Ltd. <jeremy.kerr@canonical.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#ifndef __ASM_METAG_PROM_H
#define __ASM_METAG_PROM_H
#include <asm/setup.h>
#define HAVE_ARCH_DEVTREE_FIXUPS
extern struct machine_desc *setup_machine_fdt(void *dt);
extern void copy_fdt(void);
#endif /* __ASM_METAG_PROM_H */
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <uapi/asm/setup.h> #include <uapi/asm/setup.h>
extern const struct machine_desc *setup_machine_fdt(void *dt);
void per_cpu_trap_init(unsigned long); void per_cpu_trap_init(unsigned long);
extern void __init dump_machine_table(void); extern void __init dump_machine_table(void);
#endif /* _ASM_METAG_SETUP_H */ #endif /* _ASM_METAG_SETUP_H */
...@@ -34,6 +34,19 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) ...@@ -34,6 +34,19 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
return alloc_bootmem_align(size, align); return alloc_bootmem_align(size, align);
} }
static const void * __init arch_get_next_mach(const char *const **match)
{
static const struct machine_desc *mdesc = __arch_info_begin;
const struct machine_desc *m = mdesc;
if (m >= __arch_info_end)
return NULL;
mdesc++;
*match = m->dt_compat;
return m;
}
/** /**
* setup_machine_fdt - Machine setup when an dtb was passed to the kernel * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
* @dt: virtual address pointer to dt blob * @dt: virtual address pointer to dt blob
...@@ -41,74 +54,18 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) ...@@ -41,74 +54,18 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
* If a dtb was passed to the kernel, then use it to choose the correct * If a dtb was passed to the kernel, then use it to choose the correct
* machine_desc and to setup the system. * machine_desc and to setup the system.
*/ */
struct machine_desc * __init setup_machine_fdt(void *dt) const struct machine_desc * __init setup_machine_fdt(void *dt)
{ {
struct boot_param_header *devtree = dt; const struct machine_desc *mdesc;
struct machine_desc *mdesc, *mdesc_best = NULL;
unsigned int score, mdesc_score = ~1;
unsigned long dt_root;
const char *model;
/* check device tree validity */ /* check device tree validity */
if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) if (!early_init_dt_scan(dt))
return NULL; return NULL;
/* Search the mdescs for the 'best' compatible value match */ mdesc = of_flat_dt_match_machine(NULL, arch_get_next_mach);
initial_boot_params = devtree; if (!mdesc)
dt_root = of_get_flat_dt_root();
for_each_machine_desc(mdesc) {
score = of_flat_dt_match(dt_root, mdesc->dt_compat);
if (score > 0 && score < mdesc_score) {
mdesc_best = mdesc;
mdesc_score = score;
}
}
if (!mdesc_best) {
const char *prop;
long size;
pr_err("\nError: unrecognized/unsupported device tree compatible list:\n[ ");
prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
if (prop) {
while (size > 0) {
printk("'%s' ", prop);
size -= strlen(prop) + 1;
prop += strlen(prop) + 1;
}
}
printk("]\n\n");
dump_machine_table(); /* does not return */ dump_machine_table(); /* does not return */
} pr_info("Machine name: %s\n", mdesc->name);
model = of_get_flat_dt_prop(dt_root, "model", NULL);
if (!model)
model = of_get_flat_dt_prop(dt_root, "compatible", NULL);
if (!model)
model = "<unknown>";
pr_info("Machine: %s, model: %s\n", mdesc_best->name, model);
/* Retrieve various information from the /chosen node */
of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
return mdesc_best;
}
/** return mdesc;
* copy_fdt - Copy device tree into non-init memory.
*
* We must copy the flattened device tree blob into non-init memory because the
* unflattened device tree will reference the strings in it directly.
*/
void __init copy_fdt(void)
{
void *alloc = early_init_dt_alloc_memory_arch(
be32_to_cpu(initial_boot_params->totalsize), 0x40);
if (alloc) {
memcpy(alloc, initial_boot_params,
be32_to_cpu(initial_boot_params->totalsize));
initial_boot_params = alloc;
}
} }
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include <asm/mmu.h> #include <asm/mmu.h>
#include <asm/mmzone.h> #include <asm/mmzone.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/prom.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/traps.h> #include <asm/traps.h>
...@@ -115,7 +114,7 @@ extern u32 __dtb_start[]; ...@@ -115,7 +114,7 @@ extern u32 __dtb_start[];
extern struct console dash_console; extern struct console dash_console;
#endif #endif
struct machine_desc *machine_desc __initdata; const struct machine_desc *machine_desc __initdata;
/* /*
* Map a Linux CPU number to a hardware thread ID * Map a Linux CPU number to a hardware thread ID
...@@ -404,9 +403,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -404,9 +403,7 @@ void __init setup_arch(char **cmdline_p)
cpu_2_hwthread_id[smp_processor_id()] = hard_processor_id(); cpu_2_hwthread_id[smp_processor_id()] = hard_processor_id();
hwthread_id_2_cpu[hard_processor_id()] = smp_processor_id(); hwthread_id_2_cpu[hard_processor_id()] = smp_processor_id();
/* Copy device tree blob into non-init memory before unflattening */ unflatten_and_copy_device_tree();
copy_fdt();
unflatten_device_tree();
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
smp_init_cpus(); smp_init_cpus();
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <linux/percpu.h> #include <linux/percpu.h>
#include <linux/memblock.h> #include <linux/memblock.h>
#include <linux/initrd.h> #include <linux/initrd.h>
#include <linux/of_fdt.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/page.h> #include <asm/page.h>
...@@ -405,11 +404,3 @@ void free_initrd_mem(unsigned long start, unsigned long end) ...@@ -405,11 +404,3 @@ void free_initrd_mem(unsigned long start, unsigned long end)
"initrd"); "initrd");
} }
#endif #endif
#ifdef CONFIG_OF_FLATTREE
void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
{
pr_err("%s(%llx, %llx)\n",
__func__, start, end);
}
#endif /* CONFIG_OF_FLATTREE */
...@@ -127,8 +127,6 @@ extern void of_scan_pci_bridge(struct device_node *node, ...@@ -127,8 +127,6 @@ extern void of_scan_pci_bridge(struct device_node *node,
extern void of_scan_bus(struct device_node *node, struct pci_bus *bus); extern void of_scan_bus(struct device_node *node, struct pci_bus *bus);
extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus); extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus);
extern int pci_read_irq_line(struct pci_dev *dev);
extern int pci_bus_find_capability(struct pci_bus *bus, extern int pci_bus_find_capability(struct pci_bus *bus,
unsigned int devfn, int cap); unsigned int devfn, int cap);
......
...@@ -11,19 +11,10 @@ ...@@ -11,19 +11,10 @@
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#include <linux/of.h> /* linux/of.h gets to determine #include ordering */
#ifndef _ASM_MICROBLAZE_PROM_H #ifndef _ASM_MICROBLAZE_PROM_H
#define _ASM_MICROBLAZE_PROM_H #define _ASM_MICROBLAZE_PROM_H
#ifdef __KERNEL__
#ifndef __ASSEMBLY__
#include <linux/types.h>
#include <asm/irq.h>
#include <linux/atomic.h>
#define HAVE_ARCH_DEVTREE_FIXUPS #include <linux/of.h>
/* Other Prototypes */ /* Other Prototypes */
enum early_consoles { enum early_consoles {
...@@ -33,32 +24,4 @@ enum early_consoles { ...@@ -33,32 +24,4 @@ enum early_consoles {
extern int of_early_console(void *version); extern int of_early_console(void *version);
/*
* OF address retreival & translation
*/
#ifdef CONFIG_PCI
extern unsigned long pci_address_to_pio(phys_addr_t address);
#define pci_address_to_pio pci_address_to_pio
#endif /* CONFIG_PCI */
/* Parse the ibm,dma-window property of an OF node into the busno, phys and
* size parameters.
*/
void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
unsigned long *busno, unsigned long *phys, unsigned long *size);
extern void kdump_move_device_tree(void);
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
/* These includes are put at the bottom because they may contain things
* that are overridden by this file. Ideally they shouldn't be included
* by this file, but there are a bunch of .c files that currently depend
* on it. Eventually they will be cleaned up. */
#include <linux/of_fdt.h>
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#endif /* _ASM_MICROBLAZE_PROM_H */ #endif /* _ASM_MICROBLAZE_PROM_H */
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/memblock.h> #include <linux/memblock.h>
#include <linux/of_fdt.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/page.h> #include <asm/page.h>
...@@ -41,11 +42,6 @@ ...@@ -41,11 +42,6 @@
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/pci-bridge.h> #include <asm/pci-bridge.h>
void __init early_init_dt_add_memory_arch(u64 base, u64 size)
{
memblock_add(base, size);
}
#ifdef CONFIG_EARLY_PRINTK #ifdef CONFIG_EARLY_PRINTK
static char *stdout; static char *stdout;
...@@ -106,21 +102,10 @@ void __init early_init_devtree(void *params) ...@@ -106,21 +102,10 @@ void __init early_init_devtree(void *params)
{ {
pr_debug(" -> early_init_devtree(%p)\n", params); pr_debug(" -> early_init_devtree(%p)\n", params);
/* Setup flat device-tree pointer */ early_init_dt_scan(params);
initial_boot_params = params; if (!strlen(boot_command_line))
strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
/* Retrieve various informations from the /chosen node of the
* device-tree, including the platform type, initrd location and
* size, TCE reserve, and more ...
*/
of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line);
/* Scan memory nodes and rebuild MEMBLOCKs */
of_scan_flat_dt(early_init_dt_scan_root, NULL);
of_scan_flat_dt(early_init_dt_scan_memory, NULL);
/* Save command line for /proc/cmdline and then parse parameters */
strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
parse_early_param(); parse_early_param();
memblock_allow_resize(); memblock_allow_resize();
...@@ -130,15 +115,6 @@ void __init early_init_devtree(void *params) ...@@ -130,15 +115,6 @@ void __init early_init_devtree(void *params)
pr_debug(" <- early_init_devtree()\n"); pr_debug(" <- early_init_devtree()\n");
} }
#ifdef CONFIG_BLK_DEV_INITRD
void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
{
initrd_start = (unsigned long)__va(start);
initrd_end = (unsigned long)__va(end);
initrd_below_start_ok = 1;
}
#endif
/******* /*******
* *
* New implementation of the OF "find" APIs, return a refcounted * New implementation of the OF "find" APIs, return a refcounted
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/initrd.h> #include <linux/initrd.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/of_fdt.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/sections.h> #include <asm/sections.h>
...@@ -50,7 +51,7 @@ char cmd_line[COMMAND_LINE_SIZE] __attribute__ ((section(".data"))); ...@@ -50,7 +51,7 @@ char cmd_line[COMMAND_LINE_SIZE] __attribute__ ((section(".data")));
void __init setup_arch(char **cmdline_p) void __init setup_arch(char **cmdline_p)
{ {
*cmdline_p = cmd_line; *cmdline_p = boot_command_line;
console_verbose(); console_verbose();
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/clockchips.h> #include <linux/clockchips.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/of_irq.h>
#include <asm/cpuinfo.h> #include <asm/cpuinfo.h>
#include <linux/cnt32_to_63.h> #include <linux/cnt32_to_63.h>
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/of_pci.h> #include <linux/of_pci.h>
#include <linux/export.h> #include <linux/export.h>
...@@ -192,76 +193,6 @@ void pcibios_set_master(struct pci_dev *dev) ...@@ -192,76 +193,6 @@ void pcibios_set_master(struct pci_dev *dev)
/* No special bus mastering setup handling */ /* No special bus mastering setup handling */
} }
/*
* Reads the interrupt pin to determine if interrupt is use by card.
* If the interrupt is used, then gets the interrupt line from the
* openfirmware and sets it in the pci_dev and pci_config line.
*/
int pci_read_irq_line(struct pci_dev *pci_dev)
{
struct of_irq oirq;
unsigned int virq;
/* The current device-tree that iSeries generates from the HV
* PCI informations doesn't contain proper interrupt routing,
* and all the fallback would do is print out crap, so we
* don't attempt to resolve the interrupts here at all, some
* iSeries specific fixup does it.
*
* In the long run, we will hopefully fix the generated device-tree
* instead.
*/
pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev));
#ifdef DEBUG
memset(&oirq, 0xff, sizeof(oirq));
#endif
/* Try to get a mapping from the device-tree */
if (of_irq_map_pci(pci_dev, &oirq)) {
u8 line, pin;
/* If that fails, lets fallback to what is in the config
* space and map that through the default controller. We
* also set the type to level low since that's what PCI
* interrupts are. If your platform does differently, then
* either provide a proper interrupt tree or don't use this
* function.
*/
if (pci_read_config_byte(pci_dev, PCI_INTERRUPT_PIN, &pin))
return -1;
if (pin == 0)
return -1;
if (pci_read_config_byte(pci_dev, PCI_INTERRUPT_LINE, &line) ||
line == 0xff || line == 0) {
return -1;
}
pr_debug(" No map ! Using line %d (pin %d) from PCI config\n",
line, pin);
virq = irq_create_mapping(NULL, line);
if (virq)
irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW);
} else {
pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
oirq.size, oirq.specifier[0], oirq.specifier[1],
of_node_full_name(oirq.controller));
virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
oirq.size);
}
if (!virq) {
pr_debug(" Failed to map !\n");
return -1;
}
pr_debug(" Mapped to linux irq %d\n", virq);
pci_dev->irq = virq;
return 0;
}
EXPORT_SYMBOL(pci_read_irq_line);
/* /*
* Platform support for /proc/bus/pci/X/Y mmap()s, * Platform support for /proc/bus/pci/X/Y mmap()s,
* modelled on the sparc64 implementation by Dave Miller. * modelled on the sparc64 implementation by Dave Miller.
...@@ -960,7 +891,7 @@ void pcibios_setup_bus_devices(struct pci_bus *bus) ...@@ -960,7 +891,7 @@ void pcibios_setup_bus_devices(struct pci_bus *bus)
dev->dev.archdata.dma_data = (void *)PCI_DRAM_OFFSET; dev->dev.archdata.dma_data = (void *)PCI_DRAM_OFFSET;
/* Read default IRQs and fixup if necessary */ /* Read default IRQs and fixup if necessary */
pci_read_irq_line(dev); dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
} }
} }
......
...@@ -69,6 +69,7 @@ void nlm_hal_init(void); ...@@ -69,6 +69,7 @@ void nlm_hal_init(void);
int xlp_get_dram_map(int n, uint64_t *dram_map); int xlp_get_dram_map(int n, uint64_t *dram_map);
/* Device tree related */ /* Device tree related */
void xlp_early_init_devtree(void);
void *xlp_dt_init(void *fdtp); void *xlp_dt_init(void *fdtp);
static inline int cpu_is_xlpii(void) static inline int cpu_is_xlpii(void)
......
...@@ -17,22 +17,8 @@ ...@@ -17,22 +17,8 @@
#include <linux/types.h> #include <linux/types.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
extern int early_init_dt_scan_memory_arch(unsigned long node,
const char *uname, int depth, void *data);
extern void device_tree_init(void); extern void device_tree_init(void);
static inline unsigned long pci_address_to_pio(phys_addr_t address)
{
/*
* The ioport address can be directly used by inX() / outX()
*/
BUG_ON(address > IO_SPACE_LIMIT);
return (unsigned long) address;
}
#define pci_address_to_pio pci_address_to_pio
struct boot_param_header; struct boot_param_header;
extern void __dt_setup_arch(struct boot_param_header *bph); extern void __dt_setup_arch(struct boot_param_header *bph);
......
...@@ -13,12 +13,9 @@ ...@@ -13,12 +13,9 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/initrd.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_fdt.h> #include <linux/of_fdt.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/prom.h> #include <asm/prom.h>
...@@ -40,13 +37,6 @@ char *mips_get_machine_name(void) ...@@ -40,13 +37,6 @@ char *mips_get_machine_name(void)
} }
#ifdef CONFIG_OF #ifdef CONFIG_OF
int __init early_init_dt_scan_memory_arch(unsigned long node,
const char *uname, int depth,
void *data)
{
return early_init_dt_scan_memory(node, uname, depth, data);
}
void __init early_init_dt_add_memory_arch(u64 base, u64 size) void __init early_init_dt_add_memory_arch(u64 base, u64 size)
{ {
return add_memory_region(base, size, BOOT_MEM_RAM); return add_memory_region(base, size, BOOT_MEM_RAM);
...@@ -57,57 +47,11 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) ...@@ -57,57 +47,11 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)); return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS));
} }
#ifdef CONFIG_BLK_DEV_INITRD
void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
{
initrd_start = (unsigned long)__va(start);
initrd_end = (unsigned long)__va(end);
initrd_below_start_ok = 1;
}
#endif
int __init early_init_dt_scan_model(unsigned long node, const char *uname,
int depth, void *data)
{
if (!depth) {
char *model = of_get_flat_dt_prop(node, "model", NULL);
if (model)
mips_set_machine_name(model);
}
return 0;
}
void __init early_init_devtree(void *params)
{
/* Setup flat device-tree pointer */
initial_boot_params = params;
/* Retrieve various informations from the /chosen node of the
* device-tree, including the platform type, initrd location and
* size, and more ...
*/
of_scan_flat_dt(early_init_dt_scan_chosen, arcs_cmdline);
/* Scan memory nodes */
of_scan_flat_dt(early_init_dt_scan_root, NULL);
of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL);
/* try to load the mips machine name */
of_scan_flat_dt(early_init_dt_scan_model, NULL);
}
void __init __dt_setup_arch(struct boot_param_header *bph) void __init __dt_setup_arch(struct boot_param_header *bph)
{ {
if (be32_to_cpu(bph->magic) != OF_DT_HEADER) { if (!early_init_dt_scan(bph))
pr_err("DTB has bad magic, ignoring builtin OF DTB\n");
return; return;
}
initial_boot_params = bph;
early_init_devtree(initial_boot_params); mips_set_machine_name(of_flat_dt_get_machine_name());
} }
#endif #endif
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/prom.h>
#include <lantiq.h> #include <lantiq.h>
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include <linux/of_fdt.h> #include <linux/of_fdt.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <asm/prom.h>
#include <asm/mips-boards/generic.h> #include <asm/mips-boards/generic.h>
const char *get_system_type(void) const char *get_system_type(void)
......
...@@ -39,8 +39,11 @@ ...@@ -39,8 +39,11 @@
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <asm/prom.h>
extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[], extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[],
__dtb_xlp_fvp_begin[], __dtb_start[]; __dtb_xlp_fvp_begin[], __dtb_start[];
static void *xlp_fdt_blob;
void __init *xlp_dt_init(void *fdtp) void __init *xlp_dt_init(void *fdtp)
{ {
...@@ -67,19 +70,26 @@ void __init *xlp_dt_init(void *fdtp) ...@@ -67,19 +70,26 @@ void __init *xlp_dt_init(void *fdtp)
break; break;
} }
} }
initial_boot_params = fdtp; xlp_fdt_blob = fdtp;
return fdtp; return fdtp;
} }
void __init xlp_early_init_devtree(void)
{
__dt_setup_arch(xlp_fdt_blob);
strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
}
void __init device_tree_init(void) void __init device_tree_init(void)
{ {
unsigned long base, size; unsigned long base, size;
struct boot_param_header *fdtp = xlp_fdt_blob;
if (!initial_boot_params) if (!fdtp)
return; return;
base = virt_to_phys((void *)initial_boot_params); base = virt_to_phys(fdtp);
size = be32_to_cpu(initial_boot_params->totalsize); size = be32_to_cpu(fdtp->totalsize);
/* Before we do anything, lets reserve the dt blob */ /* Before we do anything, lets reserve the dt blob */
reserve_bootmem(base, size, BOOTMEM_DEFAULT); reserve_bootmem(base, size, BOOTMEM_DEFAULT);
......
...@@ -98,7 +98,7 @@ void __init plat_mem_setup(void) ...@@ -98,7 +98,7 @@ void __init plat_mem_setup(void)
pm_power_off = nlm_linux_exit; pm_power_off = nlm_linux_exit;
/* memory and bootargs from DT */ /* memory and bootargs from DT */
early_init_devtree(initial_boot_params); xlp_early_init_devtree();
if (boot_mem_map.nr_map == 0) { if (boot_mem_map.nr_map == 0) {
pr_info("Using DRAM BARs for memory map.\n"); pr_info("Using DRAM BARs for memory map.\n");
......
...@@ -25,16 +25,5 @@ int pcibios_plat_dev_init(struct pci_dev *dev) ...@@ -25,16 +25,5 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
{ {
struct of_irq dev_irq; return of_irq_parse_and_map_pci(dev, slot, pin);
int irq;
if (of_irq_map_pci(dev, &dev_irq)) {
dev_err(&dev->dev, "trying to map irq for unknown slot:%d pin:%d\n",
slot, pin);
return 0;
}
irq = irq_create_of_mapping(dev_irq.controller, dev_irq.specifier,
dev_irq.size);
dev_info(&dev->dev, "SLOT:%d PIN:%d IRQ:%d\n", slot, pin, irq);
return irq;
} }
...@@ -583,29 +583,7 @@ static int rt3883_pci_probe(struct platform_device *pdev) ...@@ -583,29 +583,7 @@ static int rt3883_pci_probe(struct platform_device *pdev)
int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
{ {
struct of_irq dev_irq; return of_irq_parse_and_map_pci(dev, slot, pin);
int err;
int irq;
err = of_irq_map_pci(dev, &dev_irq);
if (err) {
pr_err("pci %s: unable to get irq map, err=%d\n",
pci_name((struct pci_dev *) dev), err);
return 0;
}
irq = irq_create_of_mapping(dev_irq.controller,
dev_irq.specifier,
dev_irq.size);
if (irq == 0)
pr_crit("pci %s: no irq found for pin %u\n",
pci_name((struct pci_dev *) dev), pin);
else
pr_info("pci %s: using irq %d for pin %u\n",
pci_name((struct pci_dev *) dev), irq, pin);
return irq;
} }
int pcibios_plat_dev_init(struct pci_dev *dev) int pcibios_plat_dev_init(struct pci_dev *dev)
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <asm/reboot.h> #include <asm/reboot.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/addrspace.h> #include <asm/addrspace.h>
#include <asm/prom.h>
#include "common.h" #include "common.h"
......
/*
* OpenRISC Linux
*
* Linux architectural port borrowing liberally from similar works of
* others. All original copyrights apply as per the original source
* declaration.
*
* OpenRISC implementation:
* Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
* et al.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef _ASM_OPENRISC_PROM_H
#define _ASM_OPENRISC_PROM_H
#define HAVE_ARCH_DEVTREE_FIXUPS
#endif /* _ASM_OPENRISC_PROM_H */
...@@ -18,83 +18,15 @@ ...@@ -18,83 +18,15 @@
* *
*/ */
#include <stdarg.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/threads.h>
#include <linux/spinlock.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/pci.h>
#include <linux/stringify.h>
#include <linux/delay.h>
#include <linux/initrd.h>
#include <linux/bitops.h>
#include <linux/module.h>
#include <linux/kexec.h>
#include <linux/debugfs.h>
#include <linux/irq.h>
#include <linux/memblock.h> #include <linux/memblock.h>
#include <linux/of_fdt.h> #include <linux/of_fdt.h>
#include <asm/prom.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/processor.h>
#include <asm/irq.h>
#include <linux/io.h>
#include <asm/mmu.h>
#include <asm/pgtable.h>
#include <asm/sections.h>
#include <asm/setup.h>
extern char cmd_line[COMMAND_LINE_SIZE];
void __init early_init_dt_add_memory_arch(u64 base, u64 size)
{
size &= PAGE_MASK;
memblock_add(base, size);
}
void __init early_init_devtree(void *params) void __init early_init_devtree(void *params)
{ {
void *alloc; early_init_dt_scan(params);
/* Setup flat device-tree pointer */
initial_boot_params = params;
/* Retrieve various informations from the /chosen node of the
* device-tree, including the platform type, initrd location and
* size, TCE reserve, and more ...
*/
of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line);
/* Scan memory nodes and rebuild MEMBLOCKs */
of_scan_flat_dt(early_init_dt_scan_root, NULL);
of_scan_flat_dt(early_init_dt_scan_memory, NULL);
/* Save command line for /proc/cmdline and then parse parameters */
strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
memblock_allow_resize(); memblock_allow_resize();
/* We must copy the flattend device tree from init memory to regular
* memory because the device tree references the strings in it
* directly.
*/
alloc = __va(memblock_alloc(initial_boot_params->totalsize, PAGE_SIZE));
memcpy(alloc, initial_boot_params, initial_boot_params->totalsize);
initial_boot_params = alloc;
}
#ifdef CONFIG_BLK_DEV_INITRD
void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
{
initrd_start = (unsigned long)__va(start);
initrd_end = (unsigned long)__va(end);
initrd_below_start_ok = 1;
} }
#endif
...@@ -50,8 +50,6 @@ ...@@ -50,8 +50,6 @@
#include "vmlinux.h" #include "vmlinux.h"
char __initdata cmd_line[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
static unsigned long __init setup_memory(void) static unsigned long __init setup_memory(void)
{ {
unsigned long bootmap_size; unsigned long bootmap_size;
...@@ -285,7 +283,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -285,7 +283,7 @@ void __init setup_arch(char **cmdline_p)
{ {
unsigned long max_low_pfn; unsigned long max_low_pfn;
unflatten_device_tree(); unflatten_and_copy_device_tree();
setup_cpuinfo(); setup_cpuinfo();
...@@ -316,7 +314,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -316,7 +314,7 @@ void __init setup_arch(char **cmdline_p)
conswitchp = &dummy_con; conswitchp = &dummy_con;
#endif #endif
*cmdline_p = cmd_line; *cmdline_p = boot_command_line;
printk(KERN_INFO "OpenRISC Linux -- http://openrisc.net\n"); printk(KERN_INFO "OpenRISC Linux -- http://openrisc.net\n");
} }
......
#include <linux/of.h> /* linux/of.h gets to determine #include ordering */
#ifndef _POWERPC_PROM_H #ifndef _POWERPC_PROM_H
#define _POWERPC_PROM_H #define _POWERPC_PROM_H
#ifdef __KERNEL__ #ifdef __KERNEL__
...@@ -20,21 +19,17 @@ ...@@ -20,21 +19,17 @@
#include <asm/irq.h> #include <asm/irq.h>
#include <linux/atomic.h> #include <linux/atomic.h>
#define HAVE_ARCH_DEVTREE_FIXUPS /* These includes should be removed once implicit includes are cleaned up. */
#include <linux/of.h>
#include <linux/of_fdt.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/platform_device.h>
/* /*
* OF address retreival & translation * OF address retreival & translation
*/ */
/* Translate a DMA address from device space to CPU space */
extern u64 of_translate_dma_address(struct device_node *dev,
const __be32 *in_addr);
#ifdef CONFIG_PCI
extern unsigned long pci_address_to_pio(phys_addr_t address);
#define pci_address_to_pio pci_address_to_pio
#endif /* CONFIG_PCI */
/* Parse the ibm,dma-window property of an OF node into the busno, phys and /* Parse the ibm,dma-window property of an OF node into the busno, phys and
* size parameters. * size parameters.
*/ */
...@@ -44,13 +39,6 @@ void of_parse_dma_window(struct device_node *dn, const __be32 *dma_window, ...@@ -44,13 +39,6 @@ void of_parse_dma_window(struct device_node *dn, const __be32 *dma_window,
extern void kdump_move_device_tree(void); extern void kdump_move_device_tree(void);
#ifdef CONFIG_NUMA
extern int of_node_to_nid(struct device_node *device);
#else
static inline int of_node_to_nid(struct device_node *device) { return 0; }
#endif
#define of_node_to_nid of_node_to_nid
extern void of_instantiate_rtc(void); extern void of_instantiate_rtc(void);
extern int of_get_ibm_chip_id(struct device_node *np); extern int of_get_ibm_chip_id(struct device_node *np);
...@@ -140,14 +128,5 @@ struct of_drconf_cell { ...@@ -140,14 +128,5 @@ struct of_drconf_cell {
*/ */
extern unsigned char ibm_architecture_vec[]; extern unsigned char ibm_architecture_vec[];
/* These includes are put at the bottom because they may contain things
* that are overridden by this file. Ideally they shouldn't be included
* by this file, but there are a bunch of .c files that currently depend
* on it. Eventually they will be cleaned up. */
#include <linux/of_fdt.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _POWERPC_PROM_H */ #endif /* _POWERPC_PROM_H */
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_fdt.h>
#include <asm/epapr_hcalls.h> #include <asm/epapr_hcalls.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/code-patching.h> #include <asm/code-patching.h>
......
...@@ -228,7 +228,7 @@ int pcibios_add_platform_entries(struct pci_dev *pdev) ...@@ -228,7 +228,7 @@ int pcibios_add_platform_entries(struct pci_dev *pdev)
*/ */
static int pci_read_irq_line(struct pci_dev *pci_dev) static int pci_read_irq_line(struct pci_dev *pci_dev)
{ {
struct of_irq oirq; struct of_phandle_args oirq;
unsigned int virq; unsigned int virq;
pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev)); pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev));
...@@ -237,7 +237,7 @@ static int pci_read_irq_line(struct pci_dev *pci_dev) ...@@ -237,7 +237,7 @@ static int pci_read_irq_line(struct pci_dev *pci_dev)
memset(&oirq, 0xff, sizeof(oirq)); memset(&oirq, 0xff, sizeof(oirq));
#endif #endif
/* Try to get a mapping from the device-tree */ /* Try to get a mapping from the device-tree */
if (of_irq_map_pci(pci_dev, &oirq)) { if (of_irq_parse_pci(pci_dev, &oirq)) {
u8 line, pin; u8 line, pin;
/* If that fails, lets fallback to what is in the config /* If that fails, lets fallback to what is in the config
...@@ -263,11 +263,10 @@ static int pci_read_irq_line(struct pci_dev *pci_dev) ...@@ -263,11 +263,10 @@ static int pci_read_irq_line(struct pci_dev *pci_dev)
irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW); irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW);
} else { } else {
pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n", pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
oirq.size, oirq.specifier[0], oirq.specifier[1], oirq.args_count, oirq.args[0], oirq.args[1],
of_node_full_name(oirq.controller)); of_node_full_name(oirq.np));
virq = irq_create_of_mapping(oirq.controller, oirq.specifier, virq = irq_create_of_mapping(&oirq);
oirq.size);
} }
if(virq == NO_IRQ) { if(virq == NO_IRQ) {
pr_debug(" Failed to map !\n"); pr_debug(" Failed to map !\n");
......
...@@ -546,15 +546,6 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) ...@@ -546,15 +546,6 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
memblock_add(base, size); memblock_add(base, size);
} }
#ifdef CONFIG_BLK_DEV_INITRD
void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
{
initrd_start = (unsigned long)__va(start);
initrd_end = (unsigned long)__va(end);
initrd_below_start_ok = 1;
}
#endif
static void __init early_reserve_mem_dt(void) static void __init early_reserve_mem_dt(void)
{ {
unsigned long i, len, dt_root; unsigned long i, len, dt_root;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/of_address.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <asm/mpc5xxx.h> #include <asm/mpc5xxx.h>
#include <asm/mpc5121.h> #include <asm/mpc5121.h>
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/of_address.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <asm/machdep.h> #include <asm/machdep.h>
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/fsl_devices.h> #include <linux/fsl_devices.h>
#include <linux/of_address.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/io.h> #include <linux/io.h>
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/fsl_devices.h> #include <linux/fsl_devices.h>
#include <linux/of_address.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <asm/io.h> #include <asm/io.h>
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <linux/freezer.h> #include <linux/freezer.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/fsl_devices.h> #include <linux/fsl_devices.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/export.h> #include <linux/export.h>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <asm/machdep.h> #include <asm/machdep.h>
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/of_irq.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <sysdev/cpm2_pic.h> #include <sysdev/cpm2_pic.h>
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <asm/machdep.h> #include <asm/machdep.h>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
#include <linux/of_irq.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/kexec.h> #include <linux/kexec.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/cpu.h> #include <linux/cpu.h>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
*/ */
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/io.h> #include <linux/io.h>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <asm/mpic.h> #include <asm/mpic.h>
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/of_address.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <asm/machdep.h> #include <asm/machdep.h>
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/of_address.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <asm/io.h> #include <asm/io.h>
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include <linux/fs_uart_pd.h> #include <linux/fs_uart_pd.h>
#include <linux/fsl_devices.h> #include <linux/fsl_devices.h>
#include <linux/mii.h> #include <linux/mii.h>
#include <linux/of_address.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <asm/delay.h> #include <asm/delay.h>
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/fs_uart_pd.h> #include <linux/fs_uart_pd.h>
#include <linux/fsl_devices.h> #include <linux/fsl_devices.h>
#include <linux/mii.h> #include <linux/mii.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <asm/delay.h> #include <asm/delay.h>
......
...@@ -486,7 +486,6 @@ static __init int celleb_setup_pciex(struct device_node *node, ...@@ -486,7 +486,6 @@ static __init int celleb_setup_pciex(struct device_node *node,
struct pci_controller *phb) struct pci_controller *phb)
{ {
struct resource r; struct resource r;
struct of_irq oirq;
int virq; int virq;
/* SMMIO registers; used inside this file */ /* SMMIO registers; used inside this file */
...@@ -507,12 +506,11 @@ static __init int celleb_setup_pciex(struct device_node *node, ...@@ -507,12 +506,11 @@ static __init int celleb_setup_pciex(struct device_node *node,
phb->ops = &scc_pciex_pci_ops; phb->ops = &scc_pciex_pci_ops;
/* internal interrupt handler */ /* internal interrupt handler */
if (of_irq_map_one(node, 1, &oirq)) { virq = irq_of_parse_and_map(node, 1);
if (!virq) {
pr_err("PCIEXC:Failed to map irq\n"); pr_err("PCIEXC:Failed to map irq\n");
goto error; goto error;
} }
virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
oirq.size);
if (request_irq(virq, pciex_handle_internal_irq, if (request_irq(virq, pciex_handle_internal_irq,
0, "pciex", (void *)phb)) { 0, "pciex", (void *)phb)) {
pr_err("PCIEXC:Failed to request irq\n"); pr_err("PCIEXC:Failed to request irq\n");
......
...@@ -45,7 +45,7 @@ static int __init txx9_serial_init(void) ...@@ -45,7 +45,7 @@ static int __init txx9_serial_init(void)
struct device_node *node; struct device_node *node;
int i; int i;
struct uart_port req; struct uart_port req;
struct of_irq irq; struct of_phandle_args irq;
struct resource res; struct resource res;
for_each_compatible_node(node, "serial", "toshiba,sio-scc") { for_each_compatible_node(node, "serial", "toshiba,sio-scc") {
...@@ -53,7 +53,7 @@ static int __init txx9_serial_init(void) ...@@ -53,7 +53,7 @@ static int __init txx9_serial_init(void)
if (!(txx9_serial_bitmap & (1<<i))) if (!(txx9_serial_bitmap & (1<<i)))
continue; continue;
if (of_irq_map_one(node, i, &irq)) if (of_irq_parse_one(node, i, &irq))
continue; continue;
if (of_address_to_resource(node, if (of_address_to_resource(node,
txx9_scc_tab[i].index, &res)) txx9_scc_tab[i].index, &res))
...@@ -66,8 +66,7 @@ static int __init txx9_serial_init(void) ...@@ -66,8 +66,7 @@ static int __init txx9_serial_init(void)
#ifdef CONFIG_SERIAL_TXX9_CONSOLE #ifdef CONFIG_SERIAL_TXX9_CONSOLE
req.membase = ioremap(req.mapbase, 0x24); req.membase = ioremap(req.mapbase, 0x24);
#endif #endif
req.irq = irq_create_of_mapping(irq.controller, req.irq = irq_create_of_mapping(&irq);
irq.specifier, irq.size);
req.flags |= UPF_IOREMAP | UPF_BUGGY_UART req.flags |= UPF_IOREMAP | UPF_BUGGY_UART
/*HAVE_CTS_LINE*/; /*HAVE_CTS_LINE*/;
req.uartclk = 83300000; req.uartclk = 83300000;
......
...@@ -235,12 +235,9 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic) ...@@ -235,12 +235,9 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic)
/* First, we check whether we have a real "interrupts" in the device /* First, we check whether we have a real "interrupts" in the device
* tree in case the device-tree is ever fixed * tree in case the device-tree is ever fixed
*/ */
struct of_irq oirq; virq = irq_of_parse_and_map(pic->host->of_node, 0);
if (of_irq_map_one(pic->host->of_node, 0, &oirq) == 0) { if (virq)
virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
oirq.size);
return virq; return virq;
}
/* Now do the horrible hacks */ /* Now do the horrible hacks */
tmp = of_get_property(pic->host->of_node, "#interrupt-cells", NULL); tmp = of_get_property(pic->host->of_node, "#interrupt-cells", NULL);
......
...@@ -177,21 +177,20 @@ static int __init spu_map_device_old(struct spu *spu) ...@@ -177,21 +177,20 @@ static int __init spu_map_device_old(struct spu *spu)
static int __init spu_map_interrupts(struct spu *spu, struct device_node *np) static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
{ {
struct of_irq oirq; struct of_phandle_args oirq;
int ret; int ret;
int i; int i;
for (i=0; i < 3; i++) { for (i=0; i < 3; i++) {
ret = of_irq_map_one(np, i, &oirq); ret = of_irq_parse_one(np, i, &oirq);
if (ret) { if (ret) {
pr_debug("spu_new: failed to get irq %d\n", i); pr_debug("spu_new: failed to get irq %d\n", i);
goto err; goto err;
} }
ret = -EINVAL; ret = -EINVAL;
pr_debug(" irq %d no 0x%x on %s\n", i, oirq.specifier[0], pr_debug(" irq %d no 0x%x on %s\n", i, oirq.args[0],
oirq.controller->full_name); oirq.np->full_name);
spu->irqs[i] = irq_create_of_mapping(oirq.controller, spu->irqs[i] = irq_create_of_mapping(&oirq);
oirq.specifier, oirq.size);
if (spu->irqs[i] == NO_IRQ) { if (spu->irqs[i] == NO_IRQ) {
pr_debug("spu_new: failed to map it !\n"); pr_debug("spu_new: failed to map it !\n");
goto err; goto err;
...@@ -200,7 +199,7 @@ static int __init spu_map_interrupts(struct spu *spu, struct device_node *np) ...@@ -200,7 +199,7 @@ static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
return 0; return 0;
err: err:
pr_debug("failed to map irq %x for spu %s\n", *oirq.specifier, pr_debug("failed to map irq %x for spu %s\n", *oirq.args,
spu->name); spu->name);
for (; i >= 0; i--) { for (; i >= 0; i--) {
if (spu->irqs[i] != NO_IRQ) if (spu->irqs[i] != NO_IRQ)
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <asm/io.h> #include <asm/io.h>
#include "flipper-pic.h" #include "flipper-pic.h"
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <asm/io.h> #include <asm/io.h>
#include "hlwd-pic.h" #include "hlwd-pic.h"
......
...@@ -321,8 +321,7 @@ static void hpcd_final_uli5288(struct pci_dev *dev) ...@@ -321,8 +321,7 @@ static void hpcd_final_uli5288(struct pci_dev *dev)
{ {
struct pci_controller *hose = pci_bus_to_host(dev->bus); struct pci_controller *hose = pci_bus_to_host(dev->bus);
struct device_node *hosenode = hose ? hose->dn : NULL; struct device_node *hosenode = hose ? hose->dn : NULL;
struct of_irq oirq; struct of_phandle_args oirq;
int virq, pin = 2;
u32 laddr[3]; u32 laddr[3];
if (!machine_is(mpc86xx_hpcd)) if (!machine_is(mpc86xx_hpcd))
...@@ -331,12 +330,13 @@ static void hpcd_final_uli5288(struct pci_dev *dev) ...@@ -331,12 +330,13 @@ static void hpcd_final_uli5288(struct pci_dev *dev)
if (!hosenode) if (!hosenode)
return; return;
oirq.np = hosenode;
oirq.args[0] = 2;
oirq.args_count = 1;
laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8); laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8);
laddr[1] = laddr[2] = 0; laddr[1] = laddr[2] = 0;
of_irq_map_raw(hosenode, &pin, 1, laddr, &oirq); of_irq_parse_raw(laddr, &oirq);
virq = irq_create_of_mapping(oirq.controller, oirq.specifier, dev->irq = irq_create_of_mapping(&oirq);
oirq.size);
dev->irq = virq;
} }
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, hpcd_quirk_uli1575); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, hpcd_quirk_uli1575);
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/of_address.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/of_irq.h>
#include <asm/pmac_feature.h> #include <asm/pmac_feature.h>
#include <asm/pmac_pfunc.h> #include <asm/pmac_pfunc.h>
......
...@@ -393,8 +393,8 @@ static void __init pmac_pic_probe_oldstyle(void) ...@@ -393,8 +393,8 @@ static void __init pmac_pic_probe_oldstyle(void)
#endif #endif
} }
int of_irq_map_oldworld(struct device_node *device, int index, int of_irq_parse_oldworld(struct device_node *device, int index,
struct of_irq *out_irq) struct of_phandle_args *out_irq)
{ {
const u32 *ints = NULL; const u32 *ints = NULL;
int intlen; int intlen;
...@@ -422,9 +422,9 @@ int of_irq_map_oldworld(struct device_node *device, int index, ...@@ -422,9 +422,9 @@ int of_irq_map_oldworld(struct device_node *device, int index,
if (index >= intlen) if (index >= intlen)
return -EINVAL; return -EINVAL;
out_irq->controller = NULL; out_irq->np = NULL;
out_irq->specifier[0] = ints[index]; out_irq->args[0] = ints[index];
out_irq->size = 1; out_irq->args_count = 1;
return 0; return 0;
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <asm/firmware.h> #include <asm/firmware.h>
#include <asm/xics.h> #include <asm/xics.h>
#include <asm/opal.h> #include <asm/opal.h>
#include <asm/prom.h>
static int opal_lpc_chip_id = -1; static int opal_lpc_chip_id = -1;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/notifier.h> #include <linux/notifier.h>
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_fdt.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/bug.h> #include <linux/bug.h>
......
...@@ -25,7 +25,7 @@ void request_event_sources_irqs(struct device_node *np, ...@@ -25,7 +25,7 @@ void request_event_sources_irqs(struct device_node *np,
const char *name) const char *name)
{ {
int i, index, count = 0; int i, index, count = 0;
struct of_irq oirq; struct of_phandle_args oirq;
const u32 *opicprop; const u32 *opicprop;
unsigned int opicplen; unsigned int opicplen;
unsigned int virqs[16]; unsigned int virqs[16];
...@@ -55,13 +55,11 @@ void request_event_sources_irqs(struct device_node *np, ...@@ -55,13 +55,11 @@ void request_event_sources_irqs(struct device_node *np,
/* Else use normal interrupt tree parsing */ /* Else use normal interrupt tree parsing */
else { else {
/* First try to do a proper OF tree parsing */ /* First try to do a proper OF tree parsing */
for (index = 0; of_irq_map_one(np, index, &oirq) == 0; for (index = 0; of_irq_parse_one(np, index, &oirq) == 0;
index++) { index++) {
if (count > 15) if (count > 15)
break; break;
virqs[count] = irq_create_of_mapping(oirq.controller, virqs[count] = irq_create_of_mapping(&oirq);
oirq.specifier,
oirq.size);
if (virqs[count] == NO_IRQ) { if (virqs[count] == NO_IRQ) {
pr_err("event-sources: Unable to allocate " pr_err("event-sources: Unable to allocate "
"interrupt number for %s\n", "interrupt number for %s\n",
......
...@@ -10,12 +10,14 @@ ...@@ -10,12 +10,14 @@
*/ */
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/memblock.h> #include <linux/memblock.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/memory.h> #include <linux/memory.h>
#include <asm/firmware.h> #include <asm/firmware.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/prom.h>
#include <asm/sparsemem.h> #include <asm/sparsemem.h>
static unsigned long get_memblock_size(void) static unsigned long get_memblock_size(void)
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/export.h> #include <linux/export.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <asm/udbg.h> #include <asm/udbg.h>
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -401,16 +403,15 @@ static int __init fsl_gtm_init(void) ...@@ -401,16 +403,15 @@ static int __init fsl_gtm_init(void)
gtm->clock = *clock; gtm->clock = *clock;
for (i = 0; i < ARRAY_SIZE(gtm->timers); i++) { for (i = 0; i < ARRAY_SIZE(gtm->timers); i++) {
int ret; unsigned int irq;
struct resource irq;
ret = of_irq_to_resource(np, i, &irq); irq = irq_of_parse_and_map(np, i);
if (ret == NO_IRQ) { if (irq == NO_IRQ) {
pr_err("%s: not enough interrupts specified\n", pr_err("%s: not enough interrupts specified\n",
np->full_name); np->full_name);
goto err; goto err;
} }
gtm->timers[i].irq = irq.start; gtm->timers[i].irq = irq;
gtm->timers[i].gtm = gtm; gtm->timers[i].gtm = gtm;
} }
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/of_address.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
struct pmc_regs { struct pmc_regs {
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/slab.h> #include <linux/slab.h>
......
...@@ -535,7 +535,7 @@ static void __init mpic_scan_ht_pic(struct mpic *mpic, u8 __iomem *devbase, ...@@ -535,7 +535,7 @@ static void __init mpic_scan_ht_pic(struct mpic *mpic, u8 __iomem *devbase,
mpic->fixups[irq].data = readl(base + 4) | 0x80000000; mpic->fixups[irq].data = readl(base + 4) | 0x80000000;
} }
} }
static void __init mpic_scan_ht_pics(struct mpic *mpic) static void __init mpic_scan_ht_pics(struct mpic *mpic)
{ {
...@@ -1481,7 +1481,7 @@ struct mpic * __init mpic_alloc(struct device_node *node, ...@@ -1481,7 +1481,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
* as a default instead of the value read from the HW. * as a default instead of the value read from the HW.
*/ */
last_irq = (greg_feature & MPIC_GREG_FEATURE_LAST_SRC_MASK) last_irq = (greg_feature & MPIC_GREG_FEATURE_LAST_SRC_MASK)
>> MPIC_GREG_FEATURE_LAST_SRC_SHIFT; >> MPIC_GREG_FEATURE_LAST_SRC_SHIFT;
if (isu_size) if (isu_size)
last_irq = isu_size * MPIC_MAX_ISU - 1; last_irq = isu_size * MPIC_MAX_ISU - 1;
of_property_read_u32(mpic->node, "last-interrupt-source", &last_irq); of_property_read_u32(mpic->node, "last-interrupt-source", &last_irq);
...@@ -1631,7 +1631,7 @@ void __init mpic_init(struct mpic *mpic) ...@@ -1631,7 +1631,7 @@ void __init mpic_init(struct mpic *mpic)
/* start with vector = source number, and masked */ /* start with vector = source number, and masked */
u32 vecpri = MPIC_VECPRI_MASK | i | u32 vecpri = MPIC_VECPRI_MASK | i |
(8 << MPIC_VECPRI_PRIORITY_SHIFT); (8 << MPIC_VECPRI_PRIORITY_SHIFT);
/* check if protected */ /* check if protected */
if (mpic->protected && test_bit(i, mpic->protected)) if (mpic->protected && test_bit(i, mpic->protected))
continue; continue;
...@@ -1640,7 +1640,7 @@ void __init mpic_init(struct mpic *mpic) ...@@ -1640,7 +1640,7 @@ void __init mpic_init(struct mpic *mpic)
mpic_irq_write(i, MPIC_INFO(IRQ_DESTINATION), 1 << cpu); mpic_irq_write(i, MPIC_INFO(IRQ_DESTINATION), 1 << cpu);
} }
} }
/* Init spurious vector */ /* Init spurious vector */
mpic_write(mpic->gregs, MPIC_INFO(GREG_SPURIOUS), mpic->spurious_vec); mpic_write(mpic->gregs, MPIC_INFO(GREG_SPURIOUS), mpic->spurious_vec);
......
...@@ -237,15 +237,13 @@ static int mpic_msgr_probe(struct platform_device *dev) ...@@ -237,15 +237,13 @@ static int mpic_msgr_probe(struct platform_device *dev)
raw_spin_lock_init(&msgr->lock); raw_spin_lock_init(&msgr->lock);
if (receive_mask & (1 << i)) { if (receive_mask & (1 << i)) {
struct resource irq; msgr->irq = irq_of_parse_and_map(np, irq_index);
if (msgr->irq == NO_IRQ) {
if (of_irq_to_resource(np, irq_index, &irq) == NO_IRQ) {
dev_err(&dev->dev, dev_err(&dev->dev,
"Missing interrupt specifier"); "Missing interrupt specifier");
kfree(msgr); kfree(msgr);
return -EFAULT; return -EFAULT;
} }
msgr->irq = irq.start;
irq_index += 1; irq_index += 1;
} else { } else {
msgr->irq = NO_IRQ; msgr->irq = NO_IRQ;
......
...@@ -35,7 +35,7 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic) ...@@ -35,7 +35,7 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
const struct irq_domain_ops *ops = mpic->irqhost->ops; const struct irq_domain_ops *ops = mpic->irqhost->ops;
struct device_node *np; struct device_node *np;
int flags, index, i; int flags, index, i;
struct of_irq oirq; struct of_phandle_args oirq;
pr_debug("mpic: found U3, guessing msi allocator setup\n"); pr_debug("mpic: found U3, guessing msi allocator setup\n");
...@@ -63,9 +63,9 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic) ...@@ -63,9 +63,9 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
pr_debug("mpic: mapping hwirqs for %s\n", np->full_name); pr_debug("mpic: mapping hwirqs for %s\n", np->full_name);
index = 0; index = 0;
while (of_irq_map_one(np, index++, &oirq) == 0) { while (of_irq_parse_one(np, index++, &oirq) == 0) {
ops->xlate(mpic->irqhost, NULL, oirq.specifier, ops->xlate(mpic->irqhost, NULL, oirq.args,
oirq.size, &hwirq, &flags); oirq.args_count, &hwirq, &flags);
msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, hwirq); msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, hwirq);
} }
} }
......
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_irq.h>
#include <linux/syscore_ops.h> #include <linux/syscore_ops.h>
#include <sysdev/fsl_soc.h> #include <sysdev/fsl_soc.h>
#include <asm/io.h> #include <asm/io.h>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/of_address.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/slab.h> #include <linux/slab.h>
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <asm/rheap.h> #include <asm/rheap.h>
#include <asm/ppc4xx_ocm.h> #include <asm/ppc4xx_ocm.h>
#include <linux/slab.h> #include <linux/slab.h>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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