mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH|RFC] beagle: make nand ecc command based
@ 2010-08-17  8:55 Michael Grzeschik
  2010-08-17 10:40 ` Nishanth Menon
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Grzeschik @ 2010-08-17  8:55 UTC (permalink / raw)
  To: barebox

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
This will only work once and bring the nand chip into a undefined state
after a second call. Any ideas for doing this save?

 arch/arm/boards/omap/board-beagle.c |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/arch/arm/boards/omap/board-beagle.c b/arch/arm/boards/omap/board-beagle.c
index c0b6b43..99766af 100644
--- a/arch/arm/boards/omap/board-beagle.c
+++ b/arch/arm/boards/omap/board-beagle.c
@@ -53,6 +53,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <console.h>
 #include <init.h>
 #include <driver.h>
@@ -324,7 +325,6 @@ static int beagle_devices_init(void)
 	/* WP is made high and WAIT1 active Low */
 	gpmc_generic_init(0x10);
 #endif
-	gpmc_generic_nand_devices_init(0, 16, 1);
 
 	armlinux_add_dram(&sdram_dev);
 	armlinux_set_bootparams((void *)0x80000100);
@@ -333,3 +333,29 @@ failed:
 	return ret;
 }
 device_initcall(beagle_devices_init);
+
+static int do_ecc(struct command *cmdtp, int argc, char *argv[])
+{
+	if (*argv[0] == 's') {
+		gpmc_generic_nand_devices_init(0, 16, 0);
+	} else {
+		gpmc_generic_nand_devices_init(0, 16, 1);
+	}
+	return 0;
+}
+
+static const __maybe_unused char cmd_ecc_help[] =
+"Usage: (s|h)whwcc <device>\n"
+"set software or hardware ecc for nand controller \n";
+
+BAREBOX_CMD_START(hwecc)
+        .cmd            = do_ecc,
+        .usage          = "enable HWECC support in NAND",
+        BAREBOX_CMD_HELP(cmd_ecc_help)
+BAREBOX_CMD_END
+
+BAREBOX_CMD_START(swecc)
+        .cmd            = do_ecc,
+        .usage          = "enable SWECC support in NAND",
+        BAREBOX_CMD_HELP(cmd_ecc_help)
+BAREBOX_CMD_END
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH|RFC] beagle: make nand ecc command based
  2010-08-17  8:55 [PATCH|RFC] beagle: make nand ecc command based Michael Grzeschik
@ 2010-08-17 10:40 ` Nishanth Menon
  2010-08-18  6:42   ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Nishanth Menon @ 2010-08-17 10:40 UTC (permalink / raw)
  To: Michael Grzeschik; +Cc: barebox

On 08/17/2010 03:55 AM, Michael Grzeschik wrote:
> Signed-off-by: Michael Grzeschik<m.grzeschik@pengutronix.de>
> ---
> This will only work once and bring the nand chip into a undefined state
> after a second call. Any ideas for doing this save?
looking at the gpmc logic, it does a reset in gpmc_cs_config by 
disabling and re-enabling it -> so my guess is:
a) in the selection of ecc logic
b) reset of statemachines in mtd layers
c) nand chip not being reset from it's previous state (resetting the 
controller does not mean nand chip is reset) (if i recollect sometime 
back mtd used to do a 0xff and reset)..


