All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aaro Koskinen <aaro.koskinen@iki.fi>
To: Tony Lindgren <tony@atomide.com>
Cc: "Nishanth Menon" <nm@ti.com>, "Paul Walmsley" <paul@pwsan.com>,
	"Ivaylo Dimitrov" <ivo.g.dimitrov.75@gmail.com>,
	"Sebastian Reichel" <sre@kernel.org>,
	pavel@ucw.cz, "Pali Rohár" <pali.rohar@gmail.com>,
	linux-omap@vger.kernel.org,
	"Brian Hutchinson" <b.hutchman@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	"Roger Quadros" <rogerq@ti.com>
Subject: Re: [PATCH 2/2] memory: omap-gpmc: Add Kconfig option for debug
Date: Wed, 6 Jan 2016 19:36:24 +0200	[thread overview]
Message-ID: <20160106173624.GG1587@darkstar.musicnaut.iki.fi> (raw)
In-Reply-To: <20160105224929.GF12777@atomide.com>

Hi,

On Tue, Jan 05, 2016 at 02:49:29PM -0800, Tony Lindgren wrote:
> From: Tony Lindgren <tony@atomide.com>
> Date: Tue, 5 Jan 2016 12:04:20 -0800
> Subject: [PATCH] ARM: OMAP2+: Fix onenand rate detection to avoid filesystem
>  corruption
> 
> Commit 63aa945b1013 ("memory: omap-gpmc: Add Kconfig option for debug")
> unified the GPMC debug for the SoCs with GPMC. The commit also left
> out the option for HWMOD_INIT_NO_RESET as we now require proper timings
> for GPMC to be able to remap GPMC devices out of address 0.
> 
> Unfortunately on 900, onenand now only partially works with the device
> tree provided timings. It works enough to get detected but the clock
> rate supported by the onenand chip gets misdetected. This in turn causes
> the GPMC timings to be miscalculated and this leads into file system
> corruption on n900.
> 
> Looks like onenand needs CS_CONFIG1 bit 27 WRITETYPE set for for sync
> write. This is needed also for async timings when we write to onenand
> with omap2_onenand_set_async_mode(). Without sync write bit set, the
> async read for the onenand ONENAND_REG_VERSION_ID will return 0xfff.
> 
> Let's exit with an error if onenand rate is not detected. And let's
> remove the extra call to omap2_onenand_set_async_mode() as we only
> need to do this once at the end of omap2_onenand_setup_async().
> 
> Reported-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

This fixes also the detection issue on N950. Also tested the patch
with N810.

Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>

A.

> --- a/arch/arm/mach-omap2/gpmc-onenand.c
> +++ b/arch/arm/mach-omap2/gpmc-onenand.c
> @@ -149,8 +149,8 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
>  		freq = 104;
>  		break;
>  	default:
> -		freq = 54;
> -		break;
> +		pr_err("onenand rate not detected, bad GPMC async timings?\n");
> +		freq = 0;
>  	}
>  
>  	return freq;
> @@ -271,6 +271,11 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base)
>  	struct gpmc_timings t;
>  	int ret;
>  
> +	/*
> +	 * Note that we need to keep sync_write set for the call to
> +	 * omap2_onenand_set_async_mode() to work to detect the onenand
> +	 * supported clock rate for the sync timings.
> +	 */
>  	if (gpmc_onenand_data->of_node) {
>  		gpmc_read_settings_dt(gpmc_onenand_data->of_node,
>  				      &onenand_async);
> @@ -281,12 +286,9 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base)
>  			else
>  				gpmc_onenand_data->flags |= ONENAND_SYNC_READ;
>  			onenand_async.sync_read = false;
> -			onenand_async.sync_write = false;
>  		}
>  	}
>  
> -	omap2_onenand_set_async_mode(onenand_base);
> -
>  	omap2_onenand_calc_async_timings(&t);
>  
>  	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)
>  	if (!freq) {
>  		/* Very first call freq is not known */
>  		freq = omap2_onenand_get_freq(gpmc_onenand_data, onenand_base);
> +		if (!freq)
> +			return -ENODEV;
>  		set_onenand_cfg(onenand_base);
>  	}
>  

WARNING: multiple messages have this Message-ID (diff)
From: aaro.koskinen@iki.fi (Aaro Koskinen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] memory: omap-gpmc: Add Kconfig option for debug
Date: Wed, 6 Jan 2016 19:36:24 +0200	[thread overview]
Message-ID: <20160106173624.GG1587@darkstar.musicnaut.iki.fi> (raw)
In-Reply-To: <20160105224929.GF12777@atomide.com>

Hi,

