[flashrom] [PATCH 3/6] changes macros for SSFS and SSFC bits: - introduce mask macros - add comments - change SSFS_CDS to SSFS_FDONE (abbr. used in datasheet not in SSFS but HSFS) - use those for refactoring and magic number elemination. - following patch uses them for pretty printing

Stefan Reinauer stefan.reinauer at coreboot.org
Tue Apr 5 23:43:43 CEST 2011


* Stefan Tauner <stefan.tauner at student.tuwien.ac.at> [110401 14:33]:
> 
> Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
> ---
>  ichspi.c |   56 ++++++++++++++++++++++++++++++++++----------------------
>  1 files changed, 34 insertions(+), 22 deletions(-)
> 
> diff --git a/ichspi.c b/ichspi.c
> index 4e303d7..9491604 100644
> --- a/ichspi.c
> +++ b/ichspi.c
> @@ -43,32 +43,44 @@
>  #include "spi.h"
>  
>  /* ICH9 controller register definition */
> +#define ICH9_REG_FADDR		0x08	/* 32 Bits */
> +#define ICH9_REG_FDATA0		0x10	/* 64 Bytes */
>  
> -#define ICH9_REG_SSFS          0x90	/* 08 Bits */
> -#define SSFS_SCIP		0x00000001
> -#define SSFS_CDS		0x00000004
> -#define SSFS_FCERR		0x00000008
> -#define SSFS_AEL		0x00000010
> +#define ICH9_REG_SSFS		0x90	/* 08 Bits */
> +#define SSFS_SCIP		0x00000001	/* SPI Cycle In Progress */
> +#define SSFS_SCIP_OFF		0
> +#define SSFS_FDONE		0x00000004	/* Cycle Done Status */
> +#define SSFS_FDONE_OFF		2
> +#define SSFS_FCERR		0x00000008	/* Flash Cycle Error */
> +#define SSFS_FCERR_OFF		3
> +#define SSFS_AEL		0x00000010	/* Access Error Log */
> +#define SSFS_AEL_OFF		4

Would be nice to

#define SSFS_AEL        (1 << SSFS_AEL_OFF) 

and so on. If both are needed. It would be nicer to get rid of either.






More information about the flashrom mailing list