All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] serial: Remove the "serial" console device
@ 2012-11-01 21:46 Joe Hershberger
  2012-11-01 21:46 ` [U-Boot] [PATCH 2/2] serial: Make nulldev a serial device Joe Hershberger
  2012-11-03  1:35 ` [U-Boot] [PATCH 1/2] serial: Remove the "serial" console device Marek Vasut
  0 siblings, 2 replies; 14+ messages in thread
From: Joe Hershberger @ 2012-11-01 21:46 UTC (permalink / raw)
  To: u-boot

Each serial device is added as a console device.  There was also the
"serial" device that points to the most-recently-assigned-to-some-
console-handle device.  This can be confusing.  Instead, only show the
actual serial devices.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---
 common/console.c | 37 +++++++++++++++++++------------------
 common/stdio.c   | 12 +-----------
 2 files changed, 20 insertions(+), 29 deletions(-)

diff --git a/common/console.c b/common/console.c
index 1177f7d..9cc8197 100644
--- a/common/console.c
+++ b/common/console.c
@@ -26,6 +26,7 @@
 #include <malloc.h>
 #include <stdio_dev.h>
 #include <exports.h>
+#include <serial.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -550,6 +551,7 @@ int console_assign(int file, const char *devname)
 {
 	int flag;
 	struct stdio_dev *dev;
+	const char *realdevname;
 
 	/* Check for valid file */
 	switch (file) {
@@ -565,8 +567,12 @@ int console_assign(int file, const char *devname)
 	}
 
 	/* Check for valid device name */
+	if (strcmp(devname, "serial") == 0)
+		realdevname = default_serial_console()->name;
+	else
+		realdevname = devname;
 
-	dev = search_device(flag, devname);
+	dev = search_device(flag, realdevname);
 
 	if (dev)
 		return console_setfile(file, dev);
@@ -657,13 +663,16 @@ int console_init_r(void)
 	}
 	/* if the devices are overwritten or not found, use default device */
 	if (inputdev == NULL) {
-		inputdev  = search_device(DEV_FLAGS_INPUT,  "serial");
+		inputdev  = search_device(DEV_FLAGS_INPUT,
+			default_serial_console()->name);
 	}
 	if (outputdev == NULL) {
-		outputdev = search_device(DEV_FLAGS_OUTPUT, "serial");
+		outputdev = search_device(DEV_FLAGS_OUTPUT,
+			default_serial_console()->name);
 	}
 	if (errdev == NULL) {
-		errdev    = search_device(DEV_FLAGS_OUTPUT, "serial");
+		errdev = search_device(DEV_FLAGS_OUTPUT,
+			default_serial_console()->name);
 	}
 	/* Initializes output console first */
 	if (outputdev != NULL) {
@@ -713,18 +722,10 @@ int console_init_r(void)
 	struct list_head *pos;
 	struct stdio_dev *dev;
 
-#ifdef CONFIG_SPLASH_SCREEN
-	/*
-	 * suppress all output if splash screen is enabled and we have
-	 * a bmp to display. We redirect the output from frame buffer
-	 * console to serial console in this case or suppress it if
-	 * "silent" mode was requested.
-	 */
-	if (getenv("splashimage") != NULL) {
-		if (!(gd->flags & GD_FLG_SILENT))
-			outputdev = search_device (DEV_FLAGS_OUTPUT, "serial");
-	}
-#endif
+	outputdev = search_device(DEV_FLAGS_OUTPUT,
+		default_serial_console()->name);
+	inputdev = search_device(DEV_FLAGS_INPUT,
+		default_serial_console()->name);
 
 	/* Scan devices looking for input and output devices */
 	list_for_each(pos, list) {
@@ -760,13 +761,13 @@ int console_init_r(void)
 
 	gd->flags |= GD_FLG_DEVINIT;	/* device initialization completed */
 
-	stdio_print_current_devices();
-
 	/* Setting environment variables */
 	for (i = 0; i < 3; i++) {
 		setenv(stdio_names[i], stdio_devices[i]->name);
 	}
 
+	stdio_print_current_devices();
+
 #if 0
 	/* If nothing usable installed, use only the initial console */
 	if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL))
