/* * include/asm/arch/uncompress.h * * Copyright (C) 2012 MStar Semiconductor. * * 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, * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef __ASM_ARCH_UNCOMPRESS_H #define __ASM_ARCH_UNCOMPRESS_H #include #include #include #define TRANSMIT_REGISTER (*(volatile unsigned char *)(ARM_UART1_BASE+0x00)) #define LINE_STATUS_REGISTER (*(volatile unsigned char *)(ARM_UART1_BASE+0x14)) #define LSR_THRE (0x20) // THR empty #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) /* * This does not append a newline */ static inline void putc(int c) { while (!(LINE_STATUS_REGISTER & LSR_THRE)) barrier(); TRANSMIT_REGISTER = c; if (c == '\n') { while (!(LINE_STATUS_REGISTER & LSR_THRE)) barrier(); TRANSMIT_REGISTER = '\r'; } } #else /* * The following code assumes the serial port has already been * initialized by the bootloader. We search for the first enabled * port in the most probable order. If you didn't setup a port in * your bootloader then nothing will appear (which might be desired). * * This does not append a newline */ static void putstr(const char *s) { #ifdef CONFIG_SERIAL_CORE_CONSOLE while (*s) { while (!(LINE_STATUS_REGISTER & LSR_THRE)) barrier(); TRANSMIT_REGISTER = *s; if (*s == '\n') { while (!(LINE_STATUS_REGISTER & LSR_THRE)) barrier(); TRANSMIT_REGISTER = '\r'; } s++; } #endif // CONFIG_SERIAL_CORE_CONSOLE } #endif /* LINUX_2_6_25 */ static inline void flush(void) { } /* * nothing to do */ #define arch_decomp_setup() #define arch_decomp_wdog() \ { \ WDT_CRR_PA = WDT_BF(CR, WDT_CR_VAL); \ } #endif /* __ASM_ARCH_UNCOMPRESS_H */