Skip to contentSkip to conversation

serial: nulldev: Add nulldev serial driver

PATCH Superseded Wilson Lee 3 participants 4 messages Aug 25, 2017 – Sep 14, 2017

lore
Share & tools
lore

Wilson Lee

author
#0 lore raw

PATCH v2 1/1 serial: nulldev: Add nulldev serial driver

From: Keng Soon Cheah <[email protected]>

Some device the serial console's initialization cannot run early during the boot process. Hence, nulldev serial device is helpful on that situation.

For example, if the serial module was implemented in FPGA. Serial initialization is prohibited to run until the FPGA was programmed.

This commit is to adding nulldev serial driver. This will allows the default console to be specified as a nulldev.

---
 drivers/serial/Kconfig          |  7 ++++++
 drivers/serial/Makefile         |  1 +
 drivers/serial/serial_nulldev.c | 48 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+)
 create mode 100644 drivers/serial/serial_nulldev.c
drivers/serial/Kconfig +7 -0
index a8e9978..5064edf 100644
@@ -409,6 +409,13 @@ config MXC_UART
 	  If you have a machine based on a Motorola IMX CPU you
 	  can enable its onboard serial port by enabling this option.
 
+config NULLDEV_SERIAL
+	bool "Null serial device"
+	help
+	  Select this to enable null serial device support. A null serial
+	  device merely acts as a placeholder for a serial device and does
+	  nothing for all it's operation.
+
 config PIC32_SERIAL
 	bool "Support for Microchip PIC32 on-chip UART"
 	depends on DM_SERIAL && MACH_PIC32
drivers/serial/Makefile +1 -0
index 72a6996..7adcee3 100644
@@ -49,6 +49,7 @@ obj-$(CONFIG_BCM283X_MU_SERIAL) += serial_bcm283x_mu.o
 obj-$(CONFIG_MSM_SERIAL) += serial_msm.o
 obj-$(CONFIG_MVEBU_A3700_UART) += serial_mvebu_a3700.o
 obj-$(CONFIG_MPC8XX_CONS) += serial_mpc8xx.o
+obj-$(CONFIG_NULLDEV_SERIAL) += serial_nulldev.o
 
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_USB_TTY) += usbtty.o
drivers/serial/serial_nulldev.c new file +48 -0

48 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 serial: nulldev: Add nulldev serial driver

Hi Wilson,

Quoted 9 lines · Wilson Lee

From: Keng Soon Cheah <[email protected]>

Some device the serial console's initialization cannot run early during the boot process. Hence, nulldev serial device is helpful on that situation.

For example, if the serial module was implemented in FPGA. Serial initialization is prohibited to run until the FPGA was programmed.

I still don't fully understand this. Shouldn't the FPGA serial driver has some sort of register bits that determine if it's ready? And if not ready, the FPGA serial driver can do nothing like your null serial driver does?

Quoted 6 lines

This commit is to adding nulldev serial driver. This will allows the default console to be specified as a nulldev.

Quoted 7 lines
---
 drivers/serial/Kconfig          |  7 ++++++
 drivers/serial/Makefile         |  1 +
 drivers/serial/serial_nulldev.c | 48 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+)
 create mode 100644 drivers/serial/serial_nulldev.c

[snip]

Regards,
Bin

author
#2 lore raw

PATCH v2 1/1 serial: nulldev: Add nulldev serial driver

Hi Bin Meng,

Quoted 12 lines · Bin Meng

Hi Wilson,

Quoted 8 lines · Wilson Lee

From: Keng Soon Cheah <[email protected]>

Some device the serial console's initialization cannot run early during
the boot process. Hence, nulldev serial device is helpful on that situation.

Quoted 9 lines
Quoted 3 lines

For example, if the serial module was implemented in FPGA. Serial initialization is prohibited to run until the FPGA was programmed.

I still don't fully understand this. Shouldn't the FPGA serial driver has some sort of register bits that determine if it's ready? And if not ready, the FPGA serial driver can do nothing like your null serial
driver does?

In most case we will not implement new FPGA serial driver. For example, we will try to implement the ns16550 serial module in FPGA and reuse the ns16550 driver that already exist in u-boot. The ns16550 driver will not know when is the right time to initialize the console hence causing system halt.

This nulldev console will eventually help to prevent such situation. Before the FPGA is ready, all the console initialization and output will be redirect to this nulldev console. After the FPGA is ready, "user" have the "flexibility" redirect the console to ns16550 serial module in FPGA.

Quoted 16 lines
Quoted 8 lines

This commit is to adding nulldev serial driver. This will allows the
default console to be specified as a nulldev.

Quoted 8 lines

---
 drivers/serial/Kconfig          |  7 ++++++
 drivers/serial/Makefile         |  1 +
 drivers/serial/serial_nulldev.c | 48
+++++++++++++++++++++++++++++++++++++++++

 3 files changed, 56 insertions(+)

 create mode 100644 drivers/serial/serial_nulldev.c

Quoted 4 lines

[snip]

Regards,
Bin

Thanks.

Best Regards,
Wilson Lee

#3 lore raw

PATCH v2 1/1 serial: nulldev: Add nulldev serial driver

In reply to Wilson Lee
Quoted 9 lines · Wilson Lee

From: Keng Soon Cheah <[email protected]>

Some device the serial console's initialization cannot run early during the boot process. Hence, nulldev serial device is helpful on that situation.

For example, if the serial module was implemented in FPGA. Serial initialization is prohibited to run until the FPGA was programmed.

Quoted 6 lines

This commit is to adding nulldev serial driver. This will allows the default console to be specified as a nulldev.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170913/d0e74c26/attachment.sig>