@ -166,16 +166,14 @@ static int do_set_iodelay(u32 base, struct iodelay_cfg_entry const *array,
return 0 ;
return 0 ;
}
}
void __recalibrate_iodelay ( struct pad_conf_entry const * pad , int npads ,
int __recalibrate_iodelay_start ( void )
struct iodelay_cfg_entry const * iodelay ,
int niodelays )
{
{
int ret = 0 ;
int ret = 0 ;
/* IO recalibration should be done only from SRAM */
/* IO recalibration should be done only from SRAM */
if ( OMAP_INIT_CONTEXT_SPL ! = omap_hw_init_context ( ) ) {
if ( OMAP_INIT_CONTEXT_SPL ! = omap_hw_init_context ( ) ) {
puts ( " IODELAY recalibration called from invalid context - use only from SPL in SRAM \n " ) ;
puts ( " IODELAY recalibration called from invalid context - use only from SPL in SRAM \n " ) ;
return ;
return - 1 ;
}
}
/* unlock IODELAY CONFIG registers */
/* unlock IODELAY CONFIG registers */
@ -191,23 +189,27 @@ void __recalibrate_iodelay(struct pad_conf_entry const *pad, int npads,
goto err ;
goto err ;
ret = update_delay_mechanism ( ( * ctrl ) - > iodelay_config_base ) ;
ret = update_delay_mechanism ( ( * ctrl ) - > iodelay_config_base ) ;
if ( ret )
goto err ;
/* Configure Mux settings */
err :
do_set_mux32 ( ( * ctrl ) - > control_padconf_core_base , pad , npads ) ;
return ret ;
}
/* Configure Manual IO timing modes */
void __recalibrate_iodelay_end ( int ret )
ret = do_set_iodelay ( ( * ctrl ) - > iodelay_config_base , iodelay , niodelays ) ;
{
if ( ret )
goto err ;
ret = isolate_io ( DEISOLATE_IO ) ;
/* IO recalibration should be done only from SRAM */
if ( OMAP_INIT_CONTEXT_SPL ! = omap_hw_init_context ( ) ) {
puts ( " IODELAY recalibration called from invalid context - use only from SPL in SRAM \n " ) ;
return ;
}
if ( ! ret )
ret = isolate_io ( DEISOLATE_IO ) ;
err :
/* lock IODELAY CONFIG registers */
/* lock IODELAY CONFIG registers */
writel ( CFG_IODELAY_LOCK_KEY , ( * ctrl ) - > iodelay_config_base +
writel ( CFG_IODELAY_LOCK_KEY , ( * ctrl ) - > iodelay_config_base +
CFG_REG_8_OFFSET ) ;
CFG_REG_8_OFFSET ) ;
/*
/*
* UART cannot be used during IO recalibration sequence as IOs are in
* UART cannot be used during IO recalibration sequence as IOs are in
* isolation . So error handling and debug prints are done after
* isolation . So error handling and debug prints are done after
@ -232,7 +234,41 @@ err:
case ERR_FPDE :
case ERR_FPDE :
puts ( " IODELAY: FPDE calculation failed \n " ) ;
puts ( " IODELAY: FPDE calculation failed \n " ) ;
break ;
break ;
case - 1 :
puts ( " IODELAY: Wrong Context call? \n " ) ;
break ;
default :
default :
debug ( " IODELAY: IO delay recalibration successfully completed \n " ) ;
debug ( " IODELAY: IO delay recalibration successfully completed \n " ) ;
}
}
return ;
}
void __recalibrate_iodelay ( struct pad_conf_entry const * pad , int npads ,
struct iodelay_cfg_entry const * iodelay ,
int niodelays )
{
int ret = 0 ;
/* IO recalibration should be done only from SRAM */
if ( OMAP_INIT_CONTEXT_SPL ! = omap_hw_init_context ( ) ) {
puts ( " IODELAY recalibration called from invalid context - use only from SPL in SRAM \n " ) ;
return ;
}
ret = __recalibrate_iodelay_start ( ) ;
if ( ret )
goto err ;
/* Configure Mux settings */
do_set_mux32 ( ( * ctrl ) - > control_padconf_core_base , pad , npads ) ;
/* Configure Manual IO timing modes */
ret = do_set_iodelay ( ( * ctrl ) - > iodelay_config_base , iodelay , niodelays ) ;
if ( ret )
goto err ;
err :
__recalibrate_iodelay_end ( ret ) ;
}
}