Blackfin arch: add board resources for parallel flash on cm-bf537
authorMike Frysinger <vapier.adi@gmail.com>
Tue, 5 Aug 2008 10:14:44 +0000 (18:14 +0800)
committerBryan Wu <cooloney@kernel.org>
Tue, 5 Aug 2008 10:14:44 +0000 (18:14 +0800)
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
arch/blackfin/mach-bf537/boards/cm_bf537.c

index cb73ed5..fa6064f 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/platform_device.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/mtd/physmap.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/flash.h>
 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
@@ -307,6 +308,55 @@ static struct platform_device net2272_bfin_device = {
 };
 #endif
 
+#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
+static struct mtd_partition cm_partitions[] = {
+       {
+               .name   = "bootloader(nor)",
+               .size   = 0x40000,
+               .offset = 0,
+       }, {
+               .name   = "linux kernel(nor)",
+               .size   = 0xE0000,
+               .offset = MTDPART_OFS_APPEND,
+       }, {
+               .name   = "file system(nor)",
+               .size   = MTDPART_SIZ_FULL,
+               .offset = MTDPART_OFS_APPEND,
+       }
+};
+
+static struct physmap_flash_data cm_flash_data = {
+       .width    = 2,
+       .parts    = cm_partitions,
+       .nr_parts = ARRAY_SIZE(cm_partitions),
+};
+
+static unsigned cm_flash_gpios[] = { GPIO_PF4 };
+
+static struct resource cm_flash_resource[] = {
+       {
+               .name  = "cfi_probe",
+               .start = 0x20000000,
+               .end   = 0x201fffff,
+               .flags = IORESOURCE_MEM,
+       }, {
+               .start = (unsigned long)cm_flash_gpios,
+               .end   = ARRAY_SIZE(cm_flash_gpios),
+               .flags = IORESOURCE_IRQ,
+       }
+};
+
+static struct platform_device cm_flash_device = {
+       .name          = "gpio-addr-flash",
+       .id            = 0,
+       .dev = {
+               .platform_data = &cm_flash_data,
+       },
+       .num_resources = ARRAY_SIZE(cm_flash_resource),
+       .resource      = cm_flash_resource,
+};
+#endif
+
 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
 static struct resource bfin_uart_resources[] = {
        {
@@ -510,6 +560,10 @@ static struct platform_device *cm_bf537_devices[] __initdata = {
 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
        &bfin_pata_device,
 #endif
+
+#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
+       &cm_flash_device,
+#endif
 };
 
 static int __init cm_bf537_init(void)