aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/uart
Commit message (Collapse)AuthorAgeFilesLines
* MFC: 364430:Warner Losh2020-09-091-0/+1
| | | | | | | | | | | | | r364430 | imp | 2020-08-20 11:19:40 -0600 (Thu, 20 Aug 2020) | 6 lines Tag pccard drivers with gone in 13. MFC After: 3 days Reviewed by: emaste, brooks, adrian (on twitter) Differential Revision: https://reviews.freebsd.org/D26095 Notes: svn path=/stable/12/; revision=365539
* MFC 359900: Export a sysctl count of RX FIFO overrun events.John Baldwin2020-09-082-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. Notes: svn path=/stable/12/; revision=365480
* MFC 359899: Correct baud rate error calculation.John Baldwin2020-09-081-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. Notes: svn path=/stable/12/; revision=365476
* MFC r358431:Justin Hibbits2020-03-021-0/+1
| | | | | | | | | Add Denverton UART PCI ID Sponsored by: Juniper Networks, Inc Notes: svn path=/stable/12/; revision=358551
* MFC r355796-r355797, r355799: kbd: defaults for get_fkeystr/diagKyle Evans2019-12-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The genkbd version of these remains exposed for stable branches, but keyboard drivers that just want to use the defaults can simply not provide their own. There shouldn't be any unset in the wild. r355796: kbd: provide default implementations of get_fkeystr/diag Most keyboard drivers are using the genkbd implementations as it is; formally use them for any that aren't set. r355797: chrome_kb: remove default get_fkeystr/diag implementations This file was missed in r355796, but no harm would have come from this. r355799: kbd: patch linker set methods, too This is needed after r355796. Some double-registration of kbd drivers needs to be sorted out, then this sysinit will simply add these drivers into the normal list and kill off any other bits in the driver that are aware of the linker set, for simplicity. Notes: svn path=/stable/12/; revision=356013
* MFC r355794: keyboard switch definitions: standardize on c99 initializersKyle Evans2019-12-221-19/+19
| | | | Notes: svn path=/stable/12/; revision=356007
* MFC r352369: Relax TX draining in ns8250_bus_transmit().Alexander Motin2019-09-291-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. Notes: svn path=/stable/12/; revision=352861
* MFC r345405,345406,346228,346657,348195,348198: UART SPCR fixes.Colin Percival2019-05-286-87/+189
| | | | | | | | | | | | | | | | r345405: Obey SPCR AccessWidth parameter. r345406: Initialize uart_bus_space_mem on arm64. r346228: Add quirk to ignore AccessWidth on PL011 UART. r346657: Handle SPCR BaudRate = 0. r348195: Extract arm64 SPCR code and make it MI; use on x86 too. r348198: Fix for r348195. This unbreaks the console on EC2 a1.* and *.metal instances. Sponsored by: https://www.patreon.com/cperciva Notes: svn path=/stable/12/; revision=348342
* 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
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2730-0/+60
| | | | | | | | | | | | | | | 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
* uart: detect 256-byte FIFOsEd Maste2017-10-101-1/+4
| | | | | | | | Submitted by: Zakary Nafziger <worldofzak@gmail.com> Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=324503
* Introduce UART driver module for Armada 3700Marcin Wojtas2017-09-091-0/+615
| | | | | | | | | | | | | | This patch adds support for UART in Armada 3700 family. It exposes both low-level UART interface, as well as standard driver methods. Submitted by: Patryk Duda <pdk@semihalf.com> Obtained from: Semihalf Sponsored by: Semihalf Differential Revision: https://reviews.freebsd.org/D12250 Notes: svn path=/head/; revision=323359
* uart: add AX99100 chipset supportEd Maste2017-07-271-0/+2
| | | | | | | | | PR: 215837 Submitted by: joe@thrallingpenguin.com MFC after: 2 weeks Notes: svn path=/head/; revision=321603
* Fix device lookup of for the stdout-path chosen property.Andrew Turner2017-06-021-0/+9
| | | | | | | | | | | | The stdout-path chosen property may include the serial connection details, e.g. the baud rate. When passing the device to OF_finddevice we need to strip off this information as it will cause the lookup to fail. Reviewed by: emaste, manu Differential Revision: https://reviews.freebsd.org/D6846 Notes: svn path=/head/; revision=319494
* uart: add AMT SOL PCI IDEd Maste2017-05-271-0/+1
| | | | | | | | | | | I adjusted the description to be similar to existing AMT entries. PR: 219384 Submitted by: "Tooker" MFC after: 1 week Notes: svn path=/head/; revision=318974
* Fix typo in r317659.Alexander Motin2017-05-031-1/+1
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=317752
* Make some UART consoles to not spin wait for data to be sent.Alexander Motin2017-05-012-11/+15
| | | | | | | | | | | At least with Tx FIFO enabled it shows me ~10% reduction of verbose boot time with serial console at 115200 baud. Reviewed by: marcel MFC after: 2 weeks Notes: svn path=/head/; revision=317659
* Extend the pl011 small-fifos fix to other SoCs that indicate rev 5Ian Lepore2017-03-111-13/+27
| | | | | | | | | | | | | | | | | | | | | hardware but lack the larger fifos rev 5 hardware should have. The linux world (where our FDT data comes from) solved this by adding a new property to pl011 nodes, "arm,primecell-periphid". When this property is present, its values override the values in the hardware periphid registers. For pl011 rev 5 hardware with small fifos, they override the id so that it appears to be rev 4 hardware. The driver now uses the new property when present. It also continues to check the device compat string, to handle older fdt data that may still be in use on existing systems (on RPi systems it is common to update system software without updating fdt data which is part of the boot firmware). Reviewed by: imp Notes: svn path=/head/; revision=315090
* Update the comment for the Wacom WACF00e to make it clear it's not anIan Lepore2017-03-081-2/+2
| | | | | | | | | accidental duplicate of WACF004. PR: 217306 Notes: svn path=/head/; revision=314919
* Add the pnp id for a Wacom 'WACF00e' tablet.Ian Lepore2017-03-082-0/+2
| | | | | | | | PR: 217306 Submitted by: large.hadron.collider@gmx.com Notes: svn path=/head/; revision=314918
* Handle fifo size differences between older and newer revs of pl011 hardware.Ian Lepore2017-03-081-10/+39
| | | | | | | | | | | | | | | | | | Starting with rev 5 (which is inexplicably indicated by a version number of '3' in the Peripheral ID register), the pl011 doubled the size of the rx and tx fifos, to 32 bytes, so read the ID register and set the size variables in the softc accordingly. An interesting wrinkle in this otherwise-simple concept is that the bcm2835 SoC, used in Raspberry Pi systems among others, has the rev 5 pl011 hardware, but somehow also has the older 16-byte fifos. We check the FDT data to see if the hardware is part of a bcm283x system and use the smaller size if so. Thanks to jchandra@ for pointing out that newer hardware has bigger fifos. Notes: svn path=/head/; revision=314917
* Reconfigure the fifo watermark levels on the pl011 uart to interrupt whenIan Lepore2017-03-041-2/+27
| | | | | | | the fifos are 3/4 full (rc) or empty (tx). Notes: svn path=/head/; revision=314682
* Fix bugs exposed by the recent enabling of FIFOs in the pl011 uart. TheseIan Lepore2017-03-041-4/+5
| | | | | | | | | | | | | | | | | | | | | have been in the code all along, but were masked by having a fifo depth of one byte at the hardware level, so everything kinda worked by accident. The hardware interrupts when the TX fifo is half empty, so set sc->sc_txfifosz to 8 bytes (half the hardware fifo size) to match. This eliminates dropped characters on output. Restructure the read loop to consume all the bytes in the fifo by using the "rx fifo empty" bit of the flags register rather than the "rx ready" bit of the interrupt status register. The rx-ready interrupt is cleared when the number of bytes in the fifo fall below the interrupt trigger level, leaving the fifo half full every time receive routine was called. Now it loops until the fifo is completely empty every time (including when the function is called due to a receive timeout as well as for fifo-full). Notes: svn path=/head/; revision=314681
* Allow setting access-width for UART registers.Ruslan Bukin2017-02-2716-25/+89
| | | | | | | | | | | | | | | 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
* Revert r314212 as it break Allwinner boards.Ruslan Bukin2017-02-271-1/+1
| | | | | | | Reported by: manu Notes: svn path=/head/; revision=314360
* Enable pl011 UART FIFOsJayachandran C.2017-02-261-16/+8
| | | | | | | | | | | | The pl011 UART has a 16 entry Tx FIFO and a 16 entry Rx FIFO that have not been used so far. Update the driver to enable the FIFOs and use them in transmit and receive. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D8819 Notes: svn path=/head/; revision=314318
* Use correct macro for Synopsys UART driver declaration.Ruslan Bukin2017-02-241-1/+1
| | | | Notes: svn path=/head/; revision=314212