| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2008-08-05 16:14:15 +01:00
										 |  |  |  * arch/arm/mach-pxa/include/mach/uncompress.h | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Author:	Nicolas Pitre | 
					
						
							|  |  |  |  * Copyright:	(C) 2001 MontaVista Software Inc. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU General Public License version 2 as | 
					
						
							|  |  |  |  * published by the Free Software Foundation. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-22 17:57:30 +01:00
										 |  |  | #include <linux/serial_reg.h>
 | 
					
						
							| 
									
										
										
										
											2008-06-02 15:58:03 +08:00
										 |  |  | #include <asm/mach-types.h>
 | 
					
						
							| 
									
										
										
										
											2007-11-22 17:57:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-19 13:49:39 +08:00
										 |  |  | #define FFUART_BASE	(0x40100000)
 | 
					
						
							|  |  |  | #define BTUART_BASE	(0x40200000)
 | 
					
						
							|  |  |  | #define STUART_BASE	(0x40700000)
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-28 17:00:17 -04:00
										 |  |  | unsigned long uart_base; | 
					
						
							|  |  |  | unsigned int uart_shift; | 
					
						
							|  |  |  | unsigned int uart_is_pxa; | 
					
						
							| 
									
										
										
										
											2010-02-19 13:49:39 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | static inline unsigned char uart_read(int offset) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return *(volatile unsigned char *)(uart_base + (offset << uart_shift)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static inline void uart_write(unsigned char val, int offset) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	*(volatile unsigned char *)(uart_base + (offset << uart_shift)) = val; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static inline int uart_is_enabled(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	/* assume enabled by default for non-PXA uarts */ | 
					
						
							|  |  |  | 	return uart_is_pxa ? uart_read(UART_IER) & UART_IER_UUE : 1; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-03-28 10:24:33 +01:00
										 |  |  | static inline void putc(char c) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-02-19 13:49:39 +08:00
										 |  |  | 	if (!uart_is_enabled()) | 
					
						
							| 
									
										
										
										
											2007-11-22 17:57:30 +01:00
										 |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2010-02-19 13:49:39 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	while (!(uart_read(UART_LSR) & UART_LSR_THRE)) | 
					
						
							| 
									
										
										
										
											2006-03-28 10:24:33 +01:00
										 |  |  | 		barrier(); | 
					
						
							| 
									
										
										
										
											2010-02-19 13:49:39 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	uart_write(c, UART_TX); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * This does not append a newline | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2006-03-28 10:24:33 +01:00
										 |  |  | static inline void flush(void) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-02 15:58:03 +08:00
										 |  |  | static inline void arch_decomp_setup(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-03-08 17:44:19 +00:00
										 |  |  | 	/* initialize to default */ | 
					
						
							|  |  |  | 	uart_base = FFUART_BASE; | 
					
						
							|  |  |  | 	uart_shift = 2; | 
					
						
							|  |  |  | 	uart_is_pxa = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-16 20:40:55 +03:00
										 |  |  | 	if (machine_is_littleton() || machine_is_intelmote2() | 
					
						
							| 
									
										
										
										
											2009-06-04 10:44:53 +03:00
										 |  |  | 	    || machine_is_csb726() || machine_is_stargate2() | 
					
						
							| 
									
										
										
										
											2009-07-04 14:43:56 +01:00
										 |  |  | 	    || machine_is_cm_x300() || machine_is_balloon3()) | 
					
						
							| 
									
										
										
										
											2010-02-19 13:49:39 +08:00
										 |  |  | 		uart_base = STUART_BASE; | 
					
						
							| 
									
										
										
										
											2010-02-19 14:07:37 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (machine_is_arcom_zeus()) { | 
					
						
							|  |  |  | 		uart_base = 0x10000000;	/* nCS4 */ | 
					
						
							|  |  |  | 		uart_shift = 1; | 
					
						
							|  |  |  | 		uart_is_pxa = 0; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-06-02 15:58:03 +08:00
										 |  |  | } |