You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6
* 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6: (63 commits) of/platform: Register of_platform_drivers with an "of:" prefix of/address: Clean up function declarations of/spi: call of_register_spi_devices() from spi core code of: Provide default of_node_to_nid() implementation. of/device: Make of_device_make_bus_id() usable by other code. of/irq: Fix endian issues in parsing interrupt specifiers of: Fix phandle endian issues of/flattree: fix of_flat_dt_is_compatible() to match the full compatible string of: remove of_default_bus_ids of: make of_find_device_by_node generic microblaze: remove references to of_device and to_of_device sparc: remove references to of_device and to_of_device powerpc: remove references to of_device and to_of_device of/device: Replace of_device with platform_device in includes and core code of/device: Protect against binding of_platform_drivers to non-OF devices of: remove asm/of_device.h of: remove asm/of_platform.h of/platform: remove all of_bus_type and of_platform_bus_type references of: Merge of_platform_bus_type with platform_bus_type drivercore/of: Add OF style matching to platform bus ... Fix up trivial conflicts in arch/microblaze/kernel/Makefile due to just some obj-y removals by the devicetree branch, while the microblaze updates added a new file.
This commit is contained in:
+2
-15
@@ -18,6 +18,8 @@ config MICROBLAZE
|
||||
select HAVE_DMA_ATTRS
|
||||
select HAVE_DMA_API_DEBUG
|
||||
select TRACING_SUPPORT
|
||||
select OF
|
||||
select OF_FLATTREE
|
||||
|
||||
config SWAP
|
||||
def_bool n
|
||||
@@ -76,9 +78,6 @@ config LOCKDEP_SUPPORT
|
||||
config HAVE_LATENCYTOP_SUPPORT
|
||||
def_bool y
|
||||
|
||||
config DTC
|
||||
def_bool y
|
||||
|
||||
source "init/Kconfig"
|
||||
|
||||
source "kernel/Kconfig.freezer"
|
||||
@@ -125,18 +124,6 @@ config CMDLINE_FORCE
|
||||
Set this to have arguments from the default kernel command string
|
||||
override those passed by the boot loader.
|
||||
|
||||
config OF
|
||||
def_bool y
|
||||
select OF_FLATTREE
|
||||
|
||||
config PROC_DEVICETREE
|
||||
bool "Support for device tree in /proc"
|
||||
depends on PROC_FS
|
||||
help
|
||||
This option adds a device-tree directory under /proc which contains
|
||||
an image of the device tree that the kernel copies from Open
|
||||
Firmware or other boot firmware. If unsure, say Y here.
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Advanced setup"
|
||||
|
||||
@@ -27,17 +27,6 @@ extern unsigned int nr_irq;
|
||||
struct pt_regs;
|
||||
extern void do_IRQ(struct pt_regs *regs);
|
||||
|
||||
/**
|
||||
* irq_of_parse_and_map - Parse and Map an interrupt into linux virq space
|
||||
* @device: Device node of the device whose interrupt is to be mapped
|
||||
* @index: Index of the interrupt to map
|
||||
*
|
||||
* This function is a wrapper that chains of_irq_map_one() and
|
||||
* irq_create_of_mapping() to make things easier to callers
|
||||
*/
|
||||
struct device_node;
|
||||
extern unsigned int irq_of_parse_and_map(struct device_node *dev, int index);
|
||||
|
||||
/** FIXME - not implement
|
||||
* irq_dispose_mapping - Unmap an interrupt
|
||||
* @virq: linux virq number of the interrupt to unmap
|
||||
@@ -62,17 +51,4 @@ struct irq_host;
|
||||
extern unsigned int irq_create_mapping(struct irq_host *host,
|
||||
irq_hw_number_t hwirq);
|
||||
|
||||
/**
|
||||
* irq_create_of_mapping - Map a hardware interrupt into linux virq space
|
||||
* @controller: Device node of the interrupt controller
|
||||
* @inspec: Interrupt specifier from the device-tree
|
||||
* @intsize: Size of the interrupt specifier from the device-tree
|
||||
*
|
||||
* This function is identical to irq_create_mapping except that it takes
|
||||
* as input informations straight from the device-tree (typically the results
|
||||
* of the of_irq_map_*() functions.
|
||||
*/
|
||||
extern unsigned int irq_create_of_mapping(struct device_node *controller,
|
||||
u32 *intspec, unsigned int intsize);
|
||||
|
||||
#endif /* _ASM_MICROBLAZE_IRQ_H */
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2008 Michal Simek <monstr@monstr.eu>
|
||||
*
|
||||
* based on PowerPC of_device.h
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef _ASM_MICROBLAZE_OF_DEVICE_H
|
||||
#define _ASM_MICROBLAZE_OF_DEVICE_H
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/of.h>
|
||||
|
||||
/*
|
||||
* The of_device is a kind of "base class" that is a superset of
|
||||
* struct device for use by devices attached to an OF node and
|
||||
* probed using OF properties.
|
||||
*/
|
||||
struct of_device {
|
||||
struct device dev; /* Generic device interface */
|
||||
struct pdev_archdata archdata;
|
||||
};
|
||||
|
||||
extern ssize_t of_device_get_modalias(struct of_device *ofdev,
|
||||
char *str, ssize_t len);
|
||||
|
||||
extern struct of_device *of_device_alloc(struct device_node *np,
|
||||
const char *bus_id,
|
||||
struct device *parent);
|
||||
|
||||
extern int of_device_uevent(struct device *dev,
|
||||
struct kobj_uevent_env *env);
|
||||
|
||||
extern void of_device_make_bus_id(struct of_device *dev);
|
||||
|
||||
/* This is just here during the transition */
|
||||
#include <linux/of_device.h>
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _ASM_MICROBLAZE_OF_DEVICE_H */
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
|
||||
* <benh@kernel.crashing.org>
|
||||
*
|
||||
* 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_MICROBLAZE_OF_PLATFORM_H
|
||||
#define _ASM_MICROBLAZE_OF_PLATFORM_H
|
||||
|
||||
/* This is just here during the transition */
|
||||
#include <linux/of_platform.h>
|
||||
|
||||
/*
|
||||
* The list of OF IDs below is used for matching bus types in the
|
||||
* system whose devices are to be exposed as of_platform_devices.
|
||||
*
|
||||
* This is the default list valid for most platforms. This file provides
|
||||
* functions who can take an explicit list if necessary though
|
||||
*
|
||||
* The search is always performed recursively looking for children of
|
||||
* the provided device_node and recursively if such a children matches
|
||||
* a bus type in the list
|
||||
*/
|
||||
|
||||
static const struct of_device_id of_default_bus_ids[] = {
|
||||
{ .type = "soc", },
|
||||
{ .compatible = "soc", },
|
||||
{ .type = "plb5", },
|
||||
{ .type = "plb4", },
|
||||
{ .type = "opb", },
|
||||
{ .type = "simple", },
|
||||
{},
|
||||
};
|
||||
|
||||
/* Platform devices and busses creation */
|
||||
extern struct of_device *of_platform_device_create(struct device_node *np,
|
||||
const char *bus_id,
|
||||
struct device *parent);
|
||||
/* pseudo "matches" value to not do deep probe */
|
||||
#define OF_NO_DEEP_PROBE ((struct of_device_id *)-1)
|
||||
|
||||
extern int of_platform_bus_probe(struct device_node *root,
|
||||
const struct of_device_id *matches,
|
||||
struct device *parent);
|
||||
|
||||
extern struct of_device *of_find_device_by_phandle(phandle ph);
|
||||
|
||||
extern void of_instantiate_rtc(void);
|
||||
|
||||
#endif /* _ASM_MICROBLAZE_OF_PLATFORM_H */
|
||||
@@ -47,13 +47,6 @@
|
||||
#define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1)))
|
||||
#define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1)))
|
||||
|
||||
/* align addr on a size boundary - adjust address up/down if needed */
|
||||
#define _ALIGN_UP(addr, size) (((addr)+((size)-1))&(~((size)-1)))
|
||||
#define _ALIGN_DOWN(addr, size) ((addr)&(~((size)-1)))
|
||||
|
||||
/* align addr on a size boundary - adjust address up if needed */
|
||||
#define _ALIGN(addr, size) _ALIGN_UP(addr, size)
|
||||
|
||||
#ifndef CONFIG_MMU
|
||||
/*
|
||||
* PAGE_OFFSET -- the first address of the first page of memory. When not
|
||||
|
||||
@@ -172,13 +172,8 @@ static inline int pci_has_flag(int flag)
|
||||
|
||||
extern struct list_head hose_list;
|
||||
|
||||
extern unsigned long pci_address_to_pio(phys_addr_t address);
|
||||
extern int pcibios_vaddr_is_ioport(void __iomem *address);
|
||||
#else
|
||||
static inline unsigned long pci_address_to_pio(phys_addr_t address)
|
||||
{
|
||||
return (unsigned long)-1;
|
||||
}
|
||||
static inline int pcibios_vaddr_is_ioport(void __iomem *address)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/of_fdt.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/atomic.h>
|
||||
|
||||
@@ -50,29 +47,10 @@ extern void pci_create_OF_bus_map(void);
|
||||
* OF address retreival & translation
|
||||
*/
|
||||
|
||||
/* Translate an OF address block into a CPU physical address
|
||||
*/
|
||||
extern u64 of_translate_address(struct device_node *np, const u32 *addr);
|
||||
|
||||
/* Extract an address from a device, returns the region size and
|
||||
* the address space flags too. The PCI version uses a BAR number
|
||||
* instead of an absolute index
|
||||
*/
|
||||
extern const u32 *of_get_address(struct device_node *dev, int index,
|
||||
u64 *size, unsigned int *flags);
|
||||
extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
|
||||
u64 *size, unsigned int *flags);
|
||||
|
||||
/* Get an address as a resource. Note that if your address is
|
||||
* a PIO address, the conversion will fail if the physical address
|
||||
* can't be internally converted to an IO token with
|
||||
* pci_address_to_pio(), that is because it's either called to early
|
||||
* or it can't be matched to any host bridge IO space
|
||||
*/
|
||||
extern int of_address_to_resource(struct device_node *dev, int index,
|
||||
struct resource *r);
|
||||
extern int of_pci_address_to_resource(struct device_node *dev, int bar,
|
||||
struct resource *r);
|
||||
#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.
|
||||
@@ -88,69 +66,6 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
|
||||
/* Get the MAC address */
|
||||
extern const void *of_get_mac_address(struct device_node *np);
|
||||
|
||||
/*
|
||||
* OF interrupt mapping
|
||||
*/
|
||||
|
||||
/* This structure is returned when an interrupt is mapped. The controller
|
||||
* field needs to be put() after use
|
||||
*/
|
||||
|
||||
#define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */
|
||||
|
||||
struct of_irq {
|
||||
struct device_node *controller; /* Interrupt controller node */
|
||||
u32 size; /* Specifier size */
|
||||
u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
|
||||
};
|
||||
|
||||
/**
|
||||
* of_irq_map_init - Initialize the irq remapper
|
||||
* @flags: flags defining workarounds to enable
|
||||
*
|
||||
* Some machines have bugs in the device-tree which require certain workarounds
|
||||
* to be applied. Call this before any interrupt mapping attempts to enable
|
||||
* those workarounds.
|
||||
*/
|
||||
#define OF_IMAP_OLDWORLD_MAC 0x00000001
|
||||
#define OF_IMAP_NO_PHANDLE 0x00000002
|
||||
|
||||
extern void of_irq_map_init(unsigned int flags);
|
||||
|
||||
/**
|
||||
* of_irq_map_raw - Low level interrupt tree parsing
|
||||
* @parent: the device interrupt parent
|
||||
* @intspec: interrupt specifier ("interrupts" property of the device)
|
||||
* @ointsize: size of the passed in interrupt specifier
|
||||
* @addr: address specifier (start of "reg" property of the device)
|
||||
* @out_irq: structure of_irq filled by this function
|
||||
*
|
||||
* Returns 0 on success and a negative number on error
|
||||
*
|
||||
* This function is a low-level interrupt tree walking function. It
|
||||
* can be used to do a partial walk with synthetized reg and interrupts
|
||||
* properties, for example when resolving PCI interrupts when no device
|
||||
* node exist for the parent.
|
||||
*
|
||||
*/
|
||||
|
||||
extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
|
||||
u32 ointsize, const u32 *addr,
|
||||
struct of_irq *out_irq);
|
||||
|
||||
/**
|
||||
* of_irq_map_one - Resolve an interrupt for a device
|
||||
* @device: the device whose interrupt is to be resolved
|
||||
* @index: index of the interrupt to resolve
|
||||
* @out_irq: structure of_irq filled by this function
|
||||
*
|
||||
* This function resolves an interrupt, walking the tree, for a given
|
||||
* device-tree node. It's the high level pendant to of_irq_map_raw().
|
||||
* It also implements the workarounds for OldWolrd Macs.
|
||||
*/
|
||||
extern int of_irq_map_one(struct device_node *device, int index,
|
||||
struct of_irq *out_irq);
|
||||
|
||||
/**
|
||||
* of_irq_map_pci - Resolve the interrupt for a PCI device
|
||||
* @pdev: the device whose interrupt is to be resolved
|
||||
@@ -163,20 +78,18 @@ extern int of_irq_map_one(struct device_node *device, int index,
|
||||
* resolving using the OF tree walking.
|
||||
*/
|
||||
struct pci_dev;
|
||||
struct of_irq;
|
||||
extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
|
||||
|
||||
extern int of_irq_to_resource(struct device_node *dev, int index,
|
||||
struct resource *r);
|
||||
|
||||
/**
|
||||
* of_iomap - Maps the memory mapped IO for a given device_node
|
||||
* @device: the device whose io range will be mapped
|
||||
* @index: index of the io range
|
||||
*
|
||||
* Returns a pointer to the mapped memory
|
||||
*/
|
||||
extern void __iomem *of_iomap(struct device_node *device, int index);
|
||||
|
||||
#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 */
|
||||
|
||||
@@ -1,11 +1 @@
|
||||
#include <asm-generic/topology.h>
|
||||
|
||||
#ifndef _ASM_MICROBLAZE_TOPOLOGY_H
|
||||
#define _ASM_MICROBLAZE_TOPOLOGY_H
|
||||
|
||||
struct device_node;
|
||||
static inline int of_node_to_nid(struct device_node *device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* _ASM_MICROBLAZE_TOPOLOGY_H */
|
||||
|
||||
@@ -15,8 +15,8 @@ endif
|
||||
extra-y := head.o vmlinux.lds
|
||||
|
||||
obj-y += dma.o exceptions.o \
|
||||
hw_exception_handler.o init_task.o intc.o irq.o of_device.o \
|
||||
of_platform.o process.o prom.o prom_parse.o ptrace.o \
|
||||
hw_exception_handler.o init_task.o intc.o irq.o \
|
||||
process.o prom.o prom_parse.o ptrace.o \
|
||||
reset.o setup.o signal.o sys_microblaze.o timer.o traps.o unwind.o
|
||||
|
||||
obj-y += cpu/
|
||||
|
||||
@@ -17,20 +17,10 @@
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/kernel_stat.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/of_irq.h>
|
||||
|
||||
#include <asm/prom.h>
|
||||
|
||||
unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
|
||||
{
|
||||
struct of_irq oirq;
|
||||
|
||||
if (of_irq_map_one(dev, index, &oirq))
|
||||
return NO_IRQ;
|
||||
|
||||
return oirq.specifier[0];
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
|
||||
|
||||
static u32 concurrent_irq;
|
||||
|
||||
void __irq_entry do_IRQ(struct pt_regs *regs)
|
||||
@@ -106,7 +96,7 @@ unsigned int irq_create_mapping(struct irq_host *host, irq_hw_number_t hwirq)
|
||||
EXPORT_SYMBOL_GPL(irq_create_mapping);
|
||||
|
||||
unsigned int irq_create_of_mapping(struct device_node *controller,
|
||||
u32 *intspec, unsigned int intsize)
|
||||
const u32 *intspec, unsigned int intsize)
|
||||
{
|
||||
return intspec[0];
|
||||
}
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
#include <linux/string.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/of_device.h>
|
||||
|
||||
#include <linux/errno.h>
|
||||
|
||||
void of_device_make_bus_id(struct of_device *dev)
|
||||
{
|
||||
static atomic_t bus_no_reg_magic;
|
||||
struct device_node *node = dev->dev.of_node;
|
||||
const u32 *reg;
|
||||
u64 addr;
|
||||
int magic;
|
||||
|
||||
/*
|
||||
* For MMIO, get the physical address
|
||||
*/
|
||||
reg = of_get_property(node, "reg", NULL);
|
||||
if (reg) {
|
||||
addr = of_translate_address(node, reg);
|
||||
if (addr != OF_BAD_ADDR) {
|
||||
dev_set_name(&dev->dev, "%llx.%s",
|
||||
(unsigned long long)addr, node->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* No BusID, use the node name and add a globally incremented
|
||||
* counter (and pray...)
|
||||
*/
|
||||
magic = atomic_add_return(1, &bus_no_reg_magic);
|
||||
dev_set_name(&dev->dev, "%s.%d", node->name, magic - 1);
|
||||
}
|
||||
EXPORT_SYMBOL(of_device_make_bus_id);
|
||||
|
||||
struct of_device *of_device_alloc(struct device_node *np,
|
||||
const char *bus_id,
|
||||
struct device *parent)
|
||||
{
|
||||
struct of_device *dev;
|
||||
|
||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
dev->dev.of_node = of_node_get(np);
|
||||
dev->dev.dma_mask = &dev->archdata.dma_mask;
|
||||
dev->dev.parent = parent;
|
||||
dev->dev.release = of_release_dev;
|
||||
|
||||
if (bus_id)
|
||||
dev_set_name(&dev->dev, bus_id);
|
||||
else
|
||||
of_device_make_bus_id(dev);
|
||||
|
||||
return dev;
|
||||
}
|
||||
EXPORT_SYMBOL(of_device_alloc);
|
||||
|
||||
int of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||
{
|
||||
struct of_device *ofdev;
|
||||
const char *compat;
|
||||
int seen = 0, cplen, sl;
|
||||
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
ofdev = to_of_device(dev);
|
||||
|
||||
if (add_uevent_var(env, "OF_NAME=%s", ofdev->dev.of_node->name))
|
||||
return -ENOMEM;
|
||||
|
||||
if (add_uevent_var(env, "OF_TYPE=%s", ofdev->dev.of_node->type))
|
||||
return -ENOMEM;
|
||||
|
||||
/* Since the compatible field can contain pretty much anything
|
||||
* it's not really legal to split it out with commas. We split it
|
||||
* up using a number of environment variables instead. */
|
||||
|
||||
compat = of_get_property(ofdev->dev.of_node, "compatible", &cplen);
|
||||
while (compat && *compat && cplen > 0) {
|
||||
if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat))
|
||||
return -ENOMEM;
|
||||
|
||||
sl = strlen(compat) + 1;
|
||||
compat += sl;
|
||||
cplen -= sl;
|
||||
seen++;
|
||||
}
|
||||
|
||||
if (add_uevent_var(env, "OF_COMPATIBLE_N=%d", seen))
|
||||
return -ENOMEM;
|
||||
|
||||
/* modalias is trickier, we add it in 2 steps */
|
||||
if (add_uevent_var(env, "MODALIAS="))
|
||||
return -ENOMEM;
|
||||
sl = of_device_get_modalias(ofdev, &env->buf[env->buflen-1],
|
||||
sizeof(env->buf) - env->buflen);
|
||||
if (sl >= (sizeof(env->buf) - env->buflen))
|
||||
return -ENOMEM;
|
||||
env->buflen += sl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(of_device_uevent);
|
||||
@@ -1,200 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
|
||||
* <benh@kernel.crashing.org>
|
||||
* and Arnd Bergmann, IBM Corp.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
#include <linux/string.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_platform.h>
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/topology.h>
|
||||
#include <asm/atomic.h>
|
||||
|
||||
struct bus_type of_platform_bus_type = {
|
||||
.uevent = of_device_uevent,
|
||||
};
|
||||
EXPORT_SYMBOL(of_platform_bus_type);
|
||||
|
||||
static int __init of_bus_driver_init(void)
|
||||
{
|
||||
return of_bus_type_init(&of_platform_bus_type, "of_platform");
|
||||
}
|
||||
postcore_initcall(of_bus_driver_init);
|
||||
|
||||
struct of_device *of_platform_device_create(struct device_node *np,
|
||||
const char *bus_id,
|
||||
struct device *parent)
|
||||
{
|
||||
struct of_device *dev;
|
||||
|
||||
dev = of_device_alloc(np, bus_id, parent);
|
||||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
dev->archdata.dma_mask = 0xffffffffUL;
|
||||
dev->dev.bus = &of_platform_bus_type;
|
||||
|
||||
/* We do not fill the DMA ops for platform devices by default.
|
||||
* This is currently the responsibility of the platform code
|
||||
* to do such, possibly using a device notifier
|
||||
*/
|
||||
|
||||
if (of_device_register(dev) != 0) {
|
||||
of_device_free(dev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return dev;
|
||||
}
|
||||
EXPORT_SYMBOL(of_platform_device_create);
|
||||
|
||||
/**
|
||||
* of_platform_bus_create - Create an OF device for a bus node and all its
|
||||
* children. Optionally recursively instanciate matching busses.
|
||||
* @bus: device node of the bus to instanciate
|
||||
* @matches: match table, NULL to use the default, OF_NO_DEEP_PROBE to
|
||||
* disallow recursive creation of child busses
|
||||
*/
|
||||
static int of_platform_bus_create(const struct device_node *bus,
|
||||
const struct of_device_id *matches,
|
||||
struct device *parent)
|
||||
{
|
||||
struct device_node *child;
|
||||
struct of_device *dev;
|
||||
int rc = 0;
|
||||
|
||||
for_each_child_of_node(bus, child) {
|
||||
pr_debug(" create child: %s\n", child->full_name);
|
||||
dev = of_platform_device_create(child, NULL, parent);
|
||||
if (dev == NULL)
|
||||
rc = -ENOMEM;
|
||||
else if (!of_match_node(matches, child))
|
||||
continue;
|
||||
if (rc == 0) {
|
||||
pr_debug(" and sub busses\n");
|
||||
rc = of_platform_bus_create(child, matches, &dev->dev);
|
||||
}
|
||||
if (rc) {
|
||||
of_node_put(child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* of_platform_bus_probe - Probe the device-tree for platform busses
|
||||
* @root: parent of the first level to probe or NULL for the root of the tree
|
||||
* @matches: match table, NULL to use the default
|
||||
* @parent: parent to hook devices from, NULL for toplevel
|
||||
*
|
||||
* Note that children of the provided root are not instanciated as devices
|
||||
* unless the specified root itself matches the bus list and is not NULL.
|
||||
*/
|
||||
|
||||
int of_platform_bus_probe(struct device_node *root,
|
||||
const struct of_device_id *matches,
|
||||
struct device *parent)
|
||||
{
|
||||
struct device_node *child;
|
||||
struct of_device *dev;
|
||||
int rc = 0;
|
||||
|
||||
if (matches == NULL)
|
||||
matches = of_default_bus_ids;
|
||||
if (matches == OF_NO_DEEP_PROBE)
|
||||
return -EINVAL;
|
||||
if (root == NULL)
|
||||
root = of_find_node_by_path("/");
|
||||
else
|
||||
of_node_get(root);
|
||||
|
||||
pr_debug("of_platform_bus_probe()\n");
|
||||
pr_debug(" starting at: %s\n", root->full_name);
|
||||
|
||||
/* Do a self check of bus type, if there's a match, create
|
||||
* children
|
||||
*/
|
||||
if (of_match_node(matches, root)) {
|
||||
pr_debug(" root match, create all sub devices\n");
|
||||
dev = of_platform_device_create(root, NULL, parent);
|
||||
if (dev == NULL) {
|
||||
rc = -ENOMEM;
|
||||
goto bail;
|
||||
}
|
||||
pr_debug(" create all sub busses\n");
|
||||
rc = of_platform_bus_create(root, matches, &dev->dev);
|
||||
goto bail;
|
||||
}
|
||||
for_each_child_of_node(root, child) {
|
||||
if (!of_match_node(matches, child))
|
||||
continue;
|
||||
|
||||
pr_debug(" match: %s\n", child->full_name);
|
||||
dev = of_platform_device_create(child, NULL, parent);
|
||||
if (dev == NULL)
|
||||
rc = -ENOMEM;
|
||||
else
|
||||
rc = of_platform_bus_create(child, matches, &dev->dev);
|
||||
if (rc) {
|
||||
of_node_put(child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
bail:
|
||||
of_node_put(root);
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL(of_platform_bus_probe);
|
||||
|
||||
static int of_dev_node_match(struct device *dev, void *data)
|
||||
{
|
||||
return to_of_device(dev)->dev.of_node == data;
|
||||
}
|
||||
|
||||
struct of_device *of_find_device_by_node(struct device_node *np)
|
||||
{
|
||||
struct device *dev;
|
||||
|
||||
dev = bus_find_device(&of_platform_bus_type,
|
||||
NULL, np, of_dev_node_match);
|
||||
if (dev)
|
||||
return to_of_device(dev);
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(of_find_device_by_node);
|
||||
|
||||
static int of_dev_phandle_match(struct device *dev, void *data)
|
||||
{
|
||||
phandle *ph = data;
|
||||
return to_of_device(dev)->dev.of_node->phandle == *ph;
|
||||
}
|
||||
|
||||
struct of_device *of_find_device_by_phandle(phandle ph)
|
||||
{
|
||||
struct device *dev;
|
||||
|
||||
dev = bus_find_device(&of_platform_bus_type,
|
||||
NULL, &ph, of_dev_phandle_match);
|
||||
if (dev)
|
||||
return to_of_device(dev);
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(of_find_device_by_phandle);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,8 +24,8 @@ static int of_reset_gpio_handle(void)
|
||||
int ret; /* variable which stored handle reset gpio pin */
|
||||
struct device_node *root; /* root node */
|
||||
struct device_node *gpio; /* gpio node */
|
||||
struct of_gpio_chip *of_gc = NULL;
|
||||
enum of_gpio_flags flags ;
|
||||
struct gpio_chip *gc;
|
||||
u32 flags;
|
||||
const void *gpio_spec;
|
||||
|
||||
/* find out root node */
|
||||
@@ -39,19 +39,19 @@ static int of_reset_gpio_handle(void)
|
||||
goto err0;
|
||||
}
|
||||
|
||||
of_gc = gpio->data;
|
||||
if (!of_gc) {
|
||||
gc = of_node_to_gpiochip(gpio);
|
||||
if (!gc) {
|
||||
pr_debug("%s: gpio controller %s isn't registered\n",
|
||||
root->full_name, gpio->full_name);
|
||||
ret = -ENODEV;
|
||||
goto err1;
|
||||
}
|
||||
|
||||
ret = of_gc->xlate(of_gc, root, gpio_spec, &flags);
|
||||
ret = gc->of_xlate(gc, root, gpio_spec, &flags);
|
||||
if (ret < 0)
|
||||
goto err1;
|
||||
|
||||
ret += of_gc->gc.base;
|
||||
ret += gc->base;
|
||||
err1:
|
||||
of_node_put(gpio);
|
||||
err0:
|
||||
|
||||
@@ -213,15 +213,9 @@ static struct notifier_block dflt_plat_bus_notifier = {
|
||||
.priority = INT_MAX,
|
||||
};
|
||||
|
||||
static struct notifier_block dflt_of_bus_notifier = {
|
||||
.notifier_call = dflt_bus_notify,
|
||||
.priority = INT_MAX,
|
||||
};
|
||||
|
||||
static int __init setup_bus_notifier(void)
|
||||
{
|
||||
bus_register_notifier(&platform_bus_type, &dflt_plat_bus_notifier);
|
||||
bus_register_notifier(&of_platform_bus_type, &dflt_of_bus_notifier);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+2
-16
@@ -120,6 +120,8 @@ config ARCH_NO_VIRT_TO_BUS
|
||||
config PPC
|
||||
bool
|
||||
default y
|
||||
select OF
|
||||
select OF_FLATTREE
|
||||
select HAVE_FTRACE_MCOUNT_RECORD
|
||||
select HAVE_DYNAMIC_FTRACE
|
||||
select HAVE_FUNCTION_TRACER
|
||||
@@ -173,10 +175,6 @@ config ARCH_MAY_HAVE_PC_FDC
|
||||
config PPC_OF
|
||||
def_bool y
|
||||
|
||||
config OF
|
||||
def_bool y
|
||||
select OF_FLATTREE
|
||||
|
||||
config PPC_UDBG_16550
|
||||
bool
|
||||
default n
|
||||
@@ -199,10 +197,6 @@ config SYS_SUPPORTS_APM_EMULATION
|
||||
default y if PMAC_APM_EMU
|
||||
bool
|
||||
|
||||
config DTC
|
||||
bool
|
||||
default y
|
||||
|
||||
config DEFAULT_UIMAGE
|
||||
bool
|
||||
help
|
||||
@@ -579,14 +573,6 @@ config SCHED_SMT
|
||||
when dealing with POWER5 cpus at a cost of slightly increased
|
||||
overhead in some places. If unsure say N here.
|
||||
|
||||
config PROC_DEVICETREE
|
||||
bool "Support for device tree in /proc"
|
||||
depends on PROC_FS
|
||||
help
|
||||
This option adds a device-tree directory under /proc which contains
|
||||
an image of the device tree that the kernel copies from Open
|
||||
Firmware or other boot firmware. If unsure, say Y here.
|
||||
|
||||
config CMDLINE_BOOL
|
||||
bool "Default bootloader kernel arguments"
|
||||
|
||||
|
||||
@@ -300,34 +300,6 @@ extern unsigned int irq_alloc_virt(struct irq_host *host,
|
||||
*/
|
||||
extern void irq_free_virt(unsigned int virq, unsigned int count);
|
||||
|
||||
|
||||
/* -- OF helpers -- */
|
||||
|
||||
/**
|
||||
* irq_create_of_mapping - Map a hardware interrupt into linux virq space
|
||||
* @controller: Device node of the interrupt controller
|
||||
* @inspec: Interrupt specifier from the device-tree
|
||||
* @intsize: Size of the interrupt specifier from the device-tree
|
||||
*
|
||||
* This function is identical to irq_create_mapping except that it takes
|
||||
* as input informations straight from the device-tree (typically the results
|
||||
* of the of_irq_map_*() functions.
|
||||
*/
|
||||
extern unsigned int irq_create_of_mapping(struct device_node *controller,
|
||||
const u32 *intspec, unsigned int intsize);
|
||||
|
||||
/**
|
||||
* irq_of_parse_and_map - Parse and Map an interrupt into linux virq space
|
||||
* @device: Device node of the device whose interrupt is to be mapped
|
||||
* @index: Index of the interrupt to map
|
||||
*
|
||||
* This function is a wrapper that chains of_irq_map_one() and
|
||||
* irq_create_of_mapping() to make things easier to callers
|
||||
*/
|
||||
extern unsigned int irq_of_parse_and_map(struct device_node *dev, int index);
|
||||
|
||||
/* -- End OF helpers -- */
|
||||
|
||||
/**
|
||||
* irq_early_init - Init irq remapping subsystem
|
||||
*/
|
||||
|
||||
@@ -38,7 +38,7 @@ struct macio_dev
|
||||
{
|
||||
struct macio_bus *bus; /* macio bus this device is on */
|
||||
struct macio_dev *media_bay; /* Device is part of a media bay */
|
||||
struct of_device ofdev;
|
||||
struct platform_device ofdev;
|
||||
struct device_dma_parameters dma_parms; /* ide needs that */
|
||||
int n_resources;
|
||||
struct resource resource[MACIO_DEV_COUNT_RESOURCES];
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#ifndef _ASM_POWERPC_OF_DEVICE_H
|
||||
#define _ASM_POWERPC_OF_DEVICE_H
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/of.h>
|
||||
|
||||
/*
|
||||
* The of_device is a kind of "base class" that is a superset of
|
||||
* struct device for use by devices attached to an OF node and
|
||||
* probed using OF properties.
|
||||
*/
|
||||
struct of_device
|
||||
{
|
||||
struct device dev; /* Generic device interface */
|
||||
struct pdev_archdata archdata;
|
||||
};
|
||||
|
||||
extern struct of_device *of_device_alloc(struct device_node *np,
|
||||
const char *bus_id,
|
||||
struct device *parent);
|
||||
|
||||
extern int of_device_uevent(struct device *dev,
|
||||
struct kobj_uevent_env *env);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _ASM_POWERPC_OF_DEVICE_H */
|
||||
@@ -1,29 +0,0 @@
|
||||
#ifndef _ASM_POWERPC_OF_PLATFORM_H
|
||||
#define _ASM_POWERPC_OF_PLATFORM_H
|
||||
/*
|
||||
* Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
|
||||
* <benh@kernel.crashing.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Platform devices and busses creation */
|
||||
extern struct of_device *of_platform_device_create(struct device_node *np,
|
||||
const char *bus_id,
|
||||
struct device *parent);
|
||||
/* pseudo "matches" value to not do deep probe */
|
||||
#define OF_NO_DEEP_PROBE ((struct of_device_id *)-1)
|
||||
|
||||
extern int of_platform_bus_probe(struct device_node *root,
|
||||
const struct of_device_id *matches,
|
||||
struct device *parent);
|
||||
|
||||
extern struct of_device *of_find_device_by_phandle(phandle ph);
|
||||
|
||||
extern void of_instantiate_rtc(void);
|
||||
|
||||
#endif /* _ASM_POWERPC_OF_PLATFORM_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user