diff --git a/common/stdio.c b/common/stdio.c
index 605ff3f..e9bdc0e 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -70,21 +70,11 @@ int nulldev_input(void)
 
 static void drv_system_init (void)
 {
+#ifdef CONFIG_SYS_DEVICE_NULLDEV
 	struct stdio_dev dev;
 
 	memset (&dev, 0, sizeof (dev));
 
-	strcpy (dev.name, "serial");
-	dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
-	dev.putc = serial_putc;
-	dev.puts = serial_puts;
-	dev.getc = serial_getc;
-	dev.tstc = serial_tstc;
-	stdio_register (&dev);
-
-#ifdef CONFIG_SYS_DEVICE_NULLDEV
-	memset (&dev, 0, sizeof (dev));
-
 	strcpy (dev.name, "nulldev");
 	dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
 	dev.putc = nulldev_putc;
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/2] serial: Make nulldev a serial device
  2012-11-01 21:46 [U-Boot] [PATCH 1/2] serial: Remove the "serial" console device Joe Hershberger
@ 2012-11-01 21:46 ` Joe Hershberger
  2012-11-03  1:37   ` Marek Vasut
  2012-11-03  1:35 ` [U-Boot] [PATCH 1/2] serial: Remove the "serial" console device Marek Vasut
  1 sibling, 1 reply; 14+ messages in thread
From: Joe Hershberger @ 2012-11-01 21:46 UTC (permalink / raw)
  To: u-boot

This allows the default console to be specified as the nulldev.  This is
specifically helpful when the real serial console's init() cannot run
early in the boot process.  When the init can be run, then the console
can be switched to the real device using the std* env vars.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---
 common/stdio.c          | 37 -----------------------------------
 drivers/serial/serial.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++
 include/serial.h        |  4 ++++
 3 files changed, 56 insertions(+), 37 deletions(-)

diff --git a/common/stdio.c b/common/stdio.c
index e9bdc0e..37d36cb 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -40,29 +40,6 @@ static struct stdio_dev devs;
 struct stdio_dev *stdio_devices[] = { NULL, NULL, NULL };
 char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" };
 
-#if defined(CONFIG_SPLASH_SCREEN) && !defined(CONFIG_SYS_DEVICE_NULLDEV)
-#define	CONFIG_SYS_DEVICE_NULLDEV	1
-#endif
-
-
-#ifdef CONFIG_SYS_DEVICE_NULLDEV
-void nulldev_putc(const char c)
-{
-	/* nulldev is empty! */
-}
-
-void nulldev_puts(const char *s)
-{
-	/* nulldev is empty! */
-}
-
-int nulldev_input(void)
-{
-	/* nulldev is empty! */
-	return 0;
-}
-#endif
-
 /**************************************************************************
  * SYSTEM DRIVERS
  **************************************************************************
@@ -70,20 +47,6 @@ int nulldev_input(void)
 
 static void drv_system_init (void)
 {
-#ifdef CONFIG_SYS_DEVICE_NULLDEV
-	struct stdio_dev dev;
-
-	memset (&dev, 0, sizeof (dev));
-
-	strcpy (dev.name, "nulldev");
-	dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
-	dev.putc = nulldev_putc;
-	dev.puts = nulldev_puts;
-	dev.getc = nulldev_input;
-	dev.tstc = nulldev_input;
-
-	stdio_register (&dev);
-#endif
 }
 
 /**************************************************************************
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index f5f43a6..5031b00 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -110,6 +110,57 @@ serial_initfunc(s3c44b0_serial_initialize);
 serial_initfunc(sa1100_serial_initialize);
 serial_initfunc(sh_serial_initialize);
 
+#if defined(CONFIG_SPLASH_SCREEN) && !defined(CONFIG_SYS_DEVICE_NULLDEV)
+#define	CONFIG_SYS_DEVICE_NULLDEV
+#endif
+
+#if defined(CONFIG_SYS_DEVICE_NULLDEV)
+int nulldev_init(void)
+{
+	/* nulldev is empty! */
+	return 0;
+}
+
+void nulldev_setbrg(void)
+{
+	/* nulldev is empty! */
+}
+
+void nulldev_putc(const char c)
+{
+	/* nulldev is empty! */
+}
+
+void nulldev_puts(const char *s)
+{
+	/* nulldev is empty! */
+}
+
+int nulldev_input(void)
+{
+	/* nulldev is empty! */
+	return 0;
+}
+
+struct serial_device nulldev_serial_device = {
+	"nulldev",
+	nulldev_init,
+	NULL,
+	nulldev_setbrg,
+	nulldev_input,
+	nulldev_input,
+	nulldev_putc,
+	nulldev_puts,
+};
+
+void nulldev_serial_initalize(void)
+{
+	serial_register(&nulldev_serial_device);
+}
+#else
+serial_initfunc(nulldev_serial_initalize);
+#endif
+
 /**
  * serial_register() - Register serial driver with serial driver core
  * @dev:	Pointer to the serial driver structure
@@ -154,6 +205,7 @@ void serial_register(struct serial_device *dev)
  */
 void serial_initialize(void)
 {
+	nulldev_serial_initalize();
 	mpc8xx_serial_initialize();
 	ns16550_serial_initialize();
 	pxa_serial_initialize();
diff --git a/include/serial.h b/include/serial.h
index 14f863e..3d404da 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -22,6 +22,10 @@ struct serial_device {
 
 void default_serial_puts(const char *s);
 
+#if defined(CONFIG_SYS_DEVICE_NULLDEV)
+extern struct serial_device nulldev_serial_device;
+#endif
+
 extern struct serial_device serial_smc_device;
 extern struct serial_device serial_scc_device;
 extern struct serial_device *default_serial_console(void);
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/2] serial: Remove the "serial" console device
  2012-11-01 21:46 [U-Boot] [PATCH 1/2] serial: Remove the "serial" console device Joe Hershberger
  2012-11-01 21:46 ` [U-Boot] [PATCH 2/2] serial: Make nulldev a serial device Joe Hershberger
