~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/of_platform.h

Version: ~ [ linux-5.9-rc6 ] ~ [ linux-5.8.10 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.66 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.146 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.198 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.236 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.236 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0+ */
  2 #ifndef _LINUX_OF_PLATFORM_H
  3 #define _LINUX_OF_PLATFORM_H
  4 /*
  5  *    Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
  6  *                       <benh@kernel.crashing.org>
  7  */
  8 
  9 #include <linux/device.h>
 10 #include <linux/mod_devicetable.h>
 11 #include <linux/pm.h>
 12 #include <linux/of_device.h>
 13 #include <linux/platform_device.h>
 14 
 15 /**
 16  * struct of_dev_auxdata - lookup table entry for device names & platform_data
 17  * @compatible: compatible value of node to match against node
 18  * @phys_addr: Start address of registers to match against node
 19  * @name: Name to assign for matching nodes
 20  * @platform_data: platform_data to assign for matching nodes
 21  *
 22  * This lookup table allows the caller of of_platform_populate() to override
 23  * the names of devices when creating devices from the device tree.  The table
 24  * should be terminated with an empty entry.  It also allows the platform_data
 25  * pointer to be set.
 26  *
 27  * The reason for this functionality is that some Linux infrastructure uses
 28  * the device name to look up a specific device, but the Linux-specific names
 29  * are not encoded into the device tree, so the kernel needs to provide specific
 30  * values.
 31  *
 32  * Note: Using an auxdata lookup table should be considered a last resort when
 33  * converting a platform to use the DT.  Normally the automatically generated
 34  * device name will not matter, and drivers should obtain data from the device
 35  * node instead of from an anonymous platform_data pointer.
 36  */
 37 struct of_dev_auxdata {
 38         char *compatible;
 39         resource_size_t phys_addr;
 40         char *name;
 41         void *platform_data;
 42 };
 43 
 44 /* Macro to simplify populating a lookup table */
 45 #define OF_DEV_AUXDATA(_compat,_phys,_name,_pdata) \
 46         { .compatible = _compat, .phys_addr = _phys, .name = _name, \
 47           .platform_data = _pdata }
 48 
 49 extern const struct of_device_id of_default_bus_match_table[];
 50 
 51 /* Platform drivers register/unregister */
 52 extern struct platform_device *of_device_alloc(struct device_node *np,
 53                                          const char *bus_id,
 54                                          struct device *parent);
 55 #ifdef CONFIG_OF
 56 extern struct platform_device *of_find_device_by_node(struct device_node *np);
 57 #else
 58 static inline struct platform_device *of_find_device_by_node(struct device_node *np)
 59 {
 60         return NULL;
 61 }
 62 #endif
 63 
 64 /* Platform devices and busses creation */
 65 extern struct platform_device *of_platform_device_create(struct device_node *np,
 66                                                    const char *bus_id,
 67                                                    struct device *parent);
 68 
 69 extern int of_platform_device_destroy(struct device *dev, void *data);
 70 extern int of_platform_bus_probe(struct device_node *root,
 71                                  const struct of_device_id *matches,
 72                                  struct device *parent);
 73 #ifdef CONFIG_OF_ADDRESS
 74 extern int of_platform_populate(struct device_node *root,
 75                                 const struct of_device_id *matches,
 76                                 const struct of_dev_auxdata *lookup,
 77                                 struct device *parent);
 78 extern int of_platform_default_populate(struct device_node *root,
 79                                         const struct of_dev_auxdata *lookup,
 80                                         struct device *parent);
 81 extern void of_platform_depopulate(struct device *parent);
 82 
 83 extern int devm_of_platform_populate(struct device *dev);
 84 
 85 extern void devm_of_platform_depopulate(struct device *dev);
 86 #else
 87 static inline int of_platform_populate(struct device_node *root,
 88                                         const struct of_device_id *matches,
 89                                         const struct of_dev_auxdata *lookup,
 90                                         struct device *parent)
 91 {
 92         return -ENODEV;
 93 }
 94 static inline int of_platform_default_populate(struct device_node *root,
 95                                                const struct of_dev_auxdata *lookup,
 96                                                struct device *parent)
 97 {
 98         return -ENODEV;
 99 }
100 static inline void of_platform_depopulate(struct device *parent) { }
101 
102 static inline int devm_of_platform_populate(struct device *dev)
103 {
104         return -ENODEV;
105 }
106 
107 static inline void devm_of_platform_depopulate(struct device *dev) { }
108 #endif
109 
110 #if defined(CONFIG_OF_DYNAMIC) && defined(CONFIG_OF_ADDRESS)
111 extern void of_platform_register_reconfig_notifier(void);
112 #else
113 static inline void of_platform_register_reconfig_notifier(void) { }
114 #endif
115 
116 #endif  /* _LINUX_OF_PLATFORM_H */
117 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp