[PATCH 05/19] dm: ns16550: Change how we get UART_REG to be defined

Tom Rini trini at konsulko.com
Tue Jan 10 17:19:32 CET 2023


In the case of DM_SERIAL and not having CONFIG_SYS_NS16550_REG_SIZE
defined, we would set CONFIG_SYS_NS16550_REG_SIZE to -1 with a comment
that this isn't really needed.  This implies that the reason we set
something here is so that we have UART_REG defined and so can use the
rest of the structures that are shared between all the users of
ns16650.h.  In order to not #define a CONFIG variable here, instead move
that check over to the CONFIG_NS16550_DYNAMIC case (which is at the
conceptual level, similar to DM) to get UART_REG defined.

Cc: Simon Glass <sjg at chromium.org>
Signed-off-by: Tom Rini <trini at konsulko.com>
---
I'm making an assumption, in the end, as to what the DM case is doing.
This does work in my lab.
---
 include/ns16550.h | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/include/ns16550.h b/include/ns16550.h
index 243226fc3d94..2110f00dbf28 100644
--- a/include/ns16550.h
+++ b/include/ns16550.h
@@ -26,15 +26,8 @@
 
 #include <linux/types.h>
 
-#if CONFIG_IS_ENABLED(DM_SERIAL) && !defined(CONFIG_SYS_NS16550_REG_SIZE)
-/*
- * For driver model we always use one byte per register, and sort out the
- * differences in the driver
- */
-#define CONFIG_SYS_NS16550_REG_SIZE (-1)
-#endif
-
-#if defined(CONFIG_NS16550_DYNAMIC) || defined(CONFIG_DEBUG_UART)
+#if (CONFIG_IS_ENABLED(DM_SERIAL) && !defined(CONFIG_SYS_NS16550_REG_SIZE)) || \
+	defined(CONFIG_NS16550_DYNAMIC) || defined(CONFIG_DEBUG_UART)
 #define UART_REG(x)	unsigned char x
 #else
 #if !defined(CONFIG_SYS_NS16550_REG_SIZE) || (CONFIG_SYS_NS16550_REG_SIZE == 0)
-- 
2.25.1



More information about the U-Boot mailing list