]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
sh: kfr2r09 board support - NAND flash
authorMagnus Damm <damm@igel.co.jp>
Thu, 6 Aug 2009 14:58:43 +0000 (14:58 +0000)
committerPaul Mundt <lethal@linux-sh.org>
Thu, 6 Aug 2009 18:55:32 +0000 (03:55 +0900)
This patch adds support for the NAND flash chip
attached to CS4 on the KFR2R09 board. The device is
driven by the platform device driver "onenand-flash".

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/boards/mach-kfr2r09/setup.c

index 135508040907163a6cb28d65650790fd007d9084..bdb10c29ef1827c5f4d40021f7a1a14c4ac0e6ec 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/mtd/physmap.h>
+#include <linux/mtd/onenand.h>
 #include <linux/delay.h>
 #include <linux/clk.h>
 #include <linux/gpio.h>
@@ -62,6 +63,21 @@ static struct platform_device kfr2r09_nor_flash_device = {
        },
 };
 
+static struct resource kfr2r09_nand_flash_resources[] = {
+       [0] = {
+               .name           = "NAND Flash",
+               .start          = 0x10000000,
+               .end            = 0x1001ffff,
+               .flags          = IORESOURCE_MEM,
+       }
+};
+
+static struct platform_device kfr2r09_nand_flash_device = {
+       .name           = "onenand-flash",
+       .resource       = kfr2r09_nand_flash_resources,
+       .num_resources  = ARRAY_SIZE(kfr2r09_nand_flash_resources),
+};
+
 static struct sh_keysc_info kfr2r09_sh_keysc_info = {
        .mode = SH_KEYSC_MODE_1, /* KEYOUT0->4, KEYIN0->4 */
        .scan_timing = 3,
@@ -161,12 +177,15 @@ static struct platform_device kfr2r09_sh_lcdc_device = {
 
 static struct platform_device *kfr2r09_devices[] __initdata = {
        &kfr2r09_nor_flash_device,
+       &kfr2r09_nand_flash_device,
        &kfr2r09_sh_keysc_device,
        &kfr2r09_sh_lcdc_device,
 };
 
 #define BSC_CS0BCR 0xfec10004
 #define BSC_CS0WCR 0xfec10024
+#define BSC_CS4BCR 0xfec10010
+#define BSC_CS4WCR 0xfec10030
 
 static int __init kfr2r09_devices_setup(void)
 {
@@ -178,6 +197,10 @@ static int __init kfr2r09_devices_setup(void)
        ctrl_outl(0x36db0400, BSC_CS0BCR);
        ctrl_outl(0x00000500, BSC_CS0WCR);
 
+       /* setup NAND flash at CS4 */
+       ctrl_outl(0x36db0400, BSC_CS4BCR);
+       ctrl_outl(0x00000500, BSC_CS4WCR);
+
        /* setup KEYSC pins */
        gpio_request(GPIO_FN_KEYOUT0, NULL);
        gpio_request(GPIO_FN_KEYOUT1, NULL);