SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 1 | /* |
Andrew Victor | 9d04126 | 2007-02-05 11:42:07 +0100 | [diff] [blame] | 2 | * include/asm-arm/arch-at91/uncompress.h |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2003 SAN People |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | |
| 21 | #ifndef __ASM_ARCH_UNCOMPRESS_H |
| 22 | #define __ASM_ARCH_UNCOMPRESS_H |
| 23 | |
Andrew Victor | 030f481 | 2007-05-11 13:21:27 +0100 | [diff] [blame] | 24 | #include <asm/io.h> |
Guennadi Liakhovetski | fa3218d | 2008-01-29 15:43:13 +0100 | [diff] [blame] | 25 | #include <linux/atmel_serial.h> |
| 26 | |
| 27 | #if defined(CONFIG_AT91_EARLY_DBGU) |
| 28 | #define UART_OFFSET (AT91_DBGU + AT91_BASE_SYS) |
| 29 | #elif defined(CONFIG_AT91_EARLY_USART0) |
| 30 | #define UART_OFFSET AT91_USART0 |
| 31 | #elif defined(CONFIG_AT91_EARLY_USART1) |
| 32 | #define UART_OFFSET AT91_USART1 |
| 33 | #elif defined(CONFIG_AT91_EARLY_USART2) |
| 34 | #define UART_OFFSET AT91_USART2 |
| 35 | #elif defined(CONFIG_AT91_EARLY_USART3) |
| 36 | #define UART_OFFSET AT91_USART3 |
| 37 | #elif defined(CONFIG_AT91_EARLY_USART4) |
| 38 | #define UART_OFFSET AT91_USART4 |
| 39 | #elif defined(CONFIG_AT91_EARLY_USART5) |
| 40 | #define UART_OFFSET AT91_USART5 |
| 41 | #endif |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 42 | |
| 43 | /* |
| 44 | * The following code assumes the serial port has already been |
Andrew Victor | 55d8bae | 2006-11-30 17:16:43 +0100 | [diff] [blame] | 45 | * initialized by the bootloader. If you didn't setup a port in |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 46 | * your bootloader then nothing will appear (which might be desired). |
| 47 | * |
| 48 | * This does not append a newline |
| 49 | */ |
Russell King | a081568 | 2006-03-28 10:24:33 +0100 | [diff] [blame] | 50 | static void putc(int c) |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 51 | { |
Guennadi Liakhovetski | fa3218d | 2008-01-29 15:43:13 +0100 | [diff] [blame] | 52 | #ifdef UART_OFFSET |
| 53 | void __iomem *sys = (void __iomem *) UART_OFFSET; /* physical address */ |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 54 | |
Guennadi Liakhovetski | fa3218d | 2008-01-29 15:43:13 +0100 | [diff] [blame] | 55 | while (!(__raw_readl(sys + ATMEL_US_CSR) & ATMEL_US_TXRDY)) |
Russell King | a081568 | 2006-03-28 10:24:33 +0100 | [diff] [blame] | 56 | barrier(); |
Guennadi Liakhovetski | fa3218d | 2008-01-29 15:43:13 +0100 | [diff] [blame] | 57 | __raw_writel(c, sys + ATMEL_US_THR); |
Greg Ungerer | b54942f | 2007-05-18 06:28:01 +0100 | [diff] [blame] | 58 | #endif |
Russell King | a081568 | 2006-03-28 10:24:33 +0100 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | static inline void flush(void) |
| 62 | { |
Guennadi Liakhovetski | fa3218d | 2008-01-29 15:43:13 +0100 | [diff] [blame] | 63 | #ifdef UART_OFFSET |
| 64 | void __iomem *sys = (void __iomem *) UART_OFFSET; /* physical address */ |
Russell King | a081568 | 2006-03-28 10:24:33 +0100 | [diff] [blame] | 65 | |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 66 | /* wait for transmission to complete */ |
Guennadi Liakhovetski | fa3218d | 2008-01-29 15:43:13 +0100 | [diff] [blame] | 67 | while (!(__raw_readl(sys + ATMEL_US_CSR) & ATMEL_US_TXEMPTY)) |
Russell King | a081568 | 2006-03-28 10:24:33 +0100 | [diff] [blame] | 68 | barrier(); |
Greg Ungerer | b54942f | 2007-05-18 06:28:01 +0100 | [diff] [blame] | 69 | #endif |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | #define arch_decomp_setup() |
| 73 | |
| 74 | #define arch_decomp_wdog() |
| 75 | |
| 76 | #endif |