personally, IMHO using s/w ecc has not much benefit other than being 
"legacy enabled"
>
>   arch/arm/boards/omap/board-beagle.c |   28 +++++++++++++++++++++++++++-
>   1 files changed, 27 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/boards/omap/board-beagle.c b/arch/arm/boards/omap/board-beagle.c
> index c0b6b43..99766af 100644
> --- a/arch/arm/boards/omap/board-beagle.c
> +++ b/arch/arm/boards/omap/board-beagle.c
> @@ -53,6 +53,7 @@
>    */
>
>   #include<common.h>
> +#include<command.h>
>   #include<console.h>
>   #include<init.h>
>   #include<driver.h>
> @@ -324,7 +325,6 @@ static int beagle_devices_init(void)
>   	/* WP is made high and WAIT1 active Low */
>   	gpmc_generic_init(0x10);
>   #endif
> -	gpmc_generic_nand_devices_init(0, 16, 1);
>
>   	armlinux_add_dram(&sdram_dev);
>   	armlinux_set_bootparams((void *)0x80000100);
> @@ -333,3 +333,29 @@ failed:
>   	return ret;
>   }
>   device_initcall(beagle_devices_init);
> +
> +static int do_ecc(struct command *cmdtp, int argc, char *argv[])
> +{
> +	if (*argv[0] == 's') {
> +		gpmc_generic_nand_devices_init(0, 16, 0);
> +	} else {
> +		gpmc_generic_nand_devices_init(0, 16, 1);
> +	}
> +	return 0;
> +}
> +
> +static const __maybe_unused char cmd_ecc_help[] =
> +"Usage: (s|h)whwcc<device>\n"
> +"set software or hardware ecc for nand controller \n";
> +
> +BAREBOX_CMD_START(hwecc)
> +        .cmd            = do_ecc,
> +        .usage          = "enable HWECC support in NAND",
> +        BAREBOX_CMD_HELP(cmd_ecc_help)
> +BAREBOX_CMD_END
> +
> +BAREBOX_CMD_START(swecc)
> +        .cmd            = do_ecc,
> +        .usage          = "enable SWECC support in NAND",
> +        BAREBOX_CMD_HELP(cmd_ecc_help)
> +BAREBOX_CMD_END


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH|RFC] beagle: make nand ecc command based
  2010-08-17 10:40 ` Nishanth Menon
@ 2010-08-18  6:42   ` Sascha Hauer
  2010-08-18 10:03     ` Nishanth Menon
  0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2010-08-18  6:42 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: barebox

On Tue, Aug 17, 2010 at 05:40:09AM -0500, Nishanth Menon wrote:
> On 08/17/2010 03:55 AM, Michael Grzeschik wrote:
>> Signed-off-by: Michael Grzeschik<m.grzeschik@pengutronix.de>
>> ---
>> This will only work once and bring the nand chip into a undefined state
>> after a second call. Any ideas for doing this save?
> looking at the gpmc logic, it does a reset in gpmc_cs_config by  
> disabling and re-enabling it -> so my guess is:
> a) in the selection of ecc logic
> b) reset of statemachines in mtd layers
> c) nand chip not being reset from it's previous state (resetting the  
> controller does not mean nand chip is reset) (if i recollect sometime  
> back mtd used to do a 0xff and reset)..
>
>
> personally, IMHO using s/w ecc has not much benefit other than being  
> "legacy enabled"

It really seems odd to me that the omap internal ROM code expects hw
ecc while xloader and kernel expect hw ecc. This way we always need
two different ecc algorithms in place which is really inconvenient and
hard for users to get it right.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH|RFC] beagle: make nand ecc command based
  2010-08-18  6:42   ` Sascha Hauer
@ 2010-08-18 10:03     ` Nishanth Menon
  0 siblings, 0 replies; 4+ messages in thread
From: Nishanth Menon @ 2010-08-18 10:03 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 08/18/2010 01:42 AM, Sascha Hauer wrote:
> On Tue, Aug 17, 2010 at 05:40:09AM -0500, Nishanth Menon wrote:
>> On 08/17/2010 03:55 AM, Michael Grzeschik wrote:
>>> Signed-off-by: Michael Grzeschik<m.grzeschik@pengutronix.de>
>>> ---
>>> This will only work once and bring the nand chip into a undefined state
>>> after a second call. Any ideas for doing this save?
>> looking at the gpmc logic, it does a reset in gpmc_cs_config by
>> disabling and re-enabling it ->  so my guess is:
>> a) in the selection of ecc logic
>> b) reset of statemachines in mtd layers
>> c) nand chip not being reset from it's previous state (resetting the
>> controller does not mean nand chip is reset) (if i recollect sometime
>> back mtd used to do a 0xff and reset)..
>>
>>
>> personally, IMHO using s/w ecc has not much benefit other than being
>> "legacy enabled"
>
> It really seems odd to me that the omap internal ROM code expects hw
> ecc while xloader and kernel expect hw ecc. This way we always need
> two different ecc algorithms in place which is really inconvenient and
> hard for users to get it right.


I agree, but there has been a lot of history behind how this came to 
happen. there is still discussion in linux-omap in getting kernel's mtd 
driver to sanely handle the ecc strategy selectable by the board.

Regards,
Nishanth Menon


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2010-08-18 10:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-17  8:55 [PATCH|RFC] beagle: make nand ecc command based Michael Grzeschik
2010-08-17 10:40 ` Nishanth Menon
2010-08-18  6:42   ` Sascha Hauer
2010-08-18 10:03     ` Nishanth Menon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox