s3c24x0 code style changes
PATCH 3/3 s3c24x0 code style changes
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.
--- board/trab/trab.c | 83 +++-- board/trab/trab_fkt.c | 1055 ++++++++++++++++++++++++------------------------- board/trab/tsc2000.c | 234 ++++++----- board/trab/tsc2000.h | 90 ++--- board/trab/vfd.c | 550 +++++++++++++++----------- 5 files changed, 1038 insertions(+), 974 deletions(-)
board/trab/trab.c +45 -38
@@ -27,6 +27,7 @@#include <netdev.h> #include <malloc.h> #include <asm/arch/s3c24x0_cpu.h> +#include <asm/io.h> #include <command.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -77,36 +78,39 @@ int board_init ()#ifdef CONFIG_TRAB_50MHZ /* change the clock to be 50 MHz 1:1:1 */ /* MDIV:0x5c PDIV:4 SDIV:2 */ - clk_power->MPLLCON =0x5c042 ; - clk_power->CLKDIVN =0 ; +writel (0x5c042 , &clk_power->mpllcon); +writel (0 , &clk_power->clkdivn);#else /* change the clock to be 133 MHz 1:2:4 */ /* MDIV:0x7d PDIV:4 SDIV:1 */ - clk_power->MPLLCON =0x7d041 ; - clk_power->CLKDIVN =3 ; +writel (0x7d041 , &clk_power->mpllcon); +writel (3 , &clk_power->clkdivn);#endif /* set up the I/O ports */ - gpio->PACON =0x3ffff ; - gpio->PBCON =0xaaaaaaaa ; - gpio->PBUP =0xffff ; +writel (0x3ffff , &gpio->pacon); +writel (0xaaaaaaaa , &gpio->pbcon); +writel (0xffff , &gpio->pbup);/* 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 ); +writel ((2 <<0 ) | (2 <<2 ) | (2 <<4 ) | (2 <<6 ) | (2 <<8 ) | (2 <<10 ), + &gpio->pfcon);#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 ); +writel ((1 <<0 ) | (1 <<1 ) | (1 <<2 ) | (1 <<3 ) | (1 <<4 ) | (1 <<5 ), + &gpio->pfup);#else /* do not pull up RXD0, RXD1, TXD0, TXD1 */ - gpio->PFUP = (1 <<0 ) | (1 <<1 ) | (1 <<2 ) | (1 <<3 ); +writel ((1 <<0 ) | (1 <<1 ) | (1 <<2 ) | (1 <<3 ), + &gpio->pfup);#endif - gpio->PGCON =0x0 ; - gpio->PGUP =0x0 ; - gpio->OPENCR=0x0 ; +writel (0x0 , &gpio->pgcon); +writel (0x0 , &gpio->pgup); +writel (0x0 , &gpio->opencr);/* suppress flicker of the VFDs */ - gpio->MISCCR =0x40 ; - gpio->PFCON |= (2 <<12 ); +writel (0x40 , &gpio->misccr); +writel (readl (&gpio->pfcon) | (2 <<12 ), &gpio->pfcon); gd->bd->bi_arch_number =MACH_TYPE_TRAB ;
@@ -114,8 +118,8 @@ int board_init () gd->bd->bi_boot_params =0x0c000100 ;/* Make sure both buzzers are turned off */ - gpio->PDCON |=0x5400 ; - gpio->PDDAT &= ~0xE0 ; +writel (readl (&gpio->pdcon) |0x5400 , &gpio->pdcon); +writel (readl (&gpio->pddat) & ~0xE0 , &gpio->pddat);#ifdef CONFIG_VFD vfd_init_clocks ();
@@ -132,7 +136,7 @@ int board_init ()#ifdef CONFIG_DRIVER_S3C24X0_I2C /* Configure I/O ports PG5 und PG6 for I2C */ - gpio->PGCON = (gpio->PGCON &0x003c00 ) |0x003c00 ; +writel ((readl (&gpio->pgcon) &0x003c00 ) |0x003c00 , &gpio->pgcon);#endif /* CONFIG_DRIVER_S3C24X0_I2C */ return 0 ;
@@ -337,18 +341,18 @@ static int key_pressed(void)#ifdef CONFIG_SYS_BRIGHTNESS -static inline void SET_CS_TOUCH (void ) +static inline void set_cs_touch (void ) {struct s3c24x0_gpio *const gpio =s3c24x0_get_base_gpio (); - gpio->PDDAT &=0x5FF ; +writel (readl (&gpio->pddat) &0x5FF , &gpio->pddat); } -static inline void CLR_CS_TOUCH (void ) +static inline void clr_cs_touch (void ) {struct s3c24x0_gpio *const gpio =s3c24x0_get_base_gpio (); - gpio->PDDAT |=0x200 ; +writel (readl (&gpio->pddat) |0x200 , &gpio->pddat); }static void spi_init (void )
@@ -358,20 +362,23 @@ static void spi_init(void)int i;/* Configure I/O ports. */ - gpio->PDCON = (gpio->PDCON &0xF3FFFF ) |0x040000 ; - gpio->PGCON = (gpio->PGCON &0x0F3FFF ) |0x008000 ; - gpio->PGCON = (gpio->PGCON &0x0CFFFF ) |0x020000 ; - gpio->PGCON = (gpio->PGCON &0x03FFFF ) |0x080000 ; +writel ((readl (&gpio->pdcon) &0xF3FFFF ) |0x040000 , &gpio->pdcon); +writel ((readl (&gpio->pgcon) &0x0F3FFF ) |0x008000 , &gpio->pgcon); +writel ((readl (&gpio->pgcon) &0x0CFFFF ) |0x020000 , &gpio->pgcon); +writel ((readl (&gpio->pgcon) &0x03FFFF ) |0x080000 , &gpio->pgcon); -CLR_CS_TOUCH (); +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 */ +writel (0x1F , &spi->ch[0 ].sppre); +/* SPI-MOSI holds Level after last bit */ +writel (0x01 , &spi->ch[0 ].sppin); +/* Polling, Prescaler, Master, CPOL=0, CPHA=1 */ +writel (0x1A , &spi->ch[0 ].spcon);/* Dummy byte ensures clock to be low. */ for (i =0 ; i <10 ; i++) { - spi->ch[0 ].SPTDAT =0xFF ; +writel (0xFF , &spi->ch[0 ].sptdat); }wait_transmit_done (); }
@@ -380,7 +387,7 @@ 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 */ +while (!(readl (&spi->ch[0 ].spsta) &0x01 ));/* wait until transfer is done */ } static void tsc2000_write(unsigned int page, unsigned int reg,
@@ -389,21 +396,21 @@ static void tsc2000_write(unsigned int page, unsigned int reg,struct s3c24x0_spi *const spi =s3c24x0_get_base_spi ();unsigned int command; -SET_CS_TOUCH (); +set_cs_touch (); command =0x0000 ; command |= (page <<11 ); command |= (reg <<5 ); - spi->ch[0 ].SPTDAT = (command &0xFF00 ) >>8 ; +writel ((command &0xFF00 ) >>8 , &spi->ch[0 ].sptdat);wait_transmit_done (); - spi->ch[0 ].SPTDAT = (command &0x00FF ); +writel (command &0x00FF , &spi->ch[0 ].sptdat);wait_transmit_done (); - spi->ch[0 ].SPTDAT = (data &0xFF00 ) >>8 ; +writel ((data &0xFF00 ) >>8 , &spi->ch[0 ].sptdat);wait_transmit_done (); - spi->ch[0 ].SPTDAT = (data &0x00FF ); +writel (data &0x00FF , &spi->ch[0 ].sptdat);wait_transmit_done (); -CLR_CS_TOUCH (); +clr_cs_touch (); }static void tsc2000_set_brightness (void )
board/trab/trab_fkt.c +512 -543
1,763 lines not on this page · raw message
board/trab/tsc2000.c +125 -109
413 lines not on this page · raw message
board/trab/tsc2000.h +44 -46
120 lines not on this page · raw message
board/trab/vfd.c +312 -238
536 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.6.1.2
Part of the diff is not shown here. View the raw message.
PATCH 3/3 s3c24x0 code style changes
Dear "kevin.morfitt at fearnside-systems.co.uk",
Quoted 3 lines · In message <[email protected]> you wrote:
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.
The commit message should also mention that you convert the code into using accessor functions.
You also perform a white space cleanup here. this may be a good thing (opinions differ), but in any case it is an unrelated change that must be performed in a separate commit.
Note that the same applies to the other two patches.
Please also re-check the resulting code. I think there are some way too long lines, etc.
Best regards,
Wolfgang Denk
Signature · 3 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Quoted 1 line
Is there a way to determine Yesterday's date using Unix utilities?
echo "what is yesterday's date?" | /bin/mail root -- Randal L. Schwartz in <[email protected]>
PATCH 3/3 s3c24x0 code style changes
Quoted 7 lines · Wolfgang Denk
Dear "kevin.morfitt at fearnside-systems.co.uk",
Quoted 3 lines · In message <[email protected]> you wrote:
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.
Quoted 7 lines
The commit message should also mention that you convert the code into using accessor functions.
You also perform a white space cleanup here. this may be a good thing (opinions differ), but in any case it is an unrelated change that must be performed in a separate commit.
All I really wanted to do was change the sc324x0 register struct members to lower case, but if I do that without cleaning up the white space I get checkpatch.pl errors, and if I don't change the code to use the accessor functions the patch will get NAK-ed anyway...and all I really want to do is get the code into a state where I can add support for the Embest SBC244-II Board!
I think I'll split the patches into a white-space change followed by an accessor function/s3c24x0 register change patch.
Quoted 4 lines
Note that the same applies to the other two patches.
Please also re-check the resulting code. I think there are some way too long lines, etc.
checkpatch.pl didn't report any line length errors before I emailed the patches. I'll check it again.
Quoted 5 lines
Best regards,
Wolfgang Denk
PATCH 3/3 s3c24x0 code style changes
Dear Kevin,
Quoted 7 lines · in message <[email protected]> you wrote:
All I really wanted to do was change the sc324x0 register struct members to lower case, but if I do that without cleaning up the white space I get checkpatch.pl errors, and if I don't change the code to use the accessor functions the patch will get NAK-ed anyway...and all I really want to do is get the code into a state where I can add support for the Embest SBC244-II Board!
I understand and appreciate your efforts.
In such a situation it is actually not really important in which order the changes are performend, but they shouldbe separated into orthogonal patches, and these patches submitted as a series.
Quoted 2 lines
I think I'll split the patches into a white-space change followed by an accessor function/s3c24x0 register change patch.
This is indeed the optimal sequence in this situation.
Quoted 5 lines
Quoted 2 lines
Please also re-check the resulting code. I think there are some way too long lines, etc.
checkpatch.pl didn't report any line length errors before I emailed the patches. I'll check it again.
Thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Humans do claim a great deal for that particular emotion (love). -- Spock, "The Lights of Zetar", stardate 5725.6