linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for 3.0] AT91: Change nand buswidth logic to match hardware default configuration
@ 2011-07-01 10:25 Nicolas Ferre
  2011-07-04  9:37 ` Nicolas Ferre
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Ferre @ 2011-07-01 10:25 UTC (permalink / raw)
  To: linux-arm-kernel

The recently modified nand buswitth configuration is not aligned with
board reality: the double footprint on boards is always populated with 8bits
buswidth nand flashes.
So we have to consider that without particular configuration the 8bits
buswidth is selected by default.
Moreover, the previous logic was always using !board_have_nand_8bit(), we
change it to a simpler: board_have_nand_16bit().

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 arch/arm/mach-at91/board-cap9adk.c           |    2 +-
 arch/arm/mach-at91/board-sam9260ek.c         |    2 +-
 arch/arm/mach-at91/board-sam9261ek.c         |    2 +-
 arch/arm/mach-at91/board-sam9263ek.c         |    2 +-
 arch/arm/mach-at91/board-sam9g20ek.c         |    2 +-
 arch/arm/mach-at91/board-sam9m10g45ek.c      |    2 +-
 arch/arm/mach-at91/include/mach/system_rev.h |   10 +++++-----
 7 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
index 1904fdf..cdb65d4 100644
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -215,7 +215,7 @@ static void __init cap9adk_add_device_nand(void)
 	csa = at91_sys_read(AT91_MATRIX_EBICSA);
 	at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V);
 
-	cap9adk_nand_data.bus_width_16 = !board_have_nand_8bit();
+	cap9adk_nand_data.bus_width_16 = board_have_nand_16bit();
 	/* setup bus-width (8 or 16) */
 	if (cap9adk_nand_data.bus_width_16)
 		cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_16;
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index d600dc1..5c24074 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -214,7 +214,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = {
 
 static void __init ek_add_device_nand(void)
 {
-	ek_nand_data.bus_width_16 = !board_have_nand_8bit();
+	ek_nand_data.bus_width_16 = board_have_nand_16bit();
 	/* setup bus-width (8 or 16) */
 	if (ek_nand_data.bus_width_16)
 		ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index f897f84..b60c22b 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -220,7 +220,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = {
 
 static void __init ek_add_device_nand(void)
 {
-	ek_nand_data.bus_width_16 = !board_have_nand_8bit();
+	ek_nand_data.bus_width_16 = board_have_nand_16bit();
 	/* setup bus-width (8 or 16) */
 	if (ek_nand_data.bus_width_16)
 		ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 605b26f..9bbdc92 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -221,7 +221,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = {
 
 static void __init ek_add_device_nand(void)
 {
-	ek_nand_data.bus_width_16 = !board_have_nand_8bit();
+	ek_nand_data.bus_width_16 = board_have_nand_16bit();
 	/* setup bus-width (8 or 16) */
 	if (ek_nand_data.bus_width_16)
 		ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 7624cf0..1325a50 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -198,7 +198,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = {
 
 static void __init ek_add_device_nand(void)
 {
-	ek_nand_data.bus_width_16 = !board_have_nand_8bit();
+	ek_nand_data.bus_width_16 = board_have_nand_16bit();
 	/* setup bus-width (8 or 16) */
 	if (ek_nand_data.bus_width_16)
 		ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 063c95d..33eaa13 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -178,7 +178,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = {
 
 static void __init ek_add_device_nand(void)
 {
-	ek_nand_data.bus_width_16 = !board_have_nand_8bit();
+	ek_nand_data.bus_width_16 = board_have_nand_16bit();
 	/* setup bus-width (8 or 16) */
 	if (ek_nand_data.bus_width_16)
 		ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
diff --git a/arch/arm/mach-at91/include/mach/system_rev.h b/arch/arm/mach-at91/include/mach/system_rev.h
index b855ee7..8f48660 100644
--- a/arch/arm/mach-at91/include/mach/system_rev.h
+++ b/arch/arm/mach-at91/include/mach/system_rev.h
@@ -13,13 +13,13 @@
  * the 16-31 bit are reserved for at91 generic information
  *
  * bit 31:
- *	0 => nand 16 bit
- *	1 => nand 8 bit
+ *	0 => nand 8 bit
+ *	1 => nand 16 bit
  */
-#define BOARD_HAVE_NAND_8BIT	(1 << 31)
-static int inline board_have_nand_8bit(void)
+#define BOARD_HAVE_NAND_16BIT	(1 << 31)
+static inline int board_have_nand_16bit(void)
 {
-	return system_rev & BOARD_HAVE_NAND_8BIT;
+	return system_rev & BOARD_HAVE_NAND_16BIT;
 }
 
 #endif /* __ARCH_SYSTEM_REV_H__ */
-- 
1.7.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH for 3.0] AT91: Change nand buswidth logic to match hardware default configuration
  2011-07-01 10:25 [PATCH for 3.0] AT91: Change nand buswidth logic to match hardware default configuration Nicolas Ferre
@ 2011-07-04  9:37 ` Nicolas Ferre
  2011-07-04 14:25   ` Arnd Bergmann
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Ferre @ 2011-07-04  9:37 UTC (permalink / raw)
  To: linux-arm-kernel

Le 01/07/2011 12:25, Nicolas Ferre :
> The recently modified nand buswitth configuration is not aligned with
> board reality: the double footprint on boards is always populated with 8bits
> buswidth nand flashes.
> So we have to consider that without particular configuration the 8bits
> buswidth is selected by default.
> Moreover, the previous logic was always using !board_have_nand_8bit(), we
> change it to a simpler: board_have_nand_16bit().
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com>

Arnd,

Can you please handle this parch for 3.0-final as a bug fix through the
arm-soc.git tree?

You can queue it in addition of the pull request sent by
Jean-Christophe: "AT91: Fix pull requset".

Thanks, best regards,

> ---
>  arch/arm/mach-at91/board-cap9adk.c           |    2 +-
>  arch/arm/mach-at91/board-sam9260ek.c         |    2 +-
>  arch/arm/mach-at91/board-sam9261ek.c         |    2 +-
>  arch/arm/mach-at91/board-sam9263ek.c         |    2 +-
>  arch/arm/mach-at91/board-sam9g20ek.c         |    2 +-
>  arch/arm/mach-at91/board-sam9m10g45ek.c      |    2 +-
>  arch/arm/mach-at91/include/mach/system_rev.h |   10 +++++-----
>  7 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
> index 1904fdf..cdb65d4 100644
> --- a/arch/arm/mach-at91/board-cap9adk.c
> +++ b/arch/arm/mach-at91/board-cap9adk.c
> @@ -215,7 +215,7 @@ static void __init cap9adk_add_device_nand(void)
>  	csa = at91_sys_read(AT91_MATRIX_EBICSA);
>  	at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V);
>  
> -	cap9adk_nand_data.bus_width_16 = !board_have_nand_8bit();
> +	cap9adk_nand_data.bus_width_16 = board_have_nand_16bit();
>  	/* setup bus-width (8 or 16) */
>  	if (cap9adk_nand_data.bus_width_16)
>  		cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_16;
> diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
> index d600dc1..5c24074 100644
> --- a/arch/arm/mach-at91/board-sam9260ek.c
> +++ b/arch/arm/mach-at91/board-sam9260ek.c
> @@ -214,7 +214,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = {
>  
>  static void __init ek_add_device_nand(void)
>  {
> -	ek_nand_data.bus_width_16 = !board_have_nand_8bit();
> +	ek_nand_data.bus_width_16 = board_have_nand_16bit();
>  	/* setup bus-width (8 or 16) */
>  	if (ek_nand_data.bus_width_16)
>  		ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
> diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
> index f897f84..b60c22b 100644
> --- a/arch/arm/mach-at91/board-sam9261ek.c
> +++ b/arch/arm/mach-at91/board-sam9261ek.c
> @@ -220,7 +220,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = {
>  
>  static void __init ek_add_device_nand(void)
>  {
> -	ek_nand_data.bus_width_16 = !board_have_nand_8bit();
> +	ek_nand_data.bus_width_16 = board_have_nand_16bit();
>  	/* setup bus-width (8 or 16) */
>  	if (ek_nand_data.bus_width_16)
>  		ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
> diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
> index 605b26f..9bbdc92 100644
> --- a/arch/arm/mach-at91/board-sam9263ek.c
> +++ b/arch/arm/mach-at91/board-sam9263ek.c
> @@ -221,7 +221,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = {
>  
>  static void __init ek_add_device_nand(void)
>  {
> -	ek_nand_data.bus_width_16 = !board_have_nand_8bit();
> +	ek_nand_data.bus_width_16 = board_have_nand_16bit();
>  	/* setup bus-width (8 or 16) */
>  	if (ek_nand_data.bus_width_16)
>  		ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
> diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
> index 7624cf0..1325a50 100644
> --- a/arch/arm/mach-at91/board-sam9g20ek.c
> +++ b/arch/arm/mach-at91/board-sam9g20ek.c
> @@ -198,7 +198,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = {
>  
>  static void __init ek_add_device_nand(void)
>  {
> -	ek_nand_data.bus_width_16 = !board_have_nand_8bit();
> +	ek_nand_data.bus_width_16 = board_have_nand_16bit();
>  	/* setup bus-width (8 or 16) */
>  	if (ek_nand_data.bus_width_16)
>  		ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
> diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
> index 063c95d..33eaa13 100644
> --- a/arch/arm/mach-at91/board-sam9m10g45ek.c
> +++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
> @@ -178,7 +178,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = {
>  
>  static void __init ek_add_device_nand(void)
>  {
> -	ek_nand_data.bus_width_16 = !board_have_nand_8bit();
> +	ek_nand_data.bus_width_16 = board_have_nand_16bit();
>  	/* setup bus-width (8 or 16) */
>  	if (ek_nand_data.bus_width_16)
>  		ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
> diff --git a/arch/arm/mach-at91/include/mach/system_rev.h b/arch/arm/mach-at91/include/mach/system_rev.h
> index b855ee7..8f48660 100644
> --- a/arch/arm/mach-at91/include/mach/system_rev.h
> +++ b/arch/arm/mach-at91/include/mach/system_rev.h
> @@ -13,13 +13,13 @@
>   * the 16-31 bit are reserved for at91 generic information
>   *
>   * bit 31:
> - *	0 => nand 16 bit
> - *	1 => nand 8 bit
> + *	0 => nand 8 bit
> + *	1 => nand 16 bit
>   */
> -#define BOARD_HAVE_NAND_8BIT	(1 << 31)
> -static int inline board_have_nand_8bit(void)
> +#define BOARD_HAVE_NAND_16BIT	(1 << 31)
> +static inline int board_have_nand_16bit(void)
>  {
> -	return system_rev & BOARD_HAVE_NAND_8BIT;
> +	return system_rev & BOARD_HAVE_NAND_16BIT;
>  }
>  
>  #endif /* __ARCH_SYSTEM_REV_H__ */


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH for 3.0] AT91: Change nand buswidth logic to match hardware default configuration
  2011-07-04  9:37 ` Nicolas Ferre