@ 2012-11-03  1:35 ` Marek Vasut
  2012-11-05  0:20   ` Joe Hershberger
  1 sibling, 1 reply; 14+ messages in thread
From: Marek Vasut @ 2012-11-03  1:35 UTC (permalink / raw)
  To: u-boot

Dear Joe Hershberger,

> Each serial device is added as a console device.  There was also the
> "serial" device that points to the most-recently-assigned-to-some-
> console-handle device.  This can be confusing.  Instead, only show the
> actual serial devices.
> 
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>  common/console.c | 37 +++++++++++++++++++------------------
>  common/stdio.c   | 12 +-----------
>  2 files changed, 20 insertions(+), 29 deletions(-)
> 
[...]

You also remove the nulldev, shouldn't it go via separate patch? ... but 
otherwise it's good.

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/2] serial: Make nulldev a serial device
  2012-11-01 21:46 ` [U-Boot] [PATCH 2/2] serial: Make nulldev a serial device Joe Hershberger
@ 2012-11-03  1:37   ` Marek Vasut
  2012-11-05  0:24     ` Joe Hershberger
  0 siblings, 1 reply; 14+ messages in thread
From: Marek Vasut @ 2012-11-03  1:37 UTC (permalink / raw)
  To: u-boot

Dear Joe Hershberger,

> This allows the default console to be specified as the nulldev.  This is
> specifically helpful when the real serial console's init() cannot run
> early in the boot process.  When the init can be run, then the console
> can be switched to the real device using the std* env vars.
> 
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>


Isn't it actually better to have null stdio device? Some systems might not even 
use serial port (and so null serial will be useless on these systems)!

[...]

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/2] serial: Remove the "serial" console device
  2012-11-03  1:35 ` [U-Boot] [PATCH 1/2] serial: Remove the "serial" console device Marek Vasut
@ 2012-11-05  0:20   ` Joe Hershberger
  2012-11-05 23:11     ` Marek Vasut
  0 siblings, 1 reply; 14+ messages in thread
From: Joe Hershberger @ 2012-11-05  0:20 UTC (permalink / raw)
  To: u-boot

Hi Marek,

On Fri, Nov 2, 2012 at 8:35 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Joe Hershberger,
>
>> Each serial device is added as a console device.  There was also the
>> "serial" device that points to the most-recently-assigned-to-some-
>> console-handle device.  This can be confusing.  Instead, only show the
>> actual serial devices.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>  common/console.c | 37 +++++++++++++++++++------------------
>>  common/stdio.c   | 12 +-----------
>>  2 files changed, 20 insertions(+), 29 deletions(-)
>>
> [...]
>
> You also remove the nulldev, shouldn't it go via separate patch? ... but
> otherwise it's good.

