aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/Kconfig53
-rw-r--r--arch/arm/mach-at91/include/mach/at91rm9200.h5
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9260.h7
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9261.h4
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9263.h4
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9g45.h5
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9rl.h5
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9x5.h8
-rw-r--r--arch/arm/mach-at91/include/mach/hardware.h16
-rw-r--r--arch/arm/mach-at91/include/mach/uncompress.h170
10 files changed, 148 insertions, 129 deletions
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 8acc1649c820..885fdb93618b 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -9,15 +9,6 @@ config HAVE_AT91_DBGU0
9config HAVE_AT91_DBGU1 9config HAVE_AT91_DBGU1
10 bool 10 bool
11 11
12config HAVE_AT91_USART3
13 bool
14
15config HAVE_AT91_USART4
16 bool
17
18config HAVE_AT91_USART5
19 bool
20
21config AT91_SAM9_ALT_RESET 12config AT91_SAM9_ALT_RESET
22 bool 13 bool
23 default !ARCH_AT91X40 14 default !ARCH_AT91X40
@@ -36,16 +27,12 @@ config ARCH_AT91RM9200
36 select CPU_ARM920T 27 select CPU_ARM920T
37 select GENERIC_CLOCKEVENTS 28 select GENERIC_CLOCKEVENTS
38 select HAVE_AT91_DBGU0 29 select HAVE_AT91_DBGU0
39 select HAVE_AT91_USART3
40 30
41config ARCH_AT91SAM9260 31config ARCH_AT91SAM9260
42 bool "AT91SAM9260 or AT91SAM9XE" 32 bool "AT91SAM9260 or AT91SAM9XE"
43 select CPU_ARM926T 33 select CPU_ARM926T
44 select GENERIC_CLOCKEVENTS 34 select GENERIC_CLOCKEVENTS
45 select HAVE_AT91_DBGU0 35 select HAVE_AT91_DBGU0
46 select HAVE_AT91_USART3
47 select HAVE_AT91_USART4
48 select HAVE_AT91_USART5
49 select HAVE_NET_MACB 36 select HAVE_NET_MACB
50 37
51config ARCH_AT91SAM9261 38config ARCH_AT91SAM9261
@@ -74,7 +61,6 @@ config ARCH_AT91SAM9RL
74 bool "AT91SAM9RL" 61 bool "AT91SAM9RL"
75 select CPU_ARM926T 62 select CPU_ARM926T
76 select GENERIC_CLOCKEVENTS 63 select GENERIC_CLOCKEVENTS
77 select HAVE_AT91_USART3
78 select HAVE_FB_ATMEL 64 select HAVE_FB_ATMEL
79 select HAVE_AT91_DBGU0 65 select HAVE_AT91_DBGU0
80 66
@@ -83,16 +69,12 @@ config ARCH_AT91SAM9G20
83 select CPU_ARM926T 69 select CPU_ARM926T
84 select GENERIC_CLOCKEVENTS 70 select GENERIC_CLOCKEVENTS
85 select HAVE_AT91_DBGU0 71 select HAVE_AT91_DBGU0
86 select HAVE_AT91_USART3
87 select HAVE_AT91_USART4
88 select HAVE_AT91_USART5
89 select HAVE_NET_MACB 72 select HAVE_NET_MACB
90 73
91config ARCH_AT91SAM9G45 74config ARCH_AT91SAM9G45
92 bool "AT91SAM9G45 or AT91SAM9M10 families" 75 bool "AT91SAM9G45 or AT91SAM9M10 families"
93 select CPU_ARM926T 76 select CPU_ARM926T
94 select GENERIC_CLOCKEVENTS 77 select GENERIC_CLOCKEVENTS
95 select HAVE_AT91_USART3
96 select HAVE_FB_ATMEL 78 select HAVE_FB_ATMEL
97 select HAVE_NET_MACB 79 select HAVE_NET_MACB
98 select HAVE_AT91_DBGU1 80 select HAVE_AT91_DBGU1
@@ -526,41 +508,6 @@ config AT91_TIMER_HZ
526 system clock (of at least several MHz), rounding is less of a 508 system clock (of at least several MHz), rounding is less of a
527 problem so it can be safer to use a decimal values like 100. 509 problem so it can be safer to use a decimal values like 100.
528 510
529choice
530 prompt "Select a UART for early kernel messages"
531
532config AT91_EARLY_DBGU0
533 bool "DBGU on rm9200, 9260/9g20, 9261/9g10, 9rl and 9x5"
534 depends on HAVE_AT91_DBGU0
535
536config AT91_EARLY_DBGU1
537 bool "DBGU on 9263 and 9g45"
538 depends on HAVE_AT91_DBGU1
539
540config AT91_EARLY_USART0
541 bool "USART0"
542
543config AT91_EARLY_USART1
544 bool "USART1"
545
546config AT91_EARLY_USART2
547 bool "USART2"
548 depends on ! ARCH_AT91X40
549
550config AT91_EARLY_USART3
551 bool "USART3"
552 depends on HAVE_AT91_USART3
553
554config AT91_EARLY_USART4
555 bool "USART4"
556 depends on HAVE_AT91_USART4
557
558config AT91_EARLY_USART5
559 bool "USART5"
560 depends on HAVE_AT91_USART5
561
562endchoice
563
564endmenu 511endmenu
565 512
566endif 513endif
diff --git a/arch/arm/mach-at91/include/mach/at91rm9200.h b/arch/arm/mach-at91/include/mach/at91rm9200.h
index 603e6aac2a4f..e67317c67761 100644
--- a/arch/arm/mach-at91/include/mach/at91rm9200.h
+++ b/arch/arm/mach-at91/include/mach/at91rm9200.h
@@ -88,11 +88,6 @@
88#define AT91RM9200_BASE_RTC 0xfffffe00 /* Real-Time Clock */ 88#define AT91RM9200_BASE_RTC 0xfffffe00 /* Real-Time Clock */
89#define AT91RM9200_BASE_MC 0xffffff00 /* Memory Controllers */ 89#define AT91RM9200_BASE_MC 0xffffff00 /* Memory Controllers */
90 90
91#define AT91_USART0 AT91RM9200_BASE_US0
92#define AT91_USART1 AT91RM9200_BASE_US1
93#define AT91_USART2 AT91RM9200_BASE_US2
94#define AT91_USART3 AT91RM9200_BASE_US3
95
96/* 91/*
97 * Internal Memory. 92 * Internal Memory.
98 */ 93 */
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h
index 08ae9afd00fe..416c7b6c56d3 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9260.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9260.h
@@ -95,13 +95,6 @@
95#define AT91SAM9260_BASE_WDT 0xfffffd40 95#define AT91SAM9260_BASE_WDT 0xfffffd40
96#define AT91SAM9260_BASE_GPBR 0xfffffd50 96#define AT91SAM9260_BASE_GPBR 0xfffffd50
97 97
98#define AT91_USART0 AT91SAM9260_BASE_US0
99#define AT91_USART1 AT91SAM9260_BASE_US1
100#define AT91_USART2 AT91SAM9260_BASE_US2
101#define AT91_USART3 AT91SAM9260_BASE_US3
102#define AT91_USART4 AT91SAM9260_BASE_US4
103#define AT91_USART5 AT91SAM9260_BASE_US5
104
105 98
106/* 99/*
107 * Internal Memory. 100 * Internal Memory.
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h
index 44fbdc12ee62..a041406d06ee 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9261.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9261.h
@@ -79,10 +79,6 @@
79#define AT91SAM9261_BASE_WDT 0xfffffd40 79#define AT91SAM9261_BASE_WDT 0xfffffd40
80#define AT91SAM9261_BASE_GPBR 0xfffffd50 80#define AT91SAM9261_BASE_GPBR 0xfffffd50
81 81
82#define AT91_USART0 AT91SAM9261_BASE_US0
83#define AT91_USART1 AT91SAM9261_BASE_US1
84#define AT91_USART2 AT91SAM9261_BASE_US2
85
86 82
87/* 83/*
88 * Internal Memory. 84 * Internal Memory.
diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h
index d96cbb2e03c4..d201029d60b3 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9263.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9263.h
@@ -95,10 +95,6 @@
95#define AT91SAM9263_BASE_RTT1 0xfffffd50 95#define AT91SAM9263_BASE_RTT1 0xfffffd50
96#define AT91SAM9263_BASE_GPBR 0xfffffd60 96#define AT91SAM9263_BASE_GPBR 0xfffffd60
97 97
98#define AT91_USART0 AT91SAM9263_BASE_US0
99#define AT91_USART1 AT91SAM9263_BASE_US1
100#define AT91_USART2 AT91SAM9263_BASE_US2
101
102#define AT91_SMC AT91_SMC0 98#define AT91_SMC AT91_SMC0
103 99
104/* 100/*
diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h
index d052abcff852..3a4da24d5911 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9g45.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h
@@ -106,11 +106,6 @@
106#define AT91SAM9G45_BASE_RTC 0xfffffdb0 106#define AT91SAM9G45_BASE_RTC 0xfffffdb0
107#define AT91SAM9G45_BASE_GPBR 0xfffffd60 107#define AT91SAM9G45_BASE_GPBR 0xfffffd60
108 108
109#define AT91_USART0 AT91SAM9G45_BASE_US0
110#define AT91_USART1 AT91SAM9G45_BASE_US1
111#define AT91_USART2 AT91SAM9G45_BASE_US2
112#define AT91_USART3 AT91SAM9G45_BASE_US3
113
114/* 109/*
115 * Internal Memory. 110 * Internal Memory.
116 */ 111 */
diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h
index e0073eb10144..a15db56d33fa 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9rl.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h
@@ -89,11 +89,6 @@
89#define AT91SAM9RL_BASE_GPBR 0xfffffd60 89#define AT91SAM9RL_BASE_GPBR 0xfffffd60
90#define AT91SAM9RL_BASE_RTC 0xfffffe00 90#define AT91SAM9RL_BASE_RTC 0xfffffe00
91 91
92#define AT91_USART0 AT91SAM9RL_BASE_US0
93#define AT91_USART1 AT91SAM9RL_BASE_US1
94#define AT91_USART2 AT91SAM9RL_BASE_US2
95#define AT91_USART3 AT91SAM9RL_BASE_US3
96
97 92
98/* 93/*
99 * Internal Memory. 94 * Internal Memory.
diff --git a/arch/arm/mach-at91/include/mach/at91sam9x5.h b/arch/arm/mach-at91/include/mach/at91sam9x5.h
index 88e43d534cdf..c75ee19b58d3 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9x5.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9x5.h
@@ -55,14 +55,6 @@
55#define AT91SAM9X5_BASE_USART2 0xf8024000 55#define AT91SAM9X5_BASE_USART2 0xf8024000
56 56
57/* 57/*
58 * Base addresses for early serial code (uncompress.h)
59 */
60#define AT91_DBGU AT91_BASE_DBGU0
61#define AT91_USART0 AT91SAM9X5_BASE_USART0
62#define AT91_USART1 AT91SAM9X5_BASE_USART1
63#define AT91_USART2 AT91SAM9X5_BASE_USART2
64
65/*
66 * Internal Memory. 58 * Internal Memory.
67 */ 59 */
68#define AT91SAM9X5_SRAM_BASE 0x00300000 /* Internal SRAM base address */ 60#define AT91SAM9X5_SRAM_BASE 0x00300000 /* Internal SRAM base address */
diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h
index e9e29a6c3868..3a01f8ff7e74 100644
--- a/arch/arm/mach-at91/include/mach/hardware.h
+++ b/arch/arm/mach-at91/include/mach/hardware.h
@@ -22,27 +22,17 @@
22/* 9263, 9g45 */ 22/* 9263, 9g45 */
23#define AT91_BASE_DBGU1 0xffffee00 23#define AT91_BASE_DBGU1 0xffffee00
24 24
25#if defined(CONFIG_ARCH_AT91RM9200) 25#if defined(CONFIG_ARCH_AT91X40)
26#include <mach/at91x40.h>
27#else
26#include <mach/at91rm9200.h> 28#include <mach/at91rm9200.h>
27#elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20)
28#include <mach/at91sam9260.h> 29#include <mach/at91sam9260.h>
29#elif defined(CONFIG_ARCH_AT91SAM9261) || defined(CONFIG_ARCH_AT91SAM9G10)
30#include <mach/at91sam9261.h> 30#include <mach/at91sam9261.h>
31#elif defined(CONFIG_ARCH_AT91SAM9263)
32#include <mach/at91sam9263.h> 31#include <mach/at91sam9263.h>
33#elif defined(CONFIG_ARCH_AT91SAM9RL)
34#include <mach/at91sam9rl.h> 32#include <mach/at91sam9rl.h>
35#elif defined(CONFIG_ARCH_AT91SAM9G45)
36#include <mach/at91sam9g45.h> 33#include <mach/at91sam9g45.h>
37#elif defined(CONFIG_ARCH_AT91SAM9X5)
38#include <mach/at91sam9x5.h> 34#include <mach/at91sam9x5.h>
39#elif defined(CONFIG_ARCH_AT91X40)
40#include <mach/at91x40.h>
41#else
42#error "Unsupported AT91 processor"
43#endif
44 35
45#if !defined(CONFIG_ARCH_AT91X40)
46/* 36/*
47 * On all at91 except rm9200 and x40 have the System Controller starts 37 * On all at91 except rm9200 and x40 have the System Controller starts
48 * at address 0xffffc000 and has a size of 16KiB. 38 * at address 0xffffc000 and has a size of 16KiB.
diff --git a/arch/arm/mach-at91/include/mach/uncompress.h b/arch/arm/mach-at91/include/mach/uncompress.h
index d985af7c94bd..6f6118d1576a 100644
--- a/arch/arm/mach-at91/include/mach/uncompress.h
+++ b/arch/arm/mach-at91/include/mach/uncompress.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * arch/arm/mach-at91/include/mach/uncompress.h 2 * arch/arm/mach-at91/include/mach/uncompress.h
3 * 3 *
4 * Copyright (C) 2003 SAN People 4 * Copyright (C) 2003 SAN People
5 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * 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 * it under the terms of the GNU General Public License as published by
@@ -25,32 +26,149 @@
25#include <linux/atmel_serial.h> 26#include <linux/atmel_serial.h>
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27 28
28#if defined(CONFIG_AT91_EARLY_DBGU0) 29#include <mach/at91_dbgu.h>
29#define UART_OFFSET AT91_BASE_DBGU0 30#include <mach/cpu.h>
30#elif defined(CONFIG_AT91_EARLY_DBGU1)
31#define UART_OFFSET AT91_BASE_DBGU1
32#elif defined(CONFIG_AT91_EARLY_USART0)
33#define UART_OFFSET AT91_USART0
34#elif defined(CONFIG_AT91_EARLY_USART1)
35#define UART_OFFSET AT91_USART1
36#elif defined(CONFIG_AT91_EARLY_USART2)
37#define UART_OFFSET AT91_USART2
38#elif defined(CONFIG_AT91_EARLY_USART3)
39#define UART_OFFSET AT91_USART3
40#elif defined(CONFIG_AT91_EARLY_USART4)
41#define UART_OFFSET AT91_USART4
42#elif defined(CONFIG_AT91_EARLY_USART5)
43#define UART_OFFSET AT91_USART5
44#endif
45 31
46void __iomem *at91_uart; 32void __iomem *at91_uart;
47 33
34#if !defined(CONFIG_ARCH_AT91X40)
35static const u32 uarts_rm9200[] = {
36 AT91_BASE_DBGU0,
37 AT91RM9200_BASE_US0,
38 AT91RM9200_BASE_US1,
39 AT91RM9200_BASE_US2,
40 AT91RM9200_BASE_US3,
41 0,
42};
43
44static const u32 uarts_sam9260[] = {
45 AT91_BASE_DBGU0,
46 AT91SAM9260_BASE_US0,
47 AT91SAM9260_BASE_US1,
48 AT91SAM9260_BASE_US2,
49 AT91SAM9260_BASE_US3,
50 AT91SAM9260_BASE_US4,
51 AT91SAM9260_BASE_US5,
52 0,
53};
54
55static const u32 uarts_sam9261[] = {
56 AT91_BASE_DBGU0,
57 AT91SAM9261_BASE_US0,
58 AT91SAM9261_BASE_US1,
59 AT91SAM9261_BASE_US2,
60 0,
61};
62
63static const u32 uarts_sam9263[] = {
64 AT91_BASE_DBGU1,
65 AT91SAM9263_BASE_US0,
66 AT91SAM9263_BASE_US1,
67 AT91SAM9263_BASE_US2,
68 0,
69};
70
71static const u32 uarts_sam9g45[] = {
72 AT91_BASE_DBGU1,
73 AT91SAM9G45_BASE_US0,
74 AT91SAM9G45_BASE_US1,
75 AT91SAM9G45_BASE_US2,
76 AT91SAM9G45_BASE_US3,
77 0,
78};
79
80static const u32 uarts_sam9rl[] = {
81 AT91_BASE_DBGU0,
82 AT91SAM9RL_BASE_US0,
83 AT91SAM9RL_BASE_US1,
84 AT91SAM9RL_BASE_US2,
85 AT91SAM9RL_BASE_US3,
86 0,
87};
88
89static const u32 uarts_sam9x5[] = {
90 AT91_BASE_DBGU0,
91 AT91SAM9X5_BASE_USART0,
92 AT91SAM9X5_BASE_USART1,
93 AT91SAM9X5_BASE_USART2,
94 0,
95};
96
97static inline const u32* decomp_soc_detect(u32 dbgu_base)
98{
99 u32 cidr, socid;
100
101 cidr = __raw_readl(dbgu_base + AT91_DBGU_CIDR);
102 socid = cidr & ~AT91_CIDR_VERSION;
103
104 switch (socid) {
105 case ARCH_ID_AT91RM9200:
106 return uarts_rm9200;
107
108 case ARCH_ID_AT91SAM9G20:
109 case ARCH_ID_AT91SAM9260:
110 return uarts_sam9260;
111
112 case ARCH_ID_AT91SAM9261:
113 return uarts_sam9261;
114
115 case ARCH_ID_AT91SAM9263:
116 return uarts_sam9263;
117
118 case ARCH_ID_AT91SAM9G45:
119 return uarts_sam9g45;
120
121 case ARCH_ID_AT91SAM9RL64:
122 return uarts_sam9rl;
123
124 case ARCH_ID_AT91SAM9X5:
125 return uarts_sam9x5;
126 }
127
128 /* at91sam9g10 */
129 if ((cidr & ~AT91_CIDR_EXT) == ARCH_ID_AT91SAM9G10) {
130 return uarts_sam9261;
131 }
132 /* at91sam9xe */
133 else if ((cidr & AT91_CIDR_ARCH) == ARCH_FAMILY_AT91SAM9XE) {
134 return uarts_sam9260;
135 }
136
137 return NULL;
138}
139
48static inline void arch_decomp_setup(void) 140static inline void arch_decomp_setup(void)
49{ 141{
50#ifdef UART_OFFSET 142 int i = 0;
51 at91_uart = (void __iomem *) UART_OFFSET; /* physical address */ 143 const u32* usarts;
52#endif 144
145 usarts = decomp_soc_detect(AT91_BASE_DBGU0);
146
147 if (!usarts)
148 usarts = decomp_soc_detect(AT91_BASE_DBGU1);
149 if (!usarts) {
150 at91_uart = NULL;
151 return;
152 }
153
154 do {
155 /* physical address */
156 at91_uart = (void __iomem *)usarts[i];
157
158 if (__raw_readl(at91_uart + ATMEL_US_BRGR))
159 return;
160 i++;
161 } while (usarts[i]);
162
163 at91_uart = NULL;
53} 164}
165#else
166static inline void arch_decomp_setup(void)
167{
168 at91_uart = NULL;
169}
170#endif
171
54/* 172/*
55 * The following code assumes the serial port has already been 173 * The following code assumes the serial port has already been
56 * initialized by the bootloader. If you didn't setup a port in 174 * initialized by the bootloader. If you didn't setup a port in
@@ -60,20 +178,22 @@ static inline void arch_decomp_setup(void)
60 */ 178 */
61static void putc(int c) 179static void putc(int c)
62{ 180{
63#ifdef UART_OFFSET 181 if (!at91_uart)
182 return;
183
64 while (!(__raw_readl(at91_uart + ATMEL_US_CSR) & ATMEL_US_TXRDY)) 184 while (!(__raw_readl(at91_uart + ATMEL_US_CSR) & ATMEL_US_TXRDY))
65 barrier(); 185 barrier();
66 __raw_writel(c, at91_uart + ATMEL_US_THR); 186 __raw_writel(c, at91_uart + ATMEL_US_THR);
67#endif
68} 187}
69 188
70static inline void flush(void) 189static inline void flush(void)
71{ 190{
72#ifdef UART_OFFSET 191 if (!at91_uart)
192 return;
193
73 /* wait for transmission to complete */ 194 /* wait for transmission to complete */
74 while (!(__raw_readl(at91_uart + ATMEL_US_CSR) & ATMEL_US_TXEMPTY)) 195 while (!(__raw_readl(at91_uart + ATMEL_US_CSR) & ATMEL_US_TXEMPTY))
75 barrier(); 196 barrier();
76#endif
77} 197}
78 198
79#define arch_decomp_wdog() 199#define arch_decomp_wdog()