aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/board-flash.c')
-rw-r--r--arch/arm/mach-omap2/board-flash.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index ac834aa7abf6..729892fdcf2e 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * board-sdp-flash.c 2 * board-flash.c
3 * Modified from mach-omap2/board-3430sdp-flash.c 3 * Modified from mach-omap2/board-3430sdp-flash.c
4 * 4 *
5 * Copyright (C) 2009 Nokia Corporation 5 * Copyright (C) 2009 Nokia Corporation
@@ -16,12 +16,14 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/mtd/physmap.h> 17#include <linux/mtd/physmap.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <plat/irqs.h>
19 20
20#include <plat/gpmc.h> 21#include <plat/gpmc.h>
21#include <plat/nand.h> 22#include <plat/nand.h>
22#include <plat/onenand.h> 23#include <plat/onenand.h>
23#include <plat/tc.h> 24#include <plat/tc.h>
24#include <mach/board-flash.h> 25
26#include "board-flash.h"
25 27
26#define REG_FPGA_REV 0x10 28#define REG_FPGA_REV 0x10
27#define REG_FPGA_DIP_SWITCH_INPUT2 0x60 29#define REG_FPGA_DIP_SWITCH_INPUT2 0x60
@@ -72,11 +74,11 @@ __init board_nor_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs)
72 + FLASH_SIZE_SDPV1 - 1; 74 + FLASH_SIZE_SDPV1 - 1;
73 } 75 }
74 if (err < 0) { 76 if (err < 0) {
75 printk(KERN_ERR "NOR: Can't request GPMC CS\n"); 77 pr_err("NOR: Can't request GPMC CS\n");
76 return; 78 return;
77 } 79 }
78 if (platform_device_register(&board_nor_device) < 0) 80 if (platform_device_register(&board_nor_device) < 0)
79 printk(KERN_ERR "Unable to register NOR device\n"); 81 pr_err("Unable to register NOR device\n");
80} 82}
81 83
82#if defined(CONFIG_MTD_ONENAND_OMAP2) || \ 84#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
@@ -138,17 +140,21 @@ static struct omap_nand_platform_data board_nand_data = {
138}; 140};
139 141
140void 142void
141__init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs) 143__init board_nand_init(struct mtd_partition *nand_parts,
144 u8 nr_parts, u8 cs, int nand_type)
142{ 145{
143 board_nand_data.cs = cs; 146 board_nand_data.cs = cs;
144 board_nand_data.parts = nand_parts; 147 board_nand_data.parts = nand_parts;
145 board_nand_data.nr_parts = nr_parts; 148 board_nand_data.nr_parts = nr_parts;
149 board_nand_data.devsize = nand_type;
146 150
151 board_nand_data.ecc_opt = OMAP_ECC_HAMMING_CODE_DEFAULT;
152 board_nand_data.gpmc_irq = OMAP_GPMC_IRQ_BASE + cs;
147 gpmc_nand_init(&board_nand_data); 153 gpmc_nand_init(&board_nand_data);
148} 154}
149#else 155#else
150void 156void
151__init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs) 157__init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs, int nand_type)
152{ 158{
153} 159}
154#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ 160#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
@@ -188,12 +194,12 @@ unmap:
188} 194}
189 195
190/** 196/**
191 * sdp3430_flash_init - Identify devices connected to GPMC and register. 197 * board_flash_init - Identify devices connected to GPMC and register.
192 * 198 *
193 * @return - void. 199 * @return - void.
194 */ 200 */
195void board_flash_init(struct flash_partitions partition_info[], 201void board_flash_init(struct flash_partitions partition_info[],
196 char chip_sel_board[][GPMC_CS_NUM]) 202 char chip_sel_board[][GPMC_CS_NUM], int nand_type)
197{ 203{
198 u8 cs = 0; 204 u8 cs = 0;
199 u8 norcs = GPMC_CS_NUM + 1; 205 u8 norcs = GPMC_CS_NUM + 1;
@@ -207,7 +213,7 @@ void board_flash_init(struct flash_partitions partition_info[],
207 */ 213 */
208 idx = get_gpmc0_type(); 214 idx = get_gpmc0_type();
209 if (idx >= MAX_SUPPORTED_GPMC_CONFIG) { 215 if (idx >= MAX_SUPPORTED_GPMC_CONFIG) {
210 printk(KERN_ERR "%s: Invalid chip select: %d\n", __func__, cs); 216 pr_err("%s: Invalid chip select: %d\n", __func__, cs);
211 return; 217 return;
212 } 218 }
213 config_sel = (unsigned char *)(chip_sel_board[idx]); 219 config_sel = (unsigned char *)(chip_sel_board[idx]);
@@ -231,23 +237,20 @@ void board_flash_init(struct flash_partitions partition_info[],
231 } 237 }
232 238
233 if (norcs > GPMC_CS_NUM) 239 if (norcs > GPMC_CS_NUM)
234 printk(KERN_INFO "NOR: Unable to find configuration " 240 pr_err("NOR: Unable to find configuration in GPMC\n");
235 "in GPMC\n");
236 else 241 else
237 board_nor_init(partition_info[0].parts, 242 board_nor_init(partition_info[0].parts,
238 partition_info[0].nr_parts, norcs); 243 partition_info[0].nr_parts, norcs);
239 244
240 if (onenandcs > GPMC_CS_NUM) 245 if (onenandcs > GPMC_CS_NUM)
241 printk(KERN_INFO "OneNAND: Unable to find configuration " 246 pr_err("OneNAND: Unable to find configuration in GPMC\n");
242 "in GPMC\n");
243 else 247 else
244 board_onenand_init(partition_info[1].parts, 248 board_onenand_init(partition_info[1].parts,
245 partition_info[1].nr_parts, onenandcs); 249 partition_info[1].nr_parts, onenandcs);
246 250
247 if (nandcs > GPMC_CS_NUM) 251 if (nandcs > GPMC_CS_NUM)
248 printk(KERN_INFO "NAND: Unable to find configuration " 252 pr_err("NAND: Unable to find configuration in GPMC\n");
249 "in GPMC\n");
250 else 253 else
251 board_nand_init(partition_info[2].parts, 254 board_nand_init(partition_info[2].parts,
252 partition_info[2].nr_parts, nandcs); 255 partition_info[2].nr_parts, nandcs, nand_type);
253} 256}