[U-Boot] [PATCH ARM 2/3] s3c24x0 code style changes

Minkyu Kang promsoft at gmail.com
Tue Dec 15 09:09:23 CET 2009


Dear kevin.morfitt,

2009/12/14 kevin.morfitt at fearnside-systems.co.uk
<kevin.morfitt at fearnside-systems.co.uk>:
> Cleans up the s3c24x0 header files by changing the upper case members
> of the s3c24x0 register structures to lower case and changing all code
> that uses these register structures.
>
> Signed-off-by: Kevin Morfitt <kevin.morfitt at fearnside-systems.co.uk>
> ---
>  board/mpl/vcma9/vcma9.c           |  264 ++++++++++---------
>  board/mpl/vcma9/vcma9.h           |   91 +++---
>  board/samsung/smdk2400/smdk2400.c |   53 ++--
>  board/samsung/smdk2410/smdk2410.c |   85 +++---
>  board/sbc2410x/sbc2410x.c         |  131 +++++-----
>  board/trab/cmd_trab.c             |  547 +++++++++++++++++-------------------
>  board/trab/rs485.c                |   92 ++++---
>  7 files changed, 626 insertions(+), 637 deletions(-)
>
> diff --git a/board/mpl/vcma9/vcma9.c b/board/mpl/vcma9/vcma9.c
> index 1835677..84338eb 100644
> --- a/board/mpl/vcma9/vcma9.c
> +++ b/board/mpl/vcma9/vcma9.c
> @@ -39,32 +39,31 @@ 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
> +       #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
> +       #define M_MDIV  0xA1
> +       #define M_PDIV  0x3
> +       #define M_SDIV  0x1
>  #endif
>
>  #define USB_CLOCK 1
>
>  #if USB_CLOCK==0
> -#define U_M_MDIV       0xA1
> -#define U_M_PDIV       0x3
> -#define U_M_SDIV       0x1
> +       #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
> +       #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));
> +       __asm__ volatile("1:\n"
> +                        "subs %0, %1, #1\n" "bne 1b":"=r" (loops):"0"(loops));
>  }
>
>  /*
> @@ -73,47 +72,48 @@ static inline void delay(unsigned long loops)
>
>  int board_init(void)
>  {
> -       struct s3c24x0_clock_power * const clk_power =
> -                                       s3c24x0_get_base_clock_power();
> -       struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
> +       struct s3c24x0_clock_power *const clk_power =
> +           s3c24x0_get_base_clock_power();
> +       struct s3c24x0_gpio *const gpio = s3c24x0_get_base_gpio();
>
>        /* to reduce PLL lock time, adjust the LOCKTIME register */
> -       clk_power->LOCKTIME = 0xFFFFFF;
> +       writel(0xFFFFFF, &clk_power->locktime);
>
>        /* configure MPLL */
> -       clk_power->MPLLCON = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV);
> +       writel((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV, &clk_power->mpllcon);
>
>        /* 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);
> +       writel((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV, &clk_power->upllcon);
>
>        /* some delay between MPLL and UPLL */
> -       delay (8000);
> +       delay(8000);
>
>        /* set up the I/O ports */
> -       gpio->GPACON = 0x007FFFFF;
> -       gpio->GPBCON = 0x002AAAAA;
> -       gpio->GPBUP = 0x000002BF;
> -       gpio->GPCCON = 0xAAAAAAAA;
> -       gpio->GPCUP = 0x0000FFFF;
> -       gpio->GPDCON = 0xAAAAAAAA;
> -       gpio->GPDUP = 0x0000FFFF;
> -       gpio->GPECON = 0xAAAAAAAA;
> -       gpio->GPEUP = 0x000037F7;
> -       gpio->GPFCON = 0x00000000;
> -       gpio->GPFUP = 0x00000000;
> -       gpio->GPGCON = 0xFFEAFF5A;
> -       gpio->GPGUP = 0x0000F0DC;
> -       gpio->GPHCON = 0x0028AAAA;
> -       gpio->GPHUP = 0x00000656;
> +       writel(0x007FFFFF, &gpio->gpacon);
> +       writel(0x002AAAAA, &gpio->gpbcon);
> +       writel(0x000002BF,  &gpio->gpbup);
> +       writel(0xAAAAAAAA, &gpio->gpccon);
> +       writel(0x0000FFFF,  &gpio->gpcup);
> +       writel(0xAAAAAAAA, &gpio->gpdcon);
> +       writel(0x0000FFFF,  &gpio->gpdup);
> +       writel(0xAAAAAAAA, &gpio->gpecon);
> +       writel(0x000037F7,  &gpio->gpeup);
> +       writel(0x00000000, &gpio->gpfcon);
> +       writel(0x00000000, &gpio->gpfup);
> +       writel(0xFFEAFF5A, &gpio->gpgcon);
> +       writel(0x0000F0DC,  &gpio->gpgup);
> +       writel(0x0028AAAA, &gpio->gphcon);
> +       writel(0x00000656,  &gpio->gphup);
>
>        /* setup correct IRQ modes for NIC */
> -       gpio->EXTINT2 = (gpio->EXTINT2 & ~(7<<8)) | (4<<8); /* rising edge mode */
> +       /* rising edge mode */
> +       writel((readl(&gpio->extint2) & ~(7 << 8)) | (4 << 8), &gpio->extint2);
>
>        /* select USB port 2 to be host or device (fix to host for now) */
> -       gpio->MISCCR |= 0x08;
> +       writel(readl(&gpio->misccr) | 0x08, &gpio->misccr);
>
>        /* init serial */
>        gd->baudrate = CONFIG_BAUDRATE;
> @@ -136,52 +136,49 @@ int board_init(void)
>  * NAND flash initialization.
>  */
>  #if defined(CONFIG_CMD_NAND)
> -extern ulong
> -nand_probe(ulong physadr);
> -
> +extern ulong 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)
> +static inline void nf_init(void)
>  {
> -#if 0 /* a little bit too optimistic */
> -#define TACLS   0
> -#define TWRPH0  3
> -#define TWRPH1  0
> +#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
> +       #define TACLS   0
> +       #define TWRPH0  4
> +       #define TWRPH1  2
>  #endif

please remove dead codes.

>
> -    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));
> +       /*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_Reset();
> +       nf_reset();
>  }
>
> -void
> -nand_init(void)
> +void nand_init(void)
>  {
> -       struct s3c2410_nand * const nand = s3c2410_get_base_nand();
> +       struct s3c2410_nand *const nand = s3c2410_get_base_nand();
>
> -       NF_Init();
> +       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
>
> @@ -189,96 +186,112 @@ nand_init(void)
>  * Get some Board/PLD Info
>  */
>
> -static u8 Get_PLD_ID(void)
> +static u8 get_pld_id(void)
>  {
> -       VCMA9_PLD * const pld = VCMA9_get_base_PLD();
> +       vcma9_pld *const pld = vcma9_get_base_pld();
>
> -       return(pld->ID);
> +       return readl(&pld->id);
>  }
>
> -static u8 Get_PLD_BOARD(void)
> +static u8 get_pld_board(void)
>  {
> -       VCMA9_PLD * const pld = VCMA9_get_base_PLD();
> +       vcma9_pld *const pld = vcma9_get_base_pld();
>
> -       return(pld->BOARD);
> +       return readl(&pld->board);
>  }
>
> -static u8 Get_PLD_SDRAM(void)
> +static u8 get_pld_sdram(void)
>  {
> -       VCMA9_PLD * const pld = VCMA9_get_base_PLD();
> +       vcma9_pld *const pld = vcma9_get_base_pld();
>
> -       return(pld->SDRAM);
> +       return readl(&pld->sdram);
>  }
>
> -static u8 Get_PLD_Version(void)
> +static u8 get_pld_version(void)
>  {
> -       return((Get_PLD_ID() >> 4) & 0x0F);
> +       return ((get_pld_id() >> 4) & 0x0F);
>  }
>
> -static u8 Get_PLD_Revision(void)
> +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)
> +#if 0                          /* not used */
> +static int get_board_config(void)
>  {
> -       u8 config = Get_PLD_BOARD() & 0x03;
> +       u8 config = get_pld_board() & 0x03;
>
>        if (config == 3)
> -           return 1;
> +               return 1;
>        else
> -           return 0;
> +               return 0;
>  }
>  #endif

