* [U-Boot] [PATCHv2 0/4] add SPL ONENAND support.
@ 2013-02-08 9:14 Enric Balletbo i Serra
2013-02-08 9:14 ` [U-Boot] [PATCHv2 1/4] SPL: ONENAND: Fix some ONENAND related defines Enric Balletbo i Serra
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Enric Balletbo i Serra @ 2013-02-08 9:14 UTC (permalink / raw)
To: u-boot
From: Enric Balletbo i Serra <eballetbo@iseebcn.com>
Hi all,
This is the second version to add ONENAND support to the SPL.
Changes since v1:
* Replace ONE_NAND defines for ONENAND (Tom and Kyungmin)
* Remove unnused variables (Kyungmin)
* Split patch 2 in two, things related to SPL and things related
to OMAP3 (Kyungmin)
Cheers,
Enric Balletbo i Serra (4):
SPL: ONENAND: Fix some ONENAND related defines.
SPL: ONENAND: Fix onenand_spl_load_image implementation.
SPL: ONENAND: Support SPL to boot u-boot from OneNAND.
OMAP3: Initialize gpmc if SPL_ONENAND_SUPPORT is enabled.
arch/arm/cpu/arm1136/mx35/generic.c | 2 +-
arch/arm/cpu/armv7/omap3/board.c | 2 +-
arch/arm/include/asm/arch-mx35/spl.h | 2 +-
arch/arm/include/asm/arch-omap3/spl.h | 2 +-
arch/arm/include/asm/arch-omap4/spl.h | 2 +-
arch/arm/include/asm/arch-omap5/spl.h | 2 +-
common/spl/Makefile | 1 +
common/spl/spl.c | 5 ++++
common/spl/spl_onenand.c | 47 +++++++++++++++++++++++++++++++++
drivers/mtd/onenand/onenand_spl.c | 14 +++++-----
10 files changed, 65 insertions(+), 14 deletions(-)
create mode 100644 common/spl/spl_onenand.c
--
1.7.10.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCHv2 1/4] SPL: ONENAND: Fix some ONENAND related defines.
2013-02-08 9:14 [U-Boot] [PATCHv2 0/4] add SPL ONENAND support Enric Balletbo i Serra
@ 2013-02-08 9:14 ` Enric Balletbo i Serra
2013-02-08 9:14 ` [U-Boot] [PATCHv2 2/4] SPL: ONENAND: Fix onenand_spl_load_image implementation Enric Balletbo i Serra
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Enric Balletbo i Serra @ 2013-02-08 9:14 UTC (permalink / raw)
To: u-boot
From: Enric Balletbo i Serra <eballetbo@iseebcn.com>
Some ONENAND related defines use the term ONE_NAND instead of
ONENAND, as the technology name is ONENAND this patch replaces
all these defines.
Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
---
arch/arm/cpu/arm1136/mx35/generic.c | 2 +-
arch/arm/include/asm/arch-mx35/spl.h | 2 +-
arch/arm/include/asm/arch-omap3/spl.h | 2 +-
arch/arm/include/asm/arch-omap4/spl.h | 2 +-
arch/arm/include/asm/arch-omap5/spl.h | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/arm/cpu/arm1136/mx35/generic.c b/arch/arm/cpu/arm1136/mx35/generic.c
index d11e6f6..46f4b64 100644
--- a/arch/arm/cpu/arm1136/mx35/generic.c
+++ b/arch/arm/cpu/arm1136/mx35/generic.c
@@ -519,7 +519,7 @@ u32 spl_boot_device(void)
case RCSR_MEM_TYPE_NOR:
return BOOT_DEVICE_NOR;
case RCSR_MEM_TYPE_ONENAND:
- return BOOT_DEVICE_ONE_NAND;
+ return BOOT_DEVICE_ONENAND;
default:
return BOOT_DEVICE_NONE;
}
diff --git a/arch/arm/include/asm/arch-mx35/spl.h b/arch/arm/include/asm/arch-mx35/spl.h
index 91d11ae..3ca4c94 100644
--- a/arch/arm/include/asm/arch-mx35/spl.h
+++ b/arch/arm/include/asm/arch-mx35/spl.h
@@ -27,7 +27,7 @@
#define BOOT_DEVICE_XIP 1
#define BOOT_DEVICE_XIPWAIT 2
#define BOOT_DEVICE_NAND 3
-#define BOOT_DEVICE_ONE_NAND 4
+#define BOOT_DEVICE_ONENAND 4
#define BOOT_DEVICE_MMC1 5
#define BOOT_DEVICE_MMC2 6
#define BOOT_DEVICE_MMC2_2 7
diff --git a/arch/arm/include/asm/arch-omap3/spl.h b/arch/arm/include/asm/arch-omap3/spl.h
index 404e16a..dec4dac 100644
--- a/arch/arm/include/asm/arch-omap3/spl.h
+++ b/arch/arm/include/asm/arch-omap3/spl.h
@@ -26,7 +26,7 @@
#define BOOT_DEVICE_NONE 0
#define BOOT_DEVICE_XIP 1
#define BOOT_DEVICE_NAND 2
-#define BOOT_DEVICE_ONE_NAND 3
+#define BOOT_DEVICE_ONENAND 3
#define BOOT_DEVICE_MMC2 5 /*emmc*/
#define BOOT_DEVICE_MMC1 6
#define BOOT_DEVICE_XIPWAIT 7
diff --git a/arch/arm/include/asm/arch-omap4/spl.h b/arch/arm/include/asm/arch-omap4/spl.h
index cec84dc..4e094f9 100644
--- a/arch/arm/include/asm/arch-omap4/spl.h
+++ b/arch/arm/include/asm/arch-omap4/spl.h
@@ -27,7 +27,7 @@
#define BOOT_DEVICE_XIP 1
#define BOOT_DEVICE_XIPWAIT 2
#define BOOT_DEVICE_NAND 3
-#define BOOT_DEVICE_ONE_NAND 4
+#define BOOT_DEVICE_ONENAND 4
#define BOOT_DEVICE_MMC1 5
#define BOOT_DEVICE_MMC2 6
#define BOOT_DEVICE_MMC2_2 0xFF
diff --git a/arch/arm/include/asm/arch-omap5/spl.h b/arch/arm/include/asm/arch-omap5/spl.h
index d125c61..323cd63 100644
--- a/arch/arm/include/asm/arch-omap5/spl.h
+++ b/arch/arm/include/asm/arch-omap5/spl.h
@@ -27,7 +27,7 @@
#define BOOT_DEVICE_XIP 1
#define BOOT_DEVICE_XIPWAIT 2
#define BOOT_DEVICE_NAND 3
-#define BOOT_DEVICE_ONE_NAND 4
+#define BOOT_DEVICE_ONENAND 4
#define BOOT_DEVICE_MMC1 5
#define BOOT_DEVICE_MMC2 6
#define BOOT_DEVICE_MMC2_2 7
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCHv2 2/4] SPL: ONENAND: Fix onenand_spl_load_image implementation.
2013-02-08 9:14 [U-Boot] [PATCHv2 0/4] add SPL ONENAND support Enric Balletbo i Serra
2013-02-08 9:14 ` [U-Boot] [PATCHv2 1/4] SPL: ONENAND: Fix some ONENAND related defines Enric Balletbo i Serra
@ 2013-02-08 9:14 ` Enric Balletbo i Serra
2013-02-08 9:14 ` [U-Boot] [PATCHv2 3/4] SPL: ONENAND: Support SPL to boot u-boot from OneNAND Enric Balletbo i Serra
2013-02-08 9:14 ` [U-Boot] [PATCHv2 4/4] OMAP3: Initialize gpmc if SPL_ONENAND_SUPPORT is enabled Enric Balletbo i Serra
3 siblings, 0 replies; 6+ messages in thread
From: Enric Balletbo i Serra @ 2013-02-08 9:14 UTC (permalink / raw)
To: u-boot
From: Enric Balletbo i Serra <eballetbo@iseebcn.com>
Tested with an IGEPv2 board seems that current onenand_spl_load_image implementation
doesn't work. This patch fixes this function changing the read loop and reading the
onenand blocks from page to page.
Tested with various IGEP based boards with a OneNAND from Numonyx.
Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
---
drivers/mtd/onenand/onenand_spl.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/mtd/onenand/onenand_spl.c b/drivers/mtd/onenand/onenand_spl.c
index 50eaa71..4bec2c2 100644
--- a/drivers/mtd/onenand/onenand_spl.c
+++ b/drivers/mtd/onenand/onenand_spl.c
@@ -112,7 +112,7 @@ static int onenand_spl_read_page(uint32_t block, uint32_t page, uint32_t *buf,
void onenand_spl_load_image(uint32_t offs, uint32_t size, void *dst)
{
uint32_t *addr = (uint32_t *)dst;
- uint32_t total_pages;
+ uint32_t to_page;
uint32_t block;
uint32_t page, rpage;
enum onenand_spl_pagesize pagesize;
@@ -125,22 +125,20 @@ void onenand_spl_load_image(uint32_t offs, uint32_t size, void *dst)
* pulling further unwanted functions into the SPL.
*/
if (pagesize == 2048) {
- total_pages = DIV_ROUND_UP(size, 2048);
page = offs / 2048;
+ to_page = page + DIV_ROUND_UP(size, 2048);
} else {
- total_pages = DIV_ROUND_UP(size, 4096);
page = offs / 4096;
+ to_page = page + DIV_ROUND_UP(size, 4096);
}
- for (; page <= total_pages; page++) {
+ for (; page <= to_page; page++) {
block = page / ONENAND_PAGES_PER_BLOCK;
rpage = page & (ONENAND_PAGES_PER_BLOCK - 1);
ret = onenand_spl_read_page(block, rpage, addr, pagesize);
- if (ret) {
- total_pages += ONENAND_PAGES_PER_BLOCK;
+ if (ret)
page += ONENAND_PAGES_PER_BLOCK - 1;
- } else {
+ else
addr += pagesize / 4;
- }
}
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCHv2 3/4] SPL: ONENAND: Support SPL to boot u-boot from OneNAND.
2013-02-08 9:14 [U-Boot] [PATCHv2 0/4] add SPL ONENAND support Enric Balletbo i Serra
2013-02-08 9:14 ` [U-Boot] [PATCHv2 1/4] SPL: ONENAND: Fix some ONENAND related defines Enric Balletbo i Serra
2013-02-08 9:14 ` [U-Boot] [PATCHv2 2/4] SPL: ONENAND: Fix onenand_spl_load_image implementation Enric Balletbo i Serra
@ 2013-02-08 9:14 ` Enric Balletbo i Serra
2013-03-11 18:35 ` [U-Boot] [U-Boot, PATCHv2, " Tom Rini
2013-02-08 9:14 ` [U-Boot] [PATCHv2 4/4] OMAP3: Initialize gpmc if SPL_ONENAND_SUPPORT is enabled Enric Balletbo i Serra
3 siblings, 1 reply; 6+ messages in thread
From: Enric Balletbo i Serra @ 2013-02-08 9:14 UTC (permalink / raw)
To: u-boot
From: Enric Balletbo i Serra <eballetbo@iseebcn.com>
This patch will allow use SPL to boot an u-boot from the OneNAND.
Tested with IGEPv2 board with a OneNAND from Numonyx
Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
---
common/spl/Makefile | 1 +
common/spl/spl.c | 5 +++++
common/spl/spl_onenand.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 53 insertions(+)
create mode 100644 common/spl/spl_onenand.c
diff --git a/common/spl/Makefile b/common/spl/Makefile
index 5698a23..da2afc1 100644
--- a/common/spl/Makefile
+++ b/common/spl/Makefile
@@ -18,6 +18,7 @@ COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o
COBJS-$(CONFIG_SPL_NOR_SUPPORT) += spl_nor.o
COBJS-$(CONFIG_SPL_YMODEM_SUPPORT) += spl_ymodem.o
COBJS-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o
+COBJS-$(CONFIG_SPL_ONENAND_SUPPORT) += spl_onenand.o
COBJS-$(CONFIG_SPL_NET_SUPPORT) += spl_net.o
endif
diff --git a/common/spl/spl.c b/common/spl/spl.c
index ff9ba7b..293c7e1 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -197,6 +197,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
spl_nand_load_image();
break;
#endif
+#ifdef CONFIG_SPL_ONENAND_SUPPORT
+ case BOOT_DEVICE_ONENAND:
+ spl_onenand_load_image();
+ break;
+#endif
#ifdef CONFIG_SPL_NOR_SUPPORT
case BOOT_DEVICE_NOR:
spl_nor_load_image();
diff --git a/common/spl/spl_onenand.c b/common/spl/spl_onenand.c
new file mode 100644
index 0000000..a839557
--- /dev/null
+++ b/common/spl/spl_onenand.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2013
+ * ISEE 2007 SL - Enric Balletbo i Serra <eballetbo@iseebcn.com>
+ *
+ * Based on common/spl/spl_nand.c
+ * Copyright (C) 2011
+ * Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#include <common.h>
+#include <config.h>
+#include <spl.h>
+#include <asm/io.h>
+#include <onenand_uboot.h>
+
+void spl_onenand_load_image(void)
+{
+ struct image_header *header;
+
+ debug("spl: onenand\n");
+
+ /*use CONFIG_SYS_TEXT_BASE as temporary storage area */
+ header = (struct image_header *)(CONFIG_SYS_TEXT_BASE);
+ /* Load u-boot */
+ onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
+ CONFIG_SYS_ONENAND_PAGE_SIZE, (void *)header);
+ spl_parse_image_header(header);
+ onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
+ spl_image.size, (void *)spl_image.load_addr);
+}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCHv2 4/4] OMAP3: Initialize gpmc if SPL_ONENAND_SUPPORT is enabled.
2013-02-08 9:14 [U-Boot] [PATCHv2 0/4] add SPL ONENAND support Enric Balletbo i Serra
` (2 preceding siblings ...)
2013-02-08 9:14 ` [U-Boot] [PATCHv2 3/4] SPL: ONENAND: Support SPL to boot u-boot from OneNAND Enric Balletbo i Serra
@ 2013-02-08 9:14 ` Enric Balletbo i Serra
3 siblings, 0 replies; 6+ messages in thread
From: Enric Balletbo i Serra @ 2013-02-08 9:14 UTC (permalink / raw)
To: u-boot
From: Enric Balletbo i Serra <eballetbo@iseebcn.com>
In order to use SPL boot from OneNAND we should initialize the gpmc.
Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
---
arch/arm/cpu/armv7/omap3/board.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index 89c587e..63063c8 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -110,7 +110,7 @@ int board_mmc_init(bd_t *bis)
void spl_board_init(void)
{
-#ifdef CONFIG_SPL_NAND_SUPPORT
+#if defined(CONFIG_SPL_NAND_SUPPORT) || defined(CONFIG_SPL_ONENAND_SUPPORT)
gpmc_init();
#endif
#ifdef CONFIG_SPL_I2C_SUPPORT
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [U-Boot, PATCHv2, 3/4] SPL: ONENAND: Support SPL to boot u-boot from OneNAND.
2013-02-08 9:14 ` [U-Boot] [PATCHv2 3/4] SPL: ONENAND: Support SPL to boot u-boot from OneNAND Enric Balletbo i Serra
@ 2013-03-11 18:35 ` Tom Rini
0 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2013-03-11 18:35 UTC (permalink / raw)
To: u-boot
On Thu, Feb 07, 2013 at 11:14:48PM -0000, Enric Balletbo i Serra wrote:
> From: Enric Balletbo i Serra <eballetbo@iseebcn.com>
>
> This patch will allow use SPL to boot an u-boot from the OneNAND.
>
> Tested with IGEPv2 board with a OneNAND from Numonyx
>
> Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
>
> ---
> common/spl/Makefile | 1 +
> common/spl/spl.c | 5 +++++
> common/spl/spl_onenand.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 53 insertions(+)
> create mode 100644 common/spl/spl_onenand.c
>
> diff --git a/common/spl/Makefile b/common/spl/Makefile
> index 5698a23..da2afc1 100644
> --- a/common/spl/Makefile
> +++ b/common/spl/Makefile
> @@ -18,6 +18,7 @@ COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o
> COBJS-$(CONFIG_SPL_NOR_SUPPORT) += spl_nor.o
> COBJS-$(CONFIG_SPL_YMODEM_SUPPORT) += spl_ymodem.o
> COBJS-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o
> +COBJS-$(CONFIG_SPL_ONENAND_SUPPORT) += spl_onenand.o
> COBJS-$(CONFIG_SPL_NET_SUPPORT) += spl_net.o
> endif
>
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index ff9ba7b..293c7e1 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -197,6 +197,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
> spl_nand_load_image();
> break;
> #endif
> +#ifdef CONFIG_SPL_ONENAND_SUPPORT
> + case BOOT_DEVICE_ONENAND:
> + spl_onenand_load_image();
> + break;
> +#endif
> #ifdef CONFIG_SPL_NOR_SUPPORT
> case BOOT_DEVICE_NOR:
> spl_nor_load_image();
> diff --git a/common/spl/spl_onenand.c b/common/spl/spl_onenand.c
> new file mode 100644
> index 0000000..a839557
> --- /dev/null
> +++ b/common/spl/spl_onenand.c
> @@ -0,0 +1,47 @@
> +/*
> + * Copyright (C) 2013
> + * ISEE 2007 SL - Enric Balletbo i Serra <eballetbo@iseebcn.com>
> + *
> + * Based on common/spl/spl_nand.c
> + * Copyright (C) 2011
> + * Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de>
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +#include <common.h>
> +#include <config.h>
> +#include <spl.h>
> +#include <asm/io.h>
> +#include <onenand_uboot.h>
> +
> +void spl_onenand_load_image(void)
> +{
> + struct image_header *header;
> +
> + debug("spl: onenand\n");
> +
> + /*use CONFIG_SYS_TEXT_BASE as temporary storage area */
> + header = (struct image_header *)(CONFIG_SYS_TEXT_BASE);
> + /* Load u-boot */
> + onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
> + CONFIG_SYS_ONENAND_PAGE_SIZE, (void *)header);
> + spl_parse_image_header(header);
> + onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
> + spl_image.size, (void *)spl_image.load_addr);
> +}
With the following change:
diff --git a/include/spl.h b/include/spl.h
index b02f36f..b40be80 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -59,6 +59,9 @@ void spl_display_print(void);
/* NAND SPL functions */
void spl_nand_load_image(void);
+/* OneNAND SPL functions */
+void spl_onenand_load_image(void);
+
/* NOR SPL functions */
void spl_nor_load_image(void);
To fix a warning, applied to u-boot-ti/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130311/124d2c2a/attachment.pgp>
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-03-11 18:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-08 9:14 [U-Boot] [PATCHv2 0/4] add SPL ONENAND support Enric Balletbo i Serra
2013-02-08 9:14 ` [U-Boot] [PATCHv2 1/4] SPL: ONENAND: Fix some ONENAND related defines Enric Balletbo i Serra
2013-02-08 9:14 ` [U-Boot] [PATCHv2 2/4] SPL: ONENAND: Fix onenand_spl_load_image implementation Enric Balletbo i Serra
2013-02-08 9:14 ` [U-Boot] [PATCHv2 3/4] SPL: ONENAND: Support SPL to boot u-boot from OneNAND Enric Balletbo i Serra
2013-03-11 18:35 ` [U-Boot] [U-Boot, PATCHv2, " Tom Rini
2013-02-08 9:14 ` [U-Boot] [PATCHv2 4/4] OMAP3: Initialize gpmc if SPL_ONENAND_SUPPORT is enabled Enric Balletbo i Serra
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.