freebsd-skq/sys/arm/at91
ian 720da1df6b Enable hardware flow control and high speed bulk data transfer in at91 uarts.
Changes to make rtc/cts flow control work...

This does not turn on the builtin hardware flow control on the SoC's usart
device, because that doesn't work on uart1 due to a chip erratum (they
forgot to wire up pin PA21 to RTS0 internally).  Instead it uses the
hardware flow control logic where the tty layer calls the driver to assert
and de-assert the flow control lines as needed.  This prevents overruns at
the tty layer (app doesn't read fast enough), but does nothing for overruns
at the driver layer (interrupts not serviced fast enough).

To work around the wiring problem with RTS0, the driver reassigns that pin
as a GPIO and controls it manually.  It only does so if given permission via
hint.uart.1.use_rts0_workaround=1, to prevent accidentally driving the pin
if uart1 is used without flow control (because something not related to
serial IO could be wired to that pin).

In addition to the RTS0 workaround, driver changes were needed in the area
of reading the current set of DCE signals.  A priming read is now done at
attach() time, and the interrupt routine now sets SER_INT_SIGCHG when any
of the DCE signals change.  Without these changes, nothing could ever be
transmitted, because the tty layer thought CTS was de-asserted (when in fact
we had just never read the status register, and the hwsig variable was
init'd to CTS de-asserted).

Changes to support bulk high-speed (230kbps and higher) data reception...

Allow the receive fifo size to be tuned with hint.uart.<dev>.fifo_bytes.
For high speed receive, a fifo size of 1024 works well.  The default is
still 128 bytes if no hint is provided.  Using a value larger than 384
requires a change in dev/uart/uart_core.c to size the intermediate
buffer as MAX(384, 3*sc->sc_rxfifosize).

Recalculate the receive timeout whenever the baud rate changes.  At low
baud rates (19.2kbps and below) the timeout is the number of bits in 2
characters.  At higher speed it's calculated to be 500 microseconds
worth of bits.  The idea is to compromise between being responsive in
interactive situations and not timing out prematurely during a brief
pause in bulk data flow.  The old fixed timeout of 1.5 characters was
just 32 microseconds at 460kbps.

At interrupt time, check for receiver holding register overrun status
and set the corresponding status bit in the return value.

When handling a buffer overrun, get a single buffer emptied and handed
back to the hardware as quickly as possible, then deal with the second
buffer.  This at least minimizes data loss compared to the old logic
that fully processed both buffers before restarting the hardware.

Rewrite the logic for handling buffers after a receive timeout.  The
original author speculated in a comment that there may be a race with
high speed data.  There was, although it was rare.  The code now handles
all three possible scenarios on receive timeout: two empty buffers, one
empty and one partial buffer, or one full and one partial buffer.

Reviewed by:	imp
2013-04-01 00:00:10 +00:00
..
at91_aicreg.h Import preliminary support for Atmel AT91SAM9G20 cpu, and the Hot-e HL201. 2010-07-14 00:48:53 +00:00
at91_cfata.c Eliminate devclass_find_free_unit call here, since -1 gives the same 2009-06-10 17:39:19 +00:00
at91_machdep.c Call soc_info.soc_data->soc_clock_init() before at91_pmc_init_clock(), so 2013-03-29 18:47:08 +00:00
at91_mci.c Remove a really noisy printf left over from debugging hardware errata. 2013-03-29 17:57:24 +00:00
at91_mcireg.h - Add support for MCI1 revision 2xx controllers and a work-around for their 2012-04-22 00:43:32 +00:00
at91_pdcreg.h
at91_pio_sam9g20.h Add support for the AT91SAM9260 2010-10-06 22:40:27 +00:00
at91_pio_sam9g45.h Add support for the Atmel AT91SAM9G45 CPU. 2012-07-26 08:01:25 +00:00
at91_pio.c Add userland access to at91 gpio functionality via ioctl calls. Also, 2013-03-29 19:52:57 +00:00
at91_pioreg.h Hack to unbreak boot2 for at91rm9200 boot loader. When the at91sam 2012-05-11 14:40:25 +00:00
at91_piovar.h Add userland access to at91 gpio functionality via ioctl calls. Also, 2013-03-29 19:52:57 +00:00
at91_pit.c at91pit->at91_pit for consistnecy with other drivers. 2012-07-11 17:11:54 +00:00
at91_pitreg.h at91pit->at91_pit for consistnecy with other drivers. 2012-07-11 17:11:54 +00:00
at91_pmc.c Redo the workaround for at91rm9200 erratum #26 in a way that doesn't 2013-03-29 18:17:51 +00:00
at91_pmcreg.h Add charge pump current register. 2012-08-10 04:47:20 +00:00
at91_pmcvar.h Correct the PLLA setting functions and centralize. 2012-08-11 05:45:19 +00:00
at91_reset.S Eliminate the AT91XXXX_BASE for each SoC. AT91_BASE is the right way 2012-07-10 02:14:50 +00:00
at91_rst.c at91$DEV->at91_$DEV to match other Atmel drivers. Also, export 2012-07-11 17:11:07 +00:00
at91_rstreg.h at91$DEV->at91_$DEV to match other Atmel drivers. Also, export 2012-07-11 17:11:07 +00:00
at91_rtc.c Loop reading the RTC registers until the same values are obtained 2012-10-07 20:36:46 +00:00
at91_rtcreg.h Use the RTC unit to get the time. This works on all known AT91SAM9* 2012-10-07 01:58:32 +00:00
at91_spi.c Fetch the chip select in the bridge driver, like all the other spi 2012-08-23 22:38:37 +00:00
at91_spireg.h - Prepend the device description with "AT91" to reflect its nature. [1] 2012-06-03 00:54:10 +00:00
at91_ssc.c Strip trailing whitespace before other changes. 2012-06-13 04:52:19 +00:00
at91_sscreg.h
at91_st.c Make the SoC stuff a little more modular, and start to move away from 2012-07-11 20:17:14 +00:00
at91_streg.h Make the SoC stuff a little more modular, and start to move away from 2012-07-11 20:17:14 +00:00
at91_twi.c Fix a stray debug that I committed accidentally years ago... 2012-06-22 06:44:22 +00:00
at91_twiio.h
at91_twireg.h Add support for the Atmel SAM9XE familiy of microcontrollers, which 2012-04-14 17:09:38 +00:00
at91_usartreg.h
at91_wdt.c Add support for the Atmel SAM9XE familiy of microcontrollers, which 2012-04-14 17:09:38 +00:00
at91_wdtreg.h Strip trailing whitespace before other changes. 2012-06-13 04:52:19 +00:00
at91.c Move unmask IRQ function call up to nexus device level. 2012-07-17 03:18:12 +00:00
at91board.h Create a generic way to support multiple boards within an 2012-07-07 05:02:39 +00:00
at91reg.h The system IRQ is always IRQ 1. Make it so. 2012-07-10 02:39:03 +00:00
at91rm92reg.h Eliminate the AT91XXXX_BASE for each SoC. AT91_BASE is the right way 2012-07-10 02:14:50 +00:00
at91rm9200_devices.c Fix a typo: the RXD0 pin is PA18, not PA19. 2013-03-29 18:06:54 +00:00
at91rm9200.c Fix a typo in the CF device driver name that prevented instantiation. 2013-03-31 12:51:56 +00:00
at91rm9200var.h Configure the peripheral pins for MCI devices. Eliminate the now-unused 2012-07-15 05:41:43 +00:00
at91sam9g20.c Correct the PLLA setting functions and centralize. 2012-08-11 05:45:19 +00:00
at91sam9g20reg.h Eliminate the AT91XXXX_BASE for each SoC. AT91_BASE is the right way 2012-07-10 02:14:50 +00:00
at91sam9g45.c Correct the PLLA setting functions and centralize. 2012-08-11 05:45:19 +00:00
at91sam9g45reg.h Add support for the Atmel AT91SAM9G45 CPU. 2012-07-26 08:01:25 +00:00
at91sam9x5.c Correct the PLLA setting functions and centralize. 2012-08-11 05:45:19 +00:00
at91sam9x5reg.h These files will support the whole at91sam9x5 family when done, 2012-07-30 21:30:43 +00:00
at91sam9260.c Update comments about setting PLLA and refernce the tables in the 2012-08-11 05:12:46 +00:00
at91sam9260reg.h Missed one of the special AT91SAM9xxx_BASE defines. This should be 2012-07-10 02:44:15 +00:00
at91soc.c Make the SoC stuff a little more modular, and start to move away from 2012-07-11 20:17:14 +00:00
at91soc.h Make the SoC stuff a little more modular, and start to move away from 2012-07-11 20:17:14 +00:00
at91var.h Remember where we found the DBGU and use that for our console. 2012-07-12 19:11:37 +00:00
board_bwct.c Configure the peripheral pins for MCI devices. Eliminate the now-unused 2012-07-15 05:41:43 +00:00
board_eb9200.c Preliminary Embest ATEB9200 support. 2012-08-16 05:03:59 +00:00
board_ethernut5.c uboot should be telling us it is an ETHERNUT5 for this board. Tag it 2012-07-14 06:00:37 +00:00
board_hl200.c Configure the peripheral pins for MCI devices. Eliminate the now-unused 2012-07-15 05:41:43 +00:00
board_hl201.c Create a generic way to support multiple boards within an 2012-07-07 05:02:39 +00:00
board_kb920x.c Configure the peripheral pins for MCI devices. Eliminate the now-unused 2012-07-15 05:41:43 +00:00
board_qila9g20.c Create a generic way to support multiple boards within an 2012-07-07 05:02:39 +00:00
board_sam9g20ek.c Create a generic way to support multiple boards within an 2012-07-07 05:02:39 +00:00
board_sam9x25ek.c Create a generic way to support multiple boards within an 2012-07-07 05:02:39 +00:00
board_sam9260ek.c Turns out the ETHERNUT5 isn't anything like the SAM9260-EK. Make this 2012-07-27 05:33:55 +00:00
board_sn9g45.c Add new at91sam9g45 support and sn9g45 board to the ATMEL kernel. 2012-07-27 16:38:02 +00:00
board_tsc4370.c Configure the peripheral pins for MCI devices. Eliminate the now-unused 2012-07-15 05:41:43 +00:00
files.at91 Unbreak building a kernel with EHCI: there's no ehci_atmelarm.c. 2012-11-26 23:30:47 +00:00
if_ate.c Functions m_getm2() and m_get2() have different order of arguments, 2013-03-12 13:42:47 +00:00
if_atereg.h if_ate.c: 2010-10-06 22:25:21 +00:00
if_macb.c Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
if_macbreg.h Import preliminary support for Atmel AT91SAM9G20 cpu, and the Hot-e HL201. 2010-07-14 00:48:53 +00:00
if_macbvar.h Import preliminary support for Atmel AT91SAM9G20 cpu, and the Hot-e HL201. 2010-07-14 00:48:53 +00:00
std.at91 Set machine correctly on ARM. This allows universe to use the correct world 2012-08-18 05:48:19 +00:00
std.at91sam9 Set machine correctly on ARM. This allows universe to use the correct world 2012-08-18 05:48:19 +00:00
std.at91sam9g45 Set machine correctly on ARM. This allows universe to use the correct world 2012-08-18 05:48:19 +00:00
std.atmel Set machine correctly on ARM. This allows universe to use the correct world 2012-08-18 05:48:19 +00:00
std.bwct
std.eb9200 Preliminary Embest ATEB9200 support. 2012-08-16 05:03:59 +00:00
std.ethernut5 Opt-in rather than opt-out of the SoC. We don't really support 2012-07-01 06:34:17 +00:00
std.hl200 Compute the master clock frequency, so we no longer need to have it 2012-05-29 03:23:18 +00:00
std.hl201 Opt-in rather than opt-out of the SoC. We don't really support 2012-07-01 06:34:17 +00:00
std.kb920x Compute the master clock frequency, so we no longer need to have it 2012-05-29 03:23:18 +00:00
std.qila9g20 Opt-in rather than opt-out of the SoC. We don't really support 2012-07-01 06:34:17 +00:00
std.sam9g20ek Opt-in rather than opt-out of the SoC. We don't really support 2012-07-01 06:34:17 +00:00
std.sam9x25ek These files will support the whole at91sam9x5 family when done, 2012-07-30 21:30:43 +00:00
std.sam9260ek Add preliminary support for Atmel SAM9260-EK evaluation kit. 2012-07-14 06:13:23 +00:00
std.sn9g45 Add support for the DesignA Electronics Snapper9g45 System on Module. 2012-07-26 08:05:28 +00:00
std.tsc4370
uart_bus_at91usart.c Some models have 6 USARTS + DBGU. Set a consistent name. 2012-07-26 05:46:56 +00:00
uart_cpu_at91usart.c This file is no longer AT91RM9200 specific, but now is generic to all 2012-07-12 19:15:38 +00:00
uart_dev_at91usart.c Enable hardware flow control and high speed bulk data transfer in at91 uarts. 2013-04-01 00:00:10 +00:00