summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-07-10 16:22:57 -0400
committerTom Rini <trini@konsulko.com>2020-07-10 16:22:57 -0400
commit4a9146c29573dbfa661918280d9522a01f6ca919 (patch)
treeb1b135237dcfee94a27e8df7ce2208230c28b894 /include
parentf30924739975b4f60c0862b539790fdcdb7da20c (diff)
parent6c3fc50ee59366df62e8345ea9fd86c3ace0c3f1 (diff)
Merge tag 'dm-pull-10jul20' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
of-platdata: better phandle and compatible-string support patman support for Python3 on Ubuntu 14.04 new checkpatch check to avoid #ifdefs
Diffstat (limited to 'include')
-rw-r--r--include/clk.h4
-rw-r--r--include/configs/sandbox.h5
-rw-r--r--include/dm/device-internal.h2
-rw-r--r--include/dm/device.h22
-rw-r--r--include/dm/platdata.h14
-rw-r--r--include/dm/uclass.h2
-rw-r--r--include/log.h18
7 files changed, 61 insertions, 6 deletions
diff --git a/include/clk.h b/include/clk.h
index c6a2713f62..a62e2efa2c 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -89,8 +89,8 @@ struct clk_bulk {
#if CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(CLK)
struct phandle_1_arg;
-int clk_get_by_index_platdata(struct udevice *dev, int index,
- struct phandle_1_arg *cells, struct clk *clk);
+int clk_get_by_driver_info(struct udevice *dev,
+ struct phandle_1_arg *cells, struct clk *clk);
/**
* clk_get_by_index - Get/request a clock by integer index.
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 1a981a7c37..0353a19c97 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -47,8 +47,11 @@
#define CONFIG_PHYSMEM
/* Size of our emulated memory */
+#define SB_CONCAT(x, y) x ## y
+#define SB_TO_UL(s) SB_CONCAT(s, UL)
#define CONFIG_SYS_SDRAM_BASE 0
-#define CONFIG_SYS_SDRAM_SIZE (128 << 20)
+#define CONFIG_SYS_SDRAM_SIZE \
+ (SB_TO_UL(CONFIG_SANDBOX_RAM_SIZE_MB) << 20)
#define CONFIG_SYS_MONITOR_BASE 0
#define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index 294d6c1810..5145fb4e14 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -81,7 +81,7 @@ int device_bind_with_driver_data(struct udevice *parent,
* @return 0 if OK, -ve on error
*/
int device_bind_by_name(struct udevice *parent, bool pre_reloc_only,
- const struct driver_info *info, struct udevice **devp);
+ struct driver_info *info, struct udevice **devp);
/**
* device_ofdata_to_platdata() - Read platform data for a device
diff --git a/include/dm/device.h b/include/dm/device.h
index 975eec5d0e..f5738a0cee 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -283,6 +283,13 @@ struct driver {
ll_entry_get(struct driver, __name, driver)
/**
+ * Declare a macro to state a alias for a driver name. This macro will
+ * produce no code but its information will be parsed by tools like
+ * dtoc
+ */
+#define U_BOOT_DRIVER_ALIAS(__name, __alias)
+
+/**
* dev_get_platdata() - Get the platform data for a device
*
* This checks that dev is not NULL, but no other checks for now
@@ -532,6 +539,21 @@ int device_find_global_by_ofnode(ofnode node, struct udevice **devp);
int device_get_global_by_ofnode(ofnode node, struct udevice **devp);
/**
+ * device_get_by_driver_info() - Get a device based on driver_info
+ *
+ * Locates a device by its struct driver_info, by using its reference which
+ * is updated during the bind process.
+ *
+ * The device is probed to activate it ready for use.
+ *
+ * @info: Struct driver_info
+ * @devp: Returns pointer to device if found, otherwise this is set to NULL
+ * @return 0 if OK, -ve on error
+ */
+int device_get_by_driver_info(const struct driver_info *info,
+ struct udevice **devp);
+
+/**
* device_find_first_child() - Find the first child of a device
*
* @parent: Parent device to search
diff --git a/include/dm/platdata.h b/include/dm/platdata.h
index c972fa6936..cab93b071b 100644
--- a/include/dm/platdata.h
+++ b/include/dm/platdata.h
@@ -22,12 +22,14 @@
* @name: Driver name
* @platdata: Driver-specific platform data
* @platdata_size: Size of platform data structure
+ * @dev: Device created from this structure data
*/
struct driver_info {
const char *name;
const void *platdata;
#if CONFIG_IS_ENABLED(OF_PLATDATA)
uint platdata_size;
+ struct udevice *dev;
#endif
};
@@ -43,4 +45,16 @@ struct driver_info {
#define U_BOOT_DEVICES(__name) \
ll_entry_declare_list(struct driver_info, __name, driver_info)
+/* Get a pointer to a given driver */
+#define DM_GET_DEVICE(__name) \
+ ll_entry_get(struct driver_info, __name, driver_info)
+
+/**
+ * dm_populate_phandle_data() - Populates phandle data in platda
+ *
+ * This populates phandle data with an U_BOOT_DEVICE entry get by
+ * DM_GET_DEVICE. The implementation of this function will be done
+ * by dtoc when parsing dtb.
+ */
+void dm_populate_phandle_data(void);
#endif
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 70fca79b44..67ff7466c8 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -390,7 +390,7 @@ int uclass_resolve_seq(struct udevice *dev);
* @id: enum uclass_id ID to use
* @pos: struct udevice * to hold the current device. Set to NULL when there
* are no more devices.
- * @uc: temporary uclass variable (struct udevice *)
+ * @uc: temporary uclass variable (struct uclass *)
*/
#define uclass_id_foreach_dev(id, pos, uc) \
if (!uclass_get(id, &uc)) \
diff --git a/include/log.h b/include/log.h
index df65398c04..2859ce1f2e 100644
--- a/include/log.h
+++ b/include/log.h
@@ -12,6 +12,7 @@
#include <stdio.h>
#include <linker_lists.h>
#include <dm/uclass-id.h>
+#include <linux/bitops.h>
#include <linux/list.h>
struct cmd_tbl;
@@ -411,7 +412,6 @@ enum log_fmt {
LOGF_MSG,
LOGF_COUNT,
- LOGF_DEFAULT = (1 << LOGF_FUNC) | (1 << LOGF_MSG),
LOGF_ALL = 0x3f,
};
@@ -460,4 +460,20 @@ static inline int log_init(void)
}
#endif
+/**
+ * log_get_default_format() - get default log format
+ *
+ * The default log format is configurable via
+ * CONFIG_LOGF_FILE, CONFIG_LOGF_LINE, CONFIG_LOGF_FUNC.
+ *
+ * Return: default log format
+ */
+static inline int log_get_default_format(void)
+{
+ return BIT(LOGF_MSG) |
+ (IS_ENABLED(CONFIG_LOGF_FILE) ? BIT(LOGF_FILE) : 0) |
+ (IS_ENABLED(CONFIG_LOGF_LINE) ? BIT(LOGF_LINE) : 0) |
+ (IS_ENABLED(CONFIG_LOGF_FUNC) ? BIT(LOGF_FUNC) : 0);
+}
+
#endif