aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/uart
Commit message (Collapse)AuthorAgeFilesLines
* uart: clean up empty lines in .c and .h filesMateusz Guzik2020-09-0110-23/+14
| | | | Notes: svn path=/head/; revision=365142
* Tag pccard drivers with gone in 13.Warner Losh2020-08-201-0/+1
| | | | | | | | | MFC After: 3 days Reviewed by: emaste, brooks, adrian (on twitter) Differential Revision: https://reviews.freebsd.org/D26095 Notes: svn path=/head/; revision=364430
* Move Ti AM335x to dev/extres/clk framework.Michal Meloun2020-07-301-13/+4
| | | | | | | | | | | | | | | | | Re-implement clocks for these SoC by using now standard extres/clk framework. This is necessary for future expansion of these. The new implementation is (due to the size of the patch) only the initial (minimum) version. It will be updated/expanded with a subsequent set of particular patches. This patch is also not tested on OMAP4 based boards (BeagleBone), so all possible issues should be (and will be) fixed by ASAP once identified. Submited by: Oskar Holmlund (oskar.holmlund@ohdata.se) Differential Revision: https://reviews.freebsd.org/D25118 Notes: svn path=/head/; revision=363700
* Add i.MX 8M Quad supportOleksandr Tymoshenko2020-07-011-4/+57
| | | | | | | | | | | | | | | | | - Add CCM driver and clocks implementations for i.MX 8M - Add GPC driver for iMX8 - Add clock tree for i.MX 8M Quad - Add clocks support and new compat strings (where required) for existing i.MX 6 UART, I2C, and GPIO drivers - Enable aarch64-compatible drivers form i.MX 6 in arm64 GENERIC kernel config - Add dtb/imx8 kernel module with DTBs for Nitrogen8M and iMX8MQ EVK With this patch both Nitrogen8M and iMX8MQ EVK boot with NFS root up to multiuser login prompt Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D25274 Notes: svn path=/head/; revision=362817
* Fix AccessWidth and BitWidth parsing in SPCR tableMarcin Wojtas2020-06-241-4/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ACPI Specification defines a Generic Address Structure (GAS), which is used to describe UART controller register layout in the SPCR table. The driver responsible for parsing it (uart_cpu_acpi) wrongly associates the Access Size field to the uart_bas's regshft and the register BitWidth to the regiowidth - according to the definitions it should be opposite. This problem remained hidden most likely because the majority of platforms use 32-bit registers (BitWidth) which are accessed with the according size (Dword). However on Marvell Armada 8k / Cn913x platforms, the 32-bit registers should be accessed with Byte granulity, which unveiled the issue. This patch fixes above by proper values assignment and slightly improved parsing. Note that handling of the AccessWidth set to EFI_ACPI_6_0_UNDEFINED is needed to work around a buggy SPCR table on EC2 x86 "bare metal" instances. Reviewed by: manu, imp, cperciva, greg_unrelenting.technology Obtained from: Semihalf MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25373 Notes: svn path=/head/; revision=362574
* Export a sysctl count of RX FIFO overrun events.John Baldwin2020-04-132-0/+8
| | | | | | | | | | | | | | | | | | uart(4) backends currently detect RX FIFO overrun errors and report them to the uart(4) core layer. They are then reported to the generic TTY layer which promptly ignores them. As a result, there is currently no good way to determine if a uart is experiencing RX FIFO overruns. One could add a generic per-tty counter, but there did not appear to be a good way to export those. Instead, add a sysctl under the uart(4) sysctl tree to export the count of overruns. Reviewed by: brooks MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24368 Notes: svn path=/head/; revision=359900
* Correct baud rate error calculation.John Baldwin2020-04-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Shifting right by 1 is not the same as dividing by 2 for signed values. In particular, dividing a signed value by 2 gives the integer ceiling of the (e.g. -5 / 2 == -2) whereas shifting right by 1 always gives the floor (-5 >> 1 == -3). An embedded board with a 25 Mhz base clock results in an error of -30.5% when used with a baud rate of 115200. Using division, this truncates to -30% and is permitted. Using the shift, this fails and is rejected causing TIOCSETA requests to fail with EINVAL and breaking getty(8). Using division gives the same error range for both over and under baud rates and also makes the code match the behavior documented in the existing comment about supporting boards with 25 Mhz clocks. Reported by: imp MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24367 Notes: svn path=/head/; revision=359899
* Add Denverton UART PCI IDJustin Hibbits2020-02-281-0/+1
| | | | | | | | MFC after: 3 days Sponsored by: Juniper Networks, Inc Notes: svn path=/head/; revision=358431
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-2/+2
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* Remove sparc64 kernel supportWarner Losh2020-02-035-1498/+0
| | | | | | | | | Remove all sparc64 specific files Remove all sparc64 ifdefs Removee indireeect sparc64 ifdefs Notes: svn path=/head/; revision=357455
* kbd: provide default implementations of get_fkeystr/diagKyle Evans2019-12-161-1/+0
| | | | | | | | | Most keyboard drivers are using the genkbd implementations as it is; formally use them for any that aren't set and make genkbd_get_fkeystr/genkbd_diag private. Notes: svn path=/head/; revision=355796
* keyboard switch definitions: standardize on c99 initializersKyle Evans2019-12-161-19/+19
| | | | | | | | | A future change will provide default implementations for some of these where it makes sense and most of them are already using the genkbd implementation (e.g. get_fkeystr, diag). Notes: svn path=/head/; revision=355794
* Use callout_func_t instead of the deprecated timeout_t.John Baldwin2019-12-101-2/+2
| | | | | | | | Reviewed by: kib, imp Differential Revision: https://reviews.freebsd.org/D22752 Notes: svn path=/head/; revision=355601
* Regularize my copyright noticeWarner Losh2019-12-045-10/+8
| | | | | | | | | | | | o Remove All Rights Reserved from my notices o imp@FreeBSD.org everywhere o regularize punctiation, eliminate date ranges o Make sure that it's clear that I don't claim All Rights reserved by listing All Rights Reserved on same line as other copyright holders (but not me). Other such holders are also listed last where it's clear. Notes: svn path=/head/; revision=355394
* Remove "all rights reserved" from copyright for the file that Jared McNeillEmmanuel Vadot2019-12-031-1/+0
| | | | | | | own. He gave me permission to do this. Notes: svn path=/head/; revision=355358
* Relax TX draining in ns8250_bus_transmit().Alexander Motin2019-09-151-7/+2
| | | | | | | | | | | | | | Since TX interrupt is generated when THRE is set, wait for TEMT set means wait for full character transmission time. At low speeds that may take awhile, burning CPU time while holding sc_hwmtx lock, also congested. This is partial revert of r317659. PR: 240121 MFC after: 2 weeks Notes: svn path=/head/; revision=352369
* Add ACPI entries for Synopsys Designware UARTs used on ARM platformsRebecca Cran2019-06-281-0/+3
| | | | | | | | | | | | This fixes (userspace) console on the Marvell MACCHIATObin in ACPI mode with latest TianoCore EDK2 firmware. Submitted by: Greg V <greg@unrelenting.technology> Reviewed by: mw, bcran Differential Revision: https://reviews.freebsd.org/D20765 Notes: svn path=/head/; revision=349494
* Some devices take undesired actions when RTS and DTR areStephen Hurd2019-06-121-3/+6
| | | | | | | | | | | | | | | asserted. Some development boards for example will reset on DTR, and some radio interfaces will transmit on RTS. This patch allows "stty -f /dev/ttyu9.init -rtsdtr" to prevent RTS and DTR from being asserted on open(), allowing these devices to be used without problems. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D20031 Notes: svn path=/head/; revision=348999
* uart_cpu_acpi: Fix GCC build break from r348195Conrad Meyer2019-05-231-3/+0
| | | | | | | | | | extern declarations are redundant with those in uart_cpu.h, which this file includes. X-MFC-with: r348195 Notes: svn path=/head/; revision=348198
* Use ACPI SPCR on x86Colin Percival2019-05-234-95/+185
| | | | | | | | | | | | | | | | | | This takes the SPCR code currently in uart_cpu_arm64.c, moves it into a new uart_cpu_acpi.c (with some associated refactoring), and uses it from both arm64 and x86. An SPCR serial port address AccessWidth field value of 0 ("reserved") is now treated as 1 ("byte access") in order to work around a buggy SPCR table on Amazon EC2 i3.metal instances. Reviewed by: manu, Greg V MFC after: 3 days Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D20357 Notes: svn path=/head/; revision=348195
* ACPI SPCR: handle BaudRate=0Rebecca Cran2019-04-251-0/+7
| | | | | | | | | | | | | | | | | | | From https://github.com/tianocore/edk2-platforms/commit/7d8dc6544c93a5f5a03c83316489ba8700946e9f "The mcbin (and likely others) have a nonstandard uart clock. This means that the earlycon programming will incorrectly set the baud rate if it is specified. The way around this is to tell the kernel to continue using the preprogrammed baud rate. This is done by setting the baud to 0." Our drivers (uart_dev_ns8250) do respect zero, but SPCR would error. Let's not error. Submitted by: Greg V <greg@unrelenting.technology> Reviewed by: mw, imp, bcran Differential Revision: https://reviews.freebsd.org/D19914 Notes: svn path=/head/; revision=346657
* Add quirk for ignoring SPCR AccessWidth values on the PL011 UARTEd Maste2019-04-153-3/+10
| | | | | | | | | | | | | | | | | | The SPCR table on the Lenovo HR330A Ampere eMAG server indicates 8-bit access, but 32-bit access is required for the PL011 to work. PL011 on SBSA platforms always supports 32-bit access (and that was hardcoded here before my EC2 fix), let's use 32-bit access for PL011 and 32BIT interface types. Tested by emaste on Ampere eMAG and Cavium/Marvell ThunderX2. Submitted by: Greg V <greg@unrelenting.technology> Reviewed by: andrew, imp (earlier) Differential Revision: https://reviews.freebsd.org/D19507 Notes: svn path=/head/; revision=346228
* Initialize uart_bus_space_mem.Colin Percival2019-03-221-1/+2
| | | | | | | | | | | | | | | | This value was being used uninitialized, resulting in predictable issues on systems with memory-mapped UART registers. A case could be made that memmap_bus should be declared in a header rather than being declared in each .c file which needs to refer to it, but that's a broader style question. This commit unbreaks hw.uart.console="mm:..." on ARM64. Submitted by: Greg V Notes: svn path=/head/; revision=345406
* Obey SPCR AccessWidth parameter.Colin Percival2019-03-221-1/+1
| | | | | | | | | | | | The "access width" value was hard-coded as 2, indicating 32-bit accesses; instead, use the value specified in the SPCR table. This unbreaks the console on EC2 "A1" family instances. Submitted by: Greg V Notes: svn path=/head/; revision=345405
* Recognize the Amazon PCI serial device found in a1.* EC2 instancesColin Percival2019-03-211-0/+1
| | | | | | | | | | | | | | as an NS8250 UART. This is the same as the UART found in EC2 "bare metal" instances, except that the card vendor shows up as 0x0000 rather than 0x1d0f. This seems like a bug in the EC2 firmware; but we might as well support it anyway. Reported by: Greg V Notes: svn path=/head/; revision=345369
* Remove All Rights ReservedWarner Losh2019-02-053-3/+3
| | | | | | | | Remove the all rights reserved clause from my copyright, and make other minor tweaks needed where that might have created ambiguity. Notes: svn path=/head/; revision=343811
* Add support for the UART device found in lowRISC system-on-a-chip.Ruslan Bukin2018-10-122-0/+459
| | | | | | | | | | | | The only source of documentation for this device is verilog, so driver is minimalistic. Reviewed by: Dr Jonathan Kimmitt <jrrk2@cam.ac.uk> Approved by: re (kib) Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=339330
* Update Armada 38x UART device tree bindingMarcin Wojtas2018-10-101-0/+1
| | | | | | | | | | | | | | 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
* Reapply, with minor tweaks, r338025, from the original commit:Warner Losh2018-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove unused and easy to misuse PNP macro parameter Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Approved by: re (glen) Notes: svn path=/head/; revision=338948
* Recognize the Amazon PCI serial device found in i3.metal EC2 instancesColin Percival2018-09-241-0/+1
| | | | | | | | | | | | as an NS8250 UART. Reviewed by: sbruno, imp Approved by: re (delphij) Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D17250 Notes: svn path=/head/; revision=338921
* add snps IP uart support / genaralize UARTMatt Macy2018-08-1915-71/+69
| | | | | | | | | | | | | | | | 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
* Back out r338035 until Warner is finished churning GSoC PNP patchesConrad Meyer2018-08-191-1/+1
| | | | | | | | | | I was not aware Warner was making or planning to make forward progress in this area and have since been informed of that. It's easy to apply/reapply when churn dies down. Notes: svn path=/head/; revision=338037
* Remove unused and easy to misuse PNP macro parameterConrad Meyer2018-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Notes: svn path=/head/; revision=338035
* Now that we set the busy_detect bit in the bas to support setting itWarner Losh2018-07-231-1/+1
| | | | | | | | | for the console, set our override in the bas as well. Tested by: emaste@ Notes: svn path=/head/; revision=336648
* Add busy detect quirk to list of console optionsMatt Macy2018-07-223-0/+11
| | | | | | | | | | | | | | | | 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
* Add a driver for the BCM2835 Mini-UART as seen on the RPi3Diane Bruce2018-06-121-0/+521
| | | | | | | | | Reviewed by: andrew Approved by: andrew Differential Revision: https://reviews.freebsd.org/D15684 Notes: svn path=/head/; revision=334997
* add support for console resuming, implement it for uart, use on x86Andriy Gapon2018-05-291-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | This change adds a new optional console method cn_resume and a kernel console interface cnresume. Consoles that may need to re-initialize their hardware after suspend (e.g., because firmware does not care to do it) will implement cn_resume. Note that it is called in rather early environment not unlike early boot, so the same restrictions apply. Platform specific code, for platforms that support hardware suspend, should call cnresume early after resume, before any console output is expected. This change fixes a problem with a system of mine failing to resume when a serial console is used. I found that the serial port was in a strange configuration and an attempt to write to it likely resulted in an infinite loop. To avoid adding cn_resume method to every console driver, CONSOLE_DRIVER macro has been extended to support optional methods. Reviewed by: imp, mav MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D15552 Notes: svn path=/head/; revision=334340
* uart_snps: Add early printf supportEmmanuel Vadot2018-05-011-0/+38
| | | | | | | | | 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
* Move most of the contents of opt_compat.h to opt_global.h.Brooks Davis2018-04-061-1/+0
| | | | | | | | | | | | | | | | | | | | | opt_compat.h is mentioned in nearly 180 files. In-progress network driver compabibility improvements may add over 100 more so this is closer to "just about everywhere" than "only some files" per the guidance in sys/conf/options. Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of sys/compat/linux/*.c. A fake _COMPAT_LINUX option ensure opt_compat.h is created on all architectures. Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the set of compiled files. Reviewed by: kib, cem, jhb, jtl Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14941 Notes: svn path=/head/; revision=332122
* The Arm pl011 driver assumes it's running a devicetree based system.Andrew Turner2018-02-281-9/+31
| | | | | | | | | | | | | | It calls OF_* functions to check if it needs to implement workarounds. This may not be the case on arm64 where we support both FDT and ACPI. Fix this by checking if we are booting on FDT before calling these checks. Reviewed by: ian Sponsored by: DARPA, AFRL Sponsored by: Cavium (Hardware) Differential Revision: https://reviews.freebsd.org/D14515 Notes: svn path=/head/; revision=330111
* Check all entries in the ACPI uart compat table and not just the first.Andrew Turner2018-02-261-5/+12
| | | | | | | Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=330016
* Teach the Arm pl011 driver to attach to a SBSA uart. This is defined inAndrew Turner2018-02-251-0/+1
| | | | | | | | | | | the Server Base System Architecture to be a subset of the pl011 r1p5. As we don't use the removed features it is safe to just attach to the existing driver as is. Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=329991
* Rename the FDT compat_data array to a bus-specific name.Andrew Turner2018-02-251-2/+2
| | | | | | | Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=329990
* Disable EARLY_PRINTF from the Armada 3700 uart, it breaks when we wantAndrew Turner2018-02-011-0/+2
| | | | | | | | | to use EARLY_PRINTF on other SoCs. Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=328662
* arm: lpc: Remove supportEmmanuel Vadot2018-01-241-939/+0
| | | | | | | | | | | Code hasn't been touch this it's original commit in 2012 beside api changes. Reviewed by: ian Differential Revision: https://reviews.freebsd.org/D13625 Discussed with: freebsd-arm@freebsd.org (no reply) Notes: svn path=/head/; revision=328380
* UART Clock Selection Register holds a divider value for a supplied clock,Ruslan Bukin2018-01-181-16/+0
| | | | | | | | | not a final baud rate. The value for this register has to be calculated. Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=328133
* Support for UART device found in Qualcomm Snapdragon 410E SoC.Ruslan Bukin2018-01-182-8/+16
| | | | | | | | | | | Tested on DragonBoard 410c. Reviewed by: andrew Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D13972 Notes: svn path=/head/; revision=328132
* Do pass removing some write-only variables from the kernel.Alexander Kabaev2017-12-253-7/+1
| | | | | | | | | | | | 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
* Create a new ISA_PNP_INFO macro. Use this macro every where we haveWarner Losh2017-12-231-0/+1
| | | | | | | | | | ISA PNP card support (replace by hand version in if_ed). Move module declarations to the end of some files. Fix PCCARD_PNP_INFO to use nitems(). Remove some stale comments about pc98, turns out the comment was simply wrong. Notes: svn path=/head/; revision=327102
* Set the io width when using an ACPI uart. Previously it would only ever beAndrew Turner2017-12-081-2/+5
| | | | | | | | | set when finding the uart from the device tree. Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=326683