mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
74d11d37e2
This adds a serial driver which uses semihosting calls to read and write to the host's console. For convenience, if CONFIG_DM_SERIAL is enabled, we will instantiate a serial driver. This allows users to enable this driver (which has no physical device) without modifying their device trees or board files. We also implement a non-DM driver for SPL, or for much faster output in U-Boot proper. There are three ways to print to the console: Method Baud ================== ===== smh_putc in a loop 170 smh_puts 1600 smh_write with :tt 20000 ================== ===== These speeds were measured using a 175 character message with a J-Link adapter. For reference, U-Boot typically prints around 2700 characters during boot on this board. There are two major factors affecting the speed of these functions. First, each breakpoint incurs a delay. Second, each debugger memory transaction incurs a delay. smh_putc has a breakpoint and memory transaction for every character. smh_puts has one breakpoint, but still has to use a transaction for every character. This is because we don't know the length up front, so OpenOCD has to check if each character is nul. smh_write has only one breakpoint and one memory transfer. DM serial drivers can only implement a putc interface, so we are stuck with the slowest API. Non-DM drivers can implement puts, which is vastly more efficient. When the driver starts up, we try to open :tt. Since this is an extension, this may fail. If it does, we fall back to smh_puts. We don't check :semihosting-features, since there are nonconforming implementations (OpenOCD) which don't implement it (but *do* implement :tt). Some semihosting implementations (QEMU) don't handle READC properly. To work around this, we try to use open/read (much like for stdin) if possible. There is no non-blocking I/O available, so we don't implement pending. This will cause __serial_tstc to always return true. If CONFIG_SERIAL_RX_BUFFER is enabled, _serial_tstc will try and read characters forever. To avoid this, we depend on this config being disabled. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org> |
||
---|---|---|
.. | ||
altera_jtag_uart.c | ||
altera_uart.c | ||
arm_dcc.c | ||
atmel_usart.c | ||
atmel_usart.h | ||
Kconfig | ||
lpc32xx_hsuart.c | ||
Makefile | ||
ns16550.c | ||
sandbox.c | ||
serial-uclass.c | ||
serial.c | ||
serial_ar933x.c | ||
serial_arc.c | ||
serial_bcm283x_mu.c | ||
serial_bcm283x_pl011.c | ||
serial_bcm6345.c | ||
serial_coreboot.c | ||
serial_cortina.c | ||
serial_efi.c | ||
serial_htif.c | ||
serial_intel_mid.c | ||
serial_linflexuart.c | ||
serial_lpuart.c | ||
serial_mcf.c | ||
serial_meson.c | ||
serial_mpc8xx.c | ||
serial_msm.c | ||
serial_msm_geni.c | ||
serial_mt7620.c | ||
serial_mtk.c | ||
serial_mvebu_a3700.c | ||
serial_mxc.c | ||
serial_ns16550.c | ||
serial_nulldev.c | ||
serial_octeon_bootcmd.c | ||
serial_octeon_pcie_console.c | ||
serial_omap.c | ||
serial_owl.c | ||
serial_pic32.c | ||
serial_pl01x.c | ||
serial_pl01x_internal.h | ||
serial_pxa.c | ||
serial_rockchip.c | ||
serial_s5p.c | ||
serial_sbi.c | ||
serial_semihosting.c | ||
serial_sh.c | ||
serial_sh.h | ||
serial_sifive.c | ||
serial_sti_asc.c | ||
serial_stm32.c | ||
serial_stm32.h | ||
serial_uniphier.c | ||
serial_xen.c | ||
serial_xuartlite.c | ||
serial_zynq.c | ||
usbtty.c | ||
usbtty.h |