[PATCH ARM Clean-up of ARM920T S3C24x0 code
This re-formats the S3C24x0 code in cpu/arm920t and the headers to meet the coding style requirements and to make it always use the proper I/O accessor functions when accessing registers. It was done using 'Lindent -kr -i8 -l80' followed by manual inspection of the output. checkpatch.pl reports no problems with the patch and I've run MAKEALL for all ARM9 boards with no problems.
This has been done to create a good starting point for me to add support for a new board, the Embest SBC2440-II. Another patch does the same for the S3C24x0 drivers code.
Signed-off-by Kevin Morfitt <[email protected]>
--- cpu/arm920t/s3c24x0/speed.c | 42 +- cpu/arm920t/s3c24x0/timer.c | 81 ++-- cpu/arm920t/s3c24x0/usb.c | 22 +- cpu/arm920t/start.S | 55 +- include/s3c2400.h | 368 +----------- include/s3c2410.h | 37 +- include/s3c24x0.h | 1422 ++++++++++++++----------------------------- 7 files changed, 603 insertions(+), 1424 deletions(-)
cpu/arm920t/s3c24x0/speed.c +23 -19
@@ -32,6 +32,8 @@#include <common.h> #if defined(CONFIG_S3C2400 ) || defined (CONFIG_S3C2410 ) || defined (CONFIG_TRAB ) +#include <asm/io.h> +#if defined(CONFIG_S3C2400 )#include <s3c2400.h> #elif defined(CONFIG_S3C2410 )
@@ -53,49 +55,51 @@static ulong get_PLLCLK (int pllreg) { -S3C24X0_CLOCK_POWER *const clk_power =S3C24X0_GetBase_CLOCK_POWER (); -ulong r, m, p, s; +S3C24X0_CLOCK_POWER *const clk_power =S3C24X0_GetBase_CLOCK_POWER (); +ulong r, m, p, s; -if (pllreg ==MPLL ) - r = clk_power->MPLLCON; -else if (pllreg ==UPLL ) - r = clk_power->UPLLCON; -else -hang (); +if (pllreg ==MPLL ) + r =readl (&clk_power->MPLLCON); +else if (pllreg ==UPLL ) + r =readl (&clk_power->UPLLCON); +else +hang (); - m = ((r &0xFF000 ) >>12 ) +8 ; - p = ((r &0x003F0 ) >>4 ) +2 ; - s = r &0x3 ; + m = ((r &0xFF000 ) >>12 ) +8 ; + p = ((r &0x003F0 ) >>4 ) +2 ; + s = r &0x3 ; -return ((CONFIG_SYS_CLK_FREQ * m) / (p << s)); +return (CONFIG_SYS_CLK_FREQ * m) / (p << s); }/* return FCLK frequency */ ulong get_FCLK (void ) { -return (get_PLLCLK (MPLL )); +return get_PLLCLK (MPLL ); }/* return HCLK frequency */ ulong get_HCLK (void ) { -S3C24X0_CLOCK_POWER *const clk_power =S3C24X0_GetBase_CLOCK_POWER (); +S3C24X0_CLOCK_POWER *const clk_power =S3C24X0_GetBase_CLOCK_POWER (); -return ((clk_power->CLKDIVN &0x2 ) ?get_FCLK ()/2 :get_FCLK ()); +return (readl (&clk_power->CLKDIVN) &2 ) ?get_FCLK () /2 :get_FCLK (); }/* return PCLK frequency */ ulong get_PCLK (void ) { -S3C24X0_CLOCK_POWER *const clk_power =S3C24X0_GetBase_CLOCK_POWER (); +S3C24X0_CLOCK_POWER *const clk_power =S3C24X0_GetBase_CLOCK_POWER (); -return ((clk_power->CLKDIVN &0x1 ) ?get_HCLK ()/2 :get_HCLK ()); +return (readl (&clk_power->CLKDIVN) &1 ) ?get_HCLK () /2 :get_HCLK (); }/* return UCLK frequency */ ulong get_UCLK (void ) { -return (get_PLLCLK (UPLL )); +return get_PLLCLK (UPLL ); } -#endif /* defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB) */ +#endif /* defined(CONFIG_S3C2400) || +defined (CONFIG_S3C2410) || +defined (CONFIG_TRAB) */
cpu/arm920t/s3c24x0/timer.c +44 -37
191 lines not on this page · raw message
cpu/arm920t/s3c24x0/usb.c +12 -10
@@ -32,9 +32,10 @@# include <s3c2410.h> #endif -int usb_cpu_init (void ) -{ +#include <asm/io.h> +int usb_cpu_init (void ) +{S3C24X0_CLOCK_POWER *const clk_power =S3C24X0_GetBase_CLOCK_POWER ();S3C24X0_GPIO *const gpio =S3C24X0_GetBase_GPIO ();
@@ -42,31 +43,32 @@ int usb_cpu_init (void)* Set the 48 MHz UPLL clocking. Values are taken from * "PLL value selection guide", 6-23, s3c2400_UM.pdf. */ - clk_power->UPLLCON = ((40 <<12 ) + (1 <<4 ) +2 ); - gpio->MISCCR |=0x8 ;/* 1 = use pads related USB for USB host */ +writel ((40 <<12 ) + (1 <<4 ) +2 , &clk_power->UPLLCON); +/* 1 = use pads related USB for USB host */ +writel (readl (&gpio->MISCCR) |0x8 , &gpio->MISCCR);/* * Enable USB host clock. */ - clk_power->CLKCON |= (1 <<4 ); +writel (readl (&clk_power->CLKCON) | (1 <<4 ), &clk_power->CLKCON);return 0 ; } -int usb_cpu_stop (void ) +int usb_cpu_stop (void ) {S3C24X0_CLOCK_POWER *const clk_power =S3C24X0_GetBase_CLOCK_POWER ();/* may not want to do this */ - clk_power->CLKCON &= ~(1 <<4 ); +writel (readl (&clk_power->CLKCON) & ~(1 <<4 ), &clk_power->CLKCON);return 0 ; } -int usb_cpu_init_fail (void ) +int usb_cpu_init_fail (void ) {S3C24X0_CLOCK_POWER *const clk_power =S3C24X0_GetBase_CLOCK_POWER (); - clk_power->CLKCON &= ~(1 <<4 ); +writel (readl (&clk_power->CLKCON) & ~(1 <<4 ), &clk_power->CLKCON);return 0 ; } -# endif /* defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) */ +# endif /* defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) */ #endif /* defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT) */
cpu/arm920t/start.S +29 -26
124 lines not on this page · raw message
include/s3c2400.h +17 -351
430 lines not on this page · raw message
include/s3c2410.h +18 -19
@@ -68,76 +68,75 @@ typedef enum {/* include common stuff */ #include <s3c24x0.h> - -static inline S3C24X0_MEMCTL *S3C24X0_GetBase_MEMCTL (void ) +static inline S3C24X0_MEMCTL *S3C24X0_GetBase_MEMCTL (void ) {return (S3C24X0_MEMCTL *const )S3C24X0_MEMCTL_BASE ; } -static inline S3C24X0_USB_HOST *S3C24X0_GetBase_USB_HOST (void ) +static inline S3C24X0_USB_HOST *S3C24X0_GetBase_USB_HOST (void ) {return (S3C24X0_USB_HOST *const )S3C24X0_USB_HOST_BASE ; } -static inline S3C24X0_INTERRUPT *S3C24X0_GetBase_INTERRUPT (void ) +static inline S3C24X0_INTERRUPT *S3C24X0_GetBase_INTERRUPT (void ) {return (S3C24X0_INTERRUPT *const )S3C24X0_INTERRUPT_BASE ; } -static inline S3C24X0_DMAS *S3C24X0_GetBase_DMAS (void ) +static inline S3C24X0_DMAS *S3C24X0_GetBase_DMAS (void ) {return (S3C24X0_DMAS *const )S3C24X0_DMA_BASE ; } -static inline S3C24X0_CLOCK_POWER *S3C24X0_GetBase_CLOCK_POWER (void ) +static inline S3C24X0_CLOCK_POWER *S3C24X0_GetBase_CLOCK_POWER (void ) {return (S3C24X0_CLOCK_POWER *const )S3C24X0_CLOCK_POWER_BASE ; } -static inline S3C24X0_LCD *S3C24X0_GetBase_LCD (void ) +static inline S3C24X0_LCD *S3C24X0_GetBase_LCD (void ) {return (S3C24X0_LCD *const )S3C24X0_LCD_BASE ; } -static inline S3C2410_NAND *S3C2410_GetBase_NAND (void ) +static inline S3C2410_NAND *S3C2410_GetBase_NAND (void ) {return (S3C2410_NAND *const )S3C2410_NAND_BASE ; } -static inline S3C24X0_UART *S3C24X0_GetBase_UART (S3C24X0_UARTS_NR nr) +static inline S3C24X0_UART *S3C24X0_GetBase_UART (S3C24X0_UARTS_NR nr) {return (S3C24X0_UART *const )(S3C24X0_UART_BASE + (nr *0x4000 )); } -static inline S3C24X0_TIMERS *S3C24X0_GetBase_TIMERS (void ) +static inline S3C24X0_TIMERS *S3C24X0_GetBase_TIMERS (void ) {return (S3C24X0_TIMERS *const )S3C24X0_TIMER_BASE ; } -static inline S3C24X0_USB_DEVICE *S3C24X0_GetBase_USB_DEVICE (void ) +static inline S3C24X0_USB_DEVICE *S3C24X0_GetBase_USB_DEVICE (void ) {return (S3C24X0_USB_DEVICE *const )S3C24X0_USB_DEVICE_BASE ; } -static inline S3C24X0_WATCHDOG *S3C24X0_GetBase_WATCHDOG (void ) +static inline S3C24X0_WATCHDOG *S3C24X0_GetBase_WATCHDOG (void ) {return (S3C24X0_WATCHDOG *const )S3C24X0_WATCHDOG_BASE ; } -static inline S3C24X0_I2C *S3C24X0_GetBase_I2C (void ) +static inline S3C24X0_I2C *S3C24X0_GetBase_I2C (void ) {return (S3C24X0_I2C *const )S3C24X0_I2C_BASE ; } -static inline S3C24X0_I2S *S3C24X0_GetBase_I2S (void ) +static inline S3C24X0_I2S *S3C24X0_GetBase_I2S (void ) {return (S3C24X0_I2S *const )S3C24X0_I2S_BASE ; } -static inline S3C24X0_GPIO *S3C24X0_GetBase_GPIO (void ) +static inline S3C24X0_GPIO *S3C24X0_GetBase_GPIO (void ) {return (S3C24X0_GPIO *const )S3C24X0_GPIO_BASE ; } -static inline S3C24X0_RTC *S3C24X0_GetBase_RTC (void ) +static inline S3C24X0_RTC *S3C24X0_GetBase_RTC (void ) {return (S3C24X0_RTC *const )S3C24X0_RTC_BASE ; } -static inline S3C2410_ADC *S3C2410_GetBase_ADC (void ) +static inline S3C2410_ADC *S3C2410_GetBase_ADC (void ) {return (S3C2410_ADC *const )S3C2410_ADC_BASE ; } -static inline S3C24X0_SPI *S3C24X0_GetBase_SPI (void ) +static inline S3C24X0_SPI *S3C24X0_GetBase_SPI (void ) {return (S3C24X0_SPI *const )S3C24X0_SPI_BASE ; } -static inline S3C2410_SDI *S3C2410_GetBase_SDI (void ) +static inline S3C2410_SDI *S3C2410_GetBase_SDI (void ) {return (S3C2410_SDI *const )S3C2410_SDI_BASE ; }
include/s3c24x0.h +460 -962
1,563 lines not on this page · raw message
-- 1.6.0.6