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 4/6] ARM boards: Use accessor functions to access linker variables
Date: Mon,  4 Mar 2013 21:03:07 +0100	[thread overview]
Message-ID: <1362427389-2144-5-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1362427389-2144-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/friendlyarm-tiny210/lowlevel.c |  3 ++-
 arch/arm/mach-imx/external-nand-boot.c         | 27 +++++++++++++++-----------
 drivers/mtd/nand/nand_s3c24xx.c                |  2 +-
 3 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/arch/arm/boards/friendlyarm-tiny210/lowlevel.c b/arch/arm/boards/friendlyarm-tiny210/lowlevel.c
index 1da7ba8..3bd1379 100644
--- a/arch/arm/boards/friendlyarm-tiny210/lowlevel.c
+++ b/arch/arm/boards/friendlyarm-tiny210/lowlevel.c
@@ -67,7 +67,8 @@ void __bare_init barebox_arm_reset_vector(void)
 
 	s5p_init_dram_bank_ddr2(S5P_DMC0_BASE, 0x20E00323, 0, 0);
 
-	if (! s5p_irom_load_mmc((void*)TEXT_BASE - 16, 1, (barebox_image_size + 16 + 511) / 512))
+	if (! s5p_irom_load_mmc((void*)TEXT_BASE - 16, 1,
+				(ld_var(_barebox_image_size) + 16 + 511) / 512))
 		while (1) { } /* hang */
 
 	/* Jump to SDRAM */
diff --git a/arch/arm/mach-imx/external-nand-boot.c b/arch/arm/mach-imx/external-nand-boot.c
index 73c4ccd..3ac1132 100644
--- a/arch/arm/mach-imx/external-nand-boot.c
+++ b/arch/arm/mach-imx/external-nand-boot.c
@@ -292,7 +292,7 @@ int __bare_init imx_barebox_boot_nand_external(unsigned long nfc_base)
 		return 0;
 
 	src = (unsigned int *)nfc_base;
-	trg = (unsigned int *)_text;
+	trg = (unsigned int *)ld_var(_text);
 
 	/* Move ourselves out of NFC SRAM */
 	for (i = 0; i < 0x800 / sizeof(int); i++)
@@ -313,8 +313,9 @@ void __bare_init __noreturn imx21_barebox_boot_nand_external(void)
 	unsigned long nfc_base = MX21_NFC_BASE_ADDR;
 
 	if (imx_barebox_boot_nand_external(nfc_base)) {
-		jump_sdram(nfc_base - (unsigned long)_text);
-		imx_nand_load_image((void *)_text, barebox_image_size);
+		jump_sdram(nfc_base - ld_var(_text));
+		imx_nand_load_image((void *)ld_var(_text),
+				ld_var(barebox_image_size));
 	}
 
 	imx21_barebox_entry(0);
@@ -327,8 +328,9 @@ void __bare_init __noreturn imx25_barebox_boot_nand_external(void)
 	unsigned long nfc_base = MX25_NFC_BASE_ADDR;
 
 	if (imx_barebox_boot_nand_external(nfc_base)) {
-		jump_sdram(nfc_base - (unsigned long)_text);
-		imx_nand_load_image((void *)_text, barebox_image_size);
+		jump_sdram(nfc_base - ld_var(_text));
+		imx_nand_load_image((void *)ld_var(_text),
+				ld_var(_barebox_image_size));
 	}
 
 	imx25_barebox_entry(0);
@@ -341,8 +343,9 @@ void __bare_init __noreturn imx27_barebox_boot_nand_external(void)
 	unsigned long nfc_base = MX27_NFC_BASE_ADDR;
 
 	if (imx_barebox_boot_nand_external(nfc_base)) {
-		jump_sdram(nfc_base - (unsigned long)_text);
-		imx_nand_load_image((void *)_text, barebox_image_size);
+		jump_sdram(nfc_base - ld_var(_text));
+		imx_nand_load_image((void *)ld_var(_text),
+				ld_var(_barebox_image_size));
 	}
 
 	imx27_barebox_entry(0);
@@ -355,8 +358,9 @@ void __bare_init __noreturn imx31_barebox_boot_nand_external(void)
 	unsigned long nfc_base = MX31_NFC_BASE_ADDR;
 
 	if (imx_barebox_boot_nand_external(nfc_base)) {
-		jump_sdram(nfc_base - (unsigned long)_text);
-		imx_nand_load_image((void *)_text, barebox_image_size);
+		jump_sdram(nfc_base - ld_var(_text));
+		imx_nand_load_image((void *)ld_var(_text),
+				ld_var(_barebox_image_size));
 	}
 
 	imx31_barebox_entry(0);
@@ -369,8 +373,9 @@ void __bare_init __noreturn imx35_barebox_boot_nand_external(void)
 	unsigned long nfc_base = MX35_NFC_BASE_ADDR;
 
 	if (imx_barebox_boot_nand_external(nfc_base)) {
-		jump_sdram(nfc_base - (unsigned long)_text);
-		imx_nand_load_image((void *)_text, barebox_image_size);
+		jump_sdram(nfc_base - ld_var(_text));
+		imx_nand_load_image((void *)ld_var(_text),
+				ld_var(_barebox_image_size));
 	}
 
 	imx35_barebox_entry(0);
diff --git a/drivers/mtd/nand/nand_s3c24xx.c b/drivers/mtd/nand/nand_s3c24xx.c
index fef9432..c2e41a9 100644
--- a/drivers/mtd/nand/nand_s3c24xx.c
+++ b/drivers/mtd/nand/nand_s3c24xx.c
@@ -607,7 +607,7 @@ void __nand_boot_init s3c24x0_nand_load_image(void *dest, int size, int page)
 void __nand_boot_init nand_boot(void)
 {
 	void *dest = _text;
-	int size = barebox_image_size;
+	int size = ld_var(_barebox_image_size);
 	int page = 0;
 
 	s3c24x0_nand_load_image(dest, size, page);
-- 
1.8.2.rc2


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

  parent reply	other threads:[~2013-03-04 20:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04 20:03 [PATCH] ARM: Add relocatable binary support Sascha Hauer
2013-03-04 20:03 ` [PATCH 1/6] ARM: make cpu architecture detection available as static inline function Sascha Hauer
2013-03-04 20:46   ` Alexander Aring
2013-03-05 10:34     ` Sascha Hauer
2013-03-04 20:03 ` [PATCH 2/6] ARM: add early mmu cache flush function and use it in setup_c Sascha Hauer
2013-03-04 20:03 ` [PATCH 3/6] ARM: provide accessor functions for linker variables Sascha Hauer
2013-03-04 20:03 ` Sascha Hauer [this message]
2013-03-04 20:03 ` [PATCH 5/6] ARN: fixup vector addresses for relocatable binaries Sascha Hauer
2013-03-04 20:03 ` [PATCH 6/6] ARM: Add relocatable binary support Sascha Hauer
2013-03-04 20:10   ` Alexander Shiyan
2013-03-04 20:19     ` Sascha Hauer
2013-03-05  4:32       ` Re[2]: " Alexander Shiyan
2013-03-05  7:25         ` Sascha Hauer
2013-03-04 20:53   ` Alexander Aring
2013-03-05 10:46     ` 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=1362427389-2144-5-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