On Tue, Jan 05, 2016 at 02:49:29PM -0800, Tony Lindgren wrote:
> From: Tony Lindgren <tony@atomide.com>
> Date: Tue, 5 Jan 2016 12:04:20 -0800
> Subject: [PATCH] ARM: OMAP2+: Fix onenand rate detection to avoid filesystem
>  corruption
> 
> Commit 63aa945b1013 ("memory: omap-gpmc: Add Kconfig option for debug")
> unified the GPMC debug for the SoCs with GPMC. The commit also left
> out the option for HWMOD_INIT_NO_RESET as we now require proper timings
> for GPMC to be able to remap GPMC devices out of address 0.
> 
> Unfortunately on 900, onenand now only partially works with the device
> tree provided timings. It works enough to get detected but the clock
> rate supported by the onenand chip gets misdetected. This in turn causes
> the GPMC timings to be miscalculated and this leads into file system
> corruption on n900.
> 
> Looks like onenand needs CS_CONFIG1 bit 27 WRITETYPE set for for sync
> write. This is needed also for async timings when we write to onenand
> with omap2_onenand_set_async_mode(). Without sync write bit set, the
> async read for the onenand ONENAND_REG_VERSION_ID will return 0xfff.
> 
> Let's exit with an error if onenand rate is not detected. And let's
> remove the extra call to omap2_onenand_set_async_mode() as we only
> need to do this once at the end of omap2_onenand_setup_async().
> 
> Reported-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

This fixes also the detection issue on N950. Also tested the patch
with N810.

Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>

A.