@ 2011-07-04 14:25   ` Arnd Bergmann
  2011-07-04 14:41     ` Nicolas Ferre
  0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2011-07-04 14:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 04 July 2011, Nicolas Ferre wrote:
> Le 01/07/2011 12:25, Nicolas Ferre :
> > The recently modified nand buswitth configuration is not aligned with
> > board reality: the double footprint on boards is always populated with 8bits
> > buswidth nand flashes.
> > So we have to consider that without particular configuration the 8bits
> > buswidth is selected by default.
> > Moreover, the previous logic was always using !board_have_nand_8bit(), we
> > change it to a simpler: board_have_nand_16bit().
> > 
> > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> > Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Arnd,
> 
> Can you please handle this parch for 3.0-final as a bug fix through the
> arm-soc.git tree?
> 
> You can queue it in addition of the pull request sent by
> Jean-Christophe: "AT91: Fix pull requset".

Ok, I've integrated it in the branch and will send the pull request.

My preference would be to see fixes this late in the cycle more
minmal. This patch does two things: 1. change the polarity of the
system_rev bit as a bug fix and 2. change the polarity of the
function reading it as a cleanup. Both changes look absolutely
ok, but it's better to do the cleanup for the next kernel.

In this case, studying the patch more closely shows that it's
very harmless, but I'd rather not have to look that closely.

