aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/uart
Commit message (Collapse)AuthorAgeFilesLines
* A final test with unmodified code has shown that a delay of 150msMarcel Moolenaar2013-08-301-1/+1
| | | | | | | | | | | | | | | | | is not giving us a 100% success rate. Bump the delay to 200ms as that seems to do the trick. Note that during testing the delay was added to uart_bus_attach() in uart_core.c. While having the delay in a different place can change the behaviour, it was not expected. Having to bump the delay with another 50ms could therefore be an indication that the problem can not be solved with delays. Reported by: kevlo@ Tested by: kevlo@ Notes: svn path=/head/; revision=255074
* Work-around a timing problem with the ITE IT8513E now that the coreMarcel Moolenaar2013-08-291-1/+13
| | | | | | | | | | | | | | calls ns8250_bus_ipend() almost immediately after ns8250_bus_attach(). As it appears, a line break condition is being signalled for almost all received characters due to this. A delay of 150ms seems enough to allow the H/W to settle and to avoid the problem. More analysis is needed, but for now a regression has been addressed. Reported by: kevlo@ Tested by: kevlo@ Notes: svn path=/head/; revision=255031
* Add support for uarts other than the serial console in TI OMAP SoCs.Ian Lepore2013-08-214-0/+146
| | | | | | | | | | | | The TI uart hardware is ns16550-compatible, except that before it can be used the clocks and power have to be enabled and a non-standard mode control register has to be set to put the device in uart mode (as opposed to irDa or other serial protocols). This adds the extra code in an extension to the standard ns8250 probe routine, and the rest of the driver is just the standard ns8250 code. Notes: svn path=/head/; revision=254598
* Make the uart ns8250 high-level interface public rather than static.Ian Lepore2013-08-212-38/+73
| | | | | | | | | This makes it easier to implement new drivers which are "mostly ns8250" but with some small difference such as needing to enable clocks or poke a non-standard register at probe or attach time. Notes: svn path=/head/; revision=254597
* Use an if/else sequence rather than unrelated if statements, so that aIan Lepore2013-08-211-7/+7
| | | | | | | | | device compatible with multiple drivers matches the more specific driver first and doesn't overwrite it later with the more generic. Move the generic ns16550 to the end of the list. Notes: svn path=/head/; revision=254590
* Check for generic ns16550 after all other types. A device may be compatibleIan Lepore2013-08-211-3/+3
| | | | | | | with 16550 but also have a more specific/capable driver earlier in the list. Notes: svn path=/head/; revision=254589
* Allow UART_POLL_FREQ to be set as a kernel option as well as via tunableIan Lepore2013-08-191-1/+1
| | | | | | | | | (the code was already set up for this, just needs to be in conf/options). Also, if reporting that polling is being used, report the frequency too. Notes: svn path=/head/; revision=254534
* Set the device description after we call uart_probe(). In uart_probe()Marcel Moolenaar2013-07-251-1/+7
| | | | | | | | | | | | we call device-specific probe functions, which can (and typically will) set the device description based on low-level device probe information. In the end we never actually used the device description that we so carefully maintained in the PCI match table. By setting the device description after we call uart_probe(), we'll print the more user- friendly description by default. Notes: svn path=/head/; revision=253654
* Protect against broken hardware. In this particular case, protect againstMarcel Moolenaar2013-07-101-48/+60
| | | | | | | | | | | | | | | | | | | | | | | | | H/W not de-asserting the interrupt at all. On x86, and because of the following conditions, this results in a hard hang with interrupts disabled: 1. The uart(4) driver uses a spin lock to protect against concurrent access to the H/W. Spin locks disable and restore interrupts. 2. Restoring the interrupt on x86 always writes the flags register. Even if we're restoring the interrupt from disabled to disabled. 3. The x86 CPU has a short window in which interrupts are enabled when the flags register is written. 4. The uart(4) driver registers a fast interrupt by default. To catch this case, we first try to clear any pending H/W interrupts and in particular, before setting up the interrupt. This makes sure the interrupt is masked on the PIC. The interrupt handler now has a limit set on the number of iterations it'll go through to clear interrupt conditions. If the limit is hit, the handler will return FILTER_SCHEDULE_THREAD. The attach function will check for this return code and avoid setting up the interrupt and foce polling in that case. Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=253161
* Teach UART to attach Exynos/s3/s5 class driver.Aleksandr Rybalko2013-06-294-0/+6
| | | | | | | | Submitted by: Ruslan Bukin <br@bsdpad.com> Reviewed by: gonzo Notes: svn path=/head/; revision=252394
* Add basic support for FDT to i386 & amd64. This change includes:Marcel Moolenaar2013-05-212-98/+175
| | | | | | | | | | | | | | | | | | | | | | | | | 1. Common headers for fdt.h and ofw_machdep.h under x86/include with indirections under i386/include and amd64/include. 2. New modinfo for loader provided FDT blob. 3. Common x86_init_fdt() called from hammer_time() on amd64 and init386() on i386. 4. Split-off FDT specific low-level console functions from FDT bus methods for the uart(4) driver. The low-level console logic has been moved to uart_cpu_fdt.c and is used for arm, mips & powerpc only. The FDT bus methods are shared across all architectures. 5. Add dev/fdt/fdt_x86.c to hold the fdt_fixup_table[] and the fdt_pic_table[] arrays. Both are empty right now. FDT addresses are I/O ports on x86. Since the core FDT code does not handle different address spaces, adding support for both I/O ports and memory addresses requires some thought and discussion. It may be better to use a compile-time option that controls this. Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=250840
* Fix several typosEitan Adler2013-05-121-2/+2
| | | | | | | | | PR: kern/176054 Submitted by: Christoph Mallon <christoph.mallon@gmx.de> MFC after: 3 days Notes: svn path=/head/; revision=250576
* Add Xilinx Zynq ARM/FPGA SoC support to FreeBSD/arm port.Wojciech A. Koszek2013-04-272-0/+5
| | | | | | | | | Submitted by: Thomas Skibo <ThomasSkibo (at) sbcglobal.net> Tested by: wkoszek (ZedBoard) Reviewed by: wkoszek, freebsd-arm@ (no objections raised) Notes: svn path=/head/; revision=249999
* Add support for Intel C600/X79 Series Chipset KT Controller.Eitan Adler2013-04-231-0/+1
| | | | | | | | PR: kern/177072 Submitted by: Kurt Lidl <lidl@pix.net> Notes: svn path=/head/; revision=249803
* Build uart_dev_lpc.c on arm only. This fixes pc98 build.Yoshihiro Takahashi2013-04-221-0/+2
| | | | Notes: svn path=/head/; revision=249765
* Fix low-level uart drivers that set their fifo sizes in the softc too late.Ian Lepore2013-04-015-15/+15
| | | | | | | | | | | | uart(4) allocates send and receiver buffers in attach() before it calls the low-level driver's attach routine. Many low-level drivers set the fifo sizes in their attach routine, which is too late. Other drivers set them in the probe() routine, so that they're available when uart(4) allocates buffers. This fixes the ones that were setting the values too late by moving the code to probe(). Notes: svn path=/head/; revision=248965
* Accommodate uart devices with large FIFOs (or DMA buffers which amountIan Lepore2013-03-311-1/+7
| | | | | | | | | | | | to the same thing) by allocating the uart(4) rx buffer based on the device's rxfifosz rather than using a hard-coded size of 384 bytes. The historical 384 byte size is 3 times the largest hard-coded fifo size in the tree, so use that ratio as a guide and allocate the buffer as three times rxfifosz, but never smaller than the historical size. Notes: svn path=/head/; revision=248963
* Integrate Efika MX project back to home.Aleksandr Rybalko2013-03-204-0/+663
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=248557
* Add support for A10 uart.Ganbold Tsagaankhuu2013-03-011-5/+38
| | | | | | | | | | | | | | | A10 uart is derived from Synopsys DesignWare uart and requires to read Uart Status Register when IIR_BUSY has detected. Also this change includes FDT check, where it checks device specific properties defined in dts and sets the busy_detect variable. broken_txfifo is also needed to be set in order to make it work for A10 uart case. Reviewed by: marcel@ Approved by: gonzo@ Notes: svn path=/head/; revision=247519
* - Make pci_ns8250_ids[] const.Marius Strobl2013-02-031-6/+6
| | | | | | | | | | - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers. MFC after: 1 week Notes: svn path=/head/; revision=246300
* uart: add resume method and enable it for attachments on the most commonAndriy Gapon2013-02-025-0/+13
| | | | | | | | | | | | | | | | x86 buses Otherwise the uart hardware could be in such a state after the resume where IER is cleared and thus no interrupts are generated. This behavior is observed and tested with QEMU, so I am comitting this change to help with my debugging. There has been no feedback from users of serial ports on real hardware. MFC after: 20 days Notes: svn path=/head/; revision=246243
* Add a loader tunable "hw.broken_txfifo" which enables a workaround for aColin Percival2013-01-271-1/+13
| | | | | | | | | | | | | bug in old versions of QEMU (and Xen, and other places using QEMU code). On those buggy emulated UARTs, the "TX idle" interrupt gets lost; with this workaround, we spinwait for the TX to happen and then send ourselves the interrupt. It's ugly but it works, while minimizing the impact on the code for the !broken_txfifo case. MFC after: 2 weeks Notes: svn path=/head/; revision=246016
* Prevent possible usage of uninitialized pbase variable by checkingOleksandr Tymoshenko2012-12-131-1/+3
| | | | | | | return value of fdt_get_range Notes: svn path=/head/; revision=244171
* Add support for CIR1000 - Cirrus Logic V34 to the uart driverEitan Adler2012-11-131-0/+1
| | | | | | | | Approved by: cperciva (implicit) MFC after: 1 week Notes: svn path=/head/; revision=243000
* Add support for a few more devices:Eitan Adler2012-11-041-0/+4
| | | | | | | | | | | | | PNP0510 and FUJ02E5 for a "Wacom Tablet at FuS Lifebook T" PNP0502 and PNP0511 for some other generic devices. PR: kern/173357 Submitted by: Andrey Zakharchenko <avz@jscc.ru> Approved by: cperciva (implicit) MFC after: 1 week Notes: svn path=/head/; revision=242583
* Separate interrupts enable/disable logic from setting port parameters.Oleksandr Tymoshenko2012-10-301-6/+13
| | | | | | | | Otherwise setting baud rate in TTY mode effectively disables TX/RX interrupts and renders port unusable. Notes: svn path=/head/; revision=242333
* Add PrimeCell UART (PL011) driverOleksandr Tymoshenko2012-08-303-0/+441
| | | | | | | Obtained from: Semihalf Notes: svn path=/head/; revision=239919
* Merging of projects/armv6, part 8Oleksandr Tymoshenko2012-08-154-5/+903
| | | | | | | | | | | | | | | | | | | | | | | 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
* Merging of projects/armv6, part 4Oleksandr Tymoshenko2012-08-151-2/+4
| | | | | | | | | | | | | | | | | | | | r233822: Remove useless and wrong piece of code in fdt_get_range() which i overwrites passed phandle_t node. Modify debug printf in fdt_reg_to_rl() to be consistent (that is, print start and end *virtual* addresses). r230560: Handle "ranges;" Make fdt_reg_to_rl() responsible for mapping the device memory, instead on just hoping that there's only one simplebus, and using fdt_immr_va as the base VA. r230315 Add a function to get the PA from range, instead of (ab)using fdt_immr_pa, and use it for the UART driver Notes: svn path=/head/; revision=239274
* Complete polled-mode operation by using a callout if the device will bePeter Grehan2012-04-123-1/+16
| | | | | | | | | | | | | | | used in polled-mode. The callout invokes uart_intr, which rearms the timeout. Implemented for bhyve, but generically useful for e.g. embedded bringup when the interrupt controller hasn't been setup, or if it's not deemed worthy to wire an interrupt line from a serial port. Submitted by: neel Reviewed by: marcel Obtained from: NetApp MFC after: 3 weeks Notes: svn path=/head/; revision=234194
* uart_cpu_amd64.c and uart_cpu_i386.c (under sys/dev/uart) areMarcel Moolenaar2012-04-112-107/+0
| | | | | | | | | | | identical now that the bus spaces are unified under sys/x86. Replace them with a single uart_cpu_x86.c. o delete uart_cpu_i386.c o move uart_cpu_amd64.c to uart_cpu_x86.c o update files.amd64 and files.i386 accordingly. Notes: svn path=/head/; revision=234118
* Add PCI Id for the AMT SOL UART on G4x series Intel chipsets.Konstantin Belousov2012-03-141-0/+1
| | | | | | | | Submitted by: admin zahost ru MFC after: 3 days Notes: svn path=/head/; revision=232967
* Add support for the MosChip MCS9904 four serial portsRemko Lodder2012-03-071-0/+2
| | | | | | | | | | | controller. PR: 165804 Submitted by: Eugene Grosbein MFC after: 1 week Notes: svn path=/head/; revision=232639
* Add support for Sony Ericsson GC89 EDGE/Wirelles LAN PC CardEitan Adler2012-01-191-0/+1
| | | | | | | | | | | PR: kern/131933 Submitted by: Alex Keda <admin@lissyara.su> Approved by: jhb Approved by: cperciva (mentor, blanket for pre-mentorship already-approved commits) MFC after: 1 week Notes: svn path=/head/; revision=230327
* Add PCI Id for the AMT SOL UART on 5 series Intel chipsets.Konstantin Belousov2012-01-111-0/+2
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=229971
* Add support for Intel EG20T serial portsKevin Lo2012-01-031-0/+4
| | | | Notes: svn path=/head/; revision=229379
* Use strchr() and strrchr().Ed Schouten2012-01-021-1/+1
| | | | | | | | | | | It seems strchr() and strrchr() are used more often than index() and rindex(). Therefore, simply migrate all kernel code to use it. For the XFS code, remove an empty line to make the code identical to the code in the Linux kernel. Notes: svn path=/head/; revision=229272
* Actually set the baudrate from the FDT.Marcel Moolenaar2011-12-301-1/+1
| | | | Notes: svn path=/head/; revision=228983
* Add PCI Id for the Intel AMT serial interface as found on my DQ67OW.Konstantin Belousov2011-12-291-0/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=228947
* kern cons: introduce infrastructure for console grabbing by kernelAndriy Gapon2011-12-171-0/+12
| | | | | | | | | | | | | | | At the moment grab and ungrab methods of all console drivers are no-ops. Current intended meaning of the calls is that the kernel takes control of console input. In the future the semantics may be extended to mean that the calling thread takes full ownership of the console (e.g. console output from other threads could be suspended). Inspired by: bde MFC after: 2 months Notes: svn path=/head/; revision=228631
* Replace __const by const in all non-contributed source code.Ed Schouten2011-12-131-6/+6
| | | | | | | | | 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
* Fix OF_finddevice error return value in case of FDT.Jayachandran C.2011-12-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | According to the open firmware standard, finddevice call has to return a phandle with value of -1 in case of error. This commit is to: - Fix the FDT implementation of this interface (ofw_fdt_finddevice) to return (phandle_t)-1 in case of error, instead of 0 as it does now. - Fix up the callers of OF_finddevice() to compare the return value with -1 instead of 0 to check for errors. - Since phandle_t is unsigned, the return value of OF_finddevice should be checked with '== -1' rather than '<= 0' or '> 0', fix up these cases as well. Reported by: nwhitehorn Reviewed by: raj Approved by: raj, nwhitehorn Notes: svn path=/head/; revision=228201
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.Ed Schouten2011-11-071-1/+1
| | | | | | | This means that their use is restricted to a single C file. Notes: svn path=/head/; revision=227293
* Disable the TX ready interrupts once we received one, some UART won't clearOlivier Houchard2011-11-021-2/+5
| | | | | | | | | the IIR_TXRDY bit upon reading. Reviewed by: marcel Notes: svn path=/head/; revision=227032
* Follow up to r225203 refining break-to-debugger run-time configurationRobert Watson2011-08-271-4/+0
| | | | | | | | | | | | | | | improvements: (1) Implement new model in previously missed at91 UART driver (2) Move BREAK_TO_DEBUGGER and ALT_BREAK_TO_DEBUGGER from opt_comconsole.h to opt_kdb.h (spotted by np) (3) Garbage collect now-unused opt_comconsole.h MFC after: 3 weeks Approved by: re (bz) Notes: svn path=/head/; revision=225214
* Attempt to make break-to-debugger and alternative break-to-debugger moreRobert Watson2011-08-261-21/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | accessible: (1) Always compile in support for breaking into the debugger if options KDB is present in the kernel. (2) Disable both by default, but allow them to be enabled via tunables and sysctls debug.kdb.break_to_debugger and debug.kdb.alt_break_to_debugger. (3) options BREAK_TO_DEBUGGER and options ALT_BREAK_TO_DEBUGGER continue to behave as before -- only now instead of compiling in break-to-debugger support, they change the default values of the above sysctls to enable those features by default. Current kernel configurations should, therefore, continue to behave as expected. (4) Migrate alternative break-to-debugger state machine logic out of individual device drivers into centralised KDB code. This has a number of upsides, but also one downside: it's now tricky to release sio spin locks when entering the debugger, so we don't. However, similar logic does not exist in other device drivers, including uart. (5) dcons requires some special handling; unlike other console types, it allows overriding KDB's own debugger selection, so we need a new interface to KDB to allow that to work. GENERIC kernels in -CURRENT will now support break-to-debugger as long as appropriate boot/run-time options are set, which should improve the debuggability of BETA kernels significantly. MFC after: 3 weeks Reviewed by: kib, nwhitehorn Approved by: re (bz) Notes: svn path=/head/; revision=225203
* Restore binary compatibility for GIO_KEYMAP and PIO_KEYMAP.Ed Schouten2011-07-171-0/+1
| | | | | | | | | | | | Back in 2009 I changed the ABI of the GIO_KEYMAP and PIO_KEYMAP ioctls to support wide characters. I created a patch to add ABI compatibility for the old calls, but I didn't get any feedback to that. It seems now people are upgrading from 8 to 9 they experience this issue, so add it anyway. Notes: svn path=/head/; revision=224126
* Add device ID for the Davicom 56PDV PCI Modem.John Baldwin2011-07-081-0/+1
| | | | | | | | | PR: kern/75132 Submitted by: Mike Tancsa @ Sentex (older patch against puc(4)) MFC after: 1 week Notes: svn path=/head/; revision=223874
* Add support for a MosChip PCI express serial port adapter.Hans Petter Selasky2011-06-291-0/+2
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=223672
* Ignore MCR[6] during the probe to fix a false negative. Bit 6 of theMarcel Moolenaar2011-05-261-1/+7
| | | | | | | | | | | | | MCR register on the Sunix Sun1699 chip tends to be set but doesn't seem to have a function. That is, FreeBSD just works (provided the correct RCLK is used) regardless. PR: kern/129663 Diagnostics: Eygene Ryabinkin <rea-fbsd at codelabs.ru> MFC after: 3 days Notes: svn path=/head/; revision=222317