Skip to content

Commit 841bcd2

Browse files
committed
Merge tag 'omap-for-v4.4/onenand-corruption' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into fixes
Pull "urgent onenand file system corruption fix for n900" from Tony Lindgren: Last minute urgent pull request to prevent file system corruption on Nokia N900. Looks like we have a GPMC bus timing bug that has gone unnoticed because of bootloader configured registers until few days ago. We are not detecting the onenand clock rate properly unless we have CONFIG_OMAP_GPMC_DEBUG set and this causes onenand corruption that can be easily be reproduced. There seems to be also an additional bug still lurking around for onenand corruption. But that is still being investigated and it does not seem to be GPMC timings related. Meanwhile, it would be good to get this fix into v4.4 to prevent wrong timings from corrupting onenand. * tag 'omap-for-v4.4/onenand-corruption' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: ARM: OMAP2+: Fix onenand rate detection to avoid filesystem corruption
2 parents 0f090bf + e7b11dc commit 841bcd2

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

arch/arm/mach-omap2/gpmc-onenand.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
149149
freq = 104;
150150
break;
151151
default:
152-
freq = 54;
153-
break;
152+
pr_err("onenand rate not detected, bad GPMC async timings?\n");
153+
freq = 0;
154154
}
155155

156156
return freq;
@@ -271,6 +271,11 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base)
271271
struct gpmc_timings t;
272272
int ret;
273273

274+
/*
275+
* Note that we need to keep sync_write set for the call to
276+
* omap2_onenand_set_async_mode() to work to detect the onenand
277+
* supported clock rate for the sync timings.
278+
*/
274279
if (gpmc_onenand_data->of_node) {
275280
gpmc_read_settings_dt(gpmc_onenand_data->of_node,
276281
&onenand_async);
@@ -281,12 +286,9 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base)
281286
else
282287
gpmc_onenand_data->flags |= ONENAND_SYNC_READ;
283288
onenand_async.sync_read = false;
284-
onenand_async.sync_write = false;
285289
}
286290
}
287291

288-
omap2_onenand_set_async_mode(onenand_base);
289-
290292
omap2_onenand_calc_async_timings(&t);
291293

292294
ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_async);
@@ -310,6 +312,8 @@ static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr)
310312
if (!freq) {
311313
/* Very first call freq is not known */
312314
freq = omap2_onenand_get_freq(gpmc_onenand_data, onenand_base);
315+
if (!freq)
316+
return -ENODEV;
313317
set_onenand_cfg(onenand_base);
314318
}
315319

0 commit comments

Comments
 (0)