[-mm patch 4/4] AVR32 MTD: AT49BV6416 platform device for atstk1000

Haavard Skinnemoen hskinnemoen at atmel.com
Thu Sep 14 10:34:21 EDT 2006


Register a platform device for the AT49BV6416 NOR flash chip on the
ATSTK1000 development board for use by the ATSTK1000 MTD map driver.

Signed-off-by: Haavard Skinnemoen <hskinnemoen at atmel.com>
---
 arch/avr32/boards/atstk1000/atstk1002.c |   46 ++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

Index: linux-2.6.18-rc5-mm1/arch/avr32/boards/atstk1000/atstk1002.c
===================================================================
--- linux-2.6.18-rc5-mm1.orig/arch/avr32/boards/atstk1000/atstk1002.c	2006-09-07 15:18:55.000000000 +0200
+++ linux-2.6.18-rc5-mm1/arch/avr32/boards/atstk1000/atstk1002.c	2006-09-07 15:21:18.000000000 +0200
@@ -8,6 +8,9 @@
  * published by the Free Software Foundation.
  */
 #include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
 
 #include <asm/arch/board.h>
 
@@ -20,6 +23,47 @@ struct eth_platform_data __initdata eth0
 
 extern struct lcdc_platform_data atstk1000_fb0_data;
 
+static struct mtd_partition flash_parts[] = {
+	{
+		.name           = "u-boot",
+		.offset         = 0x00000000,
+		.size           = 0x00020000,           /* 128 KiB */
+		.mask_flags     = MTD_WRITEABLE,
+	},
+	{
+		.name           = "root",
+		.offset         = 0x00020000,
+		.size           = 0x007d0000,
+	},
+	{
+		.name           = "env",
+		.offset         = 0x007f0000,
+		.size           = 0x00010000,
+		.mask_flags     = MTD_WRITEABLE,
+	},
+};
+
+static struct flash_platform_data flash_data = {
+	.nr_parts	= ARRAY_SIZE(flash_parts),
+	.parts		= flash_parts,
+};
+
+struct resource flash_resource = {
+	.start		= 0x00000000,
+	.end		= 0x007fffff,
+	.flags		= IORESOURCE_MEM,
+};
+
+struct platform_device flash_device = {
+	.name		= "atstk1000-flash",
+	.id		= 0,
+	.resource	= &flash_resource,
+	.num_resources	= 1,
+	.dev		= {
+		.platform_data = &flash_data,
+	},
+};
+
 static int __init atstk1002_init(void)
 {
 	at32_add_system_devices();
@@ -32,6 +76,8 @@ static int __init atstk1002_init(void)
 	at32_add_device_spi(0);
 	at32_add_device_lcdc(0, &atstk1000_fb0_data);
 
+	platform_device_register(&flash_device);
+
 	return 0;
 }
 postcore_initcall(atstk1002_init);




More information about the linux-mtd mailing list