Commit Graph

348 Commits

Author SHA1 Message Date
Ruslan Bukin
eff43c7467 Rename Exynos UART driver. No functional change.
Submitted by:	Michal Meloun <meloun@miracle.cz>
2015-01-13 15:04:28 +00:00
Peter Grehan
7e47312c46 Add PCI ID for the Oxford Semiconductor OXPCIe952 device.
Seen on the StarTech "1 Port Native ExpressCard RS232 Serial AdapterCard
 with 16950 UART"

Reported and tested by:	Michael Dexter
MFC after:	1 week
2015-01-12 03:39:56 +00:00
Marius Strobl
393677427c Don't use a sub-device/-vendor wildcard for probing MCS9922 as other
chips with the same device and vendor IDs actually may provide different
functionality. While at it, canonicalize the description to match other
MosChip UARTs.

PR:		186891
MFC after:	3 days
2014-12-28 21:36:20 +00:00
Alexander Motin
e67f3bec39 Add bunch of PCI IDs of Intel Wildcat Point (9 Series) chipsets.
MFC after:	1 week
2014-11-26 04:23:21 +00:00
Zbigniew Bodek
bf39c5e8d5 Make uart_bus_fdt a decendant of ofwbus
This will allow to attach UART drivers lying directly on the root node
instead of simple-bus compatible bus only.

Obtained from:   Semihalf
Sponsored by:    The FreeBSD Foundation
2014-11-12 21:41:15 +00:00
Zbigniew Bodek
17d2ee0132 Make PL011 UART to wait on putc only when TX FIFO is full
Instead of waiting for empty TX FIFO it is more reasonable to
block on full FIFO. As soon as FIFO slot is free the character
can be transmitted.
In case of TX FIFO disabled, TXFF bit indicates that transmit
register is not empty.

Obtained from:   Semihalf
Reviewed by:     andrew, emaste
Sponsored by:    The FreeBSD Foundation
2014-11-12 21:38:31 +00:00
Marcelo Araujo
3bde81092c Drop __DECONST as well as few fixes of style(9).
Phabric:	D1012
Suggested by:	mjg, jhb
Reviewed by:	mjg, jhb
Sponsored by:	QNAP Systems Inc.
2014-10-28 03:42:09 +00:00
Marcelo Araujo
f695e0468c Fix a leaked Storage Variable.
Phabric:	D981
Submitted by:	myself
Reported by:	Coverity
CID:		1248848
Reworked by:	kevlo
Reviewed by:	marcel, davide, ray, kevlo
Approved by:	marcel, kevlo
2014-10-24 05:39:32 +00:00
Davide Italiano
2be111bf7d Follow up to r225617. In order to maximize the re-usability of kernel code
in userland rename in-kernel getenv()/setenv() to kern_setenv()/kern_getenv().
This fixes a namespace collision with libc symbols.

Submitted by:   kmacy
Tested by:      make universe
2014-10-16 18:04:43 +00:00
Ian Lepore
0dc54d18b2 Use the FIFOs in the imx5/imx6 uart hardware instead of interrupting on
each byte sent or received.
2014-10-12 17:56:02 +00:00
Ganbold Tsagaankhuu
7f29c69aee Use documented compat string for msm uart.
Whilst here use tab instead of spaces.

Approved by:    stas (mentor)
2014-10-06 09:00:53 +00:00
Ganbold Tsagaankhuu
dc7717a863 Add uart driver for Qualcomm MSM 7000/8000 series chips.
It is working on IFC6410 board which has Qualcomm Snapdragon SoC.

Approved by:    stas (mentor)
2014-10-02 08:12:42 +00:00
Ian Lepore
c3f0f2847f Return the actual baud rate programmed in the hardware rather than 115200.
This allows the "3wire" entry in /etc/ttys (with no speed specified) to work.
2014-09-30 23:01:11 +00:00
Marcel Moolenaar
359ee827e1 Do not fail the low-level device probe simply because the kernel
doesn't have support for the Z8530. Embedded PowerPC platforms
typically don't. Fail when the device class we actually need is
not present.

