2 * (C) Copyright 2002-2009
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
10 /* 'inline' - We have to do it fast */
11 static inline void mdm_readline(char *buf, int bufsiz)
34 return; /* sanity check */
48 extern void enable_putc(void);
49 extern int hwflow_onoff(int);
51 enable_putc(); /* enable serial_putc() */
54 init_str = getenv("mdm_flow_control");
55 if (init_str && (strcmp(init_str, "rts/cts") == 0))
62 sprintf(env_str, "mdm_init%d", i);
63 if ((init_str = getenv(env_str)) != NULL) {
64 serial_puts(init_str);
67 mdm_readline(console_buffer, CONFIG_SYS_CBSIZE);
68 debug("ini%d: [%s]", i, console_buffer);
70 if ((strcmp(console_buffer, "OK") == 0) ||
71 (strcmp(console_buffer, "ERROR") == 0)) {
72 debug("ini%d: cmd done", i);
74 } else /* in case we are originating call ... */
75 if (strncmp(console_buffer, "CONNECT", 7) == 0) {
76 debug("ini%d: connect", i);
81 break; /* no init string - stop modem init */
88 /* final stage - wait for connect */
89 for(;i > 1;) { /* if 'i' > 1 - wait for connection
91 mdm_readline(console_buffer, CONFIG_SYS_CBSIZE);
92 debug("ini_f: [%s]", console_buffer);
93 if (strncmp(console_buffer, "CONNECT", 7) == 0) {
94 debug("ini_f: connected");