[U-Boot] [PATCH 0/5] s3c24xx serial driver cleanup patches

This is a serie of cleanup patches:
Patch 1-3 remove 3 unused config options and the related dead code from several drivers and U-Boot main code.
Patch 4 removes any reference for the 3 unused config options from the documentation.
Patch 5 removes another piece of dead, unreferenced code from the s3c24xx serial driver.

Signed-off-by: David Müller d.mueller@elsoft.ch --- arch/powerpc/cpu/mpc8xx/serial.c | 22 --------- common/Makefile | 1 - common/board_f.c | 3 -- common/main.c | 14 ------ common/modem.c | 100 -------------------------------------- drivers/serial/serial_s3c24x0.c | 18 ------- include/asm-generic/global_data.h | 4 -- 7 files changed, 162 deletions(-) delete mode 100644 common/modem.c
diff --git a/arch/powerpc/cpu/mpc8xx/serial.c b/arch/powerpc/cpu/mpc8xx/serial.c index af65c96..94c785f 100644 --- a/arch/powerpc/cpu/mpc8xx/serial.c +++ b/arch/powerpc/cpu/mpc8xx/serial.c @@ -268,11 +268,6 @@ smc_putc(const char c) volatile cpm8xx_t *cpmp = &(im->im_cpm); volatile serialbuffer_t *rtx;
-#ifdef CONFIG_MODEM_SUPPORT - if (gd->be_quiet) - return; -#endif - if (c == '\n') smc_putc ('\r');
@@ -527,11 +522,6 @@ scc_putc(const char c) volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR; volatile cpm8xx_t *cpmp = &(im->im_cpm);
-#ifdef CONFIG_MODEM_SUPPORT - if (gd->be_quiet) - return; -#endif - if (c == '\n') scc_putc ('\r');
@@ -637,18 +627,6 @@ void mpc8xx_serial_initialize(void) #endif }
-#ifdef CONFIG_MODEM_SUPPORT -void disable_putc(void) -{ - gd->be_quiet = 1; -} - -void enable_putc(void) -{ - gd->be_quiet = 0; -} -#endif - #if defined(CONFIG_CMD_KGDB)
void diff --git a/common/Makefile b/common/Makefile index 5998411..117178a 100644 --- a/common/Makefile +++ b/common/Makefile @@ -82,7 +82,6 @@ obj-$(CONFIG_LCD_ROTATION) += lcd_console_rotation.o obj-$(CONFIG_LCD_DT_SIMPLEFB) += lcd_simplefb.o obj-$(CONFIG_LYNXKDI) += lynxkdi.o obj-$(CONFIG_MENU) += menu.o -obj-$(CONFIG_MODEM_SUPPORT) += modem.o obj-$(CONFIG_UPDATE_TFTP) += update.o obj-$(CONFIG_DFU_TFTP) += update.o obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o diff --git a/common/board_f.c b/common/board_f.c index c470b59..a960144 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -162,9 +162,6 @@ static int display_text_info(void) text_base, bss_start, bss_end); #endif
-#ifdef CONFIG_MODEM_SUPPORT - debug("Modem Support enabled\n"); -#endif #ifdef CONFIG_USE_IRQ debug("IRQ Stack: %08lx\n", IRQ_STACK_START); debug("FIQ Stack: %08lx\n", FIQ_STACK_START); diff --git a/common/main.c b/common/main.c index 5a03181..1a2ef39 100644 --- a/common/main.c +++ b/common/main.c @@ -20,19 +20,6 @@ DECLARE_GLOBAL_DATA_PTR; */ __weak void show_boot_progress(int val) {}
-static void modem_init(void) -{ -#ifdef CONFIG_MODEM_SUPPORT - debug("DEBUG: main_loop: gd->do_mdm_init=%lu\n", gd->do_mdm_init); - if (gd->do_mdm_init) { - char *str = getenv("mdm_cmd"); - - setenv("preboot", str); /* set or delete definition */ - mdm_init(); /* wait for modem connection */ - } -#endif /* CONFIG_MODEM_SUPPORT */ -} - static void run_preboot_environment_command(void) { #ifdef CONFIG_PREBOOT @@ -66,7 +53,6 @@ void main_loop(void) puts("upgraded by the late 2014 may break or be removed.\n"); #endif
- modem_init(); #ifdef CONFIG_VERSION_VARIABLE setenv("ver", version_string); /* set version variable */ #endif /* CONFIG_VERSION_VARIABLE */ diff --git a/common/modem.c b/common/modem.c deleted file mode 100644 index 96b1064..0000000 --- a/common/modem.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * (C) Copyright 2002-2009 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> - -/* 'inline' - We have to do it fast */ -static inline void mdm_readline(char *buf, int bufsiz) -{ - char c; - char *p; - int n; - - n = 0; - p = buf; - for(;;) { - c = serial_getc(); - - debug("(%c)", c); - - switch(c) { - case '\r': - break; - case '\n': - *p = '\0'; - return; - - default: - if(n++ > bufsiz) { - *p = '\0'; - return; /* sanity check */ - } - *p = c; - p++; - break; - } - } -} - -int mdm_init (void) -{ - char env_str[16]; - char *init_str; - int i; - extern void enable_putc(void); - extern int hwflow_onoff(int); - - enable_putc(); /* enable serial_putc() */ - -#ifdef CONFIG_HWFLOW - init_str = getenv("mdm_flow_control"); - if (init_str && (strcmp(init_str, "rts/cts") == 0)) - hwflow_onoff (1); - else - hwflow_onoff(-1); -#endif - - for (i = 1;;i++) { - sprintf(env_str, "mdm_init%d", i); - if ((init_str = getenv(env_str)) != NULL) { - serial_puts(init_str); - serial_puts("\n"); - for(;;) { - mdm_readline(console_buffer, CONFIG_SYS_CBSIZE); - debug("ini%d: [%s]", i, console_buffer); - - if ((strcmp(console_buffer, "OK") == 0) || - (strcmp(console_buffer, "ERROR") == 0)) { - debug("ini%d: cmd done", i); - break; - } else /* in case we are originating call ... */ - if (strncmp(console_buffer, "CONNECT", 7) == 0) { - debug("ini%d: connect", i); - return 0; - } - } - } else - break; /* no init string - stop modem init */ - - udelay(100000); - } - - udelay(100000); - - /* final stage - wait for connect */ - for(;i > 1;) { /* if 'i' > 1 - wait for connection - message from modem */ - mdm_readline(console_buffer, CONFIG_SYS_CBSIZE); - debug("ini_f: [%s]", console_buffer); - if (strncmp(console_buffer, "CONNECT", 7) == 0) { - debug("ini_f: connected"); - return 0; - } - } - - return 0; -} diff --git a/drivers/serial/serial_s3c24x0.c b/drivers/serial/serial_s3c24x0.c index 7afc504..4cc94d9 100644 --- a/drivers/serial/serial_s3c24x0.c +++ b/drivers/serial/serial_s3c24x0.c @@ -164,30 +164,12 @@ int hwflow_onoff(int on) } #endif
-#ifdef CONFIG_MODEM_SUPPORT -static int be_quiet = 0; -void disable_putc(void) -{ - be_quiet = 1; -} - -void enable_putc(void) -{ - be_quiet = 0; -} -#endif - - /* * Output a single byte to the serial port. */ static void _serial_putc(const char c, const int dev_index) { struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index); -#ifdef CONFIG_MODEM_SUPPORT - if (be_quiet) - return; -#endif
while (!(readl(&uart->utrstat) & 0x2)) /* wait for room in the tx FIFO */ ; diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index a587d3c..f2810a1 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -48,10 +48,6 @@ typedef struct global_data { #ifdef CONFIG_PRE_CONSOLE_BUFFER unsigned long precon_buf_idx; /* Pre-Console buffer index */ #endif -#ifdef CONFIG_MODEM_SUPPORT - unsigned long do_mdm_init; - unsigned long be_quiet; -#endif unsigned long env_addr; /* Address of Environment struct */ unsigned long env_valid; /* Checksum of Environment valid? */

On Sat, Feb 06, 2016 at 07:57:25AM +0100, David Müller (ELSOFT AG) wrote:
Signed-off-by: David Müller d.mueller@elsoft.ch
Applied to u-boot/master, thanks!

Signed-off-by: David Müller d.mueller@elsoft.ch --- cmd/load.c | 30 ------------------------------ include/config_cmd_all.h | 1 - 2 files changed, 31 deletions(-)
diff --git a/cmd/load.c b/cmd/load.c index 0aa7937..65557e4 100644 --- a/cmd/load.c +++ b/cmd/load.c @@ -1081,33 +1081,3 @@ U_BOOT_CMD( );
#endif /* CONFIG_CMD_LOADB */ - -/* -------------------------------------------------------------------- */ - -#if defined(CONFIG_CMD_HWFLOW) -int do_hwflow(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{ - extern int hwflow_onoff(int); - - if (argc == 2) { - if (strcmp(argv[1], "off") == 0) - hwflow_onoff(-1); - else - if (strcmp(argv[1], "on") == 0) - hwflow_onoff(1); - else - return CMD_RET_USAGE; - } - printf("RTS/CTS hardware flow control: %s\n", hwflow_onoff(0) ? "on" : "off"); - return 0; -} - -/* -------------------------------------------------------------------- */ - -U_BOOT_CMD( - hwflow, 2, 0, do_hwflow, - "turn RTS/CTS hardware flow control in serial line on/off", - "[on|off]" -); - -#endif /* CONFIG_CMD_HWFLOW */ diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h index 424721b..e858e55 100644 --- a/include/config_cmd_all.h +++ b/include/config_cmd_all.h @@ -34,7 +34,6 @@ #define CONFIG_CMD_FUSE /* Device fuse support */ #define CONFIG_CMD_GETTIME /* Get time since boot */ #define CONFIG_CMD_HASH /* calculate hash / digest */ -#define CONFIG_CMD_HWFLOW /* RTS/CTS hw flow control */ #define CONFIG_CMD_I2C /* I2C serial bus support */ #define CONFIG_CMD_IDE /* IDE harddisk support */ #define CONFIG_CMD_IMMAP /* IMMR dump support */

On Sat, Feb 06, 2016 at 07:57:26AM +0100, David Müller (ELSOFT AG) wrote:
Signed-off-by: David Müller d.mueller@elsoft.ch
Applied to u-boot/master, thanks!

Signed-off-by: David Müller d.mueller@elsoft.ch --- drivers/serial/serial_imx.c | 7 ------- drivers/serial/serial_s3c24x0.c | 35 ----------------------------------- 2 files changed, 42 deletions(-)
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c index d43a5fe..8d9166b 100644 --- a/drivers/serial/serial_imx.c +++ b/drivers/serial/serial_imx.c @@ -164,13 +164,6 @@ static int imx_serial_getc(void) return ch; }
-#ifdef CONFIG_HWFLOW -static int hwflow = 0; /* turned off by default */ -int hwflow_onoff(int on) -{ -} -#endif - /* * Output a single byte to the serial port. */ diff --git a/drivers/serial/serial_s3c24x0.c b/drivers/serial/serial_s3c24x0.c index 4cc94d9..fb895fd 100644 --- a/drivers/serial/serial_s3c24x0.c +++ b/drivers/serial/serial_s3c24x0.c @@ -65,10 +65,6 @@ DECLARE_GLOBAL_DATA_PTR; .puts = s3serial##port##_puts, \ }
-#ifdef CONFIG_HWFLOW -static int hwflow; -#endif - static void _serial_setbrg(const int dev_index) { struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index); @@ -95,10 +91,6 @@ static int serial_init_dev(const int dev_index) { struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index);
-#ifdef CONFIG_HWFLOW - hwflow = 0; /* turned off by default */ -#endif - /* FIFO enable, Tx/Rx FIFO clear */ writel(0x07, &uart->ufcon); writel(0x0, &uart->umcon); @@ -111,10 +103,6 @@ static int serial_init_dev(const int dev_index) */ writel(0x245, &uart->ucon);
-#ifdef CONFIG_HWFLOW - writel(0x1, &uart->umcon); /* rts up */ -#endif - /* FIXME: This is sooooooooooooooooooo ugly */ #if defined(CONFIG_ARCH_GTA02_v1) || defined(CONFIG_ARCH_GTA02_v2) /* we need auto hw flow control on the gsm and gps port */ @@ -146,24 +134,6 @@ static inline int serial_getc_dev(unsigned int dev_index) return _serial_getc(dev_index); }
-#ifdef CONFIG_HWFLOW -int hwflow_onoff(int on) -{ - switch (on) { - case 0: - default: - break; /* return current */ - case 1: - hwflow = 1; /* turn on */ - break; - case -1: - hwflow = 0; /* turn off */ - break; - } - return hwflow; -} -#endif - /* * Output a single byte to the serial port. */ @@ -174,11 +144,6 @@ static void _serial_putc(const char c, const int dev_index) while (!(readl(&uart->utrstat) & 0x2)) /* wait for room in the tx FIFO */ ;
-#ifdef CONFIG_HWFLOW - while (hwflow && !(readl(&uart->umstat) & 0x1)) - /* Wait for CTS up */ ; -#endif - writeb(c, &uart->utxh);
/* If \n, also do \r */

On Sat, Feb 06, 2016 at 07:57:27AM +0100, David Müller (ELSOFT AG) wrote:
Signed-off-by: David Müller d.mueller@elsoft.ch
Applied to u-boot/master, thanks!

Signed-off-by: David Müller d.mueller@elsoft.ch --- README | 28 ---------------------- doc/README.Modem | 72 -------------------------------------------------------- 2 files changed, 100 deletions(-) delete mode 100644 doc/README.Modem
diff --git a/README b/README index c7c9e0a..9a5be6c 100644 --- a/README +++ b/README @@ -1023,7 +1023,6 @@ The following options need to be configured: CONFIG_CMD_GO * the 'go' command (exec code) CONFIG_CMD_GREPENV * search environment CONFIG_CMD_HASH * calculate hash / digest - CONFIG_CMD_HWFLOW * RTS/CTS hw flow control CONFIG_CMD_I2C * I2C serial bus support CONFIG_CMD_IDE * IDE harddisk support CONFIG_CMD_IMI iminfo @@ -3712,17 +3711,6 @@ FIT uImage format: CONFIG_SPL_PAD_TO must be either 0, meaning to append the SPL payload without any padding, or >= CONFIG_SPL_MAX_SIZE.
-Modem Support: --------------- - -[so far only for SMDK2400 boards] - -- Modem support enable: - CONFIG_MODEM_SUPPORT - -- RTS/CTS Flow control enable: - CONFIG_HWFLOW - - Interrupt support (PPC):
There are common interrupt_init() and timer_interrupt() @@ -3736,22 +3724,6 @@ Modem Support: / other_activity_monitor it works automatically from general timer_interrupt().
-- General: - - In the target system modem support is enabled when a - specific key (key combination) is pressed during - power-on. Otherwise U-Boot will boot normally - (autoboot). The key_pressed() function is called from - board_init(). Currently key_pressed() is a dummy - function, returning 1 and thus enabling modem - initialization. - - If there are no modem init strings in the - environment, U-Boot proceed to autoboot; the - previous output (banner, info printfs) will be - suppressed, though. - - See also: doc/README.Modem
Board initialization settings: ------------------------------ diff --git a/doc/README.Modem b/doc/README.Modem deleted file mode 100644 index 1613c11..0000000 --- a/doc/README.Modem +++ /dev/null @@ -1,72 +0,0 @@ -How to configure modem support in U-Boot : - -1. Define modem initialization strings: ---------------------------------------- - -The modem initialization strings have following format: - - mdm_init1=<AT-command> - mdm_init2=<AT-command> - ... - -Turning off modem verbose responses with ATV0 or ATQ1 is not allowed; -U-Boot analyzes only verbose (not numeric) result codes. Modem local -command echo can be turned off (ATE0). - -2. RTS/CTS hardware flow control: ---------------------------------- - -You may wish to enable RTS/CTS hardware flow control, if the board's -UART driver supports it (see CONFIG_HWFLOW compile-time flag in -config/<board>.h). This is controlled by the 'mdm_flow_control' -environment variable: - - 'mdm_flow_control=rts/cts' - to enable RTS/CTS flow control. - 'mdm_flow_control=none ' - to disable. - - -The following are the examples using a Rockwell OEM modem -configuration: - -SAMSUNG # setenv mdm_init1 ATZ - reset the modem to - the factory defaults. -SAMSUNG # setenv mdm_init2 ATS0=1 - set modem into - answer mode. -SAMSUNG # setenv mdm_flow_control rts/cts - enable serial port - flow control -SAMSUNG # saveenv - -The example above initializes modem into answer mode to wait for the -incoming call. RTS/CTS flow control is enabled for the serial port. -(The RTS/CTS flow control is enabled by default on the modem). - - -SAMSUNG # setenv mdm_init1 ATZ -SAMSUNG # setenv mdm_init2 ATS39=0+IFC=0,0 - disable modem - RTS/CTS flow control -SAMSUNG # setenv mdm_init3 ATDT1643973 - dial out the number -SAMSUNG # setenv mdm_flow_control none -SAMSUNG # saveenv - -The example above initializes modem to dial-up connection on the -number 1643973. Flow control is disabled. - -Note that flow control must be turned both off or both on for the -board serial port and for the modem. - - -If the connection was set up successfully, the U-Boot prompt appears -on the terminal console. If not (U-Boot modem was configured for -originating the call and connection was not established) - the board -should be reset for another dial-up try. - - -Note on the SMDK2400 board: ---------------------------- - -Since the board serial ports does not have DTR signal wired, modem -should be told to ignore port DTR setting prior to connection to the -SMDK board, and this setting should be stored in modem NVRAM. For the -Rockwell OEM modem this can to be done with the following command: - -AT&D0&W

On Sat, Feb 06, 2016 at 07:57:28AM +0100, David Müller (ELSOFT AG) wrote:
Signed-off-by: David Müller d.mueller@elsoft.ch
Applied to u-boot/master, thanks!

Signed-off-by: David Müller d.mueller@elsoft.ch --- drivers/serial/serial_s3c24x0.c | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/drivers/serial/serial_s3c24x0.c b/drivers/serial/serial_s3c24x0.c index fb895fd..d4e7df2 100644 --- a/drivers/serial/serial_s3c24x0.c +++ b/drivers/serial/serial_s3c24x0.c @@ -103,12 +103,6 @@ static int serial_init_dev(const int dev_index) */ writel(0x245, &uart->ucon);
- /* FIXME: This is sooooooooooooooooooo ugly */ -#if defined(CONFIG_ARCH_GTA02_v1) || defined(CONFIG_ARCH_GTA02_v2) - /* we need auto hw flow control on the gsm and gps port */ - if (dev_index == 0 || dev_index == 1) - writel(0x10, &uart->umcon); -#endif _serial_setbrg(dev_index);
return (0);

On Sat, Feb 06, 2016 at 07:57:29AM +0100, David Müller (ELSOFT AG) wrote:
Signed-off-by: David Müller d.mueller@elsoft.ch
Applied to u-boot/master, thanks!
participants (2)
-
David Müller
-
Tom Rini