diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-14 11:53:39 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-14 11:53:39 -0400 |
| commit | ae36e95cf81c98b111b84317adeb358aaffa80e2 (patch) | |
| tree | 87ef144d3392cca199448117a737c657b7c4663a /include/linux | |
| parent | cc8a44c671fd3a2c792e9e1f59ea1df52697cc8b (diff) | |
| parent | 663d3f7c2e5e1b018a4c53277ccfde40329d98ca (diff) | |
Merge tag 'devicetree-for-linus' of git://git.secretlab.ca/git/linux
Pull device tree updates from Grant Likely:
"The branch contains the following device tree changes the v3.17 merge
window:
Group changes to the device tree. In preparation for adding device
tree overlay support, OF_DYNAMIC is reworked so that a set of device
tree changes can be prepared and applied to the tree all at once.
OF_RECONFIG notifiers see the most significant change here so that
users always get a consistent view of the tree. Notifiers generation
is moved from before a change to after it, and notifiers for a group
of changes are emitted after the entire block of changes have been
applied
Automatic console selection from DT. Console drivers can now use
of_console_check() to see if the device node is specified as a console
device. If so then it gets added as a preferred console. UART
devices get this support automatically when uart_add_one_port() is
called.
DT unit tests no longer depend on pre-loaded data in the device tree.
Data is loaded dynamically at the start of unit tests, and then
unloaded again when the tests have completed.
Also contains a few bugfixes for reserved regions and early memory
setup"
* tag 'devicetree-for-linus' of git://git.secretlab.ca/git/linux: (21 commits)
of: Fixing OF Selftest build error
drivers: of: add automated assignment of reserved regions to client devices
of: Use proper types for checking memory overflow
of: typo fix in __of_prop_dup()
Adding selftest testdata dynamically into live tree
of: Add todo tasklist for Devicetree
of: Transactional DT support.
of: Reorder device tree changes and notifiers
of: Move dynamic node fixups out of powerpc and into common code
of: Make sure attached nodes don't carry along extra children
of: Make devicetree sysfs update functions consistent.
of: Create unlocked versions of node and property add/remove functions
OF: Utility helper functions for dynamic nodes
of: Move CONFIG_OF_DYNAMIC code into a separate file
of: rename of_aliases_mutex to just of_mutex
of/platform: Fix of_platform_device_destroy iteration of devices
of: Migrate of_find_node_by_name() users to for_each_node_by_name()
tty: Update hypervisor tty drivers to use core stdout parsing code.
arm/versatile: Add the uart as the stdout device.
of: Enable console on serial ports specified by /chosen/stdout-path
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/of.h | 87 | ||||
| -rw-r--r-- | include/linux/of_platform.h | 7 | ||||
| -rw-r--r-- | include/linux/of_reserved_mem.h | 7 |
3 files changed, 91 insertions, 10 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index 196b34c1ef4e..6c4363b8ddc3 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
| @@ -74,8 +74,6 @@ struct of_phandle_args { | |||
| 74 | uint32_t args[MAX_PHANDLE_ARGS]; | 74 | uint32_t args[MAX_PHANDLE_ARGS]; |
| 75 | }; | 75 | }; |
| 76 | 76 | ||
| 77 | extern int of_node_add(struct device_node *node); | ||
| 78 | |||
| 79 | /* initialize a node */ | 77 | /* initialize a node */ |
| 80 | extern struct kobj_type of_node_ktype; | 78 | extern struct kobj_type of_node_ktype; |
| 81 | static inline void of_node_init(struct device_node *node) | 79 | static inline void of_node_init(struct device_node *node) |
| @@ -113,6 +111,7 @@ static inline void of_node_put(struct device_node *node) { } | |||
| 113 | extern struct device_node *of_allnodes; | 111 | extern struct device_node *of_allnodes; |
| 114 | extern struct device_node *of_chosen; | 112 | extern struct device_node *of_chosen; |
| 115 | extern struct device_node *of_aliases; | 113 | extern struct device_node *of_aliases; |
| 114 | extern struct device_node *of_stdout; | ||
| 116 | extern raw_spinlock_t devtree_lock; | 115 | extern raw_spinlock_t devtree_lock; |
| 117 | 116 | ||
| 118 | static inline bool of_have_populated_dt(void) | 117 | static inline bool of_have_populated_dt(void) |
| @@ -204,6 +203,7 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size) | |||
| 204 | #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ | 203 | #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ |
| 205 | #define OF_DETACHED 2 /* node has been detached from the device tree */ | 204 | #define OF_DETACHED 2 /* node has been detached from the device tree */ |
| 206 | #define OF_POPULATED 3 /* device already created for the node */ | 205 | #define OF_POPULATED 3 /* device already created for the node */ |
| 206 | #define OF_POPULATED_BUS 4 /* of_platform_populate recursed to children of this node */ | ||
| 207 | 207 | ||
| 208 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) | 208 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) |
| 209 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) | 209 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) |
| @@ -322,6 +322,7 @@ extern int of_update_property(struct device_node *np, struct property *newprop); | |||
| 322 | struct of_prop_reconfig { | 322 | struct of_prop_reconfig { |
| 323 | struct device_node *dn; | 323 | struct device_node *dn; |
| 324 | struct property *prop; | 324 | struct property *prop; |
| 325 | struct property *old_prop; | ||
| 325 | }; | 326 | }; |
| 326 | 327 | ||
| 327 | extern int of_reconfig_notifier_register(struct notifier_block *); | 328 | extern int of_reconfig_notifier_register(struct notifier_block *); |
| @@ -352,7 +353,7 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur, | |||
| 352 | */ | 353 | */ |
| 353 | const char *of_prop_next_string(struct property *prop, const char *cur); | 354 | const char *of_prop_next_string(struct property *prop, const char *cur); |
| 354 | 355 | ||
| 355 | int of_device_is_stdout_path(struct device_node *dn); | 356 | bool of_console_check(struct device_node *dn, char *name, int index); |
| 356 | 357 | ||
| 357 | #else /* CONFIG_OF */ | 358 | #else /* CONFIG_OF */ |
| 358 | 359 | ||
| @@ -564,9 +565,9 @@ static inline int of_machine_is_compatible(const char *compat) | |||
| 564 | return 0; | 565 | return 0; |
| 565 | } | 566 | } |
| 566 | 567 | ||
| 567 | static inline int of_device_is_stdout_path(struct device_node *dn) | 568 | static inline bool of_console_check(const struct device_node *dn, const char *name, int index) |
| 568 | { | 569 | { |
| 569 | return 0; | 570 | return false; |
| 570 | } | 571 | } |
| 571 | 572 | ||
| 572 | static inline const __be32 *of_prop_next_u32(struct property *prop, | 573 | static inline const __be32 *of_prop_next_u32(struct property *prop, |
| @@ -786,4 +787,80 @@ typedef void (*of_init_fn_1)(struct device_node *); | |||
| 786 | #define OF_DECLARE_2(table, name, compat, fn) \ | 787 | #define OF_DECLARE_2(table, name, compat, fn) \ |
| 787 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2) | 788 | _OF_DECLARE(table, name, compat, fn, of_init_fn_2) |
| 788 | 789 | ||
| 790 | /** | ||
| 791 | * struct of_changeset_entry - Holds a changeset entry | ||
| 792 | * | ||
| 793 | * @node: list_head for the log list | ||
| 794 | * @action: notifier action | ||
| 795 | * @np: pointer to the device node affected | ||
| 796 | * @prop: pointer to the property affected | ||
| 797 | * @old_prop: hold a pointer to the original property | ||
| 798 | * | ||
| 799 | * Every modification of the device tree during a changeset | ||
| 800 | * is held in a list of of_changeset_entry structures. | ||
| 801 | * That way we can recover from a partial application, or we can | ||
| 802 | * revert the changeset | ||
| 803 | */ | ||
| 804 | struct of_changeset_entry { | ||
| 805 | struct list_head node; | ||
| 806 | unsigned long action; | ||
| 807 | struct device_node *np; | ||
| 808 | struct property *prop; | ||
| 809 | struct property *old_prop; | ||
| 810 | }; | ||
| 811 | |||
| 812 | /** | ||
| 813 | * struct of_changeset - changeset tracker structure | ||
| 814 | * | ||
| 815 | * @entries: list_head for the changeset entries | ||
| 816 | * | ||
| 817 | * changesets are a convenient way to apply bulk changes to the | ||
| 818 | * live tree. In case of an error, changes are rolled-back. | ||
| 819 | * changesets live on after initial application, and if not | ||
| 820 | * destroyed after use, they can be reverted in one single call. | ||
| 821 | */ | ||
| 822 | struct of_changeset { | ||
| 823 | struct list_head entries; | ||
| 824 | }; | ||
| 825 | |||
| 826 | #ifdef CONFIG_OF_DYNAMIC | ||
| 827 | extern void of_changeset_init(struct of_changeset *ocs); | ||
| 828 | extern void of_changeset_destroy(struct of_changeset *ocs); | ||
| 829 | extern int of_changeset_apply(struct of_changeset *ocs); | ||
| 830 | extern int of_changeset_revert(struct of_changeset *ocs); | ||
| 831 | extern int of_changeset_action(struct of_changeset *ocs, | ||
| 832 | unsigned long action, struct device_node *np, | ||
| 833 | struct property *prop); | ||
| 834 | |||
| 835 | static inline int of_changeset_attach_node(struct of_changeset *ocs, | ||
| 836 | struct device_node *np) | ||
| 837 | { | ||
| 838 | return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL); | ||
| 839 | } | ||
| 840 | |||
| 841 | static inline int of_changeset_detach_node(struct of_changeset *ocs, | ||
| 842 | struct device_node *np) | ||
| 843 | { | ||
| 844 | return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL); | ||
| 845 | } | ||
| 846 | |||
| 847 | static inline int of_changeset_add_property(struct of_changeset *ocs, | ||
| 848 | struct device_node *np, struct property *prop) | ||
| 849 | { | ||
| 850 | return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop); | ||
| 851 | } | ||
| 852 | |||
| 853 | static inline int of_changeset_remove_property(struct of_changeset *ocs, | ||
| 854 | struct device_node *np, struct property *prop) | ||
| 855 | { | ||
| 856 | return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop); | ||
| 857 | } | ||
| 858 | |||
| 859 | static inline int of_changeset_update_property(struct of_changeset *ocs, | ||
| 860 | struct device_node *np, struct property *prop) | ||
| 861 | { | ||
| 862 | return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop); | ||
| 863 | } | ||
| 864 | #endif | ||
| 865 | |||
| 789 | #endif /* _LINUX_OF_H */ | 866 | #endif /* _LINUX_OF_H */ |
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index d96e1badbee0..c2b0627a2317 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h | |||
| @@ -72,7 +72,7 @@ extern int of_platform_populate(struct device_node *root, | |||
| 72 | const struct of_device_id *matches, | 72 | const struct of_device_id *matches, |
| 73 | const struct of_dev_auxdata *lookup, | 73 | const struct of_dev_auxdata *lookup, |
| 74 | struct device *parent); | 74 | struct device *parent); |
| 75 | extern int of_platform_depopulate(struct device *parent); | 75 | extern void of_platform_depopulate(struct device *parent); |
| 76 | #else | 76 | #else |
| 77 | static inline int of_platform_populate(struct device_node *root, | 77 | static inline int of_platform_populate(struct device_node *root, |
| 78 | const struct of_device_id *matches, | 78 | const struct of_device_id *matches, |
| @@ -81,10 +81,7 @@ static inline int of_platform_populate(struct device_node *root, | |||
| 81 | { | 81 | { |
| 82 | return -ENODEV; | 82 | return -ENODEV; |
| 83 | } | 83 | } |
| 84 | static inline int of_platform_depopulate(struct device *parent) | 84 | static inline void of_platform_depopulate(struct device *parent) { } |
| 85 | { | ||
| 86 | return -ENODEV; | ||
| 87 | } | ||
| 88 | #endif | 85 | #endif |
| 89 | 86 | ||
| 90 | #endif /* _LINUX_OF_PLATFORM_H */ | 87 | #endif /* _LINUX_OF_PLATFORM_H */ |
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h index 4669ddfdd5af..5b5efae09135 100644 --- a/include/linux/of_reserved_mem.h +++ b/include/linux/of_reserved_mem.h | |||
| @@ -8,6 +8,7 @@ struct reserved_mem_ops; | |||
| 8 | struct reserved_mem { | 8 | struct reserved_mem { |
| 9 | const char *name; | 9 | const char *name; |
| 10 | unsigned long fdt_node; | 10 | unsigned long fdt_node; |
| 11 | unsigned long phandle; | ||
| 11 | const struct reserved_mem_ops *ops; | 12 | const struct reserved_mem_ops *ops; |
| 12 | phys_addr_t base; | 13 | phys_addr_t base; |
| 13 | phys_addr_t size; | 14 | phys_addr_t size; |
| @@ -27,10 +28,16 @@ typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem); | |||
| 27 | _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn) | 28 | _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn) |
| 28 | 29 | ||
| 29 | #ifdef CONFIG_OF_RESERVED_MEM | 30 | #ifdef CONFIG_OF_RESERVED_MEM |
| 31 | void of_reserved_mem_device_init(struct device *dev); | ||
| 32 | void of_reserved_mem_device_release(struct device *dev); | ||
| 33 | |||
| 30 | void fdt_init_reserved_mem(void); | 34 | void fdt_init_reserved_mem(void); |
| 31 | void fdt_reserved_mem_save_node(unsigned long node, const char *uname, | 35 | void fdt_reserved_mem_save_node(unsigned long node, const char *uname, |
| 32 | phys_addr_t base, phys_addr_t size); | 36 | phys_addr_t base, phys_addr_t size); |
| 33 | #else | 37 | #else |
| 38 | static inline void of_reserved_mem_device_init(struct device *dev) { } | ||
| 39 | static inline void of_reserved_mem_device_release(struct device *pdev) { } | ||
| 40 | |||
| 34 | static inline void fdt_init_reserved_mem(void) { } | 41 | static inline void fdt_init_reserved_mem(void) { } |
| 35 | static inline void fdt_reserved_mem_save_node(unsigned long node, | 42 | static inline void fdt_reserved_mem_save_node(unsigned long node, |
| 36 | const char *uname, phys_addr_t base, phys_addr_t size) { } | 43 | const char *uname, phys_addr_t base, phys_addr_t size) { } |