I'm not sure what you mean.  Where in this patch do I remove nulldev?
That's the next patch.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/2] serial: Make nulldev a serial device
  2012-11-03  1:37   ` Marek Vasut
@ 2012-11-05  0:24     ` Joe Hershberger
  2012-11-05 23:10       ` Marek Vasut
  0 siblings, 1 reply; 14+ messages in thread
From: Joe Hershberger @ 2012-11-05  0:24 UTC (permalink / raw)
  To: u-boot

Hi Marek,

On Fri, Nov 2, 2012 at 8:37 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Joe Hershberger,
>
>> This allows the default console to be specified as the nulldev.  This is
>> specifically helpful when the real serial console's init() cannot run
>> early in the boot process.  When the init can be run, then the console
>> can be switched to the real device using the std* env vars.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>
>
> Isn't it actually better to have null stdio device? Some systems might not even
> use serial port (and so null serial will be useless on these systems)!

As I described in my commit log, this is for the case where the serial
and console init must not touch the hardware, (since it doesn't exist
yet if it's in an FPGA or on a PCI or USB connection).  Making the
default serial port be the nulldev avoids this issue.

As for systems with no real serial port, there can still be the
nulldev serial device... or not.  Why is that a problem?

-Joe

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/2] serial: Make nulldev a serial device
  2012-11-05  0:24     ` Joe Hershberger
@ 2012-11-05 23:10       ` Marek Vasut
  2012-11-06  0:01         ` Joe Hershberger
  0 siblings, 1 reply; 14+ messages in thread
From: Marek Vasut @ 2012-11-05 23:10 UTC (permalink / raw)
  To: u-boot

Dear Joe Hershberger,

> Hi Marek,
> 
> On Fri, Nov 2, 2012 at 8:37 PM, Marek Vasut <marex@denx.de> wrote:
> > Dear Joe Hershberger,
> > 
> >> This allows the default console to be specified as the nulldev.  This is
> >> specifically helpful when the real serial console's init() cannot run
> >> early in the boot process.  When the init can be run, then the console
> >> can be switched to the real device using the std* env vars.
> >> 
> >> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> > 
> > Isn't it actually better to have null stdio device? Some systems might
> > not even use serial port (and so null serial will be useless on these
> > systems)!
> 
> As I described in my commit log, this is for the case where the serial
> and console init must not touch the hardware, (since it doesn't exist
> yet if it's in an FPGA or on a PCI or USB connection).  Making the
> default serial port be the nulldev avoids this issue.

So add nulldev serial device for this stupid case. Even though fixing iomux such 
that it'd not send anything to serial port at all if nulldev is selected would 
be even better idea.

That won't work?

> As for systems with no real serial port, there can still be the
> nulldev serial device... or not.  Why is that a problem?
> 
> -Joe

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/2] serial: Remove the "serial" console device
  2012-11-05  0:20   ` Joe Hershberger
@ 2012-11-05 23:11     ` Marek Vasut
  2012-11-05 23:45       ` Joe Hershberger
  0 siblings, 1 reply; 14+ messages in thread
From: Marek Vasut @ 2012-11-05 23:11 UTC (permalink / raw)
  To: u-boot

Dear Joe Hershberger,

> Hi Marek,
> 
> On Fri, Nov 2, 2012 at 8:35 PM, Marek Vasut <marex@denx.de> wrote:
> > Dear Joe Hershberger,
> > 
> >> Each serial device is added as a console device.  There was also the
> >> "serial" device that points to the most-recently-assigned-to-some-
> >> console-handle device.  This can be confusing.  Instead, only show the
> >> actual serial devices.
> >> 
> >> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> >> ---
> >> 
> >>  common/console.c | 37 +++++++++++++++++++------------------
> >>  common/stdio.c   | 12 +-----------
> >>  2 files changed, 20 insertions(+), 29 deletions(-)
> > 
> > [...]
> > 
> > You also remove the nulldev, shouldn't it go via separate patch? ... but
> > otherwise it's good.
> 
> I'm not sure what you mean.  Where in this patch do I remove nulldev?
> That's the next patch.

The adjustment in common/stdio.c

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/2] serial: Remove the "serial" console device
  2012-11-05 23:11     ` Marek Vasut
@ 2012-11-05 23:45       ` Joe Hershberger
  2012-11-05 23:55         ` Marek Vasut
  0 siblings, 1 reply; 14+ messages in thread
From: Joe Hershberger @ 2012-11-05 23:45 UTC (permalink / raw)
  To: u-boot

Hi Marek,

