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 262649 2014-03-01 04:16:54Z imp $");
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_RXFF (1 << 6) /* Receive FIFO/reg full */
52#define FR_TXFE (1 << 7) /* Transmit FIFO/reg empty */
53
54#define UART_IBRD 0x09 /* Integer baud rate register */
55#define IBRD_BDIVINT 0xffff /* Significant part of int. divisor value */
56
57#define UART_FBRD 0x0a /* Fractional baud rate register */
58#define FBRD_BDIVFRAC 0x3f /* Significant part of frac. divisor value */
--- 130 unchanged lines hidden (view full) ---
189uart_pl011_term(struct uart_bas *bas)
190{
191}
192
193static void
194uart_pl011_putc(struct uart_bas *bas, int c)
195{
196
197 while (!(__uart_getreg(bas, UART_FR) & FR_TXFE))
198 ;
199 __uart_setreg(bas, UART_DR, c & 0xff);
200}
201
202static int
203uart_pl011_rxready(struct uart_bas *bas)
204{
205
--- 267 unchanged lines hidden ---
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 262649 2014-03-01 04:16:54Z imp $");
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_RXFF (1 << 6) /* Receive FIFO/reg full */
52#define FR_TXFE (1 << 7) /* Transmit FIFO/reg empty */
53
54#define UART_IBRD 0x09 /* Integer baud rate register */
55#define IBRD_BDIVINT 0xffff /* Significant part of int. divisor value */
56
57#define UART_FBRD 0x0a /* Fractional baud rate register */
58#define FBRD_BDIVFRAC 0x3f /* Significant part of frac. divisor value */
--- 130 unchanged lines hidden (view full) ---
189uart_pl011_term(struct uart_bas *bas)
190{
191}
192
193static void
194uart_pl011_putc(struct uart_bas *bas, int c)
195{
196
197 while (!(__uart_getreg(bas, UART_FR) & FR_TXFE))
198 ;
199 __uart_setreg(bas, UART_DR, c & 0xff);
200}
201
202static int
203uart_pl011_rxready(struct uart_bas *bas)
204{
205
--- 267 unchanged lines hidden ---