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

Bin Meng bmeng.cn at gmail.com
Mon Feb 3 18:12:35 CET 2020


On Tue, Feb 4, 2020 at 1:04 AM Simon Glass <sjg at 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 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(),

typo: device -> define?

> + * 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)
>  {
> --

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>

I will squash this into the previous patch.

Regards,
Bin


More information about the U-Boot mailing list