X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fserial%2Fserial_pxa.c;h=d5140045bfbb54ee0d790418fe07b7cbb4655343;hb=1454ba8e56d88a8b95ac8050cde2c07c651cd0ae;hp=a9976d709a7e9f39bb804038a25003186279dee0;hpb=1086c5d6f8541460f0f10e4a302d8aac27e0e6e0;p=u-boot diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c index a9976d709a..d5140045bf 100644 --- a/drivers/serial/serial_pxa.c +++ b/drivers/serial/serial_pxa.c @@ -14,20 +14,7 @@ * * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * SPDX-License-Identifier: GPL-2.0+ */ #include @@ -36,6 +23,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -72,21 +60,7 @@ DECLARE_GLOBAL_DATA_PTR; #define HWUART_INDEX 0xff #endif -#ifndef CONFIG_SERIAL_MULTI -#if defined(CONFIG_FFUART) -#define UART_INDEX FFUART_INDEX -#elif defined(CONFIG_BTUART) -#define UART_INDEX BTUART_INDEX -#elif defined(CONFIG_STUART) -#define UART_INDEX STUART_INDEX -#elif defined(CONFIG_HWUART) -#define UART_INDEX HWUART_INDEX -#else -#error "Please select CONFIG_(FF|BT|ST|HW)UART in board config file." -#endif -#endif - -uint32_t pxa_uart_get_baud_divider(void) +static uint32_t pxa_uart_get_baud_divider(void) { if (gd->baudrate == 1200) return 768; @@ -104,7 +78,7 @@ uint32_t pxa_uart_get_baud_divider(void) return 0; } -struct pxa_uart_regs *pxa_uart_index_to_regs(uint32_t uart_index) +static struct pxa_uart_regs *pxa_uart_index_to_regs(uint32_t uart_index) { switch (uart_index) { case FFUART_INDEX: return (struct pxa_uart_regs *)FFUART_BASE; @@ -116,7 +90,7 @@ struct pxa_uart_regs *pxa_uart_index_to_regs(uint32_t uart_index) } } -void pxa_uart_toggle_clock(uint32_t uart_index, int enable) +static void pxa_uart_toggle_clock(uint32_t uart_index, int enable) { uint32_t clk_reg, clk_offset, reg; @@ -269,14 +243,14 @@ void pxa_puts_dev(unsigned int uart_index, const char *s) #define pxa_uart_desc(uart) \ struct serial_device serial_##uart##_device = \ { \ - "serial_"#uart, \ - uart##_init, \ - NULL, \ - uart##_setbrg, \ - uart##_getc, \ - uart##_tstc, \ - uart##_putc, \ - uart##_puts, \ + .name = "serial_"#uart, \ + .start = uart##_init, \ + .stop = NULL, \ + .setbrg = uart##_setbrg, \ + .getc = uart##_getc, \ + .tstc = uart##_tstc, \ + .putc = uart##_putc, \ + .puts = uart##_puts, \ }; #define pxa_uart_multi(uart, UART) \ @@ -296,6 +270,30 @@ void pxa_puts_dev(unsigned int uart_index, const char *s) pxa_uart_multi(btuart, BTUART) #endif -#ifndef CONFIG_SERIAL_MULTI - pxa_uart(serial, UART) +__weak struct serial_device *default_serial_console(void) +{ +#if CONFIG_CONS_INDEX == 1 + return &serial_hwuart_device; +#elif CONFIG_CONS_INDEX == 2 + return &serial_stuart_device; +#elif CONFIG_CONS_INDEX == 3 + return &serial_ffuart_device; +#elif CONFIG_CONS_INDEX == 4 + return &serial_btuart_device; +#else +#error "Bad CONFIG_CONS_INDEX." +#endif +} + +void pxa_serial_initialize(void) +{ +#if defined(CONFIG_FFUART) + serial_register(&serial_ffuart_device); #endif +#if defined(CONFIG_BTUART) + serial_register(&serial_btuart_device); +#endif +#if defined(CONFIG_STUART) + serial_register(&serial_stuart_device); +#endif +}