aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/u-boot/u-boot-2009.11/at91/0002-Support-running-ATSAM9G45-M10-from-dataflash.patch
blob: 4880d67d51a60e9f4f36f0efe0e8dabdede08498 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
From 05c663921ff0fab52cafd2ff23848fa4bfabc5ec Mon Sep 17 00:00:00 2001
From: Ulf Samuelsson <ulf@grond.atmel.com>
Date: Sat, 27 Feb 2010 08:58:44 +0100
Subject: [PATCH] Support running ATSAM9G45/M10 from dataflash

The current at91sam9g45 targets can build for dataflash
but the target will still use NAND flash for the environment.

This patch will add the first hooks to allow use of dataflash.
The end result will use dataflash, but there are bit errors
during transmission, so the CRC check will always fail.
This will be fixed by later patches.

Signed-off-by: Ulf Samuelsson <ulf.samuelsson@atmel.com>
---
 Makefile                                    |    2 +-
 board/atmel/at91sam9m10g45ek/Makefile       |    1 +
 board/atmel/at91sam9m10g45ek/partition.c    |   40 +++++++++++++++++++++++++++
 cpu/arm926ejs/at91/at91sam9m10g45_devices.c |    3 +-
 4 files changed, 43 insertions(+), 3 deletions(-)
 create mode 100644 board/atmel/at91sam9m10g45ek/partition.c

diff --git a/Makefile b/Makefile
index f06a97c..0bfa61c 100644
--- a/Makefile
+++ b/Makefile
@@ -2876,7 +2876,7 @@ at91sam9g45ekes_config	:	unconfig
 		echo "#define CONFIG_SYS_USE_NANDFLASH 1"	>>$(obj)include/config.h ; \
 		$(XECHO) "... with environment variable in NAND FLASH" ; \
 	else \
-		echo "#define CONFIG_ATMEL_SPI 1"	>>$(obj)include/config.h ; \
+		echo "#define CONFIG_SYS_USE_DATAFLASH 1"	>>$(obj)include/config.h ; \
 		$(XECHO) "... with environment variable in SPI DATAFLASH CS0" ; \
 	fi;
 	@$(MKCONFIG) -a at91sam9m10g45ek arm arm926ejs at91sam9m10g45ek atmel at91
diff --git a/board/atmel/at91sam9m10g45ek/Makefile b/board/atmel/at91sam9m10g45ek/Makefile
index 4caf1e4..914cc1a 100644
--- a/board/atmel/at91sam9m10g45ek/Makefile
+++ b/board/atmel/at91sam9m10g45ek/Makefile
@@ -31,6 +31,7 @@ LIB	= $(obj)lib$(BOARD).a
 
 COBJS-y += at91sam9m10g45ek.o
 COBJS-y += led.o
+COBJS-$(CONFIG_HAS_DATAFLASH) += partition.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS-y))
diff --git a/board/atmel/at91sam9m10g45ek/partition.c b/board/atmel/at91sam9m10g45ek/partition.c
new file mode 100644
index 0000000..2629c67
--- /dev/null
+++ b/board/atmel/at91sam9m10g45ek/partition.c
@@ -0,0 +1,40 @@
+/*
+ * (C) Copyright 2008
+ * Ulf Samuelsson <ulf@atmel.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+#include <common.h>
+#include <config.h>
+#include <asm/hardware.h>
+#include <dataflash.h>
+
+AT91S_DATAFLASH_INFO dataflash_info[CONFIG_SYS_MAX_DATAFLASH_BANKS];
+
+struct dataflash_addr cs[CONFIG_SYS_MAX_DATAFLASH_BANKS] = {
+	{CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0, 0},	/* Logical adress, CS */
+	{CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1, 1}
+};
+
+/*define the area offsets*/
+dataflash_protect_t area_list[NB_DATAFLASH_AREA] = {
+	{0x00000000, 0x000041FF, FLAG_PROTECT_SET,   0, "Bootstrap"},
+	{0x00004200, 0x000083FF, FLAG_PROTECT_CLEAR, 0, "Environment"},
+	{0x00008400, 0x00041FFF, FLAG_PROTECT_SET,   0, "U-Boot"},
+	{0x00042000, 0x00251FFF, FLAG_PROTECT_CLEAR, 0,	"Kernel"},
+	{0x00252000, 0xFFFFFFFF, FLAG_PROTECT_CLEAR, 0,	"FS"},
+};
diff --git a/cpu/arm926ejs/at91/at91sam9m10g45_devices.c b/cpu/arm926ejs/at91/at91sam9m10g45_devices.c
index 98d90f2..07717ea 100644
--- a/cpu/arm926ejs/at91/at91sam9m10g45_devices.c
+++ b/cpu/arm926ejs/at91/at91sam9m10g45_devices.c
@@ -75,7 +75,6 @@ void at91_serial_hw_init(void)
 #endif
 }
 
-#ifdef CONFIG_ATMEL_SPI
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
 	at91_set_A_periph(AT91_PIN_PB0, 0);	/* SPI0_MISO */
@@ -146,7 +145,7 @@ void at91_spi1_hw_init(unsigned long cs_mask)
 	}
 
 }
-#endif
+
 
 #ifdef CONFIG_MACB
 void at91_macb_hw_init(void)
-- 
1.6.0.2