[RFC 1/2] ARM omap: Add null console

Sascha Hauer s.hauer at pengutronix.de
Thu Jan 12 04:13:03 EST 2012


On Wed, Jan 11, 2012 at 11:04:43PM +0530, Sanjeev Premi wrote:
> When using barebox as both 1st and 2nd stage bootloader,
> same banner gets printed - date being the only difference.
> 
> For the first stage bootloader, prints are definitely
> required during initial debug and development phases,
> but after that, they can easily be avoided.
> 
> And if we don't need prints, then we can do without the
> serial driver as well.
> 
> With this background, this patch introduces concept of
> NULL console. Most Kconfig changes are quite simple.
> 
> Separate file console_null.c was created only for ease
> of review and maintaining console_simple.c as-is.
> 
> In final version, appropriate #ifdefs in console_simple.c
> should be used.
> 
> Visually, the prompt from barebox.bin comes up is about
> a second - and appears to be much faster.
> 
> Here is comparison of the size:
> 
>    text    data     bss     dec     hex filename
>   45801    3300    4024   53125    cf85 barebox  (Before)
>   44221    3196    4020   51437    c8ed barebox  (After)
> 
> Tested on OMAP3EVM with xload configuration derived from
> omap3530_beagle_xload_defconfig.
> 
> Signed-off-by: Sanjeev Premi <premi at ti.com>
> Cc: Sascha Hauer <s.hauer at pengutronix.de>
> Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> ---
> 
>  Although I have marked the change to be specific to
>  ARM+OMAP, it could be generally applicable.
> 
>  arch/arm/mach-omap/Kconfig |    4 +-
>  common/Kconfig             |   11 +++-
>  common/Makefile            |    1 +
>  common/console_null.c      |  135 ++++++++++++++++++++++++++++++++++++++++++++
>  drivers/serial/Kconfig     |    1 +
>  5 files changed, 149 insertions(+), 3 deletions(-)
>  create mode 100644 common/console_null.c
> 
> diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
> index 72c6850..9edb4a9 100644
> --- a/arch/arm/mach-omap/Kconfig
> +++ b/arch/arm/mach-omap/Kconfig
> @@ -171,13 +171,13 @@ if MACH_OMAP3EVM
>  
>  	config OMAP3EVM_UART1
>  		bool "Use UART1"
> -		depends on MACH_OMAP3EVM
> +		depends on MACH_OMAP3EVM && !CONSOLE_NULL

Right now CONFIG_OMAP3EVM_UART1 and CONFIG_OMAP3EVM_UART3 are
exclusive options and I see no reason why they should be. To make
this a bit simpler we could do this:

#ifndef CONSOLE_NULL
	MUX_VAL(CP(UART1_TX),		(IDIS | PTD | DIS | M0));
	MUX_VAL(CP(UART1_RTS),		(IDIS | PTD | DIS | M0));
	MUX_VAL(CP(UART1_CTS),		(IEN  | PTU | DIS | M0));
	MUX_VAL(CP(UART1_RX),		(IEN  | PTD | DIS | M0));
	MUX_VAL(CP(UART3_CTS_RCTX),	(IEN  | PTD | EN  | M0));
	MUX_VAL(CP(UART3_RTS_SD),	(IDIS | PTD | DIS | M0));
	MUX_VAL(CP(UART3_RX_IRRX),	(IEN  | PTD | DIS | M0));
	MUX_VAL(CP(UART3_TX_IRTX),	(IDIS | PTD | DIS | M0));
#endif

#ifdef CONFIG_OMAP3EVM_UART1
	add_ns16550_device(...)
#endif
#ifdef CONFIG_OMAP3EVM_UART3
	add_ns16550_device(...)
#endif

> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> index 186b596..cc0e583 100644
> --- a/drivers/serial/Kconfig
> +++ b/drivers/serial/Kconfig
> @@ -56,6 +56,7 @@ config DRIVER_SERIAL_ALTERA_JTAG
>  config DRIVER_SERIAL_NS16550
>  	default n
>  	bool "NS16550 serial driver"
> +	depends on !CONSOLE_NULL

No, we don't want to add this 'depends on' to every serial driver.
Instead we should turn the serial driver menu to a menuconfig
depending on !CONSOLE_NULL.

Please split the omap specific part and the generic part into two
patches next time you send this.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list