[U-Boot] [PATCH V7 1/4] ide: add configuration CONFIG_IDE_SWAP_IO

Prafulla Wadaskar prafulla at marvell.com
Thu Aug 5 20:58:13 CEST 2010


 

> -----Original Message-----
> From: u-boot-bounces at lists.denx.de 
> [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Albert Aribaud
> Sent: Thursday, August 05, 2010 6:06 PM
> To: u-boot at lists.denx.de
> Subject: [U-Boot] [PATCH V7 1/4] ide: add configuration 
> CONFIG_IDE_SWAP_IO
> 
> This configuration option replaces a complex conditional
> in cmd_ide.c with an explicit define to be added to SoC or
> board configs.
> 
> Signed-off-by: Albert Aribaud <albert.aribaud at free.fr>
> ---
>  arch/powerpc/include/asm/config.h |    3 +++
>  common/cmd_ide.c                  |   18 +++++++++---------
>  doc/README.PXA_CF                 |    8 ++++++++
>  include/configs/ap325rxa.h        |    1 +
>  include/configs/ms7720se.h        |    1 +
>  include/configs/r2dplus.h         |    1 +
>  include/configs/r7780mp.h         |    1 +
>  7 files changed, 24 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/config.h 
> b/arch/powerpc/include/asm/config.h
> index f70699d..d098657 100644
> --- a/arch/powerpc/include/asm/config.h
> +++ b/arch/powerpc/include/asm/config.h
> @@ -95,4 +95,7 @@
>  #define CONFIG_FSL_LBC
>  #endif
>  
> +/* All PPC boards must swap IDE bytes */
> +#define CONFIG_IDE_SWAP_IO
> +
>  #endif /* _ASM_CONFIG_H_ */
> diff --git a/common/cmd_ide.c b/common/cmd_ide.c
> index c0fb88d..d423e53 100644
> --- a/common/cmd_ide.c
> +++ b/common/cmd_ide.c
> @@ -847,7 +847,7 @@ input_swap_data(int dev, ulong *sect_buf, 
> int words)
>  #endif	/* __LITTLE_ENDIAN || CONFIG_AU1X00 */
>  
>  
> -#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA) || 
> defined(CONFIG_SH)
> +#if defined(CONFIG_IDE_SWAP_IO)
>  static void
>  output_data(int dev, ulong *sect_buf, int words)
>  {
> @@ -891,15 +891,15 @@ output_data(int dev, ulong *sect_buf, int words)
>  	}
>  #endif
>  }
> -#else	/* ! __PPC__ */
> +#else	/* ! CONFIG_IDE_SWAP_IO */
>  static void
>  output_data(int dev, ulong *sect_buf, int words)
>  {
>  	outsw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words<<1);
>  }
> -#endif	/* __PPC__ */
> +#endif	/* CONFIG_IDE_SWAP_IO */
>  
> -#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA) || 
> defined(CONFIG_SH)
> +#if defined(CONFIG_IDE_SWAP_IO)
>  static void
>  input_data(int dev, ulong *sect_buf, int words)
>  {
> @@ -949,14 +949,14 @@ input_data(int dev, ulong *sect_buf, int words)
>  	}
>  #endif
>  }
> -#else	/* ! __PPC__ */
> +#else	/* ! CONFIG_IDE_SWAP_IO */
>  static void
>  input_data(int dev, ulong *sect_buf, int words)
>  {
>  	insw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words << 1);
>  }
>  
> -#endif	/* __PPC__ */
> +#endif	/* CONFIG_IDE_SWAP_IO */
>  
>  /* 
> --------------------------------------------------------------
> -----------
>   */
> @@ -1573,7 +1573,7 @@ int ide_device_present(int dev)
>   * ATAPI Support
>   */
>  
> -#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
> +#if defined(CONFIG_IDE_SWAP_IO)
>  /* since ATAPI may use commands with not 4 bytes alligned length
>   * we have our own transfer functions, 2 bytes alligned */
>  static void
> @@ -1640,7 +1640,7 @@ input_data_shorts(int dev, ushort 
> *sect_buf, int shorts)
>  #endif
>  }
>  
> -#else	/* ! __PPC__ */
> +#else	/* ! CONFIG_IDE_SWAP_IO */
>  static void
>  output_data_shorts(int dev, ushort *sect_buf, int shorts)
>  {
> @@ -1653,7 +1653,7 @@ input_data_shorts(int dev, ushort 
> *sect_buf, int shorts)
>  	insw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, shorts);
>  }
>  
> -#endif	/* __PPC__ */
> +#endif	/* CONFIG_IDE_SWAP_IO */
>  
>  /*
>   * Wait until (Status & mask) == res, or timeout (in ms)
> diff --git a/doc/README.PXA_CF b/doc/README.PXA_CF
> index 6a0f236..1d76b32 100644
> --- a/doc/README.PXA_CF
> +++ b/doc/README.PXA_CF
> @@ -6,6 +6,14 @@ follow the connections of the standard 
> lubbock. Anyway just the block
>  marked memory configuration should be touched since the 
> other parameters
>  are imposed by the PXA architecture.
>  
> +EDIT 2010-07-01: in common/cmd_ide.c, having 
> CONFIG_PXA_PCMCIA defined
> +would cause looping on inw()/outw() rather than using insw()/outsw(),
> +thus making sure IDE / ATA bytes are properly swapped. This behaviour
> +is now controlled by CONFIG_IDE_SWAP_IO, therefore PXA boards with
> +PCMCIA should #define CONFIG_IDE_SWAP_IO.
> +
> +#define CONFIG_IDE_SWAP_IO
> +
>  #define CONFIG_PXA_PCMCIA 1
>  #define CONFIG_PXA_IDE 1
>  
> diff --git a/include/configs/ap325rxa.h b/include/configs/ap325rxa.h
> index 70dd47e..80a5797 100644
> --- a/include/configs/ap325rxa.h
> +++ b/include/configs/ap325rxa.h
> @@ -138,6 +138,7 @@
>  #define CONFIG_SYS_ATA_DATA_OFFSET	0x200	/* data reg offset */
>  #define CONFIG_SYS_ATA_REG_OFFSET	0x200	/* reg offset */
>  #define CONFIG_SYS_ATA_ALT_OFFSET	0x210	/* alternate 
> register offset */
> +#define CONFIG_IDE_SWAP_IO
>  
>  /* if you use all NOR Flash , you change dip-switch. Please 
> see Manual. */
>  #define CONFIG_SYS_MAX_FLASH_BANKS	1
> diff --git a/include/configs/ms7720se.h b/include/configs/ms7720se.h
> index ba0a3f8..0ea3527 100644
> --- a/include/configs/ms7720se.h
> +++ b/include/configs/ms7720se.h
> @@ -122,5 +122,6 @@
>  #define CONFIG_SYS_ATA_DATA_OFFSET	0		/* data 
> reg offset */
>  #define CONFIG_SYS_ATA_REG_OFFSET	0		/* reg offset */
>  #define CONFIG_SYS_ATA_ALT_OFFSET	0x200		/* 
> alternate register offset */
> +#define CONFIG_IDE_SWAP_IO
>  
>  #endif	/* __MS7720SE_H */
> diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h
> index 8931b97..955f3ff 100644
> --- a/include/configs/r2dplus.h
> +++ b/include/configs/r2dplus.h
> @@ -96,6 +96,7 @@
>  #define CONFIG_SYS_ATA_DATA_OFFSET	0x1000	/* data reg offset */
>  #define CONFIG_SYS_ATA_REG_OFFSET	0x1000	/* reg offset */
>  #define CONFIG_SYS_ATA_ALT_OFFSET	0x800	/* alternate 
> register offset */
> +#define CONFIG_IDE_SWAP_IO
>  
>  /*
>   * SuperH PCI Bridge Configration
> diff --git a/include/configs/r7780mp.h b/include/configs/r7780mp.h
> index 71c570e..3afe93a 100644
> --- a/include/configs/r7780mp.h
> +++ b/include/configs/r7780mp.h
> @@ -171,6 +171,7 @@
>  #define CONFIG_SYS_ATA_DATA_OFFSET     0x1000          /* 
> data reg offset */
>  #define CONFIG_SYS_ATA_REG_OFFSET      0x1000          /* 
> reg offset */
>  #define CONFIG_SYS_ATA_ALT_OFFSET      0x800           /* 
> alternate register offset */
> +#define CONFIG_IDE_SWAP_IO
>  #endif /* CONFIG_CMD_IDE */
>  
>  #endif /* __R7780RP_H */
> -- 

Acked-by: Prafulla Wadaskar <prafulla at marvell.com>
Tested-by: Prafulla Wadaskar <prafulla at marvell.com>

Hi Wolfgang,
This is a standalone patch.
I have tested it on Kirkwood platform, but it would be good if someone can test it on PPC boards.

Otherwise there is no harm to pull this patch.

Regards..
Prafulla . .


More information about the U-Boot mailing list