uart_dev_pl011.c (239919) | uart_dev_pl011.c (242333) |
---|---|
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: head/sys/dev/uart/uart_dev_pl011.c 239919 2012-08-30 20:31:53Z gonzo $"); | 28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_dev_pl011.c 242333 2012-10-30 01:52:49Z gonzo $"); |
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> --- 78 unchanged lines hidden (view full) --- 115static int 116uart_pl011_probe(struct uart_bas *bas) 117{ 118 119 return (0); 120} 121 122static void | 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> --- 78 unchanged lines hidden (view full) --- 115static int 116uart_pl011_probe(struct uart_bas *bas) 117{ 118 119 return (0); 120} 121 122static void |
123uart_pl011_init(struct uart_bas *bas, int baudrate, int databits, int stopbits, | 123uart_pl011_param(struct uart_bas *bas, int baudrate, int databits, int stopbits, |
124 int parity) 125{ 126 uint32_t ctrl, line; 127 uint32_t baud; 128 | 124 int parity) 125{ 126 uint32_t ctrl, line; 127 uint32_t baud; 128 |
129 /* Mask all interrupts */ 130 __uart_setreg(bas, UART_IMSC, __uart_getreg(bas, UART_IMSC) & 131 ~IMSC_MASK_ALL); 132 | |
133 /* 134 * Zero all settings to make sure 135 * UART is disabled and not configured 136 */ 137 ctrl = line = 0x0; 138 __uart_setreg(bas, UART_CR, ctrl); 139 140 /* As we know UART is disabled we may setup the line */ --- 33 unchanged lines hidden (view full) --- 174 /* Add config. to line before reenabling UART */ 175 __uart_setreg(bas, UART_LCR_H, (__uart_getreg(bas, UART_LCR_H) & 176 ~0xff) | line); 177 178 __uart_setreg(bas, UART_CR, ctrl); 179} 180 181static void | 129 /* 130 * Zero all settings to make sure 131 * UART is disabled and not configured 132 */ 133 ctrl = line = 0x0; 134 __uart_setreg(bas, UART_CR, ctrl); 135 136 /* As we know UART is disabled we may setup the line */ --- 33 unchanged lines hidden (view full) --- 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 177static void |
178uart_pl011_init(struct uart_bas *bas, int baudrate, int databits, int stopbits, 179 int parity) 180{ 181 /* Mask all interrupts */ 182 __uart_setreg(bas, UART_IMSC, __uart_getreg(bas, UART_IMSC) & 183 ~IMSC_MASK_ALL); 184 185 uart_pl011_param(bas, baudrate, databits, stopbits, parity); 186} 187 188static void |
|
182uart_pl011_term(struct uart_bas *bas) 183{ 184} 185 186static void 187uart_pl011_putc(struct uart_bas *bas, int c) 188{ 189 --- 163 unchanged lines hidden (view full) --- 353} 354 355static int 356uart_pl011_bus_param(struct uart_softc *sc, int baudrate, int databits, 357 int stopbits, int parity) 358{ 359 360 uart_lock(sc->sc_hwmtx); | 189uart_pl011_term(struct uart_bas *bas) 190{ 191} 192 193static void 194uart_pl011_putc(struct uart_bas *bas, int c) 195{ 196 --- 163 unchanged lines hidden (view full) --- 360} 361 362static int 363uart_pl011_bus_param(struct uart_softc *sc, int baudrate, int databits, 364 int stopbits, int parity) 365{ 366 367 uart_lock(sc->sc_hwmtx); |
361 uart_pl011_init(&sc->sc_bas, baudrate, databits, stopbits, parity); | 368 uart_pl011_param(&sc->sc_bas, baudrate, databits, stopbits, parity); |
362 uart_unlock(sc->sc_hwmtx); 363 364 return (0); 365} 366 367static int 368uart_pl011_bus_probe(struct uart_softc *sc) 369{ --- 67 unchanged lines hidden --- | 369 uart_unlock(sc->sc_hwmtx); 370 371 return (0); 372} 373 374static int 375uart_pl011_bus_probe(struct uart_softc *sc) 376{ --- 67 unchanged lines hidden --- |