Am I correct that the bug is a regression against 2.6.39?

	Arnd

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH for 3.0] AT91: Change nand buswidth logic to match hardware default configuration
  2011-07-04 14:25   ` Arnd Bergmann
@ 2011-07-04 14:41     ` Nicolas Ferre
  2011-07-04 15:13       ` Arnd Bergmann
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Ferre @ 2011-07-04 14:41 UTC (permalink / raw)
  To: linux-arm-kernel

Le 04/07/2011 16:25, Arnd Bergmann :
> On Monday 04 July 2011, Nicolas Ferre wrote:
>> Le 01/07/2011 12:25, Nicolas Ferre :
>>> The recently modified nand buswitth configuration is not aligned with
>>> board reality: the double footprint on boards is always populated with 8bits
>>> buswidth nand flashes.
>>> So we have to consider that without particular configuration the 8bits
>>> buswidth is selected by default.
>>> Moreover, the previous logic was always using !board_have_nand_8bit(), we
>>> change it to a simpler: board_have_nand_16bit().
>>>
>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>>> Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com>
>>
>> Arnd,
>>
>> Can you please handle this parch for 3.0-final as a bug fix through the
>> arm-soc.git tree?
>>
>> You can queue it in addition of the pull request sent by
>> Jean-Christophe: "AT91: Fix pull requset".
> 
> Ok, I've integrated it in the branch and will send the pull request.
> 
> My preference would be to see fixes this late in the cycle more
> minmal. This patch does two things: 1. change the polarity of the
> system_rev bit as a bug fix and 2. change the polarity of the
> function reading it as a cleanup. Both changes look absolutely
> ok, but it's better to do the cleanup for the next kernel.
> 
> In this case, studying the patch more closely shows that it's
> very harmless, but I'd rather not have to look that closely.

Well, in fact it is a fix against what was introduced in a 3.0 patch
which I found to be wrong.
The reason because I do not want to be in next kernel is the fact that
it can puzzle the user (people that want to use kernel without changing
the system_rev between 2.6.39 -> 3.0 and again revert their changes for
3.0 -> 3.1).

> Am I correct that the bug is a regression against 2.6.39?

No, in fact it was introduced during 3.0 early -rc.

Anyway, thanks a lot Arnd.
Best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH for 3.0] AT91: Change nand buswidth logic to match hardware default configuration
  2011-07-04 14:41     ` Nicolas Ferre
