]>
git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blob - arch/arm/mach-at91/include/mach/uncompress.h
2 * arch/arm/mach-at91/include/mach/uncompress.h
4 * Copyright (C) 2003 SAN People
5 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef __ASM_ARCH_UNCOMPRESS_H
23 #define __ASM_ARCH_UNCOMPRESS_H
26 #include <linux/atmel_serial.h>
27 #include <mach/hardware.h>
29 #include <mach/at91_dbgu.h>
32 void __iomem
*at91_uart
;
34 static const u32 uarts_rm9200
[] = {
43 static const u32 uarts_sam9260
[] = {
54 static const u32 uarts_sam9261
[] = {
62 static const u32 uarts_sam9263
[] = {
70 static const u32 uarts_sam9g45
[] = {
79 static const u32 uarts_sam9rl
[] = {
88 static const u32 uarts_sam9x5
[] = {
90 AT91SAM9X5_BASE_USART0
,
91 AT91SAM9X5_BASE_USART1
,
92 AT91SAM9X5_BASE_USART2
,
96 static const u32 uarts_sama5d3
[] = {
105 static const u32 uarts_sama5d4
[] = {
111 static inline const u32
* decomp_soc_detect(void __iomem
*dbgu_base
)
115 cidr
= __raw_readl(dbgu_base
+ AT91_DBGU_CIDR
);
116 socid
= cidr
& ~AT91_CIDR_VERSION
;
119 case ARCH_ID_AT91RM9200
:
122 case ARCH_ID_AT91SAM9G20
:
123 case ARCH_ID_AT91SAM9260
:
124 return uarts_sam9260
;
126 case ARCH_ID_AT91SAM9261
:
127 return uarts_sam9261
;
129 case ARCH_ID_AT91SAM9263
:
130 return uarts_sam9263
;
132 case ARCH_ID_AT91SAM9G45
:
133 return uarts_sam9g45
;
135 case ARCH_ID_AT91SAM9RL64
:
138 case ARCH_ID_AT91SAM9N12
:
139 case ARCH_ID_AT91SAM9X5
:
143 cidr
= __raw_readl(dbgu_base
+ AT91_DBGU_EXID
);
144 if (cidr
& ARCH_EXID_SAMA5D3
)
145 return uarts_sama5d3
;
146 else if (cidr
& ARCH_EXID_SAMA5D4
)
147 return uarts_sama5d4
;
153 if ((cidr
& ~AT91_CIDR_EXT
) == ARCH_ID_AT91SAM9G10
) {
154 return uarts_sam9261
;
157 else if ((cidr
& AT91_CIDR_ARCH
) == ARCH_FAMILY_AT91SAM9XE
) {
158 return uarts_sam9260
;
164 static inline void arch_decomp_setup(void)
169 usarts
= decomp_soc_detect((void __iomem
*)AT91_BASE_DBGU0
);
171 usarts
= decomp_soc_detect((void __iomem
*)AT91_BASE_DBGU1
);
173 usarts
= decomp_soc_detect((void __iomem
*)AT91_BASE_DBGU2
);
180 /* physical address */
181 at91_uart
= (void __iomem
*)usarts
[i
];
183 if (__raw_readl(at91_uart
+ ATMEL_US_BRGR
))
192 * The following code assumes the serial port has already been
193 * initialized by the bootloader. If you didn't setup a port in
194 * your bootloader then nothing will appear (which might be desired).
196 * This does not append a newline
198 static void putc(int c
)
203 while (!(__raw_readl(at91_uart
+ ATMEL_US_CSR
) & ATMEL_US_TXRDY
))
205 __raw_writel(c
, at91_uart
+ ATMEL_US_THR
);
208 static inline void flush(void)
213 /* wait for transmission to complete */
214 while (!(__raw_readl(at91_uart
+ ATMEL_US_CSR
) & ATMEL_US_TXEMPTY
))