summaryrefslogtreecommitdiff
path: root/sys/dev/uart
Commit message (Collapse)AuthorAgeFilesLines
* MFC change 197721:Marcel Moolenaar2009-10-103-27/+55
| | | | | | | | | | | | | Fix RTS/CTS flow control, broken by the TTY overhaul. The new TTY interface is fairly simple WRT dealing with flow control, but needed 2 new RX buffer functions with "get-char-from-buf" separated from "advance-buf-pointer" so that the pointer could be advanced only when ttydisc_rint() succeeded. Approved by: re (kib) Notes: svn path=/stable/8/; revision=197938
* Fix serial console on Apple Xserve G5 by falling back to input-device-1Nathan Whitehorn2009-07-231-9/+32
| | | | | | | | | | | | | if input-device is unavailable. The Xserve G5 defaults to using screen/keyboard for output-device/input-device even if these are not installed, and then falls back to serial ports at boot time. Reviewed by: marcel Hardware from: grehan Approved by: re (kib) Notes: svn path=/head/; revision=195831
* Move the memory layout definitions and logic from mvreg.h to mvwin.hMarcel Moolenaar2009-06-121-0/+1
| | | | | | | | | | | so that it isn't exposured unless needed. In particular this means that it's easier to tune the memory layout based on board details. While here, remove inclusion of <machine/intr.h> from mvreg.h. This also contains exposure to SoC specifics in MI drivers, because NIRQ depends on the SoC. Notes: svn path=/head/; revision=194072
* Last minute TTY API change: remove mutex argument from tty_alloc().Ed Schouten2009-05-291-1/+1
| | | | | | | | | | | | | I don't want people to override the mutex when allocating a TTY. It has to be there, to keep drivers like syscons happy. So I'm creating a tty_alloc_mutex() which can be used in those cases. tty_alloc_mutex() should eventually be removed. The advantage of this approach, is that we can just remove a function, without breaking the regular API in the future. Notes: svn path=/head/; revision=193018
* Don't use pmap_kextact() when comparing bus handles for Book-E.Marcel Moolenaar2009-04-081-0/+4
| | | | | | | | | | We typically wire translation to devices with TLB1 entries and pmap_kextract() does not know about those and returns 0. This causes false positives (read: all serial ports suddenly become the console). Notes: svn path=/head/; revision=190860
* Fix hangs caused by hardware that signals receive errorsMarcel Moolenaar2009-04-081-6/+9
| | | | | | | | | | | | (framing, parity, etc), but does not indicate characters being received. Since no chracters have been received, ignore the line errors. PR: 131006 MFC after: 3 days Notes: svn path=/head/; revision=190834
* Add support for 64-bit PowerPC CPUs operating in the 64-bit bridge modeNathan Whitehorn2009-04-041-7/+19
| | | | | | | | | | | | | provided, for example, on the PowerPC 970 (G5), as well as on related CPUs like the POWER3 and POWER4. This also adds support for various built-in hardware found on Apple G5 hardware (e.g. the IBM CPC925 northbridge). Reviewed by: grehan Notes: svn path=/head/; revision=190681
* remove now-redunant cardbus attachment.Warner Losh2009-03-091-1/+0
| | | | Notes: svn path=/head/; revision=189575
* Add support for the single-port NetMos NM9835 serial adapter. The puc(4)John Baldwin2009-03-051-0/+1
| | | | | | | | | | | | entry is a specific entry to override the generic NetMos entry so that puc(4) will leave this device alone and let uart(4) claim it. Submitted by: Navdeep Parhar nparhar @ gmail Reviewed by: marcel MFC after: 1 week Notes: svn path=/head/; revision=189407
* Added entries for Lava SP-PCI (1 serial + 1 parallel) PCI card. TheKai Wang2009-02-111-0/+1
| | | | | | | card is a multifunction PCI and report itself as two logical devices. Notes: svn path=/head/; revision=188472
* De-hard code UART speed setting for Marvell SOCs when hw.uart.console is notRafal Jaworowski2009-01-081-1/+2
| | | | | | | specified. Instead, let uart(4) fall back to whatever speed firmware has set. Notes: svn path=/head/; revision=186900
* Minor style(9) compliance change.Alexander Kabaev2008-12-271-1/+2
| | | | Notes: svn path=/head/; revision=186521
* Cast to uintptr_t before casting to void*. This allows theMarcel Moolenaar2008-11-221-3/+3
| | | | | | | | | | QUICC backend to be built on LP64 platforms. This makes it possible to include the QUICC backend in the kernel module. PR: 127120 Notes: svn path=/head/; revision=185187
* Fix detaching of uart(4) devices.Ed Schouten2008-10-231-0/+13
| | | | | | | | | | | | | | | | | With our new TTY layer we use a two step device destruction procedure. The TTY first gets abandoned by the device driver. When the TTY layer notices all threads have left the TTY layer, it deallocates the TTY. This means that the device unit number should not be reused before a callback from the TTY layer to the device driver has been made. newbus doesn't seem to support this concept (yet), so right now just add a destructor with a big comment in it. It's not ideal, but at least it's better than panicing. Reported by: rnoland Notes: svn path=/head/; revision=184208
* Introduce basic support for Marvell families of system-on-chip ARM devices:Rafal Jaworowski2008-10-132-0/+171
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Orion - 88F5181 - 88F5182 - 88F5281 * Kirkwood - 88F6281 * Discovery - MV78100 The above families of SOCs are built around CPU cores compliant with ARMv5TE instruction set architecture definition. They share a number of integrated peripherals. This commit brings support for the following basic elements: * GPIO * Interrupt controller * L1, L2 cache * Timers, watchdog, RTC * TWSI (I2C) * UART Other peripherals drivers will be introduced separately. Reviewed by: imp, marcel, stass (Thanks guys!) Obtained from: Marvell, Semihalf Notes: svn path=/head/; revision=183840
* Use bus_space_compare() rather than i386_memio_compare() directly.Yoshihiro Takahashi2008-09-071-1/+1
| | | | Notes: svn path=/head/; revision=182837
* Add the 2nd CCU and PnP devices support on pc98.Yoshihiro Takahashi2008-08-253-16/+68
| | | | | | | | Reviewed by: imp Obtained from: //depot/projects/uart with some fixes Notes: svn path=/head/; revision=182159
* Integrate the new MPSAFE TTY layer to the FreeBSD operating system.Ed Schouten2008-08-202-95/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The last half year I've been working on a replacement TTY layer for the FreeBSD kernel. The new TTY layer was designed to improve the following: - Improved driver model: The old TTY layer has a driver model that is not abstract enough to make it friendly to use. A good example is the output path, where the device drivers directly access the output buffers. This means that an in-kernel PPP implementation must always convert network buffers into TTY buffers. If a PPP implementation would be built on top of the new TTY layer (still needs a hooks layer, though), it would allow the PPP implementation to directly hand the data to the TTY driver. - Improved hotplugging: With the old TTY layer, it isn't entirely safe to destroy TTY's from the system. This implementation has a two-step destructing design, where the driver first abandons the TTY. After all threads have left the TTY, the TTY layer calls a routine in the driver, which can be used to free resources (unit numbers, etc). The pts(4) driver also implements this feature, which means posix_openpt() will now return PTY's that are created on the fly. - Improved performance: One of the major improvements is the per-TTY mutex, which is expected to improve scalability when compared to the old Giant locking. Another change is the unbuffered copying to userspace, which is both used on TTY device nodes and PTY masters. Upgrading should be quite straightforward. Unlike previous versions, existing kernel configuration files do not need to be changed, except when they reference device drivers that are listed in UPDATING. Obtained from: //depot/projects/mpsafetty/... Approved by: philip (ex-mentor) Discussed: on the lists, at BSDCan, at the DevSummit Sponsored by: Snow B.V., the Netherlands dcons(4) fixed by: kan Notes: svn path=/head/; revision=181905
* The XScale PXA255 has three generally ns16x50 compatible UARTs. One of theBenno Rice2008-05-301-5/+31
| | | | | | | | | | | | | | | | | | variations from normal 16x50 behaviour however is the the use of a normally unused bit of IER to control RX timeout interrupts independently of the generally used RXRDY bit. If this bit is not enabled, we only ever get interrupts when the FIFO is full, never before. This is not very useful when the UART is being used as a console. In order to support this without causing potential problems on more "normal" 16x50 variants, this change introduces two hints for the uart device, ier_mask and ier_rxbits. These can be used to override which bits get set and cleared when we're enabling and disabling RX interrupts. Reviewed by: marcel Notes: svn path=/head/; revision=179420
* Expand kdb_alt_break a little, most commonly used with the optionPeter Wemm2008-05-041-3/+17
| | | | | | | | | | | | | | | | | | | | | | ALT_BREAK_TO_DEBUGGER. In addition to "Enter ~ ctrl-B" (to enter the debugger), there is now "Enter ~ ctrl-P" (force panic) and "Enter ~ ctrl-R" (request clean reboot, ala ctrl-alt-del on syscons). We've used variations of this at work. The force panic sequence is best used with KDB_UNATTENDED for when you just want it to dump and get on with it. The reboot request is a safer way of getting into single user than a power cycle. eg: you've hosed the ability to log in (pam, rtld, etc). It gives init the reboot signal, which causes an orderly reboot. I've taken my best guess at what the !x86 and non-sio code changes should be. This also makes sio release its spinlock before calling KDB/DDB. Notes: svn path=/head/; revision=178766
* add device hints to control the rx FIFO interrupt level on 16550A partsSam Leffler2008-03-122-1/+18
| | | | | | | | | | PR: kern/121421 Submitted by: UEMURA Tetsuya Reviewed by: marcel MFC after: 2 weeks Notes: svn path=/head/; revision=177117
* Support for Freescale QUad Integrated Communications Controller.Rafal Jaworowski2008-03-032-0/+490
| | | | | | | | | | | | | | | | The QUICC engine is found on various Freescale parts including MPC85xx, and provides multiple generic time-division serial channel resources, which are in turn muxed/demuxed by the Serial Communications Controller (SCC). Along with core QUICC/SCC functionality a uart(4)-compliant device driver is provided which allows for serial ports over QUICC/SCC. Approved by: cognet (mentor) Obtained from: Juniper MFp4: e500 Notes: svn path=/head/; revision=176772
* Initial support for Freescale PowerQUICC III MPC85xx system-on-chip family.Rafal Jaworowski2008-03-033-0/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PQ3 is a high performance integrated communications processing system based on the e500 core, which is an embedded RISC processor that implements the 32-bit Book E definition of the PowerPC architecture. For details refer to: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MPC8555E This port was tested and successfully run on the following members of the PQ3 family: MPC8533, MPC8541, MPC8548, MPC8555. The following major integrated peripherals are supported: * On-chip peripherals bus * OpenPIC interrupt controller * UART * Ethernet (TSEC) * Host/PCI bridge * QUICC engine (SCC functionality) This commit brings the main functionality and will be followed by individual drivers that are logically separate from this base. Approved by: cognet (mentor) Obtained from: Juniper, Semihalf MFp4: e500 Notes: svn path=/head/; revision=176771
* Add a new 'why' argument to kdb_enter(), and a set of constants to useRobert Watson2007-12-251-2/+3
| | | | | | | | | | | | for that argument. This will allow DDB to detect the broad category of reason why the debugger has been entered, which it can use for the purposes of deciding which DDB script to run. Assign approximate why values to all current consumers of the kdb_enter() interface. Notes: svn path=/head/; revision=174898
* Redefine bus_space_tag_t on PowerPC from a 32-bit integral toMarcel Moolenaar2007-12-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | a pointer to struct bus_space. The structure contains function pointers that do the actual bus space access. The reason for this change is that previously all bus space accesses were little endian (i.e. had an explicit byte-swap for multi-byte accesses), because all busses on Macs are little endian. The upcoming support for Book E, and in particular the E500 core, requires support for big-endian busses because all embedded peripherals are in the native byte-order. With this change, there's no distinction between I/O port space and memory mapped I/O. PowerPC doesn't have I/O port space. Busses assign tags based on the byte-order only. For that purpose, two global structures exist (bs_be_tag and bs_le_tag), of which the address can be taken to get a valid tag. Obtained from: Juniper, Semihalf Notes: svn path=/head/; revision=174782
* The HP Diva RMP3 uses BAR 0x14.Marcel Moolenaar2007-05-171-1/+1
| | | | Notes: svn path=/head/; revision=169646
* Fix bugs in the Sun -> AT keycode translation table which caused theMarius Strobl2007-05-011-3/+3
| | | | | | | Props key to act as Again and the Paste and Copy keys to be inverted. Notes: svn path=/head/; revision=169173
* Add PCI IDs for the HP RMP3 serial port. This is often used asMarcel Moolenaar2007-04-051-0/+1
| | | | | | | | | the serial console. MFC after: 1 week Notes: svn path=/head/; revision=168391
* Don't use a time-limiting loop that's defined in terms of the baudrateMarcel Moolenaar2007-04-031-13/+7
| | | | | | | | | | | | | | | | | | in the putc() method. Likewise, in the getc() method, don't check for received characters with an interval defined in terms of the baudrate. In both cases it works equally well to implement a fixed delay. More importantly, it avoids calculating a delay that's roughly 1/10th the time it takes to send/receive a character. The calculation is costly and happens for every character sent or received, affecting low-level console or debug port performance significantly. Secondly, when the RCLK is not available or unreliable, the delays could disrupt normal operation. The fixed delay is 1/10th the time it takes to send a character at 230400 bps. Notes: svn path=/head/; revision=168285
* Don't expose the uart_ops structure directly, but instead haveMarcel Moolenaar2007-04-0215-63/+165
| | | | | | | | | | | | | | | 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
* For embedded UARTs compatible with the ns8250 family it is possibleMarcel Moolenaar2007-03-281-1/+3
| | | | | | | | | | | | that the driver clock is identical to the processor or bus clock. This is the case for the PowerQUICC processor. When the clock is high enough, overflows happen in the calculation of the time it takes to send 1/10 of a character, used in delay loops. Fix the overflows so as to fix bugs in the delay loops that can cause either insufficient delays or excessive delays. Notes: svn path=/head/; revision=168000
* When we match UARTs found during bus-enumeration with UARTs used forMarcel Moolenaar2007-03-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | system devices (i.e. console, debug port or keyboard), don't stop after the first match. Find them all and keep track of the last. The reason for this change is that the low-level console is always added to the list of system devices first, with other devices added later. Since new devices are added to the list at the head, we have the console always at the end. When a debug port is using the same UART as the console, we would previously mark the "newbus" UART as a debug port instead of as a console. This would later result in a panic because no "newbus" device was associated with the console. By matching all possible system devices we would mark the "newbus" UART as a console and not as a debug port. While it is arguably better to be able to mark a "newbus" UART as both console and debug port, this fix is lightweight and allows a single UART to be used as the console as well as a debug port with only the aesthetic bug of not telling the user about it also being a debug port. Now that we match all possible system devices, update the rclk of the system devices with the rclk that was obtained through the bus attachment. It is generally true that clock information is more reliable when obtained from the parent bus than by means of some hardcoded or assumed value used early in the boot. This by virtue of having more context information. MFC after: 1 month Notes: svn path=/head/; revision=167999
* o break newbus api: add a new argument of type driver_filter_t toPaolo Pisati2007-02-231-6/+8
| | | | | | | | | | | | | | | | bus_setup_intr() o add an int return code to all fast handlers o retire INTR_FAST/IH_FAST For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current Reviewed by: many Approved by: re@ Notes: svn path=/head/; revision=166901
* - Add a uart_rxready() and corresponding device-specific implementationsMarius Strobl2007-01-185-35/+35
| | | | | | | | | | | | | | | | | | that can be used to check whether receive data is ready, i.e. whether the subsequent call of uart_poll() should return a char, and unlike uart_poll() doesn't actually receive data. - Remove the device-specific implementations of uart_poll() and implement uart_poll() in terms of uart_getc() and the newly added uart_rxready() in order to minimize code duplication. - In sunkbd(4) take advantage of uart_rxready() and use it to implement the polled mode part of sunkbd_check() so we don't need to buffer a potentially read char in the softc. - Fix some mis-indentation in sunkbd_read_char(). Discussed with: marcel Notes: svn path=/head/; revision=166100
* - In sunkbd_probe_keyboard() don't bother to determine the keyboard layoutMarius Strobl2006-11-022-85/+382
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | as we have no use for that info. Instead let this function return the keyboard ID and verify at its invocation in sunkbd_configure() that we're talking to a Sun type 4/5/6 keyboard, i.e. a keyboard supported by this driver. - Add an option SUNKBD_EMULATE_ATKBD whose code is based on the respective code in ukbd(4) and like UKBD_EMULATE_ATSCANCODE causes this driver to emit AT keyboard/KB_101 compatible scan codes in K_RAW mode as assumed by kbdmux(4). Unlike UKBD_EMULATE_ATSCANCODE, SUNKBD_EMULATE_ATKBD also triggers the use of AT keyboard maps and thus allows to use the map files in share/syscons/keymaps with this driver at the cost of an additional translation (in ukbd(4) this just is the way of operation). - Implement an option SUNKBD_DFLT_KEYMAP, which like the equivalent options of the other keyboard drivers allows to specify the default in-kernel keyboard map. For obvious reasons this made to only work when also using SUNKBD_EMULATE_ATKBD. - Implement sunkbd_check(), sunkbd_check_char() and sunkbd_clear_state(), which are also required for interoperability with kbdmux(4). - Implement K_CODE mode and FreeBSD keypad compose. - As a minor hack define KBD_DFLT_KEYMAP also in the !SUNKBD_EMULATE_ATKBD case so we can obtain fkey_tab from <dev/kbd/kbdtables.h> rather than having to duplicate it and #ifdef some more code. - Don't use the TX-buffer for writing the two command bytes for setting the keyboard LEDs as this consequently requires a hardware FIFO that is at least two bytes in depth, which the NMOS-variant of the Zilog SCCs doesn't have. Thus use an inlined version of uart_putc() to consecutively write the command bytes (a cleaner approach would be to do this via the soft interrupt handler but that variant wouldn't work while in ddb(4)). [1] - Fix some minor style(9) bugs. PR: 90316 [1] Reviewed by: marcel [1] Notes: svn path=/head/; revision=163890
* Fix our ioctl(2) implementation when the argument is "int". NewRuslan Ermilov2006-09-271-1/+24
| | | | | | | | | | | | | | | | ioctls passing integer arguments should use the _IOWINT() macro. This fixes a lot of ioctl's not working on sparc64, most notable being keyboard/syscons ioctls. Full ABI compatibility is provided, with the bonus of fixing the handling of old ioctls on sparc64. Reviewed by: bde (with contributions) Tested by: emax, marius MFC after: 1 week Notes: svn path=/head/; revision=162711
* Do not try to call keyboard callback unless keyboard is active and busy.Maksim Yevmenkin2006-09-181-4/+6
| | | | | | | | | | This should fix 'kbdcontrol -K < /dev/console' panic on sparc64 with sunkbd(4). PR: sparc64/96798 MFC after: 1 week Notes: svn path=/head/; revision=162424
* Properly propagate overrun conditions to the TTY layer.Marcel Moolenaar2006-07-271-0/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=160731
* On PowerPC the clock for the BRG comes from RTxC, not PCLK. Add aMarcel Moolenaar2006-07-261-3/+10
| | | | | | | | quick hack to deal with this. We may need to formalize this better and have this information come from the bus attachments. Notes: svn path=/head/; revision=160717
* Implement UART_IOCTL_BAUD for the Z8530. This allows a serial consoleMarcel Moolenaar2006-07-261-1/+7
| | | | | | | | on PowerPC use the current setting of the hardware and not second guess what the OFW does on various machines. Notes: svn path=/head/; revision=160716
* Implement uart_cpu_eqres() and uart_cpu_getdev(). This allowsMarcel Moolenaar2006-07-261-3/+56
| | | | | | | FreeBSD to use a serial console, as per the OFW settings. Notes: svn path=/head/; revision=160715
* Convert to new console apiPoul-Henning Kamp2006-05-261-11/+2
| | | | Notes: svn path=/head/; revision=158960
* Eliminate gdb_checkc member from GDB_DBGPORT(), it is never used.Poul-Henning Kamp2006-05-261-10/+2
| | | | | | | | Use polling behaviour for gdb_getc() where convenient, this edges us closer to the console code. Notes: svn path=/head/; revision=158950
* Remove definitions of uart_[gs]etdreg. They are not used anymore andMarcel Moolenaar2006-05-231-6/+0
| | | | | | | were in fact wrong. Notes: svn path=/head/; revision=158862
* The lcr variable in ns8250_probe is now unused. Remove it.Benno Rice2006-05-231-1/+1
| | | | | | | Missed by: benno Notes: svn path=/head/; revision=158849
* Allow uart(4)'s ns8250 driver to work with devices whose regshift is > 0.Benno Rice2006-05-231-24/+16
| | | | | | | | | | | | | | | | - Rename REG_DL to REG_DLL and REG_DLH. - Always treat DLL and DLH as two separate 8-bit registers instead of one 16-bit register. Additionally, remove the probe for the high 4 bits of IER being 0 and don't assume we can always read/write 0 to/from those bits. These changes allow uart(4) to drive the UARTs on the Intel XScale PXA255. Reviewed by: marcel Notes: svn path=/head/; revision=158844
* o A divisor of 0 is perfectly valid. Reserve -1 for an invalidMarcel Moolenaar2006-05-121-7/+15
| | | | | | | | | | divisor. This allows us to set the line speed to the maximum of 1/4 of the device clock. o Disable the baudrate generator before programming the line settings, including baudrate, and enable it afterwards. Notes: svn path=/head/; revision=158504
* First pass at removing Alpha kernel support.John Baldwin2006-05-111-143/+0
| | | | Notes: svn path=/head/; revision=158458
* Rewrite of puc(4). Significant changes are:Marcel Moolenaar2006-04-281-25/+13
| | | | | | | | | | | | | | | | | | | | | | | o Properly use rman(9) to manage resources. This eliminates the need to puc-specific hacks to rman. It also allows devinfo(8) to be used to find out the specific assignment of resources to serial/parallel ports. o Compress the PCI device "database" by optimizing for the common case and to use a procedural interface to handle the exceptions. The procedural interface also generalizes the need to setup the hardware (program chipsets, program clock frequencies). o Eliminate the need for PUC_FASTINTR. Serdev devices are fast by default and non-serdev devices are handled by the bus. o Use the serdev I/F to collect interrupt status and to handle interrupts across ports in priority order. o Sync the PCI device configuration to include devices found in NetBSD and not yet merged to FreeBSD. o Add support for Quatech 2, 4 and 8 port UARTs. o Add support for a couple dozen Timedia serial cards as found in Linux. Notes: svn path=/head/; revision=158124
* Implement the ipend() method of the serdev I/F.Marcel Moolenaar2006-04-282-0/+10
| | | | Notes: svn path=/head/; revision=158119