| 1 |
|
| 2 |
|
| 3 |
om> |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
#include <drivers/arm/pl011.h> |
| 9 |
#include <drivers/console.h> |
| 10 |
#include <drivers/rpi3/gpio/rpi3_gpio.h> |
| 11 |
#include <drivers/ti/uart/uart_16550.h> |
| 12 |
#include <platform_def.h> |
| 13 |
|
| 14 |
#include <rpi_shared.h> |
| 15 |
|
| 16 |
static bool rpi3_use_mini_uart(void) |
| 17 |
{ |
| 18 |
return rpi3_gpio_get_select(14) == RPI3_GPIO_FUNC_ALT5; |
| 19 |
} |
| 20 |
|
| 21 |
int rpi3_register_used_uart(console_t *console) |
| 22 |
{ |
| 23 |
rpi3_gpio_init(); |
| 24 |
|
| 25 |
if (rpi3_use_mini_uart()) |
| 26 |
return console_16550_register(PLAT_RPI_MINI_UART_BASE, |
| 27 |
0, |
| 28 |
PLAT_RPI_UART_BAUDRATE, |
| 29 |
console); |
| 30 |
else |
| 31 |
return console_pl011_register(PLAT_RPI_PL011_UART_BASE, |
| 32 |
PLAT_RPI_PL011_UART_CLOCK, |
| 33 |
PLAT_RPI_UART_BAUDRATE, |
| 34 |
console); |
| 35 |
} |