mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
Devicetree updates for 3.7
- Import of latest upstream device tree compiler (dtc) - New function of_get_child_by_name - Support for #size-cells of 0 and #addr-cells of >2 - Couple of DT binding documentation updates -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAABAgAGBQJQbF9eAAoJEMhvYp4jgsXiMVAH/3AsqH/ksWFO48L2342WhPzv JLP2YJQ+X2E3fi4sIXWDOAHXgSsKcKYiUqRJNpebdAzfK+/HCdtV594GXP9MfUdq 05ByUBa728wNPHiQitbtwLu+MN0ot1icXeHB+Gx8LuVrJnW/iJv/FHa6QU+cc9ct jxnDu8Lfp4ja4rFWq56c5vda6ecP5nVIyAPZ40z9Q6QioL0BxJ4axQ8mW6lxG0SH BxOzCppxxShU3O52typ29UORfTDfFPFmskLuJPxGThI4HWaIfpBc55wKKw8P2SR0 2/uK+TJw/UTsDwB/IIzbane4AIScj7ZdRjN1T132DcX9e/aDaZhDMNoG3TSE6kQ= =CZiW -----END PGP SIGNATURE----- Merge tag 'dt-for-3.7' of git://sources.calxeda.com/kernel/linux Pull devicetree updates from Rob Herring: - Import of latest upstream device tree compiler (dtc) - New function of_get_child_by_name - Support for #size-cells of 0 and #addr-cells of >2 - Couple of DT binding documentation updates Fix up trivial conflicts due to of_get_child_by_name() having been added next to the new of_get_next_available_child(). * tag 'dt-for-3.7' of git://sources.calxeda.com/kernel/linux: MAINTAINERS: add scripts/dtc under Devicetree maintainers dtc: import latest upstream dtc dt: Document general interrupt controller bindings dt/s3c64xx/spi: Use of_get_child_by_name to get a named child dt: introduce of_get_child_by_name to get child node by name of: i2c: add support for wakeup-source property of/address: Handle #address-cells > 2 specially DT: export of_irq_to_resource_table() devicetree: serial: Add documentation for imx serial devicetree: pwm: mxs-pwm.txt: Fix reg field annotation of: Allow busses with #size-cells=0
This commit is contained in:
commit
a54dfb1a84
42 changed files with 4057 additions and 712 deletions
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
/* Max address size we deal with */
|
||||
#define OF_MAX_ADDR_CELLS 4
|
||||
#define OF_CHECK_COUNTS(na, ns) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \
|
||||
(ns) > 0)
|
||||
#define OF_CHECK_ADDR_COUNT(na) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS)
|
||||
#define OF_CHECK_COUNTS(na, ns) (OF_CHECK_ADDR_COUNT(na) && (ns) > 0)
|
||||
|
||||
static struct of_bus *of_match_bus(struct device_node *np);
|
||||
static int __of_address_to_resource(struct device_node *dev,
|
||||
|
|
@ -69,6 +69,14 @@ static u64 of_bus_default_map(u32 *addr, const __be32 *range,
|
|||
(unsigned long long)cp, (unsigned long long)s,
|
||||
(unsigned long long)da);
|
||||
|
||||
/*
|
||||
* If the number of address cells is larger than 2 we assume the
|
||||
* mapping doesn't specify a physical address. Rather, the address
|
||||
* specifies an identifier that must match exactly.
|
||||
*/
|
||||
if (na > 2 && memcmp(range, addr, na * 4) != 0)
|
||||
return OF_BAD_ADDR;
|
||||
|
||||
if (da < cp || da >= (cp + s))
|
||||
return OF_BAD_ADDR;
|
||||
return da - cp;
|
||||
|
|
@ -182,7 +190,7 @@ const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
|
|||
}
|
||||
bus->count_cells(dev, &na, &ns);
|
||||
of_node_put(parent);
|
||||
if (!OF_CHECK_COUNTS(na, ns))
|
||||
if (!OF_CHECK_ADDR_COUNT(na))
|
||||
return NULL;
|
||||
|
||||
/* Get "reg" or "assigned-addresses" property */
|
||||
|
|
@ -490,6 +498,25 @@ u64 of_translate_dma_address(struct device_node *dev, const __be32 *in_addr)
|
|||
}
|
||||
EXPORT_SYMBOL(of_translate_dma_address);
|
||||
|
||||
bool of_can_translate_address(struct device_node *dev)
|
||||
{
|
||||
struct device_node *parent;
|
||||
struct of_bus *bus;
|
||||
int na, ns;
|
||||
|
||||
parent = of_get_parent(dev);
|
||||
if (parent == NULL)
|
||||
return false;
|
||||
|
||||
bus = of_match_bus(parent);
|
||||
bus->count_cells(dev, &na, &ns);
|
||||
|
||||
of_node_put(parent);
|
||||
|
||||
return OF_CHECK_COUNTS(na, ns);
|
||||
}
|
||||
EXPORT_SYMBOL(of_can_translate_address);
|
||||
|
||||
const __be32 *of_get_address(struct device_node *dev, int index, u64 *size,
|
||||
unsigned int *flags)
|
||||
{
|
||||
|
|
@ -506,7 +533,7 @@ const __be32 *of_get_address(struct device_node *dev, int index, u64 *size,
|
|||
bus = of_match_bus(parent);
|
||||
bus->count_cells(dev, &na, &ns);
|
||||
of_node_put(parent);
|
||||
if (!OF_CHECK_COUNTS(na, ns))
|
||||
if (!OF_CHECK_ADDR_COUNT(na))
|
||||
return NULL;
|
||||
|
||||
/* Get "reg" or "assigned-addresses" property */
|
||||
|
|
|
|||
|
|
@ -390,6 +390,29 @@ struct device_node *of_get_next_available_child(const struct device_node *node,
|
|||
}
|
||||
EXPORT_SYMBOL(of_get_next_available_child);
|
||||
|
||||
/**
|
||||
* of_get_child_by_name - Find the child node by name for a given parent
|
||||
* @node: parent node
|
||||
* @name: child name to look for.
|
||||
*
|
||||
* This function looks for child node for given matching name
|
||||
*
|
||||
* Returns a node pointer if found, with refcount incremented, use
|
||||
* of_node_put() on it when done.
|
||||
* Returns NULL if node is not found.
|
||||
*/
|
||||
struct device_node *of_get_child_by_name(const struct device_node *node,
|
||||
const char *name)
|
||||
{
|
||||
struct device_node *child;
|
||||
|
||||
for_each_child_of_node(node, child)
|
||||
if (child->name && (of_node_cmp(child->name, name) == 0))
|
||||
break;
|
||||
return child;
|
||||
}
|
||||
EXPORT_SYMBOL(of_get_child_by_name);
|
||||
|
||||
/**
|
||||
* of_find_node_by_path - Find a node matching a full OF path
|
||||
* @path: The full path to match
|
||||
|
|
|
|||
|
|
@ -392,6 +392,7 @@ int of_irq_to_resource_table(struct device_node *dev, struct resource *res,
|
|||
|
||||
return i;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(of_irq_to_resource_table);
|
||||
|
||||
struct intc_desc {
|
||||
struct list_head list;
|
||||
|
|
|
|||
|
|
@ -61,6 +61,9 @@ void of_i2c_register_devices(struct i2c_adapter *adap)
|
|||
info.of_node = of_node_get(node);
|
||||
info.archdata = &dev_ad;
|
||||
|
||||
if (of_get_property(node, "wakeup-source", NULL))
|
||||
info.flags |= I2C_CLIENT_WAKE;
|
||||
|
||||
request_module("%s%s", I2C_MODULE_PREFIX, info.type);
|
||||
|
||||
result = i2c_new_device(adap, &info);
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ void of_device_make_bus_id(struct device *dev)
|
|||
struct device_node *node = dev->of_node;
|
||||
const u32 *reg;
|
||||
u64 addr;
|
||||
const __be32 *addrp;
|
||||
int magic;
|
||||
|
||||
#ifdef CONFIG_PPC_DCR
|
||||
|
|
@ -105,7 +106,15 @@ void of_device_make_bus_id(struct device *dev)
|
|||
*/
|
||||
reg = of_get_property(node, "reg", NULL);
|
||||
if (reg) {
|
||||
addr = of_translate_address(node, reg);
|
||||
if (of_can_translate_address(node)) {
|
||||
addr = of_translate_address(node, reg);
|
||||
} else {
|
||||
addrp = of_get_address(node, 0, NULL, NULL);
|
||||
if (addrp)
|
||||
addr = of_read_number(addrp, 1);
|
||||
else
|
||||
addr = OF_BAD_ADDR;
|
||||
}
|
||||
if (addr != OF_BAD_ADDR) {
|
||||
dev_set_name(dev, "%llx.%s",
|
||||
(unsigned long long)addr, node->name);
|
||||
|
|
@ -140,8 +149,9 @@ struct platform_device *of_device_alloc(struct device_node *np,
|
|||
return NULL;
|
||||
|
||||
/* count the io and irq resources */
|
||||
while (of_address_to_resource(np, num_reg, &temp_res) == 0)
|
||||
num_reg++;
|
||||
if (of_can_translate_address(np))
|
||||
while (of_address_to_resource(np, num_reg, &temp_res) == 0)
|
||||
num_reg++;
|
||||
num_irq = of_irq_count(np);
|
||||
|
||||
/* Populate the resource table */
|
||||
|
|
|
|||
Loading…
Reference in a new issue