blob: 8b6876c98ce1a320c793e7485c35d23bd3a5b923 [file] [log] [blame]
Juha Yrjolaaa62e902009-05-28 13:23:52 -07001/*
2 * linux/arch/arm/mach-omap2/gpmc-onenand.c
3 *
4 * Copyright (C) 2006 - 2009 Nokia Corporation
5 * Contacts: Juha Yrjola
6 * Tony Lindgren
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
Paul Gortmakerd44b28c2011-07-31 10:52:44 -040013#include <linux/string.h>
Juha Yrjolaaa62e902009-05-28 13:23:52 -070014#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/mtd/onenand_regs.h>
17#include <linux/io.h>
Arnd Bergmann22037472012-08-24 15:21:06 +020018#include <linux/platform_data/mtd-onenand-omap2.h>
Afzal Mohammed46376882012-06-05 10:11:48 +053019#include <linux/err.h>
Juha Yrjolaaa62e902009-05-28 13:23:52 -070020
21#include <asm/mach/flash.h>
22
Afzal Mohammed3ef5d002012-10-05 10:37:27 +053023#include "gpmc.h"
Tony Lindgrendbc04162012-08-31 10:59:07 -070024#include "soc.h"
Afzal Mohammedb6ab13e2012-09-29 10:32:42 +053025#include "gpmc-onenand.h"
Tony Lindgrendbc04162012-08-31 10:59:07 -070026
Afzal Mohammed681988b2012-08-30 12:53:23 -070027#define ONENAND_IO_SIZE SZ_128K
28
Afzal Mohammed46376882012-06-05 10:11:48 +053029#define ONENAND_FLAG_SYNCREAD (1 << 0)
30#define ONENAND_FLAG_SYNCWRITE (1 << 1)
31#define ONENAND_FLAG_HF (1 << 2)
32#define ONENAND_FLAG_VHF (1 << 3)
33
34static unsigned onenand_flags;
35static unsigned latency;
Afzal Mohammed46376882012-06-05 10:11:48 +053036
Juha Yrjolaaa62e902009-05-28 13:23:52 -070037static struct omap_onenand_platform_data *gpmc_onenand_data;
38
Afzal Mohammed681988b2012-08-30 12:53:23 -070039static struct resource gpmc_onenand_resource = {
40 .flags = IORESOURCE_MEM,
41};
42
Juha Yrjolaaa62e902009-05-28 13:23:52 -070043static struct platform_device gpmc_onenand_device = {
44 .name = "omap2-onenand",
45 .id = -1,
Afzal Mohammed681988b2012-08-30 12:53:23 -070046 .num_resources = 1,
47 .resource = &gpmc_onenand_resource,
Juha Yrjolaaa62e902009-05-28 13:23:52 -070048};
49
Jon Hunterc3be5b42013-02-21 13:46:22 -060050static struct gpmc_settings onenand_async = {
Jon Hunter3aef65e2013-02-21 12:42:22 -060051 .device_width = GPMC_DEVWIDTH_16BIT,
Jon Hunterc3be5b42013-02-21 13:46:22 -060052 .mux_add_data = GPMC_MUX_AD,
53};
54
55static struct gpmc_settings onenand_sync = {
56 .burst_read = true,
Jon Hunter3aef65e2013-02-21 12:42:22 -060057 .burst_wrap = true,
58 .burst_len = GPMC_BURST_16,
59 .device_width = GPMC_DEVWIDTH_16BIT,
Jon Hunterc3be5b42013-02-21 13:46:22 -060060 .mux_add_data = GPMC_MUX_AD,
Jon Hunter3aef65e2013-02-21 12:42:22 -060061 .wait_pin = 0,
Jon Hunterc3be5b42013-02-21 13:46:22 -060062};
63
Jon Hunterbe9f10c2013-02-21 15:20:53 -060064static void omap2_onenand_calc_async_timings(struct gpmc_timings *t)
Juha Yrjolaaa62e902009-05-28 13:23:52 -070065{
Afzal Mohammed4f4426f2012-11-09 18:05:17 +053066 struct gpmc_device_timings dev_t;
Juha Yrjolaaa62e902009-05-28 13:23:52 -070067 const int t_cer = 15;
68 const int t_avdp = 12;
69 const int t_aavdh = 7;
70 const int t_ce = 76;
71 const int t_aa = 76;
72 const int t_oe = 20;
73 const int t_cez = 20; /* max of t_cez, t_oez */
Juha Yrjolaaa62e902009-05-28 13:23:52 -070074 const int t_wpl = 40;
75 const int t_wph = 30;
76
Afzal Mohammed4f4426f2012-11-09 18:05:17 +053077 memset(&dev_t, 0, sizeof(dev_t));
Juha Yrjolaaa62e902009-05-28 13:23:52 -070078
Afzal Mohammed4f4426f2012-11-09 18:05:17 +053079 dev_t.t_avdp_r = max_t(int, t_avdp, t_cer) * 1000;
80 dev_t.t_avdp_w = dev_t.t_avdp_r;
81 dev_t.t_aavdh = t_aavdh * 1000;
82 dev_t.t_aa = t_aa * 1000;
83 dev_t.t_ce = t_ce * 1000;
84 dev_t.t_oe = t_oe * 1000;
85 dev_t.t_cez_r = t_cez * 1000;
86 dev_t.t_cez_w = dev_t.t_cez_r;
87 dev_t.t_wpl = t_wpl * 1000;
88 dev_t.t_wph = t_wph * 1000;
Juha Yrjolaaa62e902009-05-28 13:23:52 -070089
Jon Hunterc3be5b42013-02-21 13:46:22 -060090 gpmc_calc_timings(t, &onenand_async, &dev_t);
Afzal Mohammed46376882012-06-05 10:11:48 +053091}
92
Afzal Mohammed46376882012-06-05 10:11:48 +053093static void omap2_onenand_set_async_mode(void __iomem *onenand_base)
94{
95 u32 reg;
Adrian Hunter6d453e82009-06-23 13:30:24 +030096
97 /* Ensure sync read and sync write are disabled */
98 reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
99 reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE;
100 writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700101}
102
Afzal Mohammed46376882012-06-05 10:11:48 +0530103static void set_onenand_cfg(void __iomem *onenand_base)
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700104{
105 u32 reg;
106
107 reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
108 reg &= ~((0x7 << ONENAND_SYS_CFG1_BRL_SHIFT) | (0x7 << 9));
109 reg |= (latency << ONENAND_SYS_CFG1_BRL_SHIFT) |
110 ONENAND_SYS_CFG1_BL_16;
Afzal Mohammed46376882012-06-05 10:11:48 +0530111 if (onenand_flags & ONENAND_FLAG_SYNCREAD)
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700112 reg |= ONENAND_SYS_CFG1_SYNC_READ;
113 else
114 reg &= ~ONENAND_SYS_CFG1_SYNC_READ;
Afzal Mohammed46376882012-06-05 10:11:48 +0530115 if (onenand_flags & ONENAND_FLAG_SYNCWRITE)
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700116 reg |= ONENAND_SYS_CFG1_SYNC_WRITE;
117 else
118 reg &= ~ONENAND_SYS_CFG1_SYNC_WRITE;
Afzal Mohammed46376882012-06-05 10:11:48 +0530119 if (onenand_flags & ONENAND_FLAG_HF)
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700120 reg |= ONENAND_SYS_CFG1_HF;
121 else
122 reg &= ~ONENAND_SYS_CFG1_HF;
Afzal Mohammed46376882012-06-05 10:11:48 +0530123 if (onenand_flags & ONENAND_FLAG_VHF)
Adrian Hunter1435ca02011-02-07 10:46:58 +0200124 reg |= ONENAND_SYS_CFG1_VHF;
125 else
126 reg &= ~ONENAND_SYS_CFG1_VHF;
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700127 writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
128}
129
Adrian Hunter5714b7ed2011-02-07 10:47:00 +0200130static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
Jon Hunter757ef792012-06-28 13:41:29 -0500131 void __iomem *onenand_base)
Adrian Hunter5714b7ed2011-02-07 10:47:00 +0200132{
133 u16 ver = readw(onenand_base + ONENAND_REG_VERSION_ID);
Jon Hunter757ef792012-06-28 13:41:29 -0500134 int freq;
Adrian Hunter5714b7ed2011-02-07 10:47:00 +0200135
136 switch ((ver >> 4) & 0xf) {
137 case 0:
138 freq = 40;
139 break;
140 case 1:
141 freq = 54;
142 break;
143 case 2:
144 freq = 66;
145 break;
146 case 3:
147 freq = 83;
148 break;
149 case 4:
150 freq = 104;
151 break;
152 default:
153 freq = 54;
154 break;
155 }
156
157 return freq;
158}
159
Jon Hunterbe9f10c2013-02-21 15:20:53 -0600160static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t,
161 unsigned int flags,
162 int freq)
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700163{
Afzal Mohammed4f4426f2012-11-09 18:05:17 +0530164 struct gpmc_device_timings dev_t;
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700165 const int t_cer = 15;
166 const int t_avdp = 12;
167 const int t_cez = 20; /* max of t_cez, t_oez */
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700168 const int t_wpl = 40;
169 const int t_wph = 30;
170 int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo;
Afzal Mohammed4f4426f2012-11-09 18:05:17 +0530171 int div, gpmc_clk_ns;
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700172
Jon Hunterbe9f10c2013-02-21 15:20:53 -0600173 if (flags & ONENAND_SYNC_READ)
Afzal Mohammed46376882012-06-05 10:11:48 +0530174 onenand_flags = ONENAND_FLAG_SYNCREAD;
Jon Hunterbe9f10c2013-02-21 15:20:53 -0600175 else if (flags & ONENAND_SYNC_READWRITE)
Afzal Mohammed46376882012-06-05 10:11:48 +0530176 onenand_flags = ONENAND_FLAG_SYNCREAD | ONENAND_FLAG_SYNCWRITE;
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700177
178 switch (freq) {
Adrian Hunter49314452010-12-09 11:22:50 +0200179 case 104:
180 min_gpmc_clk_period = 9600; /* 104 MHz */
181 t_ces = 3;
182 t_avds = 4;
183 t_avdh = 2;
184 t_ach = 3;
185 t_aavdh = 6;
Adrian Hunter1435ca02011-02-07 10:46:58 +0200186 t_rdyo = 6;
Adrian Hunter49314452010-12-09 11:22:50 +0200187 break;
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700188 case 83:
Adrian Huntera3551f52010-12-09 10:48:27 +0200189 min_gpmc_clk_period = 12000; /* 83 MHz */
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700190 t_ces = 5;
191 t_avds = 4;
192 t_avdh = 2;
193 t_ach = 6;
194 t_aavdh = 6;
195 t_rdyo = 9;
196 break;
197 case 66:
Adrian Huntera3551f52010-12-09 10:48:27 +0200198 min_gpmc_clk_period = 15000; /* 66 MHz */
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700199 t_ces = 6;
200 t_avds = 5;
201 t_avdh = 2;
202 t_ach = 6;
203 t_aavdh = 6;
204 t_rdyo = 11;
205 break;
206 default:
Adrian Huntera3551f52010-12-09 10:48:27 +0200207 min_gpmc_clk_period = 18500; /* 54 MHz */
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700208 t_ces = 7;
209 t_avds = 7;
210 t_avdh = 7;
211 t_ach = 9;
212 t_aavdh = 7;
213 t_rdyo = 15;
Afzal Mohammed46376882012-06-05 10:11:48 +0530214 onenand_flags &= ~ONENAND_FLAG_SYNCWRITE;
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700215 break;
216 }
217
Afzal Mohammed1b47ca12012-08-19 18:29:45 +0530218 div = gpmc_calc_divider(min_gpmc_clk_period);
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700219 gpmc_clk_ns = gpmc_ticks_to_ns(div);
220 if (gpmc_clk_ns < 15) /* >66Mhz */
Afzal Mohammed46376882012-06-05 10:11:48 +0530221 onenand_flags |= ONENAND_FLAG_HF;
222 else
223 onenand_flags &= ~ONENAND_FLAG_HF;
Adrian Hunter1435ca02011-02-07 10:46:58 +0200224 if (gpmc_clk_ns < 12) /* >83Mhz */
Afzal Mohammed46376882012-06-05 10:11:48 +0530225 onenand_flags |= ONENAND_FLAG_VHF;
226 else
227 onenand_flags &= ~ONENAND_FLAG_VHF;
228 if (onenand_flags & ONENAND_FLAG_VHF)
Adrian Hunter1435ca02011-02-07 10:46:58 +0200229 latency = 8;
Afzal Mohammed46376882012-06-05 10:11:48 +0530230 else if (onenand_flags & ONENAND_FLAG_HF)
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700231 latency = 6;
232 else if (gpmc_clk_ns >= 25) /* 40 MHz*/
233 latency = 3;
234 else
235 latency = 4;
236
Afzal Mohammed46376882012-06-05 10:11:48 +0530237 /* Set synchronous read timings */
Afzal Mohammed4f4426f2012-11-09 18:05:17 +0530238 memset(&dev_t, 0, sizeof(dev_t));
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700239
Jon Hunter3aef65e2013-02-21 12:42:22 -0600240 if (onenand_flags & ONENAND_FLAG_SYNCREAD)
241 onenand_sync.sync_read = true;
Afzal Mohammed46376882012-06-05 10:11:48 +0530242 if (onenand_flags & ONENAND_FLAG_SYNCWRITE) {
Jon Hunterc3be5b42013-02-21 13:46:22 -0600243 onenand_sync.sync_write = true;
Jon Hunter3aef65e2013-02-21 12:42:22 -0600244 onenand_sync.burst_write = true;
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700245 } else {
Afzal Mohammed4f4426f2012-11-09 18:05:17 +0530246 dev_t.t_avdp_w = max(t_avdp, t_cer) * 1000;
247 dev_t.t_wpl = t_wpl * 1000;
248 dev_t.t_wph = t_wph * 1000;
249 dev_t.t_aavdh = t_aavdh * 1000;
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700250 }
Afzal Mohammed4f4426f2012-11-09 18:05:17 +0530251 dev_t.ce_xdelay = true;
252 dev_t.avd_xdelay = true;
253 dev_t.oe_xdelay = true;
254 dev_t.we_xdelay = true;
255 dev_t.clk = min_gpmc_clk_period;
256 dev_t.t_bacc = dev_t.clk;
257 dev_t.t_ces = t_ces * 1000;
258 dev_t.t_avds = t_avds * 1000;
259 dev_t.t_avdh = t_avdh * 1000;
260 dev_t.t_ach = t_ach * 1000;
261 dev_t.cyc_iaa = (latency + 1);
262 dev_t.t_cez_r = t_cez * 1000;
263 dev_t.t_cez_w = dev_t.t_cez_r;
264 dev_t.cyc_aavdh_oe = 1;
265 dev_t.t_rdyo = t_rdyo * 1000 + min_gpmc_clk_period;
266
Jon Hunterc3be5b42013-02-21 13:46:22 -0600267 gpmc_calc_timings(t, &onenand_sync, &dev_t);
Afzal Mohammed46376882012-06-05 10:11:48 +0530268}
269
Afzal Mohammed46376882012-06-05 10:11:48 +0530270static int omap2_onenand_setup_async(void __iomem *onenand_base)
271{
272 struct gpmc_timings t;
273 int ret;
274
Aaro Koskinen1dc1c332013-09-20 23:01:06 +0300275 if (gpmc_onenand_data->of_node) {
Jon Hunter32cde0b2013-02-25 11:37:58 -0600276 gpmc_read_settings_dt(gpmc_onenand_data->of_node,
277 &onenand_async);
Aaro Koskinen1dc1c332013-09-20 23:01:06 +0300278 if (onenand_async.sync_read || onenand_async.sync_write) {
279 if (onenand_async.sync_write)
280 gpmc_onenand_data->flags |=
281 ONENAND_SYNC_READWRITE;
282 else
283 gpmc_onenand_data->flags |= ONENAND_SYNC_READ;
284 onenand_async.sync_read = false;
285 onenand_async.sync_write = false;
286 }
287 }
Jon Hunter32cde0b2013-02-25 11:37:58 -0600288
Afzal Mohammed46376882012-06-05 10:11:48 +0530289 omap2_onenand_set_async_mode(onenand_base);
290
Jon Hunterbe9f10c2013-02-21 15:20:53 -0600291 omap2_onenand_calc_async_timings(&t);
Afzal Mohammed46376882012-06-05 10:11:48 +0530292
Jon Hunter3aef65e2013-02-21 12:42:22 -0600293 ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_async);
294 if (ret < 0)
295 return ret;
296
297 ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t);
Russell King71856842013-03-13 20:44:21 +0000298 if (ret < 0)
Afzal Mohammed46376882012-06-05 10:11:48 +0530299 return ret;
300
301 omap2_onenand_set_async_mode(onenand_base);
302
303 return 0;
304}
305
306static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr)
307{
308 int ret, freq = *freq_ptr;
309 struct gpmc_timings t;
Afzal Mohammed46376882012-06-05 10:11:48 +0530310
311 if (!freq) {
312 /* Very first call freq is not known */
Jon Hunter757ef792012-06-28 13:41:29 -0500313 freq = omap2_onenand_get_freq(gpmc_onenand_data, onenand_base);
Afzal Mohammed46376882012-06-05 10:11:48 +0530314 set_onenand_cfg(onenand_base);
315 }
316
Jon Hunter32cde0b2013-02-25 11:37:58 -0600317 if (gpmc_onenand_data->of_node) {
318 gpmc_read_settings_dt(gpmc_onenand_data->of_node,
319 &onenand_sync);
320 } else {
321 /*
322 * FIXME: Appears to be legacy code from initial ONENAND commit.
323 * Unclear what boards this is for and if this can be removed.
324 */
325 if (!cpu_is_omap34xx())
326 onenand_sync.wait_on_read = true;
327 }
Jon Hunter3aef65e2013-02-21 12:42:22 -0600328
Jon Hunterbe9f10c2013-02-21 15:20:53 -0600329 omap2_onenand_calc_sync_timings(&t, gpmc_onenand_data->flags, freq);
Afzal Mohammed46376882012-06-05 10:11:48 +0530330
Jon Hunter3aef65e2013-02-21 12:42:22 -0600331 ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_sync);
332 if (ret < 0)
333 return ret;
334
335 ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t);
Russell King71856842013-03-13 20:44:21 +0000336 if (ret < 0)
Afzal Mohammed46376882012-06-05 10:11:48 +0530337 return ret;
338
339 set_onenand_cfg(onenand_base);
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700340
Adrian Hunter3ad2d862011-02-07 10:46:59 +0200341 *freq_ptr = freq;
342
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700343 return 0;
344}
345
Adrian Hunter3ad2d862011-02-07 10:46:59 +0200346static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr)
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700347{
348 struct device *dev = &gpmc_onenand_device.dev;
Afzal Mohammed46376882012-06-05 10:11:48 +0530349 unsigned l = ONENAND_SYNC_READ | ONENAND_SYNC_READWRITE;
350 int ret;
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700351
Afzal Mohammed46376882012-06-05 10:11:48 +0530352 ret = omap2_onenand_setup_async(onenand_base);
353 if (ret) {
354 dev_err(dev, "unable to set to async mode\n");
355 return ret;
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700356 }
357
Afzal Mohammed46376882012-06-05 10:11:48 +0530358 if (!(gpmc_onenand_data->flags & l))
359 return 0;
360
361 ret = omap2_onenand_setup_sync(onenand_base, freq_ptr);
362 if (ret)
363 dev_err(dev, "unable to set to sync mode\n");
364 return ret;
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700365}
366
Ezequiel Garciafaf5d2f2013-01-25 09:23:10 -0300367void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700368{
Afzal Mohammed681988b2012-08-30 12:53:23 -0700369 int err;
Ezequiel Garciadf25cb42013-02-12 16:22:22 -0300370 struct device *dev = &gpmc_onenand_device.dev;
Afzal Mohammed681988b2012-08-30 12:53:23 -0700371
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700372 gpmc_onenand_data = _onenand_data;
373 gpmc_onenand_data->onenand_setup = gpmc_onenand_setup;
374 gpmc_onenand_device.dev.platform_data = gpmc_onenand_data;
375
376 if (cpu_is_omap24xx() &&
377 (gpmc_onenand_data->flags & ONENAND_SYNC_READWRITE)) {
Ezequiel Garcia7ab91592013-02-12 16:22:23 -0300378 dev_warn(dev, "OneNAND using only SYNC_READ on 24xx\n");
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700379 gpmc_onenand_data->flags &= ~ONENAND_SYNC_READWRITE;
380 gpmc_onenand_data->flags |= ONENAND_SYNC_READ;
381 }
382
Afzal Mohammedeb77b6a2012-10-05 11:39:54 +0530383 if (cpu_is_omap34xx())
384 gpmc_onenand_data->flags |= ONENAND_IN_OMAP34XX;
385 else
386 gpmc_onenand_data->flags &= ~ONENAND_IN_OMAP34XX;
387
Afzal Mohammed681988b2012-08-30 12:53:23 -0700388 err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE,
389 (unsigned long *)&gpmc_onenand_resource.start);
390 if (err < 0) {
Ezequiel Garciadf25cb42013-02-12 16:22:22 -0300391 dev_err(dev, "Cannot request GPMC CS %d, error %d\n",
392 gpmc_onenand_data->cs, err);
Afzal Mohammed681988b2012-08-30 12:53:23 -0700393 return;
394 }
395
396 gpmc_onenand_resource.end = gpmc_onenand_resource.start +
397 ONENAND_IO_SIZE - 1;
398
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700399 if (platform_device_register(&gpmc_onenand_device) < 0) {
Ezequiel Garciadf25cb42013-02-12 16:22:22 -0300400 dev_err(dev, "Unable to register OneNAND device\n");
Afzal Mohammed681988b2012-08-30 12:53:23 -0700401 gpmc_cs_free(gpmc_onenand_data->cs);
Juha Yrjolaaa62e902009-05-28 13:23:52 -0700402 return;
403 }
404}