1/*- 2 * Copyright (c) 2012 Semihalf. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: stable/10/sys/dev/uart/uart_dev_pl011.c 283321 2015-05-23 19:27:04Z ian $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/bus.h> 34#include <machine/bus.h> 35 36#include <dev/uart/uart.h> --- 6 unchanged lines hidden (view full) --- 43/* PL011 UART registers and masks*/ 44#define UART_DR 0x00 /* Data register */ 45#define DR_FE (1 << 8) /* Framing error */ 46#define DR_PE (1 << 9) /* Parity error */ 47#define DR_BE (1 << 10) /* Break error */ 48#define DR_OE (1 << 11) /* Overrun error */ 49 50#define UART_FR 0x06 /* Flag register */ |
51#define FR_TXFF (1 << 5) /* Transmit FIFO/reg full */ |
52#define FR_RXFF (1 << 6) /* Receive FIFO/reg full */ 53#define FR_TXFE (1 << 7) /* Transmit FIFO/reg empty */ 54 55#define UART_IBRD 0x09 /* Integer baud rate register */ 56#define IBRD_BDIVINT 0xffff /* Significant part of int. divisor value */ 57 58#define UART_FBRD 0x0a /* Fractional baud rate register */ 59#define FBRD_BDIVFRAC 0x3f /* Significant part of frac. divisor value */ --- 130 unchanged lines hidden (view full) --- 190uart_pl011_term(struct uart_bas *bas) 191{ 192} 193 194static void 195uart_pl011_putc(struct uart_bas *bas, int c) 196{ 197 |
198 /* Wait when TX FIFO full. Push character otherwise. */ 199 while (__uart_getreg(bas, UART_FR) & FR_TXFF) |
200 ; 201 __uart_setreg(bas, UART_DR, c & 0xff); 202} 203 204static int 205uart_pl011_rxready(struct uart_bas *bas) 206{ 207 --- 267 unchanged lines hidden --- |