Obtained from:	Juniper Networks, Inc.
2014-07-26 17:49:40 +00:00
Marcel Moolenaar
e7d939bda2 Remove ia64.
This includes:
o   All directories named *ia64*
o   All files named *ia64*
o   All ia64-specific code guarded by __ia64__
o   All ia64-specific makefile logic
o   Mention of ia64 in comments and documentation

This excludes:
o   Everything under contrib/
o   Everything under crypto/
o   sys/xen/interface
o   sys/sys/elf_common.h

Discussed at: BSDcan
2014-07-07 00:27:09 +00:00
Hans Petter Selasky
af3b2549c4 Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
Glen Barber
37a107a407 Revert r267961, r267973:
These changes prevent sysctl(8) from returning proper output,
such as:

 1) no output from sysctl(8)
 2) erroneously returning ENOMEM with tools like truss(1)
    or uname(1)
 truss: can not get etype: Cannot allocate memory
2014-06-27 22:05:21 +00:00
Hans Petter Selasky
3da1cf1e88 Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after:	2 weeks
Sponsored by:	Mellanox Technologies
2014-06-27 16:33:43 +00:00
John-Mark Gurney
aae6c4d071 add support for MosChip MCS9922... This is found on an ExpressCard..
tested to work w/ cu talking to itself (the two ports connected via
null modem cable)...
2014-06-22 06:54:36 +00:00
Olivier Houchard
8bc9a079ef In uart_bus_grab(), use the ier_mask instead of a custom hack for XScale.
Suggested by:	jmg
2014-05-29 21:00:06 +00:00
Olivier Houchard
caf6d6b491 In the grab function, keep the bit 6 on in the IER, on XScale, using 0
turns the UART off, which is unfortunate if one want to use it as a console.
2014-05-29 19:57:51 +00:00
Sean Bruno
aa475e141c Add PCI ID for AMT based serial interface found on the Lenovo T61.
uart2: <Intel AMT - PM965/GM965 KT Controller> port 0x1830-0x1837
	mem 0xfe024000-0xfe024fff irq 17 at device 3.3 on pci0
uart2: console (115200,n,8,1)

Tested as tty and serial console.  Seems "fine"
2014-05-27 13:35:31 +00:00
Ian Lepore
49d0a4c3ff Reword a comment block a bit; no functional changes. 2014-04-26 20:27:58 +00:00
Ian Lepore
2d40ec16a8 Flesh out imx_uart_init() so that we're not relying on u-boot to init
the hardware (meaning uarts other than the console will work).
2014-04-26 20:03:04 +00:00
Ian Lepore
a90f19753f The freescale imx uart driver works for the whole i.MX family, so rename the
header file to not have "5xx" in the name.
2014-04-26 17:56:39 +00:00
Marius Strobl
50c0e894a0 Distinguish between the different variants and configurations of Sunix
{MIO,SER}5xxxx chips instead of treating all of them as PUC_PORT_2S.
Among others, this fixes the hang seen when trying to probe the none-
existent second UART on an actually 1-port chip.

Obtained from:	NetBSD (BAR layouts)
MFC after:	3 days
Sponsored by:	Bally Wulff Games & Entertainment GmbH
2014-04-08 07:32:32 +00:00
Rui Paulo
3329109cb9 Use a more professional device description. 2014-04-07 05:18:27 +00:00
Marcel Moolenaar
4c710b6756 Do not prevent processes from making changes to the baudrate or the
CLOCAL and HUPCL control flags. There are legit reasons for allowing
those to be changed. When /etc/ttys has the "3wire" type (without a
baudrate) for the serial port that is the low-level console, then
this change has no effect.

