summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-01-15 22:05:34 -0500
committerTom Rini <trini@konsulko.com>2019-01-15 22:05:34 -0500
commitaac0c29d4b8418c5c78b552070ffeda022b16949 (patch)
tree1f539113f2121d84b6f62421a066505d753a2fdc /include
parentf4cfd73943032729c9ad6ddd054bcf2ff8205b6d (diff)
parentf51f6715a5013f37620c38f0430e21d4736e235a (diff)
downloadu-boot-aac0c29d4b8418c5c78b552070ffeda022b16949.tar.gz
Merge tag 'dm-pull-15jan19' of git://git.denx.de/u-boot-dm
Fix recent changes to serial API for driver model Buildman clang support and a few fixes Small fixes to 'dm tree' and regmap test Improve sandbox build compatibility A few other minor fixes
Diffstat (limited to 'include')
-rw-r--r--include/common.h5
-rw-r--r--include/log.h3
-rw-r--r--include/regmap.h14
-rw-r--r--include/serial.h38
4 files changed, 50 insertions, 10 deletions
diff --git a/include/common.h b/include/common.h
index 18948b6bc2..2c21dee850 100644
--- a/include/common.h
+++ b/include/common.h
@@ -351,8 +351,6 @@ void smp_set_core_boot_addr(unsigned long addr, int corenr);
void smp_kick_all_cpus(void);
/* $(CPU)/serial.c */
-struct serial_device_info;
-
int serial_init (void);
void serial_setbrg (void);
void serial_putc (const char);
@@ -360,9 +358,6 @@ void serial_putc_raw(const char);
void serial_puts (const char *);
int serial_getc (void);
int serial_tstc (void);
-int serial_getconfig(uint *config);
-int serial_setconfig(uint config);
-int serial_getinfo(struct serial_device_info *info);
/* $(CPU)/speed.c */
int get_clocks (void);
diff --git a/include/log.h b/include/log.h
index 0f2bc19477..d7f6471006 100644
--- a/include/log.h
+++ b/include/log.h
@@ -73,7 +73,8 @@ static inline int log_uc_cat(enum uclass_id id)
* @return 0 if log record was emitted, -ve on error
*/
int _log(enum log_category_t cat, enum log_level_t level, const char *file,
- int line, const char *func, const char *fmt, ...);
+ int line, const char *func, const char *fmt, ...)
+ __attribute__ ((format (__printf__, 6, 7)));
/* Define this at the top of a file to add a prefix to debug messages */
#ifndef pr_fmt
diff --git a/include/regmap.h b/include/regmap.h
index a3afb72df5..8359c511d2 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -248,6 +248,8 @@ int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
* @cond: Break condition (usually involving @val)
* @sleep_us: Maximum time to sleep between reads in us (0 tight-loops).
* @timeout_ms: Timeout in ms, 0 means never timeout
+ * @test_add_time: Used for sandbox testing - amount of time to add after
+ * starting the loop (0 if not testing)
*
* Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_read
* error return value in case of a error read. In the two former cases,
@@ -256,8 +258,12 @@ int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
*
* This is modelled after the regmap_read_poll_timeout macros in linux but
* with millisecond timeout.
+ *
+ * The _test version is for sandbox testing only. Do not use this in normal
+ * code as it advances the timer.
*/
-#define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_ms) \
+#define regmap_read_poll_timeout_test(map, addr, val, cond, sleep_us, \
+ timeout_ms, test_add_time) \
({ \
unsigned long __start = get_timer(0); \
int __ret; \
@@ -267,6 +273,8 @@ int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
break; \
if (cond) \
break; \
+ if (IS_ENABLED(CONFIG_SANDBOX) && test_add_time) \
+ sandbox_timer_add_offset(test_add_time); \
if ((timeout_ms) && get_timer(__start) > (timeout_ms)) { \
__ret = regmap_read((map), (addr), &(val)); \
break; \
@@ -277,6 +285,10 @@ int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
__ret ?: ((cond) ? 0 : -ETIMEDOUT); \
})
+#define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_ms) \
+ regmap_read_poll_timeout_test(map, addr, val, cond, sleep_us, \
+ timeout_ms, 0) \
+
/**
* regmap_update_bits() - Perform a read/modify/write using a mask
*
diff --git a/include/serial.h b/include/serial.h
index c1a9fee250..c1368c68b6 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -235,9 +235,7 @@ struct dm_serial_ops {
* Get a current config for this device.
*
* @dev: Device pointer
- * @parity: parity to use
- * @bits: bits number to use
- * @stop: stop bits number to use
+ * @serial_config: Returns config information (see SERIAL_... above)
* @return 0 if OK, -ve on error
*/
int (*getconfig)(struct udevice *dev, uint *serial_config);
@@ -257,6 +255,7 @@ struct dm_serial_ops {
*
* @dev: Device pointer
* @info: struct serial_device_info to fill
+ * @return 0 if OK, -ve on error
*/
int (*getinfo)(struct udevice *dev, struct serial_device_info *info);
};
@@ -281,6 +280,39 @@ struct serial_dev_priv {
/* Access the serial operations for a device */
#define serial_get_ops(dev) ((struct dm_serial_ops *)(dev)->driver->ops)
+/**
+ * serial_getconfig() - Get the uart configuration
+ * (parity, 5/6/7/8 bits word length, stop bits)
+ *
+ * Get a current config for this device.
+ *
+ * @dev: Device pointer
+ * @serial_config: Returns config information (see SERIAL_... above)
+ * @return 0 if OK, -ve on error
+ */
+int serial_getconfig(struct udevice *dev, uint *config);
+
+/**
+ * serial_setconfig() - Set up the uart configuration
+ * (parity, 5/6/7/8 bits word length, stop bits)
+ *
+ * Set up a new config for this device.
+ *
+ * @dev: Device pointer
+ * @serial_config: number of bits, parity and number of stopbits to use
+ * @return 0 if OK, -ve on error
+ */
+int serial_setconfig(struct udevice *dev, uint config);
+
+/**
+ * serial_getinfo() - Get serial device information
+ *
+ * @dev: Device pointer
+ * @info: struct serial_device_info to fill
+ * @return 0 if OK, -ve on error
+ */
+int serial_getinfo(struct udevice *dev, struct serial_device_info *info);
+
void atmel_serial_initialize(void);
void mcf_serial_initialize(void);
void mpc85xx_serial_initialize(void);