ditto.

>
> -static uchar Get_Board_PCB(void)
> +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)
> +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;
> +       switch ((get_pld_sdram() >> 4) & 0x0F) {
> +       case 0:
> +               return 4;
> +       case 1:
> +               return 1;
> +       case 2:
> +               return 2;
> +       default:
> +               return 0;
>        }
>  }
>
> -static ulong Get_SDRAM_ChipSize(void)
> +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;
> +       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;
>        }
>  }
> -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";
> +       switch (get_pld_sdram() & 0x0F) {
> +       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)
> +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)
>  {
>        gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
> -       gd->bd->bi_dram[0].size = Get_SDRAM_ChipSize() * Get_SDRAM_ChipNr();
> +       gd->bd->bi_dram[0].size = get_sdram_chipsize() * get_sdram_chipnr();
>
>        return 0;
>  }
> @@ -296,23 +309,22 @@ 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]);
> +                       show_vcma9_info(b->serial_name, &b->serial_name[6]);
>                }
>        } else {
>                s[5] = 0;
> -               Show_VCMA9_Info(s, &s[6]);
> +               show_vcma9_info(s, &s[6]);
>        }
> -       /*printf("\n");*/
> -       return(0);
> +       /*printf("\n"); */
> +       return (0);
>  }
>
> -
>  int last_stage_init(void)
>  {
>        checkboard();
> @@ -341,16 +353,16 @@ 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]);
> +               show_vcma9_info(s, &s[6]);
>        }
>  }
>
>  #ifdef CONFIG_CMD_NET
> -int board_eth_init(bd_t *bis)
> +int board_eth_init(bd_t * bis)
>  {
>        int rc = 0;
>  #ifdef CONFIG_CS8900
> diff --git a/board/mpl/vcma9/vcma9.h b/board/mpl/vcma9/vcma9.h
> index 94fd2fa..1f5c9b5 100644
> --- a/board/mpl/vcma9/vcma9.h
> +++ b/board/mpl/vcma9/vcma9.h
> @@ -26,8 +26,9 @@
>  *****************************************************************************/
>
>  #include <asm/arch/s3c24x0_cpu.h>
> +#include <asm/io.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);
>
> @@ -37,98 +38,98 @@ typedef enum {
>        NFCE_HIGH
>  } NFCE_STATE;
>
> -static inline void NF_Conf(u16 conf)
> +static inline void nf_conf(u16 conf)
>  {
> -       struct s3c2410_nand * const nand = s3c2410_get_base_nand();
> +       struct s3c2410_nand *const nand = s3c2410_get_base_nand();
>
> -       nand->NFCONF = conf;
> +       writel(conf, &nand->nfconf);
>  }
>
> -static inline void NF_Cmd(u8 cmd)
> +static inline void nf_cmd(u8 cmd)
>  {
> -       struct s3c2410_nand * const nand = s3c2410_get_base_nand();
> +       struct s3c2410_nand *const nand = s3c2410_get_base_nand();
>
> -       nand->NFCMD = cmd;
> +       writel(cmd, &nand->nfcmd);
>  }
>
> -static inline void NF_CmdW(u8 cmd)
> +static inline void nf_cmdw(u8 cmd)
>  {
> -       NF_Cmd(cmd);
> +       nf_cmd(cmd);
>        udelay(1);
>  }
>
> -static inline void NF_Addr(u8 addr)
> +static inline void nf_addr(u8 addr)
>  {
> -       struct s3c2410_nand * const nand = s3c2410_get_base_nand();
> +       struct s3c2410_nand *const nand = s3c2410_get_base_nand();
>
> -       nand->NFADDR = addr;
> +       writel(addr, &nand->nfaddr);
>  }
>
> -static inline void NF_SetCE(NFCE_STATE s)
> +static inline void nf_setce(NFCE_STATE s)
>  {
> -       struct s3c2410_nand * const nand = s3c2410_get_base_nand();
> +       struct s3c2410_nand *const nand = s3c2410_get_base_nand();
>
>        switch (s) {
> -               case NFCE_LOW:
> -                       nand->NFCONF &= ~(1<<11);
> -                       break;
> +       case NFCE_LOW:
> +               writel(readl(&nand->nfconf) & ~(1 << 11), &nand->nfconf);
> +               break;
>
> -               case NFCE_HIGH:
> -                       nand->NFCONF |= (1<<11);
> -                       break;
> +       case NFCE_HIGH:
> +               writel(readl(&nand->nfconf) | (1 << 11), &nand->nfconf);
> +               break;
>        }
>  }
>
> -static inline void NF_WaitRB(void)
> +static inline void nf_waitrb(void)
>  {
> -       struct s3c2410_nand * const nand = s3c2410_get_base_nand();
> +       struct s3c2410_nand *const nand = s3c2410_get_base_nand();
>
> -       while (!(nand->NFSTAT & (1<<0)));
> +       while (!(readl(&nand->nfstat) & (1 << 0)));
>  }
>
> -static inline void NF_Write(u8 data)
> +static inline void nf_write(u8 data)
>  {
> -       struct s3c2410_nand * const nand = s3c2410_get_base_nand();
> +       struct s3c2410_nand *const nand = s3c2410_get_base_nand();
>
> -       nand->NFDATA = data;
> +       writel(data, &nand->nfdata);
>  }
>
> -static inline u8 NF_Read(void)
> +static inline u8 nf_read(void)
>  {
> -       struct s3c2410_nand * const nand = s3c2410_get_base_nand();
> +       struct s3c2410_nand *const nand = s3c2410_get_base_nand();
>
> -       return(nand->NFDATA);
> +       return readl(&nand->nfdata);
>  }
>
> -static inline void NF_Init_ECC(void)
> +static inline void nf_init_ecc(void)
>  {
> -       struct s3c2410_nand * const nand = s3c2410_get_base_nand();
> +       struct s3c2410_nand *const nand = s3c2410_get_base_nand();
>
> -       nand->NFCONF |= (1<<12);
> +       writel(readl(&nand->nfconf) | (1 << 12), &nand->nfconf);
>  }
>
> -static inline u32 NF_Read_ECC(void)
> +static inline u32 nf_read_ecc(void)
>  {
> -       struct s3c2410_nand * const nand = s3c2410_get_base_nand();
> +       struct s3c2410_nand *const nand = s3c2410_get_base_nand();
>
> -       return(nand->NFECC);
> +       return readl(&nand->nfecc);
>  }
>
>  #endif
>
>  /* VCMA9 PLD regsiters */
>  typedef struct {
> -       u8      ID;
> -       u8      NIC;
> -       u8      CAN;
> -       u8      MISC;
> -       u8      GPCD;
> -       u8      BOARD;
> -       u8      SDRAM;
> -} /*__attribute__((__packed__))*/ VCMA9_PLD;
> +       u8 id;
> +       u8 nic;
> +       u8 can;
> +       u8 misc;
> +       u8 gpcd;
> +       u8 board;
> +       u8 sdram;
> +} /*__attribute__((__packed__))*/ vcma9_pld;
>
>  #define VCMA9_PLD_BASE 0x2C000100
> -static inline VCMA9_PLD *VCMA9_get_base_PLD(void)
> +static inline vcma9_pld *vcma9_get_base_pld(void)
>  {
> -       return (VCMA9_PLD * const)VCMA9_PLD_BASE;
> +       return (vcma9_pld * const)VCMA9_PLD_BASE;
>  }
> diff --git a/board/samsung/smdk2400/smdk2400.c b/board/samsung/smdk2400/smdk2400.c
> index 1294d3f..51cfb7f 100644
> --- a/board/samsung/smdk2400/smdk2400.c
> +++ b/board/samsung/smdk2400/smdk2400.c
> @@ -28,54 +28,55 @@
>  #include <common.h>
>  #include <netdev.h>
>  #include <asm/arch/s3c24x0_cpu.h>
> +#include <asm/io.h>
>
>  DECLARE_GLOBAL_DATA_PTR;
>
>  #ifdef CONFIG_MODEM_SUPPORT
>  static int key_pressed(void);
> -int mdm_init (bd_t *);
> +int mdm_init(bd_t *);
>  extern void disable_putc(void);
>  extern void enable_putc(void);
>  extern int hwflow_onoff(int);
> -extern int do_mdm_init; /* defined in common/main.c */
> +extern int do_mdm_init;                /* defined in common/main.c */
>  #endif /* CONFIG_MODEM_SUPPORT */
>
>  /*
>  * Miscellaneous platform dependent initialisations
>  */
>
> -int board_init (void)
> +int board_init(void)
>  {
> -       struct s3c24x0_clock_power * const clk_power =
> -                                       s3c24x0_get_base_clock_power();
> -       struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
> +       struct s3c24x0_clock_power *const clk_power =
> +           s3c24x0_get_base_clock_power();
> +       struct s3c24x0_gpio *const gpio = s3c24x0_get_base_gpio();
>
>        /* memory and cpu-speed are setup before relocation */
>        /* change the clock to be 50 MHz 1:1:1 */
> -       clk_power->MPLLCON = 0x5c042;
> -       clk_power->CLKDIVN = 0;
> +       writel(0x5c042, &clk_power->mpllcon);
> +       writel(0, &clk_power->clkdivn);
>        /* set up the I/O ports */
> -       gpio->PACON = 0x3ffff;
> -       gpio->PBCON = 0xaaaaaaaa;
> -       gpio->PBUP = 0xffff;
> -       gpio->PECON = 0x0;
> -       gpio->PEUP = 0x0;
> +       writel(0x3ffff, &gpio->pacon);
> +       writel(0xaaaaaaaa, &gpio->pbcon);
> +       writel(0xffff, &gpio->pbup);
> +       writel(0x0, &gpio->pecon);
> +       writel(0x0, &gpio->peup);
>  #ifdef CONFIG_HWFLOW
>        /*CTS[0] RTS[0] INPUT INPUT TXD[0] INPUT RXD[0] */
>        /*   10,   10,   00,   00,    10,   00,    10 */
> -       gpio->PFCON=0xa22;
> +       writel(0xa22, &gpio->pfcon);
>        /* Disable pull-up on Rx, Tx, CTS and RTS pins */
> -       gpio->PFUP=0x35;
> +       writel(0x35, &gpio->pfup);
>  #else
>        /*INPUT INPUT INPUT INPUT TXD[0] INPUT RXD[0] */
>        /*   00,   00,   00,   00,    10,   00,    10 */
> -       gpio->PFCON = 0x22;
> +       writel(0x22, &gpio->pfcon);
>        /* Disable pull-up on Rx and Tx pins */
> -       gpio->PFUP = 0x5;
> -#endif /* CONFIG_HWFLOW */
> -       gpio->PGCON = 0x0;
> -       gpio->PGUP = 0x0;
> -       gpio->OPENCR = 0x0;
> +       writel(0x5, &gpio->pfup);
> +#endif /* CONFIG_HWFLOW */
> +       writel(0x0, &gpio->pgcon);
> +       writel(0x0, &gpio->pgup);
> +       writel(0x0, &gpio->opencr);
>
>        /* arch number of SAMSUNG-Board to MACH_TYPE_SMDK2400 */
>        gd->bd->bi_arch_number = MACH_TYPE_SMDK2400;
> @@ -88,12 +89,12 @@ int board_init (void)
>                disable_putc(); /* modem doesn't understand banner etc */
>                do_mdm_init = 1;
>        }
> -#endif /* CONFIG_MODEM_SUPPORT */
> +#endif /* CONFIG_MODEM_SUPPORT */
>
>        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;
> @@ -105,16 +106,16 @@ int dram_init (void)
>  static int key_pressed(void)
>  {
>        int rc;
> -       if (1) {        /* check for button push here, now just return 1 */
> +       if (1) {                /* check for button push here, now just return 1 */
>                rc = 1;
>        }
>
>        return rc;
>  }
> -#endif /* CONFIG_MODEM_SUPPORT */
> +#endif /* CONFIG_MODEM_SUPPORT */
>
>  #ifdef CONFIG_CMD_NET
> -int board_eth_init(bd_t *bis)
> +int board_eth_init(bd_t * bis)
>  {
>        int rc = 0;
>  #ifdef CONFIG_CS8900
> diff --git a/board/samsung/smdk2410/smdk2410.c b/board/samsung/smdk2410/smdk2410.c
> index 5d1a8bb..b8fdfcb 100644
> --- a/board/samsung/smdk2410/smdk2410.c
> +++ b/board/samsung/smdk2410/smdk2410.c
> @@ -28,81 +28,82 @@
>  #include <common.h>
>  #include <netdev.h>
>  #include <asm/arch/s3c24x0_cpu.h>
> +#include <asm/io.h>
>
>  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
> +       #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
> +       #define M_MDIV  0xA1
> +       #define M_PDIV  0x3
> +       #define M_SDIV  0x1
>  #endif
>
>  #define USB_CLOCK 1
>
>  #if USB_CLOCK==0
> -#define U_M_MDIV       0xA1
> -#define U_M_PDIV       0x3
> -#define U_M_SDIV       0x1
> +       #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
> +       #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));
> +       __asm__ volatile("1:\n"
> +                         "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();
> -       struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
> +       struct s3c24x0_clock_power *const clk_power =
> +           s3c24x0_get_base_clock_power();
> +       struct s3c24x0_gpio *const gpio = s3c24x0_get_base_gpio();
>
>        /* to reduce PLL lock time, adjust the LOCKTIME register */
> -       clk_power->LOCKTIME = 0xFFFFFF;
> +       writel(0xFFFFFF, &clk_power->locktime);
>
>        /* configure MPLL */
> -       clk_power->MPLLCON = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV);
> +       writel((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV, &clk_power->mpllcon);
>
>        /* 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);
> +       writel((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV,
> +              &clk_power->upllcon);
>
>        /* some delay between MPLL and UPLL */
> -       delay (8000);
> +       delay(8000);
>
>        /* set up the I/O ports */
> -       gpio->GPACON = 0x007FFFFF;
> -       gpio->GPBCON = 0x00044555;
> -       gpio->GPBUP = 0x000007FF;
> -       gpio->GPCCON = 0xAAAAAAAA;
> -       gpio->GPCUP = 0x0000FFFF;
> -       gpio->GPDCON = 0xAAAAAAAA;
> -       gpio->GPDUP = 0x0000FFFF;
> -       gpio->GPECON = 0xAAAAAAAA;
> -       gpio->GPEUP = 0x0000FFFF;
> -       gpio->GPFCON = 0x000055AA;
> -       gpio->GPFUP = 0x000000FF;
> -       gpio->GPGCON = 0xFF95FFBA;
> -       gpio->GPGUP = 0x0000FFFF;
> -       gpio->GPHCON = 0x002AFAAA;
> -       gpio->GPHUP = 0x000007FF;
> +       writel(0x007FFFFF, &gpio->gpacon);
> +       writel(0x00044555, &gpio->gpbcon);
> +       writel(0x000007FF,  &gpio->gpbup);
> +       writel(0xAAAAAAAA, &gpio->gpccon);
> +       writel(0x0000FFFF,  &gpio->gpcup);
> +       writel(0xAAAAAAAA, &gpio->gpdcon);
> +       writel(0x0000FFFF,  &gpio->gpdup);
> +       writel(0xAAAAAAAA, &gpio->gpecon);
> +       writel(0x0000FFFF,  &gpio->gpeup);
> +       writel(0x000055AA, &gpio->gpfcon);
> +       writel(0x000000FF,  &gpio->gpfup);
> +       writel(0xFF95FFBA, &gpio->gpgcon);
> +       writel(0x0000FFFF,  &gpio->gpgup);
> +       writel(0x002AFAAA, &gpio->gphcon);
> +       writel(0x000007FF,  &gpio->gphup);
>
>        /* arch number of SMDK2410-Board */
>        gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;
> @@ -116,7 +117,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;
> @@ -125,7 +126,7 @@ int dram_init (void)
>  }
>
>  #ifdef CONFIG_CMD_NET
> -int board_eth_init(bd_t *bis)
> +int board_eth_init(bd_t * bis)
>  {
>        int rc = 0;
>  #ifdef CONFIG_CS8900
> diff --git a/board/sbc2410x/sbc2410x.c b/board/sbc2410x/sbc2410x.c
> index 3a93677..23bb386 100644
> --- a/board/sbc2410x/sbc2410x.c
> +++ b/board/sbc2410x/sbc2410x.c
> @@ -31,6 +31,7 @@
>  #include <common.h>
>  #include <netdev.h>
>  #include <asm/arch/s3c24x0_cpu.h>
> +#include <asm/io.h>
>
>  #if defined(CONFIG_CMD_NAND)
>  #include <linux/mtd/nand.h>
> @@ -41,79 +42,78 @@ 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
> +       #define M_MDIV  0xC3
> +       #define M_PDIV  0x4
> +       #define M_SDIV  0x1
>  #elif FCLK_SPEED==1            /* Fout = 202.8MHz */
> -#define M_MDIV 0x5c
> -#define M_PDIV 0x4
> -#define M_SDIV 0x0
> +       #define M_MDIV  0x5c
> +       #define M_PDIV  0x4
> +       #define M_SDIV  0x0
>  #endif
>
>  #define USB_CLOCK 1
>
>  #if USB_CLOCK==0
> -#define U_M_MDIV       0xA1
> -#define U_M_PDIV       0x3
> -#define U_M_SDIV       0x1
> +       #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
> +       #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));
> +       __asm__ volatile("1:\n"
> +                        "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();
> -       struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
> +       struct s3c24x0_clock_power *const clk_power =
> +           s3c24x0_get_base_clock_power();
> +       struct s3c24x0_gpio *const gpio = s3c24x0_get_base_gpio();
>
>        /* to reduce PLL lock time, adjust the LOCKTIME register */
> -       clk_power->LOCKTIME = 0xFFFFFF;
> +       writel(0xFFFFFF, &clk_power->locktime);
>
>        /* configure MPLL */
> -       clk_power->MPLLCON = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV);
> +       writel((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV, &clk_power->mpllcon);
>
>        /* 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);
> +       writel((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV, &clk_power->upllcon);
>
>        /* some delay between MPLL and UPLL */
> -       delay (8000);
> +       delay(8000);
>
>        /* set up the I/O ports */
> -       gpio->GPACON = 0x007FFFFF;
> -       gpio->GPBCON = 0x00044556;
> -       gpio->GPBUP = 0x000007FF;
> -       gpio->GPCCON = 0xAAAAAAAA;
> -       gpio->GPCUP = 0x0000FFFF;
> -       gpio->GPDCON = 0xAAAAAAAA;
> -       gpio->GPDUP = 0x0000FFFF;
> -       gpio->GPECON = 0xAAAAAAAA;
> -       gpio->GPEUP = 0x0000FFFF;
> -       gpio->GPFCON = 0x000055AA;
> -       gpio->GPFUP = 0x000000FF;
> -       gpio->GPGCON = 0xFF95FF3A;
> -       gpio->GPGUP = 0x0000FFFF;
> -       gpio->GPHCON = 0x0016FAAA;
> -       gpio->GPHUP = 0x000007FF;
> -
> -       gpio->EXTINT0=0x22222222;
> -       gpio->EXTINT1=0x22222222;
> -       gpio->EXTINT2=0x22222222;
> +       writel(0x007FFFFF, &gpio->gpacon);
> +       writel(0x00044556, &gpio->gpbcon);
> +       writel(0x000007FF,  &gpio->gpbup);
> +       writel(0xAAAAAAAA, &gpio->gpccon);
> +       writel(0x0000FFFF,  &gpio->gpcup);
> +       writel(0xAAAAAAAA, &gpio->gpdcon);
> +       writel(0x0000FFFF,  &gpio->gpdup);
> +       writel(0xAAAAAAAA, &gpio->gpecon);
> +       writel(0x0000FFFF,  &gpio->gpeup);
> +       writel(0x000055AA, &gpio->gpfcon);
> +       writel(0x000000FF,  &gpio->gpfup);
> +       writel(0xFF95FF3A, &gpio->gpgcon);
> +       writel(0x0000FFFF,  &gpio->gpgup);
> +       writel(0x0016FAAA, &gpio->gphcon);
> +       writel(0x000007FF,  &gpio->gphup);
> +
> +       writel(0x22222222, &gpio->extint0);
> +       writel(0x22222222, &gpio->extint1);
> +       writel(0x22222222, &gpio->extint2);
>
>        /* 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;
> @@ -138,51 +138,52 @@ int dram_init (void)
>  #if defined(CONFIG_CMD_NAND)
>  extern ulong nand_probe(ulong physadr);
>
> -static inline void NF_Reset(void)
> +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_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)
> +static inline void nf_init(void)
>  {
>  #if 1
> -#define TACLS   0
> -#define TWRPH0  3
> -#define TWRPH1  0
> +       #define TACLS   0
> +       #define TWRPH0  3
> +       #define TWRPH1  0
>  #else
> -#define TACLS   0
> -#define TWRPH0  4
> -#define TWRPH1  2
> +       #define TACLS   0
> +       #define TWRPH0  4
> +       #define TWRPH1  2
>  #endif
>
> -       NF_Conf((1<<15)|(0<<14)|(0<<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));
>        /*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_Reset();
> +       nf_reset();
>  }
>
>  void nand_init(void)
>  {
> -       struct s3c2410_nand * const nand = s3c2410_get_base_nand();
> +       struct s3c2410_nand *const nand = s3c2410_get_base_nand();
>
> -       NF_Init();
> +       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
>
>  #ifdef CONFIG_CMD_NET
> -int board_eth_init(bd_t *bis)
> +int board_eth_init(bd_t * bis)
>  {
>        int rc = 0;
>  #ifdef CONFIG_CS8900
> diff --git a/board/trab/cmd_trab.c b/board/trab/cmd_trab.c
> index 472d7d8..867b86d 100644
> --- a/board/trab/cmd_trab.c
> +++ b/board/trab/cmd_trab.c
> @@ -26,6 +26,7 @@
>  #include <common.h>
>  #include <command.h>
>  #include <asm/arch/s3c24x0_cpu.h>
> +#include <asm/io.h>
>  #include <rtc.h>
>
>  /*
> @@ -56,13 +57,13 @@
>  #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 */
> +#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)
> @@ -101,45 +102,44 @@
>  /* 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;
> @@ -152,7 +152,7 @@ u16 act_cycle;
>
>  typedef struct test_function_s {
>        char *name;
> -       int (*pf)(void);
> +       int (*pf) (void);
>  } test_function_t;
>
>  /* max number of Burn In Functions */
> @@ -161,8 +161,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 +171,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 +202,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);
> +                       if ((*test_function[i].pf) () != 0) {
> +                               printf("error in %s test\n",
> +                                      test_function[i].name);
>
>                                /* is it the first error? */
>                                if (status == 0) {
> @@ -217,11 +216,11 @@ int do_burn_in (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
>                                        first_error_cycle = act_cycle;
>
>                                        /* 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);
> +                                       first_error_num = i + 1;
> +                                       strncpy(first_error_name,
> +                                               test_function[i].name,
> +                                               sizeof(first_error_name));
> +                                       led_set(0);
>                                }
>                                cycle_status = 1;
>                        }
> @@ -232,41 +231,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 +271,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 +286,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 +301,22 @@ 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;
>
> @@ -336,75 +325,69 @@ int do_contact_temp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
>                return 1;
>        }
>
> -       tsc2000_spi_init ();
> +       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);
>        }
>        /*
> @@ -456,50 +438,47 @@ static int read_vcc5v (void)
>         * floating point support.  VCC5V is connected over an resistor divider:
>         * VCC5V=ADCval*2,5V/1023*(10K+30K)/10K.
>         */
> -       result = result * 10 * 1000 / 1023; /* result in mV */
> +       result = result * 10 * 1000 / 1023;     /* result in mV */
>
>        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,110 +564,111 @@ 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

ditto

>
> -               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 j = 1000;           /* timeout value for wait loop in us */
>        int result;
>        struct s3c2400_adc *padc;
>
>        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 |= ((channel << 3) | ADC_ENABLE_START);
> +       /* select normal mode */
> +       writel(readl(&padc->adccon) & ~ADC_STDBM, &padc->adccon);
> +       /* clear the channel bits */
> +       writel(readl(&padc->adccon) & ~(0x7 << 3), &padc->adccon);
> +       writel(readl(&padc->adccon) | ((channel << 3) | ADC_ENABLE_START),
> +              &padc->adccon);
>
>        while (j--) {
> -               if ((padc->ADCCON & ADC_ENABLE_START) == 0)
> +               if ((readl(&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 */
> +               /* select standby mode */
> +               writel(readl(&padc->adccon) | ADC_STDBM, &padc->adccon);
>                return -1;
>        }
>
> -       result = padc->ADCDAT & 0x3FF;
> +       result = readl(&padc->adcdat) & 0x3FF;
>
> -       padc->ADCCON |= ADC_STDBM; /* select standby mode */
> +       /* select standby mode */
> +       writel(readl(&padc->adccon) | ADC_STDBM, &padc->adccon);
>
> -       debug ("%s: channel %d, result[DIGIT]=%d\n", __FUNCTION__,
> -              (padc->ADCCON >> 3) & 0x7, result);
> +       debug("%s: channel %d, result[DIGIT]=%d\n", __FUNCTION__,
> +             (readl(&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 */
> +       /* clear prescaler bits */
> +       writel(readl(&padc->adccon) &= ~(0xff << 6), &padc->adccon);
> +       /* set prescaler */
> +       writel(readl(&padc->adccon) | ((65 << 6) | ADC_PRSCEN), &padc->adccon);
>
>        /*
>         * Wait some time to avoid problem with very first call of
> @@ -699,104 +676,99 @@ 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();
> +       struct s3c24x0_gpio *const gpio = s3c24x0_get_base_gpio();
>
> -       led_init ();
> +       led_init();
>
>        switch (state) {
> -       case 0: /* turn LED off */
> -               gpio->PADAT |= (1 << 12);
> +       case 0:         /* turn LED off */
> +               writel(readl(&gpio->padat) | (1 << 12), &gpio->padat);
>                break;
> -       case 1: /* turn LED on */
> -               gpio->PADAT &= ~(1 << 12);
> +       case 1:         /* turn LED on */
> +               writel(readl(&gpio->padat) & ~(1 << 12), &gpio->padat);
>                break;
>        default:
>                break;
>        }
>  }
>
> -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();
> +       struct s3c24x0_gpio *const gpio = s3c24x0_get_base_gpio();
>
>        /* configure GPA12 as output and set to High -> LED off */
> -       gpio->PACON &= ~(1 << 12);
> -       gpio->PADAT |= (1 << 12);
> +       writel(readl(&gpio->pacon) & ~(1 << 12), &gpio->pacon);
> +       writel(readl(&gpio->pacon) | (1 << 12), &gpio->padat);
>  }
>
> -
> -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 */
> -       pass_cycles             = 0;
> -       first_error_cycle       = 0;
> -       first_error_num         = 0;
> -       first_error_name[0]     = '\0';
> -       act_cycle               = 0;
> -       max_cycles              = 0;
> +       status = 1;             /* error */
> +       pass_cycles = 0;
> +       first_error_cycle = 0;
> +       first_error_num = 0;
> +       first_error_name[0] = '\0';
> +       act_cycle = 0;
> +       max_cycles = 0;
>  }
>
> -
> -static void test_function_table_init (void)
> +static void test_function_table_init(void)
>  {
>        int i;
>
> @@ -826,11 +798,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 +813,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 +830,36 @@ 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);
> +               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);
>  #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/rs485.c b/board/trab/rs485.c
> index ad0c136..80fbf26 100644
> --- a/board/trab/rs485.c
> +++ b/board/trab/rs485.c
> @@ -23,13 +23,14 @@
>
>  #include <common.h>
>  #include <asm/arch/s3c24x0_cpu.h>
> +#include <asm/io.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);
> +static void rs485_setbrg(void);
>  #ifdef NOT_USED
>  static void trab_rs485_disable_tx(void);
>  static void trab_rs485_disable_rx(void);
> @@ -40,9 +41,9 @@ static void trab_rs485_disable_rx(void);
>  /* CPLD-Register for controlling TRAB hardware functions */
>  #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);
> +       struct s3c24x0_uart *const uart = s3c24x0_get_base_uart(UART_NR);
>        int i;
>        unsigned int reg = 0;
>
> @@ -51,34 +52,39 @@ static void rs485_setbrg (void)
>        reg = (33000000 / (16 * 38400)) - 1;
>
>        /* FIFO enable, Tx/Rx FIFO clear */
> -       uart->UFCON = 0x07;
> -       uart->UMCON = 0x0;
> +       writel(0x07, &uart->ufcon);
> +       writel(0x0, &uart->umcon);
>        /* Normal,No parity,1 stop,8 bit */
> -       uart->ULCON = 0x3;
> +       writel(0x3, &uart->ulcon);
>        /*
>         * tx=level,rx=edge,disable timeout int.,enable rx error int.,
>         * normal,interrupt or polling
>         */
> -       uart->UCON = 0x245;
> -       uart->UBRDIV = reg;
> +       writel(0x245, &uart->ucon);
> +       writel(reg, &uart->ubrdiv);
>
> -       for (i = 0; i < 100; i++);
> +       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 */
> +       writel(readl(&gpio->pfcon) & ~(0x3 << 2), &gpio->pfcon);
> +       /* configure GPF1 as RXD1 */
> +       writel(readl(&gpio->pfcon) | (0x2 << 2), &gpio->pfcon);
>
> -       gpio->PFCON &= ~(0x3 << 6);
> -       gpio->PFCON |=  (0x2 << 6); /* configure GPF3 as TXD1 */
> +       writel(readl(&gpio->pfcon) & ~(0x3 << 6), &gpio->pfcon);
> +       /* configure GPF3 as TXD1 */
> +       writel(readl(&gpio->pfcon) | (0x2 << 6), &gpio->pfcon);
>
> -       gpio->PFUP |= (1 << 1); /* disable pullup on GPF1 */
> -       gpio->PFUP |= (1 << 3); /* disable pullup on GPF3 */
> +       /* disable pullup on GPF1 */
> +       writel(readl(&gpio->pfup) | (1 << 1), &gpio->pfup);
> +       /* disable pullup on GPF3 */
> +       writel(readl(&gpio->pfup) | (1 << 3), &gpio->pfup);
>
> -       gpio->PACON &= ~(1 << 11); /* set GPA11 (RS485_DE) to output */
> +       /* set GPA11 (RS485_DE) to output */
> +       writel(readl(&gpio->pacon) & ~(1 << 11), &gpio->pacon);
>  }
>
>  /*
> @@ -86,10 +92,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,51 +105,50 @@ 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);
> +       struct s3c24x0_uart *const uart = s3c24x0_get_base_uart(UART_NR);
>
>        /* wait for character to arrive */
> -       while (!(uart->UTRSTAT & 0x1));
> +       while (!(readl(&uart->utrstat) & 0x1)) ;
>
> -       return uart->URXH & 0xff;
> +       return readl(&uart->urxh) & 0xff;
>  }
>
>  /*
>  * 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);
> +       struct s3c24x0_uart *const uart = s3c24x0_get_base_uart(UART_NR);
>
>        /* wait for room in the tx FIFO */
> -       while (!(uart->UTRSTAT & 0x2));
> +       while (!(readl(&uart->utrstat) & 0x2)) ;
>
> -       uart->UTXH = c;
> +       writel(c, &uart->utxh);
>
>        /* 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;
> +       return readl(&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 +162,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;
> @@ -168,16 +173,15 @@ static void set_rs485re(unsigned char rs485re_state)
>
>  static void set_rs485de(unsigned char rs485de_state)
>  {
> -       struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
> +       struct s3c24x0_gpio *const gpio = s3c24x0_get_base_gpio();
>
>        /* This is on PORT A bit 11 */
> -       if(rs485de_state)
> -               gpio->PADAT |= (1 << 11);
> +       if (rs485de_state)
> +               gpio->padat |= (1 << 11);
>        else
> -               gpio->PADAT &= ~(1 << 11);
> +               gpio->padat &= ~(1 << 11);
>  }
>
> -
>  void trab_rs485_enable_tx(void)
>  {
>        set_rs485de(1);
> --
> 1.6.1.2
>
>

Thanks
Minkyu Kang
-- 
from. prom.
www.promsoft.net


More information about the U-Boot mailing list