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 */
43 extern void dbg(const char *fmt, ...);
49 extern void enable_putc(void);
50 extern int hwflow_onoff(int);
52 enable_putc(); /* enable serial_putc() */
55 init_str = getenv("mdm_flow_control");
56 if (init_str && (strcmp(init_str, "rts/cts") == 0))
63 sprintf(env_str, "mdm_init%d", i);
64 if ((init_str = getenv(env_str)) != NULL) {
65 serial_puts(init_str);
68 mdm_readline(console_buffer, CONFIG_SYS_CBSIZE);
69 dbg("ini%d: [%s]", i, console_buffer);
71 if ((strcmp(console_buffer, "OK") == 0) ||
72 (strcmp(console_buffer, "ERROR") == 0)) {
73 dbg("ini%d: cmd done", i);
75 } else /* in case we are originating call ... */
76 if (strncmp(console_buffer, "CONNECT", 7) == 0) {
77 dbg("ini%d: connect", i);
82 break; /* no init string - stop modem init */
89 /* final stage - wait for connect */
90 for(;i > 1;) { /* if 'i' > 1 - wait for connection
92 mdm_readline(console_buffer, CONFIG_SYS_CBSIZE);
93 dbg("ini_f: [%s]", console_buffer);
94 if (strncmp(console_buffer, "CONNECT", 7) == 0) {
95 dbg("ini_f: connected");