diff mbox series

serial: ns16550: Correct NS16550_DYNAMIC for non-x86

Message ID 20200203170421.209446-1-sjg@chromium.org
State New
Headers show
Series serial: ns16550: Correct NS16550_DYNAMIC for non-x86 | expand

Commit Message

Simon Glass Feb. 3, 2020, 5:04 p.m. UTC
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(+)

Comments

Bin Meng Feb. 3, 2020, 5:12 p.m. UTC | #1
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
Simon Glass Feb. 3, 2020, 5:15 p.m. UTC | #2
Hi Bin,

On Mon, 3 Feb 2020 at 10:12, Bin Meng <bmeng.cn at gmail.com> wrote:
>
> 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?

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 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.

OK.

Regards,
Simon
Bin Meng Feb. 3, 2020, 5:21 p.m. UTC | #3
Hi Simon,

On Tue, Feb 4, 2020 at 1:15 AM Simon Glass <sjg at chromium.org> wrote:
>
> Hi Bin,
>
> On Mon, 3 Feb 2020 at 10:12, Bin Meng <bmeng.cn at gmail.com> wrote:
> >
> > 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?
>
> 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 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.

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

Regards,
Bin
diff mbox series

Patch

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