public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: matthias.fuchs at esd-electronics.com <matthias.fuchs@esd-electronics.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ppc4xx: Fix esd loadpci command
Date: Tue, 28 Oct 2008 13:36:57 +0100	[thread overview]
Message-ID: <12251974201713-git-send-email-matthias.fuchs@esd-electronics.com> (raw)
In-Reply-To: <1225197420873-git-send-email-matthias.fuchs@esd-electronics.com>

From: Matthias Fuchs <matthias.fuchs@esd-electronics.com>

This patch fixes esd's loadpci command when not all
memory on adapter boards is accessable via PCI.

Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
---
 board/esd/common/cmd_loadpci.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/board/esd/common/cmd_loadpci.c b/board/esd/common/cmd_loadpci.c
index d88b387..ad490c3 100644
--- a/board/esd/common/cmd_loadpci.c
+++ b/board/esd/common/cmd_loadpci.c
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2005
+ * (C) Copyright 2005-2008
  * Matthias Fuchs, esd GmbH Germany, matthias.fuchs at esd-electronics.com
  *
  * See file CREDITS for list of people who contributed to this
@@ -23,6 +23,9 @@
 
 #include <common.h>
 #include <command.h>
+#if !defined(CONFIG_440)
+#include <asm/4xx_pci.h>
+#endif
 
 #if defined(CONFIG_CMD_BSP)
 
@@ -36,18 +39,24 @@ extern int do_autoscript (cmd_tbl_t *, int, int, char *[]);
  */
 int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
-	unsigned int *ptr = 0;
+	u32 *ptr = 0;
 	int count = 0;
 	int count2 = 0;
 	char addr[16];
 	char str[] = "\\|/-";
 	char *local_args[2];
+	u32 la, ptm1la;
 
+#if defined(CONFIG_440)
+	ptm1la = in32r(PCIX0_PTM1LA);
+#else
+	ptm1la = in32r(PTM1LA);
+#endif
 	while(1) {
 		/*
 		 * Mark sync address
 		 */
-		ptr = 0;
+		ptr = (u32 *)ptm1la;
 		memset(ptr, 0, 0x20);
 
 		*ptr = 0xffffffff;
@@ -74,7 +83,8 @@ int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		}
 
 		printf("\nGot bootcode %08x: ", *ptr);
-		sprintf(addr, "%08x", *ptr & ADDRMASK);
+		la = ptm1la + (*ptr & ADDRMASK);
+		sprintf(addr, "%08x", la);
 
 		switch (*ptr & ~ADDRMASK) {
 		case 0:
@@ -83,8 +93,7 @@ int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 			 */
 			printf("booting image at addr 0x%s ...\n", addr);
 			setenv("loadaddr", addr);
-
-			do_bootm (cmdtp, 0, 0, NULL);
+			do_bootm(cmdtp, 0, 0, NULL);
 			break;
 
 		case 1:
@@ -92,7 +101,6 @@ int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 			 * Boot image via autoscr
 			 */
 			printf("executing script at addr 0x%s ...\n", addr);
-
 			local_args[0] = addr;
 			local_args[1] = NULL;
 			do_autoscript(cmdtp, 0, 1, local_args);
@@ -103,7 +111,7 @@ int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 			 * Call run_cmd
 			 */
 			printf("running command at addr 0x%s ...\n", addr);
-			run_command ((char*)(*ptr & ADDRMASK), 0);
+			run_command((char*)la, 0);
 			break;
 
 		default:
-- 
1.5.3

  reply	other threads:[~2008-10-28 12:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-28 12:36 [U-Boot] [PATCH] ppc4xx: Handle other board variant in PMC440 FPGA code matthias.fuchs at esd-electronics.com
2008-10-28 12:36 ` [U-Boot] [PATCH] ppc4xx: Clean up PMC440 header matthias.fuchs at esd-electronics.com
2008-10-28 12:36   ` matthias.fuchs at esd-electronics.com [this message]
2008-10-28 12:36     ` [U-Boot] [PATCH] ppc4xx: Update PMC440 board configuration matthias.fuchs at esd-electronics.com
2008-10-28 12:36       ` [U-Boot] [PATCH] ppc4xx: Fix PMC440 BSP commands matthias.fuchs at esd-electronics.com
2008-10-28 12:37         ` [U-Boot] [PATCH] ppc4xx: Update PMC440 board support matthias.fuchs at esd-electronics.com

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=12251974201713-git-send-email-matthias.fuchs@esd-electronics.com \
    --to=matthias.fuchs@esd-electronics.com \
    --cc=u-boot@lists.denx.de \
    /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