[U-Boot] [PATCH ARM 1/3 v2] s3c24x0 white space clean up
Kevin Morfitt
kevin.morfitt at fearnside-systems.co.uk
Wed Feb 10 16:20:00 CET 2010
Cleans up white-space in the s3c24x0 files, including removing any
dead code but excluding code style or line length changes.
Signed-off-by: Kevin Morfitt <kevin.morfitt at fearnside-systems.co.uk>
---
v2 changes:
- merge the original two white-space change patches, patches 1 and 2,
into this single patch
board/mpl/vcma9/cmd_vcma9.c | 43 --
board/mpl/vcma9/lowlevel_init.S | 112 ++--
board/mpl/vcma9/vcma9.c | 177 +++---
board/mpl/vcma9/vcma9.h | 38 +-
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 +++---
board/trab/trab_fkt.c | 970 +++++++++++++++-----------------
board/trab/tsc2000.c | 183 ++++---
board/trab/tsc2000.h | 16 +-
board/trab/vfd.c | 476 +++++++++-------
18 files changed, 1530 insertions(+), 1560 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/mpl/vcma9/vcma9.h b/board/mpl/vcma9/vcma9.h
index 94fd2fa..e1ec1fe 100644
--- a/board/mpl/vcma9/vcma9.h
+++ b/board/mpl/vcma9/vcma9.h
@@ -27,8 +27,7 @@
#include <asm/arch/s3c24x0_cpu.h>
-extern int mem_test(unsigned long start, unsigned long ramsize,int mode);
-
+extern int mem_test(unsigned long start, unsigned long ramsize, int mode);
void print_vcma9_info(void);
#if defined(CONFIG_CMD_NAND)
@@ -69,13 +68,12 @@ static inline void NF_SetCE(NFCE_STATE s)
struct s3c2410_nand * const nand = s3c2410_get_base_nand();
switch (s) {
- case NFCE_LOW:
- nand->NFCONF &= ~(1<<11);
- break;
-
- case NFCE_HIGH:
- nand->NFCONF |= (1<<11);
- break;
+ case NFCE_LOW:
+ nand->NFCONF &= ~(1 << 11);
+ break;
+ case NFCE_HIGH:
+ nand->NFCONF |= (1 << 11);
+ break;
}
}
@@ -83,7 +81,7 @@ static inline void NF_WaitRB(void)
{
struct s3c2410_nand * const nand = s3c2410_get_base_nand();
- while (!(nand->NFSTAT & (1<<0)));
+ while (!(nand->NFSTAT & (1 << 0)));
}
static inline void NF_Write(u8 data)
@@ -97,34 +95,34 @@ static inline u8 NF_Read(void)
{
struct s3c2410_nand * const nand = s3c2410_get_base_nand();
- return(nand->NFDATA);
+ return (nand->NFDATA);
}
static inline void NF_Init_ECC(void)
{
struct s3c2410_nand * const nand = s3c2410_get_base_nand();
- nand->NFCONF |= (1<<12);
+ nand->NFCONF |= (1 << 12);
}
static inline u32 NF_Read_ECC(void)
{
struct s3c2410_nand * const nand = s3c2410_get_base_nand();
- return(nand->NFECC);
+ return (nand->NFECC);
}
#endif
/* VCMA9 PLD regsiters */
typedef struct {
- u8 ID;
- u8 NIC;
- u8 CAN;
- u8 MISC;
- u8 GPCD;
- u8 BOARD;
- u8 SDRAM;
+ u8 ID;
+ u8 NIC;
+ u8 CAN;
+ u8 MISC;
+ u8 GPCD;
+ u8 BOARD;
+ u8 SDRAM;
} /*__attribute__((__packed__))*/ VCMA9_PLD;
#define VCMA9_PLD_BASE 0x2C000100
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"
- " <delay> 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"
+ " <delay> 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 <asm/arch/s3c24x0_cpu.h>
#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) : "<UNDEFINED>");
-
- 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) :
- "<UNDEFINED>");
- 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) : "<UNDEFINED>");
+
+ 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) : "<UNDEFINED>");
+ 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);
}
diff --git a/board/trab/trab_fkt.c b/board/trab/trab_fkt.c
index 2df9a04..b9a2bb9 100644
--- a/board/trab/trab_fkt.c
+++ b/board/trab/trab_fkt.c
@@ -40,122 +40,122 @@
/* max time to wait for touch is pressed */
#ifndef CONFIG_TOUCH_WAIT_PRESSED
-#define TOUCH_TIMEOUT 5
+#define TOUCH_TIMEOUT 5
#endif /* !CONFIG_TOUCH_WAIT_PRESSED */
/* assignment of CPU internal ADC channels with TRAB hardware */
-#define VCC5V 2
-#define VCC12V 3
+#define VCC5V 2
+#define VCC12V 3
/* 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)
/* timer configuration bits for buzzer and PWM */
#define START2 (1 << 12)
-#define UPDATE2 (1 << 13)
-#define INVERT2 (1 << 14)
-#define RELOAD2 (1 << 15)
+#define UPDATE2 (1 << 13)
+#define INVERT2 (1 << 14)
+#define RELOAD2 (1 << 15)
#define START3 (1 << 16)
-#define UPDATE3 (1 << 17)
-#define INVERT3 (1 << 18)
-#define RELOAD3 (1 << 19)
+#define UPDATE3 (1 << 17)
+#define INVERT3 (1 << 18)
+#define RELOAD3 (1 << 19)
#define PCLK 66000000
-#define BUZZER_FREQ 1000 /* frequency in Hz */
-#define PWM_FREQ 500
+#define BUZZER_FREQ 1000 /* frequency in Hz */
+#define PWM_FREQ 500
/* definitions of I2C EEPROM device address */
-#define I2C_EEPROM_DEV_ADDR 0x54
+#define I2C_EEPROM_DEV_ADDR 0x54
/* definition for touch panel calibration points */
-#define CALIB_TL 0 /* calibration point in (T)op (L)eft corner */
-#define CALIB_DR 1 /* calibration point in (D)own (R)ight corner */
+#define CALIB_TL 0 /* calibration point in (T)op (L)eft corner */
+#define CALIB_DR 1 /* calibration point in (D)own (R)ight corner */
/* EEPROM address map */
-#define SERIAL_NUMBER 8
-#define TOUCH_X0 52
-#define TOUCH_Y0 54
-#define TOUCH_X1 56
-#define TOUCH_Y1 58
-#define CRC16 60
+#define SERIAL_NUMBER 8
+#define TOUCH_X0 52
+#define TOUCH_Y0 54
+#define TOUCH_X1 56
+#define TOUCH_Y1 58
+#define CRC16 60
/* EEPROM stuff */
-#define EEPROM_MAX_CRC_BUF 64
+#define EEPROM_MAX_CRC_BUF 64
/* RS485 stuff */
-#define RS485_MAX_RECEIVE_BUF_LEN 100
+#define RS485_MAX_RECEIVE_BUF_LEN 100
/* 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 0x8000
+#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 0x8000
/* function test functions */
-int do_dip (void);
-int do_info (void);
-int do_vcc5v (void);
-int do_vcc12v (void);
-int do_buttons (void);
-int do_fill_level (void);
-int do_rotary_switch (void);
-int do_pressure (void);
-int do_v_bat (void);
-int do_vfd_id (void);
-int do_buzzer (char **);
-int do_led (char **);
-int do_full_bridge (char **);
-int do_dac (char **);
-int do_motor_contact (void);
-int do_motor (char **);
-int do_pwm (char **);
-int do_thermo (char **);
-int do_touch (char **);
-int do_rs485 (char **);
-int do_serial_number (char **);
-int do_crc16 (void);
-int do_power_switch (void);
-int do_gain (char **);
-int do_eeprom (char **);
+int do_dip(void);
+int do_info(void);
+int do_vcc5v(void);
+int do_vcc12v(void);
+int do_buttons(void);
+int do_fill_level(void);
+int do_rotary_switch(void);
+int do_pressure(void);
+int do_v_bat(void);
+int do_vfd_id(void);
+int do_buzzer(char **);
+int do_led(char **);
+int do_full_bridge(char **);
+int do_dac(char **);
+int do_motor_contact(void);
+int do_motor(char **);
+int do_pwm(char **);
+int do_thermo(char **);
+int do_touch(char **);
+int do_rs485(char **);
+int do_serial_number(char **);
+int do_crc16(void);
+int do_power_switch(void);
+int do_gain(char **);
+int do_eeprom(char **);
/* helper functions */
-static void adc_init (void);
-static int adc_read (unsigned int channel);
-static void print_identifier (void);
+static void adc_init(void);
+static int adc_read(unsigned int channel);
+static void print_identifier(void);
#ifdef CONFIG_TOUCH_WAIT_PRESSED
-static void touch_wait_pressed (void);
+static void touch_wait_pressed(void);
#else
-static int touch_check_pressed (void);
+static int touch_check_pressed(void);
#endif /* CONFIG_TOUCH_WAIT_PRESSED */
-static void touch_read_x_y (int *x, int *y);
-static int touch_write_clibration_values (int calib_point, int x, int y);
-static int rs485_send_line (const char *data);
-static int rs485_receive_chars (char *data, int timeout);
+static void touch_read_x_y(int *x, int *y);
+static int touch_write_clibration_values(int calib_point, int x, int y);
+static int rs485_send_line(const char *data);
+static int rs485_receive_chars(char *data, int timeout);
static unsigned short updcrc(unsigned short icrc, unsigned char *icp,
unsigned int icnt);
#if defined(CONFIG_CMD_I2C)
-static int trab_eeprom_read (char **argv);
-static int trab_eeprom_write (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);
+static int trab_eeprom_read(char **argv);
+static int trab_eeprom_write(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);
#endif
/*
@@ -163,152 +163,145 @@ int i2c_read_multiple ( uchar chip, uint addr, int alen, uchar *buffer,
* test.
*/
-int trab_fkt (int argc, char *argv[])
+int trab_fkt(int argc, char *argv[])
{
int i;
app_startup(argv);
- if (get_version () != XF_VERSION) {
- printf ("Wrong XF_VERSION. Please re-compile with actual "
- "u-boot sources\n");
- printf ("Example expects ABI version %d\n", XF_VERSION);
- printf ("Actual U-Boot ABI version %d\n", (int)get_version());
+ if (get_version() != XF_VERSION) {
+ printf("Wrong XF_VERSION. Please re-compile with actual "
+ "u-boot sources\n");
+ printf("Example expects ABI version %d\n", XF_VERSION);
+ printf("Actual U-Boot ABI version %d\n", (int)get_version());
return 1;
}
- debug ("argc = %d\n", argc);
+ debug("argc = %d\n", argc);
- for (i=0; i<=argc; ++i) {
- debug ("argv[%d] = \"%s\"\n", i, argv[i] ? argv[i] : "<NULL>");
+ for (i = 0; i <= argc; ++i) {
+ debug("argv[%d] = \"%s\"\n", i, argv[i] ? argv[i] : "<NULL>");
}
- adc_init ();
+ adc_init();
switch (argc) {
-
case 0:
case 1:
break;
-
case 2:
- if (strcmp (argv[1], "info") == 0) {
- return (do_info ());
+ if (strcmp(argv[1], "info") == 0) {
+ return (do_info());
}
- if (strcmp (argv[1], "dip") == 0) {
- return (do_dip ());
+ if (strcmp(argv[1], "dip") == 0) {
+ return (do_dip());
}
- if (strcmp (argv[1], "vcc5v") == 0) {
- return (do_vcc5v ());
+ if (strcmp(argv[1], "vcc5v") == 0) {
+ return (do_vcc5v());
}
- if (strcmp (argv[1], "vcc12v") == 0) {
- return (do_vcc12v ());
+ if (strcmp(argv[1], "vcc12v") == 0) {
+ return (do_vcc12v());
}
- if (strcmp (argv[1], "buttons") == 0) {
- return (do_buttons ());
+ if (strcmp(argv[1], "buttons") == 0) {
+ return (do_buttons());
}
- if (strcmp (argv[1], "fill_level") == 0) {
- return (do_fill_level ());
+ if (strcmp(argv[1], "fill_level") == 0) {
+ return (do_fill_level());
}
- if (strcmp (argv[1], "rotary_switch") == 0) {
- return (do_rotary_switch ());
+ if (strcmp(argv[1], "rotary_switch") == 0) {
+ return (do_rotary_switch());
}
- if (strcmp (argv[1], "pressure") == 0) {
- return (do_pressure ());
+ if (strcmp(argv[1], "pressure") == 0) {
+ return (do_pressure());
}
- if (strcmp (argv[1], "v_bat") == 0) {
- return (do_v_bat ());
+ if (strcmp(argv[1], "v_bat") == 0) {
+ return (do_v_bat());
}
- if (strcmp (argv[1], "vfd_id") == 0) {
- return (do_vfd_id ());
+ if (strcmp(argv[1], "vfd_id") == 0) {
+ return (do_vfd_id());
}
- if (strcmp (argv[1], "motor_contact") == 0) {
- return (do_motor_contact ());
+ if (strcmp(argv[1], "motor_contact") == 0) {
+ return (do_motor_contact());
}
- if (strcmp (argv[1], "crc16") == 0) {
- return (do_crc16 ());
+ if (strcmp(argv[1], "crc16") == 0) {
+ return (do_crc16());
}
- if (strcmp (argv[1], "power_switch") == 0) {
- return (do_power_switch ());
+ if (strcmp(argv[1], "power_switch") == 0) {
+ return (do_power_switch());
}
break;
-
case 3:
- if (strcmp (argv[1], "full_bridge") == 0) {
- return (do_full_bridge (argv));
+ if (strcmp(argv[1], "full_bridge") == 0) {
+ return (do_full_bridge(argv));
}
- if (strcmp (argv[1], "dac") == 0) {
- return (do_dac (argv));
+ if (strcmp(argv[1], "dac") == 0) {
+ return (do_dac(argv));
}
- if (strcmp (argv[1], "motor") == 0) {
- return (do_motor (argv));
+ if (strcmp(argv[1], "motor") == 0) {
+ return (do_motor(argv));
}
- if (strcmp (argv[1], "pwm") == 0) {
- return (do_pwm (argv));
+ if (strcmp(argv[1], "pwm") == 0) {
+ return (do_pwm(argv));
}
- if (strcmp (argv[1], "thermo") == 0) {
- return (do_thermo (argv));
+ if (strcmp(argv[1], "thermo") == 0) {
+ return (do_thermo(argv));
}
- if (strcmp (argv[1], "touch") == 0) {
- return (do_touch (argv));
+ if (strcmp(argv[1], "touch") == 0) {
+ return (do_touch(argv));
}
- if (strcmp (argv[1], "serial_number") == 0) {
- return (do_serial_number (argv));
+ if (strcmp(argv[1], "serial_number") == 0) {
+ return (do_serial_number(argv));
}
- if (strcmp (argv[1], "buzzer") == 0) {
- return (do_buzzer (argv));
+ if (strcmp(argv[1], "buzzer") == 0) {
+ return (do_buzzer(argv));
}
- if (strcmp (argv[1], "gain") == 0) {
- return (do_gain (argv));
+ if (strcmp(argv[1], "gain") == 0) {
+ return (do_gain(argv));
}
break;
-
case 4:
- if (strcmp (argv[1], "led") == 0) {
- return (do_led (argv));
+ if (strcmp(argv[1], "led") == 0) {
+ return (do_led(argv));
}
- if (strcmp (argv[1], "rs485") == 0) {
- return (do_rs485 (argv));
+ if (strcmp(argv[1], "rs485") == 0) {
+ return (do_rs485(argv));
}
- if (strcmp (argv[1], "serial_number") == 0) {
- return (do_serial_number (argv));
+ if (strcmp(argv[1], "serial_number") == 0) {
+ return (do_serial_number(argv));
}
break;
-
case 5:
- if (strcmp (argv[1], "eeprom") == 0) {
- return (do_eeprom (argv));
+ if (strcmp(argv[1], "eeprom") == 0) {
+ return (do_eeprom(argv));
}
break;
-
case 6:
- if (strcmp (argv[1], "eeprom") == 0) {
- return (do_eeprom (argv));
+ if (strcmp(argv[1], "eeprom") == 0) {
+ return (do_eeprom(argv));
}
break;
-
default:
break;
}
- printf ("Usage:\n<command> <parameter1> <parameter2> ...\n");
+ printf("Usage:\n<command> <parameter1> <parameter2> ...\n");
return 1;
}
-void hang (void)
+void hang(void)
{
- puts ("### ERROR ### Please RESET the board ###\n");
+ puts("### ERROR ### Please RESET the board ###\n");
for (;;);
}
-int do_info (void)
+int do_info(void)
{
- printf ("Stand-alone application for TRAB board function test\n");
- printf ("Built: %s at %s\n", U_BOOT_DATE, U_BOOT_TIME);
+ printf("Stand-alone application for TRAB board function test\n");
+ printf("Built: %s at %s\n", U_BOOT_DATE, U_BOOT_TIME);
return 0;
}
-int do_dip (void)
+int do_dip(void)
{
unsigned int result = 0;
int adc_val;
@@ -327,8 +320,8 @@ int do_dip (void)
for (i = 7; i > 3; i--) {
- if ((adc_val = adc_read (i)) == -1) {
- printf ("Channel %d could not be read\n", i);
+ if ((adc_val = adc_read(i)) == -1) {
+ printf("Channel %d could not be read\n", i);
return 1;
}
@@ -338,11 +331,11 @@ int do_dip (void)
* Set trigger at halve that value.
*/
if (adc_val < 368)
- result |= (1 << (i-4));
+ result |= (1 << (i - 4));
}
/* print result to console */
- print_identifier ();
+ print_identifier();
for (i = 0; i < 4; i++) {
if ((result & (1 << i)) == 0)
printf("0");
@@ -354,15 +347,14 @@ int do_dip (void)
return 0;
}
-
-int do_vcc5v (void)
+int do_vcc5v(void)
{
int result;
/* VCC5V is connected to channel 2 */
- if ((result = adc_read (VCC5V)) == -1) {
- printf ("VCC5V could not be read\n");
+ if ((result = adc_read(VCC5V)) == -1) {
+ printf("VCC5V could not be read\n");
return 1;
}
@@ -371,22 +363,21 @@ int do_vcc5v (void)
* floating point support. VCC5V is connected over an resistor divider:
* VCC5V=ADCval*2,5V/1023*(10K+30K)/10K.
*/
- print_identifier ();
- printf ("%d", (result & 0x3FF)* 10 / 1023);
- printf (".%d", ((result & 0x3FF)* 10 % 1023)* 10 / 1023);
- printf ("%d V\n", (((result & 0x3FF) * 10 % 1023 ) * 10 % 1023)
- * 10 / 1024);
+ print_identifier();
+ printf("%d", (result & 0x3FF) * 10 / 1023);
+ printf(".%d", ((result & 0x3FF) * 10 % 1023) * 10 / 1023);
+ printf("%d V\n", (((result & 0x3FF) * 10 % 1023) * 10 % 1023)
+ * 10 / 1024);
return 0;
}
-
-int do_vcc12v (void)
+int do_vcc12v(void)
{
int result;
- if ((result = adc_read (VCC12V)) == -1) {
- printf ("VCC12V could not be read\n");
+ if ((result = adc_read(VCC12V)) == -1) {
+ printf("VCC12V could not be read\n");
return 1;
}
@@ -395,35 +386,35 @@ int do_vcc12v (void)
* floating point support. VCC5V is connected over an resistor divider:
* VCC12V=ADCval*2,5V/1023*(30K+270K)/30K.
*/
- print_identifier ();
- printf ("%d", (result & 0x3FF)* 25 / 1023);
- printf (".%d V\n", ((result & 0x3FF)* 25 % 1023) * 10 / 1023);
+ print_identifier();
+ printf("%d", (result & 0x3FF) * 25 / 1023);
+ printf(".%d V\n", ((result & 0x3FF) * 25 % 1023) * 10 / 1023);
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 j = 1000; /* timeout value for wait loop in us */
int result;
struct s3c2400_adc *padc;
padc = s3c2400_get_base_adc();
channel &= 0x7;
- 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;
}
@@ -431,27 +422,26 @@ static int adc_read (unsigned int channel)
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
@@ -459,22 +449,21 @@ static void adc_init (void)
* value is 0. Perhaps because the * adjustment of prescaler takes
* some clock cycles?
*/
- udelay (1000);
+ udelay(1000);
return;
}
-
-int do_buttons (void)
+int do_buttons(void)
{
int result;
int i;
result = *CPLD_BUTTONS; /* read CPLD */
- debug ("%s: cpld_taster (32 bit) %#x\n", __FUNCTION__, result);
+ debug("%s: cpld_taster (32 bit) %#x\n", __FUNCTION__, result);
/* print result to console */
- print_identifier ();
+ print_identifier();
for (i = 16; i <= 19; i++) {
if ((result & (1 << i)) == 0)
printf("0");
@@ -486,7 +475,7 @@ int do_buttons (void)
}
-int do_power_switch (void)
+int do_power_switch(void)
{
int result;
@@ -498,21 +487,20 @@ int do_power_switch (void)
/* signal GPE7 from power switch is low active: 0=on , 1=off */
result = ((gpio->PEDAT & (1 << 7)) == (1 << 7)) ? 0 : 1;
- print_identifier ();
+ print_identifier();
printf("%d\n", result);
return 0;
}
-
-int do_fill_level (void)
+int do_fill_level(void)
{
int result;
result = *CPLD_FILL_LEVEL; /* read CPLD */
- debug ("%s: cpld_fuellstand (32 bit) %#x\n", __FUNCTION__, result);
+ debug("%s: cpld_fuellstand (32 bit) %#x\n", __FUNCTION__, result);
/* print result to console */
- print_identifier ();
+ print_identifier();
if ((result & (1 << 16)) == 0)
printf("0\n");
else
@@ -520,8 +508,7 @@ int do_fill_level (void)
return 0;
}
-
-int do_rotary_switch (void)
+int do_rotary_switch(void)
{
int result;
/*
@@ -532,12 +519,13 @@ int do_rotary_switch (void)
*/
result = *CPLD_ROTARY_SWITCH; /* read CPLD */
- debug ("%s: cpld_inc (32 bit) %#x\n", __FUNCTION__, result);
+ debug("%s: cpld_inc (32 bit) %#x\n", __FUNCTION__, result);
- *CPLD_ROTARY_SWITCH |= (3 << 16); /* clear direction bits in CPLD */
+ /* clear direction bits in CPLD */
+ *CPLD_ROTARY_SWITCH |= (3 << 16);
/* print result to console */
- print_identifier ();
+ print_identifier();
if ((result & (1 << 16)) == (1 << 16))
printf("R");
if ((result & (1 << 17)) == (1 << 17))
@@ -551,8 +539,7 @@ int do_rotary_switch (void)
return 0;
}
-
-int do_vfd_id (void)
+int do_vfd_id(void)
{
int i;
long int pcup_old, pccon_old;
@@ -564,17 +551,20 @@ int do_vfd_id (void)
pcup_old = gpio->PCUP;
pccon_old = gpio->PCCON;
- gpio->PCUP = (gpio->PCUP & 0xFFF0); /* activate GPC0...GPC3 pull-ups */
- gpio->PCCON = (gpio->PCCON & 0xFFFFFF00); /* configure GPC0...GPC3 as
- * inputs */
- udelay (10); /* allow signals to settle */
- vfd_board_id = (~gpio->PCDAT) & 0x000F; /* read GPC0...GPC3 port pins */
+ /* activate GPC0...GPC3 pull-ups */
+ gpio->PCUP = (gpio->PCUP & 0xFFF0);
+ /* configure GPC0...GPC3 as inputs */
+ gpio->PCCON = (gpio->PCCON & 0xFFFFFF00);
+
+ udelay(10); /* allow signals to settle */
+ /* read GPC0...GPC3 port pins */
+ vfd_board_id = (~gpio->PCDAT) & 0x000F;
gpio->PCCON = pccon_old;
gpio->PCUP = pcup_old;
/* print vfd_board_id to console */
- print_identifier ();
+ print_identifier();
for (i = 0; i < 4; i++) {
if ((vfd_board_id & (1 << i)) == 0)
printf("0");
@@ -585,7 +575,7 @@ int do_vfd_id (void)
return 0;
}
-int do_buzzer (char **argv)
+int do_buzzer(char **argv)
{
int counter;
@@ -605,8 +595,8 @@ int do_buzzer (char **argv)
timers->ch[2].TCNTB = counter;
timers->ch[2].TCMPB = counter / 2;
- if (strcmp (argv[2], "on") == 0) {
- debug ("%s: frequency: %d\n", __FUNCTION__,
+ if (strcmp(argv[2], "on") == 0) {
+ debug("%s: frequency: %d\n", __FUNCTION__,
BUZZER_FREQ);
/* configure pin GPD7 as TOUT2 */
@@ -619,7 +609,7 @@ int do_buzzer (char **argv)
timers->TCON = (timers->TCON | START2) & ~UPDATE2;
return (0);
}
- else if (strcmp (argv[2], "off") == 0) {
+ else if (strcmp(argv[2], "off") == 0) {
/* stop */
timers->TCON &= ~(START2 | RELOAD2);
@@ -630,12 +620,11 @@ int do_buzzer (char **argv)
return (0);
}
- printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
+ printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
return 1;
}
-
-int do_led (char **argv)
+int do_led(char **argv)
{
struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
@@ -648,107 +637,97 @@ int do_led (char **argv)
gpio->PDCON |= ((0x1 << 8) | 0x1);
switch (simple_strtoul(argv[2], NULL, 10)) {
-
case 0:
case 1:
break;
-
case 2:
- if (strcmp (argv[3], "on") == 0)
+ if (strcmp(argv[3], "on") == 0)
gpio->PCDAT |= (1 << 14);
else
gpio->PCDAT &= ~(1 << 14);
return 0;
-
case 3:
- if (strcmp (argv[3], "on") == 0)
+ if (strcmp(argv[3], "on") == 0)
gpio->PCDAT |= (1 << 15);
else
gpio->PCDAT &= ~(1 << 15);
return 0;
-
case 4:
- if (strcmp (argv[3], "on") == 0)
+ if (strcmp(argv[3], "on") == 0)
gpio->PDDAT |= (1 << 0);
else
gpio->PDDAT &= ~(1 << 0);
return 0;
-
case 5:
- if (strcmp (argv[3], "on") == 0)
+ if (strcmp(argv[3], "on") == 0)
gpio->PDDAT |= (1 << 4);
else
gpio->PDDAT &= ~(1 << 4);
return 0;
-
default:
break;
-
}
- printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
+ printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
return 1;
}
-
-int do_full_bridge (char **argv)
+int do_full_bridge(char **argv)
{
struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
/* configure PD5 and PD6 as output */
- gpio->PDCON &= ~((0x3 << 5*2) | (0x3 << 6*2));
- gpio->PDCON |= ((0x1 << 5*2) | (0x1 << 6*2));
+ gpio->PDCON &= ~((0x3 << 5 * 2) | (0x3 << 6 * 2));
+ gpio->PDCON |= ((0x1 << 5 * 2) | (0x1 << 6 * 2));
- if (strcmp (argv[2], "+") == 0) {
- gpio->PDDAT |= (1 << 5);
- gpio->PDDAT |= (1 << 6);
- return 0;
+ if (strcmp(argv[2], "+") == 0) {
+ gpio->PDDAT |= (1 << 5);
+ gpio->PDDAT |= (1 << 6);
+ return 0;
}
- else if (strcmp (argv[2], "-") == 0) {
+ else if (strcmp(argv[2], "-") == 0) {
gpio->PDDAT &= ~(1 << 5);
gpio->PDDAT |= (1 << 6);
return 0;
}
- else if (strcmp (argv[2], "off") == 0) {
+ else if (strcmp(argv[2], "off") == 0) {
gpio->PDDAT &= ~(1 << 5);
gpio->PDDAT &= ~(1 << 6);
return 0;
}
- printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
+ printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
return 1;
}
/* val must be in [0, 4095] */
-static inline unsigned long tsc2000_to_uv (u16 val)
+static inline unsigned long tsc2000_to_uv(u16 val)
{
return ((250000 * val) / 4096) * 10;
}
-
-int do_dac (char **argv)
+int do_dac(char **argv)
{
int brightness;
/* initialize SPI */
- tsc2000_spi_init ();
+ tsc2000_spi_init();
- if (((brightness = simple_strtoul (argv[2], NULL, 10)) < 0) ||
- (brightness > 255)) {
- printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
+ if (((brightness = simple_strtoul(argv[2], NULL, 10)) < 0) ||
+ (brightness > 255)) {
+ printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
return 1;
}
- tsc2000_write(TSC2000_REG_DACCTL, 0x0); /* Power up DAC */
+ tsc2000_write(TSC2000_REG_DACCTL, 0x0); /* Power up DAC */
tsc2000_write(TSC2000_REG_DAC, brightness & 0xff);
return 0;
}
-
-int do_v_bat (void)
+int do_v_bat(void)
{
unsigned long ret, res;
/* initialize SPI */
- spi_init ();
+ spi_init();
tsc2000_write(TSC2000_REG_ADC, 0x1836);
@@ -759,39 +738,37 @@ int do_v_bat (void)
res = (tsc2000_to_uv(ret) + 1250) / 2500;
res += (ERROR_BATTERY * res) / 1000;
- print_identifier ();
- printf ("%ld", (res / 100));
- printf (".%ld", ((res % 100) / 10));
- printf ("%ld V\n", (res % 10));
+ print_identifier();
+ printf("%ld", (res / 100));
+ printf(".%ld", ((res % 100) / 10));
+ printf("%ld V\n", (res % 10));
return 0;
}
-
-int do_pressure (void)
+int do_pressure(void)
{
/* initialize SPI */
- spi_init ();
+ spi_init();
tsc2000_write(TSC2000_REG_ADC, 0x2436);
/* now wait for data available */
adc_wait_conversion_done();
- print_identifier ();
- printf ("%d\n", tsc2000_read(TSC2000_REG_AUX2));
+ print_identifier();
+ printf("%d\n", tsc2000_read(TSC2000_REG_AUX2));
return 0;
}
-
-int do_motor_contact (void)
+int do_motor_contact(void)
{
int result;
result = *CPLD_FILL_LEVEL; /* read CPLD */
- debug ("%s: cpld_fuellstand (32 bit) %#x\n", __FUNCTION__, result);
+ debug("%s: cpld_fuellstand (32 bit) %#x\n", __FUNCTION__, result);
/* print result to console */
- print_identifier ();
+ print_identifier();
if ((result & (1 << 17)) == 0)
printf("0\n");
else
@@ -799,7 +776,7 @@ int do_motor_contact (void)
return 0;
}
-int do_motor (char **argv)
+int do_motor(char **argv)
{
struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
@@ -807,30 +784,30 @@ int do_motor (char **argv)
gpio->PGCON &= ~(0x3 << 0);
gpio->PGCON |= (0x1 << 0);
- if (strcmp (argv[2], "on") == 0) {
+ if (strcmp(argv[2], "on") == 0) {
gpio->PGDAT &= ~(1 << 0);
return 0;
}
- if (strcmp (argv[2], "off") == 0) {
+ if (strcmp(argv[2], "off") == 0) {
gpio->PGDAT |= (1 << 0);
return 0;
}
- printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
+ printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
return 1;
}
-static void print_identifier (void)
+static void print_identifier(void)
{
- printf ("## FKT: ");
+ printf("## FKT: ");
}
-int do_pwm (char **argv)
+int do_pwm(char **argv)
{
int counter;
struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
struct s3c24x0_timers * const timers = s3c24x0_get_base_timers();
- if (strcmp (argv[2], "on") == 0) {
+ if (strcmp(argv[2], "on") == 0) {
/* configure pin GPD8 as TOUT3 */
gpio->PDCON &= ~(0x3 << 8*2);
gpio->PDCON |= (0x2 << 8*2);
@@ -853,7 +830,7 @@ int do_pwm (char **argv)
timers->TCON = (timers->TCON | START3) & ~UPDATE3;
return 0;
}
- if (strcmp (argv[2], "off") == 0) {
+ if (strcmp(argv[2], "off") == 0) {
/* stop timer */
timers->TCON &= ~(START2 | RELOAD2);
@@ -864,176 +841,172 @@ int do_pwm (char **argv)
gpio->PDDAT &= ~(1 << 8);
return 0;
}
- printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
+ printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
return 1;
}
-
-int do_thermo (char **argv)
+int do_thermo(char **argv)
{
- int channel, res;
+ int channel, res;
- tsc2000_reg_init ();
+ tsc2000_reg_init();
- if (strcmp (argv[2], "all") == 0) {
+ if (strcmp(argv[2], "all") == 0) {
int i;
for (i=0; i <= 15; i++) {
res = tsc2000_read_channel(i);
- print_identifier ();
- printf ("c%d: %d\n", i, res);
+ print_identifier();
+ printf("c%d: %d\n", i, res);
}
return 0;
}
- channel = simple_strtoul (argv[2], NULL, 10);
+ channel = simple_strtoul(argv[2], NULL, 10);
res = tsc2000_read_channel(channel);
- print_identifier ();
- printf ("%d\n", res);
- return 0; /* return OK */
+ print_identifier();
+ printf("%d\n", res);
+ return 0; /* return OK */
}
-
-int do_touch (char **argv)
+int do_touch(char **argv)
{
- int x, y;
+ int x, y;
- if (strcmp (argv[2], "tl") == 0) {
+ if (strcmp(argv[2], "tl") == 0) {
#ifdef CONFIG_TOUCH_WAIT_PRESSED
touch_wait_pressed();
#else
{
int i;
for (i = 0; i < (TOUCH_TIMEOUT * 1000); i++) {
- if (touch_check_pressed ()) {
+ if (touch_check_pressed()) {
break;
}
- udelay (1000); /* pause 1 ms */
+ udelay(1000); /* pause 1 ms */
}
}
if (!touch_check_pressed()) {
- print_identifier ();
- printf ("error: touch not pressed\n");
+ print_identifier();
+ printf("error: touch not pressed\n");
return 1;
}
#endif /* CONFIG_TOUCH_WAIT_PRESSED */
- touch_read_x_y (&x, &y);
+ touch_read_x_y(&x, &y);
- print_identifier ();
- printf ("x=%d y=%d\n", x, y);
- return touch_write_clibration_values (CALIB_TL, x, y);
+ print_identifier();
+ printf("x=%d y=%d\n", x, y);
+ return touch_write_clibration_values(CALIB_TL, x, y);
}
- else if (strcmp (argv[2], "dr") == 0) {
+ else if (strcmp(argv[2], "dr") == 0) {
#ifdef CONFIG_TOUCH_WAIT_PRESSED
touch_wait_pressed();
#else
{
int i;
for (i = 0; i < (TOUCH_TIMEOUT * 1000); i++) {
- if (touch_check_pressed ()) {
+ if (touch_check_pressed()) {
break;
}
- udelay (1000); /* pause 1 ms */
+ udelay(1000); /* pause 1 ms */
}
}
if (!touch_check_pressed()) {
- print_identifier ();
- printf ("error: touch not pressed\n");
+ print_identifier();
+ printf("error: touch not pressed\n");
return 1;
}
#endif /* CONFIG_TOUCH_WAIT_PRESSED */
- touch_read_x_y (&x, &y);
+ touch_read_x_y(&x, &y);
- print_identifier ();
- printf ("x=%d y=%d\n", x, y);
+ print_identifier();
+ printf("x=%d y=%d\n", x, y);
- return touch_write_clibration_values (CALIB_DR, x, y);
+ return touch_write_clibration_values(CALIB_DR, x, y);
}
- return 1; /* not "tl", nor "dr", so return error */
+ return 1; /* not "tl", nor "dr", so return error */
}
-
#ifdef CONFIG_TOUCH_WAIT_PRESSED
-static void touch_wait_pressed (void)
+static void touch_wait_pressed(void)
{
while (!(tsc2000_read(TSC2000_REG_ADC) & TC_PSM));
}
#else
-static int touch_check_pressed (void)
+static int touch_check_pressed(void)
{
return (tsc2000_read(TSC2000_REG_ADC) & TC_PSM);
}
#endif /* CONFIG_TOUCH_WAIT_PRESSED */
-static int touch_write_clibration_values (int calib_point, int x, int y)
+static int touch_write_clibration_values(int calib_point, int x, int y)
{
#if defined(CONFIG_CMD_I2C)
int x_verify = 0;
int y_verify = 0;
- tsc2000_reg_init ();
+ tsc2000_reg_init();
if (calib_point == CALIB_TL) {
- if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X0, 1,
- (unsigned char *)&x, 2)) {
+ if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_X0, 1,
+ (unsigned char *)&x, 2)) {
return 1;
}
- if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y0, 1,
- (unsigned char *)&y, 2)) {
+ if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_Y0, 1,
+ (unsigned char *)&y, 2)) {
return 1;
}
/* verify written values */
- if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X0, 1,
- (unsigned char *)&x_verify, 2)) {
+ if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_X0, 1,
+ (unsigned char *)&x_verify, 2)) {
return 1;
}
- if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y0, 1,
- (unsigned char *)&y_verify, 2)) {
+ if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_Y0, 1,
+ (unsigned char *)&y_verify, 2)) {
return 1;
}
if ((y != y_verify) || (x != x_verify)) {
- print_identifier ();
- printf ("error: verify error\n");
+ print_identifier();
+ printf("error: verify error\n");
return 1;
}
- return 0; /* no error */
+ return 0; /* no error */
}
else if (calib_point == CALIB_DR) {
- if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X1, 1,
- (unsigned char *)&x, 2)) {
+ if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_X1, 1,
+ (unsigned char *)&x, 2)) {
return 1;
- }
- if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y1, 1,
- (unsigned char *)&y, 2)) {
+ }
+ if (i2c_write_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_Y1, 1,
+ (unsigned char *)&y, 2)) {
return 1;
}
/* verify written values */
- if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X1, 1,
- (unsigned char *)&x_verify, 2)) {
+ if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_X1, 1,
+ (unsigned char *)&x_verify, 2)) {
return 1;
}
- if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y1, 1,
- (unsigned char *)&y_verify, 2)) {
+ if (i2c_read_multiple(I2C_EEPROM_DEV_ADDR, TOUCH_Y1, 1,
+ (unsigned char *)&y_verify, 2)) {
return 1;
}
if ((y != y_verify) || (x != x_verify)) {
- print_identifier ();
- printf ("error: verify error\n");
+ print_identifier();
+ printf("error: verify error\n");
return 1;
}
return 0;
}
return 1;
#else
- printf ("No I2C support enabled (CONFIG_CMD_I2C), could not write "
- "to EEPROM\n");
+ printf("No I2C support enabled (CONFIG_CMD_I2C), could not write "
+ "to EEPROM\n");
return (1);
#endif
}
-
-static void touch_read_x_y (int *px, int *py)
+static void touch_read_x_y(int *px, int *py)
{
tsc2000_write(TSC2000_REG_ADC, DEFAULT_ADC | TC_AD0 | TC_AD1);
adc_wait_conversion_done();
@@ -1044,64 +1017,61 @@ static void touch_read_x_y (int *px, int *py)
*py = tsc2000_read(TSC2000_REG_Y);
}
-
-int do_rs485 (char **argv)
+int do_rs485(char **argv)
{
int timeout;
char data[RS485_MAX_RECEIVE_BUF_LEN];
- if (strcmp (argv[2], "send") == 0) {
- return (rs485_send_line (argv[3]));
+ if (strcmp(argv[2], "send") == 0) {
+ return (rs485_send_line(argv[3]));
}
- else if (strcmp (argv[2], "receive") == 0) {
+ else if (strcmp(argv[2], "receive") == 0) {
timeout = simple_strtoul(argv[3], NULL, 10);
- if (rs485_receive_chars (data, timeout) != 0) {
- print_identifier ();
- printf ("## nothing received\n");
+ if (rs485_receive_chars(data, timeout) != 0) {
+ print_identifier();
+ printf("## nothing received\n");
return (1);
}
else {
- print_identifier ();
- printf ("%s\n", data);
+ print_identifier();
+ printf("%s\n", data);
return (0);
}
}
- printf ("%s: unknown command %s\n", __FUNCTION__, argv[2]);
- return (1); /* unknown command, return error */
+ printf("%s: unknown command %s\n", __FUNCTION__, argv[2]);
+ return (1); /* unknown command, return error */
}
-
-static int rs485_send_line (const char *data)
+static int rs485_send_line(const char *data)
{
- rs485_init ();
- trab_rs485_enable_tx ();
- rs485_puts (data);
- rs485_putc ('\n');
+ rs485_init();
+ trab_rs485_enable_tx();
+ rs485_puts(data);
+ rs485_putc('\n');
return (0);
}
-
-static int rs485_receive_chars (char *data, int timeout)
+static int rs485_receive_chars(char *data, int timeout)
{
int i;
int receive_count = 0;
- rs485_init ();
- trab_rs485_enable_rx ();
+ rs485_init();
+ trab_rs485_enable_rx();
/* test every 1 ms for received characters to avoid a receive FIFO
* overrun (@ 38.400 Baud) */
for (i = 0; i < (timeout * 1000); i++) {
- while (rs485_tstc ()) {
+ while (rs485_tstc()) {
if (receive_count >= RS485_MAX_RECEIVE_BUF_LEN-1)
break;
- *data++ = rs485_getc ();
+ *data++ = rs485_getc();
receive_count++;
}
- udelay (1000); /* pause 1 ms */
+ udelay(1000); /* pause 1 ms */
}
- *data = '\0'; /* terminate string */
+ *data = '\0'; /* terminate string */
if (receive_count == 0)
return (1);
@@ -1109,71 +1079,69 @@ static int rs485_receive_chars (char *data, int timeout)
return (0);
}
-
-int do_serial_number (char **argv)
+int do_serial_number(char **argv)
{
#if defined(CONFIG_CMD_I2C)
unsigned int serial_number;
- if (strcmp (argv[2], "read") == 0) {
- if (i2c_read (I2C_EEPROM_DEV_ADDR, SERIAL_NUMBER, 1,
- (unsigned char *)&serial_number, 4)) {
- printf ("could not read from eeprom\n");
+ if (strcmp(argv[2], "read") == 0) {
+ if (i2c_read(I2C_EEPROM_DEV_ADDR, SERIAL_NUMBER, 1,
+ (unsigned char *)&serial_number, 4)) {
+ printf("could not read from eeprom\n");
return (1);
}
- print_identifier ();
- printf ("%08d\n", serial_number);
+ print_identifier();
+ printf("%08d\n", serial_number);
return (0);
}
- else if (strcmp (argv[2], "write") == 0) {
+ else if (strcmp(argv[2], "write") == 0) {
serial_number = simple_strtoul(argv[3], NULL, 10);
- if (i2c_write (I2C_EEPROM_DEV_ADDR, SERIAL_NUMBER, 1,
+ if (i2c_write(I2C_EEPROM_DEV_ADDR, SERIAL_NUMBER, 1,
(unsigned char *)&serial_number, 4)) {
- printf ("could not write to eeprom\n");
+ printf("could not write to eeprom\n");
return (1);
}
return (0);
}
- printf ("%s: unknown command %s\n", __FUNCTION__, argv[2]);
- return (1); /* unknown command, return error */
+ printf("%s: unknown command %s\n", __FUNCTION__, argv[2]);
+ return (1); /* unknown command, return error */
#else
- printf ("No I2C support enabled (CONFIG_CMD_I2C), could not write "
- "to EEPROM\n");
+ printf("No I2C support enabled (CONFIG_CMD_I2C), could not write "
+ "to EEPROM\n");
return (1);
#endif
}
-int do_crc16 (void)
+int do_crc16(void)
{
#if defined(CONFIG_CMD_I2C)
int crc;
unsigned char buf[EEPROM_MAX_CRC_BUF];
- if (i2c_read (I2C_EEPROM_DEV_ADDR, 0, 1, buf, 60)) {
- printf ("could not read from eeprom\n");
+ if (i2c_read(I2C_EEPROM_DEV_ADDR, 0, 1, buf, 60)) {
+ printf("could not read from eeprom\n");
return (1);
}
- crc = 0; /* start value of crc calculation */
- crc = updcrc (crc, buf, 60);
+ crc = 0; /* start value of crc calculation */
+ crc = updcrc(crc, buf, 60);
- print_identifier ();
- printf ("crc16=%#04x\n", crc);
+ print_identifier();
+ printf("crc16=%#04x\n", crc);
- if (i2c_write (I2C_EEPROM_DEV_ADDR, CRC16, 1, (unsigned char *)&crc,
- sizeof (crc))) {
- printf ("could not read from eeprom\n");
+ if (i2c_write(I2C_EEPROM_DEV_ADDR, CRC16, 1, (unsigned char *)&crc,
+ sizeof(crc))) {
+ printf("could not read from eeprom\n");
return (1);
}
return (0);
#else
- printf ("No I2C support enabled (CONFIG_CMD_I2C), could not write "
- "to EEPROM\n");
+ printf("No I2C support enabled (CONFIG_CMD_I2C), could not write "
+ "to EEPROM\n");
return (1);
#endif
}
-
/*
* Calculate, intelligently, the CRC of a dataset incrementally given a
* buffer full at a time.
@@ -1188,52 +1156,52 @@ int do_crc16 (void)
* Compile with -DMAKETAB to print values for crctab to stdout
*/
- /* the CRC polynomial. This is used by XMODEM (almost CCITT).
- * If you change P, you must change crctab[]'s initial value to what is
- * printed by initcrctab()
- */
-#define P 0x1021
+/* the CRC polynomial. This is used by XMODEM (almost CCITT).
+ * If you change P, you must change crctab[]'s initial value to what is
+ * printed by initcrctab()
+ */
+#define P 0x1021
- /* number of bits in CRC: don't change it. */
-#define W 16
+/* number of bits in CRC: don't change it. */
+#define W 16
- /* this the number of bits per char: don't change it. */
-#define B 8
+/* this the number of bits per char: don't change it. */
+#define B 8
static unsigned short crctab[1<<B] = { /* as calculated by initcrctab() */
- 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
- 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
- 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
- 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
- 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
- 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
- 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
- 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
- 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
- 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
- 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
- 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
- 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
- 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
- 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
- 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
- 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
- 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
- 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
- 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
- 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
- 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
- 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
- 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
- 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
- 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
- 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
- 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
- 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
- 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
- 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
- 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
- };
+ 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
+ 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
+ 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
+ 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
+ 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
+ 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
+ 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
+ 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
+ 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
+ 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
+ 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
+ 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
+ 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
+ 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
+ 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
+ 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
+ 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
+ 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
+ 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
+ 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
+ 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
+ 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
+ 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
+ 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
+ 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
+ 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
+ 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
+ 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
+ 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
+ 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
+ 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
+ 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
+};
static unsigned short updcrc(unsigned short icrc, unsigned char *icp,
unsigned int icnt )
@@ -1248,45 +1216,43 @@ static unsigned short updcrc(unsigned short icrc, unsigned char *icp,
return (crc);
}
-
-int do_gain (char **argv)
+int do_gain(char **argv)
{
int range;
- range = simple_strtoul (argv[2], NULL, 10);
+ range = simple_strtoul(argv[2], NULL, 10);
if ((range < 1) || (range > 3))
{
- printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
+ printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
return 1;
}
- tsc2000_set_range (range);
+ tsc2000_set_range(range);
return (0);
}
-
-int do_eeprom (char **argv)
+int do_eeprom(char **argv)
{
#if defined(CONFIG_CMD_I2C)
- if (strcmp (argv[2], "read") == 0) {
- return (trab_eeprom_read (argv));
+ if (strcmp(argv[2], "read") == 0) {
+ return (trab_eeprom_read(argv));
}
- else if (strcmp (argv[2], "write") == 0) {
- return (trab_eeprom_write (argv));
+ else if (strcmp(argv[2], "write") == 0) {
+ return (trab_eeprom_write(argv));
}
- printf ("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
+ printf("%s: invalid parameter %s\n", __FUNCTION__, argv[2]);
return (1);
#else
- printf ("No I2C support enabled (CONFIG_CMD_I2C), could not write "
- "to EEPROM\n");
+ printf("No I2C support enabled (CONFIG_CMD_I2C), could not write "
+ "to EEPROM\n");
return (1);
#endif
}
#if defined(CONFIG_CMD_I2C)
-static int trab_eeprom_read (char **argv)
+static int trab_eeprom_read(char **argv)
{
int i;
int len;
@@ -1294,44 +1260,43 @@ static int trab_eeprom_read (char **argv)
long int value = 0;
uchar *buffer;
- buffer = (uchar *) &value;
- addr = simple_strtoul (argv[3], NULL, 10);
+ buffer = (uchar *)&value;
+ addr = simple_strtoul(argv[3], NULL, 10);
addr &= 0xfff;
- len = simple_strtoul (argv[4], NULL, 10);
+ len = simple_strtoul(argv[4], NULL, 10);
if ((len < 1) || (len > 4)) {
- printf ("%s: invalid parameter %s\n", __FUNCTION__,
- argv[4]);
+ printf("%s: invalid parameter %s\n", __FUNCTION__, argv[4]);
return (1);
}
for (i = 0; i < len; i++) {
- if (i2c_read (I2C_EEPROM_DEV_ADDR, addr+i, 1, buffer+i, 1)) {
- printf ("%s: could not read from i2c device %#x"
- ", addr %d\n", __FUNCTION__,
- I2C_EEPROM_DEV_ADDR, addr);
+ if (i2c_read(I2C_EEPROM_DEV_ADDR, addr+i, 1, buffer+i, 1)) {
+ printf("%s: could not read from i2c device %#x"
+ ", addr %d\n", __FUNCTION__,
+ I2C_EEPROM_DEV_ADDR, addr);
return (1);
}
}
- print_identifier ();
- if (strcmp (argv[5], "-") == 0) {
+ print_identifier();
+ if (strcmp(argv[5], "-") == 0) {
if (len == 1)
- printf ("%d\n", (signed char) value);
+ printf("%d\n", (signed char)value);
else if (len == 2)
- printf ("%d\n", (signed short int) value);
+ printf("%d\n", (signed short int)value);
else
- printf ("%ld\n", value);
+ printf("%ld\n", value);
}
else {
if (len == 1)
- printf ("%d\n", (unsigned char) value);
+ printf("%d\n", (unsigned char)value);
else if (len == 2)
- printf ("%d\n", (unsigned short int) value);
+ printf("%d\n", (unsigned short int)value);
else
- printf ("%ld\n", (unsigned long int) value);
+ printf("%ld\n", (unsigned long int)value);
}
return (0);
}
-static int trab_eeprom_write (char **argv)
+static int trab_eeprom_write(char **argv)
{
int i;
int len;
@@ -1339,77 +1304,74 @@ static int trab_eeprom_write (char **argv)
long int value = 0;
uchar *buffer;
- buffer = (uchar *) &value;
- addr = simple_strtoul (argv[3], NULL, 10);
+ buffer = (uchar *)&value;
+ addr = simple_strtoul(argv[3], NULL, 10);
addr &= 0xfff;
- len = simple_strtoul (argv[4], NULL, 10);
+ len = simple_strtoul(argv[4], NULL, 10);
if ((len < 1) || (len > 4)) {
- printf ("%s: invalid parameter %s\n", __FUNCTION__,
- argv[4]);
+ printf("%s: invalid parameter %s\n", __FUNCTION__, argv[4]);
return (1);
}
- value = simple_strtol (argv[5], NULL, 10);
- debug ("value=%ld\n", value);
+ value = simple_strtol(argv[5], NULL, 10);
+ debug("value=%ld\n", value);
for (i = 0; i < len; i++) {
- if (i2c_write (I2C_EEPROM_DEV_ADDR, addr+i, 1, buffer+i, 1)) {
- printf ("%s: could not write to i2c device %d"
- ", addr %d\n", __FUNCTION__,
- I2C_EEPROM_DEV_ADDR, addr);
+ if (i2c_write(I2C_EEPROM_DEV_ADDR, addr+i, 1, buffer+i, 1)) {
+ printf("%s: could not write to i2c device %d"
+ ", addr %d\n", __FUNCTION__,
+ I2C_EEPROM_DEV_ADDR, addr);
return (1);
}
#if 0
- printf ("chip=%#x, addr+i=%#x+%d=%p, alen=%d, *buffer+i="
- "%#x+%d=%p=%#x \n",I2C_EEPROM_DEV_ADDR_DEV_ADDR , addr,
- i, addr+i, 1, buffer, i, buffer+i, *(buffer+i));
+ printf("chip=%#x, addr+i=%#x+%d=%p, alen=%d, *buffer+i="
+ "%#x+%d=%p=%#x \n", I2C_EEPROM_DEV_ADDR_DEV_ADDR , addr,
+ i, addr+i, 1, buffer, i, buffer+i, *(buffer+i));
#endif
- udelay (30000); /* wait for EEPROM ready */
+ udelay(30000); /* wait for EEPROM ready */
}
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);
}
}
diff --git a/board/trab/tsc2000.c b/board/trab/tsc2000.c
index 5890624..27d90b2 100644
--- a/board/trab/tsc2000.c
+++ b/board/trab/tsc2000.c
@@ -34,14 +34,14 @@
#include "Pt1000_temp_data.h"
/* helper function */
-#define abs(value) (((value) < 0) ? ((value)*-1) : (value))
+#define abs(value) (((value) < 0) ? ((value)*-1) : (value))
/*
* Maximal allowed deviation between two immediate meassurments of an analog
- * thermo channel. 1 DIGIT = 0.0276 °C. This is used to filter sporadic
+ * thermo channel. 1 DIGIT = 0.0276 degC. This is used to filter sporadic
* "jumps" in measurment.
*/
-#define MAX_DEVIATION 18 /* unit: DIGITs of adc; 18 DIGIT = 0.5 °C */
+#define MAX_DEVIATION 18 /* unit: DIGITs of adc; 18 DIGIT = 0.5 degC */
void tsc2000_spi_init(void)
{
@@ -57,10 +57,12 @@ void tsc2000_spi_init(void)
CLR_CS_TOUCH();
- spi->ch[0].SPPRE = 0x1F; /* Baud-rate 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 */
+ /* Baud-rate 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++) {
@@ -69,15 +71,14 @@ void tsc2000_spi_init(void)
spi_wait_transmit_done();
}
-
void spi_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));
}
-
void tsc2000_write(unsigned short reg, unsigned short data)
{
struct s3c24x0_spi * const spi = s3c24x0_get_base_spi();
@@ -97,8 +98,7 @@ void tsc2000_write(unsigned short reg, unsigned short data)
CLR_CS_TOUCH();
}
-
-unsigned short tsc2000_read (unsigned short reg)
+unsigned short tsc2000_read(unsigned short reg)
{
unsigned short command, data;
struct s3c24x0_spi * const spi = s3c24x0_get_base_spi();
@@ -121,106 +121,128 @@ unsigned short tsc2000_read (unsigned short reg)
return (spi->ch[0].SPRDAT & 0x0FF) | (data << 8);
}
-
-void tsc2000_set_mux (unsigned int channel)
+void tsc2000_set_mux(unsigned int channel)
{
struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
- CLR_MUX1_ENABLE; CLR_MUX2_ENABLE;
- CLR_MUX3_ENABLE; CLR_MUX4_ENABLE;
+ CLR_MUX1_ENABLE;
+ CLR_MUX2_ENABLE;
+ CLR_MUX3_ENABLE;
+ CLR_MUX4_ENABLE;
switch (channel) {
case 0:
- CLR_MUX0; CLR_MUX1;
+ CLR_MUX0;
+ CLR_MUX1;
SET_MUX1_ENABLE;
break;
case 1:
- SET_MUX0; CLR_MUX1;
+ SET_MUX0;
+ CLR_MUX1;
SET_MUX1_ENABLE;
break;
case 2:
- CLR_MUX0; SET_MUX1;
+ CLR_MUX0;
+ SET_MUX1;
SET_MUX1_ENABLE;
break;
case 3:
- SET_MUX0; SET_MUX1;
+ SET_MUX0;
+ SET_MUX1;
SET_MUX1_ENABLE;
break;
case 4:
- CLR_MUX0; CLR_MUX1;
+ CLR_MUX0;
+ CLR_MUX1;
SET_MUX2_ENABLE;
break;
case 5:
- SET_MUX0; CLR_MUX1;
+ SET_MUX0;
+ CLR_MUX1;
SET_MUX2_ENABLE;
break;
case 6:
- CLR_MUX0; SET_MUX1;
+ CLR_MUX0;
+ SET_MUX1;
SET_MUX2_ENABLE;
break;
case 7:
- SET_MUX0; SET_MUX1;
+ SET_MUX0;
+ SET_MUX1;
SET_MUX2_ENABLE;
break;
case 8:
- CLR_MUX0; CLR_MUX1;
+ CLR_MUX0;
+ CLR_MUX1;
SET_MUX3_ENABLE;
break;
case 9:
- SET_MUX0; CLR_MUX1;
+ SET_MUX0;
+ CLR_MUX1;
SET_MUX3_ENABLE;
break;
case 10:
- CLR_MUX0; SET_MUX1;
+ CLR_MUX0;
+ SET_MUX1;
SET_MUX3_ENABLE;
break;
case 11:
- SET_MUX0; SET_MUX1;
+ SET_MUX0;
+ SET_MUX1;
SET_MUX3_ENABLE;
break;
case 12:
- CLR_MUX0; CLR_MUX1;
+ CLR_MUX0;
+ CLR_MUX1;
SET_MUX4_ENABLE;
break;
case 13:
- SET_MUX0; CLR_MUX1;
+ SET_MUX0;
+ CLR_MUX1;
SET_MUX4_ENABLE;
break;
case 14:
- CLR_MUX0; SET_MUX1;
+ CLR_MUX0;
+ SET_MUX1;
SET_MUX4_ENABLE;
break;
case 15:
- SET_MUX0; SET_MUX1;
+ SET_MUX0;
+ SET_MUX1;
SET_MUX4_ENABLE;
break;
default:
- CLR_MUX0; CLR_MUX1;
+ CLR_MUX0;
+ CLR_MUX1;
}
}
-
-void tsc2000_set_range (unsigned int range)
+void tsc2000_set_range(unsigned int range)
{
struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
switch (range) {
case 1:
- CLR_SEL_TEMP_V_0; SET_SEL_TEMP_V_1;
- CLR_SEL_TEMP_V_2; CLR_SEL_TEMP_V_3;
+ CLR_SEL_TEMP_V_0;
+ SET_SEL_TEMP_V_1;
+ CLR_SEL_TEMP_V_2;
+ CLR_SEL_TEMP_V_3;
break;
case 2:
- CLR_SEL_TEMP_V_0; CLR_SEL_TEMP_V_1;
- CLR_SEL_TEMP_V_2; SET_SEL_TEMP_V_3;
+ CLR_SEL_TEMP_V_0;
+ CLR_SEL_TEMP_V_1;
+ CLR_SEL_TEMP_V_2;
+ SET_SEL_TEMP_V_3;
break;
case 3:
- SET_SEL_TEMP_V_0; CLR_SEL_TEMP_V_1;
- SET_SEL_TEMP_V_2; CLR_SEL_TEMP_V_3;
+ SET_SEL_TEMP_V_0;
+ CLR_SEL_TEMP_V_1;
+ SET_SEL_TEMP_V_2;
+ CLR_SEL_TEMP_V_3;
break;
}
}
-
-u16 tsc2000_read_channel (unsigned int channel)
+u16 tsc2000_read_channel(unsigned int channel)
{
u16 res;
@@ -228,21 +250,20 @@ u16 tsc2000_read_channel (unsigned int channel)
udelay(20 * TSC2000_DELAY_BASE);
tsc2000_write(TSC2000_REG_ADC, 0x2036);
- adc_wait_conversion_done ();
+ adc_wait_conversion_done();
res = tsc2000_read(TSC2000_REG_AUX1);
return res;
}
-
-s32 tsc2000_contact_temp (void)
+s32 tsc2000_contact_temp(void)
{
long adc_pt1000, offset;
long u_pt1000;
long contact_temp;
long temp1, temp2;
- tsc2000_reg_init ();
- tsc2000_set_range (3);
+ tsc2000_reg_init();
+ tsc2000_set_range(3);
/*
* Because of sporadic "jumps" in the measured adc values every
@@ -251,37 +272,37 @@ s32 tsc2000_contact_temp (void)
* measurement, because it is very unlikely that a successive third
* measurement goes also wrong.
*/
- temp1 = tsc2000_read_channel (14);
- temp2 = tsc2000_read_channel (14);
+ temp1 = tsc2000_read_channel(14);
+ temp2 = tsc2000_read_channel(14);
if (abs(temp2 - temp1) < MAX_DEVIATION)
adc_pt1000 = temp2;
else {
- printf ("%s: read adc value (channel 14) exceeded max allowed "
- "deviation: %d * 0.0276 °C\n",
- __FUNCTION__, MAX_DEVIATION);
- printf ("adc value 1: %ld DIGITs\nadc value 2: %ld DIGITs\n",
- temp1, temp2);
- adc_pt1000 = tsc2000_read_channel (14);
- printf ("use (third read) adc value: adc_pt1000 = "
- "%ld DIGITs\n", adc_pt1000);
+ printf("%s: read adc value (channel 14) exceeded max allowed "
+ "deviation: %d * 0.0276 degC\n",
+ __FUNCTION__, MAX_DEVIATION);
+ printf("adc value 1: %ld DIGITs\nadc value 2: %ld DIGITs\n",
+ temp1, temp2);
+ adc_pt1000 = tsc2000_read_channel(14);
+ printf("use (third read) adc value: adc_pt1000 = "
+ "%ld DIGITs\n", adc_pt1000);
}
- debug ("read channel 14 (pt1000 adc value): %ld\n", adc_pt1000);
+ debug("read channel 14 (pt1000 adc value): %ld\n", adc_pt1000);
- temp1 = tsc2000_read_channel (15);
- temp2 = tsc2000_read_channel (15);
+ temp1 = tsc2000_read_channel(15);
+ temp2 = tsc2000_read_channel(15);
if (abs(temp2 - temp1) < MAX_DEVIATION)
offset = temp2;
else {
- printf ("%s: read adc value (channel 15) exceeded max allowed "
- "deviation: %d * 0.0276 °C\n",
- __FUNCTION__, MAX_DEVIATION);
- printf ("adc value 1: %ld DIGITs\nadc value 2: %ld DIGITs\n",
- temp1, temp2);
- offset = tsc2000_read_channel (15);
- printf ("use (third read) adc value: offset = %ld DIGITs\n",
- offset);
+ printf("%s: read adc value (channel 15) exceeded max allowed "
+ "deviation: %d * 0.0276 degC\n",
+ __FUNCTION__, MAX_DEVIATION);
+ printf("adc value 1: %ld DIGITs\nadc value 2: %ld DIGITs\n",
+ temp1, temp2);
+ offset = tsc2000_read_channel(15);
+ printf("use (third read) adc value: offset = %ld DIGITs\n",
+ offset);
}
- debug ("read channel 15 (offset): %ld\n", offset);
+ debug("read channel 15 (offset): %ld\n", offset);
/*
* Formula for calculating voltage drop on PT1000 resistor: u_pt1000 =
@@ -291,21 +312,19 @@ s32 tsc2000_contact_temp (void)
* u-boot, because this could cause only a very small error (< 1%).
*/
u_pt1000 = (101750 * (adc_pt1000 - offset)) / 10;
- debug ("u_pt1000: %ld\n", u_pt1000);
+ debug("u_pt1000: %ld\n", u_pt1000);
if (tsc2000_interpolate(u_pt1000, Pt1000_temp_table,
&contact_temp) == -1) {
- printf ("%s: error interpolating PT1000 vlaue\n",
- __FUNCTION__);
+ printf("%s: error interpolating PT1000 vlaue\n", __FUNCTION__);
return (-1000);
}
- debug ("contact_temp: %ld\n", contact_temp);
+ debug("contact_temp: %ld\n", contact_temp);
return contact_temp;
}
-
-void tsc2000_reg_init (void)
+void tsc2000_reg_init(void)
{
struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
@@ -330,7 +349,6 @@ void tsc2000_reg_init (void)
tsc2000_set_range(0);
}
-
int tsc2000_interpolate(long value, long data[][2], long *result)
{
int i;
@@ -348,17 +366,16 @@ int tsc2000_interpolate(long value, long data[][2], long *result)
/* To prevent overflow we have to store the intermediate
result in 'long long'.
- */
+ */
- val = ((unsigned long long)(data[i][1] - data[i-1][1])
- * (unsigned long long)(value - data[i-1][0]));
- do_div(val, (data[i][0] - data[i-1][0]));
- *result = data[i-1][1] + val;
+ val = ((unsigned long long)(data[i][1] - data[i - 1][1]) *
+ (unsigned long long)(value - data[i - 1][0]));
+ do_div(val, (data[i][0] - data[i - 1][0]));
+ *result = data[i - 1][1] + val;
return 0;
}
-
void adc_wait_conversion_done(void)
{
while (!(tsc2000_read(TSC2000_REG_ADC) & (1 << 14)));
diff --git a/board/trab/tsc2000.h b/board/trab/tsc2000.h
index 0b6253f..c7ec0bd 100644
--- a/board/trab/tsc2000.h
+++ b/board/trab/tsc2000.h
@@ -114,18 +114,17 @@
#define ERROR_BATTERY 220 /* must be adjusted, if R68 is changed on TRAB */
void tsc2000_write(unsigned short, unsigned short);
-unsigned short tsc2000_read (unsigned short);
-u16 tsc2000_read_channel (unsigned int);
-void tsc2000_set_mux (unsigned int);
-void tsc2000_set_range (unsigned int);
-void tsc2000_reg_init (void);
-s32 tsc2000_contact_temp (void);
-void spi_wait_transmit_done (void);
+unsigned short tsc2000_read(unsigned short);
+u16 tsc2000_read_channel(unsigned int);
+void tsc2000_set_mux(unsigned int);
+void tsc2000_set_range(unsigned int);
+void tsc2000_reg_init(void);
+s32 tsc2000_contact_temp(void);
+void spi_wait_transmit_done(void);
void tsc2000_spi_init(void);
int tsc2000_interpolate(long value, long data[][2], long *result);
void adc_wait_conversion_done(void);
-
static inline void SET_CS_TOUCH(void)
{
struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
@@ -133,7 +132,6 @@ static inline void SET_CS_TOUCH(void)
gpio->PDDAT &= 0x5FF;
}
-
static inline void CLR_CS_TOUCH(void)
{
struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
diff --git a/board/trab/vfd.c b/board/trab/vfd.c
index b7eb8cc..550d1e8 100644
--- a/board/trab/vfd.c
+++ b/board/trab/vfd.c
@@ -50,7 +50,7 @@ DECLARE_GLOBAL_DATA_PTR;
/************************************************************************/
#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
+#define PAGE_SIZE 4096
#endif
#define ROT 0x09
@@ -58,8 +58,8 @@ DECLARE_GLOBAL_DATA_PTR;
#define VIOLETT 0X0D
/* MAGIC */
-#define FRAME_BUF_SIZE ((256*4*56)/8)
-#define frame_buf_offs 4
+#define FRAME_BUF_SIZE ((256*4*56)/8)
+#define frame_buf_offs 4
/* defines for starting Timer3 as CPLD-Clk */
#define START3 (1 << 16)
@@ -72,8 +72,8 @@ DECLARE_GLOBAL_DATA_PTR;
#define VFD_ENABLE (*(volatile uchar *)0x04038000=0x0001)
/* Supported VFD Types */
-#define VFD_TYPE_T119C 1 /* Noritake T119C VFD */
-#define VFD_TYPE_MN11236 2
+#define VFD_TYPE_T119C 1 /* Noritake T119C VFD */
+#define VFD_TYPE_MN11236 2
/*#define NEW_CPLD_CLK*/
@@ -95,75 +95,87 @@ void init_grid_ctrl(void)
/*
* clear frame buffer (logical clear => set to "black")
*/
- memset ((void *)(gd->fb_base), 0, FRAME_BUF_SIZE);
+ memset((void *)(gd->fb_base), 0, FRAME_BUF_SIZE);
switch (gd->vfd_type) {
case VFD_TYPE_T119C:
- for (display=0; display<4; display++) {
- for(grid_cycle=0; grid_cycle<56; grid_cycle++) {
- bit = grid_cycle * 256 * 4 +
- (grid_cycle + 200) * 4 +
- frame_buf_offs + display;
- /* wrap arround if offset (see manual S3C2400) */
- if (bit>=FRAME_BUF_SIZE*8)
- bit = bit - (FRAME_BUF_SIZE * 8);
- adr = gd->fb_base + (bit/32) * 4 + (3 - (bit%32) / 8);
- bit_nr = bit % 8;
- bit_nr = (bit_nr > 3) ? bit_nr-4 : bit_nr+4;
- temp=(*(volatile unsigned char*)(adr));
- temp |= (1<<bit_nr);
- (*(volatile unsigned char*)(adr))=temp;
-
- if(grid_cycle<55)
- bit = grid_cycle*256*4+(grid_cycle+201)*4+frame_buf_offs+display;
- else
- bit = grid_cycle*256*4+200*4+frame_buf_offs+display-4; /* grid nr. 0 */
- /* wrap arround if offset (see manual S3C2400) */
- if (bit>=FRAME_BUF_SIZE*8)
- bit = bit-(FRAME_BUF_SIZE*8);
- adr = gd->fb_base+(bit/32)*4+(3-(bit%32)/8);
- bit_nr = bit%8;
- bit_nr = (bit_nr>3)?bit_nr-4:bit_nr+4;
- temp=(*(volatile unsigned char*)(adr));
- temp |= (1<<bit_nr);
- (*(volatile unsigned char*)(adr))=temp;
+ for (display = 0; display < 4; display++) {
+ for (grid_cycle = 0; grid_cycle < 56; grid_cycle++) {
+ bit = grid_cycle * 256 * 4 +
+ (grid_cycle + 200) * 4 +
+ frame_buf_offs + display;
+ /* wrap around if offset (see manual S3C2400) */
+ if (bit >= FRAME_BUF_SIZE * 8)
+ bit = bit - (FRAME_BUF_SIZE * 8);
+ adr = gd->fb_base + (bit / 32) * 4 +
+ (3 - (bit % 32) / 8);
+ bit_nr = bit % 8;
+ bit_nr = (bit_nr > 3) ? bit_nr - 4 : bit_nr + 4;
+ temp = (*(volatile unsigned char *)(adr));
+ temp |= (1 << bit_nr);
+ (*(volatile unsigned char *)(adr)) = temp;
+
+ if (grid_cycle < 55)
+ bit = grid_cycle * 256 * 4 +
+ (grid_cycle + 201) * 4 +
+ frame_buf_offs + display;
+ else
+ /* grid nr. 0 */
+ bit = grid_cycle * 256 * 4 + 200 * 4 +
+ frame_buf_offs + display - 4;
+ /* wrap around if offset (see manual S3C2400) */
+ if (bit >= FRAME_BUF_SIZE * 8)
+ bit = bit - (FRAME_BUF_SIZE * 8);
+ adr =
+ gd->fb_base + (bit / 32) * 4 +
+ (3 - (bit % 32) / 8);
+ bit_nr = bit % 8;
+ bit_nr = (bit_nr > 3) ? bit_nr - 4 : bit_nr + 4;
+ temp = (*(volatile unsigned char *)(adr));
+ temp |= (1 << bit_nr);
+ (*(volatile unsigned char *)(adr)) = temp;
+ }
}
- }
- break;
+ break;
case VFD_TYPE_MN11236:
- for (display=0; display<4; display++) {
- for (grid_cycle=0; grid_cycle<38; grid_cycle++) {
- bit = grid_cycle * 256 * 4 +
- (253 - grid_cycle) * 4 +
- frame_buf_offs + display;
- /* wrap arround if offset (see manual S3C2400) */
- if (bit>=FRAME_BUF_SIZE*8)
- bit = bit - (FRAME_BUF_SIZE * 8);
- adr = gd->fb_base + (bit/32) * 4 + (3 - (bit%32) / 8);
- bit_nr = bit % 8;
- bit_nr = (bit_nr > 3) ? bit_nr-4 : bit_nr+4;
- temp=(*(volatile unsigned char*)(adr));
- temp |= (1<<bit_nr);
- (*(volatile unsigned char*)(adr))=temp;
-
- if(grid_cycle<37)
- bit = grid_cycle*256*4+(252-grid_cycle)*4+frame_buf_offs+display;
-
- /* wrap arround if offset (see manual S3C2400) */
- if (bit>=FRAME_BUF_SIZE*8)
- bit = bit-(FRAME_BUF_SIZE*8);
- adr = gd->fb_base+(bit/32)*4+(3-(bit%32)/8);
- bit_nr = bit%8;
- bit_nr = (bit_nr>3)?bit_nr-4:bit_nr+4;
- temp=(*(volatile unsigned char*)(adr));
- temp |= (1<<bit_nr);
- (*(volatile unsigned char*)(adr))=temp;
+ for (display = 0; display < 4; display++) {
+ for (grid_cycle = 0; grid_cycle < 38; grid_cycle++) {
+ bit = grid_cycle * 256 * 4 +
+ (253 - grid_cycle) * 4 +
+ frame_buf_offs + display;
+ /* wrap around if offset (see manual S3C2400) */
+ if (bit >= FRAME_BUF_SIZE * 8)
+ bit = bit - (FRAME_BUF_SIZE * 8);
+ adr = gd->fb_base + (bit / 32) * 4 +
+ (3 - (bit % 32) / 8);
+ bit_nr = bit % 8;
+ bit_nr = (bit_nr > 3) ? bit_nr - 4 : bit_nr + 4;
+ temp = (*(volatile unsigned char *)(adr));
+ temp |= (1 << bit_nr);
+ (*(volatile unsigned char *)(adr)) = temp;
+
+ if (grid_cycle < 37)
+ bit = grid_cycle * 256 * 4 +
+ (252 - grid_cycle) *
+ 4 + frame_buf_offs + display;
+
+ /* wrap around if offset (see manual S3C2400) */
+ if (bit >= FRAME_BUF_SIZE * 8)
+ bit = bit - (FRAME_BUF_SIZE * 8);
+ adr =
+ gd->fb_base + (bit / 32) * 4 +
+ (3 - (bit % 32) / 8);
+ bit_nr = bit % 8;
+ bit_nr = (bit_nr > 3) ? bit_nr - 4 : bit_nr + 4;
+ temp = (*(volatile unsigned char *)(adr));
+ temp |= (1 << bit_nr);
+ (*(volatile unsigned char *)(adr)) = temp;
+ }
}
- }
- break;
+ break;
default:
- printf ("Warning: unknown display type\n");
- break;
+ printf("Warning: unknown display type\n");
+ break;
}
}
@@ -179,63 +191,91 @@ void create_vfd_table(void)
switch (gd->vfd_type) {
case VFD_TYPE_T119C:
- for(y=0; y<=17; y++) { /* Line */
- for(x=0; x<=111; x++) { /* Column */
- for(display=0; display <=3; display++) {
-
- /* Display 0 blue pixels */
- vfd_table[x][y][0][display][0] =
- (x==0) ? y*16+display
- : (x%4)*4+y*16+((x-1)/2)*1024+display;
- /* Display 0 red pixels */
- vfd_table[x][y][1][display][0] =
- (x==0) ? y*16+512+display
- : (x%4)*4+y*16+((x-1)/2)*1024+512+display;
- }
+ for (y = 0; y <= 17; y++) { /* Line */
+ for (x = 0; x <= 111; x++) { /* Column */
+ for (display = 0; display <= 3; display++) {
+ /* Display 0 blue pixels */
+ vfd_table[x][y][0][display][0] =
+ (x == 0) ?
+ y * 16 + display :
+ (x % 4) * 4 + y * 16 +
+ ((x - 1) / 2) * 1024 + display;
+ /* Display 0 red pixels */
+ vfd_table[x][y][1][display][0] =
+ (x == 0) ?
+ y * 16 + 512 + display :
+ (x % 4) * 4 + y * 16 +
+ ((x - 1) / 2) * 1024 + 512 +
+ display;
+ }
+ }
}
- }
- break;
+ break;
case VFD_TYPE_MN11236:
- for(y=0; y<=17; y++) { /* Line */
- for(x=0; x<=111; x++) { /* Column */
- for(display=0; display <=3; display++) {
-
- vfd_table[x][y][0][display][0]=0;
- vfd_table[x][y][0][display][1]=0;
- vfd_table[x][y][1][display][0]=0;
- vfd_table[x][y][1][display][1]=0;
-
- switch (x%6) {
- case 0: x_abcdef=0; break; /* a -> a */
- case 1: x_abcdef=2; break; /* b -> c */
- case 2: x_abcdef=4; break; /* c -> e */
- case 3: x_abcdef=5; break; /* d -> f */
- case 4: x_abcdef=3; break; /* e -> d */
- case 5: x_abcdef=1; break; /* f -> b */
- }
-
- /* blue pixels */
- vfd_table[x][y][0][display][0] =
- (x>1) ? x_abcdef*4+((x-1)/3)*1024+y*48+display
- : x_abcdef*4+ 0+y*48+display;
- /* blue pixels */
- if (x>1 && (x-1)%3)
- vfd_table[x][y][0][display][1] = x_abcdef*4+((x-1)/3+1)*1024+y*48+display;
-
- /* red pixels */
- vfd_table[x][y][1][display][0] =
- (x>1) ? x_abcdef*4+24+((x-1)/3)*1024+y*48+display
- : x_abcdef*4+24+ 0+y*48+display;
- /* red pixels */
- if (x>1 && (x-1)%3)
- vfd_table[x][y][1][display][1] = x_abcdef*4+24+((x-1)/3+1)*1024+y*48+display;
- }
+ for (y = 0; y <= 17; y++) { /* Line */
+ for (x = 0; x <= 111; x++) { /* Column */
+ for (display = 0; display <= 3; display++) {
+ vfd_table[x][y][0][display][0] = 0;
+ vfd_table[x][y][0][display][1] = 0;
+ vfd_table[x][y][1][display][0] = 0;
+ vfd_table[x][y][1][display][1] = 0;
+
+ switch (x % 6) {
+ case 0:
+ x_abcdef = 0;
+ break; /* a -> a */
+ case 1:
+ x_abcdef = 2;
+ break; /* b -> c */
+ case 2:
+ x_abcdef = 4;
+ break; /* c -> e */
+ case 3:
+ x_abcdef = 5;
+ break; /* d -> f */
+ case 4:
+ x_abcdef = 3;
+ break; /* e -> d */
+ case 5:
+ x_abcdef = 1;
+ break; /* f -> b */
+ }
+
+ /* blue pixels */
+ vfd_table[x][y][0][display][0] =
+ (x > 1) ?
+ x_abcdef * 4 + ((x - 1) / 3) *
+ 1024 + y * 48 + display :
+ x_abcdef * 4 + 0 + y * 48 +
+ display;
+ /* blue pixels */
+ if (x > 1 && (x - 1) % 3)
+ vfd_table[x][y][0][display][1] =
+ x_abcdef * 4 +
+ ((x - 1) / 3 + 1) * 1024 +
+ y * 48 + display;
+
+ /* red pixels */
+ vfd_table[x][y][1][display][0] =
+ (x > 1) ?
+ x_abcdef * 4 + 24 +
+ ((x - 1) / 3) * 1024 + y * 48 +
+ display :
+ x_abcdef * 4 + 24 + 0 + y *
+ 48 + display;
+ /* red pixels */
+ if (x > 1 && (x - 1) % 3)
+ vfd_table[x][y][1][display][1] =
+ x_abcdef * 4 + 24 +
+ ((x - 1) / 3 + 1) * 1024 +
+ y * 48 + display;
+ }
+ }
}
- }
- break;
+ break;
default:
- /* do nothing */
- return;
+ /* do nothing */
+ return;
}
/*
@@ -243,31 +283,40 @@ void create_vfd_table(void)
* bit-number within the byte
* from table with bit-numbers within the total framebuffer
*/
- for(y=0;y<18;y++) {
- for(x=0;x<112;x++) {
- for(color=0;color<2;color++) {
- for(display=0;display<4;display++) {
- for(entry=0;entry<2;entry++) {
- unsigned long adr = gd->fb_base;
- unsigned int bit_nr = 0;
-
- pixel = vfd_table[x][y][color][display][entry] + frame_buf_offs;
- /*
- * wrap arround if offset
- * (see manual S3C2400)
- */
- if (pixel>=FRAME_BUF_SIZE*8)
- pixel = pixel-(FRAME_BUF_SIZE*8);
- adr = gd->fb_base+(pixel/32)*4+(3-(pixel%32)/8);
- bit_nr = pixel%8;
- bit_nr = (bit_nr>3)?bit_nr-4:bit_nr+4;
-
- adr_vfd_table[x][y][color][display][entry] = adr;
- bit_vfd_table[x][y][color][display][entry] = bit_nr;
+ for (y = 0; y < 18; y++) {
+ for (x = 0; x < 112; x++) {
+ for (color = 0; color < 2; color++) {
+ for (display = 0; display < 4; display++) {
+ for (entry = 0; entry < 2; entry++) {
+ unsigned long adr = gd->fb_base;
+ unsigned int bit_nr = 0;
+
+ pixel = vfd_table[x][y][color]
+ [display][entry] +
+ frame_buf_offs;
+ /*
+ * wrap arround if offset
+ * (see manual S3C2400)
+ */
+ if (pixel >= FRAME_BUF_SIZE * 8)
+ pixel = pixel -
+ (FRAME_BUF_SIZE * 8);
+ adr = gd->fb_base +
+ (pixel / 32) * 4 +
+ (3 - (pixel % 32) / 8);
+ bit_nr = pixel % 8;
+ bit_nr = (bit_nr > 3) ?
+ bit_nr - 4 :
+ bit_nr + 4;
+
+ adr_vfd_table[x][y][color]
+ [display][entry] = adr;
+ bit_vfd_table[x][y][color]
+ [display][entry] = bit_nr;
+ }
+ }
}
- }
}
- }
}
}
@@ -281,7 +330,7 @@ void set_vfd_pixel(unsigned char x, unsigned char y,
ulong adr;
unsigned char bit_nr, temp;
- if (! gd->vfd_type) {
+ if (!gd->vfd_type) {
/* Unknown type. */
return;
}
@@ -290,14 +339,14 @@ void set_vfd_pixel(unsigned char x, unsigned char y,
adr = adr_vfd_table[x][y][color][display][0];
/* Pixel-Eintrag Nr. 1 */
bit_nr = bit_vfd_table[x][y][color][display][0];
- temp=(*(volatile unsigned char*)(adr));
+ temp = (*(volatile unsigned char *)(adr));
if (value)
- temp |= (1<<bit_nr);
+ temp |= (1 << bit_nr);
else
- temp &= ~(1<<bit_nr);
+ temp &= ~(1 << bit_nr);
- (*(volatile unsigned char*)(adr))=temp;
+ (*(volatile unsigned char *)(adr)) = temp;
}
/*
@@ -308,38 +357,37 @@ void transfer_pic(int display, unsigned char *adr, int height, int width)
int x, y;
unsigned char temp;
- for (; height > 0; height -= 18)
- {
+ for (; height > 0; height -= 18) {
if (height > 18)
y = 18;
else
y = height;
- for (; y > 0; y--)
- {
- for (x = 0; x < width; x += 2)
- {
+ for (; y > 0; y--) {
+ for (x = 0; x < width; x += 2) {
temp = *adr++;
- set_vfd_pixel(x, y-1, 0, display, 0);
- set_vfd_pixel(x, y-1, 1, display, 0);
+ set_vfd_pixel(x, y - 1, 0, display, 0);
+ set_vfd_pixel(x, y - 1, 1, display, 0);
if ((temp >> 4) == BLAU)
- set_vfd_pixel(x, y-1, 0, display, 1);
+ set_vfd_pixel(x, y - 1, 0, display, 1);
else if ((temp >> 4) == ROT)
- set_vfd_pixel(x, y-1, 1, display, 1);
- else if ((temp >> 4) == VIOLETT)
- {
- set_vfd_pixel(x, y-1, 0, display, 1);
- set_vfd_pixel(x, y-1, 1, display, 1);
+ set_vfd_pixel(x, y - 1, 1, display, 1);
+ else if ((temp >> 4) == VIOLETT) {
+ set_vfd_pixel(x, y - 1, 0, display, 1);
+ set_vfd_pixel(x, y - 1, 1, display, 1);
}
- set_vfd_pixel(x+1, y-1, 0, display, 0);
- set_vfd_pixel(x+1, y-1, 1, display, 0);
+ set_vfd_pixel(x + 1, y - 1, 0, display, 0);
+ set_vfd_pixel(x + 1, y - 1, 1, display, 0);
if ((temp & 0x0F) == BLAU)
- set_vfd_pixel(x+1, y-1, 0, display, 1);
+ set_vfd_pixel(x + 1, y - 1, 0,
+ display, 1);
else if ((temp & 0x0F) == ROT)
- set_vfd_pixel(x+1, y-1, 1, display, 1);
- else if ((temp & 0x0F) == VIOLETT)
- {
- set_vfd_pixel(x+1, y-1, 0, display, 1);
- set_vfd_pixel(x+1, y-1, 1, display, 1);
+ set_vfd_pixel(x + 1, y - 1, 1,
+ display, 1);
+ else if ((temp & 0x0F) == VIOLETT) {
+ set_vfd_pixel(x + 1, y - 1, 0,
+ display, 1);
+ set_vfd_pixel(x + 1, y - 1, 1,
+ display, 1);
}
}
}
@@ -354,7 +402,7 @@ void transfer_pic(int display, unsigned char *adr, int height, int width)
* This function initializes VFD clock that is needed for the CPLD that
* manages the keyboard.
*/
-int vfd_init_clocks (void)
+int vfd_init_clocks(void)
{
int i;
@@ -365,21 +413,26 @@ int vfd_init_clocks (void)
/* try to determine display type from the value
* defined by pull-ups
*/
- gpio->PCUP = (gpio->PCUP & 0xFFF0); /* activate GPC0...GPC3 pullups */
- gpio->PCCON = (gpio->PCCON & 0xFFFFFF00); /* configure GPC0...GPC3 as inputs */
+ /* activate GPC0...GPC3 pullups */
+ gpio->PCUP = (gpio->PCUP & 0xFFF0);
+ /* configure GPC0...GPC3 as inputs */
+ gpio->PCCON = (gpio->PCCON & 0xFFFFFF00);
/* allow signals to settle */
- for (i=0; i<10000; i++) /* udelay isn't working yet at this point! */
+ /* udelay isn't working yet at this point! */
+ for (i = 0; i < 10000; i++)
__asm__("NOP");
- vfd_board_id = (~gpio->PCDAT) & 0x000F; /* read GPC0...GPC3 port pins */
+ /* read GPC0...GPC3 port pins */
+ vfd_board_id = (~gpio->PCDAT) & 0x000F;
- VFD_DISABLE; /* activate blank for the vfd */
+ VFD_DISABLE; /* activate blank for the vfd */
-#define NEW_CPLD_CLK
+#define NEW_CPLD_CLK
#ifdef NEW_CPLD_CLK
if (vfd_board_id) {
/* If new board revision, then use PWM 3 as cpld-clock */
- /* Enable 500 Hz timer for fill level sensor to operate properly */
+ /* Enable 500 Hz timer for fill level sensor to operate
+ * properly */
/* Configure TOUT3 as functional pin, disable pull-up */
gpio->PDCON &= ~0x30000;
gpio->PDCON |= 0x20000;
@@ -443,8 +496,8 @@ int drv_vfd_init(void)
debug("Detecting Revison of WA4-VFD: ID=0x%X\n", vfd_board_id);
switch (vfd_board_id) {
- case 0: /* board revision < Rev.200 */
- if ((tmp = getenv ("vfd_type")) == NULL) {
+ case 0: /* board revision < Rev.200 */
+ if ((tmp = getenv("vfd_type")) == NULL) {
break;
}
if (strcmp(tmp, "T119C") == 0) {
@@ -460,22 +513,21 @@ int drv_vfd_init(void)
default: /* default to MN11236, data inverted */
gd->vfd_type = VFD_TYPE_MN11236;
vfd_inv_data = 1;
- setenv ("vfd_type", "MN11236");
+ setenv("vfd_type", "MN11236");
}
- debug ("VFD type: %s%s\n",
- (gd->vfd_type == VFD_TYPE_T119C) ? "T119C" :
- (gd->vfd_type == VFD_TYPE_MN11236) ? "MN11236" :
- "unknown",
- vfd_inv_data ? ", inverted data" : "");
+ debug("VFD type: %s%s\n",
+ (gd->vfd_type == VFD_TYPE_T119C) ? "T119C" :
+ (gd->vfd_type == VFD_TYPE_MN11236) ? "MN11236" :
+ "unknown", vfd_inv_data ? ", inverted data" : "");
gd->fb_base = gd->fb_base;
create_vfd_table();
init_grid_ctrl();
- for (palette=0; palette < 16; palette++)
- (*(volatile unsigned int*)(PALETTE+(palette*4)))=palette;
- for (palette=16; palette < 256; palette++)
- (*(volatile unsigned int*)(PALETTE+(palette*4)))=0x00;
+ for (palette = 0; palette < 16; palette++)
+ (*(volatile unsigned int *)(PALETTE + (palette * 4))) = palette;
+ for (palette = 16; palette < 256; palette++)
+ (*(volatile unsigned int *)(PALETTE + (palette * 4))) = 0x00;
/*
* Hinweis: Der Framebuffer ist um genau ein Nibble verschoben
@@ -490,9 +542,9 @@ int drv_vfd_init(void)
lcd->LCDSADDR1 = gd->fb_base >> 1;
/* frame buffer endadr */
lcd->LCDSADDR2 = (gd->fb_base + FRAME_BUF_SIZE) >> 1;
- lcd->LCDSADDR3 = ((256/4));
+ lcd->LCDSADDR3 = ((256 / 4));
lcd->LCDCON2 = 0x000DC000;
- if(gd->vfd_type == VFD_TYPE_MN11236)
+ if (gd->vfd_type == VFD_TYPE_MN11236)
lcd->LCDCON2 = 37 << 14; /* MN11236: 38 lines */
else
lcd->LCDCON2 = 55 << 14; /* T119C: 56 lines */
@@ -504,21 +556,24 @@ int drv_vfd_init(void)
lcd->LCDCON5 = 0x00000440;
/* Port pins as LCD output */
- gpio->PCCON = (gpio->PCCON & 0xFFFFFF00)| 0x000000AA;
- gpio->PDCON = (gpio->PDCON & 0xFFFFFF03)| 0x000000A8;
-
- /* Synchronize VFD enable with LCD controller to avoid flicker */
- lcd->LCDCON1 = 0x00000B75; /* Start LCD-Controller */
- while((lcd->LCDCON5 & 0x180000)!=0x100000); /* Wait for end of VSYNC */
- while((lcd->LCDCON5 & 0x060000)!=0x040000); /* Wait for next HSYNC */
- while((lcd->LCDCON5 & 0x060000)==0x040000);
- while((lcd->LCDCON5 & 0x060000)!=0x000000);
- if(gd->vfd_type)
+ gpio->PCCON = (gpio->PCCON & 0xFFFFFF00) | 0x000000AA;
+ gpio->PDCON = (gpio->PDCON & 0xFFFFFF03) | 0x000000A8;
+
+ /* Synchronize VFD enable with LCD controller to avoid flicker */
+ /* Start LCD-Controller */
+ lcd->LCDCON1 = 0x00000B75;
+ /* Wait for end of VSYNC */
+ while ((lcd->LCDCON5 & 0x180000) != 0x100000);
+ /* Wait for next HSYNC */
+ while ((lcd->LCDCON5 & 0x060000) != 0x040000);
+ while ((lcd->LCDCON5 & 0x060000) == 0x040000);
+ while ((lcd->LCDCON5 & 0x060000) != 0x000000);
+ if (gd->vfd_type)
VFD_ENABLE;
- debug ("LCDSADDR1: %lX\n", lcd->LCDSADDR1);
- debug ("LCDSADDR2: %lX\n", lcd->LCDSADDR2);
- debug ("LCDSADDR3: %lX\n", lcd->LCDSADDR3);
+ debug("LCDSADDR1: %lX\n", lcd->LCDSADDR1);
+ debug("LCDSADDR2: %lX\n", lcd->LCDSADDR2);
+ debug("LCDSADDR3: %lX\n", lcd->LCDSADDR3);
return 0;
}
@@ -527,13 +582,13 @@ int drv_vfd_init(void)
* Disable VFD: should be run before resetting the system:
* disable VM, enable pull-up
*/
-void disable_vfd (void)
+void disable_vfd(void)
{
struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
VFD_DISABLE;
gpio->PDCON &= ~0xC;
- gpio->PDUP &= ~0x2;
+ gpio->PDUP &= ~0x2;
}
/************************************************************************/
@@ -546,14 +601,15 @@ void disable_vfd (void)
*
* Note that this is running from ROM, so no write access to global data.
*/
-ulong vfd_setmem (ulong addr)
+ulong vfd_setmem(ulong addr)
{
ulong size;
/* Round up to nearest full page */
size = (FRAME_BUF_SIZE + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
- debug ("Reserving %ldk for VFD Framebuffer at: %08lx\n", size>>10, addr);
+ debug("Reserving %ldk for VFD Framebuffer at: %08lx\n",
+ size >> 10, addr);
return (size);
}
@@ -562,7 +618,7 @@ ulong vfd_setmem (ulong addr)
* Calculate fb size for VIDEOLFB_ATAG. Size returned contains fb,
* descriptors and palette areas.
*/
-ulong calc_fbsize (void)
+ulong calc_fbsize(void)
{
return FRAME_BUF_SIZE;
}
--
1.6.6
More information about the U-Boot
mailing list