11bb92983SJerome Forissier // SPDX-License-Identifier: BSD-2-Clause
21537d62eSAijun Sun /*
31537d62eSAijun Sun * Copyright (c) 2016, Spreadtrum Communications Inc.
41537d62eSAijun Sun * All rights reserved.
51537d62eSAijun Sun *
61537d62eSAijun Sun * Redistribution and use in source and binary forms, with or without
71537d62eSAijun Sun * modification, are permitted provided that the following conditions are met:
81537d62eSAijun Sun *
91537d62eSAijun Sun * 1. Redistributions of source code must retain the above copyright notice,
101537d62eSAijun Sun * this list of conditions and the following disclaimer.
111537d62eSAijun Sun *
121537d62eSAijun Sun * 2. Redistributions in binary form must reproduce the above copyright notice,
131537d62eSAijun Sun * this list of conditions and the following disclaimer in the documentation
141537d62eSAijun Sun * and/or other materials provided with the distribution.
151537d62eSAijun Sun *
161537d62eSAijun Sun * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
171537d62eSAijun Sun * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
181537d62eSAijun Sun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
191537d62eSAijun Sun * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
201537d62eSAijun Sun * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
211537d62eSAijun Sun * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
221537d62eSAijun Sun * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
231537d62eSAijun Sun * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
241537d62eSAijun Sun * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
251537d62eSAijun Sun * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
261537d62eSAijun Sun * POSSIBILITY OF SUCH DAMAGE.
271537d62eSAijun Sun */
281537d62eSAijun Sun #include <console.h>
291537d62eSAijun Sun #include <drivers/sprd_uart.h>
301537d62eSAijun Sun #include <mm/core_memprot.h>
311537d62eSAijun Sun #include <platform_config.h>
321537d62eSAijun Sun
3323660121SJerome Forissier static struct sprd_uart_data console_data;
341537d62eSAijun Sun
plat_console_init(void)35*55ab8f06SAlvin Chang void plat_console_init(void)
361537d62eSAijun Sun {
3759cfa779SJerome Forissier sprd_uart_init(&console_data, CONSOLE_UART_BASE);
38756aea59SJerome Forissier register_serial_console(&console_data.chip);
391537d62eSAijun Sun }
401537d62eSAijun Sun
console_putc(int ch)411537d62eSAijun Sun void console_putc(int ch)
421537d62eSAijun Sun {
4359cfa779SJerome Forissier struct serial_chip *cons = &console_data.chip;
4459cfa779SJerome Forissier
4559cfa779SJerome Forissier cons->ops->putc(cons, ch & 0xff);
461537d62eSAijun Sun }
471537d62eSAijun Sun
48