PRCM: OMAP3: Fix to wrongly modified omap2_clk_wait_ready
[linux-ginger.git] / arch / arm / mach-omap2 / board-omap3evm-flash.c
blob109d8f22abdb241e327cef6185784f1cd4bf34f7
1 /*
2 * board-omap3evm-flash.c
4 * Copyright (c) 2008 Texas Instruments,
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
11 #include <linux/kernel.h>
12 #include <linux/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/mtd/nand.h>
16 #include <linux/mtd/onenand_regs.h>
17 #include <linux/types.h>
18 #include <linux/io.h>
20 #include <asm/mach/flash.h>
21 #include <asm/arch/onenand.h>
22 #include <asm/arch/board.h>
23 #include <asm/arch/gpmc.h>
24 #include <asm/arch/nand.h>
26 static int omap3evm_onenand_setup(void __iomem *);
28 static struct mtd_partition omap3evm_onenand_partitions[] = {
30 .name = "xloader",
31 .offset = 0,
32 .size = 4*(64*2048),
33 .mask_flags = MTD_WRITEABLE
36 .name = "uboot",
37 .offset = MTDPART_OFS_APPEND,
38 .size = 15*(64*2048),
39 .mask_flags = MTD_WRITEABLE
42 .name = "params",
43 .offset = MTDPART_OFS_APPEND,
44 .size = 1*(64*2048),
47 .name = "linux",
48 .offset = MTDPART_OFS_APPEND,
49 .size = 40*(64*2048),
52 .name = "jffs2",
53 .offset = MTDPART_OFS_APPEND,
54 .size = MTDPART_SIZ_FULL,
58 static struct omap_onenand_platform_data omap3evm_onenand_data = {
59 .parts = omap3evm_onenand_partitions,
60 .nr_parts = ARRAY_SIZE(omap3evm_onenand_partitions),
61 .onenand_setup = omap3evm_onenand_setup,
62 .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */
65 static struct platform_device omap3evm_onenand_device = {
66 .name = "omap2-onenand",
67 .id = -1,
68 .dev = {
69 .platform_data = &omap3evm_onenand_data,
74 * omap3evm_onenand_setup - Set the onenand sync mode
75 * @onenand_base: The onenand base address in GPMC memory map
79 static int omap3evm_onenand_setup(void __iomem *onenand_base)
81 /* nothing is required to be setup for onenand as of now */
82 return 0;
85 void __init omap3evm_flash_init(void)
87 u8 cs = 0;
88 u8 onenandcs = GPMC_CS_NUM + 1;
90 while (cs < GPMC_CS_NUM) {
91 u32 ret = 0;
92 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
95 * xloader/Uboot would have programmed the oneNAND
96 * base address for us This is a ugly hack. The proper
97 * way of doing this is to pass the setup of u-boot up
98 * to kernel using kernel params - something on the
99 * lines of machineID. Check if oneNAND is configured
101 if ((ret & 0x3F) == (ONENAND_MAP >> 24))
102 onenandcs = cs;
103 cs++;
105 if (onenandcs > GPMC_CS_NUM) {
106 printk(KERN_INFO "OneNAND: Unable to find configuration "
107 " in GPMC\n ");
108 return;
111 if (onenandcs < GPMC_CS_NUM) {
112 omap3evm_onenand_data.cs = onenandcs;
113 if (platform_device_register(&omap3evm_onenand_device) < 0)
114 printk(KERN_ERR "Unable to register OneNAND device\n");