@ -178,122 +178,105 @@ int spl_init(void)
return 0 ;
}
void board_init_r ( gd_t * dummy1 , ulong dummy2 )
static int spl_load_image ( u32 boot_device )
{
u32 boot_device ;
debug ( " >>spl:board_init_r() \n " ) ;
# if defined(CONFIG_SYS_SPL_MALLOC_START)
mem_malloc_init ( CONFIG_SYS_SPL_MALLOC_START ,
CONFIG_SYS_SPL_MALLOC_SIZE ) ;
gd - > flags | = GD_FLG_FULL_MALLOC_INIT ;
# endif
if ( ! ( gd - > flags & GD_FLG_SPL_INIT ) ) {
if ( spl_init ( ) )
hang ( ) ;
}
# ifndef CONFIG_PPC
/*
* timer_init ( ) does not exist on PPC systems . The timer is initialized
* and enabled ( decrementer ) in interrupt_init ( ) here .
*/
timer_init ( ) ;
# endif
# ifdef CONFIG_SPL_BOARD_INIT
spl_board_init ( ) ;
# endif
boot_device = spl_boot_device ( ) ;
debug ( " boot device - %d \n " , boot_device ) ;
switch ( boot_device ) {
# ifdef CONFIG_SPL_RAM_DEVICE
case BOOT_DEVICE_RAM :
if ( spl_ram_load_image ( ) )
hang ( ) ;
break ;
return spl_ram_load_image ( ) ;
# endif
# ifdef CONFIG_SPL_MMC_SUPPORT
case BOOT_DEVICE_MMC1 :
case BOOT_DEVICE_MMC2 :
case BOOT_DEVICE_MMC2_2 :
if ( spl_mmc_load_image ( ) )
hang ( ) ;
break ;
return spl_mmc_load_image ( ) ;
# endif
# ifdef CONFIG_SPL_NAND_SUPPORT
case BOOT_DEVICE_NAND :
if ( spl_nand_load_image ( ) )
hang ( ) ;
break ;
return spl_nand_load_image ( ) ;
# endif
# ifdef CONFIG_SPL_ONENAND_SUPPORT
case BOOT_DEVICE_ONENAND :
if ( spl_onenand_load_image ( ) )
hang ( ) ;
break ;
return spl_onenand_load_image ( ) ;
# endif
# ifdef CONFIG_SPL_NOR_SUPPORT
case BOOT_DEVICE_NOR :
if ( spl_nor_load_image ( ) )
hang ( ) ;
break ;
return spl_nor_load_image ( ) ;
# endif
# ifdef CONFIG_SPL_YMODEM_SUPPORT
case BOOT_DEVICE_UART :
if ( spl_ymodem_load_image ( ) )
hang ( ) ;
break ;
return spl_ymodem_load_image ( ) ;
# endif
# ifdef CONFIG_SPL_SPI_SUPPORT
case BOOT_DEVICE_SPI :
if ( spl_spi_load_image ( ) )
hang ( ) ;
break ;
return spl_spi_load_image ( ) ;
# endif
# ifdef CONFIG_SPL_ETH_SUPPORT
case BOOT_DEVICE_CPGMAC :
# ifdef CONFIG_SPL_ETH_DEVICE
if ( spl_net_load_image ( CONFIG_SPL_ETH_DEVICE ) )
hang ( ) ;
return spl_net_load_image ( CONFIG_SPL_ETH_DEVICE ) ;
# else
if ( spl_net_load_image ( NULL ) )
hang ( ) ;
return spl_net_load_image ( NULL ) ;
# endif
break ;
# endif
# ifdef CONFIG_SPL_USBETH_SUPPORT
case BOOT_DEVICE_USBETH :
if ( spl_net_load_image ( " usb_ether " ) )
hang ( ) ;
break ;
return spl_net_load_image ( " usb_ether " ) ;
# endif
# ifdef CONFIG_SPL_USB_SUPPORT
case BOOT_DEVICE_USB :
if ( spl_usb_load_image ( ) )
hang ( ) ;
break ;
return spl_usb_load_image ( ) ;
# endif
# ifdef CONFIG_SPL_SATA_SUPPORT
case BOOT_DEVICE_SATA :
if ( spl_sata_load_image ( ) )
hang ( ) ;
break ;
return spl_sata_load_image ( ) ;
# endif
# ifdef CONFIG_SPL_BOARD_LOAD_IMAGE
case BOOT_DEVICE_BOARD :
if ( spl_board_load_image ( ) )
hang ( ) ;
break ;
return spl_board_load_image ( ) ;
# endif
default :
# if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
puts ( " SPL: Unsupported Boot Device! \n " ) ;
# endif
hang ( ) ;
return - ENODEV ;
}
return - EINVAL ;
}
void board_init_r ( gd_t * dummy1 , ulong dummy2 )
{
u32 boot_device ;
debug ( " >>spl:board_init_r() \n " ) ;
# if defined(CONFIG_SYS_SPL_MALLOC_START)
mem_malloc_init ( CONFIG_SYS_SPL_MALLOC_START ,
CONFIG_SYS_SPL_MALLOC_SIZE ) ;
gd - > flags | = GD_FLG_FULL_MALLOC_INIT ;
# endif
if ( ! ( gd - > flags & GD_FLG_SPL_INIT ) ) {
if ( spl_init ( ) )
hang ( ) ;
}
# ifndef CONFIG_PPC
/*
* timer_init ( ) does not exist on PPC systems . The timer is initialized
* and enabled ( decrementer ) in interrupt_init ( ) here .
*/
timer_init ( ) ;
# endif
# ifdef CONFIG_SPL_BOARD_INIT
spl_board_init ( ) ;
# endif
boot_device = spl_boot_device ( ) ;
debug ( " boot device - %d \n " , boot_device ) ;
if ( spl_load_image ( boot_device ) )
hang ( ) ;
switch ( spl_image . os ) {
case IH_OS_U_BOOT :
debug ( " Jumping to U-Boot \n " ) ;