diff options
author | Guennadi Liakhovetski <lg@denx.de> | 2008-01-29 09:43:13 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-02-04 08:16:39 -0500 |
commit | fa3218d8594869b38b1a170ea36d176ac455b897 (patch) | |
tree | 54e3423313f34fb144aa30c58f1d24018d604fce | |
parent | e83aff58bf1b7e6b355a0cfa206e9d3aebe5623f (diff) |
[ARM] 4660/3: at91: allow selecting UART for early kernel messages
Currently early kernel messages, i.e., those from uncompression, go to the
debugging UART. And if it is enabled in the platform configuration, but
not initialized by the bootloader, the machine hangs, waiting for UART
status change. Besides, having those messages on another UART - typically
the console UART - may be preferrable. This patch allows selecting the
UART in kernel configuration.
Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
Acked-by: Andrew Victor <linux@maxim.org.za>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-at91/Kconfig | 30 | ||||
-rw-r--r-- | drivers/serial/atmel_serial.c | 3 | ||||
-rw-r--r-- | include/asm-arm/arch-at91/at91rm9200.h | 5 | ||||
-rw-r--r-- | include/asm-arm/arch-at91/at91sam9260.h | 7 | ||||
-rw-r--r-- | include/asm-arm/arch-at91/at91sam9261.h | 4 | ||||
-rw-r--r-- | include/asm-arm/arch-at91/at91sam9263.h | 4 | ||||
-rw-r--r-- | include/asm-arm/arch-at91/at91sam9rl.h | 5 | ||||
-rw-r--r-- | include/asm-arm/arch-at91/uncompress.h | 32 | ||||
-rw-r--r-- | include/linux/atmel_serial.h (renamed from drivers/serial/atmel_serial.h) | 2 |
9 files changed, 81 insertions, 11 deletions
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 5b0422cdde76..074dcd5d9a7e 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig | |||
@@ -253,6 +253,36 @@ config AT91_TIMER_HZ | |||
253 | system clock (of at least several MHz), rounding is less of a | 253 | system clock (of at least several MHz), rounding is less of a |
254 | problem so it can be safer to use a decimal values like 100. | 254 | problem so it can be safer to use a decimal values like 100. |
255 | 255 | ||
256 | choice | ||
257 | prompt "Select a UART for early kernel messages" | ||
258 | |||
259 | config AT91_EARLY_DBGU | ||
260 | bool "DBGU" | ||
261 | |||
262 | config AT91_EARLY_USART0 | ||
263 | bool "USART0" | ||
264 | |||
265 | config AT91_EARLY_USART1 | ||
266 | bool "USART1" | ||
267 | |||
268 | config AT91_EARLY_USART2 | ||
269 | bool "USART2" | ||
270 | depends on ! ARCH_AT91X40 | ||
271 | |||
272 | config AT91_EARLY_USART3 | ||
273 | bool "USART3" | ||
274 | depends on (ARCH_AT91RM9200 || ARCH_AT91SAM9RL || ARCH_AT91SAM9260) | ||
275 | |||
276 | config AT91_EARLY_USART4 | ||
277 | bool "USART4" | ||
278 | depends on ARCH_AT91SAM9260 | ||
279 | |||
280 | config AT91_EARLY_USART5 | ||
281 | bool "USART5" | ||
282 | depends on ARCH_AT91SAM9260 | ||
283 | |||
284 | endchoice | ||
285 | |||
256 | endmenu | 286 | endmenu |
257 | 287 | ||
258 | endif | 288 | endif |
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index 111da57f5334..60f52904aad0 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/tty_flip.h> | 34 | #include <linux/tty_flip.h> |
35 | #include <linux/platform_device.h> | 35 | #include <linux/platform_device.h> |
36 | #include <linux/atmel_pdc.h> | 36 | #include <linux/atmel_pdc.h> |
37 | #include <linux/atmel_serial.h> | ||
37 | 38 | ||
38 | #include <asm/io.h> | 39 | #include <asm/io.h> |
39 | 40 | ||
@@ -45,8 +46,6 @@ | |||
45 | #include <asm/arch/gpio.h> | 46 | #include <asm/arch/gpio.h> |
46 | #endif | 47 | #endif |
47 | 48 | ||
48 | #include "atmel_serial.h" | ||
49 | |||
50 | #if defined(CONFIG_SERIAL_ATMEL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | 49 | #if defined(CONFIG_SERIAL_ATMEL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) |
51 | #define SUPPORT_SYSRQ | 50 | #define SUPPORT_SYSRQ |
52 | #endif | 51 | #endif |
diff --git a/include/asm-arm/arch-at91/at91rm9200.h b/include/asm-arm/arch-at91/at91rm9200.h index 802891a9cd81..e8fc0b1c33f4 100644 --- a/include/asm-arm/arch-at91/at91rm9200.h +++ b/include/asm-arm/arch-at91/at91rm9200.h | |||
@@ -93,6 +93,11 @@ | |||
93 | #define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) /* Real-Time Clock */ | 93 | #define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) /* Real-Time Clock */ |
94 | #define AT91_MC (0xffffff00 - AT91_BASE_SYS) /* Memory Controllers */ | 94 | #define AT91_MC (0xffffff00 - AT91_BASE_SYS) /* Memory Controllers */ |
95 | 95 | ||
96 | #define AT91_USART0 AT91RM9200_BASE_US0 | ||
97 | #define AT91_USART1 AT91RM9200_BASE_US1 | ||
98 | #define AT91_USART2 AT91RM9200_BASE_US2 | ||
99 | #define AT91_USART3 AT91RM9200_BASE_US3 | ||
100 | |||
96 | #define AT91_MATRIX 0 /* not supported */ | 101 | #define AT91_MATRIX 0 /* not supported */ |
97 | 102 | ||
98 | /* | 103 | /* |
diff --git a/include/asm-arm/arch-at91/at91sam9260.h b/include/asm-arm/arch-at91/at91sam9260.h index 0427f8698c07..c8934fe34dc5 100644 --- a/include/asm-arm/arch-at91/at91sam9260.h +++ b/include/asm-arm/arch-at91/at91sam9260.h | |||
@@ -99,6 +99,13 @@ | |||
99 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) | 99 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) |
100 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) | 100 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) |
101 | 101 | ||
102 | #define AT91_USART0 AT91SAM9260_BASE_US0 | ||
103 | #define AT91_USART1 AT91SAM9260_BASE_US1 | ||
104 | #define AT91_USART2 AT91SAM9260_BASE_US2 | ||
105 | #define AT91_USART3 AT91SAM9260_BASE_US3 | ||
106 | #define AT91_USART4 AT91SAM9260_BASE_US4 | ||
107 | #define AT91_USART5 AT91SAM9260_BASE_US5 | ||
108 | |||
102 | 109 | ||
103 | /* | 110 | /* |
104 | * Internal Memory. | 111 | * Internal Memory. |
diff --git a/include/asm-arm/arch-at91/at91sam9261.h b/include/asm-arm/arch-at91/at91sam9261.h index 9eb459570330..c7c4778dac49 100644 --- a/include/asm-arm/arch-at91/at91sam9261.h +++ b/include/asm-arm/arch-at91/at91sam9261.h | |||
@@ -84,6 +84,10 @@ | |||
84 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) | 84 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) |
85 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) | 85 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) |
86 | 86 | ||
87 | #define AT91_USART0 AT91SAM9261_BASE_US0 | ||
88 | #define AT91_USART1 AT91SAM9261_BASE_US1 | ||
89 | #define AT91_USART2 AT91SAM9261_BASE_US2 | ||
90 | |||
87 | 91 | ||
88 | /* | 92 | /* |
89 | * Internal Memory. | 93 | * Internal Memory. |
diff --git a/include/asm-arm/arch-at91/at91sam9263.h b/include/asm-arm/arch-at91/at91sam9263.h index 115c47ac7ebb..018a647311da 100644 --- a/include/asm-arm/arch-at91/at91sam9263.h +++ b/include/asm-arm/arch-at91/at91sam9263.h | |||
@@ -101,6 +101,10 @@ | |||
101 | #define AT91_RTT1 (0xfffffd50 - AT91_BASE_SYS) | 101 | #define AT91_RTT1 (0xfffffd50 - AT91_BASE_SYS) |
102 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) | 102 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) |
103 | 103 | ||
104 | #define AT91_USART0 AT91SAM9263_BASE_US0 | ||
105 | #define AT91_USART1 AT91SAM9263_BASE_US1 | ||
106 | #define AT91_USART2 AT91SAM9263_BASE_US2 | ||
107 | |||
104 | #define AT91_SMC AT91_SMC0 | 108 | #define AT91_SMC AT91_SMC0 |
105 | 109 | ||
106 | /* | 110 | /* |
diff --git a/include/asm-arm/arch-at91/at91sam9rl.h b/include/asm-arm/arch-at91/at91sam9rl.h index 8a9708a370c6..16d2832f6c0a 100644 --- a/include/asm-arm/arch-at91/at91sam9rl.h +++ b/include/asm-arm/arch-at91/at91sam9rl.h | |||
@@ -94,6 +94,11 @@ | |||
94 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) | 94 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) |
95 | #define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) | 95 | #define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) |
96 | 96 | ||
97 | #define AT91_USART0 AT91SAM9RL_BASE_US0 | ||
98 | #define AT91_USART1 AT91SAM9RL_BASE_US1 | ||
99 | #define AT91_USART2 AT91SAM9RL_BASE_US2 | ||
100 | #define AT91_USART3 AT91SAM9RL_BASE_US3 | ||
101 | |||
97 | 102 | ||
98 | /* | 103 | /* |
99 | * Internal Memory. | 104 | * Internal Memory. |
diff --git a/include/asm-arm/arch-at91/uncompress.h b/include/asm-arm/arch-at91/uncompress.h index 272a7e0dc6cf..f5636a8f6132 100644 --- a/include/asm-arm/arch-at91/uncompress.h +++ b/include/asm-arm/arch-at91/uncompress.h | |||
@@ -22,7 +22,23 @@ | |||
22 | #define __ASM_ARCH_UNCOMPRESS_H | 22 | #define __ASM_ARCH_UNCOMPRESS_H |
23 | 23 | ||
24 | #include <asm/io.h> | 24 | #include <asm/io.h> |
25 | #include <asm/arch/at91_dbgu.h> | 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 | ||
26 | 42 | ||
27 | /* | 43 | /* |
28 | * The following code assumes the serial port has already been | 44 | * The following code assumes the serial port has already been |
@@ -33,22 +49,22 @@ | |||
33 | */ | 49 | */ |
34 | static void putc(int c) | 50 | static void putc(int c) |
35 | { | 51 | { |
36 | #ifdef AT91_DBGU | 52 | #ifdef UART_OFFSET |
37 | void __iomem *sys = (void __iomem *) AT91_BASE_SYS; /* physical address */ | 53 | void __iomem *sys = (void __iomem *) UART_OFFSET; /* physical address */ |
38 | 54 | ||
39 | while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXRDY)) | 55 | while (!(__raw_readl(sys + ATMEL_US_CSR) & ATMEL_US_TXRDY)) |
40 | barrier(); | 56 | barrier(); |
41 | __raw_writel(c, sys + AT91_DBGU_THR); | 57 | __raw_writel(c, sys + ATMEL_US_THR); |
42 | #endif | 58 | #endif |
43 | } | 59 | } |
44 | 60 | ||
45 | static inline void flush(void) | 61 | static inline void flush(void) |
46 | { | 62 | { |
47 | #ifdef AT91_DBGU | 63 | #ifdef UART_OFFSET |
48 | void __iomem *sys = (void __iomem *) AT91_BASE_SYS; /* physical address */ | 64 | void __iomem *sys = (void __iomem *) UART_OFFSET; /* physical address */ |
49 | 65 | ||
50 | /* wait for transmission to complete */ | 66 | /* wait for transmission to complete */ |
51 | while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXEMPTY)) | 67 | while (!(__raw_readl(sys + ATMEL_US_CSR) & ATMEL_US_TXEMPTY)) |
52 | barrier(); | 68 | barrier(); |
53 | #endif | 69 | #endif |
54 | } | 70 | } |
diff --git a/drivers/serial/atmel_serial.h b/include/linux/atmel_serial.h index e0141776517c..fd6833764d72 100644 --- a/drivers/serial/atmel_serial.h +++ b/include/linux/atmel_serial.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/serial/atmel_serial.h | 2 | * include/linux/atmel_serial.h |
3 | * | 3 | * |
4 | * Copyright (C) 2005 Ivan Kokshaysky | 4 | * Copyright (C) 2005 Ivan Kokshaysky |
5 | * Copyright (C) SAN People | 5 | * Copyright (C) SAN People |