mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 10/22] ARM: i.MX: external NAND boot: create function macro for different SoCs
Date: Fri, 17 Jan 2014 16:03:20 +0100	[thread overview]
Message-ID: <1389971012-22977-11-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1389971012-22977-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/external-nand-boot.c | 112 +++++++--------------------------
 1 file changed, 23 insertions(+), 89 deletions(-)

diff --git a/arch/arm/mach-imx/external-nand-boot.c b/arch/arm/mach-imx/external-nand-boot.c
index a1221c8..4d86ab9 100644
--- a/arch/arm/mach-imx/external-nand-boot.c
+++ b/arch/arm/mach-imx/external-nand-boot.c
@@ -329,95 +329,29 @@ static inline int imx35_pagesize_2k(void)
  * NAND. In this case the booting is continued without loading an image from
  * NAND. This function needs a stack to be set up.
  */
-#ifdef BROKEN
-BARE_INIT_FUNCTION(imx21_barebox_boot_nand_external)(void)
-{
-	unsigned long nfc_base = MX21_NFC_BASE_ADDR;
-	int pagesize_2k;
-
-	if (imx_barebox_boot_nand_external(nfc_base)) {
-		jump_sdram(nfc_base - ld_var(_text));
-
-		pagesize_2k = imx21_pagesize_2k();
-
-		imx_nand_load_image((void *)ld_var(_text),
-				ld_var(barebox_image_size),
-				(void *)nfc_base, pagesize_2k);
-	}
-
-	/* This function doesn't exist yet */
-	imx21_barebox_entry(0);
-}
-#endif
-
-BARE_INIT_FUNCTION(imx25_barebox_boot_nand_external)(void)
-{
-	unsigned long nfc_base = MX25_NFC_BASE_ADDR;
-	int pagesize_2k;
-
-	if (imx_barebox_boot_nand_external(nfc_base)) {
-		jump_sdram(nfc_base - ld_var(_text));
-
-		pagesize_2k = imx25_pagesize_2k();
-
-		imx_nand_load_image((void *)ld_var(_text),
-				ld_var(_barebox_image_size),
-				(void *)nfc_base, pagesize_2k);
-	}
-
-	imx25_barebox_entry(0);
-}
-
-BARE_INIT_FUNCTION(imx27_barebox_boot_nand_external)(void)
-{
-	unsigned long nfc_base = MX27_NFC_BASE_ADDR;
-	int pagesize_2k;
-
-	if (imx_barebox_boot_nand_external(nfc_base)) {
-		jump_sdram(nfc_base - ld_var(_text));
 
-		pagesize_2k = imx27_pagesize_2k();
-
-		imx_nand_load_image((void *)ld_var(_text),
-				ld_var(_barebox_image_size),
-				(void *)nfc_base, pagesize_2k);
-	}
-
-	imx27_barebox_entry(0);
-}
-
-BARE_INIT_FUNCTION(imx31_barebox_boot_nand_external)(void)
-{
-	unsigned long nfc_base = MX31_NFC_BASE_ADDR;
-	int pagesize_2k;
-
-	if (imx_barebox_boot_nand_external(nfc_base)) {
-		jump_sdram(nfc_base - ld_var(_text));
-
-		pagesize_2k = imx31_pagesize_2k();
-
-		imx_nand_load_image((void *)ld_var(_text),
-				ld_var(_barebox_image_size),
-				(void *)nfc_base, pagesize_2k);
-	}
-
-	imx31_barebox_entry(0);
+#define DEFINE_EXTERNAL_NAND_ENTRY(soc)					\
+									\
+BARE_INIT_FUNCTION(imx##soc##_barebox_boot_nand_external)(void)		\
+{									\
+	unsigned long nfc_base = MX##soc##_NFC_BASE_ADDR;		\
+									\
+	if (imx_barebox_boot_nand_external(nfc_base)) {			\
+		jump_sdram(nfc_base - ld_var(_text));			\
+									\
+		imx_nand_load_image((void *)ld_var(_text),		\
+				ld_var(_barebox_image_size),		\
+				(void *)nfc_base,			\
+				imx##soc##_pagesize_2k());		\
+	}								\
+									\
+	imx##soc##_barebox_entry(0);					\
 }
 
-BARE_INIT_FUNCTION(imx35_barebox_boot_nand_external)(void)
-{
-	unsigned long nfc_base = MX35_NFC_BASE_ADDR;
-	int pagesize_2k;
-
-	if (imx_barebox_boot_nand_external(nfc_base)) {
-		jump_sdram(nfc_base - ld_var(_text));
-
-		pagesize_2k = imx35_pagesize_2k();
-
-		imx_nand_load_image((void *)ld_var(_text),
-				ld_var(_barebox_image_size),
-				(void *)nfc_base, pagesize_2k);
-	}
-
-	imx35_barebox_entry(0);
-}
+#ifdef BROKEN
+DEFINE_EXTERNAL_NAND_ENTRY(21)
+#endif
+DEFINE_EXTERNAL_NAND_ENTRY(25)
+DEFINE_EXTERNAL_NAND_ENTRY(27)
+DEFINE_EXTERNAL_NAND_ENTRY(31)
+DEFINE_EXTERNAL_NAND_ENTRY(35)
-- 
1.8.5.2


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

  parent reply	other threads:[~2014-01-17 15:04 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-17 15:03 phyCARD-i.MX27 patches Sascha Hauer
2014-01-17 15:03 ` [PATCH 01/22] ARM: Karo TX25: register external NAND boot update handler Sascha Hauer
2014-01-17 15:03 ` [PATCH 02/22] ARM: phyCARD-i.MX27: increase barebox partition Sascha Hauer
2014-01-18 19:16   ` Alexander Aring
2014-01-19 14:19     ` Alexander Aring
2014-01-20  9:28     ` Sascha Hauer
2014-01-17 15:03 ` [PATCH 03/22] ARM: phyCARD-i.MX27: register barebox update handler Sascha Hauer
2014-01-17 15:03 ` [PATCH 04/22] ARM: phyCARD-i.MX27: switch to new environment Sascha Hauer
2014-01-17 15:03 ` [PATCH 05/22] ARM: phyCARD-i.MX27: convert lowlevel init to c code Sascha Hauer
2014-01-17 15:03 ` [PATCH 06/22] ARM: i.MX27: Add missing MPLL clock sources Sascha Hauer
2014-01-17 15:03 ` [PATCH 07/22] ARM: phyCARD-i.MX27: Update defconfig Sascha Hauer
2014-01-17 15:03 ` [PATCH 08/22] ARM: Fix image size calculation for CONFIG_PBL_RELOCATABLE Sascha Hauer
2014-01-17 15:03 ` [PATCH 09/22] ARM: i.MX: external NAND boot: factor out a 2k pagesize detection function Sascha Hauer
2014-01-17 15:03 ` Sascha Hauer [this message]
2014-01-17 15:03 ` [PATCH 11/22] ARM: i.MX: external NAND boot: make it work with relocatable PBL Sascha Hauer
2014-01-17 15:03 ` [PATCH 12/22] ARM: dts: Add i.MX27 devicetree files Sascha Hauer
2014-01-17 16:35   ` Alexander Shiyan
2014-01-17 15:03 ` [PATCH 13/22] ARM: dts: Add Phytec phyCARD-i.MX27 " Sascha Hauer
2014-01-17 16:26   ` Alexander Shiyan
2014-01-17 17:56     ` Sascha Hauer
2014-01-17 15:03 ` [PATCH 14/22] ARM: i.MX: external NAND boot: pass boarddata Sascha Hauer
2014-01-17 15:03 ` [PATCH 15/22] pinctrl: Add pinctrl driver for i.MX1/21/27 Sascha Hauer
2014-01-17 15:13   ` Alexander Shiyan
2014-01-17 17:55     ` Sascha Hauer
2014-01-17 15:03 ` [PATCH 16/22] ARM: i.MX clocksource: return successful for multiple instances Sascha Hauer
2014-01-17 15:03 ` [PATCH 17/22] ARM: phycard-i.MX27: Add NAND support to dts Sascha Hauer
2014-01-17 15:03 ` [PATCH 18/22] ARM: phycard-i.MX27: Add stdout-path property Sascha Hauer
2014-01-17 15:03 ` [PATCH 19/22] ARM: dts: phycard-i.MX27: Add environment and NAND partitioning Sascha Hauer
2014-01-17 16:20   ` Alexander Shiyan
2014-01-20  9:50     ` Sascha Hauer
2014-01-17 15:03 ` [PATCH 20/22] ARM: dts: phycard-i.MX27: Add sdhc2 pinctrl Sascha Hauer
2014-01-18 18:09   ` Alexander Aring
2014-01-20  9:52     ` Sascha Hauer
2014-01-17 15:03 ` [PATCH 21/22] mci: imx: Add devicetree probe support Sascha Hauer
2014-01-17 15:03 ` [PATCH 22/22] ARM: phyCARD-i.MX27: Switch to " Sascha Hauer

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=1389971012-22977-11-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox