public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] mtd: nand: omap_gpmc: Add CONFIG_SYS_NAND_USE_READY to enable ready/busy
@ 2014-11-12 10:53 Stefan Roese
  2014-11-12 10:53 ` [U-Boot] [PATCH 2/2] arm: am335x: Enable CONFIG_SYS_NAND_USE_READY on siemens am33xx Stefan Roese
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefan Roese @ 2014-11-12 10:53 UTC (permalink / raw)
  To: u-boot

By defining CONFIG_SYS_NAND_USE_READY the GPMC NAND driver makes
use of the ready pin / signal for busy / ready detection. This function
is already available but currently only used in SPL. I don't see a reason
to not use it in the main U-Boot as well. As it increases the NAND
performance.

I'm making it configurable, so that boards that might now have this pin
connected are still supported.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Roger Meier <r.meier@siemens.com>
Cc: Samuel Egli <samuel.egli@siemens.com>
---
 README                       |  5 +++++
 drivers/mtd/nand/omap_gpmc.c | 20 +++++++++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/README b/README
index c3a9dfc..420c14b 100644
--- a/README
+++ b/README
@@ -4731,6 +4731,11 @@ Low Level (hardware related) configuration options:
 		- drivers/mtd/nand/ndfc.c
 		- drivers/mtd/nand/mxc_nand.c
 
+- CONFIG_SYS_NAND_USE_READY
+		Defined if a ready/busy pin is available on this board
+		which can be used to determine the state of the NAND
+		chip. Currently used on the OMAP/AM33xx NAND driver.
+
 - CONFIG_SYS_NDFC_EBC0_CFG
 		Sets the EBC0_CFG register for the NDFC. If not defined
 		a default value will be used.
diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c
index 40d6705..8ca95d3 100644
--- a/drivers/mtd/nand/omap_gpmc.c
+++ b/drivers/mtd/nand/omap_gpmc.c
@@ -23,6 +23,16 @@
 /* 4 bit padding to make byte aligned, 56 = 52 + 4 */
 #define BCH4_BIT_PAD		4
 
+/*
+ * All OMAP / AM33xx SPL builds already use the ready / busy pin.
+ * So lets enable this new define to use this signal for SPL. This
+ * makes the check in the code easier since its reduced to a single
+ * macro.
+ */
+#ifdef CONFIG_SPL_BUILD
+#define CONFIG_SYS_NAND_USE_READY
+#endif
+
 #ifdef CONFIG_BCH
 static u8  bch8_polynomial[] = {0xef, 0x51, 0x2e, 0x09, 0xed, 0x93, 0x9a, 0xc2,
 				0x97, 0x79, 0xe5, 0x24, 0xb5};
@@ -73,9 +83,9 @@ static void omap_nand_hwcontrol(struct mtd_info *mtd, int32_t cmd,
 		writeb(cmd, this->IO_ADDR_W);
 }
 
-#ifdef CONFIG_SPL_BUILD
+#ifdef CONFIG_SYS_NAND_USE_READY
 /* Check wait pin as dev ready indicator */
-static int omap_spl_dev_ready(struct mtd_info *mtd)
+static int omap_dev_ready(struct mtd_info *mtd)
 {
 	return gpmc_cfg->status & (1 << 8);
 }
@@ -887,7 +897,11 @@ int board_nand_init(struct nand_chip *nand)
 		nand->read_buf = nand_read_buf16;
 	else
 		nand->read_buf = nand_read_buf;
-	nand->dev_ready = omap_spl_dev_ready;
 #endif
+
+#ifdef CONFIG_SYS_NAND_USE_READY
+	nand->dev_ready = omap_dev_ready;
+#endif
+
 	return 0;
 }
-- 
2.1.3

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

* [U-Boot] [PATCH 2/2] arm: am335x: Enable CONFIG_SYS_NAND_USE_READY on siemens am33xx
  2014-11-12 10:53 [U-Boot] [PATCH 1/2] mtd: nand: omap_gpmc: Add CONFIG_SYS_NAND_USE_READY to enable ready/busy Stefan Roese
@ 2014-11-12 10:53 ` Stefan Roese
  2014-11-12 20:54 ` [U-Boot] [PATCH 1/2] mtd: nand: omap_gpmc: Add CONFIG_SYS_NAND_USE_READY to enable ready/busy Scott Wood
  2014-11-12 21:34 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2014-11-12 10:53 UTC (permalink / raw)
  To: u-boot

Testing showed a small perfomance gain by using this ready pin to
detect the NAND chip state. Here the values tested on Draco with
Hynix 4GBit NAND:

Without NAND ready pin:

U-Boot# time nand read 80400000 0 400000

NAND read: device 0 offset 0x0, size 0x400000
 4194304 bytes read: OK

time: 2.947 seconds, 2947 ticks

With NAND ready pin:

U-Boot# time nand read 80400000 0 400000

NAND read: device 0 offset 0x0, size 0x400000
 4194304 bytes read: OK

time: 2.795 seconds, 2795 ticks

So an increase of approx. 5%.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Roger Meier <r.meier@siemens.com>
Cc: Samuel Egli <samuel.egli@siemens.com>
---
 include/configs/siemens-am33x-common.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/siemens-am33x-common.h b/include/configs/siemens-am33x-common.h
index 0d5dba1..9f84e09 100644
--- a/include/configs/siemens-am33x-common.h
+++ b/include/configs/siemens-am33x-common.h
@@ -466,6 +466,8 @@
 							/* CS0 */
 #define CONFIG_SYS_MAX_NAND_DEVICE	1		/* Max number of NAND
 							   devices */
+#define CONFIG_SYS_NAND_USE_READY
+
 #if !defined(CONFIG_SPI_BOOT)
 #undef CONFIG_ENV_IS_NOWHERE
 #define CONFIG_ENV_IS_IN_NAND
-- 
2.1.3

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

* [U-Boot] [PATCH 1/2] mtd: nand: omap_gpmc: Add CONFIG_SYS_NAND_USE_READY to enable ready/busy
  2014-11-12 10:53 [U-Boot] [PATCH 1/2] mtd: nand: omap_gpmc: Add CONFIG_SYS_NAND_USE_READY to enable ready/busy Stefan Roese
  2014-11-12 10:53 ` [U-Boot] [PATCH 2/2] arm: am335x: Enable CONFIG_SYS_NAND_USE_READY on siemens am33xx Stefan Roese
