diff mbox

[U-Boot,4/6] console & omap-common/spl: Enable use of eserial

Message ID 1348689859-21803-5-git-send-email-andrew@bradfordembedded.com
State Changes Requested
Delegated to: Tom Rini
Headers show

Commit Message

Andrew Bradford Sept. 26, 2012, 8:04 p.m. UTC
Enable use of eserial devices for common and omap-common/spl.

This probably isn't the right way to do this as the changes aren't
needed for 'common' configurations, just for one case.

Signed-off-by: Andrew Bradford <andrew@bradfordembedded.com>
---
 arch/arm/cpu/armv7/omap-common/spl.c |    7 ++++++-
 common/console.c                     |   24 ++++++++++++++++++++----
 include/common.h                     |    5 +++++
 3 files changed, 31 insertions(+), 5 deletions(-)

Comments

Marek Vasut Sept. 27, 2012, 4:34 p.m. UTC | #1
Dear Andrew Bradford,

> Enable use of eserial devices for common and omap-common/spl.
> 
> This probably isn't the right way to do this as the changes aren't
> needed for 'common' configurations, just for one case.
> 
> Signed-off-by: Andrew Bradford <andrew@bradfordembedded.com>
> ---
>  arch/arm/cpu/armv7/omap-common/spl.c |    7 ++++++-
>  common/console.c                     |   24 ++++++++++++++++++++----
>  include/common.h                     |    5 +++++
>  3 files changed, 31 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/omap-common/spl.c
> b/arch/arm/cpu/armv7/omap-common/spl.c index 4d1ac85..6258c0e 100644
> --- a/arch/arm/cpu/armv7/omap-common/spl.c
> +++ b/arch/arm/cpu/armv7/omap-common/spl.c
> @@ -210,7 +210,12 @@ void preloader_console_init(void)
>  	gd->flags |= GD_FLG_RELOC;
>  	gd->baudrate = CONFIG_BAUDRATE;
> 
> -	serial_init();		/* serial communications setup */
> +	/* serial communications setup */
> +#ifdef CONFIG_SERIAL_MULTI
> +	ESERIAL_FUNC(CONFIG_CONS_INDEX, init)();

Uh, if you implement default_serial_console properly(), you won't need this. 
Actually, I'm in the process of rolling out V2 of my serial patchset, which will 
make your life much more easier. Can you rebase the patchset on my series? I'll 
poke you about it.

