[U-Boot] [PATCH V2 3/3] edmini: add IDE support

Prafulla Wadaskar prafulla at marvell.com
Wed Jul 7 10:38:19 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: Tuesday, July 06, 2010 9:29 PM
> To: u-boot at lists.denx.de
> Subject: [U-Boot] [PATCH V2 3/3] edmini: add IDE support
> 
> 
> Signed-off-by: Albert Aribaud <albert.aribaud at free.fr>
> ---
>  board/LaCie/edminiv2/edminiv2.c |   26 ++++++++++++++++++++++++++
>  include/configs/edminiv2.h      |   29 +++++++++++++++++++++++++++--
>  2 files changed, 53 insertions(+), 2 deletions(-)
> 
> diff --git a/board/LaCie/edminiv2/edminiv2.c 
> b/board/LaCie/edminiv2/edminiv2.c
> index 54c0ffe..84375c2 100644
> --- a/board/LaCie/edminiv2/edminiv2.c
> +++ b/board/LaCie/edminiv2/edminiv2.c
> @@ -80,13 +80,39 @@ ulong board_flash_get_legacy(ulong base, 
> int banknum, flash_info_t *info)
>  }
>  #endif				/* CONFIG_SYS_FLASH_CFI */
>  
> +/*
> + * ED Mini V2 uses SATA PORT1. Initialize this port and
> + * disable low power on it.
> + */
> +
> +/* mask for isolating IPM and DET fields in SControl register */
> +#define EDMINIV2_SCONTROL_MASK (ORION5X_SATA_SCONTROL_DET_MASK \
> +	|| ORION5X_SATA_SCONTROL_IMP_MASK)
> +
> +/* IPM and DET values for initializing link */
> +#define EDMINIV2_PORT_INIT (ORION5X_SATA_SCONTROL_DET_INIT \
> +	|| ORION5X_SATA_SCONTROL_IMP_NO_LP_ALLOWED)
> +
> +/* IPM and DET values to use link once initialized */
> +#define EDMINIV2_PORT_USE (ORION5X_SATA_SCONTROL_DET_NONE \
> +	|| ORION5X_SATA_SCONTROL_IMP_NO_LP_ALLOWED)
> +
>  int board_init(void)
>  {
> +	u32 reg;
> +
>  	/* arch number of board */
>  	gd->bd->bi_arch_number = MACH_TYPE_EDMINI_V2;
>  
>  	/* boot parameter start at 256th byte of RAM base */
>  	gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
>  
> +	/* reset port 1 of SATAHC controller */

don't you think it is better to add separate driver for Orion/Kirkwood/Marvell SATAC so that this code and even some configurations can be shared by other boards.
 
> +	reg = readl(ORION5X_SATA_PORT1_SCONTROL_REG);
> +	reg = (reg & ~EDMINIV2_SCONTROL_MASK) | EDMINIV2_PORT_INIT;
> +	writel(reg, ORION5X_SATA_PORT1_SCONTROL_REG);
> +	reg = (reg & ~EDMINIV2_SCONTROL_MASK) | EDMINIV2_PORT_USE;
> +	writel(reg, ORION5X_SATA_PORT1_SCONTROL_REG);

make use of c-structure for registers

> +
>  	return 0;
>  }
> diff --git a/include/configs/edminiv2.h b/include/configs/edminiv2.h
> index c3d95a0..5c328c8 100644
> --- a/include/configs/edminiv2.h
> +++ b/include/configs/edminiv2.h
> @@ -52,6 +52,12 @@
>  #define CONFIG_SYS_HZ		1000
>  
>  /*
> + * __io is necessary for cmd_ide to compile
> + */
> +
> +#define __io
> +
> +/*
>   * Board-specific values for Orion5x MPP low level init:
>   * - MPPs 12 to 15 are SATA LEDs (mode 5)
>   * - Others are GPIO/unused (mode 3 for MPP0, mode 5 for
> @@ -60,7 +66,7 @@
>  
>  #define ORION5X_MPP0_7		0x00000003
>  #define ORION5X_MPP8_15		0x55550000
> -#define ORION5X_MPP16_23	0x00000000
> +#define ORION5X_MPP16_23	0x00005555
>  
>  /*
>   * Board-specific values for Orion5x GPIO low level init:
> @@ -74,7 +80,6 @@
>   */
>  
>  #define ORION5X_GPIO_OUT_ENABLE	0x03fcffff
> -#define ORION5X_GPIO_OUT_VALUE	0x03fcffff
>  
>  /*
>   * NS16550 Configuration
> @@ -131,6 +136,7 @@
>   * Commands configuration - using default command set for now
>   */
>  #include <config_cmd_default.h>
> +
>  /*
>   * Disabling some default commands for staggered bring-up
>   */
> @@ -139,6 +145,25 @@
>  #undef CONFIG_CMD_NFS	/* no NFS since no net */
>  
>  /*
> + * ED Mini has a connector for SATA Port 1
> + */
> +
> +#define CONFIG_CMD_IDE
> +#define CONFIG_DOS_PARTITION
> +#define CONFIG_CMD_EXT2
> +
> +#define CONFIG_LIBATA
> +#define CONFIG_SYS_IDE_MAXBUS		1
> +#define CONFIG_SYS_IDE_MAXDEVICE	1
> +#define CONFIG_SYS_ATA_BASE_ADDR	ORION5X_SATA_BASE
> +#define CONFIG_SYS_ATA_IDE0_OFFSET	ORION5X_SATA_PORT1_OFFSET
> +#define CONFIG_SYS_ATA_DATA_OFFSET	(0x0100)
> +#define CONFIG_SYS_ATA_REG_OFFSET	(0x0100)
> +#define CONFIG_SYS_ATA_ALT_OFFSET	(0x0100)

can you avoid magic numbers, if not some comments please

> +#define CONFIG_SYS_ATA_STRIDE		4
> +#define CONFIG_LBA48
> +
> +/*
>   *  Environment variables configurations
>   */
>  #define CONFIG_ENV_IS_IN_FLASH		1
> -- 
> 1.6.4.4
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
> 


More information about the U-Boot mailing list