On Mon, Nov 5, 2012 at 5:11 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Joe Hershberger,
>
>> Hi Marek,
>>
>> On Fri, Nov 2, 2012 at 8:35 PM, Marek Vasut <marex@denx.de> wrote:
>> > Dear Joe Hershberger,
>> >
>> >> Each serial device is added as a console device.  There was also the
>> >> "serial" device that points to the most-recently-assigned-to-some-
>> >> console-handle device.  This can be confusing.  Instead, only show the
>> >> actual serial devices.
>> >>
>> >> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> >> ---
>> >>
>> >>  common/console.c | 37 +++++++++++++++++++------------------
>> >>  common/stdio.c   | 12 +-----------
>> >>  2 files changed, 20 insertions(+), 29 deletions(-)
>> >
>> > [...]
>> >
>> > You also remove the nulldev, shouldn't it go via separate patch? ... but
>> > otherwise it's good.
>>
>> I'm not sure what you mean.  Where in this patch do I remove nulldev?
>> That's the next patch.
>
> The adjustment in common/stdio.c

I think you are reading the diff wrong.  The only nulldev related
"change" is to not get warnings due to a (now) unused variable.  It
simply guards the definition of the variable with the NULLDEV #ifdef.

-Joe

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 1/2] serial: Remove the "serial" console device
  2012-11-05 23:45       ` Joe Hershberger
@ 2012-11-05 23:55         ` Marek Vasut
  0 siblings, 0 replies; 14+ messages in thread
From: Marek Vasut @ 2012-11-05 23:55 UTC (permalink / raw)
  To: u-boot

Dear Joe Hershberger,

> Hi Marek,
> 
> On Mon, Nov 5, 2012 at 5:11 PM, Marek Vasut <marex@denx.de> wrote:
> > Dear Joe Hershberger,
> > 
> >> Hi Marek,
> >> 
> >> On Fri, Nov 2, 2012 at 8:35 PM, Marek Vasut <marex@denx.de> wrote:
> >> > Dear Joe Hershberger,
> >> > 
> >> >> Each serial device is added as a console device.  There was also the
> >> >> "serial" device that points to the most-recently-assigned-to-some-
> >> >> console-handle device.  This can be confusing.  Instead, only show
> >> >> the actual serial devices.
> >> >> 
> >> >> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> >> >> ---
> >> >> 
> >> >>  common/console.c | 37 +++++++++++++++++++------------------
> >> >>  common/stdio.c   | 12 +-----------
> >> >>  2 files changed, 20 insertions(+), 29 deletions(-)
> >> > 
> >> > [...]
> >> > 
> >> > You also remove the nulldev, shouldn't it go via separate patch? ...
> >> > but otherwise it's good.
> >> 
> >> I'm not sure what you mean.  Where in this patch do I remove nulldev?
> >> That's the next patch.
> > 
> > The adjustment in common/stdio.c
> 
> I think you are reading the diff wrong.  The only nulldev related
> "change" is to not get warnings due to a (now) unused variable.  It
> simply guards the definition of the variable with the NULLDEV #ifdef.

Ok

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/2] serial: Make nulldev a serial device
  2012-11-05 23:10       ` Marek Vasut
@ 2012-11-06  0:01         ` Joe Hershberger
  2012-11-06  0:47           ` Marek Vasut
  0 siblings, 1 reply; 14+ messages in thread
From: Joe Hershberger @ 2012-11-06  0:01 UTC (permalink / raw)
  To: u-boot

Hi Marek.

On Mon, Nov 5, 2012 at 5:10 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Joe Hershberger,
>
>> Hi Marek,
>>
>> On Fri, Nov 2, 2012 at 8:37 PM, Marek Vasut <marex@denx.de> wrote:
>> > Dear Joe Hershberger,
>> >
>> >> This allows the default console to be specified as the nulldev.  This is
>> >> specifically helpful when the real serial console's init() cannot run
>> >> early in the boot process.  When the init can be run, then the console
>> >> can be switched to the real device using the std* env vars.
>> >>
>> >> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> >
>> > Isn't it actually better to have null stdio device? Some systems might
>> > not even use serial port (and so null serial will be useless on these
>> > systems)!
>>
>> As I described in my commit log, this is for the case where the serial
>> and console init must not touch the hardware, (since it doesn't exist
>> yet if it's in an FPGA or on a PCI or USB connection).  Making the
>> default serial port be the nulldev avoids this issue.
>
> So add nulldev serial device for this stupid case. Even though fixing iomux such
> that it'd not send anything to serial port at all if nulldev is selected would
> be even better idea.

It's not a problem of something being sent to the serial port.  It's
the call to serial_init() in arch/*/lib/board.c that kills it.  That
call needs to be no-op-able.

-Joe

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/2] serial: Make nulldev a serial device
  2012-11-06  0:01         ` Joe Hershberger
