From patchwork Thu Oct 13 13:12:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Fuchs X-Patchwork-Id: 119494 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 9CF9DB6F85 for ; Fri, 14 Oct 2011 00:16:14 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3C00128A21; Thu, 13 Oct 2011 15:16:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id s-aln-msDPdr; Thu, 13 Oct 2011 15:16:10 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9E6E228A10; Thu, 13 Oct 2011 15:16:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F3FB528A10 for ; Thu, 13 Oct 2011 15:16:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c6n2LoRGP9jL for ; Thu, 13 Oct 2011 15:16:03 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.10]) by theia.denx.de (Postfix) with ESMTP id DD088289EE for ; Thu, 13 Oct 2011 15:16:02 +0200 (CEST) Received: from comm-neu.esd (a89-182-131-39.net-htp.de [89.182.131.39]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0La2FZ-1Qp9LR1gKr-00lXGE; Thu, 13 Oct 2011 15:16:01 +0200 Received: from localhost (localhost [127.0.0.1]) by comm-neu.esd (Postfix) with ESMTP id 2A1B71362DB; Thu, 13 Oct 2011 15:14:53 +0200 (CEST) Received: from comm-neu.esd ([127.0.0.1]) by localhost (comm [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 20628-02-16; Thu, 13 Oct 2011 15:14:53 +0200 (CEST) Received: from localhost.localdomain (debby.esd [10.0.0.190]) by comm-neu.esd (Postfix) with ESMTP id CA74B1362E3; Thu, 13 Oct 2011 15:12:24 +0200 (CEST) From: matthias.fuchs@esd.eu To: u-boot@lists.denx.de Date: Thu, 13 Oct 2011 15:12:24 +0200 Message-Id: <13185115443174-git-send-email-matthias.fuchs@esd.eu> X-Mailer: git-send-email 1.5.3 In-Reply-To: <13185115441965-git-send-email-matthias.fuchs@esd.eu> References: <13185115443925-git-send-email-matthias.fuchs@esd.eu> <13185115441965-git-send-email-matthias.fuchs@esd.eu> X-Virus-Scanned: by amavisd at esd-GmbH-Hannover X-Provags-ID: V02:K0:GkANL4FTkZp9x1DlXKXOG0x0MGC/ufv9xphaNZAqhcm ZMV8i7MCV+/qFH8QKPpBVF6ymcQoalWDcd3P6EeObUiZV7RtKC YL0I1XT+evXfKTxDdSzxdYTvE+vljl53IcYFP8aKhL8/EqwdOT O7DsJXTDwg1gJ8tG3Mr8c/zGJR1HrN5wBBEn9OWgFK106c35uq Gy7OLuqpHRynlwlQGg7gFfmtcXh9eNUsZ9tjXk6MnZ1x7o3j4O 0EBxNSX6AA9xrdjI6Q9qkwgoy5Eh8DzPPjhioN4MCxhwzvQxnv gngUVaZbbAGEsrAv+VnAURFSLfmKHRR6WcYiNiiNCikTNxfNGW KSlX10mLK+ImGcv5Yo4brk/WFK9l/1ufCJgAtsf+3 Cc: sr@denx.de, Matthias Fuchs Subject: [U-Boot] [PATCH 3/3] ppc4xx: fix PMC440 painit command X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Matthias Fuchs 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 --- 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 200d7ee..3bcf2b0 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 -extern env_t *env_ptr; +#include +#include 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); + 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 */