@ 2011-07-04 15:13       ` Arnd Bergmann
  2011-07-04 15:17         ` Nicolas Ferre
  0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2011-07-04 15:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 04 July 2011, Nicolas Ferre wrote:
> > In this case, studying the patch more closely shows that it's
> > very harmless, but I'd rather not have to look that closely.
> 
> Well, in fact it is a fix against what was introduced in a 3.0 patch
> which I found to be wrong.
> The reason because I do not want to be in next kernel is the fact that
> it can puzzle the user (people that want to use kernel without changing
> the system_rev between 2.6.39 -> 3.0 and again revert their changes for
> 3.0 -> 3.1).
> 
> > Am I correct that the bug is a regression against 2.6.39?
> 
> No, in fact it was introduced during 3.0 early -rc.

That's what I mean by 'regression against 2.6.39': it was working in 2.6.39,
but later kernels are broken without this fix.

	Arnd

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH for 3.0] AT91: Change nand buswidth logic to match hardware default configuration
  2011-07-04 15:13       ` Arnd Bergmann
@ 2011-07-04 15:17         ` Nicolas Ferre
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Ferre @ 2011-07-04 15:17 UTC (permalink / raw)
  To: linux-arm-kernel

Le 04/07/2011 17:13, Arnd Bergmann :
> On Monday 04 July 2011, Nicolas Ferre wrote:
>>> In this case, studying the patch more closely shows that it's
>>> very harmless, but I'd rather not have to look that closely.
>>
>> Well, in fact it is a fix against what was introduced in a 3.0 patch
>> which I found to be wrong.
>> The reason because I do not want to be in next kernel is the fact that
>> it can puzzle the user (people that want to use kernel without changing
>> the system_rev between 2.6.39 -> 3.0 and again revert their changes for
>> 3.0 -> 3.1).
>>
>>> Am I correct that the bug is a regression against 2.6.39?
>>
>> No, in fact it was introduced during 3.0 early -rc.
> 
> That's what I mean by 'regression against 2.6.39': it was working in 2.6.39,
> but later kernels are broken without this fix.

Absolutely (here broken = not easily understandable by user).

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-07-04 15:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-01 10:25 [PATCH for 3.0] AT91: Change nand buswidth logic to match hardware default configuration Nicolas Ferre
2011-07-04  9:37 ` Nicolas Ferre
2011-07-04 14:25   ` Arnd Bergmann
2011-07-04 14:41     ` Nicolas Ferre
2011-07-04 15:13       ` Arnd Bergmann
2011-07-04 15:17         ` Nicolas Ferre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).