From patchwork Sat Nov 5 01:55:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Denk X-Patchwork-Id: 123739 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 0D8DFB6FA5 for ; Sat, 5 Nov 2011 12:57:15 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3FFE728BBA; Sat, 5 Nov 2011 02:57:05 +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 wDWxN8Jwr46Z; Sat, 5 Nov 2011 02:57:05 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 558D1295F1; Sat, 5 Nov 2011 02:56:20 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C508229653 for ; Sat, 5 Nov 2011 02:56:11 +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 zbTIeMhugQv0 for ; Sat, 5 Nov 2011 02:56:09 +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 36EB528B6C for ; Sat, 5 Nov 2011 02:56:07 +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 C0A0B188B591 for ; Sat, 5 Nov 2011 02:57:26 +0100 (CET) X-Auth-Info: dMxv7JHia2043X/dGzv33f/RwiJdcIfayDOzutHuDcY= 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 B54BB1C0012D for ; Sat, 5 Nov 2011 02:56:06 +0100 (CET) Received: from gemini.denx.de (unknown [10.0.0.2]) by diddl.denx.de (Postfix) with ESMTP id 59783C8CD260 for ; Sat, 5 Nov 2011 02:56:06 +0100 (CET) Received: by gemini.denx.de (Postfix, from userid 500) id 45C081893013; Sat, 5 Nov 2011 02:56:06 +0100 (CET) From: Wolfgang Denk To: u-boot@lists.denx.de Date: Sat, 5 Nov 2011 02:55:09 +0100 Message-Id: <1320458160-23136-6-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 05/56] board/tqc/tqm5200/cmd_stk52xx.c: fix GC 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: cmd_stk52xx.c: In function 'spi_transmit': cmd_stk52xx.c:85:6: warning: variable 'dummy' set but not used [-Wunused-but-set-variable] cmd_stk52xx.c: In function 'i2s_play_wave': cmd_stk52xx.c:199:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] Signed-off-by: Wolfgang Denk --- board/tqc/tqm5200/cmd_stk52xx.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-) diff --git a/board/tqc/tqm5200/cmd_stk52xx.c b/board/tqc/tqm5200/cmd_stk52xx.c index 0789c58..c40f7f0 100644 --- a/board/tqc/tqm5200/cmd_stk52xx.c +++ b/board/tqc/tqm5200/cmd_stk52xx.c @@ -82,18 +82,17 @@ static void spi_init(void) static int spi_transmit(unsigned char data) { - int dummy; struct mpc5xxx_spi *spi = (struct mpc5xxx_spi*)MPC5XXX_SPI; spi->dr = data; /* wait for SPI transmission completed */ - while(!(spi->sr & 0x80)) - { - if (spi->sr & 0x40) /* if write collision occured */ - { + while (!(spi->sr & 0x80)) { + if (spi->sr & 0x40) { /* if write collision occured */ + int dummy; + /* do dummy read to clear status register */ dummy = spi->dr; - printf ("SPI write collision\n"); + printf("SPI write collision: dr=0x%x\n", dummy); return -1; } } @@ -172,10 +171,8 @@ static void i2s_init(void) psc->ccr = 0x1F03; /* 16 bit data width; 5.617MHz MCLK */ psc->ctur = 0x0F; /* 16 bit frame width */ - for(i=0;i<128;i++) - { + for (i = 0; i < 128; i++) psc->psc_buffer_32 = 0; /* clear tx fifo */ - } } static int i2s_play_wave(unsigned long addr, unsigned long len) @@ -183,7 +180,6 @@ static int i2s_play_wave(unsigned long addr, unsigned long len) unsigned long i; unsigned char *wave_file = (uchar *)addr + 44; /* quick'n dirty: skip * wav header*/ - unsigned char swapped[4]; struct mpc5xxx_psc *psc = (struct mpc5xxx_psc*)MPC5XXX_PSC2; /* @@ -192,11 +188,16 @@ static int i2s_play_wave(unsigned long addr, unsigned long len) psc->command = (PSC_RX_ENABLE | PSC_TX_ENABLE); for(i = 0;i < (len / 4); i++) { + unsigned char swapped[4]; + unsigned long *p = (unsigned long*)swapped; + swapped[3] = *wave_file++; swapped[2] = *wave_file++; swapped[1] = *wave_file++; swapped[0] = *wave_file++; - psc->psc_buffer_32 = *((unsigned long*)swapped); + + psc->psc_buffer_32 = *p; + while (psc->tfnum > 400) { if(ctrlc()) return 0;