Anton Vorontsov | d94f944 | 2010-03-25 17:12:41 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2003 ARM Limited |
| 3 | * Copyright 2008 Cavium Networks |
| 4 | * |
| 5 | * This file is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License, Version 2, as |
| 7 | * published by the Free Software Foundation. |
| 8 | */ |
| 9 | |
| 10 | #include <asm/mach-types.h> |
| 11 | #include <mach/hardware.h> |
| 12 | #include <mach/cns3xxx.h> |
| 13 | |
| 14 | #define AMBA_UART_DR(base) (*(volatile unsigned char *)((base) + 0x00)) |
| 15 | #define AMBA_UART_LCRH(base) (*(volatile unsigned char *)((base) + 0x2c)) |
| 16 | #define AMBA_UART_CR(base) (*(volatile unsigned char *)((base) + 0x30)) |
| 17 | #define AMBA_UART_FR(base) (*(volatile unsigned char *)((base) + 0x18)) |
| 18 | |
| 19 | /* |
| 20 | * Return the UART base address |
| 21 | */ |
| 22 | static inline unsigned long get_uart_base(void) |
| 23 | { |
| 24 | if (machine_is_cns3420vb()) |
| 25 | return CNS3XXX_UART0_BASE; |
| 26 | else |
| 27 | return 0; |
| 28 | } |
| 29 | |
| 30 | /* |
| 31 | * This does not append a newline |
| 32 | */ |
| 33 | static inline void putc(int c) |
| 34 | { |
| 35 | unsigned long base = get_uart_base(); |
| 36 | |
| 37 | while (AMBA_UART_FR(base) & (1 << 5)) |
| 38 | barrier(); |
| 39 | |
| 40 | AMBA_UART_DR(base) = c; |
| 41 | } |
| 42 | |
| 43 | static inline void flush(void) |
| 44 | { |
| 45 | unsigned long base = get_uart_base(); |
| 46 | |
| 47 | while (AMBA_UART_FR(base) & (1 << 3)) |
| 48 | barrier(); |
| 49 | } |
| 50 | |
| 51 | /* |
| 52 | * nothing to do |
| 53 | */ |
| 54 | #define arch_decomp_setup() |
| 55 | #define arch_decomp_wdog() |