aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/uart/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/uart/util.c')
-rw-r--r--src/drivers/uart/util.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/drivers/uart/util.c b/src/drivers/uart/util.c
index f0f885d532..882e3ae784 100644
--- a/src/drivers/uart/util.c
+++ b/src/drivers/uart/util.c
@@ -18,6 +18,8 @@
#include "option_table.h"
#endif
+#define DEFAULT_BAUDRATE 115200
+
unsigned int default_baudrate(void)
{
#if !defined(__SMM__) && IS_ENABLED(CONFIG_USE_OPTION_TABLE)
@@ -33,7 +35,11 @@ unsigned int default_baudrate(void)
if (b_index < 8)
return baud[b_index];
#endif
- return CONFIG_TTYS0_BAUD;
+ /*
+ * If TTYS0_BAUD is not configured, then by default use 115200 as the
+ * baud rate.
+ */
+ return CONFIG_TTYS0_BAUD ? CONFIG_TTYS0_BAUD : DEFAULT_BAUDRATE;
}
/* Calculate divisor. Do not floor but round to nearest integer. */