[U-Boot] [PATCH-OMAP3 2/2] OMAP3: Convert register access to structure style, part #2

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat Dec 6 18:40:09 CET 2008


> ===================================================================
> --- u-boot-arm.orig/include/asm-arm/arch-omap3/omap3.h
> +++ u-boot-arm/include/asm-arm/arch-omap3/omap3.h
> @@ -75,7 +75,15 @@
>  
>  /* 32KTIMER */
>  #define SYNC_32KTIMER_BASE		0x48320000
> -#define S32K_CR				0x10
> +
> +#ifndef __ASSEMBLY__
> +
> +typedef struct s32ktimer {
> +	unsigned char res[0x10];
> +	unsigned int s32k_cr;		/* 0x10 */
> +} s32ktimer_t;

I'm not a fan of typedef struct
I prefer struct
> +
> +#endif /* __ASSEMBLY__ */
>  
>  /* OMAP3 GPIO registers */
>  #define OMAP34XX_GPIO1_BASE		0x48310000
> @@ -85,9 +93,15 @@
>  #define OMAP34XX_GPIO5_BASE		0x49056000
>  #define OMAP34XX_GPIO6_BASE		0x49058000
>  
> -#define GPIO_OE				0x34
> -#define GPIO_CLEARDATAOUT		0x90
> -#define GPIO_SETDATAOUT			0x94
> +#ifndef __ASSEMBLY__
> +typedef struct gpio {
> +	unsigned char res1[0x34];
> +	unsigned int oe;		/* 0x34 */
> +	unsigned char res2[0x58];
> +	unsigned int cleardataout;	/* 0x90 */
> +	unsigned int setdataout;	/* 0x94 */
> +} gpio_t;
> +#endif /* __ASSEMBLY__ */
>  
>  #define GPIO0				(0x1 << 0)
>  #define GPIO1				(0x1 << 1)
> Index: u-boot-arm/include/asm-arm/arch-omap3/mem.h
> ===================================================================
> --- u-boot-arm.orig/include/asm-arm/arch-omap3/mem.h
> +++ u-boot-arm/include/asm-arm/arch-omap3/mem.h
> @@ -25,18 +25,19 @@
>  #ifndef _MEM_H_
>  #define _MEM_H_
>  
> -#define SDRC_CS0_OSET	0x0
> -#define SDRC_CS1_OSET	0x30 /* mirror CS1 regs appear offset 0x30 from CS0 */
> +//#define SDRC_CS0_OSET	0x0
> +//#define SDRC_CS1_OSET	0x30 /* mirror CS1 regs appear offset 0x30 from CS0 */
please remove if not need
>  
> -#ifndef __ASSEMBLY__
> +#define CS0		0x0
> +#define CS1		0x1 /* mirror CS1 regs appear offset 0x30 from CS0 */
>  
> +#ifndef __ASSEMBLY__
>  typedef enum {
>  	STACKED = 0,
>  	IP_DDR = 1,
>  	COMBO_DDR = 2,
>  	IP_SDR = 3,
>  } mem_t;
> -
>  #endif /* __ASSEMBLY__ */
>  
>  #define EARLY_INIT	1

Best Regards,
J.


More information about the U-Boot mailing list