blob: 06383b51e6553b0aab931cab4f700972e9e52514 [file] [log] [blame]
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001/*
2 * linux/arch/arm/plat-omap/common.c
3 *
4 * Code common to all OMAP machines.
Santosh Shilimkar44169072009-05-28 14:16:04 -07005 * The file is created by Tony Lindgren <tony@atomide.com>
6 *
7 * Copyright (C) 2009 Texas Instruments
8 * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01009 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010014#include <linux/kernel.h>
15#include <linux/init.h>
Russell Kingfced80c2008-09-06 12:10:45 +010016#include <linux/io.h>
Tony Lindgren16edc3d2011-12-06 05:45:37 +010017#include <linux/dma-mapping.h>
Russell King71ee7da2010-05-23 10:18:16 +010018#include <linux/omapfb.h>
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010019
Tony Lindgrence491cf2009-10-20 09:40:47 -070020#include <plat/common.h>
21#include <plat/board.h>
Russell King71ee7da2010-05-23 10:18:16 +010022#include <plat/vram.h>
Felipe Contreras90173882010-10-04 19:09:14 +030023#include <plat/dsp.h>
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010024
Santosh Shilimkar259ee572011-06-06 20:28:23 +053025#include <plat/omap-secure.h>
26
Paul Walmsley44595982008-03-18 10:04:51 +020027
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010028#define NO_LENGTH_CHECK 0xffffffff
29
Uwe Kleine-König119c4c22011-02-09 21:40:09 +010030struct omap_board_config_kernel *omap_board_config __initdata;
Tony Lindgren92105bb2005-09-07 17:20:26 +010031int omap_board_config_size;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010032
Uwe Kleine-König119c4c22011-02-09 21:40:09 +010033static const void *__init get_config(u16 tag, size_t len,
34 int skip, size_t *len_out)
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010035{
36 struct omap_board_config_kernel *kinfo = NULL;
37 int i;
38
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010039 /* Try to find the config from the board-specific structures
40 * in the kernel. */
41 for (i = 0; i < omap_board_config_size; i++) {
42 if (omap_board_config[i].tag == tag) {
Tony Lindgrenc40fae92006-12-07 13:58:10 -080043 if (skip == 0) {
44 kinfo = &omap_board_config[i];
45 break;
46 } else {
47 skip--;
48 }
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010049 }
50 }
51 if (kinfo == NULL)
52 return NULL;
53 return kinfo->data;
54}
55
Uwe Kleine-König2354f642011-02-09 21:40:08 +010056const void *__init __omap_get_config(u16 tag, size_t len, int nr)
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010057{
58 return get_config(tag, len, nr, NULL);
59}
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010060
Uwe Kleine-König2354f642011-02-09 21:40:08 +010061const void *__init omap_get_var_config(u16 tag, size_t *len)
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010062{
63 return get_config(tag, NO_LENGTH_CHECK, 0, len);
64}
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010065
Russell King71ee7da2010-05-23 10:18:16 +010066void __init omap_reserve(void)
67{
Russell King98864ff2010-05-22 23:59:11 +010068 omapfb_reserve_sdram_memblock();
69 omap_vram_reserve_sdram_memblock();
Felipe Contreras90173882010-10-04 19:09:14 +030070 omap_dsp_reserve_sdram_memblock();
Santosh Shilimkar259ee572011-06-06 20:28:23 +053071 omap_secure_ram_reserve_memblock();
Russell King71ee7da2010-05-23 10:18:16 +010072}
Nicolas Pitre71461822011-09-14 17:06:22 -040073
74void __init omap_init_consistent_dma_size(void)
75{
76#ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
77 init_consistent_dma_size(CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE << 20);
78#endif
79}