[PATCH] serial: ns16550: Correct NS16550_DYNAMIC for non-x86

Simon Glass sjg at chromium.org
Mon Feb 3 18:04:21 CET 2020


There is currently no standard way to know which I/O functions an
architecture supports, so it is not possible to have all options used in
this driver.

Move it to use #ifdef for now, to fix the build problem.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 drivers/serial/ns16550.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 896c58d68c..67894f4e1f 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -93,6 +93,14 @@ static inline int serial_in_shift(void *addr, int shift)
 #define CONFIG_SYS_NS16550_CLK  0
 #endif
 
+/*
+ * Use this #ifdef for now since many platforms don't device in(), out(),
+ * out_le32(), etc. but we don't have #defines to indicate this.
+ *
+ * TODO(sjg at chromium.org): Add CONFIG options to indicate what I/O is available
+ * on a platform
+ */
+#ifdef CONFIG_NS16550_DYNAMIC
 static void serial_out_dynamic(struct ns16550_platdata *plat, u8 *addr,
 			       int value)
 {
@@ -133,6 +141,18 @@ static int serial_in_dynamic(struct ns16550_platdata *plat, u8 *addr)
 		return readb(addr);
 	}
 }
+#else
+static inline void serial_out_dynamic(struct ns16550_platdata *plat, u8 *addr,
+				      int value)
+{
+}
+
+static inline int serial_in_dynamic(struct ns16550_platdata *plat, u8 *addr)
+{
+	return 0;
+}
+
+#endif /* CONFIG_NS16550_DYNAMIC */
 
 static void ns16550_writeb(NS16550_t port, int offset, int value)
 {
-- 
2.25.0.341.g760bfbb309-goog



More information about the U-Boot mailing list