@ 2012-11-06  0:47           ` Marek Vasut
  2012-11-06  1:00             ` Joe Hershberger
  0 siblings, 1 reply; 14+ messages in thread
From: Marek Vasut @ 2012-11-06  0:47 UTC (permalink / raw)
  To: u-boot

Dear Joe Hershberger,

> Hi Marek.
> 
> On Mon, Nov 5, 2012 at 5:10 PM, Marek Vasut <marex@denx.de> wrote:
> > Dear Joe Hershberger,
> > 
> >> Hi Marek,
> >> 
> >> On Fri, Nov 2, 2012 at 8:37 PM, Marek Vasut <marex@denx.de> wrote:
> >> > Dear Joe Hershberger,
> >> > 
> >> >> This allows the default console to be specified as the nulldev.  This
> >> >> is specifically helpful when the real serial console's init() cannot
> >> >> run early in the boot process.  When the init can be run, then the
> >> >> console can be switched to the real device using the std* env vars.
> >> >> 
> >> >> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> >> > 
> >> > Isn't it actually better to have null stdio device? Some systems might
> >> > not even use serial port (and so null serial will be useless on these
> >> > systems)!
> >> 
> >> As I described in my commit log, this is for the case where the serial
> >> and console init must not touch the hardware, (since it doesn't exist
> >> yet if it's in an FPGA or on a PCI or USB connection).  Making the
> >> default serial port be the nulldev avoids this issue.
> > 
> > So add nulldev serial device for this stupid case. Even though fixing
> > iomux such that it'd not send anything to serial port at all if nulldev
> > is selected would be even better idea.
> 
> It's not a problem of something being sent to the serial port.  It's
> the call to serial_init() in arch/*/lib/board.c that kills it.  That
> call needs to be no-op-able.

Why?

What about fixing serial_init like this:

struct serial_device *dev = get_current();
int ret = 0;
if (dev)
  ret = dev->start();

return ret;

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/2] serial: Make nulldev a serial device
  2012-11-06  0:47           ` Marek Vasut
@ 2012-11-06  1:00             ` Joe Hershberger
  2012-11-06  1:11               ` Marek Vasut
  0 siblings, 1 reply; 14+ messages in thread
From: Joe Hershberger @ 2012-11-06  1:00 UTC (permalink / raw)
  To: u-boot

Hi Marek,

On Mon, Nov 5, 2012 at 6:47 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Joe Hershberger,
>
>> Hi Marek.
>>
>> On Mon, Nov 5, 2012 at 5:10 PM, Marek Vasut <marex@denx.de> wrote:
>> > Dear Joe Hershberger,
>> >
>> >> Hi Marek,
>> >>
>> >> On Fri, Nov 2, 2012 at 8:37 PM, Marek Vasut <marex@denx.de> wrote:
>> >> > Dear Joe Hershberger,
>> >> >
>> >> >> This allows the default console to be specified as the nulldev.  This
>> >> >> is specifically helpful when the real serial console's init() cannot
>> >> >> run early in the boot process.  When the init can be run, then the
>> >> >> console can be switched to the real device using the std* env vars.
>> >> >>
>> >> >> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> >> >
>> >> > Isn't it actually better to have null stdio device? Some systems might
>> >> > not even use serial port (and so null serial will be useless on these
>> >> > systems)!
>> >>
>> >> As I described in my commit log, this is for the case where the serial
>> >> and console init must not touch the hardware, (since it doesn't exist
>> >> yet if it's in an FPGA or on a PCI or USB connection).  Making the
>> >> default serial port be the nulldev avoids this issue.
>> >
>> > So add nulldev serial device for this stupid case. Even though fixing
>> > iomux such that it'd not send anything to serial port at all if nulldev
>> > is selected would be even better idea.
>>
>> It's not a problem of something being sent to the serial port.  It's
>> the call to serial_init() in arch/*/lib/board.c that kills it.  That
>> call needs to be no-op-able.
>
> Why?
>
> What about fixing serial_init like this:
>
> struct serial_device *dev = get_current();
> int ret = 0;
> if (dev)
>   ret = dev->start();
>
> return ret;

How does this help?  Are you suggesting that default_serial_console()
return "NULL"?  It seems that you would then have to add a ton of
checks for NULL coming back from default_serial_console() all the
places that just use it assuming it's actually a device pointer.
Sounds ugly.  If you aren't talking about having
default_serial_console() return NULL, then I don't see how this helps.

-Joe

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [U-Boot] [PATCH 2/2] serial: Make nulldev a serial device
  2012-11-06  1:00             ` Joe Hershberger
@ 2012-11-06  1:11               ` Marek Vasut
  0 siblings, 0 replies; 14+ messages in thread
From: Marek Vasut @ 2012-11-06  1:11 UTC (permalink / raw)
  To: u-boot

Dear Joe Hershberger,

> Hi Marek,
> 
> On Mon, Nov 5, 2012 at 6:47 PM, Marek Vasut <marex@denx.de> wrote:
> > Dear Joe Hershberger,
> > 
> >> Hi Marek.
> >> 
> >> On Mon, Nov 5, 2012 at 5:10 PM, Marek Vasut <marex@denx.de> wrote:
> >> > Dear Joe Hershberger,
> >> > 
> >> >> Hi Marek,
> >> >> 
> >> >> On Fri, Nov 2, 2012 at 8:37 PM, Marek Vasut <marex@denx.de> wrote:
> >> >> > Dear Joe Hershberger,
> >> >> > 
> >> >> >> This allows the default console to be specified as the nulldev. 
> >> >> >> This is specifically helpful when the real serial console's
> >> >> >> init() cannot run early in the boot process.  When the init can
> >> >> >> be run, then the console can be switched to the real device using
> >> >> >> the std* env vars.
> >> >> >> 
> >> >> >> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> >> >> > 
> >> >> > Isn't it actually better to have null stdio device? Some systems
> >> >> > might not even use serial port (and so null serial will be useless
> >> >> > on these systems)!
> >> >> 
> >> >> As I described in my commit log, this is for the case where the
> >> >> serial and console init must not touch the hardware, (since it
> >> >> doesn't exist yet if it's in an FPGA or on a PCI or USB connection).
> >> >>  Making the default serial port be the nulldev avoids this issue.
> >> > 
> >> > So add nulldev serial device for this stupid case. Even though fixing
> >> > iomux such that it'd not send anything to serial port at all if
> >> > nulldev is selected would be even better idea.
> >> 
> >> It's not a problem of something being sent to the serial port.  It's
> >> the call to serial_init() in arch/*/lib/board.c that kills it.  That
> >> call needs to be no-op-able.
> > 
> > Why?
> > 
> > What about fixing serial_init like this:
> > 
> > struct serial_device *dev = get_current();
> > int ret = 0;
> > if (dev)
> > 
> >   ret = dev->start();
> > 
> > return ret;
> 
> How does this help?  Are you suggesting that default_serial_console()
> return "NULL"?  It seems that you would then have to add a ton of
> checks for NULL coming back from default_serial_console() all the
> places that just use it assuming it's actually a device pointer.
> Sounds ugly.  If you aren't talking about having
> default_serial_console() return NULL, then I don't see how this helps.

Well what will default_serial_console() return in your case? You said the 
serial_init() is the problematic spot.

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-11-06  1:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-01 21:46 [U-Boot] [PATCH 1/2] serial: Remove the "serial" console device Joe Hershberger
2012-11-01 21:46 ` [U-Boot] [PATCH 2/2] serial: Make nulldev a serial device Joe Hershberger
2012-11-03  1:37   ` Marek Vasut
2012-11-05  0:24     ` Joe Hershberger
2012-11-05 23:10       ` Marek Vasut
2012-11-06  0:01         ` Joe Hershberger
2012-11-06  0:47           ` Marek Vasut
2012-11-06  1:00             ` Joe Hershberger
2012-11-06  1:11               ` Marek Vasut
2012-11-03  1:35 ` [U-Boot] [PATCH 1/2] serial: Remove the "serial" console device Marek Vasut
2012-11-05  0:20   ` Joe Hershberger
2012-11-05 23:11     ` Marek Vasut
2012-11-05 23:45       ` Joe Hershberger
2012-11-05 23:55         ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.