2 * PIKA Warp(tm) NAND flash specific routines
4 * Copyright (c) 2008 PIKA Technologies
5 * Sean MacLennan <smaclennan@pikatech.com>
8 #include <linux/platform_device.h>
9 #include <linux/mtd/mtd.h>
10 #include <linux/mtd/map.h>
11 #include <linux/mtd/partitions.h>
12 #include <linux/mtd/nand.h>
13 #include <linux/mtd/ndfc.h>
15 #ifdef CONFIG_MTD_NAND_NDFC
17 #define CS_NAND_0 1 /* use chip select 1 for NAND device 0 */
19 #define WARP_NAND_FLASH_REG_ADDR 0xD0000000UL
20 #define WARP_NAND_FLASH_REG_SIZE 0x2000
22 static struct resource warp_ndfc
= {
23 .start
= WARP_NAND_FLASH_REG_ADDR
,
24 .end
= WARP_NAND_FLASH_REG_ADDR
+ WARP_NAND_FLASH_REG_SIZE
,
25 .flags
= IORESOURCE_MEM
,
28 static struct mtd_partition nand_parts
[] = {
46 struct ndfc_controller_settings warp_ndfc_settings
= {
47 .ccr_settings
= (NDFC_CCR_BS(CS_NAND_0
) | NDFC_CCR_ARAC1
),
51 static struct ndfc_chip_settings warp_chip0_settings
= {
52 .bank_settings
= 0x80002222,
55 struct platform_nand_ctrl warp_nand_ctrl
= {
56 .priv
= &warp_ndfc_settings
,
59 static struct platform_device warp_ndfc_device
= {
63 .platform_data
= &warp_nand_ctrl
,
66 .resource
= &warp_ndfc
,
69 static struct nand_ecclayout nand_oob_16
= {
71 .eccpos
= { 0, 1, 2, 3, 6, 7 },
72 .oobfree
= { {.offset
= 8, .length
= 16} }
75 static struct platform_nand_chip warp_nand_chip0
= {
77 .chip_offset
= CS_NAND_0
,
78 .nr_partitions
= ARRAY_SIZE(nand_parts
),
79 .partitions
= nand_parts
,
81 .ecclayout
= &nand_oob_16
,
82 .priv
= &warp_chip0_settings
,
85 static struct platform_device warp_nand_device
= {
89 .resource
= &warp_ndfc
,
91 .platform_data
= &warp_nand_chip0
,
92 .parent
= &warp_ndfc_device
.dev
,
96 static int warp_setup_nand_flash(void)
98 platform_device_register(&warp_ndfc_device
);
99 platform_device_register(&warp_nand_device
);
103 device_initcall(warp_setup_nand_flash
);