summaryrefslogtreecommitdiff
path: root/sys/dev/uart/uart_dev_snps.c
AgeCommit message (Collapse)Author
2025-10-31uart: provide and use default rclk for JH7110 UARTMitchell Horne
A regression in the u-boot-provided JH7110 device tree leaves the uart incorrectly configured. The issue arises when a baud rate is specified ('current-speed' property), but the rclk value is not ('clock-frequency'). Previous releases, e.g. v2025.04, provided both. The alternative way to retrieve this value is to query the parent clock, but our clk framework is not available during early console probing and configuration. In this instance, we end up defaulting to DEFAULT_RCLK in ns8250_init(), which is the wrong value. The relevant uart class (uart_snps) should provide a default rclk in its definition, but it does not. Add a new variant class with the correct default rclk of 24000000. Finally, uart_cpu_fdt_probe() needs to be updated to actually query this default value when it does not find a 'clock-frequency' property. This was simply missing; the ACPI uart bus behaves identically, see uart_acpi_probe(). PR: 289978 Reported by: rdunkle@smallcatbrain.com MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D53119
2024-04-12uart_snps: Register a device xref for UARTsKa Ho Ng
This is useful for other drivers to be able to find the UART (such as the case of UARTs where hardware flow control lines are handled by another device.) Sponsored by: Juniper Networks, Inc. MFC after: 1 week Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44532
2024-02-13sys: Simplify enabling EARLY_PRINTF uartsAndrew Turner
Support selecting the early uart with "options EARLY_PRINTF=foo" in the kernel configuration file. This allows us to not have to change source files when enabling EARLY_PRINTF, simplifying enabling it. New uart drivers can be enabled by defining a new early_printf_foo value to be unique, then using "#if CHECK_EARLY_PRINTF(foo)" to decide when to enable the uart. While here add pl011 early printf support. Reviewed by: imp (earlier version) Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D43360
2024-01-14uart(4): Honor hardware state of NS8250-class for tsw_busyMarius Strobl
In 9750d9e5, I brought the equivalent of the TS_BUSY flag back in a mostly hardware-agnostic way in order to fix tty_drain() and, thus, TIOCDRAIN for UARTs with TX FIFOs. This proved to be sufficient for fixing the regression reported. So in light of the release cycle of FreeBSD 10.3, I decided that this change was be good enough for the time being and opted to go with the smallest possible yet generic (for all UARTs driven by uart(4)) solution addressing the problem at hand. However, at least for the NS8250-class the above isn't a complete fix as these UARTs only trigger an interrupt when the TX FIFO became empty. At this point, there still can be an outstanding character left in the transmit shift register as indicated via the LSR. Thus, this change adds the 3rd (besides the tty(4) and generic uart(4) bits) part I had in my tree ever since, adding a uart_txbusy method to be queried in addition for tsw_busy and hooking it up as appropriate for the NS8250-class. As it turns out, the exact equivalent of this 3rd part later on was implemented for uftdi(4) in 9ad221a5. While at it, explain the rational behind the deliberately missing locking in uart_tty_busy() (also applying to the generic sc_txbusy testing already present).
2024-01-10hwreset: Move reset code in dev/hwresetEmmanuel Vadot
We've removed kernel option EXT_RESOURCES almost two years ago. While it was ok to have some code under a common 'extres' subdirectory at first, we now have a lot of consumer of it and we made it mandatory so no need to have it under a cryptic name. Reviewed by: imp Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D43192
2024-01-10clk: Move clock code in dev/clkEmmanuel Vadot
We've removed kernel option EXT_RESOURCES almost two years ago. While it was ok to have some code under a common 'extres' subdirectory at first, we now have a lot of consumer of it and we made it mandatory so no need to have it under a cryptic name. Reviewed by: mhorne Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D43191
2023-11-26sys: Automated cleanup of cdefs and other formattingWarner Losh
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
2023-08-16sys: Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16sys: Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2022-10-06uart_dev_snps: Fix device probingKornel Dulęba
The "uart_bus_probe" function is used as a generic part of uart probe logic. It returns a driver priority(negative number) if successful and an error code otherwise. Fix the error checking condition to account for that. Also, while here return "BUS_PROBE_VENDOR", instead of "0". This fixes uart on clearfog pro with recent DT. PR: 266657 Reviewed by: mw Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D36880
2022-05-06Remove unused uart_devclass.John Baldwin
2022-02-21uart_dev_snps: Make ext_resources non-optionalEmmanuel Vadot
EXT_RESOURCES have been introduced in 12-CURRENT and all supported releases have it enabled in their kernel config. MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D33828
2019-12-03Remove "all rights reserved" from copyright for the file that Jared McNeillEmmanuel Vadot
own. He gave me permission to do this. Notes: svn path=/head/; revision=355358
2018-10-10Update Armada 38x UART device tree bindingMarcin Wojtas
Recent changes in Linux updated Marvell Armada 38x UART compatible string. As a result the FreeBSD driver (uart_dev_snps) does not probe. This commit fixes the situation, however not applying any functional modification to the driver methods. Approved by: re (kib) Obtained from: Semihalf Notes: svn path=/head/; revision=339280
2018-08-19add snps IP uart support / genaralize UARTMatt Macy
This is an amalgam of a patch by Doug Ambrisko to generalize uart_acpi_find_device, imp moving the ACPI table to uart_dev_ns8250.c and advice by jhb to work around a bug in the EPYC 3151 BIOS (the BIOS incorrectly marks the serial ports as disabled) Reviewed by: imp MFC after: 8 weeks Differential Revision: https://reviews.freebsd.org/D16432 Notes: svn path=/head/; revision=338074
2018-07-23Now that we set the busy_detect bit in the bas to support setting itWarner Losh
for the console, set our override in the bas as well. Tested by: emaste@ Notes: svn path=/head/; revision=336648
2018-05-01uart_snps: Add early printf supportEmmanuel Vadot
Move the allwinner early printf support to the snps driver as it should work with all implementation. While here add instruction for enabling it on 64bits SoCs. Notes: svn path=/head/; revision=333138
2017-12-25Do pass removing some write-only variables from the kernel.Alexander Kabaev
This reduces noise when kernel is compiled by newer GCC versions, such as one used by external toolchain ports. Reviewed by: kib, andrew(sys/arm and sys/arm64), emaste(partial), erj(partial) Reviewed by: jhb (sys/dev/pci/* sys/kern/vfs_aio.c and sys/kern/kern_synch.c) Differential Revision: https://reviews.freebsd.org/D10385 Notes: svn path=/head/; revision=327173
2017-02-27Allow setting access-width for UART registers.Ruslan Bukin
This is required for FDT's standard "reg-io-width" property (similar to "reg-shift" property) found in many DTS files. This fixes operation on Altera Arria 10 SOC Development Kit, where standard ns8250 uart allows 4-byte access only. Reviewed by: kan, marcel Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9785 Notes: svn path=/head/; revision=314362
2017-02-27Revert r314212 as it break Allwinner boards.Ruslan Bukin
Reported by: manu Notes: svn path=/head/; revision=314360
2017-02-24Use correct macro for Synopsys UART driver declaration.Ruslan Bukin
Notes: svn path=/head/; revision=314212
2016-07-10EXTRES: Add OF node as argument to all <foo>_get_by_ofw_<bar>() functions.Michal Meloun
In some cases, the driver must handle given properties located in specific OF subnode. Instead of creating duplicate set of function, add 'node' as argument to existing functions, defaulting it to device OF node. MFC after: 3 weeks Notes: svn path=/head/; revision=302528
2016-04-01Move support for Synopsys Designware APB UART out of ns8250 and into aJared McNeill
separate driver. Add support for activating clock and hwreset resources for these devices when the EXT_RESOURCES option is present. Reviewed by: andrew, mmel, Emmanuel Vadot <manu@bidouilliste.com> Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D5749 Notes: svn path=/head/; revision=297496