summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart
Commit message (Collapse)AuthorAgeFilesLines
* - Re-write OF_decode_addr() with a bus-neutral approach, adding supportmarius2005-02-121-1/+1
| | | | | | | | | | | | for nodes hanging off of Central (untested), FireHose (untested) and PCI (tested) busses. - Add an additional parameter to OF_decode_addr() which specifies the index of the register bank to decode. These should allow to eventually add support for the Z8530 hanging off of FireHose to uart(4) and to write support for PCI-based graphics adapters. Suggested by: tmm (back in '03)
* Add the keyboard system device before we probe for the keyboard.marcel2005-01-311-2/+13
| | | | | | | | | | | The presence or absence of a keyboard does not change whether an UART is designed as a keyboard port or not and thus whether we can use the port as a TTY or not. We now call sunkbd_attach() even when we didn't previously find a keyboard. Emit a useful message stating that no keyboard was found, but don't do anything else. MFC after: 5 days
* Fix a logic bug that caused DSR to never be deasserted.marcel2005-01-301-2/+2
| | | | MFC after: 5 days
* o Fix the various interrupt related problems caused by reversemarcel2005-01-301-31/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | engineering the pending interrupt sources from the current state of the controller. For channel A we can always read the interrupt pending register (RR3). For channel B we can read the interrupt vector register (RR2) because it contains the modified vector and thus includes the interrupt source. Since we currently need puc(4) for the Z8530, we know that the interrupt handler for both channels will be called and thus that RR3 will always be read at least once, even if ch A has no pending interrupt. NOTE: The modified interrupt vector has no value that represent a lack of pending interrupt for channel B. That is, the value read when no interrupts are pending is the same as the value for the special receive condition. Fortunately, we don't actually have to depend on that interrupt source. This does mean that we need to properly handle the overflow condition, when we read received character from the chip. o The DSR signal is represented by the SYNC bit in the external status register (RR0). We now properly track DSR. o It's save to enable the external/status interrupt source. We now get interrupts when line signals (DSR, DCD or CTS) change. Problems fixes: o interrupt storms. o blocked open(2). o lack of (hardware) flow control. o unable to report DSR. MFC after: 5 days
* Start each of the license/copyright comments with /*-, minor shuffle of linesimp2005-01-0622-21/+22
|
* Don't obtain the HCDP address directly from the bootinfo structure.marcel2004-12-081-3/+5
| | | | Use a function to keep the details at arms length from uart(4).
* - Don't blindly use the return value of uart_cpu_channel() to calculatemarius2004-11-281-7/+33
| | | | | | | | | | | | | | | | | | | | the address of a channel on a SCC, it returns 0 on failure. [1] - Hardcode channel 1 for the keyboard on Z8530, the information present in the Open Firmware device tree doesn't allow to determine this via uart_cpu_channel(). This makes the keyboard (if one backs out rev. 1.5 of sys/dev/puc/puc_sbus.c and has both keyboard and mouse plugged in to avoid the hang that revision works around) and consequently syscons(4) on Ultra 2 work. There's a problem with the keyboard LEDs similar to the one on Ultra 60 (LEDs don't get lit under X) though, instead of lighting just a specific single one all get lit and can't be turned off again. [1] - Add comments about what uart_cpu_channel() and uart_cpu_getdev_keyboard() do and their constraints. - Improve the comments about what uart_cpu_getdev_[console,dbgport]() do, they don't return an address (as in bus) but an Open Firmware package handle. Reviewed by: marcel (modulo the comments) [1]
* uart_i8251_ops is gone.nyan2004-11-211-8/+2
|
* o Support for the i8251 wasn't there. Remove the files.marcel2004-11-215-1637/+0
| | | | | o Remove the headers with IC register definitions. The headers are now taken from sys/dev/ic
* Include the header with the register definitions from sys/dev/ic. Theymarcel2004-11-212-2/+4
| | | | are shared now.
* Include the common <dev/ic/ns16550.h> instead of the privatemarcel2004-11-201-1/+2
| | | | <dev/uart_dev_ns8250.h>. The latter can be removed now.
* Remove the whole uart_cpu_identify() stuff again. Now that it's no longermarius2004-11-178-39/+0
| | | | | | | used on sparc64 they are only stubs on all architectures and it doesn't look like if we would need it in the near future again. Ok'ed by: marcel
* o sparc64/isa/isa.c:marius2004-11-171-40/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The claim in the commit log of rev. 1.11 of dev/uart/uart_cpu_sparc64.c etc. that UARTs are the only relevant ISA devices on sparc64 turned out to be false. While there are sparc64 models where UARTs are the only devices on the ISA bus there are in fact also low-cost models where all devices traditionally found on the EBus are hooked up to the ISA bus. There are also models that use a mix between EBus and ISA devices with things like an AT keyboard controller and other rather interesting devices that we might want to support in the futute hook up to the ISA bus. In order to not need to add sparc64 specific device_identify methods to all of the respective ISA drivers and also not add OFW specific code to the common ISA code make the sparc64 ISA bus code fake up PnP devices so most ISA drivers probe their devices without further changes. Unfortunately Sun doesn't adhere to the ISA bindings defined in IEEE 1275-1994 for the properties of most of the ISA devices which would allow to obtain the vendor and logical IDs from their properties. So we we just use a simple table which maps the name properties to PnP IDs. This could be done in a more sophisticated way but I courrently don't see the need for this. [1] - Add the children with fully mapped and specified resources (in the OFW sense) similar to what is done in the EBus code for the IRQ resources of the children as adjusting the resources and the resource list entries respectively in isa_alloc_resource() as done perviously causes trouble with drivers which use rman_get_start(), pass-through or allocate and release resources multiple times, etc. Adjusting the resources might be better off in a bus_activate_resource method but the common ISA code currently doesn't allow for an isa_activate_resource(). [2] With this change: - ppbus(4) and lpt(4) attach and work (modulo ECP mode, which requires real ISADMA code but it currently only consists of stubs on sparc64). - atkbdc(4) and atkbdc(4) attach, no further testing done. - fdc(4) itself attaches but causes a hang while attaching fd0 also when is DMA disabled, further work in fdc(4) is required here as e.g. fd0 uses the address of fd1 on sparc64 (not sure if sparc64 supports more than one floppy drive at all). All of these drivers previously caused panics in the sparc64 ISA code. - Minor changes, e.g. use __FBSDID, remove a dupe word in a comment and declare one global variable which isn't used outside of isa.c static. o dev/uart/uart_cpu_sparc64.c and modules/uart/Makefile: - Remove the code for registering the UARTs on the ISA bus from the sparc64 uart_cpu_identify() again and rely on probing them via PnP. Original idea by: tmm [1] No objections by: tmm [1], [2]
* Be slightly more paranoid about using the divisor in a division andmarcel2004-11-151-2/+6
| | | | the calculated baudrate. Neither should be 0.
* Implement UART_IOCTL_BAUD. Consequently, when the baudrate was unsetmarcel2004-11-141-1/+11
| | | | for the console, we emit the actual baudrate during bus enumeration.
* Add UART_IOCTL_BAUD to allow us to query the hardware about themarcel2004-11-142-0/+6
| | | | | | | | | current baudrate setting. Use this ioctl() when we don't know the baudrate of the sysdev (as represented by a 0 value). When the ioctl() fails, e.g. when the backend hasn't implemented it or the hardware doesn't provide the means to determine its current baudrate setting, we invalidate the baudrate setting by setting it to -1. None of the backends currently implement the new ioctl().
* Make sure the baudrate specified with the BR tag is somewhat sane.marcel2004-11-141-0/+20
| | | | | | | | 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.
* Remove asserts which are not correct if the port is a tty.phk2004-10-121-7/+1
|
* Use generic tty code instead of (comparatively little) local copies.phk2004-10-122-171/+52
|
* Use tty->t_sc to find out softc.phk2004-09-181-8/+6
|
* Use ttyalloc() instead of ttymalloc(NULL)phk2004-09-171-1/+1
|
* Don't call uart_bus_probe() for non-matching PnP-devices. Trying to probemarius2004-08-251-4/+3
| | | | | | | the keyboard controller with uart_bus_probe() caused a hang here on an i386 machine. Approved by: marcel
* Fix a style(9) bug (variable definitions inside a nested scope) a patchmarius2004-08-151-4/+2
| | | | | | | of mine introduced in revision 1.10. Approved by: marcel Prodded by: marcel
* - Introduce an uart_cpu_identify() which is implemented in uart_cpu_<arch>.cmarius2004-08-148-0/+79
| | | | | | | | | | | | | | | | | and that can be used as an identify function for all kinds of busses on a certain platform. Expect for sparc64 these are only stubs right now. [1] - For sparc64, add code to its uart_cpu_identify() for registering the on- board ISA UARTs and their resources based on information obtained from Open Firmware. It would be better if this would be done in the OFW ISA code. However, due to the common FreeBSD ISA code and PNP-IDs not always being present in the properties of the ISA nodes there seems to be no good way to implement that. Therefore special casing UARTs as the sole really relevant ISA devices on sparc64 seemed reasonable. [2] Approved by: marcel Discussed with: marcel [1], tmm [2] Tested by: make universe
* - Introduce an ofw_bus kobj-interface for retrieving the OFW node and amarius2004-08-121-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | subset ("compatible", "device_type", "model" and "name") of the standard properties in drivers for devices on Open Firmware supported busses. The standard properties "reg", "interrupts" und "address" are not covered by this interface because they are only of interest in the respective bridge code. There's a remaining standard property "status" which is unclear how to support properly but which also isn't used in FreeBSD at present. This ofw_bus kobj-interface allows to replace the various (ebus_get_node(), ofw_pci_get_node(), etc.) and partially inconsistent (central_get_type() vs. sbus_get_device_type(), etc.) existing IVAR ones with a common one. This in turn allows to simplify and remove code-duplication in drivers for devices that can hang off of more than one OFW supported bus. - Convert the sparc64 Central, EBus, FHC, PCI and SBus bus drivers and the drivers for their children to use the ofw_bus kobj-interface. The IVAR- interfaces of the Central, EBus and FHC are entirely replaced by this. The PCI bus driver used its own kobj-interface and now also uses the ofw_bus one. The IVARs special to the SBus, e.g. for retrieving the burst size, remain. Beware: this causes an ABI-breakage for modules of drivers which used the IVAR-interfaces, i.e. esp(4), hme(4), isp(4) and uart(4), which need to be recompiled. The style-inconsistencies introduced in some of the bus drivers will be fixed by tmm@ in a generic clean-up of the respective drivers later (he requested to add the changes in the "new" style). - Convert the powerpc MacIO bus driver and the drivers for its children to use the ofw_bus kobj-interface. This invloves removing the IVARs related to the "reg" property which were unused and a leftover from the NetBSD origini of the code. There's no ABI-breakage caused by this because none of these driver are currently built as modules. There are other powerpc bus drivers which can be converted to the ofw_bus kobj-interface, e.g. the PCI bus driver, which should be done together with converting powerpc to use the OFW PCI code from sparc64. - Make the SBus and FHC front-end of zs(4) and the sparc64 eeprom(4) take advantage of the ofw_bus kobj-interface and simplify them a bit. Reviewed by: grehan, tmm Approved by: re (scottl) Discussed with: tmm Tested with: Sun AX1105, AXe, Ultra 2, Ultra 60; PPC cross-build on i386
* Do not use hardware flow control for the moment. There are some issuesmarcel2004-08-061-0/+8
| | | | | | | with it that need to be understood better before they can be resolved. This takes time and time is already in short supply. Reported & tested by: glebius@
* When sizing the FIFO, don't count all the way up to 1030 if any FIFOmarcel2004-07-261-1/+1
| | | | | size larger than 128 is considered an incompatible size. Stop counting when we reach 130 in the loop.
* Preparation commit for the tty cleanups that will follow in the nearphk2004-07-151-2/+2
| | | | | | | | | future: rename ttyopen() -> tty_open() and ttyclose() -> tty_close(). We need the ttyopen() and ttyclose() for the new generic cdevsw functions for tty devices in order to have consistent naming.
* Update for the KDB framework:marcel2004-07-101-8/+6
| | | | | | o Call kdb_enter() instead of breakpoint(). o Call kdb_alt_break() instead of db_alt_break(). o Make debugging code conditional upon KDB instead of DDB.
* Add support for uart(4) being a debug port for the GDB backend.marcel2004-07-101-0/+101
|
* Define the tty methods as typedefs.phk2004-06-301-2/+1
| | | | | | Change the return type for t_break to void. Add t_ioctl (more about this later).
* Use generic support for BREAK and modem control ioctls.phk2004-06-251-65/+27
|
* Use the new serial port definitions for modemsignals.phk2004-06-246-105/+92
|
* save a few redundant lines by moving the retry loop further backwards.phk2004-06-231-7/+1
|
* Do the dreaded s/dev_t/struct cdev */phk2004-06-162-4/+4
| | | | Bump __FreeBSD_version accordingly.
* Machine generated patch which changes linedisc calls from accessingphk2004-06-041-8/+8
| | | | | | linesw[] directly to using the ttyld...() functions The ttyld...() functions ar inline so there is no performance hit.
* Make the remaining serial drivers call ttyioctl() rather than callingphk2004-06-041-5/+2
| | | | the linedisc directly.
* Add missing <sys/module.h> includes currently relying on nested includephk2004-06-031-0/+1
| | | | in <sys/kernel.h>
* Fix disordering of pccarddevs.h noticed by bde. Also remove a fewimp2004-05-271-2/+2
| | | | | | redundant includes and fix some of the include disordering. Submitted by: bde
* It seems that clearing the MCR_IE bit in the modem control registertmm2004-05-261-22/+23
| | | | | | | | | | | | | | | | | does not reliably prevent the triggering of interrupts for all supported configurations. Thus, the FIFO size probe could cause an interrupt, which could lead to an interrupt storm in the shared interrupt case. To prevent this, change ns8250_bus_probe() to use the overflow bit in the line status register instead of the RX ready bit in the interrupt identification register to detect whether the FIFO has filled up. This allows us to clear all bits in the interrupt enable register during the probe, which should prevent interrupts reliably. Additionally, the detected FIFO size may be a bit more accurate, because the overflow bit is only set when the FIFO did actually fill up, while interrupts would trigger a bit early. Reviewed and tested on a lot of hardware by: marcel
* Move to generating pccarddevs.h on the fly, both for the kernel andimp2004-05-261-1/+1
| | | | | | | the modules. Also generate usbdevs.h automatically now, but a non-kernel file is stopping that at the moment.
* - Initialize uart_bus_space_io and uart_bus_space_mem.nyan2004-05-161-7/+7
| | | | - Fix wrong comment.
* Fix hangs caused by z8530_bus_ipend() returning UART_IPEND_TXIDLEmarcel2004-05-041-1/+7
| | | | | | | | | | | | | | | | | | not as a pending interrupt status, but as a matter of status quo. Consequently, when there's no data to be transmitted the condition is not cleared and uart_intr() is stuck in an infinite loop trying to clear the UART_IPEND_TXIDLE status. The z8530_bus_ipend() function is changed to return idle only once after having sent any data. The root cause for this problem is that we cannot use the interrupt status bits of the SCC itself. The register that holds the interrupt status can only be accessed by channel A and holds the status for both channels. Using the interrupt status register would complicate the driver because we need to synchronize access to the SCC between the channels. Elementary testing: marius
* When the interrupt cannot be INTR_FAST, it still is INTR_MPSAFE.marcel2004-05-041-2/+2
| | | | Mark it as such.
* Don't mask TCD in IMR0 when we initialize the channel. Doing so makesmarcel2004-04-251-1/+1
| | | | | it impossible to check the interrupt status bit when we try to get a character in the low level console code.
* To quote submitter:marcel2004-04-041-8/+24
| | | | | | | | | | | | | | | "... uart_cpu_sparc64.c currently only looks at /options if ttyX is the selected console. However, there's one case where it should additionally look at /chosen. If "keyboard" is the selected input- device and "screen" the output-device (both via /options) but the keyboard is unplugged, OF automatically switches to ttya for the console. It even prints a line telling so on "screen". Solaris respects this behaviour and uses ttya as the console in this case and people probably expect FreeBSD to do the same (it's also very handy to temporarily switch consoles)..." Submitted by: Marius Strobl <marius@alchemy.franken.de> Has no doubt the change is correct: marcel
* In uart_ebus_probe(), match "su_pnp" besides "su" for ns8250 familymarcel2004-04-031-2/+4
| | | | | | | | of UARTs. We already did this in uart_cpu_getdev(). While here, also check the compat name for "su" or "su16550". Both changes submitted by: Marius Strobl <marius@alchemy.franken.de> Does not doubt the correctness of the second change: marcel
* In ns8250_putc() insert a barrier between writing the character andmarcel2004-04-021-0/+1
| | | | checking for transmitter empty.
* Allow the selection of a debug port with hw.uart.dbgport. Unlikemarcel2004-04-021-46/+84
| | | | | other architectures (like ia64), the variable has to be set to an OpenFirmware device name.
* Call kbd_attach() only when KBD_INSTALL_CDEV is enabled as the functionmarcel2004-04-021-0/+2
| | | | is only defined in that case.
OpenPOWER on IntegriCloud