From patchwork Mon Dec 28 22:49:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "kevin.morfitt@fearnside-systems.co.uk" X-Patchwork-Id: 71699 X-Patchwork-Delegate: promsoft@gmail.com Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id 759253F6D1 for ; Mon, 28 Dec 2009 23:51:39 +0100 (CET) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id 4C893C9601BC for ; Mon, 28 Dec 2009 23:51:39 +0100 (CET) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.9) for (single-drop); Mon, 28 Dec 2009 23:51:39 +0100 (CET) Received: from murder (svr19.m-online.net [192.168.3.147]) by backend2 (Cyrus v2.2.12) with LMTPA; Mon, 28 Dec 2009 23:48:21 +0100 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend3.pop.m-online.net (Cyrus v2.2.13) with LMTPA; Mon, 28 Dec 2009 23:48:21 +0100 Received: from scanner-2.m-online.net (unknown [192.168.8.166]) by mail.m-online.net (Postfix) with ESMTP id 55725200167; Mon, 28 Dec 2009 23:48:21 +0100 (CET) Received: from mxin-3.m-online.net ([192.168.1.19]) by scanner-2.m-online.net (scanner-2.m-online.net [192.168.8.166]) (amavisd-new, port 10026) with ESMTP id 19230-03; Mon, 28 Dec 2009 23:48:17 +0100 (CET) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-3.m-online.net (Postfix) with ESMTP id 3AA4746C0A6; Mon, 28 Dec 2009 23:48:16 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 775BB280B5; Mon, 28 Dec 2009 23:48:04 +0100 (CET) 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 a8m2TVFMKlE3; Mon, 28 Dec 2009 23:48:04 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8B69D280B7; Mon, 28 Dec 2009 23:47:56 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5CBE8280AC for ; Mon, 28 Dec 2009 23:47:49 +0100 (CET) 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 ku2Q8Zf60vpG for ; Mon, 28 Dec 2009 23:47:46 +0100 (CET) Received: from hp17.hostpapa.com (hp17.hostpapa.com [67.220.225.50]) by theia.denx.de (Postfix) with ESMTP id E00FE280BD for ; Mon, 28 Dec 2009 23:47:43 +0100 (CET) Received: from cpc1-basf5-0-0-cust771.nott.cable.ntl.com ([86.1.175.4] helo=[192.168.1.102]) by hp17.hostpapa.com with esmtpa (Exim 4.69) (envelope-from ) id 1NPONH-0006mG-RR for u-boot@lists.denx.de; Mon, 28 Dec 2009 22:47:43 +0000 Message-ID: <4B3935FA.1050604@fearnside-systems.co.uk> Date: Mon, 28 Dec 2009 22:49:30 +0000 From: "kevin.morfitt@fearnside-systems.co.uk" User-Agent: Thunderbird 2.0.0.23 (X11/20090825) MIME-Version: 1.0 To: U-Boot ML X-Enigmail-Version: 0.96.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hp17.hostpapa.com X-AntiAbuse: Original Domain - lists.denx.de X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - fearnside-systems.co.uk X-Source: X-Source-Args: X-Source-Dir: Subject: [U-Boot] [PATCH ARM 2/4] s3c24x0 white-space clean-up part 2 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list Reply-To: kevin.morfitt@fearnside-systems.co.uk List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de X-Virus-Scanned: by amavisd-new at m-online.net Cleans up white-space in the s3c24x0 files, including removing any dead code but excluding code style or line length changes. Due to the size of the changes this change is split into two patches. Signed-off-by: Kevin Morfitt --- checkpatch.pl reports no white-space errors. board/mpl/vcma9/cmd_vcma9.c | 43 --- board/mpl/vcma9/lowlevel_init.S | 112 ++++--- board/mpl/vcma9/vcma9.c | 177 +++++----- board/samsung/smdk2400/lowlevel_init.S | 60 ++-- board/samsung/smdk2400/smdk2400.c | 4 +- board/samsung/smdk2410/lowlevel_init.S | 48 ++-- board/samsung/smdk2410/smdk2410.c | 23 +- board/sbc2410x/lowlevel_init.S | 45 ++- board/sbc2410x/sbc2410x.c | 50 ++-- board/trab/cmd_trab.c | 567 +++++++++++++++----------------- board/trab/lowlevel_init.S | 72 +++-- board/trab/rs485.c | 52 ++-- board/trab/trab.c | 154 +++++----- 13 files changed, 673 insertions(+), 734 deletions(-) diff --git a/board/mpl/vcma9/cmd_vcma9.c b/board/mpl/vcma9/cmd_vcma9.c index 0ee9595..49558d8 100644 --- a/board/mpl/vcma9/cmd_vcma9.c +++ b/board/mpl/vcma9/cmd_vcma9.c @@ -133,49 +133,6 @@ int do_vcma9(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } #endif -#if 0 - if (strcmp(argv[1], "cantest") == 0) { - if (argc >= 3) - vcma9_cantest(strcmp(argv[2], "s") ? 0 : 1); - else - vcma9_cantest(0); - return 0; - } - if (strcmp(argv[1], "nandtest") == 0) { - vcma9_nandtest(); - return 0; - } - if (strcmp(argv[1], "nanderase") == 0) { - vcma9_nanderase(); - return 0; - } - if (strcmp(argv[1], "nandread") == 0) { - ulong offset = 0; - - if (argc >= 3) - offset = simple_strtoul(argv[2], NULL, 16); - - vcma9_nandread(offset); - return 0; - } - if (strcmp(argv[1], "nandwrite") == 0) { - ulong offset = 0; - - if (argc >= 3) - offset = simple_strtoul(argv[2], NULL, 16); - - vcma9_nandwrite(offset); - return 0; - } - if (strcmp(argv[1], "dactest") == 0) { - if (argc >= 3) - vcma9_dactest(strcmp(argv[2], "s") ? 0 : 1); - else - vcma9_dactest(0); - return 0; - } -#endif - return (do_mplcommon(cmdtp, flag, argc, argv)); } diff --git a/board/mpl/vcma9/lowlevel_init.S b/board/mpl/vcma9/lowlevel_init.S index e3af073..ea79ffb 100644 --- a/board/mpl/vcma9/lowlevel_init.S +++ b/board/mpl/vcma9/lowlevel_init.S @@ -59,23 +59,19 @@ /* BANK0CON */ #define B0_Tacs 0x0 /* 0clk */ #define B0_Tcos 0x1 /* 1clk */ -/*#define B0_Tcos 0x0 0clk */ #define B0_Tacc 0x7 /* 14clk */ -/*#define B0_Tacc 0x5 8clk */ #define B0_Tcoh 0x0 /* 0clk */ #define B0_Tah 0x0 /* 0clk */ -#define B0_Tacp 0x0 /* page mode is not used */ +#define B0_Tacp 0x0 /* page mode is not used */ #define B0_PMC 0x0 /* page mode disabled */ /* BANK1CON */ #define B1_Tacs 0x0 /* 0clk */ #define B1_Tcos 0x1 /* 1clk */ -/*#define B1_Tcos 0x0 0clk */ #define B1_Tacc 0x7 /* 14clk */ -/*#define B1_Tacc 0x5 8clk */ #define B1_Tcoh 0x0 /* 0clk */ #define B1_Tah 0x0 /* 0clk */ -#define B1_Tacp 0x0 /* page mode is not used */ +#define B1_Tacp 0x0 /* page mode is not used */ #define B1_PMC 0x0 /* page mode disabled */ #define B2_Tacs 0x3 /* 4clk */ @@ -84,22 +80,22 @@ #define B2_Tcoh 0x3 /* 4clk */ #define B2_Tah 0x3 /* 4clk */ #define B2_Tacp 0x0 /* page mode is not used */ -#define B2_PMC 0x0 /* page mode disabled */ +#define B2_PMC 0x0 /* page mode disabled */ #define B3_Tacs 0x3 /* 4clk */ #define B3_Tcos 0x3 /* 4clk */ -#define B3_Tacc 0x7 /* 14clk */ +#define B3_Tacc 0x7 /* 14clk */ #define B3_Tcoh 0x3 /* 4clk */ #define B3_Tah 0x3 /* 4clk */ #define B3_Tacp 0x0 /* page mode is not used */ -#define B3_PMC 0x0 /* page mode disabled */ +#define B3_PMC 0x0 /* page mode disabled */ #define B4_Tacs 0x3 /* 4clk */ #define B4_Tcos 0x1 /* 1clk */ #define B4_Tacc 0x7 /* 14clk */ #define B4_Tcoh 0x1 /* 1clk */ #define B4_Tah 0x0 /* 0clk */ -#define B4_Tacp 0x0 /* page mode is not used */ +#define B4_Tacp 0x0 /* page mode is not used */ #define B4_PMC 0x0 /* page mode disabled */ #define B5_Tacs 0x0 /* 0clk */ @@ -107,7 +103,7 @@ #define B5_Tacc 0x5 /* 8clk */ #define B5_Tcoh 0x2 /* 2clk */ #define B5_Tah 0x1 /* 1clk */ -#define B5_Tacp 0x0 /* page mode is not used */ +#define B5_Tacp 0x0 /* page mode is not used */ #define B5_PMC 0x0 /* page mode disabled */ #define B6_MT 0x3 /* SDRAM */ @@ -124,7 +120,8 @@ #define Trp 0x0 /* 2clk */ #define Trc 0x3 /* 7clk */ #define Tchr 0x2 /* 3clk */ -#define REFCNT 1113 /* period=15.6us, HCLK=60Mhz, (2048+1-15.6*60) */ +/* period=15.6us, HCLK=60Mhz, (2048+1-15.6*60) */ +#define REFCNT 1113 /**************************************/ _TEXT_BASE: @@ -135,16 +132,16 @@ lowlevel_init: /* memory control configuration */ /* make r0 relative the current location so that it */ /* reads SMRDATA out of FLASH rather than memory ! */ - ldr r0, =CSDATA + ldr r0, =CSDATA ldr r1, _TEXT_BASE sub r0, r0, r1 ldr r1, =BWSCON /* Bus Width Status Controller */ - add r2, r0, #CSDATA_END-CSDATA + add r2, r0, #CSDATA_END-CSDATA 0: - ldr r3, [r0], #4 - str r3, [r1], #4 - cmp r2, r0 - bne 0b + ldr r3, [r0], #4 + str r3, [r1], #4 + cmp r2, r0 + bne 0b /* PLD access is now possible */ /* r0 == SDRAMDATA */ @@ -154,12 +151,12 @@ lowlevel_init: mov r4, #SDRAMDATA1_END-SDRAMDATA /* calculate start and end point */ mla r0, r3, r4, r0 - add r2, r0, r4 + add r2, r0, r4 0: - ldr r3, [r0], #4 - str r3, [r1], #4 - cmp r2, r0 - bne 0b + ldr r3, [r0], #4 + str r3, [r1], #4 + cmp r2, r0 + bne 0b /* everything is fine now */ mov pc, lr @@ -168,45 +165,52 @@ lowlevel_init: /* the literal pools origin */ CSDATA: - .word (0+(B1_BWSCON<<4)+(B2_BWSCON<<8)+(B3_BWSCON<<12)+(B4_BWSCON<<16)+(B5_BWSCON<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) - .word ((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC)) - .word ((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC)) - .word ((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC)) - .word ((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_Tacp<<2)+(B3_PMC)) - .word ((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_Tacp<<2)+(B4_PMC)) - .word ((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_Tacp<<2)+(B5_PMC)) + .word (0+(B1_BWSCON<<4)+(B2_BWSCON<<8)+(B3_BWSCON<<12)+(B4_BWSCON<<16)+\ + (B5_BWSCON<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) + .word ((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+ \ + (B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC)) + .word ((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+ \ + (B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC)) + .word ((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+ \ + (B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC)) + .word ((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+ \ + (B3_Tah<<4)+(B3_Tacp<<2)+(B3_PMC)) + .word ((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+ \ + (B4_Tah<<4)+(B4_Tacp<<2)+(B4_PMC)) + .word ((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+ \ + (B5_Tah<<4)+(B5_Tacp<<2)+(B5_PMC)) CSDATA_END: SDRAMDATA: /* 4Mx8x4 */ - .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) - .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) - .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) - .word 0x32 + BURST_EN - .word 0x30 - .word 0x30 + .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) + .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) + .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) + .word 0x32 + BURST_EN + .word 0x30 + .word 0x30 SDRAMDATA1_END: /* 8Mx8x4 (not implemented yet) */ - .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) - .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) - .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) - .word 0x32 + BURST_EN - .word 0x30 - .word 0x30 + .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) + .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) + .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) + .word 0x32 + BURST_EN + .word 0x30 + .word 0x30 /* 2Mx8x4 (not implemented yet) */ - .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) - .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) - .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) - .word 0x32 + BURST_EN - .word 0x30 - .word 0x30 + .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) + .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) + .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) + .word 0x32 + BURST_EN + .word 0x30 + .word 0x30 /* 4Mx8x2 (not implemented yet) */ - .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) - .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) - .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) - .word 0x32 + BURST_EN - .word 0x30 - .word 0x30 + .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) + .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) + .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) + .word 0x32 + BURST_EN + .word 0x30 + .word 0x30 diff --git a/board/mpl/vcma9/vcma9.c b/board/mpl/vcma9/vcma9.c index 1835677..9a7c0fa 100644 --- a/board/mpl/vcma9/vcma9.c +++ b/board/mpl/vcma9/vcma9.c @@ -38,33 +38,33 @@ DECLARE_GLOBAL_DATA_PTR; #define FCLK_SPEED 1 -#if FCLK_SPEED==0 /* Fout = 203MHz, Fin = 12MHz for Audio */ -#define M_MDIV 0xC3 -#define M_PDIV 0x4 -#define M_SDIV 0x1 -#elif FCLK_SPEED==1 /* Fout = 202.8MHz */ -#define M_MDIV 0xA1 -#define M_PDIV 0x3 -#define M_SDIV 0x1 +#if FCLK_SPEED == 0 /* Fout = 203MHz, Fin = 12MHz for Audio */ +#define M_MDIV 0xC3 +#define M_PDIV 0x4 +#define M_SDIV 0x1 +#elif FCLK_SPEED == 1 /* Fout = 202.8MHz */ +#define M_MDIV 0xA1 +#define M_PDIV 0x3 +#define M_SDIV 0x1 #endif -#define USB_CLOCK 1 +#define USB_CLOCK 1 -#if USB_CLOCK==0 -#define U_M_MDIV 0xA1 -#define U_M_PDIV 0x3 -#define U_M_SDIV 0x1 -#elif USB_CLOCK==1 -#define U_M_MDIV 0x48 -#define U_M_PDIV 0x3 -#define U_M_SDIV 0x2 +#if USB_CLOCK == 0 +#define U_M_MDIV 0xA1 +#define U_M_PDIV 0x3 +#define U_M_SDIV 0x1 +#elif USB_CLOCK == 1 +#define U_M_MDIV 0x48 +#define U_M_PDIV 0x3 +#define U_M_SDIV 0x2 #endif static inline void delay(unsigned long loops) { __asm__ volatile ("1:\n" - "subs %0, %1, #1\n" - "bne 1b":"=r" (loops):"0" (loops)); + "subs %0, %1, #1\n" + "bne 1b":"=r" (loops):"0" (loops)); } /* @@ -84,13 +84,13 @@ int board_init(void) clk_power->MPLLCON = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV); /* some delay between MPLL and UPLL */ - delay (4000); + delay(4000); /* configure UPLL */ clk_power->UPLLCON = ((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV); /* some delay between MPLL and UPLL */ - delay (8000); + delay(8000); /* set up the I/O ports */ gpio->GPACON = 0x007FFFFF; @@ -110,7 +110,8 @@ int board_init(void) gpio->GPHUP = 0x00000656; /* setup correct IRQ modes for NIC */ - gpio->EXTINT2 = (gpio->EXTINT2 & ~(7<<8)) | (4<<8); /* rising edge mode */ + /* rising edge mode */ + gpio->EXTINT2 = (gpio->EXTINT2 & ~(7 << 8)) | (4 << 8); /* select USB port 2 to be host or device (fix to host for now) */ gpio->MISCCR |= 0x08; @@ -142,46 +143,39 @@ nand_probe(ulong physadr); static inline void NF_Reset(void) { - int i; + int i; - NF_SetCE(NFCE_LOW); - NF_Cmd(0xFF); /* reset command */ - for(i = 0; i < 10; i++); /* tWB = 100ns. */ - NF_WaitRB(); /* wait 200~500us; */ - NF_SetCE(NFCE_HIGH); + NF_SetCE(NFCE_LOW); + NF_Cmd(0xFF); /* reset command */ + for (i = 0; i < 10; i++); /* tWB = 100ns. */ + NF_WaitRB(); /* wait 200~500us; */ + NF_SetCE(NFCE_HIGH); } static inline void NF_Init(void) { -#if 0 /* a little bit too optimistic */ -#define TACLS 0 -#define TWRPH0 3 -#define TWRPH1 0 -#else -#define TACLS 0 -#define TWRPH0 4 -#define TWRPH1 2 -#endif +#define TACLS 0 +#define TWRPH0 4 +#define TWRPH1 2 - NF_Conf((1<<15)|(0<<14)|(0<<13)|(1<<12)|(1<<11)|(TACLS<<8)|(TWRPH0<<4)|(TWRPH1<<0)); - /*nand->NFCONF = (1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<11)|(TACLS<<8)|(TWRPH0<<4)|(TWRPH1<<0); */ - /* 1 1 1 1, 1 xxx, r xxx, r xxx */ - /* En 512B 4step ECCR nFCE=H tACLS tWRPH0 tWRPH1 */ + NF_Conf((1 << 15) | (0 << 14) | (0 << 13) | (1 << 12) | (1 << 11) | + (TACLS << 8) | (TWRPH0 << 4) | (TWRPH1 << 0)); + /* 1 1 1 1, 1 xxx, r xxx, r xxx */ + /* En 512B 4step ECCR nFCE=H tACLS tWRPH0 tWRPH1 */ - NF_Reset(); + NF_Reset(); } -void -nand_init(void) +void nand_init(void) { struct s3c2410_nand * const nand = s3c2410_get_base_nand(); NF_Init(); #ifdef DEBUG - printf("NAND flash probing at 0x%.8lX\n", (ulong)nand); + printf("NAND flash probing at 0x%.8lX\n", (ulong) nand); #endif - printf ("%4lu MB\n", nand_probe((ulong)nand) >> 20); + printf("%4lu MB\n", nand_probe((ulong) nand) >> 20); } #endif @@ -193,86 +187,91 @@ static u8 Get_PLD_ID(void) { VCMA9_PLD * const pld = VCMA9_get_base_PLD(); - return(pld->ID); + return (pld->ID); } static u8 Get_PLD_BOARD(void) { VCMA9_PLD * const pld = VCMA9_get_base_PLD(); - return(pld->BOARD); + return (pld->BOARD); } static u8 Get_PLD_SDRAM(void) { VCMA9_PLD * const pld = VCMA9_get_base_PLD(); - return(pld->SDRAM); + return (pld->SDRAM); } static u8 Get_PLD_Version(void) { - return((Get_PLD_ID() >> 4) & 0x0F); + return ((Get_PLD_ID() >> 4) & 0x0F); } static u8 Get_PLD_Revision(void) { - return(Get_PLD_ID() & 0x0F); + return (Get_PLD_ID() & 0x0F); } -#if 0 /* not used */ -static int Get_Board_Config(void) -{ - u8 config = Get_PLD_BOARD() & 0x03; - - if (config == 3) - return 1; - else - return 0; -} -#endif - static uchar Get_Board_PCB(void) { - return(((Get_PLD_BOARD() >> 4) & 0x03) + 'A'); + return (((Get_PLD_BOARD() >> 4) & 0x03) + 'A'); } static u8 Get_SDRAM_ChipNr(void) { switch ((Get_PLD_SDRAM() >> 4) & 0x0F) { - case 0: return 4; - case 1: return 1; - case 2: return 2; - default: return 0; + case 0: + return 4; + case 1: + return 1; + case 2: + return 2; + default: + return 0; } } static ulong Get_SDRAM_ChipSize(void) { switch (Get_PLD_SDRAM() & 0x0F) { - case 0: return 16 * (1024*1024); - case 1: return 32 * (1024*1024); - case 2: return 8 * (1024*1024); - case 3: return 8 * (1024*1024); - default: return 0; + case 0: + return 16 * (1024 * 1024); + case 1: + return 32 * (1024 * 1024); + case 2: + return 8 * (1024 * 1024); + case 3: + return 8 * (1024 * 1024); + default: + return 0; } } -static const char * Get_SDRAM_ChipGeom(void) + +static const char *Get_SDRAM_ChipGeom(void) { switch (Get_PLD_SDRAM() & 0x0F) { - case 0: return "4Mx8x4"; - case 1: return "8Mx8x4"; - case 2: return "2Mx8x4"; - case 3: return "4Mx8x2"; - default: return "unknown"; + case 0: + return "4Mx8x4"; + case 1: + return "8Mx8x4"; + case 2: + return "2Mx8x4"; + case 3: + return "4Mx8x2"; + default: + return "unknown"; } } static void Show_VCMA9_Info(char *board_name, char *serial) { printf("Board: %s SN: %s PCB Rev: %c PLD(%d,%d)\n", - board_name, serial, Get_Board_PCB(), Get_PLD_Version(), Get_PLD_Revision()); - printf("SDRAM: %d chips %s\n", Get_SDRAM_ChipNr(), Get_SDRAM_ChipGeom()); + board_name, serial, Get_Board_PCB(), Get_PLD_Version(), + Get_PLD_Revision()); + printf("SDRAM: %d chips %s\n", Get_SDRAM_ChipNr(), + Get_SDRAM_ChipGeom()); } int dram_init(void) @@ -296,10 +295,10 @@ int checkboard(void) backup_t *b = (backup_t *) s; i = getenv_r("serial#", s, 32); - if ((i < 0) || strncmp (s, "VCMA9", 5)) { - get_backup_values (b); - if (strncmp (b->signature, "MPL\0", 4) != 0) { - puts ("### No HW ID - assuming VCMA9"); + if ((i < 0) || strncmp(s, "VCMA9", 5)) { + get_backup_values(b); + if (strncmp(b->signature, "MPL\0", 4) != 0) { + puts("### No HW ID - assuming VCMA9"); } else { b->serial_name[5] = 0; Show_VCMA9_Info(b->serial_name, &b->serial_name[6]); @@ -308,11 +307,9 @@ int checkboard(void) s[5] = 0; Show_VCMA9_Info(s, &s[6]); } - /*printf("\n");*/ - return(0); + return (0); } - int last_stage_init(void) { checkboard(); @@ -341,8 +338,8 @@ void print_vcma9_info(void) int i; if ((i = getenv_r("serial#", s, 32)) < 0) { - puts ("### No HW ID - assuming VCMA9"); - printf("i %d", i*24); + puts("### No HW ID - assuming VCMA9"); + printf("i %d", i * 24); } else { s[5] = 0; Show_VCMA9_Info(s, &s[6]); diff --git a/board/samsung/smdk2400/lowlevel_init.S b/board/samsung/smdk2400/lowlevel_init.S index 9c808c0..d359d3e 100644 --- a/board/samsung/smdk2400/lowlevel_init.S +++ b/board/samsung/smdk2400/lowlevel_init.S @@ -45,8 +45,8 @@ */ /* memory controller */ -#define BWSCON 0x14000000 -#define BANKCON3 0x14000010 /* for cs8900, ethernet */ +#define BWSCON 0x14000000 +#define BANKCON3 0x14000010 /* for cs8900, ethernet */ /* Bank0 */ #define B0_Tacs 0x0 /* 0 clk */ @@ -103,14 +103,14 @@ #define B5_PMC 0x0 /* normal */ /* Bank6 */ -#define B6_MT 0x3 /* SDRAM */ -#define B6_Trcd 0x1 /* 3clk */ -#define B6_SCAN 0x1 /* 9 bit */ +#define B6_MT 0x3 /* SDRAM */ +#define B6_Trcd 0x1 /* 3clk */ +#define B6_SCAN 0x1 /* 9 bit */ /* Bank7 */ -#define B7_MT 0x3 /* SDRAM */ -#define B7_Trcd 0x1 /* 3clk */ -#define B7_SCAN 0x1 /* 9 bit */ +#define B7_MT 0x3 /* SDRAM */ +#define B7_Trcd 0x1 /* 3clk */ +#define B7_SCAN 0x1 /* 9 bit */ /* refresh parameter */ #define REFEN 0x1 /* enable refresh */ @@ -130,16 +130,16 @@ lowlevel_init: /* memory control configuration */ /* make r0 relative the current location so that it */ /* reads SMRDATA out of FLASH rather than memory ! */ - ldr r0, =SMRDATA + ldr r0, =SMRDATA ldr r1, _TEXT_BASE sub r0, r0, r1 ldr r1, =BWSCON /* Bus Width Status Controller */ - add r2, r0, #52 + add r2, r0, #52 0: - ldr r3, [r0], #4 - str r3, [r1], #4 - cmp r2, r0 - bne 0b + ldr r3, [r0], #4 + str r3, [r1], #4 + cmp r2, r0 + bne 0b /* everything is fine now */ mov pc, lr @@ -148,16 +148,22 @@ lowlevel_init: /* the literal pools origin */ SMRDATA: - .word 0x2211d114 /* d->Ethernet, BUSWIDTH=32 */ - .word ((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC)) /* GCS0 */ - .word ((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC)) /* GCS1 */ - .word ((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC)) /* GCS2 */ - .word ((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_Tacp<<2)+(B3_PMC)) /* GCS3 */ - .word ((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_Tacp<<2)+(B4_PMC)) /* GCS4 */ - .word ((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_Tacp<<2)+(B5_PMC)) /* GCS5 */ - .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) /* GCS6 */ - .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) /* GCS7 */ - .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) - .word 0x10 /* BUSWIDTH=32, SCLK power saving mode, BANKSIZE 32M/32M */ - .word 0x30 /* MRSR6, CL=3clk */ - .word 0x30 /* MRSR7 */ + .word 0x2211d114 /* d->Ethernet, BUSWIDTH=32 */ + .word ((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+ \ + (B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC)) /* GCS0 */ + .word ((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+ \ + (B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC)) /* GCS1 */ + .word ((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+ \ + (B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC)) /* GCS2 */ + .word ((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+ \ + (B3_Tah<<4)+(B3_Tacp<<2)+(B3_PMC)) /* GCS3 */ + .word ((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+ \ + (B4_Tah<<4)+(B4_Tacp<<2)+(B4_PMC)) /* GCS4 */ + .word ((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+ \ + (B5_Tah<<4)+(B5_Tacp<<2)+(B5_PMC)) /* GCS5 */ + .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) /* GCS6 */ + .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) /* GCS7 */ + .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) + .word 0x10 /* BUSWIDTH=32, SCLK pwr save mode, BANKSIZE 32M/32M */ + .word 0x30 /* MRSR6, CL=3clk */ + .word 0x30 /* MRSR7 */ diff --git a/board/samsung/smdk2400/smdk2400.c b/board/samsung/smdk2400/smdk2400.c index 1294d3f..5825ce9 100644 --- a/board/samsung/smdk2400/smdk2400.c +++ b/board/samsung/smdk2400/smdk2400.c @@ -63,9 +63,9 @@ int board_init (void) #ifdef CONFIG_HWFLOW /*CTS[0] RTS[0] INPUT INPUT TXD[0] INPUT RXD[0] */ /* 10, 10, 00, 00, 10, 00, 10 */ - gpio->PFCON=0xa22; + gpio->PFCON = 0xa22; /* Disable pull-up on Rx, Tx, CTS and RTS pins */ - gpio->PFUP=0x35; + gpio->PFUP = 0x35; #else /*INPUT INPUT INPUT INPUT TXD[0] INPUT RXD[0] */ /* 00, 00, 00, 00, 10, 00, 10 */ diff --git a/board/samsung/smdk2410/lowlevel_init.S b/board/samsung/smdk2410/lowlevel_init.S index ab6afdd..17b4df2 100644 --- a/board/samsung/smdk2410/lowlevel_init.S +++ b/board/samsung/smdk2410/lowlevel_init.S @@ -123,7 +123,8 @@ #define Trp 0x0 /* 2clk */ #define Trc 0x3 /* 7clk */ #define Tchr 0x2 /* 3clk */ -#define REFCNT 1113 /* period=15.6us, HCLK=60Mhz, (2048+1-15.6*60) */ +/* period=15.6us, HCLK=60Mhz, (2048+1-15.6*60) */ +#define REFCNT 1113 /**************************************/ _TEXT_BASE: @@ -134,16 +135,16 @@ lowlevel_init: /* memory control configuration */ /* make r0 relative the current location so that it */ /* reads SMRDATA out of FLASH rather than memory ! */ - ldr r0, =SMRDATA + ldr r0, =SMRDATA ldr r1, _TEXT_BASE sub r0, r0, r1 ldr r1, =BWSCON /* Bus Width Status Controller */ - add r2, r0, #13*4 + add r2, r0, #13*4 0: - ldr r3, [r0], #4 - str r3, [r1], #4 - cmp r2, r0 - bne 0b + ldr r3, [r0], #4 + str r3, [r1], #4 + cmp r2, r0 + bne 0b /* everything is fine now */ mov pc, lr @@ -152,16 +153,23 @@ lowlevel_init: /* the literal pools origin */ SMRDATA: - .word (0+(B1_BWSCON<<4)+(B2_BWSCON<<8)+(B3_BWSCON<<12)+(B4_BWSCON<<16)+(B5_BWSCON<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) - .word ((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC)) - .word ((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC)) - .word ((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC)) - .word ((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_Tacp<<2)+(B3_PMC)) - .word ((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_Tacp<<2)+(B4_PMC)) - .word ((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_Tacp<<2)+(B5_PMC)) - .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) - .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) - .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) - .word 0x32 - .word 0x30 - .word 0x30 + .word (0+(B1_BWSCON<<4)+(B2_BWSCON<<8)+(B3_BWSCON<<12)+(B4_BWSCON<<16)+\ + (B5_BWSCON<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) + .word ((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+ \ + (B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC)) + .word ((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+ \ + (B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC)) + .word ((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+ \ + (B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC)) + .word ((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+ \ + (B3_Tah<<4)+(B3_Tacp<<2)+(B3_PMC)) + .word ((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+ \ + (B4_Tah<<4)+(B4_Tacp<<2)+(B4_PMC)) + .word ((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+ \ + (B5_Tah<<4)+(B5_Tacp<<2)+(B5_PMC)) + .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) + .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) + .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) + .word 0x32 + .word 0x30 + .word 0x30 diff --git a/board/samsung/smdk2410/smdk2410.c b/board/samsung/smdk2410/smdk2410.c index 5d1a8bb..e3a4490 100644 --- a/board/samsung/smdk2410/smdk2410.c +++ b/board/samsung/smdk2410/smdk2410.c @@ -33,11 +33,11 @@ DECLARE_GLOBAL_DATA_PTR; #define FCLK_SPEED 1 -#if FCLK_SPEED==0 /* Fout = 203MHz, Fin = 12MHz for Audio */ +#if FCLK_SPEED == 0 /* Fout = 203MHz, Fin = 12MHz for Audio */ #define M_MDIV 0xC3 #define M_PDIV 0x4 #define M_SDIV 0x1 -#elif FCLK_SPEED==1 /* Fout = 202.8MHz */ +#elif FCLK_SPEED == 1 /* Fout = 202.8MHz */ #define M_MDIV 0xA1 #define M_PDIV 0x3 #define M_SDIV 0x1 @@ -45,31 +45,30 @@ DECLARE_GLOBAL_DATA_PTR; #define USB_CLOCK 1 -#if USB_CLOCK==0 +#if USB_CLOCK == 0 #define U_M_MDIV 0xA1 #define U_M_PDIV 0x3 #define U_M_SDIV 0x1 -#elif USB_CLOCK==1 +#elif USB_CLOCK == 1 #define U_M_MDIV 0x48 #define U_M_PDIV 0x3 #define U_M_SDIV 0x2 #endif -static inline void delay (unsigned long loops) +static inline void delay(unsigned long loops) { __asm__ volatile ("1:\n" - "subs %0, %1, #1\n" - "bne 1b":"=r" (loops):"0" (loops)); + "subs %0, %1, #1\n" "bne 1b":"=r" (loops):"0"(loops)); } /* * Miscellaneous platform dependent initialisations */ -int board_init (void) +int board_init(void) { struct s3c24x0_clock_power * const clk_power = - s3c24x0_get_base_clock_power(); + s3c24x0_get_base_clock_power(); struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); /* to reduce PLL lock time, adjust the LOCKTIME register */ @@ -79,13 +78,13 @@ int board_init (void) clk_power->MPLLCON = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV); /* some delay between MPLL and UPLL */ - delay (4000); + delay(4000); /* configure UPLL */ clk_power->UPLLCON = ((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV); /* some delay between MPLL and UPLL */ - delay (8000); + delay(8000); /* set up the I/O ports */ gpio->GPACON = 0x007FFFFF; @@ -116,7 +115,7 @@ int board_init (void) return 0; } -int dram_init (void) +int dram_init(void) { gd->bd->bi_dram[0].start = PHYS_SDRAM_1; gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; diff --git a/board/sbc2410x/lowlevel_init.S b/board/sbc2410x/lowlevel_init.S index 3df63cd..e60758b 100644 --- a/board/sbc2410x/lowlevel_init.S +++ b/board/sbc2410x/lowlevel_init.S @@ -130,16 +130,16 @@ lowlevel_init: /* memory control configuration */ /* make r0 relative the current location so that it */ /* reads SMRDATA out of FLASH rather than memory ! */ - ldr r0, =SMRDATA + ldr r0, =SMRDATA ldr r1, _TEXT_BASE sub r0, r0, r1 ldr r1, =BWSCON /* Bus Width Status Controller */ - add r2, r0, #13*4 + add r2, r0, #13*4 0: - ldr r3, [r0], #4 - str r3, [r1], #4 - cmp r2, r0 - bne 0b + ldr r3, [r0], #4 + str r3, [r1], #4 + cmp r2, r0 + bne 0b /* everything is fine now */ mov pc, lr @@ -148,16 +148,23 @@ lowlevel_init: /* the literal pools origin */ SMRDATA: - .word (0+(B1_BWSCON<<4)+(B2_BWSCON<<8)+(B3_BWSCON<<12)+(B4_BWSCON<<16)+(B5_BWSCON<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) - .word ((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC)) - .word ((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC)) - .word ((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC)) - .word ((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_Tacp<<2)+(B3_PMC)) - .word ((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_Tacp<<2)+(B4_PMC)) - .word ((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_Tacp<<2)+(B5_PMC)) - .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) - .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) - .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) - .word 0xb2 - .word 0x30 - .word 0x30 + .word (0+(B1_BWSCON<<4)+(B2_BWSCON<<8)+(B3_BWSCON<<12)+ \ + (B4_BWSCON<<16)+(B5_BWSCON<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) + .word ((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+ \ + (B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC)) + .word ((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+ \ + (B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC)) + .word ((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+ \ + (B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC)) + .word ((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+ \ + (B3_Tah<<4)+(B3_Tacp<<2)+(B3_PMC)) + .word ((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+ \ + (B4_Tah<<4)+(B4_Tacp<<2)+(B4_PMC)) + .word ((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+ \ + (B5_Tah<<4)+(B5_Tacp<<2)+(B5_PMC)) + .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) + .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) + .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) + .word 0xb2 + .word 0x30 + .word 0x30 diff --git a/board/sbc2410x/sbc2410x.c b/board/sbc2410x/sbc2410x.c index 3a93677..b7bbcf2 100644 --- a/board/sbc2410x/sbc2410x.c +++ b/board/sbc2410x/sbc2410x.c @@ -40,29 +40,29 @@ DECLARE_GLOBAL_DATA_PTR; #define FCLK_SPEED 1 -#if FCLK_SPEED==0 /* Fout = 203MHz, Fin = 12MHz for Audio */ +#if FCLK_SPEED == 0 /* Fout = 203MHz, Fin = 12MHz for Audio */ #define M_MDIV 0xC3 #define M_PDIV 0x4 #define M_SDIV 0x1 -#elif FCLK_SPEED==1 /* Fout = 202.8MHz */ +#elif FCLK_SPEED == 1 /* Fout = 202.8MHz */ #define M_MDIV 0x5c #define M_PDIV 0x4 #define M_SDIV 0x0 #endif -#define USB_CLOCK 1 +#define USB_CLOCK 1 -#if USB_CLOCK==0 +#if USB_CLOCK == 0 #define U_M_MDIV 0xA1 #define U_M_PDIV 0x3 #define U_M_SDIV 0x1 -#elif USB_CLOCK==1 +#elif USB_CLOCK == 1 #define U_M_MDIV 0x48 #define U_M_PDIV 0x3 #define U_M_SDIV 0x2 #endif -static inline void delay (unsigned long loops) +static inline void delay(unsigned long loops) { __asm__ volatile ("1:\n" "subs %0, %1, #1\n" @@ -73,7 +73,7 @@ static inline void delay (unsigned long loops) * Miscellaneous platform dependent initialisations */ -int board_init (void) +int board_init(void) { struct s3c24x0_clock_power * const clk_power = s3c24x0_get_base_clock_power(); @@ -92,7 +92,7 @@ int board_init (void) clk_power->UPLLCON = ((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV); /* some delay between MPLL and UPLL */ - delay (8000); + delay(8000); /* set up the I/O ports */ gpio->GPACON = 0x007FFFFF; @@ -111,9 +111,9 @@ int board_init (void) gpio->GPHCON = 0x0016FAAA; gpio->GPHUP = 0x000007FF; - gpio->EXTINT0=0x22222222; - gpio->EXTINT1=0x22222222; - gpio->EXTINT2=0x22222222; + gpio->EXTINT0 = 0x22222222; + gpio->EXTINT1 = 0x22222222; + gpio->EXTINT2 = 0x22222222; /* arch number of SMDK2410-Board */ gd->bd->bi_arch_number = MACH_TYPE_SMDK2410; @@ -127,7 +127,7 @@ int board_init (void) return 0; } -int dram_init (void) +int dram_init(void) { gd->bd->bi_dram[0].start = PHYS_SDRAM_1; gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; @@ -143,26 +143,20 @@ static inline void NF_Reset(void) int i; NF_SetCE(NFCE_LOW); - NF_Cmd(0xFF); /* reset command */ - for(i = 0; i < 10; i++); /* tWB = 100ns. */ - NF_WaitRB(); /* wait 200~500us; */ + NF_Cmd(0xFF); /* reset command */ + for (i = 0; i < 10; i++); /* tWB = 100ns. */ + NF_WaitRB(); /* wait 200~500us; */ NF_SetCE(NFCE_HIGH); } static inline void NF_Init(void) { -#if 1 -#define TACLS 0 -#define TWRPH0 3 -#define TWRPH1 0 -#else -#define TACLS 0 -#define TWRPH0 4 -#define TWRPH1 2 -#endif +#define TACLS 0 +#define TWRPH0 3 +#define TWRPH1 0 - NF_Conf((1<<15)|(0<<14)|(0<<13)|(1<<12)|(1<<11)|(TACLS<<8)|(TWRPH0<<4)|(TWRPH1<<0)); - /*nand->NFCONF = (1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<11)|(TACLS<<8)|(TWRPH0<<4)|(TWRPH1<<0); */ + NF_Conf((1 << 15) | (0 << 14) | (0 << 13) | (1 << 12) | (1 << 11) | + (TACLS << 8) | (TWRPH0 << 4) | (TWRPH1 << 0)); /* 1 1 1 1, 1 xxx, r xxx, r xxx */ /* En 512B 4step ECCR nFCE=H tACLS tWRPH0 tWRPH1 */ @@ -175,9 +169,9 @@ void nand_init(void) NF_Init(); #ifdef DEBUG - printf("NAND flash probing at 0x%.8lX\n", (ulong)nand); + printf("NAND flash probing at 0x%.8lX\n", (ulong) nand); #endif - printf ("%4lu MB\n", nand_probe((ulong)nand) >> 20); + printf("%4lu MB\n", nand_probe((ulong) nand) >> 20); } #endif diff --git a/board/trab/cmd_trab.c b/board/trab/cmd_trab.c index 472d7d8..bba9084 100644 --- a/board/trab/cmd_trab.c +++ b/board/trab/cmd_trab.c @@ -35,111 +35,109 @@ #if defined(CONFIG_CMD_BSP) /* limits for valid range of VCC5V in mV */ -#define VCC5V_MIN 4500 -#define VCC5V_MAX 5500 +#define VCC5V_MIN 4500 +#define VCC5V_MAX 5500 /* * Test strings for EEPROM test. Length of string 2 must not exceed length of * string 1. Otherwise a buffer overrun could occur! */ -#define EEPROM_TEST_STRING_1 "0987654321 :tset a si siht" -#define EEPROM_TEST_STRING_2 "this is a test: 1234567890" +#define EEPROM_TEST_STRING_1 "0987654321 :tset a si siht" +#define EEPROM_TEST_STRING_2 "this is a test: 1234567890" /* * min/max limits for valid contact temperature during burn in test (in * degree Centigrade * 100) */ -#define MIN_CONTACT_TEMP -1000 -#define MAX_CONTACT_TEMP +9000 +#define MIN_CONTACT_TEMP -1000 +#define MAX_CONTACT_TEMP +9000 /* blinking frequency of status LED */ -#define LED_BLINK_FREQ 5 +#define LED_BLINK_FREQ 5 /* delay time between burn in cycles in seconds */ -#ifndef BURN_IN_CYCLE_DELAY /* if not defined in include/configs/trab.h */ -#define BURN_IN_CYCLE_DELAY 5 +#ifndef BURN_IN_CYCLE_DELAY /* if not defined in include/configs/trab.h */ +#define BURN_IN_CYCLE_DELAY 5 #endif /* physical SRAM parameters */ -#define SRAM_ADDR 0x02000000 /* GCS1 */ -#define SRAM_SIZE 0x40000 /* 256 kByte */ +#define SRAM_ADDR 0x02000000 /* GCS1 */ +#define SRAM_SIZE 0x40000 /* 256 kByte */ /* CPLD-Register for controlling TRAB hardware functions */ -#define CPLD_BUTTONS ((volatile unsigned long *)0x04020000) -#define CPLD_FILL_LEVEL ((volatile unsigned long *)0x04008000) -#define CPLD_ROTARY_SWITCH ((volatile unsigned long *)0x04018000) -#define CPLD_RS485_RE ((volatile unsigned long *)0x04028000) +#define CPLD_BUTTONS ((volatile unsigned long *)0x04020000) +#define CPLD_FILL_LEVEL ((volatile unsigned long *)0x04008000) +#define CPLD_ROTARY_SWITCH ((volatile unsigned long *)0x04018000) +#define CPLD_RS485_RE ((volatile unsigned long *)0x04028000) /* I2C EEPROM device address */ -#define I2C_EEPROM_DEV_ADDR 0x54 +#define I2C_EEPROM_DEV_ADDR 0x54 /* EEPROM address map */ -#define EE_ADDR_TEST 192 -#define EE_ADDR_MAX_CYCLES 256 -#define EE_ADDR_STATUS 258 -#define EE_ADDR_PASS_CYCLES 259 -#define EE_ADDR_FIRST_ERROR_CYCLE 261 -#define EE_ADDR_FIRST_ERROR_NUM 263 -#define EE_ADDR_FIRST_ERROR_NAME 264 -#define EE_ADDR_ACT_CYCLE 280 +#define EE_ADDR_TEST 192 +#define EE_ADDR_MAX_CYCLES 256 +#define EE_ADDR_STATUS 258 +#define EE_ADDR_PASS_CYCLES 259 +#define EE_ADDR_FIRST_ERROR_CYCLE 261 +#define EE_ADDR_FIRST_ERROR_NUM 263 +#define EE_ADDR_FIRST_ERROR_NAME 264 +#define EE_ADDR_ACT_CYCLE 280 /* Bit definitions for ADCCON */ -#define ADC_ENABLE_START 0x1 -#define ADC_READ_START 0x2 -#define ADC_STDBM 0x4 -#define ADC_INP_AIN0 (0x0 << 3) -#define ADC_INP_AIN1 (0x1 << 3) -#define ADC_INP_AIN2 (0x2 << 3) -#define ADC_INP_AIN3 (0x3 << 3) -#define ADC_INP_AIN4 (0x4 << 3) -#define ADC_INP_AIN5 (0x5 << 3) -#define ADC_INP_AIN6 (0x6 << 3) -#define ADC_INP_AIN7 (0x7 << 3) -#define ADC_PRSCEN 0x4000 -#define ADC_ECFLG 0x800 +#define ADC_ENABLE_START 0x1 +#define ADC_READ_START 0x2 +#define ADC_STDBM 0x4 +#define ADC_INP_AIN0 (0x0 << 3) +#define ADC_INP_AIN1 (0x1 << 3) +#define ADC_INP_AIN2 (0x2 << 3) +#define ADC_INP_AIN3 (0x3 << 3) +#define ADC_INP_AIN4 (0x4 << 3) +#define ADC_INP_AIN5 (0x5 << 3) +#define ADC_INP_AIN6 (0x6 << 3) +#define ADC_INP_AIN7 (0x7 << 3) +#define ADC_PRSCEN 0x4000 +#define ADC_ECFLG 0x800 /* misc */ /* externals */ -extern int memory_post_tests (unsigned long start, unsigned long size); -extern int i2c_write (uchar, uint, int , uchar* , int); -extern int i2c_read (uchar, uint, int , uchar* , int); -extern void tsc2000_reg_init (void); -extern s32 tsc2000_contact_temp (void); +extern int memory_post_tests(unsigned long start, unsigned long size); +extern int i2c_write(uchar, uint, int, uchar *, int); +extern int i2c_read(uchar, uint, int , uchar *, int); +extern void tsc2000_reg_init(void); +extern s32 tsc2000_contact_temp(void); extern void tsc2000_spi_init(void); /* function declarations */ -int do_dip (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); -int do_vcc5v (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); -int do_burn_in (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); -int do_contact_temp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); -int do_burn_in_status (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); -int i2c_write_multiple (uchar chip, uint addr, int alen, - uchar *buffer, int len); -int i2c_read_multiple (uchar chip, uint addr, int alen, - uchar *buffer, int len); -int do_temp_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_dip(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_vcc5v(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_burn_in(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_contact_temp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_burn_in_status(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int i2c_write_multiple(uchar chip, uint addr, int alen, uchar *buffer, int len); +int i2c_read_multiple(uchar chip, uint addr, int alen, uchar *buffer, int len); +int do_temp_log(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /* helper functions */ -static void adc_init (void); -static int adc_read (unsigned int channel); -static int read_dip (void); -static int read_vcc5v (void); -static int test_dip (void); -static int test_vcc5v (void); -static int test_rotary_switch (void); -static int test_sram (void); -static int test_eeprom (void); -static int test_contact_temp (void); -static void led_set (unsigned int); -static void led_blink (void); -static void led_init (void); -static void sdelay (unsigned long seconds); /* delay in seconds */ -static int dummy (void); +static void adc_init(void); +static int adc_read(unsigned int channel); +static int read_dip(void); +static int read_vcc5v(void); +static int test_dip(void); +static int test_vcc5v(void); +static int test_rotary_switch(void); +static int test_sram(void); +static int test_eeprom(void); +static int test_contact_temp(void); +static void led_set(unsigned int); +static void led_blink(void); +static void led_init(void); +static void sdelay(unsigned long seconds); /* delay in seconds */ +static int dummy(void); static int read_max_cycles(void); -static void test_function_table_init (void); -static void global_vars_init (void); -static int global_vars_write_to_eeprom (void); +static void test_function_table_init(void); +static void global_vars_init(void); +static int global_vars_write_to_eeprom(void); /* globals */ u16 max_cycles; @@ -161,8 +159,7 @@ typedef struct test_function_s { /* table with burn in functions */ test_function_t test_function[BIF_MAX]; - -int do_burn_in (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_burn_in(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { int i; int cycle_status; @@ -172,25 +169,25 @@ int do_burn_in (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } - led_init (); - global_vars_init (); - test_function_table_init (); - tsc2000_spi_init (); + led_init(); + global_vars_init(); + test_function_table_init(); + tsc2000_spi_init(); - if (global_vars_write_to_eeprom () != 0) { - printf ("%s: error writing global_vars to eeprom\n", - __FUNCTION__); + if (global_vars_write_to_eeprom() != 0) { + printf("%s: error writing global_vars to eeprom\n", + __FUNCTION__); return (1); } - if (read_max_cycles () != 0) { - printf ("%s: error reading max_cycles from eeprom\n", - __FUNCTION__); + if (read_max_cycles() != 0) { + printf("%s: error reading max_cycles from eeprom\n", + __FUNCTION__); return (1); } if (max_cycles == 0) { - printf ("%s: error, burn in max_cycles = 0\n", __FUNCTION__); + printf("%s: error, burn in max_cycles = 0\n", __FUNCTION__); return (1); } @@ -203,13 +200,13 @@ int do_burn_in (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * avoid timestamp overflow problem after about 68 minutes of * udelay() time. */ - reset_timer_masked (); + reset_timer_masked(); for (i = 0; i < BIF_MAX; i++) { /* call test function */ if ((*test_function[i].pf)() != 0) { - printf ("error in %s test\n", - test_function[i].name); + printf("error in %s test\n", + test_function[i].name); /* is it the first error? */ if (status == 0) { @@ -218,10 +215,10 @@ int do_burn_in (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* do not use error_num 0 */ first_error_num = i+1; - strncpy (first_error_name, - test_function[i].name, - sizeof (first_error_name)); - led_set (0); + strncpy(first_error_name, + test_function[i].name, + sizeof(first_error_name)); + led_set(0); } cycle_status = 1; } @@ -232,41 +229,38 @@ int do_burn_in (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* set status LED if no error is occoured since yet */ if (status == 0) - led_set (1); + led_set(1); - printf ("%s: cycle %d finished\n", __FUNCTION__, act_cycle); + printf("%s: cycle %d finished\n", __FUNCTION__, act_cycle); /* pause between cycles */ - sdelay (BURN_IN_CYCLE_DELAY); + sdelay(BURN_IN_CYCLE_DELAY); } - if (global_vars_write_to_eeprom () != 0) { - led_set (0); - printf ("%s: error writing global_vars to eeprom\n", - __FUNCTION__); + if (global_vars_write_to_eeprom() != 0) { + led_set(0); + printf("%s: error writing global_vars to eeprom\n", + __FUNCTION__); status = 1; } if (status == 0) { - led_blink (); /* endless loop!! */ + led_blink(); /* endless loop!! */ return (0); } else { - led_set (0); + led_set(0); return (1); } } -U_BOOT_CMD( - burn_in, 1, 1, do_burn_in, - "start burn-in test application on TRAB", - "\n" - " - start burn-in test application\n" - " The burn-in test could took a while to finish!\n" - " The content of the onboard EEPROM is modified!" -); +U_BOOT_CMD(burn_in, 1, 1, do_burn_in, + "start burn-in test application on TRAB", + "\n" + " - start burn-in test application\n" + " The burn-in test could took a while to finish!\n" + " The content of the onboard EEPROM is modified!"); - -int do_dip (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_dip(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { int i, dip; @@ -275,7 +269,7 @@ int do_dip (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } - if ((dip = read_dip ()) == -1) { + if ((dip = read_dip()) == -1) { return 1; } @@ -290,16 +284,13 @@ int do_dip (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -U_BOOT_CMD( - dip, 1, 1, do_dip, - "read dip switch on TRAB", - "\n" - " - read state of dip switch (S1) on TRAB board\n" - " read sequence: 1-2-3-4; ON=1; OFF=0; e.g.: \"0100\"" -); - +U_BOOT_CMD(dip, 1, 1, do_dip, + "read dip switch on TRAB", + "\n" + " - read state of dip switch (S1) on TRAB board\n" + " read sequence: 1-2-3-4; ON=1; OFF=0; e.g.: \"0100\""); -int do_vcc5v (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_vcc5v(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { int vcc5v; @@ -308,26 +299,23 @@ int do_vcc5v (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } - if ((vcc5v = read_vcc5v ()) == -1) { + if ((vcc5v = read_vcc5v()) == -1) { return (1); } - printf ("%d", (vcc5v / 1000)); - printf (".%d", (vcc5v % 1000) / 100); - printf ("%d V\n", (vcc5v % 100) / 10) ; + printf("%d", (vcc5v / 1000)); + printf(".%d", (vcc5v % 1000) / 100); + printf("%d V\n", (vcc5v % 100) / 10); return 0; } -U_BOOT_CMD( - vcc5v, 1, 1, do_vcc5v, - "read VCC5V on TRAB", - "\n" - " - read actual value of voltage VCC5V" -); +U_BOOT_CMD(vcc5v, 1, 1, do_vcc5v, + "read VCC5V on TRAB", + "\n" + " - read actual value of voltage VCC5V"); - -int do_contact_temp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_contact_temp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { int contact_temp; @@ -339,72 +327,67 @@ int do_contact_temp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) tsc2000_spi_init (); contact_temp = tsc2000_contact_temp(); - printf ("%d degree C * 100\n", contact_temp) ; + printf("%d degree C * 100\n", contact_temp); return 0; } -U_BOOT_CMD( - c_temp, 1, 1, do_contact_temp, - "read contact temperature on TRAB", - "" - " - reads the onboard temperature (=contact temperature)\n" -); - +U_BOOT_CMD(c_temp, 1, 1, do_contact_temp, + "read contact temperature on TRAB", + "" + " - reads the onboard temperature (=contact temperature)\n"); -int do_burn_in_status (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_burn_in_status(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { if (argc > 1) { cmd_usage(cmdtp); return 1; } - if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_STATUS, 1, - (unsigned char*) &status, 1)) { + if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_STATUS, 1, + (unsigned char *)&status, 1)) { return (1); } - if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_PASS_CYCLES, 1, - (unsigned char*) &pass_cycles, 2)) { + if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_PASS_CYCLES, 1, + (unsigned char *)&pass_cycles, 2)) { return (1); } - if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_CYCLE, - 1, (unsigned char*) &first_error_cycle, 2)) { + if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_CYCLE, + 1, (unsigned char *)&first_error_cycle, 2)) { return (1); } - if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NUM, - 1, (unsigned char*) &first_error_num, 1)) { + if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NUM, + 1, (unsigned char *) &first_error_num, 1)) { return (1); } - if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NAME, - 1, (unsigned char*)first_error_name, - sizeof (first_error_name))) { + if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NAME, + 1, (unsigned char *)first_error_name, + sizeof(first_error_name))) { return (1); } - if (read_max_cycles () != 0) { + if (read_max_cycles() != 0) { return (1); } - printf ("max_cycles = %d\n", max_cycles); - printf ("status = %d\n", status); - printf ("pass_cycles = %d\n", pass_cycles); - printf ("first_error_cycle = %d\n", first_error_cycle); - printf ("first_error_num = %d\n", first_error_num); - printf ("first_error_name = %.*s\n",(int) sizeof(first_error_name), - first_error_name); + printf("max_cycles = %d\n", max_cycles); + printf("status = %d\n", status); + printf("pass_cycles = %d\n", pass_cycles); + printf("first_error_cycle = %d\n", first_error_cycle); + printf("first_error_num = %d\n", first_error_num); + printf("first_error_name = %.*s\n", (int)sizeof(first_error_name), + first_error_name); return 0; } -U_BOOT_CMD( - bis, 1, 1, do_burn_in_status, - "print burn in status on TRAB", - "\n" - " - prints the status variables of the last burn in test\n" - " stored in the onboard EEPROM on TRAB board" -); +U_BOOT_CMD(bis, 1, 1, do_burn_in_status, + "print burn in status on TRAB", + "\n" + " - prints the status variables of the last burn in test\n" + " stored in the onboard EEPROM on TRAB board"); -static int read_dip (void) +static int read_dip(void) { unsigned int result = 0; int adc_val; @@ -423,9 +406,9 @@ static int read_dip (void) for (i = 7; i > 3; i--) { - if ((adc_val = adc_read (i)) == -1) { - printf ("%s: Channel %d could not be read\n", - __FUNCTION__, i); + if ((adc_val = adc_read(i)) == -1) { + printf("%s: Channel %d could not be read\n", + __FUNCTION__, i); return (-1); } @@ -435,20 +418,19 @@ static int read_dip (void) * Set trigger at halve that value. */ if (adc_val < 368) - result |= (1 << (i-4)); + result |= (1 << (i - 4)); } return (result); } - -static int read_vcc5v (void) +static int read_vcc5v(void) { s32 result; /* VCC5V is connected to channel 2 */ - if ((result = adc_read (2)) == -1) { - printf ("%s: VCC5V could not be read\n", __FUNCTION__); + if ((result = adc_read(2)) == -1) { + printf("%s: VCC5V could not be read\n", __FUNCTION__); return (-1); } /* @@ -461,45 +443,42 @@ static int read_vcc5v (void) return (result); } - -static int test_dip (void) +static int test_dip(void) { static int first_run = 1; static int first_dip; if (first_run) { - if ((first_dip = read_dip ()) == -1) { + if ((first_dip = read_dip()) == -1) { return (1); } first_run = 0; - debug ("%s: first_dip=%d\n", __FUNCTION__, first_dip); + debug("%s: first_dip=%d\n", __FUNCTION__, first_dip); } - if (first_dip != read_dip ()) { + if (first_dip != read_dip()) { return (1); } else { return (0); } } - -static int test_vcc5v (void) +static int test_vcc5v(void) { int vcc5v; - if ((vcc5v = read_vcc5v ()) == -1) { + if ((vcc5v = read_vcc5v()) == -1) { return (1); } if ((vcc5v > VCC5V_MAX) || (vcc5v < VCC5V_MIN)) { - printf ("%s: vcc5v[V/100]=%d\n", __FUNCTION__, vcc5v); + printf("%s: vcc5v[V/100]=%d\n", __FUNCTION__, vcc5v); return (1); } else { return (0); } } - -static int test_rotary_switch (void) +static int test_rotary_switch(void) { static int first_run = 1; static int first_rs; @@ -513,7 +492,7 @@ static int test_rotary_switch (void) first_rs = ((*CPLD_ROTARY_SWITCH >> 16) & 0x7); first_run = 0; - debug ("%s: first_rs=%d\n", __FUNCTION__, first_rs); + debug("%s: first_rs=%d\n", __FUNCTION__, first_rs); } if (first_rs != ((*CPLD_ROTARY_SWITCH >> 16) & 0x7)) { @@ -523,63 +502,60 @@ static int test_rotary_switch (void) } } - -static int test_sram (void) +static int test_sram(void) { - return (memory_post_tests (SRAM_ADDR, SRAM_SIZE)); + return (memory_post_tests(SRAM_ADDR, SRAM_SIZE)); } - -static int test_eeprom (void) +static int test_eeprom(void) { - unsigned char temp[sizeof (EEPROM_TEST_STRING_1)]; + unsigned char temp[sizeof(EEPROM_TEST_STRING_1)]; int result = 0; /* write test string 1, read back and verify */ - if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1, - (unsigned char*)EEPROM_TEST_STRING_1, - sizeof (EEPROM_TEST_STRING_1))) { + if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1, + (unsigned char *)EEPROM_TEST_STRING_1, + sizeof(EEPROM_TEST_STRING_1))) { return (1); } - if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1, - temp, sizeof (EEPROM_TEST_STRING_1))) { + if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1, + temp, sizeof(EEPROM_TEST_STRING_1))) { return (1); } - if (strcmp ((char *)temp, EEPROM_TEST_STRING_1) != 0) { + if (strcmp((char *)temp, EEPROM_TEST_STRING_1) != 0) { result = 1; - printf ("%s: error; read_str = \"%s\"\n", __FUNCTION__, temp); + printf("%s: error; read_str = \"%s\"\n", __FUNCTION__, temp); } /* write test string 2, read back and verify */ if (result == 0) { - if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1, - (unsigned char*)EEPROM_TEST_STRING_2, - sizeof (EEPROM_TEST_STRING_2))) { + if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1, + (unsigned char *)EEPROM_TEST_STRING_2, + sizeof(EEPROM_TEST_STRING_2))) { return (1); } - if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1, - temp, sizeof (EEPROM_TEST_STRING_2))) { + if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1, + temp, sizeof(EEPROM_TEST_STRING_2))) { return (1); } - if (strcmp ((char *)temp, EEPROM_TEST_STRING_2) != 0) { + if (strcmp((char *)temp, EEPROM_TEST_STRING_2) != 0) { result = 1; - printf ("%s: error; read str = \"%s\"\n", - __FUNCTION__, temp); + printf("%s: error; read str = \"%s\"\n", + __FUNCTION__, temp); } } return (result); } - -static int test_contact_temp (void) +static int test_contact_temp(void) { int contact_temp; - contact_temp = tsc2000_contact_temp (); + contact_temp = tsc2000_contact_temp(); if ((contact_temp < MIN_CONTACT_TEMP) || (contact_temp > MAX_CONTACT_TEMP)) @@ -588,59 +564,56 @@ static int test_contact_temp (void) return (0); } - -int i2c_write_multiple (uchar chip, uint addr, int alen, - uchar *buffer, int len) +int i2c_write_multiple(uchar chip, uint addr, int alen, + uchar *buffer, int len) { int i; if (alen != 1) { - printf ("%s: addr len other than 1 not supported\n", - __FUNCTION__); + printf("%s: addr len other than 1 not supported\n", + __FUNCTION__); return (1); } for (i = 0; i < len; i++) { - if (i2c_write (chip, addr+i, alen, buffer+i, 1)) { - printf ("%s: could not write to i2c device %d" - ", addr %d\n", __FUNCTION__, chip, addr); + if (i2c_write(chip, addr+i, alen, buffer+i, 1)) { + printf("%s: could not write to i2c device %d" + ", addr %d\n", __FUNCTION__, chip, addr); return (1); } #if 0 - printf ("chip=%#x, addr+i=%#x+%d=%p, alen=%d, *buffer+i=" - "%#x+%d=%p=\"%.1s\"\n", chip, addr, i, addr+i, - alen, buffer, i, buffer+i, buffer+i); + printf("chip=%#x, addr+i=%#x+%d=%p, alen=%d, *buffer+i=" + "%#x+%d=%p=\"%.1s\"\n", chip, addr, i, addr+i, + alen, buffer, i, buffer+i, buffer+i); #endif - udelay (30000); + udelay(30000); } return (0); } - -int i2c_read_multiple ( uchar chip, uint addr, int alen, - uchar *buffer, int len) +int i2c_read_multiple(uchar chip, uint addr, int alen, + uchar *buffer, int len) { int i; if (alen != 1) { - printf ("%s: addr len other than 1 not supported\n", - __FUNCTION__); + printf("%s: addr len other than 1 not supported\n", + __FUNCTION__); return (1); } for (i = 0; i < len; i++) { - if (i2c_read (chip, addr+i, alen, buffer+i, 1)) { - printf ("%s: could not read from i2c device %#x" - ", addr %d\n", __FUNCTION__, chip, addr); + if (i2c_read(chip, addr+i, alen, buffer+i, 1)) { + printf("%s: could not read from i2c device %#x" + ", addr %d\n", __FUNCTION__, chip, addr); return (1); } } return (0); } - -static int adc_read (unsigned int channel) +static int adc_read(unsigned int channel) { int j = 1000; /* timeout value for wait loop in us */ int result; @@ -649,49 +622,48 @@ static int adc_read (unsigned int channel) padc = s3c2400_get_base_adc(); channel &= 0x7; - adc_init (); + adc_init(); - padc->ADCCON &= ~ADC_STDBM; /* select normal mode */ - padc->ADCCON &= ~(0x7 << 3); /* clear the channel bits */ + padc->ADCCON &= ~ADC_STDBM; /* select normal mode */ + padc->ADCCON &= ~(0x7 << 3); /* clear the channel bits */ padc->ADCCON |= ((channel << 3) | ADC_ENABLE_START); while (j--) { if ((padc->ADCCON & ADC_ENABLE_START) == 0) break; - udelay (1); + udelay(1); } if (j == 0) { printf("%s: ADC timeout\n", __FUNCTION__); - padc->ADCCON |= ADC_STDBM; /* select standby mode */ + padc->ADCCON |= ADC_STDBM; /* select standby mode */ return -1; } result = padc->ADCDAT & 0x3FF; - padc->ADCCON |= ADC_STDBM; /* select standby mode */ + padc->ADCCON |= ADC_STDBM; /* select standby mode */ - debug ("%s: channel %d, result[DIGIT]=%d\n", __FUNCTION__, - (padc->ADCCON >> 3) & 0x7, result); + debug("%s: channel %d, result[DIGIT]=%d\n", __FUNCTION__, + (padc->ADCCON >> 3) & 0x7, result); /* * Wait for ADC to be ready for next conversion. This delay value was * estimated, because the datasheet does not specify a value. */ - udelay (1000); + udelay(1000); return (result); } - -static void adc_init (void) +static void adc_init(void) { struct s3c2400_adc *padc; padc = s3c2400_get_base_adc(); - padc->ADCCON &= ~(0xff << 6); /* clear prescaler bits */ - padc->ADCCON |= ((65 << 6) | ADC_PRSCEN); /* set prescaler */ + padc->ADCCON &= ~(0xff << 6); /* clear prescaler bits */ + padc->ADCCON |= ((65 << 6) | ADC_PRSCEN); /* set prescaler */ /* * Wait some time to avoid problem with very first call of @@ -699,23 +671,22 @@ static void adc_init (void) * adc value is 0. Perhaps because the adjustment of prescaler * takes some clock cycles? */ - udelay (1000); + udelay(1000); return; } - -static void led_set (unsigned int state) +static void led_set(unsigned int state) { struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); - led_init (); + led_init(); switch (state) { - case 0: /* turn LED off */ + case 0: /* turn LED off */ gpio->PADAT |= (1 << 12); break; - case 1: /* turn LED on */ + case 1: /* turn LED on */ gpio->PADAT &= ~(1 << 12); break; default: @@ -723,22 +694,21 @@ static void led_set (unsigned int state) } } -static void led_blink (void) +static void led_blink(void) { - led_init (); + led_init(); /* blink LED. This function does not return! */ while (1) { - reset_timer_masked (); - led_set (1); - udelay (1000000 / LED_BLINK_FREQ / 2); - led_set (0); - udelay (1000000 / LED_BLINK_FREQ / 2); + reset_timer_masked(); + led_set(1); + udelay(1000000 / LED_BLINK_FREQ / 2); + led_set(0); + udelay(1000000 / LED_BLINK_FREQ / 2); } } - -static void led_init (void) +static void led_init(void) { struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); @@ -747,46 +717,44 @@ static void led_init (void) gpio->PADAT |= (1 << 12); } - -static void sdelay (unsigned long seconds) +static void sdelay(unsigned long seconds) { unsigned long i; for (i = 0; i < seconds; i++) { - udelay (1000000); + udelay(1000000); } } - -static int global_vars_write_to_eeprom (void) +static int global_vars_write_to_eeprom(void) { - if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_STATUS, 1, - (unsigned char*) &status, 1)) { + if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_STATUS, 1, + (unsigned char *) &status, 1)) { return (1); } - if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_PASS_CYCLES, 1, - (unsigned char*) &pass_cycles, 2)) { + if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_PASS_CYCLES, 1, + (unsigned char *) &pass_cycles, 2)) { return (1); } - if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_CYCLE, - 1, (unsigned char*) &first_error_cycle, 2)) { + if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_CYCLE, + 1, (unsigned char *) &first_error_cycle, 2)) { return (1); } - if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NUM, - 1, (unsigned char*) &first_error_num, 1)) { + if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NUM, + 1, (unsigned char *) &first_error_num, 1)) { return (1); } - if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NAME, - 1, (unsigned char*) first_error_name, - sizeof(first_error_name))) { + if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NAME, + 1, (unsigned char *) first_error_name, + sizeof(first_error_name))) { return (1); } return (0); } -static void global_vars_init (void) +static void global_vars_init(void) { - status = 1; /* error */ + status = 1; /* error */ pass_cycles = 0; first_error_cycle = 0; first_error_num = 0; @@ -795,8 +763,7 @@ static void global_vars_init (void) max_cycles = 0; } - -static void test_function_table_init (void) +static void test_function_table_init(void) { int i; @@ -826,11 +793,10 @@ static void test_function_table_init (void) test_function[5].name = "contact_temp"; } - -static int read_max_cycles (void) +static int read_max_cycles(void) { - if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_MAX_CYCLES, 1, - (unsigned char *) &max_cycles, 2) != 0) { + if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, EE_ADDR_MAX_CYCLES, 1, + (unsigned char *) &max_cycles, 2) != 0) { return (1); } @@ -842,7 +808,7 @@ static int dummy(void) return (0); } -int do_temp_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_temp_log(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { int contact_temp; int delay = 0; @@ -859,38 +825,35 @@ int do_temp_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) delay = simple_strtoul(argv[1], NULL, 10); } - tsc2000_spi_init (); + tsc2000_spi_init(); while (1) { #if defined(CONFIG_CMD_DATE) rtc_get (&tm); - printf ("%4d-%02d-%02d %2d:%02d:%02d - ", - tm.tm_year, tm.tm_mon, tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec); + printf("%4d-%02d-%02d %2d:%02d:%02d - ", + tm.tm_year, tm.tm_mon, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec); #endif contact_temp = tsc2000_contact_temp(); - printf ("%d\n", contact_temp) ; + printf("%d\n", contact_temp) ; if (delay != 0) /* * reset timer to avoid timestamp overflow problem * after about 68 minutes of udelay() time. */ - reset_timer_masked (); - sdelay (delay); + reset_timer_masked(); + sdelay(delay); } return 0; } -U_BOOT_CMD( - tlog, 2, 1, do_temp_log, - "log contact temperature [1/100 C] to console (endlessly)", - "delay\n" - " - contact temperature [1/100 C] is printed endlessly to console\n" - " specifies the seconds to wait between two measurements\n" - " For each measurment a timestamp is printeted" -); - +U_BOOT_CMD(tlog, 2, 1, do_temp_log, + "log contact temperature [1/100 C] to console (endlessly)", + "delay\n" + " - contact temperature [1/100 C] is printed endlessly to console\n" + " specifies the seconds to wait between two measurements\n" + " For each measurment a timestamp is printeted"); #endif diff --git a/board/trab/lowlevel_init.S b/board/trab/lowlevel_init.S index 9a00944..c522309 100644 --- a/board/trab/lowlevel_init.S +++ b/board/trab/lowlevel_init.S @@ -45,7 +45,7 @@ */ /* memory controller */ -#define BWSCON 0x14000000 +#define BWSCON 0x14000000 /* Bank0 */ #define B0_Tacs 0x1 /* 1 clk */ @@ -103,24 +103,24 @@ #ifndef CONFIG_RAM_16MB /* 32 MB RAM */ /* Bank6 */ -#define B6_MT 0x3 /* SDRAM */ -#define B6_Trcd 0x0 /* 2clk */ -#define B6_SCAN 0x1 /* 9 bit */ +#define B6_MT 0x3 /* SDRAM */ +#define B6_Trcd 0x0 /* 2clk */ +#define B6_SCAN 0x1 /* 9 bit */ /* Bank7 */ -#define B7_MT 0x3 /* SDRAM */ -#define B7_Trcd 0x0 /* 2clk */ -#define B7_SCAN 0x1 /* 9 bit */ +#define B7_MT 0x3 /* SDRAM */ +#define B7_Trcd 0x0 /* 2clk */ +#define B7_SCAN 0x1 /* 9 bit */ #else /* CONFIG_RAM_16MB = 16 MB RAM */ /* Bank6 */ -#define B6_MT 0x3 /* SDRAM */ -#define B6_Trcd 0x1 /* 2clk */ -#define B6_SCAN 0x0 /* 8 bit */ +#define B6_MT 0x3 /* SDRAM */ +#define B6_Trcd 0x1 /* 2clk */ +#define B6_SCAN 0x0 /* 8 bit */ /* Bank7 */ -#define B7_MT 0x3 /* SDRAM */ -#define B7_Trcd 0x1 /* 2clk */ -#define B7_SCAN 0x0 /* 8 bit */ +#define B7_MT 0x3 /* SDRAM */ +#define B7_Trcd 0x1 /* 2clk */ +#define B7_SCAN 0x0 /* 8 bit */ #endif /* CONFIG_RAM_16MB */ /* refresh parameter */ @@ -145,16 +145,16 @@ lowlevel_init: /* memory control configuration */ /* make r0 relative the current location so that it */ /* reads SMRDATA out of FLASH rather than memory ! */ - ldr r0, =SMRDATA + ldr r0, =SMRDATA ldr r1, _TEXT_BASE sub r0, r0, r1 ldr r1, =BWSCON /* Bus Width Status Controller */ - add r2, r0, #52 + add r2, r0, #52 0: - ldr r3, [r0], #4 - str r3, [r1], #4 - cmp r2, r0 - bne 0b + ldr r3, [r0], #4 + str r3, [r1], #4 + cmp r2, r0 + bne 0b /* everything is fine now */ mov pc, lr @@ -163,20 +163,26 @@ lowlevel_init: /* the literal pools origin */ SMRDATA: - .word 0x2211d644 /* d->Ethernet, 6->CPLD, 4->SRAM, 4->FLASH */ - .word ((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC)) /* GCS0 */ - .word ((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC)) /* GCS1 */ - .word ((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC)) /* GCS2 */ - .word ((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_Tacp<<2)+(B3_PMC)) /* GCS3 */ - .word ((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_Tacp<<2)+(B4_PMC)) /* GCS4 */ - .word ((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_Tacp<<2)+(B5_PMC)) /* GCS5 */ - .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) /* GCS6 */ - .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) /* GCS7 */ - .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) + .word 0x2211d644 /* d->Ethernet, 6->CPLD, 4->SRAM, 4->FLASH */ + .word ((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+ \ + (B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC)) /* GCS0 */ + .word ((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+ \ + (B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC)) /* GCS1 */ + .word ((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+ \ + (B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC)) /* GCS2 */ + .word ((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+ \ + (B3_Tah<<4)+(B3_Tacp<<2)+(B3_PMC)) /* GCS3 */ + .word ((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+ \ + (B4_Tah<<4)+(B4_Tacp<<2)+(B4_PMC)) /* GCS4 */ + .word ((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+ \ + (B5_Tah<<4)+(B5_Tacp<<2)+(B5_PMC)) /* GCS5 */ + .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) /* GCS6 */ + .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) /* GCS7 */ + .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) #ifndef CONFIG_RAM_16MB /* 32 MB RAM */ - .word 0x10 /* BUSWIDTH=32, SCLK power saving mode, BANKSIZE 32M/32M */ + .word 0x10 /* BUSWIDTH=32, SCLK pwr save mode, BANKSIZE 32M/32M */ #else /* CONFIG_RAM_16MB = 16 MB RAM */ - .word 0x17 /* BUSWIDTH=32, SCLK power saving mode, BANKSIZE 16M/16M */ + .word 0x17 /* BUSWIDTH=32, SCLK pwr save mode, BANKSIZE 16M/16M */ #endif /* CONFIG_RAM_16MB */ - .word 0x20 /* MRSR6, CL=2clk */ - .word 0x20 /* MRSR7 */ + .word 0x20 /* MRSR6, CL=2clk */ + .word 0x20 /* MRSR7 */ diff --git a/board/trab/rs485.c b/board/trab/rs485.c index ad0c136..2dfd202 100644 --- a/board/trab/rs485.c +++ b/board/trab/rs485.c @@ -25,12 +25,12 @@ #include #include "rs485.h" -static void rs485_setbrg (void); -static void rs485_cfgio (void); +static void rs485_setbrg(void); +static void rs485_cfgio(void); static void set_rs485re(unsigned char rs485re_state); static void set_rs485de(unsigned char rs485de_state); -static void rs485_setbrg (void); -#ifdef NOT_USED +static void rs485_setbrg(void); +#ifdef NOT_USED static void trab_rs485_disable_tx(void); static void trab_rs485_disable_rx(void); #endif @@ -38,9 +38,9 @@ static void trab_rs485_disable_rx(void); #define UART_NR S3C24X0_UART1 /* CPLD-Register for controlling TRAB hardware functions */ -#define CPLD_RS485_RE ((volatile unsigned long *)0x04028000) +#define CPLD_RS485_RE ((volatile unsigned long *)0x04028000) -static void rs485_setbrg (void) +static void rs485_setbrg(void) { struct s3c24x0_uart * const uart = s3c24x0_get_base_uart(UART_NR); int i; @@ -65,20 +65,20 @@ static void rs485_setbrg (void) for (i = 0; i < 100; i++); } -static void rs485_cfgio (void) +static void rs485_cfgio(void) { - struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); + struct s3c24x0_gpio *const gpio = s3c24x0_get_base_gpio(); gpio->PFCON &= ~(0x3 << 2); - gpio->PFCON |= (0x2 << 2); /* configure GPF1 as RXD1 */ + gpio->PFCON |= (0x2 << 2); /* configure GPF1 as RXD1 */ gpio->PFCON &= ~(0x3 << 6); - gpio->PFCON |= (0x2 << 6); /* configure GPF3 as TXD1 */ + gpio->PFCON |= (0x2 << 6); /* configure GPF3 as TXD1 */ - gpio->PFUP |= (1 << 1); /* disable pullup on GPF1 */ - gpio->PFUP |= (1 << 3); /* disable pullup on GPF3 */ + gpio->PFUP |= (1 << 1); /* disable pullup on GPF1 */ + gpio->PFUP |= (1 << 3); /* disable pullup on GPF3 */ - gpio->PACON &= ~(1 << 11); /* set GPA11 (RS485_DE) to output */ + gpio->PACON &= ~(1 << 11); /* set GPA11 (RS485_DE) to output */ } /* @@ -86,10 +86,10 @@ static void rs485_cfgio (void) * are always 8 data bits, no parity, 1 stop bit, no start bits. * */ -int rs485_init (void) +int rs485_init(void) { - rs485_cfgio (); - rs485_setbrg (); + rs485_cfgio(); + rs485_setbrg(); return (0); } @@ -99,7 +99,7 @@ int rs485_init (void) * otherwise. When the function is succesfull, the character read is * written into its argument c. */ -int rs485_getc (void) +int rs485_getc(void) { struct s3c24x0_uart * const uart = s3c24x0_get_base_uart(UART_NR); @@ -112,7 +112,7 @@ int rs485_getc (void) /* * Output a single byte to the rs485 port. */ -void rs485_putc (const char c) +void rs485_putc(const char c) { struct s3c24x0_uart * const uart = s3c24x0_get_base_uart(UART_NR); @@ -123,27 +123,26 @@ void rs485_putc (const char c) /* If \n, also do \r */ if (c == '\n') - rs485_putc ('\r'); + rs485_putc('\r'); } /* * Test whether a character is in the RX buffer */ -int rs485_tstc (void) +int rs485_tstc(void) { - struct s3c24x0_uart * const uart = s3c24x0_get_base_uart(UART_NR); + struct s3c24x0_uart *const uart = s3c24x0_get_base_uart(UART_NR); return uart->UTRSTAT & 0x1; } -void rs485_puts (const char *s) +void rs485_puts(const char *s) { while (*s) { - rs485_putc (*s++); + rs485_putc(*s++); } } - /* * State table: * RE DE Result @@ -157,7 +156,7 @@ void rs485_puts (const char *s) static void set_rs485re(unsigned char rs485re_state) { - if(rs485re_state) + if (rs485re_state) *CPLD_RS485_RE = 0x010000; else *CPLD_RS485_RE = 0x0; @@ -171,13 +170,12 @@ static void set_rs485de(unsigned char rs485de_state) struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); /* This is on PORT A bit 11 */ - if(rs485de_state) + if (rs485de_state) gpio->PADAT |= (1 << 11); else gpio->PADAT &= ~(1 << 11); } - void trab_rs485_enable_tx(void) { set_rs485de(1); diff --git a/board/trab/trab.c b/board/trab/trab.c index 71fd22c..0175d77 100644 --- a/board/trab/trab.c +++ b/board/trab/trab.c @@ -35,7 +35,7 @@ DECLARE_GLOBAL_DATA_PTR; static void spi_init(void); static void wait_transmit_done(void); static void tsc2000_write(unsigned int page, unsigned int reg, - unsigned int data); + unsigned int data); static void tsc2000_set_brightness(void); #endif #ifdef CONFIG_MODEM_SUPPORT @@ -51,12 +51,13 @@ extern int do_mdm_init; /* defined in common/main.c */ * loop. */ #define KBD_MDELAY 5000 -static void udelay_no_timer (int usec) +static void udelay_no_timer(int usec) { int i; int delay = usec * 3; - for (i = 0; i < delay; i ++) gd->bd->bi_arch_number = MACH_TYPE_TRAB; + for (i = 0; i < delay; i++) + gd->bd->bi_arch_number = MACH_TYPE_TRAB; } #endif /* CONFIG_MODEM_SUPPORT */ @@ -64,7 +65,7 @@ static void udelay_no_timer (int usec) * Miscellaneous platform dependent initialisations */ -int board_init () +int board_init() { #if defined(CONFIG_VFD) extern int vfd_init_clocks(void); @@ -89,24 +90,26 @@ int board_init () /* set up the I/O ports */ gpio->PACON = 0x3ffff; gpio->PBCON = 0xaaaaaaaa; - gpio->PBUP = 0xffff; - /* INPUT nCTS0 nRTS0 TXD[1] TXD[0] RXD[1] RXD[0] */ - /* 00, 10, 10, 10, 10, 10, 10 */ - gpio->PFCON = (2<<0) | (2<<2) | (2<<4) | (2<<6) | (2<<8) | (2<<10); + gpio->PBUP = 0xffff; + /* INPUT nCTS0 nRTS0 TXD[1] TXD[0] RXD[1] RXD[0] */ + /* 00, 10, 10, 10, 10, 10, 10 */ + gpio->PFCON = (2 << 0) | (2 << 2) | (2 << 4) | \ + (2 << 6) | (2 << 8) | (2 << 10); #ifdef CONFIG_HWFLOW /* do not pull up RXD0, RXD1, TXD0, TXD1, CTS0, RTS0 */ - gpio->PFUP = (1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<4) | (1<<5); + gpio->PFUP = (1 << 0) | (1 << 1) | (1 << 2) | \ + (1 << 3) | (1 << 4) | (1 << 5); #else /* do not pull up RXD0, RXD1, TXD0, TXD1 */ - gpio->PFUP = (1<<0) | (1<<1) | (1<<2) | (1<<3); + gpio->PFUP = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3); #endif gpio->PGCON = 0x0; - gpio->PGUP = 0x0; - gpio->OPENCR= 0x0; + gpio->PGUP = 0x0; + gpio->OPENCR = 0x0; /* suppress flicker of the VFDs */ gpio->MISCCR = 0x40; - gpio->PFCON |= (2<<12); + gpio->PFCON |= (2 << 12); gd->bd->bi_arch_number = MACH_TYPE_TRAB; @@ -122,7 +125,7 @@ int board_init () #endif /* CONFIG_VFD */ #ifdef CONFIG_MODEM_SUPPORT - udelay_no_timer (KBD_MDELAY); + udelay_no_timer(KBD_MDELAY); if (key_pressed()) { disable_putc(); /* modem doesn't understand banner etc */ @@ -138,7 +141,7 @@ int board_init () return 0; } -int dram_init (void) +int dram_init(void) { gd->bd->bi_dram[0].start = PHYS_SDRAM_1; gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; @@ -150,13 +153,13 @@ int dram_init (void) */ /* Maximum key number */ -#define KEYBD_KEY_NUM 4 +#define KEYBD_KEY_NUM 4 #define KBD_DATA (((*(volatile ulong *)0x04020000) >> 16) & 0xF) -static char *key_match (ulong); +static char *key_match(ulong); -int misc_init_r (void) +int misc_init_r(void) { ulong kbd_data = KBD_DATA; char *str; @@ -188,17 +191,18 @@ int misc_init_r (void) keybd_env[i] = '0' + ((kbd_data >> i) & 1); } keybd_env[i] = '\0'; - debug ("** Setting keybd=\"%s\"\n", keybd_env); - setenv ("keybd", keybd_env); + debug("** Setting keybd=\"%s\"\n", keybd_env); + setenv("keybd", keybd_env); - str = strdup (key_match (kbd_data)); /* decode keys */ + str = strdup(key_match(kbd_data)); /* decode keys */ #ifdef CONFIG_PREBOOT /* automatically configure "preboot" command on key match */ - debug ("** Setting preboot=\"%s\"\n", str); - setenv ("preboot", str); /* set or delete definition */ + /* automatically configure "preboot" command on key match */ + debug("** Setting preboot=\"%s\"\n", str); + setenv("preboot", str); /* set or delete definition */ #endif /* CONFIG_PREBOOT */ if (str != NULL) { - free (str); + free(str); } #ifdef CONFIG_SYS_BRIGHTNESS @@ -212,33 +216,32 @@ int misc_init_r (void) static uchar kbd_magic_prefix[] = "key_magic"; static uchar kbd_command_prefix[] = "key_cmd"; -static int compare_magic (ulong kbd_data, char *str) +static int compare_magic(ulong kbd_data, char *str) { uchar key_mask; - debug ("compare_magic: kbd: %04lx str: \"%s\"\n",kbd_data,str); - for (; *str; str++) - { + debug("compare_magic: kbd: %04lx str: \"%s\"\n", kbd_data, str); + for (; *str; str++) { uchar c = *str - '1'; - if (c >= KEYBD_KEY_NUM) /* bad key number */ + if (c >= KEYBD_KEY_NUM) /* bad key number */ return -1; key_mask = 1 << c; if (!(kbd_data & key_mask)) { /* key not pressed */ - debug ( "compare_magic: " - "kbd: %04lx mask: %04lx - key not pressed\n", - kbd_data, key_mask ); + debug("compare_magic: " + "kbd: %04lx mask: %04lx - key not pressed\n", + kbd_data, key_mask); return -1; } kbd_data &= ~key_mask; } - if (kbd_data) { /* key(s) not released */ - debug ( "compare_magic: " - "kbd: %04lx - key(s) not released\n", kbd_data); + if (kbd_data) { /* key(s) not released */ + debug("compare_magic: " + "kbd: %04lx - key(s) not released\n", kbd_data); return -1; } @@ -258,10 +261,10 @@ static int compare_magic (ulong kbd_data, char *str) * Note: the string points to static environment data and must be * saved before you call any function that modifies the environment. */ -static char *key_match (ulong kbd_data) +static char *key_match(ulong kbd_data) { - char magic[sizeof (kbd_magic_prefix) + 1]; - char cmd_name[sizeof (kbd_command_prefix) + 1]; + char magic[sizeof(kbd_magic_prefix) + 1]; + char cmd_name[sizeof(kbd_command_prefix) + 1]; char *suffix; char *kbd_magic_keys; @@ -273,60 +276,54 @@ static char *key_match (ulong kbd_data) * "key_magic" is checked (old behaviour); the string "125" causes * checks for "key_magic1", "key_magic2" and "key_magic5", etc. */ - if ((kbd_magic_keys = getenv ("magic_keys")) == NULL) + if ((kbd_magic_keys = getenv("magic_keys")) == NULL) kbd_magic_keys = ""; - debug ("key_match: magic_keys=\"%s\"\n", kbd_magic_keys); + debug("key_match: magic_keys=\"%s\"\n", kbd_magic_keys); /* loop over all magic keys; * use '\0' suffix in case of empty string */ - for (suffix=kbd_magic_keys; *suffix || suffix==kbd_magic_keys; ++suffix) - { - sprintf (magic, "%s%c", kbd_magic_prefix, *suffix); - - debug ("key_match: magic=\"%s\"\n", - getenv(magic) ? getenv(magic) : ""); - - if (compare_magic(kbd_data, getenv(magic)) == 0) - { - sprintf (cmd_name, "%s%c", kbd_command_prefix, *suffix); - debug ("key_match: cmdname %s=\"%s\"\n", - cmd_name, - getenv (cmd_name) ? - getenv (cmd_name) : - ""); - return (getenv (cmd_name)); + for (suffix = kbd_magic_keys; *suffix || suffix == kbd_magic_keys; + ++suffix) { + sprintf(magic, "%s%c", kbd_magic_prefix, *suffix); + + debug("key_match: magic=\"%s\"\n", + getenv(magic) ? getenv(magic) : ""); + + if (compare_magic(kbd_data, getenv(magic)) == 0) { + sprintf(cmd_name, "%s%c", kbd_command_prefix, *suffix); + debug("key_match: cmdname %s=\"%s\"\n", + cmd_name, + getenv(cmd_name) ? + getenv(cmd_name) : ""); + return (getenv(cmd_name)); } } - debug ("key_match: no match\n"); + debug("key_match: no match\n"); return (NULL); } -#endif /* CONFIG_PREBOOT */ +#endif /* CONFIG_PREBOOT */ /* Read Keyboard status */ -int do_kbd (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_kbd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { ulong kbd_data = KBD_DATA; char keybd_env[KEYBD_KEY_NUM + 1]; int i; - puts ("Keys:"); + puts("Keys:"); for (i = 0; i < KEYBD_KEY_NUM; ++i) { keybd_env[i] = '0' + ((kbd_data >> i) & 1); - printf (" %c", keybd_env[i]); + printf(" %c", keybd_env[i]); } keybd_env[i] = '\0'; - putc ('\n'); - setenv ("keybd", keybd_env); + putc('\n'); + setenv("keybd", keybd_env); return 0; } -U_BOOT_CMD( - kbd, 1, 1, do_kbd, - "read keyboard status", - "" -); +U_BOOT_CMD(kbd, 1, 1, do_kbd, "read keyboard status", ""); #ifdef CONFIG_MODEM_SUPPORT static int key_pressed(void) @@ -365,9 +362,12 @@ static void spi_init(void) CLR_CS_TOUCH(); - spi->ch[0].SPPRE = 0x1F; /* Baudrate ca. 514kHz */ - spi->ch[0].SPPIN = 0x01; /* SPI-MOSI holds Level after last bit */ - spi->ch[0].SPCON = 0x1A; /* Polling, Prescaler, Master, CPOL=0, CPHA=1 */ + /* Baudrate ca. 514kHz */ + spi->ch[0].SPPRE = 0x1F; + /* SPI-MOSI holds Level after last bit */ + spi->ch[0].SPPIN = 0x01; + /* Polling, Prescaler, Master, CPOL=0, CPHA=1 */ + spi->ch[0].SPCON = 0x1A; /* Dummy byte ensures clock to be low. */ for (i = 0; i < 10; i++) { @@ -380,11 +380,12 @@ static void wait_transmit_done(void) { struct s3c24x0_spi * const spi = s3c24x0_get_base_spi(); - while (!(spi->ch[0].SPSTA & 0x01)); /* wait until transfer is done */ + /* wait until transfer is done */ + while (!(spi->ch[0].SPSTA & 0x01)); } static void tsc2000_write(unsigned int page, unsigned int reg, - unsigned int data) + unsigned int data) { struct s3c24x0_spi * const spi = s3c24x0_get_base_spi(); unsigned int command; @@ -412,12 +413,11 @@ static void tsc2000_set_brightness(void) int i, br; spi_init(); - tsc2000_write(1, 2, 0x0); /* Power up DAC */ + tsc2000_write(1, 2, 0x0); /* Power up DAC */ i = getenv_r("brightness", tmp, sizeof(tmp)); - br = (i > 0) - ? (int) simple_strtoul (tmp, NULL, 10) - : CONFIG_SYS_BRIGHTNESS; + br = (i > 0) ? (int)simple_strtoul(tmp, NULL, 10) : + CONFIG_SYS_BRIGHTNESS; tsc2000_write(0, 0xb, br & 0xff); }