[U-Boot] U-Boot][PATCH] ARM Clean-up of ARM920T S3C24x0 drivers code

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat Jul 4 12:27:25 CEST 2009


On 20:02 Fri 05 Jun     , kevin.morfitt at fearnside-systems.co.uk wrote:
> This re-formats the S3C24x0 drivers code 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 
> ARM920 S3C24x0 CPU and headers code.
> 
> Signed-off-by: Kevin Morfitt <kevin.morfitt at fearnside-systems.co.uk>
> ---
>  drivers/i2c/s3c24x0_i2c.c       |  269 ++++++++++++++++++++-------------------
>  drivers/mtd/nand/s3c2410_nand.c |   97 +++++++--------
>  drivers/rtc/s3c24x0_rtc.c       |  126 +++++++++---------
>  drivers/serial/serial_s3c24x0.c |  143 ++++++++++++---------
>  4 files changed, 324 insertions(+), 311 deletions(-)
> 
> diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
> index f0c1aa3..33cd3d4 100644
> --- a/drivers/i2c/s3c24x0_i2c.c
> +++ b/drivers/i2c/s3c24x0_i2c.c
> @@ -32,6 +32,8 @@
>  #elif defined(CONFIG_S3C2410)
>  #include <s3c2410.h>
>  #endif
> +
> +#include <asm/io.h>
>  #include <i2c.h>
>  
>  #ifdef CONFIG_HARD_I2C
> @@ -42,36 +44,35 @@
>  #define I2C_OK		0
>  #define I2C_NOK		1
>  #define I2C_NACK	2
> -#define I2C_NOK_LA	3		/* Lost arbitration */
> -#define I2C_NOK_TOUT	4		/* time out */
> -
> -#define I2CSTAT_BSY	0x20		/* Busy bit */
> -#define I2CSTAT_NACK	0x01		/* Nack bit */
> -#define I2CCON_IRPND	0x10		/* Interrupt pending bit */
> -#define I2C_MODE_MT	0xC0		/* Master Transmit Mode */
> -#define I2C_MODE_MR	0x80		/* Master Receive Mode */
> -#define I2C_START_STOP	0x20		/* START / STOP */
> -#define I2C_TXRX_ENA	0x10		/* I2C Tx/Rx enable */
> +#define I2C_NOK_LA	3	/* Lost arbitration */
> +#define I2C_NOK_TOUT	4	/* time out */
>  
> -#define I2C_TIMEOUT 1			/* 1 second */
> +#define I2CSTAT_BSY	0x20	/* Busy bit */
> +#define I2CSTAT_NACK	0x01	/* Nack bit */
> +#define I2CCON_IRPND	0x10	/* Interrupt pending bit */
> +#define I2C_MODE_MT	0xC0	/* Master Transmit Mode */
> +#define I2C_MODE_MR	0x80	/* Master Receive Mode */
> +#define I2C_START_STOP	0x20	/* START / STOP */
> +#define I2C_TXRX_ENA	0x10	/* I2C Tx/Rx enable */
>  
> +#define I2C_TIMEOUT 1		/* 1 second */
>  
>  static int GetI2CSDA(void)
>  {
>  	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
const make not so much sense here
please replace by
type *name

when you are at cleaning it please use lowercase for type and function and
var name
and replace typedef struct by struct
as
struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();

Best Regards,
J.


More information about the U-Boot mailing list