int uart_post_test (int flags) { int res = 0; int i; ctlr_proc[CTLR_SMC].init = smc_init; ctlr_proc[CTLR_SMC].halt = smc_halt; ctlr_proc[CTLR_SMC].putc = smc_putc; ctlr_proc[CTLR_SMC].getc = smc_getc; ctlr_proc[CTLR_SCC].init = scc_init; ctlr_proc[CTLR_SCC].halt = scc_halt; ctlr_proc[CTLR_SCC].putc = scc_putc; ctlr_proc[CTLR_SCC].getc = scc_getc; for (i = 0; i < CTRL_LIST_SIZE; i++) { if (test_ctlr (ctlr_list[i][0], ctlr_list[i][1]) != 0) { res = -1; } } #if !defined(CONFIG_8xx_CONS_NONE) serial_reinit_all (); #endif return res; }
int uart_post_test (int flags) { int i, res = 0; static unsigned long base[] = CONFIG_SYS_POST_UART_TABLE; for (i = 0; i < ARRAY_SIZE(base); i++) { if (test_ctlr((struct NS16550 *)base[i], i)) res = -1; } serial_reinit_all (); return res; }
int uart_post_test (int flags) { int i, res = 0; static unsigned long base[] = CONFIG_SYS_POST_UART_TABLE; for (i = 0; i < sizeof (base) / sizeof (base[0]); i++) { if (test_ctlr (base[i], i)) res = -1; } serial_reinit_all (); return res; }
int ether_post_test (int flags) { int res = 0; int i; ctlr_proc[CTLR_SCC].init = scc_init; ctlr_proc[CTLR_SCC].halt = scc_halt; ctlr_proc[CTLR_SCC].send = scc_send; ctlr_proc[CTLR_SCC].recv = scc_recv; for (i = 0; i < CTRL_LIST_SIZE; i++) { if (test_ctlr (ctlr_list[i][0], ctlr_list[i][1]) != 0) { res = -1; } } #if !defined(CONFIG_8xx_CONS_NONE) serial_reinit_all (); #endif return res; }
/* Mark weak until post/cpu/.../uart.c migrate over */ __weak int uart_post_test(int flags) { unsigned char c; int ret, saved_baud, b; struct serial_device *saved_dev, *s; /* Save current serial state */ ret = 0; saved_dev = serial_current; saved_baud = gd->baudrate; for (s = serial_devices; s; s = s->next) { /* If this driver doesn't support loop back, skip it */ if (!s->loop) continue; /* Test the next device */ serial_current = s; ret = serial_init(); if (ret) goto done; /* Consume anything that happens to be queued */ while (serial_tstc()) serial_getc(); /* Enable loop back */ s->loop(1); /* Test every available baud rate */ for (b = 0; b < ARRAY_SIZE(bauds); ++b) { gd->baudrate = bauds[b]; serial_setbrg(); /* * Stick to printable chars to avoid issues: * - terminal corruption * - serial program reacting to sequences and sending * back random extra data * - most serial drivers add in extra chars (like \r\n) */ for (c = 0x20; c < 0x7f; ++c) { /* Send it out */ serial_putc(c); /* Make sure it's the same one */ ret = (c != serial_getc()); if (ret) { s->loop(0); goto done; } /* Clean up the output in case it was sent */ serial_putc('\b'); ret = ('\b' != serial_getc()); if (ret) { s->loop(0); goto done; } } } /* Disable loop back */ s->loop(0); /* XXX: There is no serial_stop() !? */ if (s->stop) s->stop(); } done: /* Restore previous serial state */ serial_current = saved_dev; gd->baudrate = saved_baud; serial_reinit_all(); serial_setbrg(); return ret; }