From patchwork Mon Feb 3 17:04:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 235875 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Mon, 3 Feb 2020 10:04:21 -0700 Subject: [PATCH] serial: ns16550: Correct NS16550_DYNAMIC for non-x86 Message-ID: <20200203170421.209446-1-sjg@chromium.org> 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 Reviewed-by: Bin Meng --- 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) {