summaryrefslogtreecommitdiff
path: root/include/serial.h
AgeCommit message (Collapse)Author
2022-12-23post: Move CONFIG_SYS_POST to CFG_SYS_POSTTom Rini
Migrate the rest of the CONFIG_SYS_POST macros over to CFG_SYS_POST namespace. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-12-05post: Migrate to KconfigTom Rini
We move the existing CONFIG_POST_* functionality over to CFG_POST and then introduce CONFIG_POST to Kconfig. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-24serial: Implement serial_flush() function for console flush() fallbackPali Rohár
Like in all other console functions, implement also serial_flush() function as a fallback int console flush() function. Flush support is available only when config option CONSOLE_FLUSH_SUPPORT is enabled. So when it is disabled then provides just empty static inline function serial_flush(). Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-01serial: dm: Add support for putsSean Anderson
Some serial drivers can be vastly more efficient when printing multiple characters at once. Non-DM serial has had a puts option for these sorts of drivers; implement it for DM serial as well. Because we have to add carriage returns, we can't just pass the whole string directly to the serial driver. Instead, we print up to the newline, then print a carriage return, and then continue on. This is less efficient, but it is better than printing each character individually. It also avoids having to allocate memory just to add a few characters. Drivers may perform short writes (such as filling a FIFO) and return the number of characters written in len. We loop over them in the same way that _serial_putc loops over putc. This results in around sizeof(void *) growth for all boards with DM_SERIAL. The full implementation takes around 140 bytes. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-01serial: Add semihosting driverSean Anderson
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>
2022-01-19doc: replace @return by Return:Heinrich Schuchardt
Sphinx expects Return: and not @return to indicate a return value. find . -name '*.c' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; find . -name '*.h' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2020-08-06drivers: serial: Make serial_initialize return intOvidiu Panait
serial_initialize is called only during the common init sequence, after relocation (in common/board_r.c). Because it has a void return value, it has to wrapped in initr_serial. In order to be able to get rid of this indirection, make serial_initialize return int. Remove extern from prototype in order to silence the following checkpatch warning: check: extern prototypes should be avoided in .h files Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2020-05-15rename symbol: CONFIG_TEGRA -> CONFIG_ARCH_TEGRATrevor Woerner
Have this symbol follow the pattern of all other such symbols. Signed-off-by: Trevor Woerner <twoerner@gmail.com>
2020-04-16dm: serial: Add clock member to struct serial_device_infoAndy Shevchenko
Some callers of serial_getinfo() would like to know the UART base clock speed in order to make decision what to pass to OS in some cases. In particular, ACPI SPCR table expects only certain base clock speed and thus we have to act accordingly. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-12-02common: Move serial functions out of common.hSimon Glass
These functions belong in serial.h so move them over. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02common: Move serial_printf() to the serial headerSimon Glass
Move this function header to serial.h since this function is clearly related to serial. The function itself stays in console.c since we don't have a single serial file. DM and non-DM each has a separate file so we would have to either create a new common serial file, or repeat the function in both serial.c and serial-uclass.c, neither of which seem worthwhile. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-02serial: usb: Correct the usbtty_...() prototypesSimon Glass
The function declarations in serial.h are not in sync with what is currently used in usbtty. Fix this by updating the header and including it, to help catch future such problems. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-01-14dm: serial: Tidy up header file commentsSimon Glass
The getconfig() comment is out of date. Fix this and add comments for recently added functions. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2019-01-14dm: serial: Adjust serial_getinfo() to use proper APISimon Glass
All driver-model functions should have a device as the first parameter. Update this function accordingly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2019-01-14dm: serial: Adjust serial_setconfig() to use proper APISimon Glass
All driver-model functions should have a device as the first parameter. Update this function accordingly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2019-01-14dm: serial: Adjust serial_getconfig() to use proper APISimon Glass
All driver-model functions should have a device as the first parameter. Update this function accordingly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2019-01-14serial: Move new functions to serial.hSimon Glass
We should not be adding new functions to common.h. Move these recently added functions to serial.h. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2018-12-05dm: serial: Introduce ->getinfo() callbackAndy Shevchenko
New callback will give a necessary information to fill up ACPI SPCR table, for example. Maybe used later for other purposes. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Glass <sjg@chromium.org> Change ADR_SPACE_SYSTEM_IO to SERIAL_ADDRESS_SPACE_IO to fix build error: Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-05dm: serial: Add ->getconfig() callbackAndy Shevchenko
In some cases it would be good to know the settings, such as parity, of current serial console. One example might be an ACPI SPCR table to generate using these parameters. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-12-03drivers: serial: get rid of non DM mpc8xx driverChristophe Leroy
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
2018-11-16dm: serial: fix comment on dm_serial_ops setconfigSimon Goldschmidt
The comment on this function prototype describes nonexistent parameters. It seems to be copied from 'setparity'. Update it to match its the parameter list. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-10sandbox: Add serial testPatrice Chotard
Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-10dm: serial: Remove setparity opsPatrice Chotard
setparity users has been updated to use new setconfig ops, so we can safely remove setparity ops Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-10dm: serial: Replace setparity by setconfigPatrice Chotard
Replace setparity by more generic setconfig ops to allow uart parity, bits word length and stop bits number change. Adds SERIAL_GET_PARITY/BITS/STOP macros. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-08-08mips: au1x00: Remove support for these SoCsTom Rini
The only platform left for the AU1x00 SoCs was the pb1x00 platform, an apparent clone of the dbau1x00 platform. As pb1x00 had no listed maintainer I am assuming that it is also orphaned. Remove this platform and then remove the unused SoC support. Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
2018-05-26dm: serial: Add setparityPatrick Delaunay
Implements serial setparity ops to allow uart parity change. It allows to select ODD, EVEN or NONE parity. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
2018-04-06drivers: serial: remove nonexisting initialisation functionsChristophe Leroy
This patch removes call of serial initialisation functions that are not implemented anymore. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
2017-08-24serial: serial-uclass: Add generic serial RX buffer supportStefan Roese
Pasting longer lines into the U-Boot console prompt sometimes leads to characters missing. One problem here is the small 16-byte FIFO of the legacy NS16550 UART, e.g. on x86 platforms. This patch now introduces a Kconfig option to enable RX buffer support for all DM based serial drivers. With this option enabled, I was able paste really long lines into the U-Boot console, without any characters missing. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2017-07-03powerpc: remove 4xx supportHeiko Schocher
There was for long time no activity in the 4xx area. We need to go further and convert to Kconfig, but it turned out, nobody is interested anymore in 4xx, so remove it. Signed-off-by: Heiko Schocher <hs@denx.de>
2017-06-16powerpc, 5xx: remove some "5xx" remainsHeiko Schocher
we removed 5xx support. So delete some forgotten remains. Signed-off-by: Heiko Schocher <hs@denx.de>
2017-06-16powerpc, 82xx: remove some missed mpc82xx remainsHeiko Schocher
we removed 82xx support. Missed some 82xx remains, remove them now. Signed-off-by: Heiko Schocher <hs@denx.de>
2017-06-16powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512xHeiko Schocher
There was for long time no activity in the mpx5xxx area. We need to go further and convert to Kconfig, but it turned out, nobody is interested anymore in mpc5xxx, so remove it. Signed-off-by: Heiko Schocher <hs@denx.de>
2016-05-27board: am335x: Allow to choose serial device dynamicallyLokesh Vutla
Different AM335x based platforms have different serial consoles. As serial console is Kconfig option a separate defconfig has to be created for each platform. So pass the serial device dynamically. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2015-10-23serial: remove altera serial initializationsThomas Chou
Both altera_jtag_serial_initialize() and altera_serial_initialize() are no longer used after they are converted to driver model. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Marek Vasut <marex@denx.de>
2015-02-24ARM: remove cm4008 and cm41xx board supportMasahiro Yamada
These are still non-generic boards. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Cc: Greg Ungerer <greg.ungerer@opengear.com> Acked-by: Marek Vasut <marex@denx.de>
2015-02-24ARM: remove jadecpu board supportMasahiro Yamada
This is still a non-generic board. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Cc: Matthias Weisser <weisserm@arcor.de> Acked-by: Marek Vasut <marex@denx.de>
2014-11-04serial: add prototypes for init functionsJeroen Hofstee
While at it, sort them. Cc: Tom Rini <trini@ti.com> Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
2014-09-10dm: Add a uclass for serial devicesSimon Glass
Serial devices support simple byte input/output and a few operations to find out whether data is available. Add a basic uclass for serial devices to be used by drivers that are converted to driver model. Signed-off-by: Simon Glass <sjg@chromium.org>
2013-08-20ppc4xx: Remove support for PPC405CR CPUsMatthias Fuchs
This patch removes support for the APM 405CR CPU. This CPU is EOL and no board uses this chip. Signed-off-by: Matthias Fuchs <matthias.fuchs@esd.eu>
2013-01-16Tegra30: Add generic Tegra30 build supportTom Warren
This patch adds basic Tegra30 (T30) build support - no specific board is targeted. Signed-off-by: Tom Warren <twarren@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2012-10-17serial: Implement default_serial_puts()Marek Vasut
U-Boot contains a lot of duplicit implementations of serial_puts() call which just pipes single characters into the port in loop. Implement function that does this behavior into common code, so others can make easy use of it. This function is called default_serial_puts() and it's sole purpose is to call putc() in loop on the whole string passed to it. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com>
2012-10-15serial: Remove CONFIG_SERIAL_MULTI from remaining sourcesMarek Vasut
Remove the parts depending either on disabled CONFIG_SERIAL_MULTI or ifdefs around CONFIG_SERIAL_MULTI parts since CONFIG_SERIAL_MULTI is now enabled by default. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> Cc: Anatolij Gustschin <agust@denx.de> Cc: Stefan Roese <sr@denx.de>
2012-10-15serial: zoom2: Remove zoom2 serial prototypes from serial.hMarek Vasut
Remove the prototypes for zoom2_serial_deviceN from serial.h . This can't be done right away, as they are referenced from the zoom2 config file. Therefore, adjust the code so the config file only specifies number of the port. Then, replace the simple return in default_serial_console() with a switch across possible values, which returns the zoom2_serial_deviceN . With such adjustment in place, the exported prototypes in serial.h can be safely removed. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com>
2012-10-15serial: bfin: Adjust serial_register_bfin_uart()Marek Vasut
Rename the serial_register_bfin_uart() to bfin_initialize_serial() to be consistent with the rest of the naming. Next, remove it's prototype from serial.h and properly insert it into serial.c as the rest of the serial initialization functions. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> Cc: Mike Frysinger <vapier@gentoo.org>
2012-10-15serial: bfin: Remove the bfin_serialN_device exports from serial.hMarek Vasut
Remove the exports from serial.h as they are only used in the blackfin serial driver. Furthermore, they are only used for registration, which is handled already inside that driver and default_serial_port() call, which is also handled in that driver. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> Cc: Mike Frysinger <vapier@gentoo.org>
2012-10-15serial: ns16550: Move serial registration from serial_initialize()Marek Vasut
Move the registration of eserialN_device ports from default serial_initialize() into driver specific function called from serial_initialize(). This slims down the serial_initialize() call to a bare tracker of all possible serial port registration routines in U-Boot. The newly implemented ns16550_serial_initialize() function, which is implemented inside of the ns16550 serial driver allows encapsulation of eserialN_device within the ns16550 serial driver itself. Also, remove the exports of eserialN_device from include/serial.h as they are no longer needed. This is simply because the implementation of default_serial_console() is wrapped into the ns16550 serial driver and the default console is picked by CONFIG_SERIAL<N> macro in config file. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> Cc: Anatolij Gustschin <agust@denx.de> Cc: Stefan Roese <sr@denx.de> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Michal Simek <monstr@monstr.eu>
2012-10-15serial: mpc512x: Move serial registration from serial_initialize()Marek Vasut
Move the registration of serialN_device ports from default serial_initialize() into driver specific function called from serial_initialize(). This slims down the serial_initialize() call to a bare tracker of all possible serial port registration routines in U-Boot. The newly implemented mpc512x_serial_initialize() function, which is implemented inside of the mpc512x serial driver allows encapsulation of serialN_device within the mpc512x serial driver itself. Also, remove the exports of serialN_device from include/serial.h as they are no longer needed. This is simply because the implementation of default_serial_console() is wrapped into the mpx512x serial driver and the default console is picked by CONFIG_SERIAL<N> macro in config file. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> Cc: Anatolij Gustschin <agust@denx.de> Cc: Stefan Roese <sr@denx.de>
2012-10-15serial: microblaze: Move serial registration from serial_initialize()Marek Vasut
Move the registration of xuartlite_serialN_device ports from default serial_initialize() into driver specific function called from serial_initialize(). This slims down the serial_initialize() call to a bare tracker of all possible serial port registration routines in U-Boot. The newly implemented xuartlite_serial_initialize() function, which is implemented inside of the serial_xuartlite driver allows encapsulation of xuartlite_serialN_device within the serial_xuartlite driver itself. Also, remove the exports of xuartlite_serialN_device from include/serial.h as they are no longer needed. This is simply because the implementation of default_serial_console() is wrapped into the serial_xuartlite driver and the default console is picked by CONFIG_SERIAL<N> macro in config file. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> Cc: Michal Simek <monstr@monstr.eu>
2012-10-15serial: zynq: Move serial registration from serial_initialize()Tom Rini
Move the registration of zynq_serialN_device ports from default serial_initialize() into driver specific function called from serial_initialize(). This slims down the serial_initialize() call to a bare tracker of all possible serial port registration routines in U-Boot. The newly implemented zynq_serial_initialize() function, which is implemented inside of the serial_zynq driver allows encapsulation of zynq_serialN_device within the serial_zynq driver itself. Also, remove the exports of zynq_serialN_device from include/serial.h as they are no longer needed. This is simply because the implementation of default_serial_console() is wrapped into the serial_zynq driver and the default console is picked by CONFIG_SERIAL<N> macro in config file. Signed-off-by: Tom Rini <trini@ti.com>
2012-10-15serial: s5p: Move serial registration from serial_initialize()Marek Vasut
Move the registration of s5p_serialN_device ports from default serial_initialize() into driver specific function called from serial_initialize(). This slims down the serial_initialize() call to a bare tracker of all possible serial port registration routines in U-Boot. The newly implemented s5p_serial_initialize() function, which is implemented inside of the serial_s5p driver allows encapsulation of s5p_serialN_device within the serial_s5p driver itself. Also, remove the exports of s5p_serialN_device from include/serial.h as they are no longer needed. This is simply because the implementation of default_serial_console() is wrapped into the serial_s5p driver and the default console is picked by CONFIG_SERIAL<N> macro in config file. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> Cc: Minkyu Kang <mk7.kang@samsung.com>