[PATCH] 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.
Signed-off-by: Simon Glass sjg@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@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) {

On Tue, Feb 4, 2020 at 1:04 AM Simon Glass sjg@chromium.org wrote:
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@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(),
typo: device -> define?
- out_le32(), etc. but we don't have #defines to indicate this.
- TODO(sjg@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) { --
Reviewed-by: Bin Meng bmeng.cn@gmail.com
I will squash this into the previous patch.
Regards, Bin

Hi Bin,
On Mon, 3 Feb 2020 at 10:12, Bin Meng bmeng.cn@gmail.com wrote:
On Tue, Feb 4, 2020 at 1:04 AM Simon Glass sjg@chromium.org wrote:
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@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(),
typo: device -> define?
Yes that's right. Do you want to fix it when applying?
- out_le32(), etc. but we don't have #defines to indicate this.
- TODO(sjg@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) { --
Reviewed-by: Bin Meng bmeng.cn@gmail.com
I will squash this into the previous patch.
OK.
Regards, Simon

Hi Simon,
On Tue, Feb 4, 2020 at 1:15 AM Simon Glass sjg@chromium.org wrote:
Hi Bin,
On Mon, 3 Feb 2020 at 10:12, Bin Meng bmeng.cn@gmail.com wrote:
On Tue, Feb 4, 2020 at 1:04 AM Simon Glass sjg@chromium.org wrote:
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@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(),
typo: device -> define?
Yes that's right. Do you want to fix it when applying?
Fixed the typo, and
- out_le32(), etc. but we don't have #defines to indicate this.
- TODO(sjg@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) { --
Reviewed-by: Bin Meng bmeng.cn@gmail.com
I will squash this into the previous patch.
Squashed into https://gitlab.denx.de/u-boot/custodians/u-boot-x86/commit/62cbde4c4e462e514...
Regards, Bin
participants (2)
-
Bin Meng
-
Simon Glass