]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
serial, ns16550: bugfix: ns16550 fifo not enabled
authorHeiko Schocher <hs@denx.de>
Wed, 18 Jan 2017 07:05:49 +0000 (08:05 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 20 Jan 2017 14:15:19 +0000 (09:15 -0500)
commit: 65f83802b7a5b "serial: 16550: Add getfcr accessor"
breaks u-boot commandline working with long commands
sending to the board.

Since the above patch, you have to setup the fcr register.

For board/archs which enable OF_PLATDATA, the new field
fcr in struct ns16550_platdata is not filled with a
default value ...

This leads in not setting up the uarts fifo, which ends
in problems, when you send long commands to u-boots
commandline.

Detected this issue with automated tbot tests on am335x
based shc board.

The error does not popup, if you type commands. You need
to copy&paste a long command to u-boots commandshell
(or send a long command with tbot)

Possible boards/plattforms with problems:
./arch/arm/cpu/arm926ejs/lpc32xx/devices.c
./arch/arm/mach-tegra/board.c
./board/overo/overo.c
./board/quipos/cairo/cairo.c
./board/logicpd/omap3som/omap3logic.c
./board/logicpd/zoom1/zoom1.c
./board/timll/devkit8000/devkit8000.c
./board/lg/sniper/sniper.c
./board/ti/beagle/beagle.c
./drivers/serial/serial_rockchip.c

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Tested-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
14 files changed:
arch/arm/cpu/arm926ejs/lpc32xx/devices.c
arch/arm/mach-omap2/am33xx/board.c
arch/arm/mach-tegra/board.c
board/isee/igep00x0/igep00x0.c
board/lg/sniper/sniper.c
board/logicpd/omap3som/omap3logic.c
board/logicpd/zoom1/zoom1.c
board/overo/overo.c
board/quipos/cairo/cairo.c
board/ti/beagle/beagle.c
board/timll/devkit8000/devkit8000.c
drivers/serial/ns16550.c
drivers/serial/serial_rockchip.c
include/ns16550.h

index 399b07c5420ab2b4cecab4f0a3dd4232011fe9d4..f744398ca7adbff2c8ff360701c1689190991ede 100644 (file)
@@ -45,10 +45,14 @@ void lpc32xx_uart_init(unsigned int uart_id)
 
 #if !CONFIG_IS_ENABLED(OF_CONTROL)
 static const struct ns16550_platdata lpc32xx_uart[] = {
-       { .base = UART3_BASE, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
-       { .base = UART4_BASE, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
-       { .base = UART5_BASE, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
-       { .base = UART6_BASE, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
+       { .base = UART3_BASE, .reg_shift = 2,
+         .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
+       { .base = UART4_BASE, .reg_shift = 2,
+         .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
+       { .base = UART5_BASE, .reg_shift = 2,
+         .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
+       { .base = UART6_BASE, .reg_shift = 2,
+         .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
 };
 
 #if defined(CONFIG_LPC32XX_HSUART)
index 73824df18fa7c192a4e0173ed8976d76e8193d5f..190310fd00792ee461dffae46b26a3314c502f86 100644 (file)
@@ -40,14 +40,20 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #if !CONFIG_IS_ENABLED(OF_CONTROL)
 static const struct ns16550_platdata am33xx_serial[] = {
-       { .base = CONFIG_SYS_NS16550_COM1, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
+       { .base = CONFIG_SYS_NS16550_COM1, .reg_shift = 2,
+         .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
 # ifdef CONFIG_SYS_NS16550_COM2
-       { .base = CONFIG_SYS_NS16550_COM2, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
+       { .base = CONFIG_SYS_NS16550_COM2, .reg_shift = 2,
+         .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
 #  ifdef CONFIG_SYS_NS16550_COM3
-       { .base = CONFIG_SYS_NS16550_COM3, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
-       { .base = CONFIG_SYS_NS16550_COM4, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
-       { .base = CONFIG_SYS_NS16550_COM5, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
-       { .base = CONFIG_SYS_NS16550_COM6, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK },
+       { .base = CONFIG_SYS_NS16550_COM3, .reg_shift = 2,
+         .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
+       { .base = CONFIG_SYS_NS16550_COM4, .reg_shift = 2,
+         .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
+       { .base = CONFIG_SYS_NS16550_COM5, .reg_shift = 2,
+         .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
+       { .base = CONFIG_SYS_NS16550_COM6, .reg_shift = 2,
+         .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, },
 #  endif
 # endif
 };
index 3d1d26d13d1399b38b1fadac66721a8bb4c08e2e..b3a041b539af80ae7b75e3f709931ab92ff1a213 100644 (file)
@@ -219,6 +219,7 @@ static struct ns16550_platdata ns16550_com1_pdata = {
        .base = CONFIG_SYS_NS16550_COM1,
        .reg_shift = 2,
        .clock = CONFIG_SYS_NS16550_CLK,
+       .fcr = UART_FCR_DEFVAL,
 };
 
 U_BOOT_DEVICE(ns16550_com1) = {
index ae7959b1eb6eb688c24b907a872a2d3d3bec221e..5a3498f570a6d98cf78fd9848e0532d04b6fdb07 100644 (file)
@@ -32,7 +32,8 @@ DECLARE_GLOBAL_DATA_PTR;
 static const struct ns16550_platdata igep_serial = {
        .base = OMAP34XX_UART3,
        .reg_shift = 2,
-       .clock = V_NS16550_CLK
+       .clock = V_NS16550_CLK,
+       .fcr = UART_FCR_DEFVAL,
 };
 
 U_BOOT_DEVICE(igep_uart) = {
index 0662449c38759e3505da870ac52673d67e53e643..b2b8f8861f11caf07508ceb0d30cba27ed711d66 100644 (file)
@@ -31,7 +31,8 @@ const omap3_sysinfo sysinfo = {
 static const struct ns16550_platdata serial_omap_platdata = {
        .base = OMAP34XX_UART3,
        .reg_shift = 2,
-       .clock = V_NS16550_CLK
+       .clock = V_NS16550_CLK,
+       .fcr = UART_FCR_DEFVAL,
 };
 
 U_BOOT_DEVICE(sniper_serial) = {
index 21b3fdcf49cfc74cc36739befd46047cb3272fdd..b2fcc28f8b4bf77d2d78cd6ab0d0c970bcc0ade4 100644 (file)
@@ -49,7 +49,8 @@ DECLARE_GLOBAL_DATA_PTR;
 static const struct ns16550_platdata omap3logic_serial = {
        .base = OMAP34XX_UART1,
        .reg_shift = 2,
-       .clock = V_NS16550_CLK
+       .clock = V_NS16550_CLK,
+       .fcr = UART_FCR_DEFVAL,
 };
 
 U_BOOT_DEVICE(omap3logic_uart) = {
index 2821ee22674f78a8afa2971c1cf982aa1255c468..0fad23af62f69c626de0a523a68ca915a84999f0 100644 (file)
@@ -47,7 +47,8 @@ static const u32 gpmc_lab_enet[] = {
 static const struct ns16550_platdata zoom1_serial = {
        .base = OMAP34XX_UART3,
        .reg_shift = 2,
-       .clock = V_NS16550_CLK
+       .clock = V_NS16550_CLK,
+       .fcr = UART_FCR_DEFVAL,
 };
 
 U_BOOT_DEVICE(zoom1_uart) = {
index 40f13e5876cc40683f6e54d544336b9271187a54..5e447262bcfd3bd8f8465f6eb2a3e7a150ff349c 100644 (file)
@@ -70,7 +70,8 @@ static struct {
 static const struct ns16550_platdata overo_serial = {
        .base = OMAP34XX_UART3,
        .reg_shift = 2,
-       .clock = V_NS16550_CLK
+       .clock = V_NS16550_CLK,
+       .fcr = UART_FCR_DEFVAL,
 };
 
 U_BOOT_DEVICE(overo_uart) = {
index 77e4482906f075cfeadc7e640d763e109381a028..793aa9023150bfab34edf6936b8d4c9d6778c639 100644 (file)
@@ -93,7 +93,8 @@ void get_board_mem_timings(struct board_sdrc_timings *timings)
 static const struct ns16550_platdata cairo_serial = {
        .base = OMAP34XX_UART2,
        .reg_shift = 2,
-       .clock = V_NS16550_CLK
+       .clock = V_NS16550_CLK,
+       .fcr = UART_FCR_DEFVAL,
 };
 
 U_BOOT_DEVICE(cairo_uart) = {
index cfdab3e34253eff04ec4c99613f3b44288c9e411..23c79333a223681b67e53bd3277b7d545ba7f537 100644 (file)
@@ -75,7 +75,8 @@ static struct {
 static const struct ns16550_platdata beagle_serial = {
        .base = OMAP34XX_UART3,
        .reg_shift = 2,
-       .clock = V_NS16550_CLK
+       .clock = V_NS16550_CLK,
+       .fcr = UART_FCR_DEFVAL,
 };
 
 U_BOOT_DEVICE(beagle_uart) = {
index f785dbe6d73234cb05c44c6b937afbb41ca01abd..b2f060b2ddbfa8a3f05e61c2bbdcf86f94b03c15 100644 (file)
@@ -48,7 +48,8 @@ static u32 gpmc_net_config[GPMC_MAX_REG] = {
 static const struct ns16550_platdata devkit8000_serial = {
        .base = OMAP34XX_UART3,
        .reg_shift = 2,
-       .clock = V_NS16550_CLK
+       .clock = V_NS16550_CLK,
+       .fcr = UART_FCR_DEFVAL,
 };
 
 U_BOOT_DEVICE(devkit8000_uart) = {
index 9b423a591d8a3226db9c456f7738c413e1b6e563..2df4a1f04fe52620776817a09340b5674ed1f499 100644 (file)
@@ -20,9 +20,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define UART_LCRVAL UART_LCR_8N1               /* 8 data, 1 stop, no parity */
 #define UART_MCRVAL (UART_MCR_DTR | \
                     UART_MCR_RTS)              /* RTS/DTR */
-#define UART_FCRVAL (UART_FCR_FIFO_EN |        \
-                    UART_FCR_RXSR |    \
-                    UART_FCR_TXSR)             /* Clear & enable FIFOs */
 
 #ifndef CONFIG_DM_SERIAL
 #ifdef CONFIG_SYS_NS16550_PORT_MAPPED
@@ -138,7 +135,7 @@ static u32 ns16550_getfcr(NS16550_t port)
 #else
 static u32 ns16550_getfcr(NS16550_t port)
 {
-       return UART_FCRVAL;
+       return UART_FCR_DEFVAL;
 }
 #endif
 
@@ -275,7 +272,7 @@ static inline void _debug_uart_init(void)
                                            CONFIG_BAUDRATE);
        serial_dout(&com_port->ier, CONFIG_SYS_NS16550_IER);
        serial_dout(&com_port->mcr, UART_MCRVAL);
-       serial_dout(&com_port->fcr, UART_FCRVAL);
+       serial_dout(&com_port->fcr, UART_FCR_DEFVAL);
 
        serial_dout(&com_port->lcr, UART_LCR_BKSE | UART_LCRVAL);
        serial_dout(&com_port->dll, baud_divisor & 0xff);
@@ -440,7 +437,7 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
                return -EINVAL;
        }
 
-       plat->fcr = UART_FCRVAL;
+       plat->fcr = UART_FCR_DEFVAL;
        if (port_type == PORT_JZ4780)
                plat->fcr |= UART_FCR_UME;
 
index 6bac95a414cec02082979978ff1dfed84f1ef515..c06afc58f7ea3483298a62a64596a7cc5c322d92 100644 (file)
@@ -27,6 +27,7 @@ static int rockchip_serial_probe(struct udevice *dev)
        plat->plat.base = plat->dtplat.reg[0];
        plat->plat.reg_shift = plat->dtplat.reg_shift;
        plat->plat.clock = plat->dtplat.clock_frequency;
+       plat->plat.fcr = UART_FCR_DEFVAL;
        dev->platdata = &plat->plat;
 
        return ns16550_serial_probe(dev);
index 7c9703683109e8268a8f3301ab2ce12d10486999..5fcbcd2e74e3a2965eda64905416f1f2b792d4bc 100644 (file)
@@ -121,6 +121,11 @@ typedef struct NS16550 *NS16550_t;
 /* Ingenic JZ47xx specific UART-enable bit. */
 #define UART_FCR_UME           0x10
 
+/* Clear & enable FIFOs */
+#define UART_FCR_DEFVAL (UART_FCR_FIFO_EN | \
+                       UART_FCR_RXSR | \
+                       UART_FCR_TXSR)
+
 /*
  * These are the definitions for the Modem Control Register
  */