@ 2014-11-12 20:54 ` Scott Wood
  2014-11-12 21:34 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Scott Wood @ 2014-11-12 20:54 UTC (permalink / raw)
  To: u-boot

On Wed, 2014-11-12 at 11:53 +0100, Stefan Roese wrote:
> By defining CONFIG_SYS_NAND_USE_READY the GPMC NAND driver makes
> use of the ready pin / signal for busy / ready detection. This function
> is already available but currently only used in SPL. I don't see a reason
> to not use it in the main U-Boot as well. As it increases the NAND
> performance.
> 
> I'm making it configurable, so that boards that might now have this pin
> connected are still supported.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Tom Rini <trini@ti.com>
> Cc: Scott Wood <scottwood@freescale.com>
> Cc: Roger Meier <r.meier@siemens.com>
> Cc: Samuel Egli <samuel.egli@siemens.com>
> ---
>  README                       |  5 +++++
>  drivers/mtd/nand/omap_gpmc.c | 20 +++++++++++++++++---
>  2 files changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/README b/README
> index c3a9dfc..420c14b 100644
> --- a/README
> +++ b/README
> @@ -4731,6 +4731,11 @@ Low Level (hardware related) configuration options:
>  		- drivers/mtd/nand/ndfc.c
>  		- drivers/mtd/nand/mxc_nand.c
>  
> +- CONFIG_SYS_NAND_USE_READY
> +		Defined if a ready/busy pin is available on this board
> +		which can be used to determine the state of the NAND
> +		chip. Currently used on the OMAP/AM33xx NAND driver.
> +

New symbols should be done in kconfig.

Is this really something that ought to be a generic symbol, rather than
OMAP-specific?

-Scott

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

* [U-Boot] [PATCH 1/2] mtd: nand: omap_gpmc: Add CONFIG_SYS_NAND_USE_READY to enable ready/busy
  2014-11-12 10:53 [U-Boot] [PATCH 1/2] mtd: nand: omap_gpmc: Add CONFIG_SYS_NAND_USE_READY to enable ready/busy Stefan Roese
  2014-11-12 10:53 ` [U-Boot] [PATCH 2/2] arm: am335x: Enable CONFIG_SYS_NAND_USE_READY on siemens am33xx Stefan Roese
  2014-11-12 20:54 ` [U-Boot] [PATCH 1/2] mtd: nand: omap_gpmc: Add CONFIG_SYS_NAND_USE_READY to enable ready/busy Scott Wood
@ 2014-11-12 21:34 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2014-11-12 21:34 UTC (permalink / raw)
  To: u-boot

On Wed, Nov 12, 2014 at 11:53:11AM +0100, Stefan Roese wrote:

> By defining CONFIG_SYS_NAND_USE_READY the GPMC NAND driver makes
> use of the ready pin / signal for busy / ready detection. This function
> is already available but currently only used in SPL. I don't see a reason
> to not use it in the main U-Boot as well. As it increases the NAND
> performance.
> 
> I'm making it configurable, so that boards that might now have this pin
> connected are still supported.

I don't think we need to make this configurable.  I think it's always
been an oversight since we've always done this in NAND for SPL and I
can't think of any boards that do support NAND but don't support booting
from NAND in U-Boot.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141112/1a230617/attachment.pgp>

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

end of thread, other threads:[~2014-11-12 21:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-12 10:53 [U-Boot] [PATCH 1/2] mtd: nand: omap_gpmc: Add CONFIG_SYS_NAND_USE_READY to enable ready/busy Stefan Roese
2014-11-12 10:53 ` [U-Boot] [PATCH 2/2] arm: am335x: Enable CONFIG_SYS_NAND_USE_READY on siemens am33xx Stefan Roese
2014-11-12 20:54 ` [U-Boot] [PATCH 1/2] mtd: nand: omap_gpmc: Add CONFIG_SYS_NAND_USE_READY to enable ready/busy Scott Wood
2014-11-12 21:34 ` Tom Rini

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