> +#else
> +	serial_init();
> +#endif /* CONFIG_SERIAL_MULTI */
> 
>  	gd->have_console = 1;
> 
> diff --git a/common/console.c b/common/console.c
> index 1177f7d..5670ce1 100644
> --- a/common/console.c
> +++ b/common/console.c
> @@ -302,12 +302,16 @@ int getc(void)
>  		return 0;
> 
>  	if (gd->flags & GD_FLG_DEVINIT) {
> -		/* Get from the standard input */
> -		return fgetc(stdin);
> +	/* Get from the standard input */
> +	return fgetc(stdin);

NAK for this formating issue

[...]

Best regards,
Marek Vasut
Andrew Bradford Oct. 10, 2012, 1:10 p.m. UTC | #2
Dear Marek Vasut,

On Thu, 27 Sep 2012 18:34:18 +0200
Marek Vasut <marex@denx.de> wrote:

> Dear Andrew Bradford,
> 
> > Enable use of eserial devices for common and omap-common/spl.
> > 
> > This probably isn't the right way to do this as the changes aren't
> > needed for 'common' configurations, just for one case.
> > 
> > Signed-off-by: Andrew Bradford <andrew@bradfordembedded.com>
> > ---
> >  arch/arm/cpu/armv7/omap-common/spl.c |    7 ++++++-
> >  common/console.c                     |   24
> > ++++++++++++++++++++---- include/common.h                     |
> > 5 +++++ 3 files changed, 31 insertions(+), 5 deletions(-)
> > 
> > diff --git a/arch/arm/cpu/armv7/omap-common/spl.c
> > b/arch/arm/cpu/armv7/omap-common/spl.c index 4d1ac85..6258c0e 100644
> > --- a/arch/arm/cpu/armv7/omap-common/spl.c
> > +++ b/arch/arm/cpu/armv7/omap-common/spl.c
> > @@ -210,7 +210,12 @@ void preloader_console_init(void)
> >  	gd->flags |= GD_FLG_RELOC;
> >  	gd->baudrate = CONFIG_BAUDRATE;
> > 
> > -	serial_init();		/* serial communications
> > setup */
> > +	/* serial communications setup */
> > +#ifdef CONFIG_SERIAL_MULTI
> > +	ESERIAL_FUNC(CONFIG_CONS_INDEX, init)();
> 
> Uh, if you implement default_serial_console properly(), you won't
> need this. Actually, I'm in the process of rolling out V2 of my
> serial patchset, which will make your life much more easier. Can you
> rebase the patchset on my series? I'll poke you about it.

I see that your serial patches have made it into u-boot/next, should I
rebase this patch set with the requested changes on top of u-boot/next
and resubmit?  Sorry, I'm not entirely clear on the role /next plays.

Or is it recommended to rebase my changes on top of the tree I worked
with before but with your serial patches applied?  Or some other method?

Thanks,
Andrew
Marek Vasut Oct. 10, 2012, 2:53 p.m. UTC | #3
Dear Andrew Bradford,

> Dear Marek Vasut,
> 
> On Thu, 27 Sep 2012 18:34:18 +0200
> 
> Marek Vasut <marex@denx.de> wrote:
> > Dear Andrew Bradford,
> > 
> > > Enable use of eserial devices for common and omap-common/spl.
> > > 
> > > This probably isn't the right way to do this as the changes aren't
> > > needed for 'common' configurations, just for one case.
> > > 
> > > Signed-off-by: Andrew Bradford <andrew@bradfordembedded.com>
> > > ---
> > > 
> > >  arch/arm/cpu/armv7/omap-common/spl.c |    7 ++++++-
> > >  common/console.c                     |   24
> > > 
> > > ++++++++++++++++++++---- include/common.h                     |
> > > 5 +++++ 3 files changed, 31 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/arch/arm/cpu/armv7/omap-common/spl.c
> > > b/arch/arm/cpu/armv7/omap-common/spl.c index 4d1ac85..6258c0e 100644
> > > --- a/arch/arm/cpu/armv7/omap-common/spl.c
> > > +++ b/arch/arm/cpu/armv7/omap-common/spl.c
> > > @@ -210,7 +210,12 @@ void preloader_console_init(void)
> > > 
> > >  	gd->flags |= GD_FLG_RELOC;
> > >  	gd->baudrate = CONFIG_BAUDRATE;
> > > 
> > > -	serial_init();		/* serial communications
> > > setup */
> > > +	/* serial communications setup */
> > > +#ifdef CONFIG_SERIAL_MULTI
> > > +	ESERIAL_FUNC(CONFIG_CONS_INDEX, init)();
> > 
> > Uh, if you implement default_serial_console properly(), you won't
> > need this. Actually, I'm in the process of rolling out V2 of my
> > serial patchset, which will make your life much more easier. Can you
> > rebase the patchset on my series? I'll poke you about it.
> 
> I see that your serial patches have made it into u-boot/next, should I
> rebase this patch set with the requested changes on top of u-boot/next
> and resubmit?

Yes

> Sorry, I'm not entirely clear on the role /next plays.

Simple. Merge window for current release is long closed, anything that goes into 
next release is in /next. The /master branch is now only being tested and only 
stabilization patches are accepted.

> Or is it recommended to rebase my changes on top of the tree I worked
> with before but with your serial patches applied?  Or some other method?

Rebase on next please. Thanks!

> Thanks,
> Andrew

Best regards,
Marek Vasut
Tom Rini Oct. 10, 2012, 4 p.m. UTC | #4
On Wed, Oct 10, 2012 at 09:10:28AM -0400, Andrew Bradford wrote:
> Dear Marek Vasut,
> 
> On Thu, 27 Sep 2012 18:34:18 +0200
> Marek Vasut <marex@denx.de> wrote:
> 
> > Dear Andrew Bradford,
> > 
> > > Enable use of eserial devices for common and omap-common/spl.
> > > 
> > > This probably isn't the right way to do this as the changes aren't
> > > needed for 'common' configurations, just for one case.
> > > 
> > > Signed-off-by: Andrew Bradford <andrew@bradfordembedded.com>
> > > ---
> > >  arch/arm/cpu/armv7/omap-common/spl.c |    7 ++++++-
> > >  common/console.c                     |   24
> > > ++++++++++++++++++++---- include/common.h                     |
> > > 5 +++++ 3 files changed, 31 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/arch/arm/cpu/armv7/omap-common/spl.c
> > > b/arch/arm/cpu/armv7/omap-common/spl.c index 4d1ac85..6258c0e 100644
> > > --- a/arch/arm/cpu/armv7/omap-common/spl.c
> > > +++ b/arch/arm/cpu/armv7/omap-common/spl.c
> > > @@ -210,7 +210,12 @@ void preloader_console_init(void)
> > >  	gd->flags |= GD_FLG_RELOC;
> > >  	gd->baudrate = CONFIG_BAUDRATE;
> > > 
> > > -	serial_init();		/* serial communications
> > > setup */
> > > +	/* serial communications setup */
> > > +#ifdef CONFIG_SERIAL_MULTI
> > > +	ESERIAL_FUNC(CONFIG_CONS_INDEX, init)();
> > 
> > Uh, if you implement default_serial_console properly(), you won't
> > need this. Actually, I'm in the process of rolling out V2 of my
> > serial patchset, which will make your life much more easier. Can you
> > rebase the patchset on my series? I'll poke you about it.
> 
> I see that your serial patches have made it into u-boot/next, should I
> rebase this patch set with the requested changes on top of u-boot/next
> and resubmit?  Sorry, I'm not entirely clear on the role /next plays.

Yes please, thanks.
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c
index 4d1ac85..6258c0e 100644
--- a/arch/arm/cpu/armv7/omap-common/spl.c
+++ b/arch/arm/cpu/armv7/omap-common/spl.c
@@ -210,7 +210,12 @@  void preloader_console_init(void)
 	gd->flags |= GD_FLG_RELOC;
 	gd->baudrate = CONFIG_BAUDRATE;
 
-	serial_init();		/* serial communications setup */
+	/* serial communications setup */
+#ifdef CONFIG_SERIAL_MULTI
+	ESERIAL_FUNC(CONFIG_CONS_INDEX, init)();
+#else
+	serial_init();
+#endif /* CONFIG_SERIAL_MULTI */
 
 	gd->have_console = 1;
 
diff --git a/common/console.c b/common/console.c
index 1177f7d..5670ce1 100644
--- a/common/console.c
+++ b/common/console.c
@@ -302,12 +302,16 @@  int getc(void)
 		return 0;
 
 	if (gd->flags & GD_FLG_DEVINIT) {
-		/* Get from the standard input */
-		return fgetc(stdin);
+	/* Get from the standard input */
+	return fgetc(stdin);
 	}
 
 	/* Send directly to the handler */
+#ifdef CONFIG_SERIAL_MULTI
+	return ESERIAL_FUNC(CONFIG_CONS_INDEX, getc)();
+#else
 	return serial_getc();
+#endif /* CONFIG_SERIAL_MULTI */
 }
 
 int tstc(void)
@@ -321,12 +325,16 @@  int tstc(void)
 		return 0;
 
 	if (gd->flags & GD_FLG_DEVINIT) {
-		/* Test the standard input */
-		return ftstc(stdin);
+	/* Test the standard input */
+	return ftstc(stdin);
 	}
 
 	/* Send directly to the handler */
+#ifdef CONFIG_SERIAL_MULTI
+	return ESERIAL_FUNC(CONFIG_CONS_INDEX, tstc)();
+#else
 	return serial_tstc();
+#endif /* CONFIG_SERIAL_MULTI */
 }
 
 #ifdef CONFIG_PRE_CONSOLE_BUFFER
@@ -382,7 +390,11 @@  void putc(const char c)
 		fputc(stdout, c);
 	} else {
 		/* Send directly to the handler */
+#ifdef CONFIG_SERIAL_MULTI
+		ESERIAL_FUNC(CONFIG_CONS_INDEX, putc)(c);
+#else
 		serial_putc(c);
+#endif /* CONFIG_SERIAL_MULTI */
 	}
 }
 
@@ -406,7 +418,11 @@  void puts(const char *s)
 		fputs(stdout, s);
 	} else {
 		/* Send directly to the handler */
+#ifdef CONFIG_SERIAL_MULTI
+		ESERIAL_FUNC(CONFIG_CONS_INDEX, puts)(s);
+#else
 		serial_puts(s);
+#endif /* CONFIG_SERIAL_MULTI */
 	}
 }
 
diff --git a/include/common.h b/include/common.h
index 55025c0..b4ebbfb 100644
--- a/include/common.h
+++ b/include/common.h
@@ -206,6 +206,11 @@  typedef void (interrupt_handler_t)(void *);
 
 #endif /* CONFIG_SERIAL_MULTI */
 
+#ifdef CONFIG_SERIAL_MULTI
+#define EXPAND_ESERIAL(x, func) eserial ## x ## _ ## func
+#define ESERIAL_FUNC(x, func) EXPAND_ESERIAL(x, func)
+#endif /* CONFIG_SERIAL_MULTI */
+
 /*
  * General Purpose Utilities
  */