Changeset View
Changeset View
Standalone View
Standalone View
sys/mips/broadcom/uart_cpu_chipc.c
Show All 39 Lines | |||||
#include <machine/bus.h> | #include <machine/bus.h> | ||||
#include <dev/bhnd/cores/chipc/chipcreg.h> | #include <dev/bhnd/cores/chipc/chipcreg.h> | ||||
#include <dev/uart/uart.h> | #include <dev/uart/uart.h> | ||||
#include <dev/uart/uart_bus.h> | #include <dev/uart/uart_bus.h> | ||||
#include <dev/uart/uart_cpu.h> | #include <dev/uart/uart_cpu.h> | ||||
#include "bcm_socinfo.h" | |||||
#ifdef CFE | #ifdef CFE | ||||
#include <dev/cfe/cfe_api.h> | #include <dev/cfe/cfe_api.h> | ||||
#include <dev/cfe/cfe_ioctl.h> | #include <dev/cfe/cfe_ioctl.h> | ||||
#include <dev/cfe/cfe_error.h> | #include <dev/cfe/cfe_error.h> | ||||
#endif | #endif | ||||
#include "bcm_machdep.h" | |||||
#include "bcm_socinfo.h" | |||||
bus_space_tag_t uart_bus_space_io; | bus_space_tag_t uart_bus_space_io; | ||||
bus_space_tag_t uart_bus_space_mem; | bus_space_tag_t uart_bus_space_mem; | ||||
static struct uart_class *chipc_uart_class = &uart_ns8250_class; | static struct uart_class *chipc_uart_class = &uart_ns8250_class; | ||||
#define CHIPC_UART_BAUDRATE 115200 | #define CHIPC_UART_BAUDRATE 115200 | ||||
int | int | ||||
Show All 9 Lines | uart_cpu_init(struct uart_devinfo *di, u_int uart, int baudrate) | ||||
if (uart >= CHIPC_UART_MAX) | if (uart >= CHIPC_UART_MAX) | ||||
return (EINVAL); | return (EINVAL); | ||||
socinfo = bcm_get_socinfo(); | socinfo = bcm_get_socinfo(); | ||||
di->ops = uart_getops(chipc_uart_class); | di->ops = uart_getops(chipc_uart_class); | ||||
di->bas.chan = 0; | di->bas.chan = 0; | ||||
di->bas.bst = uart_bus_space_mem; | di->bas.bst = uart_bus_space_mem; | ||||
di->bas.bsh = (bus_space_handle_t) BCM_SOCREG(CHIPC_UART(uart)); | di->bas.bsh = (bus_space_handle_t) BCM_CORE_ADDR(cc_addr, | ||||
CHIPC_UART(uart)); | |||||
di->bas.regshft = 0; | di->bas.regshft = 0; | ||||
di->bas.rclk = socinfo->uartrate; /* in Hz */ | di->bas.rclk = socinfo->uartrate; /* in Hz */ | ||||
di->baudrate = baudrate; | di->baudrate = baudrate; | ||||
di->databits = 8; | di->databits = 8; | ||||
di->stopbits = 1; | di->stopbits = 1; | ||||
di->parity = UART_PARITY_NONE; | di->parity = UART_PARITY_NONE; | ||||
return (0); | return (0); | ||||
Show All 17 Lines | uart_getenv_cfe(int devtype, struct uart_devinfo *di) | ||||
if (ret != CFE_OK) | if (ret != CFE_OK) | ||||
return (ENXIO); | return (ENXIO); | ||||
/* Parse serial console unit. Fails on non-uart devices. */ | /* Parse serial console unit. Fails on non-uart devices. */ | ||||
if (sscanf(device, "uart%u", &uart) != 1) | if (sscanf(device, "uart%u", &uart) != 1) | ||||
return (ENXIO); | return (ENXIO); | ||||
/* Fetch device handle */ | /* Fetch device handle */ | ||||
fd = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE); | fd = bcm_get_platform()->cfe_console; | ||||
if (fd < 0) | if (fd < 0) | ||||
return (ENXIO); | return (ENXIO); | ||||
/* Fetch serial configuration */ | /* Fetch serial configuration */ | ||||
ret = cfe_ioctl(fd, IOCTL_SERIAL_GETSPEED, (unsigned char *)&baud, | ret = cfe_ioctl(fd, IOCTL_SERIAL_GETSPEED, (unsigned char *)&baud, | ||||
sizeof(baud), &len, 0); | sizeof(baud), &len, 0); | ||||
if (ret != CFE_OK) | if (ret != CFE_OK) | ||||
baud = CHIPC_UART_BAUDRATE; | baud = CHIPC_UART_BAUDRATE; | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |