diff options
| author | Pavel Herrmann <morpheus.ibis@gmail.com> | 2012-10-07 05:56:07 +0000 | 
|---|---|---|
| committer | Tom Rini <trini@ti.com> | 2012-10-17 07:59:08 -0700 | 
| commit | e4148c1165d11807e51a9587716e6a513ce1c021 (patch) | |
| tree | e4d17b75584eb122e5ed7a29334a836cbb7d6553 /board/ivm/ivm.c | |
| parent | 8d1165e11a7aad00a2bbb05f20bacf021f6d1c12 (diff) | |
| download | olio-uboot-2014.01-e4148c1165d11807e51a9587716e6a513ce1c021.tar.xz olio-uboot-2014.01-e4148c1165d11807e51a9587716e6a513ce1c021.zip | |
split IVM power hooks from cmd_ide.c
Move power control code from ide_reset() into IVM-specific IDE reset code.
Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
Diffstat (limited to 'board/ivm/ivm.c')
| -rw-r--r-- | board/ivm/ivm.c | 46 | 
1 files changed, 46 insertions, 0 deletions
| diff --git a/board/ivm/ivm.c b/board/ivm/ivm.c index 71d64d434..ab294794b 100644 --- a/board/ivm/ivm.c +++ b/board/ivm/ivm.c @@ -333,13 +333,59 @@ void show_boot_progress (int status)  void ide_set_reset (int on)  {  	volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR; +	int i;  	/*  	 * Configure PC for IDE Reset Pin  	 */  	if (on) {		/* assert RESET */  		immr->im_ioport.iop_pcdat &= ~(CONFIG_SYS_PC_IDE_RESET); + +#ifdef CONFIG_SYS_PB_12V_ENABLE +		/* 12V Enable output OFF */ +		immr->im_cpm.cp_pbdat &= ~(CONFIG_SYS_PB_12V_ENABLE); + +		immr->im_cpm.cp_pbpar &= ~(CONFIG_SYS_PB_12V_ENABLE); +		immr->im_cpm.cp_pbodr &= ~(CONFIG_SYS_PB_12V_ENABLE); +		immr->im_cpm.cp_pbdir |= CONFIG_SYS_PB_12V_ENABLE; + +		/* wait 500 ms for the voltage to stabilize */ +		for (i = 0; i < 500; ++i) +			udelay(1000); +#endif /* CONFIG_SYS_PB_12V_ENABLE */  	} else {		/* release RESET */ +#ifdef CONFIG_SYS_PB_12V_ENABLE +		/* 12V Enable output ON */ +		immr->im_cpm.cp_pbdat |= CONFIG_SYS_PB_12V_ENABLE; +#endif /* CONFIG_SYS_PB_12V_ENABLE */ + +#ifdef CONFIG_SYS_PB_IDE_MOTOR +		/* configure IDE Motor voltage monitor pin as input */ +		immr->im_cpm.cp_pbpar &= ~(CONFIG_SYS_PB_IDE_MOTOR); +		immr->im_cpm.cp_pbodr &= ~(CONFIG_SYS_PB_IDE_MOTOR); +		immr->im_cpm.cp_pbdir &= ~(CONFIG_SYS_PB_IDE_MOTOR); + +/* wait up to 1 s for the motor voltage to stabilize */ +		for (i = 0; i < 1000; ++i) { +			if ((immr->im_cpm.cp_pbdat +					& CONFIG_SYS_PB_IDE_MOTOR) != 0) +				break; +			udelay(1000); +		} + +		if (i == 1000) {	/* Timeout */ +			printf("\nWarning: 5V for IDE Motor missing\n"); +#ifdef CONFIG_STATUS_LED +#ifdef STATUS_LED_YELLOW +			status_led_set(STATUS_LED_YELLOW, STATUS_LED_ON); +#endif +#ifdef STATUS_LED_GREEN +			status_led_set(STATUS_LED_GREEN, STATUS_LED_OFF); +#endif +#endif /* CONFIG_STATUS_LED */ +		} +#endif /* CONFIG_SYS_PB_IDE_MOTOR */ +  		immr->im_ioport.iop_pcdat |= CONFIG_SYS_PC_IDE_RESET;  	} |