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>
14 #include <asm/machdep.h>
16 #ifdef CONFIG_MTD_NAND_NDFC
18 #define CS_NAND_0 1 /* use chip select 1 for NAND device 0 */
20 #define WARP_NAND_FLASH_REG_ADDR 0xD0000000UL
21 #define WARP_NAND_FLASH_REG_SIZE 0x2000
23 static struct resource warp_ndfc = {
24 .start = WARP_NAND_FLASH_REG_ADDR,
25 .end = WARP_NAND_FLASH_REG_ADDR + WARP_NAND_FLASH_REG_SIZE,
26 .flags = IORESOURCE_MEM,
29 static struct mtd_partition nand_parts[] = {
47 struct ndfc_controller_settings warp_ndfc_settings = {
48 .ccr_settings = (NDFC_CCR_BS(CS_NAND_0) | NDFC_CCR_ARAC1),
52 static struct ndfc_chip_settings warp_chip0_settings = {
53 .bank_settings = 0x80002222,
56 struct platform_nand_ctrl warp_nand_ctrl = {
57 .priv = &warp_ndfc_settings,
60 static struct platform_device warp_ndfc_device = {
64 .platform_data = &warp_nand_ctrl,
67 .resource = &warp_ndfc,
70 static struct nand_ecclayout nand_oob_16 = {
72 .eccpos = { 0, 1, 2, 3, 6, 7 },
73 .oobfree = { {.offset = 8, .length = 16} }
76 static struct platform_nand_chip warp_nand_chip0 = {
78 .chip_offset = CS_NAND_0,
79 .nr_partitions = ARRAY_SIZE(nand_parts),
80 .partitions = nand_parts,
82 .ecclayout = &nand_oob_16,
83 .priv = &warp_chip0_settings,
86 static struct platform_device warp_nand_device = {
90 .resource = &warp_ndfc,
92 .platform_data = &warp_nand_chip0,
93 .parent = &warp_ndfc_device.dev,
97 static int warp_setup_nand_flash(void)
99 platform_device_register(&warp_ndfc_device);
100 platform_device_register(&warp_nand_device);
104 machine_device_initcall(warp, warp_setup_nand_flash);