summaryrefslogtreecommitdiff
path: root/drivers/serial
AgeCommit message (Collapse)AuthorFilesLines
2021-02-15arm: Remove mx35pdk boardTom Rini1-1/+1
This board has not been converted to CONFIG_DM_MMC by the deadline of v2019.04, which is almost two years ago. In addition there are other DM migrations it is also missing. Remove it. Cc: Stefano Babic <sbabic@denx.de> Signed-off-by: Tom Rini <trini@konsulko.com> Acked-by: Stefano Babic <sbabic@denx.de>
2021-02-03serial: sifive: Cast dev_read_addr() with uintptr_tBin Meng1-1/+1
dev_read_addr() returns fdt_addr_t which is now a 64-bit address. In a 32-bit build, this causes the following warning seen when building serial_sifive.c: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] Cast the return value with uintptr_t. Signed-off-by: Bin Meng <bin.meng@windriver.com>
2021-01-27serial: a3720: Implement pending method for output directionPali Rohár1-2/+8
To check if some output characters are waiting either in Transmitter Holding Register or Transmitter Shift Register we need to look at TX_EMPTY bit of UART Status Register. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2021-01-24serial: add uart driver for MediaTek MT7620 SoCWeijie Gao3-0/+267
This patch adds uart support for MediaTek MT7620 and earlier SoCs. The UART used by MT7620 is incompatible with the ns16550a driver. All registers of this UART have different addresses. A special 16-bit register for Divisor Latch is used to set the baudrate instead of the original two 8-bit registers (DLL and DLM). The driver supports of-platdata which is useful for tiny SPL. Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2021-01-16drivers: serial: probe all uart devicesVabhav Sharma2-0/+25
U-Boot DM model probe only single device at a time which is enabled and configured using device tree or platform data method. PL011 UART IP is SBSA compliant and firmware does the serial port set-up, initialization and let the kernel use UART port for sending and receiving characters. Normally software talk to one serial port time but some LayerScape platform require all the UART devices enabled in Linux for various use case. Adding support to probe all enabled serial devices like SBSA compliant PL011 UART ports probe and initialization by firmware. Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Sean Anderson <seanga2@gmail.com>
2021-01-13serial: stm32: define LOG_CATEGORYPatrick Delaunay1-0/+3
Define LOG_CATEGORY to allow filtering with log command. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2021-01-06Merge tag 'xilinx-for-v2021.04' of ↵Tom Rini1-1/+1
https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next Xilinx changes for v2021.04 arm64: - DT updates microblaze: - Add support for NOR device support spi: - Fix unaligned data write issue nand: - Minor code change xilinx: - Fru fix in limit calculation - Fill git repo link for all Xilinx boards video: - Add support for seps525 spi display tools: - Minor Vitis file support cmd/common - Minor code indentation fixes serial: - Uartlite debug uart initialization fix
2021-01-06Merge tag 'dm-pull-5jan21' of git://git.denx.de/u-boot-dm into nextTom Rini19-123/+110
Driver model: make some udevice fields private Driver model: Rename U_BOOT_DEVICE et al. dtoc: Tidy up and add more tests ns16550 code clean-up x86 and sandbox minor fixes for of-platdata dtoc prepration for adding build-time instantiation
2021-01-06Merge tag 'v2021.01-rc5' into nextTom Rini1-1/+1
Prepare v2021.01-rc5 Signed-off-by: Tom Rini <trini@konsulko.com>
2021-01-05dm: Rename U_BOOT_DRIVER_ALIAS to DM_DRIVER_ALIASSimon Glass1-3/+3
We use the U_BOOT_ prefix (i.e. U_BOOT_DRIVER) to declare a driver but in every other case we just use DM_. Update the alias macros to use the DM_ prefix. We could perhaps rename U_BOOT_DRIVER() to DM_DRIVER(), but this macro is widely used and there is at least some benefit to indicating it us a U-Boot driver, particularly for code ported from Linux. So for now, let's keep that name. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-01-05dm: Rename U_BOOT_DEVICE() to U_BOOT_DRVINFO()Simon Glass1-1/+1
The current macro is a misnomer since it does not declare a device directly. Instead, it declares driver_info record which U-Boot uses at runtime to create a device. The distinction seems somewhat minor most of the time, but is becomes quite confusing when we actually want to declare a device, with of-platdata. We are left trying to distinguish between a device which isn't actually device, and a device that is (perhaps an 'instance'?) It seems better to rename this macro to describe what it actually is. The macros is not widely used, since boards should use devicetree to declare devices. Rename it to U_BOOT_DRVINFO(), which indicates clearly that this is declaring a new driver_info record, not a device. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-01-05dm: core: Access device flags through functionsSimon Glass1-1/+1
At present flags are stored as part of the device. In preparation for storing them separately, change the access to go through inline functions. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-01-05sandbox: serial: Move priv into a header fileSimon Glass1-15/+1
Move this struct into a header file so that dtoc can include it in its dt-platdata.c file. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2021-01-05dm: Use access methods for dev/uclass private dataSimon Glass15-54/+55
Most drivers use these access methods but a few do not. Update them. In some cases the access is not permitted, so mark those with a FIXME tag for the maintainer to check. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Pratyush Yadav <p.yadav@ti.com>
2021-01-05serial: Rename ns16550 functions to lower caseSimon Glass2-19/+19
Lower case should be used for function names. Update this driver and its callers accordingly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2021-01-05serial: Update NS16550_t and struct NS16550Simon Glass6-36/+36
Typedefs should not be used in U-Boot and structs should be lower case. Update the code to use struct ns16550 consistently. Put a header guard on the file while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2021-01-04serial: uartlite: Fix uninitialized ret in debug uartliteAshok Reddy Soma1-1/+1
Endianness detection is checked against uninitialized ret variable. Assign ret with read value from status register to fix this. Fixes: 31a359f87eaa ("serial: uartlite: Add support to work with any endianness") Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2020-12-19dm: Avoid accessing seq directlySimon Glass2-2/+2
At present various drivers etc. access the device's 'seq' member directly. This makes it harder to change the meaning of that member. Change access to go through a function instead. The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-14dm: treewide: Rename ..._platdata variables to just ..._platSimon Glass28-166/+166
Try to maintain some consistency between these variables by using _plat as a suffix for them. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-14dm: treewide: Rename ofdata_to_platdata() to of_to_plat()Simon Glass27-51/+51
This name is far too long. Rename it to remove the 'data' bits. This makes it consistent with the platdata->plat rename. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-14dm: treewide: Rename dev_get_platdata() to dev_get_plat()Simon Glass19-54/+54
Rename this to be consistent with the change from 'platdata'. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-14dm: treewide: Rename 'platdata' variables to just 'plat'Simon Glass27-113/+113
We use 'priv' for private data but often use 'platdata' for platform data. We can't really use 'pdata' since that is ambiguous (it could mean private or platform data). Rename some of the latter variables to end with 'plat' for consistency. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-13dm: treewide: Rename auto_alloc_size members to be shorterSimon Glass38-51/+51
This construct is quite long-winded. In earlier days it made some sense since auto-allocation was a strange concept. But with driver model now used pretty universally, we can shorten this to 'auto'. This reduces verbosity and makes it easier to read. Coincidentally it also ensures that every declaration is on one line, thus making dtoc's job easier. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-13sandbox: serial: Update to use membuffSimon Glass1-29/+19
Rather than implementing our own circular queue, use membuff. This allows us to read multiple bytes at once into the serial input. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-13sandbox: serial: Convert to livetreeSimon Glass1-3/+1
Use a livetree function to read the colour. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-13serial: sandbox: Drop unnecessary #ifdefsSimon Glass1-9/+2
CONFIG_OF_CONTROL is always enabled for sandbox (as it should be for all boards), so we can drop it. Also use IS_ENABLED() for the SPL check. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-09treewide: Update email address Patrick Delaunay and Patrice ChotardPatrice Chotard1-1/+1
Update Patrick and my email address with the one dedicated to upstream activities. Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-10-30Merge tag 'dm-pull-30oct20' of ↵Tom Rini1-0/+3
https://gitlab.denx.de/u-boot/custodians/u-boot-dm of-platdata and dtoc improvements sandbox SPL tests binman support for compressed sections
2020-10-29sandbox: Drop ad-hoc device declarations in SPLSimon Glass1-0/+3
Since sandbox's SPL is build with of-platadata, we should not use U_BOOT_DEVICE() declarations as well. Drop them. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-27serial: pl01x: Add error value checkingMichal Simek1-1/+12
There also a need to check return values to make sure that clocks were enabled and setup properly. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-23Revert "serial: serial_xen: print U-Boot banner and others"Tom Rini1-0/+2
This reverts commit 18426bf02217de2e9bb2b41eaa74d769892c55ef. Signed-off-by: Tom Rini <trini@konsulko.com>
2020-10-23Revert "serial: serial_xen: add DEBUG_UART support"Tom Rini2-31/+3
This reverts commit 82e21b391bd315f6fe0e0b79326af8a141e9cca7. Signed-off-by: Tom Rini <trini@konsulko.com>
2020-10-22serial: serial_xen: add DEBUG_UART supportAKASHI Takahiro2-3/+31
By using a hypervisor call, we can implement DEBUG_UART on xen. This will allow us to see messages even earlier than serial_init(). Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-10-22serial: serial_xen: print U-Boot banner and othersAKASHI Takahiro1-2/+0
At present, DM_FLAG_PRE_RELOC is set only if !OF_CONTROL. It doesn't make sense for this para-virtualized driver. With this patch applied, you will be able to see early boot messages: U-Boot 2020.10-00001-ge442e71a6c52-dirty (Oct 15 2020 - 11:02:25 +0900) xenguest Xen virtual CPU Model: XENVM-4.15 DRAM: 128 MiB PVBLOCK: (XEN) gnttab_mark_dirty not implemented yet pvblock: 0 In: hypervisor Out: hypervisor Err: hypervisor xenguest# Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2020-10-22common: rename getc() to getchar()Heinrich Schuchardt2-2/+2
The sandbox is built with the SDL2 library with invokes the X11 library which in turn calls getc(). But getc() in glibc is defined as int getc(FILE *) This does not match our definition. int getc(void) The sandbox crashes when called with parameter -l. Rename our library symbol getc() to getchar(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-09-23serial: uartlite: Add support to work with any endiannessT Karthik Reddy1-16/+48
This endinness changes are taken from linux uartlite driver. Reset TX fifo in control register and check TX fifo empty flag in lower byte of the status register to detect if it is a little endian system. Based on this check, program the registers with le32 or be32 through out the driver. Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com> Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2020-09-23xilinx: kconfig: Change Kconfig dependencies for Xilinx driversMichal Simek1-2/+2
Zynq/ZynqMP/Versal IPs should be possible to called also from Microblaze in PL and vice versa. That's why change dependencies and do not limit enabling just for some platforms. This is follow up patch based on commit 664e16ce99a0 ("xilinx: kconfig: Change Kconfig dependencies for Xilinx drivers"). Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2020-09-01serial: sh: Improve FIFO empty check on RXMarek Vasut1-1/+4
If the SCIF is receiving data quickly enough, it may happen that the SCxSR_RDxF flag is cleared in sh_serial_getc_generic(), while the FIFO still contains data. If that happens, the serial_getc_check() reports no data in the FIFO as the flag is no longer set. Add one more check, if the SCxSR_RDxF is not set, read out the FIFO level and if there are still characters in the FIFO, permit reading them out. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2020-08-22treewide: convert devfdt_get_addr_ptr() to dev_read_addr_ptr()Masahiro Yamada1-1/+1
When you enable CONFIG_OF_LIVE, you will end up with a lot of conversions. To help this tedious work, this commit converts devfdt_get_addr_ptr() to dev_read_addr_ptr() by coccinelle. I also removed redundant casts because dev_read_addr_ptr() returns an opaque pointer. To generate this commit, I ran the following semantic patch excluding include/dm/. <smpl> @@ type T; expression dev; @@ -(T *)devfdt_get_addr_ptr(dev) +dev_read_addr_ptr(dev) @@ expression dev; @@ -devfdt_get_addr_ptr(dev) +dev_read_addr_ptr(dev) </smpl> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-08-17serial: uniphier: fix typo in commentMasahiro Yamada1-1/+1
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-08-14serial: serial_xen: Add Xen PV serial driverPeng Fan3-0/+190
Add support for Xen para-virtualized serial driver. This driver fully supports serial console for the virtual machine. Please note that as the driver is initialized late, so no banner nor memory size is visible. Signed-off-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-08-06drivers: serial: Make serial_initialize return intOvidiu Panait2-3/+5
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-07-29msm_serial: Read bit rate register value from DTRobert Marko1-1/+5
IPQ40xx and currently supported Snapdragon boards don't use the same one so enable reading it from DT, if no DT property is found default value is the same as the previous define. Signed-off-by: Robert Marko <robert.marko@sartura.hr> Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
2020-07-28Merge tag 'u-boot-amlogic-20200727' of ↵Tom Rini1-4/+39
https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic - Handle errors in Meson serial driver - Enable HDMI, keyboard and ADC for Odroid-C2
2020-07-27serial: meson: handle RX errorsNeil Armstrong1-4/+39
This checks and handles RX errors on the Amlogic UART controller after experiencing errors on the Khadas VIM3 & VIM3L when UART AO A lines are not connected. When the RX line is not connected, the first byte is erroneous and breaks the U-Boot autoboot, breaking automatic boot. This checks and drops any erroneous RX byte on pending and getc callbacks to avoid returning true to pending when an error byte is in the FIFO. Fixes: bfcef28ae4 ("arm: add initial support for Amlogic Meson and ODROID-C2") Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Tested-by: Guillaume La Roque <glaroque@baylibre.com>
2020-07-25treewide: convert devfdt_get_addr() to dev_read_addr()Masahiro Yamada16-16/+16
When you enable CONFIG_OF_LIVE, you will end up with a lot of conversions. To generate this commit, I used coccinelle excluding drivers/core/, include/dm/, and test/ The semantic patch that makes this change is as follows: <smpl> @@ expression dev; @@ -devfdt_get_addr(dev) +dev_read_addr(dev) </smpl> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-07-25treewide: convert (void *)devfdt_get_addr() to dev_read_addr_ptr()Masahiro Yamada2-2/+2
Use the _ptr suffixed variant instead of casting. Also, convert it to dev_read_addr_ptr(), which is safe to CONFIG_OF_LIVE. One curious part is an error check like follows in drivers/watchdog/omap_wdt.c: priv->regs = (struct wd_timer *)devfdt_get_addr(dev); if (!priv->regs) return -EINVAL; devfdt_get_addr() returns FDT_ADDR_T_NONE (i.e. -1) on error. So, this code does not catch any error in DT parsing. dev_read_addr_ptr() returns NULL on error, so this error check will work. I generated this commit by the following command: $ find . -name .git -prune -o -name '*.[ch]' -type f -print | \ xargs sed -i -e 's/([^*)]*\*)devfdt_get_addr(/dev_read_addr_ptr(/' I manually fixed drivers/usb/host/ehci-mx6.c Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-07-24Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscvTom Rini1-1/+1
- Fix SiFive HiFive Unleashed board booting failure problem. - Enable SiFive fu540 PWM driver. - Support SiFive fu540: SPI boot. - Update OpenSBI used for RISC-V CI testing. - Revert "riscv: Allow use of reset drivers". - Revert "Revert "riscv: sifive: fu540: Add gpio-restart support"". - sysreset: syscon: - Don't assume default value for offset and mask property. - Support value property. - qemu: Add syscon reboot and poweroff support. - Fix SIFIVE debug serial dependency. - Fix linking error when building u-boot-spl with no SMP support. - AE350 use fdtdec_get_addr_size_auto_noparent to parse smc reg. - Make memory node available to SPL in hifive-unleashed-a00-u-boot.dtsi - SiFive fu540 avoid using hardcoded ram base and size.
2020-07-24Revert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"Tom Rini18-18/+18
This reverts commit 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7, reversing changes made to 56d37f1c564107e27d873181d838571b7d7860e7. Unfortunately this is causing CI failures: https://travis-ci.org/github/trini/u-boot/jobs/711313649 Signed-off-by: Tom Rini <trini@konsulko.com>
2020-07-24serial: Fix SIFIVE debug serial dependencyMichal Simek1-1/+1
The commit 4cc24aeaf420 ("serial: Add missing Kconfig dependencies for debug consoles") has added incorrect dependency for SIFIVE debug uart which should depend on SIFIVE driver instead of PL01x. Fixes: 4cc24aeaf420 ("serial: Add missing Kconfig dependencies for debug consoles") Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Leo Liang <ycliang@andestech.com> Reviewed-by: Sean Anderson <seanga2@gmail.com>