2005-07-10 22:58:15 +04:00
/*
* linux / arch / arm / plat - omap / common . c
*
* Code common to all OMAP machines .
2009-05-29 01:16:04 +04:00
* The file is created by Tony Lindgren < tony @ atomide . com >
*
* Copyright ( C ) 2009 Texas Instruments
* Added OMAP4 support - Santosh Shilimkar < santosh . shilimkar @ ti . com >
2005-07-10 22:58:15 +04:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation .
*/
# include <linux/kernel.h>
# include <linux/init.h>
2008-09-06 15:10:45 +04:00
# include <linux/io.h>
2011-12-06 08:45:37 +04:00
# include <linux/dma-mapping.h>
2005-07-10 22:58:15 +04:00
2009-10-20 20:40:47 +04:00
# include <plat/common.h>
# include <plat/board.h>
2010-05-23 13:18:16 +04:00
# include <plat/vram.h>
2010-10-04 20:09:14 +04:00
# include <plat/dsp.h>
2012-04-13 16:34:26 +04:00
# include <plat/dma.h>
2005-07-10 22:58:15 +04:00
2011-06-06 18:58:23 +04:00
# include <plat/omap-secure.h>
2008-03-18 11:04:51 +03:00
2005-07-10 22:58:15 +04:00
# define NO_LENGTH_CHECK 0xffffffff
2011-02-09 23:40:09 +03:00
struct omap_board_config_kernel * omap_board_config __initdata ;
2005-09-07 20:20:26 +04:00
int omap_board_config_size ;
2005-07-10 22:58:15 +04:00
2011-02-09 23:40:09 +03:00
static const void * __init get_config ( u16 tag , size_t len ,
int skip , size_t * len_out )
2005-07-10 22:58:15 +04:00
{
struct omap_board_config_kernel * kinfo = NULL ;
int i ;
/* Try to find the config from the board-specific structures
* in the kernel . */
for ( i = 0 ; i < omap_board_config_size ; i + + ) {
if ( omap_board_config [ i ] . tag = = tag ) {
2006-12-08 00:58:10 +03:00
if ( skip = = 0 ) {
kinfo = & omap_board_config [ i ] ;
break ;
} else {
skip - - ;
}
2005-07-10 22:58:15 +04:00
}
}
if ( kinfo = = NULL )
return NULL ;
return kinfo - > data ;
}
2011-02-09 23:40:08 +03:00
const void * __init __omap_get_config ( u16 tag , size_t len , int nr )
2005-07-10 22:58:15 +04:00
{
return get_config ( tag , len , nr , NULL ) ;
}
2011-02-09 23:40:08 +03:00
const void * __init omap_get_var_config ( u16 tag , size_t * len )
2005-07-10 22:58:15 +04:00
{
return get_config ( tag , NO_LENGTH_CHECK , 0 , len ) ;
}
2010-05-23 13:18:16 +04:00
void __init omap_reserve ( void )
{
2010-05-23 02:59:11 +04:00
omap_vram_reserve_sdram_memblock ( ) ;
2010-10-04 20:09:14 +04:00
omap_dsp_reserve_sdram_memblock ( ) ;
2011-06-06 18:58:23 +04:00
omap_secure_ram_reserve_memblock ( ) ;
2012-02-02 18:03:55 +04:00
omap_barrier_reserve_memblock ( ) ;
2010-05-23 13:18:16 +04:00
}
2011-09-15 01:06:22 +04:00
void __init omap_init_consistent_dma_size ( void )
{
# ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
init_consistent_dma_size ( CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE < < 20 ) ;
# endif
}
2012-05-10 19:57:20 +04:00
/*
* Stub function for OMAP2 so that common files
* continue to build when custom builds are used
*/
int __weak omap_secure_ram_reserve_memblock ( void )
{
return 0 ;
}