> --- a/arch/arm/mach-omap2/gpmc-onenand.c
> +++ b/arch/arm/mach-omap2/gpmc-onenand.c
> @@ -149,8 +149,8 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
>  		freq = 104;
>  		break;
>  	default:
> -		freq = 54;
> -		break;
> +		pr_err("onenand rate not detected, bad GPMC async timings?\n");
> +		freq = 0;
>  	}
>  
>  	return freq;
> @@ -271,6 +271,11 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base)
>  	struct gpmc_timings t;
>  	int ret;
>  
> +	/*
> +	 * Note that we need to keep sync_write set for the call to
> +	 * omap2_onenand_set_async_mode() to work to detect the onenand
> +	 * supported clock rate for the sync timings.
> +	 */
>  	if (gpmc_onenand_data->of_node) {
>  		gpmc_read_settings_dt(gpmc_onenand_data->of_node,
>  				      &onenand_async);
> @@ -281,12 +286,9 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base)
>  			else
>  				gpmc_onenand_data->flags |= ONENAND_SYNC_READ;
>  			onenand_async.sync_read = false;
> -			onenand_async.sync_write = false;
>  		}
>  	}
>  
> -	omap2_onenand_set_async_mode(onenand_base);
> -
>  	omap2_onenand_calc_async_timings(&t);
>  
>  	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)
>  	if (!freq) {
>  		/* Very first call freq is not known */
>  		freq = omap2_onenand_get_freq(gpmc_onenand_data, onenand_base);
> +		if (!freq)
> +			return -ENODEV;
>  		set_onenand_cfg(onenand_base);
>  	}
>  

  parent reply	other threads:[~2016-01-06 17:36 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-20 21:21 [PATCH 0/2] omap gpmc changes for parsing devices and working debug Tony Lindgren
2015-05-20 21:21 ` Tony Lindgren
2015-05-20 21:21 ` [PATCH 1/2] memory: omap-gpmc: Fix parsing of devices Tony Lindgren
2015-05-20 21:21   ` Tony Lindgren
2015-05-20 21:21 ` [PATCH 2/2] memory: omap-gpmc: Add Kconfig option for debug Tony Lindgren
2015-05-20 21:21   ` Tony Lindgren
2015-05-20 22:50   ` Paul Walmsley
2015-05-20 22:50     ` Paul Walmsley
2015-05-20 22:56     ` Tony Lindgren
2015-05-20 22:56       ` Tony Lindgren
2015-05-21  1:06       ` Paul Walmsley
2015-05-21  1:06         ` Paul Walmsley
2015-08-27  6:25   ` Hannes Schmelzer
2015-08-27  6:25     ` Hannes Schmelzer
     [not found]   ` <OFCA2F1DCE.C787A961-ONC1257EAE.001D79BC-C1257EAE.00203AFF@br-automation.com>
2015-08-27 16:59     ` Tony Lindgren
2015-08-27 16:59       ` Tony Lindgren
2015-08-28  4:44       ` Hannes Schmelzer
2015-08-28  4:44         ` Hannes Schmelzer
2015-09-01 12:35     ` Roger Quadros
2015-09-01 12:35       ` Roger Quadros
2015-09-01 13:31       ` Antwort: " Hannes Schmelzer
2015-09-01 13:31         ` Hannes Schmelzer
2015-09-02 14:43         ` Roger Quadros
2015-09-02 14:43           ` Roger Quadros
2015-09-01 12:35     ` Roger Quadros
2015-09-01 12:35       ` Roger Quadros
2016-01-01 11:29   ` Ivaylo Dimitrov
2016-01-01 11:29     ` Ivaylo Dimitrov
2016-01-04 17:02     ` Tony Lindgren
2016-01-04 17:02       ` Tony Lindgren
2016-01-04 17:34       ` Pali Rohár
2016-01-04 17:34         ` Pali Rohár
2016-01-04 17:40         ` Tony Lindgren
2016-01-04 17:40           ` Tony Lindgren
2016-01-04 18:59           ` Ivaylo Dimitrov
2016-01-04 18:59             ` Ivaylo Dimitrov
2016-01-05  4:13             ` Tony Lindgren
2016-01-05  4:13               ` Tony Lindgren
2016-01-05  8:49               ` Pali Rohár
2016-01-05  8:49                 ` Pali Rohár
2016-01-05 22:49                 ` Tony Lindgren
2016-01-05 22:49                   ` Tony Lindgren
2016-01-06  8:55                   ` Ivaylo Dimitrov
2016-01-06  8:55                     ` Ivaylo Dimitrov
2016-01-06  9:05                     ` Pali Rohár
2016-01-06  9:05                       ` Pali Rohár
2016-01-06 16:44                       ` Tony Lindgren
2016-01-06 16:44                         ` Tony Lindgren
2016-01-06 17:36                   ` Aaro Koskinen [this message]
2016-01-06 17:36                     ` Aaro Koskinen
2016-01-06 17:40                   ` Sebastian Reichel
2016-01-06 17:40                     ` Sebastian Reichel
2016-01-06 17:47                     ` Tony Lindgren
2016-01-06 17:47                       ` Tony Lindgren
2016-01-06 18:01                       ` Ivaylo Dimitrov
2016-01-06 18:01                         ` Ivaylo Dimitrov
2016-01-06 18:26                         ` Tony Lindgren
2016-01-06 18:26                           ` Tony Lindgren
2016-01-06 18:39                           ` Ivaylo Dimitrov
2016-01-06 18:39                             ` Ivaylo Dimitrov
2016-01-07 18:07                             ` Tony Lindgren
2016-01-07 18:07                               ` Tony Lindgren
2016-01-07 21:45                               ` Ivaylo Dimitrov
2016-01-07 21:45                                 ` Ivaylo Dimitrov
2016-01-08  2:26                                 ` Tony Lindgren
2016-01-08  2:26                                   ` Tony Lindgren
2016-01-08  5:13                                   ` Ivaylo Dimitrov
2016-01-08  5:13                                     ` Ivaylo Dimitrov
2016-01-08  7:59                                     ` Pali Rohár
2016-01-08  7:59                                       ` Pali Rohár
2016-01-09  0:23                                       ` Ivaylo Dimitrov
2016-01-09  0:23                                         ` Ivaylo Dimitrov
2016-01-21  9:14                                         ` Pali Rohár
2016-01-21  9:14                                           ` Pali Rohár
2016-02-02  9:33                                           ` Ivaylo Dimitrov
2016-02-02  9:33                                             ` Ivaylo Dimitrov
2016-02-02 23:39                                             ` Tony Lindgren
2016-02-02 23:39                                               ` Tony Lindgren
2016-02-03  0:00                                               ` Tony Lindgren
2016-02-03  0:00                                                 ` Tony Lindgren
2016-02-03  7:03                                                 ` Ivaylo Dimitrov
2016-02-03  7:03                                                   ` Ivaylo Dimitrov
2016-02-03 16:50                                                   ` Ivaylo Dimitrov
2016-02-03 16:50                                                     ` Ivaylo Dimitrov
2016-02-05  6:10                                                     ` Tony Lindgren
2016-02-05  6:10                                                       ` Tony Lindgren
2016-02-05 14:43                                                       ` Ivaylo Dimitrov
2016-02-05 14:43                                                         ` Ivaylo Dimitrov
2016-01-08 17:10                                     ` Tony Lindgren
2016-01-08 17:10                                       ` Tony Lindgren
2016-01-08  7:56                                   ` Pali Rohár
2016-01-08  7:56                                     ` Pali Rohár
2016-01-08 17:04                                     ` Tony Lindgren
2016-01-08 17:04                                       ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160106173624.GG1587@darkstar.musicnaut.iki.fi \
    --to=aaro.koskinen@iki.fi \
    --cc=b.hutchman@gmail.com \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=pali.rohar@gmail.com \
    --cc=paul@pwsan.com \
    --cc=pavel@ucw.cz \
    --cc=rogerq@ti.com \
    --cc=sre@kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.