Serial cleanup series
Subsystems (7)
cover Serial cleanup series
This series does minor cleanup on the serial subsystem. The first patch implements default_serial_puts() to put an end to endless duplication of while (*s) { putc(*s++); } variations. The further three patches make use of it and clean up the serial code slightly.
The remaining two patches annotate the serial core with proper kerneldoc documentation and add a simple template for it.
Marek Vasut (6):
serial: Implement default_serial_puts()
serial: Use default_serial_puts() in drivers
serial: Reorder serial_assign()
serial: Reorder get_current()
kerneldoc: Annotate drivers/serial/serial.c
kerneldoc: stdio: tmpl: Add stdio template
arch/mips/cpu/mips32/au1x00/au1x00_serial.c | 8 +- arch/mips/cpu/mips32/incaip/asc_serial.c | 10 +- arch/mips/cpu/xburst/jz_serial.c | 8 +- arch/powerpc/cpu/mpc5xx/serial.c | 10 +- arch/powerpc/cpu/mpc8220/uart.c | 9 +- arch/powerpc/cpu/mpc8260/serial_scc.c | 9 +- arch/powerpc/cpu/mpc8260/serial_smc.c | 9 +- arch/powerpc/cpu/mpc85xx/serial_scc.c | 9 +- arch/sparc/cpu/leon2/serial.c | 9 +- arch/sparc/cpu/leon3/serial.c | 9 +- board/Marvell/common/serial.c | 9 +- board/bmw/serial.c | 10 +- board/cogent/serial.c | 8 +- board/esd/cpci750/serial.c | 10 +- board/evb64260/serial.c | 9 +- board/pcippc2/fpga_serial.c | 7 - board/pcippc2/fpga_serial.h | 1 - board/pcippc2/pcippc2.c | 3 +- board/prodrive/p3mx/serial.c | 10 +- doc/DocBook/Makefile | 2 +- doc/DocBook/stdio.tmpl | 46 +++++++ drivers/serial/altera_jtag_uart.c | 8 +- drivers/serial/altera_uart.c | 9 +- drivers/serial/atmel_usart.c | 8 +- drivers/serial/lpc32xx_hsuart.c | 8 +- drivers/serial/mcfuart.c | 9 +- drivers/serial/ns9750_serial.c | 15 +- drivers/serial/opencores_yanu.c | 10 +- drivers/serial/s3c4510b_uart.c | 6 +- drivers/serial/s3c64xx.c | 8 +- drivers/serial/serial.c | 196 +++++++++++++++++++++++++-- drivers/serial/serial_clps7111.c | 9 +- drivers/serial/serial_imx.c | 9 +- drivers/serial/serial_ixp.c | 9 +- drivers/serial/serial_ks8695.c | 9 +- drivers/serial/serial_lh7a40x.c | 9 +- drivers/serial/serial_lpc2292.c | 9 +- drivers/serial/serial_mxc.c | 9 +- drivers/serial/serial_netarm.c | 9 +- drivers/serial/serial_pl01x.c | 9 +- drivers/serial/serial_s3c44b0.c | 9 +- drivers/serial/serial_sa1100.c | 9 +- drivers/serial/serial_sh.c | 9 +- include/serial.h | 2 + 44 files changed, 271 insertions(+), 321 deletions(-) create mode 100644 doc/DocBook/stdio.tmpl
Signature · 1 line
1.7.10.4
PATCH 1/6 serial: Implement default_serial_puts()
U-Boot contains a lot of duplicit implementations of serial_puts() call which just pipes single characters into the port in loop. Implement function that does this behavior into common code, so others can make easy use of it.
This function is called default_serial_puts() and it's sole purpose is to call putc() in loop on the whole string passed to it.
--- drivers/serial/serial.c | 7 +++++++ include/serial.h | 2 ++ 2 files changed, 9 insertions(+)
drivers/serial/serial.c +7 -0
@@ -271,6 +271,13 @@ void serial_puts(const char *s)get_current ()->puts (s); } +void default_serial_puts (const char *s) +{ +struct serial_device *dev =get_current (); +while (*s) + dev->putc (*s++); +} +#if CONFIG_POST &CONFIG_SYS_POST_UART static const int bauds[] =CONFIG_SYS_BAUDRATE_TABLE ;
include/serial.h +2 -0
@@ -20,6 +20,8 @@ struct serial_device {struct serial_device *next; }; +void default_serial_puts (const char *s); +extern struct serial_device serial_smc_device;extern struct serial_device serial_scc_device;extern struct serial_device *default_serial_console (void );
Signature · 1 line
1.7.10.4
PATCH 1/6 serial: Implement default_serial_puts()
Quoted 11 lines · Marek Vasut
U-Boot contains a lot of duplicit implementations of
serial_puts()call which just pipes single characters into the port in loop. Implement function that does this behavior into common code, so others can make easy use of it.This function is called
default_serial_puts()and it's sole purpose is to callputc()in loop on the whole string passed to it.Signed-off-by Marek Vasut <[email protected]>Cc Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>
This along with the rest of the series, applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121017/e16c11ec/attachment.pgp>
PATCH 2/6 serial: Use default_serial_puts() in drivers
In reply to Marek VasutReplace the in-place ad-hoc implementation of serial_puts() within the drivers with default_serial_puts() call. This cuts down on the code duplication quite a bit.
--- arch/mips/cpu/mips32/au1x00/au1x00_serial.c | 8 +------- arch/mips/cpu/mips32/incaip/asc_serial.c | 10 +--------- arch/mips/cpu/xburst/jz_serial.c | 8 +------- arch/powerpc/cpu/mpc5xx/serial.c | 10 +--------- arch/powerpc/cpu/mpc8220/uart.c | 9 +-------- arch/powerpc/cpu/mpc8260/serial_scc.c | 9 +-------- arch/powerpc/cpu/mpc8260/serial_smc.c | 9 +-------- arch/powerpc/cpu/mpc85xx/serial_scc.c | 9 +-------- arch/sparc/cpu/leon2/serial.c | 9 +-------- arch/sparc/cpu/leon3/serial.c | 9 +-------- board/Marvell/common/serial.c | 9 +-------- board/bmw/serial.c | 10 +--------- board/cogent/serial.c | 8 +------- board/esd/cpci750/serial.c | 10 +--------- board/evb64260/serial.c | 9 +-------- board/pcippc2/fpga_serial.c | 7 ------- board/pcippc2/fpga_serial.h | 1 - board/pcippc2/pcippc2.c | 3 ++- board/prodrive/p3mx/serial.c | 10 +--------- drivers/serial/altera_jtag_uart.c | 8 +------- drivers/serial/altera_uart.c | 9 +-------- drivers/serial/atmel_usart.c | 8 +------- drivers/serial/lpc32xx_hsuart.c | 8 +------- drivers/serial/mcfuart.c | 9 +-------- drivers/serial/ns9750_serial.c | 15 +-------------- drivers/serial/opencores_yanu.c | 10 +--------- drivers/serial/s3c4510b_uart.c | 6 ++---- drivers/serial/s3c64xx.c | 8 +------- drivers/serial/serial_clps7111.c | 9 +-------- drivers/serial/serial_imx.c | 9 +-------- drivers/serial/serial_ixp.c | 9 +-------- drivers/serial/serial_ks8695.c | 9 +-------- drivers/serial/serial_lh7a40x.c | 9 +-------- drivers/serial/serial_lpc2292.c | 9 +-------- drivers/serial/serial_mxc.c | 9 +-------- drivers/serial/serial_netarm.c | 9 +-------- drivers/serial/serial_pl01x.c | 9 +-------- drivers/serial/serial_s3c44b0.c | 9 +-------- drivers/serial/serial_sa1100.c | 9 +-------- drivers/serial/serial_sh.c | 9 +-------- 40 files changed, 40 insertions(+), 306 deletions(-)
arch/mips/cpu/mips32/au1x00/au1x00_serial.c +1 -7
@@ -103,12 +103,6 @@ static void au1x00_serial_putc(const char c) *uart_tx = (u32 )c; } -static void au1x00_serial_puts (const char *s) -{ -while (*s) -serial_putc (*s++); -} -static int au1x00_serial_getc (void ) {volatile u32 *uart_rx = (volatile u32 *)(UART0_ADDR +UART_RX );
@@ -137,7 +131,7 @@ static struct serial_device au1x00_serial_drv = { .stop = NULL, .setbrg = au1x00_serial_setbrg, .putc = au1x00_serial_putc, - .puts = au1x00_serial_puts, + .puts = default_serial_puts, .getc = au1x00_serial_getc, .tstc = au1x00_serial_tstc, };
arch/mips/cpu/mips32/incaip/asc_serial.c +1 -9
@@ -236,14 +236,6 @@ static void asc_serial_putc(const char c) } } -static void asc_serial_puts (const char *s) -{ -while (*s) - { -serial_putc (*s++); - } -} -static int asc_serial_getc (void ) {ulong symbol_mask;
@@ -292,7 +284,7 @@ static struct serial_device asc_serial_drv = { .stop = NULL, .setbrg = asc_serial_setbrg, .putc = asc_serial_putc, - .puts = asc_serial_puts, + .puts = default_serial_puts, .getc = asc_serial_getc, .tstc = asc_serial_tstc, };
arch/mips/cpu/xburst/jz_serial.c +1 -7
@@ -109,19 +109,13 @@ static int jz_serial_getc(void)return readb (&uart->rbr_thr_dllr); } -static void jz_serial_puts (const char *s) -{ -while (*s) -serial_putc (*s++); -} -static struct serial_device jz_serial_drv = { .name ="jz_serial" , .start = jz_serial_init, .stop =NULL , .setbrg = jz_serial_setbrg, .putc = jz_serial_putc, - .puts = jz_serial_puts, + .puts = default_serial_puts, .getc = jz_serial_getc, .tstc = jz_serial_tstc, };
arch/powerpc/cpu/mpc5xx/serial.c +1 -9
@@ -161,21 +161,13 @@ static void mpc5xx_serial_setbrg(void)#endif } -static void mpc5xx_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s); - ++s; - } -} -static struct serial_device mpc5xx_serial_drv = { .name ="mpc5xx_serial" , .start = mpc5xx_serial_init, .stop =NULL , .setbrg = mpc5xx_serial_setbrg, .putc = mpc5xx_serial_putc, - .puts = mpc5xx_serial_puts, + .puts = default_serial_puts, .getc = mpc5xx_serial_getc, .tstc = mpc5xx_serial_tstc, };
arch/powerpc/cpu/mpc8220/uart.c +1 -8
@@ -84,13 +84,6 @@ static void mpc8220_serial_putc(const char c) psc->xmitbuf[0 ] = c; } -static void mpc8220_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static int mpc8220_serial_getc (void ) {volatile psc8220_t *psc = (psc8220_t *)PSC_BASE ;
@@ -132,7 +125,7 @@ static struct serial_device mpc8220_serial_drv = { .stop = NULL, .setbrg = mpc8220_serial_setbrg, .putc = mpc8220_serial_putc, - .puts = mpc8220_serial_puts, + .puts = default_serial_puts, .getc = mpc8220_serial_getc, .tstc = mpc8220_serial_tstc, };
arch/powerpc/cpu/mpc8260/serial_scc.c +1 -8
@@ -217,13 +217,6 @@ static void mpc8260_scc_serial_putc(const char c) tbdf->cbd_sc |=BD_SC_READY ; } -static void mpc8260_scc_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static int mpc8260_scc_serial_getc (void ) {volatile cbd_t *rbdf;
@@ -267,7 +260,7 @@ static struct serial_device mpc8260_scc_serial_drv = { .stop = NULL, .setbrg = mpc8260_scc_serial_setbrg, .putc = mpc8260_scc_serial_putc, - .puts = mpc8260_scc_serial_puts, + .puts = default_serial_puts, .getc = mpc8260_scc_serial_getc, .tstc = mpc8260_scc_serial_tstc, };
arch/powerpc/cpu/mpc8260/serial_smc.c +1 -8
@@ -216,13 +216,6 @@ static void mpc8260_smc_serial_putc(const char c) rtx->txbd.cbd_sc |=BD_SC_READY ; } -static void mpc8260_smc_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static int mpc8260_smc_serial_getc (void ) {volatile smc_uart_t *up;
@@ -270,7 +263,7 @@ static struct serial_device mpc8260_smc_serial_drv = { .stop = NULL, .setbrg = mpc8260_smc_serial_setbrg, .putc = mpc8260_smc_serial_putc, - .puts = mpc8260_smc_serial_puts, + .puts = default_serial_puts, .getc = mpc8260_smc_serial_getc, .tstc = mpc8260_smc_serial_tstc, };
arch/powerpc/cpu/mpc85xx/serial_scc.c +1 -8
@@ -220,13 +220,6 @@ static void mpc85xx_serial_putc(const char c) tbdf->cbd_sc |=BD_SC_READY ; } -static void mpc85xx_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static int mpc85xx_serial_getc (void ) {volatile cbd_t *rbdf;
@@ -268,7 +261,7 @@ static struct serial_device mpc85xx_serial_drv = { .stop = NULL, .setbrg = mpc85xx_serial_setbrg, .putc = mpc85xx_serial_putc, - .puts = mpc85xx_serial_puts, + .puts = default_serial_puts, .getc = mpc85xx_serial_getc, .tstc = mpc85xx_serial_tstc, };
arch/sparc/cpu/leon2/serial.c +1 -8
@@ -105,13 +105,6 @@ static void leon2_serial_putc(const char c)leon2_serial_putc_raw (c); } -static void leon2_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static int leon2_serial_getc (void ) {LEON2_regs *leon2 = (LEON2_regs *)LEON2_PREGS ;
@@ -172,7 +165,7 @@ static struct serial_device leon2_serial_drv = { .stop = NULL, .setbrg = leon2_serial_setbrg, .putc = leon2_serial_putc, - .puts = leon2_serial_puts, + .puts = default_serial_puts, .getc = leon2_serial_getc, .tstc = leon2_serial_tstc, };
arch/sparc/cpu/leon3/serial.c +1 -8
@@ -99,13 +99,6 @@ static void leon3_serial_putc(const char c)leon3_serial_putc_raw (c); } -static void leon3_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static int leon3_serial_getc (void ) {if (!leon3_apbuart)
@@ -146,7 +139,7 @@ static struct serial_device leon3_serial_drv = { .stop = NULL, .setbrg = leon3_serial_setbrg, .putc = leon3_serial_putc, - .puts = leon3_serial_puts, + .puts = default_serial_puts, .getc = leon3_serial_getc, .tstc = leon3_serial_tstc, };
board/Marvell/common/serial.c +1 -8
@@ -139,20 +139,13 @@ static void marvell_serial_setbrg(void)#endif /* CONFIG_MPSC */ -static void marvell_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static struct serial_device marvell_serial_drv = { .name ="marvell_serial" , .start = marvell_serial_init, .stop =NULL , .setbrg = marvell_serial_setbrg, .putc = marvell_serial_putc, - .puts = marvell_serial_puts, + .puts = default_serial_puts, .getc = marvell_serial_getc, .tstc = marvell_serial_tstc, };
board/bmw/serial.c +1 -9
@@ -58,14 +58,6 @@ static void bmw_serial_putc(const char c)NS16550_putc (console, c); } -static void bmw_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} - -static int bmw_serial_getc (void ) {return NS16550_getc (console);
@@ -89,7 +81,7 @@ static struct serial_device bmw_serial_drv = { .stop = NULL, .setbrg = bmw_serial_setbrg, .putc = bmw_serial_putc, - .puts = bmw_serial_puts, + .puts = default_serial_puts, .getc = bmw_serial_getc, .tstc = bmw_serial_tstc, };
board/cogent/serial.c +1 -7
@@ -68,12 +68,6 @@ static void cogent_serial_putc(const char c)cma_mb_reg_write (&mbsp->ser_thr, c); } -static void cogent_serial_puts (const char *s) -{ -while (*s !='\0' ) -serial_putc (*s++); -} -static int cogent_serial_getc (void ) {cma_mb_serial *mbsp = (cma_mb_serial *)CMA_MB_SERIAL_BASE ;
@@ -96,7 +90,7 @@ static struct serial_device cogent_serial_drv = { .stop = NULL, .setbrg = cogent_serial_setbrg, .putc = cogent_serial_putc, - .puts = cogent_serial_puts, + .puts = default_serial_puts, .getc = cogent_serial_getc, .tstc = cogent_serial_tstc, };
board/esd/cpci750/serial.c +1 -9
@@ -75,21 +75,13 @@ static void cpci750_serial_setbrg(void)galbrg_set_baudrate (CONFIG_MPSC_PORT , gd->baudrate); } - -static void cpci750_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static struct serial_device cpci750_serial_drv = { .name ="cpci750_serial" , .start = cpci750_serial_init, .stop =NULL , .setbrg = cpci750_serial_setbrg, .putc = cpci750_serial_putc, - .puts = cpci750_serial_puts, + .puts = default_serial_puts, .getc = cpci750_serial_getc, .tstc = cpci750_serial_tstc, };
board/evb64260/serial.c +1 -8
@@ -139,20 +139,13 @@ static void evb64260_serial_setbrg(void)#endif /* CONFIG_MPSC */ -static void evb64260_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static struct serial_device evb64260_serial_drv = { .name ="evb64260_serial" , .start = evb64260_serial_init, .stop =NULL , .setbrg = evb64260_serial_setbrg, .putc = evb64260_serial_putc, - .puts = evb64260_serial_puts, + .puts = default_serial_puts, .getc = evb64260_serial_getc, .tstc = evb64260_serial_tstc, };
board/pcippc2/fpga_serial.c +0 -7
@@ -73,13 +73,6 @@ void fpga_serial_putc (char c) } } -void fpga_serial_puts (const char *s) -{ -while (*s) { -fpga_serial_print (*s++); - } -} -int fpga_serial_getc (void ) {while ((in8 (UART (LSR )) &0x01 ) ==0 );
board/pcippc2/fpga_serial.h +0 -1
@@ -26,7 +26,6 @@extern void fpga_serial_init (int );extern void fpga_serial_putc (char ); -extern void fpga_serial_puts (const char *);extern int fpga_serial_getc (void );extern int fpga_serial_tstc (void );extern void fpga_serial_setbrg (void );
board/pcippc2/pcippc2.c +2 -1
@@ -29,6 +29,7 @@#include <watchdog.h> #include <pci.h> #include <netdev.h> +#include <serial.h> #include "hardware.h" #include "pcippc2.h"
@@ -129,7 +130,7 @@ int misc_init_r (void)fpga_serial_init (sconsole_get_baudrate ()); sconsole_putc = fpga_serial_putc; - sconsole_puts = fpga_serial_puts; + sconsole_puts = default_serial_puts; sconsole_getc = fpga_serial_getc; sconsole_tstc = fpga_serial_tstc; sconsole_setbrg = fpga_serial_setbrg;
board/prodrive/p3mx/serial.c +1 -9
@@ -75,21 +75,13 @@ static void p3mx_serial_setbrg(void)galbrg_set_baudrate (CONFIG_MPSC_PORT , gd->baudrate); } - -static void p3mx_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static struct serial_device p3mx_serial_drv = { .name ="p3mx_serial" , .start = p3mx_serial_init, .stop =NULL , .setbrg = p3mx_serial_setbrg, .putc = p3mx_serial_putc, - .puts = p3mx_serial_puts, + .puts = default_serial_puts, .getc = p3mx_serial_getc, .tstc = p3mx_serial_tstc, };
drivers/serial/altera_jtag_uart.c +1 -7
@@ -59,12 +59,6 @@ static void altera_jtag_serial_putc(char c)writel ((unsigned char )c, &jtag->data); } -static void altera_jtag_serial_puts (const char *s) -{ -while (*s !=0 ) -serial_putc (*s++); -} -static int altera_jtag_serial_tstc (void ) {return (readl (&jtag->control) &NIOS_JTAG_RRDY );
@@ -91,7 +85,7 @@ static struct serial_device altera_jtag_serial_drv = { .stop = NULL, .setbrg = altera_jtag_serial_setbrg, .putc = altera_jtag_serial_putc, - .puts = altera_jtag_serial_puts, + .puts = default_serial_puts, .getc = altera_jtag_serial_getc, .tstc = altera_jtag_serial_tstc, };
drivers/serial/altera_uart.c +1 -8
@@ -82,13 +82,6 @@ static void altera_serial_putc(char c)writel ((unsigned char )c, &uart->txdata); } -static void altera_serial_puts (const char *s) -{ -while (*s !=0 ) { -serial_putc (*s++); - } -} -static int altera_serial_tstc (void ) {return (readl (&uart->status) &NIOS_UART_RRDY );
@@ -107,7 +100,7 @@ static struct serial_device altera_serial_drv = { .stop = NULL, .setbrg = altera_serial_setbrg, .putc = altera_serial_putc, - .puts = altera_serial_puts, + .puts = default_serial_puts, .getc = altera_serial_getc, .tstc = altera_serial_tstc, };
drivers/serial/atmel_usart.c +1 -7
@@ -86,12 +86,6 @@ static void atmel_serial_putc(char c)writel (c, &usart->thr); } -static void atmel_serial_puts (const char *s) -{ -while (*s) -serial_putc (*s++); -} -static int atmel_serial_getc (void ) {atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE ;
@@ -113,7 +107,7 @@ static struct serial_device atmel_serial_drv = { .stop = NULL, .setbrg = atmel_serial_setbrg, .putc = atmel_serial_putc, - .puts = atmel_serial_puts, + .puts = default_serial_puts, .getc = atmel_serial_getc, .tstc = atmel_serial_tstc, };
drivers/serial/lpc32xx_hsuart.c +1 -7
@@ -77,19 +77,13 @@ static int lpc32xx_serial_init(void)return 0 ; } -static void lpc32xx_serial_puts (const char *s) -{ -while (*s) -serial_putc (*s++); -} -static struct serial_device lpc32xx_serial_drv = { .name ="lpc32xx_serial" , .start = lpc32xx_serial_init, .stop =NULL , .setbrg = lpc32xx_serial_setbrg, .putc = lpc32xx_serial_putc, - .puts = lpc32xx_serial_puts, + .puts = default_serial_puts, .getc = lpc32xx_serial_getc, .tstc = lpc32xx_serial_tstc, };
drivers/serial/mcfuart.c +1 -8
@@ -87,13 +87,6 @@ static void mcf_serial_putc(const char c) uart->utb = c; } -static void mcf_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static int mcf_serial_getc (void ) {volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE );
@@ -136,7 +129,7 @@ static struct serial_device mcf_serial_drv = { .stop = NULL, .setbrg = mcf_serial_setbrg, .putc = mcf_serial_putc, - .puts = mcf_serial_puts, + .puts = default_serial_puts, .getc = mcf_serial_getc, .tstc = mcf_serial_tstc, };
drivers/serial/ns9750_serial.c +1 -14
@@ -100,19 +100,6 @@ static void ns9750_serial_putc(const char c) }/*********************************************************************** -* @Function: serial_puts -* @Return: n/a -* @Descr: writes non-zero string to the FIFO. -***********************************************************************/ - -static void ns9750_serial_puts (const char *s) -{ -while (*s) { -serial_putc ( *s++ ); - } -} - -/*********************************************************************** * @Function: serial_getc * @Return: the character read * @Descr: performs only 8bit accesses to the FIFO. No error handling
@@ -215,7 +202,7 @@ static struct serial_device ns9750_serial_drv = { .stop = NULL, .setbrg = ns9750_serial_setbrg, .putc = ns9750_serial_putc, - .puts = ns9750_serial_puts, + .puts = default_serial_puts, .getc = ns9750_serial_getc, .tstc = ns9750_serial_tstc, };
drivers/serial/opencores_yanu.c +1 -9
@@ -161,14 +161,6 @@ static void oc_serial_putc(char c)writel ((unsigned char )c, &uart->data); } -static void oc_serial_puts (const char *s) -{ -while (*s !=0 ) { -serial_putc (*s++); - } -} - -static int oc_serial_tstc (void ) {unsigned status ;
@@ -195,7 +187,7 @@ static struct serial_device oc_serial_drv = { .stop = NULL, .setbrg = oc_serial_setbrg, .putc = oc_serial_putc, - .puts = oc_serial_puts, + .puts = default_serial_puts, .getc = oc_serial_getc, .tstc = oc_serial_tstc, };
drivers/serial/s3c4510b_uart.c +2 -4
@@ -199,12 +199,10 @@ static int s3c4510b_serial_getc(void)static void s3c4510b_serial_puts (const char *s) { -while (*s) { -serial_putc (*s++); - } +default_serial_puts (s);/* busy wait for tx complete */ -while ( !uart->m_stat.bf.txComplete); +while (!uart->m_stat.bf.txComplete);/* clear break */ uart->m_ctrl.bf.sendBreak =0 ;
drivers/serial/s3c64xx.c +1 -7
@@ -166,19 +166,13 @@ static int s3c64xx_serial_tstc(void)return uart->UTRSTAT &0x1 ; } -static void s3c64xx_serial_puts (const char *s) -{ -while (*s) -serial_putc (*s++); -} -static struct serial_device s3c64xx_serial_drv = { .name ="s3c64xx_serial" , .start = s3c64xx_serial_init, .stop =NULL , .setbrg = s3c64xx_serial_setbrg, .putc = s3c64xx_serial_putc, - .puts = s3c64xx_serial_puts, + .puts = default_serial_puts, .getc = s3c64xx_serial_getc, .tstc = s3c64xx_serial_tstc, };
drivers/serial/serial_clps7111.c +1 -8
@@ -112,20 +112,13 @@ static int clps7111_serial_getc(void)return IO_UARTDR1 &0xff ; } -static void clps7111_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static struct serial_device clps7111_serial_drv = { .name ="clps7111_serial" , .start = clps7111_serial_init, .stop =NULL , .setbrg = clps7111_serial_setbrg, .putc = clps7111_serial_putc, - .puts = clps7111_serial_puts, + .puts = default_serial_puts, .getc = clps7111_serial_getc, .tstc = clps7111_serial_tstc, };
drivers/serial/serial_imx.c +1 -8
@@ -214,20 +214,13 @@ static int imx_serial_tstc(void)return 1 ; } -static void imx_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static struct serial_device imx_serial_drv = { .name ="imx_serial" , .start = imx_serial_init, .stop =NULL , .setbrg = imx_serial_setbrg, .putc = imx_serial_putc, - .puts = imx_serial_puts, + .puts = default_serial_puts, .getc = imx_serial_getc, .tstc = imx_serial_tstc, };
drivers/serial/serial_ixp.c +1 -8
@@ -121,20 +121,13 @@ static int ixp_serial_getc(void)return (char )RBR (CONFIG_SYS_IXP425_CONSOLE ) &0xff ; } -static void ixp_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static struct serial_device ixp_serial_drv = { .name ="ixp_serial" , .start = ixp_serial_init, .stop =NULL , .setbrg = ixp_serial_setbrg, .putc = ixp_serial_putc, - .puts = ixp_serial_puts, + .puts = default_serial_puts, .getc = ixp_serial_getc, .tstc = ixp_serial_tstc, };
drivers/serial/serial_ks8695.c +1 -8
@@ -102,13 +102,6 @@ static int ks8695_serial_tstc(void)return 0 ; } -static void ks8695_serial_puts (const char *s) -{ -char c; -while ((c = *s++) !=0 ) -serial_putc (c); -} -static int ks8695_serial_getc (void ) {volatile struct ks8695uart *uartp =KS8695_UART_ADDR ;
@@ -124,7 +117,7 @@ static struct serial_device ks8695_serial_drv = { .stop = NULL, .setbrg = ks8695_serial_setbrg, .putc = ks8695_serial_putc, - .puts = ks8695_serial_puts, + .puts = default_serial_puts, .getc = ks8695_serial_getc, .tstc = ks8695_serial_tstc, };
drivers/serial/serial_lh7a40x.c +1 -8
@@ -175,20 +175,13 @@ static int lh7a40x_serial_tstc(void)return (!(uart->status &UART_RXFE )); } -static void lh7a40x_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static struct serial_device lh7a40x_serial_drv = { .name ="lh7a40x_serial" , .start = lh7a40x_serial_init, .stop =NULL , .setbrg = lh7a40x_serial_setbrg, .putc = lh7a40x_serial_putc, - .puts = lh7a40x_serial_puts, + .puts = default_serial_puts, .getc = lh7a40x_serial_getc, .tstc = lh7a40x_serial_tstc, };
drivers/serial/serial_lpc2292.c +1 -8
@@ -89,13 +89,6 @@ static int lpc2292_serial_getc(void)return GET8 (U0RBR ); } -static void lpc2292_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -/* Test if there is a byte to read */ static int lpc2292_serial_tstc (void ) {
@@ -108,7 +101,7 @@ static struct serial_device lpc2292_serial_drv = { .stop = NULL, .setbrg = lpc2292_serial_setbrg, .putc = lpc2292_serial_putc, - .puts = lpc2292_serial_puts, + .puts = default_serial_puts, .getc = lpc2292_serial_getc, .tstc = lpc2292_serial_tstc, };
drivers/serial/serial_mxc.c +1 -8
@@ -187,13 +187,6 @@ static int mxc_serial_tstc(void)return 1 ; } -static void mxc_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -/* * Initialise the serial port with the given baudrate. The settings * are always 8 data bits, no parity, 1 stop bit, no start bits.
@@ -228,7 +221,7 @@ static struct serial_device mxc_serial_drv = { .stop = NULL, .setbrg = mxc_serial_setbrg, .putc = mxc_serial_putc, - .puts = mxc_serial_puts, + .puts = default_serial_puts, .getc = mxc_serial_getc, .tstc = mxc_serial_tstc, };
drivers/serial/serial_netarm.c +1 -8
@@ -182,20 +182,13 @@ static int netarm_serial_getc(void)return ch_uint &0xff ; } -static void netarm_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static struct serial_device netarm_serial_drv = { .name ="netarm_serial" , .start = netarm_serial_init, .stop =NULL , .setbrg = netarm_serial_setbrg, .putc = netarm_serial_putc, - .puts = netarm_serial_puts, + .puts = default_serial_puts, .getc = netarm_serial_getc, .tstc = netarm_serial_tstc, };
drivers/serial/serial_pl01x.c +1 -8
@@ -179,13 +179,6 @@ static void pl01x_serial_putc(const char c)pl01x_putc (CONSOLE_PORT , c); } -static void pl01x_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static int pl01x_serial_getc (void ) {return pl01x_getc (CONSOLE_PORT );
@@ -259,7 +252,7 @@ static struct serial_device pl01x_serial_drv = { .stop = NULL, .setbrg = pl01x_serial_setbrg, .putc = pl01x_serial_putc, - .puts = pl01x_serial_puts, + .puts = default_serial_puts, .getc = pl01x_serial_getc, .tstc = pl01x_serial_tstc, };
drivers/serial/serial_s3c44b0.c +1 -8
@@ -209,20 +209,13 @@ static int s3c44b0_serial_getc(void) } } -static void s3c44b0_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static struct serial_device s3c44b0_serial_drv = { .name ="s3c44b0_serial" , .start = s3c44b0_serial_init, .stop =NULL , .setbrg = s3c44b0_serial_setbrg, .putc = s3c44b0_serial_putc, - .puts = s3c44b0_serial_puts, + .puts = default_serial_puts, .getc = s3c44b0_serial_getc, .tstc = s3c44b0_serial_tstc, };
drivers/serial/serial_sa1100.c +1 -8
@@ -153,20 +153,13 @@ static int sa1100_serial_getc(void)#endif } -static void sa1100_serial_puts (const char *s) -{ -while (*s) { -serial_putc (*s++); - } -} -static struct serial_device sa1100_serial_drv = { .name ="sa1100_serial" , .start = sa1100_serial_init, .stop =NULL , .setbrg = sa1100_serial_setbrg, .putc = sa1100_serial_putc, - .puts = sa1100_serial_puts, + .puts = default_serial_puts, .getc = sa1100_serial_getc, .tstc = sa1100_serial_tstc, };
drivers/serial/serial_sh.c +1 -8
@@ -134,13 +134,6 @@ static void sh_serial_putc(const char c)serial_raw_putc (c); } -static void sh_serial_puts (const char *s) -{ -char c; -while ((c = *s++) !=0 ) -serial_putc (c); -} -static int sh_serial_tstc (void ) {return serial_rx_fifo_level () ?1 :0 ;
@@ -194,7 +187,7 @@ static struct serial_device sh_serial_drv = { .stop = NULL, .setbrg = sh_serial_setbrg, .putc = sh_serial_putc, - .puts = sh_serial_puts, + .puts = default_serial_puts, .getc = sh_serial_getc, .tstc = sh_serial_tstc, };
Signature · 1 line
1.7.10.4
PATCH 3/6 serial: Reorder serial_assign()
In reply to Marek VasutReorder serial_assign() function to get rid of the extra level of indentation. Also, adjust the return value to be -EINVAL instead of positive one to be more consistent.
--- drivers/serial/serial.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/serial/serial.c +6 -5
@@ -26,6 +26,7 @@#include <stdio_dev.h> #include <post.h> #include <linux/compiler.h> +#include <errno.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -203,13 +204,13 @@ int serial_assign(const char *name)struct serial_device *s;for (s = serial_devices; s; s = s->next) { -if (strcmp (s->name, name) ==0 ) { - serial_current = s; -return 0 ; - } +if (strcmp (s->name, name)) +continue ; + serial_current = s; +return 0 ; } -return 1 ; +return -EINVAL ; }void serial_reinit_all (void )
Signature · 1 line
1.7.10.4
PATCH 3/6 serial: Reorder serial_assign()
Quoted 29 lines · Marek Vasut
Reorder
serial_assign()function to get rid of the extra level of indentation. Also, adjust the return value to be-EINVALinstead of positive one to be more consistent.Signed-off-by Marek Vasut <[email protected]>Cc Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>--- drivers/serial/serial.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)drivers/serial/serial.c +1
-2@@ -26,6 +26,7 @@#include <stdio_dev.h> #include <post.h> #include <linux/compiler.h> +#include <errno.h> DECLARE_GLOBAL_DATA_PTR ;@@ -203,13 +204,13 @@ int serial_assign(const char *name)struct serial_device *s;for (s = serial_devices; s; s = s->next) { -if (strcmp (s->name, name) ==0 ) { - serial_current = s;
drivers/serial/serial.c int serial_assign(const char *name) · line 213
Quoted 10 lines
drivers/serial/serial.c +5
-3-return 0 ; - } +if (strcmp (s->name, name)) +continue ; + serial_current = s; +return 0 ; } -return 1 ; +return -EINVAL ;
Hi Marek, the change to return value here broke serial output on tegra. What I see is that the serial device name (s->name) is "eserial0" as set by serial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and it fails. This always used to be ok because the return code didn't indicate failure and iomux_doenv() would continue on happily, but now it causes iomux_doenv() to fail and no printfs() work after that.
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
-Allen
Signature · 1 line
nvpublic
PATCH 3/6 serial: Reorder serial_assign()
Dear Allen Martin,
[...]
Quoted 9 lines
Hi Marek, the change to return value here broke serial output on tegra. What I see is that the serial device name (
s->name) is "eserial0" as set byserial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and it fails. This always used to be ok because the return code didn't indicate failure andiomux_doenv()would continue on happily, but now it causesiomux_doenv()to fail and noprintfs()work after that.
Quoted 3 lines
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
Looking at the source, the obvious course of action is to fix iomux.c .
Quoted 1 line
-Allen
Best regards,
Marek Vasut
PATCH 3/6 serial: Reorder serial_assign()
Quoted 12 lines · Marek Vasut
Dear Allen Martin,
[...]
Quoted 9 lines
Hi Marek, the change to return value here broke serial output on tegra. What I see is that the serial device name (
s->name) is "eserial0" as set byserial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and it fails. This always used to be ok because the return code didn't indicate failure andiomux_doenv()would continue on happily, but now it causesiomux_doenv()to fail and noprintfs()work after that.
Quoted 6 lines
Quoted 3 lines
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
Looking at the source, the obvious course of action is to fix
iomux.c.
I've been looking at this call to serial_assign() from iomux.c and I'm not convinced this code does anything meaningful at all. It passes the name of a struct stdio_dev device which serial_assign() then tries to match against the registered struct serial_devices, which will never match.
What I don't understand is the case where you have a board that actually has more than one physical serial port and how the mapping from stdio_dev to serial_device happens.
Also, looking at the code to cmd_nvedit, I think your change also broke "setenv stdout" for boards that don't define CONFIG_CONSOLE_MUX. We always have this on for tegra, so we don't go down this code path, but it looks identical to the code in iomux.c
-Allen
Signature · 1 line
nvpublic
PATCH 3/6 serial: Reorder serial_assign()
Hi,
Quoted 26 lines · Allen Martin
Quoted 12 lines · Marek Vasut
Dear Allen Martin,
[...]
Quoted 9 lines
Hi Marek, the change to return value here broke serial output on tegra. What I see is that the serial device name (
s->name) is "eserial0" as set byserial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and it fails. This always used to be ok because the return code didn't indicate failure andiomux_doenv()would continue on happily, but now it causesiomux_doenv()to fail and noprintfs()work after that.Quoted 6 lines
Quoted 3 lines
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
Looking at the source, the obvious course of action is to fix
iomux.c.I've been looking at this call to
serial_assign()fromiomux.cand I'm not convinced this code does anything meaningful at all. It passes the name of a structstdio_devdevice whichserial_assign()then tries to match against the registered structserial_devices, which will never match.
Quoted 8 lines
What I don't understand is the case where you have a board that actually has more than one physical serial port and how the mapping from
stdio_devtoserial_devicehappens.Also, looking at the code to
cmd_nvedit, I think your change also broke "setenv stdout" for boards that don't defineCONFIG_CONSOLE_MUX. We always have this on for tegra, so we don't go down this code path, but it looks identical to the code iniomux.c
Sorry if I missed it - what was the resolution here? Should we revert that change?
Regards,
Simon
Quoted 8 lines
-Allen
--
nvpublic
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 3/6 serial: Reorder serial_assign()
Dear Simon Glass,
Quoted 32 lines
Hi,
Quoted 29 lines · Allen Martin
Quoted 12 lines · Marek Vasut
Dear Allen Martin,
[...]
Quoted 8 lines
Hi Marek, the change to return value here broke serial output on tegra. What I see is that the serial device name (
s->name) is "eserial0" as set byserial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and it fails. This always used to be ok because the return code didn't indicate failure andiomux_doenv()would continue on happily, but now it causesiomux_doenv()to fail and noprintfs()work after that.Quoted 5 lines
Quoted 3 lines
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
Looking at the source, the obvious course of action is to fix
iomux.c.I've been looking at this call to
serial_assign()fromiomux.cand I'm not convinced this code does anything meaningful at all. It passes the name of a structstdio_devdevice whichserial_assign()then tries to match against the registered structserial_devices, which will never match.What I don't understand is the case where you have a board that actually has more than one physical serial port and how the mapping from
stdio_devtoserial_devicehappens.
Quoted 7 lines
Quoted 4 lines
Also, looking at the code to
cmd_nvedit, I think your change also broke "setenv stdout" for boards that don't defineCONFIG_CONSOLE_MUX. We always have this on for tegra, so we don't go down this code path, but it looks identical to the code iniomux.cSorry if I missed it - what was the resolution here? Should we revert that change?
Definitelly not. We should fix the iomux.c , possibly by flipping the inequation mark as a short term solution.
Best regards,
Marek Vasut
PATCH 3/6 serial: Reorder serial_assign()
Quoted 39 lines · Marek Vasut
Dear Simon Glass,
Quoted 37 lines
Hi,
Quoted 33 lines · Allen Martin
Quoted 12 lines · Marek Vasut
Dear Allen Martin,
[...]
Quoted 8 lines
Hi Marek, the change to return value here broke serial output on tegra. What I see is that the serial device name (
s->name) is "eserial0" as set byserial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and it fails. This always used to be ok because the return code didn't indicate failure andiomux_doenv()would continue on happily, but now it causesiomux_doenv()to fail and noprintfs()work after that.Quoted 5 lines
Quoted 3 lines
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
Looking at the source, the obvious course of action is to fix
iomux.c.I've been looking at this call to
serial_assign()fromiomux.cand I'm not convinced this code does anything meaningful at all. It passes the name of a structstdio_devdevice whichserial_assign()then tries to match against the registered structserial_devices, which will never match.What I don't understand is the case where you have a board that actually has more than one physical serial port and how the mapping from
stdio_devtoserial_devicehappens.Also, looking at the code to
cmd_nvedit, I think your change also broke "setenv stdout" for boards that don't defineCONFIG_CONSOLE_MUX. We always have this on for tegra, so we don't go down this code path, but it looks identical to the code iniomux.c
Quoted 5 lines
Quoted 2 lines
Sorry if I missed it - what was the resolution here? Should we revert that change?
Definitelly not. We should fix the
iomux.c, possibly by flipping the inequation mark as a short term solution.
Adding Joe Hershberger to cc
I think its safe to remove the call to serial_assign() altogether, as it's written now it will always fail. Reading through doc/driver-model/UDM-serial.txt the CONFIG_SERIAL_MULTI case should be handled transparently underneath iomux. The part that still not clear to me is what mechanism is supposed to be used to select the current serial port in a CONFIG_SERIAL_MULTI configuration? AFAICT the only caller of serial_assign() that actually passes the name of a serial device is in serial_initialize():
serial_assign(default_serial_console()->name);
Should there be another environemnt variable that maps the stdio_dev "serial" to the current serial_device so you could do something like:
; get input from first serial port and USB keyboard
# setenv serial eserial0 # setenv stdin serial,usbkbd
; get input from second serial port and USB keyboard
# setenv serial eserial1 # setenv stdin seriak,usbkbd
-Allen
Signature · 1 line
nvpublic
PATCH 3/6 serial: Reorder serial_assign()
In reply to Marek VasutHi,
Quoted 39 lines · Marek Vasut
Dear Simon Glass,
Quoted 37 lines
Hi,
Quoted 33 lines · Allen Martin
Quoted 12 lines · Marek Vasut
Dear Allen Martin,
[...]
Quoted 8 lines
Hi Marek, the change to return value here broke serial output on tegra. What I see is that the serial device name (
s->name) is "eserial0" as set byserial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and it fails. This always used to be ok because the return code didn't indicate failure andiomux_doenv()would continue on happily, but now it causesiomux_doenv()to fail and noprintfs()work after that.Quoted 5 lines
Quoted 3 lines
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
Looking at the source, the obvious course of action is to fix
iomux.c.I've been looking at this call to
serial_assign()fromiomux.cand I'm not convinced this code does anything meaningful at all. It passes the name of a structstdio_devdevice whichserial_assign()then tries to match against the registered structserial_devices, which will never match.What I don't understand is the case where you have a board that actually has more than one physical serial port and how the mapping from
stdio_devtoserial_devicehappens.Also, looking at the code to
cmd_nvedit, I think your change also broke "setenv stdout" for boards that don't defineCONFIG_CONSOLE_MUX. We always have this on for tegra, so we don't go down this code path, but it looks identical to the code iniomux.c
Quoted 5 lines
Quoted 2 lines
Sorry if I missed it - what was the resolution here? Should we revert that change?
Definitelly not. We should fix the
iomux.c, possibly by flipping the inequation mark as a short term solution.
OK that's fine. Is someone working on a patch?
Regards,
Simon
Quoted 3 lines
Best regards,
Marek Vasut
PATCH 3/6 serial: Reorder serial_assign()
Quoted 42 lines · Simon Glass
Hi,
Quoted 39 lines · Marek Vasut
Dear Simon Glass,
Quoted 37 lines
Hi,
Quoted 33 lines · Allen Martin
Quoted 12 lines · Marek Vasut
Dear Allen Martin,
[...]
Quoted 8 lines
Hi Marek, the change to return value here broke serial output on tegra. What I see is that the serial device name (
s->name) is "eserial0" as set byserial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and it fails. This always used to be ok because the return code didn't indicate failure andiomux_doenv()would continue on happily, but now it causesiomux_doenv()to fail and noprintfs()work after that.Quoted 5 lines
Quoted 3 lines
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
Looking at the source, the obvious course of action is to fix
iomux.c.I've been looking at this call to
serial_assign()fromiomux.cand I'm not convinced this code does anything meaningful at all. It passes the name of a structstdio_devdevice whichserial_assign()then tries to match against the registered structserial_devices, which will never match.What I don't understand is the case where you have a board that actually has more than one physical serial port and how the mapping from
stdio_devtoserial_devicehappens.Also, looking at the code to
cmd_nvedit, I think your change also broke "setenv stdout" for boards that don't defineCONFIG_CONSOLE_MUX. We always have this on for tegra, so we don't go down this code path, but it looks identical to the code iniomux.c
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Sorry if I missed it - what was the resolution here? Should we revert that change?
Definitelly not. We should fix the
iomux.c, possibly by flipping the inequation mark as a short term solution.OK that's fine. Is someone working on a patch?
I'll send out my proposal for a patch. Unfortunately I don't have a board with multiple serial ports to correctly test CONFIG_SERIAL_MULTI
-Allen
Signature · 1 line
nvpublic
PATCH 3/6 serial: Reorder serial_assign()
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 59 lines · Allen Martin
Quoted 58 lines · Simon Glass
Hi,
Quoted 53 lines · Marek Vasut
Dear Simon Glass,
Quoted 40 lines
Hi,
Quoted 36 lines · Allen Martin
Quoted 15 lines · Marek Vasut
Dear Allen Martin,
[...]
Quoted 11 lines
Hi Marek, the change to return value here broke serial
output on tegra. What I see is that the serial device name (s->name) is "eserial0" as set byserial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and
it fails. This always used to be ok because the
return code didn't indicate failure andiomux_doenv()would continue on happily, but now it causesiomux_doenv()to fail and noprintfs()work after that.Quoted 7 lines
Quoted 4 lines
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
Looking at the source, the obvious course of action is to fix
iomux.c.I've been looking at this call to
serial_assign()fromiomux.cand I'm not convinced this code does anything meaningful at all. It passes the name of a structstdio_devdevice whichserial_assign()then tries to match
against the registered structserial_devices, which will
never match.What I don't understand is the case where you have a board
that actually has more than one physical serial port and
how the mapping fromstdio_devtoserial_devicehappens.Quoted 8 lines
Quoted 5 lines
Also, looking at the code to
cmd_nvedit, I think your change also broke "setenv stdout" for boards that don't defineCONFIG_CONSOLE_MUX. We always have this on for tegra, so we don't go down this code path, but it looks identical to the code iniomux.cSorry if I missed it - what was the resolution here? Should we revert that change?
Definitelly not. We should fix the
iomux.c, possibly by flipping the inequation mark as a short term solution.
Quoted 6 lines
Quoted 2 lines
OK that's fine. Is someone working on a patch?
I'll send out my proposal for a patch. Unfortunately I don't have
a board with multiple serial ports to correctly testCONFIG_SERIAL_MULTI
Andrew's recent set of patches for am335x means I do. If I follow correctly, you're describing the case where >1 port for a driver is known, we default to say 0 but want to use 1, via the env?
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
iQIcBAEBAgAGBQJQia68AAoJENk4IS6UOR1W4NYP/jlbMsXtRojPz7FOVdVSUV+K OK3Pgzc0RD1LMREnHJGRrH42Y5k9s2op0eex/yRLGVjpdyQuM8MykvJ944pDihwX +0Rw8z3oNDg1IeB3R2cgwVCH5vBRGARxr/WdvCQc51uaMDZLwwWM3smHfTvDEeeJ bYIUH9JrAjkpq7DBYCSTq9FR91iJ7hMbLaJjULQaG4Fo64ZBG9A4Llf6+hotADEd 3rHrQN8mJNuYiUYmdbP3B94NNp9+hWXb6r10I8vj2Bb331tBqCHGPOWF4U2h9D2j AHofm8hj22SDTiXNR4SRfGSjqWqc8ZrocaoKxjBTnvlqxgN9+o/w+JNogCJcJ07y zNn73DdxiztgDvoRzWz7oYiI2jF5KGAXVjPRTkY6P5v8Ybh8QF+/CX3NaHjlO7GX VvK3s9AOMqyVz69EZX0OVnaL47WEaz21cG3pA2u595/5kNKrrEbUDEc6tNzLg+vy 5ah1P/g1kqNmKIgN4UtYSKCjCRA4vC5gHs4ixqhPw31aI54YnkbMq/y0SVhvd7Fk iBpsojMQnuHPwRNLtfffqKtkcSMuTxrk2U90KXMg9DSm3cOqPXZgFwfaZH8GXUAV W0Oo7QKpzgoEY4Qm0TjME2/BA/xGh7fBqiu3SAQuE89+w9rGEpQamCkuFFEKYKRt YjHt4C0QHEjwb4kqkINx
=D41e
-----END PGP SIGNATURE-----
PATCH 3/6 serial: Reorder serial_assign()
Quoted 65 lines · Tom Rini
* PGP Signed by an unknown key
Quoted 62 lines · Allen Martin
Quoted 60 lines · Simon Glass
Hi,
Quoted 48 lines · Marek Vasut
Dear Simon Glass,
Quoted 46 lines
Hi,
Quoted 41 lines · Allen Martin
Quoted 15 lines · Marek Vasut
Dear Allen Martin,
[...]
Quoted 11 lines
Hi Marek, the change to return value here broke serial
output on tegra. What I see is that the serial device name (s->name) is "eserial0" as set byserial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and
it fails. This always used to be ok because the
return code didn't indicate failure andiomux_doenv()would continue on happily, but now it causesiomux_doenv()to fail and noprintfs()work after that.Quoted 7 lines
Quoted 4 lines
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
Looking at the source, the obvious course of action is to fix
iomux.c.I've been looking at this call to
serial_assign()fromiomux.cand I'm not convinced this code does anything meaningful at all. It passes the name of a structstdio_devdevice whichserial_assign()then tries to match
against the registered structserial_devices, which will
never match.What I don't understand is the case where you have a board
that actually has more than one physical serial port and
how the mapping fromstdio_devtoserial_devicehappens.Also, looking at the code to
cmd_nvedit, I think your change also broke "setenv stdout" for boards that don't defineCONFIG_CONSOLE_MUX. We always have this on for tegra, so we don't go down this code path, but it looks identical to the code iniomux.cQuoted 5 lines
Quoted 2 lines
Sorry if I missed it - what was the resolution here? Should we revert that change?
Definitelly not. We should fix the
iomux.c, possibly by flipping the inequation mark as a short term solution.OK that's fine. Is someone working on a patch?
Quoted 7 lines
Quoted 3 lines
I'll send out my proposal for a patch. Unfortunately I don't have
a board with multiple serial ports to correctly testCONFIG_SERIAL_MULTIAndrew's recent set of patches for am335x means I do. If I follow correctly, you're describing the case where >1 port for a driver is known, we default to say 0 but want to use 1, via the env?
Yes, exactly. I assume that's what the current calls to serial_assign() were supposed to be doing, but weren't.
-Allen
Signature · 1 line
nvpublic
PATCH 3/6 serial: Reorder serial_assign()
In reply to Allen MartinHi Allen,
Quoted 46 lines · Allen Martin
Quoted 45 lines · Simon Glass
Hi,
Quoted 42 lines · Marek Vasut
Dear Simon Glass,
Quoted 39 lines
Hi,
Quoted 25 lines · Allen Martin
Quoted 12 lines · Marek Vasut
Dear Allen Martin,
[...]
Quoted 8 lines
Hi Marek, the change to return value here broke serial output on tegra. What I see is that the serial device name (
s->name) is "eserial0" as set byserial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and it fails. This always used to be ok because the return code didn't indicate failure andiomux_doenv()would continue on happily, but now it causesiomux_doenv()to fail and noprintfs()work after that.Quoted 5 lines
Quoted 3 lines
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
Looking at the source, the obvious course of action is to fix
iomux.c.I've been looking at this call to
serial_assign()fromiomux.cand I'm not convinced this code does anything meaningful at all. It passes the name of a structstdio_devdevice whichserial_assign()then tries to match against the registered structserial_devices, which will never match.Quoted 8 lines
What I don't understand is the case where you have a board that actually has more than one physical serial port and how the mapping from
stdio_devtoserial_devicehappens.Also, looking at the code to
cmd_nvedit, I think your change also broke "setenv stdout" for boards that don't defineCONFIG_CONSOLE_MUX. We always have this on for tegra, so we don't go down this code path, but it looks identical to the code iniomux.cSorry if I missed it - what was the resolution here? Should we revert that change?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Definitelly not. We should fix the
iomux.c, possibly by flipping the inequation mark as a short term solution.OK that's fine. Is someone working on a patch?
I'll send out my proposal for a patch. Unfortunately I don't have a board with multiple serial ports to correctly test
CONFIG_SERIAL_MULTI
One of the boards I'm working on does this (has more than one). At least before the serial rework from Marek, the stdout was either the serial device directly (each serial device was added as a console device as well) so the serial setting was redundant. You could just set them directly to the serial port (which is more flexible).
I had two patches (not sent to ML before Marek made them highly conflicting) that take the opposite approach you were, since it preserves the flexibility. It removed the "serial" setting to each of the std* variables and instead sets it to the default serial device. I'll remake that patch on top of the new serial landscape sometime soon.
-Joe
PATCH 3/6 serial: Reorder serial_assign()
Dear Joe Hershberger,
Quoted 12 lines
Hi Allen,
Quoted 9 lines · Allen Martin
Quoted 8 lines · Simon Glass
Hi,
Quoted 5 lines · Marek Vasut
Dear Simon Glass,
Quoted 3 lines
Hi,
On Mon, Oct 22, 2012 at 10:23 AM, Allen Martin <[email protected]>
Quoted 48 lines · wrote:
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 39 lines
Quoted 31 lines · Marek Vasut
Quoted 13 lines
Dear Allen Martin,
[...]
Quoted 9 lines
Hi Marek, the change to return value here broke serial output on tegra. What I see is that the serial device name (
s->name) is "eserial0" as set byserial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and it fails. This always used to be ok because the return code didn't indicate failure andiomux_doenv()would continue on happily, but now it causesiomux_doenv()to fail and noprintfs()work after that.Quoted 6 lines
Quoted 3 lines
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
Looking at the source, the obvious course of action is to fix
iomux.c.I've been looking at this call to
serial_assign()fromiomux.cand I'm not convinced this code does anything meaningful at all. It passes the name of a structstdio_devdevice whichserial_assign()then tries to match against the registered structserial_devices, which will never match.What I don't understand is the case where you have a board that actually has more than one physical serial port and how the mapping from
stdio_devtoserial_devicehappens.Quoted 5 lines
Also, looking at the code to
cmd_nvedit, I think your change also broke "setenv stdout" for boards that don't defineCONFIG_CONSOLE_MUX. We always have this on for tegra, so we don't go down this code path, but it looks identical to the code iniomux.cSorry if I missed it - what was the resolution here? Should we revert that change?
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Definitelly not. We should fix the
iomux.c, possibly by flipping the inequation mark as a short term solution.OK that's fine. Is someone working on a patch?
I'll send out my proposal for a patch. Unfortunately I don't have a board with multiple serial ports to correctly test
CONFIG_SERIAL_MULTI
Quoted 8 lines
One of the boards I'm working on does this (has more than one). At least before the serial rework from Marek, the stdout was either the serial device directly (each serial device was added as a console device as well) so the serial setting was redundant. You could just set them directly to the serial port (which is more flexible).
I had two patches (not sent to ML before Marek made them highly conflicting)
I know, he's such a bastard, always breaking stuff and interfering with other people's work !
Quoted 5 lines
that take the opposite approach you were, since it preserves the flexibility. It removed the "serial" setting to each of the std* variables and instead sets it to the default serial device. I'll remake that patch on top of the new serial landscape sometime soon.
Actually, I'd like to merge the serial stuff and stdio stuff into one. So "setenv stdX serial" would be replaced with "setenv stdX <serial_driver_name>". I think that's the approach to take. But it'd break many boards.
Best regards,
Marek Vasut
PATCH 3/6 serial: Reorder serial_assign()
Quoted 81 lines · Marek Vasut
Dear Joe Hershberger,
Quoted 12 lines
Hi Allen,
Quoted 9 lines · Allen Martin
Quoted 8 lines · Simon Glass
Hi,
Quoted 5 lines · Marek Vasut
Dear Simon Glass,
Quoted 3 lines
Hi,
On Mon, Oct 22, 2012 at 10:23 AM, Allen Martin <[email protected]>
Quoted 48 lines · wrote:
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 39 lines
Quoted 31 lines · Marek Vasut
Quoted 13 lines
Dear Allen Martin,
[...]
Quoted 9 lines
Hi Marek, the change to return value here broke serial output on tegra. What I see is that the serial device name (
s->name) is "eserial0" as set byserial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and it fails. This always used to be ok because the return code didn't indicate failure andiomux_doenv()would continue on happily, but now it causesiomux_doenv()to fail and noprintfs()work after that.Quoted 6 lines
Quoted 3 lines
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
Looking at the source, the obvious course of action is to fix
iomux.c.I've been looking at this call to
serial_assign()fromiomux.cand I'm not convinced this code does anything meaningful at all. It passes the name of a structstdio_devdevice whichserial_assign()then tries to match against the registered structserial_devices, which will never match.What I don't understand is the case where you have a board that actually has more than one physical serial port and how the mapping from
stdio_devtoserial_devicehappens.Quoted 5 lines
Also, looking at the code to
cmd_nvedit, I think your change also broke "setenv stdout" for boards that don't defineCONFIG_CONSOLE_MUX. We always have this on for tegra, so we don't go down this code path, but it looks identical to the code iniomux.cSorry if I missed it - what was the resolution here? Should we revert that change?
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Definitelly not. We should fix the
iomux.c, possibly by flipping the inequation mark as a short term solution.OK that's fine. Is someone working on a patch?
I'll send out my proposal for a patch. Unfortunately I don't have a board with multiple serial ports to correctly test
CONFIG_SERIAL_MULTIQuoted 8 lines
One of the boards I'm working on does this (has more than one). At least before the serial rework from Marek, the stdout was either the serial device directly (each serial device was added as a console device as well) so the serial setting was redundant. You could just set them directly to the serial port (which is more flexible).
I had two patches (not sent to ML before Marek made them highly conflicting)
I know, he's such a bastard, always breaking stuff and interfering with other people's work !
Quoted 5 lines
that take the opposite approach you were, since it preserves the flexibility. It removed the "serial" setting to each of the std* variables and instead sets it to the default serial device. I'll remake that patch on top of the new serial landscape sometime soon.
Quoted 3 lines
Actually, I'd like to merge the serial stuff and stdio stuff into one. So "setenv stdX serial" would be replaced with "setenv stdX <
serial_driver_name>". I think that's the approach to take. But it'd break many boards.
I think that would be fine if we can also preserve "setenv stdin serial" to use the default serial device. That will mean no changes for boards that have only one serial port, which is the vast majority.
-Allen
Signature · 1 line
nvpublic
PATCH 3/6 serial: Reorder serial_assign()
In reply to Marek VasutHi Marek,
Quoted 69 lines · Marek Vasut
Dear Joe Hershberger,
Quoted 12 lines
Hi Allen,
Quoted 9 lines · Allen Martin
Quoted 8 lines · Simon Glass
Hi,
Quoted 5 lines · Marek Vasut
Dear Simon Glass,
Quoted 3 lines
Hi,
On Mon, Oct 22, 2012 at 10:23 AM, Allen Martin <[email protected]>
Quoted 54 lines · wrote:
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 39 lines
Quoted 31 lines · Marek Vasut
Quoted 13 lines
Dear Allen Martin,
[...]
Quoted 9 lines
Hi Marek, the change to return value here broke serial output on tegra. What I see is that the serial device name (
s->name) is "eserial0" as set byserial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and it fails. This always used to be ok because the return code didn't indicate failure andiomux_doenv()would continue on happily, but now it causesiomux_doenv()to fail and noprintfs()work after that.Quoted 6 lines
Quoted 3 lines
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
Looking at the source, the obvious course of action is to fix
iomux.c.I've been looking at this call to
serial_assign()fromiomux.cand I'm not convinced this code does anything meaningful at all. It passes the name of a structstdio_devdevice whichserial_assign()then tries to match against the registered structserial_devices, which will never match.What I don't understand is the case where you have a board that actually has more than one physical serial port and how the mapping from
stdio_devtoserial_devicehappens.Quoted 5 lines
Also, looking at the code to
cmd_nvedit, I think your change also broke "setenv stdout" for boards that don't defineCONFIG_CONSOLE_MUX. We always have this on for tegra, so we don't go down this code path, but it looks identical to the code iniomux.cSorry if I missed it - what was the resolution here? Should we revert that change?
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Definitelly not. We should fix the
iomux.c, possibly by flipping the inequation mark as a short term solution.OK that's fine. Is someone working on a patch?
I'll send out my proposal for a patch. Unfortunately I don't have a board with multiple serial ports to correctly test
CONFIG_SERIAL_MULTIOne of the boards I'm working on does this (has more than one). At least before the serial rework from Marek, the stdout was either the serial device directly (each serial device was added as a console device as well) so the serial setting was redundant. You could just set them directly to the serial port (which is more flexible).
Quoted 5 lines
Quoted 2 lines
I had two patches (not sent to ML before Marek made them highly conflicting)
I know, he's such a bastard, always breaking stuff and interfering with other people's work !
:)
Quoted 9 lines
Quoted 5 lines
that take the opposite approach you were, since it preserves the flexibility. It removed the "serial" setting to each of the std* variables and instead sets it to the default serial device. I'll remake that patch on top of the new serial landscape sometime soon.
Actually, I'd like to merge the serial stuff and stdio stuff into one. So "setenv stdX serial" would be replaced with "setenv stdX <
serial_driver_name>". I think that's the approach to take. But it'd break many boards.
I think that's fine. We should be able to make it work both ways. In other words, as long as there is only one serial device registered, then "serial" will be accepted. The actual name of the driver is also always accepted.
-Joe
PATCH 3/6 serial: Reorder serial_assign()
Quoted 86 lines · Joe Hershberger
Hi Marek,
Quoted 69 lines · Marek Vasut
Dear Joe Hershberger,
Quoted 12 lines
Hi Allen,
Quoted 9 lines · Allen Martin
Quoted 8 lines · Simon Glass
Hi,
Quoted 5 lines · Marek Vasut
Dear Simon Glass,
Quoted 3 lines
Hi,
On Mon, Oct 22, 2012 at 10:23 AM, Allen Martin <[email protected]>
Quoted 54 lines · wrote:
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 39 lines
Quoted 31 lines · Marek Vasut
Quoted 13 lines
Dear Allen Martin,
[...]
Quoted 9 lines
Hi Marek, the change to return value here broke serial output on tegra. What I see is that the serial device name (
s->name) is "eserial0" as set byserial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and it fails. This always used to be ok because the return code didn't indicate failure andiomux_doenv()would continue on happily, but now it causesiomux_doenv()to fail and noprintfs()work after that.Quoted 6 lines
Quoted 3 lines
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
Looking at the source, the obvious course of action is to fix
iomux.c.I've been looking at this call to
serial_assign()fromiomux.cand I'm not convinced this code does anything meaningful at all. It passes the name of a structstdio_devdevice whichserial_assign()then tries to match against the registered structserial_devices, which will never match.What I don't understand is the case where you have a board that actually has more than one physical serial port and how the mapping from
stdio_devtoserial_devicehappens.Quoted 5 lines
Also, looking at the code to
cmd_nvedit, I think your change also broke "setenv stdout" for boards that don't defineCONFIG_CONSOLE_MUX. We always have this on for tegra, so we don't go down this code path, but it looks identical to the code iniomux.cSorry if I missed it - what was the resolution here? Should we revert that change?
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Definitelly not. We should fix the
iomux.c, possibly by flipping the inequation mark as a short term solution.OK that's fine. Is someone working on a patch?
I'll send out my proposal for a patch. Unfortunately I don't have a board with multiple serial ports to correctly test
CONFIG_SERIAL_MULTIOne of the boards I'm working on does this (has more than one). At least before the serial rework from Marek, the stdout was either the serial device directly (each serial device was added as a console device as well) so the serial setting was redundant. You could just set them directly to the serial port (which is more flexible).
Quoted 5 lines
Quoted 2 lines
I had two patches (not sent to ML before Marek made them highly conflicting)
I know, he's such a bastard, always breaking stuff and interfering with other people's work !
:)
Quoted 6 lines
Quoted 5 lines
that take the opposite approach you were, since it preserves the flexibility. It removed the "serial" setting to each of the std* variables and instead sets it to the default serial device. I'll remake that patch on top of the new serial landscape sometime soon.
Quoted 8 lines
Quoted 3 lines
Actually, I'd like to merge the serial stuff and stdio stuff into one. So "setenv stdX serial" would be replaced with "setenv stdX <
serial_driver_name>". I think that's the approach to take. But it'd break many boards.I think that's fine. We should be able to make it work both ways. In other words, as long as there is only one serial device registered, then "serial" will be accepted. The actual name of the driver is also always accepted.
Or, ever better we could just say "serial" always maps to default_serial_console() and that should map exactly to existing functionality regardless if there is one or more serial devices. Then any board that wants more precise control can use the name of the serial driver instead.
-Allen
Signature · 1 line
nvpublic
PATCH 3/6 serial: Reorder serial_assign()
Dear Allen Martin,
Quoted 102 lines · Joe Hershberger
Quoted 96 lines
Hi Marek,
Quoted 74 lines · Marek Vasut
Dear Joe Hershberger,
Quoted 13 lines
Hi Allen,
Quoted 10 lines · Allen Martin
Quoted 9 lines · Simon Glass
Hi,
Quoted 6 lines · Marek Vasut
Dear Simon Glass,
Quoted 4 lines
Hi,
On Mon, Oct 22, 2012 at 10:23 AM, Allen Martin
<[email protected]>Quoted 57 lines · wrote:
Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
Quoted 41 lines
Quoted 33 lines · Marek Vasut
Quoted 14 lines
Dear Allen Martin,
[...]
Quoted 10 lines
Hi Marek, the change to return value here broke serial output on tegra. What I see is that the serial device name (
s->name) is "eserial0" as set byserial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and it fails. This always used to be ok because the return code didn't indicate failure andiomux_doenv()would continue on happily, but now it causesiomux_doenv()to fail and noprintfs()work after that.Quoted 7 lines
Quoted 4 lines
Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device.
Looking at the source, the obvious course of action is to fix
iomux.c.I've been looking at this call to
serial_assign()fromiomux.cand I'm not convinced this code does anything meaningful at all. It passes the name of a structstdio_devdevice whichserial_assign()then tries to match against the registered structserial_devices, which will never match.What I don't understand is the case where you have a board that actually has more than one physical serial port and how the mapping from
stdio_devtoserial_devicehappens.Quoted 5 lines
Also, looking at the code to
cmd_nvedit, I think your change also broke "setenv stdout" for boards that don't defineCONFIG_CONSOLE_MUX. We always have this on for tegra, so we don't go down this code path, but it looks identical to the code iniomux.cSorry if I missed it - what was the resolution here? Should we revert that change?
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Definitelly not. We should fix the
iomux.c, possibly by flipping the inequation mark as a short term solution.OK that's fine. Is someone working on a patch?
I'll send out my proposal for a patch. Unfortunately I don't have a board with multiple serial ports to correctly test
CONFIG_SERIAL_MULTIOne of the boards I'm working on does this (has more than one). At least before the serial rework from Marek, the stdout was either the serial device directly (each serial device was added as a console device as well) so the serial setting was redundant. You could just set them directly to the serial port (which is more flexible).
Quoted 5 lines
Quoted 2 lines
I had two patches (not sent to ML before Marek made them highly conflicting)
I know, he's such a bastard, always breaking stuff and interfering with other people's work !
:
:)
:Quoted 10 lines
Quoted 5 lines
that take the opposite approach you were, since it preserves the flexibility. It removed the "serial" setting to each of the std* variables and instead sets it to the default serial device. I'll remake that patch on top of the new serial landscape sometime soon.
Actually, I'd like to merge the serial stuff and stdio stuff into one. So "setenv stdX serial" would be replaced with "setenv stdX <
serial_driver_name>". I think that's the approach to take. But it'd break many boards.Quoted 4 lines
I think that's fine. We should be able to make it work both ways. In other words, as long as there is only one serial device registered, then "serial" will be accepted. The actual name of the driver is also always accepted.
Quoted 5 lines
Or, ever better we could just say "serial" always maps to
default_serial_console()and that should map exactly to existing functionality regardless if there is one or more serial devices. Then any board that wants more precise control can use the name of the serial driver instead.
So default_serial_console() will return a char * instead of driver pointer ... good.
Best regards,
Marek Vasut
PATCH 4/6 serial: Reorder get_current()
In reply to Marek VasutReorder the get_current() function to make it a bit more readable. The code does not grow and there is minor change in the code logic, where dev != NULL is now checked in any case.
--- drivers/serial/serial.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/serial/serial.c +12 -9
@@ -225,20 +225,23 @@ static struct serial_device *get_current(void) {struct serial_device *dev; -if (!(gd->flags &GD_FLG_RELOC ) || !serial_current) { +if (!(gd->flags &GD_FLG_RELOC )) dev =default_serial_console (); +else if (!serial_current) + dev =default_serial_console (); +else + dev = serial_current; -/* We must have a console device */ -if (!dev) { +/* We must have a console device */ +if (!dev) {#ifdef CONFIG_SPL_BUILD -puts ("Cannot find console\n" ); -hang (); +puts ("Cannot find console\n" ); +hang ();#else -panic ("Cannot find console\n" ); +panic ("Cannot find console\n" );#endif - } - }else - dev = serial_current; + } +return dev; }
Signature · 1 line
1.7.10.4
PATCH 5/6 kerneldoc: Annotate drivers/serial/serial.c
In reply to Marek VasutAdd kerneldoc annotations into serial core.
--- drivers/serial/serial.c | 157 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+)
drivers/serial/serial.c +157 -0
@@ -33,10 +33,27 @@ DECLARE_GLOBAL_DATA_PTR;static struct serial_device *serial_devices;static struct serial_device *serial_current; +/** +* serial_null() - Void registration routine of a serial driver +* +* This routine implements a void registration routine of a serial driver. The +* registration routine of a particular driver is aliased to this empty function +* in case the driver is not compiled into U-Boot. +*/ static void serial_null (void ) { } +/** +* serial_initfunc() - Do a forward declaration of driver registration routine +* @name: Name of the real driver registration routine. +* +* This macro expands onto forward declaration of a driver registration routine, +* which is then used below in serial_initialize() function. The declaration is +* made weak and aliases to serial_null() so in case the driver is not compiled +* in, the function is still declared and can be used, but aliases to +* serial_null() and thus is optimized away. +*/ #define serial_initfunc (name) \ void name(void) \ __attribute__((weak, alias("serial_null")));
@@ -94,6 +111,15 @@ serial_initfunc(s3c44b0_serial_initialize);serial_initfunc (sa1100_serial_initialize);serial_initfunc (sh_serial_initialize); +/** +* serial_register() - Register serial driver with serial driver core +* @dev: Pointer to the serial driver structure +* +* This function registers the serial driver supplied via @dev with serial +* driver core, thus making U-Boot aware of it and making it available for +* U-Boot to use. On platforms that still require manual relocation of constant +* variables, relocation of the supplied structure is performed. +*/ void serial_register (struct serial_device *dev) {#ifdef CONFIG_NEEDS_MANUAL_RELOC
@@ -117,6 +143,14 @@ void serial_register(struct serial_device *dev) serial_devices = dev; } +/** +* serial_initialize() - Register all compiled-in serial port drivers +* +* This function registers all serial port drivers that are compiled into +* the U-Boot binary with the serial core, thus making them available to +* U-Boot to use. Lastly, this function assigns a default serial port to +* the serial core. That serial port is then used as a default output. +*/ void serial_initialize (void ) {mpc8xx_serial_initialize ();
@@ -175,6 +209,13 @@ void serial_initialize(void)serial_assign (default_serial_console ()->name); } +/** +* serial_stdio_init() - Register serial ports with STDIO core +* +* This function generates a proxy driver for each serial port driver. These +* proxy drivers then register with the STDIO core, making the serial drivers +* available as STDIO devices. +*/ void serial_stdio_init (void ) {struct stdio_dev dev;
@@ -199,6 +240,17 @@ void serial_stdio_init(void) } } +/** +* serial_assign() - Select the serial output device by name +* @name: Name of the serial driver to be used as default output +* +* This function configures the serial output multiplexing by selecting which +* serial device will be used as default. In case the STDIO "serial" device is +* selected as stdin/stdout/stderr, the serial device previously configured by +* this function will be used for the particular operation. +* +* Returns 0 on success, negative on error. +*/ int serial_assign (const char *name) {struct serial_device *s;
@@ -213,6 +265,12 @@ int serial_assign(const char *name)return -EINVAL ; } +/** +* serial_reinit_all() - Reinitialize all compiled-in serial ports +* +* This function reinitializes all serial ports that are compiled into U-Boot +* by calling their serial_start() functions. +*/ void serial_reinit_all (void ) {struct serial_device *s;
@@ -221,6 +279,20 @@ void serial_reinit_all(void) s->start (); } +/** +* get_current() - Return pointer to currently selected serial port +* +* This function returns a pointer to currently selected serial port. The +* currently selected serial port is altered by serial_assign() function. +* +* In case this function is called before relocation or before any serial +* port is configured, this function calls default_serial_console() to +* determine the serial port. Otherwise, the configured serial port is +* returned. +* +* Returns pointer to the currently selected serial port on success, +* NULL on error. +*/ static struct serial_device *get_current (void ) {struct serial_device *dev;
@@ -245,36 +317,110 @@ static struct serial_device *get_current(void)return dev; } +/** +* serial_init() - Initialize currently selected serial port +* +* This function initializes the currently selected serial port. This usually +* involves setting up the registers of that particular port, enabling clock +* and such. This function uses the get_current() call to determine which port +* is selected. +* +* Returns 0 on success, negative on error. +*/ int serial_init (void ) {return get_current ()->start (); } +/** +* serial_setbrg() - Configure baud-rate of currently selected serial port +* +* This function configures the baud-rate of the currently selected serial +* port. The baud-rate is retrieved from global data within the serial port +* driver. This function uses the get_current() call to determine which port +* is selected. +* +* Returns 0 on success, negative on error. +*/ void serial_setbrg (void ) {get_current ()->setbrg (); } +/** +* serial_getc() - Read single character from currently selected serial port +* +* This function retrieves a single character from currently selected serial +* port. In case there is no character in the serial port fifo, this function +* will block and wait for the character indefinitelly. This function uses the +* get_current() call to determine which port is selected. +* +* Returns the character on success, negative on error. +*/ int serial_getc (void ) {return get_current ()->getc (); } +/** +* serial_tstc() - Test if data is available on currently selected serial port +* +* This function tests if a single character is available on currently selected +* serial port. In case there is no character in the serial port buffer, this +* function will not block. This function uses the get_current() call to +* determine which port is selected. +* +* Returns positive if character is available, zero otherwise. +*/ int serial_tstc (void ) {return get_current ()->tstc (); } +/** +* serial_putc() - Output single character via currently selected serial port +* @c: Single character to be output from the serial port. +* +* This function outputs a single character via currently selected serial port. +* This character is written into the fifo of the port and the function waits +* for the character to be emitted, therefore this function may block for a +* short amount of time. This function uses the get_current() call to determine +* which port is selected. +*/ void serial_putc (const char c) {get_current ()->putc (c); } +/** +* serial_puts() - Output string via currently selected serial port +* @s: Zero-terminated string to be output from the serial port. +* +* This function outputs a zero-terminated string via currently selected serial +* port. This function behaves as an accelerator in case the hardware has a +* larger fifo buffer. The whole string that is to be output is available to +* the function implementing the hardware manipulation. The function waits +* for the whole string to be emitted, therefore this function may block for a +* some amount of time. This function uses the get_current() call to determine +* which port is selected. +*/ void serial_puts (const char *s) {get_current ()->puts (s); } +/** +* default_serial_puts() - Output string by calling serial_putc() in loop +* @s: Zero-terminated string to be output from the serial port. +* +* This function outputs a zero-terminated string by calling serial_putc() +* in a loop. Most drivers do not fifo larger than one byte, thus this function +* precisely implements their serial_puts(). +* +* To optimize the number of get_current() calls, this function only calls +* get_current() once and then directly accesses the putc() call of the +* &struct serial_device . +*/ void default_serial_puts (const char *s) {struct serial_device *dev =get_current ();
@@ -285,6 +431,17 @@ void default_serial_puts(const char *s)#if CONFIG_POST &CONFIG_SYS_POST_UART static const int bauds[] =CONFIG_SYS_BAUDRATE_TABLE ; +/** +* uart_post_test() - Test the currently selected serial port using POST +* @flags: POST framework flags +* +* Do a loopback test of the currently selected serial port. This function +* is only useful in the context of the POST testing framwork. The serial +* port is firstly configured into loopback mode and then characters are +* sent through it. +* +* Returns 0 on success, value otherwise. +*/ /* Mark weak until post/cpu/.../uart.c migrate over */ __weak int uart_post_test (int flags)
Signature · 1 line
1.7.10.4
PATCH 5/6 kerneldoc: Annotate drivers/serial/serial.c
Quoted 5 lines · Marek Vasut
Add kerneldoc annotations into serial core.
Signed-off-by Marek Vasut <[email protected]>Cc Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>
Please re-wrap the comments you're adding, they're too wide in many cases and right at the edge in others (textwidth=72 or 75 is my preference).
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121008/96890b1c/attachment.pgp>
PATCH 5/6 kerneldoc: Annotate drivers/serial/serial.c
Quoted 11 lines · Tom Rini
Quoted 5 lines · Marek Vasut
Add kerneldoc annotations into serial core.
Signed-off-by Marek Vasut <[email protected]>Cc Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>Please re-wrap the comments you're adding, they're too wide in many cases and right at the edge in others (textwidth=72 or 75 is my preference).
For the record, I appreciate that Marek re-wrapped his text but indeed 80-wide comments are allowed and should only result in my cussing to myself.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121008/69ff25bd/attachment.pgp>
PATCH 5/6 kerneldoc: Annotate drivers/serial/serial.c
Dear Tom Rini,
Quoted 8 lines · Tom Rini
Quoted 7 lines · Marek Vasut
Quoted 5 lines
Add kerneldoc annotations into serial core.
Signed-off-by Marek Vasut <[email protected]>Cc Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>
Quoted 7 lines
Quoted 3 lines
Please re-wrap the comments you're adding, they're too wide in many cases and right at the edge in others (textwidth=72 or 75 is my preference).
For the record, I appreciate that Marek re-wrapped his text but indeed 80-wide comments are allowed and should only result in my cussing to myself.
I adjusted my email client to handle this actually ...
Best regards,
Marek Vasut
PATCH v2 5/6 kerneldoc: Annotate drivers/serial/serial.c
In reply to Marek VasutAdd kerneldoc annotations into serial core.
--- drivers/serial/serial.c | 164 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+)
V2: Rewrap the documentation.
drivers/serial/serial.c +164 -0
@@ -33,10 +33,28 @@ DECLARE_GLOBAL_DATA_PTR;static struct serial_device *serial_devices;static struct serial_device *serial_current; +/** +* serial_null() - Void registration routine of a serial driver +* +* This routine implements a void registration routine of a serial +* driver. The registration routine of a particular driver is aliased +* to this empty function in case the driver is not compiled into +* U-Boot. +*/ static void serial_null (void ) { } +/** +* serial_initfunc() - Forward declare of driver registration routine +* @name: Name of the real driver registration routine. +* +* This macro expands onto forward declaration of a driver registration +* routine, which is then used below in serial_initialize() function. +* The declaration is made weak and aliases to serial_null() so in case +* the driver is not compiled in, the function is still declared and can +* be used, but aliases to serial_null() and thus is optimized away. +*/ #define serial_initfunc (name) \ void name(void) \ __attribute__((weak, alias("serial_null")));
@@ -94,6 +112,16 @@ serial_initfunc(s3c44b0_serial_initialize);serial_initfunc (sa1100_serial_initialize);serial_initfunc (sh_serial_initialize); +/** +* serial_register() - Register serial driver with serial driver core +* @dev: Pointer to the serial driver structure +* +* This function registers the serial driver supplied via @dev with +* serial driver core, thus making U-Boot aware of it and making it +* available for U-Boot to use. On platforms that still require manual +* relocation of constant variables, relocation of the supplied structure +* is performed. +*/ void serial_register (struct serial_device *dev) {#ifdef CONFIG_NEEDS_MANUAL_RELOC
@@ -117,6 +145,15 @@ void serial_register(struct serial_device *dev) serial_devices = dev; } +/** +* serial_initialize() - Register all compiled-in serial port drivers +* +* This function registers all serial port drivers that are compiled +* into the U-Boot binary with the serial core, thus making them +* available to U-Boot to use. Lastly, this function assigns a default +* serial port to the serial core. That serial port is then used as a +* default output. +*/ void serial_initialize (void ) {mpc8xx_serial_initialize ();
@@ -175,6 +212,13 @@ void serial_initialize(void)serial_assign (default_serial_console ()->name); } +/** +* serial_stdio_init() - Register serial ports with STDIO core +* +* This function generates a proxy driver for each serial port driver. +* These proxy drivers then register with the STDIO core, making the +* serial drivers available as STDIO devices. +*/ void serial_stdio_init (void ) {struct stdio_dev dev;
@@ -199,6 +243,18 @@ void serial_stdio_init(void) } } +/** +* serial_assign() - Select the serial output device by name +* @name: Name of the serial driver to be used as default output +* +* This function configures the serial output multiplexing by +* selecting which serial device will be used as default. In case +* the STDIO "serial" device is selected as stdin/stdout/stderr, +* the serial device previously configured by this function will be +* used for the particular operation. +* +* Returns 0 on success, negative on error. +*/ int serial_assign (const char *name) {struct serial_device *s;
@@ -213,6 +269,12 @@ int serial_assign(const char *name)return -EINVAL ; } +/** +* serial_reinit_all() - Reinitialize all compiled-in serial ports +* +* This function reinitializes all serial ports that are compiled +* into U-Boot by calling their serial_start() functions. +*/ void serial_reinit_all (void ) {struct serial_device *s;
@@ -221,6 +283,21 @@ void serial_reinit_all(void) s->start (); } +/** +* get_current() - Return pointer to currently selected serial port +* +* This function returns a pointer to currently selected serial port. +* The currently selected serial port is altered by serial_assign() +* function. +* +* In case this function is called before relocation or before any serial +* port is configured, this function calls default_serial_console() to +* determine the serial port. Otherwise, the configured serial port is +* returned. +* +* Returns pointer to the currently selected serial port on success, +* NULL on error. +*/ static struct serial_device *get_current (void ) {struct serial_device *dev;
@@ -245,36 +322,112 @@ static struct serial_device *get_current(void)return dev; } +/** +* serial_init() - Initialize currently selected serial port +* +* This function initializes the currently selected serial port. This +* usually involves setting up the registers of that particular port, +* enabling clock and such. This function uses the get_current() call +* to determine which port is selected. +* +* Returns 0 on success, negative on error. +*/ int serial_init (void ) {return get_current ()->start (); } +/** +* serial_setbrg() - Configure baud-rate of currently selected serial port +* +* This function configures the baud-rate of the currently selected +* serial port. The baud-rate is retrieved from global data within +* the serial port driver. This function uses the get_current() call +* to determine which port is selected. +* +* Returns 0 on success, negative on error. +*/ void serial_setbrg (void ) {get_current ()->setbrg (); } +/** +* serial_getc() - Read single character from currently selected serial port +* +* This function retrieves a single character from currently selected +* serial port. In case there is no character in the serial port fifo, +* this function will block and wait for the character indefinitelly. +* This function uses the get_current() call to determine which port +* is selected. +* +* Returns the character on success, negative on error. +*/ int serial_getc (void ) {return get_current ()->getc (); } +/** +* serial_tstc() - Test if data is available on currently selected serial port +* +* This function tests if a single character is available on currently +* selected serial port. In case there is no character in the serial +* port buffer, this function will not block. This function uses the +* get_current() call to determine which port is selected. +* +* Returns positive if character is available, zero otherwise. +*/ int serial_tstc (void ) {return get_current ()->tstc (); } +/** +* serial_putc() - Output single character via currently selected serial port +* @c: Single character to be output from the serial port. +* +* This function outputs a single character via currently selected +* serial port. This character is written into the fifo of the port +* and the function waits for the character to be emitted, therefore +* this function may block for a short amount of time. This function +* uses the get_current() call to determine which port is selected. +*/ void serial_putc (const char c) {get_current ()->putc (c); } +/** +* serial_puts() - Output string via currently selected serial port +* @s: Zero-terminated string to be output from the serial port. +* +* This function outputs a zero-terminated string via currently +* selected serial port. This function behaves as an accelerator +* in case the hardware has a larger fifo buffer. The whole string +* that is to be output is available to the function implementing +* the hardware manipulation. The function waits for the whole string +* to be emitted, therefore this function may block for a some amount +* of time. This function uses the get_current() call to determine +* which port is selected. +*/ void serial_puts (const char *s) {get_current ()->puts (s); } +/** +* default_serial_puts() - Output string by calling serial_putc() in loop +* @s: Zero-terminated string to be output from the serial port. +* +* This function outputs a zero-terminated string by calling serial_putc() +* in a loop. Most drivers do not fifo larger than one byte, thus this +* function precisely implements their serial_puts(). +* +* To optimize the number of get_current() calls, this function only +* calls get_current() once and then directly accesses the putc() call +* of the &struct serial_device . +*/ void default_serial_puts (const char *s) {struct serial_device *dev =get_current ();
@@ -285,6 +438,17 @@ void default_serial_puts(const char *s)#if CONFIG_POST &CONFIG_SYS_POST_UART static const int bauds[] =CONFIG_SYS_BAUDRATE_TABLE ; +/** +* uart_post_test() - Test the currently selected serial port using POST +* @flags: POST framework flags +* +* Do a loopback test of the currently selected serial port. This +* function is only useful in the context of the POST testing framwork. +* The serial port is firstly configured into loopback mode and then +* characters are sent through it. +* +* Returns 0 on success, value otherwise. +*/ /* Mark weak until post/cpu/.../uart.c migrate over */ __weak int uart_post_test (int flags)
Signature · 1 line
1.7.10.4
PATCH v3 5/6 kerneldoc: Annotate drivers/serial/serial.c
Add kerneldoc annotations into serial core.
--- drivers/serial/serial.c | 165 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+)
V2: Rewrap the documentation.
V3: Adjust the documentation to be more correct.
drivers/serial/serial.c +165 -0
@@ -33,10 +33,28 @@ DECLARE_GLOBAL_DATA_PTR;static struct serial_device *serial_devices;static struct serial_device *serial_current; +/** +* serial_null() - Void registration routine of a serial driver +* +* This routine implements a void registration routine of a serial +* driver. The registration routine of a particular driver is aliased +* to this empty function in case the driver is not compiled into +* U-Boot. +*/ static void serial_null (void ) { } +/** +* serial_initfunc() - Forward declare of driver registration routine +* @name: Name of the real driver registration routine. +* +* This macro expands onto forward declaration of a driver registration +* routine, which is then used below in serial_initialize() function. +* The declaration is made weak and aliases to serial_null() so in case +* the driver is not compiled in, the function is still declared and can +* be used, but aliases to serial_null() and thus is optimized away. +*/ #define serial_initfunc (name) \ void name(void) \ __attribute__((weak, alias("serial_null")));
@@ -94,6 +112,16 @@ serial_initfunc(s3c44b0_serial_initialize);serial_initfunc (sa1100_serial_initialize);serial_initfunc (sh_serial_initialize); +/** +* serial_register() - Register serial driver with serial driver core +* @dev: Pointer to the serial driver structure +* +* This function registers the serial driver supplied via @dev with +* serial driver core, thus making U-Boot aware of it and making it +* available for U-Boot to use. On platforms that still require manual +* relocation of constant variables, relocation of the supplied structure +* is performed. +*/ void serial_register (struct serial_device *dev) {#ifdef CONFIG_NEEDS_MANUAL_RELOC
@@ -117,6 +145,15 @@ void serial_register(struct serial_device *dev) serial_devices = dev; } +/** +* serial_initialize() - Register all compiled-in serial port drivers +* +* This function registers all serial port drivers that are compiled +* into the U-Boot binary with the serial core, thus making them +* available to U-Boot to use. Lastly, this function assigns a default +* serial port to the serial core. That serial port is then used as a +* default output. +*/ void serial_initialize (void ) {mpc8xx_serial_initialize ();
@@ -175,6 +212,13 @@ void serial_initialize(void)serial_assign (default_serial_console ()->name); } +/** +* serial_stdio_init() - Register serial ports with STDIO core +* +* This function generates a proxy driver for each serial port driver. +* These proxy drivers then register with the STDIO core, making the +* serial drivers available as STDIO devices. +*/ void serial_stdio_init (void ) {struct stdio_dev dev;
@@ -199,6 +243,18 @@ void serial_stdio_init(void) } } +/** +* serial_assign() - Select the serial output device by name +* @name: Name of the serial driver to be used as default output +* +* This function configures the serial output multiplexing by +* selecting which serial device will be used as default. In case +* the STDIO "serial" device is selected as stdin/stdout/stderr, +* the serial device previously configured by this function will be +* used for the particular operation. +* +* Returns 0 on success, negative on error. +*/ int serial_assign (const char *name) {struct serial_device *s;
@@ -213,6 +269,12 @@ int serial_assign(const char *name)return -EINVAL ; } +/** +* serial_reinit_all() - Reinitialize all compiled-in serial ports +* +* This function reinitializes all serial ports that are compiled +* into U-Boot by calling their serial_start() functions. +*/ void serial_reinit_all (void ) {struct serial_device *s;
@@ -221,6 +283,21 @@ void serial_reinit_all(void) s->start (); } +/** +* get_current() - Return pointer to currently selected serial port +* +* This function returns a pointer to currently selected serial port. +* The currently selected serial port is altered by serial_assign() +* function. +* +* In case this function is called before relocation or before any serial +* port is configured, this function calls default_serial_console() to +* determine the serial port. Otherwise, the configured serial port is +* returned. +* +* Returns pointer to the currently selected serial port on success, +* NULL on error. +*/ static struct serial_device *get_current (void ) {struct serial_device *dev;
@@ -245,36 +322,113 @@ static struct serial_device *get_current(void)return dev; } +/** +* serial_init() - Initialize currently selected serial port +* +* This function initializes the currently selected serial port. This +* usually involves setting up the registers of that particular port, +* enabling clock and such. This function uses the get_current() call +* to determine which port is selected. +* +* Returns 0 on success, negative on error. +*/ int serial_init (void ) {return get_current ()->start (); } +/** +* serial_setbrg() - Configure baud-rate of currently selected serial port +* +* This function configures the baud-rate of the currently selected +* serial port. The baud-rate is retrieved from global data within +* the serial port driver. This function uses the get_current() call +* to determine which port is selected. +* +* Returns 0 on success, negative on error. +*/ void serial_setbrg (void ) {get_current ()->setbrg (); } +/** +* serial_getc() - Read character from currently selected serial port +* +* This function retrieves a character from currently selected serial +* port. In case there is no character waiting on the serial port, +* this function will block and wait for the character to appear. This +* function uses the get_current() call to determine which port is +* selected. +* +* Returns the character on success, negative on error. +*/ int serial_getc (void ) {return get_current ()->getc (); } +/** +* serial_tstc() - Test if data is available on currently selected serial port +* +* This function tests if one or more characters are available on +* currently selected serial port. This function never blocks. This +* function uses the get_current() call to determine which port is +* selected. +* +* Returns positive if character is available, zero otherwise. +*/ int serial_tstc (void ) {return get_current ()->tstc (); } +/** +* serial_putc() - Output character via currently selected serial port +* @c: Single character to be output from the serial port. +* +* This function outputs a character via currently selected serial +* port. This character is passed to the serial port driver responsible +* for controlling the hardware. The hardware may still be in process +* of transmitting another character, therefore this function may block +* for a short amount of time. This function uses the get_current() +* call to determine which port is selected. +*/ void serial_putc (const char c) {get_current ()->putc (c); } +/** +* serial_puts() - Output string via currently selected serial port +* @s: Zero-terminated string to be output from the serial port. +* +* This function outputs a zero-terminated string via currently +* selected serial port. This function behaves as an accelerator +* in case the hardware can queue multiple characters for transfer. +* The whole string that is to be output is available to the function +* implementing the hardware manipulation. Transmitting the whole +* string may take some time, thus this function may block for some +* amount of time. This function uses the get_current() call to +* determine which port is selected. +*/ void serial_puts (const char *s) {get_current ()->puts (s); } +/** +* default_serial_puts() - Output string by calling serial_putc() in loop +* @s: Zero-terminated string to be output from the serial port. +* +* This function outputs a zero-terminated string by calling serial_putc() +* in a loop. Most drivers do not support queueing more than one byte for +* transfer, thus this function precisely implements their serial_puts(). +* +* To optimize the number of get_current() calls, this function only +* calls get_current() once and then directly accesses the putc() call +* of the &struct serial_device . +*/ void default_serial_puts (const char *s) {struct serial_device *dev =get_current ();
@@ -285,6 +439,17 @@ void default_serial_puts(const char *s)#if CONFIG_POST &CONFIG_SYS_POST_UART static const int bauds[] =CONFIG_SYS_BAUDRATE_TABLE ; +/** +* uart_post_test() - Test the currently selected serial port using POST +* @flags: POST framework flags +* +* Do a loopback test of the currently selected serial port. This +* function is only useful in the context of the POST testing framwork. +* The serial port is firstly configured into loopback mode and then +* characters are sent through it. +* +* Returns 0 on success, value otherwise. +*/ /* Mark weak until post/cpu/.../uart.c migrate over */ __weak int uart_post_test (int flags)
Signature · 1 line
1.7.10.4
PATCH 6/6 kerneldoc: stdio: tmpl: Add stdio template
In reply to Marek VasutAdd STDIO documentation template.
--- doc/DocBook/Makefile | 2 +- doc/DocBook/stdio.tmpl | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 doc/DocBook/stdio.tmpl
doc/DocBook/Makefile +1 -1
@@ -8,7 +8,7 @@ include $(TOPDIR)/config.mk -DOCBOOKS := linker_lists.xml +DOCBOOKS := linker_lists.xml stdio.xml ### # The build process is as follows (targets):
doc/DocBook/stdio.tmpl new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
1.7.10.4