Skip to contentSkip to conversation

serial: ns16550: Correct NS16550_DYNAMIC for non-x86

PATCH New Simon Glass 2 participants 4 messages Feb 3, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: ns16550: Correct NS16550_DYNAMIC for non-x86

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.

---

 drivers/serial/ns16550.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/serial/ns16550.c +20 -0
index 896c58d68c..67894f4e1f 100644
@@ -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)
 {
Signature · 1 line
2.25.0.341.g760bfbb309-goog
#1 lore raw

PATCH 1/1 serial: ns16550: Correct NS16550_DYNAMIC for non-x86

Quoted 18 lines · Simon Glass

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.

---

 drivers/serial/ns16550.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/serial/ns16550.c +0 -0
index 896c58d68c..67894f4e1f 100644

drivers/serial/ns16550.c static inline int serial_in_shift(void *addr, int shift) · line 97

Quoted 5 lines
drivers/serial/ns16550.c +2 -0
@@ -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(),

typo: device -> define?

Quoted 19 lines
drivers/serial/ns16550.c +12 -0
+ * 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)
+{
+}
+

drivers/serial/ns16550.c static int serial_in_dynamic(struct ns16550_platdata *plat, u8 *addr)

Quoted 10 lines
drivers/serial/ns16550.c +6 -1
+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)
 {
--

I will squash this into the previous patch.

Regards,
Bin

#2 lore raw

PATCH 1/1 serial: ns16550: Correct NS16550_DYNAMIC for non-x86

Hi Bin,

Quoted 23 lines · Bin Meng
Quoted 21 lines · Simon Glass

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.

---

 drivers/serial/ns16550.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/serial/ns16550.c +0 -0
index 896c58d68c..67894f4e1f 100644
@@ -93,6 +93,14 @@ static inline int serial_in_shift(void *addr, int shift)
 #define CONFIG_SYS_NS16550_CLK  0
 #endif
 
Quoted 4 lines

drivers/serial/ns16550.c static inline int serial_in_shift(void *addr, int shift) · line 97

Quoted 2 lines
drivers/serial/ns16550.c +2 -0
+/*
+ * Use this #ifdef for now since many platforms don't device in(), out(),

typo: device -> define?

Yes that's right. Do you want to fix it when applying?

Quoted 27 lines
Quoted 27 lines
drivers/serial/ns16550.c +18 -0
+ * 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 */
 
Quoted 7 lines

drivers/serial/ns16550.c static int serial_in_dynamic(struct ns16550_platdata *plat, u8 *addr)

Quoted 3 lines
drivers/serial/ns16550.c +0 -1
 static void ns16550_writeb(NS16550_t port, int offset, int value)
 {
--

I will squash this into the previous patch.

OK.

Regards,
Simon

#3 lore raw

PATCH 1/1 serial: ns16550: Correct NS16550_DYNAMIC for non-x86

Hi Simon,

Quoted 27 lines · Simon Glass

Hi Bin,

Quoted 23 lines · Bin Meng
Quoted 21 lines · Simon Glass

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.

---

 drivers/serial/ns16550.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/serial/ns16550.c +0 -0
index 896c58d68c..67894f4e1f 100644
@@ -93,6 +93,14 @@ static inline int serial_in_shift(void *addr, int shift)
 #define CONFIG_SYS_NS16550_CLK  0
 #endif
 
Quoted 6 lines
Quoted 4 lines

drivers/serial/ns16550.c static inline int serial_in_shift(void *addr, int shift) · line 97

Quoted 2 lines
drivers/serial/ns16550.c +2 -0
+/*
+ * Use this #ifdef for now since many platforms don't device in(), out(),

typo: device -> define?

Yes that's right. Do you want to fix it when applying?

Fixed the typo, and

Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
drivers/serial/ns16550.c +18 -0
+ * 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 */
 
Quoted 7 lines
Quoted 7 lines

drivers/serial/ns16550.c static int serial_in_dynamic(struct ns16550_platdata *plat, u8 *addr)

Quoted 3 lines
drivers/serial/ns16550.c +0 -1
 static void ns16550_writeb(NS16550_t port, int offset, int value)
 {
--

I will squash this into the previous patch.

Squashed into https://gitlab.denx.de/u-boot/custodians/u-boot-x86/commit/62cbde4c4e462e5147d07cf1424492bb39e7bf94

Regards,
Bin