Deleted Added
full compact
uart_dev_pl011.c (256281) uart_dev_pl011.c (259319)
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>
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 248965 2013-04-01 00:44:20Z ian $");
28__FBSDID("$FreeBSD: stable/10/sys/dev/uart/uart_dev_pl011.c 259319 2013-12-13 18:21:27Z 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>

--- 105 unchanged lines hidden (view full) ---

142 line |= LCR_H_WLEN6;
143 break;
144 case 8:
145 default:
146 line |= LCR_H_WLEN8;
147 break;
148 }
149
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>

--- 105 unchanged lines hidden (view full) ---

142 line |= LCR_H_WLEN6;
143 break;
144 case 8:
145 default:
146 line |= LCR_H_WLEN8;
147 break;
148 }
149
150 /* TODO: Calculate divisors */
151 baud = (0x1 << 16) | 0x28;
152
153 if (stopbits == 2)
154 line |= LCR_H_STP2;
155 else
156 line &= ~LCR_H_STP2;
157
158 if (parity)
159 line |= LCR_H_PEN;
160 else
161 line &= ~LCR_H_PEN;
162
163 /* Configure the rest */
164 line &= ~LCR_H_FEN;
165 ctrl |= (CR_RXE | CR_TXE | CR_UARTEN);
166
150 if (stopbits == 2)
151 line |= LCR_H_STP2;
152 else
153 line &= ~LCR_H_STP2;
154
155 if (parity)
156 line |= LCR_H_PEN;
157 else
158 line &= ~LCR_H_PEN;
159
160 /* Configure the rest */
161 line &= ~LCR_H_FEN;
162 ctrl |= (CR_RXE | CR_TXE | CR_UARTEN);
163
167 __uart_setreg(bas, UART_IBRD, ((uint32_t)(baud >> 16)) & IBRD_BDIVINT);
168 __uart_setreg(bas, UART_FBRD, (uint32_t)(baud) & FBRD_BDIVFRAC);
164 if (bas->rclk != 0 && baudrate != 0) {
165 baud = bas->rclk * 4 / baudrate;
166 __uart_setreg(bas, UART_IBRD, ((uint32_t)(baud >> 6)) & IBRD_BDIVINT);
167 __uart_setreg(bas, UART_FBRD, (uint32_t)(baud & 0x3F) & FBRD_BDIVFRAC);
168 }
169
170 /* Add config. to line before reenabling UART */
171 __uart_setreg(bas, UART_LCR_H, (__uart_getreg(bas, UART_LCR_H) &
172 ~0xff) | line);
173
174 __uart_setreg(bas, UART_CR, ctrl);
175}
176

--- 267 unchanged lines hidden ---
169
170 /* Add config. to line before reenabling UART */
171 __uart_setreg(bas, UART_LCR_H, (__uart_getreg(bas, UART_LCR_H) &
172 ~0xff) | line);
173
174 __uart_setreg(bas, UART_CR, ctrl);
175}
176

--- 267 unchanged lines hidden ---