summaryrefslogtreecommitdiff
path: root/sys/dev/uart/uart_subr.c
AgeCommit message (Collapse)Author
2024-10-14uart: uart_getenv: check for NULL class last, not firstWarner Losh
This allows one to specify dt:XXXX when the default class isn't compiled into the kernel. It's not an error to not have a class until we're done parsing the spec, so defer checking until then. Sponsored by: Netflix Reviewed by: adrian, andrew, markj Differential Revision: https://reviews.freebsd.org/D47078
2024-10-14uart: Add a signal to compute rclk from baudrateWarner Losh
With newer, more diverse hardware designs, the rclk can be unknown. Currently deployed systems have no standard way to discover the baud-clock generator frequency. However, sometimes we have a fairly good idea that the firmware programmed the UART to be the baud rate that it's telling us it's at. Create a way to instruct the uart class drivers to compute the baud clock frequency the first time their init routines are called. Usually the 'divisors' are relatively small, meaning we will likely have a fairly large error (goes as 1 / (divisor + 1). However, we also know that the baud-generator clock needs to be divided down to the baud-rate +/- about 5% (so while the error could be large for an arbitrary baud-clock, standard baud rates generally will give an error of 5% or less). Often, the console speed and the getty-configured speed are the same, so this heuristic allows boot messages and login sessions to work. Sponsored by: Netflix Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D47072
2024-10-11uart: Document rw:XXX field of hw.uart.consoleWarner Losh
Add a one-liner description of rw - Register Width added in eae36de826cc. Fixes: eae36de826cc Sponsored by: Netflix
2024-02-13dev/uart: Support setting the register io widthAndrew Turner
Some uarts require a specific register width. Support setting this in the kernel environment. Reviewed by: imp (earlier version) Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D43362
2024-02-13dev/uart: Use a linker set to find uart classesAndrew Turner
When the uart is configured via the environment we need to find the uart class with a specified name. Currently to do this with an incomplete list of uarts. As we may not have included all uarts in the kernel each class is defined as weak. Switch to a linker set so the list is always up to date based on what is included in the kernel, and the class can be static. Reviewed by: imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D43361
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-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
2022-09-30arm: Catch up with Samsung S3C2xx0 code removalWarner Losh
The code backing these uart_class was removed 7 years ago in 4648ee952520. Sponsored by: Netflix
2021-01-14uart: Improve console specification parsingWarner Losh
Print warning when we can't parse a console specification (this may not appear on the console, but will appear in dmesg). Also, accept key:value and key=value. There's no reason not to and it makes this more forgiving of mistakes. Reviewed by: rpokala@ Differential Revision: https://reviews.freebsd.org/D28168
2020-12-26scc(4)/uart(4): Remove obsolete support for Siemens SAB 82532Marius Strobl
It's no longer used since 58aa35d42975c298ca0adba705c042596303c9f5 and r357455 respectively.
2018-07-22Add busy detect quirk to list of console optionsMatt Macy
This change allows one to set the busy_detect flag required by the synopsys UART at the loader prompt. This is needed by the EPYC 3000 SoC. This will give users a working console up to the point where getty is required: hw.uart.console="mm:0xfedc9000,rs:2,bd:1" Reviewed by: imp MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D16399 Notes: svn path=/head/; revision=336623
2017-11-27sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni
Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
2016-04-21Remove slightly used const values that can be replaced with nitems().Pedro F. Giffuni
Suggested by: jhb Notes: svn path=/head/; revision=298411
2015-03-07Move the uart_class definitions and fdt compat data into the individualIan Lepore
uart implementations, and export them using the new linker-set mechanism. Differential Revision: https://reviews.freebsd.org/D1993 Submitted by: Michal Meloun Notes: svn path=/head/; revision=279724
2014-10-28Drop __DECONST as well as few fixes of style(9).Marcelo Araujo
Phabric: D1012 Suggested by: mjg, jhb Reviewed by: mjg, jhb Sponsored by: QNAP Systems Inc. Notes: svn path=/head/; revision=273761
2014-10-24Fix a leaked Storage Variable.Marcelo Araujo
Phabric: D981 Submitted by: myself Reported by: Coverity CID: 1248848 Reworked by: kevlo Reviewed by: marcel, davide, ray, kevlo Approved by: marcel, kevlo Notes: svn path=/head/; revision=273576
2014-10-16Follow up to r225617. In order to maximize the re-usability of kernel codeDavide Italiano
in userland rename in-kernel getenv()/setenv() to kern_setenv()/kern_getenv(). This fixes a namespace collision with libc symbols. Submitted by: kmacy Tested by: make universe Notes: svn path=/head/; revision=273174
2013-06-29Teach UART to attach Exynos/s3/s5 class driver.Aleksandr Rybalko
Submitted by: Ruslan Bukin <br@bsdpad.com> Reviewed by: gonzo Notes: svn path=/head/; revision=252394
2013-04-22Build uart_dev_lpc.c on arm only. This fixes pc98 build.Yoshihiro Takahashi
Notes: svn path=/head/; revision=249765
2012-08-15Merging of projects/armv6, part 8Oleksandr Tymoshenko
r235162: Initial LPC32x0 support. Includes DTS file for Embedded Artists EA3250 board. Peripherals currently supported: - Serial ports - Interrupt controller - Timers - Ethernet - USB host - Framebuffer (in conjunction with SSD1289 LCD controller) - RTC - SPI - GPIO Submitted by: Jakub Wojciech Klama <jceel@freebsd.org> Notes: svn path=/head/; revision=239278
2011-12-13Replace __const by const in all non-contributed source code.Ed Schouten
As C1X is close to being released, there is no need to wrap around a feature that is already part of C90. Most of these files already use `const' in different placed as well. Notes: svn path=/head/; revision=228468
2010-11-09Fix typos.Rebecca Cran
PR: bin/148894 Submitted by: olgeni Notes: svn path=/head/; revision=215034
2007-04-02Don't expose the uart_ops structure directly, but instead haveMarcel Moolenaar
it obtained through the uart_class structure. This allows us to declare the uart_class structure as weak and as such allows us to reference it even when it's not compiled-in. It also allows is to get the uart_ops structure by name, which makes it possible to implement the dt tag handling in uart_getenv(). The side-effect of all this is that we're using the uart_class structure more consistently which means that we now also have access to the size of the bus space block needed by the hardware when we map the bus space, eliminating any hardcoding. Notes: svn path=/head/; revision=168281
2005-12-12Make uart_getenv() not be ns8250 dependent. This will allow, in the future,Warner Losh
compilation of kernels without ns8250 support but using the uart framework. These kernels will be for machines where size matters more, so including code that can never be executed is undesriable... Notes: svn path=/head/; revision=153363
2005-01-06Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh
Notes: svn path=/head/; revision=139749
2004-11-14Make sure the baudrate specified with the BR tag is somewhat sane.Marcel Moolenaar
A baudrate we consider insane is silently replaced with 0. When the baudrate is 0, we will not try to program the hardware. Instead we leave the communication speed unaltered, maximizing the chance to have a working console. Obviously this means we allow specifying a 0 baudrate for exactly that purpose. Notes: svn path=/head/; revision=137704
2004-03-20Fix braino in previous commit: getenv() can return NULL.Marcel Moolenaar
Notes: svn path=/head/; revision=127226
2004-03-20Introduce the hw.uart.console and hw.uart.dbgport environment variablesMarcel Moolenaar
to select a serial console and debug port (resp). On ia64 these replace the use of hints completely and take precedence over hints on alpha, amd64 and i386. On sparc64 these variables are not yet recognised. The reasons for introducing these variables are: 1. Hints have side-effects. They reserve the unit number for use by isa or acpi devices and therefore cannot be used to select a pci device. Also, the use of a unit number to select a device prior to bus enumeration is nonsense. The new variables have no side- effects and are not based on unit numbers. 2. Hints don't have the expression power to allow the sysadmin to select UARTs that are not legacy PC devices and need the support of compile-time constants to give the sysadmin some level of flexibility. The hw.uart.console and hw.uart.dbgport variables specify a list of attributes. An attribute is a tag-value pair, seperated by a colon. Attributes are seperated by a comma. Where possible, tags are the same as those in /etc/remote (only br and pa in practice). Details can be found in the manpage (not part of this commit). Not tested on: amd64, pc98 Notes: svn path=/head/; revision=127215