From patchwork Sat Nov 5 01:55:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Denk X-Patchwork-Id: 123752 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 4E9EFB6F86 for ; Sat, 5 Nov 2011 12:59:30 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 99799299AB; Sat, 5 Nov 2011 02:58:46 +0100 (CET) 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 JXeIynfp4fyn; Sat, 5 Nov 2011 02:58:46 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BBDC829738; Sat, 5 Nov 2011 02:56:35 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1CA3A295DB for ; Sat, 5 Nov 2011 02:56:17 +0100 (CET) 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 f3Cdo+2Cvm6s for ; Sat, 5 Nov 2011 02:56:16 +0100 (CET) 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 mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by theia.denx.de (Postfix) with ESMTP id 27307295E5 for ; Sat, 5 Nov 2011 02:56:09 +0100 (CET) Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 129F3188A170 for ; Sat, 5 Nov 2011 02:57:29 +0100 (CET) X-Auth-Info: DkSnPPobgD2jeLbbGTTVHV9UKtTj7R7uJyRu5c2qbnM= Received: from diddl.denx.de (host-80-81-18-216.customer.m-online.net [80.81.18.216]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA id 0452E1C0013D for ; Sat, 5 Nov 2011 02:56:09 +0100 (CET) Received: from gemini.denx.de (unknown [10.0.0.2]) by diddl.denx.de (Postfix) with ESMTP id D0830C913106 for ; Sat, 5 Nov 2011 02:56:08 +0100 (CET) Received: by gemini.denx.de (Postfix, from userid 500) id 89B2D1893014; Sat, 5 Nov 2011 02:56:08 +0100 (CET) From: Wolfgang Denk To: u-boot@lists.denx.de Date: Sat, 5 Nov 2011 02:55:44 +0100 Message-Id: <1320458160-23136-41-git-send-email-wd@denx.de> X-Mailer: git-send-email 1.7.6.4 In-Reply-To: <1320458160-23136-1-git-send-email-wd@denx.de> References: <1320458160-23136-1-git-send-email-wd@denx.de> Subject: [U-Boot] [PATCH 40/56] board/mbx8xx/mbx8xx.c: Fix GCC 4.6 build warnings 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 Fix: mbx8xx.c: In function 'mbx_init': mbx8xx.c:127:15: warning: variable 'refclock' set but not used [-Wunused-but-set-variable] mbx8xx.c: In function 'board_get_cpufreq': mbx8xx.c:231:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] mbx8xx.c: In function 'get_reffreq': mbx8xx.c:242:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] Signed-off-by: Wolfgang Denk --- board/mbx8xx/mbx8xx.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/board/mbx8xx/mbx8xx.c b/board/mbx8xx/mbx8xx.c index 255796b..0f014e1 100644 --- a/board/mbx8xx/mbx8xx.c +++ b/board/mbx8xx/mbx8xx.c @@ -117,14 +117,16 @@ static const uint sdram_table_50[] = { /* ------------------------------------------------------------------------- */ +#ifdef CONFIG_SYS_USE_OSCCLK static unsigned int get_reffreq(void); +#endif static unsigned int board_get_cpufreq(void); void mbx_init (void) { volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR; volatile memctl8xx_t *memctl = &immr->im_memctl; - ulong speed, refclock, plprcr, sccr; + ulong speed, plprcr, sccr; ulong br0_32 = memctl->memc_br0 & 0x400; /* real-time clock status and control register */ @@ -152,7 +154,6 @@ void mbx_init (void) immr->im_clkrst.car_sccr = sccr; speed = board_get_cpufreq (); - refclock = get_reffreq (); #if ((CONFIG_SYS_PLPRCR & PLPRCR_MF_MSK) != 0) plprcr = CONFIG_SYS_PLPRCR; @@ -163,7 +164,7 @@ void mbx_init (void) #endif #ifdef CONFIG_SYS_USE_OSCCLK /* See doc/README.MBX ! */ - plprcr |= ((speed + refclock / 2) / refclock - 1) << 20; + plprcr |= ((speed + get_reffreq() / 2) / refclock - 1) << 20; #endif immr->im_clkrstk.cark_plprcrk = KAPWR_KEY; @@ -226,21 +227,27 @@ static unsigned int board_get_cpufreq (void) { #ifndef CONFIG_8xx_GCLK_FREQ vpd_packet_t *packet; + ulong *p; packet = vpd_find_packet (VPD_PID_ICS); - return *((ulong *) packet->data); + p = (ulong *)packet->data; + return *p; #else return((unsigned int)CONFIG_8xx_GCLK_FREQ ); #endif /* CONFIG_8xx_GCLK_FREQ */ } +#ifdef CONFIG_SYS_USE_OSCCLK static unsigned int get_reffreq (void) { vpd_packet_t *packet; + ulong *p; packet = vpd_find_packet (VPD_PID_RCS); - return *((ulong *) packet->data); + p = (ulong *)packet->data; + return *p; } +#endif static void board_get_enetaddr(uchar *addr) {