Obtained from:	Juniper Networks, Inc.
2014-04-05 22:25:10 +00:00
Marcel Moolenaar
f725b213a7 Pass the actual baudrate to tty_init_console(). This defines the initial
baudrate of the device special file, and makes sure that on open(2) the
UART is programmed with the correct baudrate. This then eliminates the
need in uart_tty_param() to override the speed setting.
2014-03-11 03:20:10 +00:00
Warner Losh
5dceed8aeb Back out r262921. I don't know what I was thinking, but it is lame. 2014-03-08 19:59:52 +00:00
Warner Losh
803253c874 Set the baud rate if it isn't 0 (meaning it has been specified) not
only if it is 0 (meaning that it hasn't been specified and is likely
to turn off the UART's transmitter).
2014-03-08 03:39:15 +00:00
Warner Losh
d1c4878039 Make clock optional on uart nodes. It is a FreeBSD-specific extention,
and won't be present in vendor supplied dts files.
2014-03-08 03:39:09 +00:00
Ian Lepore
add35ed5b8 Follow r261352 by updating all drivers which are children of simplebus
to check the status property in their probe routines.

Simplebus used to only instantiate its children whose status="okay"
but that was improper behavior, fixed in r261352.  Now that it doesn't
check anymore and probes all its children; the children all have to
do the check because really only the children know how to properly
interpret their status property strings.

Right now all existing drivers only understand "okay" versus something-
that's-not-okay, so they all use the new ofw_bus_status_okay() helper.
2014-02-02 19:17:28 +00:00
Warner Losh
65e79cf474 clock-frequency is a FreeBSD-specific extention. Make it optional and
allow the client uart drivers to decide if a frequency is required.
2014-01-24 00:14:14 +00:00
Warner Losh
df10106a87 Add Atmel serial drivers. 2014-01-23 18:09:10 +00:00
Warner Losh
138277120c Don't lock in the generic grab just to lock again in the specific grabs.
(I committed the wrong version of uart_core.c, which still had this).

Pointy hat: imp
2014-01-20 17:45:36 +00:00
Warner Losh
d76a1ef4e1 Introduce grab and ungrab upcalls. When the kernel desires to grab the
console, it calls the grab functions. These functions should turn off
the RX interrupts, and any others that interfere. This makes mountroot
prompt work again. If there's more generalized need other than
prompting, many of these routines should be expanded to do those new
things.

Should have been part of r260889, but waasn't due to command line typo.

Reviewed by:	bde (with reservations)
2014-01-19 19:39:13 +00:00
Nathan Whitehorn
dcd08302e5 Retire machine/fdt.h as a header used by MI code, as its function is now
obsolete. This involves the following pieces:
- Remove it entirely on PowerPC, where it is not used by MD code either
- Remove all references to machine/fdt.h in non-architecture-specific code
  (aside from uart_cpu_fdt.c, shared by ARM and MIPS, and so is somewhat
  non-arch-specific).
- Fix code relying on header pollution from machine/fdt.h includes
- Legacy fdtbus.c (still used on x86 FDT systems) now passes resource
  requests to its parent (nexus). This allows x86 FDT devices to allocate
  both memory and IO requests and removes the last notionally MI use of
  fdtbus_bs_tag.
- On those architectures that retain a machine/fdt.h, unused bits like
  FDT_MAP_IRQ and FDT_INTR_MAX have been removed.
2014-01-05 18:46:58 +00:00
Ian Lepore
51dbd04609 Convert from using fdt_immr style to arm_devmap_add_entry() to make
static device mappings.

This SoC relied heavily on the fact that all devices were static-mapped
at a fixed address, and it (rather bogusly) used bus_space read and write
calls passing hard-coded virtual addresses instead of proper bus handles,
relying on the fact that the virtual addresses of the mappings were known
at compile time, and relying on the implementation details of arm
bus_space never changing.  All such usage was replaced with calls to
bus_space_map() to obtain a proper bus handle for the read/write calls.

This required adjusting some of the #define values that map out hardware
registers, and some of them were renamed in the process to make it clear
which were defining absolute physical addresses and which were defining
offsets.  (The ones that just define offsets don't appear to be referenced
and probably serve no value other than perhaps documentation.)
2014-01-05 18:40:06 +00:00
Marcel Moolenaar
b1a64a96d0 Add another HP iLO serial (console) port, found on Itanium servers.
Derived from information provided by: felip.nadal@hob.de
2013-12-24 19:58:27 +00:00
Warner Losh
f83ed22cb6 Plumb the cn_grab and cn_ungrab routines down into the uart
clients. Mask RX interrupts while grabbed on the atmel serial
driver. This UART interrupts every character. When interrupts are
enabled at the mountroot> prompt, this means the ISR eats the
characters. Rather than try to create a cooperative buffering system
for the low level kernel console, instead just mask out the ISR. For
NS8250 and decsendents this isn't needed, since interrupts only happen
after 14 or more characters (depending on the fifo settings). Plumb
such that these are optional so there's no change in behavior for all
the other UART clients. ddb worked on this platform because all
interrupts were disabled while it was running, so this problem wasn't
noticed. The mountroot> issue has been around for a very very long
time.

MFC after:	3 days
2013-12-21 16:23:31 +00:00
Nathan Whitehorn
02ef3f33de Real OF systems have an ihandle under /chosen/stdout, not a phandle. Use
the right type.
2013-12-01 19:05:32 +00:00
Nathan Whitehorn
49aba28afe Make uart_cpu_powerpc work on both FDT and OFW systems. This is the last
remaining modification required to build kernels that work with both on
PowerPC.
2013-12-01 16:02:22 +00:00
Ruslan Bukin
5c263f43ef Add support for Freescale Vybrid Family VF600 heterogeneous
ARM Cortex-A5/M4 SoC (M4 core is not used in this work).

Support includes device drivers for:
- NAND Flash Controller (NFC)
- USB Enhanced Host Controller Interface (EHCI)
- General-Purpose Input/Output (GPIO)
- Universal Asynchronous Receiver/Transmitter (UART)

Also supported:
- Generic Interrupt Controller (GIC)
- MPCore timer
- ffec ethernet driver

Reviewed by:	ray
Approved by:	cognet (mentor)
2013-11-12 18:02:56 +00:00
Sean Bruno
f478527d75 Add new AMT serial port PCI ID on Intel Lynx Point chipset
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2013-11-07 19:38:19 +00:00
Ian Lepore
6495818590 Arrange for uart_cpu_fdt's probe() routine to use the same table of compat
strings as uart_bus_fdt's probe().

The bus code uses ofw_bus_search_compatible() and that's not an option in
cpu (console) code -- it runs way before the ofw routines are usable.  So
the console probe has its own loop to search the table, but now at least
there's only one table to be maintained when new devices are added.
2013-11-02 20:14:39 +00:00
Ian Lepore
8ef18b3b15 Convert the if/else list of compatible devices to the table-driven
ofw_bus_search_compatible() routine.  In addition to converting existing
strings to table entries, also add compat strings for the whole imx family.
2013-10-31 23:57:33 +00:00
Nathan Whitehorn
94f33b0ab6 Try even harder to find a console before giving up. 2013-10-26 20:06:50 +00:00
Nathan Whitehorn
dce533f390 Be a bit more flexible in how we find the console from the properties on
/chosen, following the list of allowed console properties in ePAPR. Also
do not require that stdin be defined and equal to stdout: stdin is
nonstandard (for ePAPR) and console in an unexpected place is after all
better than no console.
2013-10-26 18:25:55 +00:00
Zbigniew Bodek
49e368ac48 Wait for DesignWare UART transfers completion before accessing line control
When using DW UART with BUSY detection it is necessary to wait
until all serial transfers are finished before manipulating the
line control. LCR will not be affected when UART is busy.
In addition, if Divisor Latch Access Bit is being set in order to
modify UART divisors:
1. We will get BUSY interrupt if interrupts are enabled.
2. Because LCR will not be affected the THR and (even worse) IER
   contents will be corrupted. This will lead to console hang.

Approved by:	cognet (mentor)
2013-10-26 17:24:59 +00:00
Nathan Whitehorn
e889db8841 machine/pmap.h is included by vm/pmap.h, so is redundant here. Thanks to
Alan Cox for pointing this out.
2013-10-26 13:18:39 +00:00
Nathan Whitehorn
c20809e143 Fix build after r257111 by including headers with definition of pmap_kextract(). 2013-10-26 03:22:57 +00:00
Aleksandr Rybalko
4162dff98a Test UARTs physical address instead of virtual. 2013-10-25 11:44:39 +00:00
Aleksandr Rybalko
3a1f3e0d0c Fix crossed fingers output. Only comment changed. 2013-10-24 09:27:06 +00:00
Ian Lepore
6dd028d8f8 Calculate the baud rate divisor rather than using a hard-coded value.
Submitted by:	Steven Lawrance <stl@koffein.net>
2013-10-20 23:40:16 +00:00
Marcel Moolenaar
40a827b6f0 A final test with unmodified code has shown that a delay of 150ms
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@
2013-08-30 15:26:45 +00:00
Marcel Moolenaar
4fc4997535 Work-around a timing problem with the ITE IT8513E now that the core
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@
2013-08-29 16:26:04 +00:00
Ian Lepore
aef60d8c4a Add support for uarts other than the serial console in TI OMAP SoCs.
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.
2013-08-21 14:33:02 +00:00
Ian Lepore
167cb33f85 Make the uart ns8250 high-level interface public rather than static.
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.
2013-08-21 14:26:15 +00:00
Ian Lepore
6fd28cd9ff Use an if/else sequence rather than unrelated if statements, so that a
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.
2013-08-21 04:08:58 +00:00
Ian Lepore
d081029a4f Check for generic ns16550 after all other types. A device may be compatible
with 16550 but also have a more specific/capable driver earlier in the list.
2013-08-21 04:05:06 +00:00
Ian Lepore
1662b00871 Allow UART_POLL_FREQ to be set as a kernel option as well as via tunable
(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.
2013-08-19 15:51:30 +00:00
Marcel Moolenaar
a177309ff9 Set the device description after we call uart_probe(). In uart_probe()
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.
2013-07-25 16:57:27 +00:00
Marcel Moolenaar
eead2d551c Protect against broken hardware. In this particular case, protect against
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.
2013-07-10 17:42:20 +00:00
Aleksandr Rybalko
5d490515c3 Teach UART to attach Exynos/s3/s5 class driver.
Submitted by:	Ruslan Bukin <br@bsdpad.com>
Reviewed by:	gonzo
2013-06-29 23:48:08 +00:00
Marcel Moolenaar
cb34ed4434 Add basic support for FDT to i386 & amd64. This change includes:
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.
2013-05-21 03:05:49 +00:00
Eitan Adler
a164074fc4 Fix several typos
PR:		kern/176054
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
MFC after:	3 days
2013-05-12 16:43:26 +00:00
Wojciech A. Koszek
735c7fe55e Add Xilinx Zynq ARM/FPGA SoC support to FreeBSD/arm port.
Submitted by:	Thomas Skibo <ThomasSkibo (at) sbcglobal.net>
Tested by:	wkoszek (ZedBoard)
Reviewed by:	wkoszek, freebsd-arm@ (no objections raised)
2013-04-27 23:07:49 +00:00
Eitan Adler
af44d850f2 Add support for Intel C600/X79 Series Chipset KT Controller.
PR:		kern/177072
Submitted by:	Kurt Lidl <lidl@pix.net>
2013-04-23 13:03:08 +00:00
Yoshihiro Takahashi
3280345272 Build uart_dev_lpc.c on arm only. This fixes pc98 build. 2013-04-22 13:02:41 +00:00
Ian Lepore
4d7abca057 Fix low-level uart drivers that set their fifo sizes in the softc too late.
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().
2013-04-01 00:44:20 +00:00
Ian Lepore
3ad36a413d Accommodate uart devices with large FIFOs (or DMA buffers which amount
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.
2013-03-31 23:24:04 +00:00
Aleksandr Rybalko
a2c472e741 Integrate Efika MX project back to home.
Sponsored by:	The FreeBSD Foundation
2013-03-20 15:39:27 +00:00
Ganbold Tsagaankhuu
ac4adddf04 Add support for A10 uart.
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@
2013-03-01 01:42:31 +00:00
Marius Strobl
dec2801609 - Make pci_ns8250_ids[] const.
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.

MFC after:	1 week
2013-02-03 21:30:29 +00:00
Andriy Gapon
5b23b1b9e7 uart: add resume method and enable it for attachments on the most common
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
2013-02-02 11:38:26 +00:00
Colin Percival
1c60b24baa Add a loader tunable "hw.broken_txfifo" which enables a workaround for a
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
2013-01-27 23:33:42 +00:00
Oleksandr Tymoshenko
be9914fc31 Prevent possible usage of uninitialized pbase variable by checking
return value of fdt_get_range
2012-12-13 03:35:47 +00:00
Eitan Adler
9445dd3b87 Add support for CIR1000 - Cirrus Logic V34 to the uart driver
Approved by:	cperciva (implicit)
MFC after:	1 week
2012-11-13 21:04:35 +00:00
Eitan Adler
a016af99a9 Add support for a few more devices:
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
2012-11-04 20:50:23 +00:00
Oleksandr Tymoshenko
a0eae699c9 Separate interrupts enable/disable logic from setting port parameters.
Otherwise setting baud rate in TTY mode effectively disables TX/RX
interrupts and renders port unusable.
2012-10-30 01:52:49 +00:00
Oleksandr Tymoshenko
f70f23cc3e Add PrimeCell UART (PL011) driver
Obtained from:	Semihalf
2012-08-30 20:31:53 +00:00
Oleksandr Tymoshenko
8dee0fd04c Merging of projects/armv6, part 8
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>
2012-08-15 05:37:10 +00:00
Oleksandr Tymoshenko
8bb9363760 Merging of projects/armv6, part 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
2012-08-15 03:49:10 +00:00
Peter Grehan
332cda07c0 Complete polled-mode operation by using a callout if the device will be
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
2012-04-12 18:46:48 +00:00
Marcel Moolenaar
2059ee3cc0 uart_cpu_amd64.c and uart_cpu_i386.c (under sys/dev/uart) are
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.
2012-04-11 02:42:01 +00:00
Konstantin Belousov
77b5f5c8e2 Add PCI Id for the AMT SOL UART on G4x series Intel chipsets.
Submitted by:	admin zahost ru
MFC after:	3 days
2012-03-14 14:01:51 +00:00
Remko Lodder
c8e72d0c6f Add support for the MosChip MCS9904 four serial ports
controller.

PR:		165804
Submitted by:	Eugene Grosbein
MFC after:	1 week
2012-03-07 06:42:21 +00:00
Eitan Adler
383227f156 Add support for Sony Ericsson GC89 EDGE/Wirelles LAN PC Card
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
2012-01-19 02:47:11 +00:00
Konstantin Belousov
f5793e6f84 Add PCI Id for the AMT SOL UART on 5 series Intel chipsets.
MFC after:	1 week
2012-01-11 17:46:08 +00:00
Kevin Lo
1a74905fee Add support for Intel EG20T serial ports 2012-01-03 10:01:12 +00:00
Ed Schouten
dc15eac046 Use strchr() and strrchr().
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.
2012-01-02 12:12:10 +00:00
Marcel Moolenaar
b9887274c1 Actually set the baudrate from the FDT. 2011-12-30 03:57:17 +00:00
Konstantin Belousov
84f941284c Add PCI Id for the Intel AMT serial interface as found on my DQ67OW.
MFC after:	1 week
2011-12-29 08:27:37 +00:00
Andriy Gapon
9976156f12 kern cons: introduce infrastructure for console grabbing by kernel
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
2011-12-17 15:08:43 +00:00
Ed Schouten
f6ab8089c6 Replace __const by const in all non-contributed source code.
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.
2011-12-13 13:32:56 +00:00
Jayachandran C.
07042bef45 Fix OF_finddevice error return value in case of FDT.
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
2011-12-02 15:24:39 +00:00
Ed Schouten
d745c852be Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.
This means that their use is restricted to a single C file.
2011-11-07 06:44:47 +00:00
Olivier Houchard
11e55f9108 Disable the TX ready interrupts once we received one, some UART won't clear
the IIR_TXRDY bit upon reading.

Reviewed by:	marcel
2011-11-02 20:45:44 +00:00
Robert Watson
e5a0927394 Follow up to r225203 refining break-to-debugger run-time configuration
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)
2011-08-27 14:24:27 +00:00