* [U-Boot] [PATCH V2] ppc4xx: fix PMC440 painit command
@ 2011-11-24 15:36 Matthias Fuchs
2011-12-01 8:13 ` Stefan Roese
0 siblings, 1 reply; 2+ messages in thread
From: Matthias Fuchs @ 2011-11-24 15:36 UTC (permalink / raw)
To: u-boot
This patch fixes the PMC440 BSP command painit. The implementation was
broken since the step to the new environment handling.
Signed-off-by: Matthias Fuchs <matthias.fuchs@esd.eu>
---
V2: rebased
board/esd/pmc440/cmd_pmc440.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/board/esd/pmc440/cmd_pmc440.c b/board/esd/pmc440/cmd_pmc440.c
index 0202876..647e658 100644
--- a/board/esd/pmc440/cmd_pmc440.c
+++ b/board/esd/pmc440/cmd_pmc440.c
@@ -342,7 +342,8 @@ U_BOOT_CMD(
#if defined(CONFIG_PRAM)
#include <environment.h>
-extern env_t *env_ptr;
+#include <search.h>
+#include <errno.h>
int do_painit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
@@ -351,6 +352,10 @@ int do_painit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
u32 param;
ulong *lptr;
+ env_t *envp;
+ char *res;
+ int len;
+
v = getenv("pram");
if (v)
pram = simple_strtoul(v, NULL, 10);
@@ -384,7 +389,15 @@ int do_painit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* env is first (4k aligned) */
nextbase -= ((CONFIG_ENV_SIZE + 4096 - 1) & ~(4096 - 1));
- memcpy((void*)nextbase, env_ptr, CONFIG_ENV_SIZE);
+ envp = (env_t *)nextbase;
+ res = (char *)envp->data;
+ len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
+ if (len < 0) {
+ error("Cannot export environment: errno = %d\n", errno);
+ return 1;
+ }
+ envp->crc = crc32(0, envp->data, ENV_SIZE);
+
*(--lptr) = CONFIG_ENV_SIZE; /* size */
*(--lptr) = base - nextbase; /* offset | type=0 */
--
1.6.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH V2] ppc4xx: fix PMC440 painit command
2011-11-24 15:36 [U-Boot] [PATCH V2] ppc4xx: fix PMC440 painit command Matthias Fuchs
@ 2011-12-01 8:13 ` Stefan Roese
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Roese @ 2011-12-01 8:13 UTC (permalink / raw)
To: u-boot
On Thursday 24 November 2011 16:36:06 Matthias Fuchs wrote:
> This patch fixes the PMC440 BSP command painit. The implementation was
> broken since the step to the new environment handling.
Applied to u-boot-ppc4xx. Thanks.
Best regards,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-01 8:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-24 15:36 [U-Boot] [PATCH V2] ppc4xx: fix PMC440 painit command Matthias Fuchs
2011-12-01 8:13 ` Stefan Roese
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox