summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-2.6.32/at91
diff options
context:
space:
mode:
authorUlf Samuelsson <ulf.samuelsson@atmel.com>2010-01-15 19:50:26 +0100
committerUlf Samuelsson <ulf.samuelsson@atmel.com>2010-01-15 19:50:26 +0100
commit7ebc3015cb766f7a7ea78f539e4bc8f17dd999c1 (patch)
tree0cec594dbd6a69d0e999e0dabee02f942c2c2b2e /recipes/linux/linux-2.6.32/at91
parent48c47f275e1ca11fd64aa8f3c032305003c4eab8 (diff)
From: Ulf Samuelsson <ulf.samuelsson@atmel.com>
Add Linux-2.6.32 recipe for AT91SAM9G45EK. Two patches are included. 1) Patch which will allow the NAND flash partitioning to be configurable 2) Patch which will fix reset for SAM9260, not needed for SAM9G45 though Signed-off-by: Ulf Samuelsson <ulf.samuelsson@atmel.com> ---
Diffstat (limited to 'recipes/linux/linux-2.6.32/at91')
-rw-r--r--recipes/linux/linux-2.6.32/at91/SRC_URI_append.inc9
-rw-r--r--recipes/linux/linux-2.6.32/at91/linux-2.6.32-001-configurable-nand-partitions.patch508
-rw-r--r--recipes/linux/linux-2.6.32/at91/linux-2.6.32-002-sam9g20-proper-reset.patch103
3 files changed, 620 insertions, 0 deletions
diff --git a/recipes/linux/linux-2.6.32/at91/SRC_URI_append.inc b/recipes/linux/linux-2.6.32/at91/SRC_URI_append.inc
new file mode 100644
index 0000000000..ce18159162
--- /dev/null
+++ b/recipes/linux/linux-2.6.32/at91/SRC_URI_append.inc
@@ -0,0 +1,9 @@
+# Automatically generated from gnome script: "SRC_URI_append_linux"
+
+SRC_URI_append += "\
+ file://recipes/linux/linux-2.6.32/patch-sets/linux-2.6.32-001-configurable-nand-partitions.patch;patch=1 \
+ file://recipes/linux/linux-2.6.32/patch-sets/linux-2.6.32-002-sam9g20-proper-reset.patch;patch=1 \
+ "
+
+# no board directory=recipes/linux/linux-2.6.32/boards
+
diff --git a/recipes/linux/linux-2.6.32/at91/linux-2.6.32-001-configurable-nand-partitions.patch b/recipes/linux/linux-2.6.32/at91/linux-2.6.32-001-configurable-nand-partitions.patch
new file mode 100644
index 0000000000..3823bdd47b
--- /dev/null
+++ b/recipes/linux/linux-2.6.32/at91/linux-2.6.32-001-configurable-nand-partitions.patch
@@ -0,0 +1,508 @@
+This patch modifies the NAND partitions of Atmel SAM9 Evaluation Kits.
+The size of the System partition is configured using KConfig
+
+The new partition sizes is will become
+
+Bootstrap partition: 4MB
+System partition: Programmable Size (default 124 MB)
+Data partition: Rest of NAND flash
+
+It modifies the following Atmel SAM9 development boards.
+
+* cap9adk
+* sam9260ek
+* sam9261ek
+* sam9263ek
+* sam9g20ek-2slot-mmc
+* sam9g20ek
+* sam9m10g45ek
+* sam9rlek
+
+The KConfig configuration is implemented so that each board supporting
+this function selects "MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE".
+which enables the MTD_NAND_ATMEL_ROOTFS_SIZE configuration item.
+
+Signed-off-by: Ulf Samuelsson <ulf.samuelsson@atmel.com>
+diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/at91_nand_partitions.h linux-2.6.32/arch/arm/mach-at91/at91_nand_partitions.h
+--- linux-2.6.32-0rig/arch/arm/mach-at91/at91_nand_partitions.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.32/arch/arm/mach-at91/at91_nand_partitions.h 2009-12-13 11:32:51.000000000 +0100
+@@ -0,0 +1,45 @@
++/*
++ * linux/arch/arm/mach-at91/at91_nand_partitions.h
++ *
++ * Copyright (C) 2005 SAN People
++ * Copyright (C) 2006 Atmel
++ * Copyright (C) 2009 Ulf Samuelsson, Atmel
++ *
++ * 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
++ */
++
++
++/*
++ * NAND flash
++ */
++static struct mtd_partition __initdata at91_nand_partition[] = {
++ {
++ .name = "Bootstrap",
++ .offset = 0,
++ .size = 4 * SZ_1M,
++ },
++ {
++ .name = "System",
++ .offset = MTDPART_OFS_NXTBLK,
++ .size = CONFIG_MTD_NAND_ATMEL_ROOTFS_SIZE * SZ_1M,
++ },
++ {
++ .name = "Data",
++ .offset = MTDPART_OFS_NXTBLK,
++ .size = MTDPART_SIZ_FULL,
++ },
++};
++
++
+diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-cap9adk.c linux-2.6.32/arch/arm/mach-at91/board-cap9adk.c
+--- linux-2.6.32-0rig/arch/arm/mach-at91/board-cap9adk.c 2009-12-13 10:32:25.000000000 +0100
++++ linux-2.6.32/arch/arm/mach-at91/board-cap9adk.c 2009-12-13 11:35:57.000000000 +0100
+@@ -47,7 +47,7 @@
+
+ #include "sam9_smc.h"
+ #include "generic.h"
+-
++#include "at91_nand_partitions.h"
+
+ static void __init cap9adk_map_io(void)
+ {
+@@ -162,22 +162,10 @@
+ .is_rmii = 1,
+ };
+
+-
+-/*
+- * NAND flash
+- */
+-static struct mtd_partition __initdata cap9adk_nand_partitions[] = {
+- {
+- .name = "NAND partition",
+- .offset = 0,
+- .size = MTDPART_SIZ_FULL,
+- },
+-};
+-
+ static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
+ {
+- *num_partitions = ARRAY_SIZE(cap9adk_nand_partitions);
+- return cap9adk_nand_partitions;
++ *num_partitions = ARRAY_SIZE(at91_nand_partition);
++ return at91_nand_partition;
+ }
+
+ static struct atmel_nand_data __initdata cap9adk_nand_data = {
+diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9260ek.c linux-2.6.32/arch/arm/mach-at91/board-sam9260ek.c
+--- linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9260ek.c 2009-12-13 10:32:25.000000000 +0100
++++ linux-2.6.32/arch/arm/mach-at91/board-sam9260ek.c 2009-12-13 11:35:21.000000000 +0100
+@@ -47,6 +47,7 @@
+
+ #include "sam9_smc.h"
+ #include "generic.h"
++#include "at91_nand_partitions.h"
+
+
+ static void __init ek_map_io(void)
+@@ -161,27 +162,10 @@
+ .is_rmii = 1,
+ };
+
+-
+-/*
+- * NAND flash
+- */
+-static struct mtd_partition __initdata ek_nand_partition[] = {
+- {
+- .name = "Partition 1",
+- .offset = 0,
+- .size = SZ_256K,
+- },
+- {
+- .name = "Partition 2",
+- .offset = MTDPART_OFS_NXTBLK,
+- .size = MTDPART_SIZ_FULL,
+- },
+-};
+-
+ static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
+ {
+- *num_partitions = ARRAY_SIZE(ek_nand_partition);
+- return ek_nand_partition;
++ *num_partitions = ARRAY_SIZE(at91_nand_partition);
++ return at91_nand_partition;
+ }
+
+ static struct atmel_nand_data __initdata ek_nand_data = {
+diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9261ek.c linux-2.6.32/arch/arm/mach-at91/board-sam9261ek.c
+--- linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9261ek.c 2009-12-13 10:32:25.000000000 +0100
++++ linux-2.6.32/arch/arm/mach-at91/board-sam9261ek.c 2009-12-13 11:35:13.000000000 +0100
+@@ -51,6 +51,7 @@
+
+ #include "sam9_smc.h"
+ #include "generic.h"
++#include "at91_nand_partitions.h"
+
+
+ static void __init ek_map_io(void)
+@@ -177,27 +178,10 @@
+ // .vcc_pin = ... not connected
+ };
+
+-
+-/*
+- * NAND flash
+- */
+-static struct mtd_partition __initdata ek_nand_partition[] = {
+- {
+- .name = "Partition 1",
+- .offset = 0,
+- .size = SZ_256K,
+- },
+- {
+- .name = "Partition 2",
+- .offset = MTDPART_OFS_NXTBLK,
+- .size = MTDPART_SIZ_FULL,
+- },
+-};
+-
+ static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
+ {
+- *num_partitions = ARRAY_SIZE(ek_nand_partition);
+- return ek_nand_partition;
++ *num_partitions = ARRAY_SIZE(at91_nand_partition);
++ return at91_nand_partition;
+ }
+
+ static struct atmel_nand_data __initdata ek_nand_data = {
+diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9263ek.c linux-2.6.32/arch/arm/mach-at91/board-sam9263ek.c
+--- linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9263ek.c 2009-12-13 10:32:25.000000000 +0100
++++ linux-2.6.32/arch/arm/mach-at91/board-sam9263ek.c 2009-12-13 11:34:43.000000000 +0100
+@@ -50,6 +50,7 @@
+
+ #include "sam9_smc.h"
+ #include "generic.h"
++#include "at91_nand_partitions.h"
+
+
+ static void __init ek_map_io(void)
+@@ -168,27 +169,10 @@
+ .is_rmii = 1,
+ };
+
+-
+-/*
+- * NAND flash
+- */
+-static struct mtd_partition __initdata ek_nand_partition[] = {
+- {
+- .name = "Partition 1",
+- .offset = 0,
+- .size = SZ_64M,
+- },
+- {
+- .name = "Partition 2",
+- .offset = MTDPART_OFS_NXTBLK,
+- .size = MTDPART_SIZ_FULL,
+- },
+-};
+-
+ static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
+ {
+- *num_partitions = ARRAY_SIZE(ek_nand_partition);
+- return ek_nand_partition;
++ *num_partitions = ARRAY_SIZE(at91_nand_partition);
++ return at91_nand_partition;
+ }
+
+ static struct atmel_nand_data __initdata ek_nand_data = {
+diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c linux-2.6.32/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c
+--- linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c 2009-12-13 10:32:25.000000000 +0100
++++ linux-2.6.32/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c 2009-12-13 11:35:44.000000000 +0100
+@@ -42,6 +42,7 @@
+
+ #include "sam9_smc.h"
+ #include "generic.h"
++#include "at91_nand_partitions.h"
+
+
+ static void __init ek_map_io(void)
+@@ -117,32 +118,10 @@
+ .is_rmii = 1,
+ };
+
+-
+-/*
+- * NAND flash
+- */
+-static struct mtd_partition __initdata ek_nand_partition[] = {
+- {
+- .name = "Bootstrap",
+- .offset = 0,
+- .size = 4 * SZ_1M,
+- },
+- {
+- .name = "Partition 1",
+- .offset = MTDPART_OFS_NXTBLK,
+- .size = 60 * SZ_1M,
+- },
+- {
+- .name = "Partition 2",
+- .offset = MTDPART_OFS_NXTBLK,
+- .size = MTDPART_SIZ_FULL,
+- },
+-};
+-
+ static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
+ {
+- *num_partitions = ARRAY_SIZE(ek_nand_partition);
+- return ek_nand_partition;
++ *num_partitions = ARRAY_SIZE(at91_nand_partition);
++ return at91_nand_partition;
+ }
+
+ /* det_pin is not connected */
+diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9g20ek.c linux-2.6.32/arch/arm/mach-at91/board-sam9g20ek.c
+--- linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9g20ek.c 2009-12-13 10:32:25.000000000 +0100
++++ linux-2.6.32/arch/arm/mach-at91/board-sam9g20ek.c 2009-12-13 11:35:50.000000000 +0100
+@@ -43,6 +43,7 @@
+
+ #include "sam9_smc.h"
+ #include "generic.h"
++#include "at91_nand_partitions.h"
+
+
+ static void __init ek_map_io(void)
+@@ -118,32 +119,10 @@
+ .is_rmii = 1,
+ };
+
+-
+-/*
+- * NAND flash
+- */
+-static struct mtd_partition __initdata ek_nand_partition[] = {
+- {
+- .name = "Bootstrap",
+- .offset = 0,
+- .size = 4 * SZ_1M,
+- },
+- {
+- .name = "Partition 1",
+- .offset = MTDPART_OFS_NXTBLK,
+- .size = 60 * SZ_1M,
+- },
+- {
+- .name = "Partition 2",
+- .offset = MTDPART_OFS_NXTBLK,
+- .size = MTDPART_SIZ_FULL,
+- },
+-};
+-
+ static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
+ {
+- *num_partitions = ARRAY_SIZE(ek_nand_partition);
+- return ek_nand_partition;
++ *num_partitions = ARRAY_SIZE(at91_nand_partition);
++ return at91_nand_partition;
+ }
+
+ /* det_pin is not connected */
+diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9m10g45ek.c linux-2.6.32/arch/arm/mach-at91/board-sam9m10g45ek.c
+--- linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9m10g45ek.c 2009-12-13 10:32:25.000000000 +0100
++++ linux-2.6.32/arch/arm/mach-at91/board-sam9m10g45ek.c 2009-12-13 11:35:37.000000000 +0100
+@@ -44,6 +44,7 @@
+
+ #include "sam9_smc.h"
+ #include "generic.h"
++#include "at91_nand_partitions.h"
+
+
+ static void __init ek_map_io(void)
+@@ -106,27 +107,10 @@
+ .is_rmii = 1,
+ };
+
+-
+-/*
+- * NAND flash
+- */
+-static struct mtd_partition __initdata ek_nand_partition[] = {
+- {
+- .name = "Partition 1",
+- .offset = 0,
+- .size = SZ_64M,
+- },
+- {
+- .name = "Partition 2",
+- .offset = MTDPART_OFS_NXTBLK,
+- .size = MTDPART_SIZ_FULL,
+- },
+-};
+-
+ static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
+ {
+- *num_partitions = ARRAY_SIZE(ek_nand_partition);
+- return ek_nand_partition;
++ *num_partitions = ARRAY_SIZE(at91_nand_partition);
++ return at91_nand_partition;
+ }
+
+ /* det_pin is not connected */
+diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9rlek.c linux-2.6.32/arch/arm/mach-at91/board-sam9rlek.c
+--- linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9rlek.c 2009-12-13 10:32:25.000000000 +0100
++++ linux-2.6.32/arch/arm/mach-at91/board-sam9rlek.c 2009-12-13 11:35:27.000000000 +0100
+@@ -36,6 +36,7 @@
+
+ #include "sam9_smc.h"
+ #include "generic.h"
++#include "at91_nand_partitions.h"
+
+
+ static void __init ek_map_io(void)
+@@ -77,27 +78,10 @@
+ // .vcc_pin = ... not connected
+ };
+
+-
+-/*
+- * NAND flash
+- */
+-static struct mtd_partition __initdata ek_nand_partition[] = {
+- {
+- .name = "Partition 1",
+- .offset = 0,
+- .size = SZ_256K,
+- },
+- {
+- .name = "Partition 2",
+- .offset = MTDPART_OFS_NXTBLK,
+- .size = MTDPART_SIZ_FULL,
+- },
+-};
+-
+ static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
+ {
+- *num_partitions = ARRAY_SIZE(ek_nand_partition);
+- return ek_nand_partition;
++ *num_partitions = ARRAY_SIZE(at91_nand_partition);
++ return at91_nand_partition;
+ }
+
+ static struct atmel_nand_data __initdata ek_nand_data = {
+diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/Kconfig linux-2.6.32/arch/arm/mach-at91/Kconfig
+--- linux-2.6.32-0rig/arch/arm/mach-at91/Kconfig 2009-12-13 10:32:25.000000000 +0100
++++ linux-2.6.32/arch/arm/mach-at91/Kconfig 2009-12-13 11:01:29.000000000 +0100
+@@ -183,6 +183,7 @@
+ config MACH_AT91SAM9260EK
+ bool "Atmel AT91SAM9260-EK / AT91SAM9XE Evaluation Kit"
+ depends on ARCH_AT91SAM9260
++ select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
+ help
+ Select this if you are using Atmel's AT91SAM9260-EK or AT91SAM9XE Evaluation Kit
+ <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3933>
+@@ -242,6 +243,7 @@
+ config MACH_AT91SAM9261EK
+ bool "Atmel AT91SAM9261-EK Evaluation Kit"
+ depends on ARCH_AT91SAM9261
++ select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
+ help
+ Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit.
+ <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3820>
+@@ -257,6 +259,7 @@
+ config MACH_AT91SAM9G10EK
+ bool "Atmel AT91SAM9G10-EK Evaluation Kit"
+ depends on ARCH_AT91SAM9G10
++ select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
+ help
+ Select this if you are using Atmel's AT91SAM9G10-EK Evaluation Kit.
+ <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4588>
+@@ -272,6 +275,7 @@
+ config MACH_AT91SAM9263EK
+ bool "Atmel AT91SAM9263-EK Evaluation Kit"
+ depends on ARCH_AT91SAM9263
++ select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
+ help
+ Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit.
+ <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057>
+@@ -300,6 +304,7 @@
+ config MACH_AT91SAM9RLEK
+ bool "Atmel AT91SAM9RL-EK Evaluation Kit"
+ depends on ARCH_AT91SAM9RL
++ select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
+ help
+ Select this if you are using Atmel's AT91SAM9RL-EK Evaluation Kit.
+
+@@ -314,6 +319,7 @@
+ config MACH_AT91SAM9G20EK
+ bool "Atmel AT91SAM9G20-EK Evaluation Kit"
+ depends on ARCH_AT91SAM9G20
++ select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
+ help
+ Select this if you are using Atmel's AT91SAM9G20-EK Evaluation Kit
+ that embeds only one SD/MMC slot.
+@@ -321,6 +327,7 @@
+ config MACH_AT91SAM9G20EK_2MMC
+ bool "Atmel AT91SAM9G20-EK Evaluation Kit with 2 SD/MMC Slots"
+ depends on ARCH_AT91SAM9G20
++ select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
+ help
+ Select this if you are using an Atmel AT91SAM9G20-EK Evaluation Kit
+ with 2 SD/MMC Slots. This is the case for AT91SAM9G20-EK rev. C and
+@@ -344,6 +351,7 @@
+ config MACH_AT91SAM9G45EKES
+ bool "Atmel AT91SAM9G45-EKES Evaluation Kit"
+ depends on ARCH_AT91SAM9G45
++ select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
+ help
+ Select this if you are using Atmel's AT91SAM9G45-EKES Evaluation Kit.
+ "ES" at the end of the name means that this board is an
+@@ -360,6 +368,7 @@
+ config MACH_AT91CAP9ADK
+ bool "Atmel AT91CAP9A-DK Evaluation Kit"
+ depends on ARCH_AT91CAP9
++ select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
+ help
+ Select this if you are using Atmel's AT91CAP9A-DK Evaluation Kit.
+ <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4138>
+@@ -399,6 +408,24 @@
+ On AT91SAM926x boards both types of NAND flash can be present
+ (8 and 16 bit data bus width).
+
++config MTD_NAND_ATMEL_ROOTFS_SIZE
++ int "Size NAND rootfs in MB"
++ range 8 250
++ depends on MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
++ default "124"
++ help
++ Many Atmel development boards has a NAND Flash,
++ divided into three partitions.
++ 1) Boot partition (4 MB)
++ 2) Root FS
++ 3) Data partition
++ This allows you to configure the size of the root fs
++ with the remainder ending up in the data partition.
++ The legal values are between 8 and 250
++
++config MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
++ bool
++
+ # ----------------------------------------------------------
+
+ comment "AT91 Feature Selections"
diff --git a/recipes/linux/linux-2.6.32/at91/linux-2.6.32-002-sam9g20-proper-reset.patch b/recipes/linux/linux-2.6.32/at91/linux-2.6.32-002-sam9g20-proper-reset.patch
new file mode 100644
index 0000000000..fb230cabab
--- /dev/null
+++ b/recipes/linux/linux-2.6.32/at91/linux-2.6.32-002-sam9g20-proper-reset.patch
@@ -0,0 +1,103 @@
+Fix AT91SAM9G20 reset as per the errata in the data sheet.
+
+If the SDRAM is not cleanly shutdown before reset it can be left driving
+the bus, which then stops the bootloader booting from NAND.
+
+Signed-off-by: Peter Horton <phorton@bitbox.co.uk>
+--
+
+Index: linux-2.6.32/arch/arm/mach-at91/Makefile
+===================================================================
+--- linux-2.6.32.orig/arch/arm/mach-at91/Makefile 2009-12-15 09:53:27.000000000 +0000
++++ linux-2.6.32/arch/arm/mach-at91/Makefile 2009-12-15 09:53:27.000000000 +0000
+@@ -16,7 +16,7 @@
+ obj-$(CONFIG_ARCH_AT91SAM9G10) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o sam9_smc.o
+ obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o sam9_smc.o
+ obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o sam9_smc.o
+-obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o
++obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o at91sam9g20_reset.o
+ obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45.o at91sam926x_time.o at91sam9g45_devices.o sam9_smc.o
+ obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o sam9_smc.o
+ obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o
+Index: linux-2.6.32/arch/arm/mach-at91/at91sam9260.c
+===================================================================
+--- linux-2.6.32.orig/arch/arm/mach-at91/at91sam9260.c 2009-12-03 03:51:21.000000000 +0000
++++ linux-2.6.32/arch/arm/mach-at91/at91sam9260.c 2009-12-15 09:53:27.000000000 +0000
+@@ -25,6 +25,8 @@
+ #include "generic.h"
+ #include "clock.h"
+
++extern void at91sam9g20_reset(void);
++
+ static struct map_desc at91sam9260_io_desc[] __initdata = {
+ {
+ .virtual = AT91_VA_BASE_SYS,
+@@ -327,7 +329,11 @@
+ else
+ iotable_init(at91sam9260_sram_desc, ARRAY_SIZE(at91sam9260_sram_desc));
+
+- at91_arch_reset = at91sam9260_reset;
++ if (cpu_is_at91sam9g20())
++ at91_arch_reset = at91sam9g20_reset;
++ else
++ at91_arch_reset = at91sam9260_reset;
++
+ pm_power_off = at91sam9260_poweroff;
+ at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
+ | (1 << AT91SAM9260_ID_IRQ2);
+Index: linux-2.6.32/arch/arm/mach-at91/at91sam9g20_reset.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.32/arch/arm/mach-at91/at91sam9g20_reset.S 2009-12-15 09:55:17.000000000 +0000
+@@ -0,0 +1,50 @@
++/*
++ * (C) BitBox Ltd 2009
++ *
++ * reset AT91SAM9G20 as per errata
++ *
++ * unless the SDRAM is cleanly shutdown before we hit the
++ * reset register it can be left driving the data bus and
++ * killing the chance of a subsequent boot from NAND
++ */
++
++#define CP15_CR_I (1 << 12)
++
++#define SYS_VIRT_OFS (-0x01000000)
++
++#define SDRAMC_BASE (SYS_VIRT_OFS + 0xffffea00)
++#define SDRAMC_TR 0x0004
++#define SDRAMC_LPR 0x0010
++#define SDRAMC_LPCB_POWER_DOWN 2
++
++#define RSTC_BASE (SYS_VIRT_OFS + 0xfffffd00)
++#define RSTC_CR 0x0000
++#define RSTC_PROCRST (1 << 0)
++#define RSTC_PERRST (1 << 2)
++#define RSTC_KEY (0xa5 << 24)
++
++ .arm
++
++ .globl at91sam9g20_reset
++
++at91sam9g20_reset: mov r0, #0
++ mcr p15, 0, r0, c7, c5, 0 @ flush I-cache
++
++ mrc p15, 0, r0, c1, c0, 0
++ orr r0, r0, #CP15_CR_I
++ mcr p15, 0, r0, c1, c0, 0 @ enable I-cache
++
++ ldr r0, =SDRAMC_BASE @ preload constants
++ ldr r1, =RSTC_BASE
++
++ mov r2, #1
++ mov r3, #SDRAMC_LPCB_POWER_DOWN
++ ldr r4, =RSTC_KEY | RSTC_PERRST | RSTC_PROCRST
++
++ .balign 32 @ align to cache line
++
++ str r2, [r0, #SDRAMC_TR] @ disable SDRAM access
++ str r3, [r0, #SDRAMC_LPR] @ power down SDRAM
++ str r4, [r1, #RSTC_CR] @ reset processor
++
++ b .
+