From patchwork Thu Apr 21 05:43:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 66290 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2854835qge; Wed, 20 Apr 2016 23:06:17 -0700 (PDT) X-Received: by 10.28.47.206 with SMTP id v197mr9755869wmv.87.1461218777779; Wed, 20 Apr 2016 23:06:17 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id dd9si1191014wjc.207.2016.04.20.23.06.17; Wed, 20 Apr 2016 23:06:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 103DFA7933; Thu, 21 Apr 2016 07:52:22 +0200 (CEST) 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 orK0CSSHRE4w; Thu, 21 Apr 2016 07:52:21 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 77ED6A7AD6; Thu, 21 Apr 2016 07:46:52 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 365ADA77C7 for ; Thu, 21 Apr 2016 07:44:18 +0200 (CEST) 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 qvP7qYo9YALP for ; Thu, 21 Apr 2016 07:44:18 +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 conuserg-07.nifty.com (conuserg-07.nifty.com [210.131.2.74]) by theia.denx.de (Postfix) with ESMTPS id EBB82A77F6 for ; Thu, 21 Apr 2016 07:42:40 +0200 (CEST) Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id u3L5gQcF010871; Thu, 21 Apr 2016 14:42:29 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com u3L5gQcF010871 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1461217349; bh=dzrLHnReHsemzjd3v7lYCDDvt+sJvvBZPQsp56qSHNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vvwYkoEBH62q+vUW+VdcOSnV4iXh/0gUQ1jB8BYuaJUjJ3oxjEhGqILgCAXaFwLHk r8F3az7rlVqfLOU9UmQvWLpt8FTr1X8DkAa3+FXMcgg2ACZcK2YAGzKsZn+pdfZoiC IPas69ZnLAMoBOV/xXmzhVekrYPHafHwHh8PRwFglN45Np+mWEHxZ5K+E2NT1ul/ey AfEPOnEb0esVsWqrsw6xbt3nbLTI/lq3sd5zI3eDVTka/gOvPD/z+3qep7aO4b8oDa 1TxctKxRzHTLZxH1ESxDS1M5uUQFNxIYkvQL2dYMeibQCCZlndlq8V2PNnfx/vInas P1GR5uXfKVjOg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Thu, 21 Apr 2016 14:43:12 +0900 Message-Id: <1461217402-25430-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461217402-25430-1-git-send-email-yamada.masahiro@socionext.com> References: <1461217402-25430-1-git-send-email-yamada.masahiro@socionext.com> Subject: [U-Boot] [PATCH v4 03/13] ARM: uniphier: avoid unaligned access to DT on 64bit SoC X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Because DT properties are 4-byte aligned, the pointer access *(fdt64_t *) in this code causes unaligned access. Signed-off-by: Masahiro Yamada --- Changes in v4: None Changes in v3: None Changes in v2: None arch/arm/mach-uniphier/dram_init.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/arch/arm/mach-uniphier/dram_init.c b/arch/arm/mach-uniphier/dram_init.c index 815f243..ef0e2e8 100644 --- a/arch/arm/mach-uniphier/dram_init.c +++ b/arch/arm/mach-uniphier/dram_init.c @@ -6,6 +6,7 @@ #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; @@ -40,8 +41,7 @@ int dram_init(void) val += ac; - gd->ram_size = sc == 2 ? fdt64_to_cpu(*(fdt64_t *)val) : - fdt32_to_cpu(*val); + gd->ram_size = fdtdec_get_number(val, sc); debug("DRAM size = %08lx\n", (unsigned long)gd->ram_size); @@ -71,11 +71,9 @@ void dram_init_banksize(void) for (i = 0; i < CONFIG_NR_DRAM_BANKS && len >= cells; i++, len -= cells) { - gd->bd->bi_dram[i].start = ac == 2 ? - fdt64_to_cpu(*(fdt64_t *)val) : fdt32_to_cpu(*val); + gd->bd->bi_dram[i].start = fdtdec_get_number(val, ac); val += ac; - gd->bd->bi_dram[i].size = sc == 2 ? - fdt64_to_cpu(*(fdt64_t *)val) : fdt32_to_cpu(*val); + gd->bd->bi_dram[i].size = fdtdec_get_number(val, sc); val += sc; debug("DRAM bank %d: start = %08lx, size = %08lx\n",